@basemaps/lambda-tiler 6.29.0 → 6.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (144) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/build/__tests__/config.data.d.ts +6 -0
  3. package/build/__tests__/config.data.d.ts.map +1 -0
  4. package/build/__tests__/config.data.js +81 -0
  5. package/build/__tests__/config.data.js.map +1 -0
  6. package/build/__tests__/index.test.js +4 -3
  7. package/build/__tests__/index.test.js.map +1 -0
  8. package/build/__tests__/route.test.js +1 -0
  9. package/build/__tests__/route.test.js.map +1 -0
  10. package/build/__tests__/tiff.cache.test.js +1 -0
  11. package/build/__tests__/tiff.cache.test.js.map +1 -0
  12. package/build/__tests__/tile.cache.key.test.js +1 -0
  13. package/build/__tests__/tile.cache.key.test.js.map +1 -0
  14. package/build/__tests__/tile.set.cache.test.js +2 -53
  15. package/build/__tests__/tile.set.cache.test.js.map +1 -0
  16. package/build/__tests__/tile.set.test.js +1 -0
  17. package/build/__tests__/tile.set.test.js.map +1 -0
  18. package/build/__tests__/tile.style.json.test.js +1 -0
  19. package/build/__tests__/tile.style.json.test.js.map +1 -0
  20. package/build/__tests__/wmts.capability.test.d.ts +1 -1
  21. package/build/__tests__/wmts.capability.test.d.ts.map +1 -1
  22. package/build/__tests__/wmts.capability.test.js +207 -128
  23. package/build/__tests__/wmts.capability.test.js.map +1 -0
  24. package/build/__tests__/xyz.test.js +6 -37
  25. package/build/__tests__/xyz.test.js.map +1 -0
  26. package/build/__tests__/xyz.util.d.ts +0 -2
  27. package/build/__tests__/xyz.util.d.ts.map +1 -1
  28. package/build/__tests__/xyz.util.js +7 -29
  29. package/build/__tests__/xyz.util.js.map +1 -0
  30. package/build/api.key.js +1 -0
  31. package/build/api.key.js.map +1 -0
  32. package/build/cli/dump.js +1 -0
  33. package/build/cli/dump.js.map +1 -0
  34. package/build/cli/tile.set.local.js +1 -0
  35. package/build/cli/tile.set.local.js.map +1 -0
  36. package/build/cotar.cache.d.ts +25 -0
  37. package/build/cotar.cache.d.ts.map +1 -0
  38. package/build/cotar.cache.js +50 -0
  39. package/build/cotar.cache.js.map +1 -0
  40. package/build/index.d.ts.map +1 -1
  41. package/build/index.js +31 -35
  42. package/build/index.js.map +1 -0
  43. package/build/router.js +1 -0
  44. package/build/router.js.map +1 -0
  45. package/build/routes/__tests__/attribution.test.js +5 -3
  46. package/build/routes/__tests__/attribution.test.js.map +1 -0
  47. package/build/routes/__tests__/fonts.test.js +9 -1
  48. package/build/routes/__tests__/fonts.test.js.map +1 -0
  49. package/build/routes/__tests__/health.test.js +1 -0
  50. package/build/routes/__tests__/health.test.js.map +1 -0
  51. package/build/routes/__tests__/imagery.test.js +1 -0
  52. package/build/routes/__tests__/imagery.test.js.map +1 -0
  53. package/build/routes/__tests__/memory.fs.js +1 -0
  54. package/build/routes/__tests__/memory.fs.js.map +1 -0
  55. package/build/routes/__tests__/sprites.test.js +1 -0
  56. package/build/routes/__tests__/sprites.test.js.map +1 -0
  57. package/build/routes/__tests__/wmts.test.js +59 -10
  58. package/build/routes/__tests__/wmts.test.js.map +1 -0
  59. package/build/routes/api.d.ts +0 -1
  60. package/build/routes/api.d.ts.map +1 -1
  61. package/build/routes/api.js +1 -3
  62. package/build/routes/api.js.map +1 -0
  63. package/build/routes/attribution.js +1 -0
  64. package/build/routes/attribution.js.map +1 -0
  65. package/build/routes/esri/rest.js +1 -0
  66. package/build/routes/esri/rest.js.map +1 -0
  67. package/build/routes/fonts.d.ts.map +1 -1
  68. package/build/routes/fonts.js +9 -1
  69. package/build/routes/fonts.js.map +1 -0
  70. package/build/routes/health.js +1 -0
  71. package/build/routes/health.js.map +1 -0
  72. package/build/routes/imagery.d.ts +8 -1
  73. package/build/routes/imagery.d.ts.map +1 -1
  74. package/build/routes/imagery.js +6 -7
  75. package/build/routes/imagery.js.map +1 -0
  76. package/build/routes/response.js +1 -0
  77. package/build/routes/response.js.map +1 -0
  78. package/build/routes/sprites.d.ts.map +1 -1
  79. package/build/routes/sprites.js +8 -14
  80. package/build/routes/sprites.js.map +1 -0
  81. package/build/routes/tile.etag.js +1 -0
  82. package/build/routes/tile.etag.js.map +1 -0
  83. package/build/routes/tile.js +1 -0
  84. package/build/routes/tile.js.map +1 -0
  85. package/build/routes/tile.json.d.ts.map +1 -1
  86. package/build/routes/tile.json.js +2 -2
  87. package/build/routes/tile.json.js.map +1 -0
  88. package/build/routes/tile.style.json.js +1 -0
  89. package/build/routes/tile.style.json.js.map +1 -0
  90. package/build/routes/tile.wmts.d.ts.map +1 -1
  91. package/build/routes/tile.wmts.js +19 -23
  92. package/build/routes/tile.wmts.js.map +1 -0
  93. package/build/routes/tile.xyz.js +1 -0
  94. package/build/routes/tile.xyz.js.map +1 -0
  95. package/build/source.tracer.js +1 -0
  96. package/build/source.tracer.js.map +1 -0
  97. package/build/tiff.cache.js +1 -0
  98. package/build/tiff.cache.js.map +1 -0
  99. package/build/tile.set.cache.d.ts +0 -1
  100. package/build/tile.set.cache.d.ts.map +1 -1
  101. package/build/tile.set.cache.js +1 -29
  102. package/build/tile.set.cache.js.map +1 -0
  103. package/build/tile.set.js +1 -0
  104. package/build/tile.set.js.map +1 -0
  105. package/build/tile.set.raster.d.ts.map +1 -1
  106. package/build/tile.set.raster.js +6 -3
  107. package/build/tile.set.raster.js.map +1 -0
  108. package/build/tile.set.vector.d.ts +0 -7
  109. package/build/tile.set.vector.d.ts.map +1 -1
  110. package/build/tile.set.vector.js +3 -20
  111. package/build/tile.set.vector.js.map +1 -0
  112. package/build/validate.js +1 -0
  113. package/build/validate.js.map +1 -0
  114. package/build/wmts.capability.d.ts +26 -12
  115. package/build/wmts.capability.d.ts.map +1 -1
  116. package/build/wmts.capability.js +136 -51
  117. package/build/wmts.capability.js.map +1 -0
  118. package/dist/index.js +86 -72
  119. package/dist/node_modules/.package-lock.json +1 -1
  120. package/dist/package-lock.json +2 -2
  121. package/dist/package.json +1 -1
  122. package/package.json +7 -7
  123. package/src/__tests__/config.data.ts +82 -0
  124. package/src/__tests__/index.test.ts +3 -3
  125. package/src/__tests__/tile.set.cache.test.ts +1 -67
  126. package/src/__tests__/wmts.capability.test.ts +224 -154
  127. package/src/__tests__/xyz.test.ts +5 -49
  128. package/src/__tests__/xyz.util.ts +6 -31
  129. package/src/cotar.cache.ts +54 -0
  130. package/src/index.ts +30 -33
  131. package/src/routes/__tests__/attribution.test.ts +4 -4
  132. package/src/routes/__tests__/fonts.test.ts +10 -1
  133. package/src/routes/__tests__/wmts.test.ts +75 -15
  134. package/src/routes/api.ts +0 -4
  135. package/src/routes/fonts.ts +9 -1
  136. package/src/routes/imagery.ts +9 -7
  137. package/src/routes/sprites.ts +7 -15
  138. package/src/routes/tile.json.ts +1 -2
  139. package/src/routes/tile.wmts.ts +20 -22
  140. package/src/tile.set.cache.ts +1 -28
  141. package/src/tile.set.raster.ts +4 -2
  142. package/src/tile.set.vector.ts +3 -21
  143. package/src/wmts.capability.ts +143 -58
  144. package/tsconfig.tsbuildinfo +1 -1
package/dist/index.js CHANGED
@@ -1,40 +1,51 @@
1
- var Hw=Object.create;var La=Object.defineProperty;var Gw=Object.getOwnPropertyDescriptor;var Vw=Object.getOwnPropertyNames;var Kw=Object.getPrototypeOf,Yw=Object.prototype.hasOwnProperty;var Zw=(t,e,r)=>e in t?La(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var Da=(t,e)=>()=>(t&&(e=t(t=0)),e);var ee=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),op=(t,e)=>{for(var r in e)La(t,r,{get:e[r],enumerable:!0})},ap=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Vw(e))!Yw.call(t,n)&&n!==r&&La(t,n,{get:()=>e[n],enumerable:!(i=Gw(e,n))||i.enumerable});return t};var ve=(t,e,r)=>(r=t!=null?Hw(Kw(t)):{},ap(e||!t||!t.__esModule?La(r,"default",{value:t,enumerable:!0}):r,t)),Xw=t=>ap(La({},"__esModule",{value:!0}),t);var vf=(t,e,r)=>(Zw(t,typeof e!="symbol"?e+"":e,r),r),lp=(t,e,r)=>{if(!e.has(t))throw TypeError("Cannot "+r)};var ke=(t,e,r)=>(lp(t,e,"read from private field"),r?r.call(t):e.get(t)),Ct=(t,e,r)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,r)},it=(t,e,r,i)=>(lp(t,e,"write to private field"),i?i.call(t,r):e.set(t,r),r),wf=(t,e,r,i)=>({set _(n){it(t,e,n,r)},get _(){return ke(t,e,i)}});var fp=ee((b3,cp)=>{"use strict";cp.exports=hp;var{toString:Jw}=Object.prototype,_f=Symbol("circular-ref-tag"),Sf=Symbol("pino-raw-err-ref"),up=Object.create({},{type:{enumerable:!0,writable:!0,value:void 0},message:{enumerable:!0,writable:!0,value:void 0},stack:{enumerable:!0,writable:!0,value:void 0},raw:{enumerable:!1,get:function(){return this[Sf]},set:function(t){this[Sf]=t}}});Object.defineProperty(up,Sf,{writable:!0,value:{}});function hp(t){if(!(t instanceof Error))return t;t[_f]=void 0;let e=Object.create(up);e.type=Jw.call(t.constructor)==="[object Function]"?t.constructor.name:t.name,e.message=t.message,e.stack=t.stack;for(let r in t)if(e[r]===void 0){let i=t[r];i instanceof Error?i.hasOwnProperty(_f)||(e[r]=hp(i)):e[r]=i}return delete t[_f],e.raw=t,e}});var gp=ee((v3,pp)=>{"use strict";pp.exports={mapHttpRequest:Qw,reqSerializer:mp};var xf=Symbol("pino-raw-req-ref"),dp=Object.create({},{id:{enumerable:!0,writable:!0,value:""},method:{enumerable:!0,writable:!0,value:""},url:{enumerable:!0,writable:!0,value:""},query:{enumerable:!0,writable:!0,value:""},params:{enumerable:!0,writable:!0,value:""},headers:{enumerable:!0,writable:!0,value:{}},remoteAddress:{enumerable:!0,writable:!0,value:""},remotePort:{enumerable:!0,writable:!0,value:""},raw:{enumerable:!1,get:function(){return this[xf]},set:function(t){this[xf]=t}}});Object.defineProperty(dp,xf,{writable:!0,value:{}});function mp(t){let e=t.info||t.socket,r=Object.create(dp);return r.id=typeof t.id=="function"?t.id():t.id||(t.info?t.info.id:void 0),r.method=t.method,t.originalUrl?(r.url=t.originalUrl,r.query=t.query,r.params=t.params):r.url=t.path||(t.url?t.url.path||t.url:void 0),r.headers=t.headers,r.remoteAddress=e&&e.remoteAddress,r.remotePort=e&&e.remotePort,r.raw=t.raw||t,r}function Qw(t){return{req:mp(t)}}});var wp=ee((w3,vp)=>{"use strict";vp.exports={mapHttpResponse:e_,resSerializer:bp};var Ef=Symbol("pino-raw-res-ref"),yp=Object.create({},{statusCode:{enumerable:!0,writable:!0,value:0},headers:{enumerable:!0,writable:!0,value:""},raw:{enumerable:!1,get:function(){return this[Ef]},set:function(t){this[Ef]=t}}});Object.defineProperty(yp,Ef,{writable:!0,value:{}});function bp(t){let e=Object.create(yp);return e.statusCode=t.statusCode,e.headers=t.getHeaders?t.getHeaders():t._headers,e.raw=t,e}function e_(t){return{res:bp(t)}}});var Rf=ee((_3,_p)=>{"use strict";var Mf=fp(),Mu=gp(),Ru=wp();_p.exports={err:Mf,mapHttpRequest:Mu.mapHttpRequest,mapHttpResponse:Ru.mapHttpResponse,req:Mu.reqSerializer,res:Ru.resSerializer,wrapErrorSerializer:function(e){return e===Mf?e:function(i){return e(Mf(i))}},wrapRequestSerializer:function(e){return e===Mu.reqSerializer?e:function(i){return e(Mu.reqSerializer(i))}},wrapResponseSerializer:function(e){return e===Ru.resSerializer?e:function(i){return e(Ru.resSerializer(i))}}}});var Cf=ee((S3,Sp)=>{"use strict";function t_(t,e){return e}Sp.exports=function(){let e=Error.prepareStackTrace;Error.prepareStackTrace=t_;let r=new Error().stack;if(Error.prepareStackTrace=e,!Array.isArray(r))return;let i=r.slice(2),n=[];for(let o of i)!o||n.push(o.getFileName());return n}});var Ep=ee((x3,xp)=>{"use strict";var{createContext:r_,runInContext:i_}=require("vm");xp.exports=n_;function n_(t={}){let{ERR_PATHS_MUST_BE_STRINGS:e=()=>"fast-redact - Paths must be (non-empty) strings",ERR_INVALID_PATH:r=i=>`fast-redact \u2013 Invalid path (${i})`}=t;return function({paths:n}){n.forEach(o=>{if(typeof o!="string")throw Error(e());try{if(/〇/.test(o))throw Error();let a=new Proxy({},{get:()=>a,set:()=>{throw Error()}}),h=(o[0]==="["?"":".")+o.replace(/^\*/,"\u3007").replace(/\.\*/g,".\u3007").replace(/\[\*\]/g,"[\u3007]");if(/\n|\r|;/.test(h)||/\/\*/.test(h))throw Error();i_(`
1
+ var Og=Object.create;var za=Object.defineProperty;var Lg=Object.getOwnPropertyDescriptor;var Ng=Object.getOwnPropertyNames;var Dg=Object.getPrototypeOf,Bg=Object.prototype.hasOwnProperty;var zg=(t,e,r)=>e in t?za(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var ja=(t,e)=>()=>(t&&(e=t(t=0)),e);var H=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),t2=(t,e)=>{for(var r in e)za(t,r,{get:e[r],enumerable:!0})},r2=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Ng(e))!Bg.call(t,n)&&n!==r&&za(t,n,{get:()=>e[n],enumerable:!(i=Lg(e,n))||i.enumerable});return t};var fe=(t,e,r)=>(r=t!=null?Og(Dg(t)):{},r2(e||!t||!t.__esModule?za(r,"default",{value:t,enumerable:!0}):r,t)),jg=t=>r2(za({},"__esModule",{value:!0}),t);var $h=(t,e,r)=>(zg(t,typeof e!="symbol"?e+"":e,r),r),i2=(t,e,r)=>{if(!e.has(t))throw TypeError("Cannot "+r)};var Me=(t,e,r)=>(i2(t,e,"read from private field"),r?r.call(t):e.get(t)),yt=(t,e,r)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,r)},Ze=(t,e,r,i)=>(i2(t,e,"write to private field"),i?i.call(t,r):e.set(t,r),r),Wh=(t,e,r,i)=>({set _(n){Ze(t,e,n,r)},get _(){return Me(t,e,i)}});var a2=H(jl=>{"use strict";Object.defineProperty(jl,"__esModule",{value:!0});jl.Nztm2000Quad=void 0;jl.Nztm2000Quad={type:"TileMatrixSetType",title:"LINZ NZTM2000 Map Tile Grid V2",abstract:"",identifier:"NZTM2000Quad",supportedCRS:"https://www.opengis.net/def/crs/EPSG/0/2193",boundingBox:{type:"BoundingBoxType",crs:"https://www.opengis.net/def/crs/EPSG/0/2193",lowerCorner:[419435.9938,-32605867284e-4],upperCorner:[104381901652e-4,6758167443e-3]},tileMatrix:[{type:"TileMatrixType",identifier:"0",scaleDenominator:139770566007179e-6,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:1,matrixHeight:1},{type:"TileMatrixType",identifier:"1",scaleDenominator:698852830035895e-7,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:2,matrixHeight:2},{type:"TileMatrixType",identifier:"2",scaleDenominator:3494264150179475e-8,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:4,matrixHeight:4},{type:"TileMatrixType",identifier:"3",scaleDenominator:17471320750897374e-9,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:8,matrixHeight:8},{type:"TileMatrixType",identifier:"4",scaleDenominator:8735660375448687e-9,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:16,matrixHeight:16},{type:"TileMatrixType",identifier:"5",scaleDenominator:4.3678301877243435e6,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:32,matrixHeight:32},{type:"TileMatrixType",identifier:"6",scaleDenominator:2.1839150938621718e6,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:64,matrixHeight:64},{type:"TileMatrixType",identifier:"7",scaleDenominator:1.0919575469310859e6,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:128,matrixHeight:128},{type:"TileMatrixType",identifier:"8",scaleDenominator:545978.7734655429,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:256,matrixHeight:256},{type:"TileMatrixType",identifier:"9",scaleDenominator:272989.38673277147,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:512,matrixHeight:512},{type:"TileMatrixType",identifier:"10",scaleDenominator:136494.69336638573,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:1024,matrixHeight:1024},{type:"TileMatrixType",identifier:"11",scaleDenominator:68247.34668319287,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:2048,matrixHeight:2048},{type:"TileMatrixType",identifier:"12",scaleDenominator:34123.67334159643,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:4096,matrixHeight:4096},{type:"TileMatrixType",identifier:"13",scaleDenominator:17061.836670798217,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:8192,matrixHeight:8192},{type:"TileMatrixType",identifier:"14",scaleDenominator:8530.918335399108,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:16384,matrixHeight:16384},{type:"TileMatrixType",identifier:"15",scaleDenominator:4265.459167699554,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:32768,matrixHeight:32768},{type:"TileMatrixType",identifier:"16",scaleDenominator:2132.729583849777,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:65536,matrixHeight:65536},{type:"TileMatrixType",identifier:"17",scaleDenominator:1066.3647919248886,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:131072,matrixHeight:131072},{type:"TileMatrixType",identifier:"18",scaleDenominator:533.1823959624443,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:262144,matrixHeight:262144},{type:"TileMatrixType",identifier:"19",scaleDenominator:266.59119798122214,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:524288,matrixHeight:524288},{type:"TileMatrixType",identifier:"20",scaleDenominator:133.29559899061107,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:1048576,matrixHeight:1048576},{type:"TileMatrixType",identifier:"21",scaleDenominator:66.64779949530553,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:2097152,matrixHeight:2097152}]}});var l2=H(ql=>{"use strict";Object.defineProperty(ql,"__esModule",{value:!0});ql.Nztm2000=void 0;ql.Nztm2000={type:"TileMatrixSetType",title:"LINZ NZTM2000 Map Tile Grid",abstract:"See https://www.linz.govt.nz/data/linz-data-service/guides-and-documentation/nztm2000-map-tile-service-schema",identifier:"NZTM2000",supportedCRS:"https://www.opengis.net/def/crs/EPSG/0/2193",boundingBox:{type:"BoundingBoxType",crs:"https://www.opengis.net/def/crs/EPSG/0/2193",lowerCorner:[3087e3,274e3],upperCorner:[7173e3,3327e3]},tileMatrix:[{type:"TileMatrixType",identifier:"0",scaleDenominator:32e6,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:2,matrixHeight:4},{type:"TileMatrixType",identifier:"1",scaleDenominator:16e6,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:4,matrixHeight:8},{type:"TileMatrixType",identifier:"2",scaleDenominator:8e6,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:8,matrixHeight:16},{type:"TileMatrixType",identifier:"3",scaleDenominator:4e6,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:16,matrixHeight:32},{type:"TileMatrixType",identifier:"4",scaleDenominator:2e6,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:32,matrixHeight:64},{type:"TileMatrixType",identifier:"5",scaleDenominator:1e6,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:64,matrixHeight:128},{type:"TileMatrixType",identifier:"6",scaleDenominator:5e5,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:128,matrixHeight:256},{type:"TileMatrixType",identifier:"7",scaleDenominator:25e4,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:256,matrixHeight:512},{type:"TileMatrixType",identifier:"8",scaleDenominator:1e5,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:640,matrixHeight:1280},{type:"TileMatrixType",identifier:"9",scaleDenominator:5e4,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:1280,matrixHeight:2560},{type:"TileMatrixType",identifier:"10",scaleDenominator:25e3,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:2560,matrixHeight:5120},{type:"TileMatrixType",identifier:"11",scaleDenominator:1e4,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:6400,matrixHeight:12800},{type:"TileMatrixType",identifier:"12",scaleDenominator:5e3,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:12800,matrixHeight:25600},{type:"TileMatrixType",identifier:"13",scaleDenominator:2500,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:25600,matrixHeight:51200},{type:"TileMatrixType",identifier:"14",scaleDenominator:1e3,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:64e3,matrixHeight:128e3},{type:"TileMatrixType",identifier:"15",scaleDenominator:500,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:128e3,matrixHeight:256e3},{type:"TileMatrixType",identifier:"16",scaleDenominator:250,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:256e3,matrixHeight:512e3}]}});var u2=H(no=>{"use strict";Object.defineProperty(no,"__esModule",{value:!0});no.Nztm2000=no.Nztm2000Quad=void 0;var Wg=a2();Object.defineProperty(no,"Nztm2000Quad",{enumerable:!0,get:function(){return Wg.Nztm2000Quad}});var Fg=l2();Object.defineProperty(no,"Nztm2000",{enumerable:!0,get:function(){return Fg.Nztm2000}})});var Zn=H((Wl,c2)=>{(function(t,e){typeof Wl=="object"&&typeof c2<"u"?e(Wl):typeof define=="function"&&define.amd?define(["exports"],e):e(t.ULID={})})(Wl,function(t){"use strict";function e(C){var T=new Error(C);return T.source="ulid",T}var r="0123456789ABCDEFGHJKMNPQRSTVWXYZ",i=r.length,n=Math.pow(2,48)-1,s=10,a=16;function c(C,T,O){return T>C.length-1?C:C.substr(0,T)+O+C.substr(T+1)}function d(C){for(var T=void 0,O=C.length,B=void 0,z=void 0,G=i-1;!T&&O-->=0;){if(B=C[O],z=r.indexOf(B),z===-1)throw e("incorrectly encoded string");if(z===G){C=c(C,O,r[0]);continue}T=c(C,O,r[z+1])}if(typeof T=="string")return T;throw e("cannot increment this string")}function p(C){var T=Math.floor(C()*i);return T===i&&(T=i-1),r.charAt(T)}function m(C,T){if(isNaN(C))throw new Error(C+" must be a number");if(C>n)throw e("cannot encode time greater than "+n);if(C<0)throw e("time must be positive");if(Number.isInteger(C)===!1)throw e("time must be an integer");for(var O=void 0,B="";T>0;T--)O=C%i,B=r.charAt(O)+B,C=(C-O)/i;return B}function w(C,T){for(var O="";C>0;C--)O=p(T)+O;return O}function S(C){if(C.length!==s+a)throw e("malformed ulid");var T=C.substr(0,s).split("").reverse().reduce(function(O,B,z){var G=r.indexOf(B);if(G===-1)throw e("invalid character found: "+B);return O+=G*Math.pow(i,z)},0);if(T>n)throw e("malformed ulid, timestamp too large");return T}function v(){var C=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,T=arguments[1];T||(T=typeof window<"u"?window:null);var O=T&&(T.crypto||T.msCrypto);if(O)return function(){var z=new Uint8Array(1);return O.getRandomValues(z),z[0]/255};try{var B=require("crypto");return function(){return B.randomBytes(1).readUInt8()/255}}catch{}if(C){try{console.error("secure crypto unusable, falling back to insecure Math.random()!")}catch{}return function(){return Math.random()}}throw e("secure crypto unusable, insecure Math.random not allowed")}function R(C){return C||(C=v()),function(O){return isNaN(O)&&(O=Date.now()),m(O,s)+w(a,C)}}function x(C){C||(C=v());var T=0,O=void 0;return function(z){if(isNaN(z)&&(z=Date.now()),z<=T){var G=O=d(O);return m(T,s)+G}T=z;var te=O=w(a,C);return m(z,s)+te}}var A=R();t.replaceCharAt=c,t.incrementBase32=d,t.randomChar=p,t.encodeTime=m,t.encodeRandom=w,t.decodeTime=S,t.detectPrng=v,t.factory=R,t.monotonicFactory=x,t.ulid=A,Object.defineProperty(t,"__esModule",{value:!0})})});var y2=H((Kl,g2)=>{(function(t,e){typeof Kl=="object"&&typeof g2<"u"?e(Kl):typeof define=="function"&&define.amd?define(["exports"],e):(t=typeof globalThis<"u"?globalThis:t||self,e(t.WebStreamsPolyfill={}))})(Kl,function(t){"use strict";let e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol:l=>`Symbol(${l})`;function r(){}function i(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global}let n=i();function s(l){return typeof l=="object"&&l!==null||typeof l=="function"}let a=r,c=Promise,d=Promise.prototype.then,p=Promise.resolve.bind(c),m=Promise.reject.bind(c);function w(l){return new c(l)}function S(l){return p(l)}function v(l){return m(l)}function R(l,f,b){return d.call(l,f,b)}function x(l,f,b){R(R(l,f,b),void 0,a)}function A(l,f){x(l,f)}function C(l,f){x(l,void 0,f)}function T(l,f,b){return R(l,f,b)}function O(l){R(l,void 0,a)}let B=(()=>{let l=n&&n.queueMicrotask;if(typeof l=="function")return l;let f=S(void 0);return b=>R(f,b)})();function z(l,f,b){if(typeof l!="function")throw new TypeError("Argument is not a function");return Function.prototype.apply.call(l,f,b)}function G(l,f,b){try{return S(z(l,f,b))}catch(I){return v(I)}}let te=16384;class se{constructor(){this._cursor=0,this._size=0,this._front={_elements:[],_next:void 0},this._back=this._front,this._cursor=0,this._size=0}get length(){return this._size}push(f){let b=this._back,I=b;b._elements.length===te-1&&(I={_elements:[],_next:void 0}),b._elements.push(f),I!==b&&(this._back=I,b._next=I),++this._size}shift(){let f=this._front,b=f,I=this._cursor,L=I+1,j=f._elements,$=j[I];return L===te&&(b=f._next,L=0),--this._size,this._cursor=L,f!==b&&(this._front=b),j[I]=void 0,$}forEach(f){let b=this._cursor,I=this._front,L=I._elements;for(;(b!==L.length||I._next!==void 0)&&!(b===L.length&&(I=I._next,L=I._elements,b=0,L.length===0));)f(L[b]),++b}peek(){let f=this._front,b=this._cursor;return f._elements[b]}}function ke(l,f){l._ownerReadableStream=f,f._reader=l,f._state==="readable"?ot(l):f._state==="closed"?Fr(l):Rt(l,f._storedError)}function De(l,f){let b=l._ownerReadableStream;return Qt(b,f)}function Pe(l){l._ownerReadableStream._state==="readable"?Kt(l,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")):Nc(l,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")),l._ownerReadableStream._reader=void 0,l._ownerReadableStream=void 0}function We(l){return new TypeError("Cannot "+l+" a stream using a released reader")}function ot(l){l._closedPromise=w((f,b)=>{l._closedPromise_resolve=f,l._closedPromise_reject=b})}function Rt(l,f){ot(l),Kt(l,f)}function Fr(l){ot(l),na(l)}function Kt(l,f){l._closedPromise_reject!==void 0&&(O(l._closedPromise),l._closedPromise_reject(f),l._closedPromise_resolve=void 0,l._closedPromise_reject=void 0)}function Nc(l,f){Rt(l,f)}function na(l){l._closedPromise_resolve!==void 0&&(l._closedPromise_resolve(void 0),l._closedPromise_resolve=void 0,l._closedPromise_reject=void 0)}let vi=e("[[AbortSteps]]"),N1=e("[[ErrorSteps]]"),sa=e("[[CancelSteps]]"),Zt=e("[[PullSteps]]"),D1=Number.isFinite||function(l){return typeof l=="number"&&isFinite(l)},B1=Math.trunc||function(l){return l<0?Math.ceil(l):Math.floor(l)};function dt(l){return typeof l=="object"||typeof l=="function"}function Pr(l,f){if(l!==void 0&&!dt(l))throw new TypeError(`${f} is not an object.`)}function Jt(l,f){if(typeof l!="function")throw new TypeError(`${f} is not a function.`)}function Dc(l){return typeof l=="object"&&l!==null||typeof l=="function"}function z1(l,f){if(!Dc(l))throw new TypeError(`${f} is not an object.`)}function Tr(l,f,b){if(l===void 0)throw new TypeError(`Parameter ${f} is required in '${b}'.`)}function oa(l,f,b){if(l===void 0)throw new TypeError(`${f} is required in '${b}'.`)}function aa(l){return Number(l)}function j1(l){return l===0?0:l}function Bc(l){return j1(B1(l))}function la(l,f){let I=Number.MAX_SAFE_INTEGER,L=Number(l);if(L=j1(L),!D1(L))throw new TypeError(`${f} is not a finite number`);if(L=Bc(L),L<0||L>I)throw new TypeError(`${f} is outside the accepted range of ${0} to ${I}, inclusive`);return!D1(L)||L===0?0:L}function Nt(l,f){if(!Qr(l))throw new TypeError(`${f} is not a ReadableStream.`)}function fr(l){return new An(l)}function Z(l,f){l._reader._readRequests.push(f)}function Ct(l,f,b){let L=l._reader._readRequests.shift();b?L._closeSteps():L._chunkSteps(f)}function Hr(l){return l._reader._readRequests.length}function q1(l){let f=l._reader;return!(f===void 0||!Gr(f))}class An{constructor(f){if(Tr(f,1,"ReadableStreamDefaultReader"),Nt(f,"First parameter"),ei(f))throw new TypeError("This stream has already been locked for exclusive reading by another reader");ke(this,f),this._readRequests=new se}get closed(){return Gr(this)?this._closedPromise:v(Cs("closed"))}cancel(f=void 0){return Gr(this)?this._ownerReadableStream===void 0?v(We("cancel")):De(this,f):v(Cs("cancel"))}read(){if(!Gr(this))return v(Cs("read"));if(this._ownerReadableStream===void 0)return v(We("read from"));let f,b,I=w((j,$)=>{f=j,b=$});return Pn(this,{_chunkSteps:j=>f({value:j,done:!1}),_closeSteps:()=>f({value:void 0,done:!0}),_errorSteps:j=>b(j)}),I}releaseLock(){if(!Gr(this))throw Cs("releaseLock");if(this._ownerReadableStream!==void 0){if(this._readRequests.length>0)throw new TypeError("Tried to release a reader lock when that reader has pending read() calls un-settled");Pe(this)}}}Object.defineProperties(An.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(An.prototype,e.toStringTag,{value:"ReadableStreamDefaultReader",configurable:!0});function Gr(l){return!s(l)||!Object.prototype.hasOwnProperty.call(l,"_readRequests")?!1:l instanceof An}function Pn(l,f){let b=l._ownerReadableStream;b._disturbed=!0,b._state==="closed"?f._closeSteps():b._state==="errored"?f._errorSteps(b._storedError):b._readableStreamController[Zt](f)}function Cs(l){return new TypeError(`ReadableStreamDefaultReader.prototype.${l} can only be used on a ReadableStreamDefaultReader`)}let U1=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype);class ua{constructor(f,b){this._ongoingPromise=void 0,this._isFinished=!1,this._reader=f,this._preventCancel=b}next(){let f=()=>this._nextSteps();return this._ongoingPromise=this._ongoingPromise?T(this._ongoingPromise,f,f):f(),this._ongoingPromise}return(f){let b=()=>this._returnSteps(f);return this._ongoingPromise?T(this._ongoingPromise,b,b):b()}_nextSteps(){if(this._isFinished)return Promise.resolve({value:void 0,done:!0});let f=this._reader;if(f._ownerReadableStream===void 0)return v(We("iterate"));let b,I,L=w(($,ee)=>{b=$,I=ee});return Pn(f,{_chunkSteps:$=>{this._ongoingPromise=void 0,B(()=>b({value:$,done:!1}))},_closeSteps:()=>{this._ongoingPromise=void 0,this._isFinished=!0,Pe(f),b({value:void 0,done:!0})},_errorSteps:$=>{this._ongoingPromise=void 0,this._isFinished=!0,Pe(f),I($)}}),L}_returnSteps(f){if(this._isFinished)return Promise.resolve({value:f,done:!0});this._isFinished=!0;let b=this._reader;if(b._ownerReadableStream===void 0)return v(We("finish iterating"));if(!this._preventCancel){let I=De(b,f);return Pe(b),T(I,()=>({value:f,done:!0}))}return Pe(b),S({value:f,done:!0})}}let $1={next(){return W1(this)?this._asyncIteratorImpl.next():v(Tn("next"))},return(l){return W1(this)?this._asyncIteratorImpl.return(l):v(Tn("return"))}};U1!==void 0&&Object.setPrototypeOf($1,U1);function zc(l,f){let b=fr(l),I=new ua(b,f),L=Object.create($1);return L._asyncIteratorImpl=I,L}function W1(l){if(!s(l)||!Object.prototype.hasOwnProperty.call(l,"_asyncIteratorImpl"))return!1;try{return l._asyncIteratorImpl instanceof ua}catch{return!1}}function Tn(l){return new TypeError(`ReadableStreamAsyncIterator.${l} can only be used on a ReadableSteamAsyncIterator`)}let In=Number.isNaN||function(l){return l!==l};function Wi(l){return l.slice()}function F1(l,f,b,I,L){new Uint8Array(l).set(new Uint8Array(b,I,L),f)}function Yd(l){return l}function As(l){return!1}function le(l,f,b){if(l.slice)return l.slice(f,b);let I=b-f,L=new ArrayBuffer(I);return F1(L,0,l,f,I),L}function jc(l){return!(typeof l!="number"||In(l)||l<0)}function H1(l){let f=le(l.buffer,l.byteOffset,l.byteOffset+l.byteLength);return new Uint8Array(f)}function ca(l){let f=l._queue.shift();return l._queueTotalSize-=f.size,l._queueTotalSize<0&&(l._queueTotalSize=0),f.value}function Qe(l,f,b){if(!jc(b)||b===1/0)throw new RangeError("Size must be a finite, non-NaN, non-negative number.");l._queue.push({value:f,size:b}),l._queueTotalSize+=b}function qc(l){return l._queue.peek().value}function at(l){l._queue=new se,l._queueTotalSize=0}class kn{constructor(){throw new TypeError("Illegal constructor")}get view(){if(!ha(this))throw wa("view");return this._view}respond(f){if(!ha(this))throw wa("respond");if(Tr(f,1,"respond"),f=la(f,"First parameter"),this._associatedReadableByteStreamController===void 0)throw new TypeError("This BYOB request has been invalidated");As(this._view.buffer),Dn(this._associatedReadableByteStreamController,f)}respondWithNewView(f){if(!ha(this))throw wa("respondWithNewView");if(Tr(f,1,"respondWithNewView"),!ArrayBuffer.isView(f))throw new TypeError("You can only respond with array buffer views");if(this._associatedReadableByteStreamController===void 0)throw new TypeError("This BYOB request has been invalidated");As(f.buffer),Ps(this._associatedReadableByteStreamController,f)}}Object.defineProperties(kn.prototype,{respond:{enumerable:!0},respondWithNewView:{enumerable:!0},view:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(kn.prototype,e.toStringTag,{value:"ReadableStreamBYOBRequest",configurable:!0});class wi{constructor(){throw new TypeError("Illegal constructor")}get byobRequest(){if(!Vr(this))throw xi("byobRequest");return Si(this)}get desiredSize(){if(!Vr(this))throw xi("desiredSize");return J1(this)}close(){if(!Vr(this))throw xi("close");if(this._closeRequested)throw new TypeError("The stream has already been closed; do not close it again!");let f=this._controlledReadableByteStream._state;if(f!=="readable")throw new TypeError(`The stream (in ${f} state) is not in the readable state and cannot be closed`);nt(this)}enqueue(f){if(!Vr(this))throw xi("enqueue");if(Tr(f,1,"enqueue"),!ArrayBuffer.isView(f))throw new TypeError("chunk must be an array buffer view");if(f.byteLength===0)throw new TypeError("chunk must have non-zero byteLength");if(f.buffer.byteLength===0)throw new TypeError("chunk's buffer must have non-zero byteLength");if(this._closeRequested)throw new TypeError("stream is closed or draining");let b=this._controlledReadableByteStream._state;if(b!=="readable")throw new TypeError(`The stream (in ${b} state) is not in the readable state and cannot be enqueued to`);pt(this,f)}error(f=void 0){if(!Vr(this))throw xi("error");mt(this,f)}[sa](f){On(this),at(this);let b=this._cancelAlgorithm(f);return Ir(this),b}[Zt](f){let b=this._controlledReadableByteStream;if(this._queueTotalSize>0){let L=this._queue.shift();this._queueTotalSize-=L.byteLength,V1(this);let j=new Uint8Array(L.buffer,L.byteOffset,L.byteLength);f._chunkSteps(j);return}let I=this._autoAllocateChunkSize;if(I!==void 0){let L;try{L=new ArrayBuffer(I)}catch($){f._errorSteps($);return}let j={buffer:L,bufferByteLength:I,byteOffset:0,byteLength:I,bytesFilled:0,elementSize:1,viewConstructor:Uint8Array,readerType:"default"};this._pendingPullIntos.push(j)}Z(b,f),_i(this)}}Object.defineProperties(wi.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},byobRequest:{enumerable:!0},desiredSize:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(wi.prototype,e.toStringTag,{value:"ReadableByteStreamController",configurable:!0});function Vr(l){return!s(l)||!Object.prototype.hasOwnProperty.call(l,"_controlledReadableByteStream")?!1:l instanceof wi}function ha(l){return!s(l)||!Object.prototype.hasOwnProperty.call(l,"_associatedReadableByteStreamController")?!1:l instanceof kn}function _i(l){if(!Z1(l))return;if(l._pulling){l._pullAgain=!0;return}l._pulling=!0;let b=l._pullAlgorithm();x(b,()=>{l._pulling=!1,l._pullAgain&&(l._pullAgain=!1,_i(l))},I=>{mt(l,I)})}function On(l){Fi(l),l._pendingPullIntos=new se}function fa(l,f){let b=!1;l._state==="closed"&&(b=!0);let I=da(f);f.readerType==="default"?Ct(l,I,b):Uc(l,I,b)}function da(l){let f=l.bytesFilled,b=l.elementSize;return new l.viewConstructor(l.buffer,l.byteOffset,f/b)}function Ln(l,f,b,I){l._queue.push({buffer:f,byteOffset:b,byteLength:I}),l._queueTotalSize+=I}function G1(l,f){let b=f.elementSize,I=f.bytesFilled-f.bytesFilled%b,L=Math.min(l._queueTotalSize,f.byteLength-f.bytesFilled),j=f.bytesFilled+L,$=j-j%b,ee=L,ce=!1;$>I&&(ee=$-f.bytesFilled,ce=!0);let ve=l._queue;for(;ee>0;){let Ce=ve.peek(),Ae=Math.min(ee,Ce.byteLength),et=f.byteOffset+f.bytesFilled;F1(f.buffer,et,Ce.buffer,Ce.byteOffset,Ae),Ce.byteLength===Ae?ve.shift():(Ce.byteOffset+=Ae,Ce.byteLength-=Ae),l._queueTotalSize-=Ae,pa(l,Ae,f),ee-=Ae}return ce}function pa(l,f,b){b.bytesFilled+=f}function V1(l){l._queueTotalSize===0&&l._closeRequested?(Ir(l),Fn(l._controlledReadableByteStream)):_i(l)}function Fi(l){l._byobRequest!==null&&(l._byobRequest._associatedReadableByteStreamController=void 0,l._byobRequest._view=null,l._byobRequest=null)}function ma(l){for(;l._pendingPullIntos.length>0;){if(l._queueTotalSize===0)return;let f=l._pendingPullIntos.peek();G1(l,f)&&(Nn(l),fa(l._controlledReadableByteStream,f))}}function ga(l,f,b){let I=l._controlledReadableByteStream,L=1;f.constructor!==DataView&&(L=f.constructor.BYTES_PER_ELEMENT);let j=f.constructor,$=f.buffer,ee={buffer:$,bufferByteLength:$.byteLength,byteOffset:f.byteOffset,byteLength:f.byteLength,bytesFilled:0,elementSize:L,viewConstructor:j,readerType:"byob"};if(l._pendingPullIntos.length>0){l._pendingPullIntos.push(ee),Q1(I,b);return}if(I._state==="closed"){let ce=new j(ee.buffer,ee.byteOffset,0);b._closeSteps(ce);return}if(l._queueTotalSize>0){if(G1(l,ee)){let ce=da(ee);V1(l),b._chunkSteps(ce);return}if(l._closeRequested){let ce=new TypeError("Insufficient bytes to fill elements in the given buffer");mt(l,ce),b._errorSteps(ce);return}}l._pendingPullIntos.push(ee),Q1(I,b),_i(l)}function K1(l,f){let b=l._controlledReadableByteStream;if(Sa(b))for(;_a(b)>0;){let I=Nn(l);fa(b,I)}}function Dt(l,f,b){if(pa(l,f,b),b.bytesFilled<b.elementSize)return;Nn(l);let I=b.bytesFilled%b.elementSize;if(I>0){let L=b.byteOffset+b.bytesFilled,j=le(b.buffer,L-I,L);Ln(l,j,0,j.byteLength)}b.bytesFilled-=I,fa(l._controlledReadableByteStream,b),ma(l)}function ya(l,f){let b=l._pendingPullIntos.peek();Fi(l),l._controlledReadableByteStream._state==="closed"?K1(l):Dt(l,f,b),_i(l)}function Nn(l){return l._pendingPullIntos.shift()}function Z1(l){let f=l._controlledReadableByteStream;return f._state!=="readable"||l._closeRequested||!l._started?!1:!!(q1(f)&&Hr(f)>0||Sa(f)&&_a(f)>0||J1(l)>0)}function Ir(l){l._pullAlgorithm=void 0,l._cancelAlgorithm=void 0}function nt(l){let f=l._controlledReadableByteStream;if(!(l._closeRequested||f._state!=="readable")){if(l._queueTotalSize>0){l._closeRequested=!0;return}if(l._pendingPullIntos.length>0&&l._pendingPullIntos.peek().bytesFilled>0){let I=new TypeError("Insufficient bytes to fill elements in the given buffer");throw mt(l,I),I}Ir(l),Fn(f)}}function pt(l,f){let b=l._controlledReadableByteStream;if(l._closeRequested||b._state!=="readable")return;let I=f.buffer,L=f.byteOffset,j=f.byteLength,$=I;if(l._pendingPullIntos.length>0){let ee=l._pendingPullIntos.peek();As(ee.buffer),ee.buffer=ee.buffer}if(Fi(l),q1(b))if(Hr(b)===0)Ln(l,$,L,j);else{l._pendingPullIntos.length>0&&Nn(l);let ee=new Uint8Array($,L,j);Ct(b,ee,!1)}else Sa(b)?(Ln(l,$,L,j),ma(l)):Ln(l,$,L,j);_i(l)}function mt(l,f){let b=l._controlledReadableByteStream;b._state==="readable"&&(On(l),at(l),Ir(l),Sl(b,f))}function Si(l){if(l._byobRequest===null&&l._pendingPullIntos.length>0){let f=l._pendingPullIntos.peek(),b=new Uint8Array(f.buffer,f.byteOffset+f.bytesFilled,f.byteLength-f.bytesFilled),I=Object.create(kn.prototype);Y1(I,l,b),l._byobRequest=I}return l._byobRequest}function J1(l){let f=l._controlledReadableByteStream._state;return f==="errored"?null:f==="closed"?0:l._strategyHWM-l._queueTotalSize}function Dn(l,f){let b=l._pendingPullIntos.peek();if(l._controlledReadableByteStream._state==="closed"){if(f!==0)throw new TypeError("bytesWritten must be 0 when calling respond() on a closed stream")}else{if(f===0)throw new TypeError("bytesWritten must be greater than 0 when calling respond() on a readable stream");if(b.bytesFilled+f>b.byteLength)throw new RangeError("bytesWritten out of range")}b.buffer=b.buffer,ya(l,f)}function Ps(l,f){let b=l._pendingPullIntos.peek();if(l._controlledReadableByteStream._state==="closed"){if(f.byteLength!==0)throw new TypeError("The view's length must be 0 when calling respondWithNewView() on a closed stream")}else if(f.byteLength===0)throw new TypeError("The view's length must be greater than 0 when calling respondWithNewView() on a readable stream");if(b.byteOffset+b.bytesFilled!==f.byteOffset)throw new RangeError("The region specified by view does not match byobRequest");if(b.bufferByteLength!==f.buffer.byteLength)throw new RangeError("The buffer of view has different capacity than byobRequest");if(b.bytesFilled+f.byteLength>b.byteLength)throw new RangeError("The region specified by view is larger than byobRequest");let L=f.byteLength;b.buffer=f.buffer,ya(l,L)}function ba(l,f,b,I,L,j,$){f._controlledReadableByteStream=l,f._pullAgain=!1,f._pulling=!1,f._byobRequest=null,f._queue=f._queueTotalSize=void 0,at(f),f._closeRequested=!1,f._started=!1,f._strategyHWM=j,f._pullAlgorithm=I,f._cancelAlgorithm=L,f._autoAllocateChunkSize=$,f._pendingPullIntos=new se,l._readableStreamController=f;let ee=b();x(S(ee),()=>{f._started=!0,_i(f)},ce=>{mt(f,ce)})}function va(l,f,b){let I=Object.create(wi.prototype),L=()=>{},j=()=>S(void 0),$=()=>S(void 0);f.start!==void 0&&(L=()=>f.start(I)),f.pull!==void 0&&(j=()=>f.pull(I)),f.cancel!==void 0&&($=ce=>f.cancel(ce));let ee=f.autoAllocateChunkSize;if(ee===0)throw new TypeError("autoAllocateChunkSize must be greater than 0");ba(l,I,L,j,$,b,ee)}function Y1(l,f,b){l._associatedReadableByteStreamController=f,l._view=b}function wa(l){return new TypeError(`ReadableStreamBYOBRequest.prototype.${l} can only be used on a ReadableStreamBYOBRequest`)}function xi(l){return new TypeError(`ReadableByteStreamController.prototype.${l} can only be used on a ReadableByteStreamController`)}function X1(l){return new Hi(l)}function Q1(l,f){l._reader._readIntoRequests.push(f)}function Uc(l,f,b){let L=l._reader._readIntoRequests.shift();b?L._closeSteps(f):L._chunkSteps(f)}function _a(l){return l._reader._readIntoRequests.length}function Sa(l){let f=l._reader;return!(f===void 0||!Mi(f))}class Hi{constructor(f){if(Tr(f,1,"ReadableStreamBYOBReader"),Nt(f,"First parameter"),ei(f))throw new TypeError("This stream has already been locked for exclusive reading by another reader");if(!Vr(f._readableStreamController))throw new TypeError("Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte source");ke(this,f),this._readIntoRequests=new se}get closed(){return Mi(this)?this._closedPromise:v(Ts("closed"))}cancel(f=void 0){return Mi(this)?this._ownerReadableStream===void 0?v(We("cancel")):De(this,f):v(Ts("cancel"))}read(f){if(!Mi(this))return v(Ts("read"));if(!ArrayBuffer.isView(f))return v(new TypeError("view must be an array buffer view"));if(f.byteLength===0)return v(new TypeError("view must have non-zero byteLength"));if(f.buffer.byteLength===0)return v(new TypeError("view's buffer must have non-zero byteLength"));if(As(f.buffer),this._ownerReadableStream===void 0)return v(We("read from"));let b,I,L=w(($,ee)=>{b=$,I=ee});return el(this,f,{_chunkSteps:$=>b({value:$,done:!1}),_closeSteps:$=>b({value:$,done:!0}),_errorSteps:$=>I($)}),L}releaseLock(){if(!Mi(this))throw Ts("releaseLock");if(this._ownerReadableStream!==void 0){if(this._readIntoRequests.length>0)throw new TypeError("Tried to release a reader lock when that reader has pending read() calls un-settled");Pe(this)}}}Object.defineProperties(Hi.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(Hi.prototype,e.toStringTag,{value:"ReadableStreamBYOBReader",configurable:!0});function Mi(l){return!s(l)||!Object.prototype.hasOwnProperty.call(l,"_readIntoRequests")?!1:l instanceof Hi}function el(l,f,b){let I=l._ownerReadableStream;I._disturbed=!0,I._state==="errored"?b._errorSteps(I._storedError):ga(I._readableStreamController,f,b)}function Ts(l){return new TypeError(`ReadableStreamBYOBReader.prototype.${l} can only be used on a ReadableStreamBYOBReader`)}function dr(l,f){let{highWaterMark:b}=l;if(b===void 0)return f;if(In(b)||b<0)throw new RangeError("Invalid highWaterMark");return b}function Is(l){let{size:f}=l;return f||(()=>1)}function ks(l,f){Pr(l,f);let b=l?.highWaterMark,I=l?.size;return{highWaterMark:b===void 0?void 0:aa(b),size:I===void 0?void 0:tl(I,`${f} has member 'size' that`)}}function tl(l,f){return Jt(l,f),b=>aa(l(b))}function rl(l,f){Pr(l,f);let b=l?.abort,I=l?.close,L=l?.start,j=l?.type,$=l?.write;return{abort:b===void 0?void 0:il(b,l,`${f} has member 'abort' that`),close:I===void 0?void 0:$c(I,l,`${f} has member 'close' that`),start:L===void 0?void 0:Wc(L,l,`${f} has member 'start' that`),write:$===void 0?void 0:Fc($,l,`${f} has member 'write' that`),type:j}}function il(l,f,b){return Jt(l,b),I=>G(l,f,[I])}function $c(l,f,b){return Jt(l,b),()=>G(l,f,[])}function Wc(l,f,b){return Jt(l,b),I=>z(l,f,[I])}function Fc(l,f,b){return Jt(l,b),(I,L)=>G(l,f,[I,L])}function nl(l,f){if(!Vi(l))throw new TypeError(`${f} is not a WritableStream.`)}function Hc(l){if(typeof l!="object"||l===null)return!1;try{return typeof l.aborted=="boolean"}catch{return!1}}let Gc=typeof AbortController=="function";function Vc(){if(Gc)return new AbortController}class Gi{constructor(f={},b={}){f===void 0?f=null:z1(f,"First parameter");let I=ks(b,"Second parameter"),L=rl(f,"First parameter");if(xa(this),L.type!==void 0)throw new RangeError("Invalid type is specified");let $=Is(I),ee=dr(I,1);sh(this,L,ee,$)}get locked(){if(!Vi(this))throw zs("locked");return Ki(this)}abort(f=void 0){return Vi(this)?Ki(this)?v(new TypeError("Cannot abort a stream that already has a writer")):Os(this,f):v(zs("abort"))}close(){return Vi(this)?Ki(this)?v(new TypeError("Cannot close a stream that already has a writer")):Yt(this)?v(new TypeError("Cannot close an already-closing stream")):sl(this):v(zs("close"))}getWriter(){if(!Vi(this))throw zs("getWriter");return Bn(this)}}Object.defineProperties(Gi.prototype,{abort:{enumerable:!0},close:{enumerable:!0},getWriter:{enumerable:!0},locked:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(Gi.prototype,e.toStringTag,{value:"WritableStream",configurable:!0});function Bn(l){return new zn(l)}function Kc(l,f,b,I,L=1,j=()=>1){let $=Object.create(Gi.prototype);xa($);let ee=Object.create(Kr.prototype);return hl($,ee,l,f,b,I,L,j),$}function xa(l){l._state="writable",l._storedError=void 0,l._writer=void 0,l._writableStreamController=void 0,l._writeRequests=new se,l._inFlightWriteRequest=void 0,l._closeRequest=void 0,l._inFlightCloseRequest=void 0,l._pendingAbortRequest=void 0,l._backpressure=!1}function Vi(l){return!s(l)||!Object.prototype.hasOwnProperty.call(l,"_writableStreamController")?!1:l instanceof Gi}function Ki(l){return l._writer!==void 0}function Os(l,f){var b;if(l._state==="closed"||l._state==="errored")return S(void 0);l._writableStreamController._abortReason=f,(b=l._writableStreamController._abortController)===null||b===void 0||b.abort();let I=l._state;if(I==="closed"||I==="errored")return S(void 0);if(l._pendingAbortRequest!==void 0)return l._pendingAbortRequest._promise;let L=!1;I==="erroring"&&(L=!0,f=void 0);let j=w(($,ee)=>{l._pendingAbortRequest={_promise:void 0,_resolve:$,_reject:ee,_reason:f,_wasAlreadyErroring:L}});return l._pendingAbortRequest._promise=j,L||Zi(l,f),j}function sl(l){let f=l._state;if(f==="closed"||f==="errored")return v(new TypeError(`The stream (in ${f} state) is not in the writable state and cannot be closed`));let b=w((L,j)=>{let $={_resolve:L,_reject:j};l._closeRequest=$}),I=l._writer;return I!==void 0&&l._backpressure&&f==="writable"&&Oa(I),oh(l._writableStreamController),b}function Zc(l){return w((b,I)=>{let L={_resolve:b,_reject:I};l._writeRequests.push(L)})}function Ls(l,f){if(l._state==="writable"){Zi(l,f);return}Ma(l)}function Zi(l,f){let b=l._writableStreamController;l._state="erroring",l._storedError=f;let I=l._writer;I!==void 0&&al(I,f),!Qc(l)&&b._started&&Ma(l)}function Ma(l){l._state="errored",l._writableStreamController[N1]();let f=l._storedError;if(l._writeRequests.forEach(L=>{L._reject(f)}),l._writeRequests=new se,l._pendingAbortRequest===void 0){Ns(l);return}let b=l._pendingAbortRequest;if(l._pendingAbortRequest=void 0,b._wasAlreadyErroring){b._reject(f),Ns(l);return}let I=l._writableStreamController[vi](b._reason);x(I,()=>{b._resolve(),Ns(l)},L=>{b._reject(L),Ns(l)})}function Jc(l){l._inFlightWriteRequest._resolve(void 0),l._inFlightWriteRequest=void 0}function Ea(l,f){l._inFlightWriteRequest._reject(f),l._inFlightWriteRequest=void 0,Ls(l,f)}function Yc(l){l._inFlightCloseRequest._resolve(void 0),l._inFlightCloseRequest=void 0,l._state==="erroring"&&(l._storedError=void 0,l._pendingAbortRequest!==void 0&&(l._pendingAbortRequest._resolve(),l._pendingAbortRequest=void 0)),l._state="closed";let b=l._writer;b!==void 0&&ml(b)}function Xc(l,f){l._inFlightCloseRequest._reject(f),l._inFlightCloseRequest=void 0,l._pendingAbortRequest!==void 0&&(l._pendingAbortRequest._reject(f),l._pendingAbortRequest=void 0),Ls(l,f)}function Yt(l){return!(l._closeRequest===void 0&&l._inFlightCloseRequest===void 0)}function Qc(l){return!(l._inFlightWriteRequest===void 0&&l._inFlightCloseRequest===void 0)}function eh(l){l._inFlightCloseRequest=l._closeRequest,l._closeRequest=void 0}function th(l){l._inFlightWriteRequest=l._writeRequests.shift()}function Ns(l){l._closeRequest!==void 0&&(l._closeRequest._reject(l._storedError),l._closeRequest=void 0);let f=l._writer;f!==void 0&&Ia(f,l._storedError)}function Ji(l,f){let b=l._writer;b!==void 0&&f!==l._backpressure&&(f?dh(b):Oa(b)),l._backpressure=f}class zn{constructor(f){if(Tr(f,1,"WritableStreamDefaultWriter"),nl(f,"First parameter"),Ki(f))throw new TypeError("This stream has already been locked for exclusive writing by another writer");this._ownerWritableStream=f,f._writer=this;let b=f._state;if(b==="writable")!Yt(f)&&f._backpressure?qs(this):gl(this),js(this);else if(b==="erroring")ka(this,f._storedError),js(this);else if(b==="closed")gl(this),hh(this);else{let I=f._storedError;ka(this,I),pl(this,I)}}get closed(){return Ei(this)?this._closedPromise:v(Ri("closed"))}get desiredSize(){if(!Ei(this))throw Ri("desiredSize");if(this._ownerWritableStream===void 0)throw jn("desiredSize");return nh(this)}get ready(){return Ei(this)?this._readyPromise:v(Ri("ready"))}abort(f=void 0){return Ei(this)?this._ownerWritableStream===void 0?v(jn("abort")):rh(this,f):v(Ri("abort"))}close(){if(!Ei(this))return v(Ri("close"));let f=this._ownerWritableStream;return f===void 0?v(jn("close")):Yt(f)?v(new TypeError("Cannot close an already-closing stream")):ol(this)}releaseLock(){if(!Ei(this))throw Ri("releaseLock");this._ownerWritableStream!==void 0&&ll(this)}write(f=void 0){return Ei(this)?this._ownerWritableStream===void 0?v(jn("write to")):ul(this,f):v(Ri("write"))}}Object.defineProperties(zn.prototype,{abort:{enumerable:!0},close:{enumerable:!0},releaseLock:{enumerable:!0},write:{enumerable:!0},closed:{enumerable:!0},desiredSize:{enumerable:!0},ready:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(zn.prototype,e.toStringTag,{value:"WritableStreamDefaultWriter",configurable:!0});function Ei(l){return!s(l)||!Object.prototype.hasOwnProperty.call(l,"_ownerWritableStream")?!1:l instanceof zn}function rh(l,f){let b=l._ownerWritableStream;return Os(b,f)}function ol(l){let f=l._ownerWritableStream;return sl(f)}function ih(l){let f=l._ownerWritableStream,b=f._state;return Yt(f)||b==="closed"?S(void 0):b==="errored"?v(f._storedError):ol(l)}function Ra(l,f){l._closedPromiseState==="pending"?Ia(l,f):fh(l,f)}function al(l,f){l._readyPromiseState==="pending"?yl(l,f):ph(l,f)}function nh(l){let f=l._ownerWritableStream,b=f._state;return b==="errored"||b==="erroring"?null:b==="closed"?0:fl(f._writableStreamController)}function ll(l){let f=l._ownerWritableStream,b=new TypeError("Writer was released and can no longer be used to monitor the stream's closedness");al(l,b),Ra(l,b),f._writer=void 0,l._ownerWritableStream=void 0}function ul(l,f){let b=l._ownerWritableStream,I=b._writableStreamController,L=ah(I,f);if(b!==l._ownerWritableStream)return v(jn("write to"));let j=b._state;if(j==="errored")return v(b._storedError);if(Yt(b)||j==="closed")return v(new TypeError("The stream is closing or closed and cannot be written to"));if(j==="erroring")return v(b._storedError);let $=Zc(b);return lh(I,f,L),$}let cl={};class Kr{constructor(){throw new TypeError("Illegal constructor")}get abortReason(){if(!Ca(this))throw Ta("abortReason");return this._abortReason}get signal(){if(!Ca(this))throw Ta("signal");if(this._abortController===void 0)throw new TypeError("WritableStreamDefaultController.prototype.signal is not supported");return this._abortController.signal}error(f=void 0){if(!Ca(this))throw Ta("error");this._controlledWritableStream._state==="writable"&&dl(this,f)}[vi](f){let b=this._abortAlgorithm(f);return Ds(this),b}[N1](){at(this)}}Object.defineProperties(Kr.prototype,{abortReason:{enumerable:!0},signal:{enumerable:!0},error:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(Kr.prototype,e.toStringTag,{value:"WritableStreamDefaultController",configurable:!0});function Ca(l){return!s(l)||!Object.prototype.hasOwnProperty.call(l,"_controlledWritableStream")?!1:l instanceof Kr}function hl(l,f,b,I,L,j,$,ee){f._controlledWritableStream=l,l._writableStreamController=f,f._queue=void 0,f._queueTotalSize=void 0,at(f),f._abortReason=void 0,f._abortController=Vc(),f._started=!1,f._strategySizeAlgorithm=ee,f._strategyHWM=$,f._writeAlgorithm=I,f._closeAlgorithm=L,f._abortAlgorithm=j;let ce=Pa(f);Ji(l,ce);let ve=b(),Ce=S(ve);x(Ce,()=>{f._started=!0,Bs(f)},Ae=>{f._started=!0,Ls(l,Ae)})}function sh(l,f,b,I){let L=Object.create(Kr.prototype),j=()=>{},$=()=>S(void 0),ee=()=>S(void 0),ce=()=>S(void 0);f.start!==void 0&&(j=()=>f.start(L)),f.write!==void 0&&($=ve=>f.write(ve,L)),f.close!==void 0&&(ee=()=>f.close()),f.abort!==void 0&&(ce=ve=>f.abort(ve)),hl(l,L,j,$,ee,ce,b,I)}function Ds(l){l._writeAlgorithm=void 0,l._closeAlgorithm=void 0,l._abortAlgorithm=void 0,l._strategySizeAlgorithm=void 0}function oh(l){Qe(l,cl,0),Bs(l)}function ah(l,f){try{return l._strategySizeAlgorithm(f)}catch(b){return Aa(l,b),1}}function fl(l){return l._strategyHWM-l._queueTotalSize}function lh(l,f,b){try{Qe(l,f,b)}catch(L){Aa(l,L);return}let I=l._controlledWritableStream;if(!Yt(I)&&I._state==="writable"){let L=Pa(l);Ji(I,L)}Bs(l)}function Bs(l){let f=l._controlledWritableStream;if(!l._started||f._inFlightWriteRequest!==void 0)return;if(f._state==="erroring"){Ma(f);return}if(l._queue.length===0)return;let I=qc(l);I===cl?uh(l):ch(l,I)}function Aa(l,f){l._controlledWritableStream._state==="writable"&&dl(l,f)}function uh(l){let f=l._controlledWritableStream;eh(f),ca(l);let b=l._closeAlgorithm();Ds(l),x(b,()=>{Yc(f)},I=>{Xc(f,I)})}function ch(l,f){let b=l._controlledWritableStream;th(b);let I=l._writeAlgorithm(f);x(I,()=>{Jc(b);let L=b._state;if(ca(l),!Yt(b)&&L==="writable"){let j=Pa(l);Ji(b,j)}Bs(l)},L=>{b._state==="writable"&&Ds(l),Ea(b,L)})}function Pa(l){return fl(l)<=0}function dl(l,f){let b=l._controlledWritableStream;Ds(l),Zi(b,f)}function zs(l){return new TypeError(`WritableStream.prototype.${l} can only be used on a WritableStream`)}function Ta(l){return new TypeError(`WritableStreamDefaultController.prototype.${l} can only be used on a WritableStreamDefaultController`)}function Ri(l){return new TypeError(`WritableStreamDefaultWriter.prototype.${l} can only be used on a WritableStreamDefaultWriter`)}function jn(l){return new TypeError("Cannot "+l+" a stream using a released writer")}function js(l){l._closedPromise=w((f,b)=>{l._closedPromise_resolve=f,l._closedPromise_reject=b,l._closedPromiseState="pending"})}function pl(l,f){js(l),Ia(l,f)}function hh(l){js(l),ml(l)}function Ia(l,f){l._closedPromise_reject!==void 0&&(O(l._closedPromise),l._closedPromise_reject(f),l._closedPromise_resolve=void 0,l._closedPromise_reject=void 0,l._closedPromiseState="rejected")}function fh(l,f){pl(l,f)}function ml(l){l._closedPromise_resolve!==void 0&&(l._closedPromise_resolve(void 0),l._closedPromise_resolve=void 0,l._closedPromise_reject=void 0,l._closedPromiseState="resolved")}function qs(l){l._readyPromise=w((f,b)=>{l._readyPromise_resolve=f,l._readyPromise_reject=b}),l._readyPromiseState="pending"}function ka(l,f){qs(l),yl(l,f)}function gl(l){qs(l),Oa(l)}function yl(l,f){l._readyPromise_reject!==void 0&&(O(l._readyPromise),l._readyPromise_reject(f),l._readyPromise_resolve=void 0,l._readyPromise_reject=void 0,l._readyPromiseState="rejected")}function dh(l){qs(l)}function ph(l,f){ka(l,f)}function Oa(l){l._readyPromise_resolve!==void 0&&(l._readyPromise_resolve(void 0),l._readyPromise_resolve=void 0,l._readyPromise_reject=void 0,l._readyPromiseState="fulfilled")}let ht=typeof DOMException<"u"?DOMException:void 0;function qn(l){if(!(typeof l=="function"||typeof l=="object"))return!1;try{return new l,!0}catch{return!1}}function Un(){let l=function(b,I){this.message=b||"",this.name=I||"Error",Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)};return l.prototype=Object.create(Error.prototype),Object.defineProperty(l.prototype,"constructor",{value:l,writable:!0,configurable:!0}),l}let $n=qn(ht)?ht:Un();function Yi(l,f,b,I,L,j){let $=fr(l),ee=Bn(f);l._disturbed=!0;let ce=!1,ve=S(void 0);return w((Ce,Ae)=>{let et;if(j!==void 0){if(et=()=>{let re=new $n("Aborted","AbortError"),me=[];I||me.push(()=>f._state==="writable"?Os(f,re):S(void 0)),L||me.push(()=>l._state==="readable"?Qt(l,re):S(void 0)),bt(()=>Promise.all(me.map(Ue=>Ue())),!0,re)},j.aborted){et();return}j.addEventListener("abort",et)}function er(){return w((re,me)=>{function Ue(we){we?re():R(Qi(),Ue,me)}Ue(!1)})}function Qi(){return ce?S(!0):R(ee._readyPromise,()=>w((re,me)=>{Pn($,{_chunkSteps:Ue=>{ve=R(ul(ee,Ue),void 0,r),re(!1)},_closeSteps:()=>re(!0),_errorSteps:me})}))}if(Or(l,$._closedPromise,re=>{I?Bt(!0,re):bt(()=>Os(f,re),!0,re)}),Or(f,ee._closedPromise,re=>{L?Bt(!0,re):bt(()=>Qt(l,re),!0,re)}),gt(l,$._closedPromise,()=>{b?Bt():bt(()=>ih(ee))}),Yt(f)||f._state==="closed"){let re=new TypeError("the destination writable stream closed before all data could be piped to it");L?Bt(!0,re):bt(()=>Qt(l,re),!0,re)}O(er());function ti(){let re=ve;return R(ve,()=>re!==ve?ti():void 0)}function Or(re,me,Ue){re._state==="errored"?Ue(re._storedError):C(me,Ue)}function gt(re,me,Ue){re._state==="closed"?Ue():A(me,Ue)}function bt(re,me,Ue){if(ce)return;ce=!0,f._state==="writable"&&!Yt(f)?A(ti(),we):we();function we(){x(re(),()=>Lr(me,Ue),_e=>Lr(!0,_e))}}function Bt(re,me){ce||(ce=!0,f._state==="writable"&&!Yt(f)?A(ti(),()=>Lr(re,me)):Lr(re,me))}function Lr(re,me){ll(ee),Pe($),j!==void 0&&j.removeEventListener("abort",et),re?Ae(me):Ce(void 0)}})}class Xt{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!kr(this))throw Ws("desiredSize");return pr(this)}close(){if(!kr(this))throw Ws("close");if(!Xi(this))throw new TypeError("The stream is not in a state that permits close");Wn(this)}enqueue(f=void 0){if(!kr(this))throw Ws("enqueue");if(!Xi(this))throw new TypeError("The stream is not in a state that permits enqueue");return $s(this,f)}error(f=void 0){if(!kr(this))throw Ws("error");Jr(this,f)}[sa](f){at(this);let b=this._cancelAlgorithm(f);return Us(this),b}[Zt](f){let b=this._controlledReadableStream;if(this._queue.length>0){let I=ca(this);this._closeRequested&&this._queue.length===0?(Us(this),Fn(b)):Zr(this),f._chunkSteps(I)}else Z(b,f),Zr(this)}}Object.defineProperties(Xt.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},desiredSize:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(Xt.prototype,e.toStringTag,{value:"ReadableStreamDefaultController",configurable:!0});function kr(l){return!s(l)||!Object.prototype.hasOwnProperty.call(l,"_controlledReadableStream")?!1:l instanceof Xt}function Zr(l){if(!bl(l))return;if(l._pulling){l._pullAgain=!0;return}l._pulling=!0;let b=l._pullAlgorithm();x(b,()=>{l._pulling=!1,l._pullAgain&&(l._pullAgain=!1,Zr(l))},I=>{Jr(l,I)})}function bl(l){let f=l._controlledReadableStream;return!Xi(l)||!l._started?!1:!!(ei(f)&&Hr(f)>0||pr(l)>0)}function Us(l){l._pullAlgorithm=void 0,l._cancelAlgorithm=void 0,l._strategySizeAlgorithm=void 0}function Wn(l){if(!Xi(l))return;let f=l._controlledReadableStream;l._closeRequested=!0,l._queue.length===0&&(Us(l),Fn(f))}function $s(l,f){if(!Xi(l))return;let b=l._controlledReadableStream;if(ei(b)&&Hr(b)>0)Ct(b,f,!1);else{let I;try{I=l._strategySizeAlgorithm(f)}catch(L){throw Jr(l,L),L}try{Qe(l,f,I)}catch(L){throw Jr(l,L),L}}Zr(l)}function Jr(l,f){let b=l._controlledReadableStream;b._state==="readable"&&(at(l),Us(l),Sl(b,f))}function pr(l){let f=l._controlledReadableStream._state;return f==="errored"?null:f==="closed"?0:l._strategyHWM-l._queueTotalSize}function mh(l){return!bl(l)}function Xi(l){let f=l._controlledReadableStream._state;return!l._closeRequested&&f==="readable"}function vl(l,f,b,I,L,j,$){f._controlledReadableStream=l,f._queue=void 0,f._queueTotalSize=void 0,at(f),f._started=!1,f._closeRequested=!1,f._pullAgain=!1,f._pulling=!1,f._strategySizeAlgorithm=$,f._strategyHWM=j,f._pullAlgorithm=I,f._cancelAlgorithm=L,l._readableStreamController=f;let ee=b();x(S(ee),()=>{f._started=!0,Zr(f)},ce=>{Jr(f,ce)})}function gh(l,f,b,I){let L=Object.create(Xt.prototype),j=()=>{},$=()=>S(void 0),ee=()=>S(void 0);f.start!==void 0&&(j=()=>f.start(L)),f.pull!==void 0&&($=()=>f.pull(L)),f.cancel!==void 0&&(ee=ce=>f.cancel(ce)),vl(l,L,j,$,ee,b,I)}function Ws(l){return new TypeError(`ReadableStreamDefaultController.prototype.${l} can only be used on a ReadableStreamDefaultController`)}function yh(l,f){return Vr(l._readableStreamController)?vh(l):bh(l)}function bh(l,f){let b=fr(l),I=!1,L=!1,j=!1,$=!1,ee,ce,ve,Ce,Ae,et=w(gt=>{Ae=gt});function er(){return I?(L=!0,S(void 0)):(I=!0,Pn(b,{_chunkSteps:bt=>{B(()=>{L=!1;let Bt=bt,Lr=bt;j||$s(ve._readableStreamController,Bt),$||$s(Ce._readableStreamController,Lr),I=!1,L&&er()})},_closeSteps:()=>{I=!1,j||Wn(ve._readableStreamController),$||Wn(Ce._readableStreamController),(!j||!$)&&Ae(void 0)},_errorSteps:()=>{I=!1}}),S(void 0))}function Qi(gt){if(j=!0,ee=gt,$){let bt=Wi([ee,ce]),Bt=Qt(l,bt);Ae(Bt)}return et}function ti(gt){if($=!0,ce=gt,j){let bt=Wi([ee,ce]),Bt=Qt(l,bt);Ae(Bt)}return et}function Or(){}return ve=La(Or,er,Qi),Ce=La(Or,er,ti),C(b._closedPromise,gt=>{Jr(ve._readableStreamController,gt),Jr(Ce._readableStreamController,gt),(!j||!$)&&Ae(void 0)}),[ve,Ce]}function vh(l){let f=fr(l),b=!1,I=!1,L=!1,j=!1,$=!1,ee,ce,ve,Ce,Ae,et=w(re=>{Ae=re});function er(re){C(re._closedPromise,me=>{re===f&&(mt(ve._readableStreamController,me),mt(Ce._readableStreamController,me),(!j||!$)&&Ae(void 0))})}function Qi(){Mi(f)&&(Pe(f),f=fr(l),er(f)),Pn(f,{_chunkSteps:me=>{B(()=>{I=!1,L=!1;let Ue=me,we=me;if(!j&&!$)try{we=H1(me)}catch(_e){mt(ve._readableStreamController,_e),mt(Ce._readableStreamController,_e),Ae(Qt(l,_e));return}j||pt(ve._readableStreamController,Ue),$||pt(Ce._readableStreamController,we),b=!1,I?Or():L&&gt()})},_closeSteps:()=>{b=!1,j||nt(ve._readableStreamController),$||nt(Ce._readableStreamController),ve._readableStreamController._pendingPullIntos.length>0&&Dn(ve._readableStreamController,0),Ce._readableStreamController._pendingPullIntos.length>0&&Dn(Ce._readableStreamController,0),(!j||!$)&&Ae(void 0)},_errorSteps:()=>{b=!1}})}function ti(re,me){Gr(f)&&(Pe(f),f=X1(l),er(f));let Ue=me?Ce:ve,we=me?ve:Ce;el(f,re,{_chunkSteps:en=>{B(()=>{I=!1,L=!1;let tn=me?$:j;if(me?j:$)tn||Ps(Ue._readableStreamController,en);else{let Gn;try{Gn=H1(en)}catch(ri){mt(Ue._readableStreamController,ri),mt(we._readableStreamController,ri),Ae(Qt(l,ri));return}tn||Ps(Ue._readableStreamController,en),pt(we._readableStreamController,Gn)}b=!1,I?Or():L&&gt()})},_closeSteps:en=>{b=!1;let tn=me?$:j,Xs=me?j:$;tn||nt(Ue._readableStreamController),Xs||nt(we._readableStreamController),en!==void 0&&(tn||Ps(Ue._readableStreamController,en),!Xs&&we._readableStreamController._pendingPullIntos.length>0&&Dn(we._readableStreamController,0)),(!tn||!Xs)&&Ae(void 0)},_errorSteps:()=>{b=!1}})}function Or(){if(b)return I=!0,S(void 0);b=!0;let re=Si(ve._readableStreamController);return re===null?Qi():ti(re._view,!1),S(void 0)}function gt(){if(b)return L=!0,S(void 0);b=!0;let re=Si(Ce._readableStreamController);return re===null?Qi():ti(re._view,!0),S(void 0)}function bt(re){if(j=!0,ee=re,$){let me=Wi([ee,ce]),Ue=Qt(l,me);Ae(Ue)}return et}function Bt(re){if($=!0,ce=re,j){let me=Wi([ee,ce]),Ue=Qt(l,me);Ae(Ue)}return et}function Lr(){}return ve=_l(Lr,Or,bt),Ce=_l(Lr,gt,Bt),er(f),[ve,Ce]}function wh(l,f){Pr(l,f);let b=l,I=b?.autoAllocateChunkSize,L=b?.cancel,j=b?.pull,$=b?.start,ee=b?.type;return{autoAllocateChunkSize:I===void 0?void 0:la(I,`${f} has member 'autoAllocateChunkSize' that`),cancel:L===void 0?void 0:_h(L,b,`${f} has member 'cancel' that`),pull:j===void 0?void 0:Sh(j,b,`${f} has member 'pull' that`),start:$===void 0?void 0:xh($,b,`${f} has member 'start' that`),type:ee===void 0?void 0:Mh(ee,`${f} has member 'type' that`)}}function _h(l,f,b){return Jt(l,b),I=>G(l,f,[I])}function Sh(l,f,b){return Jt(l,b),I=>G(l,f,[I])}function xh(l,f,b){return Jt(l,b),I=>z(l,f,[I])}function Mh(l,f){if(l=`${l}`,l!=="bytes")throw new TypeError(`${f} '${l}' is not a valid enumeration value for ReadableStreamType`);return l}function Eh(l,f){Pr(l,f);let b=l?.mode;return{mode:b===void 0?void 0:Rh(b,`${f} has member 'mode' that`)}}function Rh(l,f){if(l=`${l}`,l!=="byob")throw new TypeError(`${f} '${l}' is not a valid enumeration value for ReadableStreamReaderMode`);return l}function Ch(l,f){Pr(l,f);let b=l?.preventCancel;return{preventCancel:Boolean(b)}}function wl(l,f){Pr(l,f);let b=l?.preventAbort,I=l?.preventCancel,L=l?.preventClose,j=l?.signal;return j!==void 0&&Yr(j,`${f} has member 'signal' that`),{preventAbort:Boolean(b),preventCancel:Boolean(I),preventClose:Boolean(L),signal:j}}function Yr(l,f){if(!Hc(l))throw new TypeError(`${f} is not an AbortSignal.`)}function Ah(l,f){Pr(l,f);let b=l?.readable;oa(b,"readable","ReadableWritablePair"),Nt(b,`${f} has member 'readable' that`);let I=l?.writable;return oa(I,"writable","ReadableWritablePair"),nl(I,`${f} has member 'writable' that`),{readable:b,writable:I}}class Xr{constructor(f={},b={}){f===void 0?f=null:z1(f,"First parameter");let I=ks(b,"Second parameter"),L=wh(f,"First parameter");if(Na(this),L.type==="bytes"){if(I.size!==void 0)throw new RangeError("The strategy for a byte stream cannot have a size function");let j=dr(I,0);va(this,L,j)}else{let j=Is(I),$=dr(I,1);gh(this,L,$,j)}}get locked(){if(!Qr(this))throw Ci("locked");return ei(this)}cancel(f=void 0){return Qr(this)?ei(this)?v(new TypeError("Cannot cancel a stream that already has a reader")):Qt(this,f):v(Ci("cancel"))}getReader(f=void 0){if(!Qr(this))throw Ci("getReader");return Eh(f,"First parameter").mode===void 0?fr(this):X1(this)}pipeThrough(f,b={}){if(!Qr(this))throw Ci("pipeThrough");Tr(f,1,"pipeThrough");let I=Ah(f,"First parameter"),L=wl(b,"Second parameter");if(ei(this))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream");if(Ki(I.writable))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream");let j=Yi(this,I.writable,L.preventClose,L.preventAbort,L.preventCancel,L.signal);return O(j),I.readable}pipeTo(f,b={}){if(!Qr(this))return v(Ci("pipeTo"));if(f===void 0)return v("Parameter 1 is required in 'pipeTo'.");if(!Vi(f))return v(new TypeError("ReadableStream.prototype.pipeTo's first argument must be a WritableStream"));let I;try{I=wl(b,"Second parameter")}catch(L){return v(L)}return ei(this)?v(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream")):Ki(f)?v(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream")):Yi(this,f,I.preventClose,I.preventAbort,I.preventCancel,I.signal)}tee(){if(!Qr(this))throw Ci("tee");let f=yh(this);return Wi(f)}values(f=void 0){if(!Qr(this))throw Ci("values");let b=Ch(f,"First parameter");return zc(this,b.preventCancel)}}Object.defineProperties(Xr.prototype,{cancel:{enumerable:!0},getReader:{enumerable:!0},pipeThrough:{enumerable:!0},pipeTo:{enumerable:!0},tee:{enumerable:!0},values:{enumerable:!0},locked:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(Xr.prototype,e.toStringTag,{value:"ReadableStream",configurable:!0}),typeof e.asyncIterator=="symbol"&&Object.defineProperty(Xr.prototype,e.asyncIterator,{value:Xr.prototype.values,writable:!0,configurable:!0});function La(l,f,b,I=1,L=()=>1){let j=Object.create(Xr.prototype);Na(j);let $=Object.create(Xt.prototype);return vl(j,$,l,f,b,I,L),j}function _l(l,f,b){let I=Object.create(Xr.prototype);Na(I);let L=Object.create(wi.prototype);return ba(I,L,l,f,b,0,void 0),I}function Na(l){l._state="readable",l._reader=void 0,l._storedError=void 0,l._disturbed=!1}function Qr(l){return!s(l)||!Object.prototype.hasOwnProperty.call(l,"_readableStreamController")?!1:l instanceof Xr}function ei(l){return l._reader!==void 0}function Qt(l,f){if(l._disturbed=!0,l._state==="closed")return S(void 0);if(l._state==="errored")return v(l._storedError);Fn(l);let b=l._reader;b!==void 0&&Mi(b)&&(b._readIntoRequests.forEach(L=>{L._closeSteps(void 0)}),b._readIntoRequests=new se);let I=l._readableStreamController[sa](f);return T(I,r)}function Fn(l){l._state="closed";let f=l._reader;f!==void 0&&(na(f),Gr(f)&&(f._readRequests.forEach(b=>{b._closeSteps()}),f._readRequests=new se))}function Sl(l,f){l._state="errored",l._storedError=f;let b=l._reader;b!==void 0&&(Kt(b,f),Gr(b)?(b._readRequests.forEach(I=>{I._errorSteps(f)}),b._readRequests=new se):(b._readIntoRequests.forEach(I=>{I._errorSteps(f)}),b._readIntoRequests=new se))}function Ci(l){return new TypeError(`ReadableStream.prototype.${l} can only be used on a ReadableStream`)}function xl(l,f){Pr(l,f);let b=l?.highWaterMark;return oa(b,"highWaterMark","QueuingStrategyInit"),{highWaterMark:aa(b)}}let Ml=l=>l.byteLength;Object.defineProperty(Ml,"name",{value:"size",configurable:!0});class Fs{constructor(f){Tr(f,1,"ByteLengthQueuingStrategy"),f=xl(f,"First parameter"),this._byteLengthQueuingStrategyHighWaterMark=f.highWaterMark}get highWaterMark(){if(!Rl(this))throw El("highWaterMark");return this._byteLengthQueuingStrategyHighWaterMark}get size(){if(!Rl(this))throw El("size");return Ml}}Object.defineProperties(Fs.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(Fs.prototype,e.toStringTag,{value:"ByteLengthQueuingStrategy",configurable:!0});function El(l){return new TypeError(`ByteLengthQueuingStrategy.prototype.${l} can only be used on a ByteLengthQueuingStrategy`)}function Rl(l){return!s(l)||!Object.prototype.hasOwnProperty.call(l,"_byteLengthQueuingStrategyHighWaterMark")?!1:l instanceof Fs}let Cl=()=>1;Object.defineProperty(Cl,"name",{value:"size",configurable:!0});class Hs{constructor(f){Tr(f,1,"CountQueuingStrategy"),f=xl(f,"First parameter"),this._countQueuingStrategyHighWaterMark=f.highWaterMark}get highWaterMark(){if(!Pl(this))throw Al("highWaterMark");return this._countQueuingStrategyHighWaterMark}get size(){if(!Pl(this))throw Al("size");return Cl}}Object.defineProperties(Hs.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(Hs.prototype,e.toStringTag,{value:"CountQueuingStrategy",configurable:!0});function Al(l){return new TypeError(`CountQueuingStrategy.prototype.${l} can only be used on a CountQueuingStrategy`)}function Pl(l){return!s(l)||!Object.prototype.hasOwnProperty.call(l,"_countQueuingStrategyHighWaterMark")?!1:l instanceof Hs}function Ph(l,f){Pr(l,f);let b=l?.flush,I=l?.readableType,L=l?.start,j=l?.transform,$=l?.writableType;return{flush:b===void 0?void 0:Th(b,l,`${f} has member 'flush' that`),readableType:I,start:L===void 0?void 0:Tl(L,l,`${f} has member 'start' that`),transform:j===void 0?void 0:Ih(j,l,`${f} has member 'transform' that`),writableType:$}}function Th(l,f,b){return Jt(l,b),I=>G(l,f,[I])}function Tl(l,f,b){return Jt(l,b),I=>z(l,f,[I])}function Ih(l,f,b){return Jt(l,b),(I,L)=>G(l,f,[I,L])}class Gs{constructor(f={},b={},I={}){f===void 0&&(f=null);let L=ks(b,"Second parameter"),j=ks(I,"Third parameter"),$=Ph(f,"First parameter");if($.readableType!==void 0)throw new RangeError("Invalid readableType specified");if($.writableType!==void 0)throw new RangeError("Invalid writableType specified");let ee=dr(j,0),ce=Is(j),ve=dr(L,1),Ce=Is(L),Ae,et=w(er=>{Ae=er});kh(this,et,ve,Ce,ee,ce),Lh(this,$),$.start!==void 0?Ae($.start(this._transformStreamController)):Ae(void 0)}get readable(){if(!Il(this))throw Nl("readable");return this._readable}get writable(){if(!Il(this))throw Nl("writable");return this._writable}}Object.defineProperties(Gs.prototype,{readable:{enumerable:!0},writable:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(Gs.prototype,e.toStringTag,{value:"TransformStream",configurable:!0});function kh(l,f,b,I,L,j){function $(){return f}function ee(et){return Bh(l,et)}function ce(et){return zh(l,et)}function ve(){return jh(l)}l._writable=Kc($,ee,ve,ce,b,I);function Ce(){return qh(l)}function Ae(et){return Ks(l,et),S(void 0)}l._readable=La($,Ce,Ae,L,j),l._backpressure=void 0,l._backpressureChangePromise=void 0,l._backpressureChangePromise_resolve=void 0,Zs(l,!0),l._transformStreamController=void 0}function Il(l){return!s(l)||!Object.prototype.hasOwnProperty.call(l,"_transformStreamController")?!1:l instanceof Gs}function Vs(l,f){Jr(l._readable._readableStreamController,f),Ks(l,f)}function Ks(l,f){kl(l._transformStreamController),Aa(l._writable._writableStreamController,f),l._backpressure&&Zs(l,!1)}function Zs(l,f){l._backpressureChangePromise!==void 0&&l._backpressureChangePromise_resolve(),l._backpressureChangePromise=w(b=>{l._backpressureChangePromise_resolve=b}),l._backpressure=f}class Hn{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!Js(this))throw Ys("desiredSize");let f=this._controlledTransformStream._readable._readableStreamController;return pr(f)}enqueue(f=void 0){if(!Js(this))throw Ys("enqueue");Ol(this,f)}error(f=void 0){if(!Js(this))throw Ys("error");Nh(this,f)}terminate(){if(!Js(this))throw Ys("terminate");Dh(this)}}Object.defineProperties(Hn.prototype,{enqueue:{enumerable:!0},error:{enumerable:!0},terminate:{enumerable:!0},desiredSize:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(Hn.prototype,e.toStringTag,{value:"TransformStreamDefaultController",configurable:!0});function Js(l){return!s(l)||!Object.prototype.hasOwnProperty.call(l,"_controlledTransformStream")?!1:l instanceof Hn}function Oh(l,f,b,I){f._controlledTransformStream=l,l._transformStreamController=f,f._transformAlgorithm=b,f._flushAlgorithm=I}function Lh(l,f){let b=Object.create(Hn.prototype),I=j=>{try{return Ol(b,j),S(void 0)}catch($){return v($)}},L=()=>S(void 0);f.transform!==void 0&&(I=j=>f.transform(j,b)),f.flush!==void 0&&(L=()=>f.flush(b)),Oh(l,b,I,L)}function kl(l){l._transformAlgorithm=void 0,l._flushAlgorithm=void 0}function Ol(l,f){let b=l._controlledTransformStream,I=b._readable._readableStreamController;if(!Xi(I))throw new TypeError("Readable side is not in a state that permits enqueue");try{$s(I,f)}catch(j){throw Ks(b,j),b._readable._storedError}mh(I)!==b._backpressure&&Zs(b,!0)}function Nh(l,f){Vs(l._controlledTransformStream,f)}function Ll(l,f){let b=l._transformAlgorithm(f);return T(b,void 0,I=>{throw Vs(l._controlledTransformStream,I),I})}function Dh(l){let f=l._controlledTransformStream,b=f._readable._readableStreamController;Wn(b);let I=new TypeError("TransformStream terminated");Ks(f,I)}function Bh(l,f){let b=l._transformStreamController;if(l._backpressure){let I=l._backpressureChangePromise;return T(I,()=>{let L=l._writable;if(L._state==="erroring")throw L._storedError;return Ll(b,f)})}return Ll(b,f)}function zh(l,f){return Vs(l,f),S(void 0)}function jh(l){let f=l._readable,b=l._transformStreamController,I=b._flushAlgorithm();return kl(b),T(I,()=>{if(f._state==="errored")throw f._storedError;Wn(f._readableStreamController)},L=>{throw Vs(l,L),f._storedError})}function qh(l){return Zs(l,!1),l._backpressureChangePromise}function Ys(l){return new TypeError(`TransformStreamDefaultController.prototype.${l} can only be used on a TransformStreamDefaultController`)}function Nl(l){return new TypeError(`TransformStream.prototype.${l} can only be used on a TransformStream`)}t.ByteLengthQueuingStrategy=Fs,t.CountQueuingStrategy=Hs,t.ReadableByteStreamController=wi,t.ReadableStream=Xr,t.ReadableStreamBYOBReader=Hi,t.ReadableStreamBYOBRequest=kn,t.ReadableStreamDefaultController=Xt,t.ReadableStreamDefaultReader=An,t.TransformStream=Gs,t.TransformStreamDefaultController=Hn,t.WritableStream=Gi,t.WritableStreamDefaultController=Kr,t.WritableStreamDefaultWriter=zn,Object.defineProperty(t,"__esModule",{value:!0})})});var b2=H(()=>{if(!globalThis.ReadableStream)try{let t=require("process"),{emitWarning:e}=t;try{t.emitWarning=()=>{},Object.assign(globalThis,require("stream/web")),t.emitWarning=e}catch(r){throw t.emitWarning=e,r}}catch{Object.assign(globalThis,y2())}try{let{Blob:t}=require("buffer");t&&!t.prototype.stream&&(t.prototype.stream=function(r){let i=0,n=this;return new ReadableStream({type:"bytes",async pull(s){let c=await n.slice(i,Math.min(n.size,i+65536)).arrayBuffer();i+=c.byteLength,s.enqueue(new Uint8Array(c)),i===n.size&&s.close()}})})}catch{}});async function*Kh(t,e=!0){for(let r of t)if("stream"in r)yield*r.stream();else if(ArrayBuffer.isView(r))if(e){let i=r.byteOffset,n=r.byteOffset+r.byteLength;for(;i!==n;){let s=Math.min(n-i,v2),a=r.buffer.slice(i,i+s);i+=a.byteLength,yield new Uint8Array(a)}}else yield r;else{let i=0,n=r;for(;i!==n.size;){let a=await n.slice(i,Math.min(n.size,i+v2)).arrayBuffer();i+=a.byteLength,yield new Uint8Array(a)}}}var hE,v2,Ti,Fa,oo,Zl,ao,w2,Qg,Ii,Ha=ja(()=>{hE=fe(b2(),1);v2=65536;w2=(ao=class{constructor(e=[],r={}){yt(this,Ti,[]);yt(this,Fa,"");yt(this,oo,0);yt(this,Zl,"transparent");if(typeof e!="object"||e===null)throw new TypeError("Failed to construct 'Blob': The provided value cannot be converted to a sequence.");if(typeof e[Symbol.iterator]!="function")throw new TypeError("Failed to construct 'Blob': The object must have a callable @@iterator property.");if(typeof r!="object"&&typeof r!="function")throw new TypeError("Failed to construct 'Blob': parameter 2 cannot convert to dictionary.");r===null&&(r={});let i=new TextEncoder;for(let s of e){let a;ArrayBuffer.isView(s)?a=new Uint8Array(s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength)):s instanceof ArrayBuffer?a=new Uint8Array(s.slice(0)):s instanceof ao?a=s:a=i.encode(`${s}`),Ze(this,oo,Me(this,oo)+(ArrayBuffer.isView(a)?a.byteLength:a.size)),Me(this,Ti).push(a)}Ze(this,Zl,`${r.endings===void 0?"transparent":r.endings}`);let n=r.type===void 0?"":String(r.type);Ze(this,Fa,/^[\x20-\x7E]*$/.test(n)?n:"")}get size(){return Me(this,oo)}get type(){return Me(this,Fa)}async text(){let e=new TextDecoder,r="";for await(let i of Kh(Me(this,Ti),!1))r+=e.decode(i,{stream:!0});return r+=e.decode(),r}async arrayBuffer(){let e=new Uint8Array(this.size),r=0;for await(let i of Kh(Me(this,Ti),!1))e.set(i,r),r+=i.length;return e.buffer}stream(){let e=Kh(Me(this,Ti),!0);return new globalThis.ReadableStream({type:"bytes",async pull(r){let i=await e.next();i.done?r.close():r.enqueue(i.value)},async cancel(){await e.return()}})}slice(e=0,r=this.size,i=""){let{size:n}=this,s=e<0?Math.max(n+e,0):Math.min(e,n),a=r<0?Math.max(n+r,0):Math.min(r,n),c=Math.max(a-s,0),d=Me(this,Ti),p=[],m=0;for(let S of d){if(m>=c)break;let v=ArrayBuffer.isView(S)?S.byteLength:S.size;if(s&&v<=s)s-=v,a-=v;else{let R;ArrayBuffer.isView(S)?(R=S.subarray(s,Math.min(v,a)),m+=R.byteLength):(R=S.slice(s,Math.min(v,a)),m+=R.size),a-=v,p.push(R),s=0}}let w=new ao([],{type:String(i).toLowerCase()});return Ze(w,oo,c),Ze(w,Ti,p),w}get[Symbol.toStringTag](){return"Blob"}static[Symbol.hasInstance](e){return e&&typeof e=="object"&&typeof e.constructor=="function"&&(typeof e.stream=="function"||typeof e.arrayBuffer=="function")&&/^(Blob|File)$/.test(e[Symbol.toStringTag])}},Ti=new WeakMap,Fa=new WeakMap,oo=new WeakMap,Zl=new WeakMap,ao);Object.defineProperties(w2.prototype,{size:{enumerable:!0},type:{enumerable:!0},slice:{enumerable:!0}});Qg=w2,Ii=Qg});var Ga,Va,_2,ey,ty,lo,Zh=ja(()=>{Ha();ey=(_2=class extends Ii{constructor(r,i,n={}){if(arguments.length<2)throw new TypeError(`Failed to construct 'File': 2 arguments required, but only ${arguments.length} present.`);super(r,n);yt(this,Ga,0);yt(this,Va,"");n===null&&(n={});let s=n.lastModified===void 0?Date.now():Number(n.lastModified);Number.isNaN(s)||Ze(this,Ga,s),Ze(this,Va,String(i))}get name(){return Me(this,Va)}get lastModified(){return Me(this,Ga)}get[Symbol.toStringTag](){return"File"}static[Symbol.hasInstance](r){return!!r&&r instanceof Ii&&/^(File)$/.test(r[Symbol.toStringTag])}},Ga=new WeakMap,Va=new WeakMap,_2),ty=ey,lo=ty});function E2(t,e=Ii){var r=`${S2()}${S2()}`.replace(/\./g,"").slice(-28).padStart(32,"-"),i=[],n=`--${r}\r
2
+ Content-Disposition: form-data; name="`;return t.forEach((s,a)=>typeof s=="string"?i.push(n+Jh(a)+`"\r
3
+ \r
4
+ ${s.replace(/\r(?!\n)|(?<!\r)\n/g,`\r
5
+ `)}\r
6
+ `):i.push(n+Jh(a)+`"; filename="${Jh(s.name,1)}"\r
7
+ Content-Type: ${s.type||"application/octet-stream"}\r
8
+ \r
9
+ `,s,`\r
10
+ `)),i.push(`--${r}--`),new e(i,{type:"multipart/form-data; boundary="+r})}var Ka,ry,iy,S2,ny,x2,Jh,Jn,mr,M2,Yn,Jl=ja(()=>{Ha();Zh();({toStringTag:Ka,iterator:ry,hasInstance:iy}=Symbol),S2=Math.random,ny="append,set,get,getAll,delete,keys,values,entries,forEach,constructor".split(","),x2=(t,e,r)=>(t+="",/^(Blob|File)$/.test(e&&e[Ka])?[(r=r!==void 0?r+"":e[Ka]=="File"?e.name:"blob",t),e.name!==r||e[Ka]=="blob"?new lo([e],r,e):e]:[t,e+""]),Jh=(t,e)=>(e?t:t.replace(/\r?\n|\r/g,`\r
11
+ `)).replace(/\n/g,"%0A").replace(/\r/g,"%0D").replace(/"/g,"%22"),Jn=(t,e,r)=>{if(e.length<r)throw new TypeError(`Failed to execute '${t}' on 'FormData': ${r} arguments required, but only ${e.length} present.`)},Yn=(M2=class{constructor(...e){yt(this,mr,[]);if(e.length)throw new TypeError("Failed to construct 'FormData': parameter 1 is not of type 'HTMLFormElement'.")}get[Ka](){return"FormData"}[ry](){return this.entries()}static[iy](e){return e&&typeof e=="object"&&e[Ka]==="FormData"&&!ny.some(r=>typeof e[r]!="function")}append(...e){Jn("append",arguments,2),Me(this,mr).push(x2(...e))}delete(e){Jn("delete",arguments,1),e+="",Ze(this,mr,Me(this,mr).filter(([r])=>r!==e))}get(e){Jn("get",arguments,1),e+="";for(var r=Me(this,mr),i=r.length,n=0;n<i;n++)if(r[n][0]===e)return r[n][1];return null}getAll(e,r){return Jn("getAll",arguments,1),r=[],e+="",Me(this,mr).forEach(i=>i[0]===e&&r.push(i[1])),r}has(e){return Jn("has",arguments,1),e+="",Me(this,mr).some(r=>r[0]===e)}forEach(e,r){Jn("forEach",arguments,1);for(var[i,n]of this)e.call(r,n,i,this)}set(...e){Jn("set",arguments,2);var r=[],i=!0;e=x2(...e),Me(this,mr).forEach(n=>{n[0]===e[0]?i&&(i=!r.push(e)):r.push(n)}),i&&r.push(e),Ze(this,mr,r)}*entries(){yield*Me(this,mr)}*keys(){for(var[e]of this)yield e}*values(){for(var[,e]of this)yield e}},mr=new WeakMap,M2)});var P2=H((ME,A2)=>{if(!globalThis.DOMException)try{let{MessageChannel:t}=require("worker_threads"),e=new t().port1,r=new ArrayBuffer;e.postMessage(r,[r,r])}catch(t){t.constructor.name==="DOMException"&&(globalThis.DOMException=t.constructor)}A2.exports=globalThis.DOMException});var Ja,I2,sy,Xn,Qn,Xh,T2,Qh=ja(()=>{Ja=require("fs"),I2=fe(P2(),1);Zh();Ha();({stat:sy}=Ja.promises),Xh=class{constructor(e){yt(this,Xn,void 0);yt(this,Qn,void 0);Ze(this,Xn,e.path),Ze(this,Qn,e.start),this.size=e.size,this.lastModified=e.lastModified}slice(e,r){return new Xh({path:Me(this,Xn),lastModified:this.lastModified,size:r-e,start:Me(this,Qn)+e})}async*stream(){let{mtimeMs:e}=await sy(Me(this,Xn));if(e>this.lastModified)throw new I2.default("The requested file could not be read, typically due to permission problems that have occurred after a reference to a file was acquired.","NotReadableError");yield*(0,Ja.createReadStream)(Me(this,Xn),{start:Me(this,Qn),end:Me(this,Qn)+this.size-1})}get[Symbol.toStringTag](){return"Blob"}},T2=Xh;Xn=new WeakMap,Qn=new WeakMap});var O2={};t2(O2,{toFormData:()=>fy});function hy(t){let e=t.match(/\bfilename=("(.*?)"|([^()<>@,;:\\"/[\]?={}\s\t]+))($|;\s)/i);if(!e)return;let r=e[2]||e[3]||"",i=r.slice(r.lastIndexOf("\\")+1);return i=i.replace(/%22/g,'"'),i=i.replace(/&#(\d{4});/g,(n,s)=>String.fromCharCode(s)),i}async function fy(t,e){if(!/multipart/i.test(e))throw new TypeError("Failed to fetch");let r=e.match(/boundary=(?:"([^"]+)"|([^;]+))/i);if(!r)throw new TypeError("no or bad content-type header, no multipart boundary");let i=new ef(r[1]||r[2]),n,s,a,c,d,p,m=[],w=new Yn,S=C=>{a+=A.decode(C,{stream:!0})},v=C=>{m.push(C)},R=()=>{let C=new lo(m,p,{type:d});w.append(c,C)},x=()=>{w.append(c,a)},A=new TextDecoder("utf-8");A.decode(),i.onPartBegin=function(){i.onPartData=S,i.onPartEnd=x,n="",s="",a="",c="",d="",p=null,m.length=0},i.onHeaderField=function(C){n+=A.decode(C,{stream:!0})},i.onHeaderValue=function(C){s+=A.decode(C,{stream:!0})},i.onHeaderEnd=function(){if(s+=A.decode(),n=n.toLowerCase(),n==="content-disposition"){let C=s.match(/\bname=("([^"]*)"|([^()<>@,;:\\"/[\]?={}\s\t]+))/i);C&&(c=C[2]||C[3]||""),p=hy(s),p&&(i.onPartData=v,i.onPartEnd=R)}else n==="content-type"&&(d=s);s="",n=""};for await(let C of t)i.write(C);return i.end(),w}var si,He,k2,ln,Xl,Ql,oy,Ya,ay,ly,uy,cy,es,ef,L2=ja(()=>{Qh();Jl();si=0,He={START_BOUNDARY:si++,HEADER_FIELD_START:si++,HEADER_FIELD:si++,HEADER_VALUE_START:si++,HEADER_VALUE:si++,HEADER_VALUE_ALMOST_DONE:si++,HEADERS_ALMOST_DONE:si++,PART_DATA_START:si++,PART_DATA:si++,END:si++},k2=1,ln={PART_BOUNDARY:k2,LAST_BOUNDARY:k2*=2},Xl=10,Ql=13,oy=32,Ya=45,ay=58,ly=97,uy=122,cy=t=>t|32,es=()=>{},ef=class{constructor(e){this.index=0,this.flags=0,this.onHeaderEnd=es,this.onHeaderField=es,this.onHeadersEnd=es,this.onHeaderValue=es,this.onPartBegin=es,this.onPartData=es,this.onPartEnd=es,this.boundaryChars={},e=`\r
12
+ --`+e;let r=new Uint8Array(e.length);for(let i=0;i<e.length;i++)r[i]=e.charCodeAt(i),this.boundaryChars[r[i]]=!0;this.boundary=r,this.lookbehind=new Uint8Array(this.boundary.length+8),this.state=He.START_BOUNDARY}write(e){let r=0,i=e.length,n=this.index,{lookbehind:s,boundary:a,boundaryChars:c,index:d,state:p,flags:m}=this,w=this.boundary.length,S=w-1,v=e.length,R,x,A=B=>{this[B+"Mark"]=r},C=B=>{delete this[B+"Mark"]},T=(B,z,G,te)=>{(z===void 0||z!==G)&&this[B](te&&te.subarray(z,G))},O=(B,z)=>{let G=B+"Mark";G in this&&(z?(T(B,this[G],r,e),delete this[G]):(T(B,this[G],e.length,e),this[G]=0))};for(r=0;r<i;r++)switch(R=e[r],p){case He.START_BOUNDARY:if(d===a.length-2){if(R===Ya)m|=ln.LAST_BOUNDARY;else if(R!==Ql)return;d++;break}else if(d-1===a.length-2){if(m&ln.LAST_BOUNDARY&&R===Ya)p=He.END,m=0;else if(!(m&ln.LAST_BOUNDARY)&&R===Xl)d=0,T("onPartBegin"),p=He.HEADER_FIELD_START;else return;break}R!==a[d+2]&&(d=-2),R===a[d+2]&&d++;break;case He.HEADER_FIELD_START:p=He.HEADER_FIELD,A("onHeaderField"),d=0;case He.HEADER_FIELD:if(R===Ql){C("onHeaderField"),p=He.HEADERS_ALMOST_DONE;break}if(d++,R===Ya)break;if(R===ay){if(d===1)return;O("onHeaderField",!0),p=He.HEADER_VALUE_START;break}if(x=cy(R),x<ly||x>uy)return;break;case He.HEADER_VALUE_START:if(R===oy)break;A("onHeaderValue"),p=He.HEADER_VALUE;case He.HEADER_VALUE:R===Ql&&(O("onHeaderValue",!0),T("onHeaderEnd"),p=He.HEADER_VALUE_ALMOST_DONE);break;case He.HEADER_VALUE_ALMOST_DONE:if(R!==Xl)return;p=He.HEADER_FIELD_START;break;case He.HEADERS_ALMOST_DONE:if(R!==Xl)return;T("onHeadersEnd"),p=He.PART_DATA_START;break;case He.PART_DATA_START:p=He.PART_DATA,A("onPartData");case He.PART_DATA:if(n=d,d===0){for(r+=S;r<v&&!(e[r]in c);)r+=w;r-=S,R=e[r]}if(d<a.length)a[d]===R?(d===0&&O("onPartData",!0),d++):d=0;else if(d===a.length)d++,R===Ql?m|=ln.PART_BOUNDARY:R===Ya?m|=ln.LAST_BOUNDARY:d=0;else if(d-1===a.length)if(m&ln.PART_BOUNDARY){if(d=0,R===Xl){m&=~ln.PART_BOUNDARY,T("onPartEnd"),T("onPartBegin"),p=He.HEADER_FIELD_START;break}}else m&ln.LAST_BOUNDARY&&R===Ya?(T("onPartEnd"),p=He.END,m=0):d=0;if(d>0)s[d-1]=R;else if(n>0){let B=new Uint8Array(s.buffer,s.byteOffset,s.byteLength);T("onPartData",0,n,B),n=0,A("onPartData"),r--}break;case He.END:break;default:throw new Error(`Unexpected state entered: ${p}`)}O("onHeaderField"),O("onHeaderValue"),O("onPartData"),this.index=d,this.state=p,this.flags=m}end(){if(this.state===He.HEADER_FIELD_START&&this.index===0||this.state===He.PART_DATA&&this.index===this.boundary.length)this.onPartEnd();else if(this.state!==He.END)throw new Error("MultipartParser.end(): stream ended unexpectedly")}}});var c5=H((dC,u5)=>{"use strict";u5.exports=l5;var{toString:_8}=Object.prototype,lf=Symbol("circular-ref-tag"),uf=Symbol("pino-raw-err-ref"),a5=Object.create({},{type:{enumerable:!0,writable:!0,value:void 0},message:{enumerable:!0,writable:!0,value:void 0},stack:{enumerable:!0,writable:!0,value:void 0},raw:{enumerable:!1,get:function(){return this[uf]},set:function(t){this[uf]=t}}});Object.defineProperty(a5,uf,{writable:!0,value:{}});function l5(t){if(!(t instanceof Error))return t;t[lf]=void 0;let e=Object.create(a5);e.type=_8.call(t.constructor)==="[object Function]"?t.constructor.name:t.name,e.message=t.message,e.stack=t.stack;for(let r in t)if(e[r]===void 0){let i=t[r];i instanceof Error?i.hasOwnProperty(lf)||(e[r]=l5(i)):e[r]=i}return delete t[lf],e.raw=t,e}});var p5=H((pC,d5)=>{"use strict";d5.exports={mapHttpRequest:S8,reqSerializer:f5};var cf=Symbol("pino-raw-req-ref"),h5=Object.create({},{id:{enumerable:!0,writable:!0,value:""},method:{enumerable:!0,writable:!0,value:""},url:{enumerable:!0,writable:!0,value:""},query:{enumerable:!0,writable:!0,value:""},params:{enumerable:!0,writable:!0,value:""},headers:{enumerable:!0,writable:!0,value:{}},remoteAddress:{enumerable:!0,writable:!0,value:""},remotePort:{enumerable:!0,writable:!0,value:""},raw:{enumerable:!1,get:function(){return this[cf]},set:function(t){this[cf]=t}}});Object.defineProperty(h5,cf,{writable:!0,value:{}});function f5(t){let e=t.info||t.socket,r=Object.create(h5);return r.id=typeof t.id=="function"?t.id():t.id||(t.info?t.info.id:void 0),r.method=t.method,t.originalUrl?(r.url=t.originalUrl,r.query=t.query,r.params=t.params):r.url=t.path||(t.url?t.url.path||t.url:void 0),r.headers=t.headers,r.remoteAddress=e&&e.remoteAddress,r.remotePort=e&&e.remotePort,r.raw=t.raw||t,r}function S8(t){return{req:f5(t)}}});var b5=H((mC,y5)=>{"use strict";y5.exports={mapHttpResponse:x8,resSerializer:g5};var hf=Symbol("pino-raw-res-ref"),m5=Object.create({},{statusCode:{enumerable:!0,writable:!0,value:0},headers:{enumerable:!0,writable:!0,value:""},raw:{enumerable:!1,get:function(){return this[hf]},set:function(t){this[hf]=t}}});Object.defineProperty(m5,hf,{writable:!0,value:{}});function g5(t){let e=Object.create(m5);return e.statusCode=t.statusCode,e.headers=t.getHeaders?t.getHeaders():t._headers,e.raw=t,e}function x8(t){return{res:g5(t)}}});var df=H((gC,v5)=>{"use strict";var ff=c5(),fu=p5(),du=b5();v5.exports={err:ff,mapHttpRequest:fu.mapHttpRequest,mapHttpResponse:du.mapHttpResponse,req:fu.reqSerializer,res:du.resSerializer,wrapErrorSerializer:function(e){return e===ff?e:function(i){return e(ff(i))}},wrapRequestSerializer:function(e){return e===fu.reqSerializer?e:function(i){return e(fu.reqSerializer(i))}},wrapResponseSerializer:function(e){return e===du.resSerializer?e:function(i){return e(du.resSerializer(i))}}}});var pf=H((yC,w5)=>{"use strict";function M8(t,e){return e}w5.exports=function(){let e=Error.prepareStackTrace;Error.prepareStackTrace=M8;let r=new Error().stack;if(Error.prepareStackTrace=e,!Array.isArray(r))return;let i=r.slice(2),n=[];for(let s of i)!s||n.push(s.getFileName());return n}});var S5=H((bC,_5)=>{"use strict";var{createContext:E8,runInContext:R8}=require("vm");_5.exports=C8;function C8(t={}){let{ERR_PATHS_MUST_BE_STRINGS:e=()=>"fast-redact - Paths must be (non-empty) strings",ERR_INVALID_PATH:r=i=>`fast-redact \u2013 Invalid path (${i})`}=t;return function({paths:n}){n.forEach(s=>{if(typeof s!="string")throw Error(e());try{if(/〇/.test(s))throw Error();let a=new Proxy({},{get:()=>a,set:()=>{throw Error()}}),c=(s[0]==="["?"":".")+s.replace(/^\*/,"\u3007").replace(/\.\*/g,".\u3007").replace(/\[\*\]/g,"[\u3007]");if(/\n|\r|;/.test(c)||/\/\*/.test(c))throw Error();R8(`
2
13
  (function () {
3
14
  'use strict'
4
- o${h}
5
- if ([o${h}].length !== 1) throw Error()
15
+ o${c}
16
+ if ([o${c}].length !== 1) throw Error()
6
17
  })()
7
- `,r_({o:a,"\u3007":null}),{codeGeneration:{strings:!1,wasm:!1}})}catch{throw Error(r(o))}})}}});var Cu=ee((E3,Mp)=>{"use strict";Mp.exports=/[^.[\]]+|\[((?:.)*?)\]/g});var Cp=ee((M3,Rp)=>{"use strict";var s_=Cu();Rp.exports=o_;function o_({paths:t}){let e=[];var r=0;let i=t.reduce(function(n,o,a){var h=o.match(s_).map(p=>p.replace(/'|"|`/g,""));let d=o[0]==="[";h=h.map(p=>p[0]==="["?p.substr(1,p.length-2):p);let m=h.indexOf("*");if(m>-1){let p=h.slice(0,m),w=p.join("."),E=h.slice(m+1,h.length);if(E.indexOf("*")>-1)throw Error("fast-redact \u2013 Only one wildcard per path is supported");let _=E.length>0;r++,e.push({before:p,beforeStr:w,after:E,nested:_})}else n[o]={path:h,val:void 0,precensored:!1,circle:"",escPath:JSON.stringify(o),leadingBracket:d};return n},{});return{wildcards:e,wcLen:r,secret:i}}});var Ap=ee((R3,Tp)=>{"use strict";var a_=Cu();Tp.exports=l_;function l_({secret:t,serialize:e,wcLen:r,strict:i,isCensorFct:n,censorFctTakesPath:o},a){let h=Function("o",`
18
+ `,E8({o:a,"\u3007":null}),{codeGeneration:{strings:!1,wasm:!1}})}catch{throw Error(r(s))}})}}});var pu=H((vC,x5)=>{"use strict";x5.exports=/[^.[\]]+|\[((?:.)*?)\]/g});var E5=H((wC,M5)=>{"use strict";var A8=pu();M5.exports=P8;function P8({paths:t}){let e=[];var r=0;let i=t.reduce(function(n,s,a){var c=s.match(A8).map(m=>m.replace(/'|"|`/g,""));let d=s[0]==="[";c=c.map(m=>m[0]==="["?m.substr(1,m.length-2):m);let p=c.indexOf("*");if(p>-1){let m=c.slice(0,p),w=m.join("."),S=c.slice(p+1,c.length);if(S.indexOf("*")>-1)throw Error("fast-redact \u2013 Only one wildcard per path is supported");let v=S.length>0;r++,e.push({before:m,beforeStr:w,after:S,nested:v})}else n[s]={path:c,val:void 0,precensored:!1,circle:"",escPath:JSON.stringify(s),leadingBracket:d};return n},{});return{wildcards:e,wcLen:r,secret:i}}});var C5=H((_C,R5)=>{"use strict";var T8=pu();R5.exports=I8;function I8({secret:t,serialize:e,wcLen:r,strict:i,isCensorFct:n,censorFctTakesPath:s},a){let c=Function("o",`
8
19
  if (typeof o !== 'object' || o == null) {
9
- ${f_(i,e)}
20
+ ${N8(i,e)}
10
21
  }
11
22
  const { censor, secret } = this
12
- ${u_(t,n,o)}
23
+ ${k8(t,n,s)}
13
24
  this.compileRestore()
14
- ${h_(r>0,n,o)}
15
- ${c_(e)}
16
- `).bind(a);return e===!1&&(h.restore=d=>a.restore(d)),h}function u_(t,e,r){return Object.keys(t).map(i=>{let{escPath:n,leadingBracket:o,path:a}=t[i],h=o?1:0,d=o?"":".",m=[];for(var p;(p=a_.exec(i))!==null;){let[,C]=p,{index:R,input:I}=p;R>h&&m.push(I.substring(0,R-(C?0:1)))}var w=m.map(C=>`o${d}${C}`).join(" && ");w.length===0?w+=`o${d}${i} != null`:w+=` && o${d}${i} != null`;let E=`
25
+ ${O8(r>0,n,s)}
26
+ ${L8(e)}
27
+ `).bind(a);return e===!1&&(c.restore=d=>a.restore(d)),c}function k8(t,e,r){return Object.keys(t).map(i=>{let{escPath:n,leadingBracket:s,path:a}=t[i],c=s?1:0,d=s?"":".",p=[];for(var m;(m=T8.exec(i))!==null;){let[,R]=m,{index:x,input:A}=m;x>c&&p.push(A.substring(0,x-(R?0:1)))}var w=p.map(R=>`o${d}${R}`).join(" && ");w.length===0?w+=`o${d}${i} != null`:w+=` && o${d}${i} != null`;let S=`
17
28
  switch (true) {
18
- ${m.reverse().map(C=>`
19
- case o${d}${C} === censor:
20
- secret[${n}].circle = ${JSON.stringify(C)}
29
+ ${p.reverse().map(R=>`
30
+ case o${d}${R} === censor:
31
+ secret[${n}].circle = ${JSON.stringify(R)}
21
32
  break
22
33
  `).join(`
23
34
  `)}
24
35
  }
25
- `,_=r?`val, ${JSON.stringify(a)}`:"val";return`
36
+ `,v=r?`val, ${JSON.stringify(a)}`:"val";return`
26
37
  if (${w}) {
27
38
  const val = o${d}${i}
28
39
  if (val === censor) {
29
40
  secret[${n}].precensored = true
30
41
  } else {
31
42
  secret[${n}].val = val
32
- o${d}${i} = ${e?`censor(${_})`:"censor"}
33
- ${E}
43
+ o${d}${i} = ${e?`censor(${v})`:"censor"}
44
+ ${S}
34
45
  }
35
46
  }
36
47
  `}).join(`
37
- `)}function h_(t,e,r){return t===!0?`
48
+ `)}function O8(t,e,r){return t===!0?`
38
49
  {
39
50
  const { wildcards, wcLen, groupRedact, nestedRedact } = this
40
51
  for (var i = 0; i < wcLen; i++) {
@@ -45,16 +56,16 @@ var Hw=Object.create;var La=Object.defineProperty;var Gw=Object.getOwnPropertyDe
45
56
  } else secret[beforeStr] = groupRedact(o, before, censor, ${e}, ${r})
46
57
  }
47
58
  }
48
- `:""}function c_(t){return t===!1?"return o":`
59
+ `:""}function L8(t){return t===!1?"return o":`
49
60
  var s = this.serialize(o)
50
61
  this.restore(o)
51
62
  return s
52
- `}function f_(t,e){return t===!0?"throw Error('fast-redact: primitives cannot be redacted')":e===!1?"return o":"return this.serialize(o)"}});var Tf=ee((C3,Pp)=>{"use strict";Pp.exports={groupRedact:m_,groupRestore:d_,nestedRedact:g_,nestedRestore:p_};function d_({keys:t,values:e,target:r}){if(r==null)return;let i=t.length;for(var n=0;n<i;n++){let o=t[n];r[o]=e[n]}}function m_(t,e,r,i,n){let o=Ip(t,e);if(o==null)return{keys:null,values:null,target:null,flat:!0};let a=Object.keys(o),h=a.length,d=e.length,m=n?[...e]:void 0,p=new Array(h);for(var w=0;w<h;w++){let E=a[w];p[w]=o[E],n?(m[d]=E,o[E]=r(o[E],m)):i?o[E]=r(o[E]):o[E]=r}return{keys:a,values:p,target:o,flat:!0}}function p_(t){let e=t.length;for(var r=0;r<e;r++){let{key:i,target:n,value:o}=t[r];n[i]=o}}function g_(t,e,r,i,n,o,a){let h=Ip(e,r);if(h==null)return;let d=Object.keys(h),m=d.length;for(var p=0;p<m;p++){let w=d[p],{value:E,parent:_,exists:C}=b_(h,w,r,i,n,o,a);C===!0&&_!==null&&t.push({key:i[i.length-1],target:_,value:E})}return t}function y_(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function b_(t,e,r,i,n,o,a){let h=i.length,d=h-1,m=e;var p=-1,w,E,_,C=null,R=!0;if(_=w=t[e],typeof w!="object")return{value:null,parent:null,exists:R};for(;w!=null&&++p<h;){if(e=i[p],C=_,!(e in w)){R=!1;break}if(_=w[e],E=p!==d?_:o?a?n(_,[...r,m,...i]):n(_):n,w[e]=y_(w,e)&&E===_||E===void 0&&n!==void 0?w[e]:E,w=w[e],typeof w!="object")break}return{value:_,parent:C,exists:R}}function Ip(t,e){for(var r=-1,i=e.length,n=t;n!=null&&++r<i;)n=n[e[r]];return n}});var kp=ee((T3,Op)=>{"use strict";var{groupRestore:v_,nestedRestore:w_}=Tf();Op.exports=__;function __({secret:t,wcLen:e}){return function(){if(this.restore)return;let i=Object.keys(t).filter(h=>t[h].precensored===!1),n=S_(t,i),o=e>0,a=o?{secret:t,groupRestore:v_,nestedRestore:w_}:{secret:t};this.restore=Function("o",x_(n,i,o)).bind(a)}}function S_(t,e){return e.map(r=>{let{circle:i,escPath:n,leadingBracket:o}=t[r],h=i?`o.${i} = secret[${n}].val`:`o${o?"":"."}${r} = secret[${n}].val`,d=`secret[${n}].val = undefined`;return`
63
+ `}function N8(t,e){return t===!0?"throw Error('fast-redact: primitives cannot be redacted')":e===!1?"return o":"return this.serialize(o)"}});var mf=H((SC,P5)=>{"use strict";P5.exports={groupRedact:B8,groupRestore:D8,nestedRedact:j8,nestedRestore:z8};function D8({keys:t,values:e,target:r}){if(r==null)return;let i=t.length;for(var n=0;n<i;n++){let s=t[n];r[s]=e[n]}}function B8(t,e,r,i,n){let s=A5(t,e);if(s==null)return{keys:null,values:null,target:null,flat:!0};let a=Object.keys(s),c=a.length,d=e.length,p=n?[...e]:void 0,m=new Array(c);for(var w=0;w<c;w++){let S=a[w];m[w]=s[S],n?(p[d]=S,s[S]=r(s[S],p)):i?s[S]=r(s[S]):s[S]=r}return{keys:a,values:m,target:s,flat:!0}}function z8(t){let e=t.length;for(var r=0;r<e;r++){let{key:i,target:n,value:s}=t[r];n[i]=s}}function j8(t,e,r,i,n,s,a){let c=A5(e,r);if(c==null)return;let d=Object.keys(c),p=d.length;for(var m=0;m<p;m++){let w=d[m],{value:S,parent:v,exists:R}=U8(c,w,r,i,n,s,a);R===!0&&v!==null&&t.push({key:i[i.length-1],target:v,value:S})}return t}function q8(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function U8(t,e,r,i,n,s,a){let c=i.length,d=c-1,p=e;var m=-1,w,S,v,R=null,x=!0;if(v=w=t[e],typeof w!="object")return{value:null,parent:null,exists:x};for(;w!=null&&++m<c;){if(e=i[m],R=v,!(e in w)){x=!1;break}if(v=w[e],S=m!==d?v:s?a?n(v,[...r,p,...i]):n(v):n,w[e]=q8(w,e)&&S===v||S===void 0&&n!==void 0?w[e]:S,w=w[e],typeof w!="object")break}return{value:v,parent:R,exists:x}}function A5(t,e){for(var r=-1,i=e.length,n=t;n!=null&&++r<i;)n=n[e[r]];return n}});var I5=H((xC,T5)=>{"use strict";var{groupRestore:$8,nestedRestore:W8}=mf();T5.exports=F8;function F8({secret:t,wcLen:e}){return function(){if(this.restore)return;let i=Object.keys(t).filter(c=>t[c].precensored===!1),n=H8(t,i),s=e>0,a=s?{secret:t,groupRestore:$8,nestedRestore:W8}:{secret:t};this.restore=Function("o",G8(n,i,s)).bind(a)}}function H8(t,e){return e.map(r=>{let{circle:i,escPath:n,leadingBracket:s}=t[r],c=i?`o.${i} = secret[${n}].val`:`o${s?"":"."}${r} = secret[${n}].val`,d=`secret[${n}].val = undefined`;return`
53
64
  if (secret[${n}].val !== undefined) {
54
- try { ${h} } catch (e) {}
65
+ try { ${c} } catch (e) {}
55
66
  ${d}
56
67
  }
57
- `}).join("")}function x_(t,e,r){let i=r===!0?`
68
+ `}).join("")}function G8(t,e,r){let i=r===!0?`
58
69
  const keys = Object.keys(secret)
59
70
  const len = keys.length
60
71
  for (var i = ${e.length}; i < len; i++) {
@@ -69,59 +80,63 @@ var Hw=Object.create;var La=Object.defineProperty;var Gw=Object.getOwnPropertyDe
69
80
  ${t}
70
81
  ${i}
71
82
  return o
72
- `}});var Lp=ee((A3,Np)=>{"use strict";Np.exports=E_;function E_(t){let{secret:e,censor:r,compileRestore:i,serialize:n,groupRedact:o,nestedRedact:a,wildcards:h,wcLen:d}=t,m=[{secret:e,censor:r,compileRestore:i}];return n!==!1&&m.push({serialize:n}),d>0&&m.push({groupRedact:o,nestedRedact:a,wildcards:h,wcLen:d}),Object.assign(...m)}});var zp=ee((I3,Bp)=>{"use strict";var Dp=Ep(),M_=Cp(),R_=Ap(),C_=kp(),{groupRedact:T_,nestedRedact:A_}=Tf(),I_=Lp(),P_=Cu(),O_=Dp(),Af=t=>t;Af.restore=Af;var k_="[REDACTED]";If.rx=P_;If.validator=Dp;Bp.exports=If;function If(t={}){let e=Array.from(new Set(t.paths||[])),r="serialize"in t&&(t.serialize===!1||typeof t.serialize=="function")?t.serialize:JSON.stringify,i=t.remove;if(i===!0&&r!==JSON.stringify)throw Error("fast-redact \u2013 remove option may only be set when serializer is JSON.stringify");let n=i===!0?void 0:"censor"in t?t.censor:k_,o=typeof n=="function",a=o&&n.length>1;if(e.length===0)return r||Af;O_({paths:e,serialize:r,censor:n});let{wildcards:h,wcLen:d,secret:m}=M_({paths:e,censor:n}),p=C_({secret:m,wcLen:d}),w="strict"in t?t.strict:!0;return R_({secret:m,wcLen:d,serialize:r,strict:w,isCensorFct:o,censorFctTakesPath:a},I_({secret:m,censor:n,compileRestore:p,serialize:r,groupRedact:T_,nestedRedact:A_,wildcards:h,wcLen:d}))}});var uo=ee((P3,Fp)=>{"use strict";var N_=Symbol("pino.setLevel"),L_=Symbol("pino.getLevel"),D_=Symbol("pino.levelVal"),B_=Symbol("pino.useLevelLabels"),z_=Symbol("pino.useOnlyCustomLevels"),F_=Symbol("pino.mixin"),U_=Symbol("pino.lsCache"),j_=Symbol("pino.chindings"),W_=Symbol("pino.parsedChindings"),$_=Symbol("pino.asJson"),q_=Symbol("pino.write"),H_=Symbol("pino.redactFmt"),G_=Symbol("pino.time"),V_=Symbol("pino.timeSliceIndex"),K_=Symbol("pino.stream"),Y_=Symbol("pino.stringify"),Z_=Symbol("pino.stringifySafe"),X_=Symbol("pino.stringifiers"),J_=Symbol("pino.end"),Q_=Symbol("pino.formatOpts"),e1=Symbol("pino.messageKey"),t1=Symbol("pino.nestedKey"),r1=Symbol("pino.nestedKeyStr"),i1=Symbol("pino.mixinMergeStrategy"),n1=Symbol("pino.wildcardFirst"),s1=Symbol.for("pino.serializers"),o1=Symbol.for("pino.formatters"),a1=Symbol.for("pino.hooks"),l1=Symbol.for("pino.metadata");Fp.exports={setLevelSym:N_,getLevelSym:L_,levelValSym:D_,useLevelLabelsSym:B_,mixinSym:F_,lsCacheSym:U_,chindingsSym:j_,parsedChindingsSym:W_,asJsonSym:$_,writeSym:q_,serializersSym:s1,redactFmtSym:H_,timeSym:G_,timeSliceIndexSym:V_,streamSym:K_,stringifySym:Y_,stringifySafeSym:Z_,stringifiersSym:X_,endSym:J_,formatOptsSym:Q_,messageKeySym:e1,nestedKeySym:t1,wildcardFirstSym:n1,needsMetadataGsym:l1,useOnlyCustomLevelsSym:z_,formattersSym:o1,hooksSym:a1,nestedKeyStrSym:r1,mixinMergeStrategySym:i1}});var kf=ee((O3,$p)=>{"use strict";var Of=zp(),{redactFmtSym:u1,wildcardFirstSym:Tu}=uo(),{rx:Pf,validator:h1}=Of,Up=h1({ERR_PATHS_MUST_BE_STRINGS:()=>"pino \u2013 redacted paths must be strings",ERR_INVALID_PATH:t=>`pino \u2013 redact paths array contains an invalid path (${t})`}),jp="[Redacted]",Wp=!1;function c1(t,e){let{paths:r,censor:i}=f1(t),n=r.reduce((h,d)=>{Pf.lastIndex=0;let m=Pf.exec(d),p=Pf.exec(d),w=m[1]!==void 0?m[1].replace(/^(?:"|'|`)(.*)(?:"|'|`)$/,"$1"):m[0];if(w==="*"&&(w=Tu),p===null)return h[w]=null,h;if(h[w]===null)return h;let{index:E}=p,_=`${d.substr(E,d.length-1)}`;return h[w]=h[w]||[],w!==Tu&&h[w].length===0&&h[w].push(...h[Tu]||[]),w===Tu&&Object.keys(h).forEach(function(C){h[C]&&h[C].push(_)}),h[w].push(_),h},{}),o={[u1]:Of({paths:r,censor:i,serialize:e,strict:Wp})},a=(...h)=>e(typeof i=="function"?i(...h):i);return[...Object.keys(n),...Object.getOwnPropertySymbols(n)].reduce((h,d)=>{if(n[d]===null)h[d]=m=>a(m,[d]);else{let m=typeof i=="function"?(p,w)=>i(p,[d,...w]):i;h[d]=Of({paths:n[d],censor:m,serialize:e,strict:Wp})}return h},o)}function f1(t){if(Array.isArray(t))return t={paths:t,censor:jp},Up(t),t;let{paths:e,censor:r=jp,remove:i}=t;if(Array.isArray(e)===!1)throw Error("pino \u2013 redact must contain an array of strings");return i===!0&&(r=void 0),Up({paths:e,censor:r}),{paths:e,censor:r}}$p.exports=c1});var Hp=ee((k3,qp)=>{"use strict";var d1=()=>"",m1=()=>`,"time":${Date.now()}`,p1=()=>`,"time":${Math.round(Date.now()/1e3)}`,g1=()=>`,"time":"${new Date(Date.now()).toISOString()}"`;qp.exports={nullTime:d1,epochTime:m1,unixTime:p1,isoTime:g1}});var Vp=ee((N3,Gp)=>{"use strict";function y1(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}Gp.exports=b1;function b1(t,e,r){var i=r&&r.stringify||y1,n=1;if(typeof t=="object"&&t!==null){var o=e.length+n;if(o===1)return t;var a=new Array(o);a[0]=i(t);for(var h=1;h<o;h++)a[h]=i(e[h]);return a.join(" ")}if(typeof t!="string")return t;var d=e.length;if(d===0)return t;for(var m="",p=1-n,w=-1,E=t&&t.length||0,_=0;_<E;){if(t.charCodeAt(_)===37&&_+1<E){switch(w=w>-1?w:0,t.charCodeAt(_+1)){case 100:case 102:if(p>=d||(w<_&&(m+=t.slice(w,_)),e[p]==null))break;m+=Number(e[p]),w=_=_+2;break;case 105:if(p>=d||(w<_&&(m+=t.slice(w,_)),e[p]==null))break;m+=Math.floor(Number(e[p])),w=_=_+2;break;case 79:case 111:case 106:if(p>=d||(w<_&&(m+=t.slice(w,_)),e[p]===void 0))break;var C=typeof e[p];if(C==="string"){m+="'"+e[p]+"'",w=_+2,_++;break}if(C==="function"){m+=e[p].name||"<anonymous>",w=_+2,_++;break}m+=i(e[p]),w=_+2,_++;break;case 115:if(p>=d)break;w<_&&(m+=t.slice(w,_)),m+=String(e[p]),w=_+2,_++;break;case 37:w<_&&(m+=t.slice(w,_)),m+="%",w=_+2,_++,p--;break}++p}++_}return w===-1?t:(w<E&&(m+=t.slice(w)),m)}});var Lf=ee((L3,Nf)=>{"use strict";if(typeof SharedArrayBuffer<"u"&&typeof Atomics<"u"){let e=function(r){if((r>0&&r<1/0)===!1)throw typeof r!="number"&&typeof r!="bigint"?TypeError("sleep: ms must be a number"):RangeError("sleep: ms must be a number that is greater than 0 but less than Infinity");Atomics.wait(t,0,0,Number(r))},t=new Int32Array(new SharedArrayBuffer(4));Nf.exports=e}else{let t=function(e){if((e>0&&e<1/0)===!1)throw typeof e!="number"&&typeof e!="bigint"?TypeError("sleep: ms must be a number"):RangeError("sleep: ms must be a number that is greater than 0 but less than Infinity");let i=Date.now()+Number(e);for(;i>Date.now(););};Nf.exports=t}});var Jp=ee((D3,Xp)=>{"use strict";var fr=require("fs"),v1=require("events"),w1=require("util").inherits,Kp=require("path"),Yp=Lf(),Df=100,Bf=16*1024*1024;function Zp(t,e){e._opening=!0,e._writing=!0,e._asyncDrainScheduled=!1;function r(n,o){if(n){e._reopening=!1,e._writing=!1,e._opening=!1,e.sync?process.nextTick(()=>{e.listenerCount("error")>0&&e.emit("error",n)}):e.emit("error",n);return}e.fd=o,e.file=t,e._reopening=!1,e._opening=!1,e._writing=!1,e.sync?process.nextTick(()=>e.emit("ready")):e.emit("ready"),!e._reopening&&!e._writing&&e._len>e.minLength&&!e.destroyed&&ho(e)}let i=e.append?"a":"w";if(e.sync)try{e.mkdir&&fr.mkdirSync(Kp.dirname(t),{recursive:!0});let n=fr.openSync(t,i);r(null,n)}catch(n){throw r(n),n}else e.mkdir?fr.mkdir(Kp.dirname(t),{recursive:!0},n=>{if(n)return r(n);fr.open(t,i,r)}):fr.open(t,i,r)}function Qt(t){if(!(this instanceof Qt))return new Qt(t);let{fd:e,dest:r,minLength:i,maxLength:n,sync:o,append:a=!0,mkdir:h,retryEAGAIN:d}=t||{};if(e=e||r,this._bufs=[],this._len=0,this.fd=-1,this._writing=!1,this._writingBuf="",this._ending=!1,this._reopening=!1,this._asyncDrainScheduled=!1,this._hwm=Math.max(i||0,16387),this.file=null,this.destroyed=!1,this.minLength=i||0,this.maxLength=n||0,this.sync=o||!1,this.append=a||!1,this.retryEAGAIN=d||(()=>!0),this.mkdir=h||!1,typeof e=="number")this.fd=e,process.nextTick(()=>this.emit("ready"));else if(typeof e=="string")Zp(e,this);else throw new Error("SonicBoom supports only file descriptors and files");if(this.minLength>=Bf)throw new Error(`minLength should be smaller than MAX_WRITE (${Bf})`);this.release=(m,p)=>{if(m){if(m.code==="EAGAIN"&&this.retryEAGAIN(m,this._writingBuf.length,this._len-this._writingBuf.length))if(this.sync)try{Yp(Df),this.release(void 0,0)}catch(E){this.release(E)}else setTimeout(()=>{fr.write(this.fd,this._writingBuf,"utf8",this.release)},Df);else this._writing=!1,this.emit("error",m);return}if(this._len-=p,this._writingBuf=this._writingBuf.slice(p),this._writingBuf.length){if(!this.sync){fr.write(this.fd,this._writingBuf,"utf8",this.release);return}try{do{let E=fr.writeSync(this.fd,this._writingBuf,"utf8");this._len-=E,this._writingBuf=this._writingBuf.slice(E)}while(this._writingBuf)}catch(E){this.release(E);return}}let w=this._len;this._reopening?(this._writing=!1,this._reopening=!1,this.reopen()):w>this.minLength?ho(this):this._ending?w>0?ho(this):(this._writing=!1,Au(this)):(this._writing=!1,this.sync?this._asyncDrainScheduled||(this._asyncDrainScheduled=!0,process.nextTick(_1,this)):this.emit("drain"))},this.on("newListener",function(m){m==="drain"&&(this._asyncDrainScheduled=!1)})}function _1(t){t.listenerCount("drain")>0&&(t._asyncDrainScheduled=!1,t.emit("drain"))}w1(Qt,v1);Qt.prototype.write=function(t){if(this.destroyed)throw new Error("SonicBoom destroyed");let e=this._len+t.length,r=this._bufs;return this.maxLength&&e>this.maxLength?(this.emit("drop",t),this._len<this._hwm):(!this._writing&&e>Bf?r.push(t):r.length===0?r[0]=""+t:r[r.length-1]+=t,this._len=e,!this._writing&&this._len>=this.minLength&&ho(this),this._len<this._hwm)};Qt.prototype.flush=function(){if(this.destroyed)throw new Error("SonicBoom destroyed");this._writing||this.minLength<=0||(this._bufs.length===0&&this._bufs.push(""),ho(this))};Qt.prototype.reopen=function(t){if(this.destroyed)throw new Error("SonicBoom destroyed");if(this._opening){this.once("ready",()=>{this.reopen(t)});return}if(this._ending)return;if(!this.file)throw new Error("Unable to reopen a file descriptor, you must pass a file to SonicBoom");if(this._reopening=!0,this._writing)return;let e=this.fd;this.once("ready",()=>{e!==this.fd&&fr.close(e,r=>{if(r)return this.emit("error",r)})}),Zp(t||this.file,this)};Qt.prototype.end=function(){if(this.destroyed)throw new Error("SonicBoom destroyed");if(this._opening){this.once("ready",()=>{this.end()});return}this._ending||(this._ending=!0,!this._writing&&(this._len>0&&this.fd>=0?ho(this):Au(this)))};Qt.prototype.flushSync=function(){if(this.destroyed)throw new Error("SonicBoom destroyed");if(this.fd<0)throw new Error("sonic boom is not ready yet");for(!this._writing&&this._writingBuf.length>0&&(this._bufs.unshift(this._writingBuf),this._writingBuf="");this._bufs.length;){let t=this._bufs[0];try{this._len-=fr.writeSync(this.fd,t,"utf8"),this._bufs.shift()}catch(e){if(e.code!=="EAGAIN"||!this.retryEAGAIN(e,t.length,this._len-t.length))throw e;Yp(Df)}}};Qt.prototype.destroy=function(){this.destroyed||Au(this)};function ho(t){let e=t.release;if(t._writing=!0,t._writingBuf=t._writingBuf||t._bufs.shift(),t.sync)try{let r=fr.writeSync(t.fd,t._writingBuf,"utf8");e(null,r)}catch(r){e(r)}else fr.write(t.fd,t._writingBuf,"utf8",e)}function Au(t){if(t.fd===-1){t.once("ready",Au.bind(null,t));return}fr.close(t.fd,e=>{if(e){t.emit("error",e);return}t._ending&&!t._writing&&t.emit("finish"),t.emit("close")}),t.destroyed=!0,t._bufs=[]}Qt.SonicBoom=Qt;Qt.default=Qt;Xp.exports=Qt});var e0=ee((B3,Qp)=>{"use strict";var{format:zf}=require("util");function S1(){let t={},e=new Map;function r(n,o,a){if(!n)throw new Error("Warning name must not be empty");if(!o)throw new Error("Warning code must not be empty");if(!a)throw new Error("Warning message must not be empty");if(o=o.toUpperCase(),t[o]!==void 0)throw new Error(`The code '${o}' already exist`);function h(d,m,p){let w;return d&&m&&p?w=zf(a,d,m,p):d&&m?w=zf(a,d,m):d?w=zf(a,d):w=a,{code:o,name:n,message:w}}return e.set(o,!1),t[o]=h,t[o]}function i(n,o,a,h){if(t[n]===void 0)throw new Error(`The code '${n}' does not exist`);if(e.get(n)===!0)return;e.set(n,!0);let d=t[n](o,a,h);process.emitWarning(d.message,d.name,d.code)}return{create:r,emit:i,emitted:e}}Qp.exports=S1});var i0=ee((z3,r0)=>{"use strict";var Ff=e0()();r0.exports=Ff;var t0="PinoWarning";Ff.create(t0,"PINODEP008","prettyPrint is deprecated, look at https://github.com/pinojs/pino-pretty for alternatives.");Ff.create(t0,"PINODEP009","The use of pino.final is discouraged in Node.js v14+ and not required. It will be removed in the next major version")});var jf=ee((F3,a0)=>{"use strict";function n0(t,e,r,i){function n(){let o=e.deref();o!==void 0&&r(o,i)}t[i]=n,process.once(i,n)}var s0=new FinalizationRegistry(o0),Uf=new WeakMap;function o0(t){process.removeListener("exit",t.exit),process.removeListener("beforeExit",t.beforeExit)}function x1(t,e){if(t===void 0)throw new Error("the object can't be undefined");let r=new WeakRef(t),i={};Uf.set(t,i),s0.register(t,i),n0(i,r,e,"exit"),n0(i,r,e,"beforeExit")}function E1(t){let e=Uf.get(t);Uf.delete(t),e&&o0(e),s0.unregister(t)}a0.exports={register:x1,unregister:E1}});var u0=ee((U3,l0)=>{"use strict";function M1(t,e,r,i,n){let o=Date.now()+i,a=Atomics.load(t,e);if(a===r){n(null,"ok");return}let h=a,d=m=>{Date.now()>o?n(null,"timed-out"):setTimeout(()=>{h=a,a=Atomics.load(t,e),a===h?d(m>=1e3?1e3:m*2):a===r?n(null,"ok"):n(null,"not-equal")},m)};d(1)}function R1(t,e,r,i,n){let o=Date.now()+i,a=Atomics.load(t,e);if(a!==r){n(null,"ok");return}let h=d=>{Date.now()>o?n(null,"timed-out"):setTimeout(()=>{a=Atomics.load(t,e),a!==r?n(null,"ok"):h(d>=1e3?1e3:d*2)},d)};h(1)}l0.exports={wait:M1,waitDiff:R1}});var c0=ee((j3,h0)=>{"use strict";h0.exports={WRITE_INDEX:4,READ_INDEX:8}});var g0=ee(($3,p0)=>{"use strict";var{EventEmitter:C1}=require("events"),{Worker:T1}=require("worker_threads"),{join:A1}=require("path"),{pathToFileURL:I1}=require("url"),{wait:P1}=u0(),{WRITE_INDEX:er,READ_INDEX:ui}=c0(),O1=require("buffer"),k1=require("assert"),H=Symbol("kImpl"),N1=O1.constants.MAX_STRING_LENGTH,Pu=class{constructor(e){this._value=e}deref(){return this._value}},L1=global.FinalizationRegistry||class{register(){}unregister(){}},D1=global.WeakRef||Pu,f0=new L1(t=>{t.exited||t.terminate()});function B1(t,e){let{filename:r,workerData:i}=e,o=("__bundlerPathsOverrides"in globalThis?globalThis.__bundlerPathsOverrides:{})["thread-stream-worker"]||A1(__dirname,"lib","worker.js"),a=new T1(o,{...e.workerOpts,workerData:{filename:r.indexOf("file://")===0?r:I1(r).href,dataBuf:t[H].dataBuf,stateBuf:t[H].stateBuf,workerData:i}});return a.stream=new Pu(t),a.on("message",z1),a.on("exit",m0),f0.register(t,a),a}function d0(t){k1(!t[H].sync),t[H].needDrain&&(t[H].needDrain=!1,t.emit("drain"))}function Iu(t){let e=Atomics.load(t[H].state,er),r=t[H].data.length-e;if(r>0){if(t[H].buf.length===0){t[H].flushing=!1,t[H].ending?Hf(t):t[H].needDrain&&process.nextTick(d0,t);return}let i=t[H].buf.slice(0,r),n=Buffer.byteLength(i);n<=r?(t[H].buf=t[H].buf.slice(r),Ou(t,i,Iu.bind(null,t))):t.flush(()=>{if(!t.destroyed){for(Atomics.store(t[H].state,ui,0),Atomics.store(t[H].state,er,0);n>t[H].data.length;)r=r/2,i=t[H].buf.slice(0,r),n=Buffer.byteLength(i);t[H].buf=t[H].buf.slice(r),Ou(t,i,Iu.bind(null,t))}})}else if(r===0){if(e===0&&t[H].buf.length===0)return;t.flush(()=>{Atomics.store(t[H].state,ui,0),Atomics.store(t[H].state,er,0),Iu(t)})}else throw new Error("overwritten")}function z1(t){let e=this.stream.deref();if(e===void 0){this.exited=!0,this.terminate();return}switch(t.code){case"READY":this.stream=new D1(e),e.flush(()=>{e[H].ready=!0,e.emit("ready")});break;case"ERROR":co(e,t.err);break;default:throw new Error("this should not happen: "+t.code)}}function m0(t){let e=this.stream.deref();e!==void 0&&(f0.unregister(e),e.worker.exited=!0,e.worker.off("exit",m0),co(e,t!==0?new Error("The worker thread exited"):null))}var $f=class extends C1{constructor(e={}){if(super(),e.bufferSize<4)throw new Error("bufferSize must at least fit a 4-byte utf-8 char");this[H]={},this[H].stateBuf=new SharedArrayBuffer(128),this[H].state=new Int32Array(this[H].stateBuf),this[H].dataBuf=new SharedArrayBuffer(e.bufferSize||4*1024*1024),this[H].data=Buffer.from(this[H].dataBuf),this[H].sync=e.sync||!1,this[H].ending=!1,this[H].ended=!1,this[H].needDrain=!1,this[H].destroyed=!1,this[H].flushing=!1,this[H].ready=!1,this[H].finished=!1,this[H].errored=null,this[H].closed=!1,this[H].buf="",this.worker=B1(this,e)}write(e){if(this[H].destroyed)throw new Error("the worker has exited");if(this[H].ending)throw new Error("the worker is ending");if(this[H].flushing&&this[H].buf.length+e.length>=N1)try{Wf(this),this[H].flushing=!0}catch(r){return co(this,r),!1}if(this[H].buf+=e,this[H].sync)try{return Wf(this),!0}catch(r){return co(this,r),!1}return this[H].flushing||(this[H].flushing=!0,setImmediate(Iu,this)),this[H].needDrain=this[H].data.length-this[H].buf.length-Atomics.load(this[H].state,er)<=0,!this[H].needDrain}end(){this[H].destroyed||(this[H].ending=!0,Hf(this))}flush(e){if(this[H].destroyed){typeof e=="function"&&process.nextTick(e,new Error("the worker has exited"));return}let r=Atomics.load(this[H].state,er);P1(this[H].state,ui,r,1/0,(i,n)=>{if(i){co(this,i),process.nextTick(e,i);return}if(n==="not-equal"){this.flush(e);return}process.nextTick(e)})}flushSync(){this[H].destroyed||(Wf(this),qf(this))}unref(){this.worker.unref()}ref(){this.worker.ref()}get ready(){return this[H].ready}get destroyed(){return this[H].destroyed}get closed(){return this[H].closed}get writable(){return!this[H].destroyed&&!this[H].ending}get writableEnded(){return this[H].ending}get writableFinished(){return this[H].finished}get writableNeedDrain(){return this[H].needDrain}get writableObjectMode(){return!1}get writableErrored(){return this[H].errored}};function co(t,e){t[H].destroyed||(t[H].destroyed=!0,e&&(t[H].errored=e,t.emit("error",e)),t.worker.exited?setImmediate(()=>{t[H].closed=!0,t.emit("close")}):t.worker.terminate().catch(()=>{}).then(()=>{t[H].closed=!0,t.emit("close")}))}function Ou(t,e,r){let i=Atomics.load(t[H].state,er),n=Buffer.byteLength(e);return t[H].data.write(e,i),Atomics.store(t[H].state,er,i+n),Atomics.notify(t[H].state,er),r(),!0}function Hf(t){if(!(t[H].ended||!t[H].ending||t[H].flushing)){t[H].ended=!0;try{t.flushSync();let e=Atomics.load(t[H].state,ui);Atomics.store(t[H].state,er,-1),Atomics.notify(t[H].state,er);let r=0;for(;e!==-1;){if(Atomics.wait(t[H].state,ui,e,1e3),e=Atomics.load(t[H].state,ui),e===-2)throw new Error("end() failed");if(++r===10)throw new Error("end() took too long (10s)")}process.nextTick(()=>{t[H].finished=!0,t.emit("finish")})}catch(e){co(t,e)}}}function Wf(t){let e=()=>{t[H].ending?Hf(t):t[H].needDrain&&process.nextTick(d0,t)};for(t[H].flushing=!1;t[H].buf.length!==0;){let r=Atomics.load(t[H].state,er),i=t[H].data.length-r;if(i===0){qf(t),Atomics.store(t[H].state,ui,0),Atomics.store(t[H].state,er,0);continue}else if(i<0)throw new Error("overwritten");let n=t[H].buf.slice(0,i),o=Buffer.byteLength(n);if(o<=i)t[H].buf=t[H].buf.slice(i),Ou(t,n,e);else{for(qf(t),Atomics.store(t[H].state,ui,0),Atomics.store(t[H].state,er,0);o>t[H].buf.length;)i=i/2,n=t[H].buf.slice(0,i),o=Buffer.byteLength(n);t[H].buf=t[H].buf.slice(i),Ou(t,n,e)}}}function qf(t){if(t[H].flushing)throw new Error("unable to flush while flushing");let e=Atomics.load(t[H].state,er),r=0;for(;;){let i=Atomics.load(t[H].state,ui);if(i===-2)throw new Error("_flushSync failed");if(i!==e)Atomics.wait(t[H].state,ui,i,1e3);else break;if(++r===10)throw new Error("_flushSync took too long (10s)")}}p0.exports=$f});var Vf=ee((q3,b0)=>{"use strict";var{createRequire:F1}=require("module"),U1=Cf(),{join:Gf,isAbsolute:j1}=require("path"),W1=Lf(),ku;global.WeakRef&&global.WeakMap&&global.FinalizationRegistry&&(ku=jf());var $1=g0();function q1(t){if(ku)ku.register(t,y0),t.on("close",function(){ku.unregister(t)});else{let e=y0.bind(null,t);process.once("beforeExit",e),process.once("exit",e),t.on("close",function(){process.removeListener("beforeExit",e),process.removeListener("exit",e)})}}function H1(t,e,r){let i=new $1({filename:t,workerData:e,workerOpts:r});i.on("ready",n),i.on("close",function(){process.removeListener("exit",o)}),process.on("exit",o);function n(){process.removeListener("exit",o),i.unref(),r.autoEnd!==!1&&q1(i)}function o(){i.closed||(i.flushSync(),W1(100),i.end())}return i}function y0(t){t.ref(),t.flushSync(),t.end(),t.once("close",function(){t.unref()})}function G1(t){let{pipeline:e,targets:r,levels:i,options:n={},worker:o={},caller:a=U1()}=t,h=typeof a=="string"?[a]:a,d="__bundlerPathsOverrides"in globalThis?globalThis.__bundlerPathsOverrides:{},m=t.target;if(m&&r)throw new Error("only one of target or targets can be specified");return r?(m=d["pino-worker"]||Gf(__dirname,"worker.js"),n.targets=r.map(w=>({...w,target:p(w.target)}))):e&&(m=d["pino-pipeline-worker"]||Gf(__dirname,"worker-pipeline.js"),n.targets=e.map(w=>({...w,target:p(w.target)}))),i&&(n.levels=i),H1(p(m),n,o);function p(w){if(w=d[w]||w,j1(w)||w.indexOf("file://")===0)return w;if(w==="pino/file")return Gf(__dirname,"..","file.js");let E;for(let _ of h)try{E=F1(_).resolve(w);break}catch{continue}if(!E)throw new Error(`unable to determine transport target for "${w}"`);return E}}b0.exports=G1});var Lu=ee((H3,I0)=>{"use strict";var v0=Vp(),{mapHttpRequest:V1,mapHttpResponse:K1}=Rf(),Zf=Jp(),E0=i0(),{lsCacheSym:Y1,chindingsSym:Xf,parsedChindingsSym:Kf,writeSym:w0,serializersSym:Jf,formatOptsSym:_0,endSym:Z1,stringifiersSym:Qf,stringifySym:M0,stringifySafeSym:ed,wildcardFirstSym:R0,needsMetadataGsym:C0,redactFmtSym:X1,streamSym:J1,nestedKeySym:Q1,formattersSym:td,messageKeySym:T0,nestedKeyStrSym:eS}=uo(),{isMainThread:tS}=require("worker_threads"),rS=Vf();function Ba(){}function iS(t,e){if(!e)return r;return function(...n){e.call(this,n,r,t)};function r(i,...n){if(typeof i=="object"){let o=i;i!==null&&(i.method&&i.headers&&i.socket?i=V1(i):typeof i.setHeader=="function"&&(i=K1(i)));let a;o===null&&n.length===0?a=[null]:(o=n.shift(),a=n),this[w0](i,v0(o,a,this[_0]),t)}else this[w0](null,v0(i,n,this[_0]),t)}}function S0(t){let e="",r=0,i=!1,n=255,o=t.length;if(o>100)return JSON.stringify(t);for(var a=0;a<o&&n>=32;a++)n=t.charCodeAt(a),(n===34||n===92)&&(e+=t.slice(r,a)+"\\",r=a,i=!0);return i?e+=t.slice(r):e=t,n<32?JSON.stringify(t):'"'+e+'"'}function nS(t,e,r,i){let n=this[M0],o=this[ed],a=this[Qf],h=this[Z1],d=this[Xf],m=this[Jf],p=this[td],w=this[T0],E=this[Y1][r]+i;E=E+d;let _;p.log&&(t=p.log(t));let C=a[R0],R="";for(let A in t)if(_=t[A],Object.prototype.hasOwnProperty.call(t,A)&&_!==void 0){_=m[A]?m[A](_):_;let k=a[A]||C;switch(typeof _){case"undefined":case"function":continue;case"number":Number.isFinite(_)===!1&&(_=null);case"boolean":k&&(_=k(_));break;case"string":_=(k||S0)(_);break;default:_=(k||n)(_,o)}if(_===void 0)continue;R+=',"'+A+'":'+_}let I="";if(e!==void 0){_=m[w]?m[w](e):e;let A=a[w]||C;switch(typeof _){case"function":break;case"number":Number.isFinite(_)===!1&&(_=null);case"boolean":A&&(_=A(_)),I=',"'+w+'":'+_;break;case"string":_=(A||S0)(_),I=',"'+w+'":'+_;break;default:_=(A||n)(_,o),I=',"'+w+'":'+_}}return this[Q1]&&R?E+this[eS]+R.slice(1)+"}"+I+h:E+R+I+h}function sS(t,e){let r,i=t[Xf],n=t[M0],o=t[ed],a=t[Qf],h=a[R0],d=t[Jf];e=t[td].bindings(e);for(let p in e)if(r=e[p],(p!=="level"&&p!=="serializers"&&p!=="formatters"&&p!=="customLevels"&&e.hasOwnProperty(p)&&r!==void 0)===!0){if(r=d[p]?d[p](r):r,r=(a[p]||h||n)(r,o),r===void 0)continue;i+=',"'+p+'":'+r}return i}function A0(t,e,r,i){if(e&&typeof e=="function")return e=e.bind(i),Yf(e(t),r,t);try{let n=require("pino-pretty").prettyFactory;return n.asMetaWrapper=Yf,Yf(n(t),r,t)}catch(n){throw n.message.startsWith("Cannot find module 'pino-pretty'")?Error("Missing `pino-pretty` module: `pino-pretty` must be installed separately"):n}}function Yf(t,e,r){r=Object.assign({suppressFlushSyncWarning:!1},r);let i=!1;return{[C0]:!0,lastLevel:0,lastMsg:null,lastObj:null,lastLogger:null,flushSync(){r.suppressFlushSyncWarning||i||(i=!0,x0(e,this),e.write(t(Object.assign({level:40,msg:"pino.final with prettyPrint does not support flushing",time:Date.now()},this.chindings()))))},chindings(){let n=this.lastLogger,o=null;return n?(n.hasOwnProperty(Kf)?o=n[Kf]:(o=JSON.parse("{"+n[Xf].substr(1)+"}"),n[Kf]=o),o):null},write(n){let o=this.lastLogger,a=this.chindings(),h=this.lastTime;typeof h=="number"||(h.match(/^\d+/)?h=parseInt(h):h=h.slice(1,-1));let d=this.lastObj,m=this.lastMsg,p=null,w=o[td],E=w.log?w.log(d):d,_=o[T0];m&&E&&!Object.prototype.hasOwnProperty.call(E,_)&&(E[_]=m);let C=Object.assign({level:this.lastLevel,time:h},E,p),R=o[Jf],I=Object.keys(R);for(var A=0;A<I.length;A++){let W=I[A];C[W]!==void 0&&(C[W]=R[W](C[W]))}for(let W in a)C.hasOwnProperty(W)||(C[W]=a[W]);let D=o[Qf][X1],j=t(typeof D=="function"?D(C):C);j!==void 0&&(x0(e,this),e.write(j))}}}function oS(t){return t.write!==t.constructor.prototype.write}function Nu(t){let e=new Zf(t);return e.on("error",r),!t.sync&&tS&&aS(e),e;function r(i){if(i.code==="EPIPE"){e.write=Ba,e.end=Ba,e.flushSync=Ba,e.destroy=Ba;return}e.removeListener("error",r),e.emit("error",i)}}function aS(t){if(global.WeakRef&&global.WeakMap&&global.FinalizationRegistry){let e=jf();e.register(t,lS),t.on("close",function(){e.unregister(t)})}}function lS(t,e){t.destroyed||(e==="beforeExit"?(t.flush(),t.on("drain",function(){t.end()})):t.flushSync())}function uS(t){return function(r,i,n={},o){if(typeof n=="string")o=Nu({dest:n,sync:!0}),n={};else if(typeof o=="string"){if(n&&n.transport)throw Error("only one of option.transport or stream can be specified");o=Nu({dest:o,sync:!0})}else if(n instanceof Zf||n.writable||n._writableState)o=n,n={};else if(n.transport){if(n.transport instanceof Zf||n.transport.writable||n.transport._writableState)throw Error("option.transport do not allow stream, please pass to option directly. e.g. pino(transport)");if(n.transport.targets&&n.transport.targets.length&&n.formatters&&typeof n.formatters.level=="function")throw Error("option.transport.targets do not allow custom level formatters");let p;n.customLevels&&(p=n.useOnlyCustomLevels?n.customLevels:Object.assign({},n.levels,n.customLevels)),o=rS({caller:i,...n.transport,levels:p})}if(n=Object.assign({},t,n),n.serializers=Object.assign({},t.serializers,n.serializers),n.formatters=Object.assign({},t.formatters,n.formatters),"onTerminated"in n)throw Error("The onTerminated option has been removed, use pino.final instead");"changeLevelName"in n&&(process.emitWarning("The changeLevelName option is deprecated and will be removed in v7. Use levelKey instead.",{code:"changeLevelName_deprecation"}),n.levelKey=n.changeLevelName,delete n.changeLevelName);let{enabled:a,prettyPrint:h,prettifier:d,messageKey:m}=n;if(a===!1&&(n.level="silent"),o=o||process.stdout,o===process.stdout&&o.fd>=0&&!oS(o)&&(o=Nu({fd:o.fd,sync:!0})),h){E0.emit("PINODEP008");let p=Object.assign({messageKey:m},h);o=A0(p,d,o,r)}return{opts:n,stream:o}}}function hS(t,e){if(Number(process.versions.node.split(".")[0])>=14&&E0.emit("PINODEP009"),typeof t>"u"||typeof t.child!="function")throw Error("expected a pino logger instance");let i=typeof e<"u";if(i&&typeof e!="function")throw Error("if supplied, the handler parameter should be a function");let n=t[J1];if(typeof n.flushSync!="function")throw Error("final requires a stream that has a flushSync method, such as pino.destination");let o=new Proxy(t,{get:(a,h)=>h in a.levels.values?(...d)=>{a[h](...d),n.flushSync()}:a[h]});if(!i){try{n.flushSync()}catch{}return o}return(a=null,...h)=>{try{n.flushSync()}catch{}return e(a,o,...h)}}function cS(t,e){try{return JSON.stringify(t)}catch{try{return(e||this[ed])(t)}catch{return'"[unable to serialize, circular reference is too complex to analyze]"'}}}function fS(t,e,r){return{level:t,bindings:e,log:r}}function x0(t,e){t[C0]===!0&&(t.lastLevel=e.lastLevel,t.lastMsg=e.lastMsg,t.lastObj=e.lastObj,t.lastTime=e.lastTime,t.lastLogger=e.lastLogger)}function dS(t){let e=Number(t);return typeof t=="string"&&Number.isFinite(e)?e:t}I0.exports={noop:Ba,buildSafeSonicBoom:Nu,getPrettyStream:A0,asChindings:sS,asJson:nS,genLog:iS,createArgsNormalizer:uS,final:hS,stringify:cS,buildFormatters:fS,normalizeDestFileDescriptor:dS}});var Du=ee((G3,O0)=>{"use strict";var{lsCacheSym:mS,levelValSym:rd,useOnlyCustomLevelsSym:pS,streamSym:gS,formattersSym:yS,hooksSym:bS}=uo(),{noop:vS,genLog:ss}=Lu(),jr={trace:10,debug:20,info:30,warn:40,error:50,fatal:60},P0={fatal:t=>{let e=ss(jr.fatal,t);return function(...r){let i=this[gS];if(e.call(this,...r),typeof i.flushSync=="function")try{i.flushSync()}catch{}}},error:t=>ss(jr.error,t),warn:t=>ss(jr.warn,t),info:t=>ss(jr.info,t),debug:t=>ss(jr.debug,t),trace:t=>ss(jr.trace,t)},id=Object.keys(jr).reduce((t,e)=>(t[jr[e]]=e,t),{}),wS=Object.keys(id).reduce((t,e)=>(t[e]='{"level":'+Number(e),t),{});function _S(t){let e=t[yS].level,{labels:r}=t.levels,i={};for(let n in r){let o=e(r[n],Number(n));i[n]=JSON.stringify(o).slice(0,-1)}return t[mS]=i,t}function SS(t,e){if(e)return!1;switch(t){case"fatal":case"error":case"warn":case"info":case"debug":case"trace":return!0;default:return!1}}function xS(t){let{labels:e,values:r}=this.levels;if(typeof t=="number"){if(e[t]===void 0)throw Error("unknown level value"+t);t=e[t]}if(r[t]===void 0)throw Error("unknown level "+t);let i=this[rd],n=this[rd]=r[t],o=this[pS],a=this[bS].logMethod;for(let h in r){if(n>r[h]){this[h]=vS;continue}this[h]=SS(h,o)?P0[h](a):ss(r[h],a)}this.emit("level-change",t,n,e[i],i)}function ES(t){let{levels:e,levelVal:r}=this;return e&&e.labels?e.labels[r]:""}function MS(t){let{values:e}=this.levels,r=e[t];return r!==void 0&&r>=this[rd]}function RS(t=null,e=!1){let r=t?Object.keys(t).reduce((o,a)=>(o[t[a]]=a,o),{}):null,i=Object.assign(Object.create(Object.prototype,{Infinity:{value:"silent"}}),e?null:id,r),n=Object.assign(Object.create(Object.prototype,{silent:{value:1/0}}),e?null:jr,t);return{labels:i,values:n}}function CS(t,e,r){if(typeof t=="number"){if(![].concat(Object.keys(e||{}).map(o=>e[o]),r?[]:Object.keys(id).map(o=>+o),1/0).includes(t))throw Error(`default level:${t} must be included in custom levels`);return}let i=Object.assign(Object.create(Object.prototype,{silent:{value:1/0}}),r?null:jr,e);if(!(t in i))throw Error(`default level:${t} must be included in custom levels`)}function TS(t,e){let{labels:r,values:i}=t;for(let n in e){if(n in i)throw Error("levels cannot be overridden");if(e[n]in r)throw Error("pre-existing level values cannot be used for new levels")}}O0.exports={initialLsCache:wS,genLsCache:_S,levelMethods:P0,getLevel:ES,setLevel:xS,isLevelEnabled:MS,mappings:RS,levels:jr,assertNoLevelCollisions:TS,assertDefaultLevelFound:CS}});var k0=ee((V3,AS)=>{AS.exports={name:"pino",version:"7.11.0",description:"super fast, all natural json logger",main:"pino.js",type:"commonjs",types:"pino.d.ts",browser:"./browser.js",files:["pino.js","file.js","pino.d.ts","bin.js","browser.js","pretty.js","usage.txt","test","docs","example.js","lib"],scripts:{docs:"docsify serve","browser-test":"airtap --local 8080 test/browser*test.js",lint:"eslint .",test:"npm run lint && npm run transpile && tap --ts && jest test/jest && npm run test-types","test-ci":"npm run lint && npm run transpile && tap --ts --no-check-coverage --coverage-report=lcovonly && npm run test-types","test-ci-pnpm":"pnpm run lint && npm run transpile && tap --ts --no-coverage --no-check-coverage && pnpm run test-types","test-ci-yarn-pnp":"yarn run lint && npm run transpile && tap --ts --no-check-coverage --coverage-report=lcovonly","test-types":"tsc && tsd && ts-node test/types/pino.ts",transpile:"node ./test/fixtures/ts/transpile.cjs","cov-ui":"tap --ts --coverage-report=html",bench:"node benchmarks/utils/runbench all","bench-basic":"node benchmarks/utils/runbench basic","bench-object":"node benchmarks/utils/runbench object","bench-deep-object":"node benchmarks/utils/runbench deep-object","bench-multi-arg":"node benchmarks/utils/runbench multi-arg","bench-longs-tring":"node benchmarks/utils/runbench long-string","bench-child":"node benchmarks/utils/runbench child","bench-child-child":"node benchmarks/utils/runbench child-child","bench-child-creation":"node benchmarks/utils/runbench child-creation","bench-formatters":"node benchmarks/utils/runbench formatters","update-bench-doc":"node benchmarks/utils/generate-benchmark-doc > docs/benchmarks.md"},bin:{pino:"./bin.js"},precommit:"test",repository:{type:"git",url:"git+https://github.com/pinojs/pino.git"},keywords:["fast","logger","stream","json"],author:"Matteo Collina <hello@matteocollina.com>",contributors:["David Mark Clements <huperekchuno@googlemail.com>","James Sumners <james.sumners@gmail.com>","Thomas Watson Steen <w@tson.dk> (https://twitter.com/wa7son)"],license:"MIT",bugs:{url:"https://github.com/pinojs/pino/issues"},homepage:"http://getpino.io",devDependencies:{"@types/flush-write-stream":"^1.0.0","@types/node":"^17.0.0","@types/tap":"^15.0.6",airtap:"4.0.4",benchmark:"^2.1.4",bole:"^4.0.0",bunyan:"^1.8.14","docsify-cli":"^4.4.1",eslint:"^7.17.0","eslint-config-standard":"^16.0.3","eslint-plugin-import":"^2.22.1","eslint-plugin-node":"^11.1.0","eslint-plugin-promise":"^5.1.0",execa:"^5.0.0",fastbench:"^1.0.1","flush-write-stream":"^2.0.0","import-fresh":"^3.2.1",jest:"^27.3.1",log:"^6.0.0",loglevel:"^1.6.7","pino-pretty":"^v7.6.0","pre-commit":"^1.2.2",proxyquire:"^2.1.3",pump:"^3.0.0",rimraf:"^3.0.2",semver:"^7.0.0",split2:"^4.0.0",steed:"^1.1.3","strip-ansi":"^6.0.0",tap:"^16.0.0",tape:"^5.0.0",through2:"^4.0.0","ts-node":"^10.7.0",tsd:"^0.20.0",typescript:"^4.4.4",winston:"^3.3.3"},dependencies:{"atomic-sleep":"^1.0.0","fast-redact":"^3.0.0","on-exit-leak-free":"^0.2.0","pino-abstract-transport":"v0.5.0","pino-std-serializers":"^4.0.0","process-warning":"^1.0.0","quick-format-unescaped":"^4.0.3","real-require":"^0.1.0","safe-stable-stringify":"^2.1.0","sonic-boom":"^2.2.1","thread-stream":"^0.15.1"},tsd:{directory:"test/types"}}});var nd=ee((K3,N0)=>{"use strict";var{version:IS}=k0();N0.exports={version:IS}});var q0=ee((Z3,$0)=>{"use strict";var{EventEmitter:PS}=require("events"),{lsCacheSym:OS,levelValSym:kS,setLevelSym:od,getLevelSym:L0,chindingsSym:ad,parsedChindingsSym:NS,mixinSym:LS,asJsonSym:F0,writeSym:DS,mixinMergeStrategySym:BS,timeSym:zS,timeSliceIndexSym:FS,streamSym:U0,serializersSym:os,formattersSym:sd,useOnlyCustomLevelsSym:US,needsMetadataGsym:jS,redactFmtSym:WS,stringifySym:$S,formatOptsSym:qS,stringifiersSym:HS}=uo(),{getLevel:GS,setLevel:VS,isLevelEnabled:KS,mappings:YS,initialLsCache:ZS,genLsCache:XS,assertNoLevelCollisions:JS}=Du(),{asChindings:j0,asJson:QS,buildFormatters:D0,stringify:B0}=Lu(),{version:ex}=nd(),tx=kf(),rx=class{},W0={constructor:rx,child:ix,bindings:nx,setBindings:sx,flush:ux,isLevelEnabled:KS,version:ex,get level(){return this[L0]()},set level(t){this[od](t)},get levelVal(){return this[kS]},set levelVal(t){throw Error("levelVal is read-only")},[OS]:ZS,[DS]:ax,[F0]:QS,[L0]:GS,[od]:VS};Object.setPrototypeOf(W0,PS.prototype);$0.exports=function(){return Object.create(W0)};var z0=t=>t;function ix(t,e){if(!t)throw Error("missing bindings for child Pino");e=e||{};let r=this[os],i=this[sd],n=Object.create(this);if(e.hasOwnProperty("serializers")===!0){n[os]=Object.create(null);for(let p in r)n[os][p]=r[p];let d=Object.getOwnPropertySymbols(r);for(var o=0;o<d.length;o++){let p=d[o];n[os][p]=r[p]}for(let p in e.serializers)n[os][p]=e.serializers[p];let m=Object.getOwnPropertySymbols(e.serializers);for(var a=0;a<m.length;a++){let p=m[a];n[os][p]=e.serializers[p]}}else n[os]=r;if(e.hasOwnProperty("formatters")){let{level:d,bindings:m,log:p}=e.formatters;n[sd]=D0(d||i.level,m||z0,p||i.log)}else n[sd]=D0(i.level,z0,i.log);if(e.hasOwnProperty("customLevels")===!0&&(JS(this.levels,e.customLevels),n.levels=YS(e.customLevels,n[US]),XS(n)),typeof e.redact=="object"&&e.redact!==null||Array.isArray(e.redact)){n.redact=e.redact;let d=tx(n.redact,B0),m={stringify:d[WS]};n[$S]=B0,n[HS]=d,n[qS]=m}n[ad]=j0(n,t);let h=e.level||this.level;return n[od](h),n}function nx(){let e=`{${this[ad].substr(1)}}`,r=JSON.parse(e);return delete r.pid,delete r.hostname,r}function sx(t){let e=j0(this,t);this[ad]=e,delete this[NS]}function ox(t,e){return Object.assign(e,t)}function ax(t,e,r){let i=this[zS](),n=this[LS],o=this[BS]||ox,a;t==null?a={}:t instanceof Error?(a={err:t},e===void 0&&(e=t.message)):(a=t,e===void 0&&t.err&&(e=t.err.message)),n&&(a=o(a,n(a,r)));let h=this[F0](a,e,r,i),d=this[U0];d[jS]===!0&&(d.lastLevel=r,d.lastObj=a,d.lastMsg=e,d.lastTime=i.slice(this[FS]),d.lastLogger=this),d.write(h)}function lx(){}function ux(){let t=this[U0];"flush"in t&&t.flush(lx)}});var K0=ee((dd,V0)=>{"use strict";var ls=fd();ls.configure=fd;ls.stringify=ls;ls.default=ls;dd.stringify=ls;dd.configure=fd;V0.exports=ls;var hx=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/,cx=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/g,cd=["\\u0000","\\u0001","\\u0002","\\u0003","\\u0004","\\u0005","\\u0006","\\u0007","\\b","\\t","\\n","\\u000b","\\f","\\r","\\u000e","\\u000f","\\u0010","\\u0011","\\u0012","\\u0013","\\u0014","\\u0015","\\u0016","\\u0017","\\u0018","\\u0019","\\u001a","\\u001b","\\u001c","\\u001d","\\u001e","\\u001f","","",'\\"',"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\\\"];function fx(t){let e=t.charCodeAt(0);return cd.length>e?cd[e]:`\\u${e.toString(16)}`}function hn(t){if(t.length<5e3&&!hx.test(t))return t;if(t.length>100)return t.replace(cx,fx);let e="",r=0;for(let i=0;i<t.length;i++){let n=t.charCodeAt(i);if(n===34||n===92||n<32)e+=`${t.slice(r,i)}${cd[n]}`,r=i+1;else if(n>=55296&&n<=57343){if(n<=56319&&i+1<t.length){let o=t.charCodeAt(i+1);if(o>=56320&&o<=57343){i++;continue}}e+=`${t.slice(r,i)}${`\\u${n.toString(16)}`}`,r=i+1}}return e+=t.slice(r),e}function ld(t){if(t.length>200)return t.sort();for(let e=1;e<t.length;e++){let r=t[e],i=e;for(;i!==0&&t[i-1]>r;)t[i]=t[i-1],i--;t[i]=r}return t}var dx=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Uint8Array)),Symbol.toStringTag).get;function ud(t){return dx.call(t)!==void 0&&t.length!==0}function hd(t,e,r){t.length<r&&(r=t.length);let i=e===","?"":" ",n=`"0":${i}${t[0]}`;for(let o=1;o<r;o++)n+=`${e}"${o}":${i}${t[o]}`;return n}function mx(t){if(t&&Object.prototype.hasOwnProperty.call(t,"circularValue")){var e=t.circularValue;if(typeof e=="string")return`"${e}"`;if(e==null)return e;if(e===Error||e===TypeError)return{toString(){throw new TypeError("Converting circular structure to JSON")}};throw new TypeError('The "circularValue" argument must be of type string or the value null or undefined')}return'"[Circular]"'}function H0(t,e){if(t&&Object.prototype.hasOwnProperty.call(t,e)){var r=t[e];if(typeof r!="boolean")throw new TypeError(`The "${e}" argument must be of type boolean`)}return r===void 0?!0:r}function G0(t,e){if(t&&Object.prototype.hasOwnProperty.call(t,e)){var r=t[e];if(typeof r!="number")throw new TypeError(`The "${e}" argument must be of type number`);if(!Number.isInteger(r))throw new TypeError(`The "${e}" argument must be an integer`);if(r<1)throw new RangeError(`The "${e}" argument must be >= 1`)}return r===void 0?1/0:r}function as(t){return t===1?"1 item":`${t} items`}function px(t){let e=new Set;for(let r of t)typeof r=="string"?e.add(r):typeof r=="number"&&e.add(String(r));return e}function fd(t){let e=mx(t),r=H0(t,"bigint"),i=H0(t,"deterministic"),n=G0(t,"maximumDepth"),o=G0(t,"maximumBreadth");function a(w,E,_,C,R,I){let A=E[w];switch(typeof A=="object"&&A!==null&&typeof A.toJSON=="function"&&(A=A.toJSON(w)),A=C.call(E,w,A),typeof A){case"string":return`"${hn(A)}"`;case"object":{if(A===null)return"null";if(_.indexOf(A)!==-1)return e;let k="",D=",",j=I;if(Array.isArray(A)){if(A.length===0)return"[]";if(n<_.length+1)return'"[Array]"';_.push(A),R!==""&&(I+=R,k+=`
73
- ${I}`,D=`,
74
- ${I}`);let Pe=Math.min(A.length,o),ae=0;for(;ae<Pe-1;ae++){let ot=a(ae,A,_,C,R,I);k+=ot!==void 0?ot:"null",k+=D}let ze=a(ae,A,_,C,R,I);if(k+=ze!==void 0?ze:"null",A.length-1>o){let ot=A.length-o-1;k+=`${D}"... ${as(ot)} not stringified"`}return R!==""&&(k+=`
75
- ${j}`),_.pop(),`[${k}]`}let W=Object.keys(A),Z=W.length;if(Z===0)return"{}";if(n<_.length+1)return'"[Object]"';let oe="",N="";R!==""&&(I+=R,D=`,
76
- ${I}`,oe=" ");let Oe=Math.min(Z,o);ud(A)&&(k+=hd(A,D,o),W=W.slice(A.length),Oe-=A.length,N=D),i&&(W=ld(W)),_.push(A);for(let Pe=0;Pe<Oe;Pe++){let ae=W[Pe],ze=a(ae,A,_,C,R,I);ze!==void 0&&(k+=`${N}"${hn(ae)}":${oe}${ze}`,N=D)}if(Z>o){let Pe=Z-o;k+=`${N}"...":${oe}"${as(Pe)} not stringified"`,N=D}return R!==""&&N.length>1&&(k=`
77
- ${I}${k}
78
- ${j}`),_.pop(),`{${k}}`}case"number":return isFinite(A)?String(A):"null";case"boolean":return A===!0?"true":"false";case"bigint":return r?String(A):void 0}}function h(w,E,_,C,R,I){switch(typeof E=="object"&&E!==null&&typeof E.toJSON=="function"&&(E=E.toJSON(w)),typeof E){case"string":return`"${hn(E)}"`;case"object":{if(E===null)return"null";if(_.indexOf(E)!==-1)return e;let A=I,k="",D=",";if(Array.isArray(E)){if(E.length===0)return"[]";if(n<_.length+1)return'"[Array]"';_.push(E),R!==""&&(I+=R,k+=`
79
- ${I}`,D=`,
80
- ${I}`);let Z=Math.min(E.length,o),oe=0;for(;oe<Z-1;oe++){let Oe=h(oe,E[oe],_,C,R,I);k+=Oe!==void 0?Oe:"null",k+=D}let N=h(oe,E[oe],_,C,R,I);if(k+=N!==void 0?N:"null",E.length-1>o){let Oe=E.length-o-1;k+=`${D}"... ${as(Oe)} not stringified"`}return R!==""&&(k+=`
81
- ${A}`),_.pop(),`[${k}]`}if(C.size===0)return"{}";_.push(E);let j="";R!==""&&(I+=R,D=`,
82
- ${I}`,j=" ");let W="";for(let Z of C){let oe=h(Z,E[Z],_,C,R,I);oe!==void 0&&(k+=`${W}"${hn(Z)}":${j}${oe}`,W=D)}return R!==""&&W.length>1&&(k=`
83
- ${I}${k}
84
- ${A}`),_.pop(),`{${k}}`}case"number":return isFinite(E)?String(E):"null";case"boolean":return E===!0?"true":"false";case"bigint":return r?String(E):void 0}}function d(w,E,_,C,R){switch(typeof E){case"string":return`"${hn(E)}"`;case"object":{if(E===null)return"null";if(typeof E.toJSON=="function"){if(E=E.toJSON(w),typeof E!="object")return d(w,E,_,C,R);if(E===null)return"null"}if(_.indexOf(E)!==-1)return e;let I=R;if(Array.isArray(E)){if(E.length===0)return"[]";if(n<_.length+1)return'"[Array]"';_.push(E),R+=C;let oe=`
85
- ${R}`,N=`,
86
- ${R}`,Oe=Math.min(E.length,o),Pe=0;for(;Pe<Oe-1;Pe++){let ze=d(Pe,E[Pe],_,C,R);oe+=ze!==void 0?ze:"null",oe+=N}let ae=d(Pe,E[Pe],_,C,R);if(oe+=ae!==void 0?ae:"null",E.length-1>o){let ze=E.length-o-1;oe+=`${N}"... ${as(ze)} not stringified"`}return oe+=`
87
- ${I}`,_.pop(),`[${oe}]`}let A=Object.keys(E),k=A.length;if(k===0)return"{}";if(n<_.length+1)return'"[Object]"';R+=C;let D=`,
88
- ${R}`,j="",W="",Z=Math.min(k,o);ud(E)&&(j+=hd(E,D,o),A=A.slice(E.length),Z-=E.length,W=D),i&&(A=ld(A)),_.push(E);for(let oe=0;oe<Z;oe++){let N=A[oe],Oe=d(N,E[N],_,C,R);Oe!==void 0&&(j+=`${W}"${hn(N)}": ${Oe}`,W=D)}if(k>o){let oe=k-o;j+=`${W}"...": "${as(oe)} not stringified"`,W=D}return W!==""&&(j=`
89
- ${R}${j}
90
- ${I}`),_.pop(),`{${j}}`}case"number":return isFinite(E)?String(E):"null";case"boolean":return E===!0?"true":"false";case"bigint":return r?String(E):void 0}}function m(w,E,_){switch(typeof E){case"string":return`"${hn(E)}"`;case"object":{if(E===null)return"null";if(typeof E.toJSON=="function"){if(E=E.toJSON(w),typeof E!="object")return m(w,E,_);if(E===null)return"null"}if(_.indexOf(E)!==-1)return e;let C="";if(Array.isArray(E)){if(E.length===0)return"[]";if(n<_.length+1)return'"[Array]"';_.push(E);let D=Math.min(E.length,o),j=0;for(;j<D-1;j++){let Z=m(j,E[j],_);C+=Z!==void 0?Z:"null",C+=","}let W=m(j,E[j],_);if(C+=W!==void 0?W:"null",E.length-1>o){let Z=E.length-o-1;C+=`,"... ${as(Z)} not stringified"`}return _.pop(),`[${C}]`}let R=Object.keys(E),I=R.length;if(I===0)return"{}";if(n<_.length+1)return'"[Object]"';let A="",k=Math.min(I,o);ud(E)&&(C+=hd(E,",",o),R=R.slice(E.length),k-=E.length,A=","),i&&(R=ld(R)),_.push(E);for(let D=0;D<k;D++){let j=R[D],W=m(j,E[j],_);W!==void 0&&(C+=`${A}"${hn(j)}":${W}`,A=",")}if(I>o){let D=I-o;C+=`${A}"...":"${as(D)} not stringified"`}return _.pop(),`{${C}}`}case"number":return isFinite(E)?String(E):"null";case"boolean":return E===!0?"true":"false";case"bigint":return r?String(E):void 0}}function p(w,E,_){if(arguments.length>1){let C="";if(typeof _=="number"?C=" ".repeat(Math.min(_,10)):typeof _=="string"&&(C=_.slice(0,10)),E!=null){if(typeof E=="function")return a("",{"":w},[],E,C,"");if(Array.isArray(E))return h("",w,[],px(E),C,"")}if(C.length!==0)return d("",w,[],C,"")}return m("",w,[])}return p}});var J0=ee((X3,X0)=>{"use strict";var md=Symbol.for("pino.metadata"),{levels:Y0}=Du(),Z0=Object.create(Y0);Z0.silent=1/0;var gx=Y0.info;function yx(t,e){let r=0;t=t||[],e=e||{dedupe:!1};let i=Z0;e.levels&&typeof e.levels=="object"&&(i=e.levels);let n={write:o,add:h,flushSync:a,end:d,minLevel:0,streams:[],clone:m,[md]:!0};return Array.isArray(t)?t.forEach(h,n):h.call(n,t),t=null,n;function o(p){let w,E=this.lastLevel,{streams:_}=this,C;for(let R=0;R<_.length&&(w=_[R],w.level<=E);R++){if(C=w.stream,C[md]){let{lastTime:I,lastMsg:A,lastObj:k,lastLogger:D}=this;C.lastLevel=E,C.lastTime=I,C.lastMsg=A,C.lastObj=k,C.lastLogger=D}(!e.dedupe||w.level===E)&&C.write(p)}}function a(){for(let{stream:p}of this.streams)typeof p.flushSync=="function"&&p.flushSync()}function h(p){if(!p)return n;let w=typeof p.write=="function"||p.stream,E=p.write?p:p.stream;if(!w)throw Error("stream object needs to implement either StreamEntry or DestinationStream interface");let{streams:_}=this,C;typeof p.levelVal=="number"?C=p.levelVal:typeof p.level=="string"?C=i[p.level]:typeof p.level=="number"?C=p.level:C=gx;let R={stream:E,level:C,levelVal:void 0,id:r++};return _.unshift(R),_.sort(bx),this.minLevel=_[0].level,n}function d(){for(let{stream:p}of this.streams)typeof p.flushSync=="function"&&p.flushSync(),p.end()}function m(p){let w=new Array(this.streams.length);for(let E=0;E<w.length;E++)w[E]={level:p,stream:this.streams[E].stream};return{write:o,add:h,minLevel:p,streams:w,clone:m,flushSync:a,[md]:!0}}}function bx(t,e){return t.level-e.level}X0.exports=yx});var yd=ee((J3,dr)=>{"use strict";var vx=require("os"),og=Rf(),wx=Cf(),_x=kf(),ag=Hp(),Sx=q0(),lg=uo(),{configure:xx}=K0(),{assertDefaultLevelFound:Ex,mappings:ug,genLsCache:Mx,levels:Rx}=Du(),{createArgsNormalizer:Cx,asChindings:Tx,final:Ax,buildSafeSonicBoom:Q0,buildFormatters:Ix,stringify:Bu,normalizeDestFileDescriptor:eg,noop:Px}=Lu(),{version:Ox}=nd(),{chindingsSym:tg,redactFmtSym:kx,serializersSym:rg,timeSym:Nx,timeSliceIndexSym:Lx,streamSym:Dx,stringifySym:ig,stringifySafeSym:pd,stringifiersSym:ng,setLevelSym:Bx,endSym:zx,formatOptsSym:Fx,messageKeySym:Ux,nestedKeySym:jx,mixinSym:Wx,useOnlyCustomLevelsSym:$x,formattersSym:sg,hooksSym:qx,nestedKeyStrSym:Hx,mixinMergeStrategySym:Gx}=lg,{epochTime:hg,nullTime:Vx}=ag,{pid:Kx}=process,Yx=vx.hostname(),Zx=og.err,Xx={level:"info",levels:Rx,messageKey:"msg",nestedKey:null,enabled:!0,prettyPrint:!1,base:{pid:Kx,hostname:Yx},serializers:Object.assign(Object.create(null),{err:Zx}),formatters:Object.assign(Object.create(null),{bindings(t){return t},level(t,e){return{level:e}}}),hooks:{logMethod:void 0},timestamp:hg,name:void 0,redact:null,customLevels:null,useOnlyCustomLevels:!1,depthLimit:5,edgeLimit:100},Jx=Cx(Xx),Qx=Object.assign(Object.create(null),og);function gd(...t){let e={},{opts:r,stream:i}=Jx(e,wx(),...t),{redact:n,crlf:o,serializers:a,timestamp:h,messageKey:d,nestedKey:m,base:p,name:w,level:E,customLevels:_,mixin:C,mixinMergeStrategy:R,useOnlyCustomLevels:I,formatters:A,hooks:k,depthLimit:D,edgeLimit:j}=r,W=xx({maximumDepth:D,maximumBreadth:j}),Z=Ix(A.level,A.bindings,A.log),oe=n?_x(n,Bu):{},N=Bu.bind({[pd]:W}),Oe=n?{stringify:oe[kx]}:{stringify:N},Pe="}"+(o?`\r
83
+ `}});var O5=H((MC,k5)=>{"use strict";k5.exports=V8;function V8(t){let{secret:e,censor:r,compileRestore:i,serialize:n,groupRedact:s,nestedRedact:a,wildcards:c,wcLen:d}=t,p=[{secret:e,censor:r,compileRestore:i}];return n!==!1&&p.push({serialize:n}),d>0&&p.push({groupRedact:s,nestedRedact:a,wildcards:c,wcLen:d}),Object.assign(...p)}});var D5=H((EC,N5)=>{"use strict";var L5=S5(),K8=E5(),Z8=C5(),J8=I5(),{groupRedact:Y8,nestedRedact:X8}=mf(),Q8=O5(),e3=pu(),t3=L5(),gf=t=>t;gf.restore=gf;var r3="[REDACTED]";yf.rx=e3;yf.validator=L5;N5.exports=yf;function yf(t={}){let e=Array.from(new Set(t.paths||[])),r="serialize"in t&&(t.serialize===!1||typeof t.serialize=="function")?t.serialize:JSON.stringify,i=t.remove;if(i===!0&&r!==JSON.stringify)throw Error("fast-redact \u2013 remove option may only be set when serializer is JSON.stringify");let n=i===!0?void 0:"censor"in t?t.censor:r3,s=typeof n=="function",a=s&&n.length>1;if(e.length===0)return r||gf;t3({paths:e,serialize:r,censor:n});let{wildcards:c,wcLen:d,secret:p}=K8({paths:e,censor:n}),m=J8({secret:p,wcLen:d}),w="strict"in t?t.strict:!0;return Z8({secret:p,wcLen:d,serialize:r,strict:w,isCensorFct:s,censorFctTakesPath:a},Q8({secret:p,censor:n,compileRestore:m,serialize:r,groupRedact:Y8,nestedRedact:X8,wildcards:c,wcLen:d}))}});var Ao=H((RC,B5)=>{"use strict";var i3=Symbol("pino.setLevel"),n3=Symbol("pino.getLevel"),s3=Symbol("pino.levelVal"),o3=Symbol("pino.useLevelLabels"),a3=Symbol("pino.useOnlyCustomLevels"),l3=Symbol("pino.mixin"),u3=Symbol("pino.lsCache"),c3=Symbol("pino.chindings"),h3=Symbol("pino.parsedChindings"),f3=Symbol("pino.asJson"),d3=Symbol("pino.write"),p3=Symbol("pino.redactFmt"),m3=Symbol("pino.time"),g3=Symbol("pino.timeSliceIndex"),y3=Symbol("pino.stream"),b3=Symbol("pino.stringify"),v3=Symbol("pino.stringifySafe"),w3=Symbol("pino.stringifiers"),_3=Symbol("pino.end"),S3=Symbol("pino.formatOpts"),x3=Symbol("pino.messageKey"),M3=Symbol("pino.nestedKey"),E3=Symbol("pino.nestedKeyStr"),R3=Symbol("pino.mixinMergeStrategy"),C3=Symbol("pino.wildcardFirst"),A3=Symbol.for("pino.serializers"),P3=Symbol.for("pino.formatters"),T3=Symbol.for("pino.hooks"),I3=Symbol.for("pino.metadata");B5.exports={setLevelSym:i3,getLevelSym:n3,levelValSym:s3,useLevelLabelsSym:o3,mixinSym:l3,lsCacheSym:u3,chindingsSym:c3,parsedChindingsSym:h3,asJsonSym:f3,writeSym:d3,serializersSym:A3,redactFmtSym:p3,timeSym:m3,timeSliceIndexSym:g3,streamSym:y3,stringifySym:b3,stringifySafeSym:v3,stringifiersSym:w3,endSym:_3,formatOptsSym:S3,messageKeySym:x3,nestedKeySym:M3,wildcardFirstSym:C3,needsMetadataGsym:I3,useOnlyCustomLevelsSym:a3,formattersSym:P3,hooksSym:T3,nestedKeyStrSym:E3,mixinMergeStrategySym:R3}});var wf=H((CC,U5)=>{"use strict";var vf=D5(),{redactFmtSym:k3,wildcardFirstSym:mu}=Ao(),{rx:bf,validator:O3}=vf,z5=O3({ERR_PATHS_MUST_BE_STRINGS:()=>"pino \u2013 redacted paths must be strings",ERR_INVALID_PATH:t=>`pino \u2013 redact paths array contains an invalid path (${t})`}),j5="[Redacted]",q5=!1;function L3(t,e){let{paths:r,censor:i}=N3(t),n=r.reduce((c,d)=>{bf.lastIndex=0;let p=bf.exec(d),m=bf.exec(d),w=p[1]!==void 0?p[1].replace(/^(?:"|'|`)(.*)(?:"|'|`)$/,"$1"):p[0];if(w==="*"&&(w=mu),m===null)return c[w]=null,c;if(c[w]===null)return c;let{index:S}=m,v=`${d.substr(S,d.length-1)}`;return c[w]=c[w]||[],w!==mu&&c[w].length===0&&c[w].push(...c[mu]||[]),w===mu&&Object.keys(c).forEach(function(R){c[R]&&c[R].push(v)}),c[w].push(v),c},{}),s={[k3]:vf({paths:r,censor:i,serialize:e,strict:q5})},a=(...c)=>e(typeof i=="function"?i(...c):i);return[...Object.keys(n),...Object.getOwnPropertySymbols(n)].reduce((c,d)=>{if(n[d]===null)c[d]=p=>a(p,[d]);else{let p=typeof i=="function"?(m,w)=>i(m,[d,...w]):i;c[d]=vf({paths:n[d],censor:p,serialize:e,strict:q5})}return c},s)}function N3(t){if(Array.isArray(t))return t={paths:t,censor:j5},z5(t),t;let{paths:e,censor:r=j5,remove:i}=t;if(Array.isArray(e)===!1)throw Error("pino \u2013 redact must contain an array of strings");return i===!0&&(r=void 0),z5({paths:e,censor:r}),{paths:e,censor:r}}U5.exports=L3});var W5=H((AC,$5)=>{"use strict";var D3=()=>"",B3=()=>`,"time":${Date.now()}`,z3=()=>`,"time":${Math.round(Date.now()/1e3)}`,j3=()=>`,"time":"${new Date(Date.now()).toISOString()}"`;$5.exports={nullTime:D3,epochTime:B3,unixTime:z3,isoTime:j3}});var H5=H((PC,F5)=>{"use strict";function q3(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}F5.exports=U3;function U3(t,e,r){var i=r&&r.stringify||q3,n=1;if(typeof t=="object"&&t!==null){var s=e.length+n;if(s===1)return t;var a=new Array(s);a[0]=i(t);for(var c=1;c<s;c++)a[c]=i(e[c]);return a.join(" ")}if(typeof t!="string")return t;var d=e.length;if(d===0)return t;for(var p="",m=1-n,w=-1,S=t&&t.length||0,v=0;v<S;){if(t.charCodeAt(v)===37&&v+1<S){switch(w=w>-1?w:0,t.charCodeAt(v+1)){case 100:case 102:if(m>=d||(w<v&&(p+=t.slice(w,v)),e[m]==null))break;p+=Number(e[m]),w=v=v+2;break;case 105:if(m>=d||(w<v&&(p+=t.slice(w,v)),e[m]==null))break;p+=Math.floor(Number(e[m])),w=v=v+2;break;case 79:case 111:case 106:if(m>=d||(w<v&&(p+=t.slice(w,v)),e[m]===void 0))break;var R=typeof e[m];if(R==="string"){p+="'"+e[m]+"'",w=v+2,v++;break}if(R==="function"){p+=e[m].name||"<anonymous>",w=v+2,v++;break}p+=i(e[m]),w=v+2,v++;break;case 115:if(m>=d)break;w<v&&(p+=t.slice(w,v)),p+=String(e[m]),w=v+2,v++;break;case 37:w<v&&(p+=t.slice(w,v)),p+="%",w=v+2,v++,m--;break}++m}++v}return w===-1?t:(w<S&&(p+=t.slice(w)),p)}});var Sf=H((TC,_f)=>{"use strict";if(typeof SharedArrayBuffer<"u"&&typeof Atomics<"u"){let e=function(r){if((r>0&&r<1/0)===!1)throw typeof r!="number"&&typeof r!="bigint"?TypeError("sleep: ms must be a number"):RangeError("sleep: ms must be a number that is greater than 0 but less than Infinity");Atomics.wait(t,0,0,Number(r))},t=new Int32Array(new SharedArrayBuffer(4));_f.exports=e}else{let t=function(e){if((e>0&&e<1/0)===!1)throw typeof e!="number"&&typeof e!="bigint"?TypeError("sleep: ms must be a number"):RangeError("sleep: ms must be a number that is greater than 0 but less than Infinity");let i=Date.now()+Number(e);for(;i>Date.now(););};_f.exports=t}});var J5=H((IC,Z5)=>{"use strict";var sr=require("fs"),$3=require("events"),W3=require("util").inherits,G5=require("path"),V5=Sf(),xf=100,Mf=16*1024*1024;function K5(t,e){e._opening=!0,e._writing=!0,e._asyncDrainScheduled=!1;function r(n,s){if(n){e._reopening=!1,e._writing=!1,e._opening=!1,e.sync?process.nextTick(()=>{e.listenerCount("error")>0&&e.emit("error",n)}):e.emit("error",n);return}e.fd=s,e.file=t,e._reopening=!1,e._opening=!1,e._writing=!1,e.sync?process.nextTick(()=>e.emit("ready")):e.emit("ready"),!e._reopening&&!e._writing&&e._len>e.minLength&&!e.destroyed&&Po(e)}let i=e.append?"a":"w";if(e.sync)try{e.mkdir&&sr.mkdirSync(G5.dirname(t),{recursive:!0});let n=sr.openSync(t,i);r(null,n)}catch(n){throw r(n),n}else e.mkdir?sr.mkdir(G5.dirname(t),{recursive:!0},n=>{if(n)return r(n);sr.open(t,i,r)}):sr.open(t,i,r)}function $t(t){if(!(this instanceof $t))return new $t(t);let{fd:e,dest:r,minLength:i,maxLength:n,sync:s,append:a=!0,mkdir:c,retryEAGAIN:d}=t||{};if(e=e||r,this._bufs=[],this._len=0,this.fd=-1,this._writing=!1,this._writingBuf="",this._ending=!1,this._reopening=!1,this._asyncDrainScheduled=!1,this._hwm=Math.max(i||0,16387),this.file=null,this.destroyed=!1,this.minLength=i||0,this.maxLength=n||0,this.sync=s||!1,this.append=a||!1,this.retryEAGAIN=d||(()=>!0),this.mkdir=c||!1,typeof e=="number")this.fd=e,process.nextTick(()=>this.emit("ready"));else if(typeof e=="string")K5(e,this);else throw new Error("SonicBoom supports only file descriptors and files");if(this.minLength>=Mf)throw new Error(`minLength should be smaller than MAX_WRITE (${Mf})`);this.release=(p,m)=>{if(p){if(p.code==="EAGAIN"&&this.retryEAGAIN(p,this._writingBuf.length,this._len-this._writingBuf.length))if(this.sync)try{V5(xf),this.release(void 0,0)}catch(S){this.release(S)}else setTimeout(()=>{sr.write(this.fd,this._writingBuf,"utf8",this.release)},xf);else this._writing=!1,this.emit("error",p);return}if(this._len-=m,this._writingBuf=this._writingBuf.slice(m),this._writingBuf.length){if(!this.sync){sr.write(this.fd,this._writingBuf,"utf8",this.release);return}try{do{let S=sr.writeSync(this.fd,this._writingBuf,"utf8");this._len-=S,this._writingBuf=this._writingBuf.slice(S)}while(this._writingBuf)}catch(S){this.release(S);return}}let w=this._len;this._reopening?(this._writing=!1,this._reopening=!1,this.reopen()):w>this.minLength?Po(this):this._ending?w>0?Po(this):(this._writing=!1,gu(this)):(this._writing=!1,this.sync?this._asyncDrainScheduled||(this._asyncDrainScheduled=!0,process.nextTick(F3,this)):this.emit("drain"))},this.on("newListener",function(p){p==="drain"&&(this._asyncDrainScheduled=!1)})}function F3(t){t.listenerCount("drain")>0&&(t._asyncDrainScheduled=!1,t.emit("drain"))}W3($t,$3);$t.prototype.write=function(t){if(this.destroyed)throw new Error("SonicBoom destroyed");let e=this._len+t.length,r=this._bufs;return this.maxLength&&e>this.maxLength?(this.emit("drop",t),this._len<this._hwm):(!this._writing&&e>Mf?r.push(t):r.length===0?r[0]=""+t:r[r.length-1]+=t,this._len=e,!this._writing&&this._len>=this.minLength&&Po(this),this._len<this._hwm)};$t.prototype.flush=function(){if(this.destroyed)throw new Error("SonicBoom destroyed");this._writing||this.minLength<=0||(this._bufs.length===0&&this._bufs.push(""),Po(this))};$t.prototype.reopen=function(t){if(this.destroyed)throw new Error("SonicBoom destroyed");if(this._opening){this.once("ready",()=>{this.reopen(t)});return}if(this._ending)return;if(!this.file)throw new Error("Unable to reopen a file descriptor, you must pass a file to SonicBoom");if(this._reopening=!0,this._writing)return;let e=this.fd;this.once("ready",()=>{e!==this.fd&&sr.close(e,r=>{if(r)return this.emit("error",r)})}),K5(t||this.file,this)};$t.prototype.end=function(){if(this.destroyed)throw new Error("SonicBoom destroyed");if(this._opening){this.once("ready",()=>{this.end()});return}this._ending||(this._ending=!0,!this._writing&&(this._len>0&&this.fd>=0?Po(this):gu(this)))};$t.prototype.flushSync=function(){if(this.destroyed)throw new Error("SonicBoom destroyed");if(this.fd<0)throw new Error("sonic boom is not ready yet");for(!this._writing&&this._writingBuf.length>0&&(this._bufs.unshift(this._writingBuf),this._writingBuf="");this._bufs.length;){let t=this._bufs[0];try{this._len-=sr.writeSync(this.fd,t,"utf8"),this._bufs.shift()}catch(e){if(e.code!=="EAGAIN"||!this.retryEAGAIN(e,t.length,this._len-t.length))throw e;V5(xf)}}};$t.prototype.destroy=function(){this.destroyed||gu(this)};function Po(t){let e=t.release;if(t._writing=!0,t._writingBuf=t._writingBuf||t._bufs.shift(),t.sync)try{let r=sr.writeSync(t.fd,t._writingBuf,"utf8");e(null,r)}catch(r){e(r)}else sr.write(t.fd,t._writingBuf,"utf8",e)}function gu(t){if(t.fd===-1){t.once("ready",gu.bind(null,t));return}sr.close(t.fd,e=>{if(e){t.emit("error",e);return}t._ending&&!t._writing&&t.emit("finish"),t.emit("close")}),t.destroyed=!0,t._bufs=[]}$t.SonicBoom=$t;$t.default=$t;Z5.exports=$t});var X5=H((kC,Y5)=>{"use strict";var{format:Ef}=require("util");function H3(){let t={},e=new Map;function r(n,s,a){if(!n)throw new Error("Warning name must not be empty");if(!s)throw new Error("Warning code must not be empty");if(!a)throw new Error("Warning message must not be empty");if(s=s.toUpperCase(),t[s]!==void 0)throw new Error(`The code '${s}' already exist`);function c(d,p,m){let w;return d&&p&&m?w=Ef(a,d,p,m):d&&p?w=Ef(a,d,p):d?w=Ef(a,d):w=a,{code:s,name:n,message:w}}return e.set(s,!1),t[s]=c,t[s]}function i(n,s,a,c){if(t[n]===void 0)throw new Error(`The code '${n}' does not exist`);if(e.get(n)===!0)return;e.set(n,!0);let d=t[n](s,a,c);process.emitWarning(d.message,d.name,d.code)}return{create:r,emit:i,emitted:e}}Y5.exports=H3});var t9=H((OC,e9)=>{"use strict";var Rf=X5()();e9.exports=Rf;var Q5="PinoWarning";Rf.create(Q5,"PINODEP008","prettyPrint is deprecated, look at https://github.com/pinojs/pino-pretty for alternatives.");Rf.create(Q5,"PINODEP009","The use of pino.final is discouraged in Node.js v14+ and not required. It will be removed in the next major version")});var Af=H((LC,s9)=>{"use strict";function r9(t,e,r,i){function n(){let s=e.deref();s!==void 0&&r(s,i)}t[i]=n,process.once(i,n)}var i9=new FinalizationRegistry(n9),Cf=new WeakMap;function n9(t){process.removeListener("exit",t.exit),process.removeListener("beforeExit",t.beforeExit)}function G3(t,e){if(t===void 0)throw new Error("the object can't be undefined");let r=new WeakRef(t),i={};Cf.set(t,i),i9.register(t,i),r9(i,r,e,"exit"),r9(i,r,e,"beforeExit")}function V3(t){let e=Cf.get(t);Cf.delete(t),e&&n9(e),i9.unregister(t)}s9.exports={register:G3,unregister:V3}});var a9=H((NC,o9)=>{"use strict";function K3(t,e,r,i,n){let s=Date.now()+i,a=Atomics.load(t,e);if(a===r){n(null,"ok");return}let c=a,d=p=>{Date.now()>s?n(null,"timed-out"):setTimeout(()=>{c=a,a=Atomics.load(t,e),a===c?d(p>=1e3?1e3:p*2):a===r?n(null,"ok"):n(null,"not-equal")},p)};d(1)}function Z3(t,e,r,i,n){let s=Date.now()+i,a=Atomics.load(t,e);if(a!==r){n(null,"ok");return}let c=d=>{Date.now()>s?n(null,"timed-out"):setTimeout(()=>{a=Atomics.load(t,e),a!==r?n(null,"ok"):c(d>=1e3?1e3:d*2)},d)};c(1)}o9.exports={wait:K3,waitDiff:Z3}});var u9=H((DC,l9)=>{"use strict";l9.exports={WRITE_INDEX:4,READ_INDEX:8}});var p9=H((zC,d9)=>{"use strict";var{EventEmitter:J3}=require("events"),{Worker:Y3}=require("worker_threads"),{join:X3}=require("path"),{pathToFileURL:Q3}=require("url"),{wait:e7}=a9(),{WRITE_INDEX:Wt,READ_INDEX:ci}=u9(),t7=require("buffer"),r7=require("assert"),U=Symbol("kImpl"),i7=t7.constants.MAX_STRING_LENGTH,bu=class{constructor(e){this._value=e}deref(){return this._value}},n7=global.FinalizationRegistry||class{register(){}unregister(){}},s7=global.WeakRef||bu,c9=new n7(t=>{t.exited||t.terminate()});function o7(t,e){let{filename:r,workerData:i}=e,s=("__bundlerPathsOverrides"in globalThis?globalThis.__bundlerPathsOverrides:{})["thread-stream-worker"]||X3(__dirname,"lib","worker.js"),a=new Y3(s,{...e.workerOpts,workerData:{filename:r.indexOf("file://")===0?r:Q3(r).href,dataBuf:t[U].dataBuf,stateBuf:t[U].stateBuf,workerData:i}});return a.stream=new bu(t),a.on("message",a7),a.on("exit",f9),c9.register(t,a),a}function h9(t){r7(!t[U].sync),t[U].needDrain&&(t[U].needDrain=!1,t.emit("drain"))}function yu(t){let e=Atomics.load(t[U].state,Wt),r=t[U].data.length-e;if(r>0){if(t[U].buf.length===0){t[U].flushing=!1,t[U].ending?kf(t):t[U].needDrain&&process.nextTick(h9,t);return}let i=t[U].buf.slice(0,r),n=Buffer.byteLength(i);n<=r?(t[U].buf=t[U].buf.slice(r),vu(t,i,yu.bind(null,t))):t.flush(()=>{if(!t.destroyed){for(Atomics.store(t[U].state,ci,0),Atomics.store(t[U].state,Wt,0);n>t[U].data.length;)r=r/2,i=t[U].buf.slice(0,r),n=Buffer.byteLength(i);t[U].buf=t[U].buf.slice(r),vu(t,i,yu.bind(null,t))}})}else if(r===0){if(e===0&&t[U].buf.length===0)return;t.flush(()=>{Atomics.store(t[U].state,ci,0),Atomics.store(t[U].state,Wt,0),yu(t)})}else throw new Error("overwritten")}function a7(t){let e=this.stream.deref();if(e===void 0){this.exited=!0,this.terminate();return}switch(t.code){case"READY":this.stream=new s7(e),e.flush(()=>{e[U].ready=!0,e.emit("ready")});break;case"ERROR":To(e,t.err);break;default:throw new Error("this should not happen: "+t.code)}}function f9(t){let e=this.stream.deref();e!==void 0&&(c9.unregister(e),e.worker.exited=!0,e.worker.off("exit",f9),To(e,t!==0?new Error("The worker thread exited"):null))}var Tf=class extends J3{constructor(e={}){if(super(),e.bufferSize<4)throw new Error("bufferSize must at least fit a 4-byte utf-8 char");this[U]={},this[U].stateBuf=new SharedArrayBuffer(128),this[U].state=new Int32Array(this[U].stateBuf),this[U].dataBuf=new SharedArrayBuffer(e.bufferSize||4*1024*1024),this[U].data=Buffer.from(this[U].dataBuf),this[U].sync=e.sync||!1,this[U].ending=!1,this[U].ended=!1,this[U].needDrain=!1,this[U].destroyed=!1,this[U].flushing=!1,this[U].ready=!1,this[U].finished=!1,this[U].errored=null,this[U].closed=!1,this[U].buf="",this.worker=o7(this,e)}write(e){if(this[U].destroyed)throw new Error("the worker has exited");if(this[U].ending)throw new Error("the worker is ending");if(this[U].flushing&&this[U].buf.length+e.length>=i7)try{Pf(this),this[U].flushing=!0}catch(r){return To(this,r),!1}if(this[U].buf+=e,this[U].sync)try{return Pf(this),!0}catch(r){return To(this,r),!1}return this[U].flushing||(this[U].flushing=!0,setImmediate(yu,this)),this[U].needDrain=this[U].data.length-this[U].buf.length-Atomics.load(this[U].state,Wt)<=0,!this[U].needDrain}end(){this[U].destroyed||(this[U].ending=!0,kf(this))}flush(e){if(this[U].destroyed){typeof e=="function"&&process.nextTick(e,new Error("the worker has exited"));return}let r=Atomics.load(this[U].state,Wt);e7(this[U].state,ci,r,1/0,(i,n)=>{if(i){To(this,i),process.nextTick(e,i);return}if(n==="not-equal"){this.flush(e);return}process.nextTick(e)})}flushSync(){this[U].destroyed||(Pf(this),If(this))}unref(){this.worker.unref()}ref(){this.worker.ref()}get ready(){return this[U].ready}get destroyed(){return this[U].destroyed}get closed(){return this[U].closed}get writable(){return!this[U].destroyed&&!this[U].ending}get writableEnded(){return this[U].ending}get writableFinished(){return this[U].finished}get writableNeedDrain(){return this[U].needDrain}get writableObjectMode(){return!1}get writableErrored(){return this[U].errored}};function To(t,e){t[U].destroyed||(t[U].destroyed=!0,e&&(t[U].errored=e,t.emit("error",e)),t.worker.exited?setImmediate(()=>{t[U].closed=!0,t.emit("close")}):t.worker.terminate().catch(()=>{}).then(()=>{t[U].closed=!0,t.emit("close")}))}function vu(t,e,r){let i=Atomics.load(t[U].state,Wt),n=Buffer.byteLength(e);return t[U].data.write(e,i),Atomics.store(t[U].state,Wt,i+n),Atomics.notify(t[U].state,Wt),r(),!0}function kf(t){if(!(t[U].ended||!t[U].ending||t[U].flushing)){t[U].ended=!0;try{t.flushSync();let e=Atomics.load(t[U].state,ci);Atomics.store(t[U].state,Wt,-1),Atomics.notify(t[U].state,Wt);let r=0;for(;e!==-1;){if(Atomics.wait(t[U].state,ci,e,1e3),e=Atomics.load(t[U].state,ci),e===-2)throw new Error("end() failed");if(++r===10)throw new Error("end() took too long (10s)")}process.nextTick(()=>{t[U].finished=!0,t.emit("finish")})}catch(e){To(t,e)}}}function Pf(t){let e=()=>{t[U].ending?kf(t):t[U].needDrain&&process.nextTick(h9,t)};for(t[U].flushing=!1;t[U].buf.length!==0;){let r=Atomics.load(t[U].state,Wt),i=t[U].data.length-r;if(i===0){If(t),Atomics.store(t[U].state,ci,0),Atomics.store(t[U].state,Wt,0);continue}else if(i<0)throw new Error("overwritten");let n=t[U].buf.slice(0,i),s=Buffer.byteLength(n);if(s<=i)t[U].buf=t[U].buf.slice(i),vu(t,n,e);else{for(If(t),Atomics.store(t[U].state,ci,0),Atomics.store(t[U].state,Wt,0);s>t[U].buf.length;)i=i/2,n=t[U].buf.slice(0,i),s=Buffer.byteLength(n);t[U].buf=t[U].buf.slice(i),vu(t,n,e)}}}function If(t){if(t[U].flushing)throw new Error("unable to flush while flushing");let e=Atomics.load(t[U].state,Wt),r=0;for(;;){let i=Atomics.load(t[U].state,ci);if(i===-2)throw new Error("_flushSync failed");if(i!==e)Atomics.wait(t[U].state,ci,i,1e3);else break;if(++r===10)throw new Error("_flushSync took too long (10s)")}}d9.exports=Tf});var Lf=H((jC,g9)=>{"use strict";var{createRequire:l7}=require("module"),u7=pf(),{join:Of,isAbsolute:c7}=require("path"),h7=Sf(),wu;global.WeakRef&&global.WeakMap&&global.FinalizationRegistry&&(wu=Af());var f7=p9();function d7(t){if(wu)wu.register(t,m9),t.on("close",function(){wu.unregister(t)});else{let e=m9.bind(null,t);process.once("beforeExit",e),process.once("exit",e),t.on("close",function(){process.removeListener("beforeExit",e),process.removeListener("exit",e)})}}function p7(t,e,r){let i=new f7({filename:t,workerData:e,workerOpts:r});i.on("ready",n),i.on("close",function(){process.removeListener("exit",s)}),process.on("exit",s);function n(){process.removeListener("exit",s),i.unref(),r.autoEnd!==!1&&d7(i)}function s(){i.closed||(i.flushSync(),h7(100),i.end())}return i}function m9(t){t.ref(),t.flushSync(),t.end(),t.once("close",function(){t.unref()})}function m7(t){let{pipeline:e,targets:r,levels:i,options:n={},worker:s={},caller:a=u7()}=t,c=typeof a=="string"?[a]:a,d="__bundlerPathsOverrides"in globalThis?globalThis.__bundlerPathsOverrides:{},p=t.target;if(p&&r)throw new Error("only one of target or targets can be specified");return r?(p=d["pino-worker"]||Of(__dirname,"worker.js"),n.targets=r.map(w=>({...w,target:m(w.target)}))):e&&(p=d["pino-pipeline-worker"]||Of(__dirname,"worker-pipeline.js"),n.targets=e.map(w=>({...w,target:m(w.target)}))),i&&(n.levels=i),p7(m(p),n,s);function m(w){if(w=d[w]||w,c7(w)||w.indexOf("file://")===0)return w;if(w==="pino/file")return Of(__dirname,"..","file.js");let S;for(let v of c)try{S=l7(v).resolve(w);break}catch{continue}if(!S)throw new Error(`unable to determine transport target for "${w}"`);return S}}g9.exports=m7});var Su=H((qC,A9)=>{"use strict";var y9=H5(),{mapHttpRequest:g7,mapHttpResponse:y7}=df(),Bf=J5(),S9=t9(),{lsCacheSym:b7,chindingsSym:zf,parsedChindingsSym:Nf,writeSym:b9,serializersSym:jf,formatOptsSym:v9,endSym:v7,stringifiersSym:qf,stringifySym:x9,stringifySafeSym:Uf,wildcardFirstSym:M9,needsMetadataGsym:E9,redactFmtSym:w7,streamSym:_7,nestedKeySym:S7,formattersSym:$f,messageKeySym:R9,nestedKeyStrSym:x7}=Ao(),{isMainThread:M7}=require("worker_threads"),E7=Lf();function i1(){}function R7(t,e){if(!e)return r;return function(...n){e.call(this,n,r,t)};function r(i,...n){if(typeof i=="object"){let s=i;i!==null&&(i.method&&i.headers&&i.socket?i=g7(i):typeof i.setHeader=="function"&&(i=y7(i)));let a;s===null&&n.length===0?a=[null]:(s=n.shift(),a=n),this[b9](i,y9(s,a,this[v9]),t)}else this[b9](null,y9(i,n,this[v9]),t)}}function w9(t){let e="",r=0,i=!1,n=255,s=t.length;if(s>100)return JSON.stringify(t);for(var a=0;a<s&&n>=32;a++)n=t.charCodeAt(a),(n===34||n===92)&&(e+=t.slice(r,a)+"\\",r=a,i=!0);return i?e+=t.slice(r):e=t,n<32?JSON.stringify(t):'"'+e+'"'}function C7(t,e,r,i){let n=this[x9],s=this[Uf],a=this[qf],c=this[v7],d=this[zf],p=this[jf],m=this[$f],w=this[R9],S=this[b7][r]+i;S=S+d;let v;m.log&&(t=m.log(t));let R=a[M9],x="";for(let C in t)if(v=t[C],Object.prototype.hasOwnProperty.call(t,C)&&v!==void 0){v=p[C]?p[C](v):v;let T=a[C]||R;switch(typeof v){case"undefined":case"function":continue;case"number":Number.isFinite(v)===!1&&(v=null);case"boolean":T&&(v=T(v));break;case"string":v=(T||w9)(v);break;default:v=(T||n)(v,s)}if(v===void 0)continue;x+=',"'+C+'":'+v}let A="";if(e!==void 0){v=p[w]?p[w](e):e;let C=a[w]||R;switch(typeof v){case"function":break;case"number":Number.isFinite(v)===!1&&(v=null);case"boolean":C&&(v=C(v)),A=',"'+w+'":'+v;break;case"string":v=(C||w9)(v),A=',"'+w+'":'+v;break;default:v=(C||n)(v,s),A=',"'+w+'":'+v}}return this[S7]&&x?S+this[x7]+x.slice(1)+"}"+A+c:S+x+A+c}function A7(t,e){let r,i=t[zf],n=t[x9],s=t[Uf],a=t[qf],c=a[M9],d=t[jf];e=t[$f].bindings(e);for(let m in e)if(r=e[m],(m!=="level"&&m!=="serializers"&&m!=="formatters"&&m!=="customLevels"&&e.hasOwnProperty(m)&&r!==void 0)===!0){if(r=d[m]?d[m](r):r,r=(a[m]||c||n)(r,s),r===void 0)continue;i+=',"'+m+'":'+r}return i}function C9(t,e,r,i){if(e&&typeof e=="function")return e=e.bind(i),Df(e(t),r,t);try{let n=require("pino-pretty").prettyFactory;return n.asMetaWrapper=Df,Df(n(t),r,t)}catch(n){throw n.message.startsWith("Cannot find module 'pino-pretty'")?Error("Missing `pino-pretty` module: `pino-pretty` must be installed separately"):n}}function Df(t,e,r){r=Object.assign({suppressFlushSyncWarning:!1},r);let i=!1;return{[E9]:!0,lastLevel:0,lastMsg:null,lastObj:null,lastLogger:null,flushSync(){r.suppressFlushSyncWarning||i||(i=!0,_9(e,this),e.write(t(Object.assign({level:40,msg:"pino.final with prettyPrint does not support flushing",time:Date.now()},this.chindings()))))},chindings(){let n=this.lastLogger,s=null;return n?(n.hasOwnProperty(Nf)?s=n[Nf]:(s=JSON.parse("{"+n[zf].substr(1)+"}"),n[Nf]=s),s):null},write(n){let s=this.lastLogger,a=this.chindings(),c=this.lastTime;typeof c=="number"||(c.match(/^\d+/)?c=parseInt(c):c=c.slice(1,-1));let d=this.lastObj,p=this.lastMsg,m=null,w=s[$f],S=w.log?w.log(d):d,v=s[R9];p&&S&&!Object.prototype.hasOwnProperty.call(S,v)&&(S[v]=p);let R=Object.assign({level:this.lastLevel,time:c},S,m),x=s[jf],A=Object.keys(x);for(var C=0;C<A.length;C++){let z=A[C];R[z]!==void 0&&(R[z]=x[z](R[z]))}for(let z in a)R.hasOwnProperty(z)||(R[z]=a[z]);let O=s[qf][w7],B=t(typeof O=="function"?O(R):R);B!==void 0&&(_9(e,this),e.write(B))}}}function P7(t){return t.write!==t.constructor.prototype.write}function _u(t){let e=new Bf(t);return e.on("error",r),!t.sync&&M7&&T7(e),e;function r(i){if(i.code==="EPIPE"){e.write=i1,e.end=i1,e.flushSync=i1,e.destroy=i1;return}e.removeListener("error",r),e.emit("error",i)}}function T7(t){if(global.WeakRef&&global.WeakMap&&global.FinalizationRegistry){let e=Af();e.register(t,I7),t.on("close",function(){e.unregister(t)})}}function I7(t,e){t.destroyed||(e==="beforeExit"?(t.flush(),t.on("drain",function(){t.end()})):t.flushSync())}function k7(t){return function(r,i,n={},s){if(typeof n=="string")s=_u({dest:n,sync:!0}),n={};else if(typeof s=="string"){if(n&&n.transport)throw Error("only one of option.transport or stream can be specified");s=_u({dest:s,sync:!0})}else if(n instanceof Bf||n.writable||n._writableState)s=n,n={};else if(n.transport){if(n.transport instanceof Bf||n.transport.writable||n.transport._writableState)throw Error("option.transport do not allow stream, please pass to option directly. e.g. pino(transport)");if(n.transport.targets&&n.transport.targets.length&&n.formatters&&typeof n.formatters.level=="function")throw Error("option.transport.targets do not allow custom level formatters");let m;n.customLevels&&(m=n.useOnlyCustomLevels?n.customLevels:Object.assign({},n.levels,n.customLevels)),s=E7({caller:i,...n.transport,levels:m})}if(n=Object.assign({},t,n),n.serializers=Object.assign({},t.serializers,n.serializers),n.formatters=Object.assign({},t.formatters,n.formatters),"onTerminated"in n)throw Error("The onTerminated option has been removed, use pino.final instead");"changeLevelName"in n&&(process.emitWarning("The changeLevelName option is deprecated and will be removed in v7. Use levelKey instead.",{code:"changeLevelName_deprecation"}),n.levelKey=n.changeLevelName,delete n.changeLevelName);let{enabled:a,prettyPrint:c,prettifier:d,messageKey:p}=n;if(a===!1&&(n.level="silent"),s=s||process.stdout,s===process.stdout&&s.fd>=0&&!P7(s)&&(s=_u({fd:s.fd,sync:!0})),c){S9.emit("PINODEP008");let m=Object.assign({messageKey:p},c);s=C9(m,d,s,r)}return{opts:n,stream:s}}}function O7(t,e){if(Number(process.versions.node.split(".")[0])>=14&&S9.emit("PINODEP009"),typeof t>"u"||typeof t.child!="function")throw Error("expected a pino logger instance");let i=typeof e<"u";if(i&&typeof e!="function")throw Error("if supplied, the handler parameter should be a function");let n=t[_7];if(typeof n.flushSync!="function")throw Error("final requires a stream that has a flushSync method, such as pino.destination");let s=new Proxy(t,{get:(a,c)=>c in a.levels.values?(...d)=>{a[c](...d),n.flushSync()}:a[c]});if(!i){try{n.flushSync()}catch{}return s}return(a=null,...c)=>{try{n.flushSync()}catch{}return e(a,s,...c)}}function L7(t,e){try{return JSON.stringify(t)}catch{try{return(e||this[Uf])(t)}catch{return'"[unable to serialize, circular reference is too complex to analyze]"'}}}function N7(t,e,r){return{level:t,bindings:e,log:r}}function _9(t,e){t[E9]===!0&&(t.lastLevel=e.lastLevel,t.lastMsg=e.lastMsg,t.lastObj=e.lastObj,t.lastTime=e.lastTime,t.lastLogger=e.lastLogger)}function D7(t){let e=Number(t);return typeof t=="string"&&Number.isFinite(e)?e:t}A9.exports={noop:i1,buildSafeSonicBoom:_u,getPrettyStream:C9,asChindings:A7,asJson:C7,genLog:R7,createArgsNormalizer:k7,final:O7,stringify:L7,buildFormatters:N7,normalizeDestFileDescriptor:D7}});var xu=H((UC,T9)=>{"use strict";var{lsCacheSym:B7,levelValSym:Wf,useOnlyCustomLevelsSym:z7,streamSym:j7,formattersSym:q7,hooksSym:U7}=Ao(),{noop:$7,genLog:ss}=Su(),Br={trace:10,debug:20,info:30,warn:40,error:50,fatal:60},P9={fatal:t=>{let e=ss(Br.fatal,t);return function(...r){let i=this[j7];if(e.call(this,...r),typeof i.flushSync=="function")try{i.flushSync()}catch{}}},error:t=>ss(Br.error,t),warn:t=>ss(Br.warn,t),info:t=>ss(Br.info,t),debug:t=>ss(Br.debug,t),trace:t=>ss(Br.trace,t)},Ff=Object.keys(Br).reduce((t,e)=>(t[Br[e]]=e,t),{}),W7=Object.keys(Ff).reduce((t,e)=>(t[e]='{"level":'+Number(e),t),{});function F7(t){let e=t[q7].level,{labels:r}=t.levels,i={};for(let n in r){let s=e(r[n],Number(n));i[n]=JSON.stringify(s).slice(0,-1)}return t[B7]=i,t}function H7(t,e){if(e)return!1;switch(t){case"fatal":case"error":case"warn":case"info":case"debug":case"trace":return!0;default:return!1}}function G7(t){let{labels:e,values:r}=this.levels;if(typeof t=="number"){if(e[t]===void 0)throw Error("unknown level value"+t);t=e[t]}if(r[t]===void 0)throw Error("unknown level "+t);let i=this[Wf],n=this[Wf]=r[t],s=this[z7],a=this[U7].logMethod;for(let c in r){if(n>r[c]){this[c]=$7;continue}this[c]=H7(c,s)?P9[c](a):ss(r[c],a)}this.emit("level-change",t,n,e[i],i)}function V7(t){let{levels:e,levelVal:r}=this;return e&&e.labels?e.labels[r]:""}function K7(t){let{values:e}=this.levels,r=e[t];return r!==void 0&&r>=this[Wf]}function Z7(t=null,e=!1){let r=t?Object.keys(t).reduce((s,a)=>(s[t[a]]=a,s),{}):null,i=Object.assign(Object.create(Object.prototype,{Infinity:{value:"silent"}}),e?null:Ff,r),n=Object.assign(Object.create(Object.prototype,{silent:{value:1/0}}),e?null:Br,t);return{labels:i,values:n}}function J7(t,e,r){if(typeof t=="number"){if(![].concat(Object.keys(e||{}).map(s=>e[s]),r?[]:Object.keys(Ff).map(s=>+s),1/0).includes(t))throw Error(`default level:${t} must be included in custom levels`);return}let i=Object.assign(Object.create(Object.prototype,{silent:{value:1/0}}),r?null:Br,e);if(!(t in i))throw Error(`default level:${t} must be included in custom levels`)}function Y7(t,e){let{labels:r,values:i}=t;for(let n in e){if(n in i)throw Error("levels cannot be overridden");if(e[n]in r)throw Error("pre-existing level values cannot be used for new levels")}}T9.exports={initialLsCache:W7,genLsCache:F7,levelMethods:P9,getLevel:V7,setLevel:G7,isLevelEnabled:K7,mappings:Z7,levels:Br,assertNoLevelCollisions:Y7,assertDefaultLevelFound:J7}});var I9=H(($C,X7)=>{X7.exports={name:"pino",version:"7.11.0",description:"super fast, all natural json logger",main:"pino.js",type:"commonjs",types:"pino.d.ts",browser:"./browser.js",files:["pino.js","file.js","pino.d.ts","bin.js","browser.js","pretty.js","usage.txt","test","docs","example.js","lib"],scripts:{docs:"docsify serve","browser-test":"airtap --local 8080 test/browser*test.js",lint:"eslint .",test:"npm run lint && npm run transpile && tap --ts && jest test/jest && npm run test-types","test-ci":"npm run lint && npm run transpile && tap --ts --no-check-coverage --coverage-report=lcovonly && npm run test-types","test-ci-pnpm":"pnpm run lint && npm run transpile && tap --ts --no-coverage --no-check-coverage && pnpm run test-types","test-ci-yarn-pnp":"yarn run lint && npm run transpile && tap --ts --no-check-coverage --coverage-report=lcovonly","test-types":"tsc && tsd && ts-node test/types/pino.ts",transpile:"node ./test/fixtures/ts/transpile.cjs","cov-ui":"tap --ts --coverage-report=html",bench:"node benchmarks/utils/runbench all","bench-basic":"node benchmarks/utils/runbench basic","bench-object":"node benchmarks/utils/runbench object","bench-deep-object":"node benchmarks/utils/runbench deep-object","bench-multi-arg":"node benchmarks/utils/runbench multi-arg","bench-longs-tring":"node benchmarks/utils/runbench long-string","bench-child":"node benchmarks/utils/runbench child","bench-child-child":"node benchmarks/utils/runbench child-child","bench-child-creation":"node benchmarks/utils/runbench child-creation","bench-formatters":"node benchmarks/utils/runbench formatters","update-bench-doc":"node benchmarks/utils/generate-benchmark-doc > docs/benchmarks.md"},bin:{pino:"./bin.js"},precommit:"test",repository:{type:"git",url:"git+https://github.com/pinojs/pino.git"},keywords:["fast","logger","stream","json"],author:"Matteo Collina <hello@matteocollina.com>",contributors:["David Mark Clements <huperekchuno@googlemail.com>","James Sumners <james.sumners@gmail.com>","Thomas Watson Steen <w@tson.dk> (https://twitter.com/wa7son)"],license:"MIT",bugs:{url:"https://github.com/pinojs/pino/issues"},homepage:"http://getpino.io",devDependencies:{"@types/flush-write-stream":"^1.0.0","@types/node":"^17.0.0","@types/tap":"^15.0.6",airtap:"4.0.4",benchmark:"^2.1.4",bole:"^4.0.0",bunyan:"^1.8.14","docsify-cli":"^4.4.1",eslint:"^7.17.0","eslint-config-standard":"^16.0.3","eslint-plugin-import":"^2.22.1","eslint-plugin-node":"^11.1.0","eslint-plugin-promise":"^5.1.0",execa:"^5.0.0",fastbench:"^1.0.1","flush-write-stream":"^2.0.0","import-fresh":"^3.2.1",jest:"^27.3.1",log:"^6.0.0",loglevel:"^1.6.7","pino-pretty":"^v7.6.0","pre-commit":"^1.2.2",proxyquire:"^2.1.3",pump:"^3.0.0",rimraf:"^3.0.2",semver:"^7.0.0",split2:"^4.0.0",steed:"^1.1.3","strip-ansi":"^6.0.0",tap:"^16.0.0",tape:"^5.0.0",through2:"^4.0.0","ts-node":"^10.7.0",tsd:"^0.20.0",typescript:"^4.4.4",winston:"^3.3.3"},dependencies:{"atomic-sleep":"^1.0.0","fast-redact":"^3.0.0","on-exit-leak-free":"^0.2.0","pino-abstract-transport":"v0.5.0","pino-std-serializers":"^4.0.0","process-warning":"^1.0.0","quick-format-unescaped":"^4.0.3","real-require":"^0.1.0","safe-stable-stringify":"^2.1.0","sonic-boom":"^2.2.1","thread-stream":"^0.15.1"},tsd:{directory:"test/types"}}});var Hf=H((WC,k9)=>{"use strict";var{version:Q7}=I9();k9.exports={version:Q7}});var $9=H((HC,U9)=>{"use strict";var{EventEmitter:eb}=require("events"),{lsCacheSym:tb,levelValSym:rb,setLevelSym:Vf,getLevelSym:O9,chindingsSym:Kf,parsedChindingsSym:ib,mixinSym:nb,asJsonSym:B9,writeSym:sb,mixinMergeStrategySym:ob,timeSym:ab,timeSliceIndexSym:lb,streamSym:z9,serializersSym:os,formattersSym:Gf,useOnlyCustomLevelsSym:ub,needsMetadataGsym:cb,redactFmtSym:hb,stringifySym:fb,formatOptsSym:db,stringifiersSym:pb}=Ao(),{getLevel:mb,setLevel:gb,isLevelEnabled:yb,mappings:bb,initialLsCache:vb,genLsCache:wb,assertNoLevelCollisions:_b}=xu(),{asChindings:j9,asJson:Sb,buildFormatters:L9,stringify:N9}=Su(),{version:xb}=Hf(),Mb=wf(),Eb=class{},q9={constructor:Eb,child:Rb,bindings:Cb,setBindings:Ab,flush:kb,isLevelEnabled:yb,version:xb,get level(){return this[O9]()},set level(t){this[Vf](t)},get levelVal(){return this[rb]},set levelVal(t){throw Error("levelVal is read-only")},[tb]:vb,[sb]:Tb,[B9]:Sb,[O9]:mb,[Vf]:gb};Object.setPrototypeOf(q9,eb.prototype);U9.exports=function(){return Object.create(q9)};var D9=t=>t;function Rb(t,e){if(!t)throw Error("missing bindings for child Pino");e=e||{};let r=this[os],i=this[Gf],n=Object.create(this);if(e.hasOwnProperty("serializers")===!0){n[os]=Object.create(null);for(let m in r)n[os][m]=r[m];let d=Object.getOwnPropertySymbols(r);for(var s=0;s<d.length;s++){let m=d[s];n[os][m]=r[m]}for(let m in e.serializers)n[os][m]=e.serializers[m];let p=Object.getOwnPropertySymbols(e.serializers);for(var a=0;a<p.length;a++){let m=p[a];n[os][m]=e.serializers[m]}}else n[os]=r;if(e.hasOwnProperty("formatters")){let{level:d,bindings:p,log:m}=e.formatters;n[Gf]=L9(d||i.level,p||D9,m||i.log)}else n[Gf]=L9(i.level,D9,i.log);if(e.hasOwnProperty("customLevels")===!0&&(_b(this.levels,e.customLevels),n.levels=bb(e.customLevels,n[ub]),wb(n)),typeof e.redact=="object"&&e.redact!==null||Array.isArray(e.redact)){n.redact=e.redact;let d=Mb(n.redact,N9),p={stringify:d[hb]};n[fb]=N9,n[pb]=d,n[db]=p}n[Kf]=j9(n,t);let c=e.level||this.level;return n[Vf](c),n}function Cb(){let e=`{${this[Kf].substr(1)}}`,r=JSON.parse(e);return delete r.pid,delete r.hostname,r}function Ab(t){let e=j9(this,t);this[Kf]=e,delete this[ib]}function Pb(t,e){return Object.assign(e,t)}function Tb(t,e,r){let i=this[ab](),n=this[nb],s=this[ob]||Pb,a;t==null?a={}:t instanceof Error?(a={err:t},e===void 0&&(e=t.message)):(a=t,e===void 0&&t.err&&(e=t.err.message)),n&&(a=s(a,n(a,r)));let c=this[B9](a,e,r,i),d=this[z9];d[cb]===!0&&(d.lastLevel=r,d.lastObj=a,d.lastMsg=e,d.lastTime=i.slice(this[lb]),d.lastLogger=this),d.write(c)}function Ib(){}function kb(){let t=this[z9];"flush"in t&&t.flush(Ib)}});var G9=H((e0,H9)=>{"use strict";var ls=Qf();ls.configure=Qf;ls.stringify=ls;ls.default=ls;e0.stringify=ls;e0.configure=Qf;H9.exports=ls;var Ob=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/,Lb=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/g,Xf=["\\u0000","\\u0001","\\u0002","\\u0003","\\u0004","\\u0005","\\u0006","\\u0007","\\b","\\t","\\n","\\u000b","\\f","\\r","\\u000e","\\u000f","\\u0010","\\u0011","\\u0012","\\u0013","\\u0014","\\u0015","\\u0016","\\u0017","\\u0018","\\u0019","\\u001a","\\u001b","\\u001c","\\u001d","\\u001e","\\u001f","","",'\\"',"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\\\"];function Nb(t){let e=t.charCodeAt(0);return Xf.length>e?Xf[e]:`\\u${e.toString(16)}`}function fn(t){if(t.length<5e3&&!Ob.test(t))return t;if(t.length>100)return t.replace(Lb,Nb);let e="",r=0;for(let i=0;i<t.length;i++){let n=t.charCodeAt(i);if(n===34||n===92||n<32)e+=`${t.slice(r,i)}${Xf[n]}`,r=i+1;else if(n>=55296&&n<=57343){if(n<=56319&&i+1<t.length){let s=t.charCodeAt(i+1);if(s>=56320&&s<=57343){i++;continue}}e+=`${t.slice(r,i)}${`\\u${n.toString(16)}`}`,r=i+1}}return e+=t.slice(r),e}function Zf(t){if(t.length>200)return t.sort();for(let e=1;e<t.length;e++){let r=t[e],i=e;for(;i!==0&&t[i-1]>r;)t[i]=t[i-1],i--;t[i]=r}return t}var Db=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Uint8Array)),Symbol.toStringTag).get;function Jf(t){return Db.call(t)!==void 0&&t.length!==0}function Yf(t,e,r){t.length<r&&(r=t.length);let i=e===","?"":" ",n=`"0":${i}${t[0]}`;for(let s=1;s<r;s++)n+=`${e}"${s}":${i}${t[s]}`;return n}function Bb(t){if(t&&Object.prototype.hasOwnProperty.call(t,"circularValue")){var e=t.circularValue;if(typeof e=="string")return`"${e}"`;if(e==null)return e;if(e===Error||e===TypeError)return{toString(){throw new TypeError("Converting circular structure to JSON")}};throw new TypeError('The "circularValue" argument must be of type string or the value null or undefined')}return'"[Circular]"'}function W9(t,e){if(t&&Object.prototype.hasOwnProperty.call(t,e)){var r=t[e];if(typeof r!="boolean")throw new TypeError(`The "${e}" argument must be of type boolean`)}return r===void 0?!0:r}function F9(t,e){if(t&&Object.prototype.hasOwnProperty.call(t,e)){var r=t[e];if(typeof r!="number")throw new TypeError(`The "${e}" argument must be of type number`);if(!Number.isInteger(r))throw new TypeError(`The "${e}" argument must be an integer`);if(r<1)throw new RangeError(`The "${e}" argument must be >= 1`)}return r===void 0?1/0:r}function as(t){return t===1?"1 item":`${t} items`}function zb(t){let e=new Set;for(let r of t)typeof r=="string"?e.add(r):typeof r=="number"&&e.add(String(r));return e}function Qf(t){let e=Bb(t),r=W9(t,"bigint"),i=W9(t,"deterministic"),n=F9(t,"maximumDepth"),s=F9(t,"maximumBreadth");function a(w,S,v,R,x,A){let C=S[w];switch(typeof C=="object"&&C!==null&&typeof C.toJSON=="function"&&(C=C.toJSON(w)),C=R.call(S,w,C),typeof C){case"string":return`"${fn(C)}"`;case"object":{if(C===null)return"null";if(v.indexOf(C)!==-1)return e;let T="",O=",",B=A;if(Array.isArray(C)){if(C.length===0)return"[]";if(n<v.length+1)return'"[Array]"';v.push(C),x!==""&&(A+=x,T+=`
84
+ ${A}`,O=`,
85
+ ${A}`);let De=Math.min(C.length,s),Pe=0;for(;Pe<De-1;Pe++){let ot=a(Pe,C,v,R,x,A);T+=ot!==void 0?ot:"null",T+=O}let We=a(Pe,C,v,R,x,A);if(T+=We!==void 0?We:"null",C.length-1>s){let ot=C.length-s-1;T+=`${O}"... ${as(ot)} not stringified"`}return x!==""&&(T+=`
86
+ ${B}`),v.pop(),`[${T}]`}let z=Object.keys(C),G=z.length;if(G===0)return"{}";if(n<v.length+1)return'"[Object]"';let te="",se="";x!==""&&(A+=x,O=`,
87
+ ${A}`,te=" ");let ke=Math.min(G,s);Jf(C)&&(T+=Yf(C,O,s),z=z.slice(C.length),ke-=C.length,se=O),i&&(z=Zf(z)),v.push(C);for(let De=0;De<ke;De++){let Pe=z[De],We=a(Pe,C,v,R,x,A);We!==void 0&&(T+=`${se}"${fn(Pe)}":${te}${We}`,se=O)}if(G>s){let De=G-s;T+=`${se}"...":${te}"${as(De)} not stringified"`,se=O}return x!==""&&se.length>1&&(T=`
88
+ ${A}${T}
89
+ ${B}`),v.pop(),`{${T}}`}case"number":return isFinite(C)?String(C):"null";case"boolean":return C===!0?"true":"false";case"bigint":return r?String(C):void 0}}function c(w,S,v,R,x,A){switch(typeof S=="object"&&S!==null&&typeof S.toJSON=="function"&&(S=S.toJSON(w)),typeof S){case"string":return`"${fn(S)}"`;case"object":{if(S===null)return"null";if(v.indexOf(S)!==-1)return e;let C=A,T="",O=",";if(Array.isArray(S)){if(S.length===0)return"[]";if(n<v.length+1)return'"[Array]"';v.push(S),x!==""&&(A+=x,T+=`
90
+ ${A}`,O=`,
91
+ ${A}`);let G=Math.min(S.length,s),te=0;for(;te<G-1;te++){let ke=c(te,S[te],v,R,x,A);T+=ke!==void 0?ke:"null",T+=O}let se=c(te,S[te],v,R,x,A);if(T+=se!==void 0?se:"null",S.length-1>s){let ke=S.length-s-1;T+=`${O}"... ${as(ke)} not stringified"`}return x!==""&&(T+=`
92
+ ${C}`),v.pop(),`[${T}]`}if(R.size===0)return"{}";v.push(S);let B="";x!==""&&(A+=x,O=`,
93
+ ${A}`,B=" ");let z="";for(let G of R){let te=c(G,S[G],v,R,x,A);te!==void 0&&(T+=`${z}"${fn(G)}":${B}${te}`,z=O)}return x!==""&&z.length>1&&(T=`
94
+ ${A}${T}
95
+ ${C}`),v.pop(),`{${T}}`}case"number":return isFinite(S)?String(S):"null";case"boolean":return S===!0?"true":"false";case"bigint":return r?String(S):void 0}}function d(w,S,v,R,x){switch(typeof S){case"string":return`"${fn(S)}"`;case"object":{if(S===null)return"null";if(typeof S.toJSON=="function"){if(S=S.toJSON(w),typeof S!="object")return d(w,S,v,R,x);if(S===null)return"null"}if(v.indexOf(S)!==-1)return e;let A=x;if(Array.isArray(S)){if(S.length===0)return"[]";if(n<v.length+1)return'"[Array]"';v.push(S),x+=R;let te=`
96
+ ${x}`,se=`,
97
+ ${x}`,ke=Math.min(S.length,s),De=0;for(;De<ke-1;De++){let We=d(De,S[De],v,R,x);te+=We!==void 0?We:"null",te+=se}let Pe=d(De,S[De],v,R,x);if(te+=Pe!==void 0?Pe:"null",S.length-1>s){let We=S.length-s-1;te+=`${se}"... ${as(We)} not stringified"`}return te+=`
98
+ ${A}`,v.pop(),`[${te}]`}let C=Object.keys(S),T=C.length;if(T===0)return"{}";if(n<v.length+1)return'"[Object]"';x+=R;let O=`,
99
+ ${x}`,B="",z="",G=Math.min(T,s);Jf(S)&&(B+=Yf(S,O,s),C=C.slice(S.length),G-=S.length,z=O),i&&(C=Zf(C)),v.push(S);for(let te=0;te<G;te++){let se=C[te],ke=d(se,S[se],v,R,x);ke!==void 0&&(B+=`${z}"${fn(se)}": ${ke}`,z=O)}if(T>s){let te=T-s;B+=`${z}"...": "${as(te)} not stringified"`,z=O}return z!==""&&(B=`
100
+ ${x}${B}
101
+ ${A}`),v.pop(),`{${B}}`}case"number":return isFinite(S)?String(S):"null";case"boolean":return S===!0?"true":"false";case"bigint":return r?String(S):void 0}}function p(w,S,v){switch(typeof S){case"string":return`"${fn(S)}"`;case"object":{if(S===null)return"null";if(typeof S.toJSON=="function"){if(S=S.toJSON(w),typeof S!="object")return p(w,S,v);if(S===null)return"null"}if(v.indexOf(S)!==-1)return e;let R="";if(Array.isArray(S)){if(S.length===0)return"[]";if(n<v.length+1)return'"[Array]"';v.push(S);let O=Math.min(S.length,s),B=0;for(;B<O-1;B++){let G=p(B,S[B],v);R+=G!==void 0?G:"null",R+=","}let z=p(B,S[B],v);if(R+=z!==void 0?z:"null",S.length-1>s){let G=S.length-s-1;R+=`,"... ${as(G)} not stringified"`}return v.pop(),`[${R}]`}let x=Object.keys(S),A=x.length;if(A===0)return"{}";if(n<v.length+1)return'"[Object]"';let C="",T=Math.min(A,s);Jf(S)&&(R+=Yf(S,",",s),x=x.slice(S.length),T-=S.length,C=","),i&&(x=Zf(x)),v.push(S);for(let O=0;O<T;O++){let B=x[O],z=p(B,S[B],v);z!==void 0&&(R+=`${C}"${fn(B)}":${z}`,C=",")}if(A>s){let O=A-s;R+=`${C}"...":"${as(O)} not stringified"`}return v.pop(),`{${R}}`}case"number":return isFinite(S)?String(S):"null";case"boolean":return S===!0?"true":"false";case"bigint":return r?String(S):void 0}}function m(w,S,v){if(arguments.length>1){let R="";if(typeof v=="number"?R=" ".repeat(Math.min(v,10)):typeof v=="string"&&(R=v.slice(0,10)),S!=null){if(typeof S=="function")return a("",{"":w},[],S,R,"");if(Array.isArray(S))return c("",w,[],zb(S),R,"")}if(R.length!==0)return d("",w,[],R,"")}return p("",w,[])}return m}});var J9=H((GC,Z9)=>{"use strict";var t0=Symbol.for("pino.metadata"),{levels:V9}=xu(),K9=Object.create(V9);K9.silent=1/0;var jb=V9.info;function qb(t,e){let r=0;t=t||[],e=e||{dedupe:!1};let i=K9;e.levels&&typeof e.levels=="object"&&(i=e.levels);let n={write:s,add:c,flushSync:a,end:d,minLevel:0,streams:[],clone:p,[t0]:!0};return Array.isArray(t)?t.forEach(c,n):c.call(n,t),t=null,n;function s(m){let w,S=this.lastLevel,{streams:v}=this,R;for(let x=0;x<v.length&&(w=v[x],w.level<=S);x++){if(R=w.stream,R[t0]){let{lastTime:A,lastMsg:C,lastObj:T,lastLogger:O}=this;R.lastLevel=S,R.lastTime=A,R.lastMsg=C,R.lastObj=T,R.lastLogger=O}(!e.dedupe||w.level===S)&&R.write(m)}}function a(){for(let{stream:m}of this.streams)typeof m.flushSync=="function"&&m.flushSync()}function c(m){if(!m)return n;let w=typeof m.write=="function"||m.stream,S=m.write?m:m.stream;if(!w)throw Error("stream object needs to implement either StreamEntry or DestinationStream interface");let{streams:v}=this,R;typeof m.levelVal=="number"?R=m.levelVal:typeof m.level=="string"?R=i[m.level]:typeof m.level=="number"?R=m.level:R=jb;let x={stream:S,level:R,levelVal:void 0,id:r++};return v.unshift(x),v.sort(Ub),this.minLevel=v[0].level,n}function d(){for(let{stream:m}of this.streams)typeof m.flushSync=="function"&&m.flushSync(),m.end()}function p(m){let w=new Array(this.streams.length);for(let S=0;S<w.length;S++)w[S]={level:m,stream:this.streams[S].stream};return{write:s,add:c,minLevel:m,streams:w,clone:p,flushSync:a,[t0]:!0}}}function Ub(t,e){return t.level-e.level}Z9.exports=qb});var n0=H((VC,or)=>{"use strict";var $b=require("os"),np=df(),Wb=pf(),Fb=wf(),sp=W5(),Hb=$9(),op=Ao(),{configure:Gb}=G9(),{assertDefaultLevelFound:Vb,mappings:ap,genLsCache:Kb,levels:Zb}=xu(),{createArgsNormalizer:Jb,asChindings:Yb,final:Xb,buildSafeSonicBoom:Y9,buildFormatters:Qb,stringify:Mu,normalizeDestFileDescriptor:X9,noop:ev}=Su(),{version:tv}=Hf(),{chindingsSym:Q9,redactFmtSym:rv,serializersSym:ep,timeSym:iv,timeSliceIndexSym:nv,streamSym:sv,stringifySym:tp,stringifySafeSym:r0,stringifiersSym:rp,setLevelSym:ov,endSym:av,formatOptsSym:lv,messageKeySym:uv,nestedKeySym:cv,mixinSym:hv,useOnlyCustomLevelsSym:fv,formattersSym:ip,hooksSym:dv,nestedKeyStrSym:pv,mixinMergeStrategySym:mv}=op,{epochTime:lp,nullTime:gv}=sp,{pid:yv}=process,bv=$b.hostname(),vv=np.err,wv={level:"info",levels:Zb,messageKey:"msg",nestedKey:null,enabled:!0,prettyPrint:!1,base:{pid:yv,hostname:bv},serializers:Object.assign(Object.create(null),{err:vv}),formatters:Object.assign(Object.create(null),{bindings(t){return t},level(t,e){return{level:e}}}),hooks:{logMethod:void 0},timestamp:lp,name:void 0,redact:null,customLevels:null,useOnlyCustomLevels:!1,depthLimit:5,edgeLimit:100},_v=Jb(wv),Sv=Object.assign(Object.create(null),np);function i0(...t){let e={},{opts:r,stream:i}=_v(e,Wb(),...t),{redact:n,crlf:s,serializers:a,timestamp:c,messageKey:d,nestedKey:p,base:m,name:w,level:S,customLevels:v,mixin:R,mixinMergeStrategy:x,useOnlyCustomLevels:A,formatters:C,hooks:T,depthLimit:O,edgeLimit:B}=r,z=Gb({maximumDepth:O,maximumBreadth:B}),G=Qb(C.level,C.bindings,C.log),te=n?Fb(n,Mu):{},se=Mu.bind({[r0]:z}),ke=n?{stringify:te[rv]}:{stringify:se},De="}"+(s?`\r
91
102
  `:`
92
- `),ae=Tx.bind(null,{[tg]:"",[rg]:a,[ng]:oe,[ig]:Bu,[pd]:W,[sg]:Z}),ze="";p!==null&&(w===void 0?ze=ae(p):ze=ae(Object.assign({},p,{name:w})));let ot=h instanceof Function?h:h?hg:Vx,mt=ot().indexOf(":")+1;if(I&&!_)throw Error("customLevels is required if useOnlyCustomLevels is set true");if(C&&typeof C!="function")throw Error(`Unknown mixin type "${typeof C}" - expected "function"`);Ex(E,_,I);let or=ug(_,I);return Object.assign(e,{levels:or,[$x]:I,[Dx]:i,[Nx]:ot,[Lx]:mt,[ig]:Bu,[pd]:W,[ng]:oe,[zx]:Pe,[Fx]:Oe,[Ux]:d,[jx]:m,[Hx]:m?`,${JSON.stringify(m)}:{`:"",[rg]:a,[Wx]:C,[Gx]:R,[tg]:ze,[sg]:Z,[qx]:k,silent:Px}),Object.setPrototypeOf(e,Sx()),Mx(e),e[Bx](E),e}dr.exports=gd;dr.exports.destination=(t=process.stdout.fd)=>typeof t=="object"?(t.dest=eg(t.dest||process.stdout.fd),Q0(t)):Q0({dest:eg(t),minLength:0,sync:!0});dr.exports.transport=Vf();dr.exports.multistream=J0();dr.exports.final=Ax;dr.exports.levels=ug();dr.exports.stdSerializers=Qx;dr.exports.stdTimeFunctions=Object.assign({},ag);dr.exports.symbols=lg;dr.exports.version=Ox;dr.exports.default=gd;dr.exports.pino=gd});var hs=ee((zu,cg)=>{(function(t,e){typeof zu=="object"&&typeof cg<"u"?e(zu):typeof define=="function"&&define.amd?define(["exports"],e):e(t.ULID={})})(zu,function(t){"use strict";function e(A){var k=new Error(A);return k.source="ulid",k}var r="0123456789ABCDEFGHJKMNPQRSTVWXYZ",i=r.length,n=Math.pow(2,48)-1,o=10,a=16;function h(A,k,D){return k>A.length-1?A:A.substr(0,k)+D+A.substr(k+1)}function d(A){for(var k=void 0,D=A.length,j=void 0,W=void 0,Z=i-1;!k&&D-->=0;){if(j=A[D],W=r.indexOf(j),W===-1)throw e("incorrectly encoded string");if(W===Z){A=h(A,D,r[0]);continue}k=h(A,D,r[W+1])}if(typeof k=="string")return k;throw e("cannot increment this string")}function m(A){var k=Math.floor(A()*i);return k===i&&(k=i-1),r.charAt(k)}function p(A,k){if(isNaN(A))throw new Error(A+" must be a number");if(A>n)throw e("cannot encode time greater than "+n);if(A<0)throw e("time must be positive");if(Number.isInteger(A)===!1)throw e("time must be an integer");for(var D=void 0,j="";k>0;k--)D=A%i,j=r.charAt(D)+j,A=(A-D)/i;return j}function w(A,k){for(var D="";A>0;A--)D=m(k)+D;return D}function E(A){if(A.length!==o+a)throw e("malformed ulid");var k=A.substr(0,o).split("").reverse().reduce(function(D,j,W){var Z=r.indexOf(j);if(Z===-1)throw e("invalid character found: "+j);return D+=Z*Math.pow(i,W)},0);if(k>n)throw e("malformed ulid, timestamp too large");return k}function _(){var A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,k=arguments[1];k||(k=typeof window<"u"?window:null);var D=k&&(k.crypto||k.msCrypto);if(D)return function(){var W=new Uint8Array(1);return D.getRandomValues(W),W[0]/255};try{var j=require("crypto");return function(){return j.randomBytes(1).readUInt8()/255}}catch{}if(A){try{console.error("secure crypto unusable, falling back to insecure Math.random()!")}catch{}return function(){return Math.random()}}throw e("secure crypto unusable, insecure Math.random not allowed")}function C(A){return A||(A=_()),function(D){return isNaN(D)&&(D=Date.now()),p(D,o)+w(a,A)}}function R(A){A||(A=_());var k=0,D=void 0;return function(W){if(isNaN(W)&&(W=Date.now()),W<=k){var Z=D=d(D);return p(k,o)+Z}k=W;var oe=D=w(a,A);return p(W,o)+oe}}var I=C();t.replaceCharAt=h,t.incrementBase32=d,t.randomChar=m,t.encodeTime=p,t.encodeRandom=w,t.decodeTime=E,t.detectPrng=_,t.factory=C,t.monotonicFactory=R,t.ulid=I,Object.defineProperty(t,"__esModule",{value:!0})})});var xg=ee(ju=>{"use strict";Object.defineProperty(ju,"__esModule",{value:!0});ju.Nztm2000Quad=void 0;ju.Nztm2000Quad={type:"TileMatrixSetType",title:"LINZ NZTM2000 Map Tile Grid V2",abstract:"",identifier:"NZTM2000Quad",supportedCRS:"https://www.opengis.net/def/crs/EPSG/0/2193",boundingBox:{type:"BoundingBoxType",crs:"https://www.opengis.net/def/crs/EPSG/0/2193",lowerCorner:[419435.9938,-32605867284e-4],upperCorner:[104381901652e-4,6758167443e-3]},tileMatrix:[{type:"TileMatrixType",identifier:"0",scaleDenominator:139770566007179e-6,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:1,matrixHeight:1},{type:"TileMatrixType",identifier:"1",scaleDenominator:698852830035895e-7,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:2,matrixHeight:2},{type:"TileMatrixType",identifier:"2",scaleDenominator:3494264150179475e-8,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:4,matrixHeight:4},{type:"TileMatrixType",identifier:"3",scaleDenominator:17471320750897374e-9,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:8,matrixHeight:8},{type:"TileMatrixType",identifier:"4",scaleDenominator:8735660375448687e-9,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:16,matrixHeight:16},{type:"TileMatrixType",identifier:"5",scaleDenominator:4.3678301877243435e6,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:32,matrixHeight:32},{type:"TileMatrixType",identifier:"6",scaleDenominator:2.1839150938621718e6,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:64,matrixHeight:64},{type:"TileMatrixType",identifier:"7",scaleDenominator:1.0919575469310859e6,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:128,matrixHeight:128},{type:"TileMatrixType",identifier:"8",scaleDenominator:545978.7734655429,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:256,matrixHeight:256},{type:"TileMatrixType",identifier:"9",scaleDenominator:272989.38673277147,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:512,matrixHeight:512},{type:"TileMatrixType",identifier:"10",scaleDenominator:136494.69336638573,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:1024,matrixHeight:1024},{type:"TileMatrixType",identifier:"11",scaleDenominator:68247.34668319287,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:2048,matrixHeight:2048},{type:"TileMatrixType",identifier:"12",scaleDenominator:34123.67334159643,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:4096,matrixHeight:4096},{type:"TileMatrixType",identifier:"13",scaleDenominator:17061.836670798217,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:8192,matrixHeight:8192},{type:"TileMatrixType",identifier:"14",scaleDenominator:8530.918335399108,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:16384,matrixHeight:16384},{type:"TileMatrixType",identifier:"15",scaleDenominator:4265.459167699554,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:32768,matrixHeight:32768},{type:"TileMatrixType",identifier:"16",scaleDenominator:2132.729583849777,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:65536,matrixHeight:65536},{type:"TileMatrixType",identifier:"17",scaleDenominator:1066.3647919248886,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:131072,matrixHeight:131072},{type:"TileMatrixType",identifier:"18",scaleDenominator:533.1823959624443,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:262144,matrixHeight:262144},{type:"TileMatrixType",identifier:"19",scaleDenominator:266.59119798122214,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:524288,matrixHeight:524288},{type:"TileMatrixType",identifier:"20",scaleDenominator:133.29559899061107,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:1048576,matrixHeight:1048576},{type:"TileMatrixType",identifier:"21",scaleDenominator:66.64779949530553,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:2097152,matrixHeight:2097152}]}});var Eg=ee(Wu=>{"use strict";Object.defineProperty(Wu,"__esModule",{value:!0});Wu.Nztm2000=void 0;Wu.Nztm2000={type:"TileMatrixSetType",title:"LINZ NZTM2000 Map Tile Grid",abstract:"See https://www.linz.govt.nz/data/linz-data-service/guides-and-documentation/nztm2000-map-tile-service-schema",identifier:"NZTM2000",supportedCRS:"https://www.opengis.net/def/crs/EPSG/0/2193",boundingBox:{type:"BoundingBoxType",crs:"https://www.opengis.net/def/crs/EPSG/0/2193",lowerCorner:[3087e3,274e3],upperCorner:[7173e3,3327e3]},tileMatrix:[{type:"TileMatrixType",identifier:"0",scaleDenominator:32e6,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:2,matrixHeight:4},{type:"TileMatrixType",identifier:"1",scaleDenominator:16e6,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:4,matrixHeight:8},{type:"TileMatrixType",identifier:"2",scaleDenominator:8e6,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:8,matrixHeight:16},{type:"TileMatrixType",identifier:"3",scaleDenominator:4e6,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:16,matrixHeight:32},{type:"TileMatrixType",identifier:"4",scaleDenominator:2e6,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:32,matrixHeight:64},{type:"TileMatrixType",identifier:"5",scaleDenominator:1e6,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:64,matrixHeight:128},{type:"TileMatrixType",identifier:"6",scaleDenominator:5e5,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:128,matrixHeight:256},{type:"TileMatrixType",identifier:"7",scaleDenominator:25e4,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:256,matrixHeight:512},{type:"TileMatrixType",identifier:"8",scaleDenominator:1e5,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:640,matrixHeight:1280},{type:"TileMatrixType",identifier:"9",scaleDenominator:5e4,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:1280,matrixHeight:2560},{type:"TileMatrixType",identifier:"10",scaleDenominator:25e3,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:2560,matrixHeight:5120},{type:"TileMatrixType",identifier:"11",scaleDenominator:1e4,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:6400,matrixHeight:12800},{type:"TileMatrixType",identifier:"12",scaleDenominator:5e3,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:12800,matrixHeight:25600},{type:"TileMatrixType",identifier:"13",scaleDenominator:2500,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:25600,matrixHeight:51200},{type:"TileMatrixType",identifier:"14",scaleDenominator:1e3,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:64e3,matrixHeight:128e3},{type:"TileMatrixType",identifier:"15",scaleDenominator:500,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:128e3,matrixHeight:256e3},{type:"TileMatrixType",identifier:"16",scaleDenominator:250,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:256e3,matrixHeight:512e3}]}});var Mg=ee(_o=>{"use strict";Object.defineProperty(_o,"__esModule",{value:!0});_o.Nztm2000=_o.Nztm2000Quad=void 0;var s2=xg();Object.defineProperty(_o,"Nztm2000Quad",{enumerable:!0,get:function(){return s2.Nztm2000Quad}});var o2=Eg();Object.defineProperty(_o,"Nztm2000",{enumerable:!0,get:function(){return o2.Nztm2000}})});var Og=ee((Yu,Pg)=>{(function(t,e){typeof Yu=="object"&&typeof Pg<"u"?e(Yu):typeof define=="function"&&define.amd?define(["exports"],e):(t=typeof globalThis<"u"?globalThis:t||self,e(t.WebStreamsPolyfill={}))})(Yu,function(t){"use strict";let e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol:l=>`Symbol(${l})`;function r(){}function i(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global}let n=i();function o(l){return typeof l=="object"&&l!==null||typeof l=="function"}let a=r,h=Promise,d=Promise.prototype.then,m=Promise.resolve.bind(h),p=Promise.reject.bind(h);function w(l){return new h(l)}function E(l){return m(l)}function _(l){return p(l)}function C(l,f,b){return d.call(l,f,b)}function R(l,f,b){C(C(l,f,b),void 0,a)}function I(l,f){R(l,f)}function A(l,f){R(l,void 0,f)}function k(l,f,b){return C(l,f,b)}function D(l){C(l,void 0,a)}let j=(()=>{let l=n&&n.queueMicrotask;if(typeof l=="function")return l;let f=E(void 0);return b=>C(f,b)})();function W(l,f,b){if(typeof l!="function")throw new TypeError("Argument is not a function");return Function.prototype.apply.call(l,f,b)}function Z(l,f,b){try{return E(W(l,f,b))}catch(O){return _(O)}}let oe=16384;class N{constructor(){this._cursor=0,this._size=0,this._front={_elements:[],_next:void 0},this._back=this._front,this._cursor=0,this._size=0}get length(){return this._size}push(f){let b=this._back,O=b;b._elements.length===oe-1&&(O={_elements:[],_next:void 0}),b._elements.push(f),O!==b&&(this._back=O,b._next=O),++this._size}shift(){let f=this._front,b=f,O=this._cursor,B=O+1,$=f._elements,V=$[O];return B===oe&&(b=f._next,B=0),--this._size,this._cursor=B,f!==b&&(this._front=b),$[O]=void 0,V}forEach(f){let b=this._cursor,O=this._front,B=O._elements;for(;(b!==B.length||O._next!==void 0)&&!(b===B.length&&(O=O._next,B=O._elements,b=0,B.length===0));)f(B[b]),++b}peek(){let f=this._front,b=this._cursor;return f._elements[b]}}function Oe(l,f){l._ownerReadableStream=f,f._reader=l,f._state==="readable"?ot(l):f._state==="closed"?or(l):mt(l,f._storedError)}function Pe(l,f){let b=l._ownerReadableStream;return hr(b,f)}function ae(l){l._ownerReadableStream._state==="readable"?pe(l,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")):sa(l,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")),l._ownerReadableStream._reader=void 0,l._ownerReadableStream=void 0}function ze(l){return new TypeError("Cannot "+l+" a stream using a released reader")}function ot(l){l._closedPromise=w((f,b)=>{l._closedPromise_resolve=f,l._closedPromise_reject=b})}function mt(l,f){ot(l),pe(l,f)}function or(l){ot(l),Mi(l)}function pe(l,f){l._closedPromise_reject!==void 0&&(D(l._closedPromise),l._closedPromise_reject(f),l._closedPromise_resolve=void 0,l._closedPromise_reject=void 0)}function sa(l,f){mt(l,f)}function Mi(l){l._closedPromise_resolve!==void 0&&(l._closedPromise_resolve(void 0),l._closedPromise_resolve=void 0,l._closedPromise_reject=void 0)}let ar=e("[[AbortSteps]]"),_r=e("[[ErrorSteps]]"),Ri=e("[[CancelSteps]]"),zt=e("[[PullSteps]]"),Ln=Number.isFinite||function(l){return typeof l=="number"&&isFinite(l)},Dn=Math.trunc||function(l){return l<0?Math.ceil(l):Math.floor(l)};function yt(l){return typeof l=="object"||typeof l=="function"}function T(l,f){if(l!==void 0&&!yt(l))throw new TypeError(`${f} is not an object.`)}function M(l,f){if(typeof l!="function")throw new TypeError(`${f} is not a function.`)}function G(l){return typeof l=="object"&&l!==null||typeof l=="function"}function F(l,f){if(!G(l))throw new TypeError(`${f} is not an object.`)}function be(l,f,b){if(l===void 0)throw new TypeError(`Parameter ${f} is required in '${b}'.`)}function Qe(l,f,b){if(l===void 0)throw new TypeError(`${f} is required in '${b}'.`)}function tt(l){return Number(l)}function bt(l){return l===0?0:l}function Yt(l){return bt(Dn(l))}function Sr(l,f){let O=Number.MAX_SAFE_INTEGER,B=Number(l);if(B=bt(B),!Ln(B))throw new TypeError(`${f} is not a finite number`);if(B=Yt(B),B<0||B>O)throw new TypeError(`${f} is outside the accepted range of ${0} to ${O}, inclusive`);return!Ln(B)||B===0?0:B}function je(l,f){if(!ni(l))throw new TypeError(`${f} is not a ReadableStream.`)}function at(l){return new zn(l)}function Q(l,f){l._reader._readRequests.push(f)}function _t(l,f,b){let B=l._reader._readRequests.shift();b?B._closeSteps():B._chunkSteps(f)}function Zt(l){return l._reader._readRequests.length}function Bn(l){let f=l._reader;return!(f===void 0||!Xr(f))}class zn{constructor(f){if(be(f,1,"ReadableStreamDefaultReader"),je(f,"First parameter"),si(f))throw new TypeError("This stream has already been locked for exclusive reading by another reader");Oe(this,f),this._readRequests=new N}get closed(){return Xr(this)?this._closedPromise:_(Ds("closed"))}cancel(f=void 0){return Xr(this)?this._ownerReadableStream===void 0?_(ze("cancel")):Pe(this,f):_(Ds("cancel"))}read(){if(!Xr(this))return _(Ds("read"));if(this._ownerReadableStream===void 0)return _(ze("read from"));let f,b,O=w(($,V)=>{f=$,b=V});return Fn(this,{_chunkSteps:$=>f({value:$,done:!1}),_closeSteps:()=>f({value:void 0,done:!0}),_errorSteps:$=>b($)}),O}releaseLock(){if(!Xr(this))throw Ds("releaseLock");if(this._ownerReadableStream!==void 0){if(this._readRequests.length>0)throw new TypeError("Tried to release a reader lock when that reader has pending read() calls un-settled");ae(this)}}}Object.defineProperties(zn.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(zn.prototype,e.toStringTag,{value:"ReadableStreamDefaultReader",configurable:!0});function Xr(l){return!o(l)||!Object.prototype.hasOwnProperty.call(l,"_readRequests")?!1:l instanceof zn}function Fn(l,f){let b=l._ownerReadableStream;b._disturbed=!0,b._state==="closed"?f._closeSteps():b._state==="errored"?f._errorSteps(b._storedError):b._readableStreamController[zt](f)}function Ds(l){return new TypeError(`ReadableStreamDefaultReader.prototype.${l} can only be used on a ReadableStreamDefaultReader`)}let Tl=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype);class oa{constructor(f,b){this._ongoingPromise=void 0,this._isFinished=!1,this._reader=f,this._preventCancel=b}next(){let f=()=>this._nextSteps();return this._ongoingPromise=this._ongoingPromise?k(this._ongoingPromise,f,f):f(),this._ongoingPromise}return(f){let b=()=>this._returnSteps(f);return this._ongoingPromise?k(this._ongoingPromise,b,b):b()}_nextSteps(){if(this._isFinished)return Promise.resolve({value:void 0,done:!0});let f=this._reader;if(f._ownerReadableStream===void 0)return _(ze("iterate"));let b,O,B=w((V,ne)=>{b=V,O=ne});return Fn(f,{_chunkSteps:V=>{this._ongoingPromise=void 0,j(()=>b({value:V,done:!1}))},_closeSteps:()=>{this._ongoingPromise=void 0,this._isFinished=!0,ae(f),b({value:void 0,done:!0})},_errorSteps:V=>{this._ongoingPromise=void 0,this._isFinished=!0,ae(f),O(V)}}),B}_returnSteps(f){if(this._isFinished)return Promise.resolve({value:f,done:!0});this._isFinished=!0;let b=this._reader;if(b._ownerReadableStream===void 0)return _(ze("finish iterating"));if(!this._preventCancel){let O=Pe(b,f);return ae(b),k(O,()=>({value:f,done:!0}))}return ae(b),E({value:f,done:!0})}}let Al={next(){return Il(this)?this._asyncIteratorImpl.next():_(Un("next"))},return(l){return Il(this)?this._asyncIteratorImpl.return(l):_(Un("return"))}};Tl!==void 0&&Object.setPrototypeOf(Al,Tl);function mc(l,f){let b=at(l),O=new oa(b,f),B=Object.create(Al);return B._asyncIteratorImpl=O,B}function Il(l){if(!o(l)||!Object.prototype.hasOwnProperty.call(l,"_asyncIteratorImpl"))return!1;try{return l._asyncIteratorImpl instanceof oa}catch{return!1}}function Un(l){return new TypeError(`ReadableStreamAsyncIterator.${l} can only be used on a ReadableSteamAsyncIterator`)}let jn=Number.isNaN||function(l){return l!==l};function Zi(l){return l.slice()}function Pl(l,f,b,O,B){new Uint8Array(l).set(new Uint8Array(b,O,B),f)}function rp(l){return l}function Bs(l){return!1}function de(l,f,b){if(l.slice)return l.slice(f,b);let O=b-f,B=new ArrayBuffer(O);return Pl(B,0,l,f,O),B}function pc(l){return!(typeof l!="number"||jn(l)||l<0)}function Ol(l){let f=de(l.buffer,l.byteOffset,l.byteOffset+l.byteLength);return new Uint8Array(f)}function aa(l){let f=l._queue.shift();return l._queueTotalSize-=f.size,l._queueTotalSize<0&&(l._queueTotalSize=0),f.value}function lt(l,f,b){if(!pc(b)||b===1/0)throw new RangeError("Size must be a finite, non-NaN, non-negative number.");l._queue.push({value:f,size:b}),l._queueTotalSize+=b}function gc(l){return l._queue.peek().value}function vt(l){l._queue=new N,l._queueTotalSize=0}class Wn{constructor(){throw new TypeError("Illegal constructor")}get view(){if(!la(this))throw ya("view");return this._view}respond(f){if(!la(this))throw ya("respond");if(be(f,1,"respond"),f=Sr(f,"First parameter"),this._associatedReadableByteStreamController===void 0)throw new TypeError("This BYOB request has been invalidated");Bs(this._view.buffer),Gn(this._associatedReadableByteStreamController,f)}respondWithNewView(f){if(!la(this))throw ya("respondWithNewView");if(be(f,1,"respondWithNewView"),!ArrayBuffer.isView(f))throw new TypeError("You can only respond with array buffer views");if(this._associatedReadableByteStreamController===void 0)throw new TypeError("This BYOB request has been invalidated");Bs(f.buffer),zs(this._associatedReadableByteStreamController,f)}}Object.defineProperties(Wn.prototype,{respond:{enumerable:!0},respondWithNewView:{enumerable:!0},view:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(Wn.prototype,e.toStringTag,{value:"ReadableStreamBYOBRequest",configurable:!0});class Ci{constructor(){throw new TypeError("Illegal constructor")}get byobRequest(){if(!Jr(this))throw Ii("byobRequest");return Ai(this)}get desiredSize(){if(!Jr(this))throw Ii("desiredSize");return Bl(this)}close(){if(!Jr(this))throw Ii("close");if(this._closeRequested)throw new TypeError("The stream has already been closed; do not close it again!");let f=this._controlledReadableByteStream._state;if(f!=="readable")throw new TypeError(`The stream (in ${f} state) is not in the readable state and cannot be closed`);pt(this)}enqueue(f){if(!Jr(this))throw Ii("enqueue");if(be(f,1,"enqueue"),!ArrayBuffer.isView(f))throw new TypeError("chunk must be an array buffer view");if(f.byteLength===0)throw new TypeError("chunk must have non-zero byteLength");if(f.buffer.byteLength===0)throw new TypeError("chunk's buffer must have non-zero byteLength");if(this._closeRequested)throw new TypeError("stream is closed or draining");let b=this._controlledReadableByteStream._state;if(b!=="readable")throw new TypeError(`The stream (in ${b} state) is not in the readable state and cannot be enqueued to`);Et(this,f)}error(f=void 0){if(!Jr(this))throw Ii("error");Mt(this,f)}[Ri](f){$n(this),vt(this);let b=this._cancelAlgorithm(f);return Br(this),b}[zt](f){let b=this._controlledReadableByteStream;if(this._queueTotalSize>0){let B=this._queue.shift();this._queueTotalSize-=B.byteLength,Nl(this);let $=new Uint8Array(B.buffer,B.byteOffset,B.byteLength);f._chunkSteps($);return}let O=this._autoAllocateChunkSize;if(O!==void 0){let B;try{B=new ArrayBuffer(O)}catch(V){f._errorSteps(V);return}let $={buffer:B,bufferByteLength:O,byteOffset:0,byteLength:O,bytesFilled:0,elementSize:1,viewConstructor:Uint8Array,readerType:"default"};this._pendingPullIntos.push($)}Q(b,f),Ti(this)}}Object.defineProperties(Ci.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},byobRequest:{enumerable:!0},desiredSize:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(Ci.prototype,e.toStringTag,{value:"ReadableByteStreamController",configurable:!0});function Jr(l){return!o(l)||!Object.prototype.hasOwnProperty.call(l,"_controlledReadableByteStream")?!1:l instanceof Ci}function la(l){return!o(l)||!Object.prototype.hasOwnProperty.call(l,"_associatedReadableByteStreamController")?!1:l instanceof Wn}function Ti(l){if(!Dl(l))return;if(l._pulling){l._pullAgain=!0;return}l._pulling=!0;let b=l._pullAlgorithm();R(b,()=>{l._pulling=!1,l._pullAgain&&(l._pullAgain=!1,Ti(l))},O=>{Mt(l,O)})}function $n(l){Xi(l),l._pendingPullIntos=new N}function ua(l,f){let b=!1;l._state==="closed"&&(b=!0);let O=ha(f);f.readerType==="default"?_t(l,O,b):yc(l,O,b)}function ha(l){let f=l.bytesFilled,b=l.elementSize;return new l.viewConstructor(l.buffer,l.byteOffset,f/b)}function qn(l,f,b,O){l._queue.push({buffer:f,byteOffset:b,byteLength:O}),l._queueTotalSize+=O}function kl(l,f){let b=f.elementSize,O=f.bytesFilled-f.bytesFilled%b,B=Math.min(l._queueTotalSize,f.byteLength-f.bytesFilled),$=f.bytesFilled+B,V=$-$%b,ne=B,ge=!1;V>O&&(ne=V-f.bytesFilled,ge=!0);let Me=l._queue;for(;ne>0;){let De=Me.peek(),Be=Math.min(ne,De.byteLength),ut=f.byteOffset+f.bytesFilled;Pl(f.buffer,ut,De.buffer,De.byteOffset,Be),De.byteLength===Be?Me.shift():(De.byteOffset+=Be,De.byteLength-=Be),l._queueTotalSize-=Be,ca(l,Be,f),ne-=Be}return ge}function ca(l,f,b){b.bytesFilled+=f}function Nl(l){l._queueTotalSize===0&&l._closeRequested?(Br(l),es(l._controlledReadableByteStream)):Ti(l)}function Xi(l){l._byobRequest!==null&&(l._byobRequest._associatedReadableByteStreamController=void 0,l._byobRequest._view=null,l._byobRequest=null)}function fa(l){for(;l._pendingPullIntos.length>0;){if(l._queueTotalSize===0)return;let f=l._pendingPullIntos.peek();kl(l,f)&&(Hn(l),ua(l._controlledReadableByteStream,f))}}function da(l,f,b){let O=l._controlledReadableByteStream,B=1;f.constructor!==DataView&&(B=f.constructor.BYTES_PER_ELEMENT);let $=f.constructor,V=f.buffer,ne={buffer:V,bufferByteLength:V.byteLength,byteOffset:f.byteOffset,byteLength:f.byteLength,bytesFilled:0,elementSize:B,viewConstructor:$,readerType:"byob"};if(l._pendingPullIntos.length>0){l._pendingPullIntos.push(ne),Ul(O,b);return}if(O._state==="closed"){let ge=new $(ne.buffer,ne.byteOffset,0);b._closeSteps(ge);return}if(l._queueTotalSize>0){if(kl(l,ne)){let ge=ha(ne);Nl(l),b._chunkSteps(ge);return}if(l._closeRequested){let ge=new TypeError("Insufficient bytes to fill elements in the given buffer");Mt(l,ge),b._errorSteps(ge);return}}l._pendingPullIntos.push(ne),Ul(O,b),Ti(l)}function Ll(l,f){let b=l._controlledReadableByteStream;if(va(b))for(;ba(b)>0;){let O=Hn(l);ua(b,O)}}function Xt(l,f,b){if(ca(l,f,b),b.bytesFilled<b.elementSize)return;Hn(l);let O=b.bytesFilled%b.elementSize;if(O>0){let B=b.byteOffset+b.bytesFilled,$=de(b.buffer,B-O,B);qn(l,$,0,$.byteLength)}b.bytesFilled-=O,ua(l._controlledReadableByteStream,b),fa(l)}function ma(l,f){let b=l._pendingPullIntos.peek();Xi(l),l._controlledReadableByteStream._state==="closed"?Ll(l):Xt(l,f,b),Ti(l)}function Hn(l){return l._pendingPullIntos.shift()}function Dl(l){let f=l._controlledReadableByteStream;return f._state!=="readable"||l._closeRequested||!l._started?!1:!!(Bn(f)&&Zt(f)>0||va(f)&&ba(f)>0||Bl(l)>0)}function Br(l){l._pullAlgorithm=void 0,l._cancelAlgorithm=void 0}function pt(l){let f=l._controlledReadableByteStream;if(!(l._closeRequested||f._state!=="readable")){if(l._queueTotalSize>0){l._closeRequested=!0;return}if(l._pendingPullIntos.length>0&&l._pendingPullIntos.peek().bytesFilled>0){let O=new TypeError("Insufficient bytes to fill elements in the given buffer");throw Mt(l,O),O}Br(l),es(f)}}function Et(l,f){let b=l._controlledReadableByteStream;if(l._closeRequested||b._state!=="readable")return;let O=f.buffer,B=f.byteOffset,$=f.byteLength,V=O;if(l._pendingPullIntos.length>0){let ne=l._pendingPullIntos.peek();Bs(ne.buffer),ne.buffer=ne.buffer}if(Xi(l),Bn(b))if(Zt(b)===0)qn(l,V,B,$);else{l._pendingPullIntos.length>0&&Hn(l);let ne=new Uint8Array(V,B,$);_t(b,ne,!1)}else va(b)?(qn(l,V,B,$),fa(l)):qn(l,V,B,$);Ti(l)}function Mt(l,f){let b=l._controlledReadableByteStream;b._state==="readable"&&($n(l),vt(l),Br(l),uu(b,f))}function Ai(l){if(l._byobRequest===null&&l._pendingPullIntos.length>0){let f=l._pendingPullIntos.peek(),b=new Uint8Array(f.buffer,f.byteOffset+f.bytesFilled,f.byteLength-f.bytesFilled),O=Object.create(Wn.prototype);zl(O,l,b),l._byobRequest=O}return l._byobRequest}function Bl(l){let f=l._controlledReadableByteStream._state;return f==="errored"?null:f==="closed"?0:l._strategyHWM-l._queueTotalSize}function Gn(l,f){let b=l._pendingPullIntos.peek();if(l._controlledReadableByteStream._state==="closed"){if(f!==0)throw new TypeError("bytesWritten must be 0 when calling respond() on a closed stream")}else{if(f===0)throw new TypeError("bytesWritten must be greater than 0 when calling respond() on a readable stream");if(b.bytesFilled+f>b.byteLength)throw new RangeError("bytesWritten out of range")}b.buffer=b.buffer,ma(l,f)}function zs(l,f){let b=l._pendingPullIntos.peek();if(l._controlledReadableByteStream._state==="closed"){if(f.byteLength!==0)throw new TypeError("The view's length must be 0 when calling respondWithNewView() on a closed stream")}else if(f.byteLength===0)throw new TypeError("The view's length must be greater than 0 when calling respondWithNewView() on a readable stream");if(b.byteOffset+b.bytesFilled!==f.byteOffset)throw new RangeError("The region specified by view does not match byobRequest");if(b.bufferByteLength!==f.buffer.byteLength)throw new RangeError("The buffer of view has different capacity than byobRequest");if(b.bytesFilled+f.byteLength>b.byteLength)throw new RangeError("The region specified by view is larger than byobRequest");let B=f.byteLength;b.buffer=f.buffer,ma(l,B)}function pa(l,f,b,O,B,$,V){f._controlledReadableByteStream=l,f._pullAgain=!1,f._pulling=!1,f._byobRequest=null,f._queue=f._queueTotalSize=void 0,vt(f),f._closeRequested=!1,f._started=!1,f._strategyHWM=$,f._pullAlgorithm=O,f._cancelAlgorithm=B,f._autoAllocateChunkSize=V,f._pendingPullIntos=new N,l._readableStreamController=f;let ne=b();R(E(ne),()=>{f._started=!0,Ti(f)},ge=>{Mt(f,ge)})}function ga(l,f,b){let O=Object.create(Ci.prototype),B=()=>{},$=()=>E(void 0),V=()=>E(void 0);f.start!==void 0&&(B=()=>f.start(O)),f.pull!==void 0&&($=()=>f.pull(O)),f.cancel!==void 0&&(V=ge=>f.cancel(ge));let ne=f.autoAllocateChunkSize;if(ne===0)throw new TypeError("autoAllocateChunkSize must be greater than 0");pa(l,O,B,$,V,b,ne)}function zl(l,f,b){l._associatedReadableByteStreamController=f,l._view=b}function ya(l){return new TypeError(`ReadableStreamBYOBRequest.prototype.${l} can only be used on a ReadableStreamBYOBRequest`)}function Ii(l){return new TypeError(`ReadableByteStreamController.prototype.${l} can only be used on a ReadableByteStreamController`)}function Fl(l){return new Ji(l)}function Ul(l,f){l._reader._readIntoRequests.push(f)}function yc(l,f,b){let B=l._reader._readIntoRequests.shift();b?B._closeSteps(f):B._chunkSteps(f)}function ba(l){return l._reader._readIntoRequests.length}function va(l){let f=l._reader;return!(f===void 0||!Pi(f))}class Ji{constructor(f){if(be(f,1,"ReadableStreamBYOBReader"),je(f,"First parameter"),si(f))throw new TypeError("This stream has already been locked for exclusive reading by another reader");if(!Jr(f._readableStreamController))throw new TypeError("Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte source");Oe(this,f),this._readIntoRequests=new N}get closed(){return Pi(this)?this._closedPromise:_(Fs("closed"))}cancel(f=void 0){return Pi(this)?this._ownerReadableStream===void 0?_(ze("cancel")):Pe(this,f):_(Fs("cancel"))}read(f){if(!Pi(this))return _(Fs("read"));if(!ArrayBuffer.isView(f))return _(new TypeError("view must be an array buffer view"));if(f.byteLength===0)return _(new TypeError("view must have non-zero byteLength"));if(f.buffer.byteLength===0)return _(new TypeError("view's buffer must have non-zero byteLength"));if(Bs(f.buffer),this._ownerReadableStream===void 0)return _(ze("read from"));let b,O,B=w((V,ne)=>{b=V,O=ne});return jl(this,f,{_chunkSteps:V=>b({value:V,done:!1}),_closeSteps:V=>b({value:V,done:!0}),_errorSteps:V=>O(V)}),B}releaseLock(){if(!Pi(this))throw Fs("releaseLock");if(this._ownerReadableStream!==void 0){if(this._readIntoRequests.length>0)throw new TypeError("Tried to release a reader lock when that reader has pending read() calls un-settled");ae(this)}}}Object.defineProperties(Ji.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(Ji.prototype,e.toStringTag,{value:"ReadableStreamBYOBReader",configurable:!0});function Pi(l){return!o(l)||!Object.prototype.hasOwnProperty.call(l,"_readIntoRequests")?!1:l instanceof Ji}function jl(l,f,b){let O=l._ownerReadableStream;O._disturbed=!0,O._state==="errored"?b._errorSteps(O._storedError):da(O._readableStreamController,f,b)}function Fs(l){return new TypeError(`ReadableStreamBYOBReader.prototype.${l} can only be used on a ReadableStreamBYOBReader`)}function xr(l,f){let{highWaterMark:b}=l;if(b===void 0)return f;if(jn(b)||b<0)throw new RangeError("Invalid highWaterMark");return b}function Us(l){let{size:f}=l;return f||(()=>1)}function js(l,f){T(l,f);let b=l?.highWaterMark,O=l?.size;return{highWaterMark:b===void 0?void 0:tt(b),size:O===void 0?void 0:Wl(O,`${f} has member 'size' that`)}}function Wl(l,f){return M(l,f),b=>tt(l(b))}function $l(l,f){T(l,f);let b=l?.abort,O=l?.close,B=l?.start,$=l?.type,V=l?.write;return{abort:b===void 0?void 0:ql(b,l,`${f} has member 'abort' that`),close:O===void 0?void 0:bc(O,l,`${f} has member 'close' that`),start:B===void 0?void 0:vc(B,l,`${f} has member 'start' that`),write:V===void 0?void 0:wc(V,l,`${f} has member 'write' that`),type:$}}function ql(l,f,b){return M(l,b),O=>Z(l,f,[O])}function bc(l,f,b){return M(l,b),()=>Z(l,f,[])}function vc(l,f,b){return M(l,b),O=>W(l,f,[O])}function wc(l,f,b){return M(l,b),(O,B)=>Z(l,f,[O,B])}function Hl(l,f){if(!en(l))throw new TypeError(`${f} is not a WritableStream.`)}function _c(l){if(typeof l!="object"||l===null)return!1;try{return typeof l.aborted=="boolean"}catch{return!1}}let Sc=typeof AbortController=="function";function xc(){if(Sc)return new AbortController}class Qi{constructor(f={},b={}){f===void 0?f=null:F(f,"First parameter");let O=js(b,"Second parameter"),B=$l(f,"First parameter");if(wa(this),B.type!==void 0)throw new RangeError("Invalid type is specified");let V=Us(O),ne=xr(O,1);Lc(this,B,ne,V)}get locked(){if(!en(this))throw Vs("locked");return tn(this)}abort(f=void 0){return en(this)?tn(this)?_(new TypeError("Cannot abort a stream that already has a writer")):Ws(this,f):_(Vs("abort"))}close(){return en(this)?tn(this)?_(new TypeError("Cannot close a stream that already has a writer")):lr(this)?_(new TypeError("Cannot close an already-closing stream")):Gl(this):_(Vs("close"))}getWriter(){if(!en(this))throw Vs("getWriter");return Vn(this)}}Object.defineProperties(Qi.prototype,{abort:{enumerable:!0},close:{enumerable:!0},getWriter:{enumerable:!0},locked:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(Qi.prototype,e.toStringTag,{value:"WritableStream",configurable:!0});function Vn(l){return new Kn(l)}function Ec(l,f,b,O,B=1,$=()=>1){let V=Object.create(Qi.prototype);wa(V);let ne=Object.create(Qr.prototype);return Jl(V,ne,l,f,b,O,B,$),V}function wa(l){l._state="writable",l._storedError=void 0,l._writer=void 0,l._writableStreamController=void 0,l._writeRequests=new N,l._inFlightWriteRequest=void 0,l._closeRequest=void 0,l._inFlightCloseRequest=void 0,l._pendingAbortRequest=void 0,l._backpressure=!1}function en(l){return!o(l)||!Object.prototype.hasOwnProperty.call(l,"_writableStreamController")?!1:l instanceof Qi}function tn(l){return l._writer!==void 0}function Ws(l,f){var b;if(l._state==="closed"||l._state==="errored")return E(void 0);l._writableStreamController._abortReason=f,(b=l._writableStreamController._abortController)===null||b===void 0||b.abort();let O=l._state;if(O==="closed"||O==="errored")return E(void 0);if(l._pendingAbortRequest!==void 0)return l._pendingAbortRequest._promise;let B=!1;O==="erroring"&&(B=!0,f=void 0);let $=w((V,ne)=>{l._pendingAbortRequest={_promise:void 0,_resolve:V,_reject:ne,_reason:f,_wasAlreadyErroring:B}});return l._pendingAbortRequest._promise=$,B||rn(l,f),$}function Gl(l){let f=l._state;if(f==="closed"||f==="errored")return _(new TypeError(`The stream (in ${f} state) is not in the writable state and cannot be closed`));let b=w((B,$)=>{let V={_resolve:B,_reject:$};l._closeRequest=V}),O=l._writer;return O!==void 0&&l._backpressure&&f==="writable"&&Ia(O),Dc(l._writableStreamController),b}function Mc(l){return w((b,O)=>{let B={_resolve:b,_reject:O};l._writeRequests.push(B)})}function $s(l,f){if(l._state==="writable"){rn(l,f);return}_a(l)}function rn(l,f){let b=l._writableStreamController;l._state="erroring",l._storedError=f;let O=l._writer;O!==void 0&&Kl(O,f),!Ac(l)&&b._started&&_a(l)}function _a(l){l._state="errored",l._writableStreamController[_r]();let f=l._storedError;if(l._writeRequests.forEach(B=>{B._reject(f)}),l._writeRequests=new N,l._pendingAbortRequest===void 0){qs(l);return}let b=l._pendingAbortRequest;if(l._pendingAbortRequest=void 0,b._wasAlreadyErroring){b._reject(f),qs(l);return}let O=l._writableStreamController[ar](b._reason);R(O,()=>{b._resolve(),qs(l)},B=>{b._reject(B),qs(l)})}function Rc(l){l._inFlightWriteRequest._resolve(void 0),l._inFlightWriteRequest=void 0}function Sa(l,f){l._inFlightWriteRequest._reject(f),l._inFlightWriteRequest=void 0,$s(l,f)}function Cc(l){l._inFlightCloseRequest._resolve(void 0),l._inFlightCloseRequest=void 0,l._state==="erroring"&&(l._storedError=void 0,l._pendingAbortRequest!==void 0&&(l._pendingAbortRequest._resolve(),l._pendingAbortRequest=void 0)),l._state="closed";let b=l._writer;b!==void 0&&ru(b)}function Tc(l,f){l._inFlightCloseRequest._reject(f),l._inFlightCloseRequest=void 0,l._pendingAbortRequest!==void 0&&(l._pendingAbortRequest._reject(f),l._pendingAbortRequest=void 0),$s(l,f)}function lr(l){return!(l._closeRequest===void 0&&l._inFlightCloseRequest===void 0)}function Ac(l){return!(l._inFlightWriteRequest===void 0&&l._inFlightCloseRequest===void 0)}function Ic(l){l._inFlightCloseRequest=l._closeRequest,l._closeRequest=void 0}function Pc(l){l._inFlightWriteRequest=l._writeRequests.shift()}function qs(l){l._closeRequest!==void 0&&(l._closeRequest._reject(l._storedError),l._closeRequest=void 0);let f=l._writer;f!==void 0&&Ta(f,l._storedError)}function nn(l,f){let b=l._writer;b!==void 0&&f!==l._backpressure&&(f?$c(b):Ia(b)),l._backpressure=f}class Kn{constructor(f){if(be(f,1,"WritableStreamDefaultWriter"),Hl(f,"First parameter"),tn(f))throw new TypeError("This stream has already been locked for exclusive writing by another writer");this._ownerWritableStream=f,f._writer=this;let b=f._state;if(b==="writable")!lr(f)&&f._backpressure?Ys(this):iu(this),Ks(this);else if(b==="erroring")Aa(this,f._storedError),Ks(this);else if(b==="closed")iu(this),jc(this);else{let O=f._storedError;Aa(this,O),tu(this,O)}}get closed(){return Oi(this)?this._closedPromise:_(ki("closed"))}get desiredSize(){if(!Oi(this))throw ki("desiredSize");if(this._ownerWritableStream===void 0)throw Yn("desiredSize");return Nc(this)}get ready(){return Oi(this)?this._readyPromise:_(ki("ready"))}abort(f=void 0){return Oi(this)?this._ownerWritableStream===void 0?_(Yn("abort")):Oc(this,f):_(ki("abort"))}close(){if(!Oi(this))return _(ki("close"));let f=this._ownerWritableStream;return f===void 0?_(Yn("close")):lr(f)?_(new TypeError("Cannot close an already-closing stream")):Vl(this)}releaseLock(){if(!Oi(this))throw ki("releaseLock");this._ownerWritableStream!==void 0&&Yl(this)}write(f=void 0){return Oi(this)?this._ownerWritableStream===void 0?_(Yn("write to")):Zl(this,f):_(ki("write"))}}Object.defineProperties(Kn.prototype,{abort:{enumerable:!0},close:{enumerable:!0},releaseLock:{enumerable:!0},write:{enumerable:!0},closed:{enumerable:!0},desiredSize:{enumerable:!0},ready:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(Kn.prototype,e.toStringTag,{value:"WritableStreamDefaultWriter",configurable:!0});function Oi(l){return!o(l)||!Object.prototype.hasOwnProperty.call(l,"_ownerWritableStream")?!1:l instanceof Kn}function Oc(l,f){let b=l._ownerWritableStream;return Ws(b,f)}function Vl(l){let f=l._ownerWritableStream;return Gl(f)}function kc(l){let f=l._ownerWritableStream,b=f._state;return lr(f)||b==="closed"?E(void 0):b==="errored"?_(f._storedError):Vl(l)}function xa(l,f){l._closedPromiseState==="pending"?Ta(l,f):Wc(l,f)}function Kl(l,f){l._readyPromiseState==="pending"?nu(l,f):qc(l,f)}function Nc(l){let f=l._ownerWritableStream,b=f._state;return b==="errored"||b==="erroring"?null:b==="closed"?0:Ql(f._writableStreamController)}function Yl(l){let f=l._ownerWritableStream,b=new TypeError("Writer was released and can no longer be used to monitor the stream's closedness");Kl(l,b),xa(l,b),f._writer=void 0,l._ownerWritableStream=void 0}function Zl(l,f){let b=l._ownerWritableStream,O=b._writableStreamController,B=Bc(O,f);if(b!==l._ownerWritableStream)return _(Yn("write to"));let $=b._state;if($==="errored")return _(b._storedError);if(lr(b)||$==="closed")return _(new TypeError("The stream is closing or closed and cannot be written to"));if($==="erroring")return _(b._storedError);let V=Mc(b);return zc(O,f,B),V}let Xl={};class Qr{constructor(){throw new TypeError("Illegal constructor")}get abortReason(){if(!Ea(this))throw Ca("abortReason");return this._abortReason}get signal(){if(!Ea(this))throw Ca("signal");if(this._abortController===void 0)throw new TypeError("WritableStreamDefaultController.prototype.signal is not supported");return this._abortController.signal}error(f=void 0){if(!Ea(this))throw Ca("error");this._controlledWritableStream._state==="writable"&&eu(this,f)}[ar](f){let b=this._abortAlgorithm(f);return Hs(this),b}[_r](){vt(this)}}Object.defineProperties(Qr.prototype,{abortReason:{enumerable:!0},signal:{enumerable:!0},error:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(Qr.prototype,e.toStringTag,{value:"WritableStreamDefaultController",configurable:!0});function Ea(l){return!o(l)||!Object.prototype.hasOwnProperty.call(l,"_controlledWritableStream")?!1:l instanceof Qr}function Jl(l,f,b,O,B,$,V,ne){f._controlledWritableStream=l,l._writableStreamController=f,f._queue=void 0,f._queueTotalSize=void 0,vt(f),f._abortReason=void 0,f._abortController=xc(),f._started=!1,f._strategySizeAlgorithm=ne,f._strategyHWM=V,f._writeAlgorithm=O,f._closeAlgorithm=B,f._abortAlgorithm=$;let ge=Ra(f);nn(l,ge);let Me=b(),De=E(Me);R(De,()=>{f._started=!0,Gs(f)},Be=>{f._started=!0,$s(l,Be)})}function Lc(l,f,b,O){let B=Object.create(Qr.prototype),$=()=>{},V=()=>E(void 0),ne=()=>E(void 0),ge=()=>E(void 0);f.start!==void 0&&($=()=>f.start(B)),f.write!==void 0&&(V=Me=>f.write(Me,B)),f.close!==void 0&&(ne=()=>f.close()),f.abort!==void 0&&(ge=Me=>f.abort(Me)),Jl(l,B,$,V,ne,ge,b,O)}function Hs(l){l._writeAlgorithm=void 0,l._closeAlgorithm=void 0,l._abortAlgorithm=void 0,l._strategySizeAlgorithm=void 0}function Dc(l){lt(l,Xl,0),Gs(l)}function Bc(l,f){try{return l._strategySizeAlgorithm(f)}catch(b){return Ma(l,b),1}}function Ql(l){return l._strategyHWM-l._queueTotalSize}function zc(l,f,b){try{lt(l,f,b)}catch(B){Ma(l,B);return}let O=l._controlledWritableStream;if(!lr(O)&&O._state==="writable"){let B=Ra(l);nn(O,B)}Gs(l)}function Gs(l){let f=l._controlledWritableStream;if(!l._started||f._inFlightWriteRequest!==void 0)return;if(f._state==="erroring"){_a(f);return}if(l._queue.length===0)return;let O=gc(l);O===Xl?Fc(l):Uc(l,O)}function Ma(l,f){l._controlledWritableStream._state==="writable"&&eu(l,f)}function Fc(l){let f=l._controlledWritableStream;Ic(f),aa(l);let b=l._closeAlgorithm();Hs(l),R(b,()=>{Cc(f)},O=>{Tc(f,O)})}function Uc(l,f){let b=l._controlledWritableStream;Pc(b);let O=l._writeAlgorithm(f);R(O,()=>{Rc(b);let B=b._state;if(aa(l),!lr(b)&&B==="writable"){let $=Ra(l);nn(b,$)}Gs(l)},B=>{b._state==="writable"&&Hs(l),Sa(b,B)})}function Ra(l){return Ql(l)<=0}function eu(l,f){let b=l._controlledWritableStream;Hs(l),rn(b,f)}function Vs(l){return new TypeError(`WritableStream.prototype.${l} can only be used on a WritableStream`)}function Ca(l){return new TypeError(`WritableStreamDefaultController.prototype.${l} can only be used on a WritableStreamDefaultController`)}function ki(l){return new TypeError(`WritableStreamDefaultWriter.prototype.${l} can only be used on a WritableStreamDefaultWriter`)}function Yn(l){return new TypeError("Cannot "+l+" a stream using a released writer")}function Ks(l){l._closedPromise=w((f,b)=>{l._closedPromise_resolve=f,l._closedPromise_reject=b,l._closedPromiseState="pending"})}function tu(l,f){Ks(l),Ta(l,f)}function jc(l){Ks(l),ru(l)}function Ta(l,f){l._closedPromise_reject!==void 0&&(D(l._closedPromise),l._closedPromise_reject(f),l._closedPromise_resolve=void 0,l._closedPromise_reject=void 0,l._closedPromiseState="rejected")}function Wc(l,f){tu(l,f)}function ru(l){l._closedPromise_resolve!==void 0&&(l._closedPromise_resolve(void 0),l._closedPromise_resolve=void 0,l._closedPromise_reject=void 0,l._closedPromiseState="resolved")}function Ys(l){l._readyPromise=w((f,b)=>{l._readyPromise_resolve=f,l._readyPromise_reject=b}),l._readyPromiseState="pending"}function Aa(l,f){Ys(l),nu(l,f)}function iu(l){Ys(l),Ia(l)}function nu(l,f){l._readyPromise_reject!==void 0&&(D(l._readyPromise),l._readyPromise_reject(f),l._readyPromise_resolve=void 0,l._readyPromise_reject=void 0,l._readyPromiseState="rejected")}function $c(l){Ys(l)}function qc(l,f){Aa(l,f)}function Ia(l){l._readyPromise_resolve!==void 0&&(l._readyPromise_resolve(void 0),l._readyPromise_resolve=void 0,l._readyPromise_reject=void 0,l._readyPromiseState="fulfilled")}let St=typeof DOMException<"u"?DOMException:void 0;function Zn(l){if(!(typeof l=="function"||typeof l=="object"))return!1;try{return new l,!0}catch{return!1}}function Xn(){let l=function(b,O){this.message=b||"",this.name=O||"Error",Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)};return l.prototype=Object.create(Error.prototype),Object.defineProperty(l.prototype,"constructor",{value:l,writable:!0,configurable:!0}),l}let Jn=Zn(St)?St:Xn();function sn(l,f,b,O,B,$){let V=at(l),ne=Vn(f);l._disturbed=!0;let ge=!1,Me=E(void 0);return w((De,Be)=>{let ut;if($!==void 0){if(ut=()=>{let le=new Jn("Aborted","AbortError"),Se=[];O||Se.push(()=>f._state==="writable"?Ws(f,le):E(void 0)),B||Se.push(()=>l._state==="readable"?hr(l,le):E(void 0)),At(()=>Promise.all(Se.map(Ve=>Ve())),!0,le)},$.aborted){ut();return}$.addEventListener("abort",ut)}function cr(){return w((le,Se)=>{function Ve(Re){Re?le():C(an(),Ve,Se)}Ve(!1)})}function an(){return ge?E(!0):C(ne._readyPromise,()=>w((le,Se)=>{Fn(V,{_chunkSteps:Ve=>{Me=C(Zl(ne,Ve),void 0,r),le(!1)},_closeSteps:()=>le(!0),_errorSteps:Se})}))}if(Fr(l,V._closedPromise,le=>{O?Jt(!0,le):At(()=>Ws(f,le),!0,le)}),Fr(f,ne._closedPromise,le=>{B?Jt(!0,le):At(()=>hr(l,le),!0,le)}),Rt(l,V._closedPromise,()=>{b?Jt():At(()=>kc(ne))}),lr(f)||f._state==="closed"){let le=new TypeError("the destination writable stream closed before all data could be piped to it");B?Jt(!0,le):At(()=>hr(l,le),!0,le)}D(cr());function oi(){let le=Me;return C(Me,()=>le!==Me?oi():void 0)}function Fr(le,Se,Ve){le._state==="errored"?Ve(le._storedError):A(Se,Ve)}function Rt(le,Se,Ve){le._state==="closed"?Ve():I(Se,Ve)}function At(le,Se,Ve){if(ge)return;ge=!0,f._state==="writable"&&!lr(f)?I(oi(),Re):Re();function Re(){R(le(),()=>Ur(Se,Ve),Ce=>Ur(!0,Ce))}}function Jt(le,Se){ge||(ge=!0,f._state==="writable"&&!lr(f)?I(oi(),()=>Ur(le,Se)):Ur(le,Se))}function Ur(le,Se){Yl(ne),ae(V),$!==void 0&&$.removeEventListener("abort",ut),le?Be(Se):De(void 0)}})}class ur{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!zr(this))throw Js("desiredSize");return Er(this)}close(){if(!zr(this))throw Js("close");if(!on(this))throw new TypeError("The stream is not in a state that permits close");Qn(this)}enqueue(f=void 0){if(!zr(this))throw Js("enqueue");if(!on(this))throw new TypeError("The stream is not in a state that permits enqueue");return Xs(this,f)}error(f=void 0){if(!zr(this))throw Js("error");ti(this,f)}[Ri](f){vt(this);let b=this._cancelAlgorithm(f);return Zs(this),b}[zt](f){let b=this._controlledReadableStream;if(this._queue.length>0){let O=aa(this);this._closeRequested&&this._queue.length===0?(Zs(this),es(b)):ei(this),f._chunkSteps(O)}else Q(b,f),ei(this)}}Object.defineProperties(ur.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},desiredSize:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(ur.prototype,e.toStringTag,{value:"ReadableStreamDefaultController",configurable:!0});function zr(l){return!o(l)||!Object.prototype.hasOwnProperty.call(l,"_controlledReadableStream")?!1:l instanceof ur}function ei(l){if(!su(l))return;if(l._pulling){l._pullAgain=!0;return}l._pulling=!0;let b=l._pullAlgorithm();R(b,()=>{l._pulling=!1,l._pullAgain&&(l._pullAgain=!1,ei(l))},O=>{ti(l,O)})}function su(l){let f=l._controlledReadableStream;return!on(l)||!l._started?!1:!!(si(f)&&Zt(f)>0||Er(l)>0)}function Zs(l){l._pullAlgorithm=void 0,l._cancelAlgorithm=void 0,l._strategySizeAlgorithm=void 0}function Qn(l){if(!on(l))return;let f=l._controlledReadableStream;l._closeRequested=!0,l._queue.length===0&&(Zs(l),es(f))}function Xs(l,f){if(!on(l))return;let b=l._controlledReadableStream;if(si(b)&&Zt(b)>0)_t(b,f,!1);else{let O;try{O=l._strategySizeAlgorithm(f)}catch(B){throw ti(l,B),B}try{lt(l,f,O)}catch(B){throw ti(l,B),B}}ei(l)}function ti(l,f){let b=l._controlledReadableStream;b._state==="readable"&&(vt(l),Zs(l),uu(b,f))}function Er(l){let f=l._controlledReadableStream._state;return f==="errored"?null:f==="closed"?0:l._strategyHWM-l._queueTotalSize}function Hc(l){return!su(l)}function on(l){let f=l._controlledReadableStream._state;return!l._closeRequested&&f==="readable"}function ou(l,f,b,O,B,$,V){f._controlledReadableStream=l,f._queue=void 0,f._queueTotalSize=void 0,vt(f),f._started=!1,f._closeRequested=!1,f._pullAgain=!1,f._pulling=!1,f._strategySizeAlgorithm=V,f._strategyHWM=$,f._pullAlgorithm=O,f._cancelAlgorithm=B,l._readableStreamController=f;let ne=b();R(E(ne),()=>{f._started=!0,ei(f)},ge=>{ti(f,ge)})}function Gc(l,f,b,O){let B=Object.create(ur.prototype),$=()=>{},V=()=>E(void 0),ne=()=>E(void 0);f.start!==void 0&&($=()=>f.start(B)),f.pull!==void 0&&(V=()=>f.pull(B)),f.cancel!==void 0&&(ne=ge=>f.cancel(ge)),ou(l,B,$,V,ne,b,O)}function Js(l){return new TypeError(`ReadableStreamDefaultController.prototype.${l} can only be used on a ReadableStreamDefaultController`)}function Vc(l,f){return Jr(l._readableStreamController)?Yc(l):Kc(l)}function Kc(l,f){let b=at(l),O=!1,B=!1,$=!1,V=!1,ne,ge,Me,De,Be,ut=w(Rt=>{Be=Rt});function cr(){return O?(B=!0,E(void 0)):(O=!0,Fn(b,{_chunkSteps:At=>{j(()=>{B=!1;let Jt=At,Ur=At;$||Xs(Me._readableStreamController,Jt),V||Xs(De._readableStreamController,Ur),O=!1,B&&cr()})},_closeSteps:()=>{O=!1,$||Qn(Me._readableStreamController),V||Qn(De._readableStreamController),(!$||!V)&&Be(void 0)},_errorSteps:()=>{O=!1}}),E(void 0))}function an(Rt){if($=!0,ne=Rt,V){let At=Zi([ne,ge]),Jt=hr(l,At);Be(Jt)}return ut}function oi(Rt){if(V=!0,ge=Rt,$){let At=Zi([ne,ge]),Jt=hr(l,At);Be(Jt)}return ut}function Fr(){}return Me=Pa(Fr,cr,an),De=Pa(Fr,cr,oi),A(b._closedPromise,Rt=>{ti(Me._readableStreamController,Rt),ti(De._readableStreamController,Rt),(!$||!V)&&Be(void 0)}),[Me,De]}function Yc(l){let f=at(l),b=!1,O=!1,B=!1,$=!1,V=!1,ne,ge,Me,De,Be,ut=w(le=>{Be=le});function cr(le){A(le._closedPromise,Se=>{le===f&&(Mt(Me._readableStreamController,Se),Mt(De._readableStreamController,Se),(!$||!V)&&Be(void 0))})}function an(){Pi(f)&&(ae(f),f=at(l),cr(f)),Fn(f,{_chunkSteps:Se=>{j(()=>{O=!1,B=!1;let Ve=Se,Re=Se;if(!$&&!V)try{Re=Ol(Se)}catch(Ce){Mt(Me._readableStreamController,Ce),Mt(De._readableStreamController,Ce),Be(hr(l,Ce));return}$||Et(Me._readableStreamController,Ve),V||Et(De._readableStreamController,Re),b=!1,O?Fr():B&&Rt()})},_closeSteps:()=>{b=!1,$||pt(Me._readableStreamController),V||pt(De._readableStreamController),Me._readableStreamController._pendingPullIntos.length>0&&Gn(Me._readableStreamController,0),De._readableStreamController._pendingPullIntos.length>0&&Gn(De._readableStreamController,0),(!$||!V)&&Be(void 0)},_errorSteps:()=>{b=!1}})}function oi(le,Se){Xr(f)&&(ae(f),f=Fl(l),cr(f));let Ve=Se?De:Me,Re=Se?Me:De;jl(f,le,{_chunkSteps:ln=>{j(()=>{O=!1,B=!1;let un=Se?V:$;if(Se?$:V)un||zs(Ve._readableStreamController,ln);else{let rs;try{rs=Ol(ln)}catch(ai){Mt(Ve._readableStreamController,ai),Mt(Re._readableStreamController,ai),Be(hr(l,ai));return}un||zs(Ve._readableStreamController,ln),Et(Re._readableStreamController,rs)}b=!1,O?Fr():B&&Rt()})},_closeSteps:ln=>{b=!1;let un=Se?V:$,ao=Se?$:V;un||pt(Ve._readableStreamController),ao||pt(Re._readableStreamController),ln!==void 0&&(un||zs(Ve._readableStreamController,ln),!ao&&Re._readableStreamController._pendingPullIntos.length>0&&Gn(Re._readableStreamController,0)),(!un||!ao)&&Be(void 0)},_errorSteps:()=>{b=!1}})}function Fr(){if(b)return O=!0,E(void 0);b=!0;let le=Ai(Me._readableStreamController);return le===null?an():oi(le._view,!1),E(void 0)}function Rt(){if(b)return B=!0,E(void 0);b=!0;let le=Ai(De._readableStreamController);return le===null?an():oi(le._view,!0),E(void 0)}function At(le){if($=!0,ne=le,V){let Se=Zi([ne,ge]),Ve=hr(l,Se);Be(Ve)}return ut}function Jt(le){if(V=!0,ge=le,$){let Se=Zi([ne,ge]),Ve=hr(l,Se);Be(Ve)}return ut}function Ur(){}return Me=lu(Ur,Fr,At),De=lu(Ur,Rt,Jt),cr(f),[Me,De]}function Zc(l,f){T(l,f);let b=l,O=b?.autoAllocateChunkSize,B=b?.cancel,$=b?.pull,V=b?.start,ne=b?.type;return{autoAllocateChunkSize:O===void 0?void 0:Sr(O,`${f} has member 'autoAllocateChunkSize' that`),cancel:B===void 0?void 0:Xc(B,b,`${f} has member 'cancel' that`),pull:$===void 0?void 0:Jc($,b,`${f} has member 'pull' that`),start:V===void 0?void 0:Qc(V,b,`${f} has member 'start' that`),type:ne===void 0?void 0:ef(ne,`${f} has member 'type' that`)}}function Xc(l,f,b){return M(l,b),O=>Z(l,f,[O])}function Jc(l,f,b){return M(l,b),O=>Z(l,f,[O])}function Qc(l,f,b){return M(l,b),O=>W(l,f,[O])}function ef(l,f){if(l=`${l}`,l!=="bytes")throw new TypeError(`${f} '${l}' is not a valid enumeration value for ReadableStreamType`);return l}function tf(l,f){T(l,f);let b=l?.mode;return{mode:b===void 0?void 0:rf(b,`${f} has member 'mode' that`)}}function rf(l,f){if(l=`${l}`,l!=="byob")throw new TypeError(`${f} '${l}' is not a valid enumeration value for ReadableStreamReaderMode`);return l}function nf(l,f){T(l,f);let b=l?.preventCancel;return{preventCancel:Boolean(b)}}function au(l,f){T(l,f);let b=l?.preventAbort,O=l?.preventCancel,B=l?.preventClose,$=l?.signal;return $!==void 0&&ri($,`${f} has member 'signal' that`),{preventAbort:Boolean(b),preventCancel:Boolean(O),preventClose:Boolean(B),signal:$}}function ri(l,f){if(!_c(l))throw new TypeError(`${f} is not an AbortSignal.`)}function sf(l,f){T(l,f);let b=l?.readable;Qe(b,"readable","ReadableWritablePair"),je(b,`${f} has member 'readable' that`);let O=l?.writable;return Qe(O,"writable","ReadableWritablePair"),Hl(O,`${f} has member 'writable' that`),{readable:b,writable:O}}class ii{constructor(f={},b={}){f===void 0?f=null:F(f,"First parameter");let O=js(b,"Second parameter"),B=Zc(f,"First parameter");if(Oa(this),B.type==="bytes"){if(O.size!==void 0)throw new RangeError("The strategy for a byte stream cannot have a size function");let $=xr(O,0);ga(this,B,$)}else{let $=Us(O),V=xr(O,1);Gc(this,B,V,$)}}get locked(){if(!ni(this))throw Ni("locked");return si(this)}cancel(f=void 0){return ni(this)?si(this)?_(new TypeError("Cannot cancel a stream that already has a reader")):hr(this,f):_(Ni("cancel"))}getReader(f=void 0){if(!ni(this))throw Ni("getReader");return tf(f,"First parameter").mode===void 0?at(this):Fl(this)}pipeThrough(f,b={}){if(!ni(this))throw Ni("pipeThrough");be(f,1,"pipeThrough");let O=sf(f,"First parameter"),B=au(b,"Second parameter");if(si(this))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream");if(tn(O.writable))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream");let $=sn(this,O.writable,B.preventClose,B.preventAbort,B.preventCancel,B.signal);return D($),O.readable}pipeTo(f,b={}){if(!ni(this))return _(Ni("pipeTo"));if(f===void 0)return _("Parameter 1 is required in 'pipeTo'.");if(!en(f))return _(new TypeError("ReadableStream.prototype.pipeTo's first argument must be a WritableStream"));let O;try{O=au(b,"Second parameter")}catch(B){return _(B)}return si(this)?_(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream")):tn(f)?_(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream")):sn(this,f,O.preventClose,O.preventAbort,O.preventCancel,O.signal)}tee(){if(!ni(this))throw Ni("tee");let f=Vc(this);return Zi(f)}values(f=void 0){if(!ni(this))throw Ni("values");let b=nf(f,"First parameter");return mc(this,b.preventCancel)}}Object.defineProperties(ii.prototype,{cancel:{enumerable:!0},getReader:{enumerable:!0},pipeThrough:{enumerable:!0},pipeTo:{enumerable:!0},tee:{enumerable:!0},values:{enumerable:!0},locked:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(ii.prototype,e.toStringTag,{value:"ReadableStream",configurable:!0}),typeof e.asyncIterator=="symbol"&&Object.defineProperty(ii.prototype,e.asyncIterator,{value:ii.prototype.values,writable:!0,configurable:!0});function Pa(l,f,b,O=1,B=()=>1){let $=Object.create(ii.prototype);Oa($);let V=Object.create(ur.prototype);return ou($,V,l,f,b,O,B),$}function lu(l,f,b){let O=Object.create(ii.prototype);Oa(O);let B=Object.create(Ci.prototype);return pa(O,B,l,f,b,0,void 0),O}function Oa(l){l._state="readable",l._reader=void 0,l._storedError=void 0,l._disturbed=!1}function ni(l){return!o(l)||!Object.prototype.hasOwnProperty.call(l,"_readableStreamController")?!1:l instanceof ii}function si(l){return l._reader!==void 0}function hr(l,f){if(l._disturbed=!0,l._state==="closed")return E(void 0);if(l._state==="errored")return _(l._storedError);es(l);let b=l._reader;b!==void 0&&Pi(b)&&(b._readIntoRequests.forEach(B=>{B._closeSteps(void 0)}),b._readIntoRequests=new N);let O=l._readableStreamController[Ri](f);return k(O,r)}function es(l){l._state="closed";let f=l._reader;f!==void 0&&(Mi(f),Xr(f)&&(f._readRequests.forEach(b=>{b._closeSteps()}),f._readRequests=new N))}function uu(l,f){l._state="errored",l._storedError=f;let b=l._reader;b!==void 0&&(pe(b,f),Xr(b)?(b._readRequests.forEach(O=>{O._errorSteps(f)}),b._readRequests=new N):(b._readIntoRequests.forEach(O=>{O._errorSteps(f)}),b._readIntoRequests=new N))}function Ni(l){return new TypeError(`ReadableStream.prototype.${l} can only be used on a ReadableStream`)}function hu(l,f){T(l,f);let b=l?.highWaterMark;return Qe(b,"highWaterMark","QueuingStrategyInit"),{highWaterMark:tt(b)}}let cu=l=>l.byteLength;Object.defineProperty(cu,"name",{value:"size",configurable:!0});class Qs{constructor(f){be(f,1,"ByteLengthQueuingStrategy"),f=hu(f,"First parameter"),this._byteLengthQueuingStrategyHighWaterMark=f.highWaterMark}get highWaterMark(){if(!du(this))throw fu("highWaterMark");return this._byteLengthQueuingStrategyHighWaterMark}get size(){if(!du(this))throw fu("size");return cu}}Object.defineProperties(Qs.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(Qs.prototype,e.toStringTag,{value:"ByteLengthQueuingStrategy",configurable:!0});function fu(l){return new TypeError(`ByteLengthQueuingStrategy.prototype.${l} can only be used on a ByteLengthQueuingStrategy`)}function du(l){return!o(l)||!Object.prototype.hasOwnProperty.call(l,"_byteLengthQueuingStrategyHighWaterMark")?!1:l instanceof Qs}let mu=()=>1;Object.defineProperty(mu,"name",{value:"size",configurable:!0});class eo{constructor(f){be(f,1,"CountQueuingStrategy"),f=hu(f,"First parameter"),this._countQueuingStrategyHighWaterMark=f.highWaterMark}get highWaterMark(){if(!gu(this))throw pu("highWaterMark");return this._countQueuingStrategyHighWaterMark}get size(){if(!gu(this))throw pu("size");return mu}}Object.defineProperties(eo.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(eo.prototype,e.toStringTag,{value:"CountQueuingStrategy",configurable:!0});function pu(l){return new TypeError(`CountQueuingStrategy.prototype.${l} can only be used on a CountQueuingStrategy`)}function gu(l){return!o(l)||!Object.prototype.hasOwnProperty.call(l,"_countQueuingStrategyHighWaterMark")?!1:l instanceof eo}function of(l,f){T(l,f);let b=l?.flush,O=l?.readableType,B=l?.start,$=l?.transform,V=l?.writableType;return{flush:b===void 0?void 0:af(b,l,`${f} has member 'flush' that`),readableType:O,start:B===void 0?void 0:yu(B,l,`${f} has member 'start' that`),transform:$===void 0?void 0:lf($,l,`${f} has member 'transform' that`),writableType:V}}function af(l,f,b){return M(l,b),O=>Z(l,f,[O])}function yu(l,f,b){return M(l,b),O=>W(l,f,[O])}function lf(l,f,b){return M(l,b),(O,B)=>Z(l,f,[O,B])}class to{constructor(f={},b={},O={}){f===void 0&&(f=null);let B=js(b,"Second parameter"),$=js(O,"Third parameter"),V=of(f,"First parameter");if(V.readableType!==void 0)throw new RangeError("Invalid readableType specified");if(V.writableType!==void 0)throw new RangeError("Invalid writableType specified");let ne=xr($,0),ge=Us($),Me=xr(B,1),De=Us(B),Be,ut=w(cr=>{Be=cr});uf(this,ut,Me,De,ne,ge),cf(this,V),V.start!==void 0?Be(V.start(this._transformStreamController)):Be(void 0)}get readable(){if(!bu(this))throw Su("readable");return this._readable}get writable(){if(!bu(this))throw Su("writable");return this._writable}}Object.defineProperties(to.prototype,{readable:{enumerable:!0},writable:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(to.prototype,e.toStringTag,{value:"TransformStream",configurable:!0});function uf(l,f,b,O,B,$){function V(){return f}function ne(ut){return mf(l,ut)}function ge(ut){return pf(l,ut)}function Me(){return gf(l)}l._writable=Ec(V,ne,Me,ge,b,O);function De(){return yf(l)}function Be(ut){return io(l,ut),E(void 0)}l._readable=Pa(V,De,Be,B,$),l._backpressure=void 0,l._backpressureChangePromise=void 0,l._backpressureChangePromise_resolve=void 0,no(l,!0),l._transformStreamController=void 0}function bu(l){return!o(l)||!Object.prototype.hasOwnProperty.call(l,"_transformStreamController")?!1:l instanceof to}function ro(l,f){ti(l._readable._readableStreamController,f),io(l,f)}function io(l,f){vu(l._transformStreamController),Ma(l._writable._writableStreamController,f),l._backpressure&&no(l,!1)}function no(l,f){l._backpressureChangePromise!==void 0&&l._backpressureChangePromise_resolve(),l._backpressureChangePromise=w(b=>{l._backpressureChangePromise_resolve=b}),l._backpressure=f}class ts{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!so(this))throw oo("desiredSize");let f=this._controlledTransformStream._readable._readableStreamController;return Er(f)}enqueue(f=void 0){if(!so(this))throw oo("enqueue");wu(this,f)}error(f=void 0){if(!so(this))throw oo("error");ff(this,f)}terminate(){if(!so(this))throw oo("terminate");df(this)}}Object.defineProperties(ts.prototype,{enqueue:{enumerable:!0},error:{enumerable:!0},terminate:{enumerable:!0},desiredSize:{enumerable:!0}}),typeof e.toStringTag=="symbol"&&Object.defineProperty(ts.prototype,e.toStringTag,{value:"TransformStreamDefaultController",configurable:!0});function so(l){return!o(l)||!Object.prototype.hasOwnProperty.call(l,"_controlledTransformStream")?!1:l instanceof ts}function hf(l,f,b,O){f._controlledTransformStream=l,l._transformStreamController=f,f._transformAlgorithm=b,f._flushAlgorithm=O}function cf(l,f){let b=Object.create(ts.prototype),O=$=>{try{return wu(b,$),E(void 0)}catch(V){return _(V)}},B=()=>E(void 0);f.transform!==void 0&&(O=$=>f.transform($,b)),f.flush!==void 0&&(B=()=>f.flush(b)),hf(l,b,O,B)}function vu(l){l._transformAlgorithm=void 0,l._flushAlgorithm=void 0}function wu(l,f){let b=l._controlledTransformStream,O=b._readable._readableStreamController;if(!on(O))throw new TypeError("Readable side is not in a state that permits enqueue");try{Xs(O,f)}catch($){throw io(b,$),b._readable._storedError}Hc(O)!==b._backpressure&&no(b,!0)}function ff(l,f){ro(l._controlledTransformStream,f)}function _u(l,f){let b=l._transformAlgorithm(f);return k(b,void 0,O=>{throw ro(l._controlledTransformStream,O),O})}function df(l){let f=l._controlledTransformStream,b=f._readable._readableStreamController;Qn(b);let O=new TypeError("TransformStream terminated");io(f,O)}function mf(l,f){let b=l._transformStreamController;if(l._backpressure){let O=l._backpressureChangePromise;return k(O,()=>{let B=l._writable;if(B._state==="erroring")throw B._storedError;return _u(b,f)})}return _u(b,f)}function pf(l,f){return ro(l,f),E(void 0)}function gf(l){let f=l._readable,b=l._transformStreamController,O=b._flushAlgorithm();return vu(b),k(O,()=>{if(f._state==="errored")throw f._storedError;Qn(f._readableStreamController)},B=>{throw ro(l,B),f._storedError})}function yf(l){return no(l,!1),l._backpressureChangePromise}function oo(l){return new TypeError(`TransformStreamDefaultController.prototype.${l} can only be used on a TransformStreamDefaultController`)}function Su(l){return new TypeError(`TransformStream.prototype.${l} can only be used on a TransformStream`)}t.ByteLengthQueuingStrategy=Qs,t.CountQueuingStrategy=eo,t.ReadableByteStreamController=Ci,t.ReadableStream=ii,t.ReadableStreamBYOBReader=Ji,t.ReadableStreamBYOBRequest=Wn,t.ReadableStreamDefaultController=ur,t.ReadableStreamDefaultReader=zn,t.TransformStream=to,t.TransformStreamDefaultController=ts,t.WritableStream=Qi,t.WritableStreamDefaultController=Qr,t.WritableStreamDefaultWriter=Kn,Object.defineProperty(t,"__esModule",{value:!0})})});var kg=ee(()=>{if(!globalThis.ReadableStream)try{let t=require("process"),{emitWarning:e}=t;try{t.emitWarning=()=>{},Object.assign(globalThis,require("stream/web")),t.emitWarning=e}catch(r){throw t.emitWarning=e,r}}catch{Object.assign(globalThis,Og())}try{let{Blob:t}=require("buffer");t&&!t.prototype.stream&&(t.prototype.stream=function(r){let i=0,n=this;return new ReadableStream({type:"bytes",async pull(o){let h=await n.slice(i,Math.min(n.size,i+65536)).arrayBuffer();i+=h.byteLength,o.enqueue(new Uint8Array(h)),i===n.size&&o.close()}})})}catch{}});async function*Md(t,e=!0){for(let r of t)if("stream"in r)yield*r.stream();else if(ArrayBuffer.isView(r))if(e){let i=r.byteOffset,n=r.byteOffset+r.byteLength;for(;i!==n;){let o=Math.min(n-i,Ng),a=r.buffer.slice(i,i+o);i+=a.byteLength,yield new Uint8Array(a)}}else yield r;else{let i=0,n=r;for(;i!==n.size;){let a=await n.slice(i,Math.min(n.size,i+Ng)).arrayBuffer();i+=a.byteLength,yield new Uint8Array(a)}}}var yI,Ng,zi,Wa,So,Zu,xo,Lg,c2,Fi,$a=Da(()=>{yI=ve(kg(),1);Ng=65536;Lg=(xo=class{constructor(e=[],r={}){Ct(this,zi,[]);Ct(this,Wa,"");Ct(this,So,0);Ct(this,Zu,"transparent");if(typeof e!="object"||e===null)throw new TypeError("Failed to construct 'Blob': The provided value cannot be converted to a sequence.");if(typeof e[Symbol.iterator]!="function")throw new TypeError("Failed to construct 'Blob': The object must have a callable @@iterator property.");if(typeof r!="object"&&typeof r!="function")throw new TypeError("Failed to construct 'Blob': parameter 2 cannot convert to dictionary.");r===null&&(r={});let i=new TextEncoder;for(let o of e){let a;ArrayBuffer.isView(o)?a=new Uint8Array(o.buffer.slice(o.byteOffset,o.byteOffset+o.byteLength)):o instanceof ArrayBuffer?a=new Uint8Array(o.slice(0)):o instanceof xo?a=o:a=i.encode(`${o}`),it(this,So,ke(this,So)+(ArrayBuffer.isView(a)?a.byteLength:a.size)),ke(this,zi).push(a)}it(this,Zu,`${r.endings===void 0?"transparent":r.endings}`);let n=r.type===void 0?"":String(r.type);it(this,Wa,/^[\x20-\x7E]*$/.test(n)?n:"")}get size(){return ke(this,So)}get type(){return ke(this,Wa)}async text(){let e=new TextDecoder,r="";for await(let i of Md(ke(this,zi),!1))r+=e.decode(i,{stream:!0});return r+=e.decode(),r}async arrayBuffer(){let e=new Uint8Array(this.size),r=0;for await(let i of Md(ke(this,zi),!1))e.set(i,r),r+=i.length;return e.buffer}stream(){let e=Md(ke(this,zi),!0);return new globalThis.ReadableStream({type:"bytes",async pull(r){let i=await e.next();i.done?r.close():r.enqueue(i.value)},async cancel(){await e.return()}})}slice(e=0,r=this.size,i=""){let{size:n}=this,o=e<0?Math.max(n+e,0):Math.min(e,n),a=r<0?Math.max(n+r,0):Math.min(r,n),h=Math.max(a-o,0),d=ke(this,zi),m=[],p=0;for(let E of d){if(p>=h)break;let _=ArrayBuffer.isView(E)?E.byteLength:E.size;if(o&&_<=o)o-=_,a-=_;else{let C;ArrayBuffer.isView(E)?(C=E.subarray(o,Math.min(_,a)),p+=C.byteLength):(C=E.slice(o,Math.min(_,a)),p+=C.size),a-=_,m.push(C),o=0}}let w=new xo([],{type:String(i).toLowerCase()});return it(w,So,h),it(w,zi,m),w}get[Symbol.toStringTag](){return"Blob"}static[Symbol.hasInstance](e){return e&&typeof e=="object"&&typeof e.constructor=="function"&&(typeof e.stream=="function"||typeof e.arrayBuffer=="function")&&/^(Blob|File)$/.test(e[Symbol.toStringTag])}},zi=new WeakMap,Wa=new WeakMap,So=new WeakMap,Zu=new WeakMap,xo);Object.defineProperties(Lg.prototype,{size:{enumerable:!0},type:{enumerable:!0},slice:{enumerable:!0}});c2=Lg,Fi=c2});var qa,Ha,Dg,f2,d2,Eo,Rd=Da(()=>{$a();f2=(Dg=class extends Fi{constructor(r,i,n={}){if(arguments.length<2)throw new TypeError(`Failed to construct 'File': 2 arguments required, but only ${arguments.length} present.`);super(r,n);Ct(this,qa,0);Ct(this,Ha,"");n===null&&(n={});let o=n.lastModified===void 0?Date.now():Number(n.lastModified);Number.isNaN(o)||it(this,qa,o),it(this,Ha,String(i))}get name(){return ke(this,Ha)}get lastModified(){return ke(this,qa)}get[Symbol.toStringTag](){return"File"}static[Symbol.hasInstance](r){return!!r&&r instanceof Fi&&/^(File)$/.test(r[Symbol.toStringTag])}},qa=new WeakMap,Ha=new WeakMap,Dg),d2=f2,Eo=d2});function Ug(t,e=Fi){var r=`${Bg()}${Bg()}`.replace(/\./g,"").slice(-28).padStart(32,"-"),i=[],n=`--${r}\r
93
- Content-Disposition: form-data; name="`;return t.forEach((o,a)=>typeof o=="string"?i.push(n+Cd(a)+`"\r
94
- \r
95
- ${o.replace(/\r(?!\n)|(?<!\r)\n/g,`\r
96
- `)}\r
97
- `):i.push(n+Cd(a)+`"; filename="${Cd(o.name,1)}"\r
98
- Content-Type: ${o.type||"application/octet-stream"}\r
99
- \r
100
- `,o,`\r
101
- `)),i.push(`--${r}--`),new e(i,{type:"multipart/form-data; boundary="+r})}var Ga,m2,p2,Bg,g2,zg,Cd,fs,Mr,Fg,ds,Xu=Da(()=>{$a();Rd();({toStringTag:Ga,iterator:m2,hasInstance:p2}=Symbol),Bg=Math.random,g2="append,set,get,getAll,delete,keys,values,entries,forEach,constructor".split(","),zg=(t,e,r)=>(t+="",/^(Blob|File)$/.test(e&&e[Ga])?[(r=r!==void 0?r+"":e[Ga]=="File"?e.name:"blob",t),e.name!==r||e[Ga]=="blob"?new Eo([e],r,e):e]:[t,e+""]),Cd=(t,e)=>(e?t:t.replace(/\r?\n|\r/g,`\r
102
- `)).replace(/\n/g,"%0A").replace(/\r/g,"%0D").replace(/"/g,"%22"),fs=(t,e,r)=>{if(e.length<r)throw new TypeError(`Failed to execute '${t}' on 'FormData': ${r} arguments required, but only ${e.length} present.`)},ds=(Fg=class{constructor(...e){Ct(this,Mr,[]);if(e.length)throw new TypeError("Failed to construct 'FormData': parameter 1 is not of type 'HTMLFormElement'.")}get[Ga](){return"FormData"}[m2](){return this.entries()}static[p2](e){return e&&typeof e=="object"&&e[Ga]==="FormData"&&!g2.some(r=>typeof e[r]!="function")}append(...e){fs("append",arguments,2),ke(this,Mr).push(zg(...e))}delete(e){fs("delete",arguments,1),e+="",it(this,Mr,ke(this,Mr).filter(([r])=>r!==e))}get(e){fs("get",arguments,1),e+="";for(var r=ke(this,Mr),i=r.length,n=0;n<i;n++)if(r[n][0]===e)return r[n][1];return null}getAll(e,r){return fs("getAll",arguments,1),r=[],e+="",ke(this,Mr).forEach(i=>i[0]===e&&r.push(i[1])),r}has(e){return fs("has",arguments,1),e+="",ke(this,Mr).some(r=>r[0]===e)}forEach(e,r){fs("forEach",arguments,1);for(var[i,n]of this)e.call(r,n,i,this)}set(...e){fs("set",arguments,2);var r=[],i=!0;e=zg(...e),ke(this,Mr).forEach(n=>{n[0]===e[0]?i&&(i=!r.push(e)):r.push(n)}),i&&r.push(e),it(this,Mr,r)}*entries(){yield*ke(this,Mr)}*keys(){for(var[e]of this)yield e}*values(){for(var[,e]of this)yield e}},Mr=new WeakMap,Fg)});var qg=ee((II,$g)=>{if(!globalThis.DOMException)try{let{MessageChannel:t}=require("worker_threads"),e=new t().port1,r=new ArrayBuffer;e.postMessage(r,[r,r])}catch(t){t.constructor.name==="DOMException"&&(globalThis.DOMException=t.constructor)}$g.exports=globalThis.DOMException});var Ka,Gg,y2,ms,ps,Ad,Hg,Id=Da(()=>{Ka=require("fs"),Gg=ve(qg(),1);Rd();$a();({stat:y2}=Ka.promises),Ad=class{constructor(e){Ct(this,ms,void 0);Ct(this,ps,void 0);it(this,ms,e.path),it(this,ps,e.start),this.size=e.size,this.lastModified=e.lastModified}slice(e,r){return new Ad({path:ke(this,ms),lastModified:this.lastModified,size:r-e,start:ke(this,ps)+e})}async*stream(){let{mtimeMs:e}=await y2(ke(this,ms));if(e>this.lastModified)throw new Gg.default("The requested file could not be read, typically due to permission problems that have occurred after a reference to a file was acquired.","NotReadableError");yield*(0,Ka.createReadStream)(ke(this,ms),{start:ke(this,ps),end:ke(this,ps)+this.size-1})}get[Symbol.toStringTag](){return"Blob"}},Hg=Ad;ms=new WeakMap,ps=new WeakMap});var Kg={};op(Kg,{toFormData:()=>E2});function x2(t){let e=t.match(/\bfilename=("(.*?)"|([^()<>@,;:\\"/[\]?={}\s\t]+))($|;\s)/i);if(!e)return;let r=e[2]||e[3]||"",i=r.slice(r.lastIndexOf("\\")+1);return i=i.replace(/%22/g,'"'),i=i.replace(/&#(\d{4});/g,(n,o)=>String.fromCharCode(o)),i}async function E2(t,e){if(!/multipart/i.test(e))throw new TypeError("Failed to fetch");let r=e.match(/boundary=(?:"([^"]+)"|([^;]+))/i);if(!r)throw new TypeError("no or bad content-type header, no multipart boundary");let i=new Pd(r[1]||r[2]),n,o,a,h,d,m,p=[],w=new ds,E=A=>{a+=I.decode(A,{stream:!0})},_=A=>{p.push(A)},C=()=>{let A=new Eo(p,m,{type:d});w.append(h,A)},R=()=>{w.append(h,a)},I=new TextDecoder("utf-8");I.decode(),i.onPartBegin=function(){i.onPartData=E,i.onPartEnd=R,n="",o="",a="",h="",d="",m=null,p.length=0},i.onHeaderField=function(A){n+=I.decode(A,{stream:!0})},i.onHeaderValue=function(A){o+=I.decode(A,{stream:!0})},i.onHeaderEnd=function(){if(o+=I.decode(),n=n.toLowerCase(),n==="content-disposition"){let A=o.match(/\bname=("([^"]*)"|([^()<>@,;:\\"/[\]?={}\s\t]+))/i);A&&(h=A[2]||A[3]||""),m=x2(o),m&&(i.onPartData=_,i.onPartEnd=C)}else n==="content-type"&&(d=o);o="",n=""};for await(let A of t)i.write(A);return i.end(),w}var di,Ze,Vg,pn,Qu,eh,b2,Ya,v2,w2,_2,S2,gs,Pd,Yg=Da(()=>{Id();Xu();di=0,Ze={START_BOUNDARY:di++,HEADER_FIELD_START:di++,HEADER_FIELD:di++,HEADER_VALUE_START:di++,HEADER_VALUE:di++,HEADER_VALUE_ALMOST_DONE:di++,HEADERS_ALMOST_DONE:di++,PART_DATA_START:di++,PART_DATA:di++,END:di++},Vg=1,pn={PART_BOUNDARY:Vg,LAST_BOUNDARY:Vg*=2},Qu=10,eh=13,b2=32,Ya=45,v2=58,w2=97,_2=122,S2=t=>t|32,gs=()=>{},Pd=class{constructor(e){this.index=0,this.flags=0,this.onHeaderEnd=gs,this.onHeaderField=gs,this.onHeadersEnd=gs,this.onHeaderValue=gs,this.onPartBegin=gs,this.onPartData=gs,this.onPartEnd=gs,this.boundaryChars={},e=`\r
103
- --`+e;let r=new Uint8Array(e.length);for(let i=0;i<e.length;i++)r[i]=e.charCodeAt(i),this.boundaryChars[r[i]]=!0;this.boundary=r,this.lookbehind=new Uint8Array(this.boundary.length+8),this.state=Ze.START_BOUNDARY}write(e){let r=0,i=e.length,n=this.index,{lookbehind:o,boundary:a,boundaryChars:h,index:d,state:m,flags:p}=this,w=this.boundary.length,E=w-1,_=e.length,C,R,I=j=>{this[j+"Mark"]=r},A=j=>{delete this[j+"Mark"]},k=(j,W,Z,oe)=>{(W===void 0||W!==Z)&&this[j](oe&&oe.subarray(W,Z))},D=(j,W)=>{let Z=j+"Mark";Z in this&&(W?(k(j,this[Z],r,e),delete this[Z]):(k(j,this[Z],e.length,e),this[Z]=0))};for(r=0;r<i;r++)switch(C=e[r],m){case Ze.START_BOUNDARY:if(d===a.length-2){if(C===Ya)p|=pn.LAST_BOUNDARY;else if(C!==eh)return;d++;break}else if(d-1===a.length-2){if(p&pn.LAST_BOUNDARY&&C===Ya)m=Ze.END,p=0;else if(!(p&pn.LAST_BOUNDARY)&&C===Qu)d=0,k("onPartBegin"),m=Ze.HEADER_FIELD_START;else return;break}C!==a[d+2]&&(d=-2),C===a[d+2]&&d++;break;case Ze.HEADER_FIELD_START:m=Ze.HEADER_FIELD,I("onHeaderField"),d=0;case Ze.HEADER_FIELD:if(C===eh){A("onHeaderField"),m=Ze.HEADERS_ALMOST_DONE;break}if(d++,C===Ya)break;if(C===v2){if(d===1)return;D("onHeaderField",!0),m=Ze.HEADER_VALUE_START;break}if(R=S2(C),R<w2||R>_2)return;break;case Ze.HEADER_VALUE_START:if(C===b2)break;I("onHeaderValue"),m=Ze.HEADER_VALUE;case Ze.HEADER_VALUE:C===eh&&(D("onHeaderValue",!0),k("onHeaderEnd"),m=Ze.HEADER_VALUE_ALMOST_DONE);break;case Ze.HEADER_VALUE_ALMOST_DONE:if(C!==Qu)return;m=Ze.HEADER_FIELD_START;break;case Ze.HEADERS_ALMOST_DONE:if(C!==Qu)return;k("onHeadersEnd"),m=Ze.PART_DATA_START;break;case Ze.PART_DATA_START:m=Ze.PART_DATA,I("onPartData");case Ze.PART_DATA:if(n=d,d===0){for(r+=E;r<_&&!(e[r]in h);)r+=w;r-=E,C=e[r]}if(d<a.length)a[d]===C?(d===0&&D("onPartData",!0),d++):d=0;else if(d===a.length)d++,C===eh?p|=pn.PART_BOUNDARY:C===Ya?p|=pn.LAST_BOUNDARY:d=0;else if(d-1===a.length)if(p&pn.PART_BOUNDARY){if(d=0,C===Qu){p&=~pn.PART_BOUNDARY,k("onPartEnd"),k("onPartBegin"),m=Ze.HEADER_FIELD_START;break}}else p&pn.LAST_BOUNDARY&&C===Ya?(k("onPartEnd"),m=Ze.END,p=0):d=0;if(d>0)o[d-1]=C;else if(n>0){let j=new Uint8Array(o.buffer,o.byteOffset,o.byteLength);k("onPartData",0,n,j),n=0,I("onPartData"),r--}break;case Ze.END:break;default:throw new Error(`Unexpected state entered: ${m}`)}D("onHeaderField"),D("onHeaderValue"),D("onPartData"),this.index=d,this.state=m,this.flags=p}end(){if(this.state===Ze.HEADER_FIELD_START&&this.index===0||this.state===Ze.PART_DATA&&this.index===this.boundary.length)this.onPartEnd();else if(this.state!==Ze.END)throw new Error("MultipartParser.end(): stream ended unexpectedly")}}});var My=ee((bP,tl)=>{"use strict";var kE=process.env.TERM_PROGRAM==="Hyper",NE=process.platform==="win32",Sy=process.platform==="linux",zd={ballotDisabled:"\u2612",ballotOff:"\u2610",ballotOn:"\u2611",bullet:"\u2022",bulletWhite:"\u25E6",fullBlock:"\u2588",heart:"\u2764",identicalTo:"\u2261",line:"\u2500",mark:"\u203B",middot:"\xB7",minus:"\uFF0D",multiplication:"\xD7",obelus:"\xF7",pencilDownRight:"\u270E",pencilRight:"\u270F",pencilUpRight:"\u2710",percent:"%",pilcrow2:"\u2761",pilcrow:"\xB6",plusMinus:"\xB1",section:"\xA7",starsOff:"\u2606",starsOn:"\u2605",upDownArrow:"\u2195"},xy=Object.assign({},zd,{check:"\u221A",cross:"\xD7",ellipsisLarge:"...",ellipsis:"...",info:"i",question:"?",questionSmall:"?",pointer:">",pointerSmall:"\xBB",radioOff:"( )",radioOn:"(*)",warning:"\u203C"}),Ey=Object.assign({},zd,{ballotCross:"\u2718",check:"\u2714",cross:"\u2716",ellipsisLarge:"\u22EF",ellipsis:"\u2026",info:"\u2139",question:"?",questionFull:"\uFF1F",questionSmall:"\uFE56",pointer:Sy?"\u25B8":"\u276F",pointerSmall:Sy?"\u2023":"\u203A",radioOff:"\u25EF",radioOn:"\u25C9",warning:"\u26A0"});tl.exports=NE&&!kE?xy:Ey;Reflect.defineProperty(tl.exports,"common",{enumerable:!1,value:zd});Reflect.defineProperty(tl.exports,"windows",{enumerable:!1,value:xy});Reflect.defineProperty(tl.exports,"other",{enumerable:!1,value:Ey})});var Cy=ee((vP,Fd)=>{"use strict";var LE=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),DE=/[\u001b\u009b][[\]#;?()]*(?:(?:(?:[^\W_]*;?[^\W_]*)\u0007)|(?:(?:[0-9]{1,4}(;[0-9]{0,4})*)?[~0-9=<>cf-nqrtyA-PRZ]))/g,Ry=()=>{let t={enabled:!0,visible:!0,styles:{},keys:{}};"FORCE_COLOR"in process.env&&(t.enabled=process.env.FORCE_COLOR!=="0");let e=o=>{let a=o.open=`\x1B[${o.codes[0]}m`,h=o.close=`\x1B[${o.codes[1]}m`,d=o.regex=new RegExp(`\\u001b\\[${o.codes[1]}m`,"g");return o.wrap=(m,p)=>{m.includes(h)&&(m=m.replace(d,h+a));let w=a+m+h;return p?w.replace(/\r*\n/g,`${h}$&${a}`):w},o},r=(o,a,h)=>typeof o=="function"?o(a):o.wrap(a,h),i=(o,a)=>{if(o===""||o==null)return"";if(t.enabled===!1)return o;if(t.visible===!1)return"";let h=""+o,d=h.includes(`
104
- `),m=a.length;for(m>0&&a.includes("unstyle")&&(a=[...new Set(["unstyle",...a])].reverse());m-- >0;)h=r(t.styles[a[m]],h,d);return h},n=(o,a,h)=>{t.styles[o]=e({name:o,codes:a}),(t.keys[h]||(t.keys[h]=[])).push(o),Reflect.defineProperty(t,o,{configurable:!0,enumerable:!0,set(m){t.alias(o,m)},get(){let m=p=>i(p,m.stack);return Reflect.setPrototypeOf(m,t),m.stack=this.stack?this.stack.concat(o):[o],m}})};return n("reset",[0,0],"modifier"),n("bold",[1,22],"modifier"),n("dim",[2,22],"modifier"),n("italic",[3,23],"modifier"),n("underline",[4,24],"modifier"),n("inverse",[7,27],"modifier"),n("hidden",[8,28],"modifier"),n("strikethrough",[9,29],"modifier"),n("black",[30,39],"color"),n("red",[31,39],"color"),n("green",[32,39],"color"),n("yellow",[33,39],"color"),n("blue",[34,39],"color"),n("magenta",[35,39],"color"),n("cyan",[36,39],"color"),n("white",[37,39],"color"),n("gray",[90,39],"color"),n("grey",[90,39],"color"),n("bgBlack",[40,49],"bg"),n("bgRed",[41,49],"bg"),n("bgGreen",[42,49],"bg"),n("bgYellow",[43,49],"bg"),n("bgBlue",[44,49],"bg"),n("bgMagenta",[45,49],"bg"),n("bgCyan",[46,49],"bg"),n("bgWhite",[47,49],"bg"),n("blackBright",[90,39],"bright"),n("redBright",[91,39],"bright"),n("greenBright",[92,39],"bright"),n("yellowBright",[93,39],"bright"),n("blueBright",[94,39],"bright"),n("magentaBright",[95,39],"bright"),n("cyanBright",[96,39],"bright"),n("whiteBright",[97,39],"bright"),n("bgBlackBright",[100,49],"bgBright"),n("bgRedBright",[101,49],"bgBright"),n("bgGreenBright",[102,49],"bgBright"),n("bgYellowBright",[103,49],"bgBright"),n("bgBlueBright",[104,49],"bgBright"),n("bgMagentaBright",[105,49],"bgBright"),n("bgCyanBright",[106,49],"bgBright"),n("bgWhiteBright",[107,49],"bgBright"),t.ansiRegex=DE,t.hasColor=t.hasAnsi=o=>(t.ansiRegex.lastIndex=0,typeof o=="string"&&o!==""&&t.ansiRegex.test(o)),t.alias=(o,a)=>{let h=typeof a=="string"?t[a]:a;if(typeof h!="function")throw new TypeError("Expected alias to be the name of an existing color (string) or a function");h.stack||(Reflect.defineProperty(h,"name",{value:o}),t.styles[o]=h,h.stack=[o]),Reflect.defineProperty(t,o,{configurable:!0,enumerable:!0,set(d){t.alias(o,d)},get(){let d=m=>i(m,d.stack);return Reflect.setPrototypeOf(d,t),d.stack=this.stack?this.stack.concat(h.stack):h.stack,d}})},t.theme=o=>{if(!LE(o))throw new TypeError("Expected theme to be an object");for(let a of Object.keys(o))t.alias(a,o[a]);return t},t.alias("unstyle",o=>typeof o=="string"&&o!==""?(t.ansiRegex.lastIndex=0,o.replace(t.ansiRegex,"")):""),t.alias("noop",o=>o),t.none=t.clear=t.noop,t.stripColor=t.unstyle,t.symbols=My(),t.define=n,t};Fd.exports=Ry();Fd.exports.create=Ry});var Ud=ee((_P,Ty)=>{Ty.exports=require("stream")});var Oy=ee((SP,Py)=>{"use strict";function Ay(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function zE(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Ay(Object(r),!0).forEach(function(i){FE(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Ay(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function FE(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function UE(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Iy(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function jE(t,e,r){return e&&Iy(t.prototype,e),r&&Iy(t,r),t}var WE=require("buffer"),dh=WE.Buffer,$E=require("util"),jd=$E.inspect,qE=jd&&jd.custom||"inspect";function HE(t,e,r){dh.prototype.copy.call(t,e,r)}Py.exports=function(){function t(){UE(this,t),this.head=null,this.tail=null,this.length=0}return jE(t,[{key:"push",value:function(r){var i={data:r,next:null};this.length>0?this.tail.next=i:this.head=i,this.tail=i,++this.length}},{key:"unshift",value:function(r){var i={data:r,next:this.head};this.length===0&&(this.tail=i),this.head=i,++this.length}},{key:"shift",value:function(){if(this.length!==0){var r=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,r}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(r){if(this.length===0)return"";for(var i=this.head,n=""+i.data;i=i.next;)n+=r+i.data;return n}},{key:"concat",value:function(r){if(this.length===0)return dh.alloc(0);for(var i=dh.allocUnsafe(r>>>0),n=this.head,o=0;n;)HE(n.data,i,o),o+=n.data.length,n=n.next;return i}},{key:"consume",value:function(r,i){var n;return r<this.head.data.length?(n=this.head.data.slice(0,r),this.head.data=this.head.data.slice(r)):r===this.head.data.length?n=this.shift():n=i?this._getString(r):this._getBuffer(r),n}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(r){var i=this.head,n=1,o=i.data;for(r-=o.length;i=i.next;){var a=i.data,h=r>a.length?a.length:r;if(h===a.length?o+=a:o+=a.slice(0,r),r-=h,r===0){h===a.length?(++n,i.next?this.head=i.next:this.head=this.tail=null):(this.head=i,i.data=a.slice(h));break}++n}return this.length-=n,o}},{key:"_getBuffer",value:function(r){var i=dh.allocUnsafe(r),n=this.head,o=1;for(n.data.copy(i),r-=n.data.length;n=n.next;){var a=n.data,h=r>a.length?a.length:r;if(a.copy(i,i.length-r,0,h),r-=h,r===0){h===a.length?(++o,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=a.slice(h));break}++o}return this.length-=o,i}},{key:qE,value:function(r,i){return jd(this,zE({},i,{depth:0,customInspect:!1}))}}]),t}()});var $d=ee((xP,Ny)=>{"use strict";function GE(t,e){var r=this,i=this._readableState&&this._readableState.destroyed,n=this._writableState&&this._writableState.destroyed;return i||n?(e?e(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(Wd,this,t)):process.nextTick(Wd,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(o){!e&&o?r._writableState?r._writableState.errorEmitted?process.nextTick(mh,r):(r._writableState.errorEmitted=!0,process.nextTick(ky,r,o)):process.nextTick(ky,r,o):e?(process.nextTick(mh,r),e(o)):process.nextTick(mh,r)}),this)}function ky(t,e){Wd(t,e),mh(t)}function mh(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function VE(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function Wd(t,e){t.emit("error",e)}function KE(t,e){var r=t._readableState,i=t._writableState;r&&r.autoDestroy||i&&i.autoDestroy?t.destroy(e):t.emit("error",e)}Ny.exports={destroy:GE,undestroy:VE,errorOrDestroy:KE}});var vn=ee((EP,By)=>{"use strict";var Dy={};function Or(t,e,r){r||(r=Error);function i(o,a,h){return typeof e=="string"?e:e(o,a,h)}class n extends r{constructor(a,h,d){super(i(a,h,d))}}n.prototype.name=r.name,n.prototype.code=t,Dy[t]=n}function Ly(t,e){if(Array.isArray(t)){let r=t.length;return t=t.map(i=>String(i)),r>2?`one of ${e} ${t.slice(0,r-1).join(", ")}, or `+t[r-1]:r===2?`one of ${e} ${t[0]} or ${t[1]}`:`of ${e} ${t[0]}`}else return`of ${e} ${String(t)}`}function YE(t,e,r){return t.substr(!r||r<0?0:+r,e.length)===e}function ZE(t,e,r){return(r===void 0||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}function XE(t,e,r){return typeof r!="number"&&(r=0),r+e.length>t.length?!1:t.indexOf(e,r)!==-1}Or("ERR_INVALID_OPT_VALUE",function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'},TypeError);Or("ERR_INVALID_ARG_TYPE",function(t,e,r){let i;typeof e=="string"&&YE(e,"not ")?(i="must not be",e=e.replace(/^not /,"")):i="must be";let n;if(ZE(t," argument"))n=`The ${t} ${i} ${Ly(e,"type")}`;else{let o=XE(t,".")?"property":"argument";n=`The "${t}" ${o} ${i} ${Ly(e,"type")}`}return n+=`. Received type ${typeof r}`,n},TypeError);Or("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");Or("ERR_METHOD_NOT_IMPLEMENTED",function(t){return"The "+t+" method is not implemented"});Or("ERR_STREAM_PREMATURE_CLOSE","Premature close");Or("ERR_STREAM_DESTROYED",function(t){return"Cannot call "+t+" after a stream was destroyed"});Or("ERR_MULTIPLE_CALLBACK","Callback called multiple times");Or("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");Or("ERR_STREAM_WRITE_AFTER_END","write after end");Or("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);Or("ERR_UNKNOWN_ENCODING",function(t){return"Unknown encoding: "+t},TypeError);Or("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");By.exports.codes=Dy});var qd=ee((MP,zy)=>{"use strict";var JE=vn().codes.ERR_INVALID_OPT_VALUE;function QE(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function eM(t,e,r,i){var n=QE(e,i,r);if(n!=null){if(!(isFinite(n)&&Math.floor(n)===n)||n<0){var o=i?r:"highWaterMark";throw new JE(o,n)}return Math.floor(n)}return t.objectMode?16:16*1024}zy.exports={getHighWaterMark:eM}});var Fy=ee((RP,Hd)=>{typeof Object.create=="function"?Hd.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Hd.exports=function(e,r){if(r){e.super_=r;var i=function(){};i.prototype=r.prototype,e.prototype=new i,e.prototype.constructor=e}}});var $o=ee((CP,Vd)=>{try{if(Gd=require("util"),typeof Gd.inherits!="function")throw"";Vd.exports=Gd.inherits}catch{Vd.exports=Fy()}var Gd});var jy=ee((TP,Uy)=>{Uy.exports=require("util").deprecate});var Zd=ee((AP,Vy)=>{"use strict";Vy.exports=ft;function $y(t){var e=this;this.next=null,this.entry=null,this.finish=function(){CM(e,t)}}var qo;ft.WritableState=il;var tM={deprecate:jy()},qy=Ud(),gh=require("buffer").Buffer,rM=global.Uint8Array||function(){};function iM(t){return gh.from(t)}function nM(t){return gh.isBuffer(t)||t instanceof rM}var Yd=$d(),sM=qd(),oM=sM.getHighWaterMark,wn=vn().codes,aM=wn.ERR_INVALID_ARG_TYPE,lM=wn.ERR_METHOD_NOT_IMPLEMENTED,uM=wn.ERR_MULTIPLE_CALLBACK,hM=wn.ERR_STREAM_CANNOT_PIPE,cM=wn.ERR_STREAM_DESTROYED,fM=wn.ERR_STREAM_NULL_VALUES,dM=wn.ERR_STREAM_WRITE_AFTER_END,mM=wn.ERR_UNKNOWN_ENCODING,Ho=Yd.errorOrDestroy;$o()(ft,qy);function pM(){}function il(t,e,r){qo=qo||_s(),t=t||{},typeof r!="boolean"&&(r=e instanceof qo),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=oM(this,t,"writableHighWaterMark",r),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var i=t.decodeStrings===!1;this.decodeStrings=!i,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(n){SM(e,n)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=t.emitClose!==!1,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new $y(this)}il.prototype.getBuffer=function(){for(var e=this.bufferedRequest,r=[];e;)r.push(e),e=e.next;return r};(function(){try{Object.defineProperty(il.prototype,"buffer",{get:tM.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var ph;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(ph=Function.prototype[Symbol.hasInstance],Object.defineProperty(ft,Symbol.hasInstance,{value:function(e){return ph.call(this,e)?!0:this!==ft?!1:e&&e._writableState instanceof il}})):ph=function(e){return e instanceof this};function ft(t){qo=qo||_s();var e=this instanceof qo;if(!e&&!ph.call(ft,this))return new ft(t);this._writableState=new il(t,this,e),this.writable=!0,t&&(typeof t.write=="function"&&(this._write=t.write),typeof t.writev=="function"&&(this._writev=t.writev),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.final=="function"&&(this._final=t.final)),qy.call(this)}ft.prototype.pipe=function(){Ho(this,new hM)};function gM(t,e){var r=new dM;Ho(t,r),process.nextTick(e,r)}function yM(t,e,r,i){var n;return r===null?n=new fM:typeof r!="string"&&!e.objectMode&&(n=new aM("chunk",["string","Buffer"],r)),n?(Ho(t,n),process.nextTick(i,n),!1):!0}ft.prototype.write=function(t,e,r){var i=this._writableState,n=!1,o=!i.objectMode&&nM(t);return o&&!gh.isBuffer(t)&&(t=iM(t)),typeof e=="function"&&(r=e,e=null),o?e="buffer":e||(e=i.defaultEncoding),typeof r!="function"&&(r=pM),i.ending?gM(this,r):(o||yM(this,i,t,r))&&(i.pendingcb++,n=vM(this,i,o,t,e,r)),n};ft.prototype.cork=function(){this._writableState.corked++};ft.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,!t.writing&&!t.corked&&!t.bufferProcessing&&t.bufferedRequest&&Hy(this,t))};ft.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new mM(e);return this._writableState.defaultEncoding=e,this};Object.defineProperty(ft.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function bM(t,e,r){return!t.objectMode&&t.decodeStrings!==!1&&typeof e=="string"&&(e=gh.from(e,r)),e}Object.defineProperty(ft.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function vM(t,e,r,i,n,o){if(!r){var a=bM(e,i,n);i!==a&&(r=!0,n="buffer",i=a)}var h=e.objectMode?1:i.length;e.length+=h;var d=e.length<e.highWaterMark;if(d||(e.needDrain=!0),e.writing||e.corked){var m=e.lastBufferedRequest;e.lastBufferedRequest={chunk:i,encoding:n,isBuf:r,callback:o,next:null},m?m.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else Kd(t,e,!1,h,i,n,o);return d}function Kd(t,e,r,i,n,o,a){e.writelen=i,e.writecb=a,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new cM("write")):r?t._writev(n,e.onwrite):t._write(n,o,e.onwrite),e.sync=!1}function wM(t,e,r,i,n){--e.pendingcb,r?(process.nextTick(n,i),process.nextTick(rl,t,e),t._writableState.errorEmitted=!0,Ho(t,i)):(n(i),t._writableState.errorEmitted=!0,Ho(t,i),rl(t,e))}function _M(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}function SM(t,e){var r=t._writableState,i=r.sync,n=r.writecb;if(typeof n!="function")throw new uM;if(_M(r),e)wM(t,r,i,e,n);else{var o=Gy(r)||t.destroyed;!o&&!r.corked&&!r.bufferProcessing&&r.bufferedRequest&&Hy(t,r),i?process.nextTick(Wy,t,r,o,n):Wy(t,r,o,n)}}function Wy(t,e,r,i){r||xM(t,e),e.pendingcb--,i(),rl(t,e)}function xM(t,e){e.length===0&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}function Hy(t,e){e.bufferProcessing=!0;var r=e.bufferedRequest;if(t._writev&&r&&r.next){var i=e.bufferedRequestCount,n=new Array(i),o=e.corkedRequestsFree;o.entry=r;for(var a=0,h=!0;r;)n[a]=r,r.isBuf||(h=!1),r=r.next,a+=1;n.allBuffers=h,Kd(t,e,!0,e.length,n,"",o.finish),e.pendingcb++,e.lastBufferedRequest=null,o.next?(e.corkedRequestsFree=o.next,o.next=null):e.corkedRequestsFree=new $y(e),e.bufferedRequestCount=0}else{for(;r;){var d=r.chunk,m=r.encoding,p=r.callback,w=e.objectMode?1:d.length;if(Kd(t,e,!1,w,d,m,p),r=r.next,e.bufferedRequestCount--,e.writing)break}r===null&&(e.lastBufferedRequest=null)}e.bufferedRequest=r,e.bufferProcessing=!1}ft.prototype._write=function(t,e,r){r(new lM("_write()"))};ft.prototype._writev=null;ft.prototype.end=function(t,e,r){var i=this._writableState;return typeof t=="function"?(r=t,t=null,e=null):typeof e=="function"&&(r=e,e=null),t!=null&&this.write(t,e),i.corked&&(i.corked=1,this.uncork()),i.ending||RM(this,i,r),this};Object.defineProperty(ft.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function Gy(t){return t.ending&&t.length===0&&t.bufferedRequest===null&&!t.finished&&!t.writing}function EM(t,e){t._final(function(r){e.pendingcb--,r&&Ho(t,r),e.prefinished=!0,t.emit("prefinish"),rl(t,e)})}function MM(t,e){!e.prefinished&&!e.finalCalled&&(typeof t._final=="function"&&!e.destroyed?(e.pendingcb++,e.finalCalled=!0,process.nextTick(EM,t,e)):(e.prefinished=!0,t.emit("prefinish")))}function rl(t,e){var r=Gy(e);if(r&&(MM(t,e),e.pendingcb===0&&(e.finished=!0,t.emit("finish"),e.autoDestroy))){var i=t._readableState;(!i||i.autoDestroy&&i.endEmitted)&&t.destroy()}return r}function RM(t,e,r){e.ending=!0,rl(t,e),r&&(e.finished?process.nextTick(r):t.once("finish",r)),e.ended=!0,t.writable=!1}function CM(t,e,r){var i=t.entry;for(t.entry=null;i;){var n=i.callback;e.pendingcb--,n(r),i=i.next}e.corkedRequestsFree.next=t}Object.defineProperty(ft.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(e){!this._writableState||(this._writableState.destroyed=e)}});ft.prototype.destroy=Yd.destroy;ft.prototype._undestroy=Yd.undestroy;ft.prototype._destroy=function(t,e){e(t)}});var _s=ee((IP,Yy)=>{"use strict";var TM=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};Yy.exports=bi;var Ky=Qd(),Jd=Zd();$o()(bi,Ky);for(Xd=TM(Jd.prototype),yh=0;yh<Xd.length;yh++)bh=Xd[yh],bi.prototype[bh]||(bi.prototype[bh]=Jd.prototype[bh]);var Xd,bh,yh;function bi(t){if(!(this instanceof bi))return new bi(t);Ky.call(this,t),Jd.call(this,t),this.allowHalfOpen=!0,t&&(t.readable===!1&&(this.readable=!1),t.writable===!1&&(this.writable=!1),t.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",AM)))}Object.defineProperty(bi.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});Object.defineProperty(bi.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});Object.defineProperty(bi.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function AM(){this._writableState.ended||process.nextTick(IM,this)}function IM(t){t.end()}Object.defineProperty(bi.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(e){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=e,this._writableState.destroyed=e)}})});var Jy=ee((em,Xy)=>{var vh=require("buffer"),vi=vh.Buffer;function Zy(t,e){for(var r in t)e[r]=t[r]}vi.from&&vi.alloc&&vi.allocUnsafe&&vi.allocUnsafeSlow?Xy.exports=vh:(Zy(vh,em),em.Buffer=Ss);function Ss(t,e,r){return vi(t,e,r)}Ss.prototype=Object.create(vi.prototype);Zy(vi,Ss);Ss.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return vi(t,e,r)};Ss.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var i=vi(t);return e!==void 0?typeof r=="string"?i.fill(e,r):i.fill(e):i.fill(0),i};Ss.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return vi(t)};Ss.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return vh.SlowBuffer(t)}});var im=ee(eb=>{"use strict";var rm=Jy().Buffer,Qy=rm.isEncoding||function(t){switch(t=""+t,t&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function PM(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}function OM(t){var e=PM(t);if(typeof e!="string"&&(rm.isEncoding===Qy||!Qy(t)))throw new Error("Unknown encoding: "+t);return e||t}eb.StringDecoder=nl;function nl(t){this.encoding=OM(t);var e;switch(this.encoding){case"utf16le":this.text=zM,this.end=FM,e=4;break;case"utf8":this.fillLast=LM,e=4;break;case"base64":this.text=UM,this.end=jM,e=3;break;default:this.write=WM,this.end=$M;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=rm.allocUnsafe(e)}nl.prototype.write=function(t){if(t.length===0)return"";var e,r;if(this.lastNeed){if(e=this.fillLast(t),e===void 0)return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<t.length?e?e+this.text(t,r):this.text(t,r):e||""};nl.prototype.end=BM;nl.prototype.text=DM;nl.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length};function tm(t){return t<=127?0:t>>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}function kM(t,e,r){var i=e.length-1;if(i<r)return 0;var n=tm(e[i]);return n>=0?(n>0&&(t.lastNeed=n-1),n):--i<r||n===-2?0:(n=tm(e[i]),n>=0?(n>0&&(t.lastNeed=n-2),n):--i<r||n===-2?0:(n=tm(e[i]),n>=0?(n>0&&(n===2?n=0:t.lastNeed=n-3),n):0))}function NM(t,e,r){if((e[0]&192)!==128)return t.lastNeed=0,"\uFFFD";if(t.lastNeed>1&&e.length>1){if((e[1]&192)!==128)return t.lastNeed=1,"\uFFFD";if(t.lastNeed>2&&e.length>2&&(e[2]&192)!==128)return t.lastNeed=2,"\uFFFD"}}function LM(t){var e=this.lastTotal-this.lastNeed,r=NM(this,t,e);if(r!==void 0)return r;if(this.lastNeed<=t.length)return t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,e,0,t.length),this.lastNeed-=t.length}function DM(t,e){var r=kM(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var i=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,i),t.toString("utf8",e,i)}function BM(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function zM(t,e){if((t.length-e)%2===0){var r=t.toString("utf16le",e);if(r){var i=r.charCodeAt(r.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function FM(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function UM(t,e){var r=(t.length-e)%3;return r===0?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,r===1?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function jM(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function WM(t){return t.toString(this.encoding)}function $M(t){return t&&t.length?this.write(t):""}});var wh=ee((OP,ib)=>{"use strict";var tb=vn().codes.ERR_STREAM_PREMATURE_CLOSE;function qM(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,i=new Array(r),n=0;n<r;n++)i[n]=arguments[n];t.apply(this,i)}}}function HM(){}function GM(t){return t.setHeader&&typeof t.abort=="function"}function rb(t,e,r){if(typeof e=="function")return rb(t,null,e);e||(e={}),r=qM(r||HM);var i=e.readable||e.readable!==!1&&t.readable,n=e.writable||e.writable!==!1&&t.writable,o=function(){t.writable||h()},a=t._writableState&&t._writableState.finished,h=function(){n=!1,a=!0,i||r.call(t)},d=t._readableState&&t._readableState.endEmitted,m=function(){i=!1,d=!0,n||r.call(t)},p=function(C){r.call(t,C)},w=function(){var C;if(i&&!d)return(!t._readableState||!t._readableState.ended)&&(C=new tb),r.call(t,C);if(n&&!a)return(!t._writableState||!t._writableState.ended)&&(C=new tb),r.call(t,C)},E=function(){t.req.on("finish",h)};return GM(t)?(t.on("complete",h),t.on("abort",w),t.req?E():t.on("request",E)):n&&!t._writableState&&(t.on("end",o),t.on("close",o)),t.on("end",m),t.on("finish",h),e.error!==!1&&t.on("error",p),t.on("close",w),function(){t.removeListener("complete",h),t.removeListener("abort",w),t.removeListener("request",E),t.req&&t.req.removeListener("finish",h),t.removeListener("end",o),t.removeListener("close",o),t.removeListener("finish",h),t.removeListener("end",m),t.removeListener("error",p),t.removeListener("close",w)}}ib.exports=rb});var sb=ee((kP,nb)=>{"use strict";var _h;function _n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var VM=wh(),Sn=Symbol("lastResolve"),xs=Symbol("lastReject"),sl=Symbol("error"),Sh=Symbol("ended"),Es=Symbol("lastPromise"),nm=Symbol("handlePromise"),Ms=Symbol("stream");function xn(t,e){return{value:t,done:e}}function KM(t){var e=t[Sn];if(e!==null){var r=t[Ms].read();r!==null&&(t[Es]=null,t[Sn]=null,t[xs]=null,e(xn(r,!1)))}}function YM(t){process.nextTick(KM,t)}function ZM(t,e){return function(r,i){t.then(function(){if(e[Sh]){r(xn(void 0,!0));return}e[nm](r,i)},i)}}var XM=Object.getPrototypeOf(function(){}),JM=Object.setPrototypeOf((_h={get stream(){return this[Ms]},next:function(){var e=this,r=this[sl];if(r!==null)return Promise.reject(r);if(this[Sh])return Promise.resolve(xn(void 0,!0));if(this[Ms].destroyed)return new Promise(function(a,h){process.nextTick(function(){e[sl]?h(e[sl]):a(xn(void 0,!0))})});var i=this[Es],n;if(i)n=new Promise(ZM(i,this));else{var o=this[Ms].read();if(o!==null)return Promise.resolve(xn(o,!1));n=new Promise(this[nm])}return this[Es]=n,n}},_n(_h,Symbol.asyncIterator,function(){return this}),_n(_h,"return",function(){var e=this;return new Promise(function(r,i){e[Ms].destroy(null,function(n){if(n){i(n);return}r(xn(void 0,!0))})})}),_h),XM),QM=function(e){var r,i=Object.create(JM,(r={},_n(r,Ms,{value:e,writable:!0}),_n(r,Sn,{value:null,writable:!0}),_n(r,xs,{value:null,writable:!0}),_n(r,sl,{value:null,writable:!0}),_n(r,Sh,{value:e._readableState.endEmitted,writable:!0}),_n(r,nm,{value:function(o,a){var h=i[Ms].read();h?(i[Es]=null,i[Sn]=null,i[xs]=null,o(xn(h,!1))):(i[Sn]=o,i[xs]=a)},writable:!0}),r));return i[Es]=null,VM(e,function(n){if(n&&n.code!=="ERR_STREAM_PREMATURE_CLOSE"){var o=i[xs];o!==null&&(i[Es]=null,i[Sn]=null,i[xs]=null,o(n)),i[sl]=n;return}var a=i[Sn];a!==null&&(i[Es]=null,i[Sn]=null,i[xs]=null,a(xn(void 0,!0))),i[Sh]=!0}),e.on("readable",YM.bind(null,i)),i};nb.exports=QM});var ub=ee((NP,lb)=>{"use strict";function ob(t,e,r,i,n,o,a){try{var h=t[o](a),d=h.value}catch(m){r(m);return}h.done?e(d):Promise.resolve(d).then(i,n)}function eR(t){return function(){var e=this,r=arguments;return new Promise(function(i,n){var o=t.apply(e,r);function a(d){ob(o,i,n,a,h,"next",d)}function h(d){ob(o,i,n,a,h,"throw",d)}a(void 0)})}}function ab(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function tR(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?ab(Object(r),!0).forEach(function(i){rR(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ab(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function rR(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var iR=vn().codes.ERR_INVALID_ARG_TYPE;function nR(t,e,r){var i;if(e&&typeof e.next=="function")i=e;else if(e&&e[Symbol.asyncIterator])i=e[Symbol.asyncIterator]();else if(e&&e[Symbol.iterator])i=e[Symbol.iterator]();else throw new iR("iterable",["Iterable"],e);var n=new t(tR({objectMode:!0},r)),o=!1;n._read=function(){o||(o=!0,a())};function a(){return h.apply(this,arguments)}function h(){return h=eR(function*(){try{var d=yield i.next(),m=d.value,p=d.done;p?n.push(null):n.push(yield m)?a():o=!1}catch(w){n.destroy(w)}}),h.apply(this,arguments)}return n}lb.exports=nR});var Qd=ee((DP,vb)=>{"use strict";vb.exports=Ue;var Go;Ue.ReadableState=db;var LP=require("events").EventEmitter,fb=function(e,r){return e.listeners(r).length},al=Ud(),xh=require("buffer").Buffer,sR=global.Uint8Array||function(){};function oR(t){return xh.from(t)}function aR(t){return xh.isBuffer(t)||t instanceof sR}var sm=require("util"),xe;sm&&sm.debuglog?xe=sm.debuglog("stream"):xe=function(){};var lR=Oy(),fm=$d(),uR=qd(),hR=uR.getHighWaterMark,Eh=vn().codes,cR=Eh.ERR_INVALID_ARG_TYPE,fR=Eh.ERR_STREAM_PUSH_AFTER_EOF,dR=Eh.ERR_METHOD_NOT_IMPLEMENTED,mR=Eh.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,Vo,om,am;$o()(Ue,al);var ol=fm.errorOrDestroy,lm=["error","close","destroy","pause","resume"];function pR(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}function db(t,e,r){Go=Go||_s(),t=t||{},typeof r!="boolean"&&(r=e instanceof Go),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=hR(this,t,"readableHighWaterMark",r),this.buffer=new lR,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=t.emitClose!==!1,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(Vo||(Vo=im().StringDecoder),this.decoder=new Vo(t.encoding),this.encoding=t.encoding)}function Ue(t){if(Go=Go||_s(),!(this instanceof Ue))return new Ue(t);var e=this instanceof Go;this._readableState=new db(t,this,e),this.readable=!0,t&&(typeof t.read=="function"&&(this._read=t.read),typeof t.destroy=="function"&&(this._destroy=t.destroy)),al.call(this)}Object.defineProperty(Ue.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(e){!this._readableState||(this._readableState.destroyed=e)}});Ue.prototype.destroy=fm.destroy;Ue.prototype._undestroy=fm.undestroy;Ue.prototype._destroy=function(t,e){e(t)};Ue.prototype.push=function(t,e){var r=this._readableState,i;return r.objectMode?i=!0:typeof t=="string"&&(e=e||r.defaultEncoding,e!==r.encoding&&(t=xh.from(t,e),e=""),i=!0),mb(this,t,e,!1,i)};Ue.prototype.unshift=function(t){return mb(this,t,null,!0,!1)};function mb(t,e,r,i,n){xe("readableAddChunk",e);var o=t._readableState;if(e===null)o.reading=!1,bR(t,o);else{var a;if(n||(a=gR(o,e)),a)ol(t,a);else if(o.objectMode||e&&e.length>0)if(typeof e!="string"&&!o.objectMode&&Object.getPrototypeOf(e)!==xh.prototype&&(e=oR(e)),i)o.endEmitted?ol(t,new mR):um(t,o,e,!0);else if(o.ended)ol(t,new fR);else{if(o.destroyed)return!1;o.reading=!1,o.decoder&&!r?(e=o.decoder.write(e),o.objectMode||e.length!==0?um(t,o,e,!1):cm(t,o)):um(t,o,e,!1)}else i||(o.reading=!1,cm(t,o))}return!o.ended&&(o.length<o.highWaterMark||o.length===0)}function um(t,e,r,i){e.flowing&&e.length===0&&!e.sync?(e.awaitDrain=0,t.emit("data",r)):(e.length+=e.objectMode?1:r.length,i?e.buffer.unshift(r):e.buffer.push(r),e.needReadable&&Mh(t)),cm(t,e)}function gR(t,e){var r;return!aR(e)&&typeof e!="string"&&e!==void 0&&!t.objectMode&&(r=new cR("chunk",["string","Buffer","Uint8Array"],e)),r}Ue.prototype.isPaused=function(){return this._readableState.flowing===!1};Ue.prototype.setEncoding=function(t){Vo||(Vo=im().StringDecoder);var e=new Vo(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;for(var r=this._readableState.buffer.head,i="";r!==null;)i+=e.write(r.data),r=r.next;return this._readableState.buffer.clear(),i!==""&&this._readableState.buffer.push(i),this._readableState.length=i.length,this};var hb=1073741824;function yR(t){return t>=hb?t=hb:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}function cb(t,e){return t<=0||e.length===0&&e.ended?0:e.objectMode?1:t!==t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=yR(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}Ue.prototype.read=function(t){xe("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(t!==0&&(e.emittedReadable=!1),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return xe("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?hm(this):Mh(this),null;if(t=cb(t,e),t===0&&e.ended)return e.length===0&&hm(this),null;var i=e.needReadable;xe("need readable",i),(e.length===0||e.length-t<e.highWaterMark)&&(i=!0,xe("length less than watermark",i)),e.ended||e.reading?(i=!1,xe("reading or ended",i)):i&&(xe("do read"),e.reading=!0,e.sync=!0,e.length===0&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=cb(r,e)));var n;return t>0?n=yb(t,e):n=null,n===null?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),e.length===0&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&hm(this)),n!==null&&this.emit("data",n),n};function bR(t,e){if(xe("onEofChunk"),!e.ended){if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?Mh(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,pb(t)))}}function Mh(t){var e=t._readableState;xe("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(xe("emitReadable",e.flowing),e.emittedReadable=!0,process.nextTick(pb,t))}function pb(t){var e=t._readableState;xe("emitReadable_",e.destroyed,e.length,e.ended),!e.destroyed&&(e.length||e.ended)&&(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,dm(t)}function cm(t,e){e.readingMore||(e.readingMore=!0,process.nextTick(vR,t,e))}function vR(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&e.length===0);){var r=e.length;if(xe("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}Ue.prototype._read=function(t){ol(this,new dR("_read()"))};Ue.prototype.pipe=function(t,e){var r=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=t;break;case 1:i.pipes=[i.pipes,t];break;default:i.pipes.push(t);break}i.pipesCount+=1,xe("pipe count=%d opts=%j",i.pipesCount,e);var n=(!e||e.end!==!1)&&t!==process.stdout&&t!==process.stderr,o=n?h:R;i.endEmitted?process.nextTick(o):r.once("end",o),t.on("unpipe",a);function a(I,A){xe("onunpipe"),I===r&&A&&A.hasUnpiped===!1&&(A.hasUnpiped=!0,p())}function h(){xe("onend"),t.end()}var d=wR(r);t.on("drain",d);var m=!1;function p(){xe("cleanup"),t.removeListener("close",_),t.removeListener("finish",C),t.removeListener("drain",d),t.removeListener("error",E),t.removeListener("unpipe",a),r.removeListener("end",h),r.removeListener("end",R),r.removeListener("data",w),m=!0,i.awaitDrain&&(!t._writableState||t._writableState.needDrain)&&d()}r.on("data",w);function w(I){xe("ondata");var A=t.write(I);xe("dest.write",A),A===!1&&((i.pipesCount===1&&i.pipes===t||i.pipesCount>1&&bb(i.pipes,t)!==-1)&&!m&&(xe("false write response, pause",i.awaitDrain),i.awaitDrain++),r.pause())}function E(I){xe("onerror",I),R(),t.removeListener("error",E),fb(t,"error")===0&&ol(t,I)}pR(t,"error",E);function _(){t.removeListener("finish",C),R()}t.once("close",_);function C(){xe("onfinish"),t.removeListener("close",_),R()}t.once("finish",C);function R(){xe("unpipe"),r.unpipe(t)}return t.emit("pipe",r),i.flowing||(xe("pipe resume"),r.resume()),t};function wR(t){return function(){var r=t._readableState;xe("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,r.awaitDrain===0&&fb(t,"data")&&(r.flowing=!0,dm(t))}}Ue.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(e.pipesCount===0)return this;if(e.pipesCount===1)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r),this);if(!t){var i=e.pipes,n=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o<n;o++)i[o].emit("unpipe",this,{hasUnpiped:!1});return this}var a=bb(e.pipes,t);return a===-1?this:(e.pipes.splice(a,1),e.pipesCount-=1,e.pipesCount===1&&(e.pipes=e.pipes[0]),t.emit("unpipe",this,r),this)};Ue.prototype.on=function(t,e){var r=al.prototype.on.call(this,t,e),i=this._readableState;return t==="data"?(i.readableListening=this.listenerCount("readable")>0,i.flowing!==!1&&this.resume()):t==="readable"&&!i.endEmitted&&!i.readableListening&&(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,xe("on readable",i.length,i.reading),i.length?Mh(this):i.reading||process.nextTick(_R,this)),r};Ue.prototype.addListener=Ue.prototype.on;Ue.prototype.removeListener=function(t,e){var r=al.prototype.removeListener.call(this,t,e);return t==="readable"&&process.nextTick(gb,this),r};Ue.prototype.removeAllListeners=function(t){var e=al.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&process.nextTick(gb,this),e};function gb(t){var e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function _R(t){xe("readable nexttick read 0"),t.read(0)}Ue.prototype.resume=function(){var t=this._readableState;return t.flowing||(xe("resume"),t.flowing=!t.readableListening,SR(this,t)),t.paused=!1,this};function SR(t,e){e.resumeScheduled||(e.resumeScheduled=!0,process.nextTick(xR,t,e))}function xR(t,e){xe("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),dm(t),e.flowing&&!e.reading&&t.read(0)}Ue.prototype.pause=function(){return xe("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(xe("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function dm(t){var e=t._readableState;for(xe("flow",e.flowing);e.flowing&&t.read()!==null;);}Ue.prototype.wrap=function(t){var e=this,r=this._readableState,i=!1;t.on("end",function(){if(xe("wrapped end"),r.decoder&&!r.ended){var a=r.decoder.end();a&&a.length&&e.push(a)}e.push(null)}),t.on("data",function(a){if(xe("wrapped data"),r.decoder&&(a=r.decoder.write(a)),!(r.objectMode&&a==null)&&!(!r.objectMode&&(!a||!a.length))){var h=e.push(a);h||(i=!0,t.pause())}});for(var n in t)this[n]===void 0&&typeof t[n]=="function"&&(this[n]=function(h){return function(){return t[h].apply(t,arguments)}}(n));for(var o=0;o<lm.length;o++)t.on(lm[o],this.emit.bind(this,lm[o]));return this._read=function(a){xe("wrapped _read",a),i&&(i=!1,t.resume())},this};typeof Symbol=="function"&&(Ue.prototype[Symbol.asyncIterator]=function(){return om===void 0&&(om=sb()),om(this)});Object.defineProperty(Ue.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}});Object.defineProperty(Ue.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}});Object.defineProperty(Ue.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}});Ue._fromList=yb;Object.defineProperty(Ue.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function yb(t,e){if(e.length===0)return null;var r;return e.objectMode?r=e.buffer.shift():!t||t>=e.length?(e.decoder?r=e.buffer.join(""):e.buffer.length===1?r=e.buffer.first():r=e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r}function hm(t){var e=t._readableState;xe("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,process.nextTick(ER,e,t))}function ER(t,e){if(xe("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&t.length===0&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}typeof Symbol=="function"&&(Ue.from=function(t,e){return am===void 0&&(am=ub()),am(Ue,t,e)});function bb(t,e){for(var r=0,i=t.length;r<i;r++)if(t[r]===e)return r;return-1}});var mm=ee((BP,_b)=>{"use strict";_b.exports=Yi;var Rh=vn().codes,MR=Rh.ERR_METHOD_NOT_IMPLEMENTED,RR=Rh.ERR_MULTIPLE_CALLBACK,CR=Rh.ERR_TRANSFORM_ALREADY_TRANSFORMING,TR=Rh.ERR_TRANSFORM_WITH_LENGTH_0,Ch=_s();$o()(Yi,Ch);function AR(t,e){var r=this._transformState;r.transforming=!1;var i=r.writecb;if(i===null)return this.emit("error",new RR);r.writechunk=null,r.writecb=null,e!=null&&this.push(e),i(t);var n=this._readableState;n.reading=!1,(n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}function Yi(t){if(!(this instanceof Yi))return new Yi(t);Ch.call(this,t),this._transformState={afterTransform:AR.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",IR)}function IR(){var t=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(e,r){wb(t,e,r)}):wb(this,null,null)}Yi.prototype.push=function(t,e){return this._transformState.needTransform=!1,Ch.prototype.push.call(this,t,e)};Yi.prototype._transform=function(t,e,r){r(new MR("_transform()"))};Yi.prototype._write=function(t,e,r){var i=this._transformState;if(i.writecb=r,i.writechunk=t,i.writeencoding=e,!i.transforming){var n=this._readableState;(i.needTransform||n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}};Yi.prototype._read=function(t){var e=this._transformState;e.writechunk!==null&&!e.transforming?(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform)):e.needTransform=!0};Yi.prototype._destroy=function(t,e){Ch.prototype._destroy.call(this,t,function(r){e(r)})};function wb(t,e,r){if(e)return t.emit("error",e);if(r!=null&&t.push(r),t._writableState.length)throw new TR;if(t._transformState.transforming)throw new CR;return t.push(null)}});var Eb=ee((zP,xb)=>{"use strict";xb.exports=ll;var Sb=mm();$o()(ll,Sb);function ll(t){if(!(this instanceof ll))return new ll(t);Sb.call(this,t)}ll.prototype._transform=function(t,e,r){r(null,t)}});var Ab=ee((FP,Tb)=>{"use strict";var pm;function PR(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}var Cb=vn().codes,OR=Cb.ERR_MISSING_ARGS,kR=Cb.ERR_STREAM_DESTROYED;function Mb(t){if(t)throw t}function NR(t){return t.setHeader&&typeof t.abort=="function"}function LR(t,e,r,i){i=PR(i);var n=!1;t.on("close",function(){n=!0}),pm===void 0&&(pm=wh()),pm(t,{readable:e,writable:r},function(a){if(a)return i(a);n=!0,i()});var o=!1;return function(a){if(!n&&!o){if(o=!0,NR(t))return t.abort();if(typeof t.destroy=="function")return t.destroy();i(a||new kR("pipe"))}}}function Rb(t){t()}function DR(t,e){return t.pipe(e)}function BR(t){return!t.length||typeof t[t.length-1]!="function"?Mb:t.pop()}function zR(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var i=BR(e);if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw new OR("streams");var n,o=e.map(function(a,h){var d=h<e.length-1,m=h>0;return LR(a,d,m,function(p){n||(n=p),p&&o.forEach(Rb),!d&&(o.forEach(Rb),i(n))})});return e.reduce(DR)}Tb.exports=zR});var Ib=ee((kr,hl)=>{var ul=require("stream");process.env.READABLE_STREAM==="disable"&&ul?(hl.exports=ul.Readable,Object.assign(hl.exports,ul),hl.exports.Stream=ul):(kr=hl.exports=Qd(),kr.Stream=ul||kr,kr.Readable=kr,kr.Writable=Zd(),kr.Duplex=_s(),kr.Transform=mm(),kr.PassThrough=Eb(),kr.finished=wh(),kr.pipeline=Ab())});var Nb=ee((UP,kb)=>{"use strict";var{Transform:FR}=Ib(),{StringDecoder:UR}=require("string_decoder"),En=Symbol("last"),Th=Symbol("decoder");function jR(t,e,r){var i;if(this.overflow){var n=this[Th].write(t);if(i=n.split(this.matcher),i.length===1)return r();i.shift(),this.overflow=!1}else this[En]+=this[Th].write(t),i=this[En].split(this.matcher);this[En]=i.pop();for(var o=0;o<i.length;o++)Ob(this,this.mapper(i[o]));if(this.overflow=this[En].length>this.maxLength,this.overflow&&!this.skipOverflow)return r(new Error("maximum buffer reached"));r()}function WR(t){this[En]+=this[Th].end(),this[En]&&Ob(this,this.mapper(this[En])),t()}function Ob(t,e){e!==void 0&&t.push(e)}function Pb(t){return t}function $R(t,e,r){switch(t=t||/\r?\n/,e=e||Pb,r=r||{},arguments.length){case 1:typeof t=="function"?(e=t,t=/\r?\n/):typeof t=="object"&&!(t instanceof RegExp)&&(r=t,t=/\r?\n/);break;case 2:typeof t=="function"?(r=e,e=t,t=/\r?\n/):typeof e=="object"&&(r=e,e=Pb)}r=Object.assign({},r),r.transform=jR,r.flush=WR,r.readableObjectMode=!0;let i=new FR(r);return i[En]="",i[Th]=new UR("utf8"),i.matcher=t,i.mapper=e,i.maxLength=r.maxLength,i.skipOverflow=r.skipOverflow,i.overflow=!1,i}kb.exports=$R});var $b=ee(Nh=>{(function(t){t.parser=function(T,M){return new r(T,M)},t.SAXParser=r,t.SAXStream=m,t.createStream=d,t.MAX_BUFFER_LENGTH=64*1024;var e=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];t.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"];function r(T,M){if(!(this instanceof r))return new r(T,M);var G=this;n(G),G.q=G.c="",G.bufferCheckPosition=t.MAX_BUFFER_LENGTH,G.opt=M||{},G.opt.lowercase=G.opt.lowercase||G.opt.lowercasetags,G.looseCase=G.opt.lowercase?"toLowerCase":"toUpperCase",G.tags=[],G.closed=G.closedRoot=G.sawRoot=!1,G.tag=G.error=null,G.strict=!!T,G.noscript=!!(T||G.opt.noscript),G.state=N.BEGIN,G.strictEntities=G.opt.strictEntities,G.ENTITIES=G.strictEntities?Object.create(t.XML_ENTITIES):Object.create(t.ENTITIES),G.attribList=[],G.opt.xmlns&&(G.ns=Object.create(C)),G.trackPosition=G.opt.position!==!1,G.trackPosition&&(G.position=G.line=G.column=0),Pe(G,"onready")}Object.create||(Object.create=function(T){function M(){}M.prototype=T;var G=new M;return G}),Object.keys||(Object.keys=function(T){var M=[];for(var G in T)T.hasOwnProperty(G)&&M.push(G);return M});function i(T){for(var M=Math.max(t.MAX_BUFFER_LENGTH,10),G=0,F=0,be=e.length;F<be;F++){var Qe=T[e[F]].length;if(Qe>M)switch(e[F]){case"textNode":ze(T);break;case"cdata":ae(T,"oncdata",T.cdata),T.cdata="";break;case"script":ae(T,"onscript",T.script),T.script="";break;default:mt(T,"Max buffer length exceeded: "+e[F])}G=Math.max(G,Qe)}var tt=t.MAX_BUFFER_LENGTH-G;T.bufferCheckPosition=tt+T.position}function n(T){for(var M=0,G=e.length;M<G;M++)T[e[M]]=""}function o(T){ze(T),T.cdata!==""&&(ae(T,"oncdata",T.cdata),T.cdata=""),T.script!==""&&(ae(T,"onscript",T.script),T.script="")}r.prototype={end:function(){or(this)},write:yt,resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){o(this)}};var a;try{a=require("stream").Stream}catch{a=function(){}}var h=t.EVENTS.filter(function(T){return T!=="error"&&T!=="end"});function d(T,M){return new m(T,M)}function m(T,M){if(!(this instanceof m))return new m(T,M);a.apply(this),this._parser=new r(T,M),this.writable=!0,this.readable=!0;var G=this;this._parser.onend=function(){G.emit("end")},this._parser.onerror=function(F){G.emit("error",F),G._parser.error=null},this._decoder=null,h.forEach(function(F){Object.defineProperty(G,"on"+F,{get:function(){return G._parser["on"+F]},set:function(be){if(!be)return G.removeAllListeners(F),G._parser["on"+F]=be,be;G.on(F,be)},enumerable:!0,configurable:!1})})}m.prototype=Object.create(a.prototype,{constructor:{value:m}}),m.prototype.write=function(T){if(typeof Buffer=="function"&&typeof Buffer.isBuffer=="function"&&Buffer.isBuffer(T)){if(!this._decoder){var M=require("string_decoder").StringDecoder;this._decoder=new M("utf8")}T=this._decoder.write(T)}return this._parser.write(T.toString()),this.emit("data",T),!0},m.prototype.end=function(T){return T&&T.length&&this.write(T),this._parser.end(),!0},m.prototype.on=function(T,M){var G=this;return!G._parser["on"+T]&&h.indexOf(T)!==-1&&(G._parser["on"+T]=function(){var F=arguments.length===1?[arguments[0]]:Array.apply(null,arguments);F.splice(0,0,T),G.emit.apply(G,F)}),a.prototype.on.call(G,T,M)};var p="[CDATA[",w="DOCTYPE",E="http://www.w3.org/XML/1998/namespace",_="http://www.w3.org/2000/xmlns/",C={xml:E,xmlns:_},R=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,I=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/,A=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,k=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;function D(T){return T===" "||T===`
105
- `||T==="\r"||T===" "}function j(T){return T==='"'||T==="'"}function W(T){return T===">"||D(T)}function Z(T,M){return T.test(M)}function oe(T,M){return!Z(T,M)}var N=0;t.STATE={BEGIN:N++,BEGIN_WHITESPACE:N++,TEXT:N++,TEXT_ENTITY:N++,OPEN_WAKA:N++,SGML_DECL:N++,SGML_DECL_QUOTED:N++,DOCTYPE:N++,DOCTYPE_QUOTED:N++,DOCTYPE_DTD:N++,DOCTYPE_DTD_QUOTED:N++,COMMENT_STARTING:N++,COMMENT:N++,COMMENT_ENDING:N++,COMMENT_ENDED:N++,CDATA:N++,CDATA_ENDING:N++,CDATA_ENDING_2:N++,PROC_INST:N++,PROC_INST_BODY:N++,PROC_INST_ENDING:N++,OPEN_TAG:N++,OPEN_TAG_SLASH:N++,ATTRIB:N++,ATTRIB_NAME:N++,ATTRIB_NAME_SAW_WHITE:N++,ATTRIB_VALUE:N++,ATTRIB_VALUE_QUOTED:N++,ATTRIB_VALUE_CLOSED:N++,ATTRIB_VALUE_UNQUOTED:N++,ATTRIB_VALUE_ENTITY_Q:N++,ATTRIB_VALUE_ENTITY_U:N++,CLOSE_TAG:N++,CLOSE_TAG_SAW_WHITE:N++,SCRIPT:N++,SCRIPT_ENDING:N++},t.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},t.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(t.ENTITIES).forEach(function(T){var M=t.ENTITIES[T],G=typeof M=="number"?String.fromCharCode(M):M;t.ENTITIES[T]=G});for(var Oe in t.STATE)t.STATE[t.STATE[Oe]]=Oe;N=t.STATE;function Pe(T,M,G){T[M]&&T[M](G)}function ae(T,M,G){T.textNode&&ze(T),Pe(T,M,G)}function ze(T){T.textNode=ot(T.opt,T.textNode),T.textNode&&Pe(T,"ontext",T.textNode),T.textNode=""}function ot(T,M){return T.trim&&(M=M.trim()),T.normalize&&(M=M.replace(/\s+/g," ")),M}function mt(T,M){return ze(T),T.trackPosition&&(M+=`
106
- Line: `+T.line+`
107
- Column: `+T.column+`
108
- Char: `+T.c),M=new Error(M),T.error=M,Pe(T,"onerror",M),T}function or(T){return T.sawRoot&&!T.closedRoot&&pe(T,"Unclosed root tag"),T.state!==N.BEGIN&&T.state!==N.BEGIN_WHITESPACE&&T.state!==N.TEXT&&mt(T,"Unexpected end"),ze(T),T.c="",T.closed=!0,Pe(T,"onend"),r.call(T,T.strict,T.opt),T}function pe(T,M){if(typeof T!="object"||!(T instanceof r))throw new Error("bad call to strictFail");T.strict&&mt(T,M)}function sa(T){T.strict||(T.tagName=T.tagName[T.looseCase]());var M=T.tags[T.tags.length-1]||T,G=T.tag={name:T.tagName,attributes:{}};T.opt.xmlns&&(G.ns=M.ns),T.attribList.length=0,ae(T,"onopentagstart",G)}function Mi(T,M){var G=T.indexOf(":"),F=G<0?["",T]:T.split(":"),be=F[0],Qe=F[1];return M&&T==="xmlns"&&(be="xmlns",Qe=""),{prefix:be,local:Qe}}function ar(T){if(T.strict||(T.attribName=T.attribName[T.looseCase]()),T.attribList.indexOf(T.attribName)!==-1||T.tag.attributes.hasOwnProperty(T.attribName)){T.attribName=T.attribValue="";return}if(T.opt.xmlns){var M=Mi(T.attribName,!0),G=M.prefix,F=M.local;if(G==="xmlns")if(F==="xml"&&T.attribValue!==E)pe(T,"xml: prefix must be bound to "+E+`
109
- Actual: `+T.attribValue);else if(F==="xmlns"&&T.attribValue!==_)pe(T,"xmlns: prefix must be bound to "+_+`
110
- Actual: `+T.attribValue);else{var be=T.tag,Qe=T.tags[T.tags.length-1]||T;be.ns===Qe.ns&&(be.ns=Object.create(Qe.ns)),be.ns[F]=T.attribValue}T.attribList.push([T.attribName,T.attribValue])}else T.tag.attributes[T.attribName]=T.attribValue,ae(T,"onattribute",{name:T.attribName,value:T.attribValue});T.attribName=T.attribValue=""}function _r(T,M){if(T.opt.xmlns){var G=T.tag,F=Mi(T.tagName);G.prefix=F.prefix,G.local=F.local,G.uri=G.ns[F.prefix]||"",G.prefix&&!G.uri&&(pe(T,"Unbound namespace prefix: "+JSON.stringify(T.tagName)),G.uri=F.prefix);var be=T.tags[T.tags.length-1]||T;G.ns&&be.ns!==G.ns&&Object.keys(G.ns).forEach(function(Bn){ae(T,"onopennamespace",{prefix:Bn,uri:G.ns[Bn]})});for(var Qe=0,tt=T.attribList.length;Qe<tt;Qe++){var bt=T.attribList[Qe],Yt=bt[0],Sr=bt[1],je=Mi(Yt,!0),at=je.prefix,Q=je.local,_t=at===""?"":G.ns[at]||"",Zt={name:Yt,value:Sr,prefix:at,local:Q,uri:_t};at&&at!=="xmlns"&&!_t&&(pe(T,"Unbound namespace prefix: "+JSON.stringify(at)),Zt.uri=at),T.tag.attributes[Yt]=Zt,ae(T,"onattribute",Zt)}T.attribList.length=0}T.tag.isSelfClosing=!!M,T.sawRoot=!0,T.tags.push(T.tag),ae(T,"onopentag",T.tag),M||(!T.noscript&&T.tagName.toLowerCase()==="script"?T.state=N.SCRIPT:T.state=N.TEXT,T.tag=null,T.tagName=""),T.attribName=T.attribValue="",T.attribList.length=0}function Ri(T){if(!T.tagName){pe(T,"Weird empty close tag."),T.textNode+="</>",T.state=N.TEXT;return}if(T.script){if(T.tagName!=="script"){T.script+="</"+T.tagName+">",T.tagName="",T.state=N.SCRIPT;return}ae(T,"onscript",T.script),T.script=""}var M=T.tags.length,G=T.tagName;T.strict||(G=G[T.looseCase]());for(var F=G;M--;){var be=T.tags[M];if(be.name!==F)pe(T,"Unexpected close tag");else break}if(M<0){pe(T,"Unmatched closing tag: "+T.tagName),T.textNode+="</"+T.tagName+">",T.state=N.TEXT;return}T.tagName=G;for(var Qe=T.tags.length;Qe-- >M;){var tt=T.tag=T.tags.pop();T.tagName=T.tag.name,ae(T,"onclosetag",T.tagName);var bt={};for(var Yt in tt.ns)bt[Yt]=tt.ns[Yt];var Sr=T.tags[T.tags.length-1]||T;T.opt.xmlns&&tt.ns!==Sr.ns&&Object.keys(tt.ns).forEach(function(je){var at=tt.ns[je];ae(T,"onclosenamespace",{prefix:je,uri:at})})}M===0&&(T.closedRoot=!0),T.tagName=T.attribValue=T.attribName="",T.attribList.length=0,T.state=N.TEXT}function zt(T){var M=T.entity,G=M.toLowerCase(),F,be="";return T.ENTITIES[M]?T.ENTITIES[M]:T.ENTITIES[G]?T.ENTITIES[G]:(M=G,M.charAt(0)==="#"&&(M.charAt(1)==="x"?(M=M.slice(2),F=parseInt(M,16),be=F.toString(16)):(M=M.slice(1),F=parseInt(M,10),be=F.toString(10))),M=M.replace(/^0+/,""),isNaN(F)||be.toLowerCase()!==M?(pe(T,"Invalid character entity"),"&"+T.entity+";"):String.fromCodePoint(F))}function Ln(T,M){M==="<"?(T.state=N.OPEN_WAKA,T.startTagPosition=T.position):D(M)||(pe(T,"Non-whitespace before first tag."),T.textNode=M,T.state=N.TEXT)}function Dn(T,M){var G="";return M<T.length&&(G=T.charAt(M)),G}function yt(T){var M=this;if(this.error)throw this.error;if(M.closed)return mt(M,"Cannot write after close. Assign an onready handler.");if(T===null)return or(M);typeof T=="object"&&(T=T.toString());for(var G=0,F="";F=Dn(T,G++),M.c=F,!!F;)switch(M.trackPosition&&(M.position++,F===`
111
- `?(M.line++,M.column=0):M.column++),M.state){case N.BEGIN:if(M.state=N.BEGIN_WHITESPACE,F==="\uFEFF")continue;Ln(M,F);continue;case N.BEGIN_WHITESPACE:Ln(M,F);continue;case N.TEXT:if(M.sawRoot&&!M.closedRoot){for(var be=G-1;F&&F!=="<"&&F!=="&";)F=Dn(T,G++),F&&M.trackPosition&&(M.position++,F===`
112
- `?(M.line++,M.column=0):M.column++);M.textNode+=T.substring(be,G-1)}F==="<"&&!(M.sawRoot&&M.closedRoot&&!M.strict)?(M.state=N.OPEN_WAKA,M.startTagPosition=M.position):(!D(F)&&(!M.sawRoot||M.closedRoot)&&pe(M,"Text data outside of root node."),F==="&"?M.state=N.TEXT_ENTITY:M.textNode+=F);continue;case N.SCRIPT:F==="<"?M.state=N.SCRIPT_ENDING:M.script+=F;continue;case N.SCRIPT_ENDING:F==="/"?M.state=N.CLOSE_TAG:(M.script+="<"+F,M.state=N.SCRIPT);continue;case N.OPEN_WAKA:if(F==="!")M.state=N.SGML_DECL,M.sgmlDecl="";else if(!D(F))if(Z(R,F))M.state=N.OPEN_TAG,M.tagName=F;else if(F==="/")M.state=N.CLOSE_TAG,M.tagName="";else if(F==="?")M.state=N.PROC_INST,M.procInstName=M.procInstBody="";else{if(pe(M,"Unencoded <"),M.startTagPosition+1<M.position){var Qe=M.position-M.startTagPosition;F=new Array(Qe).join(" ")+F}M.textNode+="<"+F,M.state=N.TEXT}continue;case N.SGML_DECL:(M.sgmlDecl+F).toUpperCase()===p?(ae(M,"onopencdata"),M.state=N.CDATA,M.sgmlDecl="",M.cdata=""):M.sgmlDecl+F==="--"?(M.state=N.COMMENT,M.comment="",M.sgmlDecl=""):(M.sgmlDecl+F).toUpperCase()===w?(M.state=N.DOCTYPE,(M.doctype||M.sawRoot)&&pe(M,"Inappropriately located doctype declaration"),M.doctype="",M.sgmlDecl=""):F===">"?(ae(M,"onsgmldeclaration",M.sgmlDecl),M.sgmlDecl="",M.state=N.TEXT):(j(F)&&(M.state=N.SGML_DECL_QUOTED),M.sgmlDecl+=F);continue;case N.SGML_DECL_QUOTED:F===M.q&&(M.state=N.SGML_DECL,M.q=""),M.sgmlDecl+=F;continue;case N.DOCTYPE:F===">"?(M.state=N.TEXT,ae(M,"ondoctype",M.doctype),M.doctype=!0):(M.doctype+=F,F==="["?M.state=N.DOCTYPE_DTD:j(F)&&(M.state=N.DOCTYPE_QUOTED,M.q=F));continue;case N.DOCTYPE_QUOTED:M.doctype+=F,F===M.q&&(M.q="",M.state=N.DOCTYPE);continue;case N.DOCTYPE_DTD:M.doctype+=F,F==="]"?M.state=N.DOCTYPE:j(F)&&(M.state=N.DOCTYPE_DTD_QUOTED,M.q=F);continue;case N.DOCTYPE_DTD_QUOTED:M.doctype+=F,F===M.q&&(M.state=N.DOCTYPE_DTD,M.q="");continue;case N.COMMENT:F==="-"?M.state=N.COMMENT_ENDING:M.comment+=F;continue;case N.COMMENT_ENDING:F==="-"?(M.state=N.COMMENT_ENDED,M.comment=ot(M.opt,M.comment),M.comment&&ae(M,"oncomment",M.comment),M.comment=""):(M.comment+="-"+F,M.state=N.COMMENT);continue;case N.COMMENT_ENDED:F!==">"?(pe(M,"Malformed comment"),M.comment+="--"+F,M.state=N.COMMENT):M.state=N.TEXT;continue;case N.CDATA:F==="]"?M.state=N.CDATA_ENDING:M.cdata+=F;continue;case N.CDATA_ENDING:F==="]"?M.state=N.CDATA_ENDING_2:(M.cdata+="]"+F,M.state=N.CDATA);continue;case N.CDATA_ENDING_2:F===">"?(M.cdata&&ae(M,"oncdata",M.cdata),ae(M,"onclosecdata"),M.cdata="",M.state=N.TEXT):F==="]"?M.cdata+="]":(M.cdata+="]]"+F,M.state=N.CDATA);continue;case N.PROC_INST:F==="?"?M.state=N.PROC_INST_ENDING:D(F)?M.state=N.PROC_INST_BODY:M.procInstName+=F;continue;case N.PROC_INST_BODY:if(!M.procInstBody&&D(F))continue;F==="?"?M.state=N.PROC_INST_ENDING:M.procInstBody+=F;continue;case N.PROC_INST_ENDING:F===">"?(ae(M,"onprocessinginstruction",{name:M.procInstName,body:M.procInstBody}),M.procInstName=M.procInstBody="",M.state=N.TEXT):(M.procInstBody+="?"+F,M.state=N.PROC_INST_BODY);continue;case N.OPEN_TAG:Z(I,F)?M.tagName+=F:(sa(M),F===">"?_r(M):F==="/"?M.state=N.OPEN_TAG_SLASH:(D(F)||pe(M,"Invalid character in tag name"),M.state=N.ATTRIB));continue;case N.OPEN_TAG_SLASH:F===">"?(_r(M,!0),Ri(M)):(pe(M,"Forward-slash in opening tag not followed by >"),M.state=N.ATTRIB);continue;case N.ATTRIB:if(D(F))continue;F===">"?_r(M):F==="/"?M.state=N.OPEN_TAG_SLASH:Z(R,F)?(M.attribName=F,M.attribValue="",M.state=N.ATTRIB_NAME):pe(M,"Invalid attribute name");continue;case N.ATTRIB_NAME:F==="="?M.state=N.ATTRIB_VALUE:F===">"?(pe(M,"Attribute without value"),M.attribValue=M.attribName,ar(M),_r(M)):D(F)?M.state=N.ATTRIB_NAME_SAW_WHITE:Z(I,F)?M.attribName+=F:pe(M,"Invalid attribute name");continue;case N.ATTRIB_NAME_SAW_WHITE:if(F==="=")M.state=N.ATTRIB_VALUE;else{if(D(F))continue;pe(M,"Attribute without value"),M.tag.attributes[M.attribName]="",M.attribValue="",ae(M,"onattribute",{name:M.attribName,value:""}),M.attribName="",F===">"?_r(M):Z(R,F)?(M.attribName=F,M.state=N.ATTRIB_NAME):(pe(M,"Invalid attribute name"),M.state=N.ATTRIB)}continue;case N.ATTRIB_VALUE:if(D(F))continue;j(F)?(M.q=F,M.state=N.ATTRIB_VALUE_QUOTED):(pe(M,"Unquoted attribute value"),M.state=N.ATTRIB_VALUE_UNQUOTED,M.attribValue=F);continue;case N.ATTRIB_VALUE_QUOTED:if(F!==M.q){F==="&"?M.state=N.ATTRIB_VALUE_ENTITY_Q:M.attribValue+=F;continue}ar(M),M.q="",M.state=N.ATTRIB_VALUE_CLOSED;continue;case N.ATTRIB_VALUE_CLOSED:D(F)?M.state=N.ATTRIB:F===">"?_r(M):F==="/"?M.state=N.OPEN_TAG_SLASH:Z(R,F)?(pe(M,"No whitespace between attributes"),M.attribName=F,M.attribValue="",M.state=N.ATTRIB_NAME):pe(M,"Invalid attribute name");continue;case N.ATTRIB_VALUE_UNQUOTED:if(!W(F)){F==="&"?M.state=N.ATTRIB_VALUE_ENTITY_U:M.attribValue+=F;continue}ar(M),F===">"?_r(M):M.state=N.ATTRIB;continue;case N.CLOSE_TAG:if(M.tagName)F===">"?Ri(M):Z(I,F)?M.tagName+=F:M.script?(M.script+="</"+M.tagName,M.tagName="",M.state=N.SCRIPT):(D(F)||pe(M,"Invalid tagname in closing tag"),M.state=N.CLOSE_TAG_SAW_WHITE);else{if(D(F))continue;oe(R,F)?M.script?(M.script+="</"+F,M.state=N.SCRIPT):pe(M,"Invalid tagname in closing tag."):M.tagName=F}continue;case N.CLOSE_TAG_SAW_WHITE:if(D(F))continue;F===">"?Ri(M):pe(M,"Invalid characters in closing tag");continue;case N.TEXT_ENTITY:case N.ATTRIB_VALUE_ENTITY_Q:case N.ATTRIB_VALUE_ENTITY_U:var tt,bt;switch(M.state){case N.TEXT_ENTITY:tt=N.TEXT,bt="textNode";break;case N.ATTRIB_VALUE_ENTITY_Q:tt=N.ATTRIB_VALUE_QUOTED,bt="attribValue";break;case N.ATTRIB_VALUE_ENTITY_U:tt=N.ATTRIB_VALUE_UNQUOTED,bt="attribValue";break}F===";"?(M[bt]+=zt(M),M.entity="",M.state=tt):Z(M.entity.length?k:A,F)?M.entity+=F:(pe(M,"Invalid character in entity name"),M[bt]+="&"+M.entity+F,M.entity="",M.state=tt);continue;default:throw new Error(M,"Unknown state: "+M.state)}return M.position>=M.bufferCheckPosition&&i(M),M}String.fromCodePoint||function(){var T=String.fromCharCode,M=Math.floor,G=function(){var F=16384,be=[],Qe,tt,bt=-1,Yt=arguments.length;if(!Yt)return"";for(var Sr="";++bt<Yt;){var je=Number(arguments[bt]);if(!isFinite(je)||je<0||je>1114111||M(je)!==je)throw RangeError("Invalid code point: "+je);je<=65535?be.push(je):(je-=65536,Qe=(je>>10)+55296,tt=je%1024+56320,be.push(Qe,tt)),(bt+1===Yt||be.length>F)&&(Sr+=T.apply(null,be),be.length=0)}return Sr};Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:G,configurable:!0,writable:!0}):String.fromCodePoint=G}()})(typeof Nh>"u"?Nh.sax={}:Nh)});var Hb=ee((m8,qb)=>{"use strict";qb.exports=Lh;Lh.polyline=Lh;Lh.polygon=ZR;function Lh(t,e,r){var i=t.length,n=Zo(t[0],e),o=[],a,h,d,m,p;for(r||(r=[]),a=1;a<i;a++){for(h=t[a-1],d=t[a],m=p=Zo(d,e);;)if(n|m){if(n&m)break;n?(h=ym(h,d,n,e),n=Zo(h,e)):(d=ym(h,d,m,e),m=Zo(d,e))}else{o.push(h),m!==p?(o.push(d),a<i-1&&(r.push(o),o=[])):a===i-1&&o.push(d);break}n=p}return o.length&&r.push(o),r}function ZR(t,e){var r,i,n,o,a,h,d;for(i=1;i<=8;i*=2){for(r=[],n=t[t.length-1],o=!(Zo(n,e)&i),a=0;a<t.length;a++)h=t[a],d=!(Zo(h,e)&i),d!==o&&r.push(ym(n,h,i,e)),d&&r.push(h),n=h,o=d;if(t=r,!t.length)break}return r}function ym(t,e,r,i){return r&8?[t[0]+(e[0]-t[0])*(i[3]-t[1])/(e[1]-t[1]),i[3]]:r&4?[t[0]+(e[0]-t[0])*(i[1]-t[1])/(e[1]-t[1]),i[1]]:r&2?[i[2],t[1]+(e[1]-t[1])*(i[2]-t[0])/(e[0]-t[0])]:r&1?[i[0],t[1]+(e[1]-t[1])*(i[0]-t[0])/(e[0]-t[0])]:null}function Zo(t,e){var r=0;return t[0]<e[0]?r|=1:t[0]>e[2]&&(r|=2),t[1]<e[1]?r|=4:t[1]>e[3]&&(r|=8),r}});var Gb=ee((bm,vm)=>{(function(t,e){typeof bm=="object"&&typeof vm<"u"?vm.exports=e():typeof define=="function"&&define.amd?define(e):t.SplayTree=e()})(bm,function(){"use strict";var t=function(){function C(R,I){this.next=null,this.key=R,this.data=I,this.left=null,this.right=null}return C}();function e(C,R){return C>R?1:C<R?-1:0}function r(C,R,I){for(var A=new t(null,null),k=A,D=A;;){var j=I(C,R.key);if(j<0){if(R.left===null)break;if(I(C,R.left.key)<0){var W=R.left;if(R.left=W.right,W.right=R,R=W,R.left===null)break}D.left=R,D=R,R=R.left}else if(j>0){if(R.right===null)break;if(I(C,R.right.key)>0){var W=R.right;if(R.right=W.left,W.left=R,R=W,R.right===null)break}k.right=R,k=R,R=R.right}else break}return k.right=R.left,D.left=R.right,R.left=A.right,R.right=A.left,R}function i(C,R,I,A){var k=new t(C,R);if(I===null)return k.left=k.right=null,k;I=r(C,I,A);var D=A(C,I.key);return D<0?(k.left=I.left,k.right=I,I.left=null):D>=0&&(k.right=I.right,k.left=I,I.right=null),k}function n(C,R,I){var A=null,k=null;if(R){R=r(C,R,I);var D=I(R.key,C);D===0?(A=R.left,k=R.right):D<0?(k=R.right,R.right=null,A=R):(A=R.left,R.left=null,k=R)}return{left:A,right:k}}function o(C,R,I){return R===null?C:(C===null||(R=r(C.key,R,I),R.left=C),R)}function a(C,R,I,A,k){if(C){A(""+R+(I?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ")+k(C)+`
113
- `);var D=R+(I?" ":"\u2502 ");C.left&&a(C.left,D,!1,A,k),C.right&&a(C.right,D,!0,A,k)}}var h=function(){function C(R){R===void 0&&(R=e),this._root=null,this._size=0,this._comparator=R}return C.prototype.insert=function(R,I){return this._size++,this._root=i(R,I,this._root,this._comparator)},C.prototype.add=function(R,I){var A=new t(R,I);this._root===null&&(A.left=A.right=null,this._size++,this._root=A);var k=this._comparator,D=r(R,this._root,k),j=k(R,D.key);return j===0?this._root=D:(j<0?(A.left=D.left,A.right=D,D.left=null):j>0&&(A.right=D.right,A.left=D,D.right=null),this._size++,this._root=A),this._root},C.prototype.remove=function(R){this._root=this._remove(R,this._root,this._comparator)},C.prototype._remove=function(R,I,A){var k;if(I===null)return null;I=r(R,I,A);var D=A(R,I.key);return D===0?(I.left===null?k=I.right:(k=r(R,I.left,A),k.right=I.right),this._size--,k):I},C.prototype.pop=function(){var R=this._root;if(R){for(;R.left;)R=R.left;return this._root=r(R.key,this._root,this._comparator),this._root=this._remove(R.key,this._root,this._comparator),{key:R.key,data:R.data}}return null},C.prototype.findStatic=function(R){for(var I=this._root,A=this._comparator;I;){var k=A(R,I.key);if(k===0)return I;k<0?I=I.left:I=I.right}return null},C.prototype.find=function(R){return this._root&&(this._root=r(R,this._root,this._comparator),this._comparator(R,this._root.key)!==0)?null:this._root},C.prototype.contains=function(R){for(var I=this._root,A=this._comparator;I;){var k=A(R,I.key);if(k===0)return!0;k<0?I=I.left:I=I.right}return!1},C.prototype.forEach=function(R,I){for(var A=this._root,k=[],D=!1;!D;)A!==null?(k.push(A),A=A.left):k.length!==0?(A=k.pop(),R.call(I,A),A=A.right):D=!0;return this},C.prototype.range=function(R,I,A,k){for(var D=[],j=this._comparator,W=this._root,Z;D.length!==0||W;)if(W)D.push(W),W=W.left;else{if(W=D.pop(),Z=j(W.key,I),Z>0)break;if(j(W.key,R)>=0&&A.call(k,W))return this;W=W.right}return this},C.prototype.keys=function(){var R=[];return this.forEach(function(I){var A=I.key;return R.push(A)}),R},C.prototype.values=function(){var R=[];return this.forEach(function(I){var A=I.data;return R.push(A)}),R},C.prototype.min=function(){return this._root?this.minNode(this._root).key:null},C.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},C.prototype.minNode=function(R){if(R===void 0&&(R=this._root),R)for(;R.left;)R=R.left;return R},C.prototype.maxNode=function(R){if(R===void 0&&(R=this._root),R)for(;R.right;)R=R.right;return R},C.prototype.at=function(R){for(var I=this._root,A=!1,k=0,D=[];!A;)if(I)D.push(I),I=I.left;else if(D.length>0){if(I=D.pop(),k===R)return I;k++,I=I.right}else A=!0;return null},C.prototype.next=function(R){var I=this._root,A=null;if(R.right){for(A=R.right;A.left;)A=A.left;return A}for(var k=this._comparator;I;){var D=k(R.key,I.key);if(D===0)break;D<0?(A=I,I=I.left):I=I.right}return A},C.prototype.prev=function(R){var I=this._root,A=null;if(R.left!==null){for(A=R.left;A.right;)A=A.right;return A}for(var k=this._comparator;I;){var D=k(R.key,I.key);if(D===0)break;D<0?I=I.left:(A=I,I=I.right)}return A},C.prototype.clear=function(){return this._root=null,this._size=0,this},C.prototype.toList=function(){return p(this._root)},C.prototype.load=function(R,I,A){I===void 0&&(I=[]),A===void 0&&(A=!1);var k=R.length,D=this._comparator;if(A&&_(R,I,0,k-1,D),this._root===null)this._root=d(R,I,0,k),this._size=k;else{var j=E(this.toList(),m(R,I),D);k=this._size+k,this._root=w({head:j},0,k)}return this},C.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(C.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(C.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),C.prototype.toString=function(R){R===void 0&&(R=function(A){return String(A.key)});var I=[];return a(this._root,"",!0,function(A){return I.push(A)},R),I.join("")},C.prototype.update=function(R,I,A){var k=this._comparator,D=n(R,this._root,k),j=D.left,W=D.right;k(R,I)<0?W=i(I,A,W,k):j=i(I,A,j,k),this._root=o(j,W,k)},C.prototype.split=function(R){return n(R,this._root,this._comparator)},C}();function d(C,R,I,A){var k=A-I;if(k>0){var D=I+Math.floor(k/2),j=C[D],W=R[D],Z=new t(j,W);return Z.left=d(C,R,I,D),Z.right=d(C,R,D+1,A),Z}return null}function m(C,R){for(var I=new t(null,null),A=I,k=0;k<C.length;k++)A=A.next=new t(C[k],R[k]);return A.next=null,I.next}function p(C){for(var R=C,I=[],A=!1,k=new t(null,null),D=k;!A;)R?(I.push(R),R=R.left):I.length>0?(R=D=D.next=I.pop(),R=R.right):A=!0;return D.next=null,k.next}function w(C,R,I){var A=I-R;if(A>0){var k=R+Math.floor(A/2),D=w(C,R,k),j=C.head;return j.left=D,C.head=C.head.next,j.right=w(C,k+1,I),j}return null}function E(C,R,I){for(var A=new t(null,null),k=A,D=C,j=R;D!==null&&j!==null;)I(D.key,j.key)<0?(k.next=D,D=D.next):(k.next=j,j=j.next),k=k.next;return D!==null?k.next=D:j!==null&&(k.next=j),A.next}function _(C,R,I,A,k){if(!(I>=A)){for(var D=C[I+A>>1],j=I-1,W=A+1;;){do j++;while(k(C[j],D)<0);do W--;while(k(C[W],D)>0);if(j>=W)break;var Z=C[j];C[j]=C[W],C[W]=Z,Z=R[j],R[j]=R[W],R[W]=Z}_(C,R,I,W,k),_(C,R,W+1,A,k)}}return h})});var nv=ee((p8,iv)=>{"use strict";var XR=Gb();function JR(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var Sm=JR(XR);function Nr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Vb(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function qt(t,e,r){return e&&Vb(t.prototype,e),r&&Vb(t,r),t}var ml=function(e,r){return e.ll.x<=r.x&&r.x<=e.ur.x&&e.ll.y<=r.y&&r.y<=e.ur.y},wm=function(e,r){if(r.ur.x<e.ll.x||e.ur.x<r.ll.x||r.ur.y<e.ll.y||e.ur.y<r.ll.y)return null;var i=e.ll.x<r.ll.x?r.ll.x:e.ll.x,n=e.ur.x<r.ur.x?e.ur.x:r.ur.x,o=e.ll.y<r.ll.y?r.ll.y:e.ll.y,a=e.ur.y<r.ur.y?e.ur.y:r.ur.y;return{ll:{x:i,y:o},ur:{x:n,y:a}}},Cn=Number.EPSILON;Cn===void 0&&(Cn=Math.pow(2,-52));var QR=Cn*Cn,_m=function(e,r){if(-Cn<e&&e<Cn&&-Cn<r&&r<Cn)return 0;var i=e-r;return i*i<QR*e*r?0:e<r?-1:1},eC=function(){function t(){Nr(this,t),this.reset()}return qt(t,[{key:"reset",value:function(){this.xRounder=new Kb,this.yRounder=new Kb}},{key:"round",value:function(r,i){return{x:this.xRounder.round(r),y:this.yRounder.round(i)}}}]),t}(),Kb=function(){function t(){Nr(this,t),this.tree=new Sm.default,this.round(0)}return qt(t,[{key:"round",value:function(r){var i=this.tree.add(r),n=this.tree.prev(i);if(n!==null&&_m(i.key,n.key)===0)return this.tree.remove(r),n.key;var o=this.tree.next(i);return o!==null&&_m(i.key,o.key)===0?(this.tree.remove(r),o.key):r}}]),t}(),gl=new eC,pl=function(e,r){return e.x*r.y-e.y*r.x},rv=function(e,r){return e.x*r.x+e.y*r.y},Yb=function(e,r,i){var n={x:r.x-e.x,y:r.y-e.y},o={x:i.x-e.x,y:i.y-e.y},a=pl(n,o);return _m(a,0)},Dh=function(e){return Math.sqrt(rv(e,e))},tC=function(e,r,i){var n={x:r.x-e.x,y:r.y-e.y},o={x:i.x-e.x,y:i.y-e.y};return pl(o,n)/Dh(o)/Dh(n)},rC=function(e,r,i){var n={x:r.x-e.x,y:r.y-e.y},o={x:i.x-e.x,y:i.y-e.y};return rv(o,n)/Dh(o)/Dh(n)},Zb=function(e,r,i){return r.y===0?null:{x:e.x+r.x/r.y*(i-e.y),y:i}},Xb=function(e,r,i){return r.x===0?null:{x:i,y:e.y+r.y/r.x*(i-e.x)}},iC=function(e,r,i,n){if(r.x===0)return Xb(i,n,e.x);if(n.x===0)return Xb(e,r,i.x);if(r.y===0)return Zb(i,n,e.y);if(n.y===0)return Zb(e,r,i.y);var o=pl(r,n);if(o==0)return null;var a={x:i.x-e.x,y:i.y-e.y},h=pl(a,r)/o,d=pl(a,n)/o,m=e.x+d*r.x,p=i.x+h*n.x,w=e.y+d*r.y,E=i.y+h*n.y,_=(m+p)/2,C=(w+E)/2;return{x:_,y:C}},_i=function(){qt(t,null,[{key:"compare",value:function(r,i){var n=t.comparePoints(r.point,i.point);return n!==0?n:(r.point!==i.point&&r.link(i),r.isLeft!==i.isLeft?r.isLeft?1:-1:Bh.compare(r.segment,i.segment))}},{key:"comparePoints",value:function(r,i){return r.x<i.x?-1:r.x>i.x?1:r.y<i.y?-1:r.y>i.y?1:0}}]);function t(e,r){Nr(this,t),e.events===void 0?e.events=[this]:e.events.push(this),this.point=e,this.isLeft=r}return qt(t,[{key:"link",value:function(r){if(r.point===this.point)throw new Error("Tried to link already linked events");for(var i=r.point.events,n=0,o=i.length;n<o;n++){var a=i[n];this.point.events.push(a),a.point=this.point}this.checkForConsuming()}},{key:"checkForConsuming",value:function(){for(var r=this.point.events.length,i=0;i<r;i++){var n=this.point.events[i];if(n.segment.consumedBy===void 0)for(var o=i+1;o<r;o++){var a=this.point.events[o];a.consumedBy===void 0&&n.otherSE.point.events===a.otherSE.point.events&&n.segment.consume(a.segment)}}}},{key:"getAvailableLinkedEvents",value:function(){for(var r=[],i=0,n=this.point.events.length;i<n;i++){var o=this.point.events[i];o!==this&&!o.segment.ringOut&&o.segment.isInResult()&&r.push(o)}return r}},{key:"getLeftmostComparator",value:function(r){var i=this,n=new Map,o=function(h){var d=h.otherSE;n.set(h,{sine:tC(i.point,r.point,d.point),cosine:rC(i.point,r.point,d.point)})};return function(a,h){n.has(a)||o(a),n.has(h)||o(h);var d=n.get(a),m=d.sine,p=d.cosine,w=n.get(h),E=w.sine,_=w.cosine;return m>=0&&E>=0?p<_?1:p>_?-1:0:m<0&&E<0?p<_?-1:p>_?1:0:E<m?-1:E>m?1:0}}}]),t}(),nC=0,Bh=function(){qt(t,null,[{key:"compare",value:function(r,i){var n=r.leftSE.point.x,o=i.leftSE.point.x,a=r.rightSE.point.x,h=i.rightSE.point.x;if(h<n)return 1;if(a<o)return-1;var d=r.leftSE.point.y,m=i.leftSE.point.y,p=r.rightSE.point.y,w=i.rightSE.point.y;if(n<o){if(m<d&&m<p)return 1;if(m>d&&m>p)return-1;var E=r.comparePoint(i.leftSE.point);if(E<0)return 1;if(E>0)return-1;var _=i.comparePoint(r.rightSE.point);return _!==0?_:-1}if(n>o){if(d<m&&d<w)return-1;if(d>m&&d>w)return 1;var C=i.comparePoint(r.leftSE.point);if(C!==0)return C;var R=r.comparePoint(i.rightSE.point);return R<0?1:R>0?-1:1}if(d<m)return-1;if(d>m)return 1;if(a<h){var I=i.comparePoint(r.rightSE.point);if(I!==0)return I}if(a>h){var A=r.comparePoint(i.rightSE.point);if(A<0)return 1;if(A>0)return-1}if(a!==h){var k=p-d,D=a-n,j=w-m,W=h-o;if(k>D&&j<W)return 1;if(k<D&&j>W)return-1}return a>h?1:a<h||p<w?-1:p>w?1:r.id<i.id?-1:r.id>i.id?1:0}}]);function t(e,r,i,n){Nr(this,t),this.id=++nC,this.leftSE=e,e.segment=this,e.otherSE=r,this.rightSE=r,r.segment=this,r.otherSE=e,this.rings=i,this.windings=n}return qt(t,[{key:"replaceRightSE",value:function(r){this.rightSE=r,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}},{key:"bbox",value:function(){var r=this.leftSE.point.y,i=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:r<i?r:i},ur:{x:this.rightSE.point.x,y:r>i?r:i}}}},{key:"vector",value:function(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}},{key:"isAnEndpoint",value:function(r){return r.x===this.leftSE.point.x&&r.y===this.leftSE.point.y||r.x===this.rightSE.point.x&&r.y===this.rightSE.point.y}},{key:"comparePoint",value:function(r){if(this.isAnEndpoint(r))return 0;var i=this.leftSE.point,n=this.rightSE.point,o=this.vector();if(i.x===n.x)return r.x===i.x?0:r.x<i.x?1:-1;var a=(r.y-i.y)/o.y,h=i.x+a*o.x;if(r.x===h)return 0;var d=(r.x-i.x)/o.x,m=i.y+d*o.y;return r.y===m?0:r.y<m?-1:1}},{key:"getIntersection",value:function(r){var i=this.bbox(),n=r.bbox(),o=wm(i,n);if(o===null)return null;var a=this.leftSE.point,h=this.rightSE.point,d=r.leftSE.point,m=r.rightSE.point,p=ml(i,d)&&this.comparePoint(d)===0,w=ml(n,a)&&r.comparePoint(a)===0,E=ml(i,m)&&this.comparePoint(m)===0,_=ml(n,h)&&r.comparePoint(h)===0;if(w&&p)return _&&!E?h:!_&&E?m:null;if(w)return E&&a.x===m.x&&a.y===m.y?null:a;if(p)return _&&h.x===d.x&&h.y===d.y?null:d;if(_&&E)return null;if(_)return h;if(E)return m;var C=iC(a,this.vector(),d,r.vector());return C===null||!ml(o,C)?null:gl.round(C.x,C.y)}},{key:"split",value:function(r){var i=[],n=r.events!==void 0,o=new _i(r,!0),a=new _i(r,!1),h=this.rightSE;this.replaceRightSE(a),i.push(a),i.push(o);var d=new t(o,h,this.rings.slice(),this.windings.slice());return _i.comparePoints(d.leftSE.point,d.rightSE.point)>0&&d.swapEvents(),_i.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),n&&(o.checkForConsuming(),a.checkForConsuming()),i}},{key:"swapEvents",value:function(){var r=this.rightSE;this.rightSE=this.leftSE,this.leftSE=r,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(var i=0,n=this.windings.length;i<n;i++)this.windings[i]*=-1}},{key:"consume",value:function(r){for(var i=this,n=r;i.consumedBy;)i=i.consumedBy;for(;n.consumedBy;)n=n.consumedBy;var o=t.compare(i,n);if(o!==0){if(o>0){var a=i;i=n,n=a}if(i.prev===n){var h=i;i=n,n=h}for(var d=0,m=n.rings.length;d<m;d++){var p=n.rings[d],w=n.windings[d],E=i.rings.indexOf(p);E===-1?(i.rings.push(p),i.windings.push(w)):i.windings[E]+=w}n.rings=null,n.windings=null,n.consumedBy=i,n.leftSE.consumedBy=i.leftSE,n.rightSE.consumedBy=i.rightSE}}},{key:"prevInResult",value:function(){return this._prevInResult!==void 0?this._prevInResult:(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null,this._prevInResult)}},{key:"beforeState",value:function(){if(this._beforeState!==void 0)return this._beforeState;if(!this.prev)this._beforeState={rings:[],windings:[],multiPolys:[]};else{var r=this.prev.consumedBy||this.prev;this._beforeState=r.afterState()}return this._beforeState}},{key:"afterState",value:function(){if(this._afterState!==void 0)return this._afterState;var r=this.beforeState();this._afterState={rings:r.rings.slice(0),windings:r.windings.slice(0),multiPolys:[]};for(var i=this._afterState.rings,n=this._afterState.windings,o=this._afterState.multiPolys,a=0,h=this.rings.length;a<h;a++){var d=this.rings[a],m=this.windings[a],p=i.indexOf(d);p===-1?(i.push(d),n.push(m)):n[p]+=m}for(var w=[],E=[],_=0,C=i.length;_<C;_++)if(n[_]!==0){var R=i[_],I=R.poly;if(E.indexOf(I)===-1)if(R.isExterior)w.push(I);else{E.indexOf(I)===-1&&E.push(I);var A=w.indexOf(R.poly);A!==-1&&w.splice(A,1)}}for(var k=0,D=w.length;k<D;k++){var j=w[k].multiPoly;o.indexOf(j)===-1&&o.push(j)}return this._afterState}},{key:"isInResult",value:function(){if(this.consumedBy)return!1;if(this._isInResult!==void 0)return this._isInResult;var r=this.beforeState().multiPolys,i=this.afterState().multiPolys;switch(Vr.type){case"union":{var n=r.length===0,o=i.length===0;this._isInResult=n!==o;break}case"intersection":{var a,h;r.length<i.length?(a=r.length,h=i.length):(a=i.length,h=r.length),this._isInResult=h===Vr.numMultiPolys&&a<h;break}case"xor":{var d=Math.abs(r.length-i.length);this._isInResult=d%2===1;break}case"difference":{var m=function(w){return w.length===1&&w[0].isSubject};this._isInResult=m(r)!==m(i);break}default:throw new Error("Unrecognized operation type found ".concat(Vr.type))}return this._isInResult}}],[{key:"fromRing",value:function(r,i,n){var o,a,h,d=_i.comparePoints(r,i);if(d<0)o=r,a=i,h=1;else if(d>0)o=i,a=r,h=-1;else throw new Error("Tried to create degenerate segment at [".concat(r.x,", ").concat(r.y,"]"));var m=new _i(o,!0),p=new _i(a,!1);return new t(m,p,[n],[h])}}]),t}(),Jb=function(){function t(e,r,i){if(Nr(this,t),!Array.isArray(e)||e.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=r,this.isExterior=i,this.segments=[],typeof e[0][0]!="number"||typeof e[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var n=gl.round(e[0][0],e[0][1]);this.bbox={ll:{x:n.x,y:n.y},ur:{x:n.x,y:n.y}};for(var o=n,a=1,h=e.length;a<h;a++){if(typeof e[a][0]!="number"||typeof e[a][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var d=gl.round(e[a][0],e[a][1]);d.x===o.x&&d.y===o.y||(this.segments.push(Bh.fromRing(o,d,this)),d.x<this.bbox.ll.x&&(this.bbox.ll.x=d.x),d.y<this.bbox.ll.y&&(this.bbox.ll.y=d.y),d.x>this.bbox.ur.x&&(this.bbox.ur.x=d.x),d.y>this.bbox.ur.y&&(this.bbox.ur.y=d.y),o=d)}(n.x!==o.x||n.y!==o.y)&&this.segments.push(Bh.fromRing(o,n,this))}return qt(t,[{key:"getSweepEvents",value:function(){for(var r=[],i=0,n=this.segments.length;i<n;i++){var o=this.segments[i];r.push(o.leftSE),r.push(o.rightSE)}return r}}]),t}(),sC=function(){function t(e,r){if(Nr(this,t),!Array.isArray(e))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new Jb(e[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(var i=1,n=e.length;i<n;i++){var o=new Jb(e[i],this,!1);o.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=o.bbox.ll.x),o.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=o.bbox.ll.y),o.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=o.bbox.ur.x),o.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=o.bbox.ur.y),this.interiorRings.push(o)}this.multiPoly=r}return qt(t,[{key:"getSweepEvents",value:function(){for(var r=this.exteriorRing.getSweepEvents(),i=0,n=this.interiorRings.length;i<n;i++)for(var o=this.interiorRings[i].getSweepEvents(),a=0,h=o.length;a<h;a++)r.push(o[a]);return r}}]),t}(),Qb=function(){function t(e,r){if(Nr(this,t),!Array.isArray(e))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{typeof e[0][0][0]=="number"&&(e=[e])}catch{}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(var i=0,n=e.length;i<n;i++){var o=new sC(e[i],this);o.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=o.bbox.ll.x),o.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=o.bbox.ll.y),o.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=o.bbox.ur.x),o.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=o.bbox.ur.y),this.polys.push(o)}this.isSubject=r}return qt(t,[{key:"getSweepEvents",value:function(){for(var r=[],i=0,n=this.polys.length;i<n;i++)for(var o=this.polys[i].getSweepEvents(),a=0,h=o.length;a<h;a++)r.push(o[a]);return r}}]),t}(),oC=function(){qt(t,null,[{key:"factory",value:function(r){for(var i=[],n=0,o=r.length;n<o;n++){var a=r[n];if(!(!a.isInResult()||a.ringOut)){for(var h=null,d=a.leftSE,m=a.rightSE,p=[d],w=d.point,E=[];h=d,d=m,p.push(d),d.point!==w;)for(;;){var _=d.getAvailableLinkedEvents();if(_.length===0){var C=p[0].point,R=p[p.length-1].point;throw new Error("Unable to complete output ring starting at [".concat(C.x,",")+" ".concat(C.y,"]. Last matching segment found ends at")+" [".concat(R.x,", ").concat(R.y,"]."))}if(_.length===1){m=_[0].otherSE;break}for(var I=null,A=0,k=E.length;A<k;A++)if(E[A].point===d.point){I=A;break}if(I!==null){var D=E.splice(I)[0],j=p.splice(D.index);j.unshift(j[0].otherSE),i.push(new t(j.reverse()));continue}E.push({index:p.length,point:d.point});var W=d.getLeftmostComparator(h);m=_.sort(W)[0].otherSE;break}i.push(new t(p))}}return i}}]);function t(e){Nr(this,t),this.events=e;for(var r=0,i=e.length;r<i;r++)e[r].segment.ringOut=this;this.poly=null}return qt(t,[{key:"getGeom",value:function(){for(var r=this.events[0].point,i=[r],n=1,o=this.events.length-1;n<o;n++){var a=this.events[n].point,h=this.events[n+1].point;Yb(a,r,h)!==0&&(i.push(a),r=a)}if(i.length===1)return null;var d=i[0],m=i[1];Yb(d,r,m)===0&&i.shift(),i.push(i[0]);for(var p=this.isExteriorRing()?1:-1,w=this.isExteriorRing()?0:i.length-1,E=this.isExteriorRing()?i.length:-1,_=[],C=w;C!=E;C+=p)_.push([i[C].x,i[C].y]);return _}},{key:"isExteriorRing",value:function(){if(this._isExteriorRing===void 0){var r=this.enclosingRing();this._isExteriorRing=r?!r.isExteriorRing():!0}return this._isExteriorRing}},{key:"enclosingRing",value:function(){return this._enclosingRing===void 0&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}},{key:"_calcEnclosingRing",value:function(){for(var r=this.events[0],i=1,n=this.events.length;i<n;i++){var o=this.events[i];_i.compare(r,o)>0&&(r=o)}for(var a=r.segment.prevInResult(),h=a?a.prevInResult():null;;){if(!a)return null;if(!h)return a.ringOut;if(h.ringOut!==a.ringOut)return h.ringOut.enclosingRing()!==a.ringOut?a.ringOut:a.ringOut.enclosingRing();a=h.prevInResult(),h=a?a.prevInResult():null}}}]),t}(),ev=function(){function t(e){Nr(this,t),this.exteriorRing=e,e.poly=this,this.interiorRings=[]}return qt(t,[{key:"addInterior",value:function(r){this.interiorRings.push(r),r.poly=this}},{key:"getGeom",value:function(){var r=[this.exteriorRing.getGeom()];if(r[0]===null)return null;for(var i=0,n=this.interiorRings.length;i<n;i++){var o=this.interiorRings[i].getGeom();o!==null&&r.push(o)}return r}}]),t}(),aC=function(){function t(e){Nr(this,t),this.rings=e,this.polys=this._composePolys(e)}return qt(t,[{key:"getGeom",value:function(){for(var r=[],i=0,n=this.polys.length;i<n;i++){var o=this.polys[i].getGeom();o!==null&&r.push(o)}return r}},{key:"_composePolys",value:function(r){for(var i=[],n=0,o=r.length;n<o;n++){var a=r[n];if(!a.poly)if(a.isExteriorRing())i.push(new ev(a));else{var h=a.enclosingRing();h.poly||i.push(new ev(h)),h.poly.addInterior(a)}}return i}}]),t}(),lC=function(){function t(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Bh.compare;Nr(this,t),this.queue=e,this.tree=new Sm.default(r),this.segments=[]}return qt(t,[{key:"process",value:function(r){var i=r.segment,n=[];if(r.consumedBy)return r.isLeft?this.queue.remove(r.otherSE):this.tree.remove(i),n;var o=r.isLeft?this.tree.insert(i):this.tree.find(i);if(!o)throw new Error("Unable to find segment #".concat(i.id," ")+"[".concat(i.leftSE.point.x,", ").concat(i.leftSE.point.y,"] -> ")+"[".concat(i.rightSE.point.x,", ").concat(i.rightSE.point.y,"] ")+"in SweepLine tree. Please submit a bug report.");for(var a=o,h=o,d=void 0,m=void 0;d===void 0;)a=this.tree.prev(a),a===null?d=null:a.key.consumedBy===void 0&&(d=a.key);for(;m===void 0;)h=this.tree.next(h),h===null?m=null:h.key.consumedBy===void 0&&(m=h.key);if(r.isLeft){var p=null;if(d){var w=d.getIntersection(i);if(w!==null&&(i.isAnEndpoint(w)||(p=w),!d.isAnEndpoint(w)))for(var E=this._splitSafely(d,w),_=0,C=E.length;_<C;_++)n.push(E[_])}var R=null;if(m){var I=m.getIntersection(i);if(I!==null&&(i.isAnEndpoint(I)||(R=I),!m.isAnEndpoint(I)))for(var A=this._splitSafely(m,I),k=0,D=A.length;k<D;k++)n.push(A[k])}if(p!==null||R!==null){var j=null;if(p===null)j=R;else if(R===null)j=p;else{var W=_i.comparePoints(p,R);j=W<=0?p:R}this.queue.remove(i.rightSE),n.push(i.rightSE);for(var Z=i.split(j),oe=0,N=Z.length;oe<N;oe++)n.push(Z[oe])}n.length>0?(this.tree.remove(i),n.push(r)):(this.segments.push(i),i.prev=d)}else{if(d&&m){var Oe=d.getIntersection(m);if(Oe!==null){if(!d.isAnEndpoint(Oe))for(var Pe=this._splitSafely(d,Oe),ae=0,ze=Pe.length;ae<ze;ae++)n.push(Pe[ae]);if(!m.isAnEndpoint(Oe))for(var ot=this._splitSafely(m,Oe),mt=0,or=ot.length;mt<or;mt++)n.push(ot[mt])}}this.tree.remove(i)}return n}},{key:"_splitSafely",value:function(r,i){this.tree.remove(r);var n=r.rightSE;this.queue.remove(n);var o=r.split(i);return o.push(n),r.consumedBy===void 0&&this.tree.insert(r),o}}]),t}(),tv=typeof process<"u"&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,uC=typeof process<"u"&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6,hC=function(){function t(){Nr(this,t)}return qt(t,[{key:"run",value:function(r,i,n){Vr.type=r,gl.reset();for(var o=[new Qb(i,!0)],a=0,h=n.length;a<h;a++)o.push(new Qb(n[a],!1));if(Vr.numMultiPolys=o.length,Vr.type==="difference")for(var d=o[0],m=1;m<o.length;)wm(o[m].bbox,d.bbox)!==null?m++:o.splice(m,1);if(Vr.type==="intersection"){for(var p=0,w=o.length;p<w;p++)for(var E=o[p],_=p+1,C=o.length;_<C;_++)if(wm(E.bbox,o[_].bbox)===null)return[]}for(var R=new Sm.default(_i.compare),I=0,A=o.length;I<A;I++)for(var k=o[I].getSweepEvents(),D=0,j=k.length;D<j;D++)if(R.insert(k[D]),R.size>tv)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");for(var W=new lC(R),Z=R.size,oe=R.pop();oe;){var N=oe.key;if(R.size===Z){var Oe=N.segment;throw new Error("Unable to pop() ".concat(N.isLeft?"left":"right"," SweepEvent ")+"[".concat(N.point.x,", ").concat(N.point.y,"] from segment #").concat(Oe.id," ")+"[".concat(Oe.leftSE.point.x,", ").concat(Oe.leftSE.point.y,"] -> ")+"[".concat(Oe.rightSE.point.x,", ").concat(Oe.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(R.size>tv)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(W.segments.length>uC)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var Pe=W.process(N),ae=0,ze=Pe.length;ae<ze;ae++){var ot=Pe[ae];ot.consumedBy===void 0&&R.insert(ot)}Z=R.size,oe=R.pop()}gl.reset();var mt=oC.factory(W.segments),or=new aC(mt);return or.getGeom()}}]),t}(),Vr=new hC,cC=function(e){for(var r=arguments.length,i=new Array(r>1?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];return Vr.run("union",e,i)},fC=function(e){for(var r=arguments.length,i=new Array(r>1?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];return Vr.run("intersection",e,i)},dC=function(e){for(var r=arguments.length,i=new Array(r>1?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];return Vr.run("xor",e,i)},mC=function(e){for(var r=arguments.length,i=new Array(r>1?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];return Vr.run("difference",e,i)},pC={union:cC,intersection:fC,xor:dC,difference:mC};iv.exports=pC});var cv=ee((Em,Mm)=>{(function(t,e){typeof Em=="object"&&typeof Mm<"u"?Mm.exports=e():typeof define=="function"&&define.amd?define(e):t.proj4=e()})(Em,function(){"use strict";var t=function(s){s("EPSG:4326","+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees"),s("EPSG:4269","+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees"),s("EPSG:3857","+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs"),s.WGS84=s["EPSG:4326"],s["EPSG:3785"]=s["EPSG:3857"],s.GOOGLE=s["EPSG:3857"],s["EPSG:900913"]=s["EPSG:3857"],s["EPSG:102113"]=s["EPSG:3857"]},e=1,r=2,i=4,n=5,o=484813681109536e-20,a=Math.PI/2,h=.16666666666666666,d=.04722222222222222,m=.022156084656084655,p=1e-10,w=.017453292519943295,E=57.29577951308232,_=Math.PI/4,C=Math.PI*2,R=3.14159265359,I={};I.greenwich=0,I.lisbon=-9.131906111111,I.paris=2.337229166667,I.bogota=-74.080916666667,I.madrid=-3.687938888889,I.rome=12.452333333333,I.bern=7.439583333333,I.jakarta=106.807719444444,I.ferro=-17.666666666667,I.brussels=4.367975,I.stockholm=18.058277777778,I.athens=23.7163375,I.oslo=10.722916666667;var A={ft:{to_meter:.3048},"us-ft":{to_meter:1200/3937}},k=/[\s_\-\/\(\)]/g;function D(s,u){if(s[u])return s[u];for(var c=Object.keys(s),y=u.toLowerCase().replace(k,""),g=-1,v,S;++g<c.length;)if(v=c[g],S=v.toLowerCase().replace(k,""),S===y)return s[v]}var j=function(s){var u={},c=s.split("+").map(function(x){return x.trim()}).filter(function(x){return x}).reduce(function(x,P){var L=P.split("=");return L.push(!0),x[L[0].toLowerCase()]=L[1],x},{}),y,g,v,S={proj:"projName",datum:"datumCode",rf:function(x){u.rf=parseFloat(x)},lat_0:function(x){u.lat0=x*w},lat_1:function(x){u.lat1=x*w},lat_2:function(x){u.lat2=x*w},lat_ts:function(x){u.lat_ts=x*w},lon_0:function(x){u.long0=x*w},lon_1:function(x){u.long1=x*w},lon_2:function(x){u.long2=x*w},alpha:function(x){u.alpha=parseFloat(x)*w},lonc:function(x){u.longc=x*w},x_0:function(x){u.x0=parseFloat(x)},y_0:function(x){u.y0=parseFloat(x)},k_0:function(x){u.k0=parseFloat(x)},k:function(x){u.k0=parseFloat(x)},a:function(x){u.a=parseFloat(x)},b:function(x){u.b=parseFloat(x)},r_a:function(){u.R_A=!0},zone:function(x){u.zone=parseInt(x,10)},south:function(){u.utmSouth=!0},towgs84:function(x){u.datum_params=x.split(",").map(function(P){return parseFloat(P)})},to_meter:function(x){u.to_meter=parseFloat(x)},units:function(x){u.units=x;var P=D(A,x);P&&(u.to_meter=P.to_meter)},from_greenwich:function(x){u.from_greenwich=x*w},pm:function(x){var P=D(I,x);u.from_greenwich=(P||parseFloat(x))*w},nadgrids:function(x){x==="@null"?u.datumCode="none":u.nadgrids=x},axis:function(x){var P="ewnsud";x.length===3&&P.indexOf(x.substr(0,1))!==-1&&P.indexOf(x.substr(1,1))!==-1&&P.indexOf(x.substr(2,1))!==-1&&(u.axis=x)}};for(y in c)g=c[y],y in S?(v=S[y],typeof v=="function"?v(g):u[v]=g):u[y]=g;return typeof u.datumCode=="string"&&u.datumCode!=="WGS84"&&(u.datumCode=u.datumCode.toLowerCase()),u},W=1,Z=2,oe=3,N=4,Oe=5,Pe=-1,ae=/\s/,ze=/[A-Za-z]/,ot=/[A-Za-z84]/,mt=/[,\]]/,or=/[\d\.E\-\+]/;function pe(s){if(typeof s!="string")throw new Error("not a string");this.text=s.trim(),this.level=0,this.place=0,this.root=null,this.stack=[],this.currentObject=null,this.state=W}pe.prototype.readCharicter=function(){var s=this.text[this.place++];if(this.state!==N)for(;ae.test(s);){if(this.place>=this.text.length)return;s=this.text[this.place++]}switch(this.state){case W:return this.neutral(s);case Z:return this.keyword(s);case N:return this.quoted(s);case Oe:return this.afterquote(s);case oe:return this.number(s);case Pe:return}},pe.prototype.afterquote=function(s){if(s==='"'){this.word+='"',this.state=N;return}if(mt.test(s)){this.word=this.word.trim(),this.afterItem(s);return}throw new Error(`havn't handled "`+s+'" in afterquote yet, index '+this.place)},pe.prototype.afterItem=function(s){if(s===","){this.word!==null&&this.currentObject.push(this.word),this.word=null,this.state=W;return}if(s==="]"){this.level--,this.word!==null&&(this.currentObject.push(this.word),this.word=null),this.state=W,this.currentObject=this.stack.pop(),this.currentObject||(this.state=Pe);return}},pe.prototype.number=function(s){if(or.test(s)){this.word+=s;return}if(mt.test(s)){this.word=parseFloat(this.word),this.afterItem(s);return}throw new Error(`havn't handled "`+s+'" in number yet, index '+this.place)},pe.prototype.quoted=function(s){if(s==='"'){this.state=Oe;return}this.word+=s},pe.prototype.keyword=function(s){if(ot.test(s)){this.word+=s;return}if(s==="["){var u=[];u.push(this.word),this.level++,this.root===null?this.root=u:this.currentObject.push(u),this.stack.push(this.currentObject),this.currentObject=u,this.state=W;return}if(mt.test(s)){this.afterItem(s);return}throw new Error(`havn't handled "`+s+'" in keyword yet, index '+this.place)},pe.prototype.neutral=function(s){if(ze.test(s)){this.word=s,this.state=Z;return}if(s==='"'){this.word="",this.state=N;return}if(or.test(s)){this.word=s,this.state=oe;return}if(mt.test(s)){this.afterItem(s);return}throw new Error(`havn't handled "`+s+'" in neutral yet, index '+this.place)},pe.prototype.output=function(){for(;this.place<this.text.length;)this.readCharicter();if(this.state===Pe)return this.root;throw new Error('unable to parse string "'+this.text+'". State is '+this.state)};function sa(s){var u=new pe(s);return u.output()}function Mi(s,u,c){Array.isArray(u)&&(c.unshift(u),u=null);var y=u?{}:s,g=c.reduce(function(v,S){return ar(S,v),v},y);u&&(s[u]=g)}function ar(s,u){if(!Array.isArray(s)){u[s]=!0;return}var c=s.shift();if(c==="PARAMETER"&&(c=s.shift()),s.length===1){if(Array.isArray(s[0])){u[c]={},ar(s[0],u[c]);return}u[c]=s[0];return}if(!s.length){u[c]=!0;return}if(c==="TOWGS84"){u[c]=s;return}if(c==="AXIS"){c in u||(u[c]=[]),u[c].push(s);return}Array.isArray(c)||(u[c]={});var y;switch(c){case"UNIT":case"PRIMEM":case"VERT_DATUM":u[c]={name:s[0].toLowerCase(),convert:s[1]},s.length===3&&ar(s[2],u[c]);return;case"SPHEROID":case"ELLIPSOID":u[c]={name:s[0],a:s[1],rf:s[2]},s.length===4&&ar(s[3],u[c]);return;case"PROJECTEDCRS":case"PROJCRS":case"GEOGCS":case"GEOCCS":case"PROJCS":case"LOCAL_CS":case"GEODCRS":case"GEODETICCRS":case"GEODETICDATUM":case"EDATUM":case"ENGINEERINGDATUM":case"VERT_CS":case"VERTCRS":case"VERTICALCRS":case"COMPD_CS":case"COMPOUNDCRS":case"ENGINEERINGCRS":case"ENGCRS":case"FITTED_CS":case"LOCAL_DATUM":case"DATUM":s[0]=["name",s[0]],Mi(u,c,s);return;default:for(y=-1;++y<s.length;)if(!Array.isArray(s[y]))return ar(s,u[c]);return Mi(u,c,s)}}var _r=.017453292519943295;function Ri(s,u){var c=u[0],y=u[1];!(c in s)&&y in s&&(s[c]=s[y],u.length===3&&(s[c]=u[2](s[c])))}function zt(s){return s*_r}function Ln(s){if(s.type==="GEOGCS"?s.projName="longlat":s.type==="LOCAL_CS"?(s.projName="identity",s.local=!0):typeof s.PROJECTION=="object"?s.projName=Object.keys(s.PROJECTION)[0]:s.projName=s.PROJECTION,s.AXIS){for(var u="",c=0,y=s.AXIS.length;c<y;++c){var g=s.AXIS[c],v=g[0].toLowerCase();v.indexOf("north")!==-1?u+="n":v.indexOf("south")!==-1?u+="s":v.indexOf("east")!==-1?u+="e":v.indexOf("west")!==-1&&(u+="w")}u.length===2&&(u+="u"),u.length===3&&(s.axis=u)}s.UNIT&&(s.units=s.UNIT.name.toLowerCase(),s.units==="metre"&&(s.units="meter"),s.UNIT.convert&&(s.type==="GEOGCS"?s.DATUM&&s.DATUM.SPHEROID&&(s.to_meter=s.UNIT.convert*s.DATUM.SPHEROID.a):s.to_meter=s.UNIT.convert));var S=s.GEOGCS;s.type==="GEOGCS"&&(S=s),S&&(S.DATUM?s.datumCode=S.DATUM.name.toLowerCase():s.datumCode=S.name.toLowerCase(),s.datumCode.slice(0,2)==="d_"&&(s.datumCode=s.datumCode.slice(2)),(s.datumCode==="new_zealand_geodetic_datum_1949"||s.datumCode==="new_zealand_1949")&&(s.datumCode="nzgd49"),(s.datumCode==="wgs_1984"||s.datumCode==="world_geodetic_system_1984")&&(s.PROJECTION==="Mercator_Auxiliary_Sphere"&&(s.sphere=!0),s.datumCode="wgs84"),s.datumCode.slice(-6)==="_ferro"&&(s.datumCode=s.datumCode.slice(0,-6)),s.datumCode.slice(-8)==="_jakarta"&&(s.datumCode=s.datumCode.slice(0,-8)),~s.datumCode.indexOf("belge")&&(s.datumCode="rnb72"),S.DATUM&&S.DATUM.SPHEROID&&(s.ellps=S.DATUM.SPHEROID.name.replace("_19","").replace(/[Cc]larke\_18/,"clrk"),s.ellps.toLowerCase().slice(0,13)==="international"&&(s.ellps="intl"),s.a=S.DATUM.SPHEROID.a,s.rf=parseFloat(S.DATUM.SPHEROID.rf,10)),S.DATUM&&S.DATUM.TOWGS84&&(s.datum_params=S.DATUM.TOWGS84),~s.datumCode.indexOf("osgb_1936")&&(s.datumCode="osgb36"),~s.datumCode.indexOf("osni_1952")&&(s.datumCode="osni52"),(~s.datumCode.indexOf("tm65")||~s.datumCode.indexOf("geodetic_datum_of_1965"))&&(s.datumCode="ire65"),s.datumCode==="ch1903+"&&(s.datumCode="ch1903"),~s.datumCode.indexOf("israel")&&(s.datumCode="isr93")),s.b&&!isFinite(s.b)&&(s.b=s.a);function x(U){var z=s.to_meter||1;return U*z}var P=function(U){return Ri(s,U)},L=[["standard_parallel_1","Standard_Parallel_1"],["standard_parallel_2","Standard_Parallel_2"],["false_easting","False_Easting"],["false_northing","False_Northing"],["central_meridian","Central_Meridian"],["latitude_of_origin","Latitude_Of_Origin"],["latitude_of_origin","Central_Parallel"],["scale_factor","Scale_Factor"],["k0","scale_factor"],["latitude_of_center","Latitude_Of_Center"],["latitude_of_center","Latitude_of_center"],["lat0","latitude_of_center",zt],["longitude_of_center","Longitude_Of_Center"],["longitude_of_center","Longitude_of_center"],["longc","longitude_of_center",zt],["x0","false_easting",x],["y0","false_northing",x],["long0","central_meridian",zt],["lat0","latitude_of_origin",zt],["lat0","standard_parallel_1",zt],["lat1","standard_parallel_1",zt],["lat2","standard_parallel_2",zt],["azimuth","Azimuth"],["alpha","azimuth",zt],["srsCode","name"]];L.forEach(P),!s.long0&&s.longc&&(s.projName==="Albers_Conic_Equal_Area"||s.projName==="Lambert_Azimuthal_Equal_Area")&&(s.long0=s.longc),!s.lat_ts&&s.lat1&&(s.projName==="Stereographic_South_Pole"||s.projName==="Polar Stereographic (variant B)")&&(s.lat0=zt(s.lat1>0?90:-90),s.lat_ts=s.lat1)}var Dn=function(s){var u=sa(s),c=u.shift(),y=u.shift();u.unshift(["name",y]),u.unshift(["type",c]);var g={};return ar(u,g),Ln(g),g};function yt(s){var u=this;if(arguments.length===2){var c=arguments[1];typeof c=="string"?c.charAt(0)==="+"?yt[s]=j(arguments[1]):yt[s]=Dn(arguments[1]):yt[s]=c}else if(arguments.length===1){if(Array.isArray(s))return s.map(function(y){Array.isArray(y)?yt.apply(u,y):yt(y)});if(typeof s=="string"){if(s in yt)return yt[s]}else"EPSG"in s?yt["EPSG:"+s.EPSG]=s:"ESRI"in s?yt["ESRI:"+s.ESRI]=s:"IAU2000"in s?yt["IAU2000:"+s.IAU2000]=s:console.log(s);return}}t(yt);function T(s){return typeof s=="string"}function M(s){return s in yt}var G=["PROJECTEDCRS","PROJCRS","GEOGCS","GEOCCS","PROJCS","LOCAL_CS","GEODCRS","GEODETICCRS","GEODETICDATUM","ENGCRS","ENGINEERINGCRS"];function F(s){return G.some(function(u){return s.indexOf(u)>-1})}var be=["3857","900913","3785","102113"];function Qe(s){var u=D(s,"authority");if(!!u){var c=D(u,"epsg");return c&&be.indexOf(c)>-1}}function tt(s){var u=D(s,"extension");if(!!u)return D(u,"proj4")}function bt(s){return s[0]==="+"}function Yt(s){if(T(s)){if(M(s))return yt[s];if(F(s)){var u=Dn(s);if(Qe(u))return yt["EPSG:3857"];var c=tt(u);return c?j(c):u}if(bt(s))return j(s)}else return s}var Sr=function(s,u){s=s||{};var c,y;if(!u)return s;for(y in u)c=u[y],c!==void 0&&(s[y]=c);return s},je=function(s,u,c){var y=s*u;return c/Math.sqrt(1-y*y)},at=function(s){return s<0?-1:1},Q=function(s){return Math.abs(s)<=R?s:s-at(s)*C},_t=function(s,u,c){var y=s*c,g=.5*s;return y=Math.pow((1-y)/(1+y),g),Math.tan(.5*(a-u))/y},Zt=function(s,u){for(var c=.5*s,y,g,v=a-2*Math.atan(u),S=0;S<=15;S++)if(y=s*Math.sin(v),g=a-2*Math.atan(u*Math.pow((1-y)/(1+y),c))-v,v+=g,Math.abs(g)<=1e-10)return v;return-9999};function Bn(){var s=this.b/this.a;this.es=1-s*s,"x0"in this||(this.x0=0),"y0"in this||(this.y0=0),this.e=Math.sqrt(this.es),this.lat_ts?this.sphere?this.k0=Math.cos(this.lat_ts):this.k0=je(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):this.k0||(this.k?this.k0=this.k:this.k0=1)}function zn(s){var u=s.x,c=s.y;if(c*E>90&&c*E<-90&&u*E>180&&u*E<-180)return null;var y,g;if(Math.abs(Math.abs(c)-a)<=p)return null;if(this.sphere)y=this.x0+this.a*this.k0*Q(u-this.long0),g=this.y0+this.a*this.k0*Math.log(Math.tan(_+.5*c));else{var v=Math.sin(c),S=_t(this.e,c,v);y=this.x0+this.a*this.k0*Q(u-this.long0),g=this.y0-this.a*this.k0*Math.log(S)}return s.x=y,s.y=g,s}function Xr(s){var u=s.x-this.x0,c=s.y-this.y0,y,g;if(this.sphere)g=a-2*Math.atan(Math.exp(-c/(this.a*this.k0)));else{var v=Math.exp(-c/(this.a*this.k0));if(g=Zt(this.e,v),g===-9999)return null}return y=Q(this.long0+u/(this.a*this.k0)),s.x=y,s.y=g,s}var Fn=["Mercator","Popular Visualisation Pseudo Mercator","Mercator_1SP","Mercator_Auxiliary_Sphere","merc"],Ds={init:Bn,forward:zn,inverse:Xr,names:Fn};function Tl(){}function oa(s){return s}var Al=["longlat","identity"],mc={init:Tl,forward:oa,inverse:oa,names:Al},Il=[Ds,mc],Un={},jn=[];function Zi(s,u){var c=jn.length;return s.names?(jn[c]=s,s.names.forEach(function(y){Un[y.toLowerCase()]=c}),this):(console.log(u),!0)}function Pl(s){if(!s)return!1;var u=s.toLowerCase();if(typeof Un[u]<"u"&&jn[Un[u]])return jn[Un[u]]}function rp(){Il.forEach(Zi)}var Bs={start:rp,add:Zi,get:Pl},de={};de.MERIT={a:6378137,rf:298.257,ellipseName:"MERIT 1983"},de.SGS85={a:6378136,rf:298.257,ellipseName:"Soviet Geodetic System 85"},de.GRS80={a:6378137,rf:298.257222101,ellipseName:"GRS 1980(IUGG, 1980)"},de.IAU76={a:6378140,rf:298.257,ellipseName:"IAU 1976"},de.airy={a:6377563396e-3,b:635625691e-2,ellipseName:"Airy 1830"},de.APL4={a:6378137,rf:298.25,ellipseName:"Appl. Physics. 1965"},de.NWL9D={a:6378145,rf:298.25,ellipseName:"Naval Weapons Lab., 1965"},de.mod_airy={a:6377340189e-3,b:6356034446e-3,ellipseName:"Modified Airy"},de.andrae={a:637710443e-2,rf:300,ellipseName:"Andrae 1876 (Den., Iclnd.)"},de.aust_SA={a:6378160,rf:298.25,ellipseName:"Australian Natl & S. Amer. 1969"},de.GRS67={a:6378160,rf:298.247167427,ellipseName:"GRS 67(IUGG 1967)"},de.bessel={a:6377397155e-3,rf:299.1528128,ellipseName:"Bessel 1841"},de.bess_nam={a:6377483865e-3,rf:299.1528128,ellipseName:"Bessel 1841 (Namibia)"},de.clrk66={a:63782064e-1,b:63565838e-1,ellipseName:"Clarke 1866"},de.clrk80={a:6378249145e-3,rf:293.4663,ellipseName:"Clarke 1880 mod."},de.clrk58={a:6378293645208759e-9,rf:294.2606763692654,ellipseName:"Clarke 1858"},de.CPM={a:63757387e-1,rf:334.29,ellipseName:"Comm. des Poids et Mesures 1799"},de.delmbr={a:6376428,rf:311.5,ellipseName:"Delambre 1810 (Belgium)"},de.engelis={a:637813605e-2,rf:298.2566,ellipseName:"Engelis 1985"},de.evrst30={a:6377276345e-3,rf:300.8017,ellipseName:"Everest 1830"},de.evrst48={a:6377304063e-3,rf:300.8017,ellipseName:"Everest 1948"},de.evrst56={a:6377301243e-3,rf:300.8017,ellipseName:"Everest 1956"},de.evrst69={a:6377295664e-3,rf:300.8017,ellipseName:"Everest 1969"},de.evrstSS={a:6377298556e-3,rf:300.8017,ellipseName:"Everest (Sabah & Sarawak)"},de.fschr60={a:6378166,rf:298.3,ellipseName:"Fischer (Mercury Datum) 1960"},de.fschr60m={a:6378155,rf:298.3,ellipseName:"Fischer 1960"},de.fschr68={a:6378150,rf:298.3,ellipseName:"Fischer 1968"},de.helmert={a:6378200,rf:298.3,ellipseName:"Helmert 1906"},de.hough={a:6378270,rf:297,ellipseName:"Hough"},de.intl={a:6378388,rf:297,ellipseName:"International 1909 (Hayford)"},de.kaula={a:6378163,rf:298.24,ellipseName:"Kaula 1961"},de.lerch={a:6378139,rf:298.257,ellipseName:"Lerch 1979"},de.mprts={a:6397300,rf:191,ellipseName:"Maupertius 1738"},de.new_intl={a:63781575e-1,b:63567722e-1,ellipseName:"New International 1967"},de.plessis={a:6376523,rf:6355863,ellipseName:"Plessis 1817 (France)"},de.krass={a:6378245,rf:298.3,ellipseName:"Krassovsky, 1942"},de.SEasia={a:6378155,b:63567733205e-4,ellipseName:"Southeast Asia"},de.walbeck={a:6376896,b:63558348467e-4,ellipseName:"Walbeck"},de.WGS60={a:6378165,rf:298.3,ellipseName:"WGS 60"},de.WGS66={a:6378145,rf:298.25,ellipseName:"WGS 66"},de.WGS7={a:6378135,rf:298.26,ellipseName:"WGS 72"};var pc=de.WGS84={a:6378137,rf:298.257223563,ellipseName:"WGS 84"};de.sphere={a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"};function Ol(s,u,c,y){var g=s*s,v=u*u,S=(g-v)/g,x=0;y?(s*=1-S*(h+S*(d+S*m)),g=s*s,S=0):x=Math.sqrt(S);var P=(g-v)/v;return{es:S,e:x,ep2:P}}function aa(s,u,c,y,g){if(!s){var v=D(de,y);v||(v=pc),s=v.a,u=v.b,c=v.rf}return c&&!u&&(u=(1-1/c)*s),(c===0||Math.abs(s-u)<p)&&(g=!0,u=s),{a:s,b:u,rf:c,sphere:g}}var lt={};lt.wgs84={towgs84:"0,0,0",ellipse:"WGS84",datumName:"WGS84"},lt.ch1903={towgs84:"674.374,15.056,405.346",ellipse:"bessel",datumName:"swiss"},lt.ggrs87={towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"},lt.nad83={towgs84:"0,0,0",ellipse:"GRS80",datumName:"North_American_Datum_1983"},lt.nad27={nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"},lt.potsdam={towgs84:"606.0,23.0,413.0",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"},lt.carthage={towgs84:"-263.0,6.0,431.0",ellipse:"clark80",datumName:"Carthage 1934 Tunisia"},lt.hermannskogel={towgs84:"653.0,-212.0,449.0",ellipse:"bessel",datumName:"Hermannskogel"},lt.osni52={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"airy",datumName:"Irish National"},lt.ire65={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"},lt.rassadiran={towgs84:"-133.63,-157.5,-158.62",ellipse:"intl",datumName:"Rassadiran"},lt.nzgd49={towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"},lt.osgb36={towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Airy 1830"},lt.s_jtsk={towgs84:"589,76,480",ellipse:"bessel",datumName:"S-JTSK (Ferro)"},lt.beduaram={towgs84:"-106,-87,188",ellipse:"clrk80",datumName:"Beduaram"},lt.gunung_segara={towgs84:"-403,684,41",ellipse:"bessel",datumName:"Gunung Segara Jakarta"},lt.rnb72={towgs84:"106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",ellipse:"intl",datumName:"Reseau National Belge 1972"};function gc(s,u,c,y,g,v){var S={};return s===void 0||s==="none"?S.datum_type=n:S.datum_type=i,u&&(S.datum_params=u.map(parseFloat),(S.datum_params[0]!==0||S.datum_params[1]!==0||S.datum_params[2]!==0)&&(S.datum_type=e),S.datum_params.length>3&&(S.datum_params[3]!==0||S.datum_params[4]!==0||S.datum_params[5]!==0||S.datum_params[6]!==0)&&(S.datum_type=r,S.datum_params[3]*=o,S.datum_params[4]*=o,S.datum_params[5]*=o,S.datum_params[6]=S.datum_params[6]/1e6+1)),S.a=c,S.b=y,S.es=g,S.ep2=v,S}function vt(s,u){if(!(this instanceof vt))return new vt(s);u=u||function(P){if(P)throw P};var c=Yt(s);if(typeof c!="object"){u(s);return}var y=vt.projections.get(c.projName);if(!y){u(s);return}if(c.datumCode&&c.datumCode!=="none"){var g=D(lt,c.datumCode);g&&(c.datum_params=g.towgs84?g.towgs84.split(","):null,c.ellps=g.ellipse,c.datumName=g.datumName?g.datumName:c.datumCode)}c.k0=c.k0||1,c.axis=c.axis||"enu",c.ellps=c.ellps||"wgs84";var v=aa(c.a,c.b,c.rf,c.ellps,c.sphere),S=Ol(v.a,v.b,v.rf,c.R_A),x=c.datum||gc(c.datumCode,c.datum_params,v.a,v.b,S.es,S.ep2);Sr(this,c),Sr(this,y),this.a=v.a,this.b=v.b,this.rf=v.rf,this.sphere=v.sphere,this.es=S.es,this.e=S.e,this.ep2=S.ep2,this.datum=x,this.init(),u(null,this)}vt.projections=Bs,vt.projections.start();function Wn(s,u){return s.datum_type!==u.datum_type||s.a!==u.a||Math.abs(s.es-u.es)>5e-11?!1:s.datum_type===e?s.datum_params[0]===u.datum_params[0]&&s.datum_params[1]===u.datum_params[1]&&s.datum_params[2]===u.datum_params[2]:s.datum_type===r?s.datum_params[0]===u.datum_params[0]&&s.datum_params[1]===u.datum_params[1]&&s.datum_params[2]===u.datum_params[2]&&s.datum_params[3]===u.datum_params[3]&&s.datum_params[4]===u.datum_params[4]&&s.datum_params[5]===u.datum_params[5]&&s.datum_params[6]===u.datum_params[6]:!0}function Ci(s,u,c){var y=s.x,g=s.y,v=s.z?s.z:0,S,x,P,L;if(g<-a&&g>-1.001*a)g=-a;else if(g>a&&g<1.001*a)g=a;else{if(g<-a)return{x:-1/0,y:-1/0,z:s.z};if(g>a)return{x:1/0,y:1/0,z:s.z}}return y>Math.PI&&(y-=2*Math.PI),x=Math.sin(g),L=Math.cos(g),P=x*x,S=c/Math.sqrt(1-u*P),{x:(S+v)*L*Math.cos(y),y:(S+v)*L*Math.sin(y),z:(S*(1-u)+v)*x}}function Jr(s,u,c,y){var g=1e-12,v=g*g,S=30,x,P,L,U,z,q,Y,K,X,J,ce,_e,We,rt=s.x,$e=s.y,He=s.z?s.z:0,Pt,ht,li;if(x=Math.sqrt(rt*rt+$e*$e),P=Math.sqrt(rt*rt+$e*$e+He*He),x/c<g){if(Pt=0,P/c<g)return ht=a,li=-y,{x:s.x,y:s.y,z:s.z}}else Pt=Math.atan2($e,rt);L=He/P,U=x/P,z=1/Math.sqrt(1-u*(2-u)*U*U),K=U*(1-u)*z,X=L*z,We=0;do We++,Y=c/Math.sqrt(1-u*X*X),li=x*K+He*X-Y*(1-u*X*X),q=u*Y/(Y+li),z=1/Math.sqrt(1-q*(2-q)*U*U),J=U*(1-q)*z,ce=L*z,_e=ce*K-J*X,K=J,X=ce;while(_e*_e>v&&We<S);return ht=Math.atan(ce/Math.abs(J)),{x:Pt,y:ht,z:li}}function la(s,u,c){if(u===e)return{x:s.x+c[0],y:s.y+c[1],z:s.z+c[2]};if(u===r){var y=c[0],g=c[1],v=c[2],S=c[3],x=c[4],P=c[5],L=c[6];return{x:L*(s.x-P*s.y+x*s.z)+y,y:L*(P*s.x+s.y-S*s.z)+g,z:L*(-x*s.x+S*s.y+s.z)+v}}}function Ti(s,u,c){if(u===e)return{x:s.x-c[0],y:s.y-c[1],z:s.z-c[2]};if(u===r){var y=c[0],g=c[1],v=c[2],S=c[3],x=c[4],P=c[5],L=c[6],U=(s.x-y)/L,z=(s.y-g)/L,q=(s.z-v)/L;return{x:U+P*z-x*q,y:-P*U+z+S*q,z:x*U-S*z+q}}}function $n(s){return s===e||s===r}var ua=function(s,u,c){return Wn(s,u)||s.datum_type===n||u.datum_type===n||s.es===u.es&&s.a===u.a&&!$n(s.datum_type)&&!$n(u.datum_type)?c:(c=Ci(c,s.es,s.a),$n(s.datum_type)&&(c=la(c,s.datum_type,s.datum_params)),$n(u.datum_type)&&(c=Ti(c,u.datum_type,u.datum_params)),Jr(c,u.es,u.a,u.b))},ha=function(s,u,c){var y=c.x,g=c.y,v=c.z||0,S,x,P,L={};for(P=0;P<3;P++)if(!(u&&P===2&&c.z===void 0))switch(P===0?(S=y,"ew".indexOf(s.axis[P])!==-1?x="x":x="y"):P===1?(S=g,"ns".indexOf(s.axis[P])!==-1?x="y":x="x"):(S=v,x="z"),s.axis[P]){case"e":L[x]=S;break;case"w":L[x]=-S;break;case"n":L[x]=S;break;case"s":L[x]=-S;break;case"u":c[x]!==void 0&&(L.z=S);break;case"d":c[x]!==void 0&&(L.z=-S);break;default:return null}return L},qn=function(s){var u={x:s[0],y:s[1]};return s.length>2&&(u.z=s[2]),s.length>3&&(u.m=s[3]),u},kl=function(s){ca(s.x),ca(s.y)};function ca(s){if(typeof Number.isFinite=="function"){if(Number.isFinite(s))return;throw new TypeError("coordinates must be finite numbers")}if(typeof s!="number"||s!==s||!isFinite(s))throw new TypeError("coordinates must be finite numbers")}function Nl(s,u){return(s.datum.datum_type===e||s.datum.datum_type===r)&&u.datumCode!=="WGS84"||(u.datum.datum_type===e||u.datum.datum_type===r)&&s.datumCode!=="WGS84"}function Xi(s,u,c){var y;if(Array.isArray(c)&&(c=qn(c)),kl(c),s.datum&&u.datum&&Nl(s,u)&&(y=new vt("WGS84"),c=Xi(s,y,c),s=y),s.axis!=="enu"&&(c=ha(s,!1,c)),s.projName==="longlat")c={x:c.x*w,y:c.y*w,z:c.z||0};else if(s.to_meter&&(c={x:c.x*s.to_meter,y:c.y*s.to_meter,z:c.z||0}),c=s.inverse(c),!c)return;return s.from_greenwich&&(c.x+=s.from_greenwich),c=ua(s.datum,u.datum,c),u.from_greenwich&&(c={x:c.x-u.from_greenwich,y:c.y,z:c.z||0}),u.projName==="longlat"?c={x:c.x*E,y:c.y*E,z:c.z||0}:(c=u.forward(c),u.to_meter&&(c={x:c.x/u.to_meter,y:c.y/u.to_meter,z:c.z||0})),u.axis!=="enu"?ha(u,!0,c):c}var fa=vt("WGS84");function da(s,u,c){var y,g,v;return Array.isArray(c)?(y=Xi(s,u,c)||{x:NaN,y:NaN},c.length>2?typeof s.name<"u"&&s.name==="geocent"||typeof u.name<"u"&&u.name==="geocent"?typeof y.z=="number"?[y.x,y.y,y.z].concat(c.splice(3)):[y.x,y.y,c[2]].concat(c.splice(3)):[y.x,y.y].concat(c.splice(2)):[y.x,y.y]):(g=Xi(s,u,c),v=Object.keys(c),v.length===2||v.forEach(function(S){if(typeof s.name<"u"&&s.name==="geocent"||typeof u.name<"u"&&u.name==="geocent"){if(S==="x"||S==="y"||S==="z")return}else if(S==="x"||S==="y")return;g[S]=c[S]}),g)}function Ll(s){return s instanceof vt?s:s.oProj?s.oProj:vt(s)}function Xt(s,u,c){s=Ll(s);var y=!1,g;return typeof u>"u"?(u=s,s=fa,y=!0):(typeof u.x<"u"||Array.isArray(u))&&(c=u,u=s,s=fa,y=!0),u=Ll(u),c?da(s,u,c):(g={forward:function(v){return da(s,u,v)},inverse:function(v){return da(u,s,v)}},y&&(g.oProj=u),g)}var ma=6,Hn="AJSAJS",Dl="AFAFAF",Br=65,pt=73,Et=79,Mt=86,Ai=90,Bl={forward:Gn,inverse:zs,toPoint:pa};function Gn(s,u){return u=u||5,Ul(ya({lat:s[1],lon:s[0]}),u)}function zs(s){var u=Ii(Ji(s.toUpperCase()));return u.lat&&u.lon?[u.lon,u.lat,u.lon,u.lat]:[u.left,u.bottom,u.right,u.top]}function pa(s){var u=Ii(Ji(s.toUpperCase()));return u.lat&&u.lon?[u.lon,u.lat]:[(u.left+u.right)/2,(u.top+u.bottom)/2]}function ga(s){return s*(Math.PI/180)}function zl(s){return 180*(s/Math.PI)}function ya(s){var u=s.lat,c=s.lon,y=6378137,g=.00669438,v=.9996,S,x,P,L,U,z,q,Y=ga(u),K=ga(c),X,J;J=Math.floor((c+180)/6)+1,c===180&&(J=60),u>=56&&u<64&&c>=3&&c<12&&(J=32),u>=72&&u<84&&(c>=0&&c<9?J=31:c>=9&&c<21?J=33:c>=21&&c<33?J=35:c>=33&&c<42&&(J=37)),S=(J-1)*6-180+3,X=ga(S),x=g/(1-g),P=y/Math.sqrt(1-g*Math.sin(Y)*Math.sin(Y)),L=Math.tan(Y)*Math.tan(Y),U=x*Math.cos(Y)*Math.cos(Y),z=Math.cos(Y)*(K-X),q=y*((1-g/4-3*g*g/64-5*g*g*g/256)*Y-(3*g/8+3*g*g/32+45*g*g*g/1024)*Math.sin(2*Y)+(15*g*g/256+45*g*g*g/1024)*Math.sin(4*Y)-35*g*g*g/3072*Math.sin(6*Y));var ce=v*P*(z+(1-L+U)*z*z*z/6+(5-18*L+L*L+72*U-58*x)*z*z*z*z*z/120)+5e5,_e=v*(q+P*Math.tan(Y)*(z*z/2+(5-L+9*U+4*U*U)*z*z*z*z/24+(61-58*L+L*L+600*U-330*x)*z*z*z*z*z*z/720));return u<0&&(_e+=1e7),{northing:Math.round(_e),easting:Math.round(ce),zoneNumber:J,zoneLetter:Fl(u)}}function Ii(s){var u=s.northing,c=s.easting,y=s.zoneLetter,g=s.zoneNumber;if(g<0||g>60)return null;var v=.9996,S=6378137,x=.00669438,P,L=(1-Math.sqrt(1-x))/(1+Math.sqrt(1-x)),U,z,q,Y,K,X,J,ce,_e,We=c-5e5,rt=u;y<"N"&&(rt-=1e7),J=(g-1)*6-180+3,P=x/(1-x),X=rt/v,ce=X/(S*(1-x/4-3*x*x/64-5*x*x*x/256)),_e=ce+(3*L/2-27*L*L*L/32)*Math.sin(2*ce)+(21*L*L/16-55*L*L*L*L/32)*Math.sin(4*ce)+151*L*L*L/96*Math.sin(6*ce),U=S/Math.sqrt(1-x*Math.sin(_e)*Math.sin(_e)),z=Math.tan(_e)*Math.tan(_e),q=P*Math.cos(_e)*Math.cos(_e),Y=S*(1-x)/Math.pow(1-x*Math.sin(_e)*Math.sin(_e),1.5),K=We/(U*v);var $e=_e-U*Math.tan(_e)/Y*(K*K/2-(5+3*z+10*q-4*q*q-9*P)*K*K*K*K/24+(61+90*z+298*q+45*z*z-252*P-3*q*q)*K*K*K*K*K*K/720);$e=zl($e);var He=(K-(1+2*z+q)*K*K*K/6+(5-2*q+28*z-3*q*q+8*P+24*z*z)*K*K*K*K*K/120)/Math.cos(_e);He=J+zl(He);var Pt;if(s.accuracy){var ht=Ii({northing:s.northing+s.accuracy,easting:s.easting+s.accuracy,zoneLetter:s.zoneLetter,zoneNumber:s.zoneNumber});Pt={top:ht.lat,right:ht.lon,bottom:$e,left:He}}else Pt={lat:$e,lon:He};return Pt}function Fl(s){var u="Z";return 84>=s&&s>=72?u="X":72>s&&s>=64?u="W":64>s&&s>=56?u="V":56>s&&s>=48?u="U":48>s&&s>=40?u="T":40>s&&s>=32?u="S":32>s&&s>=24?u="R":24>s&&s>=16?u="Q":16>s&&s>=8?u="P":8>s&&s>=0?u="N":0>s&&s>=-8?u="M":-8>s&&s>=-16?u="L":-16>s&&s>=-24?u="K":-24>s&&s>=-32?u="J":-32>s&&s>=-40?u="H":-40>s&&s>=-48?u="G":-48>s&&s>=-56?u="F":-56>s&&s>=-64?u="E":-64>s&&s>=-72?u="D":-72>s&&s>=-80&&(u="C"),u}function Ul(s,u){var c="00000"+s.easting,y="00000"+s.northing;return s.zoneNumber+s.zoneLetter+yc(s.easting,s.northing,s.zoneNumber)+c.substr(c.length-5,u)+y.substr(y.length-5,u)}function yc(s,u,c){var y=ba(c),g=Math.floor(s/1e5),v=Math.floor(u/1e5)%20;return va(g,v,y)}function ba(s){var u=s%ma;return u===0&&(u=ma),u}function va(s,u,c){var y=c-1,g=Hn.charCodeAt(y),v=Dl.charCodeAt(y),S=g+s-1,x=v+u,P=!1;S>Ai&&(S=S-Ai+Br-1,P=!0),(S===pt||g<pt&&S>pt||(S>pt||g<pt)&&P)&&S++,(S===Et||g<Et&&S>Et||(S>Et||g<Et)&&P)&&(S++,S===pt&&S++),S>Ai&&(S=S-Ai+Br-1),x>Mt?(x=x-Mt+Br-1,P=!0):P=!1,(x===pt||v<pt&&x>pt||(x>pt||v<pt)&&P)&&x++,(x===Et||v<Et&&x>Et||(x>Et||v<Et)&&P)&&(x++,x===pt&&x++),x>Mt&&(x=x-Mt+Br-1);var L=String.fromCharCode(S)+String.fromCharCode(x);return L}function Ji(s){if(s&&s.length===0)throw"MGRSPoint coverting from nothing";for(var u=s.length,c=null,y="",g,v=0;!/[A-Z]/.test(g=s.charAt(v));){if(v>=2)throw"MGRSPoint bad conversion from: "+s;y+=g,v++}var S=parseInt(y,10);if(v===0||v+3>u)throw"MGRSPoint bad conversion from: "+s;var x=s.charAt(v++);if(x<="A"||x==="B"||x==="Y"||x>="Z"||x==="I"||x==="O")throw"MGRSPoint zone letter "+x+" not handled: "+s;c=s.substring(v,v+=2);for(var P=ba(S),L=Pi(c.charAt(0),P),U=jl(c.charAt(1),P);U<Fs(x);)U+=2e6;var z=u-v;if(z%2!==0)throw`MGRSPoint has to have an even number
103
+ `),Pe=Yb.bind(null,{[Q9]:"",[ep]:a,[rp]:te,[tp]:Mu,[r0]:z,[ip]:G}),We="";m!==null&&(w===void 0?We=Pe(m):We=Pe(Object.assign({},m,{name:w})));let ot=c instanceof Function?c:c?lp:gv,Rt=ot().indexOf(":")+1;if(A&&!v)throw Error("customLevels is required if useOnlyCustomLevels is set true");if(R&&typeof R!="function")throw Error(`Unknown mixin type "${typeof R}" - expected "function"`);Vb(S,v,A);let Fr=ap(v,A);return Object.assign(e,{levels:Fr,[fv]:A,[sv]:i,[iv]:ot,[nv]:Rt,[tp]:Mu,[r0]:z,[rp]:te,[av]:De,[lv]:ke,[uv]:d,[cv]:p,[pv]:p?`,${JSON.stringify(p)}:{`:"",[ep]:a,[hv]:R,[mv]:x,[Q9]:We,[ip]:G,[dv]:T,silent:ev}),Object.setPrototypeOf(e,Hb()),Kb(e),e[ov](S),e}or.exports=i0;or.exports.destination=(t=process.stdout.fd)=>typeof t=="object"?(t.dest=X9(t.dest||process.stdout.fd),Y9(t)):Y9({dest:X9(t),minLength:0,sync:!0});or.exports.transport=Lf();or.exports.multistream=J9();or.exports.final=Xb;or.exports.levels=ap();or.exports.stdSerializers=Sv;or.exports.stdTimeFunctions=Object.assign({},sp);or.exports.symbols=op;or.exports.version=tv;or.exports.default=i0;or.exports.pino=i0});var fp=H((KC,n1)=>{"use strict";var xv=process.env.TERM_PROGRAM==="Hyper",Mv=process.platform==="win32",up=process.platform==="linux",s0={ballotDisabled:"\u2612",ballotOff:"\u2610",ballotOn:"\u2611",bullet:"\u2022",bulletWhite:"\u25E6",fullBlock:"\u2588",heart:"\u2764",identicalTo:"\u2261",line:"\u2500",mark:"\u203B",middot:"\xB7",minus:"\uFF0D",multiplication:"\xD7",obelus:"\xF7",pencilDownRight:"\u270E",pencilRight:"\u270F",pencilUpRight:"\u2710",percent:"%",pilcrow2:"\u2761",pilcrow:"\xB6",plusMinus:"\xB1",section:"\xA7",starsOff:"\u2606",starsOn:"\u2605",upDownArrow:"\u2195"},cp=Object.assign({},s0,{check:"\u221A",cross:"\xD7",ellipsisLarge:"...",ellipsis:"...",info:"i",question:"?",questionSmall:"?",pointer:">",pointerSmall:"\xBB",radioOff:"( )",radioOn:"(*)",warning:"\u203C"}),hp=Object.assign({},s0,{ballotCross:"\u2718",check:"\u2714",cross:"\u2716",ellipsisLarge:"\u22EF",ellipsis:"\u2026",info:"\u2139",question:"?",questionFull:"\uFF1F",questionSmall:"\uFE56",pointer:up?"\u25B8":"\u276F",pointerSmall:up?"\u2023":"\u203A",radioOff:"\u25EF",radioOn:"\u25C9",warning:"\u26A0"});n1.exports=Mv&&!xv?cp:hp;Reflect.defineProperty(n1.exports,"common",{enumerable:!1,value:s0});Reflect.defineProperty(n1.exports,"windows",{enumerable:!1,value:cp});Reflect.defineProperty(n1.exports,"other",{enumerable:!1,value:hp})});var pp=H((ZC,o0)=>{"use strict";var Ev=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),Rv=/[\u001b\u009b][[\]#;?()]*(?:(?:(?:[^\W_]*;?[^\W_]*)\u0007)|(?:(?:[0-9]{1,4}(;[0-9]{0,4})*)?[~0-9=<>cf-nqrtyA-PRZ]))/g,dp=()=>{let t={enabled:!0,visible:!0,styles:{},keys:{}};"FORCE_COLOR"in process.env&&(t.enabled=process.env.FORCE_COLOR!=="0");let e=s=>{let a=s.open=`\x1B[${s.codes[0]}m`,c=s.close=`\x1B[${s.codes[1]}m`,d=s.regex=new RegExp(`\\u001b\\[${s.codes[1]}m`,"g");return s.wrap=(p,m)=>{p.includes(c)&&(p=p.replace(d,c+a));let w=a+p+c;return m?w.replace(/\r*\n/g,`${c}$&${a}`):w},s},r=(s,a,c)=>typeof s=="function"?s(a):s.wrap(a,c),i=(s,a)=>{if(s===""||s==null)return"";if(t.enabled===!1)return s;if(t.visible===!1)return"";let c=""+s,d=c.includes(`
104
+ `),p=a.length;for(p>0&&a.includes("unstyle")&&(a=[...new Set(["unstyle",...a])].reverse());p-- >0;)c=r(t.styles[a[p]],c,d);return c},n=(s,a,c)=>{t.styles[s]=e({name:s,codes:a}),(t.keys[c]||(t.keys[c]=[])).push(s),Reflect.defineProperty(t,s,{configurable:!0,enumerable:!0,set(p){t.alias(s,p)},get(){let p=m=>i(m,p.stack);return Reflect.setPrototypeOf(p,t),p.stack=this.stack?this.stack.concat(s):[s],p}})};return n("reset",[0,0],"modifier"),n("bold",[1,22],"modifier"),n("dim",[2,22],"modifier"),n("italic",[3,23],"modifier"),n("underline",[4,24],"modifier"),n("inverse",[7,27],"modifier"),n("hidden",[8,28],"modifier"),n("strikethrough",[9,29],"modifier"),n("black",[30,39],"color"),n("red",[31,39],"color"),n("green",[32,39],"color"),n("yellow",[33,39],"color"),n("blue",[34,39],"color"),n("magenta",[35,39],"color"),n("cyan",[36,39],"color"),n("white",[37,39],"color"),n("gray",[90,39],"color"),n("grey",[90,39],"color"),n("bgBlack",[40,49],"bg"),n("bgRed",[41,49],"bg"),n("bgGreen",[42,49],"bg"),n("bgYellow",[43,49],"bg"),n("bgBlue",[44,49],"bg"),n("bgMagenta",[45,49],"bg"),n("bgCyan",[46,49],"bg"),n("bgWhite",[47,49],"bg"),n("blackBright",[90,39],"bright"),n("redBright",[91,39],"bright"),n("greenBright",[92,39],"bright"),n("yellowBright",[93,39],"bright"),n("blueBright",[94,39],"bright"),n("magentaBright",[95,39],"bright"),n("cyanBright",[96,39],"bright"),n("whiteBright",[97,39],"bright"),n("bgBlackBright",[100,49],"bgBright"),n("bgRedBright",[101,49],"bgBright"),n("bgGreenBright",[102,49],"bgBright"),n("bgYellowBright",[103,49],"bgBright"),n("bgBlueBright",[104,49],"bgBright"),n("bgMagentaBright",[105,49],"bgBright"),n("bgCyanBright",[106,49],"bgBright"),n("bgWhiteBright",[107,49],"bgBright"),t.ansiRegex=Rv,t.hasColor=t.hasAnsi=s=>(t.ansiRegex.lastIndex=0,typeof s=="string"&&s!==""&&t.ansiRegex.test(s)),t.alias=(s,a)=>{let c=typeof a=="string"?t[a]:a;if(typeof c!="function")throw new TypeError("Expected alias to be the name of an existing color (string) or a function");c.stack||(Reflect.defineProperty(c,"name",{value:s}),t.styles[s]=c,c.stack=[s]),Reflect.defineProperty(t,s,{configurable:!0,enumerable:!0,set(d){t.alias(s,d)},get(){let d=p=>i(p,d.stack);return Reflect.setPrototypeOf(d,t),d.stack=this.stack?this.stack.concat(c.stack):c.stack,d}})},t.theme=s=>{if(!Ev(s))throw new TypeError("Expected theme to be an object");for(let a of Object.keys(s))t.alias(a,s[a]);return t},t.alias("unstyle",s=>typeof s=="string"&&s!==""?(t.ansiRegex.lastIndex=0,s.replace(t.ansiRegex,"")):""),t.alias("noop",s=>s),t.none=t.clear=t.noop,t.stripColor=t.unstyle,t.symbols=fp(),t.define=n,t};o0.exports=dp();o0.exports.create=dp});var a0=H((YC,mp)=>{mp.exports=require("stream")});var vp=H((XC,bp)=>{"use strict";function gp(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function Av(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?gp(Object(r),!0).forEach(function(i){Pv(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):gp(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function Pv(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Tv(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function yp(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function Iv(t,e,r){return e&&yp(t.prototype,e),r&&yp(t,r),t}var kv=require("buffer"),Eu=kv.Buffer,Ov=require("util"),l0=Ov.inspect,Lv=l0&&l0.custom||"inspect";function Nv(t,e,r){Eu.prototype.copy.call(t,e,r)}bp.exports=function(){function t(){Tv(this,t),this.head=null,this.tail=null,this.length=0}return Iv(t,[{key:"push",value:function(r){var i={data:r,next:null};this.length>0?this.tail.next=i:this.head=i,this.tail=i,++this.length}},{key:"unshift",value:function(r){var i={data:r,next:this.head};this.length===0&&(this.tail=i),this.head=i,++this.length}},{key:"shift",value:function(){if(this.length!==0){var r=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,r}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(r){if(this.length===0)return"";for(var i=this.head,n=""+i.data;i=i.next;)n+=r+i.data;return n}},{key:"concat",value:function(r){if(this.length===0)return Eu.alloc(0);for(var i=Eu.allocUnsafe(r>>>0),n=this.head,s=0;n;)Nv(n.data,i,s),s+=n.data.length,n=n.next;return i}},{key:"consume",value:function(r,i){var n;return r<this.head.data.length?(n=this.head.data.slice(0,r),this.head.data=this.head.data.slice(r)):r===this.head.data.length?n=this.shift():n=i?this._getString(r):this._getBuffer(r),n}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(r){var i=this.head,n=1,s=i.data;for(r-=s.length;i=i.next;){var a=i.data,c=r>a.length?a.length:r;if(c===a.length?s+=a:s+=a.slice(0,r),r-=c,r===0){c===a.length?(++n,i.next?this.head=i.next:this.head=this.tail=null):(this.head=i,i.data=a.slice(c));break}++n}return this.length-=n,s}},{key:"_getBuffer",value:function(r){var i=Eu.allocUnsafe(r),n=this.head,s=1;for(n.data.copy(i),r-=n.data.length;n=n.next;){var a=n.data,c=r>a.length?a.length:r;if(a.copy(i,i.length-r,0,c),r-=c,r===0){c===a.length?(++s,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=a.slice(c));break}++s}return this.length-=s,i}},{key:Lv,value:function(r,i){return l0(this,Av({},i,{depth:0,customInspect:!1}))}}]),t}()});var c0=H((QC,_p)=>{"use strict";function Dv(t,e){var r=this,i=this._readableState&&this._readableState.destroyed,n=this._writableState&&this._writableState.destroyed;return i||n?(e?e(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(u0,this,t)):process.nextTick(u0,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(s){!e&&s?r._writableState?r._writableState.errorEmitted?process.nextTick(Ru,r):(r._writableState.errorEmitted=!0,process.nextTick(wp,r,s)):process.nextTick(wp,r,s):e?(process.nextTick(Ru,r),e(s)):process.nextTick(Ru,r)}),this)}function wp(t,e){u0(t,e),Ru(t)}function Ru(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function Bv(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function u0(t,e){t.emit("error",e)}function zv(t,e){var r=t._readableState,i=t._writableState;r&&r.autoDestroy||i&&i.autoDestroy?t.destroy(e):t.emit("error",e)}_p.exports={destroy:Dv,undestroy:Bv,errorOrDestroy:zv}});var dn=H((eA,Mp)=>{"use strict";var xp={};function Sr(t,e,r){r||(r=Error);function i(s,a,c){return typeof e=="string"?e:e(s,a,c)}class n extends r{constructor(a,c,d){super(i(a,c,d))}}n.prototype.name=r.name,n.prototype.code=t,xp[t]=n}function Sp(t,e){if(Array.isArray(t)){let r=t.length;return t=t.map(i=>String(i)),r>2?`one of ${e} ${t.slice(0,r-1).join(", ")}, or `+t[r-1]:r===2?`one of ${e} ${t[0]} or ${t[1]}`:`of ${e} ${t[0]}`}else return`of ${e} ${String(t)}`}function jv(t,e,r){return t.substr(!r||r<0?0:+r,e.length)===e}function qv(t,e,r){return(r===void 0||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}function Uv(t,e,r){return typeof r!="number"&&(r=0),r+e.length>t.length?!1:t.indexOf(e,r)!==-1}Sr("ERR_INVALID_OPT_VALUE",function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'},TypeError);Sr("ERR_INVALID_ARG_TYPE",function(t,e,r){let i;typeof e=="string"&&jv(e,"not ")?(i="must not be",e=e.replace(/^not /,"")):i="must be";let n;if(qv(t," argument"))n=`The ${t} ${i} ${Sp(e,"type")}`;else{let s=Uv(t,".")?"property":"argument";n=`The "${t}" ${s} ${i} ${Sp(e,"type")}`}return n+=`. Received type ${typeof r}`,n},TypeError);Sr("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");Sr("ERR_METHOD_NOT_IMPLEMENTED",function(t){return"The "+t+" method is not implemented"});Sr("ERR_STREAM_PREMATURE_CLOSE","Premature close");Sr("ERR_STREAM_DESTROYED",function(t){return"Cannot call "+t+" after a stream was destroyed"});Sr("ERR_MULTIPLE_CALLBACK","Callback called multiple times");Sr("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");Sr("ERR_STREAM_WRITE_AFTER_END","write after end");Sr("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);Sr("ERR_UNKNOWN_ENCODING",function(t){return"Unknown encoding: "+t},TypeError);Sr("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");Mp.exports.codes=xp});var h0=H((tA,Ep)=>{"use strict";var $v=dn().codes.ERR_INVALID_OPT_VALUE;function Wv(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function Fv(t,e,r,i){var n=Wv(e,i,r);if(n!=null){if(!(isFinite(n)&&Math.floor(n)===n)||n<0){var s=i?r:"highWaterMark";throw new $v(s,n)}return Math.floor(n)}return t.objectMode?16:16*1024}Ep.exports={getHighWaterMark:Fv}});var Rp=H((rA,f0)=>{typeof Object.create=="function"?f0.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:f0.exports=function(e,r){if(r){e.super_=r;var i=function(){};i.prototype=r.prototype,e.prototype=new i,e.prototype.constructor=e}}});var Io=H((iA,p0)=>{try{if(d0=require("util"),typeof d0.inherits!="function")throw"";p0.exports=d0.inherits}catch{p0.exports=Rp()}var d0});var Ap=H((nA,Cp)=>{Cp.exports=require("util").deprecate});var y0=H((sA,Lp)=>{"use strict";Lp.exports=rt;function Tp(t){var e=this;this.next=null,this.entry=null,this.finish=function(){yw(e,t)}}var ko;rt.WritableState=o1;var Hv={deprecate:Ap()},Ip=a0(),Au=require("buffer").Buffer,Gv=global.Uint8Array||function(){};function Vv(t){return Au.from(t)}function Kv(t){return Au.isBuffer(t)||t instanceof Gv}var g0=c0(),Zv=h0(),Jv=Zv.getHighWaterMark,pn=dn().codes,Yv=pn.ERR_INVALID_ARG_TYPE,Xv=pn.ERR_METHOD_NOT_IMPLEMENTED,Qv=pn.ERR_MULTIPLE_CALLBACK,ew=pn.ERR_STREAM_CANNOT_PIPE,tw=pn.ERR_STREAM_DESTROYED,rw=pn.ERR_STREAM_NULL_VALUES,iw=pn.ERR_STREAM_WRITE_AFTER_END,nw=pn.ERR_UNKNOWN_ENCODING,Oo=g0.errorOrDestroy;Io()(rt,Ip);function sw(){}function o1(t,e,r){ko=ko||us(),t=t||{},typeof r!="boolean"&&(r=e instanceof ko),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=Jv(this,t,"writableHighWaterMark",r),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var i=t.decodeStrings===!1;this.decodeStrings=!i,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(n){fw(e,n)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=t.emitClose!==!1,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new Tp(this)}o1.prototype.getBuffer=function(){for(var e=this.bufferedRequest,r=[];e;)r.push(e),e=e.next;return r};(function(){try{Object.defineProperty(o1.prototype,"buffer",{get:Hv.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var Cu;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(Cu=Function.prototype[Symbol.hasInstance],Object.defineProperty(rt,Symbol.hasInstance,{value:function(e){return Cu.call(this,e)?!0:this!==rt?!1:e&&e._writableState instanceof o1}})):Cu=function(e){return e instanceof this};function rt(t){ko=ko||us();var e=this instanceof ko;if(!e&&!Cu.call(rt,this))return new rt(t);this._writableState=new o1(t,this,e),this.writable=!0,t&&(typeof t.write=="function"&&(this._write=t.write),typeof t.writev=="function"&&(this._writev=t.writev),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.final=="function"&&(this._final=t.final)),Ip.call(this)}rt.prototype.pipe=function(){Oo(this,new ew)};function ow(t,e){var r=new iw;Oo(t,r),process.nextTick(e,r)}function aw(t,e,r,i){var n;return r===null?n=new rw:typeof r!="string"&&!e.objectMode&&(n=new Yv("chunk",["string","Buffer"],r)),n?(Oo(t,n),process.nextTick(i,n),!1):!0}rt.prototype.write=function(t,e,r){var i=this._writableState,n=!1,s=!i.objectMode&&Kv(t);return s&&!Au.isBuffer(t)&&(t=Vv(t)),typeof e=="function"&&(r=e,e=null),s?e="buffer":e||(e=i.defaultEncoding),typeof r!="function"&&(r=sw),i.ending?ow(this,r):(s||aw(this,i,t,r))&&(i.pendingcb++,n=uw(this,i,s,t,e,r)),n};rt.prototype.cork=function(){this._writableState.corked++};rt.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,!t.writing&&!t.corked&&!t.bufferProcessing&&t.bufferedRequest&&kp(this,t))};rt.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new nw(e);return this._writableState.defaultEncoding=e,this};Object.defineProperty(rt.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function lw(t,e,r){return!t.objectMode&&t.decodeStrings!==!1&&typeof e=="string"&&(e=Au.from(e,r)),e}Object.defineProperty(rt.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function uw(t,e,r,i,n,s){if(!r){var a=lw(e,i,n);i!==a&&(r=!0,n="buffer",i=a)}var c=e.objectMode?1:i.length;e.length+=c;var d=e.length<e.highWaterMark;if(d||(e.needDrain=!0),e.writing||e.corked){var p=e.lastBufferedRequest;e.lastBufferedRequest={chunk:i,encoding:n,isBuf:r,callback:s,next:null},p?p.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else m0(t,e,!1,c,i,n,s);return d}function m0(t,e,r,i,n,s,a){e.writelen=i,e.writecb=a,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new tw("write")):r?t._writev(n,e.onwrite):t._write(n,s,e.onwrite),e.sync=!1}function cw(t,e,r,i,n){--e.pendingcb,r?(process.nextTick(n,i),process.nextTick(s1,t,e),t._writableState.errorEmitted=!0,Oo(t,i)):(n(i),t._writableState.errorEmitted=!0,Oo(t,i),s1(t,e))}function hw(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}function fw(t,e){var r=t._writableState,i=r.sync,n=r.writecb;if(typeof n!="function")throw new Qv;if(hw(r),e)cw(t,r,i,e,n);else{var s=Op(r)||t.destroyed;!s&&!r.corked&&!r.bufferProcessing&&r.bufferedRequest&&kp(t,r),i?process.nextTick(Pp,t,r,s,n):Pp(t,r,s,n)}}function Pp(t,e,r,i){r||dw(t,e),e.pendingcb--,i(),s1(t,e)}function dw(t,e){e.length===0&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}function kp(t,e){e.bufferProcessing=!0;var r=e.bufferedRequest;if(t._writev&&r&&r.next){var i=e.bufferedRequestCount,n=new Array(i),s=e.corkedRequestsFree;s.entry=r;for(var a=0,c=!0;r;)n[a]=r,r.isBuf||(c=!1),r=r.next,a+=1;n.allBuffers=c,m0(t,e,!0,e.length,n,"",s.finish),e.pendingcb++,e.lastBufferedRequest=null,s.next?(e.corkedRequestsFree=s.next,s.next=null):e.corkedRequestsFree=new Tp(e),e.bufferedRequestCount=0}else{for(;r;){var d=r.chunk,p=r.encoding,m=r.callback,w=e.objectMode?1:d.length;if(m0(t,e,!1,w,d,p,m),r=r.next,e.bufferedRequestCount--,e.writing)break}r===null&&(e.lastBufferedRequest=null)}e.bufferedRequest=r,e.bufferProcessing=!1}rt.prototype._write=function(t,e,r){r(new Xv("_write()"))};rt.prototype._writev=null;rt.prototype.end=function(t,e,r){var i=this._writableState;return typeof t=="function"?(r=t,t=null,e=null):typeof e=="function"&&(r=e,e=null),t!=null&&this.write(t,e),i.corked&&(i.corked=1,this.uncork()),i.ending||gw(this,i,r),this};Object.defineProperty(rt.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function Op(t){return t.ending&&t.length===0&&t.bufferedRequest===null&&!t.finished&&!t.writing}function pw(t,e){t._final(function(r){e.pendingcb--,r&&Oo(t,r),e.prefinished=!0,t.emit("prefinish"),s1(t,e)})}function mw(t,e){!e.prefinished&&!e.finalCalled&&(typeof t._final=="function"&&!e.destroyed?(e.pendingcb++,e.finalCalled=!0,process.nextTick(pw,t,e)):(e.prefinished=!0,t.emit("prefinish")))}function s1(t,e){var r=Op(e);if(r&&(mw(t,e),e.pendingcb===0&&(e.finished=!0,t.emit("finish"),e.autoDestroy))){var i=t._readableState;(!i||i.autoDestroy&&i.endEmitted)&&t.destroy()}return r}function gw(t,e,r){e.ending=!0,s1(t,e),r&&(e.finished?process.nextTick(r):t.once("finish",r)),e.ended=!0,t.writable=!1}function yw(t,e,r){var i=t.entry;for(t.entry=null;i;){var n=i.callback;e.pendingcb--,n(r),i=i.next}e.corkedRequestsFree.next=t}Object.defineProperty(rt.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(e){!this._writableState||(this._writableState.destroyed=e)}});rt.prototype.destroy=g0.destroy;rt.prototype._undestroy=g0.undestroy;rt.prototype._destroy=function(t,e){e(t)}});var us=H((oA,Dp)=>{"use strict";var bw=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};Dp.exports=hi;var Np=w0(),v0=y0();Io()(hi,Np);for(b0=bw(v0.prototype),Pu=0;Pu<b0.length;Pu++)Tu=b0[Pu],hi.prototype[Tu]||(hi.prototype[Tu]=v0.prototype[Tu]);var b0,Tu,Pu;function hi(t){if(!(this instanceof hi))return new hi(t);Np.call(this,t),v0.call(this,t),this.allowHalfOpen=!0,t&&(t.readable===!1&&(this.readable=!1),t.writable===!1&&(this.writable=!1),t.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",vw)))}Object.defineProperty(hi.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});Object.defineProperty(hi.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});Object.defineProperty(hi.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function vw(){this._writableState.ended||process.nextTick(ww,this)}function ww(t){t.end()}Object.defineProperty(hi.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(e){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=e,this._writableState.destroyed=e)}})});var jp=H((_0,zp)=>{var Iu=require("buffer"),fi=Iu.Buffer;function Bp(t,e){for(var r in t)e[r]=t[r]}fi.from&&fi.alloc&&fi.allocUnsafe&&fi.allocUnsafeSlow?zp.exports=Iu:(Bp(Iu,_0),_0.Buffer=cs);function cs(t,e,r){return fi(t,e,r)}cs.prototype=Object.create(fi.prototype);Bp(fi,cs);cs.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return fi(t,e,r)};cs.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var i=fi(t);return e!==void 0?typeof r=="string"?i.fill(e,r):i.fill(e):i.fill(0),i};cs.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return fi(t)};cs.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Iu.SlowBuffer(t)}});var M0=H(Up=>{"use strict";var x0=jp().Buffer,qp=x0.isEncoding||function(t){switch(t=""+t,t&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function _w(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}function Sw(t){var e=_w(t);if(typeof e!="string"&&(x0.isEncoding===qp||!qp(t)))throw new Error("Unknown encoding: "+t);return e||t}Up.StringDecoder=a1;function a1(t){this.encoding=Sw(t);var e;switch(this.encoding){case"utf16le":this.text=Aw,this.end=Pw,e=4;break;case"utf8":this.fillLast=Ew,e=4;break;case"base64":this.text=Tw,this.end=Iw,e=3;break;default:this.write=kw,this.end=Ow;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=x0.allocUnsafe(e)}a1.prototype.write=function(t){if(t.length===0)return"";var e,r;if(this.lastNeed){if(e=this.fillLast(t),e===void 0)return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<t.length?e?e+this.text(t,r):this.text(t,r):e||""};a1.prototype.end=Cw;a1.prototype.text=Rw;a1.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length};function S0(t){return t<=127?0:t>>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}function xw(t,e,r){var i=e.length-1;if(i<r)return 0;var n=S0(e[i]);return n>=0?(n>0&&(t.lastNeed=n-1),n):--i<r||n===-2?0:(n=S0(e[i]),n>=0?(n>0&&(t.lastNeed=n-2),n):--i<r||n===-2?0:(n=S0(e[i]),n>=0?(n>0&&(n===2?n=0:t.lastNeed=n-3),n):0))}function Mw(t,e,r){if((e[0]&192)!==128)return t.lastNeed=0,"\uFFFD";if(t.lastNeed>1&&e.length>1){if((e[1]&192)!==128)return t.lastNeed=1,"\uFFFD";if(t.lastNeed>2&&e.length>2&&(e[2]&192)!==128)return t.lastNeed=2,"\uFFFD"}}function Ew(t){var e=this.lastTotal-this.lastNeed,r=Mw(this,t,e);if(r!==void 0)return r;if(this.lastNeed<=t.length)return t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,e,0,t.length),this.lastNeed-=t.length}function Rw(t,e){var r=xw(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var i=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,i),t.toString("utf8",e,i)}function Cw(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function Aw(t,e){if((t.length-e)%2===0){var r=t.toString("utf16le",e);if(r){var i=r.charCodeAt(r.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function Pw(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function Tw(t,e){var r=(t.length-e)%3;return r===0?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,r===1?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function Iw(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function kw(t){return t.toString(this.encoding)}function Ow(t){return t&&t.length?this.write(t):""}});var ku=H((lA,Fp)=>{"use strict";var $p=dn().codes.ERR_STREAM_PREMATURE_CLOSE;function Lw(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,i=new Array(r),n=0;n<r;n++)i[n]=arguments[n];t.apply(this,i)}}}function Nw(){}function Dw(t){return t.setHeader&&typeof t.abort=="function"}function Wp(t,e,r){if(typeof e=="function")return Wp(t,null,e);e||(e={}),r=Lw(r||Nw);var i=e.readable||e.readable!==!1&&t.readable,n=e.writable||e.writable!==!1&&t.writable,s=function(){t.writable||c()},a=t._writableState&&t._writableState.finished,c=function(){n=!1,a=!0,i||r.call(t)},d=t._readableState&&t._readableState.endEmitted,p=function(){i=!1,d=!0,n||r.call(t)},m=function(R){r.call(t,R)},w=function(){var R;if(i&&!d)return(!t._readableState||!t._readableState.ended)&&(R=new $p),r.call(t,R);if(n&&!a)return(!t._writableState||!t._writableState.ended)&&(R=new $p),r.call(t,R)},S=function(){t.req.on("finish",c)};return Dw(t)?(t.on("complete",c),t.on("abort",w),t.req?S():t.on("request",S)):n&&!t._writableState&&(t.on("end",s),t.on("close",s)),t.on("end",p),t.on("finish",c),e.error!==!1&&t.on("error",m),t.on("close",w),function(){t.removeListener("complete",c),t.removeListener("abort",w),t.removeListener("request",S),t.req&&t.req.removeListener("finish",c),t.removeListener("end",s),t.removeListener("close",s),t.removeListener("finish",c),t.removeListener("end",p),t.removeListener("error",m),t.removeListener("close",w)}}Fp.exports=Wp});var Gp=H((uA,Hp)=>{"use strict";var Ou;function mn(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var Bw=ku(),gn=Symbol("lastResolve"),hs=Symbol("lastReject"),l1=Symbol("error"),Lu=Symbol("ended"),fs=Symbol("lastPromise"),E0=Symbol("handlePromise"),ds=Symbol("stream");function yn(t,e){return{value:t,done:e}}function zw(t){var e=t[gn];if(e!==null){var r=t[ds].read();r!==null&&(t[fs]=null,t[gn]=null,t[hs]=null,e(yn(r,!1)))}}function jw(t){process.nextTick(zw,t)}function qw(t,e){return function(r,i){t.then(function(){if(e[Lu]){r(yn(void 0,!0));return}e[E0](r,i)},i)}}var Uw=Object.getPrototypeOf(function(){}),$w=Object.setPrototypeOf((Ou={get stream(){return this[ds]},next:function(){var e=this,r=this[l1];if(r!==null)return Promise.reject(r);if(this[Lu])return Promise.resolve(yn(void 0,!0));if(this[ds].destroyed)return new Promise(function(a,c){process.nextTick(function(){e[l1]?c(e[l1]):a(yn(void 0,!0))})});var i=this[fs],n;if(i)n=new Promise(qw(i,this));else{var s=this[ds].read();if(s!==null)return Promise.resolve(yn(s,!1));n=new Promise(this[E0])}return this[fs]=n,n}},mn(Ou,Symbol.asyncIterator,function(){return this}),mn(Ou,"return",function(){var e=this;return new Promise(function(r,i){e[ds].destroy(null,function(n){if(n){i(n);return}r(yn(void 0,!0))})})}),Ou),Uw),Ww=function(e){var r,i=Object.create($w,(r={},mn(r,ds,{value:e,writable:!0}),mn(r,gn,{value:null,writable:!0}),mn(r,hs,{value:null,writable:!0}),mn(r,l1,{value:null,writable:!0}),mn(r,Lu,{value:e._readableState.endEmitted,writable:!0}),mn(r,E0,{value:function(s,a){var c=i[ds].read();c?(i[fs]=null,i[gn]=null,i[hs]=null,s(yn(c,!1))):(i[gn]=s,i[hs]=a)},writable:!0}),r));return i[fs]=null,Bw(e,function(n){if(n&&n.code!=="ERR_STREAM_PREMATURE_CLOSE"){var s=i[hs];s!==null&&(i[fs]=null,i[gn]=null,i[hs]=null,s(n)),i[l1]=n;return}var a=i[gn];a!==null&&(i[fs]=null,i[gn]=null,i[hs]=null,a(yn(void 0,!0))),i[Lu]=!0}),e.on("readable",jw.bind(null,i)),i};Hp.exports=Ww});var Jp=H((cA,Zp)=>{"use strict";function Vp(t,e,r,i,n,s,a){try{var c=t[s](a),d=c.value}catch(p){r(p);return}c.done?e(d):Promise.resolve(d).then(i,n)}function Fw(t){return function(){var e=this,r=arguments;return new Promise(function(i,n){var s=t.apply(e,r);function a(d){Vp(s,i,n,a,c,"next",d)}function c(d){Vp(s,i,n,a,c,"throw",d)}a(void 0)})}}function Kp(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function Hw(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Kp(Object(r),!0).forEach(function(i){Gw(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Kp(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function Gw(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var Vw=dn().codes.ERR_INVALID_ARG_TYPE;function Kw(t,e,r){var i;if(e&&typeof e.next=="function")i=e;else if(e&&e[Symbol.asyncIterator])i=e[Symbol.asyncIterator]();else if(e&&e[Symbol.iterator])i=e[Symbol.iterator]();else throw new Vw("iterable",["Iterable"],e);var n=new t(Hw({objectMode:!0},r)),s=!1;n._read=function(){s||(s=!0,a())};function a(){return c.apply(this,arguments)}function c(){return c=Fw(function*(){try{var d=yield i.next(),p=d.value,m=d.done;m?n.push(null):n.push(yield p)?a():s=!1}catch(w){n.destroy(w)}}),c.apply(this,arguments)}return n}Zp.exports=Kw});var w0=H((fA,om)=>{"use strict";om.exports=Te;var Lo;Te.ReadableState=em;var hA=require("events").EventEmitter,Qp=function(e,r){return e.listeners(r).length},c1=a0(),Nu=require("buffer").Buffer,Zw=global.Uint8Array||function(){};function Jw(t){return Nu.from(t)}function Yw(t){return Nu.isBuffer(t)||t instanceof Zw}var R0=require("util"),ye;R0&&R0.debuglog?ye=R0.debuglog("stream"):ye=function(){};var Xw=vp(),O0=c0(),Qw=h0(),e_=Qw.getHighWaterMark,Du=dn().codes,t_=Du.ERR_INVALID_ARG_TYPE,r_=Du.ERR_STREAM_PUSH_AFTER_EOF,i_=Du.ERR_METHOD_NOT_IMPLEMENTED,n_=Du.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,No,C0,A0;Io()(Te,c1);var u1=O0.errorOrDestroy,P0=["error","close","destroy","pause","resume"];function s_(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}function em(t,e,r){Lo=Lo||us(),t=t||{},typeof r!="boolean"&&(r=e instanceof Lo),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=e_(this,t,"readableHighWaterMark",r),this.buffer=new Xw,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=t.emitClose!==!1,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(No||(No=M0().StringDecoder),this.decoder=new No(t.encoding),this.encoding=t.encoding)}function Te(t){if(Lo=Lo||us(),!(this instanceof Te))return new Te(t);var e=this instanceof Lo;this._readableState=new em(t,this,e),this.readable=!0,t&&(typeof t.read=="function"&&(this._read=t.read),typeof t.destroy=="function"&&(this._destroy=t.destroy)),c1.call(this)}Object.defineProperty(Te.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(e){!this._readableState||(this._readableState.destroyed=e)}});Te.prototype.destroy=O0.destroy;Te.prototype._undestroy=O0.undestroy;Te.prototype._destroy=function(t,e){e(t)};Te.prototype.push=function(t,e){var r=this._readableState,i;return r.objectMode?i=!0:typeof t=="string"&&(e=e||r.defaultEncoding,e!==r.encoding&&(t=Nu.from(t,e),e=""),i=!0),tm(this,t,e,!1,i)};Te.prototype.unshift=function(t){return tm(this,t,null,!0,!1)};function tm(t,e,r,i,n){ye("readableAddChunk",e);var s=t._readableState;if(e===null)s.reading=!1,l_(t,s);else{var a;if(n||(a=o_(s,e)),a)u1(t,a);else if(s.objectMode||e&&e.length>0)if(typeof e!="string"&&!s.objectMode&&Object.getPrototypeOf(e)!==Nu.prototype&&(e=Jw(e)),i)s.endEmitted?u1(t,new n_):T0(t,s,e,!0);else if(s.ended)u1(t,new r_);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!r?(e=s.decoder.write(e),s.objectMode||e.length!==0?T0(t,s,e,!1):k0(t,s)):T0(t,s,e,!1)}else i||(s.reading=!1,k0(t,s))}return!s.ended&&(s.length<s.highWaterMark||s.length===0)}function T0(t,e,r,i){e.flowing&&e.length===0&&!e.sync?(e.awaitDrain=0,t.emit("data",r)):(e.length+=e.objectMode?1:r.length,i?e.buffer.unshift(r):e.buffer.push(r),e.needReadable&&Bu(t)),k0(t,e)}function o_(t,e){var r;return!Yw(e)&&typeof e!="string"&&e!==void 0&&!t.objectMode&&(r=new t_("chunk",["string","Buffer","Uint8Array"],e)),r}Te.prototype.isPaused=function(){return this._readableState.flowing===!1};Te.prototype.setEncoding=function(t){No||(No=M0().StringDecoder);var e=new No(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;for(var r=this._readableState.buffer.head,i="";r!==null;)i+=e.write(r.data),r=r.next;return this._readableState.buffer.clear(),i!==""&&this._readableState.buffer.push(i),this._readableState.length=i.length,this};var Yp=1073741824;function a_(t){return t>=Yp?t=Yp:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}function Xp(t,e){return t<=0||e.length===0&&e.ended?0:e.objectMode?1:t!==t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=a_(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}Te.prototype.read=function(t){ye("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(t!==0&&(e.emittedReadable=!1),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return ye("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?I0(this):Bu(this),null;if(t=Xp(t,e),t===0&&e.ended)return e.length===0&&I0(this),null;var i=e.needReadable;ye("need readable",i),(e.length===0||e.length-t<e.highWaterMark)&&(i=!0,ye("length less than watermark",i)),e.ended||e.reading?(i=!1,ye("reading or ended",i)):i&&(ye("do read"),e.reading=!0,e.sync=!0,e.length===0&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=Xp(r,e)));var n;return t>0?n=nm(t,e):n=null,n===null?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),e.length===0&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&I0(this)),n!==null&&this.emit("data",n),n};function l_(t,e){if(ye("onEofChunk"),!e.ended){if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?Bu(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,rm(t)))}}function Bu(t){var e=t._readableState;ye("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(ye("emitReadable",e.flowing),e.emittedReadable=!0,process.nextTick(rm,t))}function rm(t){var e=t._readableState;ye("emitReadable_",e.destroyed,e.length,e.ended),!e.destroyed&&(e.length||e.ended)&&(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,L0(t)}function k0(t,e){e.readingMore||(e.readingMore=!0,process.nextTick(u_,t,e))}function u_(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&e.length===0);){var r=e.length;if(ye("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}Te.prototype._read=function(t){u1(this,new i_("_read()"))};Te.prototype.pipe=function(t,e){var r=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=t;break;case 1:i.pipes=[i.pipes,t];break;default:i.pipes.push(t);break}i.pipesCount+=1,ye("pipe count=%d opts=%j",i.pipesCount,e);var n=(!e||e.end!==!1)&&t!==process.stdout&&t!==process.stderr,s=n?c:x;i.endEmitted?process.nextTick(s):r.once("end",s),t.on("unpipe",a);function a(A,C){ye("onunpipe"),A===r&&C&&C.hasUnpiped===!1&&(C.hasUnpiped=!0,m())}function c(){ye("onend"),t.end()}var d=c_(r);t.on("drain",d);var p=!1;function m(){ye("cleanup"),t.removeListener("close",v),t.removeListener("finish",R),t.removeListener("drain",d),t.removeListener("error",S),t.removeListener("unpipe",a),r.removeListener("end",c),r.removeListener("end",x),r.removeListener("data",w),p=!0,i.awaitDrain&&(!t._writableState||t._writableState.needDrain)&&d()}r.on("data",w);function w(A){ye("ondata");var C=t.write(A);ye("dest.write",C),C===!1&&((i.pipesCount===1&&i.pipes===t||i.pipesCount>1&&sm(i.pipes,t)!==-1)&&!p&&(ye("false write response, pause",i.awaitDrain),i.awaitDrain++),r.pause())}function S(A){ye("onerror",A),x(),t.removeListener("error",S),Qp(t,"error")===0&&u1(t,A)}s_(t,"error",S);function v(){t.removeListener("finish",R),x()}t.once("close",v);function R(){ye("onfinish"),t.removeListener("close",v),x()}t.once("finish",R);function x(){ye("unpipe"),r.unpipe(t)}return t.emit("pipe",r),i.flowing||(ye("pipe resume"),r.resume()),t};function c_(t){return function(){var r=t._readableState;ye("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,r.awaitDrain===0&&Qp(t,"data")&&(r.flowing=!0,L0(t))}}Te.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(e.pipesCount===0)return this;if(e.pipesCount===1)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r),this);if(!t){var i=e.pipes,n=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var s=0;s<n;s++)i[s].emit("unpipe",this,{hasUnpiped:!1});return this}var a=sm(e.pipes,t);return a===-1?this:(e.pipes.splice(a,1),e.pipesCount-=1,e.pipesCount===1&&(e.pipes=e.pipes[0]),t.emit("unpipe",this,r),this)};Te.prototype.on=function(t,e){var r=c1.prototype.on.call(this,t,e),i=this._readableState;return t==="data"?(i.readableListening=this.listenerCount("readable")>0,i.flowing!==!1&&this.resume()):t==="readable"&&!i.endEmitted&&!i.readableListening&&(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,ye("on readable",i.length,i.reading),i.length?Bu(this):i.reading||process.nextTick(h_,this)),r};Te.prototype.addListener=Te.prototype.on;Te.prototype.removeListener=function(t,e){var r=c1.prototype.removeListener.call(this,t,e);return t==="readable"&&process.nextTick(im,this),r};Te.prototype.removeAllListeners=function(t){var e=c1.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&process.nextTick(im,this),e};function im(t){var e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function h_(t){ye("readable nexttick read 0"),t.read(0)}Te.prototype.resume=function(){var t=this._readableState;return t.flowing||(ye("resume"),t.flowing=!t.readableListening,f_(this,t)),t.paused=!1,this};function f_(t,e){e.resumeScheduled||(e.resumeScheduled=!0,process.nextTick(d_,t,e))}function d_(t,e){ye("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),L0(t),e.flowing&&!e.reading&&t.read(0)}Te.prototype.pause=function(){return ye("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(ye("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function L0(t){var e=t._readableState;for(ye("flow",e.flowing);e.flowing&&t.read()!==null;);}Te.prototype.wrap=function(t){var e=this,r=this._readableState,i=!1;t.on("end",function(){if(ye("wrapped end"),r.decoder&&!r.ended){var a=r.decoder.end();a&&a.length&&e.push(a)}e.push(null)}),t.on("data",function(a){if(ye("wrapped data"),r.decoder&&(a=r.decoder.write(a)),!(r.objectMode&&a==null)&&!(!r.objectMode&&(!a||!a.length))){var c=e.push(a);c||(i=!0,t.pause())}});for(var n in t)this[n]===void 0&&typeof t[n]=="function"&&(this[n]=function(c){return function(){return t[c].apply(t,arguments)}}(n));for(var s=0;s<P0.length;s++)t.on(P0[s],this.emit.bind(this,P0[s]));return this._read=function(a){ye("wrapped _read",a),i&&(i=!1,t.resume())},this};typeof Symbol=="function"&&(Te.prototype[Symbol.asyncIterator]=function(){return C0===void 0&&(C0=Gp()),C0(this)});Object.defineProperty(Te.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}});Object.defineProperty(Te.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}});Object.defineProperty(Te.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}});Te._fromList=nm;Object.defineProperty(Te.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function nm(t,e){if(e.length===0)return null;var r;return e.objectMode?r=e.buffer.shift():!t||t>=e.length?(e.decoder?r=e.buffer.join(""):e.buffer.length===1?r=e.buffer.first():r=e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r}function I0(t){var e=t._readableState;ye("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,process.nextTick(p_,e,t))}function p_(t,e){if(ye("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&t.length===0&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}typeof Symbol=="function"&&(Te.from=function(t,e){return A0===void 0&&(A0=Jp()),A0(Te,t,e)});function sm(t,e){for(var r=0,i=t.length;r<i;r++)if(t[r]===e)return r;return-1}});var N0=H((dA,lm)=>{"use strict";lm.exports=Ui;var zu=dn().codes,m_=zu.ERR_METHOD_NOT_IMPLEMENTED,g_=zu.ERR_MULTIPLE_CALLBACK,y_=zu.ERR_TRANSFORM_ALREADY_TRANSFORMING,b_=zu.ERR_TRANSFORM_WITH_LENGTH_0,ju=us();Io()(Ui,ju);function v_(t,e){var r=this._transformState;r.transforming=!1;var i=r.writecb;if(i===null)return this.emit("error",new g_);r.writechunk=null,r.writecb=null,e!=null&&this.push(e),i(t);var n=this._readableState;n.reading=!1,(n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}function Ui(t){if(!(this instanceof Ui))return new Ui(t);ju.call(this,t),this._transformState={afterTransform:v_.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",w_)}function w_(){var t=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(e,r){am(t,e,r)}):am(this,null,null)}Ui.prototype.push=function(t,e){return this._transformState.needTransform=!1,ju.prototype.push.call(this,t,e)};Ui.prototype._transform=function(t,e,r){r(new m_("_transform()"))};Ui.prototype._write=function(t,e,r){var i=this._transformState;if(i.writecb=r,i.writechunk=t,i.writeencoding=e,!i.transforming){var n=this._readableState;(i.needTransform||n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}};Ui.prototype._read=function(t){var e=this._transformState;e.writechunk!==null&&!e.transforming?(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform)):e.needTransform=!0};Ui.prototype._destroy=function(t,e){ju.prototype._destroy.call(this,t,function(r){e(r)})};function am(t,e,r){if(e)return t.emit("error",e);if(r!=null&&t.push(r),t._writableState.length)throw new b_;if(t._transformState.transforming)throw new y_;return t.push(null)}});var hm=H((pA,cm)=>{"use strict";cm.exports=h1;var um=N0();Io()(h1,um);function h1(t){if(!(this instanceof h1))return new h1(t);um.call(this,t)}h1.prototype._transform=function(t,e,r){r(null,t)}});var gm=H((mA,mm)=>{"use strict";var D0;function __(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}var pm=dn().codes,S_=pm.ERR_MISSING_ARGS,x_=pm.ERR_STREAM_DESTROYED;function fm(t){if(t)throw t}function M_(t){return t.setHeader&&typeof t.abort=="function"}function E_(t,e,r,i){i=__(i);var n=!1;t.on("close",function(){n=!0}),D0===void 0&&(D0=ku()),D0(t,{readable:e,writable:r},function(a){if(a)return i(a);n=!0,i()});var s=!1;return function(a){if(!n&&!s){if(s=!0,M_(t))return t.abort();if(typeof t.destroy=="function")return t.destroy();i(a||new x_("pipe"))}}}function dm(t){t()}function R_(t,e){return t.pipe(e)}function C_(t){return!t.length||typeof t[t.length-1]!="function"?fm:t.pop()}function A_(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var i=C_(e);if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw new S_("streams");var n,s=e.map(function(a,c){var d=c<e.length-1,p=c>0;return E_(a,d,p,function(m){n||(n=m),m&&s.forEach(dm),!d&&(s.forEach(dm),i(n))})});return e.reduce(R_)}mm.exports=A_});var ym=H((xr,d1)=>{var f1=require("stream");process.env.READABLE_STREAM==="disable"&&f1?(d1.exports=f1.Readable,Object.assign(d1.exports,f1),d1.exports.Stream=f1):(xr=d1.exports=w0(),xr.Stream=f1||xr,xr.Readable=xr,xr.Writable=y0(),xr.Duplex=us(),xr.Transform=N0(),xr.PassThrough=hm(),xr.finished=ku(),xr.pipeline=gm())});var _m=H((gA,wm)=>{"use strict";var{Transform:P_}=ym(),{StringDecoder:T_}=require("string_decoder"),bn=Symbol("last"),qu=Symbol("decoder");function I_(t,e,r){var i;if(this.overflow){var n=this[qu].write(t);if(i=n.split(this.matcher),i.length===1)return r();i.shift(),this.overflow=!1}else this[bn]+=this[qu].write(t),i=this[bn].split(this.matcher);this[bn]=i.pop();for(var s=0;s<i.length;s++)vm(this,this.mapper(i[s]));if(this.overflow=this[bn].length>this.maxLength,this.overflow&&!this.skipOverflow)return r(new Error("maximum buffer reached"));r()}function k_(t){this[bn]+=this[qu].end(),this[bn]&&vm(this,this.mapper(this[bn])),t()}function vm(t,e){e!==void 0&&t.push(e)}function bm(t){return t}function O_(t,e,r){switch(t=t||/\r?\n/,e=e||bm,r=r||{},arguments.length){case 1:typeof t=="function"?(e=t,t=/\r?\n/):typeof t=="object"&&!(t instanceof RegExp)&&(r=t,t=/\r?\n/);break;case 2:typeof t=="function"?(r=e,e=t,t=/\r?\n/):typeof e=="object"&&(r=e,e=bm)}r=Object.assign({},r),r.transform=I_,r.flush=k_,r.readableObjectMode=!0;let i=new P_(r);return i[bn]="",i[qu]=new T_("utf8"),i.matcher=t,i.mapper=e,i.maxLength=r.maxLength,i.skipOverflow=r.skipOverflow,i.overflow=!1,i}wm.exports=O_});var Wm=H((dP,$m)=>{"use strict";$m.exports=Gu;Gu.polyline=Gu;Gu.polygon=H_;function Gu(t,e,r){var i=t.length,n=jo(t[0],e),s=[],a,c,d,p,m;for(r||(r=[]),a=1;a<i;a++){for(c=t[a-1],d=t[a],p=m=jo(d,e);;)if(n|p){if(n&p)break;n?(c=H0(c,d,n,e),n=jo(c,e)):(d=H0(c,d,p,e),p=jo(d,e))}else{s.push(c),p!==m?(s.push(d),a<i-1&&(r.push(s),s=[])):a===i-1&&s.push(d);break}n=m}return s.length&&r.push(s),r}function H_(t,e){var r,i,n,s,a,c,d;for(i=1;i<=8;i*=2){for(r=[],n=t[t.length-1],s=!(jo(n,e)&i),a=0;a<t.length;a++)c=t[a],d=!(jo(c,e)&i),d!==s&&r.push(H0(n,c,i,e)),d&&r.push(c),n=c,s=d;if(t=r,!t.length)break}return r}function H0(t,e,r,i){return r&8?[t[0]+(e[0]-t[0])*(i[3]-t[1])/(e[1]-t[1]),i[3]]:r&4?[t[0]+(e[0]-t[0])*(i[1]-t[1])/(e[1]-t[1]),i[1]]:r&2?[i[2],t[1]+(e[1]-t[1])*(i[2]-t[0])/(e[0]-t[0])]:r&1?[i[0],t[1]+(e[1]-t[1])*(i[0]-t[0])/(e[0]-t[0])]:null}function jo(t,e){var r=0;return t[0]<e[0]?r|=1:t[0]>e[2]&&(r|=2),t[1]<e[1]?r|=4:t[1]>e[3]&&(r|=8),r}});var Fm=H((G0,V0)=>{(function(t,e){typeof G0=="object"&&typeof V0<"u"?V0.exports=e():typeof define=="function"&&define.amd?define(e):t.SplayTree=e()})(G0,function(){"use strict";var t=function(){function R(x,A){this.next=null,this.key=x,this.data=A,this.left=null,this.right=null}return R}();function e(R,x){return R>x?1:R<x?-1:0}function r(R,x,A){for(var C=new t(null,null),T=C,O=C;;){var B=A(R,x.key);if(B<0){if(x.left===null)break;if(A(R,x.left.key)<0){var z=x.left;if(x.left=z.right,z.right=x,x=z,x.left===null)break}O.left=x,O=x,x=x.left}else if(B>0){if(x.right===null)break;if(A(R,x.right.key)>0){var z=x.right;if(x.right=z.left,z.left=x,x=z,x.right===null)break}T.right=x,T=x,x=x.right}else break}return T.right=x.left,O.left=x.right,x.left=C.right,x.right=C.left,x}function i(R,x,A,C){var T=new t(R,x);if(A===null)return T.left=T.right=null,T;A=r(R,A,C);var O=C(R,A.key);return O<0?(T.left=A.left,T.right=A,A.left=null):O>=0&&(T.right=A.right,T.left=A,A.right=null),T}function n(R,x,A){var C=null,T=null;if(x){x=r(R,x,A);var O=A(x.key,R);O===0?(C=x.left,T=x.right):O<0?(T=x.right,x.right=null,C=x):(C=x.left,x.left=null,T=x)}return{left:C,right:T}}function s(R,x,A){return x===null?R:(R===null||(x=r(R.key,x,A),x.left=R),x)}function a(R,x,A,C,T){if(R){C(""+x+(A?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ")+T(R)+`
105
+ `);var O=x+(A?" ":"\u2502 ");R.left&&a(R.left,O,!1,C,T),R.right&&a(R.right,O,!0,C,T)}}var c=function(){function R(x){x===void 0&&(x=e),this._root=null,this._size=0,this._comparator=x}return R.prototype.insert=function(x,A){return this._size++,this._root=i(x,A,this._root,this._comparator)},R.prototype.add=function(x,A){var C=new t(x,A);this._root===null&&(C.left=C.right=null,this._size++,this._root=C);var T=this._comparator,O=r(x,this._root,T),B=T(x,O.key);return B===0?this._root=O:(B<0?(C.left=O.left,C.right=O,O.left=null):B>0&&(C.right=O.right,C.left=O,O.right=null),this._size++,this._root=C),this._root},R.prototype.remove=function(x){this._root=this._remove(x,this._root,this._comparator)},R.prototype._remove=function(x,A,C){var T;if(A===null)return null;A=r(x,A,C);var O=C(x,A.key);return O===0?(A.left===null?T=A.right:(T=r(x,A.left,C),T.right=A.right),this._size--,T):A},R.prototype.pop=function(){var x=this._root;if(x){for(;x.left;)x=x.left;return this._root=r(x.key,this._root,this._comparator),this._root=this._remove(x.key,this._root,this._comparator),{key:x.key,data:x.data}}return null},R.prototype.findStatic=function(x){for(var A=this._root,C=this._comparator;A;){var T=C(x,A.key);if(T===0)return A;T<0?A=A.left:A=A.right}return null},R.prototype.find=function(x){return this._root&&(this._root=r(x,this._root,this._comparator),this._comparator(x,this._root.key)!==0)?null:this._root},R.prototype.contains=function(x){for(var A=this._root,C=this._comparator;A;){var T=C(x,A.key);if(T===0)return!0;T<0?A=A.left:A=A.right}return!1},R.prototype.forEach=function(x,A){for(var C=this._root,T=[],O=!1;!O;)C!==null?(T.push(C),C=C.left):T.length!==0?(C=T.pop(),x.call(A,C),C=C.right):O=!0;return this},R.prototype.range=function(x,A,C,T){for(var O=[],B=this._comparator,z=this._root,G;O.length!==0||z;)if(z)O.push(z),z=z.left;else{if(z=O.pop(),G=B(z.key,A),G>0)break;if(B(z.key,x)>=0&&C.call(T,z))return this;z=z.right}return this},R.prototype.keys=function(){var x=[];return this.forEach(function(A){var C=A.key;return x.push(C)}),x},R.prototype.values=function(){var x=[];return this.forEach(function(A){var C=A.data;return x.push(C)}),x},R.prototype.min=function(){return this._root?this.minNode(this._root).key:null},R.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},R.prototype.minNode=function(x){if(x===void 0&&(x=this._root),x)for(;x.left;)x=x.left;return x},R.prototype.maxNode=function(x){if(x===void 0&&(x=this._root),x)for(;x.right;)x=x.right;return x},R.prototype.at=function(x){for(var A=this._root,C=!1,T=0,O=[];!C;)if(A)O.push(A),A=A.left;else if(O.length>0){if(A=O.pop(),T===x)return A;T++,A=A.right}else C=!0;return null},R.prototype.next=function(x){var A=this._root,C=null;if(x.right){for(C=x.right;C.left;)C=C.left;return C}for(var T=this._comparator;A;){var O=T(x.key,A.key);if(O===0)break;O<0?(C=A,A=A.left):A=A.right}return C},R.prototype.prev=function(x){var A=this._root,C=null;if(x.left!==null){for(C=x.left;C.right;)C=C.right;return C}for(var T=this._comparator;A;){var O=T(x.key,A.key);if(O===0)break;O<0?A=A.left:(C=A,A=A.right)}return C},R.prototype.clear=function(){return this._root=null,this._size=0,this},R.prototype.toList=function(){return m(this._root)},R.prototype.load=function(x,A,C){A===void 0&&(A=[]),C===void 0&&(C=!1);var T=x.length,O=this._comparator;if(C&&v(x,A,0,T-1,O),this._root===null)this._root=d(x,A,0,T),this._size=T;else{var B=S(this.toList(),p(x,A),O);T=this._size+T,this._root=w({head:B},0,T)}return this},R.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(R.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(R.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),R.prototype.toString=function(x){x===void 0&&(x=function(C){return String(C.key)});var A=[];return a(this._root,"",!0,function(C){return A.push(C)},x),A.join("")},R.prototype.update=function(x,A,C){var T=this._comparator,O=n(x,this._root,T),B=O.left,z=O.right;T(x,A)<0?z=i(A,C,z,T):B=i(A,C,B,T),this._root=s(B,z,T)},R.prototype.split=function(x){return n(x,this._root,this._comparator)},R}();function d(R,x,A,C){var T=C-A;if(T>0){var O=A+Math.floor(T/2),B=R[O],z=x[O],G=new t(B,z);return G.left=d(R,x,A,O),G.right=d(R,x,O+1,C),G}return null}function p(R,x){for(var A=new t(null,null),C=A,T=0;T<R.length;T++)C=C.next=new t(R[T],x[T]);return C.next=null,A.next}function m(R){for(var x=R,A=[],C=!1,T=new t(null,null),O=T;!C;)x?(A.push(x),x=x.left):A.length>0?(x=O=O.next=A.pop(),x=x.right):C=!0;return O.next=null,T.next}function w(R,x,A){var C=A-x;if(C>0){var T=x+Math.floor(C/2),O=w(R,x,T),B=R.head;return B.left=O,R.head=R.head.next,B.right=w(R,T+1,A),B}return null}function S(R,x,A){for(var C=new t(null,null),T=C,O=R,B=x;O!==null&&B!==null;)A(O.key,B.key)<0?(T.next=O,O=O.next):(T.next=B,B=B.next),T=T.next;return O!==null?T.next=O:B!==null&&(T.next=B),C.next}function v(R,x,A,C,T){if(!(A>=C)){for(var O=R[A+C>>1],B=A-1,z=C+1;;){do B++;while(T(R[B],O)<0);do z--;while(T(R[z],O)>0);if(B>=z)break;var G=R[B];R[B]=R[z],R[z]=G,G=x[B],x[B]=x[z],x[z]=G}v(R,x,A,z,T),v(R,x,z+1,C,T)}}return c})});var r6=H((pP,t6)=>{"use strict";var G_=Fm();function V_(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var J0=V_(G_);function Mr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Hm(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function It(t,e,r){return e&&Hm(t.prototype,e),r&&Hm(t,r),t}var g1=function(e,r){return e.ll.x<=r.x&&r.x<=e.ur.x&&e.ll.y<=r.y&&r.y<=e.ur.y},K0=function(e,r){if(r.ur.x<e.ll.x||e.ur.x<r.ll.x||r.ur.y<e.ll.y||e.ur.y<r.ll.y)return null;var i=e.ll.x<r.ll.x?r.ll.x:e.ll.x,n=e.ur.x<r.ur.x?e.ur.x:r.ur.x,s=e.ll.y<r.ll.y?r.ll.y:e.ll.y,a=e.ur.y<r.ur.y?e.ur.y:r.ur.y;return{ll:{x:i,y:s},ur:{x:n,y:a}}},wn=Number.EPSILON;wn===void 0&&(wn=Math.pow(2,-52));var K_=wn*wn,Z0=function(e,r){if(-wn<e&&e<wn&&-wn<r&&r<wn)return 0;var i=e-r;return i*i<K_*e*r?0:e<r?-1:1},Z_=function(){function t(){Mr(this,t),this.reset()}return It(t,[{key:"reset",value:function(){this.xRounder=new Gm,this.yRounder=new Gm}},{key:"round",value:function(r,i){return{x:this.xRounder.round(r),y:this.yRounder.round(i)}}}]),t}(),Gm=function(){function t(){Mr(this,t),this.tree=new J0.default,this.round(0)}return It(t,[{key:"round",value:function(r){var i=this.tree.add(r),n=this.tree.prev(i);if(n!==null&&Z0(i.key,n.key)===0)return this.tree.remove(r),n.key;var s=this.tree.next(i);return s!==null&&Z0(i.key,s.key)===0?(this.tree.remove(r),s.key):r}}]),t}(),b1=new Z_,y1=function(e,r){return e.x*r.y-e.y*r.x},e6=function(e,r){return e.x*r.x+e.y*r.y},Vm=function(e,r,i){var n={x:r.x-e.x,y:r.y-e.y},s={x:i.x-e.x,y:i.y-e.y},a=y1(n,s);return Z0(a,0)},Vu=function(e){return Math.sqrt(e6(e,e))},J_=function(e,r,i){var n={x:r.x-e.x,y:r.y-e.y},s={x:i.x-e.x,y:i.y-e.y};return y1(s,n)/Vu(s)/Vu(n)},Y_=function(e,r,i){var n={x:r.x-e.x,y:r.y-e.y},s={x:i.x-e.x,y:i.y-e.y};return e6(s,n)/Vu(s)/Vu(n)},Km=function(e,r,i){return r.y===0?null:{x:e.x+r.x/r.y*(i-e.y),y:i}},Zm=function(e,r,i){return r.x===0?null:{x:i,y:e.y+r.y/r.x*(i-e.x)}},X_=function(e,r,i,n){if(r.x===0)return Zm(i,n,e.x);if(n.x===0)return Zm(e,r,i.x);if(r.y===0)return Km(i,n,e.y);if(n.y===0)return Km(e,r,i.y);var s=y1(r,n);if(s==0)return null;var a={x:i.x-e.x,y:i.y-e.y},c=y1(a,r)/s,d=y1(a,n)/s,p=e.x+d*r.x,m=i.x+c*n.x,w=e.y+d*r.y,S=i.y+c*n.y,v=(p+m)/2,R=(w+S)/2;return{x:v,y:R}},pi=function(){It(t,null,[{key:"compare",value:function(r,i){var n=t.comparePoints(r.point,i.point);return n!==0?n:(r.point!==i.point&&r.link(i),r.isLeft!==i.isLeft?r.isLeft?1:-1:Ku.compare(r.segment,i.segment))}},{key:"comparePoints",value:function(r,i){return r.x<i.x?-1:r.x>i.x?1:r.y<i.y?-1:r.y>i.y?1:0}}]);function t(e,r){Mr(this,t),e.events===void 0?e.events=[this]:e.events.push(this),this.point=e,this.isLeft=r}return It(t,[{key:"link",value:function(r){if(r.point===this.point)throw new Error("Tried to link already linked events");for(var i=r.point.events,n=0,s=i.length;n<s;n++){var a=i[n];this.point.events.push(a),a.point=this.point}this.checkForConsuming()}},{key:"checkForConsuming",value:function(){for(var r=this.point.events.length,i=0;i<r;i++){var n=this.point.events[i];if(n.segment.consumedBy===void 0)for(var s=i+1;s<r;s++){var a=this.point.events[s];a.consumedBy===void 0&&n.otherSE.point.events===a.otherSE.point.events&&n.segment.consume(a.segment)}}}},{key:"getAvailableLinkedEvents",value:function(){for(var r=[],i=0,n=this.point.events.length;i<n;i++){var s=this.point.events[i];s!==this&&!s.segment.ringOut&&s.segment.isInResult()&&r.push(s)}return r}},{key:"getLeftmostComparator",value:function(r){var i=this,n=new Map,s=function(c){var d=c.otherSE;n.set(c,{sine:J_(i.point,r.point,d.point),cosine:Y_(i.point,r.point,d.point)})};return function(a,c){n.has(a)||s(a),n.has(c)||s(c);var d=n.get(a),p=d.sine,m=d.cosine,w=n.get(c),S=w.sine,v=w.cosine;return p>=0&&S>=0?m<v?1:m>v?-1:0:p<0&&S<0?m<v?-1:m>v?1:0:S<p?-1:S>p?1:0}}}]),t}(),Q_=0,Ku=function(){It(t,null,[{key:"compare",value:function(r,i){var n=r.leftSE.point.x,s=i.leftSE.point.x,a=r.rightSE.point.x,c=i.rightSE.point.x;if(c<n)return 1;if(a<s)return-1;var d=r.leftSE.point.y,p=i.leftSE.point.y,m=r.rightSE.point.y,w=i.rightSE.point.y;if(n<s){if(p<d&&p<m)return 1;if(p>d&&p>m)return-1;var S=r.comparePoint(i.leftSE.point);if(S<0)return 1;if(S>0)return-1;var v=i.comparePoint(r.rightSE.point);return v!==0?v:-1}if(n>s){if(d<p&&d<w)return-1;if(d>p&&d>w)return 1;var R=i.comparePoint(r.leftSE.point);if(R!==0)return R;var x=r.comparePoint(i.rightSE.point);return x<0?1:x>0?-1:1}if(d<p)return-1;if(d>p)return 1;if(a<c){var A=i.comparePoint(r.rightSE.point);if(A!==0)return A}if(a>c){var C=r.comparePoint(i.rightSE.point);if(C<0)return 1;if(C>0)return-1}if(a!==c){var T=m-d,O=a-n,B=w-p,z=c-s;if(T>O&&B<z)return 1;if(T<O&&B>z)return-1}return a>c?1:a<c||m<w?-1:m>w?1:r.id<i.id?-1:r.id>i.id?1:0}}]);function t(e,r,i,n){Mr(this,t),this.id=++Q_,this.leftSE=e,e.segment=this,e.otherSE=r,this.rightSE=r,r.segment=this,r.otherSE=e,this.rings=i,this.windings=n}return It(t,[{key:"replaceRightSE",value:function(r){this.rightSE=r,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}},{key:"bbox",value:function(){var r=this.leftSE.point.y,i=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:r<i?r:i},ur:{x:this.rightSE.point.x,y:r>i?r:i}}}},{key:"vector",value:function(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}},{key:"isAnEndpoint",value:function(r){return r.x===this.leftSE.point.x&&r.y===this.leftSE.point.y||r.x===this.rightSE.point.x&&r.y===this.rightSE.point.y}},{key:"comparePoint",value:function(r){if(this.isAnEndpoint(r))return 0;var i=this.leftSE.point,n=this.rightSE.point,s=this.vector();if(i.x===n.x)return r.x===i.x?0:r.x<i.x?1:-1;var a=(r.y-i.y)/s.y,c=i.x+a*s.x;if(r.x===c)return 0;var d=(r.x-i.x)/s.x,p=i.y+d*s.y;return r.y===p?0:r.y<p?-1:1}},{key:"getIntersection",value:function(r){var i=this.bbox(),n=r.bbox(),s=K0(i,n);if(s===null)return null;var a=this.leftSE.point,c=this.rightSE.point,d=r.leftSE.point,p=r.rightSE.point,m=g1(i,d)&&this.comparePoint(d)===0,w=g1(n,a)&&r.comparePoint(a)===0,S=g1(i,p)&&this.comparePoint(p)===0,v=g1(n,c)&&r.comparePoint(c)===0;if(w&&m)return v&&!S?c:!v&&S?p:null;if(w)return S&&a.x===p.x&&a.y===p.y?null:a;if(m)return v&&c.x===d.x&&c.y===d.y?null:d;if(v&&S)return null;if(v)return c;if(S)return p;var R=X_(a,this.vector(),d,r.vector());return R===null||!g1(s,R)?null:b1.round(R.x,R.y)}},{key:"split",value:function(r){var i=[],n=r.events!==void 0,s=new pi(r,!0),a=new pi(r,!1),c=this.rightSE;this.replaceRightSE(a),i.push(a),i.push(s);var d=new t(s,c,this.rings.slice(),this.windings.slice());return pi.comparePoints(d.leftSE.point,d.rightSE.point)>0&&d.swapEvents(),pi.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),n&&(s.checkForConsuming(),a.checkForConsuming()),i}},{key:"swapEvents",value:function(){var r=this.rightSE;this.rightSE=this.leftSE,this.leftSE=r,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(var i=0,n=this.windings.length;i<n;i++)this.windings[i]*=-1}},{key:"consume",value:function(r){for(var i=this,n=r;i.consumedBy;)i=i.consumedBy;for(;n.consumedBy;)n=n.consumedBy;var s=t.compare(i,n);if(s!==0){if(s>0){var a=i;i=n,n=a}if(i.prev===n){var c=i;i=n,n=c}for(var d=0,p=n.rings.length;d<p;d++){var m=n.rings[d],w=n.windings[d],S=i.rings.indexOf(m);S===-1?(i.rings.push(m),i.windings.push(w)):i.windings[S]+=w}n.rings=null,n.windings=null,n.consumedBy=i,n.leftSE.consumedBy=i.leftSE,n.rightSE.consumedBy=i.rightSE}}},{key:"prevInResult",value:function(){return this._prevInResult!==void 0?this._prevInResult:(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null,this._prevInResult)}},{key:"beforeState",value:function(){if(this._beforeState!==void 0)return this._beforeState;if(!this.prev)this._beforeState={rings:[],windings:[],multiPolys:[]};else{var r=this.prev.consumedBy||this.prev;this._beforeState=r.afterState()}return this._beforeState}},{key:"afterState",value:function(){if(this._afterState!==void 0)return this._afterState;var r=this.beforeState();this._afterState={rings:r.rings.slice(0),windings:r.windings.slice(0),multiPolys:[]};for(var i=this._afterState.rings,n=this._afterState.windings,s=this._afterState.multiPolys,a=0,c=this.rings.length;a<c;a++){var d=this.rings[a],p=this.windings[a],m=i.indexOf(d);m===-1?(i.push(d),n.push(p)):n[m]+=p}for(var w=[],S=[],v=0,R=i.length;v<R;v++)if(n[v]!==0){var x=i[v],A=x.poly;if(S.indexOf(A)===-1)if(x.isExterior)w.push(A);else{S.indexOf(A)===-1&&S.push(A);var C=w.indexOf(x.poly);C!==-1&&w.splice(C,1)}}for(var T=0,O=w.length;T<O;T++){var B=w[T].multiPoly;s.indexOf(B)===-1&&s.push(B)}return this._afterState}},{key:"isInResult",value:function(){if(this.consumedBy)return!1;if(this._isInResult!==void 0)return this._isInResult;var r=this.beforeState().multiPolys,i=this.afterState().multiPolys;switch(jr.type){case"union":{var n=r.length===0,s=i.length===0;this._isInResult=n!==s;break}case"intersection":{var a,c;r.length<i.length?(a=r.length,c=i.length):(a=i.length,c=r.length),this._isInResult=c===jr.numMultiPolys&&a<c;break}case"xor":{var d=Math.abs(r.length-i.length);this._isInResult=d%2===1;break}case"difference":{var p=function(w){return w.length===1&&w[0].isSubject};this._isInResult=p(r)!==p(i);break}default:throw new Error("Unrecognized operation type found ".concat(jr.type))}return this._isInResult}}],[{key:"fromRing",value:function(r,i,n){var s,a,c,d=pi.comparePoints(r,i);if(d<0)s=r,a=i,c=1;else if(d>0)s=i,a=r,c=-1;else throw new Error("Tried to create degenerate segment at [".concat(r.x,", ").concat(r.y,"]"));var p=new pi(s,!0),m=new pi(a,!1);return new t(p,m,[n],[c])}}]),t}(),Jm=function(){function t(e,r,i){if(Mr(this,t),!Array.isArray(e)||e.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=r,this.isExterior=i,this.segments=[],typeof e[0][0]!="number"||typeof e[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var n=b1.round(e[0][0],e[0][1]);this.bbox={ll:{x:n.x,y:n.y},ur:{x:n.x,y:n.y}};for(var s=n,a=1,c=e.length;a<c;a++){if(typeof e[a][0]!="number"||typeof e[a][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var d=b1.round(e[a][0],e[a][1]);d.x===s.x&&d.y===s.y||(this.segments.push(Ku.fromRing(s,d,this)),d.x<this.bbox.ll.x&&(this.bbox.ll.x=d.x),d.y<this.bbox.ll.y&&(this.bbox.ll.y=d.y),d.x>this.bbox.ur.x&&(this.bbox.ur.x=d.x),d.y>this.bbox.ur.y&&(this.bbox.ur.y=d.y),s=d)}(n.x!==s.x||n.y!==s.y)&&this.segments.push(Ku.fromRing(s,n,this))}return It(t,[{key:"getSweepEvents",value:function(){for(var r=[],i=0,n=this.segments.length;i<n;i++){var s=this.segments[i];r.push(s.leftSE),r.push(s.rightSE)}return r}}]),t}(),eS=function(){function t(e,r){if(Mr(this,t),!Array.isArray(e))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new Jm(e[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(var i=1,n=e.length;i<n;i++){var s=new Jm(e[i],this,!1);s.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=s.bbox.ll.x),s.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=s.bbox.ll.y),s.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=s.bbox.ur.x),s.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=s.bbox.ur.y),this.interiorRings.push(s)}this.multiPoly=r}return It(t,[{key:"getSweepEvents",value:function(){for(var r=this.exteriorRing.getSweepEvents(),i=0,n=this.interiorRings.length;i<n;i++)for(var s=this.interiorRings[i].getSweepEvents(),a=0,c=s.length;a<c;a++)r.push(s[a]);return r}}]),t}(),Ym=function(){function t(e,r){if(Mr(this,t),!Array.isArray(e))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{typeof e[0][0][0]=="number"&&(e=[e])}catch{}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(var i=0,n=e.length;i<n;i++){var s=new eS(e[i],this);s.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=s.bbox.ll.x),s.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=s.bbox.ll.y),s.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=s.bbox.ur.x),s.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=s.bbox.ur.y),this.polys.push(s)}this.isSubject=r}return It(t,[{key:"getSweepEvents",value:function(){for(var r=[],i=0,n=this.polys.length;i<n;i++)for(var s=this.polys[i].getSweepEvents(),a=0,c=s.length;a<c;a++)r.push(s[a]);return r}}]),t}(),tS=function(){It(t,null,[{key:"factory",value:function(r){for(var i=[],n=0,s=r.length;n<s;n++){var a=r[n];if(!(!a.isInResult()||a.ringOut)){for(var c=null,d=a.leftSE,p=a.rightSE,m=[d],w=d.point,S=[];c=d,d=p,m.push(d),d.point!==w;)for(;;){var v=d.getAvailableLinkedEvents();if(v.length===0){var R=m[0].point,x=m[m.length-1].point;throw new Error("Unable to complete output ring starting at [".concat(R.x,",")+" ".concat(R.y,"]. Last matching segment found ends at")+" [".concat(x.x,", ").concat(x.y,"]."))}if(v.length===1){p=v[0].otherSE;break}for(var A=null,C=0,T=S.length;C<T;C++)if(S[C].point===d.point){A=C;break}if(A!==null){var O=S.splice(A)[0],B=m.splice(O.index);B.unshift(B[0].otherSE),i.push(new t(B.reverse()));continue}S.push({index:m.length,point:d.point});var z=d.getLeftmostComparator(c);p=v.sort(z)[0].otherSE;break}i.push(new t(m))}}return i}}]);function t(e){Mr(this,t),this.events=e;for(var r=0,i=e.length;r<i;r++)e[r].segment.ringOut=this;this.poly=null}return It(t,[{key:"getGeom",value:function(){for(var r=this.events[0].point,i=[r],n=1,s=this.events.length-1;n<s;n++){var a=this.events[n].point,c=this.events[n+1].point;Vm(a,r,c)!==0&&(i.push(a),r=a)}if(i.length===1)return null;var d=i[0],p=i[1];Vm(d,r,p)===0&&i.shift(),i.push(i[0]);for(var m=this.isExteriorRing()?1:-1,w=this.isExteriorRing()?0:i.length-1,S=this.isExteriorRing()?i.length:-1,v=[],R=w;R!=S;R+=m)v.push([i[R].x,i[R].y]);return v}},{key:"isExteriorRing",value:function(){if(this._isExteriorRing===void 0){var r=this.enclosingRing();this._isExteriorRing=r?!r.isExteriorRing():!0}return this._isExteriorRing}},{key:"enclosingRing",value:function(){return this._enclosingRing===void 0&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}},{key:"_calcEnclosingRing",value:function(){for(var r=this.events[0],i=1,n=this.events.length;i<n;i++){var s=this.events[i];pi.compare(r,s)>0&&(r=s)}for(var a=r.segment.prevInResult(),c=a?a.prevInResult():null;;){if(!a)return null;if(!c)return a.ringOut;if(c.ringOut!==a.ringOut)return c.ringOut.enclosingRing()!==a.ringOut?a.ringOut:a.ringOut.enclosingRing();a=c.prevInResult(),c=a?a.prevInResult():null}}}]),t}(),Xm=function(){function t(e){Mr(this,t),this.exteriorRing=e,e.poly=this,this.interiorRings=[]}return It(t,[{key:"addInterior",value:function(r){this.interiorRings.push(r),r.poly=this}},{key:"getGeom",value:function(){var r=[this.exteriorRing.getGeom()];if(r[0]===null)return null;for(var i=0,n=this.interiorRings.length;i<n;i++){var s=this.interiorRings[i].getGeom();s!==null&&r.push(s)}return r}}]),t}(),rS=function(){function t(e){Mr(this,t),this.rings=e,this.polys=this._composePolys(e)}return It(t,[{key:"getGeom",value:function(){for(var r=[],i=0,n=this.polys.length;i<n;i++){var s=this.polys[i].getGeom();s!==null&&r.push(s)}return r}},{key:"_composePolys",value:function(r){for(var i=[],n=0,s=r.length;n<s;n++){var a=r[n];if(!a.poly)if(a.isExteriorRing())i.push(new Xm(a));else{var c=a.enclosingRing();c.poly||i.push(new Xm(c)),c.poly.addInterior(a)}}return i}}]),t}(),iS=function(){function t(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ku.compare;Mr(this,t),this.queue=e,this.tree=new J0.default(r),this.segments=[]}return It(t,[{key:"process",value:function(r){var i=r.segment,n=[];if(r.consumedBy)return r.isLeft?this.queue.remove(r.otherSE):this.tree.remove(i),n;var s=r.isLeft?this.tree.insert(i):this.tree.find(i);if(!s)throw new Error("Unable to find segment #".concat(i.id," ")+"[".concat(i.leftSE.point.x,", ").concat(i.leftSE.point.y,"] -> ")+"[".concat(i.rightSE.point.x,", ").concat(i.rightSE.point.y,"] ")+"in SweepLine tree. Please submit a bug report.");for(var a=s,c=s,d=void 0,p=void 0;d===void 0;)a=this.tree.prev(a),a===null?d=null:a.key.consumedBy===void 0&&(d=a.key);for(;p===void 0;)c=this.tree.next(c),c===null?p=null:c.key.consumedBy===void 0&&(p=c.key);if(r.isLeft){var m=null;if(d){var w=d.getIntersection(i);if(w!==null&&(i.isAnEndpoint(w)||(m=w),!d.isAnEndpoint(w)))for(var S=this._splitSafely(d,w),v=0,R=S.length;v<R;v++)n.push(S[v])}var x=null;if(p){var A=p.getIntersection(i);if(A!==null&&(i.isAnEndpoint(A)||(x=A),!p.isAnEndpoint(A)))for(var C=this._splitSafely(p,A),T=0,O=C.length;T<O;T++)n.push(C[T])}if(m!==null||x!==null){var B=null;if(m===null)B=x;else if(x===null)B=m;else{var z=pi.comparePoints(m,x);B=z<=0?m:x}this.queue.remove(i.rightSE),n.push(i.rightSE);for(var G=i.split(B),te=0,se=G.length;te<se;te++)n.push(G[te])}n.length>0?(this.tree.remove(i),n.push(r)):(this.segments.push(i),i.prev=d)}else{if(d&&p){var ke=d.getIntersection(p);if(ke!==null){if(!d.isAnEndpoint(ke))for(var De=this._splitSafely(d,ke),Pe=0,We=De.length;Pe<We;Pe++)n.push(De[Pe]);if(!p.isAnEndpoint(ke))for(var ot=this._splitSafely(p,ke),Rt=0,Fr=ot.length;Rt<Fr;Rt++)n.push(ot[Rt])}}this.tree.remove(i)}return n}},{key:"_splitSafely",value:function(r,i){this.tree.remove(r);var n=r.rightSE;this.queue.remove(n);var s=r.split(i);return s.push(n),r.consumedBy===void 0&&this.tree.insert(r),s}}]),t}(),Qm=typeof process<"u"&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,nS=typeof process<"u"&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6,sS=function(){function t(){Mr(this,t)}return It(t,[{key:"run",value:function(r,i,n){jr.type=r,b1.reset();for(var s=[new Ym(i,!0)],a=0,c=n.length;a<c;a++)s.push(new Ym(n[a],!1));if(jr.numMultiPolys=s.length,jr.type==="difference")for(var d=s[0],p=1;p<s.length;)K0(s[p].bbox,d.bbox)!==null?p++:s.splice(p,1);if(jr.type==="intersection"){for(var m=0,w=s.length;m<w;m++)for(var S=s[m],v=m+1,R=s.length;v<R;v++)if(K0(S.bbox,s[v].bbox)===null)return[]}for(var x=new J0.default(pi.compare),A=0,C=s.length;A<C;A++)for(var T=s[A].getSweepEvents(),O=0,B=T.length;O<B;O++)if(x.insert(T[O]),x.size>Qm)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");for(var z=new iS(x),G=x.size,te=x.pop();te;){var se=te.key;if(x.size===G){var ke=se.segment;throw new Error("Unable to pop() ".concat(se.isLeft?"left":"right"," SweepEvent ")+"[".concat(se.point.x,", ").concat(se.point.y,"] from segment #").concat(ke.id," ")+"[".concat(ke.leftSE.point.x,", ").concat(ke.leftSE.point.y,"] -> ")+"[".concat(ke.rightSE.point.x,", ").concat(ke.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(x.size>Qm)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(z.segments.length>nS)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var De=z.process(se),Pe=0,We=De.length;Pe<We;Pe++){var ot=De[Pe];ot.consumedBy===void 0&&x.insert(ot)}G=x.size,te=x.pop()}b1.reset();var Rt=tS.factory(z.segments),Fr=new rS(Rt);return Fr.getGeom()}}]),t}(),jr=new sS,oS=function(e){for(var r=arguments.length,i=new Array(r>1?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];return jr.run("union",e,i)},aS=function(e){for(var r=arguments.length,i=new Array(r>1?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];return jr.run("intersection",e,i)},lS=function(e){for(var r=arguments.length,i=new Array(r>1?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];return jr.run("xor",e,i)},uS=function(e){for(var r=arguments.length,i=new Array(r>1?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];return jr.run("difference",e,i)},cS={union:oS,intersection:aS,xor:lS,difference:uS};t6.exports=cS});var u6=H((X0,Q0)=>{(function(t,e){typeof X0=="object"&&typeof Q0<"u"?Q0.exports=e():typeof define=="function"&&define.amd?define(e):t.proj4=e()})(X0,function(){"use strict";var t=function(o){o("EPSG:4326","+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees"),o("EPSG:4269","+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees"),o("EPSG:3857","+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs"),o.WGS84=o["EPSG:4326"],o["EPSG:3785"]=o["EPSG:3857"],o.GOOGLE=o["EPSG:3857"],o["EPSG:900913"]=o["EPSG:3857"],o["EPSG:102113"]=o["EPSG:3857"]},e=1,r=2,i=4,n=5,s=484813681109536e-20,a=Math.PI/2,c=.16666666666666666,d=.04722222222222222,p=.022156084656084655,m=1e-10,w=.017453292519943295,S=57.29577951308232,v=Math.PI/4,R=Math.PI*2,x=3.14159265359,A={};A.greenwich=0,A.lisbon=-9.131906111111,A.paris=2.337229166667,A.bogota=-74.080916666667,A.madrid=-3.687938888889,A.rome=12.452333333333,A.bern=7.439583333333,A.jakarta=106.807719444444,A.ferro=-17.666666666667,A.brussels=4.367975,A.stockholm=18.058277777778,A.athens=23.7163375,A.oslo=10.722916666667;var C={ft:{to_meter:.3048},"us-ft":{to_meter:1200/3937}},T=/[\s_\-\/\(\)]/g;function O(o,u){if(o[u])return o[u];for(var h=Object.keys(o),y=u.toLowerCase().replace(T,""),g=-1,_,M;++g<h.length;)if(_=h[g],M=_.toLowerCase().replace(T,""),M===y)return o[_]}var B=function(o){var u={},h=o.split("+").map(function(E){return E.trim()}).filter(function(E){return E}).reduce(function(E,P){var k=P.split("=");return k.push(!0),E[k[0].toLowerCase()]=k[1],E},{}),y,g,_,M={proj:"projName",datum:"datumCode",rf:function(E){u.rf=parseFloat(E)},lat_0:function(E){u.lat0=E*w},lat_1:function(E){u.lat1=E*w},lat_2:function(E){u.lat2=E*w},lat_ts:function(E){u.lat_ts=E*w},lon_0:function(E){u.long0=E*w},lon_1:function(E){u.long1=E*w},lon_2:function(E){u.long2=E*w},alpha:function(E){u.alpha=parseFloat(E)*w},lonc:function(E){u.longc=E*w},x_0:function(E){u.x0=parseFloat(E)},y_0:function(E){u.y0=parseFloat(E)},k_0:function(E){u.k0=parseFloat(E)},k:function(E){u.k0=parseFloat(E)},a:function(E){u.a=parseFloat(E)},b:function(E){u.b=parseFloat(E)},r_a:function(){u.R_A=!0},zone:function(E){u.zone=parseInt(E,10)},south:function(){u.utmSouth=!0},towgs84:function(E){u.datum_params=E.split(",").map(function(P){return parseFloat(P)})},to_meter:function(E){u.to_meter=parseFloat(E)},units:function(E){u.units=E;var P=O(C,E);P&&(u.to_meter=P.to_meter)},from_greenwich:function(E){u.from_greenwich=E*w},pm:function(E){var P=O(A,E);u.from_greenwich=(P||parseFloat(E))*w},nadgrids:function(E){E==="@null"?u.datumCode="none":u.nadgrids=E},axis:function(E){var P="ewnsud";E.length===3&&P.indexOf(E.substr(0,1))!==-1&&P.indexOf(E.substr(1,1))!==-1&&P.indexOf(E.substr(2,1))!==-1&&(u.axis=E)}};for(y in h)g=h[y],y in M?(_=M[y],typeof _=="function"?_(g):u[_]=g):u[y]=g;return typeof u.datumCode=="string"&&u.datumCode!=="WGS84"&&(u.datumCode=u.datumCode.toLowerCase()),u},z=1,G=2,te=3,se=4,ke=5,De=-1,Pe=/\s/,We=/[A-Za-z]/,ot=/[A-Za-z84]/,Rt=/[,\]]/,Fr=/[\d\.E\-\+]/;function Kt(o){if(typeof o!="string")throw new Error("not a string");this.text=o.trim(),this.level=0,this.place=0,this.root=null,this.stack=[],this.currentObject=null,this.state=z}Kt.prototype.readCharicter=function(){var o=this.text[this.place++];if(this.state!==se)for(;Pe.test(o);){if(this.place>=this.text.length)return;o=this.text[this.place++]}switch(this.state){case z:return this.neutral(o);case G:return this.keyword(o);case se:return this.quoted(o);case ke:return this.afterquote(o);case te:return this.number(o);case De:return}},Kt.prototype.afterquote=function(o){if(o==='"'){this.word+='"',this.state=se;return}if(Rt.test(o)){this.word=this.word.trim(),this.afterItem(o);return}throw new Error(`havn't handled "`+o+'" in afterquote yet, index '+this.place)},Kt.prototype.afterItem=function(o){if(o===","){this.word!==null&&this.currentObject.push(this.word),this.word=null,this.state=z;return}if(o==="]"){this.level--,this.word!==null&&(this.currentObject.push(this.word),this.word=null),this.state=z,this.currentObject=this.stack.pop(),this.currentObject||(this.state=De);return}},Kt.prototype.number=function(o){if(Fr.test(o)){this.word+=o;return}if(Rt.test(o)){this.word=parseFloat(this.word),this.afterItem(o);return}throw new Error(`havn't handled "`+o+'" in number yet, index '+this.place)},Kt.prototype.quoted=function(o){if(o==='"'){this.state=ke;return}this.word+=o},Kt.prototype.keyword=function(o){if(ot.test(o)){this.word+=o;return}if(o==="["){var u=[];u.push(this.word),this.level++,this.root===null?this.root=u:this.currentObject.push(u),this.stack.push(this.currentObject),this.currentObject=u,this.state=z;return}if(Rt.test(o)){this.afterItem(o);return}throw new Error(`havn't handled "`+o+'" in keyword yet, index '+this.place)},Kt.prototype.neutral=function(o){if(We.test(o)){this.word=o,this.state=G;return}if(o==='"'){this.word="",this.state=se;return}if(Fr.test(o)){this.word=o,this.state=te;return}if(Rt.test(o)){this.afterItem(o);return}throw new Error(`havn't handled "`+o+'" in neutral yet, index '+this.place)},Kt.prototype.output=function(){for(;this.place<this.text.length;)this.readCharicter();if(this.state===De)return this.root;throw new Error('unable to parse string "'+this.text+'". State is '+this.state)};function Nc(o){var u=new Kt(o);return u.output()}function na(o,u,h){Array.isArray(u)&&(h.unshift(u),u=null);var y=u?{}:o,g=h.reduce(function(_,M){return vi(M,_),_},y);u&&(o[u]=g)}function vi(o,u){if(!Array.isArray(o)){u[o]=!0;return}var h=o.shift();if(h==="PARAMETER"&&(h=o.shift()),o.length===1){if(Array.isArray(o[0])){u[h]={},vi(o[0],u[h]);return}u[h]=o[0];return}if(!o.length){u[h]=!0;return}if(h==="TOWGS84"){u[h]=o;return}if(h==="AXIS"){h in u||(u[h]=[]),u[h].push(o);return}Array.isArray(h)||(u[h]={});var y;switch(h){case"UNIT":case"PRIMEM":case"VERT_DATUM":u[h]={name:o[0].toLowerCase(),convert:o[1]},o.length===3&&vi(o[2],u[h]);return;case"SPHEROID":case"ELLIPSOID":u[h]={name:o[0],a:o[1],rf:o[2]},o.length===4&&vi(o[3],u[h]);return;case"PROJECTEDCRS":case"PROJCRS":case"GEOGCS":case"GEOCCS":case"PROJCS":case"LOCAL_CS":case"GEODCRS":case"GEODETICCRS":case"GEODETICDATUM":case"EDATUM":case"ENGINEERINGDATUM":case"VERT_CS":case"VERTCRS":case"VERTICALCRS":case"COMPD_CS":case"COMPOUNDCRS":case"ENGINEERINGCRS":case"ENGCRS":case"FITTED_CS":case"LOCAL_DATUM":case"DATUM":o[0]=["name",o[0]],na(u,h,o);return;default:for(y=-1;++y<o.length;)if(!Array.isArray(o[y]))return vi(o,u[h]);return na(u,h,o)}}var N1=.017453292519943295;function sa(o,u){var h=u[0],y=u[1];!(h in o)&&y in o&&(o[h]=o[y],u.length===3&&(o[h]=u[2](o[h])))}function Zt(o){return o*N1}function D1(o){if(o.type==="GEOGCS"?o.projName="longlat":o.type==="LOCAL_CS"?(o.projName="identity",o.local=!0):typeof o.PROJECTION=="object"?o.projName=Object.keys(o.PROJECTION)[0]:o.projName=o.PROJECTION,o.AXIS){for(var u="",h=0,y=o.AXIS.length;h<y;++h){var g=o.AXIS[h],_=g[0].toLowerCase();_.indexOf("north")!==-1?u+="n":_.indexOf("south")!==-1?u+="s":_.indexOf("east")!==-1?u+="e":_.indexOf("west")!==-1&&(u+="w")}u.length===2&&(u+="u"),u.length===3&&(o.axis=u)}o.UNIT&&(o.units=o.UNIT.name.toLowerCase(),o.units==="metre"&&(o.units="meter"),o.UNIT.convert&&(o.type==="GEOGCS"?o.DATUM&&o.DATUM.SPHEROID&&(o.to_meter=o.UNIT.convert*o.DATUM.SPHEROID.a):o.to_meter=o.UNIT.convert));var M=o.GEOGCS;o.type==="GEOGCS"&&(M=o),M&&(M.DATUM?o.datumCode=M.DATUM.name.toLowerCase():o.datumCode=M.name.toLowerCase(),o.datumCode.slice(0,2)==="d_"&&(o.datumCode=o.datumCode.slice(2)),(o.datumCode==="new_zealand_geodetic_datum_1949"||o.datumCode==="new_zealand_1949")&&(o.datumCode="nzgd49"),(o.datumCode==="wgs_1984"||o.datumCode==="world_geodetic_system_1984")&&(o.PROJECTION==="Mercator_Auxiliary_Sphere"&&(o.sphere=!0),o.datumCode="wgs84"),o.datumCode.slice(-6)==="_ferro"&&(o.datumCode=o.datumCode.slice(0,-6)),o.datumCode.slice(-8)==="_jakarta"&&(o.datumCode=o.datumCode.slice(0,-8)),~o.datumCode.indexOf("belge")&&(o.datumCode="rnb72"),M.DATUM&&M.DATUM.SPHEROID&&(o.ellps=M.DATUM.SPHEROID.name.replace("_19","").replace(/[Cc]larke\_18/,"clrk"),o.ellps.toLowerCase().slice(0,13)==="international"&&(o.ellps="intl"),o.a=M.DATUM.SPHEROID.a,o.rf=parseFloat(M.DATUM.SPHEROID.rf,10)),M.DATUM&&M.DATUM.TOWGS84&&(o.datum_params=M.DATUM.TOWGS84),~o.datumCode.indexOf("osgb_1936")&&(o.datumCode="osgb36"),~o.datumCode.indexOf("osni_1952")&&(o.datumCode="osni52"),(~o.datumCode.indexOf("tm65")||~o.datumCode.indexOf("geodetic_datum_of_1965"))&&(o.datumCode="ire65"),o.datumCode==="ch1903+"&&(o.datumCode="ch1903"),~o.datumCode.indexOf("israel")&&(o.datumCode="isr93")),o.b&&!isFinite(o.b)&&(o.b=o.a);function E(D){var N=o.to_meter||1;return D*N}var P=function(D){return sa(o,D)},k=[["standard_parallel_1","Standard_Parallel_1"],["standard_parallel_2","Standard_Parallel_2"],["false_easting","False_Easting"],["false_northing","False_Northing"],["central_meridian","Central_Meridian"],["latitude_of_origin","Latitude_Of_Origin"],["latitude_of_origin","Central_Parallel"],["scale_factor","Scale_Factor"],["k0","scale_factor"],["latitude_of_center","Latitude_Of_Center"],["latitude_of_center","Latitude_of_center"],["lat0","latitude_of_center",Zt],["longitude_of_center","Longitude_Of_Center"],["longitude_of_center","Longitude_of_center"],["longc","longitude_of_center",Zt],["x0","false_easting",E],["y0","false_northing",E],["long0","central_meridian",Zt],["lat0","latitude_of_origin",Zt],["lat0","standard_parallel_1",Zt],["lat1","standard_parallel_1",Zt],["lat2","standard_parallel_2",Zt],["azimuth","Azimuth"],["alpha","azimuth",Zt],["srsCode","name"]];k.forEach(P),!o.long0&&o.longc&&(o.projName==="Albers_Conic_Equal_Area"||o.projName==="Lambert_Azimuthal_Equal_Area")&&(o.long0=o.longc),!o.lat_ts&&o.lat1&&(o.projName==="Stereographic_South_Pole"||o.projName==="Polar Stereographic (variant B)")&&(o.lat0=Zt(o.lat1>0?90:-90),o.lat_ts=o.lat1)}var B1=function(o){var u=Nc(o),h=u.shift(),y=u.shift();u.unshift(["name",y]),u.unshift(["type",h]);var g={};return vi(u,g),D1(g),g};function dt(o){var u=this;if(arguments.length===2){var h=arguments[1];typeof h=="string"?h.charAt(0)==="+"?dt[o]=B(arguments[1]):dt[o]=B1(arguments[1]):dt[o]=h}else if(arguments.length===1){if(Array.isArray(o))return o.map(function(y){Array.isArray(y)?dt.apply(u,y):dt(y)});if(typeof o=="string"){if(o in dt)return dt[o]}else"EPSG"in o?dt["EPSG:"+o.EPSG]=o:"ESRI"in o?dt["ESRI:"+o.ESRI]=o:"IAU2000"in o?dt["IAU2000:"+o.IAU2000]=o:console.log(o);return}}t(dt);function Pr(o){return typeof o=="string"}function Jt(o){return o in dt}var Dc=["PROJECTEDCRS","PROJCRS","GEOGCS","GEOCCS","PROJCS","LOCAL_CS","GEODCRS","GEODETICCRS","GEODETICDATUM","ENGCRS","ENGINEERINGCRS"];function z1(o){return Dc.some(function(u){return o.indexOf(u)>-1})}var Tr=["3857","900913","3785","102113"];function oa(o){var u=O(o,"authority");if(!!u){var h=O(u,"epsg");return h&&Tr.indexOf(h)>-1}}function aa(o){var u=O(o,"extension");if(!!u)return O(u,"proj4")}function j1(o){return o[0]==="+"}function Bc(o){if(Pr(o)){if(Jt(o))return dt[o];if(z1(o)){var u=B1(o);if(oa(u))return dt["EPSG:3857"];var h=aa(u);return h?B(h):u}if(j1(o))return B(o)}else return o}var la=function(o,u){o=o||{};var h,y;if(!u)return o;for(y in u)h=u[y],h!==void 0&&(o[y]=h);return o},Nt=function(o,u,h){var y=o*u;return h/Math.sqrt(1-y*y)},fr=function(o){return o<0?-1:1},Z=function(o){return Math.abs(o)<=x?o:o-fr(o)*R},Ct=function(o,u,h){var y=o*h,g=.5*o;return y=Math.pow((1-y)/(1+y),g),Math.tan(.5*(a-u))/y},Hr=function(o,u){for(var h=.5*o,y,g,_=a-2*Math.atan(u),M=0;M<=15;M++)if(y=o*Math.sin(_),g=a-2*Math.atan(u*Math.pow((1-y)/(1+y),h))-_,_+=g,Math.abs(g)<=1e-10)return _;return-9999};function q1(){var o=this.b/this.a;this.es=1-o*o,"x0"in this||(this.x0=0),"y0"in this||(this.y0=0),this.e=Math.sqrt(this.es),this.lat_ts?this.sphere?this.k0=Math.cos(this.lat_ts):this.k0=Nt(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):this.k0||(this.k?this.k0=this.k:this.k0=1)}function An(o){var u=o.x,h=o.y;if(h*S>90&&h*S<-90&&u*S>180&&u*S<-180)return null;var y,g;if(Math.abs(Math.abs(h)-a)<=m)return null;if(this.sphere)y=this.x0+this.a*this.k0*Z(u-this.long0),g=this.y0+this.a*this.k0*Math.log(Math.tan(v+.5*h));else{var _=Math.sin(h),M=Ct(this.e,h,_);y=this.x0+this.a*this.k0*Z(u-this.long0),g=this.y0-this.a*this.k0*Math.log(M)}return o.x=y,o.y=g,o}function Gr(o){var u=o.x-this.x0,h=o.y-this.y0,y,g;if(this.sphere)g=a-2*Math.atan(Math.exp(-h/(this.a*this.k0)));else{var _=Math.exp(-h/(this.a*this.k0));if(g=Hr(this.e,_),g===-9999)return null}return y=Z(this.long0+u/(this.a*this.k0)),o.x=y,o.y=g,o}var Pn=["Mercator","Popular Visualisation Pseudo Mercator","Mercator_1SP","Mercator_Auxiliary_Sphere","merc"],Cs={init:q1,forward:An,inverse:Gr,names:Pn};function U1(){}function ua(o){return o}var $1=["longlat","identity"],zc={init:U1,forward:ua,inverse:ua,names:$1},W1=[Cs,zc],Tn={},In=[];function Wi(o,u){var h=In.length;return o.names?(In[h]=o,o.names.forEach(function(y){Tn[y.toLowerCase()]=h}),this):(console.log(u),!0)}function F1(o){if(!o)return!1;var u=o.toLowerCase();if(typeof Tn[u]<"u"&&In[Tn[u]])return In[Tn[u]]}function Yd(){W1.forEach(Wi)}var As={start:Yd,add:Wi,get:F1},le={};le.MERIT={a:6378137,rf:298.257,ellipseName:"MERIT 1983"},le.SGS85={a:6378136,rf:298.257,ellipseName:"Soviet Geodetic System 85"},le.GRS80={a:6378137,rf:298.257222101,ellipseName:"GRS 1980(IUGG, 1980)"},le.IAU76={a:6378140,rf:298.257,ellipseName:"IAU 1976"},le.airy={a:6377563396e-3,b:635625691e-2,ellipseName:"Airy 1830"},le.APL4={a:6378137,rf:298.25,ellipseName:"Appl. Physics. 1965"},le.NWL9D={a:6378145,rf:298.25,ellipseName:"Naval Weapons Lab., 1965"},le.mod_airy={a:6377340189e-3,b:6356034446e-3,ellipseName:"Modified Airy"},le.andrae={a:637710443e-2,rf:300,ellipseName:"Andrae 1876 (Den., Iclnd.)"},le.aust_SA={a:6378160,rf:298.25,ellipseName:"Australian Natl & S. Amer. 1969"},le.GRS67={a:6378160,rf:298.247167427,ellipseName:"GRS 67(IUGG 1967)"},le.bessel={a:6377397155e-3,rf:299.1528128,ellipseName:"Bessel 1841"},le.bess_nam={a:6377483865e-3,rf:299.1528128,ellipseName:"Bessel 1841 (Namibia)"},le.clrk66={a:63782064e-1,b:63565838e-1,ellipseName:"Clarke 1866"},le.clrk80={a:6378249145e-3,rf:293.4663,ellipseName:"Clarke 1880 mod."},le.clrk58={a:6378293645208759e-9,rf:294.2606763692654,ellipseName:"Clarke 1858"},le.CPM={a:63757387e-1,rf:334.29,ellipseName:"Comm. des Poids et Mesures 1799"},le.delmbr={a:6376428,rf:311.5,ellipseName:"Delambre 1810 (Belgium)"},le.engelis={a:637813605e-2,rf:298.2566,ellipseName:"Engelis 1985"},le.evrst30={a:6377276345e-3,rf:300.8017,ellipseName:"Everest 1830"},le.evrst48={a:6377304063e-3,rf:300.8017,ellipseName:"Everest 1948"},le.evrst56={a:6377301243e-3,rf:300.8017,ellipseName:"Everest 1956"},le.evrst69={a:6377295664e-3,rf:300.8017,ellipseName:"Everest 1969"},le.evrstSS={a:6377298556e-3,rf:300.8017,ellipseName:"Everest (Sabah & Sarawak)"},le.fschr60={a:6378166,rf:298.3,ellipseName:"Fischer (Mercury Datum) 1960"},le.fschr60m={a:6378155,rf:298.3,ellipseName:"Fischer 1960"},le.fschr68={a:6378150,rf:298.3,ellipseName:"Fischer 1968"},le.helmert={a:6378200,rf:298.3,ellipseName:"Helmert 1906"},le.hough={a:6378270,rf:297,ellipseName:"Hough"},le.intl={a:6378388,rf:297,ellipseName:"International 1909 (Hayford)"},le.kaula={a:6378163,rf:298.24,ellipseName:"Kaula 1961"},le.lerch={a:6378139,rf:298.257,ellipseName:"Lerch 1979"},le.mprts={a:6397300,rf:191,ellipseName:"Maupertius 1738"},le.new_intl={a:63781575e-1,b:63567722e-1,ellipseName:"New International 1967"},le.plessis={a:6376523,rf:6355863,ellipseName:"Plessis 1817 (France)"},le.krass={a:6378245,rf:298.3,ellipseName:"Krassovsky, 1942"},le.SEasia={a:6378155,b:63567733205e-4,ellipseName:"Southeast Asia"},le.walbeck={a:6376896,b:63558348467e-4,ellipseName:"Walbeck"},le.WGS60={a:6378165,rf:298.3,ellipseName:"WGS 60"},le.WGS66={a:6378145,rf:298.25,ellipseName:"WGS 66"},le.WGS7={a:6378135,rf:298.26,ellipseName:"WGS 72"};var jc=le.WGS84={a:6378137,rf:298.257223563,ellipseName:"WGS 84"};le.sphere={a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"};function H1(o,u,h,y){var g=o*o,_=u*u,M=(g-_)/g,E=0;y?(o*=1-M*(c+M*(d+M*p)),g=o*o,M=0):E=Math.sqrt(M);var P=(g-_)/_;return{es:M,e:E,ep2:P}}function ca(o,u,h,y,g){if(!o){var _=O(le,y);_||(_=jc),o=_.a,u=_.b,h=_.rf}return h&&!u&&(u=(1-1/h)*o),(h===0||Math.abs(o-u)<m)&&(g=!0,u=o),{a:o,b:u,rf:h,sphere:g}}var Qe={};Qe.wgs84={towgs84:"0,0,0",ellipse:"WGS84",datumName:"WGS84"},Qe.ch1903={towgs84:"674.374,15.056,405.346",ellipse:"bessel",datumName:"swiss"},Qe.ggrs87={towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"},Qe.nad83={towgs84:"0,0,0",ellipse:"GRS80",datumName:"North_American_Datum_1983"},Qe.nad27={nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"},Qe.potsdam={towgs84:"606.0,23.0,413.0",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"},Qe.carthage={towgs84:"-263.0,6.0,431.0",ellipse:"clark80",datumName:"Carthage 1934 Tunisia"},Qe.hermannskogel={towgs84:"653.0,-212.0,449.0",ellipse:"bessel",datumName:"Hermannskogel"},Qe.osni52={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"airy",datumName:"Irish National"},Qe.ire65={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"},Qe.rassadiran={towgs84:"-133.63,-157.5,-158.62",ellipse:"intl",datumName:"Rassadiran"},Qe.nzgd49={towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"},Qe.osgb36={towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Airy 1830"},Qe.s_jtsk={towgs84:"589,76,480",ellipse:"bessel",datumName:"S-JTSK (Ferro)"},Qe.beduaram={towgs84:"-106,-87,188",ellipse:"clrk80",datumName:"Beduaram"},Qe.gunung_segara={towgs84:"-403,684,41",ellipse:"bessel",datumName:"Gunung Segara Jakarta"},Qe.rnb72={towgs84:"106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",ellipse:"intl",datumName:"Reseau National Belge 1972"};function qc(o,u,h,y,g,_){var M={};return o===void 0||o==="none"?M.datum_type=n:M.datum_type=i,u&&(M.datum_params=u.map(parseFloat),(M.datum_params[0]!==0||M.datum_params[1]!==0||M.datum_params[2]!==0)&&(M.datum_type=e),M.datum_params.length>3&&(M.datum_params[3]!==0||M.datum_params[4]!==0||M.datum_params[5]!==0||M.datum_params[6]!==0)&&(M.datum_type=r,M.datum_params[3]*=s,M.datum_params[4]*=s,M.datum_params[5]*=s,M.datum_params[6]=M.datum_params[6]/1e6+1)),M.a=h,M.b=y,M.es=g,M.ep2=_,M}function at(o,u){if(!(this instanceof at))return new at(o);u=u||function(P){if(P)throw P};var h=Bc(o);if(typeof h!="object"){u(o);return}var y=at.projections.get(h.projName);if(!y){u(o);return}if(h.datumCode&&h.datumCode!=="none"){var g=O(Qe,h.datumCode);g&&(h.datum_params=g.towgs84?g.towgs84.split(","):null,h.ellps=g.ellipse,h.datumName=g.datumName?g.datumName:h.datumCode)}h.k0=h.k0||1,h.axis=h.axis||"enu",h.ellps=h.ellps||"wgs84";var _=ca(h.a,h.b,h.rf,h.ellps,h.sphere),M=H1(_.a,_.b,_.rf,h.R_A),E=h.datum||qc(h.datumCode,h.datum_params,_.a,_.b,M.es,M.ep2);la(this,h),la(this,y),this.a=_.a,this.b=_.b,this.rf=_.rf,this.sphere=_.sphere,this.es=M.es,this.e=M.e,this.ep2=M.ep2,this.datum=E,this.init(),u(null,this)}at.projections=As,at.projections.start();function kn(o,u){return o.datum_type!==u.datum_type||o.a!==u.a||Math.abs(o.es-u.es)>5e-11?!1:o.datum_type===e?o.datum_params[0]===u.datum_params[0]&&o.datum_params[1]===u.datum_params[1]&&o.datum_params[2]===u.datum_params[2]:o.datum_type===r?o.datum_params[0]===u.datum_params[0]&&o.datum_params[1]===u.datum_params[1]&&o.datum_params[2]===u.datum_params[2]&&o.datum_params[3]===u.datum_params[3]&&o.datum_params[4]===u.datum_params[4]&&o.datum_params[5]===u.datum_params[5]&&o.datum_params[6]===u.datum_params[6]:!0}function wi(o,u,h){var y=o.x,g=o.y,_=o.z?o.z:0,M,E,P,k;if(g<-a&&g>-1.001*a)g=-a;else if(g>a&&g<1.001*a)g=a;else{if(g<-a)return{x:-1/0,y:-1/0,z:o.z};if(g>a)return{x:1/0,y:1/0,z:o.z}}return y>Math.PI&&(y-=2*Math.PI),E=Math.sin(g),k=Math.cos(g),P=E*E,M=h/Math.sqrt(1-u*P),{x:(M+_)*k*Math.cos(y),y:(M+_)*k*Math.sin(y),z:(M*(1-u)+_)*E}}function Vr(o,u,h,y){var g=1e-12,_=g*g,M=30,E,P,k,D,N,q,F,W,V,K,ae,pe,Oe,Ke=o.x,Le=o.y,Be=o.z?o.z:0,wt,tt,ii;if(E=Math.sqrt(Ke*Ke+Le*Le),P=Math.sqrt(Ke*Ke+Le*Le+Be*Be),E/h<g){if(wt=0,P/h<g)return tt=a,ii=-y,{x:o.x,y:o.y,z:o.z}}else wt=Math.atan2(Le,Ke);k=Be/P,D=E/P,N=1/Math.sqrt(1-u*(2-u)*D*D),W=D*(1-u)*N,V=k*N,Oe=0;do Oe++,F=h/Math.sqrt(1-u*V*V),ii=E*W+Be*V-F*(1-u*V*V),q=u*F/(F+ii),N=1/Math.sqrt(1-q*(2-q)*D*D),K=D*(1-q)*N,ae=k*N,pe=ae*W-K*V,W=K,V=ae;while(pe*pe>_&&Oe<M);return tt=Math.atan(ae/Math.abs(K)),{x:wt,y:tt,z:ii}}function ha(o,u,h){if(u===e)return{x:o.x+h[0],y:o.y+h[1],z:o.z+h[2]};if(u===r){var y=h[0],g=h[1],_=h[2],M=h[3],E=h[4],P=h[5],k=h[6];return{x:k*(o.x-P*o.y+E*o.z)+y,y:k*(P*o.x+o.y-M*o.z)+g,z:k*(-E*o.x+M*o.y+o.z)+_}}}function _i(o,u,h){if(u===e)return{x:o.x-h[0],y:o.y-h[1],z:o.z-h[2]};if(u===r){var y=h[0],g=h[1],_=h[2],M=h[3],E=h[4],P=h[5],k=h[6],D=(o.x-y)/k,N=(o.y-g)/k,q=(o.z-_)/k;return{x:D+P*N-E*q,y:-P*D+N+M*q,z:E*D-M*N+q}}}function On(o){return o===e||o===r}var fa=function(o,u,h){return kn(o,u)||o.datum_type===n||u.datum_type===n||o.es===u.es&&o.a===u.a&&!On(o.datum_type)&&!On(u.datum_type)?h:(h=wi(h,o.es,o.a),On(o.datum_type)&&(h=ha(h,o.datum_type,o.datum_params)),On(u.datum_type)&&(h=_i(h,u.datum_type,u.datum_params)),Vr(h,u.es,u.a,u.b))},da=function(o,u,h){var y=h.x,g=h.y,_=h.z||0,M,E,P,k={};for(P=0;P<3;P++)if(!(u&&P===2&&h.z===void 0))switch(P===0?(M=y,"ew".indexOf(o.axis[P])!==-1?E="x":E="y"):P===1?(M=g,"ns".indexOf(o.axis[P])!==-1?E="y":E="x"):(M=_,E="z"),o.axis[P]){case"e":k[E]=M;break;case"w":k[E]=-M;break;case"n":k[E]=M;break;case"s":k[E]=-M;break;case"u":h[E]!==void 0&&(k.z=M);break;case"d":h[E]!==void 0&&(k.z=-M);break;default:return null}return k},Ln=function(o){var u={x:o[0],y:o[1]};return o.length>2&&(u.z=o[2]),o.length>3&&(u.m=o[3]),u},G1=function(o){pa(o.x),pa(o.y)};function pa(o){if(typeof Number.isFinite=="function"){if(Number.isFinite(o))return;throw new TypeError("coordinates must be finite numbers")}if(typeof o!="number"||o!==o||!isFinite(o))throw new TypeError("coordinates must be finite numbers")}function V1(o,u){return(o.datum.datum_type===e||o.datum.datum_type===r)&&u.datumCode!=="WGS84"||(u.datum.datum_type===e||u.datum.datum_type===r)&&o.datumCode!=="WGS84"}function Fi(o,u,h){var y;if(Array.isArray(h)&&(h=Ln(h)),G1(h),o.datum&&u.datum&&V1(o,u)&&(y=new at("WGS84"),h=Fi(o,y,h),o=y),o.axis!=="enu"&&(h=da(o,!1,h)),o.projName==="longlat")h={x:h.x*w,y:h.y*w,z:h.z||0};else if(o.to_meter&&(h={x:h.x*o.to_meter,y:h.y*o.to_meter,z:h.z||0}),h=o.inverse(h),!h)return;return o.from_greenwich&&(h.x+=o.from_greenwich),h=fa(o.datum,u.datum,h),u.from_greenwich&&(h={x:h.x-u.from_greenwich,y:h.y,z:h.z||0}),u.projName==="longlat"?h={x:h.x*S,y:h.y*S,z:h.z||0}:(h=u.forward(h),u.to_meter&&(h={x:h.x/u.to_meter,y:h.y/u.to_meter,z:h.z||0})),u.axis!=="enu"?da(u,!0,h):h}var ma=at("WGS84");function ga(o,u,h){var y,g,_;return Array.isArray(h)?(y=Fi(o,u,h)||{x:NaN,y:NaN},h.length>2?typeof o.name<"u"&&o.name==="geocent"||typeof u.name<"u"&&u.name==="geocent"?typeof y.z=="number"?[y.x,y.y,y.z].concat(h.splice(3)):[y.x,y.y,h[2]].concat(h.splice(3)):[y.x,y.y].concat(h.splice(2)):[y.x,y.y]):(g=Fi(o,u,h),_=Object.keys(h),_.length===2||_.forEach(function(M){if(typeof o.name<"u"&&o.name==="geocent"||typeof u.name<"u"&&u.name==="geocent"){if(M==="x"||M==="y"||M==="z")return}else if(M==="x"||M==="y")return;g[M]=h[M]}),g)}function K1(o){return o instanceof at?o:o.oProj?o.oProj:at(o)}function Dt(o,u,h){o=K1(o);var y=!1,g;return typeof u>"u"?(u=o,o=ma,y=!0):(typeof u.x<"u"||Array.isArray(u))&&(h=u,u=o,o=ma,y=!0),u=K1(u),h?ga(o,u,h):(g={forward:function(_){return ga(o,u,_)},inverse:function(_){return ga(u,o,_)}},y&&(g.oProj=u),g)}var ya=6,Nn="AJSAJS",Z1="AFAFAF",Ir=65,nt=73,pt=79,mt=86,Si=90,J1={forward:Dn,inverse:Ps,toPoint:ba};function Dn(o,u){return u=u||5,Q1(wa({lat:o[1],lon:o[0]}),u)}function Ps(o){var u=xi(Hi(o.toUpperCase()));return u.lat&&u.lon?[u.lon,u.lat,u.lon,u.lat]:[u.left,u.bottom,u.right,u.top]}function ba(o){var u=xi(Hi(o.toUpperCase()));return u.lat&&u.lon?[u.lon,u.lat]:[(u.left+u.right)/2,(u.top+u.bottom)/2]}function va(o){return o*(Math.PI/180)}function Y1(o){return 180*(o/Math.PI)}function wa(o){var u=o.lat,h=o.lon,y=6378137,g=.00669438,_=.9996,M,E,P,k,D,N,q,F=va(u),W=va(h),V,K;K=Math.floor((h+180)/6)+1,h===180&&(K=60),u>=56&&u<64&&h>=3&&h<12&&(K=32),u>=72&&u<84&&(h>=0&&h<9?K=31:h>=9&&h<21?K=33:h>=21&&h<33?K=35:h>=33&&h<42&&(K=37)),M=(K-1)*6-180+3,V=va(M),E=g/(1-g),P=y/Math.sqrt(1-g*Math.sin(F)*Math.sin(F)),k=Math.tan(F)*Math.tan(F),D=E*Math.cos(F)*Math.cos(F),N=Math.cos(F)*(W-V),q=y*((1-g/4-3*g*g/64-5*g*g*g/256)*F-(3*g/8+3*g*g/32+45*g*g*g/1024)*Math.sin(2*F)+(15*g*g/256+45*g*g*g/1024)*Math.sin(4*F)-35*g*g*g/3072*Math.sin(6*F));var ae=_*P*(N+(1-k+D)*N*N*N/6+(5-18*k+k*k+72*D-58*E)*N*N*N*N*N/120)+5e5,pe=_*(q+P*Math.tan(F)*(N*N/2+(5-k+9*D+4*D*D)*N*N*N*N/24+(61-58*k+k*k+600*D-330*E)*N*N*N*N*N*N/720));return u<0&&(pe+=1e7),{northing:Math.round(pe),easting:Math.round(ae),zoneNumber:K,zoneLetter:X1(u)}}function xi(o){var u=o.northing,h=o.easting,y=o.zoneLetter,g=o.zoneNumber;if(g<0||g>60)return null;var _=.9996,M=6378137,E=.00669438,P,k=(1-Math.sqrt(1-E))/(1+Math.sqrt(1-E)),D,N,q,F,W,V,K,ae,pe,Oe=h-5e5,Ke=u;y<"N"&&(Ke-=1e7),K=(g-1)*6-180+3,P=E/(1-E),V=Ke/_,ae=V/(M*(1-E/4-3*E*E/64-5*E*E*E/256)),pe=ae+(3*k/2-27*k*k*k/32)*Math.sin(2*ae)+(21*k*k/16-55*k*k*k*k/32)*Math.sin(4*ae)+151*k*k*k/96*Math.sin(6*ae),D=M/Math.sqrt(1-E*Math.sin(pe)*Math.sin(pe)),N=Math.tan(pe)*Math.tan(pe),q=P*Math.cos(pe)*Math.cos(pe),F=M*(1-E)/Math.pow(1-E*Math.sin(pe)*Math.sin(pe),1.5),W=Oe/(D*_);var Le=pe-D*Math.tan(pe)/F*(W*W/2-(5+3*N+10*q-4*q*q-9*P)*W*W*W*W/24+(61+90*N+298*q+45*N*N-252*P-3*q*q)*W*W*W*W*W*W/720);Le=Y1(Le);var Be=(W-(1+2*N+q)*W*W*W/6+(5-2*q+28*N-3*q*q+8*P+24*N*N)*W*W*W*W*W/120)/Math.cos(pe);Be=K+Y1(Be);var wt;if(o.accuracy){var tt=xi({northing:o.northing+o.accuracy,easting:o.easting+o.accuracy,zoneLetter:o.zoneLetter,zoneNumber:o.zoneNumber});wt={top:tt.lat,right:tt.lon,bottom:Le,left:Be}}else wt={lat:Le,lon:Be};return wt}function X1(o){var u="Z";return 84>=o&&o>=72?u="X":72>o&&o>=64?u="W":64>o&&o>=56?u="V":56>o&&o>=48?u="U":48>o&&o>=40?u="T":40>o&&o>=32?u="S":32>o&&o>=24?u="R":24>o&&o>=16?u="Q":16>o&&o>=8?u="P":8>o&&o>=0?u="N":0>o&&o>=-8?u="M":-8>o&&o>=-16?u="L":-16>o&&o>=-24?u="K":-24>o&&o>=-32?u="J":-32>o&&o>=-40?u="H":-40>o&&o>=-48?u="G":-48>o&&o>=-56?u="F":-56>o&&o>=-64?u="E":-64>o&&o>=-72?u="D":-72>o&&o>=-80&&(u="C"),u}function Q1(o,u){var h="00000"+o.easting,y="00000"+o.northing;return o.zoneNumber+o.zoneLetter+Uc(o.easting,o.northing,o.zoneNumber)+h.substr(h.length-5,u)+y.substr(y.length-5,u)}function Uc(o,u,h){var y=_a(h),g=Math.floor(o/1e5),_=Math.floor(u/1e5)%20;return Sa(g,_,y)}function _a(o){var u=o%ya;return u===0&&(u=ya),u}function Sa(o,u,h){var y=h-1,g=Nn.charCodeAt(y),_=Z1.charCodeAt(y),M=g+o-1,E=_+u,P=!1;M>Si&&(M=M-Si+Ir-1,P=!0),(M===nt||g<nt&&M>nt||(M>nt||g<nt)&&P)&&M++,(M===pt||g<pt&&M>pt||(M>pt||g<pt)&&P)&&(M++,M===nt&&M++),M>Si&&(M=M-Si+Ir-1),E>mt?(E=E-mt+Ir-1,P=!0):P=!1,(E===nt||_<nt&&E>nt||(E>nt||_<nt)&&P)&&E++,(E===pt||_<pt&&E>pt||(E>pt||_<pt)&&P)&&(E++,E===nt&&E++),E>mt&&(E=E-mt+Ir-1);var k=String.fromCharCode(M)+String.fromCharCode(E);return k}function Hi(o){if(o&&o.length===0)throw"MGRSPoint coverting from nothing";for(var u=o.length,h=null,y="",g,_=0;!/[A-Z]/.test(g=o.charAt(_));){if(_>=2)throw"MGRSPoint bad conversion from: "+o;y+=g,_++}var M=parseInt(y,10);if(_===0||_+3>u)throw"MGRSPoint bad conversion from: "+o;var E=o.charAt(_++);if(E<="A"||E==="B"||E==="Y"||E>="Z"||E==="I"||E==="O")throw"MGRSPoint zone letter "+E+" not handled: "+o;h=o.substring(_,_+=2);for(var P=_a(M),k=Mi(h.charAt(0),P),D=el(h.charAt(1),P);D<Ts(E);)D+=2e6;var N=u-_;if(N%2!==0)throw`MGRSPoint has to have an even number
114
106
  of digits after the zone letter and two 100km letters - front
115
107
  half for easting meters, second half for
116
- northing meters`+s;var q=z/2,Y=0,K=0,X,J,ce,_e,We;return q>0&&(X=1e5/Math.pow(10,q),J=s.substring(v,v+q),Y=parseFloat(J)*X,ce=s.substring(v+q),K=parseFloat(ce)*X),_e=Y+L,We=K+U,{easting:_e,northing:We,zoneLetter:x,zoneNumber:S,accuracy:X}}function Pi(s,u){for(var c=Hn.charCodeAt(u-1),y=1e5,g=!1;c!==s.charCodeAt(0);){if(c++,c===pt&&c++,c===Et&&c++,c>Ai){if(g)throw"Bad character: "+s;c=Br,g=!0}y+=1e5}return y}function jl(s,u){if(s>"V")throw"MGRSPoint given invalid Northing "+s;for(var c=Dl.charCodeAt(u-1),y=0,g=!1;c!==s.charCodeAt(0);){if(c++,c===pt&&c++,c===Et&&c++,c>Mt){if(g)throw"Bad character: "+s;c=Br,g=!0}y+=1e5}return y}function Fs(s){var u;switch(s){case"C":u=11e5;break;case"D":u=2e6;break;case"E":u=28e5;break;case"F":u=37e5;break;case"G":u=46e5;break;case"H":u=55e5;break;case"J":u=64e5;break;case"K":u=73e5;break;case"L":u=82e5;break;case"M":u=91e5;break;case"N":u=0;break;case"P":u=8e5;break;case"Q":u=17e5;break;case"R":u=26e5;break;case"S":u=35e5;break;case"T":u=44e5;break;case"U":u=53e5;break;case"V":u=62e5;break;case"W":u=7e6;break;case"X":u=79e5;break;default:u=-1}if(u>=0)return u;throw"Invalid zone letter: "+s}function xr(s,u,c){if(!(this instanceof xr))return new xr(s,u,c);if(Array.isArray(s))this.x=s[0],this.y=s[1],this.z=s[2]||0;else if(typeof s=="object")this.x=s.x,this.y=s.y,this.z=s.z||0;else if(typeof s=="string"&&typeof u>"u"){var y=s.split(",");this.x=parseFloat(y[0],10),this.y=parseFloat(y[1],10),this.z=parseFloat(y[2],10)||0}else this.x=s,this.y=u,this.z=c||0;console.warn("proj4.Point will be removed in version 3, use proj4.toPoint")}xr.fromMGRS=function(s){return new xr(pa(s))},xr.prototype.toMGRS=function(s){return Gn([this.x,this.y],s)};var Us=1,js=.25,Wl=.046875,$l=.01953125,ql=.01068115234375,bc=.75,vc=.46875,wc=.013020833333333334,Hl=.007120768229166667,_c=.3645833333333333,Sc=.005696614583333333,xc=.3076171875,Qi=function(s){var u=[];u[0]=Us-s*(js+s*(Wl+s*($l+s*ql))),u[1]=s*(bc-s*(Wl+s*($l+s*ql)));var c=s*s;return u[2]=c*(vc-s*(wc+s*Hl)),c*=s,u[3]=c*(_c-s*Sc),u[4]=c*s*xc,u},Vn=function(s,u,c,y){return c*=u,u*=u,y[0]*s-c*(y[1]+u*(y[2]+u*(y[3]+u*y[4])))},Ec=20,wa=function(s,u,c){for(var y=1/(1-u),g=s,v=Ec;v;--v){var S=Math.sin(g),x=1-u*S*S;if(x=(Vn(g,S,Math.cos(g),c)-s)*(x*Math.sqrt(x))*y,g-=x,Math.abs(x)<p)return g}return g};function en(){this.x0=this.x0!==void 0?this.x0:0,this.y0=this.y0!==void 0?this.y0:0,this.long0=this.long0!==void 0?this.long0:0,this.lat0=this.lat0!==void 0?this.lat0:0,this.es&&(this.en=Qi(this.es),this.ml0=Vn(this.lat0,Math.sin(this.lat0),Math.cos(this.lat0),this.en))}function tn(s){var u=s.x,c=s.y,y=Q(u-this.long0),g,v,S,x=Math.sin(c),P=Math.cos(c);if(this.es){var U=P*y,z=Math.pow(U,2),q=this.ep2*Math.pow(P,2),Y=Math.pow(q,2),K=Math.abs(P)>p?Math.tan(c):0,X=Math.pow(K,2),J=Math.pow(X,2);g=1-this.es*Math.pow(x,2),U=U/Math.sqrt(g);var ce=Vn(c,x,P,this.en);v=this.a*(this.k0*U*(1+z/6*(1-X+q+z/20*(5-18*X+J+14*q-58*X*q+z/42*(61+179*J-J*X-479*X)))))+this.x0,S=this.a*(this.k0*(ce-this.ml0+x*y*U/2*(1+z/12*(5-X+9*q+4*Y+z/30*(61+J-58*X+270*q-330*X*q+z/56*(1385+543*J-J*X-3111*X))))))+this.y0}else{var L=P*Math.sin(y);if(Math.abs(Math.abs(L)-1)<p)return 93;if(v=.5*this.a*this.k0*Math.log((1+L)/(1-L))+this.x0,S=P*Math.cos(y)/Math.sqrt(1-Math.pow(L,2)),L=Math.abs(S),L>=1){if(L-1>p)return 93;S=0}else S=Math.acos(S);c<0&&(S=-S),S=this.a*this.k0*(S-this.lat0)+this.y0}return s.x=v,s.y=S,s}function Ws(s){var u,c,y,g,v=(s.x-this.x0)*(1/this.a),S=(s.y-this.y0)*(1/this.a);if(this.es)if(u=this.ml0+S/this.k0,c=wa(u,this.es,this.en),Math.abs(c)<a){var z=Math.sin(c),q=Math.cos(c),Y=Math.abs(q)>p?Math.tan(c):0,K=this.ep2*Math.pow(q,2),X=Math.pow(K,2),J=Math.pow(Y,2),ce=Math.pow(J,2);u=1-this.es*Math.pow(z,2);var _e=v*Math.sqrt(u)/this.k0,We=Math.pow(_e,2);u=u*Y,y=c-u*We/(1-this.es)*.5*(1-We/12*(5+3*J-9*K*J+K-4*X-We/30*(61+90*J-252*K*J+45*ce+46*K-We/56*(1385+3633*J+4095*ce+1574*ce*J)))),g=Q(this.long0+_e*(1-We/6*(1+2*J+K-We/20*(5+28*J+24*ce+8*K*J+6*K-We/42*(61+662*J+1320*ce+720*ce*J))))/q)}else y=a*at(S),g=0;else{var x=Math.exp(v/this.k0),P=.5*(x-1/x),L=this.lat0+S/this.k0,U=Math.cos(L);u=Math.sqrt((1-Math.pow(U,2))/(1+Math.pow(P,2))),y=Math.asin(u),S<0&&(y=-y),P===0&&U===0?g=0:g=Q(Math.atan2(P,U)+this.long0)}return s.x=g,s.y=y,s}var Gl=["Transverse_Mercator","Transverse Mercator","tmerc"],Mc={init:en,forward:tn,inverse:Ws,names:Gl},$s=function(s){var u=Math.exp(s);return u=(u-1/u)/2,u},rn=function(s,u){s=Math.abs(s),u=Math.abs(u);var c=Math.max(s,u),y=Math.min(s,u)/(c||1);return c*Math.sqrt(1+Math.pow(y,2))},_a=function(s){var u=1+s,c=u-1;return c===0?s:s*Math.log(u)/c},Rc=function(s){var u=Math.abs(s);return u=_a(u*(1+u/(rn(1,u)+1))),s<0?-u:u},Sa=function(s,u){for(var c=2*Math.cos(2*u),y=s.length-1,g=s[y],v=0,S;--y>=0;)S=-v+c*g+s[y],v=g,g=S;return u+S*Math.sin(2*u)},Cc=function(s,u){for(var c=2*Math.cos(u),y=s.length-1,g=s[y],v=0,S;--y>=0;)S=-v+c*g+s[y],v=g,g=S;return Math.sin(u)*S},Tc=function(s){var u=Math.exp(s);return u=(u+1/u)/2,u},lr=function(s,u,c){for(var y=Math.sin(u),g=Math.cos(u),v=$s(c),S=Tc(c),x=2*g*S,P=-2*y*v,L=s.length-1,U=s[L],z=0,q=0,Y=0,K,X;--L>=0;)K=q,X=z,q=U,z=Y,U=-K+x*q-P*z+s[L],Y=-X+P*q+x*z;return x=y*S,P=g*v,[x*U-P*Y,x*Y+P*U]};function Ac(){if(this.es===void 0||this.es<=0)throw new Error("incorrect elliptical usage");this.x0=this.x0!==void 0?this.x0:0,this.y0=this.y0!==void 0?this.y0:0,this.long0=this.long0!==void 0?this.long0:0,this.lat0=this.lat0!==void 0?this.lat0:0,this.cgb=[],this.cbg=[],this.utg=[],this.gtu=[];var s=this.es/(1+Math.sqrt(1-this.es)),u=s/(2-s),c=u;this.cgb[0]=u*(2+u*(-2/3+u*(-2+u*(116/45+u*(26/45+u*(-2854/675)))))),this.cbg[0]=u*(-2+u*(2/3+u*(4/3+u*(-82/45+u*(32/45+u*(4642/4725)))))),c=c*u,this.cgb[1]=c*(7/3+u*(-8/5+u*(-227/45+u*(2704/315+u*(2323/945))))),this.cbg[1]=c*(5/3+u*(-16/15+u*(-13/9+u*(904/315+u*(-1522/945))))),c=c*u,this.cgb[2]=c*(56/15+u*(-136/35+u*(-1262/105+u*(73814/2835)))),this.cbg[2]=c*(-26/15+u*(34/21+u*(8/5+u*(-12686/2835)))),c=c*u,this.cgb[3]=c*(4279/630+u*(-332/35+u*(-399572/14175))),this.cbg[3]=c*(1237/630+u*(-12/5+u*(-24832/14175))),c=c*u,this.cgb[4]=c*(4174/315+u*(-144838/6237)),this.cbg[4]=c*(-734/315+u*(109598/31185)),c=c*u,this.cgb[5]=c*(601676/22275),this.cbg[5]=c*(444337/155925),c=Math.pow(u,2),this.Qn=this.k0/(1+u)*(1+c*(1/4+c*(1/64+c/256))),this.utg[0]=u*(-.5+u*(2/3+u*(-37/96+u*(1/360+u*(81/512+u*(-96199/604800)))))),this.gtu[0]=u*(.5+u*(-2/3+u*(5/16+u*(41/180+u*(-127/288+u*(7891/37800)))))),this.utg[1]=c*(-1/48+u*(-1/15+u*(437/1440+u*(-46/105+u*(1118711/3870720))))),this.gtu[1]=c*(13/48+u*(-3/5+u*(557/1440+u*(281/630+u*(-1983433/1935360))))),c=c*u,this.utg[2]=c*(-17/480+u*(37/840+u*(209/4480+u*(-5569/90720)))),this.gtu[2]=c*(61/240+u*(-103/140+u*(15061/26880+u*(167603/181440)))),c=c*u,this.utg[3]=c*(-4397/161280+u*(11/504+u*(830251/7257600))),this.gtu[3]=c*(49561/161280+u*(-179/168+u*(6601661/7257600))),c=c*u,this.utg[4]=c*(-4583/161280+u*(108847/3991680)),this.gtu[4]=c*(34729/80640+u*(-3418889/1995840)),c=c*u,this.utg[5]=c*(-20648693/638668800),this.gtu[5]=c*(212378941/319334400);var y=Sa(this.cbg,this.lat0);this.Zb=-this.Qn*(y+Cc(this.gtu,2*y))}function Ic(s){var u=Q(s.x-this.long0),c=s.y;c=Sa(this.cbg,c);var y=Math.sin(c),g=Math.cos(c),v=Math.sin(u),S=Math.cos(u);c=Math.atan2(y,S*g),u=Math.atan2(v*g,rn(y,g*S)),u=Rc(Math.tan(u));var x=lr(this.gtu,2*c,2*u);c=c+x[0],u=u+x[1];var P,L;return Math.abs(u)<=2.623395162778?(P=this.a*(this.Qn*u)+this.x0,L=this.a*(this.Qn*c+this.Zb)+this.y0):(P=1/0,L=1/0),s.x=P,s.y=L,s}function Pc(s){var u=(s.x-this.x0)*(1/this.a),c=(s.y-this.y0)*(1/this.a);c=(c-this.Zb)/this.Qn,u=u/this.Qn;var y,g;if(Math.abs(u)<=2.623395162778){var v=lr(this.utg,2*c,2*u);c=c+v[0],u=u+v[1],u=Math.atan($s(u));var S=Math.sin(c),x=Math.cos(c),P=Math.sin(u),L=Math.cos(u);c=Math.atan2(S*L,rn(P,L*x)),u=Math.atan2(P,L*x),y=Q(u+this.long0),g=Sa(this.cgb,c)}else y=1/0,g=1/0;return s.x=y,s.y=g,s}var qs=["Extended_Transverse_Mercator","Extended Transverse Mercator","etmerc"],nn={init:Ac,forward:Ic,inverse:Pc,names:qs},Kn=function(s,u){if(s===void 0){if(s=Math.floor((Q(u)+Math.PI)*30/Math.PI)+1,s<0)return 0;if(s>60)return 60}return s},Oi="etmerc";function Oc(){var s=Kn(this.zone,this.long0);if(s===void 0)throw new Error("unknown utm zone");this.lat0=0,this.long0=(6*Math.abs(s)-183)*w,this.x0=5e5,this.y0=this.utmSouth?1e7:0,this.k0=.9996,nn.init.apply(this),this.forward=nn.forward,this.inverse=nn.inverse}var Vl=["Universal Transverse Mercator System","utm"],kc={init:Oc,names:Vl,dependsOn:Oi},xa=function(s,u){return Math.pow((1-s)/(1+s),u)},Kl=20;function Nc(){var s=Math.sin(this.lat0),u=Math.cos(this.lat0);u*=u,this.rc=Math.sqrt(1-this.es)/(1-this.es*s*s),this.C=Math.sqrt(1+this.es*u*u/(1-this.es)),this.phic0=Math.asin(s/this.C),this.ratexp=.5*this.C*this.e,this.K=Math.tan(.5*this.phic0+_)/(Math.pow(Math.tan(.5*this.lat0+_),this.C)*xa(this.e*s,this.ratexp))}function Yl(s){var u=s.x,c=s.y;return s.y=2*Math.atan(this.K*Math.pow(Math.tan(.5*c+_),this.C)*xa(this.e*Math.sin(c),this.ratexp))-a,s.x=this.C*u,s}function Zl(s){for(var u=1e-14,c=s.x/this.C,y=s.y,g=Math.pow(Math.tan(.5*y+_)/this.K,1/this.C),v=Kl;v>0&&(y=2*Math.atan(g*xa(this.e*Math.sin(s.y),-.5*this.e))-a,!(Math.abs(y-s.y)<u));--v)s.y=y;return v?(s.x=c,s.y=y,s):null}var Xl=["gauss"],Qr={init:Nc,forward:Yl,inverse:Zl,names:Xl};function Ea(){Qr.init.apply(this),this.rc&&(this.sinc0=Math.sin(this.phic0),this.cosc0=Math.cos(this.phic0),this.R2=2*this.rc,this.title||(this.title="Oblique Stereographic Alternative"))}function Jl(s){var u,c,y,g;return s.x=Q(s.x-this.long0),Qr.forward.apply(this,[s]),u=Math.sin(s.y),c=Math.cos(s.y),y=Math.cos(s.x),g=this.k0*this.R2/(1+this.sinc0*u+this.cosc0*c*y),s.x=g*c*Math.sin(s.x),s.y=g*(this.cosc0*u-this.sinc0*c*y),s.x=this.a*s.x+this.x0,s.y=this.a*s.y+this.y0,s}function Lc(s){var u,c,y,g,v;if(s.x=(s.x-this.x0)/this.a,s.y=(s.y-this.y0)/this.a,s.x/=this.k0,s.y/=this.k0,v=Math.sqrt(s.x*s.x+s.y*s.y)){var S=2*Math.atan2(v,this.R2);u=Math.sin(S),c=Math.cos(S),g=Math.asin(c*this.sinc0+s.y*u*this.cosc0/v),y=Math.atan2(s.x*u,v*this.cosc0*c-s.y*this.sinc0*u)}else g=this.phic0,y=0;return s.x=y,s.y=g,Qr.inverse.apply(this,[s]),s.x=Q(s.x+this.long0),s}var Hs=["Stereographic_North_Pole","Oblique_Stereographic","Polar_Stereographic","sterea","Oblique Stereographic Alternative","Double_Stereographic"],Dc={init:Ea,forward:Jl,inverse:Lc,names:Hs};function Bc(s,u,c){return u*=c,Math.tan(.5*(a+s))*Math.pow((1-u)/(1+u),.5*c)}function Ql(){this.coslat0=Math.cos(this.lat0),this.sinlat0=Math.sin(this.lat0),this.sphere?this.k0===1&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=p&&(this.k0=.5*(1+at(this.lat0)*Math.sin(this.lat_ts))):(Math.abs(this.coslat0)<=p&&(this.lat0>0?this.con=1:this.con=-1),this.cons=Math.sqrt(Math.pow(1+this.e,1+this.e)*Math.pow(1-this.e,1-this.e)),this.k0===1&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=p&&(this.k0=.5*this.cons*je(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/_t(this.e,this.con*this.lat_ts,this.con*Math.sin(this.lat_ts))),this.ms1=je(this.e,this.sinlat0,this.coslat0),this.X0=2*Math.atan(this.ssfn_(this.lat0,this.sinlat0,this.e))-a,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))}function zc(s){var u=s.x,c=s.y,y=Math.sin(c),g=Math.cos(c),v,S,x,P,L,U,z=Q(u-this.long0);return Math.abs(Math.abs(u-this.long0)-Math.PI)<=p&&Math.abs(c+this.lat0)<=p?(s.x=NaN,s.y=NaN,s):this.sphere?(v=2*this.k0/(1+this.sinlat0*y+this.coslat0*g*Math.cos(z)),s.x=this.a*v*g*Math.sin(z)+this.x0,s.y=this.a*v*(this.coslat0*y-this.sinlat0*g*Math.cos(z))+this.y0,s):(S=2*Math.atan(this.ssfn_(c,y,this.e))-a,P=Math.cos(S),x=Math.sin(S),Math.abs(this.coslat0)<=p?(L=_t(this.e,c*this.con,this.con*y),U=2*this.a*this.k0*L/this.cons,s.x=this.x0+U*Math.sin(u-this.long0),s.y=this.y0-this.con*U*Math.cos(u-this.long0),s):(Math.abs(this.sinlat0)<p?(v=2*this.a*this.k0/(1+P*Math.cos(z)),s.y=v*x):(v=2*this.a*this.k0*this.ms1/(this.cosX0*(1+this.sinX0*x+this.cosX0*P*Math.cos(z))),s.y=v*(this.cosX0*x-this.sinX0*P*Math.cos(z))+this.y0),s.x=v*P*Math.sin(z)+this.x0,s))}function Gs(s){s.x-=this.x0,s.y-=this.y0;var u,c,y,g,v,S=Math.sqrt(s.x*s.x+s.y*s.y);if(this.sphere){var x=2*Math.atan(S/(2*this.a*this.k0));return u=this.long0,c=this.lat0,S<=p?(s.x=u,s.y=c,s):(c=Math.asin(Math.cos(x)*this.sinlat0+s.y*Math.sin(x)*this.coslat0/S),Math.abs(this.coslat0)<p?this.lat0>0?u=Q(this.long0+Math.atan2(s.x,-1*s.y)):u=Q(this.long0+Math.atan2(s.x,s.y)):u=Q(this.long0+Math.atan2(s.x*Math.sin(x),S*this.coslat0*Math.cos(x)-s.y*this.sinlat0*Math.sin(x))),s.x=u,s.y=c,s)}else if(Math.abs(this.coslat0)<=p){if(S<=p)return c=this.lat0,u=this.long0,s.x=u,s.y=c,s;s.x*=this.con,s.y*=this.con,y=S*this.cons/(2*this.a*this.k0),c=this.con*Zt(this.e,y),u=this.con*Q(this.con*this.long0+Math.atan2(s.x,-1*s.y))}else g=2*Math.atan(S*this.cosX0/(2*this.a*this.k0*this.ms1)),u=this.long0,S<=p?v=this.X0:(v=Math.asin(Math.cos(g)*this.sinX0+s.y*Math.sin(g)*this.cosX0/S),u=Q(this.long0+Math.atan2(s.x*Math.sin(g),S*this.cosX0*Math.cos(g)-s.y*this.sinX0*Math.sin(g)))),c=-1*Zt(this.e,Math.tan(.5*(a+v)));return s.x=u,s.y=c,s}var Ma=["stere","Stereographic_South_Pole","Polar Stereographic (variant B)"],Fc={init:Ql,forward:zc,inverse:Gs,names:Ma,ssfn_:Bc};function Uc(){var s=this.lat0;this.lambda0=this.long0;var u=Math.sin(s),c=this.a,y=this.rf,g=1/y,v=2*g-Math.pow(g,2),S=this.e=Math.sqrt(v);this.R=this.k0*c*Math.sqrt(1-v)/(1-v*Math.pow(u,2)),this.alpha=Math.sqrt(1+v/(1-v)*Math.pow(Math.cos(s),4)),this.b0=Math.asin(u/this.alpha);var x=Math.log(Math.tan(Math.PI/4+this.b0/2)),P=Math.log(Math.tan(Math.PI/4+s/2)),L=Math.log((1+S*u)/(1-S*u));this.K=x-this.alpha*P+this.alpha*S/2*L}function Ra(s){var u=Math.log(Math.tan(Math.PI/4-s.y/2)),c=this.e/2*Math.log((1+this.e*Math.sin(s.y))/(1-this.e*Math.sin(s.y))),y=-this.alpha*(u+c)+this.K,g=2*(Math.atan(Math.exp(y))-Math.PI/4),v=this.alpha*(s.x-this.lambda0),S=Math.atan(Math.sin(v)/(Math.sin(this.b0)*Math.tan(g)+Math.cos(this.b0)*Math.cos(v))),x=Math.asin(Math.cos(this.b0)*Math.sin(g)-Math.sin(this.b0)*Math.cos(g)*Math.cos(v));return s.y=this.R/2*Math.log((1+Math.sin(x))/(1-Math.sin(x)))+this.y0,s.x=this.R*S+this.x0,s}function eu(s){for(var u=s.x-this.x0,c=s.y-this.y0,y=u/this.R,g=2*(Math.atan(Math.exp(c/this.R))-Math.PI/4),v=Math.asin(Math.cos(this.b0)*Math.sin(g)+Math.sin(this.b0)*Math.cos(g)*Math.cos(y)),S=Math.atan(Math.sin(y)/(Math.cos(this.b0)*Math.cos(y)-Math.sin(this.b0)*Math.tan(g))),x=this.lambda0+S/this.alpha,P=0,L=v,U=-1e3,z=0;Math.abs(L-U)>1e-7;){if(++z>20)return;P=1/this.alpha*(Math.log(Math.tan(Math.PI/4+v/2))-this.K)+this.e*Math.log(Math.tan(Math.PI/4+Math.asin(this.e*Math.sin(L))/2)),U=L,L=2*Math.atan(Math.exp(P))-Math.PI/2}return s.x=x,s.y=L,s}var Vs=["somerc"],Ca={init:Uc,forward:Ra,inverse:eu,names:Vs};function ki(){this.no_off=this.no_off||!1,this.no_rot=this.no_rot||!1,isNaN(this.k0)&&(this.k0=1);var s=Math.sin(this.lat0),u=Math.cos(this.lat0),c=this.e*s;this.bl=Math.sqrt(1+this.es/(1-this.es)*Math.pow(u,4)),this.al=this.a*this.bl*this.k0*Math.sqrt(1-this.es)/(1-c*c);var y=_t(this.e,this.lat0,s),g=this.bl/u*Math.sqrt((1-this.es)/(1-c*c));g*g<1&&(g=1);var v,S;if(!isNaN(this.longc))this.lat0>=0?v=g+Math.sqrt(g*g-1):v=g-Math.sqrt(g*g-1),this.el=v*Math.pow(y,this.bl),S=.5*(v-1/v),this.gamma0=Math.asin(Math.sin(this.alpha)/g),this.long0=this.longc-Math.asin(S*Math.tan(this.gamma0))/this.bl;else{var x=_t(this.e,this.lat1,Math.sin(this.lat1)),P=_t(this.e,this.lat2,Math.sin(this.lat2));this.lat0>=0?this.el=(g+Math.sqrt(g*g-1))*Math.pow(y,this.bl):this.el=(g-Math.sqrt(g*g-1))*Math.pow(y,this.bl);var L=Math.pow(x,this.bl),U=Math.pow(P,this.bl);v=this.el/L,S=.5*(v-1/v);var z=(this.el*this.el-U*L)/(this.el*this.el+U*L),q=(U-L)/(U+L),Y=Q(this.long1-this.long2);this.long0=.5*(this.long1+this.long2)-Math.atan(z*Math.tan(.5*this.bl*Y)/q)/this.bl,this.long0=Q(this.long0);var K=Q(this.long1-this.long0);this.gamma0=Math.atan(Math.sin(this.bl*K)/S),this.alpha=Math.asin(g*Math.sin(this.gamma0))}this.no_off?this.uc=0:this.lat0>=0?this.uc=this.al/this.bl*Math.atan2(Math.sqrt(g*g-1),Math.cos(this.alpha)):this.uc=-1*this.al/this.bl*Math.atan2(Math.sqrt(g*g-1),Math.cos(this.alpha))}function Yn(s){var u=s.x,c=s.y,y=Q(u-this.long0),g,v,S;if(Math.abs(Math.abs(c)-a)<=p)c>0?S=-1:S=1,v=this.al/this.bl*Math.log(Math.tan(_+S*this.gamma0*.5)),g=-1*S*a*this.al/this.bl;else{var x=_t(this.e,c,Math.sin(c)),P=this.el/Math.pow(x,this.bl),L=.5*(P-1/P),U=.5*(P+1/P),z=Math.sin(this.bl*y),q=(L*Math.sin(this.gamma0)-z*Math.cos(this.gamma0))/U;Math.abs(Math.abs(q)-1)<=p?v=Number.POSITIVE_INFINITY:v=.5*this.al*Math.log((1-q)/(1+q))/this.bl,Math.abs(Math.cos(this.bl*y))<=p?g=this.al*this.bl*y:g=this.al*Math.atan2(L*Math.cos(this.gamma0)+z*Math.sin(this.gamma0),Math.cos(this.bl*y))/this.bl}return this.no_rot?(s.x=this.x0+g,s.y=this.y0+v):(g-=this.uc,s.x=this.x0+v*Math.cos(this.alpha)+g*Math.sin(this.alpha),s.y=this.y0+g*Math.cos(this.alpha)-v*Math.sin(this.alpha)),s}function Ks(s){var u,c;this.no_rot?(c=s.y-this.y0,u=s.x-this.x0):(c=(s.x-this.x0)*Math.cos(this.alpha)-(s.y-this.y0)*Math.sin(this.alpha),u=(s.y-this.y0)*Math.cos(this.alpha)+(s.x-this.x0)*Math.sin(this.alpha),u+=this.uc);var y=Math.exp(-1*this.bl*c/this.al),g=.5*(y-1/y),v=.5*(y+1/y),S=Math.sin(this.bl*u/this.al),x=(S*Math.cos(this.gamma0)+g*Math.sin(this.gamma0))/v,P=Math.pow(this.el/Math.sqrt((1+x)/(1-x)),1/this.bl);return Math.abs(x-1)<p?(s.x=this.long0,s.y=a):Math.abs(x+1)<p?(s.x=this.long0,s.y=-1*a):(s.y=Zt(this.e,P),s.x=Q(this.long0-Math.atan2(g*Math.cos(this.gamma0)-S*Math.sin(this.gamma0),Math.cos(this.bl*u/this.al))/this.bl)),s}var tu=["Hotine_Oblique_Mercator","Hotine Oblique Mercator","Hotine_Oblique_Mercator_Azimuth_Natural_Origin","Hotine_Oblique_Mercator_Azimuth_Center","omerc"],jc={init:ki,forward:Yn,inverse:Ks,names:tu};function Ta(){if(this.lat2||(this.lat2=this.lat1),this.k0||(this.k0=1),this.x0=this.x0||0,this.y0=this.y0||0,!(Math.abs(this.lat1+this.lat2)<p)){var s=this.b/this.a;this.e=Math.sqrt(1-s*s);var u=Math.sin(this.lat1),c=Math.cos(this.lat1),y=je(this.e,u,c),g=_t(this.e,this.lat1,u),v=Math.sin(this.lat2),S=Math.cos(this.lat2),x=je(this.e,v,S),P=_t(this.e,this.lat2,v),L=_t(this.e,this.lat0,Math.sin(this.lat0));Math.abs(this.lat1-this.lat2)>p?this.ns=Math.log(y/x)/Math.log(g/P):this.ns=u,isNaN(this.ns)&&(this.ns=u),this.f0=y/(this.ns*Math.pow(g,this.ns)),this.rh=this.a*this.f0*Math.pow(L,this.ns),this.title||(this.title="Lambert Conformal Conic")}}function Wc(s){var u=s.x,c=s.y;Math.abs(2*Math.abs(c)-Math.PI)<=p&&(c=at(c)*(a-2*p));var y=Math.abs(Math.abs(c)-a),g,v;if(y>p)g=_t(this.e,c,Math.sin(c)),v=this.a*this.f0*Math.pow(g,this.ns);else{if(y=c*this.ns,y<=0)return null;v=0}var S=this.ns*Q(u-this.long0);return s.x=this.k0*(v*Math.sin(S))+this.x0,s.y=this.k0*(this.rh-v*Math.cos(S))+this.y0,s}function ru(s){var u,c,y,g,v,S=(s.x-this.x0)/this.k0,x=this.rh-(s.y-this.y0)/this.k0;this.ns>0?(u=Math.sqrt(S*S+x*x),c=1):(u=-Math.sqrt(S*S+x*x),c=-1);var P=0;if(u!==0&&(P=Math.atan2(c*S,c*x)),u!==0||this.ns>0){if(c=1/this.ns,y=Math.pow(u/(this.a*this.f0),c),g=Zt(this.e,y),g===-9999)return null}else g=-a;return v=Q(P/this.ns+this.long0),s.x=v,s.y=g,s}var Ys=["Lambert Tangential Conformal Conic Projection","Lambert_Conformal_Conic","Lambert_Conformal_Conic_2SP","lcc"],Aa={init:Ta,forward:Wc,inverse:ru,names:Ys};function iu(){this.a=6377397155e-3,this.es=.006674372230614,this.e=Math.sqrt(this.es),this.lat0||(this.lat0=.863937979737193),this.long0||(this.long0=.7417649320975901-.308341501185665),this.k0||(this.k0=.9999),this.s45=.785398163397448,this.s90=2*this.s45,this.fi0=this.lat0,this.e2=this.es,this.e=Math.sqrt(this.e2),this.alfa=Math.sqrt(1+this.e2*Math.pow(Math.cos(this.fi0),4)/(1-this.e2)),this.uq=1.04216856380474,this.u0=Math.asin(Math.sin(this.fi0)/this.alfa),this.g=Math.pow((1+this.e*Math.sin(this.fi0))/(1-this.e*Math.sin(this.fi0)),this.alfa*this.e/2),this.k=Math.tan(this.u0/2+this.s45)/Math.pow(Math.tan(this.fi0/2+this.s45),this.alfa)*this.g,this.k1=this.k0,this.n0=this.a*Math.sqrt(1-this.e2)/(1-this.e2*Math.pow(Math.sin(this.fi0),2)),this.s0=1.37008346281555,this.n=Math.sin(this.s0),this.ro0=this.k1*this.n0/Math.tan(this.s0),this.ad=this.s90-this.uq}function nu(s){var u,c,y,g,v,S,x,P=s.x,L=s.y,U=Q(P-this.long0);return u=Math.pow((1+this.e*Math.sin(L))/(1-this.e*Math.sin(L)),this.alfa*this.e/2),c=2*(Math.atan(this.k*Math.pow(Math.tan(L/2+this.s45),this.alfa)/u)-this.s45),y=-U*this.alfa,g=Math.asin(Math.cos(this.ad)*Math.sin(c)+Math.sin(this.ad)*Math.cos(c)*Math.cos(y)),v=Math.asin(Math.cos(c)*Math.sin(y)/Math.cos(g)),S=this.n*v,x=this.ro0*Math.pow(Math.tan(this.s0/2+this.s45),this.n)/Math.pow(Math.tan(g/2+this.s45),this.n),s.y=x*Math.cos(S)/1,s.x=x*Math.sin(S)/1,this.czech||(s.y*=-1,s.x*=-1),s}function $c(s){var u,c,y,g,v,S,x,P,L=s.x;s.x=s.y,s.y=L,this.czech||(s.y*=-1,s.x*=-1),S=Math.sqrt(s.x*s.x+s.y*s.y),v=Math.atan2(s.y,s.x),g=v/Math.sin(this.s0),y=2*(Math.atan(Math.pow(this.ro0/S,1/this.n)*Math.tan(this.s0/2+this.s45))-this.s45),u=Math.asin(Math.cos(this.ad)*Math.sin(y)-Math.sin(this.ad)*Math.cos(y)*Math.cos(g)),c=Math.asin(Math.cos(y)*Math.sin(g)/Math.cos(u)),s.x=this.long0-c/this.alfa,x=u,P=0;var U=0;do s.y=2*(Math.atan(Math.pow(this.k,-1/this.alfa)*Math.pow(Math.tan(u/2+this.s45),1/this.alfa)*Math.pow((1+this.e*Math.sin(x))/(1-this.e*Math.sin(x)),this.e/2))-this.s45),Math.abs(x-s.y)<1e-10&&(P=1),x=s.y,U+=1;while(P===0&&U<15);return U>=15?null:s}var qc=["Krovak","krovak"],Ia={init:iu,forward:nu,inverse:$c,names:qc},St=function(s,u,c,y,g){return s*g-u*Math.sin(2*g)+c*Math.sin(4*g)-y*Math.sin(6*g)},Zn=function(s){return 1-.25*s*(1+s/16*(3+1.25*s))},Xn=function(s){return .375*s*(1+.25*s*(1+.46875*s))},Jn=function(s){return .05859375*s*s*(1+.75*s)},sn=function(s){return s*s*s*(35/3072)},ur=function(s,u,c){var y=u*c;return s/Math.sqrt(1-y*y)},zr=function(s){return Math.abs(s)<a?s:s-at(s)*Math.PI},ei=function(s,u,c,y,g){var v,S;v=s/u;for(var x=0;x<15;x++)if(S=(s-(u*v-c*Math.sin(2*v)+y*Math.sin(4*v)-g*Math.sin(6*v)))/(u-2*c*Math.cos(2*v)+4*y*Math.cos(4*v)-6*g*Math.cos(6*v)),v+=S,Math.abs(S)<=1e-10)return v;return NaN};function su(){this.sphere||(this.e0=Zn(this.es),this.e1=Xn(this.es),this.e2=Jn(this.es),this.e3=sn(this.es),this.ml0=this.a*St(this.e0,this.e1,this.e2,this.e3,this.lat0))}function Zs(s){var u,c,y=s.x,g=s.y;if(y=Q(y-this.long0),this.sphere)u=this.a*Math.asin(Math.cos(g)*Math.sin(y)),c=this.a*(Math.atan2(Math.tan(g),Math.cos(y))-this.lat0);else{var v=Math.sin(g),S=Math.cos(g),x=ur(this.a,this.e,v),P=Math.tan(g)*Math.tan(g),L=y*Math.cos(g),U=L*L,z=this.es*S*S/(1-this.es),q=this.a*St(this.e0,this.e1,this.e2,this.e3,g);u=x*L*(1-U*P*(1/6-(8-P+8*z)*U/120)),c=q-this.ml0+x*v/S*U*(.5+(5-P+6*z)*U/24)}return s.x=u+this.x0,s.y=c+this.y0,s}function Qn(s){s.x-=this.x0,s.y-=this.y0;var u=s.x/this.a,c=s.y/this.a,y,g;if(this.sphere){var v=c+this.lat0;y=Math.asin(Math.sin(v)*Math.cos(u)),g=Math.atan2(Math.tan(u),Math.cos(v))}else{var S=this.ml0/this.a+c,x=ei(S,this.e0,this.e1,this.e2,this.e3);if(Math.abs(Math.abs(x)-a)<=p)return s.x=this.long0,s.y=a,c<0&&(s.y*=-1),s;var P=ur(this.a,this.e,Math.sin(x)),L=P*P*P/this.a/this.a*(1-this.es),U=Math.pow(Math.tan(x),2),z=u*this.a/P,q=z*z;y=x-P*Math.tan(x)/L*z*z*(.5-(1+3*U)*z*z/24),g=z*(1-q*(U/3+(1+3*U)*U*q/15))/Math.cos(x)}return s.x=Q(g+this.long0),s.y=zr(y),s}var Xs=["Cassini","Cassini_Soldner","cass"],ti={init:su,forward:Zs,inverse:Qn,names:Xs},Er=function(s,u){var c;return s>1e-7?(c=s*u,(1-s*s)*(u/(1-c*c)-.5/s*Math.log((1-c)/(1+c)))):2*u},Hc=1,on=2,ou=3,Gc=4;function Js(){var s=Math.abs(this.lat0);if(Math.abs(s-a)<p?this.mode=this.lat0<0?this.S_POLE:this.N_POLE:Math.abs(s)<p?this.mode=this.EQUIT:this.mode=this.OBLIQ,this.es>0){var u;switch(this.qp=Er(this.e,1),this.mmf=.5/(1-this.es),this.apa=tf(this.es),this.mode){case this.N_POLE:this.dd=1;break;case this.S_POLE:this.dd=1;break;case this.EQUIT:this.rq=Math.sqrt(.5*this.qp),this.dd=1/this.rq,this.xmf=1,this.ymf=.5*this.qp;break;case this.OBLIQ:this.rq=Math.sqrt(.5*this.qp),u=Math.sin(this.lat0),this.sinb1=Er(this.e,u)/this.qp,this.cosb1=Math.sqrt(1-this.sinb1*this.sinb1),this.dd=Math.cos(this.lat0)/(Math.sqrt(1-this.es*u*u)*this.rq*this.cosb1),this.ymf=(this.xmf=this.rq)/this.dd,this.xmf*=this.dd;break}}else this.mode===this.OBLIQ&&(this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0))}function Vc(s){var u,c,y,g,v,S,x,P,L,U,z=s.x,q=s.y;if(z=Q(z-this.long0),this.sphere){if(v=Math.sin(q),U=Math.cos(q),y=Math.cos(z),this.mode===this.OBLIQ||this.mode===this.EQUIT){if(c=this.mode===this.EQUIT?1+U*y:1+this.sinph0*v+this.cosph0*U*y,c<=p)return null;c=Math.sqrt(2/c),u=c*U*Math.sin(z),c*=this.mode===this.EQUIT?v:this.cosph0*v-this.sinph0*U*y}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(y=-y),Math.abs(q+this.lat0)<p)return null;c=_-q*.5,c=2*(this.mode===this.S_POLE?Math.cos(c):Math.sin(c)),u=c*Math.sin(z),c*=y}}else{switch(x=0,P=0,L=0,y=Math.cos(z),g=Math.sin(z),v=Math.sin(q),S=Er(this.e,v),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(x=S/this.qp,P=Math.sqrt(1-x*x)),this.mode){case this.OBLIQ:L=1+this.sinb1*x+this.cosb1*P*y;break;case this.EQUIT:L=1+P*y;break;case this.N_POLE:L=a+q,S=this.qp-S;break;case this.S_POLE:L=q-a,S=this.qp+S;break}if(Math.abs(L)<p)return null;switch(this.mode){case this.OBLIQ:case this.EQUIT:L=Math.sqrt(2/L),this.mode===this.OBLIQ?c=this.ymf*L*(this.cosb1*x-this.sinb1*P*y):c=(L=Math.sqrt(2/(1+P*y)))*x*this.ymf,u=this.xmf*L*P*g;break;case this.N_POLE:case this.S_POLE:S>=0?(u=(L=Math.sqrt(S))*g,c=y*(this.mode===this.S_POLE?L:-L)):u=c=0;break}}return s.x=this.a*u+this.x0,s.y=this.a*c+this.y0,s}function Kc(s){s.x-=this.x0,s.y-=this.y0;var u=s.x/this.a,c=s.y/this.a,y,g,v,S,x,P,L;if(this.sphere){var U=0,z,q=0;if(z=Math.sqrt(u*u+c*c),g=z*.5,g>1)return null;switch(g=2*Math.asin(g),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(q=Math.sin(g),U=Math.cos(g)),this.mode){case this.EQUIT:g=Math.abs(z)<=p?0:Math.asin(c*q/z),u*=q,c=U*z;break;case this.OBLIQ:g=Math.abs(z)<=p?this.lat0:Math.asin(U*this.sinph0+c*q*this.cosph0/z),u*=q*this.cosph0,c=(U-Math.sin(g)*this.sinph0)*z;break;case this.N_POLE:c=-c,g=a-g;break;case this.S_POLE:g-=a;break}y=c===0&&(this.mode===this.EQUIT||this.mode===this.OBLIQ)?0:Math.atan2(u,c)}else{if(L=0,this.mode===this.OBLIQ||this.mode===this.EQUIT){if(u/=this.dd,c*=this.dd,P=Math.sqrt(u*u+c*c),P<p)return s.x=this.long0,s.y=this.lat0,s;S=2*Math.asin(.5*P/this.rq),v=Math.cos(S),u*=S=Math.sin(S),this.mode===this.OBLIQ?(L=v*this.sinb1+c*S*this.cosb1/P,x=this.qp*L,c=P*this.cosb1*v-c*this.sinb1*S):(L=c*S/P,x=this.qp*L,c=P*v)}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(c=-c),x=u*u+c*c,!x)return s.x=this.long0,s.y=this.lat0,s;L=1-x/this.qp,this.mode===this.S_POLE&&(L=-L)}y=Math.atan2(u,c),g=rf(Math.asin(L),this.apa)}return s.x=Q(this.long0+y),s.y=g,s}var Yc=.3333333333333333,Zc=.17222222222222222,Xc=.10257936507936508,Jc=.06388888888888888,Qc=.0664021164021164,ef=.016415012942191543;function tf(s){var u,c=[];return c[0]=s*Yc,u=s*s,c[0]+=u*Zc,c[1]=u*Jc,u*=s,c[0]+=u*Xc,c[1]+=u*Qc,c[2]=u*ef,c}function rf(s,u){var c=s+s;return s+u[0]*Math.sin(c)+u[1]*Math.sin(c+c)+u[2]*Math.sin(c+c+c)}var nf=["Lambert Azimuthal Equal Area","Lambert_Azimuthal_Equal_Area","laea"],au={init:Js,forward:Vc,inverse:Kc,names:nf,S_POLE:Hc,N_POLE:on,EQUIT:ou,OBLIQ:Gc},ri=function(s){return Math.abs(s)>1&&(s=s>1?1:-1),Math.asin(s)};function sf(){Math.abs(this.lat1+this.lat2)<p||(this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e3=Math.sqrt(this.es),this.sin_po=Math.sin(this.lat1),this.cos_po=Math.cos(this.lat1),this.t1=this.sin_po,this.con=this.sin_po,this.ms1=je(this.e3,this.sin_po,this.cos_po),this.qs1=Er(this.e3,this.sin_po,this.cos_po),this.sin_po=Math.sin(this.lat2),this.cos_po=Math.cos(this.lat2),this.t2=this.sin_po,this.ms2=je(this.e3,this.sin_po,this.cos_po),this.qs2=Er(this.e3,this.sin_po,this.cos_po),this.sin_po=Math.sin(this.lat0),this.cos_po=Math.cos(this.lat0),this.t3=this.sin_po,this.qs0=Er(this.e3,this.sin_po,this.cos_po),Math.abs(this.lat1-this.lat2)>p?this.ns0=(this.ms1*this.ms1-this.ms2*this.ms2)/(this.qs2-this.qs1):this.ns0=this.con,this.c=this.ms1*this.ms1+this.ns0*this.qs1,this.rh=this.a*Math.sqrt(this.c-this.ns0*this.qs0)/this.ns0)}function ii(s){var u=s.x,c=s.y;this.sin_phi=Math.sin(c),this.cos_phi=Math.cos(c);var y=Er(this.e3,this.sin_phi,this.cos_phi),g=this.a*Math.sqrt(this.c-this.ns0*y)/this.ns0,v=this.ns0*Q(u-this.long0),S=g*Math.sin(v)+this.x0,x=this.rh-g*Math.cos(v)+this.y0;return s.x=S,s.y=x,s}function Pa(s){var u,c,y,g,v,S;return s.x-=this.x0,s.y=this.rh-s.y+this.y0,this.ns0>=0?(u=Math.sqrt(s.x*s.x+s.y*s.y),y=1):(u=-Math.sqrt(s.x*s.x+s.y*s.y),y=-1),g=0,u!==0&&(g=Math.atan2(y*s.x,y*s.y)),y=u*this.ns0/this.a,this.sphere?S=Math.asin((this.c-y*y)/(2*this.ns0)):(c=(this.c-y*y)/this.ns0,S=this.phi1z(this.e3,c)),v=Q(g/this.ns0+this.long0),s.x=v,s.y=S,s}function lu(s,u){var c,y,g,v,S,x=ri(.5*u);if(s<p)return x;for(var P=s*s,L=1;L<=25;L++)if(c=Math.sin(x),y=Math.cos(x),g=s*c,v=1-g*g,S=.5*v*v/y*(u/(1-P)-c/v+.5/s*Math.log((1-g)/(1+g))),x=x+S,Math.abs(S)<=1e-7)return x;return null}var Oa=["Albers_Conic_Equal_Area","Albers","aea"],ni={init:sf,forward:ii,inverse:Pa,names:Oa,phi1z:lu};function si(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0),this.infinity_dist=1e3*this.a,this.rc=1}function hr(s){var u,c,y,g,v,S,x,P,L=s.x,U=s.y;return y=Q(L-this.long0),u=Math.sin(U),c=Math.cos(U),g=Math.cos(y),S=this.sin_p14*u+this.cos_p14*c*g,v=1,S>0||Math.abs(S)<=p?(x=this.x0+this.a*v*c*Math.sin(y)/S,P=this.y0+this.a*v*(this.cos_p14*u-this.sin_p14*c*g)/S):(x=this.x0+this.infinity_dist*c*Math.sin(y),P=this.y0+this.infinity_dist*(this.cos_p14*u-this.sin_p14*c*g)),s.x=x,s.y=P,s}function es(s){var u,c,y,g,v,S;return s.x=(s.x-this.x0)/this.a,s.y=(s.y-this.y0)/this.a,s.x/=this.k0,s.y/=this.k0,(u=Math.sqrt(s.x*s.x+s.y*s.y))?(g=Math.atan2(u,this.rc),c=Math.sin(g),y=Math.cos(g),S=ri(y*this.sin_p14+s.y*c*this.cos_p14/u),v=Math.atan2(s.x*c,u*this.cos_p14*y-s.y*this.sin_p14*c),v=Q(this.long0+v)):(S=this.phic0,v=0),s.x=v,s.y=S,s}var uu=["gnom"],Ni={init:si,forward:hr,inverse:es,names:uu},hu=function(s,u){var c=1-(1-s*s)/(2*s)*Math.log((1-s)/(1+s));if(Math.abs(Math.abs(u)-c)<1e-6)return u<0?-1*a:a;for(var y=Math.asin(.5*u),g,v,S,x,P=0;P<30;P++)if(v=Math.sin(y),S=Math.cos(y),x=s*v,g=Math.pow(1-x*x,2)/(2*S)*(u/(1-s*s)-v/(1-x*x)+.5/s*Math.log((1-x)/(1+x))),y+=g,Math.abs(g)<=1e-10)return y;return NaN};function cu(){this.sphere||(this.k0=je(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))}function Qs(s){var u=s.x,c=s.y,y,g,v=Q(u-this.long0);if(this.sphere)y=this.x0+this.a*v*Math.cos(this.lat_ts),g=this.y0+this.a*Math.sin(c)/Math.cos(this.lat_ts);else{var S=Er(this.e,Math.sin(c));y=this.x0+this.a*this.k0*v,g=this.y0+this.a*S*.5/this.k0}return s.x=y,s.y=g,s}function fu(s){s.x-=this.x0,s.y-=this.y0;var u,c;return this.sphere?(u=Q(this.long0+s.x/this.a/Math.cos(this.lat_ts)),c=Math.asin(s.y/this.a*Math.cos(this.lat_ts))):(c=hu(this.e,2*s.y*this.k0/this.a),u=Q(this.long0+s.x/(this.a*this.k0))),s.x=u,s.y=c,s}var du=["cea"],mu={init:cu,forward:Qs,inverse:fu,names:du};function eo(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Equidistant Cylindrical (Plate Carre)",this.rc=Math.cos(this.lat_ts)}function pu(s){var u=s.x,c=s.y,y=Q(u-this.long0),g=zr(c-this.lat0);return s.x=this.x0+this.a*y*this.rc,s.y=this.y0+this.a*g,s}function gu(s){var u=s.x,c=s.y;return s.x=Q(this.long0+(u-this.x0)/(this.a*this.rc)),s.y=zr(this.lat0+(c-this.y0)/this.a),s}var of=["Equirectangular","Equidistant_Cylindrical","eqc"],af={init:eo,forward:pu,inverse:gu,names:of},yu=20;function lf(){this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=Zn(this.es),this.e1=Xn(this.es),this.e2=Jn(this.es),this.e3=sn(this.es),this.ml0=this.a*St(this.e0,this.e1,this.e2,this.e3,this.lat0)}function to(s){var u=s.x,c=s.y,y,g,v,S=Q(u-this.long0);if(v=S*Math.sin(c),this.sphere)Math.abs(c)<=p?(y=this.a*S,g=-1*this.a*this.lat0):(y=this.a*Math.sin(v)/Math.tan(c),g=this.a*(zr(c-this.lat0)+(1-Math.cos(v))/Math.tan(c)));else if(Math.abs(c)<=p)y=this.a*S,g=-1*this.ml0;else{var x=ur(this.a,this.e,Math.sin(c))/Math.tan(c);y=x*Math.sin(v),g=this.a*St(this.e0,this.e1,this.e2,this.e3,c)-this.ml0+x*(1-Math.cos(v))}return s.x=y+this.x0,s.y=g+this.y0,s}function uf(s){var u,c,y,g,v,S,x,P,L;if(y=s.x-this.x0,g=s.y-this.y0,this.sphere)if(Math.abs(g+this.a*this.lat0)<=p)u=Q(y/this.a+this.long0),c=0;else{S=this.lat0+g/this.a,x=y*y/this.a/this.a+S*S,P=S;var U;for(v=yu;v;--v)if(U=Math.tan(P),L=-1*(S*(P*U+1)-P-.5*(P*P+x)*U)/((P-S)/U-1),P+=L,Math.abs(L)<=p){c=P;break}u=Q(this.long0+Math.asin(y*Math.tan(P)/this.a)/Math.sin(c))}else if(Math.abs(g+this.ml0)<=p)c=0,u=Q(this.long0+y/this.a);else{S=(this.ml0+g)/this.a,x=y*y/this.a/this.a+S*S,P=S;var z,q,Y,K,X;for(v=yu;v;--v)if(X=this.e*Math.sin(P),z=Math.sqrt(1-X*X)*Math.tan(P),q=this.a*St(this.e0,this.e1,this.e2,this.e3,P),Y=this.e0-2*this.e1*Math.cos(2*P)+4*this.e2*Math.cos(4*P)-6*this.e3*Math.cos(6*P),K=q/this.a,L=(S*(z*K+1)-K-.5*z*(K*K+x))/(this.es*Math.sin(2*P)*(K*K+x-2*S*K)/(4*z)+(S-K)*(z*Y-2/Math.sin(2*P))-Y),P-=L,Math.abs(L)<=p){c=P;break}z=Math.sqrt(1-this.es*Math.pow(Math.sin(c),2))*Math.tan(c),u=Q(this.long0+Math.asin(y*z/this.a)/Math.sin(c))}return s.x=u,s.y=c,s}var bu=["Polyconic","poly"],ro={init:lf,forward:to,inverse:uf,names:bu};function io(){this.A=[],this.A[1]=.6399175073,this.A[2]=-.1358797613,this.A[3]=.063294409,this.A[4]=-.02526853,this.A[5]=.0117879,this.A[6]=-.0055161,this.A[7]=.0026906,this.A[8]=-.001333,this.A[9]=67e-5,this.A[10]=-34e-5,this.B_re=[],this.B_im=[],this.B_re[1]=.7557853228,this.B_im[1]=0,this.B_re[2]=.249204646,this.B_im[2]=.003371507,this.B_re[3]=-.001541739,this.B_im[3]=.04105856,this.B_re[4]=-.10162907,this.B_im[4]=.01727609,this.B_re[5]=-.26623489,this.B_im[5]=-.36249218,this.B_re[6]=-.6870983,this.B_im[6]=-1.1651967,this.C_re=[],this.C_im=[],this.C_re[1]=1.3231270439,this.C_im[1]=0,this.C_re[2]=-.577245789,this.C_im[2]=-.007809598,this.C_re[3]=.508307513,this.C_im[3]=-.112208952,this.C_re[4]=-.15094762,this.C_im[4]=.18200602,this.C_re[5]=1.01418179,this.C_im[5]=1.64497696,this.C_re[6]=1.9660549,this.C_im[6]=2.5127645,this.D=[],this.D[1]=1.5627014243,this.D[2]=.5185406398,this.D[3]=-.03333098,this.D[4]=-.1052906,this.D[5]=-.0368594,this.D[6]=.007317,this.D[7]=.0122,this.D[8]=.00394,this.D[9]=-.0013}function no(s){var u,c=s.x,y=s.y,g=y-this.lat0,v=c-this.long0,S=g/o*1e-5,x=v,P=1,L=0;for(u=1;u<=10;u++)P=P*S,L=L+this.A[u]*P;var U=L,z=x,q=1,Y=0,K,X,J=0,ce=0;for(u=1;u<=6;u++)K=q*U-Y*z,X=Y*U+q*z,q=K,Y=X,J=J+this.B_re[u]*q-this.B_im[u]*Y,ce=ce+this.B_im[u]*q+this.B_re[u]*Y;return s.x=ce*this.a+this.x0,s.y=J*this.a+this.y0,s}function ts(s){var u,c=s.x,y=s.y,g=c-this.x0,v=y-this.y0,S=v/this.a,x=g/this.a,P=1,L=0,U,z,q=0,Y=0;for(u=1;u<=6;u++)U=P*S-L*x,z=L*S+P*x,P=U,L=z,q=q+this.C_re[u]*P-this.C_im[u]*L,Y=Y+this.C_im[u]*P+this.C_re[u]*L;for(var K=0;K<this.iterations;K++){var X=q,J=Y,ce,_e,We=S,rt=x;for(u=2;u<=6;u++)ce=X*q-J*Y,_e=J*q+X*Y,X=ce,J=_e,We=We+(u-1)*(this.B_re[u]*X-this.B_im[u]*J),rt=rt+(u-1)*(this.B_im[u]*X+this.B_re[u]*J);X=1,J=0;var $e=this.B_re[1],He=this.B_im[1];for(u=2;u<=6;u++)ce=X*q-J*Y,_e=J*q+X*Y,X=ce,J=_e,$e=$e+u*(this.B_re[u]*X-this.B_im[u]*J),He=He+u*(this.B_im[u]*X+this.B_re[u]*J);var Pt=$e*$e+He*He;q=(We*$e+rt*He)/Pt,Y=(rt*$e-We*He)/Pt}var ht=q,li=Y,is=1,ns=0;for(u=1;u<=9;u++)is=is*ht,ns=ns+this.D[u]*is;var Eu=this.lat0+ns*o*1e5,qw=this.long0+li;return s.x=qw,s.y=Eu,s}var so=["New_Zealand_Map_Grid","nzmg"],hf={init:io,forward:no,inverse:ts,names:so};function cf(){}function vu(s){var u=s.x,c=s.y,y=Q(u-this.long0),g=this.x0+this.a*y,v=this.y0+this.a*Math.log(Math.tan(Math.PI/4+c/2.5))*1.25;return s.x=g,s.y=v,s}function wu(s){s.x-=this.x0,s.y-=this.y0;var u=Q(this.long0+s.x/this.a),c=2.5*(Math.atan(Math.exp(.8*s.y/this.a))-Math.PI/4);return s.x=u,s.y=c,s}var ff=["Miller_Cylindrical","mill"],_u={init:cf,forward:vu,inverse:wu,names:ff},df=20;function mf(){this.sphere?(this.n=1,this.m=0,this.es=0,this.C_y=Math.sqrt((this.m+1)/this.n),this.C_x=this.C_y/(this.m+1)):this.en=Qi(this.es)}function pf(s){var u,c,y=s.x,g=s.y;if(y=Q(y-this.long0),this.sphere){if(!this.m)g=this.n!==1?Math.asin(this.n*Math.sin(g)):g;else for(var v=this.n*Math.sin(g),S=df;S;--S){var x=(this.m*g+Math.sin(g)-v)/(this.m+Math.cos(g));if(g-=x,Math.abs(x)<p)break}u=this.a*this.C_x*y*(this.m+Math.cos(g)),c=this.a*this.C_y*g}else{var P=Math.sin(g),L=Math.cos(g);c=this.a*Vn(g,P,L,this.en),u=this.a*y*L/Math.sqrt(1-this.es*P*P)}return s.x=u,s.y=c,s}function gf(s){var u,c,y,g;return s.x-=this.x0,y=s.x/this.a,s.y-=this.y0,u=s.y/this.a,this.sphere?(u/=this.C_y,y=y/(this.C_x*(this.m+Math.cos(u))),this.m?u=ri((this.m*u+Math.sin(u))/this.n):this.n!==1&&(u=ri(Math.sin(u)/this.n)),y=Q(y+this.long0),u=zr(u)):(u=wa(s.y/this.a,this.es,this.en),g=Math.abs(u),g<a?(g=Math.sin(u),c=this.long0+s.x*Math.sqrt(1-this.es*g*g)/(this.a*Math.cos(u)),y=Q(c)):g-p<a&&(y=this.long0)),s.x=y,s.y=u,s}var yf=["Sinusoidal","sinu"],oo={init:mf,forward:pf,inverse:gf,names:yf};function Su(){}function l(s){for(var u=s.x,c=s.y,y=Q(u-this.long0),g=c,v=Math.PI*Math.sin(c);;){var S=-(g+Math.sin(g)-v)/(1+Math.cos(g));if(g+=S,Math.abs(S)<p)break}g/=2,Math.PI/2-Math.abs(c)<p&&(y=0);var x=.900316316158*this.a*y*Math.cos(g)+this.x0,P=1.4142135623731*this.a*Math.sin(g)+this.y0;return s.x=x,s.y=P,s}function f(s){var u,c;s.x-=this.x0,s.y-=this.y0,c=s.y/(1.4142135623731*this.a),Math.abs(c)>.999999999999&&(c=.999999999999),u=Math.asin(c);var y=Q(this.long0+s.x/(.900316316158*this.a*Math.cos(u)));y<-Math.PI&&(y=-Math.PI),y>Math.PI&&(y=Math.PI),c=(2*u+Math.sin(2*u))/Math.PI,Math.abs(c)>1&&(c=1);var g=Math.asin(c);return s.x=y,s.y=g,s}var b=["Mollweide","moll"],O={init:Su,forward:l,inverse:f,names:b};function B(){Math.abs(this.lat1+this.lat2)<p||(this.lat2=this.lat2||this.lat1,this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=Zn(this.es),this.e1=Xn(this.es),this.e2=Jn(this.es),this.e3=sn(this.es),this.sinphi=Math.sin(this.lat1),this.cosphi=Math.cos(this.lat1),this.ms1=je(this.e,this.sinphi,this.cosphi),this.ml1=St(this.e0,this.e1,this.e2,this.e3,this.lat1),Math.abs(this.lat1-this.lat2)<p?this.ns=this.sinphi:(this.sinphi=Math.sin(this.lat2),this.cosphi=Math.cos(this.lat2),this.ms2=je(this.e,this.sinphi,this.cosphi),this.ml2=St(this.e0,this.e1,this.e2,this.e3,this.lat2),this.ns=(this.ms1-this.ms2)/(this.ml2-this.ml1)),this.g=this.ml1+this.ms1/this.ns,this.ml0=St(this.e0,this.e1,this.e2,this.e3,this.lat0),this.rh=this.a*(this.g-this.ml0))}function $(s){var u=s.x,c=s.y,y;if(this.sphere)y=this.a*(this.g-c);else{var g=St(this.e0,this.e1,this.e2,this.e3,c);y=this.a*(this.g-g)}var v=this.ns*Q(u-this.long0),S=this.x0+y*Math.sin(v),x=this.y0+this.rh-y*Math.cos(v);return s.x=S,s.y=x,s}function V(s){s.x-=this.x0,s.y=this.rh-s.y+this.y0;var u,c,y,g;this.ns>=0?(c=Math.sqrt(s.x*s.x+s.y*s.y),u=1):(c=-Math.sqrt(s.x*s.x+s.y*s.y),u=-1);var v=0;if(c!==0&&(v=Math.atan2(u*s.x,u*s.y)),this.sphere)return g=Q(this.long0+v/this.ns),y=zr(this.g-c/this.a),s.x=g,s.y=y,s;var S=this.g-c/this.a;return y=ei(S,this.e0,this.e1,this.e2,this.e3),g=Q(this.long0+v/this.ns),s.x=g,s.y=y,s}var ne=["Equidistant_Conic","eqdc"],ge={init:B,forward:$,inverse:V,names:ne};function Me(){this.R=this.a}function De(s){var u=s.x,c=s.y,y=Q(u-this.long0),g,v;Math.abs(c)<=p&&(g=this.x0+this.R*y,v=this.y0);var S=ri(2*Math.abs(c/Math.PI));(Math.abs(y)<=p||Math.abs(Math.abs(c)-a)<=p)&&(g=this.x0,c>=0?v=this.y0+Math.PI*this.R*Math.tan(.5*S):v=this.y0+Math.PI*this.R*-Math.tan(.5*S));var x=.5*Math.abs(Math.PI/y-y/Math.PI),P=x*x,L=Math.sin(S),U=Math.cos(S),z=U/(L+U-1),q=z*z,Y=z*(2/L-1),K=Y*Y,X=Math.PI*this.R*(x*(z-K)+Math.sqrt(P*(z-K)*(z-K)-(K+P)*(q-K)))/(K+P);y<0&&(X=-X),g=this.x0+X;var J=P+z;return X=Math.PI*this.R*(Y*J-x*Math.sqrt((K+P)*(P+1)-J*J))/(K+P),c>=0?v=this.y0+X:v=this.y0-X,s.x=g,s.y=v,s}function Be(s){var u,c,y,g,v,S,x,P,L,U,z,q,Y;return s.x-=this.x0,s.y-=this.y0,z=Math.PI*this.R,y=s.x/z,g=s.y/z,v=y*y+g*g,S=-Math.abs(g)*(1+v),x=S-2*g*g+y*y,P=-2*S+1+2*g*g+v*v,Y=g*g/P+(2*x*x*x/P/P/P-9*S*x/P/P)/27,L=(S-x*x/3/P)/P,U=2*Math.sqrt(-L/3),z=3*Y/L/U,Math.abs(z)>1&&(z>=0?z=1:z=-1),q=Math.acos(z)/3,s.y>=0?c=(-U*Math.cos(q+Math.PI/3)-x/3/P)*Math.PI:c=-(-U*Math.cos(q+Math.PI/3)-x/3/P)*Math.PI,Math.abs(y)<p?u=this.long0:u=Q(this.long0+Math.PI*(v-1+Math.sqrt(1+2*(y*y-g*g)+v*v))/2/y),s.x=u,s.y=c,s}var ut=["Van_der_Grinten_I","VanDerGrinten","vandg"],cr={init:Me,forward:De,inverse:Be,names:ut};function an(){this.sin_p12=Math.sin(this.lat0),this.cos_p12=Math.cos(this.lat0)}function oi(s){var u=s.x,c=s.y,y=Math.sin(s.y),g=Math.cos(s.y),v=Q(u-this.long0),S,x,P,L,U,z,q,Y,K,X,J,ce,_e,We,rt,$e,He,Pt,ht,li,is,ns,Eu;return this.sphere?Math.abs(this.sin_p12-1)<=p?(s.x=this.x0+this.a*(a-c)*Math.sin(v),s.y=this.y0-this.a*(a-c)*Math.cos(v),s):Math.abs(this.sin_p12+1)<=p?(s.x=this.x0+this.a*(a+c)*Math.sin(v),s.y=this.y0+this.a*(a+c)*Math.cos(v),s):(Pt=this.sin_p12*y+this.cos_p12*g*Math.cos(v),$e=Math.acos(Pt),He=$e?$e/Math.sin($e):1,s.x=this.x0+this.a*He*g*Math.sin(v),s.y=this.y0+this.a*He*(this.cos_p12*y-this.sin_p12*g*Math.cos(v)),s):(S=Zn(this.es),x=Xn(this.es),P=Jn(this.es),L=sn(this.es),Math.abs(this.sin_p12-1)<=p?(U=this.a*St(S,x,P,L,a),z=this.a*St(S,x,P,L,c),s.x=this.x0+(U-z)*Math.sin(v),s.y=this.y0-(U-z)*Math.cos(v),s):Math.abs(this.sin_p12+1)<=p?(U=this.a*St(S,x,P,L,a),z=this.a*St(S,x,P,L,c),s.x=this.x0+(U+z)*Math.sin(v),s.y=this.y0+(U+z)*Math.cos(v),s):(q=y/g,Y=ur(this.a,this.e,this.sin_p12),K=ur(this.a,this.e,y),X=Math.atan((1-this.es)*q+this.es*Y*this.sin_p12/(K*g)),J=Math.atan2(Math.sin(v),this.cos_p12*Math.tan(X)-this.sin_p12*Math.cos(v)),J===0?ht=Math.asin(this.cos_p12*Math.sin(X)-this.sin_p12*Math.cos(X)):Math.abs(Math.abs(J)-Math.PI)<=p?ht=-Math.asin(this.cos_p12*Math.sin(X)-this.sin_p12*Math.cos(X)):ht=Math.asin(Math.sin(v)*Math.cos(X)/Math.sin(J)),ce=this.e*this.sin_p12/Math.sqrt(1-this.es),_e=this.e*this.cos_p12*Math.cos(J)/Math.sqrt(1-this.es),We=ce*_e,rt=_e*_e,li=ht*ht,is=li*ht,ns=is*ht,Eu=ns*ht,$e=Y*ht*(1-li*rt*(1-rt)/6+is/8*We*(1-2*rt)+ns/120*(rt*(4-7*rt)-3*ce*ce*(1-7*rt))-Eu/48*We),s.x=this.x0+$e*Math.sin(J),s.y=this.y0+$e*Math.cos(J),s))}function Fr(s){s.x-=this.x0,s.y-=this.y0;var u,c,y,g,v,S,x,P,L,U,z,q,Y,K,X,J,ce,_e,We,rt,$e,He,Pt,ht;return this.sphere?(u=Math.sqrt(s.x*s.x+s.y*s.y),u>2*a*this.a?void 0:(c=u/this.a,y=Math.sin(c),g=Math.cos(c),v=this.long0,Math.abs(u)<=p?S=this.lat0:(S=ri(g*this.sin_p12+s.y*y*this.cos_p12/u),x=Math.abs(this.lat0)-a,Math.abs(x)<=p?this.lat0>=0?v=Q(this.long0+Math.atan2(s.x,-s.y)):v=Q(this.long0-Math.atan2(-s.x,s.y)):v=Q(this.long0+Math.atan2(s.x*y,u*this.cos_p12*g-s.y*this.sin_p12*y))),s.x=v,s.y=S,s)):(P=Zn(this.es),L=Xn(this.es),U=Jn(this.es),z=sn(this.es),Math.abs(this.sin_p12-1)<=p?(q=this.a*St(P,L,U,z,a),u=Math.sqrt(s.x*s.x+s.y*s.y),Y=q-u,S=ei(Y/this.a,P,L,U,z),v=Q(this.long0+Math.atan2(s.x,-1*s.y)),s.x=v,s.y=S,s):Math.abs(this.sin_p12+1)<=p?(q=this.a*St(P,L,U,z,a),u=Math.sqrt(s.x*s.x+s.y*s.y),Y=u-q,S=ei(Y/this.a,P,L,U,z),v=Q(this.long0+Math.atan2(s.x,s.y)),s.x=v,s.y=S,s):(u=Math.sqrt(s.x*s.x+s.y*s.y),J=Math.atan2(s.x,s.y),K=ur(this.a,this.e,this.sin_p12),ce=Math.cos(J),_e=this.e*this.cos_p12*ce,We=-_e*_e/(1-this.es),rt=3*this.es*(1-We)*this.sin_p12*this.cos_p12*ce/(1-this.es),$e=u/K,He=$e-We*(1+We)*Math.pow($e,3)/6-rt*(1+3*We)*Math.pow($e,4)/24,Pt=1-We*He*He/2-$e*He*He*He/6,X=Math.asin(this.sin_p12*Math.cos(He)+this.cos_p12*Math.sin(He)*ce),v=Q(this.long0+Math.asin(Math.sin(J)*Math.sin(He)/Math.cos(X))),ht=Math.sin(X),S=Math.atan2((ht-this.es*Pt*this.sin_p12)*Math.tan(X),ht*(1-this.es)),s.x=v,s.y=S,s))}var Rt=["Azimuthal_Equidistant","aeqd"],At={init:an,forward:oi,inverse:Fr,names:Rt};function Jt(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0)}function Ur(s){var u,c,y,g,v,S,x,P,L=s.x,U=s.y;return y=Q(L-this.long0),u=Math.sin(U),c=Math.cos(U),g=Math.cos(y),S=this.sin_p14*u+this.cos_p14*c*g,v=1,(S>0||Math.abs(S)<=p)&&(x=this.a*v*c*Math.sin(y),P=this.y0+this.a*v*(this.cos_p14*u-this.sin_p14*c*g)),s.x=x,s.y=P,s}function le(s){var u,c,y,g,v,S,x;return s.x-=this.x0,s.y-=this.y0,u=Math.sqrt(s.x*s.x+s.y*s.y),c=ri(u/this.a),y=Math.sin(c),g=Math.cos(c),S=this.long0,Math.abs(u)<=p?(x=this.lat0,s.x=S,s.y=x,s):(x=ri(g*this.sin_p14+s.y*y*this.cos_p14/u),v=Math.abs(this.lat0)-a,Math.abs(v)<=p?(this.lat0>=0?S=Q(this.long0+Math.atan2(s.x,-s.y)):S=Q(this.long0-Math.atan2(-s.x,s.y)),s.x=S,s.y=x,s):(S=Q(this.long0+Math.atan2(s.x*y,u*this.cos_p14*g-s.y*this.sin_p14*y)),s.x=S,s.y=x,s))}var Se=["ortho"],Ve={init:Jt,forward:Ur,inverse:le,names:Se},Re={FRONT:1,RIGHT:2,BACK:3,LEFT:4,TOP:5,BOTTOM:6},Ce={AREA_0:1,AREA_1:2,AREA_2:3,AREA_3:4};function ln(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Quadrilateralized Spherical Cube",this.lat0>=a-_/2?this.face=Re.TOP:this.lat0<=-(a-_/2)?this.face=Re.BOTTOM:Math.abs(this.long0)<=_?this.face=Re.FRONT:Math.abs(this.long0)<=a+_?this.face=this.long0>0?Re.RIGHT:Re.LEFT:this.face=Re.BACK,this.es!==0&&(this.one_minus_f=1-(this.a-this.b)/this.a,this.one_minus_f_squared=this.one_minus_f*this.one_minus_f)}function un(s){var u={x:0,y:0},c,y,g,v,S,x,P={value:0};if(s.x-=this.long0,this.es!==0?c=Math.atan(this.one_minus_f_squared*Math.tan(s.y)):c=s.y,y=s.x,this.face===Re.TOP)v=a-c,y>=_&&y<=a+_?(P.value=Ce.AREA_0,g=y-a):y>a+_||y<=-(a+_)?(P.value=Ce.AREA_1,g=y>0?y-R:y+R):y>-(a+_)&&y<=-_?(P.value=Ce.AREA_2,g=y+a):(P.value=Ce.AREA_3,g=y);else if(this.face===Re.BOTTOM)v=a+c,y>=_&&y<=a+_?(P.value=Ce.AREA_0,g=-y+a):y<_&&y>=-_?(P.value=Ce.AREA_1,g=-y):y<-_&&y>=-(a+_)?(P.value=Ce.AREA_2,g=-y-a):(P.value=Ce.AREA_3,g=y>0?-y+R:-y-R);else{var L,U,z,q,Y,K,X;this.face===Re.RIGHT?y=ai(y,+a):this.face===Re.BACK?y=ai(y,+R):this.face===Re.LEFT&&(y=ai(y,-a)),q=Math.sin(c),Y=Math.cos(c),K=Math.sin(y),X=Math.cos(y),L=Y*X,U=Y*K,z=q,this.face===Re.FRONT?(v=Math.acos(L),g=rs(v,z,U,P)):this.face===Re.RIGHT?(v=Math.acos(U),g=rs(v,z,-L,P)):this.face===Re.BACK?(v=Math.acos(-L),g=rs(v,z,-U,P)):this.face===Re.LEFT?(v=Math.acos(-U),g=rs(v,z,L,P)):(v=g=0,P.value=Ce.AREA_0)}return x=Math.atan(12/R*(g+Math.acos(Math.sin(g)*Math.cos(_))-a)),S=Math.sqrt((1-Math.cos(v))/(Math.cos(x)*Math.cos(x))/(1-Math.cos(Math.atan(1/Math.cos(g))))),P.value===Ce.AREA_1?x+=a:P.value===Ce.AREA_2?x+=R:P.value===Ce.AREA_3&&(x+=1.5*R),u.x=S*Math.cos(x),u.y=S*Math.sin(x),u.x=u.x*this.a+this.x0,u.y=u.y*this.a+this.y0,s.x=u.x,s.y=u.y,s}function ao(s){var u={lam:0,phi:0},c,y,g,v,S,x,P,L,U,z={value:0};if(s.x=(s.x-this.x0)/this.a,s.y=(s.y-this.y0)/this.a,y=Math.atan(Math.sqrt(s.x*s.x+s.y*s.y)),c=Math.atan2(s.y,s.x),s.x>=0&&s.x>=Math.abs(s.y)?z.value=Ce.AREA_0:s.y>=0&&s.y>=Math.abs(s.x)?(z.value=Ce.AREA_1,c-=a):s.x<0&&-s.x>=Math.abs(s.y)?(z.value=Ce.AREA_2,c=c<0?c+R:c-R):(z.value=Ce.AREA_3,c+=a),U=R/12*Math.tan(c),S=Math.sin(U)/(Math.cos(U)-1/Math.sqrt(2)),x=Math.atan(S),g=Math.cos(c),v=Math.tan(y),P=1-g*g*v*v*(1-Math.cos(Math.atan(1/Math.cos(x)))),P<-1?P=-1:P>1&&(P=1),this.face===Re.TOP)L=Math.acos(P),u.phi=a-L,z.value===Ce.AREA_0?u.lam=x+a:z.value===Ce.AREA_1?u.lam=x<0?x+R:x-R:z.value===Ce.AREA_2?u.lam=x-a:u.lam=x;else if(this.face===Re.BOTTOM)L=Math.acos(P),u.phi=L-a,z.value===Ce.AREA_0?u.lam=-x+a:z.value===Ce.AREA_1?u.lam=-x:z.value===Ce.AREA_2?u.lam=-x-a:u.lam=x<0?-x-R:-x+R;else{var q,Y,K;q=P,U=q*q,U>=1?K=0:K=Math.sqrt(1-U)*Math.sin(x),U+=K*K,U>=1?Y=0:Y=Math.sqrt(1-U),z.value===Ce.AREA_1?(U=Y,Y=-K,K=U):z.value===Ce.AREA_2?(Y=-Y,K=-K):z.value===Ce.AREA_3&&(U=Y,Y=K,K=-U),this.face===Re.RIGHT?(U=q,q=-Y,Y=U):this.face===Re.BACK?(q=-q,Y=-Y):this.face===Re.LEFT&&(U=q,q=Y,Y=-U),u.phi=Math.acos(-K)-a,u.lam=Math.atan2(Y,q),this.face===Re.RIGHT?u.lam=ai(u.lam,-a):this.face===Re.BACK?u.lam=ai(u.lam,-R):this.face===Re.LEFT&&(u.lam=ai(u.lam,+a))}if(this.es!==0){var X,J,ce;X=u.phi<0?1:0,J=Math.tan(u.phi),ce=this.b/Math.sqrt(J*J+this.one_minus_f_squared),u.phi=Math.atan(Math.sqrt(this.a*this.a-ce*ce)/(this.one_minus_f*ce)),X&&(u.phi=-u.phi)}return u.lam+=this.long0,s.x=u.lam,s.y=u.phi,s}function rs(s,u,c,y){var g;return s<p?(y.value=Ce.AREA_0,g=0):(g=Math.atan2(u,c),Math.abs(g)<=_?y.value=Ce.AREA_0:g>_&&g<=a+_?(y.value=Ce.AREA_1,g-=a):g>a+_||g<=-(a+_)?(y.value=Ce.AREA_2,g=g>=0?g-R:g+R):(y.value=Ce.AREA_3,g+=a)),g}function ai(s,u){var c=s+u;return c<-R?c+=C:c>+R&&(c-=C),c}var xw=["Quadrilateralized Spherical Cube","Quadrilateralized_Spherical_Cube","qsc"],Ew={init:ln,forward:un,inverse:ao,names:xw},bf=[[1,22199e-21,-715515e-10,31103e-10],[.9986,-482243e-9,-24897e-9,-13309e-10],[.9954,-83103e-8,-448605e-10,-986701e-12],[.99,-.00135364,-59661e-9,36777e-10],[.9822,-.00167442,-449547e-11,-572411e-11],[.973,-.00214868,-903571e-10,18736e-12],[.96,-.00305085,-900761e-10,164917e-11],[.9427,-.00382792,-653386e-10,-26154e-10],[.9216,-.00467746,-10457e-8,481243e-11],[.8962,-.00536223,-323831e-10,-543432e-11],[.8679,-.00609363,-113898e-9,332484e-11],[.835,-.00698325,-640253e-10,934959e-12],[.7986,-.00755338,-500009e-10,935324e-12],[.7597,-.00798324,-35971e-9,-227626e-11],[.7186,-.00851367,-701149e-10,-86303e-10],[.6732,-.00986209,-199569e-9,191974e-10],[.6213,-.010418,883923e-10,624051e-11],[.5722,-.00906601,182e-6,624051e-11],[.5322,-.00677797,275608e-9,624051e-11]],ka=[[-520417e-23,.0124,121431e-23,-845284e-16],[.062,.0124,-126793e-14,422642e-15],[.124,.0124,507171e-14,-160604e-14],[.186,.0123999,-190189e-13,600152e-14],[.248,.0124002,710039e-13,-224e-10],[.31,.0123992,-264997e-12,835986e-13],[.372,.0124029,988983e-12,-311994e-12],[.434,.0123893,-369093e-11,-435621e-12],[.4958,.0123198,-102252e-10,-345523e-12],[.5571,.0121916,-154081e-10,-582288e-12],[.6176,.0119938,-241424e-10,-525327e-12],[.6769,.011713,-320223e-10,-516405e-12],[.7346,.0113541,-397684e-10,-609052e-12],[.7903,.0109107,-489042e-10,-104739e-11],[.8435,.0103431,-64615e-9,-140374e-14],[.8936,.00969686,-64636e-9,-8547e-9],[.9394,.00840947,-192841e-9,-42106e-10],[.9761,.00616527,-256e-6,-42106e-10],[1,.00328947,-319159e-9,-42106e-10]],ip=.8487,np=1.3523,sp=E/5,Mw=1/sp,lo=18,xu=function(s,u){return s[0]+u*(s[1]+u*(s[2]+u*s[3]))},Rw=function(s,u){return s[1]+u*(2*s[2]+u*3*s[3])};function Cw(s,u,c,y){for(var g=u;y;--y){var v=s(g);if(g-=v,Math.abs(v)<c)break}return g}function Tw(){this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.es=0,this.title=this.title||"Robinson"}function Aw(s){var u=Q(s.x-this.long0),c=Math.abs(s.y),y=Math.floor(c*sp);y<0?y=0:y>=lo&&(y=lo-1),c=E*(c-Mw*y);var g={x:xu(bf[y],c)*u,y:xu(ka[y],c)};return s.y<0&&(g.y=-g.y),g.x=g.x*this.a*ip+this.x0,g.y=g.y*this.a*np+this.y0,g}function Iw(s){var u={x:(s.x-this.x0)/(this.a*ip),y:Math.abs(s.y-this.y0)/(this.a*np)};if(u.y>=1)u.x/=bf[lo][0],u.y=s.y<0?-a:a;else{var c=Math.floor(u.y*lo);for(c<0?c=0:c>=lo&&(c=lo-1);;)if(ka[c][0]>u.y)--c;else if(ka[c+1][0]<=u.y)++c;else break;var y=ka[c],g=5*(u.y-y[0])/(ka[c+1][0]-y[0]);g=Cw(function(v){return(xu(y,v)-u.y)/Rw(y,v)},g,p,100),u.x/=xu(bf[c],g),u.y=(5*c+g)*w,s.y<0&&(u.y=-u.y)}return u.x=Q(u.x+this.long0),u}var Pw=["Robinson","robin"],Ow={init:Tw,forward:Aw,inverse:Iw,names:Pw};function kw(){this.name="geocent"}function Nw(s){var u=Ci(s,this.es,this.a);return u}function Lw(s){var u=Jr(s,this.es,this.a,this.b);return u}var Dw=["Geocentric","geocentric","geocent","Geocent"],Bw={init:kw,forward:Nw,inverse:Lw,names:Dw},It={N_POLE:0,S_POLE:1,EQUIT:2,OBLIQ:3},Na={h:{def:1e5,num:!0},azi:{def:0,num:!0,degrees:!0},tilt:{def:0,num:!0,degrees:!0},long0:{def:0,num:!0},lat0:{def:0,num:!0}};function zw(){if(Object.keys(Na).forEach(function(c){if(typeof this[c]>"u")this[c]=Na[c].def;else{if(Na[c].num&&isNaN(this[c]))throw new Error("Invalid parameter value, must be numeric "+c+" = "+this[c]);Na[c].num&&(this[c]=parseFloat(this[c]))}Na[c].degrees&&(this[c]=this[c]*w)}.bind(this)),Math.abs(Math.abs(this.lat0)-a)<p?this.mode=this.lat0<0?It.S_POLE:It.N_POLE:Math.abs(this.lat0)<p?this.mode=It.EQUIT:(this.mode=It.OBLIQ,this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0)),this.pn1=this.h/this.a,this.pn1<=0||this.pn1>1e10)throw new Error("Invalid height");this.p=1+this.pn1,this.rp=1/this.p,this.h1=1/this.pn1,this.pfact=(this.p+1)*this.h1,this.es=0;var s=this.tilt,u=this.azi;this.cg=Math.cos(u),this.sg=Math.sin(u),this.cw=Math.cos(s),this.sw=Math.sin(s)}function Fw(s){s.x-=this.long0;var u=Math.sin(s.y),c=Math.cos(s.y),y=Math.cos(s.x),g,v;switch(this.mode){case It.OBLIQ:v=this.sinph0*u+this.cosph0*c*y;break;case It.EQUIT:v=c*y;break;case It.S_POLE:v=-u;break;case It.N_POLE:v=u;break}switch(v=this.pn1/(this.p-v),g=v*c*Math.sin(s.x),this.mode){case It.OBLIQ:v*=this.cosph0*u-this.sinph0*c*y;break;case It.EQUIT:v*=u;break;case It.N_POLE:v*=-(c*y);break;case It.S_POLE:v*=c*y;break}var S,x;return S=v*this.cg+g*this.sg,x=1/(S*this.sw*this.h1+this.cw),g=(g*this.cg-v*this.sg)*this.cw*x,v=S*x,s.x=g*this.a,s.y=v*this.a,s}function Uw(s){s.x/=this.a,s.y/=this.a;var u={x:s.x,y:s.y},c,y,g;g=1/(this.pn1-s.y*this.sw),c=this.pn1*s.x*g,y=this.pn1*s.y*this.cw*g,s.x=c*this.cg+y*this.sg,s.y=y*this.cg-c*this.sg;var v=rn(s.x,s.y);if(Math.abs(v)<p)u.x=0,u.y=s.y;else{var S,x;switch(x=1-v*v*this.pfact,x=(this.p-Math.sqrt(x))/(this.pn1/v+v/this.pn1),S=Math.sqrt(1-x*x),this.mode){case It.OBLIQ:u.y=Math.asin(S*this.sinph0+s.y*x*this.cosph0/v),s.y=(S-this.sinph0*Math.sin(u.y))*v,s.x*=x*this.cosph0;break;case It.EQUIT:u.y=Math.asin(s.y*x/v),s.y=S*v,s.x*=x;break;case It.N_POLE:u.y=Math.asin(S),s.y=-s.y;break;case It.S_POLE:u.y=-Math.asin(S);break}u.x=Math.atan2(s.x,s.y)}return s.x=u.x+this.long0,s.y=u.y,s}var jw=["Tilted_Perspective","tpers"],Ww={init:zw,forward:Fw,inverse:Uw,names:jw},$w=function(s){s.Proj.projections.add(Mc),s.Proj.projections.add(nn),s.Proj.projections.add(kc),s.Proj.projections.add(Dc),s.Proj.projections.add(Fc),s.Proj.projections.add(Ca),s.Proj.projections.add(jc),s.Proj.projections.add(Aa),s.Proj.projections.add(Ia),s.Proj.projections.add(ti),s.Proj.projections.add(au),s.Proj.projections.add(ni),s.Proj.projections.add(Ni),s.Proj.projections.add(mu),s.Proj.projections.add(af),s.Proj.projections.add(ro),s.Proj.projections.add(hf),s.Proj.projections.add(_u),s.Proj.projections.add(oo),s.Proj.projections.add(O),s.Proj.projections.add(ge),s.Proj.projections.add(cr),s.Proj.projections.add(At),s.Proj.projections.add(Ve),s.Proj.projections.add(Ew),s.Proj.projections.add(Ow),s.Proj.projections.add(Bw),s.Proj.projections.add(Ww)};return Xt.defaultDatum="WGS84",Xt.Proj=vt,Xt.WGS84=new Xt.Proj("WGS84"),Xt.Point=xr,Xt.toPoint=qn,Xt.defs=yt,Xt.transform=Xi,Xt.mgrs=Bl,Xt.version="2.6.3",$w(Xt),Xt})});var Av=ee((IO,Tv)=>{"use strict";Tv.exports=TC;var CC={threshold:.1,includeAA:!1,alpha:.1,aaColor:[255,255,0],diffColor:[255,0,0],diffColorAlt:null,diffMask:!1};function TC(t,e,r,i,n,o){if(!Cm(t)||!Cm(e)||r&&!Cm(r))throw new Error("Image data: Uint8Array, Uint8ClampedArray or Buffer expected.");if(t.length!==e.length||r&&r.length!==t.length)throw new Error("Image sizes do not match.");if(t.length!==i*n*4)throw new Error("Image data size does not match width/height.");o=Object.assign({},CC,o);let a=i*n,h=new Uint32Array(t.buffer,t.byteOffset,a),d=new Uint32Array(e.buffer,e.byteOffset,a),m=!0;for(let E=0;E<a;E++)if(h[E]!==d[E]){m=!1;break}if(m){if(r&&!o.diffMask)for(let E=0;E<a;E++)Rv(t,4*E,o.alpha,r);return 0}let p=35215*o.threshold*o.threshold,w=0;for(let E=0;E<n;E++)for(let _=0;_<i;_++){let C=(E*i+_)*4,R=Cv(t,e,C,C);Math.abs(R)>p?!o.includeAA&&(xv(t,_,E,i,n,e)||xv(e,_,E,i,n,t))?r&&!o.diffMask&&Am(r,C,...o.aaColor):(r&&Am(r,C,...R<0&&o.diffColorAlt||o.diffColor),w++):r&&(o.diffMask||Rv(t,C,o.alpha,r))}return w}function Cm(t){return ArrayBuffer.isView(t)&&t.constructor.BYTES_PER_ELEMENT===1}function xv(t,e,r,i,n,o){let a=Math.max(e-1,0),h=Math.max(r-1,0),d=Math.min(e+1,i-1),m=Math.min(r+1,n-1),p=(r*i+e)*4,w=e===a||e===d||r===h||r===m?1:0,E=0,_=0,C,R,I,A;for(let k=a;k<=d;k++)for(let D=h;D<=m;D++){if(k===e&&D===r)continue;let j=Cv(t,t,p,(D*i+k)*4,!0);if(j===0){if(w++,w>2)return!1}else j<E?(E=j,C=k,R=D):j>_&&(_=j,I=k,A=D)}return E===0||_===0?!1:Uh(t,C,R,i,n)&&Uh(o,C,R,i,n)||Uh(t,I,A,i,n)&&Uh(o,I,A,i,n)}function Uh(t,e,r,i,n){let o=Math.max(e-1,0),a=Math.max(r-1,0),h=Math.min(e+1,i-1),d=Math.min(r+1,n-1),m=(r*i+e)*4,p=e===o||e===h||r===a||r===d?1:0;for(let w=o;w<=h;w++)for(let E=a;E<=d;E++){if(w===e&&E===r)continue;let _=(E*i+w)*4;if(t[m]===t[_]&&t[m+1]===t[_+1]&&t[m+2]===t[_+2]&&t[m+3]===t[_+3]&&p++,p>2)return!0}return!1}function Cv(t,e,r,i,n){let o=t[r+0],a=t[r+1],h=t[r+2],d=t[r+3],m=e[i+0],p=e[i+1],w=e[i+2],E=e[i+3];if(d===E&&o===m&&a===p&&h===w)return 0;d<255&&(d/=255,o=Ts(o,d),a=Ts(a,d),h=Ts(h,d)),E<255&&(E/=255,m=Ts(m,E),p=Ts(p,E),w=Ts(w,E));let _=Tm(o,a,h),C=Tm(m,p,w),R=_-C;if(n)return R;let I=Ev(o,a,h)-Ev(m,p,w),A=Mv(o,a,h)-Mv(m,p,w),k=.5053*R*R+.299*I*I+.1957*A*A;return _>C?-k:k}function Tm(t,e,r){return t*.29889531+e*.58662247+r*.11448223}function Ev(t,e,r){return t*.59597799-e*.2741761-r*.32180189}function Mv(t,e,r){return t*.21147017-e*.52261711+r*.31114694}function Ts(t,e){return 255+(t-255)*e}function Am(t,e,r,i,n){t[e+0]=r,t[e+1]=i,t[e+2]=n,t[e+3]=255}function Rv(t,e,r,i){let n=t[e+0],o=t[e+1],a=t[e+2],h=Ts(Tm(n,o,a),r*t[e+3]/255);Am(i,e,h,h,h)}});var Om=ee(Pm=>{Pm.read=function(t,e,r,i,n){var o,a,h=n*8-i-1,d=(1<<h)-1,m=d>>1,p=-7,w=r?n-1:0,E=r?-1:1,_=t[e+w];for(w+=E,o=_&(1<<-p)-1,_>>=-p,p+=h;p>0;o=o*256+t[e+w],w+=E,p-=8);for(a=o&(1<<-p)-1,o>>=-p,p+=i;p>0;a=a*256+t[e+w],w+=E,p-=8);if(o===0)o=1-m;else{if(o===d)return a?NaN:(_?-1:1)*(1/0);a=a+Math.pow(2,i),o=o-m}return(_?-1:1)*a*Math.pow(2,o-i)};Pm.write=function(t,e,r,i,n,o){var a,h,d,m=o*8-n-1,p=(1<<m)-1,w=p>>1,E=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,_=i?0:o-1,C=i?1:-1,R=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(h=isNaN(e)?1:0,a=p):(a=Math.floor(Math.log(e)/Math.LN2),e*(d=Math.pow(2,-a))<1&&(a--,d*=2),a+w>=1?e+=E/d:e+=E*Math.pow(2,1-w),e*d>=2&&(a++,d/=2),a+w>=p?(h=0,a=p):a+w>=1?(h=(e*d-1)*Math.pow(2,n),a=a+w):(h=e*Math.pow(2,w-1)*Math.pow(2,n),a=0));n>=8;t[r+_]=h&255,_+=C,h/=256,n-=8);for(a=a<<n|h,m+=n;m>0;t[r+_]=a&255,_+=C,a/=256,m-=8);t[r+_-C]|=R*128}});var g3={};op(g3,{handleRequest:()=>Sw,handler:()=>Cl});module.exports=Xw(g3);var bg=ve(yd(),1);var cn="application/json",me;(function(t){t.CacheControl="Cache-Control",t.ContentEncoding="Content-Encoding",t.ContentType="Content-Type",t.Cors="Access-Control-Allow-Origin",t.ETag="ETag",t.IfNoneMatch="If-None-Match",t.Server="Server",t.ServerTiming="Server-Timing"})(me||(me={}));var fo;(function(t){t.CloudfrontId="X-Amz-Cf-Id",t.TraceId="X-Amzn-Trace-Id"})(fo||(fo={}));var Wr;(function(t){t.CorrelationId="X-LINZ-Correlation-Id",t.RequestId="X-LINZ-Request-Id"})(Wr||(Wr={}));var us=class{constructor(){if(this.timers=new Map,typeof process<"u"&&typeof process.hrtime.bigint=="function"){let e=BigInt(1e6);this.getTime=()=>Number(process.hrtime.bigint()/e)}else typeof typeof performance<"u"?this.getTime=()=>performance.now():this.getTime=()=>Date.now()}start(e){let r=this.timers.get(e);if(r!=null&&r.duration==null)throw new Error(`Duplicate startTime for "${e}"`);this.timers.set(e,{start:this.getTime()})}end(e){let r=this.timers.get(e);if(r==null)throw new Error(`Missing startTime information for "${e}"`);let i=this.getTime()-r.start;return r.duration=i,i}get metrics(){if(this.timers.size===0)return;let e={};for(let[r,i]of this.timers.entries())i.duration!=null&&(e[r]=i.duration);return e}get unfinished(){let e=[];for(let[r,i]of this.timers.entries())i.duration==null&&e.push(r);if(e.length!==0)return e}};var fg=ve(hs(),1);function Ft(t){return!(typeof t!="object"||t==null)}var cs=class{constructor(e,r,i){this.logContext={},this.timer=new us,this.headers=new Map,this.context=r,this.event=e,this.id=(0,fg.ulid)(),this.log=i,this.timer=new us,this.log=i.child({id:this.id,aws:{lambdaId:r.awsRequestId}})}set(e,r){r==null&&(r=void 0),this.logContext[e]=r}toResponse(e){return e?.body}};var mg=require("url");var dg=ve(hs(),1);var $r=class extends cs{constructor(e,r,i){var n;super(e,r,i),this.headers=new Map,this.correlationId=(n=this.header(Wr.CorrelationId))!==null&&n!==void 0?n:dg.ulid(),this.set("correlationId",this.correlationId)}header(e){return this._isHeadersLoaded!==!0&&(this.loadHeaders(),this._isHeadersLoaded=!0),this.headers.get(e.toLowerCase())}json(){var e;if(this.header(me.ContentType)!==cn)throw new Error(`Invalid Content-Type: "${this.header("content-type")}"`);if(this.body==null)throw new Error("Cannot parse empty body as JSON");try{return this.isBase64Encoded?JSON.parse(Buffer.from((e=this.body)!==null&&e!==void 0?e:"","base64").toString()):JSON.parse(this.body)}catch{throw new Error("Body is not a JSON object")}}get query(){return this._query==null&&(this._query=this.loadQueryString()),this._query}};var mo=class extends $r{static is(e){return Ft(e)&&Ft(e.requestContext)&&Ft(e.requestContext.elb)}toResponse(e){return{statusCode:e.status,statusDescription:e.statusDescription,body:e.body,headers:this.toHeaders(e.headers),isBase64Encoded:e.isBase64Encoded}}toHeaders(e){if(e.size===0)return;let r={};for(let i of e)r[i[0]]=i[1];return r}loadHeaders(){if(this.event.headers!=null)for(let[e,r]of Object.entries(this.event.headers))r!=null&&this.headers.set(e.toLowerCase(),r)}loadQueryString(){let e=new mg.URLSearchParams;if(this.event.queryStringParameters==null)return e;for(let[r,i]of Object.entries(this.event.queryStringParameters))e.append(r.toLowerCase(),i??"true");return e}get method(){return this.event.httpMethod.toUpperCase()}get path(){return this.event.path}get body(){return this.event.body}get isBase64Encoded(){return this.event.isBase64Encoded}};var pg=require("url");var hi=class extends $r{static is(e){return!(!Ft(e)||!Ft(e.requestContext)||typeof e.requestContext.apiId!="string"||typeof e.requestContext.resourceId!="string"||typeof e.requestContext.httpMethod!="string")}toResponse(e){return{statusCode:e.status,body:e.body,headers:hi.toHeaders(e),isBase64Encoded:e.isBase64Encoded}}static toHeaders(e){if(e.headers.size===0)return;let r={};for(let i of e.headers)r[i[0]]=i[1];return r}loadHeaders(){if(this.event.headers!=null)for(let[e,r]of Object.entries(this.event.headers))r!=null&&this.headers.set(e.toLowerCase(),r)}loadQueryString(){let e=new pg.URLSearchParams;if(this.event.multiValueQueryStringParameters==null)return e;for(let[r,i]of Object.entries(this.event.multiValueQueryStringParameters))if(i!=null)for(let n of i)e.append(r.toLowerCase(),n);return e}get path(){return this.event.path}get method(){return this.event.httpMethod.toUpperCase()}get body(){return this.event.body}get isBase64Encoded(){return this.event.isBase64Encoded}};var bd=require("url");var po=class extends $r{static is(e){if(!Ft(e)||!Array.isArray(e.Records))return!1;let r=e.Records[0];return Ft(r)?Ft(r.cf):!1}toResponse(e){if(e.status===100&&this.event!=null){let r=this.event.Records[0].cf.request;for(let[i,n]of e.headers)r.headers[i.toLowerCase()]=[{key:i,value:String(n)}];return this.event.Records[0].cf.request}return{status:String(e.status),statusDescription:e.statusDescription,body:e.body,headers:this.toHeaders(e),bodyEncoding:"text"}}toHeaders(e){if(e.headers.size===0)return{};let r={};for(let i of e.headers)r[i[0]]=[{key:i[0],value:String(i[1])}];return r}loadHeaders(){var e;for(let[r,i]of Object.entries(this.event.Records[0].cf.request.headers))this.headers.set(r.toLowerCase(),(e=i[0])===null||e===void 0?void 0:e.value)}loadQueryString(){let e=this.event.Records[0].cf.request.querystring;return e==null?new bd.URLSearchParams:new bd.URLSearchParams(e.toLowerCase())}get path(){return this.event.Records[0].cf.request.uri}get method(){return this.event.Records[0].cf.request.method.toUpperCase()}get body(){let e=this.event.Records[0].cf.request.body;return e==null?null:e.data}get isBase64Encoded(){var e;return((e=this.event.Records[0].cf.request.body)===null||e===void 0?void 0:e.encoding)==="base64"}};var te=class{constructor(e,r,i){if(this._body=null,this.headers=new Map,this.status=e,this.statusDescription=r,i!=null)for(let n of Object.keys(i))this.header(n,i[n])}static is(e){return e instanceof te}static ok(e=200,r="Ok"){return new te(e,r)}header(e,r){let i=e.toLowerCase();if(r==null)return this.headers.get(i);this.headers.set(i,r)}get isBase64Encoded(){return Buffer.isBuffer(this._body)}json(e){return this.buffer(JSON.stringify(e),cn),this}buffer(e,r=cn){return this.header(me.ContentType,r),this._body=e,this}get body(){return this._body==null?(this.header(me.ContentType,cn),JSON.stringify({id:this.header(Wr.RequestId),status:this.status,message:this.statusDescription,correlationId:this.header(Wr.CorrelationId)})):Buffer.isBuffer(this._body)?this._body.toString("base64"):this._body}};var Fu=class{constructor(){this.routes=[],this.hooks={request:[],response:[]}}register(e,r,i){let n=RegExp(`^${r.replace(/(\/?)\*/g,"($1.*)?").replace(/\/$/,"").replace(/:(\w+)(\?)?(\.)?/g,"$2(?<$1>[^/]+)$2$3").replace(/\.(?=[\w(])/,"\\.").replace(/\)\.\?\(([^\[]+)\[\^/g,"?)\\.?($1(?<=\\.)[^\\.")}/*$`);this.routes.push({path:n,method:e,fn:i})}hook(e,r){this.hooks[e].push(r)}all(e,r){return this.register("ALL",e,r)}get(e,r){return this.register("GET",e,r)}post(e,r){return this.register("POST",e,r)}delete(e,r){return this.register("DELETE",e,r)}options(e,r){return this.register("OPTIONS",e,r)}patch(e,r){return this.register("PATCH",e,r)}head(e,r){return this.register("HEAD",e,r)}put(e,r){return this.register("PUT",e,r)}async after(e,r){try{for(let i of this.hooks.response)await i(e,r)}catch(i){return te.is(i)?i:(e.set("err",i),new te(500,"Internal Server Error"))}return r}async handle(e){for(let r of this.hooks.request){let i=await vd(e,r);if(i)return this.after(e,i)}for(let r of this.routes){if(r.method!=="ALL"&&e.method!==r.method)continue;let i=e.path.match(r.path);if(i){e.params=i.groups;let n=await wd(e,r.fn);if(n)return this.after(e,n)}}return this.after(e,new te(404,"Not found"))}};var gg=require("url");var go=class extends $r{toResponse(e){return{statusCode:e.status,body:e.body,headers:hi.toHeaders(e),isBase64Encoded:e.isBase64Encoded}}loadHeaders(){for(let[e,r]of Object.entries(this.event.headers))this.headers.set(e.toLowerCase(),r)}loadQueryString(){return new gg.URLSearchParams(this.event.rawQueryString)}get method(){return this.event.requestContext.http.method.toUpperCase()}get path(){return this.event.rawPath}get isBase64Encoded(){return this.event.isBase64Encoded}get body(){return null}static is(e){return!(!Ft(e)||!Ft(e.requestContext)||!Ft(e.requestContext.http))}};var vg="v6.29.0",e2="9097d2f045d734d0d5acd968f026fe29ab6afcda",yg={version:vg,hash:e2};async function vd(t,e){try{return await e(t)}catch(r){return te.is(r)?r:(t.set("err",r),new te(500,"Internal Server Error"))}}async function wd(t,e){t.timer.start("lambda");let r=await vd(t,e),i=200;te.is(r)&&(i=r.status,t.set("description",r.statusDescription)),t.set("status",i),t.set("metrics",t.timer.metrics),yg.hash&&t.set("package",yg);let n=t.timer.end("lambda");return t.set("unfinished",t.timer.unfinished),t.set("duration",n),t.set("@type","report"),i>499?t.log.error(t.logContext,"Lambda:Done"):i>399?t.log.warn(t.logContext,"Lambda:Done"):t.log.info(t.logContext,"Lambda:Done"),r}function t2(t){let e={rejectOnError:!0,tracePercent:0,...t};if(isNaN(e.tracePercent)||e.tracePercent>1)throw new Error("tracePercent is not between 0-1 :"+e.tracePercent);return e}var mr=class{static request(e,r,i){if(mo.is(e))return new mo(e,r,i);if(go.is(e))return new go(e,r,i);if(hi.is(e))return new hi(e,r,i);if(po.is(e))return new po(e,r,i);throw new Error("Request is not a a ALB, ApiGateway or Cloudfront event")}static handler(e,r,i){let n=t2(r);function o(a,h,d){let m=new cs(a,h,i??mr.Logger);n.tracePercent>0&&Math.random()<n.tracePercent&&(m.log.level="trace"),process.env.TRACE_LAMBDA&&(m.log.level="trace"),m.log.trace({event:a},"Lambda:Start");let p=h.awsRequestId;m.set("aws",{lambdaId:p}),wd(m,e).then(w=>{if(n.rejectOnError&&te.is(w)){if(m.logContext.err)return d(m.logContext.err);if(w.status>399)return d(m.toResponse(w))}return d(null,m.toResponse(w))})}return o}static http(e){let r=new Fu;function i(n,o,a){let h=mr.request(n,o,e??mr.Logger),d=h.header(fo.CloudfrontId),m=h.header(fo.TraceId),p=o.awsRequestId;h.set("aws",{cloudFrontId:d,traceId:m,lambdaId:p}),h.set("method",h.method),h.set("path",h.path),r.handle(h).then(w=>{var E;w.status===500&&w.header(me.CacheControl,"no-store"),w.header(Wr.RequestId,h.id),w.header(Wr.CorrelationId,h.correlationId);let _=(E=h.timer.metrics)===null||E===void 0?void 0:E.lambda;_!=null&&w.header(me.ServerTiming,`total;dur=${_}`),!w.isBase64Encoded&&w.header(me.ContentType)==null&&w.header(me.ContentType,cn),mr.ServerName&&w.header(me.Server,`${mr.ServerName}-${vg}`),a(null,h.toResponse(w))})}return i.router=r,i}};mr.Logger=(0,bg.default)();mr.ServerName="linz";var pr;(function(t){t.Imagery="im",t.TileSet="ts",t.Provider="pv",t.ImageryRule="ir",t.Style="st",t.ProcessingJob="pj",t.ConfigBundle="cb"})(pr||(pr={}));var wg=new Set(Object.values(pr));var dt;(function(t){t.Raster="raster",t.Vector="vector"})(dt||(dt={}));var Uu=class{get TileSet(){return this.cfg.TileSet}get Imagery(){return this.cfg.Imagery}get Style(){return this.cfg.Style}get Provider(){return this.cfg.Provider}get ProcessingJob(){return this.cfg.ProcessingJob}setConfigProvider(e){this.cfg=e}isTileSetRaster(e){return e==null?!1:e.type==null||e.type===dt.Raster}isTileSetVector(e){return e==null?!1:e.type===dt.Vector}async getAllImagery(e,r){let i=new Set;for(let n of e){let o=n[r.code];o&&i.add(this.Imagery.id(o))}return this.Imagery.getAll(i)}prefix(e,r){return r===""||r.startsWith(e)?r:`${e}_${r}`}getPrefix(e){let r=e.indexOf("_");if(r===-1)return null;let i=e.slice(0,r);return wg.has(i)?i:null}unprefix(e,r){return r.startsWith(e)?r.slice(3):r}},yo=class{},za=class{constructor(e){this.prefix=e}isWriteable(){return!1}id(e){return e.startsWith(`${this.prefix}_`)?e:`${this.prefix}_${e}`}is(e){return e!=null&&e.id.startsWith(this.prefix)}},nt=new Uu;var _d;(function(t){t.Processing="processing",t.Complete="complete",t.Fail="failed"})(_d||(_d={}));var _g=ve(require("aws-sdk/clients/dynamodb.js"),1);var bo=ve(require("aws-sdk/clients/dynamodb.js"),1);function r2(t){return{id:{S:t}}}var fn=class extends za{constructor(e,r){super(r),this.cfg=e}get db(){return this.cfg.dynamo}isWriteable(){return!0}clone(e){return bo.default.Converter.unmarshall(bo.default.Converter.marshall(e))}async get(e){let r=await this.db.getItem({Key:{id:{S:e}},TableName:this.cfg.tableName}).promise();if(r==null||r.Item==null)return null;let i=bo.default.Converter.unmarshall(r.Item);return this.is(i)?i:null}async getAll(e){var r;let i=Array.from(e,r2),n=new Map;for(;i.length>0;){let o=i.length>100?i.slice(0,100):i;i=i.length>100?i.slice(100):[];let a={[this.cfg.tableName]:{Keys:o}};for(;a!=null&&Object.keys(a).length>0;){let h=await this.db.batchGetItem({RequestItems:a}).promise(),d=(r=h.Responses)===null||r===void 0?void 0:r[this.cfg.tableName];if(d==null)throw new Error("Failed to fetch metadata from "+this.cfg.tableName);for(let m of d){let p=bo.default.Converter.unmarshall(m);this.is(p)&&n.set(p.id,p)}a=h.UnprocessedKeys}}return n}async put(e){return e.updatedAt=Date.now(),await this.db.putItem({TableName:this.cfg.tableName,Item:bo.default.Converter.marshall(e)}).promise(),e.id}};var vo=class extends fn{constructor(){super(...arguments),this.cache=new Map}async get(e){let r=this.cache.get(e);if(r==null){if(r=await super.get(e),r==null)return null;this.cache.set(e,r)}return r}async getAll(e){let r=new Map,i=new Set;for(let n of e){let o=this.cache.get(n);o==null?i.add(n):r.set(n,o)}if(i.size>0){let n=await super.getAll(i);for(let o of n.values())r.set(o.id,o),this.cache.set(o.id,o)}return r}};var Fa=class extends yo{constructor(e){super(),this.Prefix=pr,this.type="dynamo",this.Imagery=new vo(this,pr.Imagery),this.Style=new vo(this,pr.Style),this.TileSet=new fn(this,pr.TileSet),this.Provider=new vo(this,pr.Provider),this.ProcessingJob=new fn(this,pr.ProcessingJob),this.dynamo=new _g.default({region:"ap-southeast-2"}),this.tableName=e}record(){let e=Date.now();return{id:"",name:"",updatedAt:e}}};var Fe=class{constructor(e,r,i,n){this.x=e,this.y=r,this.width=i,this.height=n}get bottom(){return this.y+this.height}get right(){return this.x+this.width}intersects(e){return this.x<e.right&&e.x<this.right&&this.y<e.bottom&&e.y<this.bottom}containsBounds(e){return Fe.contains(this,e)}intersection(e){let r=Math.max(this.x,e.x),i=Math.min(this.x+this.width,e.x+e.width),n=Math.max(this.y,e.y),o=Math.min(this.y+this.height,e.y+e.height);return i>r&&o>n?new Fe(r,n,i-r,o-n):null}static union(e){if(e.length===0)throw new Error("Union on empty list is not allowed");let{x:r,y:i}=e[0],n=r+e[0].width,o=i+e[0].height;for(let a=1;a<e.length;++a){let h=e[a];r=Math.min(r,h.x),n=Math.max(n,h.x+h.width),i=Math.min(i,h.y),o=Math.max(o,h.y+h.height)}return new Fe(r,i,n-r,o-i)}union(e){return Fe.union([this,e])}toJson(){return{x:this.x,y:this.y,width:this.width,height:this.height}}toBbox(){return[this.x,this.y,this.right,this.bottom]}toPolygon(){return[[[this.x,this.y],[this.x,this.bottom],[this.right,this.bottom],[this.right,this.y],[this.x,this.y]]]}scale(e,r=e){return new Fe(this.x*e,this.y*r,this.width*e,this.height*r)}scaleFromCenter(e,r=e){let i=this.width*e,n=this.height*r;return new Fe(this.x-.5*(i-this.width),this.y-.5*(n-this.height),i,n)}pad(e,r=e){return new Fe(this.x-e,this.y-r,this.width+e*2,this.height+r*2)}round(e=0){let r=Math.round(this.x-e),i=Math.round(this.y-e);return new Fe(r,i,Math.round(this.right+e)-r,Math.round(this.bottom+e)-i)}add(e){return new Fe(this.x+e.x,this.y+e.y,this.width,this.height)}subtract(e){return new Fe(this.x-e.x,this.y-e.y,this.width,this.height)}static fromMultiPolygon(e){if(e.length===0)return new Fe(0,0,0,0);let r=e[0][0][0][0],i=e[0][0][0][1],n=r,o=i;for(let[a]of e)for(let[h,d]of a)h<r?r=h:h>n&&(n=h),d<i?i=d:d>o&&(o=d);return new Fe(r,i,n-r,o-i)}static fromBbox([e,r,i,n]){return new Fe(Math.min(e,i),Math.min(r,n),Math.abs(i-e),Math.abs(n-r))}static fromUpperLeftLowerRight(e,r){return new Fe(e.x,e.y,r.x-e.x,r.y-e.y)}static fromJson(e){return new Fe(e.x,e.y,e.width,e.height)}static compareArea(e,r){let i=e.width*e.height-r.width*r.height;if(i!==0)return i;let n=e.x-r.x;return n===0?e.y-r.y:n}static contains(e,r){return e.x<=r.x&&e.x+e.width>=r.x+r.width&&e.y<=r.y&&e.y+e.height>=r.y+r.height}};var Ye;(function(t){t[t.Google=3857]="Google",t[t.Wgs84=4326]="Wgs84",t[t.Nztm2000=2193]="Nztm2000",t[t.Citm2000=3793]="Citm2000"})(Ye||(Ye={}));var Sd={google:Ye.Google,epsg3857:Ye.Google,[Ye.Google]:Ye.Google,globalmercator:Ye.Google,wgs84:Ye.Wgs84,epsg4326:Ye.Wgs84,[Ye.Wgs84]:Ye.Wgs84,nztm:Ye.Nztm2000,epsg2193:Ye.Nztm2000,[Ye.Nztm2000]:Ye.Nztm2000,nztm2000:Ye.Nztm2000,citm:Ye.Citm2000,epsg3793:Ye.Citm2000,[Ye.Citm2000]:Ye.Citm2000,citm2000:Ye.Citm2000},Te=class{constructor(e){if(this.code=e,Te.Codes.has(e))throw new Error(`Duplicate EPSG code created: ${e}`);Te.Codes.set(this.code,this)}toString(){return this.code.toString()}toJSON(){return this.code}toEpsgString(){return`EPSG:${this.code}`}toUrn(){return`urn:ogc:def:crs:EPSG::${this.code}`}static get(e){let r=Te.Codes.get(e);if(r==null)throw new Error(`Invalid EPSG:${e}`);return r}static tryGet(e){if(e!=null)return Te.Codes.get(e)}static parseCode(e){var r;return e.startsWith("urn:")?Sd[e.slice(e.lastIndexOf(":")+1)]:e.startsWith("https://")?Sd[e.slice(e.lastIndexOf("/")+1)]:(r=Sd[e.replace(/[\W_]/g,"").toLowerCase()])!==null&&r!==void 0?r:null}static parse(e){let r=Te.parseCode(e);return r==null?null:Te.get(r)}};Te.Codes=new Map;Te.Google=new Te(Ye.Google);Te.Wgs84=new Te(Ye.Wgs84);Te.Nztm2000=new Te(Ye.Nztm2000);Te.Citm2000=new Te(Ye.Citm2000);var oA="0".charCodeAt(0),aA="1".charCodeAt(0),lA="2".charCodeAt(0),uA="3".charCodeAt(0);var wo;(function(t){t[t.Xy=0]="Xy",t[t.Yx=1]="Yx"})(wo||(wo={}));function Sg(t){return t===Te.Nztm2000?wo.Yx:wo.Xy}function i2(t,e){return e.scaleDenominator-t.scaleDenominator}var Ot=class{constructor(e){this.zooms=[],this.indexX=0,this.indexY=1,this.zoomConversionMap=new Map,this.def=e,this.tileSize=e.tileMatrix[0].tileHeight;let r=e.tileMatrix.slice().sort(i2),i={};for(let m of r){if(i[m.identifier])throw new Error(`Duplicate tileMatrix identifier ${m.identifier}`);if(m.tileHeight!==m.tileWidth)throw new Error("Only square tiles supported");if(m.tileHeight!==this.tileSize)throw new Error("All tiles must have the same tile size");i[m.identifier]=!0}this.zooms=r;let n=Te.parse(e.supportedCRS);if(n==null)throw new Error(`Unable to find supported projection ${e.supportedCRS}`);this.projection=n,Sg(this.projection)===wo.Yx&&(this.indexX=1,this.indexY=0);let{lowerCorner:o,upperCorner:a}=e.boundingBox,h=o[this.indexX],d=o[this.indexY];this.extent=new Fe(h,d,a[this.indexX]-h,a[this.indexY]-d)}get maxZoom(){return this.zooms.length-1}get identifier(){return this.def.identifier}pixelScale(e){let r=this.zooms[e];if(r==null)throw new Error(`Zoom not found :${e}`);return r.scaleDenominator*28e-5}tileToPixels(e,r){return{x:e*this.tileSize,y:r*this.tileSize}}pixelsToTile(e,r,i){let n=Math.floor(e/this.tileSize),o=Math.floor(r/this.tileSize);return{x:n,y:o,z:i}}sourceToPixels(e,r,i){let n=this.zooms[i],o=this.pixelScale(i),a=(e-n.topLeftCorner[this.indexX])/o,h=(n.topLeftCorner[this.indexY]-r)/o;return{x:a,y:h}}pixelsToSource(e,r,i){let n=this.zooms[i],o=this.pixelScale(i),a=n.topLeftCorner[this.indexX]+e*o,h=n.topLeftCorner[this.indexY]-r*o;return{x:a,y:h}}tileToSource(e){let r=this.tileToPixels(e.x,e.y);return this.pixelsToSource(r.x,r.y,e.z)}tileToSourceBounds(e){let r=this.tileToSource(e),i=this.pixelScale(e.z)*this.tileSize;return new Fe(r.x,r.y-i,i,i)}*topLevelTiles(){let{matrixWidth:r,matrixHeight:i}=this.zooms[0];for(let n=0;n<i;++n)for(let o=0;o<r;++o)yield{x:o,y:n,z:0};return null}*coverTile(e){if(e==null)return yield*this.topLevelTiles(),null;let r=e.z+1,{matrixWidth:i,matrixHeight:n}=this.zooms[e.z],{matrixWidth:o,matrixHeight:a}=this.zooms[r],h=o/i,d=a/n,m=Math.floor(e.x*h),p=Math.floor(e.y*d),w=Math.ceil((e.x+1)*h),E=Math.ceil((e.y+1)*d);for(let _=p;_<E;++_)for(let C=m;C<w;++C)yield{x:C,y:_,z:r};return null}static tileToName(e){return`${e.z}-${e.x}-${e.y}`}static nameToTile(e){let r=e.split("-");if(r.length===3){let i=Number(r[0]),n=Number(r[1]),o=Number(r[2]);if(!(isNaN(i)||isNaN(o)||isNaN(n)))return{x:n,y:o,z:i}}throw new Error(`Invalid tile name '${e}'`)}findBestZoom(e){let r=this.zoomConversionMap.get(e);return r==null&&(r=this.convertZoomLevel(e),this.zoomConversionMap.set(e,r)),r}convertZoomLevel(e){for(let r=0;r<this.zooms.length;r++){let i=this.zooms[r].scaleDenominator-e;if(i>1e-5)continue;if(r===0)return r;let n=this.zooms[r-1].scaleDenominator-e;return Math.abs(i)<n?r:r-1}return this.maxZoom}static convertZoomLevel(e,r,i,n=!0){return r.identifier===i.identifier||(e>=r.maxZoom&&(e=r.maxZoom),n&&e===0)?e:n&&e===r.maxZoom?i.maxZoom:i.findBestZoom(r.zooms[e].scaleDenominator)}};var Ua={Version:"1.0.0-beta.2",License:"CC BY 4.0",BaseMapsExtension:"https://basemaps.linz.govt.nz/json-schema/stac-basemaps-extension/1.0/schema.json"};var n2={type:"TileMatrixSetType",title:"Google Maps Compatible for the World",identifier:"WebMercatorQuad",boundingBox:{type:"BoundingBoxType",crs:"http://www.opengis.net/def/crs/EPSG/0/3857",lowerCorner:[-200375083427892e-7,-200375083427892e-7],upperCorner:[200375083427892e-7,200375083427892e-7]},supportedCRS:"https://www.opengis.net/def/crs/EPSG/0/3857",wellKnownScaleSet:"https://www.opengis.net/def/wkss/OGC/1.0/GoogleMapsCompatible",tileMatrix:[{type:"TileMatrixType",identifier:"0",scaleDenominator:559082264028717e-6,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:1,matrixHeight:1},{type:"TileMatrixType",identifier:"1",scaleDenominator:279541132014358e-6,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:2,matrixHeight:2},{type:"TileMatrixType",identifier:"2",scaleDenominator:139770566007179e-6,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:4,matrixHeight:4},{type:"TileMatrixType",identifier:"3",scaleDenominator:698852830035897e-7,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:8,matrixHeight:8},{type:"TileMatrixType",identifier:"4",scaleDenominator:349426415017948e-7,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:16,matrixHeight:16},{type:"TileMatrixType",identifier:"5",scaleDenominator:174713207508974e-7,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:32,matrixHeight:32},{type:"TileMatrixType",identifier:"6",scaleDenominator:873566037544871e-8,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:64,matrixHeight:64},{type:"TileMatrixType",identifier:"7",scaleDenominator:436783018772435e-8,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:128,matrixHeight:128},{type:"TileMatrixType",identifier:"8",scaleDenominator:218391509386217e-8,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:256,matrixHeight:256},{type:"TileMatrixType",identifier:"9",scaleDenominator:109195754693108e-8,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:512,matrixHeight:512},{type:"TileMatrixType",identifier:"10",scaleDenominator:545978.773465544,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:1024,matrixHeight:1024},{type:"TileMatrixType",identifier:"11",scaleDenominator:272989.386732772,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:2048,matrixHeight:2048},{type:"TileMatrixType",identifier:"12",scaleDenominator:136494.693366386,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:4096,matrixHeight:4096},{type:"TileMatrixType",identifier:"13",scaleDenominator:68247.346683193,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:8192,matrixHeight:8192},{type:"TileMatrixType",identifier:"14",scaleDenominator:34123.6733415964,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:16384,matrixHeight:16384},{type:"TileMatrixType",identifier:"15",scaleDenominator:17061.8366707982,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:32768,matrixHeight:32768},{type:"TileMatrixType",identifier:"16",scaleDenominator:8530.91833539913,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:65536,matrixHeight:65536},{type:"TileMatrixType",identifier:"17",scaleDenominator:4265.45916769956,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:131072,matrixHeight:131072},{type:"TileMatrixType",identifier:"18",scaleDenominator:2132.72958384978,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:262144,matrixHeight:262144},{type:"TileMatrixType",identifier:"19",scaleDenominator:1066.36479192489,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:524288,matrixHeight:524288},{type:"TileMatrixType",identifier:"20",scaleDenominator:533.182395962445,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:1048576,matrixHeight:1048576},{type:"TileMatrixType",identifier:"21",scaleDenominator:266.591197981222,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:2097152,matrixHeight:2097152},{type:"TileMatrixType",identifier:"22",scaleDenominator:133.295598990611,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:4194304,matrixHeight:4194304},{type:"TileMatrixType",identifier:"23",scaleDenominator:66.6477994953056,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:8388608,matrixHeight:8388608},{type:"TileMatrixType",identifier:"24",scaleDenominator:33.3238997476528,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:16777216,matrixHeight:16777216}]},wt=new Ot(n2);var $u=ve(Mg(),1),qu=new Ot($u.Nztm2000),Li=new Ot($u.Nztm2000Quad);var ci={All:[wt,qu,Li],Defaults:new Map([[Te.Google.code,wt],[Te.Nztm2000.code,qu]]),get(t){let e=this.tryGet(t);if(e==null)throw new Error("Failed to lookup TileMatrixSet: "+t);return e},tryGet(t){var e,r;return t==null?null:typeof t=="number"?(e=this.Defaults.get(t))!==null&&e!==void 0?e:null:(r=this.Defaults.get(t.code))!==null&&r!==void 0?r:null},find(t){if(t==null)return null;let e=Te.parse(t);if(e!=null)return ci.tryGet(e);for(let r of ci.All)if(r.identifier===t)return r;return null}};var Ge;(function(t){t.Png="png",t.Jpeg="jpeg",t.Webp="webp",t.Avif="avif"})(Ge||(Ge={}));var gr;(function(t){t.MapboxVectorTiles="pbf"})(gr||(gr={}));var Rg=ve(hs(),1);var Ut={parse(t){let e={name:t},r=t.indexOf(":");return r!==-1&&(e.layer=e.name.substring(r+1),e.name=e.name.substring(0,r)),e},componentsToName(t){return Ut.toName(t.name,t.layer)},toName(t,e){let r=[t];return e&&r.push(`:${e}`),r.join("")}};function ja(t){if(t==="")return 0;let e=parseInt(t,16);if(isNaN(e))throw new Error("Invalid hex byte: "+t);return e}function Hu(t){if(t.startsWith("0x")?t=t.slice(2):t.startsWith("#")&&(t=t.slice(1)),t.length!==6&&t.length!==8)throw new Error("Invalid hex color: "+t);return{r:ja(t.substr(0,2)),g:ja(t.substr(2,2)),b:ja(t.substr(4,2)),alpha:ja(t.substr(6,2))}}var mn=ve(require("fs"),1),Ku=ve(require("path"),1);var kt;(function(t){t[t.UInt8=1]="UInt8",t[t.UInt16=2]="UInt16",t[t.UInt32=4]="UInt32",t[t.UInt64=8]="UInt64",t[t.Double=8]="Double",t[t.Float=4]="Float"})(kt||(kt={}));var Cg=2**32,a2=typeof setImmediate>"u"?setTimeout:setImmediate,jt=()=>{throw new Error("Method not implemented.")},Nt=class{constructor(){this.isLittleEndian=!0,this.delayMs=Nt.DefaultDelayMs,this.maxChunkCount=10,this.chunks=Nt.DefaultChunkCache(),this.blankFillCount=16,this.maxConcurrentRequests=50,this.toFetch=new Set,this.toFetchPromise=null,this.byteOffset=0,this.getFloat32=jt,this.getFloat64=jt,this.getInt8=jt,this.getInt16=jt,this.getInt32=jt,this.setFloat32=jt,this.setFloat64=jt,this.setInt8=jt,this.setInt16=jt,this.setInt32=jt,this.setUint8=jt,this.setUint16=jt,this.setUint32=jt,this.setBigInt64=jt,this.setBigUint64=jt}static getByteRanges(e,r=32,i=16){if(e.size===0)return{chunks:[],blankFill:[]};let n=[...e.values()].sort((d,m)=>d-m),o=[],a=[];o.push(a);let h=[];for(let d=0;d<n.length;++d){let m=n[d],p=n[d-1];if(a.length>=r)a=[m],o.push(a);else if(d===0||m===p+1)a.push(m);else if(m<p+i){for(let w=p;w<m;w++)a.push(w+1),h.push(w+1);h.pop()}else a=[m],o.push(a)}return{chunks:o,blankFill:h}}async fetchData(){if(this.toFetch.size===0)return;let e=this.toFetch;this.toFetch=new Set,this.toFetchPromise=null;let r=Nt.getByteRanges(e,this.maxChunkCount,this.blankFillCount),i=[];for(let n of r.chunks){let o=n[0],a=n[n.length-1],h=o*this.chunkSize,d=a*this.chunkSize+this.chunkSize-h,m=await this.fetchBytes(h,d);if(n.length===1){i[o]=m,this.chunks.set(o,new DataView(m));continue}let p=o*this.chunkSize;for(let w of n){let E=w*this.chunkSize-p,_=m.slice(E,E+this.chunkSize);i[w]=_,this.chunks.set(w,new DataView(_))}}}async loadBytes(e,r){if(e<0)throw new Error("Offset must be positive");let i=Math.floor(e/this.chunkSize),n=Math.ceil((e+r)/this.chunkSize)-1;for(let o=i;o<=n;o++)this.chunks.has(o)||this.toFetch.add(o);if(this.toFetch.size!==0){if(this.toFetchPromise==null&&(this.toFetchPromise=new Promise(o=>a2(o,this.delayMs)).then(()=>this.fetchData())),this.toFetch.size>this.maxConcurrentRequests)throw new Error("Too many outstanding requests");await this.toFetchPromise}}getChunkId(e){return Math.floor(e/this.chunkSize)}getUint(e,r){switch(r){case kt.UInt8:return this.getUint8(e);case kt.UInt16:return this.getUint16(e);case kt.UInt32:return this.getUint32(e);case kt.UInt64:return this.getUint64(e)}}bytes(e,r){let i=this.isOneChunk(e,r);if(i){let m=this.getView(i),p=e-i*this.chunkSize;return new Uint8Array(m.buffer.slice(p,p+r))}let n=new Uint8Array(r),o=e+r,a=Math.floor(e/this.chunkSize),h=Math.ceil((e+r)/this.chunkSize)-1,d=0;for(let m=a;m<=h;m++){let p=e+d,w=m*this.chunkSize,E=this.getView(m),_=Math.min(o,w+this.chunkSize),C=E.buffer.slice(p-w,_-w);n.set(new Uint8Array(C),d),d+=C.byteLength}return n}getView(e){let r=this.chunks.get(e);if(r==null)throw new Error(`Chunk:${e} is not ready`);return r}isOneChunk(e,r){let i=e+r-1,n=Math.floor(e/this.chunkSize);return Math.floor(i/this.chunkSize)-n<1?n:null}hasBytes(e,r=1){let i=Math.floor(e/this.chunkSize),n=Math.ceil((e+r)/this.chunkSize)-1;for(let o=i;o<=n;o++)if(!this.chunks.has(o))return!1;return!0}toRange(e,r){if(r==null)return`bytes=${e}`;if(e<0)throw new Error("Cannot read from remote source with negative offset and length");return`bytes=${e}-${e+r}`}parseContentRange(e){let[r,i]=e.split(" ");if(r!=="bytes")throw new Error("Failed to parse content-range: "+e);if(i==null)throw new Error("Failed to parse content-range: "+e);let[,n]=i.split("/"),o=Number(n);if(isNaN(o))throw new Error("Failed to parse content-range: "+e);return o}get buffer(){throw new Error("Method not implemented.")}get byteLength(){if(this._byteLength)return this._byteLength;throw Error(".size() has not been fetched.")}getUint8(e){let r=Math.floor(e/this.chunkSize),i=this.chunks.get(r);if(i==null)throw new Error(`Chunk:${r} is not ready`);return i.getUint8(e-r*this.chunkSize)}getUint16(e){let r=this.isOneChunk(e,kt.UInt16);if(r!=null)return this.getView(r).getUint16(e-r*this.chunkSize,this.isLittleEndian);let i=this.getUint8(e),n=this.getUint8(e+kt.UInt8);return this.isLittleEndian?i+(n<<8):(i<<8)+n}getUint32(e){let r=this.isOneChunk(e,kt.UInt32);if(r!=null)return this.getView(r).getUint32(e-r*this.chunkSize,this.isLittleEndian);let i=this.getUint16(e),n=this.getUint16(e+kt.UInt16);return this.isLittleEndian?i+n*65536:i*65536+n}getUint64(e){let r=this.isOneChunk(e,kt.UInt64);if(r!=null){let o=this.getView(r);return Number(o.getBigUint64(e-r*this.chunkSize,this.isLittleEndian))}let i=this.getUint32(e),n=this.getUint32(e+kt.UInt32);return this.isLittleEndian?i+n*Cg:i*Cg+n}getBigUint64(e){let r=this.isOneChunk(e,kt.UInt64);if(r!=null)return this.getView(r).getBigUint64(e-r*this.chunkSize,this.isLittleEndian);let i=BigInt(this.getUint32(e)),n=BigInt(this.getUint32(e+kt.UInt32));return this.isLittleEndian?i+(n<<BigInt(32)):(i<<BigInt(32))+n}getBigInt64(){throw new Error("Not implemented.")}};Nt.DefaultChunkCache=()=>new Map;Nt.DefaultDelayMs=1;var st=class extends Error{constructor(e,r,i){super(e),this.name="CompositeError",this.code=r,this.reason=i}static isCompositeError(e){return typeof e!="object"||e==null?!1:e.name==="CompositeError"}};function Di(t){return typeof t=="object"&&t!==null}function fi(t){let e=t.split("/"),r=e[0];if(r==null||r==="")return null;r.endsWith(":")&&(r=r.slice(0,r.length-1));let i=e[2];if(i==null||i.trim()==="")return null;if(e.length===3)return{protocol:r,bucket:i};let n=e.slice(3).join("/");return n==null||n.trim()===""?{protocol:r,bucket:i}:{key:n,bucket:i,protocol:r}}var l2=/\/$/,u2=/^\//;function xd(t,e){return t.replace(l2,"")+"/"+e.replace(u2,"")}function Tg(t,...e){let r=t;for(let i=0;i<e.length;i++)r=xd(r,e[i]);return r}async function Ag(t){let e=[];for await(let r of t)e.push(r);return e}var Ed=require("fs"),Gu=require("path"),dn=class extends Nt{constructor(e){super(),this.type="file",this.protocol="file",this.chunkSize=dn.DefaultChunkSize,this.fd=null,this.closeAfterRead=!1,this.fileName=e}static isSource(e){return e.type==="file"}async close(){let e=await this.fd;e!=null&&(await e.close(),this.fd=null)}get uri(){return(0,Gu.resolve)(this.fileName)}get name(){return(0,Gu.basename)(this.fileName)}get size(){return this._size?this._size:(this._size=Promise.resolve().then(async()=>(await Ed.promises.stat(this.fileName)).size),this._size)}async fetchBytes(e,r){if(e<0&&r!=null)throw new Error("Cannot fetch negative offsets with length");if(e<0&&(r=Math.abs(e),e=await this.size+e),r==null)throw new Error("Length is required for reading from files");this.fd==null&&(this.fd=Ed.promises.open(this.fileName,"r"));let i=await this.fd,{buffer:n}=await i.read(Buffer.allocUnsafe(r),0,r,e);return this.closeAfterRead&&await this.close(),n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength)}};dn.DefaultChunkSize=16*1024;function Vu(t,e){return Di(t)?t.code==="ENOENT"?new st(e,404,t):t.code==="EACCES"?new st(e,403,t):new st(e,500,t):new st(e,500,t)}var Bi=class{constructor(){this.protocol=Bi.protocol}static is(e){return e.protocol===Bi.protocol}source(e){return new dn(e)}async*list(e,r){try{let i=await mn.default.promises.readdir(e,{withFileTypes:!0}),n=Ku.default.resolve(e);for(let o of i){let a=Ku.default.join(n,o.name);o.isDirectory()&&r?.recursive!==!1?yield*this.list(a):yield a}}catch(i){throw Vu(i,`Failed to list: ${e}`)}}async*details(e,r){for await(let i of this.list(e,r)){let n=await this.head(i);n!=null&&(yield n)}}async head(e){try{let r=await mn.default.promises.stat(e);return{path:e,size:r.size,isDirectory:r.isDirectory()}}catch(r){if(Di(r)&&r.code==="ENOENT")return null;throw Vu(r,`Failed to stat: ${e}`)}}async read(e){try{return await mn.default.promises.readFile(e)}catch(r){throw Vu(r,`Failed to read: ${e}`)}}async write(e,r){let i=Ku.default.dirname(e);await mn.default.promises.mkdir(i,{recursive:!0});try{if(Buffer.isBuffer(r)||typeof r=="string")await mn.default.promises.writeFile(e,r);else{let n=mn.default.createWriteStream(e);await new Promise((o,a)=>{n.on("finish",o),n.on("error",a),r.pipe(n)})}}catch(n){throw Vu(n,`Failed to write: ${e}`)}}stream(e){return mn.default.createReadStream(e)}};Bi.protocol="file";var hy=ve(require("http"),1),cy=ve(require("https"),1),ys=ve(require("zlib"),1),br=ve(require("stream"),1),Xa=require("buffer");function h2(t){if(!/^data:/i.test(t))throw new TypeError('`uri` does not appear to be a Data URI (must begin with "data:")');t=t.replace(/\r?\n/g,"");let e=t.indexOf(",");if(e===-1||e<=4)throw new TypeError("malformed data: URI");let r=t.substring(5,e).split(";"),i="",n=!1,o=r[0]||"text/plain",a=o;for(let p=1;p<r.length;p++)r[p]==="base64"?n=!0:(a+=`;${r[p]}`,r[p].indexOf("charset=")===0&&(i=r[p].substring(8)));!r[0]&&!i.length&&(a+=";charset=US-ASCII",i="US-ASCII");let h=n?"base64":"ascii",d=unescape(t.substring(e+1)),m=Buffer.from(d,h);return m.type=o,m.typeFull=a,m.charset=i,m}var Ig=h2;var Rr=ve(require("stream"),1),ji=require("util"),yr=require("buffer");$a();Xu();var Ui=class extends Error{constructor(e,r){super(e),Error.captureStackTrace(this,this.constructor),this.type=r}get name(){return this.constructor.name}get[Symbol.toStringTag](){return this.constructor.name}};var tr=class extends Ui{constructor(e,r,i){super(e,r),i&&(this.code=this.errno=i.code,this.erroredSysCall=i.syscall)}};var Ju=Symbol.toStringTag,Td=t=>typeof t=="object"&&typeof t.append=="function"&&typeof t.delete=="function"&&typeof t.get=="function"&&typeof t.getAll=="function"&&typeof t.has=="function"&&typeof t.set=="function"&&typeof t.sort=="function"&&t[Ju]==="URLSearchParams",Va=t=>t&&typeof t=="object"&&typeof t.arrayBuffer=="function"&&typeof t.type=="string"&&typeof t.stream=="function"&&typeof t.constructor=="function"&&/^(Blob|File)$/.test(t[Ju]),jg=t=>typeof t=="object"&&(t[Ju]==="AbortSignal"||t[Ju]==="EventTarget"),Wg=(t,e)=>{let r=new URL(e).hostname,i=new URL(t).hostname;return r===i||r.endsWith(`.${i}`)};var M2=(0,ji.promisify)(Rr.default.pipeline),rr=Symbol("Body internals"),mi=class{constructor(e,{size:r=0}={}){let i=null;e===null?e=null:Td(e)?e=yr.Buffer.from(e.toString()):Va(e)||yr.Buffer.isBuffer(e)||(ji.types.isAnyArrayBuffer(e)?e=yr.Buffer.from(e):ArrayBuffer.isView(e)?e=yr.Buffer.from(e.buffer,e.byteOffset,e.byteLength):e instanceof Rr.default||(e instanceof ds?(e=Ug(e),i=e.type.split("=")[1]):e=yr.Buffer.from(String(e))));let n=e;yr.Buffer.isBuffer(e)?n=Rr.default.Readable.from(e):Va(e)&&(n=Rr.default.Readable.from(e.stream())),this[rr]={body:e,stream:n,boundary:i,disturbed:!1,error:null},this.size=r,e instanceof Rr.default&&e.on("error",o=>{let a=o instanceof Ui?o:new tr(`Invalid response body while trying to fetch ${this.url}: ${o.message}`,"system",o);this[rr].error=a})}get body(){return this[rr].stream}get bodyUsed(){return this[rr].disturbed}async arrayBuffer(){let{buffer:e,byteOffset:r,byteLength:i}=await th(this);return e.slice(r,r+i)}async formData(){let e=this.headers.get("content-type");if(e.startsWith("application/x-www-form-urlencoded")){let i=new ds,n=new URLSearchParams(await this.text());for(let[o,a]of n)i.append(o,a);return i}let{toFormData:r}=await Promise.resolve().then(()=>(Yg(),Kg));return r(this.body,e)}async blob(){let e=this.headers&&this.headers.get("content-type")||this[rr].body&&this[rr].body.type||"",r=await this.arrayBuffer();return new Fi([r],{type:e})}async json(){let e=await th(this);return JSON.parse(e.toString())}async text(){return(await th(this)).toString()}buffer(){return th(this)}};mi.prototype.buffer=(0,ji.deprecate)(mi.prototype.buffer,"Please use 'response.arrayBuffer()' instead of 'response.buffer()'","node-fetch#buffer");Object.defineProperties(mi.prototype,{body:{enumerable:!0},bodyUsed:{enumerable:!0},arrayBuffer:{enumerable:!0},blob:{enumerable:!0},json:{enumerable:!0},text:{enumerable:!0},data:{get:(0,ji.deprecate)(()=>{},"data doesn't exist, use json(), text(), arrayBuffer(), or body instead","https://github.com/node-fetch/node-fetch/issues/1000 (response)")}});async function th(t){if(t[rr].disturbed)throw new TypeError(`body used already for: ${t.url}`);if(t[rr].disturbed=!0,t[rr].error)throw t[rr].error;let{body:e}=t;if(e===null)return yr.Buffer.alloc(0);if(!(e instanceof Rr.default))return yr.Buffer.alloc(0);let r=[],i=0;try{for await(let n of e){if(t.size>0&&i+n.length>t.size){let o=new tr(`content size at ${t.url} over limit: ${t.size}`,"max-size");throw e.destroy(o),o}i+=n.length,r.push(n)}}catch(n){throw n instanceof Ui?n:new tr(`Invalid response body while trying to fetch ${t.url}: ${n.message}`,"system",n)}if(e.readableEnded===!0||e._readableState.ended===!0)try{return r.every(n=>typeof n=="string")?yr.Buffer.from(r.join("")):yr.Buffer.concat(r,i)}catch(n){throw new tr(`Could not create Buffer from response body for ${t.url}: ${n.message}`,"system",n)}else throw new tr(`Premature close of server response while trying to fetch ${t.url}`)}var Mo=(t,e)=>{let r,i,{body:n}=t[rr];if(t.bodyUsed)throw new Error("cannot clone body after it is used");return n instanceof Rr.default&&typeof n.getBoundary!="function"&&(r=new Rr.PassThrough({highWaterMark:e}),i=new Rr.PassThrough({highWaterMark:e}),n.pipe(r),n.pipe(i),t[rr].stream=r,n=i),n},R2=(0,ji.deprecate)(t=>t.getBoundary(),"form-data doesn't follow the spec and requires special treatment. Use alternative package","https://github.com/node-fetch/node-fetch/issues/1167"),rh=(t,e)=>t===null?null:typeof t=="string"?"text/plain;charset=UTF-8":Td(t)?"application/x-www-form-urlencoded;charset=UTF-8":Va(t)?t.type||null:yr.Buffer.isBuffer(t)||ji.types.isAnyArrayBuffer(t)||ArrayBuffer.isView(t)?null:t instanceof ds?`multipart/form-data; boundary=${e[rr].boundary}`:t&&typeof t.getBoundary=="function"?`multipart/form-data;boundary=${R2(t)}`:t instanceof Rr.default?null:"text/plain;charset=UTF-8",Zg=t=>{let{body:e}=t[rr];return e===null?0:Va(e)?e.size:yr.Buffer.isBuffer(e)?e.length:e&&typeof e.getLengthSync=="function"&&e.hasKnownLength&&e.hasKnownLength()?e.getLengthSync():null},Xg=async(t,{body:e})=>{e===null?t.end():await M2(e,t)};var Od=require("util"),Za=ve(require("http"),1),ih=typeof Za.default.validateHeaderName=="function"?Za.default.validateHeaderName:t=>{if(!/^[\^`\-\w!#$%&'*+.|~]+$/.test(t)){let e=new TypeError(`Header name must be a valid HTTP token [${t}]`);throw Object.defineProperty(e,"code",{value:"ERR_INVALID_HTTP_TOKEN"}),e}},kd=typeof Za.default.validateHeaderValue=="function"?Za.default.validateHeaderValue:(t,e)=>{if(/[^\t\u0020-\u007E\u0080-\u00FF]/.test(e)){let r=new TypeError(`Invalid character in header content ["${t}"]`);throw Object.defineProperty(r,"code",{value:"ERR_INVALID_CHAR"}),r}},ir=class extends URLSearchParams{constructor(e){let r=[];if(e instanceof ir){let i=e.raw();for(let[n,o]of Object.entries(i))r.push(...o.map(a=>[n,a]))}else if(e!=null)if(typeof e=="object"&&!Od.types.isBoxedPrimitive(e)){let i=e[Symbol.iterator];if(i==null)r.push(...Object.entries(e));else{if(typeof i!="function")throw new TypeError("Header pairs must be iterable");r=[...e].map(n=>{if(typeof n!="object"||Od.types.isBoxedPrimitive(n))throw new TypeError("Each header pair must be an iterable object");return[...n]}).map(n=>{if(n.length!==2)throw new TypeError("Each header pair must be a name/value tuple");return[...n]})}}else throw new TypeError("Failed to construct 'Headers': The provided value is not of type '(sequence<sequence<ByteString>> or record<ByteString, ByteString>)");return r=r.length>0?r.map(([i,n])=>(ih(i),kd(i,String(n)),[String(i).toLowerCase(),String(n)])):void 0,super(r),new Proxy(this,{get(i,n,o){switch(n){case"append":case"set":return(a,h)=>(ih(a),kd(a,String(h)),URLSearchParams.prototype[n].call(i,String(a).toLowerCase(),String(h)));case"delete":case"has":case"getAll":return a=>(ih(a),URLSearchParams.prototype[n].call(i,String(a).toLowerCase()));case"keys":return()=>(i.sort(),new Set(URLSearchParams.prototype.keys.call(i)).keys());default:return Reflect.get(i,n,o)}}})}get[Symbol.toStringTag](){return this.constructor.name}toString(){return Object.prototype.toString.call(this)}get(e){let r=this.getAll(e);if(r.length===0)return null;let i=r.join(", ");return/^content-encoding$/i.test(e)&&(i=i.toLowerCase()),i}forEach(e,r=void 0){for(let i of this.keys())Reflect.apply(e,r,[this.get(i),i,this])}*values(){for(let e of this.keys())yield this.get(e)}*entries(){for(let e of this.keys())yield[e,this.get(e)]}[Symbol.iterator](){return this.entries()}raw(){return[...this.keys()].reduce((e,r)=>(e[r]=this.getAll(r),e),{})}[Symbol.for("nodejs.util.inspect.custom")](){return[...this.keys()].reduce((e,r)=>{let i=this.getAll(r);return r==="host"?e[r]=i[0]:e[r]=i.length>1?i:i[0],e},{})}};Object.defineProperties(ir.prototype,["get","entries","forEach","values"].reduce((t,e)=>(t[e]={enumerable:!0},t),{}));function Jg(t=[]){return new ir(t.reduce((e,r,i,n)=>(i%2===0&&e.push(n.slice(i,i+2)),e),[]).filter(([e,r])=>{try{return ih(e),kd(e,String(r)),!0}catch{return!1}}))}var C2=new Set([301,302,303,307,308]),nh=t=>C2.has(t);var qr=Symbol("Response internals"),Lt=class extends mi{constructor(e=null,r={}){super(e,r);let i=r.status!=null?r.status:200,n=new ir(r.headers);if(e!==null&&!n.has("Content-Type")){let o=rh(e,this);o&&n.append("Content-Type",o)}this[qr]={type:"default",url:r.url,status:i,statusText:r.statusText||"",headers:n,counter:r.counter,highWaterMark:r.highWaterMark}}get type(){return this[qr].type}get url(){return this[qr].url||""}get status(){return this[qr].status}get ok(){return this[qr].status>=200&&this[qr].status<300}get redirected(){return this[qr].counter>0}get statusText(){return this[qr].statusText}get headers(){return this[qr].headers}get highWaterMark(){return this[qr].highWaterMark}clone(){return new Lt(Mo(this,this.highWaterMark),{type:this.type,url:this.url,status:this.status,statusText:this.statusText,headers:this.headers,ok:this.ok,redirected:this.redirected,size:this.size,highWaterMark:this.highWaterMark})}static redirect(e,r=302){if(!nh(r))throw new RangeError('Failed to execute "redirect" on "response": Invalid status code');return new Lt(null,{headers:{location:new URL(e).toString()},status:r})}static error(){let e=new Lt(null,{status:0,statusText:""});return e[qr].type="error",e}get[Symbol.toStringTag](){return"Response"}};Object.defineProperties(Lt.prototype,{type:{enumerable:!0},url:{enumerable:!0},status:{enumerable:!0},ok:{enumerable:!0},redirected:{enumerable:!0},statusText:{enumerable:!0},headers:{enumerable:!0},clone:{enumerable:!0}});var ay=require("url"),ly=require("util");var Qg=t=>{if(t.search)return t.search;let e=t.href.length-1,r=t.hash||(t.href[e]==="#"?"#":"");return t.href[e-r.length]==="?"?"?":""};var ty=require("net");function ey(t,e=!1){return t==null||(t=new URL(t),/^(about|blob|data):$/.test(t.protocol))?"no-referrer":(t.username="",t.password="",t.hash="",e&&(t.pathname="",t.search=""),t)}var ry=new Set(["","no-referrer","no-referrer-when-downgrade","same-origin","origin","strict-origin","origin-when-cross-origin","strict-origin-when-cross-origin","unsafe-url"]),iy="strict-origin-when-cross-origin";function ny(t){if(!ry.has(t))throw new TypeError(`Invalid referrerPolicy: ${t}`);return t}function T2(t){if(/^(http|ws)s:$/.test(t.protocol))return!0;let e=t.host.replace(/(^\[)|(]$)/g,""),r=(0,ty.isIP)(e);return r===4&&/^127\./.test(e)||r===6&&/^(((0+:){7})|(::(0+:){0,6}))0*1$/.test(e)?!0:/^(.+\.)*localhost$/.test(t.host)?!1:t.protocol==="file:"}function Ro(t){return/^about:(blank|srcdoc)$/.test(t)||t.protocol==="data:"||/^(blob|filesystem):$/.test(t.protocol)?!0:T2(t)}function sy(t,{referrerURLCallback:e,referrerOriginCallback:r}={}){if(t.referrer==="no-referrer"||t.referrerPolicy==="")return null;let i=t.referrerPolicy;if(t.referrer==="about:client")return"no-referrer";let n=t.referrer,o=ey(n),a=ey(n,!0);o.toString().length>4096&&(o=a),e&&(o=e(o)),r&&(a=r(a));let h=new URL(t.url);switch(i){case"no-referrer":return"no-referrer";case"origin":return a;case"unsafe-url":return o;case"strict-origin":return Ro(o)&&!Ro(h)?"no-referrer":a.toString();case"strict-origin-when-cross-origin":return o.origin===h.origin?o:Ro(o)&&!Ro(h)?"no-referrer":a;case"same-origin":return o.origin===h.origin?o:"no-referrer";case"origin-when-cross-origin":return o.origin===h.origin?o:a;case"no-referrer-when-downgrade":return Ro(o)&&!Ro(h)?"no-referrer":o;default:throw new TypeError(`Invalid referrerPolicy: ${i}`)}}function oy(t){let e=(t.get("referrer-policy")||"").split(/[,\s]+/),r="";for(let i of e)i&&ry.has(i)&&(r=i);return r}var xt=Symbol("Request internals"),sh=t=>typeof t=="object"&&typeof t[xt]=="object",A2=(0,ly.deprecate)(()=>{},".data is not a valid RequestInit property, use .body instead","https://github.com/node-fetch/node-fetch/issues/1000 (request)"),Wi=class extends mi{constructor(e,r={}){let i;if(sh(e)?i=new URL(e.url):(i=new URL(e),e={}),i.username!==""||i.password!=="")throw new TypeError(`${i} is an url with embedded credentails.`);let n=r.method||e.method||"GET";if(n=n.toUpperCase(),"data"in r&&A2(),(r.body!=null||sh(e)&&e.body!==null)&&(n==="GET"||n==="HEAD"))throw new TypeError("Request with GET/HEAD method cannot have body");let o=r.body?r.body:sh(e)&&e.body!==null?Mo(e):null;super(o,{size:r.size||e.size||0});let a=new ir(r.headers||e.headers||{});if(o!==null&&!a.has("Content-Type")){let m=rh(o,this);m&&a.set("Content-Type",m)}let h=sh(e)?e.signal:null;if("signal"in r&&(h=r.signal),h!=null&&!jg(h))throw new TypeError("Expected signal to be an instanceof AbortSignal or EventTarget");let d=r.referrer==null?e.referrer:r.referrer;if(d==="")d="no-referrer";else if(d){let m=new URL(d);d=/^about:(\/\/)?client$/.test(m)?"client":m}else d=void 0;this[xt]={method:n,redirect:r.redirect||e.redirect||"follow",headers:a,parsedURL:i,signal:h,referrer:d},this.follow=r.follow===void 0?e.follow===void 0?20:e.follow:r.follow,this.compress=r.compress===void 0?e.compress===void 0?!0:e.compress:r.compress,this.counter=r.counter||e.counter||0,this.agent=r.agent||e.agent,this.highWaterMark=r.highWaterMark||e.highWaterMark||16384,this.insecureHTTPParser=r.insecureHTTPParser||e.insecureHTTPParser||!1,this.referrerPolicy=r.referrerPolicy||e.referrerPolicy||""}get method(){return this[xt].method}get url(){return(0,ay.format)(this[xt].parsedURL)}get headers(){return this[xt].headers}get redirect(){return this[xt].redirect}get signal(){return this[xt].signal}get referrer(){if(this[xt].referrer==="no-referrer")return"";if(this[xt].referrer==="client")return"about:client";if(this[xt].referrer)return this[xt].referrer.toString()}get referrerPolicy(){return this[xt].referrerPolicy}set referrerPolicy(e){this[xt].referrerPolicy=ny(e)}clone(){return new Wi(this)}get[Symbol.toStringTag](){return"Request"}};Object.defineProperties(Wi.prototype,{method:{enumerable:!0},url:{enumerable:!0},headers:{enumerable:!0},redirect:{enumerable:!0},clone:{enumerable:!0},signal:{enumerable:!0},referrer:{enumerable:!0},referrerPolicy:{enumerable:!0}});var uy=t=>{let{parsedURL:e}=t[xt],r=new ir(t[xt].headers);r.has("Accept")||r.set("Accept","*/*");let i=null;if(t.body===null&&/^(post|put)$/i.test(t.method)&&(i="0"),t.body!==null){let h=Zg(t);typeof h=="number"&&!Number.isNaN(h)&&(i=String(h))}i&&r.set("Content-Length",i),t.referrerPolicy===""&&(t.referrerPolicy=iy),t.referrer&&t.referrer!=="no-referrer"?t[xt].referrer=sy(t):t[xt].referrer="no-referrer",t[xt].referrer instanceof URL&&r.set("Referer",t.referrer),r.has("User-Agent")||r.set("User-Agent","node-fetch"),t.compress&&!r.has("Accept-Encoding")&&r.set("Accept-Encoding","gzip,deflate,br");let{agent:n}=t;typeof n=="function"&&(n=n(e)),!r.has("Connection")&&!n&&r.set("Connection","close");let o=Qg(e),a={path:e.pathname+o,method:t.method,headers:r[Symbol.for("nodejs.util.inspect.custom")](),insecureHTTPParser:t.insecureHTTPParser,agent:n};return{parsedURL:e,options:a}};var oh=class extends Ui{constructor(e,r="aborted"){super(e,r)}};Xu();Id();var I2=new Set(["data:","http:","https:"]);async function ah(t,e){return new Promise((r,i)=>{let n=new Wi(t,e),{parsedURL:o,options:a}=uy(n);if(!I2.has(o.protocol))throw new TypeError(`node-fetch cannot load ${t}. URL scheme "${o.protocol.replace(/:$/,"")}" is not supported.`);if(o.protocol==="data:"){let C=Ig(n.url),R=new Lt(C,{headers:{"Content-Type":C.typeFull}});r(R);return}let h=(o.protocol==="https:"?cy.default:hy.default).request,{signal:d}=n,m=null,p=()=>{let C=new oh("The operation was aborted.");i(C),n.body&&n.body instanceof br.default.Readable&&n.body.destroy(C),!(!m||!m.body)&&m.body.emit("error",C)};if(d&&d.aborted){p();return}let w=()=>{p(),_()},E=h(o.toString(),a);d&&d.addEventListener("abort",w);let _=()=>{E.abort(),d&&d.removeEventListener("abort",w)};E.on("error",C=>{i(new tr(`request to ${n.url} failed, reason: ${C.message}`,"system",C)),_()}),P2(E,C=>{m.body.destroy(C)}),process.version<"v14"&&E.on("socket",C=>{let R;C.prependListener("end",()=>{R=C._eventsCount}),C.prependListener("close",I=>{if(m&&R<C._eventsCount&&!I){let A=new Error("Premature close");A.code="ERR_STREAM_PREMATURE_CLOSE",m.body.emit("error",A)}})}),E.on("response",C=>{E.setTimeout(0);let R=Jg(C.rawHeaders);if(nh(C.statusCode)){let j=R.get("Location"),W=null;try{W=j===null?null:new URL(j,n.url)}catch{if(n.redirect!=="manual"){i(new tr(`uri requested responds with an invalid redirect URL: ${j}`,"invalid-redirect")),_();return}}switch(n.redirect){case"error":i(new tr(`uri requested responds with a redirect, redirect mode is set to error: ${n.url}`,"no-redirect")),_();return;case"manual":break;case"follow":{if(W===null)break;if(n.counter>=n.follow){i(new tr(`maximum redirect reached at: ${n.url}`,"max-redirect")),_();return}let Z={headers:new ir(n.headers),follow:n.follow,counter:n.counter+1,agent:n.agent,compress:n.compress,method:n.method,body:Mo(n),signal:n.signal,size:n.size,referrer:n.referrer,referrerPolicy:n.referrerPolicy};if(!Wg(n.url,W))for(let N of["authorization","www-authenticate","cookie","cookie2"])Z.headers.delete(N);if(C.statusCode!==303&&n.body&&e.body instanceof br.default.Readable){i(new tr("Cannot follow redirect with body being a readable stream","unsupported-redirect")),_();return}(C.statusCode===303||(C.statusCode===301||C.statusCode===302)&&n.method==="POST")&&(Z.method="GET",Z.body=void 0,Z.headers.delete("content-length"));let oe=oy(R);oe&&(Z.referrerPolicy=oe),r(ah(new Wi(W,Z))),_();return}default:return i(new TypeError(`Redirect option '${n.redirect}' is not a valid value of RequestRedirect`))}}d&&C.once("end",()=>{d.removeEventListener("abort",w)});let I=(0,br.pipeline)(C,new br.PassThrough,j=>{j&&i(j)});process.version<"v12.10"&&C.on("aborted",w);let A={url:n.url,status:C.statusCode,statusText:C.statusMessage,headers:R,size:n.size,counter:n.counter,highWaterMark:n.highWaterMark},k=R.get("Content-Encoding");if(!n.compress||n.method==="HEAD"||k===null||C.statusCode===204||C.statusCode===304){m=new Lt(I,A),r(m);return}let D={flush:ys.default.Z_SYNC_FLUSH,finishFlush:ys.default.Z_SYNC_FLUSH};if(k==="gzip"||k==="x-gzip"){I=(0,br.pipeline)(I,ys.default.createGunzip(D),j=>{j&&i(j)}),m=new Lt(I,A),r(m);return}if(k==="deflate"||k==="x-deflate"){let j=(0,br.pipeline)(C,new br.PassThrough,W=>{W&&i(W)});j.once("data",W=>{(W[0]&15)===8?I=(0,br.pipeline)(I,ys.default.createInflate(),Z=>{Z&&i(Z)}):I=(0,br.pipeline)(I,ys.default.createInflateRaw(),Z=>{Z&&i(Z)}),m=new Lt(I,A),r(m)}),j.once("end",()=>{m||(m=new Lt(I,A),r(m))});return}if(k==="br"){I=(0,br.pipeline)(I,ys.default.createBrotliDecompress(),j=>{j&&i(j)}),m=new Lt(I,A),r(m);return}m=new Lt(I,A),r(m)}),Xg(E,n).catch(i)})}function P2(t,e){let r=Xa.Buffer.from(`0\r
108
+ northing meters`+o;var q=N/2,F=0,W=0,V,K,ae,pe,Oe;return q>0&&(V=1e5/Math.pow(10,q),K=o.substring(_,_+q),F=parseFloat(K)*V,ae=o.substring(_+q),W=parseFloat(ae)*V),pe=F+k,Oe=W+D,{easting:pe,northing:Oe,zoneLetter:E,zoneNumber:M,accuracy:V}}function Mi(o,u){for(var h=Nn.charCodeAt(u-1),y=1e5,g=!1;h!==o.charCodeAt(0);){if(h++,h===nt&&h++,h===pt&&h++,h>Si){if(g)throw"Bad character: "+o;h=Ir,g=!0}y+=1e5}return y}function el(o,u){if(o>"V")throw"MGRSPoint given invalid Northing "+o;for(var h=Z1.charCodeAt(u-1),y=0,g=!1;h!==o.charCodeAt(0);){if(h++,h===nt&&h++,h===pt&&h++,h>mt){if(g)throw"Bad character: "+o;h=Ir,g=!0}y+=1e5}return y}function Ts(o){var u;switch(o){case"C":u=11e5;break;case"D":u=2e6;break;case"E":u=28e5;break;case"F":u=37e5;break;case"G":u=46e5;break;case"H":u=55e5;break;case"J":u=64e5;break;case"K":u=73e5;break;case"L":u=82e5;break;case"M":u=91e5;break;case"N":u=0;break;case"P":u=8e5;break;case"Q":u=17e5;break;case"R":u=26e5;break;case"S":u=35e5;break;case"T":u=44e5;break;case"U":u=53e5;break;case"V":u=62e5;break;case"W":u=7e6;break;case"X":u=79e5;break;default:u=-1}if(u>=0)return u;throw"Invalid zone letter: "+o}function dr(o,u,h){if(!(this instanceof dr))return new dr(o,u,h);if(Array.isArray(o))this.x=o[0],this.y=o[1],this.z=o[2]||0;else if(typeof o=="object")this.x=o.x,this.y=o.y,this.z=o.z||0;else if(typeof o=="string"&&typeof u>"u"){var y=o.split(",");this.x=parseFloat(y[0],10),this.y=parseFloat(y[1],10),this.z=parseFloat(y[2],10)||0}else this.x=o,this.y=u,this.z=h||0;console.warn("proj4.Point will be removed in version 3, use proj4.toPoint")}dr.fromMGRS=function(o){return new dr(ba(o))},dr.prototype.toMGRS=function(o){return Dn([this.x,this.y],o)};var Is=1,ks=.25,tl=.046875,rl=.01953125,il=.01068115234375,$c=.75,Wc=.46875,Fc=.013020833333333334,nl=.007120768229166667,Hc=.3645833333333333,Gc=.005696614583333333,Vc=.3076171875,Gi=function(o){var u=[];u[0]=Is-o*(ks+o*(tl+o*(rl+o*il))),u[1]=o*($c-o*(tl+o*(rl+o*il)));var h=o*o;return u[2]=h*(Wc-o*(Fc+o*nl)),h*=o,u[3]=h*(Hc-o*Gc),u[4]=h*o*Vc,u},Bn=function(o,u,h,y){return h*=u,u*=u,y[0]*o-h*(y[1]+u*(y[2]+u*(y[3]+u*y[4])))},Kc=20,xa=function(o,u,h){for(var y=1/(1-u),g=o,_=Kc;_;--_){var M=Math.sin(g),E=1-u*M*M;if(E=(Bn(g,M,Math.cos(g),h)-o)*(E*Math.sqrt(E))*y,g-=E,Math.abs(E)<m)return g}return g};function Vi(){this.x0=this.x0!==void 0?this.x0:0,this.y0=this.y0!==void 0?this.y0:0,this.long0=this.long0!==void 0?this.long0:0,this.lat0=this.lat0!==void 0?this.lat0:0,this.es&&(this.en=Gi(this.es),this.ml0=Bn(this.lat0,Math.sin(this.lat0),Math.cos(this.lat0),this.en))}function Ki(o){var u=o.x,h=o.y,y=Z(u-this.long0),g,_,M,E=Math.sin(h),P=Math.cos(h);if(this.es){var D=P*y,N=Math.pow(D,2),q=this.ep2*Math.pow(P,2),F=Math.pow(q,2),W=Math.abs(P)>m?Math.tan(h):0,V=Math.pow(W,2),K=Math.pow(V,2);g=1-this.es*Math.pow(E,2),D=D/Math.sqrt(g);var ae=Bn(h,E,P,this.en);_=this.a*(this.k0*D*(1+N/6*(1-V+q+N/20*(5-18*V+K+14*q-58*V*q+N/42*(61+179*K-K*V-479*V)))))+this.x0,M=this.a*(this.k0*(ae-this.ml0+E*y*D/2*(1+N/12*(5-V+9*q+4*F+N/30*(61+K-58*V+270*q-330*V*q+N/56*(1385+543*K-K*V-3111*V))))))+this.y0}else{var k=P*Math.sin(y);if(Math.abs(Math.abs(k)-1)<m)return 93;if(_=.5*this.a*this.k0*Math.log((1+k)/(1-k))+this.x0,M=P*Math.cos(y)/Math.sqrt(1-Math.pow(k,2)),k=Math.abs(M),k>=1){if(k-1>m)return 93;M=0}else M=Math.acos(M);h<0&&(M=-M),M=this.a*this.k0*(M-this.lat0)+this.y0}return o.x=_,o.y=M,o}function Os(o){var u,h,y,g,_=(o.x-this.x0)*(1/this.a),M=(o.y-this.y0)*(1/this.a);if(this.es)if(u=this.ml0+M/this.k0,h=xa(u,this.es,this.en),Math.abs(h)<a){var N=Math.sin(h),q=Math.cos(h),F=Math.abs(q)>m?Math.tan(h):0,W=this.ep2*Math.pow(q,2),V=Math.pow(W,2),K=Math.pow(F,2),ae=Math.pow(K,2);u=1-this.es*Math.pow(N,2);var pe=_*Math.sqrt(u)/this.k0,Oe=Math.pow(pe,2);u=u*F,y=h-u*Oe/(1-this.es)*.5*(1-Oe/12*(5+3*K-9*W*K+W-4*V-Oe/30*(61+90*K-252*W*K+45*ae+46*W-Oe/56*(1385+3633*K+4095*ae+1574*ae*K)))),g=Z(this.long0+pe*(1-Oe/6*(1+2*K+W-Oe/20*(5+28*K+24*ae+8*W*K+6*W-Oe/42*(61+662*K+1320*ae+720*ae*K))))/q)}else y=a*fr(M),g=0;else{var E=Math.exp(_/this.k0),P=.5*(E-1/E),k=this.lat0+M/this.k0,D=Math.cos(k);u=Math.sqrt((1-Math.pow(D,2))/(1+Math.pow(P,2))),y=Math.asin(u),M<0&&(y=-y),P===0&&D===0?g=0:g=Z(Math.atan2(P,D)+this.long0)}return o.x=g,o.y=y,o}var sl=["Transverse_Mercator","Transverse Mercator","tmerc"],Zc={init:Vi,forward:Ki,inverse:Os,names:sl},Ls=function(o){var u=Math.exp(o);return u=(u-1/u)/2,u},Zi=function(o,u){o=Math.abs(o),u=Math.abs(u);var h=Math.max(o,u),y=Math.min(o,u)/(h||1);return h*Math.sqrt(1+Math.pow(y,2))},Ma=function(o){var u=1+o,h=u-1;return h===0?o:o*Math.log(u)/h},Jc=function(o){var u=Math.abs(o);return u=Ma(u*(1+u/(Zi(1,u)+1))),o<0?-u:u},Ea=function(o,u){for(var h=2*Math.cos(2*u),y=o.length-1,g=o[y],_=0,M;--y>=0;)M=-_+h*g+o[y],_=g,g=M;return u+M*Math.sin(2*u)},Yc=function(o,u){for(var h=2*Math.cos(u),y=o.length-1,g=o[y],_=0,M;--y>=0;)M=-_+h*g+o[y],_=g,g=M;return Math.sin(u)*M},Xc=function(o){var u=Math.exp(o);return u=(u+1/u)/2,u},Yt=function(o,u,h){for(var y=Math.sin(u),g=Math.cos(u),_=Ls(h),M=Xc(h),E=2*g*M,P=-2*y*_,k=o.length-1,D=o[k],N=0,q=0,F=0,W,V;--k>=0;)W=q,V=N,q=D,N=F,D=-W+E*q-P*N+o[k],F=-V+P*q+E*N;return E=y*M,P=g*_,[E*D-P*F,E*F+P*D]};function Qc(){if(this.es===void 0||this.es<=0)throw new Error("incorrect elliptical usage");this.x0=this.x0!==void 0?this.x0:0,this.y0=this.y0!==void 0?this.y0:0,this.long0=this.long0!==void 0?this.long0:0,this.lat0=this.lat0!==void 0?this.lat0:0,this.cgb=[],this.cbg=[],this.utg=[],this.gtu=[];var o=this.es/(1+Math.sqrt(1-this.es)),u=o/(2-o),h=u;this.cgb[0]=u*(2+u*(-2/3+u*(-2+u*(116/45+u*(26/45+u*(-2854/675)))))),this.cbg[0]=u*(-2+u*(2/3+u*(4/3+u*(-82/45+u*(32/45+u*(4642/4725)))))),h=h*u,this.cgb[1]=h*(7/3+u*(-8/5+u*(-227/45+u*(2704/315+u*(2323/945))))),this.cbg[1]=h*(5/3+u*(-16/15+u*(-13/9+u*(904/315+u*(-1522/945))))),h=h*u,this.cgb[2]=h*(56/15+u*(-136/35+u*(-1262/105+u*(73814/2835)))),this.cbg[2]=h*(-26/15+u*(34/21+u*(8/5+u*(-12686/2835)))),h=h*u,this.cgb[3]=h*(4279/630+u*(-332/35+u*(-399572/14175))),this.cbg[3]=h*(1237/630+u*(-12/5+u*(-24832/14175))),h=h*u,this.cgb[4]=h*(4174/315+u*(-144838/6237)),this.cbg[4]=h*(-734/315+u*(109598/31185)),h=h*u,this.cgb[5]=h*(601676/22275),this.cbg[5]=h*(444337/155925),h=Math.pow(u,2),this.Qn=this.k0/(1+u)*(1+h*(1/4+h*(1/64+h/256))),this.utg[0]=u*(-.5+u*(2/3+u*(-37/96+u*(1/360+u*(81/512+u*(-96199/604800)))))),this.gtu[0]=u*(.5+u*(-2/3+u*(5/16+u*(41/180+u*(-127/288+u*(7891/37800)))))),this.utg[1]=h*(-1/48+u*(-1/15+u*(437/1440+u*(-46/105+u*(1118711/3870720))))),this.gtu[1]=h*(13/48+u*(-3/5+u*(557/1440+u*(281/630+u*(-1983433/1935360))))),h=h*u,this.utg[2]=h*(-17/480+u*(37/840+u*(209/4480+u*(-5569/90720)))),this.gtu[2]=h*(61/240+u*(-103/140+u*(15061/26880+u*(167603/181440)))),h=h*u,this.utg[3]=h*(-4397/161280+u*(11/504+u*(830251/7257600))),this.gtu[3]=h*(49561/161280+u*(-179/168+u*(6601661/7257600))),h=h*u,this.utg[4]=h*(-4583/161280+u*(108847/3991680)),this.gtu[4]=h*(34729/80640+u*(-3418889/1995840)),h=h*u,this.utg[5]=h*(-20648693/638668800),this.gtu[5]=h*(212378941/319334400);var y=Ea(this.cbg,this.lat0);this.Zb=-this.Qn*(y+Yc(this.gtu,2*y))}function eh(o){var u=Z(o.x-this.long0),h=o.y;h=Ea(this.cbg,h);var y=Math.sin(h),g=Math.cos(h),_=Math.sin(u),M=Math.cos(u);h=Math.atan2(y,M*g),u=Math.atan2(_*g,Zi(y,g*M)),u=Jc(Math.tan(u));var E=Yt(this.gtu,2*h,2*u);h=h+E[0],u=u+E[1];var P,k;return Math.abs(u)<=2.623395162778?(P=this.a*(this.Qn*u)+this.x0,k=this.a*(this.Qn*h+this.Zb)+this.y0):(P=1/0,k=1/0),o.x=P,o.y=k,o}function th(o){var u=(o.x-this.x0)*(1/this.a),h=(o.y-this.y0)*(1/this.a);h=(h-this.Zb)/this.Qn,u=u/this.Qn;var y,g;if(Math.abs(u)<=2.623395162778){var _=Yt(this.utg,2*h,2*u);h=h+_[0],u=u+_[1],u=Math.atan(Ls(u));var M=Math.sin(h),E=Math.cos(h),P=Math.sin(u),k=Math.cos(u);h=Math.atan2(M*k,Zi(P,k*E)),u=Math.atan2(P,k*E),y=Z(u+this.long0),g=Ea(this.cgb,h)}else y=1/0,g=1/0;return o.x=y,o.y=g,o}var Ns=["Extended_Transverse_Mercator","Extended Transverse Mercator","etmerc"],Ji={init:Qc,forward:eh,inverse:th,names:Ns},zn=function(o,u){if(o===void 0){if(o=Math.floor((Z(u)+Math.PI)*30/Math.PI)+1,o<0)return 0;if(o>60)return 60}return o},Ei="etmerc";function rh(){var o=zn(this.zone,this.long0);if(o===void 0)throw new Error("unknown utm zone");this.lat0=0,this.long0=(6*Math.abs(o)-183)*w,this.x0=5e5,this.y0=this.utmSouth?1e7:0,this.k0=.9996,Ji.init.apply(this),this.forward=Ji.forward,this.inverse=Ji.inverse}var ol=["Universal Transverse Mercator System","utm"],ih={init:rh,names:ol,dependsOn:Ei},Ra=function(o,u){return Math.pow((1-o)/(1+o),u)},al=20;function nh(){var o=Math.sin(this.lat0),u=Math.cos(this.lat0);u*=u,this.rc=Math.sqrt(1-this.es)/(1-this.es*o*o),this.C=Math.sqrt(1+this.es*u*u/(1-this.es)),this.phic0=Math.asin(o/this.C),this.ratexp=.5*this.C*this.e,this.K=Math.tan(.5*this.phic0+v)/(Math.pow(Math.tan(.5*this.lat0+v),this.C)*Ra(this.e*o,this.ratexp))}function ll(o){var u=o.x,h=o.y;return o.y=2*Math.atan(this.K*Math.pow(Math.tan(.5*h+v),this.C)*Ra(this.e*Math.sin(h),this.ratexp))-a,o.x=this.C*u,o}function ul(o){for(var u=1e-14,h=o.x/this.C,y=o.y,g=Math.pow(Math.tan(.5*y+v)/this.K,1/this.C),_=al;_>0&&(y=2*Math.atan(g*Ra(this.e*Math.sin(o.y),-.5*this.e))-a,!(Math.abs(y-o.y)<u));--_)o.y=y;return _?(o.x=h,o.y=y,o):null}var cl=["gauss"],Kr={init:nh,forward:ll,inverse:ul,names:cl};function Ca(){Kr.init.apply(this),this.rc&&(this.sinc0=Math.sin(this.phic0),this.cosc0=Math.cos(this.phic0),this.R2=2*this.rc,this.title||(this.title="Oblique Stereographic Alternative"))}function hl(o){var u,h,y,g;return o.x=Z(o.x-this.long0),Kr.forward.apply(this,[o]),u=Math.sin(o.y),h=Math.cos(o.y),y=Math.cos(o.x),g=this.k0*this.R2/(1+this.sinc0*u+this.cosc0*h*y),o.x=g*h*Math.sin(o.x),o.y=g*(this.cosc0*u-this.sinc0*h*y),o.x=this.a*o.x+this.x0,o.y=this.a*o.y+this.y0,o}function sh(o){var u,h,y,g,_;if(o.x=(o.x-this.x0)/this.a,o.y=(o.y-this.y0)/this.a,o.x/=this.k0,o.y/=this.k0,_=Math.sqrt(o.x*o.x+o.y*o.y)){var M=2*Math.atan2(_,this.R2);u=Math.sin(M),h=Math.cos(M),g=Math.asin(h*this.sinc0+o.y*u*this.cosc0/_),y=Math.atan2(o.x*u,_*this.cosc0*h-o.y*this.sinc0*u)}else g=this.phic0,y=0;return o.x=y,o.y=g,Kr.inverse.apply(this,[o]),o.x=Z(o.x+this.long0),o}var Ds=["Stereographic_North_Pole","Oblique_Stereographic","Polar_Stereographic","sterea","Oblique Stereographic Alternative","Double_Stereographic"],oh={init:Ca,forward:hl,inverse:sh,names:Ds};function ah(o,u,h){return u*=h,Math.tan(.5*(a+o))*Math.pow((1-u)/(1+u),.5*h)}function fl(){this.coslat0=Math.cos(this.lat0),this.sinlat0=Math.sin(this.lat0),this.sphere?this.k0===1&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=m&&(this.k0=.5*(1+fr(this.lat0)*Math.sin(this.lat_ts))):(Math.abs(this.coslat0)<=m&&(this.lat0>0?this.con=1:this.con=-1),this.cons=Math.sqrt(Math.pow(1+this.e,1+this.e)*Math.pow(1-this.e,1-this.e)),this.k0===1&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=m&&(this.k0=.5*this.cons*Nt(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/Ct(this.e,this.con*this.lat_ts,this.con*Math.sin(this.lat_ts))),this.ms1=Nt(this.e,this.sinlat0,this.coslat0),this.X0=2*Math.atan(this.ssfn_(this.lat0,this.sinlat0,this.e))-a,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))}function lh(o){var u=o.x,h=o.y,y=Math.sin(h),g=Math.cos(h),_,M,E,P,k,D,N=Z(u-this.long0);return Math.abs(Math.abs(u-this.long0)-Math.PI)<=m&&Math.abs(h+this.lat0)<=m?(o.x=NaN,o.y=NaN,o):this.sphere?(_=2*this.k0/(1+this.sinlat0*y+this.coslat0*g*Math.cos(N)),o.x=this.a*_*g*Math.sin(N)+this.x0,o.y=this.a*_*(this.coslat0*y-this.sinlat0*g*Math.cos(N))+this.y0,o):(M=2*Math.atan(this.ssfn_(h,y,this.e))-a,P=Math.cos(M),E=Math.sin(M),Math.abs(this.coslat0)<=m?(k=Ct(this.e,h*this.con,this.con*y),D=2*this.a*this.k0*k/this.cons,o.x=this.x0+D*Math.sin(u-this.long0),o.y=this.y0-this.con*D*Math.cos(u-this.long0),o):(Math.abs(this.sinlat0)<m?(_=2*this.a*this.k0/(1+P*Math.cos(N)),o.y=_*E):(_=2*this.a*this.k0*this.ms1/(this.cosX0*(1+this.sinX0*E+this.cosX0*P*Math.cos(N))),o.y=_*(this.cosX0*E-this.sinX0*P*Math.cos(N))+this.y0),o.x=_*P*Math.sin(N)+this.x0,o))}function Bs(o){o.x-=this.x0,o.y-=this.y0;var u,h,y,g,_,M=Math.sqrt(o.x*o.x+o.y*o.y);if(this.sphere){var E=2*Math.atan(M/(2*this.a*this.k0));return u=this.long0,h=this.lat0,M<=m?(o.x=u,o.y=h,o):(h=Math.asin(Math.cos(E)*this.sinlat0+o.y*Math.sin(E)*this.coslat0/M),Math.abs(this.coslat0)<m?this.lat0>0?u=Z(this.long0+Math.atan2(o.x,-1*o.y)):u=Z(this.long0+Math.atan2(o.x,o.y)):u=Z(this.long0+Math.atan2(o.x*Math.sin(E),M*this.coslat0*Math.cos(E)-o.y*this.sinlat0*Math.sin(E))),o.x=u,o.y=h,o)}else if(Math.abs(this.coslat0)<=m){if(M<=m)return h=this.lat0,u=this.long0,o.x=u,o.y=h,o;o.x*=this.con,o.y*=this.con,y=M*this.cons/(2*this.a*this.k0),h=this.con*Hr(this.e,y),u=this.con*Z(this.con*this.long0+Math.atan2(o.x,-1*o.y))}else g=2*Math.atan(M*this.cosX0/(2*this.a*this.k0*this.ms1)),u=this.long0,M<=m?_=this.X0:(_=Math.asin(Math.cos(g)*this.sinX0+o.y*Math.sin(g)*this.cosX0/M),u=Z(this.long0+Math.atan2(o.x*Math.sin(g),M*this.cosX0*Math.cos(g)-o.y*this.sinX0*Math.sin(g)))),h=-1*Hr(this.e,Math.tan(.5*(a+_)));return o.x=u,o.y=h,o}var Aa=["stere","Stereographic_South_Pole","Polar Stereographic (variant B)"],uh={init:fl,forward:lh,inverse:Bs,names:Aa,ssfn_:ah};function ch(){var o=this.lat0;this.lambda0=this.long0;var u=Math.sin(o),h=this.a,y=this.rf,g=1/y,_=2*g-Math.pow(g,2),M=this.e=Math.sqrt(_);this.R=this.k0*h*Math.sqrt(1-_)/(1-_*Math.pow(u,2)),this.alpha=Math.sqrt(1+_/(1-_)*Math.pow(Math.cos(o),4)),this.b0=Math.asin(u/this.alpha);var E=Math.log(Math.tan(Math.PI/4+this.b0/2)),P=Math.log(Math.tan(Math.PI/4+o/2)),k=Math.log((1+M*u)/(1-M*u));this.K=E-this.alpha*P+this.alpha*M/2*k}function Pa(o){var u=Math.log(Math.tan(Math.PI/4-o.y/2)),h=this.e/2*Math.log((1+this.e*Math.sin(o.y))/(1-this.e*Math.sin(o.y))),y=-this.alpha*(u+h)+this.K,g=2*(Math.atan(Math.exp(y))-Math.PI/4),_=this.alpha*(o.x-this.lambda0),M=Math.atan(Math.sin(_)/(Math.sin(this.b0)*Math.tan(g)+Math.cos(this.b0)*Math.cos(_))),E=Math.asin(Math.cos(this.b0)*Math.sin(g)-Math.sin(this.b0)*Math.cos(g)*Math.cos(_));return o.y=this.R/2*Math.log((1+Math.sin(E))/(1-Math.sin(E)))+this.y0,o.x=this.R*M+this.x0,o}function dl(o){for(var u=o.x-this.x0,h=o.y-this.y0,y=u/this.R,g=2*(Math.atan(Math.exp(h/this.R))-Math.PI/4),_=Math.asin(Math.cos(this.b0)*Math.sin(g)+Math.sin(this.b0)*Math.cos(g)*Math.cos(y)),M=Math.atan(Math.sin(y)/(Math.cos(this.b0)*Math.cos(y)-Math.sin(this.b0)*Math.tan(g))),E=this.lambda0+M/this.alpha,P=0,k=_,D=-1e3,N=0;Math.abs(k-D)>1e-7;){if(++N>20)return;P=1/this.alpha*(Math.log(Math.tan(Math.PI/4+_/2))-this.K)+this.e*Math.log(Math.tan(Math.PI/4+Math.asin(this.e*Math.sin(k))/2)),D=k,k=2*Math.atan(Math.exp(P))-Math.PI/2}return o.x=E,o.y=k,o}var zs=["somerc"],Ta={init:ch,forward:Pa,inverse:dl,names:zs};function Ri(){this.no_off=this.no_off||!1,this.no_rot=this.no_rot||!1,isNaN(this.k0)&&(this.k0=1);var o=Math.sin(this.lat0),u=Math.cos(this.lat0),h=this.e*o;this.bl=Math.sqrt(1+this.es/(1-this.es)*Math.pow(u,4)),this.al=this.a*this.bl*this.k0*Math.sqrt(1-this.es)/(1-h*h);var y=Ct(this.e,this.lat0,o),g=this.bl/u*Math.sqrt((1-this.es)/(1-h*h));g*g<1&&(g=1);var _,M;if(!isNaN(this.longc))this.lat0>=0?_=g+Math.sqrt(g*g-1):_=g-Math.sqrt(g*g-1),this.el=_*Math.pow(y,this.bl),M=.5*(_-1/_),this.gamma0=Math.asin(Math.sin(this.alpha)/g),this.long0=this.longc-Math.asin(M*Math.tan(this.gamma0))/this.bl;else{var E=Ct(this.e,this.lat1,Math.sin(this.lat1)),P=Ct(this.e,this.lat2,Math.sin(this.lat2));this.lat0>=0?this.el=(g+Math.sqrt(g*g-1))*Math.pow(y,this.bl):this.el=(g-Math.sqrt(g*g-1))*Math.pow(y,this.bl);var k=Math.pow(E,this.bl),D=Math.pow(P,this.bl);_=this.el/k,M=.5*(_-1/_);var N=(this.el*this.el-D*k)/(this.el*this.el+D*k),q=(D-k)/(D+k),F=Z(this.long1-this.long2);this.long0=.5*(this.long1+this.long2)-Math.atan(N*Math.tan(.5*this.bl*F)/q)/this.bl,this.long0=Z(this.long0);var W=Z(this.long1-this.long0);this.gamma0=Math.atan(Math.sin(this.bl*W)/M),this.alpha=Math.asin(g*Math.sin(this.gamma0))}this.no_off?this.uc=0:this.lat0>=0?this.uc=this.al/this.bl*Math.atan2(Math.sqrt(g*g-1),Math.cos(this.alpha)):this.uc=-1*this.al/this.bl*Math.atan2(Math.sqrt(g*g-1),Math.cos(this.alpha))}function jn(o){var u=o.x,h=o.y,y=Z(u-this.long0),g,_,M;if(Math.abs(Math.abs(h)-a)<=m)h>0?M=-1:M=1,_=this.al/this.bl*Math.log(Math.tan(v+M*this.gamma0*.5)),g=-1*M*a*this.al/this.bl;else{var E=Ct(this.e,h,Math.sin(h)),P=this.el/Math.pow(E,this.bl),k=.5*(P-1/P),D=.5*(P+1/P),N=Math.sin(this.bl*y),q=(k*Math.sin(this.gamma0)-N*Math.cos(this.gamma0))/D;Math.abs(Math.abs(q)-1)<=m?_=Number.POSITIVE_INFINITY:_=.5*this.al*Math.log((1-q)/(1+q))/this.bl,Math.abs(Math.cos(this.bl*y))<=m?g=this.al*this.bl*y:g=this.al*Math.atan2(k*Math.cos(this.gamma0)+N*Math.sin(this.gamma0),Math.cos(this.bl*y))/this.bl}return this.no_rot?(o.x=this.x0+g,o.y=this.y0+_):(g-=this.uc,o.x=this.x0+_*Math.cos(this.alpha)+g*Math.sin(this.alpha),o.y=this.y0+g*Math.cos(this.alpha)-_*Math.sin(this.alpha)),o}function js(o){var u,h;this.no_rot?(h=o.y-this.y0,u=o.x-this.x0):(h=(o.x-this.x0)*Math.cos(this.alpha)-(o.y-this.y0)*Math.sin(this.alpha),u=(o.y-this.y0)*Math.cos(this.alpha)+(o.x-this.x0)*Math.sin(this.alpha),u+=this.uc);var y=Math.exp(-1*this.bl*h/this.al),g=.5*(y-1/y),_=.5*(y+1/y),M=Math.sin(this.bl*u/this.al),E=(M*Math.cos(this.gamma0)+g*Math.sin(this.gamma0))/_,P=Math.pow(this.el/Math.sqrt((1+E)/(1-E)),1/this.bl);return Math.abs(E-1)<m?(o.x=this.long0,o.y=a):Math.abs(E+1)<m?(o.x=this.long0,o.y=-1*a):(o.y=Hr(this.e,P),o.x=Z(this.long0-Math.atan2(g*Math.cos(this.gamma0)-M*Math.sin(this.gamma0),Math.cos(this.bl*u/this.al))/this.bl)),o}var pl=["Hotine_Oblique_Mercator","Hotine Oblique Mercator","Hotine_Oblique_Mercator_Azimuth_Natural_Origin","Hotine_Oblique_Mercator_Azimuth_Center","omerc"],hh={init:Ri,forward:jn,inverse:js,names:pl};function Ia(){if(this.lat2||(this.lat2=this.lat1),this.k0||(this.k0=1),this.x0=this.x0||0,this.y0=this.y0||0,!(Math.abs(this.lat1+this.lat2)<m)){var o=this.b/this.a;this.e=Math.sqrt(1-o*o);var u=Math.sin(this.lat1),h=Math.cos(this.lat1),y=Nt(this.e,u,h),g=Ct(this.e,this.lat1,u),_=Math.sin(this.lat2),M=Math.cos(this.lat2),E=Nt(this.e,_,M),P=Ct(this.e,this.lat2,_),k=Ct(this.e,this.lat0,Math.sin(this.lat0));Math.abs(this.lat1-this.lat2)>m?this.ns=Math.log(y/E)/Math.log(g/P):this.ns=u,isNaN(this.ns)&&(this.ns=u),this.f0=y/(this.ns*Math.pow(g,this.ns)),this.rh=this.a*this.f0*Math.pow(k,this.ns),this.title||(this.title="Lambert Conformal Conic")}}function fh(o){var u=o.x,h=o.y;Math.abs(2*Math.abs(h)-Math.PI)<=m&&(h=fr(h)*(a-2*m));var y=Math.abs(Math.abs(h)-a),g,_;if(y>m)g=Ct(this.e,h,Math.sin(h)),_=this.a*this.f0*Math.pow(g,this.ns);else{if(y=h*this.ns,y<=0)return null;_=0}var M=this.ns*Z(u-this.long0);return o.x=this.k0*(_*Math.sin(M))+this.x0,o.y=this.k0*(this.rh-_*Math.cos(M))+this.y0,o}function ml(o){var u,h,y,g,_,M=(o.x-this.x0)/this.k0,E=this.rh-(o.y-this.y0)/this.k0;this.ns>0?(u=Math.sqrt(M*M+E*E),h=1):(u=-Math.sqrt(M*M+E*E),h=-1);var P=0;if(u!==0&&(P=Math.atan2(h*M,h*E)),u!==0||this.ns>0){if(h=1/this.ns,y=Math.pow(u/(this.a*this.f0),h),g=Hr(this.e,y),g===-9999)return null}else g=-a;return _=Z(P/this.ns+this.long0),o.x=_,o.y=g,o}var qs=["Lambert Tangential Conformal Conic Projection","Lambert_Conformal_Conic","Lambert_Conformal_Conic_2SP","lcc"],ka={init:Ia,forward:fh,inverse:ml,names:qs};function gl(){this.a=6377397155e-3,this.es=.006674372230614,this.e=Math.sqrt(this.es),this.lat0||(this.lat0=.863937979737193),this.long0||(this.long0=.7417649320975901-.308341501185665),this.k0||(this.k0=.9999),this.s45=.785398163397448,this.s90=2*this.s45,this.fi0=this.lat0,this.e2=this.es,this.e=Math.sqrt(this.e2),this.alfa=Math.sqrt(1+this.e2*Math.pow(Math.cos(this.fi0),4)/(1-this.e2)),this.uq=1.04216856380474,this.u0=Math.asin(Math.sin(this.fi0)/this.alfa),this.g=Math.pow((1+this.e*Math.sin(this.fi0))/(1-this.e*Math.sin(this.fi0)),this.alfa*this.e/2),this.k=Math.tan(this.u0/2+this.s45)/Math.pow(Math.tan(this.fi0/2+this.s45),this.alfa)*this.g,this.k1=this.k0,this.n0=this.a*Math.sqrt(1-this.e2)/(1-this.e2*Math.pow(Math.sin(this.fi0),2)),this.s0=1.37008346281555,this.n=Math.sin(this.s0),this.ro0=this.k1*this.n0/Math.tan(this.s0),this.ad=this.s90-this.uq}function yl(o){var u,h,y,g,_,M,E,P=o.x,k=o.y,D=Z(P-this.long0);return u=Math.pow((1+this.e*Math.sin(k))/(1-this.e*Math.sin(k)),this.alfa*this.e/2),h=2*(Math.atan(this.k*Math.pow(Math.tan(k/2+this.s45),this.alfa)/u)-this.s45),y=-D*this.alfa,g=Math.asin(Math.cos(this.ad)*Math.sin(h)+Math.sin(this.ad)*Math.cos(h)*Math.cos(y)),_=Math.asin(Math.cos(h)*Math.sin(y)/Math.cos(g)),M=this.n*_,E=this.ro0*Math.pow(Math.tan(this.s0/2+this.s45),this.n)/Math.pow(Math.tan(g/2+this.s45),this.n),o.y=E*Math.cos(M)/1,o.x=E*Math.sin(M)/1,this.czech||(o.y*=-1,o.x*=-1),o}function dh(o){var u,h,y,g,_,M,E,P,k=o.x;o.x=o.y,o.y=k,this.czech||(o.y*=-1,o.x*=-1),M=Math.sqrt(o.x*o.x+o.y*o.y),_=Math.atan2(o.y,o.x),g=_/Math.sin(this.s0),y=2*(Math.atan(Math.pow(this.ro0/M,1/this.n)*Math.tan(this.s0/2+this.s45))-this.s45),u=Math.asin(Math.cos(this.ad)*Math.sin(y)-Math.sin(this.ad)*Math.cos(y)*Math.cos(g)),h=Math.asin(Math.cos(y)*Math.sin(g)/Math.cos(u)),o.x=this.long0-h/this.alfa,E=u,P=0;var D=0;do o.y=2*(Math.atan(Math.pow(this.k,-1/this.alfa)*Math.pow(Math.tan(u/2+this.s45),1/this.alfa)*Math.pow((1+this.e*Math.sin(E))/(1-this.e*Math.sin(E)),this.e/2))-this.s45),Math.abs(E-o.y)<1e-10&&(P=1),E=o.y,D+=1;while(P===0&&D<15);return D>=15?null:o}var ph=["Krovak","krovak"],Oa={init:gl,forward:yl,inverse:dh,names:ph},ht=function(o,u,h,y,g){return o*g-u*Math.sin(2*g)+h*Math.sin(4*g)-y*Math.sin(6*g)},qn=function(o){return 1-.25*o*(1+o/16*(3+1.25*o))},Un=function(o){return .375*o*(1+.25*o*(1+.46875*o))},$n=function(o){return .05859375*o*o*(1+.75*o)},Yi=function(o){return o*o*o*(35/3072)},Xt=function(o,u,h){var y=u*h;return o/Math.sqrt(1-y*y)},kr=function(o){return Math.abs(o)<a?o:o-fr(o)*Math.PI},Zr=function(o,u,h,y,g){var _,M;_=o/u;for(var E=0;E<15;E++)if(M=(o-(u*_-h*Math.sin(2*_)+y*Math.sin(4*_)-g*Math.sin(6*_)))/(u-2*h*Math.cos(2*_)+4*y*Math.cos(4*_)-6*g*Math.cos(6*_)),_+=M,Math.abs(M)<=1e-10)return _;return NaN};function bl(){this.sphere||(this.e0=qn(this.es),this.e1=Un(this.es),this.e2=$n(this.es),this.e3=Yi(this.es),this.ml0=this.a*ht(this.e0,this.e1,this.e2,this.e3,this.lat0))}function Us(o){var u,h,y=o.x,g=o.y;if(y=Z(y-this.long0),this.sphere)u=this.a*Math.asin(Math.cos(g)*Math.sin(y)),h=this.a*(Math.atan2(Math.tan(g),Math.cos(y))-this.lat0);else{var _=Math.sin(g),M=Math.cos(g),E=Xt(this.a,this.e,_),P=Math.tan(g)*Math.tan(g),k=y*Math.cos(g),D=k*k,N=this.es*M*M/(1-this.es),q=this.a*ht(this.e0,this.e1,this.e2,this.e3,g);u=E*k*(1-D*P*(1/6-(8-P+8*N)*D/120)),h=q-this.ml0+E*_/M*D*(.5+(5-P+6*N)*D/24)}return o.x=u+this.x0,o.y=h+this.y0,o}function Wn(o){o.x-=this.x0,o.y-=this.y0;var u=o.x/this.a,h=o.y/this.a,y,g;if(this.sphere){var _=h+this.lat0;y=Math.asin(Math.sin(_)*Math.cos(u)),g=Math.atan2(Math.tan(u),Math.cos(_))}else{var M=this.ml0/this.a+h,E=Zr(M,this.e0,this.e1,this.e2,this.e3);if(Math.abs(Math.abs(E)-a)<=m)return o.x=this.long0,o.y=a,h<0&&(o.y*=-1),o;var P=Xt(this.a,this.e,Math.sin(E)),k=P*P*P/this.a/this.a*(1-this.es),D=Math.pow(Math.tan(E),2),N=u*this.a/P,q=N*N;y=E-P*Math.tan(E)/k*N*N*(.5-(1+3*D)*N*N/24),g=N*(1-q*(D/3+(1+3*D)*D*q/15))/Math.cos(E)}return o.x=Z(g+this.long0),o.y=kr(y),o}var $s=["Cassini","Cassini_Soldner","cass"],Jr={init:bl,forward:Us,inverse:Wn,names:$s},pr=function(o,u){var h;return o>1e-7?(h=o*u,(1-o*o)*(u/(1-h*h)-.5/o*Math.log((1-h)/(1+h)))):2*u},mh=1,Xi=2,vl=3,gh=4;function Ws(){var o=Math.abs(this.lat0);if(Math.abs(o-a)<m?this.mode=this.lat0<0?this.S_POLE:this.N_POLE:Math.abs(o)<m?this.mode=this.EQUIT:this.mode=this.OBLIQ,this.es>0){var u;switch(this.qp=pr(this.e,1),this.mmf=.5/(1-this.es),this.apa=Eh(this.es),this.mode){case this.N_POLE:this.dd=1;break;case this.S_POLE:this.dd=1;break;case this.EQUIT:this.rq=Math.sqrt(.5*this.qp),this.dd=1/this.rq,this.xmf=1,this.ymf=.5*this.qp;break;case this.OBLIQ:this.rq=Math.sqrt(.5*this.qp),u=Math.sin(this.lat0),this.sinb1=pr(this.e,u)/this.qp,this.cosb1=Math.sqrt(1-this.sinb1*this.sinb1),this.dd=Math.cos(this.lat0)/(Math.sqrt(1-this.es*u*u)*this.rq*this.cosb1),this.ymf=(this.xmf=this.rq)/this.dd,this.xmf*=this.dd;break}}else this.mode===this.OBLIQ&&(this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0))}function yh(o){var u,h,y,g,_,M,E,P,k,D,N=o.x,q=o.y;if(N=Z(N-this.long0),this.sphere){if(_=Math.sin(q),D=Math.cos(q),y=Math.cos(N),this.mode===this.OBLIQ||this.mode===this.EQUIT){if(h=this.mode===this.EQUIT?1+D*y:1+this.sinph0*_+this.cosph0*D*y,h<=m)return null;h=Math.sqrt(2/h),u=h*D*Math.sin(N),h*=this.mode===this.EQUIT?_:this.cosph0*_-this.sinph0*D*y}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(y=-y),Math.abs(q+this.lat0)<m)return null;h=v-q*.5,h=2*(this.mode===this.S_POLE?Math.cos(h):Math.sin(h)),u=h*Math.sin(N),h*=y}}else{switch(E=0,P=0,k=0,y=Math.cos(N),g=Math.sin(N),_=Math.sin(q),M=pr(this.e,_),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(E=M/this.qp,P=Math.sqrt(1-E*E)),this.mode){case this.OBLIQ:k=1+this.sinb1*E+this.cosb1*P*y;break;case this.EQUIT:k=1+P*y;break;case this.N_POLE:k=a+q,M=this.qp-M;break;case this.S_POLE:k=q-a,M=this.qp+M;break}if(Math.abs(k)<m)return null;switch(this.mode){case this.OBLIQ:case this.EQUIT:k=Math.sqrt(2/k),this.mode===this.OBLIQ?h=this.ymf*k*(this.cosb1*E-this.sinb1*P*y):h=(k=Math.sqrt(2/(1+P*y)))*E*this.ymf,u=this.xmf*k*P*g;break;case this.N_POLE:case this.S_POLE:M>=0?(u=(k=Math.sqrt(M))*g,h=y*(this.mode===this.S_POLE?k:-k)):u=h=0;break}}return o.x=this.a*u+this.x0,o.y=this.a*h+this.y0,o}function bh(o){o.x-=this.x0,o.y-=this.y0;var u=o.x/this.a,h=o.y/this.a,y,g,_,M,E,P,k;if(this.sphere){var D=0,N,q=0;if(N=Math.sqrt(u*u+h*h),g=N*.5,g>1)return null;switch(g=2*Math.asin(g),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(q=Math.sin(g),D=Math.cos(g)),this.mode){case this.EQUIT:g=Math.abs(N)<=m?0:Math.asin(h*q/N),u*=q,h=D*N;break;case this.OBLIQ:g=Math.abs(N)<=m?this.lat0:Math.asin(D*this.sinph0+h*q*this.cosph0/N),u*=q*this.cosph0,h=(D-Math.sin(g)*this.sinph0)*N;break;case this.N_POLE:h=-h,g=a-g;break;case this.S_POLE:g-=a;break}y=h===0&&(this.mode===this.EQUIT||this.mode===this.OBLIQ)?0:Math.atan2(u,h)}else{if(k=0,this.mode===this.OBLIQ||this.mode===this.EQUIT){if(u/=this.dd,h*=this.dd,P=Math.sqrt(u*u+h*h),P<m)return o.x=this.long0,o.y=this.lat0,o;M=2*Math.asin(.5*P/this.rq),_=Math.cos(M),u*=M=Math.sin(M),this.mode===this.OBLIQ?(k=_*this.sinb1+h*M*this.cosb1/P,E=this.qp*k,h=P*this.cosb1*_-h*this.sinb1*M):(k=h*M/P,E=this.qp*k,h=P*_)}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(h=-h),E=u*u+h*h,!E)return o.x=this.long0,o.y=this.lat0,o;k=1-E/this.qp,this.mode===this.S_POLE&&(k=-k)}y=Math.atan2(u,h),g=Rh(Math.asin(k),this.apa)}return o.x=Z(this.long0+y),o.y=g,o}var vh=.3333333333333333,wh=.17222222222222222,_h=.10257936507936508,Sh=.06388888888888888,xh=.0664021164021164,Mh=.016415012942191543;function Eh(o){var u,h=[];return h[0]=o*vh,u=o*o,h[0]+=u*wh,h[1]=u*Sh,u*=o,h[0]+=u*_h,h[1]+=u*xh,h[2]=u*Mh,h}function Rh(o,u){var h=o+o;return o+u[0]*Math.sin(h)+u[1]*Math.sin(h+h)+u[2]*Math.sin(h+h+h)}var Ch=["Lambert Azimuthal Equal Area","Lambert_Azimuthal_Equal_Area","laea"],wl={init:Ws,forward:yh,inverse:bh,names:Ch,S_POLE:mh,N_POLE:Xi,EQUIT:vl,OBLIQ:gh},Yr=function(o){return Math.abs(o)>1&&(o=o>1?1:-1),Math.asin(o)};function Ah(){Math.abs(this.lat1+this.lat2)<m||(this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e3=Math.sqrt(this.es),this.sin_po=Math.sin(this.lat1),this.cos_po=Math.cos(this.lat1),this.t1=this.sin_po,this.con=this.sin_po,this.ms1=Nt(this.e3,this.sin_po,this.cos_po),this.qs1=pr(this.e3,this.sin_po,this.cos_po),this.sin_po=Math.sin(this.lat2),this.cos_po=Math.cos(this.lat2),this.t2=this.sin_po,this.ms2=Nt(this.e3,this.sin_po,this.cos_po),this.qs2=pr(this.e3,this.sin_po,this.cos_po),this.sin_po=Math.sin(this.lat0),this.cos_po=Math.cos(this.lat0),this.t3=this.sin_po,this.qs0=pr(this.e3,this.sin_po,this.cos_po),Math.abs(this.lat1-this.lat2)>m?this.ns0=(this.ms1*this.ms1-this.ms2*this.ms2)/(this.qs2-this.qs1):this.ns0=this.con,this.c=this.ms1*this.ms1+this.ns0*this.qs1,this.rh=this.a*Math.sqrt(this.c-this.ns0*this.qs0)/this.ns0)}function Xr(o){var u=o.x,h=o.y;this.sin_phi=Math.sin(h),this.cos_phi=Math.cos(h);var y=pr(this.e3,this.sin_phi,this.cos_phi),g=this.a*Math.sqrt(this.c-this.ns0*y)/this.ns0,_=this.ns0*Z(u-this.long0),M=g*Math.sin(_)+this.x0,E=this.rh-g*Math.cos(_)+this.y0;return o.x=M,o.y=E,o}function La(o){var u,h,y,g,_,M;return o.x-=this.x0,o.y=this.rh-o.y+this.y0,this.ns0>=0?(u=Math.sqrt(o.x*o.x+o.y*o.y),y=1):(u=-Math.sqrt(o.x*o.x+o.y*o.y),y=-1),g=0,u!==0&&(g=Math.atan2(y*o.x,y*o.y)),y=u*this.ns0/this.a,this.sphere?M=Math.asin((this.c-y*y)/(2*this.ns0)):(h=(this.c-y*y)/this.ns0,M=this.phi1z(this.e3,h)),_=Z(g/this.ns0+this.long0),o.x=_,o.y=M,o}function _l(o,u){var h,y,g,_,M,E=Yr(.5*u);if(o<m)return E;for(var P=o*o,k=1;k<=25;k++)if(h=Math.sin(E),y=Math.cos(E),g=o*h,_=1-g*g,M=.5*_*_/y*(u/(1-P)-h/_+.5/o*Math.log((1-g)/(1+g))),E=E+M,Math.abs(M)<=1e-7)return E;return null}var Na=["Albers_Conic_Equal_Area","Albers","aea"],Qr={init:Ah,forward:Xr,inverse:La,names:Na,phi1z:_l};function ei(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0),this.infinity_dist=1e3*this.a,this.rc=1}function Qt(o){var u,h,y,g,_,M,E,P,k=o.x,D=o.y;return y=Z(k-this.long0),u=Math.sin(D),h=Math.cos(D),g=Math.cos(y),M=this.sin_p14*u+this.cos_p14*h*g,_=1,M>0||Math.abs(M)<=m?(E=this.x0+this.a*_*h*Math.sin(y)/M,P=this.y0+this.a*_*(this.cos_p14*u-this.sin_p14*h*g)/M):(E=this.x0+this.infinity_dist*h*Math.sin(y),P=this.y0+this.infinity_dist*(this.cos_p14*u-this.sin_p14*h*g)),o.x=E,o.y=P,o}function Fn(o){var u,h,y,g,_,M;return o.x=(o.x-this.x0)/this.a,o.y=(o.y-this.y0)/this.a,o.x/=this.k0,o.y/=this.k0,(u=Math.sqrt(o.x*o.x+o.y*o.y))?(g=Math.atan2(u,this.rc),h=Math.sin(g),y=Math.cos(g),M=Yr(y*this.sin_p14+o.y*h*this.cos_p14/u),_=Math.atan2(o.x*h,u*this.cos_p14*y-o.y*this.sin_p14*h),_=Z(this.long0+_)):(M=this.phic0,_=0),o.x=_,o.y=M,o}var Sl=["gnom"],Ci={init:ei,forward:Qt,inverse:Fn,names:Sl},xl=function(o,u){var h=1-(1-o*o)/(2*o)*Math.log((1-o)/(1+o));if(Math.abs(Math.abs(u)-h)<1e-6)return u<0?-1*a:a;for(var y=Math.asin(.5*u),g,_,M,E,P=0;P<30;P++)if(_=Math.sin(y),M=Math.cos(y),E=o*_,g=Math.pow(1-E*E,2)/(2*M)*(u/(1-o*o)-_/(1-E*E)+.5/o*Math.log((1-E)/(1+E))),y+=g,Math.abs(g)<=1e-10)return y;return NaN};function Ml(){this.sphere||(this.k0=Nt(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))}function Fs(o){var u=o.x,h=o.y,y,g,_=Z(u-this.long0);if(this.sphere)y=this.x0+this.a*_*Math.cos(this.lat_ts),g=this.y0+this.a*Math.sin(h)/Math.cos(this.lat_ts);else{var M=pr(this.e,Math.sin(h));y=this.x0+this.a*this.k0*_,g=this.y0+this.a*M*.5/this.k0}return o.x=y,o.y=g,o}function El(o){o.x-=this.x0,o.y-=this.y0;var u,h;return this.sphere?(u=Z(this.long0+o.x/this.a/Math.cos(this.lat_ts)),h=Math.asin(o.y/this.a*Math.cos(this.lat_ts))):(h=xl(this.e,2*o.y*this.k0/this.a),u=Z(this.long0+o.x/(this.a*this.k0))),o.x=u,o.y=h,o}var Rl=["cea"],Cl={init:Ml,forward:Fs,inverse:El,names:Rl};function Hs(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Equidistant Cylindrical (Plate Carre)",this.rc=Math.cos(this.lat_ts)}function Al(o){var u=o.x,h=o.y,y=Z(u-this.long0),g=kr(h-this.lat0);return o.x=this.x0+this.a*y*this.rc,o.y=this.y0+this.a*g,o}function Pl(o){var u=o.x,h=o.y;return o.x=Z(this.long0+(u-this.x0)/(this.a*this.rc)),o.y=kr(this.lat0+(h-this.y0)/this.a),o}var Ph=["Equirectangular","Equidistant_Cylindrical","eqc"],Th={init:Hs,forward:Al,inverse:Pl,names:Ph},Tl=20;function Ih(){this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=qn(this.es),this.e1=Un(this.es),this.e2=$n(this.es),this.e3=Yi(this.es),this.ml0=this.a*ht(this.e0,this.e1,this.e2,this.e3,this.lat0)}function Gs(o){var u=o.x,h=o.y,y,g,_,M=Z(u-this.long0);if(_=M*Math.sin(h),this.sphere)Math.abs(h)<=m?(y=this.a*M,g=-1*this.a*this.lat0):(y=this.a*Math.sin(_)/Math.tan(h),g=this.a*(kr(h-this.lat0)+(1-Math.cos(_))/Math.tan(h)));else if(Math.abs(h)<=m)y=this.a*M,g=-1*this.ml0;else{var E=Xt(this.a,this.e,Math.sin(h))/Math.tan(h);y=E*Math.sin(_),g=this.a*ht(this.e0,this.e1,this.e2,this.e3,h)-this.ml0+E*(1-Math.cos(_))}return o.x=y+this.x0,o.y=g+this.y0,o}function kh(o){var u,h,y,g,_,M,E,P,k;if(y=o.x-this.x0,g=o.y-this.y0,this.sphere)if(Math.abs(g+this.a*this.lat0)<=m)u=Z(y/this.a+this.long0),h=0;else{M=this.lat0+g/this.a,E=y*y/this.a/this.a+M*M,P=M;var D;for(_=Tl;_;--_)if(D=Math.tan(P),k=-1*(M*(P*D+1)-P-.5*(P*P+E)*D)/((P-M)/D-1),P+=k,Math.abs(k)<=m){h=P;break}u=Z(this.long0+Math.asin(y*Math.tan(P)/this.a)/Math.sin(h))}else if(Math.abs(g+this.ml0)<=m)h=0,u=Z(this.long0+y/this.a);else{M=(this.ml0+g)/this.a,E=y*y/this.a/this.a+M*M,P=M;var N,q,F,W,V;for(_=Tl;_;--_)if(V=this.e*Math.sin(P),N=Math.sqrt(1-V*V)*Math.tan(P),q=this.a*ht(this.e0,this.e1,this.e2,this.e3,P),F=this.e0-2*this.e1*Math.cos(2*P)+4*this.e2*Math.cos(4*P)-6*this.e3*Math.cos(6*P),W=q/this.a,k=(M*(N*W+1)-W-.5*N*(W*W+E))/(this.es*Math.sin(2*P)*(W*W+E-2*M*W)/(4*N)+(M-W)*(N*F-2/Math.sin(2*P))-F),P-=k,Math.abs(k)<=m){h=P;break}N=Math.sqrt(1-this.es*Math.pow(Math.sin(h),2))*Math.tan(h),u=Z(this.long0+Math.asin(y*N/this.a)/Math.sin(h))}return o.x=u,o.y=h,o}var Il=["Polyconic","poly"],Vs={init:Ih,forward:Gs,inverse:kh,names:Il};function Ks(){this.A=[],this.A[1]=.6399175073,this.A[2]=-.1358797613,this.A[3]=.063294409,this.A[4]=-.02526853,this.A[5]=.0117879,this.A[6]=-.0055161,this.A[7]=.0026906,this.A[8]=-.001333,this.A[9]=67e-5,this.A[10]=-34e-5,this.B_re=[],this.B_im=[],this.B_re[1]=.7557853228,this.B_im[1]=0,this.B_re[2]=.249204646,this.B_im[2]=.003371507,this.B_re[3]=-.001541739,this.B_im[3]=.04105856,this.B_re[4]=-.10162907,this.B_im[4]=.01727609,this.B_re[5]=-.26623489,this.B_im[5]=-.36249218,this.B_re[6]=-.6870983,this.B_im[6]=-1.1651967,this.C_re=[],this.C_im=[],this.C_re[1]=1.3231270439,this.C_im[1]=0,this.C_re[2]=-.577245789,this.C_im[2]=-.007809598,this.C_re[3]=.508307513,this.C_im[3]=-.112208952,this.C_re[4]=-.15094762,this.C_im[4]=.18200602,this.C_re[5]=1.01418179,this.C_im[5]=1.64497696,this.C_re[6]=1.9660549,this.C_im[6]=2.5127645,this.D=[],this.D[1]=1.5627014243,this.D[2]=.5185406398,this.D[3]=-.03333098,this.D[4]=-.1052906,this.D[5]=-.0368594,this.D[6]=.007317,this.D[7]=.0122,this.D[8]=.00394,this.D[9]=-.0013}function Zs(o){var u,h=o.x,y=o.y,g=y-this.lat0,_=h-this.long0,M=g/s*1e-5,E=_,P=1,k=0;for(u=1;u<=10;u++)P=P*M,k=k+this.A[u]*P;var D=k,N=E,q=1,F=0,W,V,K=0,ae=0;for(u=1;u<=6;u++)W=q*D-F*N,V=F*D+q*N,q=W,F=V,K=K+this.B_re[u]*q-this.B_im[u]*F,ae=ae+this.B_im[u]*q+this.B_re[u]*F;return o.x=ae*this.a+this.x0,o.y=K*this.a+this.y0,o}function Hn(o){var u,h=o.x,y=o.y,g=h-this.x0,_=y-this.y0,M=_/this.a,E=g/this.a,P=1,k=0,D,N,q=0,F=0;for(u=1;u<=6;u++)D=P*M-k*E,N=k*M+P*E,P=D,k=N,q=q+this.C_re[u]*P-this.C_im[u]*k,F=F+this.C_im[u]*P+this.C_re[u]*k;for(var W=0;W<this.iterations;W++){var V=q,K=F,ae,pe,Oe=M,Ke=E;for(u=2;u<=6;u++)ae=V*q-K*F,pe=K*q+V*F,V=ae,K=pe,Oe=Oe+(u-1)*(this.B_re[u]*V-this.B_im[u]*K),Ke=Ke+(u-1)*(this.B_im[u]*V+this.B_re[u]*K);V=1,K=0;var Le=this.B_re[1],Be=this.B_im[1];for(u=2;u<=6;u++)ae=V*q-K*F,pe=K*q+V*F,V=ae,K=pe,Le=Le+u*(this.B_re[u]*V-this.B_im[u]*K),Be=Be+u*(this.B_im[u]*V+this.B_re[u]*K);var wt=Le*Le+Be*Be;q=(Oe*Le+Ke*Be)/wt,F=(Ke*Le-Oe*Be)/wt}var tt=q,ii=F,Vn=1,Kn=0;for(u=1;u<=9;u++)Vn=Vn*tt,Kn=Kn+this.D[u]*Vn;var Bl=this.lat0+Kn*s*1e5,kg=this.long0+ii;return o.x=kg,o.y=Bl,o}var Js=["New_Zealand_Map_Grid","nzmg"],Oh={init:Ks,forward:Zs,inverse:Hn,names:Js};function Lh(){}function kl(o){var u=o.x,h=o.y,y=Z(u-this.long0),g=this.x0+this.a*y,_=this.y0+this.a*Math.log(Math.tan(Math.PI/4+h/2.5))*1.25;return o.x=g,o.y=_,o}function Ol(o){o.x-=this.x0,o.y-=this.y0;var u=Z(this.long0+o.x/this.a),h=2.5*(Math.atan(Math.exp(.8*o.y/this.a))-Math.PI/4);return o.x=u,o.y=h,o}var Nh=["Miller_Cylindrical","mill"],Ll={init:Lh,forward:kl,inverse:Ol,names:Nh},Dh=20;function Bh(){this.sphere?(this.n=1,this.m=0,this.es=0,this.C_y=Math.sqrt((this.m+1)/this.n),this.C_x=this.C_y/(this.m+1)):this.en=Gi(this.es)}function zh(o){var u,h,y=o.x,g=o.y;if(y=Z(y-this.long0),this.sphere){if(!this.m)g=this.n!==1?Math.asin(this.n*Math.sin(g)):g;else for(var _=this.n*Math.sin(g),M=Dh;M;--M){var E=(this.m*g+Math.sin(g)-_)/(this.m+Math.cos(g));if(g-=E,Math.abs(E)<m)break}u=this.a*this.C_x*y*(this.m+Math.cos(g)),h=this.a*this.C_y*g}else{var P=Math.sin(g),k=Math.cos(g);h=this.a*Bn(g,P,k,this.en),u=this.a*y*k/Math.sqrt(1-this.es*P*P)}return o.x=u,o.y=h,o}function jh(o){var u,h,y,g;return o.x-=this.x0,y=o.x/this.a,o.y-=this.y0,u=o.y/this.a,this.sphere?(u/=this.C_y,y=y/(this.C_x*(this.m+Math.cos(u))),this.m?u=Yr((this.m*u+Math.sin(u))/this.n):this.n!==1&&(u=Yr(Math.sin(u)/this.n)),y=Z(y+this.long0),u=kr(u)):(u=xa(o.y/this.a,this.es,this.en),g=Math.abs(u),g<a?(g=Math.sin(u),h=this.long0+o.x*Math.sqrt(1-this.es*g*g)/(this.a*Math.cos(u)),y=Z(h)):g-m<a&&(y=this.long0)),o.x=y,o.y=u,o}var qh=["Sinusoidal","sinu"],Ys={init:Bh,forward:zh,inverse:jh,names:qh};function Nl(){}function l(o){for(var u=o.x,h=o.y,y=Z(u-this.long0),g=h,_=Math.PI*Math.sin(h);;){var M=-(g+Math.sin(g)-_)/(1+Math.cos(g));if(g+=M,Math.abs(M)<m)break}g/=2,Math.PI/2-Math.abs(h)<m&&(y=0);var E=.900316316158*this.a*y*Math.cos(g)+this.x0,P=1.4142135623731*this.a*Math.sin(g)+this.y0;return o.x=E,o.y=P,o}function f(o){var u,h;o.x-=this.x0,o.y-=this.y0,h=o.y/(1.4142135623731*this.a),Math.abs(h)>.999999999999&&(h=.999999999999),u=Math.asin(h);var y=Z(this.long0+o.x/(.900316316158*this.a*Math.cos(u)));y<-Math.PI&&(y=-Math.PI),y>Math.PI&&(y=Math.PI),h=(2*u+Math.sin(2*u))/Math.PI,Math.abs(h)>1&&(h=1);var g=Math.asin(h);return o.x=y,o.y=g,o}var b=["Mollweide","moll"],I={init:Nl,forward:l,inverse:f,names:b};function L(){Math.abs(this.lat1+this.lat2)<m||(this.lat2=this.lat2||this.lat1,this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=qn(this.es),this.e1=Un(this.es),this.e2=$n(this.es),this.e3=Yi(this.es),this.sinphi=Math.sin(this.lat1),this.cosphi=Math.cos(this.lat1),this.ms1=Nt(this.e,this.sinphi,this.cosphi),this.ml1=ht(this.e0,this.e1,this.e2,this.e3,this.lat1),Math.abs(this.lat1-this.lat2)<m?this.ns=this.sinphi:(this.sinphi=Math.sin(this.lat2),this.cosphi=Math.cos(this.lat2),this.ms2=Nt(this.e,this.sinphi,this.cosphi),this.ml2=ht(this.e0,this.e1,this.e2,this.e3,this.lat2),this.ns=(this.ms1-this.ms2)/(this.ml2-this.ml1)),this.g=this.ml1+this.ms1/this.ns,this.ml0=ht(this.e0,this.e1,this.e2,this.e3,this.lat0),this.rh=this.a*(this.g-this.ml0))}function j(o){var u=o.x,h=o.y,y;if(this.sphere)y=this.a*(this.g-h);else{var g=ht(this.e0,this.e1,this.e2,this.e3,h);y=this.a*(this.g-g)}var _=this.ns*Z(u-this.long0),M=this.x0+y*Math.sin(_),E=this.y0+this.rh-y*Math.cos(_);return o.x=M,o.y=E,o}function $(o){o.x-=this.x0,o.y=this.rh-o.y+this.y0;var u,h,y,g;this.ns>=0?(h=Math.sqrt(o.x*o.x+o.y*o.y),u=1):(h=-Math.sqrt(o.x*o.x+o.y*o.y),u=-1);var _=0;if(h!==0&&(_=Math.atan2(u*o.x,u*o.y)),this.sphere)return g=Z(this.long0+_/this.ns),y=kr(this.g-h/this.a),o.x=g,o.y=y,o;var M=this.g-h/this.a;return y=Zr(M,this.e0,this.e1,this.e2,this.e3),g=Z(this.long0+_/this.ns),o.x=g,o.y=y,o}var ee=["Equidistant_Conic","eqdc"],ce={init:L,forward:j,inverse:$,names:ee};function ve(){this.R=this.a}function Ce(o){var u=o.x,h=o.y,y=Z(u-this.long0),g,_;Math.abs(h)<=m&&(g=this.x0+this.R*y,_=this.y0);var M=Yr(2*Math.abs(h/Math.PI));(Math.abs(y)<=m||Math.abs(Math.abs(h)-a)<=m)&&(g=this.x0,h>=0?_=this.y0+Math.PI*this.R*Math.tan(.5*M):_=this.y0+Math.PI*this.R*-Math.tan(.5*M));var E=.5*Math.abs(Math.PI/y-y/Math.PI),P=E*E,k=Math.sin(M),D=Math.cos(M),N=D/(k+D-1),q=N*N,F=N*(2/k-1),W=F*F,V=Math.PI*this.R*(E*(N-W)+Math.sqrt(P*(N-W)*(N-W)-(W+P)*(q-W)))/(W+P);y<0&&(V=-V),g=this.x0+V;var K=P+N;return V=Math.PI*this.R*(F*K-E*Math.sqrt((W+P)*(P+1)-K*K))/(W+P),h>=0?_=this.y0+V:_=this.y0-V,o.x=g,o.y=_,o}function Ae(o){var u,h,y,g,_,M,E,P,k,D,N,q,F;return o.x-=this.x0,o.y-=this.y0,N=Math.PI*this.R,y=o.x/N,g=o.y/N,_=y*y+g*g,M=-Math.abs(g)*(1+_),E=M-2*g*g+y*y,P=-2*M+1+2*g*g+_*_,F=g*g/P+(2*E*E*E/P/P/P-9*M*E/P/P)/27,k=(M-E*E/3/P)/P,D=2*Math.sqrt(-k/3),N=3*F/k/D,Math.abs(N)>1&&(N>=0?N=1:N=-1),q=Math.acos(N)/3,o.y>=0?h=(-D*Math.cos(q+Math.PI/3)-E/3/P)*Math.PI:h=-(-D*Math.cos(q+Math.PI/3)-E/3/P)*Math.PI,Math.abs(y)<m?u=this.long0:u=Z(this.long0+Math.PI*(_-1+Math.sqrt(1+2*(y*y-g*g)+_*_))/2/y),o.x=u,o.y=h,o}var et=["Van_der_Grinten_I","VanDerGrinten","vandg"],er={init:ve,forward:Ce,inverse:Ae,names:et};function Qi(){this.sin_p12=Math.sin(this.lat0),this.cos_p12=Math.cos(this.lat0)}function ti(o){var u=o.x,h=o.y,y=Math.sin(o.y),g=Math.cos(o.y),_=Z(u-this.long0),M,E,P,k,D,N,q,F,W,V,K,ae,pe,Oe,Ke,Le,Be,wt,tt,ii,Vn,Kn,Bl;return this.sphere?Math.abs(this.sin_p12-1)<=m?(o.x=this.x0+this.a*(a-h)*Math.sin(_),o.y=this.y0-this.a*(a-h)*Math.cos(_),o):Math.abs(this.sin_p12+1)<=m?(o.x=this.x0+this.a*(a+h)*Math.sin(_),o.y=this.y0+this.a*(a+h)*Math.cos(_),o):(wt=this.sin_p12*y+this.cos_p12*g*Math.cos(_),Le=Math.acos(wt),Be=Le?Le/Math.sin(Le):1,o.x=this.x0+this.a*Be*g*Math.sin(_),o.y=this.y0+this.a*Be*(this.cos_p12*y-this.sin_p12*g*Math.cos(_)),o):(M=qn(this.es),E=Un(this.es),P=$n(this.es),k=Yi(this.es),Math.abs(this.sin_p12-1)<=m?(D=this.a*ht(M,E,P,k,a),N=this.a*ht(M,E,P,k,h),o.x=this.x0+(D-N)*Math.sin(_),o.y=this.y0-(D-N)*Math.cos(_),o):Math.abs(this.sin_p12+1)<=m?(D=this.a*ht(M,E,P,k,a),N=this.a*ht(M,E,P,k,h),o.x=this.x0+(D+N)*Math.sin(_),o.y=this.y0+(D+N)*Math.cos(_),o):(q=y/g,F=Xt(this.a,this.e,this.sin_p12),W=Xt(this.a,this.e,y),V=Math.atan((1-this.es)*q+this.es*F*this.sin_p12/(W*g)),K=Math.atan2(Math.sin(_),this.cos_p12*Math.tan(V)-this.sin_p12*Math.cos(_)),K===0?tt=Math.asin(this.cos_p12*Math.sin(V)-this.sin_p12*Math.cos(V)):Math.abs(Math.abs(K)-Math.PI)<=m?tt=-Math.asin(this.cos_p12*Math.sin(V)-this.sin_p12*Math.cos(V)):tt=Math.asin(Math.sin(_)*Math.cos(V)/Math.sin(K)),ae=this.e*this.sin_p12/Math.sqrt(1-this.es),pe=this.e*this.cos_p12*Math.cos(K)/Math.sqrt(1-this.es),Oe=ae*pe,Ke=pe*pe,ii=tt*tt,Vn=ii*tt,Kn=Vn*tt,Bl=Kn*tt,Le=F*tt*(1-ii*Ke*(1-Ke)/6+Vn/8*Oe*(1-2*Ke)+Kn/120*(Ke*(4-7*Ke)-3*ae*ae*(1-7*Ke))-Bl/48*Oe),o.x=this.x0+Le*Math.sin(K),o.y=this.y0+Le*Math.cos(K),o))}function Or(o){o.x-=this.x0,o.y-=this.y0;var u,h,y,g,_,M,E,P,k,D,N,q,F,W,V,K,ae,pe,Oe,Ke,Le,Be,wt,tt;return this.sphere?(u=Math.sqrt(o.x*o.x+o.y*o.y),u>2*a*this.a?void 0:(h=u/this.a,y=Math.sin(h),g=Math.cos(h),_=this.long0,Math.abs(u)<=m?M=this.lat0:(M=Yr(g*this.sin_p12+o.y*y*this.cos_p12/u),E=Math.abs(this.lat0)-a,Math.abs(E)<=m?this.lat0>=0?_=Z(this.long0+Math.atan2(o.x,-o.y)):_=Z(this.long0-Math.atan2(-o.x,o.y)):_=Z(this.long0+Math.atan2(o.x*y,u*this.cos_p12*g-o.y*this.sin_p12*y))),o.x=_,o.y=M,o)):(P=qn(this.es),k=Un(this.es),D=$n(this.es),N=Yi(this.es),Math.abs(this.sin_p12-1)<=m?(q=this.a*ht(P,k,D,N,a),u=Math.sqrt(o.x*o.x+o.y*o.y),F=q-u,M=Zr(F/this.a,P,k,D,N),_=Z(this.long0+Math.atan2(o.x,-1*o.y)),o.x=_,o.y=M,o):Math.abs(this.sin_p12+1)<=m?(q=this.a*ht(P,k,D,N,a),u=Math.sqrt(o.x*o.x+o.y*o.y),F=u-q,M=Zr(F/this.a,P,k,D,N),_=Z(this.long0+Math.atan2(o.x,o.y)),o.x=_,o.y=M,o):(u=Math.sqrt(o.x*o.x+o.y*o.y),K=Math.atan2(o.x,o.y),W=Xt(this.a,this.e,this.sin_p12),ae=Math.cos(K),pe=this.e*this.cos_p12*ae,Oe=-pe*pe/(1-this.es),Ke=3*this.es*(1-Oe)*this.sin_p12*this.cos_p12*ae/(1-this.es),Le=u/W,Be=Le-Oe*(1+Oe)*Math.pow(Le,3)/6-Ke*(1+3*Oe)*Math.pow(Le,4)/24,wt=1-Oe*Be*Be/2-Le*Be*Be*Be/6,V=Math.asin(this.sin_p12*Math.cos(Be)+this.cos_p12*Math.sin(Be)*ae),_=Z(this.long0+Math.asin(Math.sin(K)*Math.sin(Be)/Math.cos(V))),tt=Math.sin(V),M=Math.atan2((tt-this.es*wt*this.sin_p12)*Math.tan(V),tt*(1-this.es)),o.x=_,o.y=M,o))}var gt=["Azimuthal_Equidistant","aeqd"],bt={init:Qi,forward:ti,inverse:Or,names:gt};function Bt(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0)}function Lr(o){var u,h,y,g,_,M,E,P,k=o.x,D=o.y;return y=Z(k-this.long0),u=Math.sin(D),h=Math.cos(D),g=Math.cos(y),M=this.sin_p14*u+this.cos_p14*h*g,_=1,(M>0||Math.abs(M)<=m)&&(E=this.a*_*h*Math.sin(y),P=this.y0+this.a*_*(this.cos_p14*u-this.sin_p14*h*g)),o.x=E,o.y=P,o}function re(o){var u,h,y,g,_,M,E;return o.x-=this.x0,o.y-=this.y0,u=Math.sqrt(o.x*o.x+o.y*o.y),h=Yr(u/this.a),y=Math.sin(h),g=Math.cos(h),M=this.long0,Math.abs(u)<=m?(E=this.lat0,o.x=M,o.y=E,o):(E=Yr(g*this.sin_p14+o.y*y*this.cos_p14/u),_=Math.abs(this.lat0)-a,Math.abs(_)<=m?(this.lat0>=0?M=Z(this.long0+Math.atan2(o.x,-o.y)):M=Z(this.long0-Math.atan2(-o.x,o.y)),o.x=M,o.y=E,o):(M=Z(this.long0+Math.atan2(o.x*y,u*this.cos_p14*g-o.y*this.sin_p14*y)),o.x=M,o.y=E,o))}var me=["ortho"],Ue={init:Bt,forward:Lr,inverse:re,names:me},we={FRONT:1,RIGHT:2,BACK:3,LEFT:4,TOP:5,BOTTOM:6},_e={AREA_0:1,AREA_1:2,AREA_2:3,AREA_3:4};function en(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Quadrilateralized Spherical Cube",this.lat0>=a-v/2?this.face=we.TOP:this.lat0<=-(a-v/2)?this.face=we.BOTTOM:Math.abs(this.long0)<=v?this.face=we.FRONT:Math.abs(this.long0)<=a+v?this.face=this.long0>0?we.RIGHT:we.LEFT:this.face=we.BACK,this.es!==0&&(this.one_minus_f=1-(this.a-this.b)/this.a,this.one_minus_f_squared=this.one_minus_f*this.one_minus_f)}function tn(o){var u={x:0,y:0},h,y,g,_,M,E,P={value:0};if(o.x-=this.long0,this.es!==0?h=Math.atan(this.one_minus_f_squared*Math.tan(o.y)):h=o.y,y=o.x,this.face===we.TOP)_=a-h,y>=v&&y<=a+v?(P.value=_e.AREA_0,g=y-a):y>a+v||y<=-(a+v)?(P.value=_e.AREA_1,g=y>0?y-x:y+x):y>-(a+v)&&y<=-v?(P.value=_e.AREA_2,g=y+a):(P.value=_e.AREA_3,g=y);else if(this.face===we.BOTTOM)_=a+h,y>=v&&y<=a+v?(P.value=_e.AREA_0,g=-y+a):y<v&&y>=-v?(P.value=_e.AREA_1,g=-y):y<-v&&y>=-(a+v)?(P.value=_e.AREA_2,g=-y-a):(P.value=_e.AREA_3,g=y>0?-y+x:-y-x);else{var k,D,N,q,F,W,V;this.face===we.RIGHT?y=ri(y,+a):this.face===we.BACK?y=ri(y,+x):this.face===we.LEFT&&(y=ri(y,-a)),q=Math.sin(h),F=Math.cos(h),W=Math.sin(y),V=Math.cos(y),k=F*V,D=F*W,N=q,this.face===we.FRONT?(_=Math.acos(k),g=Gn(_,N,D,P)):this.face===we.RIGHT?(_=Math.acos(D),g=Gn(_,N,-k,P)):this.face===we.BACK?(_=Math.acos(-k),g=Gn(_,N,-D,P)):this.face===we.LEFT?(_=Math.acos(-D),g=Gn(_,N,k,P)):(_=g=0,P.value=_e.AREA_0)}return E=Math.atan(12/x*(g+Math.acos(Math.sin(g)*Math.cos(v))-a)),M=Math.sqrt((1-Math.cos(_))/(Math.cos(E)*Math.cos(E))/(1-Math.cos(Math.atan(1/Math.cos(g))))),P.value===_e.AREA_1?E+=a:P.value===_e.AREA_2?E+=x:P.value===_e.AREA_3&&(E+=1.5*x),u.x=M*Math.cos(E),u.y=M*Math.sin(E),u.x=u.x*this.a+this.x0,u.y=u.y*this.a+this.y0,o.x=u.x,o.y=u.y,o}function Xs(o){var u={lam:0,phi:0},h,y,g,_,M,E,P,k,D,N={value:0};if(o.x=(o.x-this.x0)/this.a,o.y=(o.y-this.y0)/this.a,y=Math.atan(Math.sqrt(o.x*o.x+o.y*o.y)),h=Math.atan2(o.y,o.x),o.x>=0&&o.x>=Math.abs(o.y)?N.value=_e.AREA_0:o.y>=0&&o.y>=Math.abs(o.x)?(N.value=_e.AREA_1,h-=a):o.x<0&&-o.x>=Math.abs(o.y)?(N.value=_e.AREA_2,h=h<0?h+x:h-x):(N.value=_e.AREA_3,h+=a),D=x/12*Math.tan(h),M=Math.sin(D)/(Math.cos(D)-1/Math.sqrt(2)),E=Math.atan(M),g=Math.cos(h),_=Math.tan(y),P=1-g*g*_*_*(1-Math.cos(Math.atan(1/Math.cos(E)))),P<-1?P=-1:P>1&&(P=1),this.face===we.TOP)k=Math.acos(P),u.phi=a-k,N.value===_e.AREA_0?u.lam=E+a:N.value===_e.AREA_1?u.lam=E<0?E+x:E-x:N.value===_e.AREA_2?u.lam=E-a:u.lam=E;else if(this.face===we.BOTTOM)k=Math.acos(P),u.phi=k-a,N.value===_e.AREA_0?u.lam=-E+a:N.value===_e.AREA_1?u.lam=-E:N.value===_e.AREA_2?u.lam=-E-a:u.lam=E<0?-E-x:-E+x;else{var q,F,W;q=P,D=q*q,D>=1?W=0:W=Math.sqrt(1-D)*Math.sin(E),D+=W*W,D>=1?F=0:F=Math.sqrt(1-D),N.value===_e.AREA_1?(D=F,F=-W,W=D):N.value===_e.AREA_2?(F=-F,W=-W):N.value===_e.AREA_3&&(D=F,F=W,W=-D),this.face===we.RIGHT?(D=q,q=-F,F=D):this.face===we.BACK?(q=-q,F=-F):this.face===we.LEFT&&(D=q,q=F,F=-D),u.phi=Math.acos(-W)-a,u.lam=Math.atan2(F,q),this.face===we.RIGHT?u.lam=ri(u.lam,-a):this.face===we.BACK?u.lam=ri(u.lam,-x):this.face===we.LEFT&&(u.lam=ri(u.lam,+a))}if(this.es!==0){var V,K,ae;V=u.phi<0?1:0,K=Math.tan(u.phi),ae=this.b/Math.sqrt(K*K+this.one_minus_f_squared),u.phi=Math.atan(Math.sqrt(this.a*this.a-ae*ae)/(this.one_minus_f*ae)),V&&(u.phi=-u.phi)}return u.lam+=this.long0,o.x=u.lam,o.y=u.phi,o}function Gn(o,u,h,y){var g;return o<m?(y.value=_e.AREA_0,g=0):(g=Math.atan2(u,h),Math.abs(g)<=v?y.value=_e.AREA_0:g>v&&g<=a+v?(y.value=_e.AREA_1,g-=a):g>a+v||g<=-(a+v)?(y.value=_e.AREA_2,g=g>=0?g-x:g+x):(y.value=_e.AREA_3,g+=a)),g}function ri(o,u){var h=o+u;return h<-x?h+=R:h>+x&&(h-=R),h}var hg=["Quadrilateralized Spherical Cube","Quadrilateralized_Spherical_Cube","qsc"],fg={init:en,forward:tn,inverse:Xs,names:hg},Uh=[[1,22199e-21,-715515e-10,31103e-10],[.9986,-482243e-9,-24897e-9,-13309e-10],[.9954,-83103e-8,-448605e-10,-986701e-12],[.99,-.00135364,-59661e-9,36777e-10],[.9822,-.00167442,-449547e-11,-572411e-11],[.973,-.00214868,-903571e-10,18736e-12],[.96,-.00305085,-900761e-10,164917e-11],[.9427,-.00382792,-653386e-10,-26154e-10],[.9216,-.00467746,-10457e-8,481243e-11],[.8962,-.00536223,-323831e-10,-543432e-11],[.8679,-.00609363,-113898e-9,332484e-11],[.835,-.00698325,-640253e-10,934959e-12],[.7986,-.00755338,-500009e-10,935324e-12],[.7597,-.00798324,-35971e-9,-227626e-11],[.7186,-.00851367,-701149e-10,-86303e-10],[.6732,-.00986209,-199569e-9,191974e-10],[.6213,-.010418,883923e-10,624051e-11],[.5722,-.00906601,182e-6,624051e-11],[.5322,-.00677797,275608e-9,624051e-11]],Da=[[-520417e-23,.0124,121431e-23,-845284e-16],[.062,.0124,-126793e-14,422642e-15],[.124,.0124,507171e-14,-160604e-14],[.186,.0123999,-190189e-13,600152e-14],[.248,.0124002,710039e-13,-224e-10],[.31,.0123992,-264997e-12,835986e-13],[.372,.0124029,988983e-12,-311994e-12],[.434,.0123893,-369093e-11,-435621e-12],[.4958,.0123198,-102252e-10,-345523e-12],[.5571,.0121916,-154081e-10,-582288e-12],[.6176,.0119938,-241424e-10,-525327e-12],[.6769,.011713,-320223e-10,-516405e-12],[.7346,.0113541,-397684e-10,-609052e-12],[.7903,.0109107,-489042e-10,-104739e-11],[.8435,.0103431,-64615e-9,-140374e-14],[.8936,.00969686,-64636e-9,-8547e-9],[.9394,.00840947,-192841e-9,-42106e-10],[.9761,.00616527,-256e-6,-42106e-10],[1,.00328947,-319159e-9,-42106e-10]],Xd=.8487,Qd=1.3523,e2=S/5,dg=1/e2,Qs=18,Dl=function(o,u){return o[0]+u*(o[1]+u*(o[2]+u*o[3]))},pg=function(o,u){return o[1]+u*(2*o[2]+u*3*o[3])};function mg(o,u,h,y){for(var g=u;y;--y){var _=o(g);if(g-=_,Math.abs(_)<h)break}return g}function gg(){this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.es=0,this.title=this.title||"Robinson"}function yg(o){var u=Z(o.x-this.long0),h=Math.abs(o.y),y=Math.floor(h*e2);y<0?y=0:y>=Qs&&(y=Qs-1),h=S*(h-dg*y);var g={x:Dl(Uh[y],h)*u,y:Dl(Da[y],h)};return o.y<0&&(g.y=-g.y),g.x=g.x*this.a*Xd+this.x0,g.y=g.y*this.a*Qd+this.y0,g}function bg(o){var u={x:(o.x-this.x0)/(this.a*Xd),y:Math.abs(o.y-this.y0)/(this.a*Qd)};if(u.y>=1)u.x/=Uh[Qs][0],u.y=o.y<0?-a:a;else{var h=Math.floor(u.y*Qs);for(h<0?h=0:h>=Qs&&(h=Qs-1);;)if(Da[h][0]>u.y)--h;else if(Da[h+1][0]<=u.y)++h;else break;var y=Da[h],g=5*(u.y-y[0])/(Da[h+1][0]-y[0]);g=mg(function(_){return(Dl(y,_)-u.y)/pg(y,_)},g,m,100),u.x/=Dl(Uh[h],g),u.y=(5*h+g)*w,o.y<0&&(u.y=-u.y)}return u.x=Z(u.x+this.long0),u}var vg=["Robinson","robin"],wg={init:gg,forward:yg,inverse:bg,names:vg};function _g(){this.name="geocent"}function Sg(o){var u=wi(o,this.es,this.a);return u}function xg(o){var u=Vr(o,this.es,this.a,this.b);return u}var Mg=["Geocentric","geocentric","geocent","Geocent"],Eg={init:_g,forward:Sg,inverse:xg,names:Mg},vt={N_POLE:0,S_POLE:1,EQUIT:2,OBLIQ:3},Ba={h:{def:1e5,num:!0},azi:{def:0,num:!0,degrees:!0},tilt:{def:0,num:!0,degrees:!0},long0:{def:0,num:!0},lat0:{def:0,num:!0}};function Rg(){if(Object.keys(Ba).forEach(function(h){if(typeof this[h]>"u")this[h]=Ba[h].def;else{if(Ba[h].num&&isNaN(this[h]))throw new Error("Invalid parameter value, must be numeric "+h+" = "+this[h]);Ba[h].num&&(this[h]=parseFloat(this[h]))}Ba[h].degrees&&(this[h]=this[h]*w)}.bind(this)),Math.abs(Math.abs(this.lat0)-a)<m?this.mode=this.lat0<0?vt.S_POLE:vt.N_POLE:Math.abs(this.lat0)<m?this.mode=vt.EQUIT:(this.mode=vt.OBLIQ,this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0)),this.pn1=this.h/this.a,this.pn1<=0||this.pn1>1e10)throw new Error("Invalid height");this.p=1+this.pn1,this.rp=1/this.p,this.h1=1/this.pn1,this.pfact=(this.p+1)*this.h1,this.es=0;var o=this.tilt,u=this.azi;this.cg=Math.cos(u),this.sg=Math.sin(u),this.cw=Math.cos(o),this.sw=Math.sin(o)}function Cg(o){o.x-=this.long0;var u=Math.sin(o.y),h=Math.cos(o.y),y=Math.cos(o.x),g,_;switch(this.mode){case vt.OBLIQ:_=this.sinph0*u+this.cosph0*h*y;break;case vt.EQUIT:_=h*y;break;case vt.S_POLE:_=-u;break;case vt.N_POLE:_=u;break}switch(_=this.pn1/(this.p-_),g=_*h*Math.sin(o.x),this.mode){case vt.OBLIQ:_*=this.cosph0*u-this.sinph0*h*y;break;case vt.EQUIT:_*=u;break;case vt.N_POLE:_*=-(h*y);break;case vt.S_POLE:_*=h*y;break}var M,E;return M=_*this.cg+g*this.sg,E=1/(M*this.sw*this.h1+this.cw),g=(g*this.cg-_*this.sg)*this.cw*E,_=M*E,o.x=g*this.a,o.y=_*this.a,o}function Ag(o){o.x/=this.a,o.y/=this.a;var u={x:o.x,y:o.y},h,y,g;g=1/(this.pn1-o.y*this.sw),h=this.pn1*o.x*g,y=this.pn1*o.y*this.cw*g,o.x=h*this.cg+y*this.sg,o.y=y*this.cg-h*this.sg;var _=Zi(o.x,o.y);if(Math.abs(_)<m)u.x=0,u.y=o.y;else{var M,E;switch(E=1-_*_*this.pfact,E=(this.p-Math.sqrt(E))/(this.pn1/_+_/this.pn1),M=Math.sqrt(1-E*E),this.mode){case vt.OBLIQ:u.y=Math.asin(M*this.sinph0+o.y*E*this.cosph0/_),o.y=(M-this.sinph0*Math.sin(u.y))*_,o.x*=E*this.cosph0;break;case vt.EQUIT:u.y=Math.asin(o.y*E/_),o.y=M*_,o.x*=E;break;case vt.N_POLE:u.y=Math.asin(M),o.y=-o.y;break;case vt.S_POLE:u.y=-Math.asin(M);break}u.x=Math.atan2(o.x,o.y)}return o.x=u.x+this.long0,o.y=u.y,o}var Pg=["Tilted_Perspective","tpers"],Tg={init:Rg,forward:Cg,inverse:Ag,names:Pg},Ig=function(o){o.Proj.projections.add(Zc),o.Proj.projections.add(Ji),o.Proj.projections.add(ih),o.Proj.projections.add(oh),o.Proj.projections.add(uh),o.Proj.projections.add(Ta),o.Proj.projections.add(hh),o.Proj.projections.add(ka),o.Proj.projections.add(Oa),o.Proj.projections.add(Jr),o.Proj.projections.add(wl),o.Proj.projections.add(Qr),o.Proj.projections.add(Ci),o.Proj.projections.add(Cl),o.Proj.projections.add(Th),o.Proj.projections.add(Vs),o.Proj.projections.add(Oh),o.Proj.projections.add(Ll),o.Proj.projections.add(Ys),o.Proj.projections.add(I),o.Proj.projections.add(ce),o.Proj.projections.add(er),o.Proj.projections.add(bt),o.Proj.projections.add(Ue),o.Proj.projections.add(fg),o.Proj.projections.add(wg),o.Proj.projections.add(Eg),o.Proj.projections.add(Tg)};return Dt.defaultDatum="WGS84",Dt.Proj=at,Dt.WGS84=new Dt.Proj("WGS84"),Dt.Point=dr,Dt.toPoint=Ln,Dt.defs=dt,Dt.transform=Fi,Dt.mgrs=J1,Dt.version="2.6.3",Ig(Dt),Dt})});var _1=H((ZT,S6)=>{S6.exports={ROOT:0,GROUP:1,POSITION:2,SET:3,RANGE:4,REPETITION:5,REFERENCE:6,CHAR:7}});var id=H(Sn=>{var ze=_1(),rd=()=>[{type:ze.RANGE,from:48,to:57}],x6=()=>[{type:ze.CHAR,value:95},{type:ze.RANGE,from:97,to:122},{type:ze.RANGE,from:65,to:90}].concat(rd()),M6=()=>[{type:ze.CHAR,value:9},{type:ze.CHAR,value:10},{type:ze.CHAR,value:11},{type:ze.CHAR,value:12},{type:ze.CHAR,value:13},{type:ze.CHAR,value:32},{type:ze.CHAR,value:160},{type:ze.CHAR,value:5760},{type:ze.RANGE,from:8192,to:8202},{type:ze.CHAR,value:8232},{type:ze.CHAR,value:8233},{type:ze.CHAR,value:8239},{type:ze.CHAR,value:8287},{type:ze.CHAR,value:12288},{type:ze.CHAR,value:65279}],SS=()=>[{type:ze.CHAR,value:10},{type:ze.CHAR,value:13},{type:ze.CHAR,value:8232},{type:ze.CHAR,value:8233}];Sn.words=()=>({type:ze.SET,set:x6(),not:!1});Sn.notWords=()=>({type:ze.SET,set:x6(),not:!0});Sn.ints=()=>({type:ze.SET,set:rd(),not:!1});Sn.notInts=()=>({type:ze.SET,set:rd(),not:!0});Sn.whitespace=()=>({type:ze.SET,set:M6(),not:!1});Sn.notWhitespace=()=>({type:ze.SET,set:M6(),not:!0});Sn.anyChar=()=>({type:ze.SET,set:SS(),not:!0})});var R6=H(S1=>{var E6=_1(),Go=id(),xS="@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^ ?",MS={"0":0,t:9,n:10,v:11,f:12,r:13};S1.strToChars=function(t){var e=/(\[\\b\])|(\\)?\\(?:u([A-F0-9]{4})|x([A-F0-9]{2})|(0?[0-7]{2})|c([@A-Z[\\\]^?])|([0tnvfr]))/g;return t=t.replace(e,function(r,i,n,s,a,c,d,p){if(n)return r;var m=i?8:s?parseInt(s,16):a?parseInt(a,16):c?parseInt(c,8):d?xS.indexOf(d):MS[p],w=String.fromCharCode(m);return/[[\]{}^$.|?*+()]/.test(w)&&(w="\\"+w),w}),t};S1.tokenizeClass=(t,e)=>{for(var r=[],i=/\\(?:(w)|(d)|(s)|(W)|(D)|(S))|((?:(?:\\)(.)|([^\]\\]))-(?:\\)?([^\]]))|(\])|(?:\\)?([^])/g,n,s;(n=i.exec(t))!=null;)if(n[1])r.push(Go.words());else if(n[2])r.push(Go.ints());else if(n[3])r.push(Go.whitespace());else if(n[4])r.push(Go.notWords());else if(n[5])r.push(Go.notInts());else if(n[6])r.push(Go.notWhitespace());else if(n[7])r.push({type:E6.RANGE,from:(n[8]||n[9]).charCodeAt(0),to:n[10].charCodeAt(0)});else if(s=n[12])r.push({type:E6.CHAR,value:s.charCodeAt(0)});else return[r,i.lastIndex];S1.error(e,"Unterminated character class")};S1.error=(t,e)=>{throw new SyntaxError("Invalid regular expression: /"+t+"/: "+e)}});var C6=H(x1=>{var Yu=_1();x1.wordBoundary=()=>({type:Yu.POSITION,value:"b"});x1.nonWordBoundary=()=>({type:Yu.POSITION,value:"B"});x1.begin=()=>({type:Yu.POSITION,value:"^"});x1.end=()=>({type:Yu.POSITION,value:"$"})});var A6=H((QT,nd)=>{var Vo=R6(),Er=_1(),vs=id(),Xu=C6();nd.exports=t=>{var e=0,r,i,n={type:Er.ROOT,stack:[]},s=n,a=n.stack,c=[],d=C=>{Vo.error(t,`Nothing to repeat at column ${C-1}`)},p=Vo.strToChars(t);for(r=p.length;e<r;)switch(i=p[e++],i){case"\\":switch(i=p[e++],i){case"b":a.push(Xu.wordBoundary());break;case"B":a.push(Xu.nonWordBoundary());break;case"w":a.push(vs.words());break;case"W":a.push(vs.notWords());break;case"d":a.push(vs.ints());break;case"D":a.push(vs.notInts());break;case"s":a.push(vs.whitespace());break;case"S":a.push(vs.notWhitespace());break;default:/\d/.test(i)?a.push({type:Er.REFERENCE,value:parseInt(i,10)}):a.push({type:Er.CHAR,value:i.charCodeAt(0)})}break;case"^":a.push(Xu.begin());break;case"$":a.push(Xu.end());break;case"[":var m;p[e]==="^"?(m=!0,e++):m=!1;var w=Vo.tokenizeClass(p.slice(e),t);e+=w[1],a.push({type:Er.SET,set:w[0],not:m});break;case".":a.push(vs.anyChar());break;case"(":var S={type:Er.GROUP,stack:[],remember:!0};i=p[e],i==="?"&&(i=p[e+1],e+=2,i==="="?S.followedBy=!0:i==="!"?S.notFollowedBy=!0:i!==":"&&Vo.error(t,`Invalid group, character '${i}' after '?' at column ${e-1}`),S.remember=!1),a.push(S),c.push(s),s=S,a=S.stack;break;case")":c.length===0&&Vo.error(t,`Unmatched ) at column ${e-1}`),s=c.pop(),a=s.options?s.options[s.options.length-1]:s.stack;break;case"|":s.options||(s.options=[s.stack],delete s.stack);var v=[];s.options.push(v),a=v;break;case"{":var R=/^(\d+)(,(\d+)?)?\}/.exec(p.slice(e)),x,A;R!==null?(a.length===0&&d(e),x=parseInt(R[1],10),A=R[2]?R[3]?parseInt(R[3],10):1/0:x,e+=R[0].length,a.push({type:Er.REPETITION,min:x,max:A,value:a.pop()})):a.push({type:Er.CHAR,value:123});break;case"?":a.length===0&&d(e),a.push({type:Er.REPETITION,min:0,max:1,value:a.pop()});break;case"+":a.length===0&&d(e),a.push({type:Er.REPETITION,min:1,max:1/0,value:a.pop()});break;case"*":a.length===0&&d(e),a.push({type:Er.REPETITION,min:0,max:1/0,value:a.pop()});break;default:a.push({type:Er.CHAR,value:i.charCodeAt(0)})}return c.length!==0&&Vo.error(t,"Unterminated group"),n};nd.exports.types=Er});var I6=H((eI,T6)=>{"use strict";var P6=A6(),ES=P6.types;T6.exports=function(t,e){e||(e={});var r=e.limit===void 0?25:e.limit;RS(t)?t=t.source:typeof t!="string"&&(t=String(t));try{t=P6(t)}catch{return!1}var i=0;return function n(s,a){var c,d,p;if(s.type===ES.REPETITION&&(a++,i++,a>1||i>r))return!1;if(s.options){for(c=0,p=s.options.length;c<p;c++)if(d=n({stack:s.options[c]},a),!d)return!1}var m=s.stack||s.value&&s.value.stack;if(!m)return!0;for(c=0;c<m.length;c++)if(d=n(m[c],a),!d)return!1;return!0}(t,0)};function RS(t){return{}.toString.call(t)==="[object RegExp]"}});var O6=H((tI,k6)=>{"use strict";k6.exports=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var i,n,s;if(Array.isArray(e)){if(i=e.length,i!=r.length)return!1;for(n=i;n--!==0;)if(!t(e[n],r[n]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(s=Object.keys(e),i=s.length,i!==Object.keys(r).length)return!1;for(n=i;n--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[n]))return!1;for(n=i;n--!==0;){var a=s[n];if(!t(e[a],r[a]))return!1}return!0}return e!==e&&r!==r}});var $6=H((rI,U6)=>{"use strict";var Ko=" ",Zo="\u2502 ",L6="\u251C\u2500\u2500 ",N6="\u2514\u2500\u2500 ",D6="*",M1="/",B6=/(?=\/)/;function CS(t){let e=t.name||"";return e=e.replace("bound","").trim(),e=(e||"anonymous")+"()",e}function z6(t){return Array.isArray(t)?t.map(e=>z6(e)):typeof t=="symbol"?t.toString():typeof t=="function"?CS(t):t}function sd(t,e){let r={},i=this.buildPrettyMeta(t);return Array.isArray(e)||(e=i?Reflect.ownKeys(i):[]),e.forEach(n=>{let s=typeof n=="symbol"?n.toString():n;i&&i[n]&&(r[s]=z6(i[n]))}),r}function AS(t,e={}){if(!this.buildPrettyMeta)throw new Error("buildPrettyMeta not defined");e.includeMeta=e.includeMeta||null;let r=[],i="";t.sort((s,a)=>!s.path||!a.path?0:s.path.localeCompare(a.path));for(let s=0;s<t.length;s++){let a=t[s],c=r.find(p=>a.path===p.path);if(c){c.handlers.push({method:a.method,opts:a.opts.constraints||void 0,meta:e.includeMeta?sd.call(this,a,e.includeMeta):null});continue}let d={method:a.method,opts:a.opts.constraints||void 0,meta:e.includeMeta?sd.call(this,a,e.includeMeta):null};r.push({path:a.path,methods:[a.method],opts:[a.opts],handlers:[d]})}if(!r.filter(s=>s.path===M1).length){let s={path:M1,truncatedPath:"",methods:[],opts:[],handlers:[{}]};r.filter(a=>a.path===D6).length?r.splice(1,0,s):r.unshift(s)}let n=PS(r);return n.forEach((s,a)=>{i+=j6(s,null,a===n.length-1,!1,!0),i+=`
109
+ `}),i}function PS(t,e){e=e||M1;let r=[],i={result:r};return t.forEach((n,s)=>{let a=n.path.split(B6);a[0]!==M1&&a[0]!==D6&&(a=[M1,a[0].slice(1),...a.slice(1)]),a.reduce((c,d,p)=>{if(!c[d]){c[d]={result:[]};let m={path:d,children:c[d].result};p===a.length-1&&(m.handlers=n.handlers),c.result.push(m)}return c[d]},i)}),r}function j6(t,e,r,i,n){let s="";if(!i&&!n&&(s+=`
110
+ `),i||(s+=`${e||""}${r?N6:L6}`),s+=`${t.path}`,t.handlers){let a=t.handlers.reduce((c,d)=>{let p=c.findIndex(m=>JSON.stringify(m.opts)===JSON.stringify(d.opts));return p!==-1?c[p].method=[c[p].method,d.method].join(", "):c.push(d),c},[]);a.forEach((c,d)=>{d>0&&(s+=`${i?"":e||""}${r?Ko:Zo}${t.path}`),s+=` (${c.method||"-"})`,c.opts&&JSON.stringify(c.opts)!=="{}"&&(s+=` ${JSON.stringify(c.opts)}`),c.meta&&Reflect.ownKeys(c.meta).forEach((p,m)=>{s+=`
111
+ ${i?"":e||""}${r?Ko:Zo}`,s+=`\u2022 (${p}) ${JSON.stringify(c.meta[p])}`}),a.length>1&&d!==a.length-1&&(s+=`
112
+ `)})}else t.children.length>1&&(s+=" (-)");return i||(e=`${e||""}${r?Ko:Zo}`),t.children.forEach((a,c)=>{let d=c===t.children.length-1,p=!t.handlers&&t.children.length===1;s+=j6(a,e,d,p)}),s}function q6(t,e,r,i){if(!this.buildPrettyMeta)throw new Error("buildPrettyMeta not defined");i.includeMeta=i.includeMeta||null;let n="",s=[];for(let{node:d,method:p}of t.nodes)for(let m of d.handlerStorage.handlers)s.push({method:p,...m});s.length?s.forEach((d,p)=>{let m=`(${d.method||"-"})`;Object.keys(d.constraints).length>0&&(m+=" "+JSON.stringify(d.constraints));let w="",S=t.prefix.split("").map((v,R)=>v===":"?R:null).filter(v=>v!==null);if(S.length){let v=0;S.forEach((R,x)=>{w+=t.prefix.slice(v,R+1),w+=d.params[d.params.length-S.length+x],x===S.length-1&&(w+=t.prefix.slice(R+1)),v=R+1})}else w=t.prefix;if(p===0?n+=`${w} ${m}`:n+=`
113
+ ${e}${r?Ko:Zo}${w} ${m}`,i.includeMeta){let v=sd.call(this,d,i.includeMeta);Object.keys(v).forEach((R,x)=>{n+=`
114
+ ${e||""}${r?Ko:Zo}`,n+=`\u2022 (${R}) ${JSON.stringify(v[R])}`})}}):n=t.prefix;let a=`${e}${r?N6:L6}${n}
115
+ `;e=`${e}${r?Ko:Zo}`;let c=Object.keys(t.children);for(let d=0;d<c.length;d++){let p=t.children[c[d]];a+=q6.call(this,p,e,d===c.length-1,i)}return a}function Qu(t,e,r){if(e.handlerStorage.handlers.length!==0&&t.nodes.push({method:r,node:e}),e.parametricChildren&&e.parametricChildren[0]&&(t.children[":"]||(t.children[":"]={prefix:":",nodes:[],children:{}}),Qu(t.children[":"],e.parametricChildren[0],r)),e.wildcardChild&&(t.children["*"]||(t.children["*"]={prefix:"*",nodes:[],children:{}}),Qu(t.children["*"],e.wildcardChild,r)),e.staticChildren)for(let i of Object.values(e.staticChildren)){let n=i.prefix.split(B6),s=t,a;for(let c of n)a=s,s=s.children[c],s||(s={prefix:c,nodes:[],children:{}},a.children[c]=s);Qu(s,i,r)}}function od(t){let e=Object.keys(t.children);if(t.nodes.length===0&&e.length===1){let r=t.children[e[0]];if(r.nodes.length<=1)return od(r),t.nodes=r.nodes,t.prefix+=r.prefix,t.children=r.children,t}for(let r of Object.keys(t.children))od(t.children[r]);return t}U6.exports={flattenNode:Qu,compressFlattenedNode:od,prettyPrintFlattenedNode:q6,prettyPrintRoutesArray:AS}});var F6=H((iI,W6)=>{"use strict";var ad=class{constructor(){this.unconstrainedHandler=null,this.constraints=[],this.handlers=[],this.constrainedHandlerStores=null}getMatchingHandler(e){return e===void 0?this.unconstrainedHandler:this._getHandlerMatchingConstraints(e)}addHandler(e,r,i,n,s){let a={handler:e,params:r,constraints:s,store:i||null,_createParamsObject:this._compileCreateParamsObject(r)};Object.keys(s).length===0&&(this.unconstrainedHandler=a);for(let c of Object.keys(s))this.constraints.includes(c)||(c==="version"?this.constraints.unshift(c):this.constraints.push(c));if(this.handlers.length>=32)throw new Error("find-my-way supports a maximum of 32 route handlers per node when there are constraints, limit reached");this.handlers.push(a),this.handlers.sort((c,d)=>Object.keys(c.constraints).length-Object.keys(d.constraints).length),this._compileGetHandlerMatchingConstraints(n,s)}_compileCreateParamsObject(e){let r=[];for(let i=0;i<e.length;i++)r.push(`'${e[i]}': paramsArray[${i}]`);return new Function("paramsArray",`return {${r.join(",")}}`)}_getHandlerMatchingConstraints(){return null}_buildConstraintStore(e,r){for(let i=0;i<this.handlers.length;i++){let s=this.handlers[i].constraints[r];if(s!==void 0){let a=e.get(s)||0;a|=1<<i,e.set(s,a)}}}_constrainedIndexBitmask(e){let r=0;for(let i=0;i<this.handlers.length;i++)this.handlers[i].constraints[e]!==void 0&&(r|=1<<i);return~r}_compileGetHandlerMatchingConstraints(e){this.constrainedHandlerStores={};for(let i of this.constraints){let n=e.newStoreForConstraint(i);this.constrainedHandlerStores[i]=n,this._buildConstraintStore(n,i)}let r=[];r.push(`
116
+ let candidates = ${(1<<this.handlers.length)-1}
117
+ let mask, matches
118
+ `);for(let i of this.constraints){r.push(`
119
+ mask = ${this._constrainedIndexBitmask(i)}
120
+ value = derivedConstraints.${i}
121
+ `);let s=e.strategies[i].mustMatchWhenDerived?"matches":"(matches | mask)";r.push(`
122
+ if (value === undefined) {
123
+ candidates &= mask
124
+ } else {
125
+ matches = this.constrainedHandlerStores.${i}.get(value) || 0
126
+ candidates &= ${s}
127
+ }
128
+ if (candidates === 0) return null;
129
+ `)}for(let i in e.strategies)e.strategies[i].mustMatchWhenDerived&&!this.constraints.includes(i)&&r.push(`if (derivedConstraints.${i} !== undefined) return null`);r.push("return this.handlers[Math.floor(Math.log2(candidates))]"),this._getHandlerMatchingConstraints=new Function("derivedConstraints",r.join(`
130
+ `))}};W6.exports=ad});var G6=H((nI,H6)=>{"use strict";var TS=F6(),nc={STATIC:0,PARAMETRIC:1,WILDCARD:2},ec=class{constructor(){this.handlerStorage=new TS}},tc=class extends ec{constructor(){super(),this.staticChildren={}}findStaticMatchingChild(e,r){let i=this.staticChildren[e.charAt(r)];return i===void 0||!i.matchPrefix(e,r)?null:i}createStaticChild(e){if(e.length===0)return this;let r=this.staticChildren[e.charAt(0)];if(r){let n=1;for(;n<r.prefix.length;n++)if(e.charCodeAt(n)!==r.prefix.charCodeAt(n)){r=r.split(this,n);break}return r.createStaticChild(e.slice(n))}let i=e.charAt(0);return this.staticChildren[i]=new Jo(e),this.staticChildren[i]}},Jo=class extends tc{constructor(e){super(),this.prefix=e,this.wildcardChild=null,this.parametricChildren=[],this.kind=nc.STATIC,this._compilePrefixMatch()}createParametricChild(e){let r=e&&e.source,i=this.parametricChildren.find(n=>(n.regex&&n.regex.source)===r);return i||(i=new rc(e),e?this.parametricChildren.unshift(i):this.parametricChildren.push(i),i)}createWildcardChild(){return this.wildcardChild?this.wildcardChild:(this.wildcardChild=new ic,this.wildcardChild)}split(e,r){let i=this.prefix.slice(0,r),n=this.prefix.slice(r);this.prefix=n,this._compilePrefixMatch();let s=new Jo(i);return s.staticChildren[n.charAt(0)]=this,e.staticChildren[i.charAt(0)]=s,s}getNextNode(e,r,i,n){let s=this.findStaticMatchingChild(e,r),a=0;if(s===null){if(this.parametricChildren.length===0)return this.wildcardChild;s=this.parametricChildren[0],a=1}this.wildcardChild!==null&&i.push({paramsCount:n,brotherPathIndex:r,brotherNode:this.wildcardChild});for(let c=this.parametricChildren.length-1;c>=a;c--)i.push({paramsCount:n,brotherPathIndex:r,brotherNode:this.parametricChildren[c]});return s}_compilePrefixMatch(){if(this.prefix.length===1){this.matchPrefix=()=>!0;return}let e=[];for(let r=1;r<this.prefix.length;r++){let i=this.prefix.charCodeAt(r);e.push(`path.charCodeAt(i + ${r}) === ${i}`)}this.matchPrefix=new Function("path","i",`return ${e.join(" && ")}`)}},rc=class extends tc{constructor(e){super(),this.regex=e||null,this.isRegex=!!e,this.kind=nc.PARAMETRIC}getNextNode(e,r){return this.findStaticMatchingChild(e,r)}},ic=class extends ec{constructor(){super(),this.kind=nc.WILDCARD}getNextNode(){return null}};H6.exports={StaticNode:Jo,ParametricNode:rc,WildcardNode:ic,NODE_TYPES:nc}});var K6=H((sI,V6)=>{"use strict";var IS=require("assert");function E1(){if(!(this instanceof E1))return new E1;this.store={},this.maxMajor=0,this.maxMinors={},this.maxPatches={}}E1.prototype.set=function(t,e){if(typeof t!="string")throw new TypeError("Version should be a string");let[r,i,n]=t.split(".");return r=Number(r)||0,i=Number(i)||0,n=Number(n)||0,r>=this.maxMajor&&(this.maxMajor=r,this.store.x=e,this.store["*"]=e,this.store["x.x"]=e,this.store["x.x.x"]=e),i>=(this.maxMinors[r]||0)&&(this.maxMinors[r]=i,this.store[`${r}.x`]=e,this.store[`${r}.x.x`]=e),n>=(this.store[`${r}.${i}`]||0)&&(this.maxPatches[`${r}.${i}`]=n,this.store[`${r}.${i}.x`]=e),this.store[`${r}.${i}.${n}`]=e,this};E1.prototype.get=function(t){return this.store[t]};V6.exports={name:"version",mustMatchWhenDerived:!0,storage:E1,validate(t){IS(typeof t=="string","Version should be a string")}}});var J6=H((oI,Z6)=>{"use strict";var kS=require("assert");function OS(){let t={},e=[];return{get:r=>{let i=t[r];if(i)return i;for(let n of e)if(n.host.test(r))return n.value},set:(r,i)=>{r instanceof RegExp?e.push({host:r,value:i}):t[r]=i}}}Z6.exports={name:"host",mustMatchWhenDerived:!1,storage:OS,validate(t){kS(typeof t=="string"||Object.prototype.toString.call(t)==="[object RegExp]","Host should be a string or a RegExp")}}});var X6=H((aI,Y6)=>{"use strict";var LS=K6(),NS=J6(),ld=require("assert"),ud=class{constructor(e){if(this.strategies={version:LS,host:NS},this.strategiesInUse=new Set,e)for(let r of Object.values(e))this.addConstraintStrategy(r)}hasConstraintStrategy(e){let r=this.strategies[e];return r!==void 0?r.isCustom||this.strategiesInUse.has(e):!1}addConstraintStrategy(e){if(ld(typeof e.name=="string"&&e.name!=="","strategy.name is required."),ld(e.storage&&typeof e.storage=="function","strategy.storage function is required."),ld(e.deriveConstraint&&typeof e.deriveConstraint=="function","strategy.deriveConstraint function is required."),this.strategies[e.name]&&this.strategies[e.name].isCustom)throw new Error(`There already exists a custom constraint with the name ${e.name}.`);if(this.strategiesInUse.has(e.name))throw new Error(`There already exists a route with ${e.name} constraint.`);e.isCustom=!0,this.strategies[e.name]=e,e.mustMatchWhenDerived&&this.noteUsage({[e.name]:e})}deriveConstraints(e,r){}noteUsage(e){if(e){let r=this.strategiesInUse.size;for(let i in e)this.strategiesInUse.add(i);r!==this.strategiesInUse.size&&this._buildDeriveConstraints()}}newStoreForConstraint(e){if(!this.strategies[e])throw new Error(`No strategy registered for constraint key ${e}`);return this.strategies[e].storage()}validateConstraints(e){for(let r in e){let i=e[r];if(typeof i>"u")throw new Error("Can't pass an undefined constraint value, must pass null or no key at all");let n=this.strategies[r];if(!n)throw new Error(`No strategy registered for constraint key ${r}`);n.validate&&n.validate(i)}}_buildDeriveConstraints(){if(this.strategiesInUse.size===0)return;let e=["return {"];for(let r of this.strategiesInUse){let i=this.strategies[r];if(i.isCustom)e.push(` ${i.name}: this.strategies.${r}.deriveConstraint(req, ctx),`);else if(r==="version")e.push(" version: req.headers['accept-version'],");else if(r==="host")e.push(" host: req.headers.host || req.headers[':authority'],");else throw new Error("unknown non-custom strategy for compiling constraint derivation function")}e.push("}"),this.deriveConstraints=new Function("req","ctx",e.join(`
131
+ `)).bind(this)}};Y6.exports=ud});var t4=H((lI,e4)=>{"use strict";function Q6(t,e){return t===50?e===53?"%":e===51?"#":e===52?"$":e===54?"&":e===66||e===98?"+":e===67||e===99?",":e===70||e===102?"/":null:t===51?e===65||e===97?":":e===66||e===98?";":e===68||e===100?"=":e===70||e===102?"?":null:t===52&&e===48?"@":null}function DS(t){let e=!1,r=!1,i="";for(let s=1;s<t.length;s++){let a=t.charCodeAt(s);if(a===37){let c=t.charCodeAt(s+1),d=t.charCodeAt(s+2);Q6(c,d)===null?e=!0:(r=!0,c===50&&d===53&&(e=!0,t=t.slice(0,s+1)+"25"+t.slice(s+1),s+=2),s+=2)}else if(a===63||a===59||a===35){i=t.slice(s+1),t=t.slice(0,s);break}}return{path:e?decodeURI(t):t,querystring:i,shouldDecodeParam:r}}function BS(t){let e=t.indexOf("%");if(e===-1)return t;let r="",i=e;for(let n=e;n<t.length;n++)if(t.charCodeAt(n)===37){let s=t.charCodeAt(n+1),a=t.charCodeAt(n+2),c=Q6(s,a);r+=t.slice(i,n)+c,i=n+3}return t.slice(0,e)+r+t.slice(i)}e4.exports={safeDecodeURI:DS,safeDecodeURIComponent:BS}});var a4=H((uI,o4)=>{"use strict";var ut=require("assert"),sc=require("http"),zS=require("querystring"),fd=I6(),n4=O6(),{flattenNode:jS,compressFlattenedNode:qS,prettyPrintFlattenedNode:US,prettyPrintRoutesArray:$S}=$6(),{StaticNode:r4,NODE_TYPES:cd}=G6(),WS=X6(),{safeDecodeURI:FS,safeDecodeURIComponent:i4}=t4(),dd=sc.METHODS,s4=/^https?:\/\/.*?\//,ws=/(\/:[^/()]*?)\?(\/?)/;if(!fd(s4))throw new Error("the FULL_PATH_REGEXP is not safe, update this module");if(!fd(ws))throw new Error("the OPTIONAL_PARAM_REGEXP is not safe, update this module");function ct(t){if(!(this instanceof ct))return new ct(t);t=t||{},t.defaultRoute?(ut(typeof t.defaultRoute=="function","The default route must be a function"),this.defaultRoute=t.defaultRoute):this.defaultRoute=null,t.onBadUrl?(ut(typeof t.onBadUrl=="function","The bad url handler must be a function"),this.onBadUrl=t.onBadUrl):this.onBadUrl=null,t.buildPrettyMeta?(ut(typeof t.buildPrettyMeta=="function","buildPrettyMeta must be a function"),this.buildPrettyMeta=t.buildPrettyMeta):this.buildPrettyMeta=KS,t.querystringParser?(ut(typeof t.querystringParser=="function","querystringParser must be a function"),this.querystringParser=t.querystringParser):this.querystringParser=e=>e===""?{}:zS.parse(e),this.caseSensitive=t.caseSensitive===void 0?!0:t.caseSensitive,this.ignoreTrailingSlash=t.ignoreTrailingSlash||!1,this.ignoreDuplicateSlashes=t.ignoreDuplicateSlashes||!1,this.maxParamLength=t.maxParamLength||100,this.allowUnsafeRegex=t.allowUnsafeRegex||!1,this.routes=[],this.trees={},this.constrainer=new WS(t.constraints),this._routesPatterns=[]}ct.prototype.on=function(e,r,i,n,s){typeof i=="function"&&(n!==void 0&&(s=n),n=i,i={}),ut(typeof r=="string","Path should be a string"),ut(r.length>0,"The path could not be empty"),ut(r[0]==="/"||r[0]==="*","The first character of a path should be `/` or `*`"),ut(typeof n=="function","Handler should be a function");let a=r.match(ws);if(a){ut(r.length===a.index+a[0].length,"Optional Parameter needs to be the last parameter of the path");let p=r.replace(ws,"$1$2"),m=r.replace(ws,"$2");this.on(e,p,i,n,s),this.on(e,m,i,n,s);return}let c=r;this.ignoreDuplicateSlashes&&(r=pd(r)),this.ignoreTrailingSlash&&(r=md(r));let d=Array.isArray(e)?e:[e];for(let p of d)this._on(p,r,i,n,s,c),this.routes.push({method:p,path:r,opts:i,handler:n,store:s})};ct.prototype._on=function(e,r,i,n,s){ut(typeof e=="string","Method should be a string"),ut(dd.includes(e),`Method '${e}' is not an http method.`);let a={};if(i.constraints!==void 0&&(ut(typeof i.constraints=="object"&&i.constraints!==null,"Constraints should be an object"),Object.keys(i.constraints).length!==0&&(a=i.constraints)),this.constrainer.validateConstraints(a),this.constrainer.noteUsage(a),this.trees[e]===void 0&&(this.trees[e]=new r4("/")),r==="*"&&this.trees[e].prefix.length!==0){let m=this.trees[e];this.trees[e]=new r4(""),this.trees[e].staticChildren["/"]=m}let c=this.trees[e],d=c.prefix.length,p=[];for(let m=0;m<=r.length;m++){if(r.charCodeAt(m)===58&&r.charCodeAt(m+1)===58){m++;continue}let w=r.charCodeAt(m)===58&&r.charCodeAt(m+1)!==58,S=r.charCodeAt(m)===42;if(w||S||m===r.length&&m!==d){let v=r.slice(d,m);this.caseSensitive||(v=v.toLowerCase()),v=v.split("::").join(":"),v=v.split("%").join("%25"),c=c.createStaticChild(v)}if(w){let v=!1,R=[],x=0,A=m+1;for(let T=A;;T++){let O=r.charCodeAt(T);if(O===40||O===45||O===46){v=!0;let B=r.slice(A,T);if(p.push(B),O===40){let te=VS(r,T),se=r.slice(T,te+1);this.allowUnsafeRegex||ut(fd(new RegExp(se)),`The regex '${se}' is not safe!`),R.push(GS(se)),T=te+1}else R.push("(.*?)");let z=T;for(;z<r.length;z++){let te=r.charCodeAt(z);if(te===58||te===47)break}let G=r.slice(T,z);G&&R.push(HS(G)),A=z+1,T=z,(r.charCodeAt(T)===47||T===r.length)&&(x=G.length)}else if(O===47||T===r.length){let B=r.slice(A,T);p.push(B),R.length!==0&&R.push("(.*?)")}if(r.charCodeAt(T)===47||T===r.length){r=r.slice(0,m+1)+r.slice(T-x),m+=x;break}}let C=null;v&&(C=new RegExp("^"+R.join("")+"$")),c=c.createParametricChild(C),d=m+1}else S&&(p.push("*"),c=c.createWildcardChild(),d=m+1)}this.caseSensitive||(r=r.toLowerCase());for(let m of this._routesPatterns)if(m.path===r&&m.method===e&&n4(m.constraints,a))throw new Error(`Method '${e}' already declared for route '${r}' with constraints '${JSON.stringify(a)}'`);this._routesPatterns.push({method:e,path:r,constraints:a}),c.handlerStorage.addHandler(n,p,s,this.constrainer,a)};ct.prototype.hasConstraintStrategy=function(t){return this.constrainer.hasConstraintStrategy(t)};ct.prototype.addConstraintStrategy=function(t){this.constrainer.addConstraintStrategy(t),this._rebuild(this.routes)};ct.prototype.reset=function(){this.trees={},this.routes=[],this._routesPatterns=[]};ct.prototype.off=function(e,r,i){ut(typeof r=="string","Path should be a string"),ut(r.length>0,"The path could not be empty"),ut(r[0]==="/"||r[0]==="*","The first character of a path should be `/` or `*`");let n=r.match(ws);if(n){ut(r.length===n.index+n[0].length,"Optional Parameter needs to be the last parameter of the path");let a=r.replace(ws,"$1$2"),c=r.replace(ws,"$2");this.off(e,a,i),this.off(e,c,i);return}this.ignoreDuplicateSlashes&&(r=pd(r)),this.ignoreTrailingSlash&&(r=md(r));let s=Array.isArray(e)?e:[e];for(let a of s)this._off(a,r,i)};ct.prototype._off=function(e,r,i){ut(typeof e=="string","Method should be a string"),ut(dd.includes(e),`Method '${e}' is not an http method.`);function n(a){return!i||!a?!0:n4(i,a)}let s=this.routes.filter(a=>e!==a.method||r!==a.path||!n(a.opts.constraints));this._rebuild(s)};ct.prototype.lookup=function(e,r,i){var n=this.find(e.method,e.url,this.constrainer.deriveConstraints(e,i));return n===null?this._defaultRoute(e,r,i):i===void 0?n.handler(e,r,n.params,n.store,n.searchParams):n.handler.call(i,e,r,n.params,n.store,n.searchParams)};ct.prototype.find=function(e,r,i){let n=this.trees[e];if(n===void 0)return null;r.charCodeAt(0)!==47&&(r=r.replace(s4,"/")),this.ignoreDuplicateSlashes&&(r=pd(r));let s,a,c;try{s=FS(r),r=s.path,a=s.querystring,c=s.shouldDecodeParam}catch{return this._onBadUrl(r)}this.ignoreTrailingSlash&&(r=md(r));let d=r;this.caseSensitive===!1&&(r=r.toLowerCase());let p=this.maxParamLength,m=n.prefix.length,w=[],S=r.length,v=[];for(;;){if(m===S){let x=n.handlerStorage.getMatchingHandler(i);if(x!==null)return{handler:x.handler,store:x.store,params:x._createParamsObject(w),searchParams:this.querystringParser(a)}}let R=n.getNextNode(r,m,v,w.length);if(R===null){if(v.length===0)return null;let x=v.pop();m=x.brotherPathIndex,w.splice(x.paramsCount),R=x.brotherNode}if(n=R,n.kind===cd.STATIC){m+=n.prefix.length;continue}if(n.kind===cd.WILDCARD){let x=d.slice(m);c&&(x=i4(x)),w.push(x),m=S;continue}if(n.kind===cd.PARAMETRIC){let x=d.indexOf("/",m);x===-1&&(x=S);let A=d.slice(m,x);if(c&&(A=i4(A)),n.isRegex){let C=n.regex.exec(A);if(C===null)continue;for(let T=1;T<C.length;T++){let O=C[T];if(O.length>p)return null;w.push(O)}}else{if(A.length>p)return null;w.push(A)}m=x}}};ct.prototype._rebuild=function(t){this.reset();for(let e of t){let{method:r,path:i,opts:n,handler:s,store:a}=e;this._on(r,i,n,s,a),this.routes.push({method:r,path:i,opts:n,handler:s,store:a})}};ct.prototype._defaultRoute=function(t,e,r){if(this.defaultRoute!==null)return r===void 0?this.defaultRoute(t,e):this.defaultRoute.call(r,t,e);e.statusCode=404,e.end()};ct.prototype._onBadUrl=function(t){if(this.onBadUrl===null)return null;let e=this.onBadUrl;return{handler:(r,i,n)=>e(t,r,i),params:{},store:null}};ct.prototype.prettyPrint=function(t={}){if(t.commonPrefix=t.commonPrefix===void 0?!0:t.commonPrefix,!t.commonPrefix)return $S.call(this,this.routes,t);let e={prefix:"/",nodes:[],children:{}};for(let r in this.trees){let i=this.trees[r];i&&jS(e,i,r)}return qS(e),US.call(this,e,"",!0,t)};for(hd in sc.METHODS){if(!sc.METHODS.hasOwnProperty(hd))continue;let t=sc.METHODS[hd],e=t.toLowerCase();if(ct.prototype[e])throw new Error("Method already exists: "+e);ct.prototype[e]=function(r,i,n){return this.on(t,r,i,n)}}var hd;ct.prototype.all=function(t,e,r){this.on(dd,t,e,r)};o4.exports=ct;function HS(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function pd(t){return t.replace(/\/\/+/g,"/")}function md(t){return t.length>1&&t.charCodeAt(t.length-1)===47?t.slice(0,-1):t}function GS(t){return t.charCodeAt(1)===94&&(t=t.slice(0,1)+t.slice(2)),t.charCodeAt(t.length-2)===36&&(t=t.slice(0,t.length-2)+t.slice(t.length-1)),t}function VS(t,e){for(var r=1;e<t.length;){if(e++,t[e]==="\\"){e++;continue}if(t[e]===")"?r--:t[e]==="("&&r++,!r)return e}throw new TypeError('Invalid regexp expression in "'+t+'"')}function KS(t){return t?t.store?Object.assign({},t.store):{}:{}}});var I4=H((dO,T4)=>{"use strict";T4.exports=ax;var ox={threshold:.1,includeAA:!1,alpha:.1,aaColor:[255,255,0],diffColor:[255,0,0],diffColorAlt:null,diffMask:!1};function ax(t,e,r,i,n,s){if(!Pd(t)||!Pd(e)||r&&!Pd(r))throw new Error("Image data: Uint8Array, Uint8ClampedArray or Buffer expected.");if(t.length!==e.length||r&&r.length!==t.length)throw new Error("Image sizes do not match.");if(t.length!==i*n*4)throw new Error("Image data size does not match width/height.");s=Object.assign({},ox,s);let a=i*n,c=new Uint32Array(t.buffer,t.byteOffset,a),d=new Uint32Array(e.buffer,e.byteOffset,a),p=!0;for(let S=0;S<a;S++)if(c[S]!==d[S]){p=!1;break}if(p){if(r&&!s.diffMask)for(let S=0;S<a;S++)A4(t,4*S,s.alpha,r);return 0}let m=35215*s.threshold*s.threshold,w=0;for(let S=0;S<n;S++)for(let v=0;v<i;v++){let R=(S*i+v)*4,x=P4(t,e,R,R);Math.abs(x)>m?!s.includeAA&&(E4(t,v,S,i,n,e)||E4(e,v,S,i,n,t))?r&&!s.diffMask&&Id(r,R,...s.aaColor):(r&&Id(r,R,...x<0&&s.diffColorAlt||s.diffColor),w++):r&&(s.diffMask||A4(t,R,s.alpha,r))}return w}function Pd(t){return ArrayBuffer.isView(t)&&t.constructor.BYTES_PER_ELEMENT===1}function E4(t,e,r,i,n,s){let a=Math.max(e-1,0),c=Math.max(r-1,0),d=Math.min(e+1,i-1),p=Math.min(r+1,n-1),m=(r*i+e)*4,w=e===a||e===d||r===c||r===p?1:0,S=0,v=0,R,x,A,C;for(let T=a;T<=d;T++)for(let O=c;O<=p;O++){if(T===e&&O===r)continue;let B=P4(t,t,m,(O*i+T)*4,!0);if(B===0){if(w++,w>2)return!1}else B<S?(S=B,R=T,x=O):B>v&&(v=B,A=T,C=O)}return S===0||v===0?!1:xc(t,R,x,i,n)&&xc(s,R,x,i,n)||xc(t,A,C,i,n)&&xc(s,A,C,i,n)}function xc(t,e,r,i,n){let s=Math.max(e-1,0),a=Math.max(r-1,0),c=Math.min(e+1,i-1),d=Math.min(r+1,n-1),p=(r*i+e)*4,m=e===s||e===c||r===a||r===d?1:0;for(let w=s;w<=c;w++)for(let S=a;S<=d;S++){if(w===e&&S===r)continue;let v=(S*i+w)*4;if(t[p]===t[v]&&t[p+1]===t[v+1]&&t[p+2]===t[v+2]&&t[p+3]===t[v+3]&&m++,m>2)return!0}return!1}function P4(t,e,r,i,n){let s=t[r+0],a=t[r+1],c=t[r+2],d=t[r+3],p=e[i+0],m=e[i+1],w=e[i+2],S=e[i+3];if(d===S&&s===p&&a===m&&c===w)return 0;d<255&&(d/=255,s=Ss(s,d),a=Ss(a,d),c=Ss(c,d)),S<255&&(S/=255,p=Ss(p,S),m=Ss(m,S),w=Ss(w,S));let v=Td(s,a,c),R=Td(p,m,w),x=v-R;if(n)return x;let A=R4(s,a,c)-R4(p,m,w),C=C4(s,a,c)-C4(p,m,w),T=.5053*x*x+.299*A*A+.1957*C*C;return v>R?-T:T}function Td(t,e,r){return t*.29889531+e*.58662247+r*.11448223}function R4(t,e,r){return t*.59597799-e*.2741761-r*.32180189}function C4(t,e,r){return t*.21147017-e*.52261711+r*.31114694}function Ss(t,e){return 255+(t-255)*e}function Id(t,e,r,i,n){t[e+0]=r,t[e+1]=i,t[e+2]=n,t[e+3]=255}function A4(t,e,r,i){let n=t[e+0],s=t[e+1],a=t[e+2],c=Ss(Td(n,s,a),r*t[e+3]/255);Id(i,e,c,c,c)}});var Ld=H(Od=>{Od.read=function(t,e,r,i,n){var s,a,c=n*8-i-1,d=(1<<c)-1,p=d>>1,m=-7,w=r?n-1:0,S=r?-1:1,v=t[e+w];for(w+=S,s=v&(1<<-m)-1,v>>=-m,m+=c;m>0;s=s*256+t[e+w],w+=S,m-=8);for(a=s&(1<<-m)-1,s>>=-m,m+=i;m>0;a=a*256+t[e+w],w+=S,m-=8);if(s===0)s=1-p;else{if(s===d)return a?NaN:(v?-1:1)*(1/0);a=a+Math.pow(2,i),s=s-p}return(v?-1:1)*a*Math.pow(2,s-i)};Od.write=function(t,e,r,i,n,s){var a,c,d,p=s*8-n-1,m=(1<<p)-1,w=m>>1,S=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,v=i?0:s-1,R=i?1:-1,x=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(c=isNaN(e)?1:0,a=m):(a=Math.floor(Math.log(e)/Math.LN2),e*(d=Math.pow(2,-a))<1&&(a--,d*=2),a+w>=1?e+=S/d:e+=S*Math.pow(2,1-w),e*d>=2&&(a++,d/=2),a+w>=m?(c=0,a=m):a+w>=1?(c=(e*d-1)*Math.pow(2,n),a=a+w):(c=e*Math.pow(2,w-1)*Math.pow(2,n),a=0));n>=8;t[r+v]=c&255,v+=R,c/=256,n-=8);for(a=a<<n|c,p+=n;p>0;t[r+v]=a&255,v+=R,a/=256,p-=8);t[r+v-R]|=x*128}});var Lx={};t2(Lx,{handleRequest:()=>cg,handler:()=>Vt});module.exports=jg(Lx);var tr;(function(t){t.Imagery="im",t.TileSet="ts",t.Provider="pv",t.ImageryRule="ir",t.Style="st",t.ProcessingJob="pj",t.ConfigBundle="cb"})(tr||(tr={}));var n2=new Set(Object.values(tr));var st;(function(t){t.Raster="raster",t.Vector="vector"})(st||(st={}));var zl=class{get TileSet(){return this.cfg.TileSet}get Imagery(){return this.cfg.Imagery}get Style(){return this.cfg.Style}get Provider(){return this.cfg.Provider}get ProcessingJob(){return this.cfg.ProcessingJob}setConfigProvider(e){this.cfg=e}isTileSetRaster(e){return e==null?!1:e.type==null||e.type===st.Raster}isTileSetVector(e){return e==null?!1:e.type===st.Vector}async getAllImagery(e,r){let i=new Set;for(let n of r)for(let s of e){let a=s[n.code];a&&i.add(this.Imagery.id(a))}return this.Imagery.getAll(i)}prefix(e,r){return r===""||r.startsWith(e)?r:`${e}_${r}`}getPrefix(e){let r=e.indexOf("_");if(r===-1)return null;let i=e.slice(0,r);return n2.has(i)?i:null}unprefix(e,r){return r.startsWith(e)?r.slice(3):r}},eo=class{},qa=class{constructor(e){this.prefix=e}isWriteable(){return!1}id(e){return e.startsWith(`${this.prefix}_`)?e:`${this.prefix}_${e}`}is(e){return e!=null&&e.id.startsWith(this.prefix)}},je=new zl;var Fh;(function(t){t.Processing="processing",t.Complete="complete",t.Fail="failed"})(Fh||(Fh={}));var s2=fe(require("aws-sdk/clients/dynamodb.js"),1);var to=fe(require("aws-sdk/clients/dynamodb.js"),1);function qg(t){return{id:{S:t}}}var rn=class extends qa{constructor(e,r){super(r),this.cfg=e}ensureId(e){if(e.startsWith(this.prefix+"_"))return e;throw new Error(`Trying to query "${e}" expected prefix of ${this.prefix}`)}get db(){return this.cfg.dynamo}isWriteable(){return!0}clone(e){return to.default.Converter.unmarshall(to.default.Converter.marshall(e))}async get(e){let r=await this.db.getItem({Key:{id:{S:this.ensureId(e)}},TableName:this.cfg.tableName}).promise();if(r==null||r.Item==null)return null;let i=to.default.Converter.unmarshall(r.Item);return this.is(i)?i:null}async getAll(e){var r;let i=[];for(let s of e)i.push(qg(this.ensureId(s)));let n=new Map;for(;i.length>0;){let s=i.length>100?i.slice(0,100):i;i=i.length>100?i.slice(100):[];let a={[this.cfg.tableName]:{Keys:s}};for(;a!=null&&Object.keys(a).length>0;){let c=await this.db.batchGetItem({RequestItems:a}).promise(),d=(r=c.Responses)===null||r===void 0?void 0:r[this.cfg.tableName];if(d==null)throw new Error("Failed to fetch from "+this.cfg.tableName);for(let p of d){let m=to.default.Converter.unmarshall(p);this.is(m)&&n.set(m.id,m)}a=c.UnprocessedKeys}}return n}async put(e){return e.updatedAt=Date.now(),await this.db.putItem({TableName:this.cfg.tableName,Item:to.default.Converter.marshall(e)}).promise(),e.id}};var ro=class extends rn{constructor(){super(...arguments),this.cache=new Map}async get(e){let r=this.ensureId(e),i=this.cache.get(r);if(i==null){if(i=await super.get(r),i==null)return null;this.cache.set(r,i)}return i}async getAll(e){let r=new Map,i=new Set;for(let n of e){let s=this.ensureId(n),a=this.cache.get(s);a==null?i.add(s):r.set(s,a)}if(i.size>0){let n=await super.getAll(i);for(let s of n.values())r.set(s.id,s),this.cache.set(s.id,s)}return r}};var Ua=class extends eo{constructor(e){super(),this.Prefix=tr,this.type="dynamo",this.Imagery=new ro(this,tr.Imagery),this.Style=new ro(this,tr.Style),this.TileSet=new rn(this,tr.TileSet),this.Provider=new ro(this,tr.Provider),this.ProcessingJob=new rn(this,tr.ProcessingJob),this.dynamo=new s2.default({region:"ap-southeast-2"}),this.tableName=e}record(){let e=Date.now();return{id:"",name:"",updatedAt:e}}};var ge=class{constructor(e,r,i,n){this.x=e,this.y=r,this.width=i,this.height=n}get bottom(){return this.y+this.height}get right(){return this.x+this.width}intersects(e){return this.x<e.right&&e.x<this.right&&this.y<e.bottom&&e.y<this.bottom}containsBounds(e){return ge.contains(this,e)}intersection(e){let r=Math.max(this.x,e.x),i=Math.min(this.x+this.width,e.x+e.width),n=Math.max(this.y,e.y),s=Math.min(this.y+this.height,e.y+e.height);return i>r&&s>n?new ge(r,n,i-r,s-n):null}static union(e){if(e.length===0)throw new Error("Union on empty list is not allowed");let{x:r,y:i}=e[0],n=r+e[0].width,s=i+e[0].height;for(let a=1;a<e.length;++a){let c=e[a];r=Math.min(r,c.x),n=Math.max(n,c.x+c.width),i=Math.min(i,c.y),s=Math.max(s,c.y+c.height)}return new ge(r,i,n-r,s-i)}union(e){return ge.union([this,e])}toJson(){return{x:this.x,y:this.y,width:this.width,height:this.height}}toBbox(){return[this.x,this.y,this.right,this.bottom]}toPolygon(){return[[[this.x,this.y],[this.x,this.bottom],[this.right,this.bottom],[this.right,this.y],[this.x,this.y]]]}scale(e,r=e){return new ge(this.x*e,this.y*r,this.width*e,this.height*r)}scaleFromCenter(e,r=e){let i=this.width*e,n=this.height*r;return new ge(this.x-.5*(i-this.width),this.y-.5*(n-this.height),i,n)}pad(e,r=e){return new ge(this.x-e,this.y-r,this.width+e*2,this.height+r*2)}round(e=0){let r=Math.round(this.x-e),i=Math.round(this.y-e);return new ge(r,i,Math.round(this.right+e)-r,Math.round(this.bottom+e)-i)}add(e){return new ge(this.x+e.x,this.y+e.y,this.width,this.height)}subtract(e){return new ge(this.x-e.x,this.y-e.y,this.width,this.height)}static fromMultiPolygon(e){if(e.length===0)return new ge(0,0,0,0);let r=e[0][0][0][0],i=e[0][0][0][1],n=r,s=i;for(let[a]of e)for(let[c,d]of a)c<r?r=c:c>n&&(n=c),d<i?i=d:d>s&&(s=d);return new ge(r,i,n-r,s-i)}static fromBbox([e,r,i,n]){return new ge(Math.min(e,i),Math.min(r,n),Math.abs(i-e),Math.abs(n-r))}static fromUpperLeftLowerRight(e,r){return new ge(e.x,e.y,r.x-e.x,r.y-e.y)}static fromJson(e){return new ge(e.x,e.y,e.width,e.height)}static compareArea(e,r){let i=e.width*e.height-r.width*r.height;if(i!==0)return i;let n=e.x-r.x;return n===0?e.y-r.y:n}static contains(e,r){return e.x<=r.x&&e.x+e.width>=r.x+r.width&&e.y<=r.y&&e.y+e.height>=r.y+r.height}};var Fe;(function(t){t[t.Google=3857]="Google",t[t.Wgs84=4326]="Wgs84",t[t.Nztm2000=2193]="Nztm2000",t[t.Citm2000=3793]="Citm2000"})(Fe||(Fe={}));var Hh={google:Fe.Google,epsg3857:Fe.Google,[Fe.Google]:Fe.Google,globalmercator:Fe.Google,wgs84:Fe.Wgs84,epsg4326:Fe.Wgs84,[Fe.Wgs84]:Fe.Wgs84,nztm:Fe.Nztm2000,epsg2193:Fe.Nztm2000,[Fe.Nztm2000]:Fe.Nztm2000,nztm2000:Fe.Nztm2000,citm:Fe.Citm2000,epsg3793:Fe.Citm2000,[Fe.Citm2000]:Fe.Citm2000,citm2000:Fe.Citm2000},Se=class{constructor(e){if(this.code=e,Se.Codes.has(e))throw new Error(`Duplicate EPSG code created: ${e}`);Se.Codes.set(this.code,this)}toString(){return this.code.toString()}toJSON(){return this.code}toEpsgString(){return`EPSG:${this.code}`}toUrn(){return`urn:ogc:def:crs:EPSG::${this.code}`}static get(e){let r=Se.Codes.get(e);if(r==null)throw new Error(`Invalid EPSG:${e}`);return r}static tryGet(e){if(e!=null)return Se.Codes.get(e)}static parseCode(e){var r;return e.startsWith("urn:")?Hh[e.slice(e.lastIndexOf(":")+1)]:e.startsWith("https://")?Hh[e.slice(e.lastIndexOf("/")+1)]:(r=Hh[e.replace(/[\W_]/g,"").toLowerCase()])!==null&&r!==void 0?r:null}static parse(e){let r=Se.parseCode(e);return r==null?null:Se.get(r)}};Se.Codes=new Map;Se.Google=new Se(Fe.Google);Se.Wgs84=new Se(Fe.Wgs84);Se.Nztm2000=new Se(Fe.Nztm2000);Se.Citm2000=new Se(Fe.Citm2000);var Qx="0".charCodeAt(0),eM="1".charCodeAt(0),tM="2".charCodeAt(0),rM="3".charCodeAt(0);var io;(function(t){t[t.Xy=0]="Xy",t[t.Yx=1]="Yx"})(io||(io={}));function o2(t){return t===Se.Nztm2000?io.Yx:io.Xy}function Ug(t,e){return e.scaleDenominator-t.scaleDenominator}var _t=class{constructor(e){this.zooms=[],this.indexX=0,this.indexY=1,this.zoomConversionMap=new Map,this.def=e,this.tileSize=e.tileMatrix[0].tileHeight;let r=e.tileMatrix.slice().sort(Ug),i={};for(let p of r){if(i[p.identifier])throw new Error(`Duplicate tileMatrix identifier ${p.identifier}`);if(p.tileHeight!==p.tileWidth)throw new Error("Only square tiles supported");if(p.tileHeight!==this.tileSize)throw new Error("All tiles must have the same tile size");i[p.identifier]=!0}this.zooms=r;let n=Se.parse(e.supportedCRS);if(n==null)throw new Error(`Unable to find supported projection ${e.supportedCRS}`);this.projection=n,o2(this.projection)===io.Yx&&(this.indexX=1,this.indexY=0);let{lowerCorner:s,upperCorner:a}=e.boundingBox,c=s[this.indexX],d=s[this.indexY];this.extent=new ge(c,d,a[this.indexX]-c,a[this.indexY]-d)}get maxZoom(){return this.zooms.length-1}get identifier(){return this.def.identifier}pixelScale(e){let r=this.zooms[e];if(r==null)throw new Error(`Zoom not found :${e}`);return r.scaleDenominator*28e-5}tileToPixels(e,r){return{x:e*this.tileSize,y:r*this.tileSize}}pixelsToTile(e,r,i){let n=Math.floor(e/this.tileSize),s=Math.floor(r/this.tileSize);return{x:n,y:s,z:i}}sourceToPixels(e,r,i){let n=this.zooms[i],s=this.pixelScale(i),a=(e-n.topLeftCorner[this.indexX])/s,c=(n.topLeftCorner[this.indexY]-r)/s;return{x:a,y:c}}pixelsToSource(e,r,i){let n=this.zooms[i],s=this.pixelScale(i),a=n.topLeftCorner[this.indexX]+e*s,c=n.topLeftCorner[this.indexY]-r*s;return{x:a,y:c}}tileToSource(e){let r=this.tileToPixels(e.x,e.y);return this.pixelsToSource(r.x,r.y,e.z)}tileToSourceBounds(e){let r=this.tileToSource(e),i=this.pixelScale(e.z)*this.tileSize;return new ge(r.x,r.y-i,i,i)}*topLevelTiles(){let{matrixWidth:r,matrixHeight:i}=this.zooms[0];for(let n=0;n<i;++n)for(let s=0;s<r;++s)yield{x:s,y:n,z:0};return null}*coverTile(e){if(e==null)return yield*this.topLevelTiles(),null;let r=e.z+1,{matrixWidth:i,matrixHeight:n}=this.zooms[e.z],{matrixWidth:s,matrixHeight:a}=this.zooms[r],c=s/i,d=a/n,p=Math.floor(e.x*c),m=Math.floor(e.y*d),w=Math.ceil((e.x+1)*c),S=Math.ceil((e.y+1)*d);for(let v=m;v<S;++v)for(let R=p;R<w;++R)yield{x:R,y:v,z:r};return null}static tileToName(e){return`${e.z}-${e.x}-${e.y}`}static nameToTile(e){let r=e.split("-");if(r.length===3){let i=Number(r[0]),n=Number(r[1]),s=Number(r[2]);if(!(isNaN(i)||isNaN(s)||isNaN(n)))return{x:n,y:s,z:i}}throw new Error(`Invalid tile name '${e}'`)}findBestZoom(e){let r=this.zoomConversionMap.get(e);return r==null&&(r=this.convertZoomLevel(e),this.zoomConversionMap.set(e,r)),r}convertZoomLevel(e){for(let r=0;r<this.zooms.length;r++){let i=this.zooms[r].scaleDenominator-e;if(i>1e-5)continue;if(r===0)return r;let n=this.zooms[r-1].scaleDenominator-e;return Math.abs(i)<n?r:r-1}return this.maxZoom}static convertZoomLevel(e,r,i,n=!0){return r.identifier===i.identifier||(e>=r.maxZoom&&(e=r.maxZoom),n&&e===0)?e:n&&e===r.maxZoom?i.maxZoom:i.findBestZoom(r.zooms[e].scaleDenominator)}};var $a={Version:"1.0.0-beta.2",License:"CC BY 4.0",BaseMapsExtension:"https://basemaps.linz.govt.nz/json-schema/stac-basemaps-extension/1.0/schema.json"};var $g={type:"TileMatrixSetType",title:"Google Maps Compatible for the World",identifier:"WebMercatorQuad",boundingBox:{type:"BoundingBoxType",crs:"http://www.opengis.net/def/crs/EPSG/0/3857",lowerCorner:[-200375083427892e-7,-200375083427892e-7],upperCorner:[200375083427892e-7,200375083427892e-7]},supportedCRS:"https://www.opengis.net/def/crs/EPSG/0/3857",wellKnownScaleSet:"https://www.opengis.net/def/wkss/OGC/1.0/GoogleMapsCompatible",tileMatrix:[{type:"TileMatrixType",identifier:"0",scaleDenominator:559082264028717e-6,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:1,matrixHeight:1},{type:"TileMatrixType",identifier:"1",scaleDenominator:279541132014358e-6,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:2,matrixHeight:2},{type:"TileMatrixType",identifier:"2",scaleDenominator:139770566007179e-6,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:4,matrixHeight:4},{type:"TileMatrixType",identifier:"3",scaleDenominator:698852830035897e-7,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:8,matrixHeight:8},{type:"TileMatrixType",identifier:"4",scaleDenominator:349426415017948e-7,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:16,matrixHeight:16},{type:"TileMatrixType",identifier:"5",scaleDenominator:174713207508974e-7,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:32,matrixHeight:32},{type:"TileMatrixType",identifier:"6",scaleDenominator:873566037544871e-8,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:64,matrixHeight:64},{type:"TileMatrixType",identifier:"7",scaleDenominator:436783018772435e-8,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:128,matrixHeight:128},{type:"TileMatrixType",identifier:"8",scaleDenominator:218391509386217e-8,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:256,matrixHeight:256},{type:"TileMatrixType",identifier:"9",scaleDenominator:109195754693108e-8,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:512,matrixHeight:512},{type:"TileMatrixType",identifier:"10",scaleDenominator:545978.773465544,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:1024,matrixHeight:1024},{type:"TileMatrixType",identifier:"11",scaleDenominator:272989.386732772,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:2048,matrixHeight:2048},{type:"TileMatrixType",identifier:"12",scaleDenominator:136494.693366386,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:4096,matrixHeight:4096},{type:"TileMatrixType",identifier:"13",scaleDenominator:68247.346683193,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:8192,matrixHeight:8192},{type:"TileMatrixType",identifier:"14",scaleDenominator:34123.6733415964,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:16384,matrixHeight:16384},{type:"TileMatrixType",identifier:"15",scaleDenominator:17061.8366707982,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:32768,matrixHeight:32768},{type:"TileMatrixType",identifier:"16",scaleDenominator:8530.91833539913,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:65536,matrixHeight:65536},{type:"TileMatrixType",identifier:"17",scaleDenominator:4265.45916769956,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:131072,matrixHeight:131072},{type:"TileMatrixType",identifier:"18",scaleDenominator:2132.72958384978,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:262144,matrixHeight:262144},{type:"TileMatrixType",identifier:"19",scaleDenominator:1066.36479192489,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:524288,matrixHeight:524288},{type:"TileMatrixType",identifier:"20",scaleDenominator:533.182395962445,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:1048576,matrixHeight:1048576},{type:"TileMatrixType",identifier:"21",scaleDenominator:266.591197981222,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:2097152,matrixHeight:2097152},{type:"TileMatrixType",identifier:"22",scaleDenominator:133.295598990611,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:4194304,matrixHeight:4194304},{type:"TileMatrixType",identifier:"23",scaleDenominator:66.6477994953056,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:8388608,matrixHeight:8388608},{type:"TileMatrixType",identifier:"24",scaleDenominator:33.3238997476528,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:16777216,matrixHeight:16777216}]},lt=new _t($g);var Ul=fe(u2(),1),$l=new _t(Ul.Nztm2000),nn=new _t(Ul.Nztm2000Quad);var sn={All:[lt,$l,nn],Defaults:new Map([[Se.Google.code,lt],[Se.Nztm2000.code,$l]]),get(t){let e=this.tryGet(t);if(e==null)throw new Error("Failed to lookup TileMatrixSet: "+t);return e},tryGet(t){var e,r;return t==null?null:typeof t=="number"?(e=this.Defaults.get(t))!==null&&e!==void 0?e:null:(r=this.Defaults.get(t.code))!==null&&r!==void 0?r:null},find(t){if(t==null)return null;let e=Se.parse(t);if(e!=null)return sn.tryGet(e);for(let r of sn.All)if(r.identifier===t)return r;return null}};var qe;(function(t){t.Png="png",t.Jpeg="jpeg",t.Webp="webp",t.Avif="avif"})(qe||(qe={}));var rr;(function(t){t.MapboxVectorTiles="pbf"})(rr||(rr={}));var h2=fe(Zn(),1);function Hg(t){if(!t.endsWith("m")||!t.includes("-"))return null;let e=Number(t.replace("-",".").slice(0,t.length-1));return isNaN(e)?null:String(e)+"m"}function Gg(t){let e=t.split("-");return e.length!==2||e[0].length!==4?null:e[1].length===4?t:e[1].length===2?`${e[0]}-${e[0].slice(0,2)}${e[1]}`:null}var Vg=[Hg,Gg];function so(t){let e=new Set(t.split("_"));e.delete("RGB"),e.delete("RGBI"),e.delete("RGBA");let r=[];for(let i of e){let n=!1;for(let s of Vg){let a=s(i);if(a!=null){n=!0,r.push(a);break}}n||r.push(i)}return r.join("-")}var zt={parse(t){let e={name:t},r=t.indexOf(":");return r!==-1&&(e.layer=e.name.substring(r+1),e.name=e.name.substring(0,r)),e},componentsToName(t){return zt.toName(t.name,t.layer)},toName(t,e){let r=[t];return e&&r.push(`:${e}`),r.join("")}};function Wa(t){if(t==="")return 0;let e=parseInt(t,16);if(isNaN(e))throw new Error("Invalid hex byte: "+t);return e}function Fl(t){if(t.startsWith("0x")?t=t.slice(2):t.startsWith("#")&&(t=t.slice(1)),t.length!==6&&t.length!==8)throw new Error("Invalid hex color: "+t);return{r:Wa(t.substr(0,2)),g:Wa(t.substr(2,2)),b:Wa(t.substr(4,2)),alpha:Wa(t.substr(6,2))}}var an=fe(require("fs"),1),Vl=fe(require("path"),1);var St;(function(t){t[t.UInt8=1]="UInt8",t[t.UInt16=2]="UInt16",t[t.UInt32=4]="UInt32",t[t.UInt64=8]="UInt64",t[t.Double=8]="Double",t[t.Float=4]="Float"})(St||(St={}));var f2=2**32,Kg=typeof setImmediate>"u"?setTimeout:setImmediate,At=()=>{throw new Error("Method not implemented.")},xt=class{constructor(){this.isLittleEndian=!0,this.delayMs=xt.DefaultDelayMs,this.maxChunkCount=10,this.chunks=xt.DefaultChunkCache(),this.blankFillCount=16,this.maxConcurrentRequests=50,this.toFetch=new Set,this.toFetchPromise=null,this.byteOffset=0,this.getFloat32=At,this.getFloat64=At,this.getInt8=At,this.getInt16=At,this.getInt32=At,this.setFloat32=At,this.setFloat64=At,this.setInt8=At,this.setInt16=At,this.setInt32=At,this.setUint8=At,this.setUint16=At,this.setUint32=At,this.setBigInt64=At,this.setBigUint64=At}static getByteRanges(e,r=32,i=16){if(e.size===0)return{chunks:[],blankFill:[]};let n=[...e.values()].sort((d,p)=>d-p),s=[],a=[];s.push(a);let c=[];for(let d=0;d<n.length;++d){let p=n[d],m=n[d-1];if(a.length>=r)a=[p],s.push(a);else if(d===0||p===m+1)a.push(p);else if(p<m+i){for(let w=m;w<p;w++)a.push(w+1),c.push(w+1);c.pop()}else a=[p],s.push(a)}return{chunks:s,blankFill:c}}async fetchData(){if(this.toFetch.size===0)return;let e=this.toFetch;this.toFetch=new Set,this.toFetchPromise=null;let r=xt.getByteRanges(e,this.maxChunkCount,this.blankFillCount),i=[];for(let n of r.chunks){let s=n[0],a=n[n.length-1],c=s*this.chunkSize,d=a*this.chunkSize+this.chunkSize-c,p=await this.fetchBytes(c,d);if(n.length===1){i[s]=p,this.chunks.set(s,new DataView(p));continue}let m=s*this.chunkSize;for(let w of n){let S=w*this.chunkSize-m,v=p.slice(S,S+this.chunkSize);i[w]=v,this.chunks.set(w,new DataView(v))}}}async loadBytes(e,r){if(e<0)throw new Error("Offset must be positive");let i=Math.floor(e/this.chunkSize),n=Math.ceil((e+r)/this.chunkSize)-1;for(let s=i;s<=n;s++)this.chunks.has(s)||this.toFetch.add(s);if(this.toFetch.size!==0){if(this.toFetchPromise==null&&(this.toFetchPromise=new Promise(s=>Kg(s,this.delayMs)).then(()=>this.fetchData())),this.toFetch.size>this.maxConcurrentRequests)throw new Error("Too many outstanding requests");await this.toFetchPromise}}getChunkId(e){return Math.floor(e/this.chunkSize)}getUint(e,r){switch(r){case St.UInt8:return this.getUint8(e);case St.UInt16:return this.getUint16(e);case St.UInt32:return this.getUint32(e);case St.UInt64:return this.getUint64(e)}}bytes(e,r){let i=this.isOneChunk(e,r);if(i){let p=this.getView(i),m=e-i*this.chunkSize;return new Uint8Array(p.buffer.slice(m,m+r))}let n=new Uint8Array(r),s=e+r,a=Math.floor(e/this.chunkSize),c=Math.ceil((e+r)/this.chunkSize)-1,d=0;for(let p=a;p<=c;p++){let m=e+d,w=p*this.chunkSize,S=this.getView(p),v=Math.min(s,w+this.chunkSize),R=S.buffer.slice(m-w,v-w);n.set(new Uint8Array(R),d),d+=R.byteLength}return n}getView(e){let r=this.chunks.get(e);if(r==null)throw new Error(`Chunk:${e} is not ready`);return r}isOneChunk(e,r){let i=e+r-1,n=Math.floor(e/this.chunkSize);return Math.floor(i/this.chunkSize)-n<1?n:null}hasBytes(e,r=1){let i=Math.floor(e/this.chunkSize),n=Math.ceil((e+r)/this.chunkSize)-1;for(let s=i;s<=n;s++)if(!this.chunks.has(s))return!1;return!0}toRange(e,r){if(r==null)return`bytes=${e}`;if(e<0)throw new Error("Cannot read from remote source with negative offset and length");return`bytes=${e}-${e+r}`}parseContentRange(e){let[r,i]=e.split(" ");if(r!=="bytes")throw new Error("Failed to parse content-range: "+e);if(i==null)throw new Error("Failed to parse content-range: "+e);let[,n]=i.split("/"),s=Number(n);if(isNaN(s))throw new Error("Failed to parse content-range: "+e);return s}get buffer(){throw new Error("Method not implemented.")}get byteLength(){if(this._byteLength)return this._byteLength;throw Error(".size() has not been fetched.")}getUint8(e){let r=Math.floor(e/this.chunkSize),i=this.chunks.get(r);if(i==null)throw new Error(`Chunk:${r} is not ready`);return i.getUint8(e-r*this.chunkSize)}getUint16(e){let r=this.isOneChunk(e,St.UInt16);if(r!=null)return this.getView(r).getUint16(e-r*this.chunkSize,this.isLittleEndian);let i=this.getUint8(e),n=this.getUint8(e+St.UInt8);return this.isLittleEndian?i+(n<<8):(i<<8)+n}getUint32(e){let r=this.isOneChunk(e,St.UInt32);if(r!=null)return this.getView(r).getUint32(e-r*this.chunkSize,this.isLittleEndian);let i=this.getUint16(e),n=this.getUint16(e+St.UInt16);return this.isLittleEndian?i+n*65536:i*65536+n}getUint64(e){let r=this.isOneChunk(e,St.UInt64);if(r!=null){let s=this.getView(r);return Number(s.getBigUint64(e-r*this.chunkSize,this.isLittleEndian))}let i=this.getUint32(e),n=this.getUint32(e+St.UInt32);return this.isLittleEndian?i+n*f2:i*f2+n}getBigUint64(e){let r=this.isOneChunk(e,St.UInt64);if(r!=null)return this.getView(r).getBigUint64(e-r*this.chunkSize,this.isLittleEndian);let i=BigInt(this.getUint32(e)),n=BigInt(this.getUint32(e+St.UInt32));return this.isLittleEndian?i+(n<<BigInt(32)):(i<<BigInt(32))+n}getBigInt64(){throw new Error("Not implemented.")}};xt.DefaultChunkCache=()=>new Map;xt.DefaultDelayMs=1;var Je=class extends Error{constructor(e,r,i){super(e),this.name="CompositeError",this.code=r,this.reason=i}static isCompositeError(e){return typeof e!="object"||e==null?!1:e.name==="CompositeError"}};function Ai(t){return typeof t=="object"&&t!==null}function ni(t){let e=t.split("/"),r=e[0];if(r==null||r==="")return null;r.endsWith(":")&&(r=r.slice(0,r.length-1));let i=e[2];if(i==null||i.trim()==="")return null;if(e.length===3)return{protocol:r,bucket:i};let n=e.slice(3).join("/");return n==null||n.trim()===""?{protocol:r,bucket:i}:{key:n,bucket:i,protocol:r}}var Jg=/\/$/,Yg=/^\//;function Gh(t,e){return t.replace(Jg,"")+"/"+e.replace(Yg,"")}function d2(t,...e){let r=t;for(let i=0;i<e.length;i++)r=Gh(r,e[i]);return r}async function p2(t){let e=[];for await(let r of t)e.push(r);return e}var Vh=require("fs"),Hl=require("path"),on=class extends xt{constructor(e){super(),this.type="file",this.protocol="file",this.chunkSize=on.DefaultChunkSize,this.fd=null,this.closeAfterRead=!1,this.fileName=e}static isSource(e){return e.type==="file"}async close(){let e=await this.fd;e!=null&&(await e.close(),this.fd=null)}get uri(){return(0,Hl.resolve)(this.fileName)}get name(){return(0,Hl.basename)(this.fileName)}get size(){return this._size?this._size:(this._size=Promise.resolve().then(async()=>(await Vh.promises.stat(this.fileName)).size),this._size)}async fetchBytes(e,r){if(e<0&&r!=null)throw new Error("Cannot fetch negative offsets with length");if(e<0&&(r=Math.abs(e),e=await this.size+e),r==null)throw new Error("Length is required for reading from files");this.fd==null&&(this.fd=Vh.promises.open(this.fileName,"r"));let i=await this.fd,{buffer:n}=await i.read(Buffer.allocUnsafe(r),0,r,e);return this.closeAfterRead&&await this.close(),n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength)}};on.DefaultChunkSize=16*1024;function Gl(t,e){return Ai(t)?t.code==="ENOENT"?new Je(e,404,t):t.code==="EACCES"?new Je(e,403,t):new Je(e,500,t):new Je(e,500,t)}var Pi=class{constructor(){this.protocol=Pi.protocol}static is(e){return e.protocol===Pi.protocol}source(e){return new on(e)}async*list(e,r){try{let i=await an.default.promises.readdir(e,{withFileTypes:!0}),n=Vl.default.resolve(e);for(let s of i){let a=Vl.default.join(n,s.name);s.isDirectory()&&r?.recursive!==!1?yield*this.list(a):yield a}}catch(i){throw Gl(i,`Failed to list: ${e}`)}}async*details(e,r){for await(let i of this.list(e,r)){let n=await this.head(i);n!=null&&(yield n)}}async head(e){try{let r=await an.default.promises.stat(e);return{path:e,size:r.size,isDirectory:r.isDirectory()}}catch(r){if(Ai(r)&&r.code==="ENOENT")return null;throw Gl(r,`Failed to stat: ${e}`)}}async read(e){try{return await an.default.promises.readFile(e)}catch(r){throw Gl(r,`Failed to read: ${e}`)}}async write(e,r){let i=Vl.default.dirname(e);await an.default.promises.mkdir(i,{recursive:!0});try{if(Buffer.isBuffer(r)||typeof r=="string")await an.default.promises.writeFile(e,r);else{let n=an.default.createWriteStream(e);await new Promise((s,a)=>{n.on("finish",s),n.on("error",a),r.pipe(n)})}}catch(n){throw Gl(n,`Failed to write: ${e}`)}}stream(e){return an.default.createReadStream(e)}};Pi.protocol="file";var Z2=fe(require("http"),1),J2=fe(require("https"),1),ts=fe(require("zlib"),1),nr=fe(require("stream"),1),Qa=require("buffer");function Xg(t){if(!/^data:/i.test(t))throw new TypeError('`uri` does not appear to be a Data URI (must begin with "data:")');t=t.replace(/\r?\n/g,"");let e=t.indexOf(",");if(e===-1||e<=4)throw new TypeError("malformed data: URI");let r=t.substring(5,e).split(";"),i="",n=!1,s=r[0]||"text/plain",a=s;for(let m=1;m<r.length;m++)r[m]==="base64"?n=!0:(a+=`;${r[m]}`,r[m].indexOf("charset=")===0&&(i=r[m].substring(8)));!r[0]&&!i.length&&(a+=";charset=US-ASCII",i="US-ASCII");let c=n?"base64":"ascii",d=unescape(t.substring(e+1)),p=Buffer.from(d,c);return p.type=s,p.typeFull=a,p.charset=i,p}var m2=Xg;var gr=fe(require("stream"),1),Oi=require("util"),ir=require("buffer");Ha();Jl();var ki=class extends Error{constructor(e,r){super(e),Error.captureStackTrace(this,this.constructor),this.type=r}get name(){return this.constructor.name}get[Symbol.toStringTag](){return this.constructor.name}};var jt=class extends ki{constructor(e,r,i){super(e,r),i&&(this.code=this.errno=i.code,this.erroredSysCall=i.syscall)}};var Yl=Symbol.toStringTag,Yh=t=>typeof t=="object"&&typeof t.append=="function"&&typeof t.delete=="function"&&typeof t.get=="function"&&typeof t.getAll=="function"&&typeof t.has=="function"&&typeof t.set=="function"&&typeof t.sort=="function"&&t[Yl]==="URLSearchParams",Za=t=>t&&typeof t=="object"&&typeof t.arrayBuffer=="function"&&typeof t.type=="string"&&typeof t.stream=="function"&&typeof t.constructor=="function"&&/^(Blob|File)$/.test(t[Yl]),R2=t=>typeof t=="object"&&(t[Yl]==="AbortSignal"||t[Yl]==="EventTarget"),C2=(t,e)=>{let r=new URL(e).hostname,i=new URL(t).hostname;return r===i||r.endsWith(`.${i}`)};var dy=(0,Oi.promisify)(gr.default.pipeline),qt=Symbol("Body internals"),oi=class{constructor(e,{size:r=0}={}){let i=null;e===null?e=null:Yh(e)?e=ir.Buffer.from(e.toString()):Za(e)||ir.Buffer.isBuffer(e)||(Oi.types.isAnyArrayBuffer(e)?e=ir.Buffer.from(e):ArrayBuffer.isView(e)?e=ir.Buffer.from(e.buffer,e.byteOffset,e.byteLength):e instanceof gr.default||(e instanceof Yn?(e=E2(e),i=e.type.split("=")[1]):e=ir.Buffer.from(String(e))));let n=e;ir.Buffer.isBuffer(e)?n=gr.default.Readable.from(e):Za(e)&&(n=gr.default.Readable.from(e.stream())),this[qt]={body:e,stream:n,boundary:i,disturbed:!1,error:null},this.size=r,e instanceof gr.default&&e.on("error",s=>{let a=s instanceof ki?s:new jt(`Invalid response body while trying to fetch ${this.url}: ${s.message}`,"system",s);this[qt].error=a})}get body(){return this[qt].stream}get bodyUsed(){return this[qt].disturbed}async arrayBuffer(){let{buffer:e,byteOffset:r,byteLength:i}=await eu(this);return e.slice(r,r+i)}async formData(){let e=this.headers.get("content-type");if(e.startsWith("application/x-www-form-urlencoded")){let i=new Yn,n=new URLSearchParams(await this.text());for(let[s,a]of n)i.append(s,a);return i}let{toFormData:r}=await Promise.resolve().then(()=>(L2(),O2));return r(this.body,e)}async blob(){let e=this.headers&&this.headers.get("content-type")||this[qt].body&&this[qt].body.type||"",r=await this.arrayBuffer();return new Ii([r],{type:e})}async json(){let e=await eu(this);return JSON.parse(e.toString())}async text(){return(await eu(this)).toString()}buffer(){return eu(this)}};oi.prototype.buffer=(0,Oi.deprecate)(oi.prototype.buffer,"Please use 'response.arrayBuffer()' instead of 'response.buffer()'","node-fetch#buffer");Object.defineProperties(oi.prototype,{body:{enumerable:!0},bodyUsed:{enumerable:!0},arrayBuffer:{enumerable:!0},blob:{enumerable:!0},json:{enumerable:!0},text:{enumerable:!0},data:{get:(0,Oi.deprecate)(()=>{},"data doesn't exist, use json(), text(), arrayBuffer(), or body instead","https://github.com/node-fetch/node-fetch/issues/1000 (response)")}});async function eu(t){if(t[qt].disturbed)throw new TypeError(`body used already for: ${t.url}`);if(t[qt].disturbed=!0,t[qt].error)throw t[qt].error;let{body:e}=t;if(e===null)return ir.Buffer.alloc(0);if(!(e instanceof gr.default))return ir.Buffer.alloc(0);let r=[],i=0;try{for await(let n of e){if(t.size>0&&i+n.length>t.size){let s=new jt(`content size at ${t.url} over limit: ${t.size}`,"max-size");throw e.destroy(s),s}i+=n.length,r.push(n)}}catch(n){throw n instanceof ki?n:new jt(`Invalid response body while trying to fetch ${t.url}: ${n.message}`,"system",n)}if(e.readableEnded===!0||e._readableState.ended===!0)try{return r.every(n=>typeof n=="string")?ir.Buffer.from(r.join("")):ir.Buffer.concat(r,i)}catch(n){throw new jt(`Could not create Buffer from response body for ${t.url}: ${n.message}`,"system",n)}else throw new jt(`Premature close of server response while trying to fetch ${t.url}`)}var uo=(t,e)=>{let r,i,{body:n}=t[qt];if(t.bodyUsed)throw new Error("cannot clone body after it is used");return n instanceof gr.default&&typeof n.getBoundary!="function"&&(r=new gr.PassThrough({highWaterMark:e}),i=new gr.PassThrough({highWaterMark:e}),n.pipe(r),n.pipe(i),t[qt].stream=r,n=i),n},py=(0,Oi.deprecate)(t=>t.getBoundary(),"form-data doesn't follow the spec and requires special treatment. Use alternative package","https://github.com/node-fetch/node-fetch/issues/1167"),tu=(t,e)=>t===null?null:typeof t=="string"?"text/plain;charset=UTF-8":Yh(t)?"application/x-www-form-urlencoded;charset=UTF-8":Za(t)?t.type||null:ir.Buffer.isBuffer(t)||Oi.types.isAnyArrayBuffer(t)||ArrayBuffer.isView(t)?null:t instanceof Yn?`multipart/form-data; boundary=${e[qt].boundary}`:t&&typeof t.getBoundary=="function"?`multipart/form-data;boundary=${py(t)}`:t instanceof gr.default?null:"text/plain;charset=UTF-8",N2=t=>{let{body:e}=t[qt];return e===null?0:Za(e)?e.size:ir.Buffer.isBuffer(e)?e.length:e&&typeof e.getLengthSync=="function"&&e.hasKnownLength&&e.hasKnownLength()?e.getLengthSync():null},D2=async(t,{body:e})=>{e===null?t.end():await dy(e,t)};var tf=require("util"),Xa=fe(require("http"),1),ru=typeof Xa.default.validateHeaderName=="function"?Xa.default.validateHeaderName:t=>{if(!/^[\^`\-\w!#$%&'*+.|~]+$/.test(t)){let e=new TypeError(`Header name must be a valid HTTP token [${t}]`);throw Object.defineProperty(e,"code",{value:"ERR_INVALID_HTTP_TOKEN"}),e}},rf=typeof Xa.default.validateHeaderValue=="function"?Xa.default.validateHeaderValue:(t,e)=>{if(/[^\t\u0020-\u007E\u0080-\u00FF]/.test(e)){let r=new TypeError(`Invalid character in header content ["${t}"]`);throw Object.defineProperty(r,"code",{value:"ERR_INVALID_CHAR"}),r}},Ut=class extends URLSearchParams{constructor(e){let r=[];if(e instanceof Ut){let i=e.raw();for(let[n,s]of Object.entries(i))r.push(...s.map(a=>[n,a]))}else if(e!=null)if(typeof e=="object"&&!tf.types.isBoxedPrimitive(e)){let i=e[Symbol.iterator];if(i==null)r.push(...Object.entries(e));else{if(typeof i!="function")throw new TypeError("Header pairs must be iterable");r=[...e].map(n=>{if(typeof n!="object"||tf.types.isBoxedPrimitive(n))throw new TypeError("Each header pair must be an iterable object");return[...n]}).map(n=>{if(n.length!==2)throw new TypeError("Each header pair must be a name/value tuple");return[...n]})}}else throw new TypeError("Failed to construct 'Headers': The provided value is not of type '(sequence<sequence<ByteString>> or record<ByteString, ByteString>)");return r=r.length>0?r.map(([i,n])=>(ru(i),rf(i,String(n)),[String(i).toLowerCase(),String(n)])):void 0,super(r),new Proxy(this,{get(i,n,s){switch(n){case"append":case"set":return(a,c)=>(ru(a),rf(a,String(c)),URLSearchParams.prototype[n].call(i,String(a).toLowerCase(),String(c)));case"delete":case"has":case"getAll":return a=>(ru(a),URLSearchParams.prototype[n].call(i,String(a).toLowerCase()));case"keys":return()=>(i.sort(),new Set(URLSearchParams.prototype.keys.call(i)).keys());default:return Reflect.get(i,n,s)}}})}get[Symbol.toStringTag](){return this.constructor.name}toString(){return Object.prototype.toString.call(this)}get(e){let r=this.getAll(e);if(r.length===0)return null;let i=r.join(", ");return/^content-encoding$/i.test(e)&&(i=i.toLowerCase()),i}forEach(e,r=void 0){for(let i of this.keys())Reflect.apply(e,r,[this.get(i),i,this])}*values(){for(let e of this.keys())yield this.get(e)}*entries(){for(let e of this.keys())yield[e,this.get(e)]}[Symbol.iterator](){return this.entries()}raw(){return[...this.keys()].reduce((e,r)=>(e[r]=this.getAll(r),e),{})}[Symbol.for("nodejs.util.inspect.custom")](){return[...this.keys()].reduce((e,r)=>{let i=this.getAll(r);return r==="host"?e[r]=i[0]:e[r]=i.length>1?i:i[0],e},{})}};Object.defineProperties(Ut.prototype,["get","entries","forEach","values"].reduce((t,e)=>(t[e]={enumerable:!0},t),{}));function B2(t=[]){return new Ut(t.reduce((e,r,i,n)=>(i%2===0&&e.push(n.slice(i,i+2)),e),[]).filter(([e,r])=>{try{return ru(e),rf(e,String(r)),!0}catch{return!1}}))}var my=new Set([301,302,303,307,308]),iu=t=>my.has(t);var Nr=Symbol("Response internals"),Mt=class extends oi{constructor(e=null,r={}){super(e,r);let i=r.status!=null?r.status:200,n=new Ut(r.headers);if(e!==null&&!n.has("Content-Type")){let s=tu(e,this);s&&n.append("Content-Type",s)}this[Nr]={type:"default",url:r.url,status:i,statusText:r.statusText||"",headers:n,counter:r.counter,highWaterMark:r.highWaterMark}}get type(){return this[Nr].type}get url(){return this[Nr].url||""}get status(){return this[Nr].status}get ok(){return this[Nr].status>=200&&this[Nr].status<300}get redirected(){return this[Nr].counter>0}get statusText(){return this[Nr].statusText}get headers(){return this[Nr].headers}get highWaterMark(){return this[Nr].highWaterMark}clone(){return new Mt(uo(this,this.highWaterMark),{type:this.type,url:this.url,status:this.status,statusText:this.statusText,headers:this.headers,ok:this.ok,redirected:this.redirected,size:this.size,highWaterMark:this.highWaterMark})}static redirect(e,r=302){if(!iu(r))throw new RangeError('Failed to execute "redirect" on "response": Invalid status code');return new Mt(null,{headers:{location:new URL(e).toString()},status:r})}static error(){let e=new Mt(null,{status:0,statusText:""});return e[Nr].type="error",e}get[Symbol.toStringTag](){return"Response"}};Object.defineProperties(Mt.prototype,{type:{enumerable:!0},url:{enumerable:!0},status:{enumerable:!0},ok:{enumerable:!0},redirected:{enumerable:!0},statusText:{enumerable:!0},headers:{enumerable:!0},clone:{enumerable:!0}});var G2=require("url"),V2=require("util");var z2=t=>{if(t.search)return t.search;let e=t.href.length-1,r=t.hash||(t.href[e]==="#"?"#":"");return t.href[e-r.length]==="?"?"?":""};var q2=require("net");function j2(t,e=!1){return t==null||(t=new URL(t),/^(about|blob|data):$/.test(t.protocol))?"no-referrer":(t.username="",t.password="",t.hash="",e&&(t.pathname="",t.search=""),t)}var U2=new Set(["","no-referrer","no-referrer-when-downgrade","same-origin","origin","strict-origin","origin-when-cross-origin","strict-origin-when-cross-origin","unsafe-url"]),$2="strict-origin-when-cross-origin";function W2(t){if(!U2.has(t))throw new TypeError(`Invalid referrerPolicy: ${t}`);return t}function gy(t){if(/^(http|ws)s:$/.test(t.protocol))return!0;let e=t.host.replace(/(^\[)|(]$)/g,""),r=(0,q2.isIP)(e);return r===4&&/^127\./.test(e)||r===6&&/^(((0+:){7})|(::(0+:){0,6}))0*1$/.test(e)?!0:/^(.+\.)*localhost$/.test(t.host)?!1:t.protocol==="file:"}function co(t){return/^about:(blank|srcdoc)$/.test(t)||t.protocol==="data:"||/^(blob|filesystem):$/.test(t.protocol)?!0:gy(t)}function F2(t,{referrerURLCallback:e,referrerOriginCallback:r}={}){if(t.referrer==="no-referrer"||t.referrerPolicy==="")return null;let i=t.referrerPolicy;if(t.referrer==="about:client")return"no-referrer";let n=t.referrer,s=j2(n),a=j2(n,!0);s.toString().length>4096&&(s=a),e&&(s=e(s)),r&&(a=r(a));let c=new URL(t.url);switch(i){case"no-referrer":return"no-referrer";case"origin":return a;case"unsafe-url":return s;case"strict-origin":return co(s)&&!co(c)?"no-referrer":a.toString();case"strict-origin-when-cross-origin":return s.origin===c.origin?s:co(s)&&!co(c)?"no-referrer":a;case"same-origin":return s.origin===c.origin?s:"no-referrer";case"origin-when-cross-origin":return s.origin===c.origin?s:a;case"no-referrer-when-downgrade":return co(s)&&!co(c)?"no-referrer":s;default:throw new TypeError(`Invalid referrerPolicy: ${i}`)}}function H2(t){let e=(t.get("referrer-policy")||"").split(/[,\s]+/),r="";for(let i of e)i&&U2.has(i)&&(r=i);return r}var ft=Symbol("Request internals"),nu=t=>typeof t=="object"&&typeof t[ft]=="object",yy=(0,V2.deprecate)(()=>{},".data is not a valid RequestInit property, use .body instead","https://github.com/node-fetch/node-fetch/issues/1000 (request)"),Li=class extends oi{constructor(e,r={}){let i;if(nu(e)?i=new URL(e.url):(i=new URL(e),e={}),i.username!==""||i.password!=="")throw new TypeError(`${i} is an url with embedded credentails.`);let n=r.method||e.method||"GET";if(n=n.toUpperCase(),"data"in r&&yy(),(r.body!=null||nu(e)&&e.body!==null)&&(n==="GET"||n==="HEAD"))throw new TypeError("Request with GET/HEAD method cannot have body");let s=r.body?r.body:nu(e)&&e.body!==null?uo(e):null;super(s,{size:r.size||e.size||0});let a=new Ut(r.headers||e.headers||{});if(s!==null&&!a.has("Content-Type")){let p=tu(s,this);p&&a.set("Content-Type",p)}let c=nu(e)?e.signal:null;if("signal"in r&&(c=r.signal),c!=null&&!R2(c))throw new TypeError("Expected signal to be an instanceof AbortSignal or EventTarget");let d=r.referrer==null?e.referrer:r.referrer;if(d==="")d="no-referrer";else if(d){let p=new URL(d);d=/^about:(\/\/)?client$/.test(p)?"client":p}else d=void 0;this[ft]={method:n,redirect:r.redirect||e.redirect||"follow",headers:a,parsedURL:i,signal:c,referrer:d},this.follow=r.follow===void 0?e.follow===void 0?20:e.follow:r.follow,this.compress=r.compress===void 0?e.compress===void 0?!0:e.compress:r.compress,this.counter=r.counter||e.counter||0,this.agent=r.agent||e.agent,this.highWaterMark=r.highWaterMark||e.highWaterMark||16384,this.insecureHTTPParser=r.insecureHTTPParser||e.insecureHTTPParser||!1,this.referrerPolicy=r.referrerPolicy||e.referrerPolicy||""}get method(){return this[ft].method}get url(){return(0,G2.format)(this[ft].parsedURL)}get headers(){return this[ft].headers}get redirect(){return this[ft].redirect}get signal(){return this[ft].signal}get referrer(){if(this[ft].referrer==="no-referrer")return"";if(this[ft].referrer==="client")return"about:client";if(this[ft].referrer)return this[ft].referrer.toString()}get referrerPolicy(){return this[ft].referrerPolicy}set referrerPolicy(e){this[ft].referrerPolicy=W2(e)}clone(){return new Li(this)}get[Symbol.toStringTag](){return"Request"}};Object.defineProperties(Li.prototype,{method:{enumerable:!0},url:{enumerable:!0},headers:{enumerable:!0},redirect:{enumerable:!0},clone:{enumerable:!0},signal:{enumerable:!0},referrer:{enumerable:!0},referrerPolicy:{enumerable:!0}});var K2=t=>{let{parsedURL:e}=t[ft],r=new Ut(t[ft].headers);r.has("Accept")||r.set("Accept","*/*");let i=null;if(t.body===null&&/^(post|put)$/i.test(t.method)&&(i="0"),t.body!==null){let c=N2(t);typeof c=="number"&&!Number.isNaN(c)&&(i=String(c))}i&&r.set("Content-Length",i),t.referrerPolicy===""&&(t.referrerPolicy=$2),t.referrer&&t.referrer!=="no-referrer"?t[ft].referrer=F2(t):t[ft].referrer="no-referrer",t[ft].referrer instanceof URL&&r.set("Referer",t.referrer),r.has("User-Agent")||r.set("User-Agent","node-fetch"),t.compress&&!r.has("Accept-Encoding")&&r.set("Accept-Encoding","gzip,deflate,br");let{agent:n}=t;typeof n=="function"&&(n=n(e)),!r.has("Connection")&&!n&&r.set("Connection","close");let s=z2(e),a={path:e.pathname+s,method:t.method,headers:r[Symbol.for("nodejs.util.inspect.custom")](),insecureHTTPParser:t.insecureHTTPParser,agent:n};return{parsedURL:e,options:a}};var su=class extends ki{constructor(e,r="aborted"){super(e,r)}};Jl();Qh();var by=new Set(["data:","http:","https:"]);async function ou(t,e){return new Promise((r,i)=>{let n=new Li(t,e),{parsedURL:s,options:a}=K2(n);if(!by.has(s.protocol))throw new TypeError(`node-fetch cannot load ${t}. URL scheme "${s.protocol.replace(/:$/,"")}" is not supported.`);if(s.protocol==="data:"){let R=m2(n.url),x=new Mt(R,{headers:{"Content-Type":R.typeFull}});r(x);return}let c=(s.protocol==="https:"?J2.default:Z2.default).request,{signal:d}=n,p=null,m=()=>{let R=new su("The operation was aborted.");i(R),n.body&&n.body instanceof nr.default.Readable&&n.body.destroy(R),!(!p||!p.body)&&p.body.emit("error",R)};if(d&&d.aborted){m();return}let w=()=>{m(),v()},S=c(s.toString(),a);d&&d.addEventListener("abort",w);let v=()=>{S.abort(),d&&d.removeEventListener("abort",w)};S.on("error",R=>{i(new jt(`request to ${n.url} failed, reason: ${R.message}`,"system",R)),v()}),vy(S,R=>{p.body.destroy(R)}),process.version<"v14"&&S.on("socket",R=>{let x;R.prependListener("end",()=>{x=R._eventsCount}),R.prependListener("close",A=>{if(p&&x<R._eventsCount&&!A){let C=new Error("Premature close");C.code="ERR_STREAM_PREMATURE_CLOSE",p.body.emit("error",C)}})}),S.on("response",R=>{S.setTimeout(0);let x=B2(R.rawHeaders);if(iu(R.statusCode)){let B=x.get("Location"),z=null;try{z=B===null?null:new URL(B,n.url)}catch{if(n.redirect!=="manual"){i(new jt(`uri requested responds with an invalid redirect URL: ${B}`,"invalid-redirect")),v();return}}switch(n.redirect){case"error":i(new jt(`uri requested responds with a redirect, redirect mode is set to error: ${n.url}`,"no-redirect")),v();return;case"manual":break;case"follow":{if(z===null)break;if(n.counter>=n.follow){i(new jt(`maximum redirect reached at: ${n.url}`,"max-redirect")),v();return}let G={headers:new Ut(n.headers),follow:n.follow,counter:n.counter+1,agent:n.agent,compress:n.compress,method:n.method,body:uo(n),signal:n.signal,size:n.size,referrer:n.referrer,referrerPolicy:n.referrerPolicy};if(!C2(n.url,z))for(let se of["authorization","www-authenticate","cookie","cookie2"])G.headers.delete(se);if(R.statusCode!==303&&n.body&&e.body instanceof nr.default.Readable){i(new jt("Cannot follow redirect with body being a readable stream","unsupported-redirect")),v();return}(R.statusCode===303||(R.statusCode===301||R.statusCode===302)&&n.method==="POST")&&(G.method="GET",G.body=void 0,G.headers.delete("content-length"));let te=H2(x);te&&(G.referrerPolicy=te),r(ou(new Li(z,G))),v();return}default:return i(new TypeError(`Redirect option '${n.redirect}' is not a valid value of RequestRedirect`))}}d&&R.once("end",()=>{d.removeEventListener("abort",w)});let A=(0,nr.pipeline)(R,new nr.PassThrough,B=>{B&&i(B)});process.version<"v12.10"&&R.on("aborted",w);let C={url:n.url,status:R.statusCode,statusText:R.statusMessage,headers:x,size:n.size,counter:n.counter,highWaterMark:n.highWaterMark},T=x.get("Content-Encoding");if(!n.compress||n.method==="HEAD"||T===null||R.statusCode===204||R.statusCode===304){p=new Mt(A,C),r(p);return}let O={flush:ts.default.Z_SYNC_FLUSH,finishFlush:ts.default.Z_SYNC_FLUSH};if(T==="gzip"||T==="x-gzip"){A=(0,nr.pipeline)(A,ts.default.createGunzip(O),B=>{B&&i(B)}),p=new Mt(A,C),r(p);return}if(T==="deflate"||T==="x-deflate"){let B=(0,nr.pipeline)(R,new nr.PassThrough,z=>{z&&i(z)});B.once("data",z=>{(z[0]&15)===8?A=(0,nr.pipeline)(A,ts.default.createInflate(),G=>{G&&i(G)}):A=(0,nr.pipeline)(A,ts.default.createInflateRaw(),G=>{G&&i(G)}),p=new Mt(A,C),r(p)}),B.once("end",()=>{p||(p=new Mt(A,C),r(p))});return}if(T==="br"){A=(0,nr.pipeline)(A,ts.default.createBrotliDecompress(),B=>{B&&i(B)}),p=new Mt(A,C),r(p);return}p=new Mt(A,C),r(p)}),D2(S,n).catch(i)})}function vy(t,e){let r=Qa.Buffer.from(`0\r
117
132
  \r
118
- `),i=!1,n=!1,o;t.on("response",a=>{let{headers:h}=a;i=h["transfer-encoding"]==="chunked"&&!h["content-length"]}),t.on("socket",a=>{let h=()=>{if(i&&!n){let d=new Error("Premature close");d.code="ERR_STREAM_PREMATURE_CLOSE",e(d)}};a.prependListener("close",h),t.on("abort",()=>{a.removeListener("close",h)}),a.on("data",d=>{n=Xa.Buffer.compare(d.slice(-5),r)===0,!n&&o&&(n=Xa.Buffer.compare(o.slice(-3),r.slice(0,3))===0&&Xa.Buffer.compare(d.slice(-2),r.slice(3))===0),o=d})})}var Wt=class extends Nt{constructor(e){super(),this.type="url",this.protocol="http",this.chunkSize=Wt.DefaultChunkSize,this.uri=e}static isSource(e){return e.type==="url"}get size(){return this._size?this._size:(this._size=Promise.resolve().then(async()=>{let e=await Wt.fetch(this.uri,{method:"HEAD"});return Number(e.headers.get("content-length"))}),this._size)}async fetchBytes(e,r){let n={Range:this.toRange(e,r)},o=await Wt.fetch(this.uri,{headers:n});if(o.ok){let a=o.headers.get("content-range");return this._size==null&&a!=null&&(this._size=Promise.resolve(this.parseContentRange(a))),o.arrayBuffer()}throw new Error("Failed to fetch")}};Wt.DefaultChunkSize=32*1024;Wt.fetch=(t,e)=>fetch(t,e);function fy(t,e){return Di(t)?t.code==="ENOENT"?new st(e,404,t):t.code==="EACCES"?new st(e,403,t):new st(e,500,t):new st(e,500,t)}var $i=class{constructor(){this.protocol=$i.protocol}static is(e){return e.protocol===$i.protocol}source(e){return new Wt(e)}async*list(e){throw new Error(`Unable to "list" on ${e}`)}async*details(e){throw new Error(`Unable to "details" on ${e}`)}async head(e){let r=await Wt.fetch(e,{method:"HEAD"});if(!r.ok)throw fy(new Error(r.statusText),`Failed to head: ${e}`);return{path:e,size:Number(r.headers.get("content-length")),isDirectory:!1}}async read(e){let r=await Wt.fetch(e,{method:"GET"});if(!r.ok)throw fy(new Error(r.statusText),`Failed to head: ${e}`);return Buffer.from(await r.arrayBuffer())}async write(e){throw new Error(`Unable to "write" on ${e}`)}stream(e){throw new Error(`Unable to "stream" on ${e}`)}};$i.protocol="http";Wt.fetch=ah;function O2(t){return typeof t!="object"||t==null?!1:t.constructor===Object}var lh=class{constructor(){this.protocol="abstract",this.isOrdered=!0,this.systems=[],this.toArray=Ag,this.join=xd,this.joinAll=Tg}register(e,r,i="rw"){for(let n=0;n<this.systems.length;n++){let o=this.systems[n];if(o.path===e&&o.flag===i){this.systems.splice(n,1,{path:e,system:r,flag:i});return}}this.systems.push({path:e,system:r,flag:i}),this.isOrdered=!1}read(e){return this.get(e,"r").read(e)}async readJson(e){let r=await this.read(e);return JSON.parse(r.toString())}stream(e){return this.get(e,"r").stream(e)}write(e,r,i){if(Array.isArray(r)||O2(r)){let n=JSON.stringify(r,null,2);return this.get(e,"rw").write(e,n,{contentType:"application/json",...i})}return this.get(e,"rw").write(e,r,i)}list(e,r){return this.get(e,"r").list(e,r)}details(e,r){return this.get(e,"r").details(e,r)}exists(e){return this.get(e,"r").head(e).then(r=>r!=null)}head(e){return this.get(e,"r").head(e)}source(e){return this.get(e,"r").source(e)}sortSystems(){this.isOrdered||(this.systems.sort((e,r)=>r.path.length-e.path.length),this.isOrdered=!0)}get(e,r){this.sortSystems();for(let i of this.systems)if(e.startsWith(i.path)){if(r==="rw"&&i.flag==="r")continue;return i.system}throw new Error(`Unable to find file system for path:${e}`)}},gt=new lh;var dy=new Bi;gt.register("",dy);gt.register("file://",dy);var my=new $i;gt.register("http://",my);gt.register("https://",my);var OE=ve(hs(),1);var et;(function(t){function e(i){throw new Error}t.assertNever=e,t.arrayToEnum=i=>{let n={};for(let o of i)n[o]=o;return n},t.getValidEnumValues=i=>{let n=t.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),o={};for(let a of n)o[a]=i[a];return t.objectValues(o)},t.objectValues=i=>t.objectKeys(i).map(function(n){return i[n]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let n=[];for(let o in i)Object.prototype.hasOwnProperty.call(i,o)&&n.push(o);return n},t.find=(i,n)=>{for(let o of i)if(n(o))return o},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function r(i,n=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(n)}t.joinValues=r})(et||(et={}));var ie=et.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),gn=t=>{switch(typeof t){case"undefined":return ie.undefined;case"string":return ie.string;case"number":return isNaN(t)?ie.nan:ie.number;case"boolean":return ie.boolean;case"function":return ie.function;case"bigint":return ie.bigint;case"object":return Array.isArray(t)?ie.array:t===null?ie.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?ie.promise:typeof Map<"u"&&t instanceof Map?ie.map:typeof Set<"u"&&t instanceof Set?ie.set:typeof Date<"u"&&t instanceof Date?ie.date:ie.object;default:return ie.unknown}},re=et.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of"]),k2=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),Hr=class extends Error{constructor(e){super(),this.issues=[],this.addIssue=i=>{this.issues=[...this.issues,i]},this.addIssues=(i=[])=>{this.issues=[...this.issues,...i]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){let r=e||function(o){return o.message},i={_errors:[]},n=o=>{for(let a of o.issues)if(a.code==="invalid_union")a.unionErrors.map(n);else if(a.code==="invalid_return_type")n(a.returnTypeError);else if(a.code==="invalid_arguments")n(a.argumentsError);else if(a.path.length===0)i._errors.push(r(a));else{let h=i,d=0;for(;d<a.path.length;){let m=a.path[d];d===a.path.length-1?(h[m]=h[m]||{_errors:[]},h[m]._errors.push(r(a))):h[m]=h[m]||{_errors:[]},h=h[m],d++}}};return n(this),i}toString(){return this.message}get message(){return JSON.stringify(this.issues,null,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},i=[];for(let n of this.issues)n.path.length>0?(r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(e(n))):i.push(e(n));return{formErrors:i,fieldErrors:r}}get formErrors(){return this.flatten()}};Hr.create=t=>new Hr(t);var Ja=(t,e)=>{let r;switch(t.code){case re.invalid_type:t.received===ie.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case re.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected)}`;break;case re.unrecognized_keys:r=`Unrecognized key(s) in object: ${et.joinValues(t.keys,", ")}`;break;case re.invalid_union:r="Invalid input";break;case re.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${et.joinValues(t.options)}`;break;case re.invalid_enum_value:r=`Invalid enum value. Expected ${et.joinValues(t.options)}, received '${t.received}'`;break;case re.invalid_arguments:r="Invalid function arguments";break;case re.invalid_return_type:r="Invalid function return type";break;case re.invalid_date:r="Invalid date";break;case re.invalid_string:t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case re.too_small:t.type==="array"?r=`Array must contain ${t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be greater than ${t.inclusive?"or equal to ":""}${t.minimum}`:r="Invalid input";break;case re.too_big:t.type==="array"?r=`Array must contain ${t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be less than ${t.inclusive?"or equal to ":""}${t.maximum}`:r="Invalid input";break;case re.custom:r="Invalid input";break;case re.invalid_intersection_types:r="Intersection results could not be merged";break;case re.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;default:r=e.defaultError,et.assertNever(t)}return{message:r}},Qa=Ja,N2=t=>{Qa=t},uh=t=>{let{data:e,path:r,errorMaps:i,issueData:n}=t,o=[...r,...n.path||[]],a={...n,path:o},h="",d=i.filter(m=>!!m).slice().reverse();for(let m of d)h=m(a,{data:e,defaultError:h}).message;return{...n,path:o,message:n.message||h}},L2=[];function he(t,e){let r=uh({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Qa,Ja].filter(i=>!!i)});t.common.issues.push(r)}var Dt=class{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let i=[];for(let n of r){if(n.status==="aborted")return we;n.status==="dirty"&&e.dirty(),i.push(n.value)}return{status:e.value,value:i}}static async mergeObjectAsync(e,r){let i=[];for(let n of r)i.push({key:await n.key,value:await n.value});return Dt.mergeObjectSync(e,i)}static mergeObjectSync(e,r){let i={};for(let n of r){let{key:o,value:a}=n;if(o.status==="aborted"||a.status==="aborted")return we;o.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),(typeof a.value<"u"||n.alwaysSet)&&(i[o.value]=a.value)}return{status:e.value,value:i}}},we=Object.freeze({status:"aborted"}),D2=t=>({status:"dirty",value:t}),$t=t=>({status:"valid",value:t}),Nd=t=>t.status==="aborted",Ld=t=>t.status==="dirty",hh=t=>t.status==="valid",Dd=t=>typeof Promise!==void 0&&t instanceof Promise,Ke;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Ke||(Ke={}));var Tr=class{constructor(e,r,i,n){this.parent=e,this.data=r,this._path=i,this._key=n}get path(){return this._path.concat(this._key)}},py=(t,e)=>{if(hh(e))return{success:!0,data:e.value};{if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");let r=new Hr(t.common.issues);return{success:!1,error:r}}};function Ne(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:i,description:n}=t;if(e&&(r||i))throw new Error(`Can't use "invalid" or "required" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(a,h)=>a.code!=="invalid_type"?{message:h.defaultError}:typeof h.data>"u"&&i?{message:i}:t.invalid_type_error?{message:t.invalid_type_error}:{message:h.defaultError},description:n}}var Ae=class{constructor(e){this.spa=this.safeParseAsync,this.superRefine=this._refinement,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.default=this.default.bind(this),this.describe=this.describe.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return gn(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:gn(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Dt,ctx:{common:e.parent.common,data:e.data,parsedType:gn(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(Dd(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let i=this.safeParse(e,r);if(i.success)return i.data;throw i.error}safeParse(e,r){var i;let n={common:{issues:[],async:(i=r?.async)!==null&&i!==void 0?i:!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:gn(e)},o=this._parseSync({data:e,path:n.path,parent:n});return py(n,o)}async parseAsync(e,r){let i=await this.safeParseAsync(e,r);if(i.success)return i.data;throw i.error}async safeParseAsync(e,r){let i={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:gn(e)},n=this._parse({data:e,path:[],parent:i}),o=await(Dd(n)?n:Promise.resolve(n));return py(i,o)}refine(e,r){let i=n=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(n):r;return this._refinement((n,o)=>{let a=e(n),h=()=>o.addIssue({code:re.custom,...i(n)});return typeof Promise<"u"&&a instanceof Promise?a.then(d=>d?!0:(h(),!1)):a?!0:(h(),!1)})}refinement(e,r){return this._refinement((i,n)=>e(i)?!0:(n.addIssue(typeof r=="function"?r(i,n):r),!1))}_refinement(e){return new Pr({schema:this,typeName:ye.ZodEffects,effect:{type:"refinement",refinement:e}})}optional(){return Cr.create(this)}nullable(){return Vi.create(this)}nullish(){return this.optional().nullable()}array(){return Ar.create(this)}promise(){return bn.create(this)}or(e){return bs.create([this,e])}and(e){return vs.create(this,e)}transform(e){return new Pr({schema:this,typeName:ye.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new el({innerType:this,defaultValue:r,typeName:ye.ZodDefault})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},B2=/^c[^\s-]{8,}$/i,z2=/^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i,F2=/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i,gi=class extends Ae{constructor(){super(...arguments),this._regex=(e,r,i)=>this.refinement(n=>e.test(n),{validation:r,code:re.invalid_string,...Ke.errToObj(i)}),this.nonempty=e=>this.min(1,Ke.errToObj(e)),this.trim=()=>new gi({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}_parse(e){if(this._getType(e)!==ie.string){let o=this._getOrReturnCtx(e);return he(o,{code:re.invalid_type,expected:ie.string,received:o.parsedType}),we}let i=new Dt,n;for(let o of this._def.checks)if(o.kind==="min")e.data.length<o.value&&(n=this._getOrReturnCtx(e,n),he(n,{code:re.too_small,minimum:o.value,type:"string",inclusive:!0,message:o.message}),i.dirty());else if(o.kind==="max")e.data.length>o.value&&(n=this._getOrReturnCtx(e,n),he(n,{code:re.too_big,maximum:o.value,type:"string",inclusive:!0,message:o.message}),i.dirty());else if(o.kind==="email")F2.test(e.data)||(n=this._getOrReturnCtx(e,n),he(n,{validation:"email",code:re.invalid_string,message:o.message}),i.dirty());else if(o.kind==="uuid")z2.test(e.data)||(n=this._getOrReturnCtx(e,n),he(n,{validation:"uuid",code:re.invalid_string,message:o.message}),i.dirty());else if(o.kind==="cuid")B2.test(e.data)||(n=this._getOrReturnCtx(e,n),he(n,{validation:"cuid",code:re.invalid_string,message:o.message}),i.dirty());else if(o.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),he(n,{validation:"url",code:re.invalid_string,message:o.message}),i.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),he(n,{validation:"regex",code:re.invalid_string,message:o.message}),i.dirty())):o.kind==="trim"?e.data=e.data.trim():et.assertNever(o);return{status:i.value,value:e.data}}_addCheck(e){return new gi({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Ke.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Ke.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Ke.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Ke.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...Ke.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...Ke.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...Ke.errToObj(r)})}length(e,r){return this.min(e,r).max(e,r)}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get minLength(){let e=-1/0;return this._def.checks.map(r=>{r.kind==="min"&&(e===null||r.value>e)&&(e=r.value)}),e}get maxLength(){let e=null;return this._def.checks.map(r=>{r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}),e}};gi.create=t=>new gi({checks:[],typeName:ye.ZodString,...Ne(t)});function U2(t,e){let r=(t.toString().split(".")[1]||"").length,i=(e.toString().split(".")[1]||"").length,n=r>i?r:i,o=parseInt(t.toFixed(n).replace(".","")),a=parseInt(e.toFixed(n).replace(".",""));return o%a/Math.pow(10,n)}var qi=class extends Ae{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._getType(e)!==ie.number){let o=this._getOrReturnCtx(e);return he(o,{code:re.invalid_type,expected:ie.number,received:o.parsedType}),we}let i,n=new Dt;for(let o of this._def.checks)o.kind==="int"?et.isInteger(e.data)||(i=this._getOrReturnCtx(e,i),he(i,{code:re.invalid_type,expected:"integer",received:"float",message:o.message}),n.dirty()):o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(i=this._getOrReturnCtx(e,i),he(i,{code:re.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,message:o.message}),n.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(i=this._getOrReturnCtx(e,i),he(i,{code:re.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,message:o.message}),n.dirty()):o.kind==="multipleOf"?U2(e.data,o.value)!==0&&(i=this._getOrReturnCtx(e,i),he(i,{code:re.not_multiple_of,multipleOf:o.value,message:o.message}),n.dirty()):et.assertNever(o);return{status:n.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,Ke.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Ke.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Ke.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Ke.toString(r))}setLimit(e,r,i,n){return new qi({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:i,message:Ke.toString(n)}]})}_addCheck(e){return new qi({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Ke.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ke.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ke.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ke.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ke.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Ke.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int")}};qi.create=t=>new qi({checks:[],typeName:ye.ZodNumber,...Ne(t)});var To=class extends Ae{_parse(e){if(this._getType(e)!==ie.bigint){let i=this._getOrReturnCtx(e);return he(i,{code:re.invalid_type,expected:ie.bigint,received:i.parsedType}),we}return $t(e.data)}};To.create=t=>new To({typeName:ye.ZodBigInt,...Ne(t)});var Ao=class extends Ae{_parse(e){if(this._getType(e)!==ie.boolean){let i=this._getOrReturnCtx(e);return he(i,{code:re.invalid_type,expected:ie.boolean,received:i.parsedType}),we}return $t(e.data)}};Ao.create=t=>new Ao({typeName:ye.ZodBoolean,...Ne(t)});var Io=class extends Ae{_parse(e){if(this._getType(e)!==ie.date){let i=this._getOrReturnCtx(e);return he(i,{code:re.invalid_type,expected:ie.date,received:i.parsedType}),we}if(isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return he(i,{code:re.invalid_date}),we}return{status:"valid",value:new Date(e.data.getTime())}}};Io.create=t=>new Io({typeName:ye.ZodDate,...Ne(t)});var Po=class extends Ae{_parse(e){if(this._getType(e)!==ie.undefined){let i=this._getOrReturnCtx(e);return he(i,{code:re.invalid_type,expected:ie.undefined,received:i.parsedType}),we}return $t(e.data)}};Po.create=t=>new Po({typeName:ye.ZodUndefined,...Ne(t)});var Oo=class extends Ae{_parse(e){if(this._getType(e)!==ie.null){let i=this._getOrReturnCtx(e);return he(i,{code:re.invalid_type,expected:ie.null,received:i.parsedType}),we}return $t(e.data)}};Oo.create=t=>new Oo({typeName:ye.ZodNull,...Ne(t)});var yn=class extends Ae{constructor(){super(...arguments),this._any=!0}_parse(e){return $t(e.data)}};yn.create=t=>new yn({typeName:ye.ZodAny,...Ne(t)});var pi=class extends Ae{constructor(){super(...arguments),this._unknown=!0}_parse(e){return $t(e.data)}};pi.create=t=>new pi({typeName:ye.ZodUnknown,...Ne(t)});var yi=class extends Ae{_parse(e){let r=this._getOrReturnCtx(e);return he(r,{code:re.invalid_type,expected:ie.never,received:r.parsedType}),we}};yi.create=t=>new yi({typeName:ye.ZodNever,...Ne(t)});var ko=class extends Ae{_parse(e){if(this._getType(e)!==ie.undefined){let i=this._getOrReturnCtx(e);return he(i,{code:re.invalid_type,expected:ie.void,received:i.parsedType}),we}return $t(e.data)}};ko.create=t=>new ko({typeName:ye.ZodVoid,...Ne(t)});var Ar=class extends Ae{_parse(e){let{ctx:r,status:i}=this._processInputParams(e),n=this._def;if(r.parsedType!==ie.array)return he(r,{code:re.invalid_type,expected:ie.array,received:r.parsedType}),we;if(n.minLength!==null&&r.data.length<n.minLength.value&&(he(r,{code:re.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,message:n.minLength.message}),i.dirty()),n.maxLength!==null&&r.data.length>n.maxLength.value&&(he(r,{code:re.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,message:n.maxLength.message}),i.dirty()),r.common.async)return Promise.all(r.data.map((a,h)=>n.type._parseAsync(new Tr(r,a,r.path,h)))).then(a=>Dt.mergeArray(i,a));let o=r.data.map((a,h)=>n.type._parseSync(new Tr(r,a,r.path,h)));return Dt.mergeArray(i,o)}get element(){return this._def.type}min(e,r){return new Ar({...this._def,minLength:{value:e,message:Ke.toString(r)}})}max(e,r){return new Ar({...this._def,maxLength:{value:e,message:Ke.toString(r)}})}length(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};Ar.create=(t,e)=>new Ar({type:t,minLength:null,maxLength:null,typeName:ye.ZodArray,...Ne(e)});var ch;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(ch||(ch={}));var gy=t=>e=>new Xe({...t,shape:()=>({...t.shape(),...e})});function Co(t){if(t instanceof Xe){let e={};for(let r in t.shape){let i=t.shape[r];e[r]=Cr.create(Co(i))}return new Xe({...t._def,shape:()=>e})}else return t instanceof Ar?Ar.create(Co(t.element)):t instanceof Cr?Cr.create(Co(t.unwrap())):t instanceof Vi?Vi.create(Co(t.unwrap())):t instanceof Ir?Ir.create(t.items.map(e=>Co(e))):t}var Xe=class extends Ae{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=gy(this._def),this.extend=gy(this._def)}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=et.objectKeys(e);return this._cached={shape:e,keys:r}}_parse(e){if(this._getType(e)!==ie.object){let m=this._getOrReturnCtx(e);return he(m,{code:re.invalid_type,expected:ie.object,received:m.parsedType}),we}let{status:i,ctx:n}=this._processInputParams(e),{shape:o,keys:a}=this._getCached(),h=[];for(let m in n.data)a.includes(m)||h.push(m);let d=[];for(let m of a){let p=o[m],w=n.data[m];d.push({key:{status:"valid",value:m},value:p._parse(new Tr(n,w,n.path,m)),alwaysSet:m in n.data})}if(this._def.catchall instanceof yi){let m=this._def.unknownKeys;if(m==="passthrough")for(let p of h)d.push({key:{status:"valid",value:p},value:{status:"valid",value:n.data[p]}});else if(m==="strict")h.length>0&&(he(n,{code:re.unrecognized_keys,keys:h}),i.dirty());else if(m!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let m=this._def.catchall;for(let p of h){let w=n.data[p];d.push({key:{status:"valid",value:p},value:m._parse(new Tr(n,w,n.path,p)),alwaysSet:p in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let m=[];for(let p of d){let w=await p.key;m.push({key:w,value:await p.value,alwaysSet:p.alwaysSet})}return m}).then(m=>Dt.mergeObjectSync(i,m)):Dt.mergeObjectSync(i,d)}get shape(){return this._def.shape()}strict(e){return Ke.errToObj,new Xe({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,i)=>{var n,o,a,h;let d=(a=(o=(n=this._def).errorMap)===null||o===void 0?void 0:o.call(n,r,i).message)!==null&&a!==void 0?a:i.defaultError;return r.code==="unrecognized_keys"?{message:(h=Ke.errToObj(e).message)!==null&&h!==void 0?h:d}:{message:d}}}:{}})}strip(){return new Xe({...this._def,unknownKeys:"strip"})}passthrough(){return new Xe({...this._def,unknownKeys:"passthrough"})}setKey(e,r){return this.augment({[e]:r})}merge(e){return new Xe({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>ch.mergeShapes(this._def.shape(),e._def.shape()),typeName:ye.ZodObject})}catchall(e){return new Xe({...this._def,catchall:e})}pick(e){let r={};return et.objectKeys(e).map(i=>{this.shape[i]&&(r[i]=this.shape[i])}),new Xe({...this._def,shape:()=>r})}omit(e){let r={};return et.objectKeys(this.shape).map(i=>{et.objectKeys(e).indexOf(i)===-1&&(r[i]=this.shape[i])}),new Xe({...this._def,shape:()=>r})}deepPartial(){return Co(this)}partial(e){let r={};if(e)return et.objectKeys(this.shape).map(i=>{et.objectKeys(e).indexOf(i)===-1?r[i]=this.shape[i]:r[i]=this.shape[i].optional()}),new Xe({...this._def,shape:()=>r});for(let i in this.shape){let n=this.shape[i];r[i]=n.optional()}return new Xe({...this._def,shape:()=>r})}required(){let e={};for(let r in this.shape){let n=this.shape[r];for(;n instanceof Cr;)n=n._def.innerType;e[r]=n}return new Xe({...this._def,shape:()=>e})}};Xe.create=(t,e)=>new Xe({shape:()=>t,unknownKeys:"strip",catchall:yi.create(),typeName:ye.ZodObject,...Ne(e)});Xe.strictCreate=(t,e)=>new Xe({shape:()=>t,unknownKeys:"strict",catchall:yi.create(),typeName:ye.ZodObject,...Ne(e)});Xe.lazycreate=(t,e)=>new Xe({shape:t,unknownKeys:"strip",catchall:yi.create(),typeName:ye.ZodObject,...Ne(e)});var bs=class extends Ae{_parse(e){let{ctx:r}=this._processInputParams(e),i=this._def.options;function n(o){for(let h of o)if(h.result.status==="valid")return h.result;for(let h of o)if(h.result.status==="dirty")return r.common.issues.push(...h.ctx.common.issues),h.result;let a=o.map(h=>new Hr(h.ctx.common.issues));return he(r,{code:re.invalid_union,unionErrors:a}),we}if(r.common.async)return Promise.all(i.map(async o=>{let a={...r,common:{...r.common,issues:[]},parent:null};return{result:await o._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}})).then(n);{let o,a=[];for(let d of i){let m={...r,common:{...r.common,issues:[]},parent:null},p=d._parseSync({data:r.data,path:r.path,parent:m});if(p.status==="valid")return p;p.status==="dirty"&&!o&&(o={result:p,ctx:m}),m.common.issues.length&&a.push(m.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;let h=a.map(d=>new Hr(d));return he(r,{code:re.invalid_union,unionErrors:h}),we}}get options(){return this._def.options}};bs.create=(t,e)=>new bs({options:t,typeName:ye.ZodUnion,...Ne(e)});var No=class extends Ae{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==ie.object)return he(r,{code:re.invalid_type,expected:ie.object,received:r.parsedType}),we;let i=this.discriminator,n=r.data[i],o=this.options.get(n);return o?r.common.async?o._parseAsync({data:r.data,path:r.path,parent:r}):o._parseSync({data:r.data,path:r.path,parent:r}):(he(r,{code:re.invalid_union_discriminator,options:this.validDiscriminatorValues,path:[i]}),we)}get discriminator(){return this._def.discriminator}get validDiscriminatorValues(){return Array.from(this.options.keys())}get options(){return this._def.options}static create(e,r,i){let n=new Map;try{r.forEach(o=>{let a=o.shape[e].value;n.set(a,o)})}catch{throw new Error("The discriminator value could not be extracted from all the provided schemas")}if(n.size!==r.length)throw new Error("Some of the discriminator values are not unique");return new No({typeName:ye.ZodDiscriminatedUnion,discriminator:e,options:n,...Ne(i)})}};function Bd(t,e){let r=gn(t),i=gn(e);if(t===e)return{valid:!0,data:t};if(r===ie.object&&i===ie.object){let n=et.objectKeys(e),o=et.objectKeys(t).filter(h=>n.indexOf(h)!==-1),a={...t,...e};for(let h of o){let d=Bd(t[h],e[h]);if(!d.valid)return{valid:!1};a[h]=d.data}return{valid:!0,data:a}}else if(r===ie.array&&i===ie.array){if(t.length!==e.length)return{valid:!1};let n=[];for(let o=0;o<t.length;o++){let a=t[o],h=e[o],d=Bd(a,h);if(!d.valid)return{valid:!1};n.push(d.data)}return{valid:!0,data:n}}else return r===ie.date&&i===ie.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var vs=class extends Ae{_parse(e){let{status:r,ctx:i}=this._processInputParams(e),n=(o,a)=>{if(Nd(o)||Nd(a))return we;let h=Bd(o.value,a.value);return h.valid?((Ld(o)||Ld(a))&&r.dirty(),{status:r.value,value:h.data}):(he(i,{code:re.invalid_intersection_types}),we)};return i.common.async?Promise.all([this._def.left._parseAsync({data:i.data,path:i.path,parent:i}),this._def.right._parseAsync({data:i.data,path:i.path,parent:i})]).then(([o,a])=>n(o,a)):n(this._def.left._parseSync({data:i.data,path:i.path,parent:i}),this._def.right._parseSync({data:i.data,path:i.path,parent:i}))}};vs.create=(t,e,r)=>new vs({left:t,right:e,typeName:ye.ZodIntersection,...Ne(r)});var Ir=class extends Ae{_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==ie.array)return he(i,{code:re.invalid_type,expected:ie.array,received:i.parsedType}),we;if(i.data.length<this._def.items.length)return he(i,{code:re.too_small,minimum:this._def.items.length,inclusive:!0,type:"array"}),we;!this._def.rest&&i.data.length>this._def.items.length&&(he(i,{code:re.too_big,maximum:this._def.items.length,inclusive:!0,type:"array"}),r.dirty());let o=i.data.map((a,h)=>{let d=this._def.items[h]||this._def.rest;return d?d._parse(new Tr(i,a,i.path,h)):null}).filter(a=>!!a);return i.common.async?Promise.all(o).then(a=>Dt.mergeArray(r,a)):Dt.mergeArray(r,o)}get items(){return this._def.items}rest(e){return new Ir({...this._def,rest:e})}};Ir.create=(t,e)=>new Ir({items:t,typeName:ye.ZodTuple,rest:null,...Ne(e)});var ws=class extends Ae{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==ie.object)return he(i,{code:re.invalid_type,expected:ie.object,received:i.parsedType}),we;let n=[],o=this._def.keyType,a=this._def.valueType;for(let h in i.data)n.push({key:o._parse(new Tr(i,h,i.path,h)),value:a._parse(new Tr(i,i.data[h],i.path,h))});return i.common.async?Dt.mergeObjectAsync(r,n):Dt.mergeObjectSync(r,n)}get element(){return this._def.valueType}static create(e,r,i){return r instanceof Ae?new ws({keyType:e,valueType:r,typeName:ye.ZodRecord,...Ne(i)}):new ws({keyType:gi.create(),valueType:e,typeName:ye.ZodRecord,...Ne(r)})}},Lo=class extends Ae{_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==ie.map)return he(i,{code:re.invalid_type,expected:ie.map,received:i.parsedType}),we;let n=this._def.keyType,o=this._def.valueType,a=[...i.data.entries()].map(([h,d],m)=>({key:n._parse(new Tr(i,h,i.path,[m,"key"])),value:o._parse(new Tr(i,d,i.path,[m,"value"]))}));if(i.common.async){let h=new Map;return Promise.resolve().then(async()=>{for(let d of a){let m=await d.key,p=await d.value;if(m.status==="aborted"||p.status==="aborted")return we;(m.status==="dirty"||p.status==="dirty")&&r.dirty(),h.set(m.value,p.value)}return{status:r.value,value:h}})}else{let h=new Map;for(let d of a){let m=d.key,p=d.value;if(m.status==="aborted"||p.status==="aborted")return we;(m.status==="dirty"||p.status==="dirty")&&r.dirty(),h.set(m.value,p.value)}return{status:r.value,value:h}}}};Lo.create=(t,e,r)=>new Lo({valueType:e,keyType:t,typeName:ye.ZodMap,...Ne(r)});var Hi=class extends Ae{_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==ie.set)return he(i,{code:re.invalid_type,expected:ie.set,received:i.parsedType}),we;let n=this._def;n.minSize!==null&&i.data.size<n.minSize.value&&(he(i,{code:re.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,message:n.minSize.message}),r.dirty()),n.maxSize!==null&&i.data.size>n.maxSize.value&&(he(i,{code:re.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,message:n.maxSize.message}),r.dirty());let o=this._def.valueType;function a(d){let m=new Set;for(let p of d){if(p.status==="aborted")return we;p.status==="dirty"&&r.dirty(),m.add(p.value)}return{status:r.value,value:m}}let h=[...i.data.values()].map((d,m)=>o._parse(new Tr(i,d,i.path,m)));return i.common.async?Promise.all(h).then(d=>a(d)):a(h)}min(e,r){return new Hi({...this._def,minSize:{value:e,message:Ke.toString(r)}})}max(e,r){return new Hi({...this._def,maxSize:{value:e,message:Ke.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};Hi.create=(t,e)=>new Hi({valueType:t,minSize:null,maxSize:null,typeName:ye.ZodSet,...Ne(e)});var Gi=class extends Ae{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==ie.function)return he(r,{code:re.invalid_type,expected:ie.function,received:r.parsedType}),we;function i(h,d){return uh({data:h,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Qa,Ja].filter(m=>!!m),issueData:{code:re.invalid_arguments,argumentsError:d}})}function n(h,d){return uh({data:h,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Qa,Ja].filter(m=>!!m),issueData:{code:re.invalid_return_type,returnTypeError:d}})}let o={errorMap:r.common.contextualErrorMap},a=r.data;return this._def.returns instanceof bn?$t(async(...h)=>{let d=new Hr([]),m=await this._def.args.parseAsync(h,o).catch(E=>{throw d.addIssue(i(h,E)),d}),p=await a(...m);return await this._def.returns._def.type.parseAsync(p,o).catch(E=>{throw d.addIssue(n(p,E)),d})}):$t((...h)=>{let d=this._def.args.safeParse(h,o);if(!d.success)throw new Hr([i(h,d.error)]);let m=a(...d.data),p=this._def.returns.safeParse(m,o);if(!p.success)throw new Hr([n(m,p.error)]);return p.data})}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Gi({...this._def,args:Ir.create(e).rest(pi.create())})}returns(e){return new Gi({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}};Gi.create=(t,e,r)=>new Gi({args:t?t.rest(pi.create()):Ir.create([]).rest(pi.create()),returns:e||pi.create(),typeName:ye.ZodFunction,...Ne(r)});var Do=class extends Ae{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Do.create=(t,e)=>new Do({getter:t,typeName:ye.ZodLazy,...Ne(e)});var Bo=class extends Ae{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return he(r,{code:re.invalid_literal,expected:this._def.value}),we}return{status:"valid",value:e.data}}get value(){return this._def.value}};Bo.create=(t,e)=>new Bo({value:t,typeName:ye.ZodLiteral,...Ne(e)});function j2(t,e){return new zo({values:t,typeName:ye.ZodEnum,...Ne(e)})}var zo=class extends Ae{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),i=this._def.values;return he(r,{expected:et.joinValues(i),received:r.parsedType,code:re.invalid_type}),we}if(this._def.values.indexOf(e.data)===-1){let r=this._getOrReturnCtx(e),i=this._def.values;return he(r,{received:r.data,code:re.invalid_enum_value,options:i}),we}return $t(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}};zo.create=j2;var Fo=class extends Ae{_parse(e){let r=et.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(e);if(i.parsedType!==ie.string&&i.parsedType!==ie.number){let n=et.objectValues(r);return he(i,{expected:et.joinValues(n),received:i.parsedType,code:re.invalid_type}),we}if(r.indexOf(e.data)===-1){let n=et.objectValues(r);return he(i,{received:i.data,code:re.invalid_enum_value,options:n}),we}return $t(e.data)}get enum(){return this._def.values}};Fo.create=(t,e)=>new Fo({values:t,typeName:ye.ZodNativeEnum,...Ne(e)});var bn=class extends Ae{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==ie.promise&&r.common.async===!1)return he(r,{code:re.invalid_type,expected:ie.promise,received:r.parsedType}),we;let i=r.parsedType===ie.promise?r.data:Promise.resolve(r.data);return $t(i.then(n=>this._def.type.parseAsync(n,{path:r.path,errorMap:r.common.contextualErrorMap})))}};bn.create=(t,e)=>new bn({type:t,typeName:ye.ZodPromise,...Ne(e)});var Pr=class extends Ae{innerType(){return this._def.schema}_parse(e){let{status:r,ctx:i}=this._processInputParams(e),n=this._def.effect||null;if(n.type==="preprocess"){let a=n.transform(i.data);return i.common.async?Promise.resolve(a).then(h=>this._def.schema._parseAsync({data:h,path:i.path,parent:i})):this._def.schema._parseSync({data:a,path:i.path,parent:i})}let o={addIssue:a=>{he(i,a),a.fatal?r.abort():r.dirty()},get path(){return i.path}};if(o.addIssue=o.addIssue.bind(o),n.type==="refinement"){let a=h=>{let d=n.refinement(h,o);if(i.common.async)return Promise.resolve(d);if(d instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return h};if(i.common.async===!1){let h=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return h.status==="aborted"?we:(h.status==="dirty"&&r.dirty(),a(h.value),{status:r.value,value:h.value})}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(h=>h.status==="aborted"?we:(h.status==="dirty"&&r.dirty(),a(h.value).then(()=>({status:r.value,value:h.value}))))}if(n.type==="transform")if(i.common.async===!1){let a=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!hh(a))return a;let h=n.transform(a.value,o);if(h instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:h}}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(a=>hh(a)?Promise.resolve(n.transform(a.value,o)).then(h=>({status:r.value,value:h})):a);et.assertNever(n)}};Pr.create=(t,e,r)=>new Pr({schema:t,typeName:ye.ZodEffects,effect:e,...Ne(r)});Pr.createWithPreprocess=(t,e,r)=>new Pr({schema:e,effect:{type:"preprocess",transform:t},typeName:ye.ZodEffects,...Ne(r)});var Cr=class extends Ae{_parse(e){return this._getType(e)===ie.undefined?$t(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Cr.create=(t,e)=>new Cr({innerType:t,typeName:ye.ZodOptional,...Ne(e)});var Vi=class extends Ae{_parse(e){return this._getType(e)===ie.null?$t(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Vi.create=(t,e)=>new Vi({innerType:t,typeName:ye.ZodNullable,...Ne(e)});var el=class extends Ae{_parse(e){let{ctx:r}=this._processInputParams(e),i=r.data;return r.parsedType===ie.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};el.create=(t,e)=>new Cr({innerType:t,typeName:ye.ZodOptional,...Ne(e)});var Uo=class extends Ae{_parse(e){if(this._getType(e)!==ie.nan){let i=this._getOrReturnCtx(e);return he(i,{code:re.invalid_type,expected:ie.nan,received:i.parsedType}),we}return{status:"valid",value:e.data}}};Uo.create=t=>new Uo({typeName:ye.ZodNaN,...Ne(t)});var by=(t,e={},r)=>t?yn.create().superRefine((i,n)=>{if(!t(i)){let o=typeof e=="function"?e(i):e,a=typeof o=="string"?{message:o}:o;n.addIssue({code:"custom",...a,fatal:r})}}):yn.create(),W2={object:Xe.lazycreate},ye;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodPromise="ZodPromise"})(ye||(ye={}));var $2=(t,e={message:`Input not instance of ${t.name}`})=>by(r=>r instanceof t,e,!0),vy=gi.create,wy=qi.create,q2=Uo.create,H2=To.create,_y=Ao.create,G2=Io.create,V2=Po.create,K2=Oo.create,Y2=yn.create,Z2=pi.create,X2=yi.create,J2=ko.create,Q2=Ar.create,eE=Xe.create,tE=Xe.strictCreate,rE=bs.create,iE=No.create,nE=vs.create,sE=Ir.create,oE=ws.create,aE=Lo.create,lE=Hi.create,uE=Gi.create,hE=Do.create,cE=Bo.create,fE=zo.create,dE=Fo.create,mE=bn.create,yy=Pr.create,pE=Cr.create,gE=Vi.create,yE=Pr.createWithPreprocess,bE=()=>vy().optional(),vE=()=>wy().optional(),wE=()=>_y().optional(),fe=Object.freeze({__proto__:null,getParsedType:gn,ZodParsedType:ie,makeIssue:uh,EMPTY_PATH:L2,addIssueToContext:he,ParseStatus:Dt,INVALID:we,DIRTY:D2,OK:$t,isAborted:Nd,isDirty:Ld,isValid:hh,isAsync:Dd,ZodType:Ae,ZodString:gi,ZodNumber:qi,ZodBigInt:To,ZodBoolean:Ao,ZodDate:Io,ZodUndefined:Po,ZodNull:Oo,ZodAny:yn,ZodUnknown:pi,ZodNever:yi,ZodVoid:ko,ZodArray:Ar,get objectUtil(){return ch},ZodObject:Xe,ZodUnion:bs,ZodDiscriminatedUnion:No,ZodIntersection:vs,ZodTuple:Ir,ZodRecord:ws,ZodMap:Lo,ZodSet:Hi,ZodFunction:Gi,ZodLazy:Do,ZodLiteral:Bo,ZodEnum:zo,ZodNativeEnum:Fo,ZodPromise:bn,ZodEffects:Pr,ZodTransformer:Pr,ZodOptional:Cr,ZodNullable:Vi,ZodDefault:el,ZodNaN:Uo,custom:by,Schema:Ae,ZodSchema:Ae,late:W2,get ZodFirstPartyTypeKind(){return ye},any:Y2,array:Q2,bigint:H2,boolean:_y,date:G2,discriminatedUnion:iE,effect:yy,enum:fE,function:uE,instanceof:$2,intersection:nE,lazy:hE,literal:cE,map:aE,nan:q2,nativeEnum:dE,never:X2,null:K2,nullable:gE,number:wy,object:eE,oboolean:wE,onumber:vE,optional:pE,ostring:bE,preprocess:yE,promise:mE,record:oE,set:lE,strictObject:tE,string:vy,transformer:yy,tuple:sE,undefined:V2,union:rE,unknown:Z2,void:J2,ZodIssueCode:re,quotelessJson:k2,ZodError:Hr,defaultErrorMap:Ja,get overrideErrorMap(){return Qa},setErrorMap:N2});var _E=fe.object({title:fe.string(),description:fe.string(),fees:fe.string(),accessConstraints:fe.string()}),SE=fe.object({deliveryPoint:fe.string(),city:fe.string(),postalCode:fe.string(),country:fe.string(),email:fe.string()}),xE=fe.object({individualName:fe.string(),position:fe.string(),phone:fe.string(),address:SE}),EE=fe.object({name:fe.string(),site:fe.string(),contact:xE}),ME=fe.object({id:fe.string(),serviceIdentification:_E,serviceProvider:EE});var RE=fe.object({id:fe.string(),version:fe.number(),name:fe.string(),metadata:fe.unknown().optional(),sprite:fe.string().optional(),glyphs:fe.string().optional(),sources:fe.unknown(),layers:fe.array(fe.unknown())});function CE(t){try{return Hu(t),!0}catch{return!1}}var TE=fe.string().refine(CE,{message:"Invalid hex color"}),jo={minZoom:0,maxZoom:32},fh=fe.number().refine(t=>t>=jo.minZoom&&t<=jo.maxZoom,{message:`must be between ${jo.minZoom} and ${jo.maxZoom}`}),AE=fe.object({name:fe.string(),2193:fe.string().optional(),3857:fe.string().optional(),minZoom:fh.optional(),maxZoom:fh.optional()}).refine(({minZoom:t,maxZoom:e})=>(t||jo.minZoom)<=(e||jo.maxZoom),{message:"minZoom may no be greater than maxZoom",path:["minZoom"]}),IE=fe.object({type:fe.nativeEnum(dt),id:fe.string(),title:fe.string().optional(),description:fe.string().optional(),background:TE.optional(),layers:fe.array(AE),minZoom:fh.optional(),maxZoom:fh.optional(),format:fe.union([fe.nativeEnum(Ge),fe.nativeEnum(gr)]).optional()});var Wo={Aws:{Region:"ap-southeast-2"},ApiKey:{QueryString:"api",TableName:"ApiKey",RequestLimitMinute:1e3},TileMetadata:{TableName:"TileMetadata",RequestLimitMinute:1e3}},ct={PublicUrlBase:"BASEMAPS_PUBLIC_URL",AssetLocation:"BASEMAPS_ASSEST_LOCATION",TiffConcurrency:"TIFF_CONCURRENCY",TempFolder:"TEMP_FOLDER",BatchIndex:"AWS_BATCH_JOB_ARRAY_INDEX",AwsRoleDurationHours:"AWS_ROLE_DURATION_HOURS",AwsRoleConfigBucket:"ROLE_CONFIG_BUCKET",ImportImageryBucket:"IMPORT_IMAGERY_BUCKET",ImportFilesNumberLimit:"FILES_NUMBER_LIMIT",ImportFilesSizeLimitGb:"FILES_SIZE_LIMIT_GB",Gdal:{UseDocker:"GDAL_DOCKER",DockerContainer:"GDAL_DOCKER_CONTAINER",DockerContainerTag:"GDAL_DOCKER_CONTAINER_TAG"},Analytics:{CloudFrontId:"ANALYTICS_CLOUD_FRONT_ID",CloudFrontSourceBucket:"ANALYTICS_CLOUD_FRONT_SOURCE_BUCKET",CacheBucket:"ANALYTICS_CACHE_BUCKET"},get(t){return process.env[t]},getNumber(t,e){let r=ct.get(t);if(r===""||r==null)return e;let i=parseFloat(r);return isNaN(i)?e:i},isProduction(){return!0}};var gm=ve(yd(),1);var Gr=ve(Cy(),1);function BE(t){return t<=10?Gr.default.gray("TRACE"):t<=20?Gr.default.magenta("DEBUG"):t<=30?Gr.default.cyan("INFO"):t<=40?Gr.default.yellow("WARN"):t<=50?Gr.default.red("ERROR"):Gr.default.bgRed("FATAL")}var Ki=class{constructor(e){this.level=e}static formatObject(e){let r=[];for(let i of Object.keys(e)){if(Ki.Ignore.has(i))continue;let n=e[i];if(n==null||n==="")continue;let o="",a=typeof n;if(a==="number")o=Gr.default.yellow(String(n));else if(a==="string")o=Gr.default.green(n);else if(a==="object"){let h=this.formatObject(n);h.length>0&&(o=`{ ${h.join(" ")} }`)}else o=String(n);o!==""&&r.push(`${Gr.default.dim(i)}=${o}`)}return r}pretty(e){if(e.level<this.level)return null;let r=new Date(e.time);if(isNaN(r.getTime()))return null;let n=Ki.formatObject(e).join(" ");return`[${r.toISOString()}] ${BE(e.level)} ${Gr.default.blue(e.msg)} ${n}`}};Ki.Ignore=new Set(["pid","time","hostname","level","v","name","msg"]);var Lb=ve(Nb(),1),Ko=require("stream"),Db=require("string_decoder");function qR(t){try{return JSON.parse(t)}catch{return null}}function HR(t){t!=null&&console.error("PrettyTransformFailed",t)}var Mn=class extends Ko.Transform{constructor(){super(),this.pretty=new Ki(-1),this.decoder=new Db.StringDecoder}static stream(e=process.stdout){let r=new Ko.PassThrough;return Mn.pretty(r,e),r}static pretty(e,r=process.stdout){let i=new Mn;return(0,Ko.pipeline)(e,(0,Lb.default)(),i,r,HR),i}_transform(e,r,i){if(r!=="buffer")return i(new Error(`Unknown encoding: ${r}`));let n=this.decoder.write(e),o=qR(n);if(o==null)return i(null,e+`
119
- `);let a=this.pretty.pretty(o);if(a==null)return i(null,e+`
133
+ `),i=!1,n=!1,s;t.on("response",a=>{let{headers:c}=a;i=c["transfer-encoding"]==="chunked"&&!c["content-length"]}),t.on("socket",a=>{let c=()=>{if(i&&!n){let d=new Error("Premature close");d.code="ERR_STREAM_PREMATURE_CLOSE",e(d)}};a.prependListener("close",c),t.on("abort",()=>{a.removeListener("close",c)}),a.on("data",d=>{n=Qa.Buffer.compare(d.slice(-5),r)===0,!n&&s&&(n=Qa.Buffer.compare(s.slice(-3),r.slice(0,3))===0&&Qa.Buffer.compare(d.slice(-2),r.slice(3))===0),s=d})})}var Pt=class extends xt{constructor(e){super(),this.type="url",this.protocol="http",this.chunkSize=Pt.DefaultChunkSize,this.uri=e}static isSource(e){return e.type==="url"}get size(){return this._size?this._size:(this._size=Promise.resolve().then(async()=>{let e=await Pt.fetch(this.uri,{method:"HEAD"});return Number(e.headers.get("content-length"))}),this._size)}async fetchBytes(e,r){let n={Range:this.toRange(e,r)},s=await Pt.fetch(this.uri,{headers:n});if(s.ok){let a=s.headers.get("content-range");return this._size==null&&a!=null&&(this._size=Promise.resolve(this.parseContentRange(a))),s.arrayBuffer()}throw new Error("Failed to fetch")}};Pt.DefaultChunkSize=32*1024;Pt.fetch=(t,e)=>fetch(t,e);function Y2(t,e){return Ai(t)?t.code==="ENOENT"?new Je(e,404,t):t.code==="EACCES"?new Je(e,403,t):new Je(e,500,t):new Je(e,500,t)}var Ni=class{constructor(){this.protocol=Ni.protocol}static is(e){return e.protocol===Ni.protocol}source(e){return new Pt(e)}async*list(e){throw new Error(`Unable to "list" on ${e}`)}async*details(e){throw new Error(`Unable to "details" on ${e}`)}async head(e){let r=await Pt.fetch(e,{method:"HEAD"});if(!r.ok)throw Y2(new Error(r.statusText),`Failed to head: ${e}`);return{path:e,size:Number(r.headers.get("content-length")),isDirectory:!1}}async read(e){let r=await Pt.fetch(e,{method:"GET"});if(!r.ok)throw Y2(new Error(r.statusText),`Failed to head: ${e}`);return Buffer.from(await r.arrayBuffer())}async write(e){throw new Error(`Unable to "write" on ${e}`)}stream(e){throw new Error(`Unable to "stream" on ${e}`)}};Ni.protocol="http";Pt.fetch=ou;function wy(t){return typeof t!="object"||t==null?!1:t.constructor===Object}var au=class{constructor(){this.protocol="abstract",this.isOrdered=!0,this.systems=[],this.toArray=p2,this.join=Gh,this.joinAll=d2}register(e,r,i="rw"){for(let n=0;n<this.systems.length;n++){let s=this.systems[n];if(s.path===e&&s.flag===i){this.systems.splice(n,1,{path:e,system:r,flag:i});return}}this.systems.push({path:e,system:r,flag:i}),this.isOrdered=!1}read(e){return this.get(e,"r").read(e)}async readJson(e){let r=await this.read(e);return JSON.parse(r.toString())}stream(e){return this.get(e,"r").stream(e)}write(e,r,i){if(Array.isArray(r)||wy(r)){let n=JSON.stringify(r,null,2);return this.get(e,"rw").write(e,n,{contentType:"application/json",...i})}return this.get(e,"rw").write(e,r,i)}list(e,r){return this.get(e,"r").list(e,r)}details(e,r){return this.get(e,"r").details(e,r)}exists(e){return this.get(e,"r").head(e).then(r=>r!=null)}head(e){return this.get(e,"r").head(e)}source(e){return this.get(e,"r").source(e)}sortSystems(){this.isOrdered||(this.systems.sort((e,r)=>r.path.length-e.path.length),this.isOrdered=!0)}get(e,r){this.sortSystems();for(let i of this.systems)if(e.startsWith(i.path)){if(r==="rw"&&i.flag==="r")continue;return i.system}throw new Error(`Unable to find file system for path:${e}`)}},Ye=new au;var X2=new Pi;Ye.register("",X2);Ye.register("file://",X2);var Q2=new Ni;Ye.register("http://",Q2);Ye.register("https://",Q2);var w8=fe(Zn(),1);var Ve;(function(t){function e(i){throw new Error}t.assertNever=e,t.arrayToEnum=i=>{let n={};for(let s of i)n[s]=s;return n},t.getValidEnumValues=i=>{let n=t.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),s={};for(let a of n)s[a]=i[a];return t.objectValues(s)},t.objectValues=i=>t.objectKeys(i).map(function(n){return i[n]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let n=[];for(let s in i)Object.prototype.hasOwnProperty.call(i,s)&&n.push(s);return n},t.find=(i,n)=>{for(let s of i)if(n(s))return s},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function r(i,n=" | "){return i.map(s=>typeof s=="string"?`'${s}'`:s).join(n)}t.joinValues=r})(Ve||(Ve={}));var Q=Ve.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),un=t=>{switch(typeof t){case"undefined":return Q.undefined;case"string":return Q.string;case"number":return isNaN(t)?Q.nan:Q.number;case"boolean":return Q.boolean;case"function":return Q.function;case"bigint":return Q.bigint;case"object":return Array.isArray(t)?Q.array:t===null?Q.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Q.promise:typeof Map<"u"&&t instanceof Map?Q.map:typeof Set<"u"&&t instanceof Set?Q.set:typeof Date<"u"&&t instanceof Date?Q.date:Q.object;default:return Q.unknown}},X=Ve.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of"]),_y=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),Dr=class extends Error{constructor(e){super(),this.issues=[],this.addIssue=i=>{this.issues=[...this.issues,i]},this.addIssues=(i=[])=>{this.issues=[...this.issues,...i]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){let r=e||function(s){return s.message},i={_errors:[]},n=s=>{for(let a of s.issues)if(a.code==="invalid_union")a.unionErrors.map(n);else if(a.code==="invalid_return_type")n(a.returnTypeError);else if(a.code==="invalid_arguments")n(a.argumentsError);else if(a.path.length===0)i._errors.push(r(a));else{let c=i,d=0;for(;d<a.path.length;){let p=a.path[d];d===a.path.length-1?(c[p]=c[p]||{_errors:[]},c[p]._errors.push(r(a))):c[p]=c[p]||{_errors:[]},c=c[p],d++}}};return n(this),i}toString(){return this.message}get message(){return JSON.stringify(this.issues,null,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},i=[];for(let n of this.issues)n.path.length>0?(r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(e(n))):i.push(e(n));return{formErrors:i,fieldErrors:r}}get formErrors(){return this.flatten()}};Dr.create=t=>new Dr(t);var e1=(t,e)=>{let r;switch(t.code){case X.invalid_type:t.received===Q.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case X.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected)}`;break;case X.unrecognized_keys:r=`Unrecognized key(s) in object: ${Ve.joinValues(t.keys,", ")}`;break;case X.invalid_union:r="Invalid input";break;case X.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Ve.joinValues(t.options)}`;break;case X.invalid_enum_value:r=`Invalid enum value. Expected ${Ve.joinValues(t.options)}, received '${t.received}'`;break;case X.invalid_arguments:r="Invalid function arguments";break;case X.invalid_return_type:r="Invalid function return type";break;case X.invalid_date:r="Invalid date";break;case X.invalid_string:t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case X.too_small:t.type==="array"?r=`Array must contain ${t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be greater than ${t.inclusive?"or equal to ":""}${t.minimum}`:r="Invalid input";break;case X.too_big:t.type==="array"?r=`Array must contain ${t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be less than ${t.inclusive?"or equal to ":""}${t.maximum}`:r="Invalid input";break;case X.custom:r="Invalid input";break;case X.invalid_intersection_types:r="Intersection results could not be merged";break;case X.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;default:r=e.defaultError,Ve.assertNever(t)}return{message:r}},t1=e1,Sy=t=>{t1=t},lu=t=>{let{data:e,path:r,errorMaps:i,issueData:n}=t,s=[...r,...n.path||[]],a={...n,path:s},c="",d=i.filter(p=>!!p).slice().reverse();for(let p of d)c=p(a,{data:e,defaultError:c}).message;return{...n,path:s,message:n.message||c}},xy=[];function oe(t,e){let r=lu({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,t1,e1].filter(i=>!!i)});t.common.issues.push(r)}var Et=class{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let i=[];for(let n of r){if(n.status==="aborted")return de;n.status==="dirty"&&e.dirty(),i.push(n.value)}return{status:e.value,value:i}}static async mergeObjectAsync(e,r){let i=[];for(let n of r)i.push({key:await n.key,value:await n.value});return Et.mergeObjectSync(e,i)}static mergeObjectSync(e,r){let i={};for(let n of r){let{key:s,value:a}=n;if(s.status==="aborted"||a.status==="aborted")return de;s.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),(typeof a.value<"u"||n.alwaysSet)&&(i[s.value]=a.value)}return{status:e.value,value:i}}},de=Object.freeze({status:"aborted"}),My=t=>({status:"dirty",value:t}),Tt=t=>({status:"valid",value:t}),nf=t=>t.status==="aborted",sf=t=>t.status==="dirty",uu=t=>t.status==="valid",of=t=>typeof Promise!==void 0&&t instanceof Promise,$e;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})($e||($e={}));var br=class{constructor(e,r,i,n){this.parent=e,this.data=r,this._path=i,this._key=n}get path(){return this._path.concat(this._key)}},e5=(t,e)=>{if(uu(e))return{success:!0,data:e.value};{if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");let r=new Dr(t.common.issues);return{success:!1,error:r}}};function Ee(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:i,description:n}=t;if(e&&(r||i))throw new Error(`Can't use "invalid" or "required" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(a,c)=>a.code!=="invalid_type"?{message:c.defaultError}:typeof c.data>"u"&&i?{message:i}:t.invalid_type_error?{message:t.invalid_type_error}:{message:c.defaultError},description:n}}var xe=class{constructor(e){this.spa=this.safeParseAsync,this.superRefine=this._refinement,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.default=this.default.bind(this),this.describe=this.describe.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return un(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:un(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Et,ctx:{common:e.parent.common,data:e.data,parsedType:un(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(of(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let i=this.safeParse(e,r);if(i.success)return i.data;throw i.error}safeParse(e,r){var i;let n={common:{issues:[],async:(i=r?.async)!==null&&i!==void 0?i:!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:un(e)},s=this._parseSync({data:e,path:n.path,parent:n});return e5(n,s)}async parseAsync(e,r){let i=await this.safeParseAsync(e,r);if(i.success)return i.data;throw i.error}async safeParseAsync(e,r){let i={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:un(e)},n=this._parse({data:e,path:[],parent:i}),s=await(of(n)?n:Promise.resolve(n));return e5(i,s)}refine(e,r){let i=n=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(n):r;return this._refinement((n,s)=>{let a=e(n),c=()=>s.addIssue({code:X.custom,...i(n)});return typeof Promise<"u"&&a instanceof Promise?a.then(d=>d?!0:(c(),!1)):a?!0:(c(),!1)})}refinement(e,r){return this._refinement((i,n)=>e(i)?!0:(n.addIssue(typeof r=="function"?r(i,n):r),!1))}_refinement(e){return new _r({schema:this,typeName:he.ZodEffects,effect:{type:"refinement",refinement:e}})}optional(){return yr.create(this)}nullable(){return ji.create(this)}nullish(){return this.optional().nullable()}array(){return vr.create(this)}promise(){return hn.create(this)}or(e){return rs.create([this,e])}and(e){return is.create(this,e)}transform(e){return new _r({schema:this,typeName:he.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new r1({innerType:this,defaultValue:r,typeName:he.ZodDefault})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Ey=/^c[^\s-]{8,}$/i,Ry=/^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i,Cy=/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i,li=class extends xe{constructor(){super(...arguments),this._regex=(e,r,i)=>this.refinement(n=>e.test(n),{validation:r,code:X.invalid_string,...$e.errToObj(i)}),this.nonempty=e=>this.min(1,$e.errToObj(e)),this.trim=()=>new li({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}_parse(e){if(this._getType(e)!==Q.string){let s=this._getOrReturnCtx(e);return oe(s,{code:X.invalid_type,expected:Q.string,received:s.parsedType}),de}let i=new Et,n;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(n=this._getOrReturnCtx(e,n),oe(n,{code:X.too_small,minimum:s.value,type:"string",inclusive:!0,message:s.message}),i.dirty());else if(s.kind==="max")e.data.length>s.value&&(n=this._getOrReturnCtx(e,n),oe(n,{code:X.too_big,maximum:s.value,type:"string",inclusive:!0,message:s.message}),i.dirty());else if(s.kind==="email")Cy.test(e.data)||(n=this._getOrReturnCtx(e,n),oe(n,{validation:"email",code:X.invalid_string,message:s.message}),i.dirty());else if(s.kind==="uuid")Ry.test(e.data)||(n=this._getOrReturnCtx(e,n),oe(n,{validation:"uuid",code:X.invalid_string,message:s.message}),i.dirty());else if(s.kind==="cuid")Ey.test(e.data)||(n=this._getOrReturnCtx(e,n),oe(n,{validation:"cuid",code:X.invalid_string,message:s.message}),i.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),oe(n,{validation:"url",code:X.invalid_string,message:s.message}),i.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),oe(n,{validation:"regex",code:X.invalid_string,message:s.message}),i.dirty())):s.kind==="trim"?e.data=e.data.trim():Ve.assertNever(s);return{status:i.value,value:e.data}}_addCheck(e){return new li({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...$e.errToObj(e)})}url(e){return this._addCheck({kind:"url",...$e.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...$e.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...$e.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...$e.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...$e.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...$e.errToObj(r)})}length(e,r){return this.min(e,r).max(e,r)}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get minLength(){let e=-1/0;return this._def.checks.map(r=>{r.kind==="min"&&(e===null||r.value>e)&&(e=r.value)}),e}get maxLength(){let e=null;return this._def.checks.map(r=>{r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}),e}};li.create=t=>new li({checks:[],typeName:he.ZodString,...Ee(t)});function Ay(t,e){let r=(t.toString().split(".")[1]||"").length,i=(e.toString().split(".")[1]||"").length,n=r>i?r:i,s=parseInt(t.toFixed(n).replace(".","")),a=parseInt(e.toFixed(n).replace(".",""));return s%a/Math.pow(10,n)}var Di=class extends xe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._getType(e)!==Q.number){let s=this._getOrReturnCtx(e);return oe(s,{code:X.invalid_type,expected:Q.number,received:s.parsedType}),de}let i,n=new Et;for(let s of this._def.checks)s.kind==="int"?Ve.isInteger(e.data)||(i=this._getOrReturnCtx(e,i),oe(i,{code:X.invalid_type,expected:"integer",received:"float",message:s.message}),n.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(i=this._getOrReturnCtx(e,i),oe(i,{code:X.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,message:s.message}),n.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(i=this._getOrReturnCtx(e,i),oe(i,{code:X.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,message:s.message}),n.dirty()):s.kind==="multipleOf"?Ay(e.data,s.value)!==0&&(i=this._getOrReturnCtx(e,i),oe(i,{code:X.not_multiple_of,multipleOf:s.value,message:s.message}),n.dirty()):Ve.assertNever(s);return{status:n.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,$e.toString(r))}gt(e,r){return this.setLimit("min",e,!1,$e.toString(r))}lte(e,r){return this.setLimit("max",e,!0,$e.toString(r))}lt(e,r){return this.setLimit("max",e,!1,$e.toString(r))}setLimit(e,r,i,n){return new Di({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:i,message:$e.toString(n)}]})}_addCheck(e){return new Di({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:$e.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:$e.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:$e.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:$e.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:$e.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:$e.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int")}};Di.create=t=>new Di({checks:[],typeName:he.ZodNumber,...Ee(t)});var fo=class extends xe{_parse(e){if(this._getType(e)!==Q.bigint){let i=this._getOrReturnCtx(e);return oe(i,{code:X.invalid_type,expected:Q.bigint,received:i.parsedType}),de}return Tt(e.data)}};fo.create=t=>new fo({typeName:he.ZodBigInt,...Ee(t)});var po=class extends xe{_parse(e){if(this._getType(e)!==Q.boolean){let i=this._getOrReturnCtx(e);return oe(i,{code:X.invalid_type,expected:Q.boolean,received:i.parsedType}),de}return Tt(e.data)}};po.create=t=>new po({typeName:he.ZodBoolean,...Ee(t)});var mo=class extends xe{_parse(e){if(this._getType(e)!==Q.date){let i=this._getOrReturnCtx(e);return oe(i,{code:X.invalid_type,expected:Q.date,received:i.parsedType}),de}if(isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return oe(i,{code:X.invalid_date}),de}return{status:"valid",value:new Date(e.data.getTime())}}};mo.create=t=>new mo({typeName:he.ZodDate,...Ee(t)});var go=class extends xe{_parse(e){if(this._getType(e)!==Q.undefined){let i=this._getOrReturnCtx(e);return oe(i,{code:X.invalid_type,expected:Q.undefined,received:i.parsedType}),de}return Tt(e.data)}};go.create=t=>new go({typeName:he.ZodUndefined,...Ee(t)});var yo=class extends xe{_parse(e){if(this._getType(e)!==Q.null){let i=this._getOrReturnCtx(e);return oe(i,{code:X.invalid_type,expected:Q.null,received:i.parsedType}),de}return Tt(e.data)}};yo.create=t=>new yo({typeName:he.ZodNull,...Ee(t)});var cn=class extends xe{constructor(){super(...arguments),this._any=!0}_parse(e){return Tt(e.data)}};cn.create=t=>new cn({typeName:he.ZodAny,...Ee(t)});var ai=class extends xe{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Tt(e.data)}};ai.create=t=>new ai({typeName:he.ZodUnknown,...Ee(t)});var ui=class extends xe{_parse(e){let r=this._getOrReturnCtx(e);return oe(r,{code:X.invalid_type,expected:Q.never,received:r.parsedType}),de}};ui.create=t=>new ui({typeName:he.ZodNever,...Ee(t)});var bo=class extends xe{_parse(e){if(this._getType(e)!==Q.undefined){let i=this._getOrReturnCtx(e);return oe(i,{code:X.invalid_type,expected:Q.void,received:i.parsedType}),de}return Tt(e.data)}};bo.create=t=>new bo({typeName:he.ZodVoid,...Ee(t)});var vr=class extends xe{_parse(e){let{ctx:r,status:i}=this._processInputParams(e),n=this._def;if(r.parsedType!==Q.array)return oe(r,{code:X.invalid_type,expected:Q.array,received:r.parsedType}),de;if(n.minLength!==null&&r.data.length<n.minLength.value&&(oe(r,{code:X.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,message:n.minLength.message}),i.dirty()),n.maxLength!==null&&r.data.length>n.maxLength.value&&(oe(r,{code:X.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,message:n.maxLength.message}),i.dirty()),r.common.async)return Promise.all(r.data.map((a,c)=>n.type._parseAsync(new br(r,a,r.path,c)))).then(a=>Et.mergeArray(i,a));let s=r.data.map((a,c)=>n.type._parseSync(new br(r,a,r.path,c)));return Et.mergeArray(i,s)}get element(){return this._def.type}min(e,r){return new vr({...this._def,minLength:{value:e,message:$e.toString(r)}})}max(e,r){return new vr({...this._def,maxLength:{value:e,message:$e.toString(r)}})}length(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};vr.create=(t,e)=>new vr({type:t,minLength:null,maxLength:null,typeName:he.ZodArray,...Ee(e)});var cu;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(cu||(cu={}));var t5=t=>e=>new Ge({...t,shape:()=>({...t.shape(),...e})});function ho(t){if(t instanceof Ge){let e={};for(let r in t.shape){let i=t.shape[r];e[r]=yr.create(ho(i))}return new Ge({...t._def,shape:()=>e})}else return t instanceof vr?vr.create(ho(t.element)):t instanceof yr?yr.create(ho(t.unwrap())):t instanceof ji?ji.create(ho(t.unwrap())):t instanceof wr?wr.create(t.items.map(e=>ho(e))):t}var Ge=class extends xe{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=t5(this._def),this.extend=t5(this._def)}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=Ve.objectKeys(e);return this._cached={shape:e,keys:r}}_parse(e){if(this._getType(e)!==Q.object){let p=this._getOrReturnCtx(e);return oe(p,{code:X.invalid_type,expected:Q.object,received:p.parsedType}),de}let{status:i,ctx:n}=this._processInputParams(e),{shape:s,keys:a}=this._getCached(),c=[];for(let p in n.data)a.includes(p)||c.push(p);let d=[];for(let p of a){let m=s[p],w=n.data[p];d.push({key:{status:"valid",value:p},value:m._parse(new br(n,w,n.path,p)),alwaysSet:p in n.data})}if(this._def.catchall instanceof ui){let p=this._def.unknownKeys;if(p==="passthrough")for(let m of c)d.push({key:{status:"valid",value:m},value:{status:"valid",value:n.data[m]}});else if(p==="strict")c.length>0&&(oe(n,{code:X.unrecognized_keys,keys:c}),i.dirty());else if(p!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let p=this._def.catchall;for(let m of c){let w=n.data[m];d.push({key:{status:"valid",value:m},value:p._parse(new br(n,w,n.path,m)),alwaysSet:m in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let p=[];for(let m of d){let w=await m.key;p.push({key:w,value:await m.value,alwaysSet:m.alwaysSet})}return p}).then(p=>Et.mergeObjectSync(i,p)):Et.mergeObjectSync(i,d)}get shape(){return this._def.shape()}strict(e){return $e.errToObj,new Ge({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,i)=>{var n,s,a,c;let d=(a=(s=(n=this._def).errorMap)===null||s===void 0?void 0:s.call(n,r,i).message)!==null&&a!==void 0?a:i.defaultError;return r.code==="unrecognized_keys"?{message:(c=$e.errToObj(e).message)!==null&&c!==void 0?c:d}:{message:d}}}:{}})}strip(){return new Ge({...this._def,unknownKeys:"strip"})}passthrough(){return new Ge({...this._def,unknownKeys:"passthrough"})}setKey(e,r){return this.augment({[e]:r})}merge(e){return new Ge({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>cu.mergeShapes(this._def.shape(),e._def.shape()),typeName:he.ZodObject})}catchall(e){return new Ge({...this._def,catchall:e})}pick(e){let r={};return Ve.objectKeys(e).map(i=>{this.shape[i]&&(r[i]=this.shape[i])}),new Ge({...this._def,shape:()=>r})}omit(e){let r={};return Ve.objectKeys(this.shape).map(i=>{Ve.objectKeys(e).indexOf(i)===-1&&(r[i]=this.shape[i])}),new Ge({...this._def,shape:()=>r})}deepPartial(){return ho(this)}partial(e){let r={};if(e)return Ve.objectKeys(this.shape).map(i=>{Ve.objectKeys(e).indexOf(i)===-1?r[i]=this.shape[i]:r[i]=this.shape[i].optional()}),new Ge({...this._def,shape:()=>r});for(let i in this.shape){let n=this.shape[i];r[i]=n.optional()}return new Ge({...this._def,shape:()=>r})}required(){let e={};for(let r in this.shape){let n=this.shape[r];for(;n instanceof yr;)n=n._def.innerType;e[r]=n}return new Ge({...this._def,shape:()=>e})}};Ge.create=(t,e)=>new Ge({shape:()=>t,unknownKeys:"strip",catchall:ui.create(),typeName:he.ZodObject,...Ee(e)});Ge.strictCreate=(t,e)=>new Ge({shape:()=>t,unknownKeys:"strict",catchall:ui.create(),typeName:he.ZodObject,...Ee(e)});Ge.lazycreate=(t,e)=>new Ge({shape:t,unknownKeys:"strip",catchall:ui.create(),typeName:he.ZodObject,...Ee(e)});var rs=class extends xe{_parse(e){let{ctx:r}=this._processInputParams(e),i=this._def.options;function n(s){for(let c of s)if(c.result.status==="valid")return c.result;for(let c of s)if(c.result.status==="dirty")return r.common.issues.push(...c.ctx.common.issues),c.result;let a=s.map(c=>new Dr(c.ctx.common.issues));return oe(r,{code:X.invalid_union,unionErrors:a}),de}if(r.common.async)return Promise.all(i.map(async s=>{let a={...r,common:{...r.common,issues:[]},parent:null};return{result:await s._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}})).then(n);{let s,a=[];for(let d of i){let p={...r,common:{...r.common,issues:[]},parent:null},m=d._parseSync({data:r.data,path:r.path,parent:p});if(m.status==="valid")return m;m.status==="dirty"&&!s&&(s={result:m,ctx:p}),p.common.issues.length&&a.push(p.common.issues)}if(s)return r.common.issues.push(...s.ctx.common.issues),s.result;let c=a.map(d=>new Dr(d));return oe(r,{code:X.invalid_union,unionErrors:c}),de}}get options(){return this._def.options}};rs.create=(t,e)=>new rs({options:t,typeName:he.ZodUnion,...Ee(e)});var vo=class extends xe{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Q.object)return oe(r,{code:X.invalid_type,expected:Q.object,received:r.parsedType}),de;let i=this.discriminator,n=r.data[i],s=this.options.get(n);return s?r.common.async?s._parseAsync({data:r.data,path:r.path,parent:r}):s._parseSync({data:r.data,path:r.path,parent:r}):(oe(r,{code:X.invalid_union_discriminator,options:this.validDiscriminatorValues,path:[i]}),de)}get discriminator(){return this._def.discriminator}get validDiscriminatorValues(){return Array.from(this.options.keys())}get options(){return this._def.options}static create(e,r,i){let n=new Map;try{r.forEach(s=>{let a=s.shape[e].value;n.set(a,s)})}catch{throw new Error("The discriminator value could not be extracted from all the provided schemas")}if(n.size!==r.length)throw new Error("Some of the discriminator values are not unique");return new vo({typeName:he.ZodDiscriminatedUnion,discriminator:e,options:n,...Ee(i)})}};function af(t,e){let r=un(t),i=un(e);if(t===e)return{valid:!0,data:t};if(r===Q.object&&i===Q.object){let n=Ve.objectKeys(e),s=Ve.objectKeys(t).filter(c=>n.indexOf(c)!==-1),a={...t,...e};for(let c of s){let d=af(t[c],e[c]);if(!d.valid)return{valid:!1};a[c]=d.data}return{valid:!0,data:a}}else if(r===Q.array&&i===Q.array){if(t.length!==e.length)return{valid:!1};let n=[];for(let s=0;s<t.length;s++){let a=t[s],c=e[s],d=af(a,c);if(!d.valid)return{valid:!1};n.push(d.data)}return{valid:!0,data:n}}else return r===Q.date&&i===Q.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var is=class extends xe{_parse(e){let{status:r,ctx:i}=this._processInputParams(e),n=(s,a)=>{if(nf(s)||nf(a))return de;let c=af(s.value,a.value);return c.valid?((sf(s)||sf(a))&&r.dirty(),{status:r.value,value:c.data}):(oe(i,{code:X.invalid_intersection_types}),de)};return i.common.async?Promise.all([this._def.left._parseAsync({data:i.data,path:i.path,parent:i}),this._def.right._parseAsync({data:i.data,path:i.path,parent:i})]).then(([s,a])=>n(s,a)):n(this._def.left._parseSync({data:i.data,path:i.path,parent:i}),this._def.right._parseSync({data:i.data,path:i.path,parent:i}))}};is.create=(t,e,r)=>new is({left:t,right:e,typeName:he.ZodIntersection,...Ee(r)});var wr=class extends xe{_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==Q.array)return oe(i,{code:X.invalid_type,expected:Q.array,received:i.parsedType}),de;if(i.data.length<this._def.items.length)return oe(i,{code:X.too_small,minimum:this._def.items.length,inclusive:!0,type:"array"}),de;!this._def.rest&&i.data.length>this._def.items.length&&(oe(i,{code:X.too_big,maximum:this._def.items.length,inclusive:!0,type:"array"}),r.dirty());let s=i.data.map((a,c)=>{let d=this._def.items[c]||this._def.rest;return d?d._parse(new br(i,a,i.path,c)):null}).filter(a=>!!a);return i.common.async?Promise.all(s).then(a=>Et.mergeArray(r,a)):Et.mergeArray(r,s)}get items(){return this._def.items}rest(e){return new wr({...this._def,rest:e})}};wr.create=(t,e)=>new wr({items:t,typeName:he.ZodTuple,rest:null,...Ee(e)});var ns=class extends xe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==Q.object)return oe(i,{code:X.invalid_type,expected:Q.object,received:i.parsedType}),de;let n=[],s=this._def.keyType,a=this._def.valueType;for(let c in i.data)n.push({key:s._parse(new br(i,c,i.path,c)),value:a._parse(new br(i,i.data[c],i.path,c))});return i.common.async?Et.mergeObjectAsync(r,n):Et.mergeObjectSync(r,n)}get element(){return this._def.valueType}static create(e,r,i){return r instanceof xe?new ns({keyType:e,valueType:r,typeName:he.ZodRecord,...Ee(i)}):new ns({keyType:li.create(),valueType:e,typeName:he.ZodRecord,...Ee(r)})}},wo=class extends xe{_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==Q.map)return oe(i,{code:X.invalid_type,expected:Q.map,received:i.parsedType}),de;let n=this._def.keyType,s=this._def.valueType,a=[...i.data.entries()].map(([c,d],p)=>({key:n._parse(new br(i,c,i.path,[p,"key"])),value:s._parse(new br(i,d,i.path,[p,"value"]))}));if(i.common.async){let c=new Map;return Promise.resolve().then(async()=>{for(let d of a){let p=await d.key,m=await d.value;if(p.status==="aborted"||m.status==="aborted")return de;(p.status==="dirty"||m.status==="dirty")&&r.dirty(),c.set(p.value,m.value)}return{status:r.value,value:c}})}else{let c=new Map;for(let d of a){let p=d.key,m=d.value;if(p.status==="aborted"||m.status==="aborted")return de;(p.status==="dirty"||m.status==="dirty")&&r.dirty(),c.set(p.value,m.value)}return{status:r.value,value:c}}}};wo.create=(t,e,r)=>new wo({valueType:e,keyType:t,typeName:he.ZodMap,...Ee(r)});var Bi=class extends xe{_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==Q.set)return oe(i,{code:X.invalid_type,expected:Q.set,received:i.parsedType}),de;let n=this._def;n.minSize!==null&&i.data.size<n.minSize.value&&(oe(i,{code:X.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,message:n.minSize.message}),r.dirty()),n.maxSize!==null&&i.data.size>n.maxSize.value&&(oe(i,{code:X.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,message:n.maxSize.message}),r.dirty());let s=this._def.valueType;function a(d){let p=new Set;for(let m of d){if(m.status==="aborted")return de;m.status==="dirty"&&r.dirty(),p.add(m.value)}return{status:r.value,value:p}}let c=[...i.data.values()].map((d,p)=>s._parse(new br(i,d,i.path,p)));return i.common.async?Promise.all(c).then(d=>a(d)):a(c)}min(e,r){return new Bi({...this._def,minSize:{value:e,message:$e.toString(r)}})}max(e,r){return new Bi({...this._def,maxSize:{value:e,message:$e.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};Bi.create=(t,e)=>new Bi({valueType:t,minSize:null,maxSize:null,typeName:he.ZodSet,...Ee(e)});var zi=class extends xe{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Q.function)return oe(r,{code:X.invalid_type,expected:Q.function,received:r.parsedType}),de;function i(c,d){return lu({data:c,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t1,e1].filter(p=>!!p),issueData:{code:X.invalid_arguments,argumentsError:d}})}function n(c,d){return lu({data:c,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t1,e1].filter(p=>!!p),issueData:{code:X.invalid_return_type,returnTypeError:d}})}let s={errorMap:r.common.contextualErrorMap},a=r.data;return this._def.returns instanceof hn?Tt(async(...c)=>{let d=new Dr([]),p=await this._def.args.parseAsync(c,s).catch(S=>{throw d.addIssue(i(c,S)),d}),m=await a(...p);return await this._def.returns._def.type.parseAsync(m,s).catch(S=>{throw d.addIssue(n(m,S)),d})}):Tt((...c)=>{let d=this._def.args.safeParse(c,s);if(!d.success)throw new Dr([i(c,d.error)]);let p=a(...d.data),m=this._def.returns.safeParse(p,s);if(!m.success)throw new Dr([n(p,m.error)]);return m.data})}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new zi({...this._def,args:wr.create(e).rest(ai.create())})}returns(e){return new zi({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}};zi.create=(t,e,r)=>new zi({args:t?t.rest(ai.create()):wr.create([]).rest(ai.create()),returns:e||ai.create(),typeName:he.ZodFunction,...Ee(r)});var _o=class extends xe{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};_o.create=(t,e)=>new _o({getter:t,typeName:he.ZodLazy,...Ee(e)});var So=class extends xe{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return oe(r,{code:X.invalid_literal,expected:this._def.value}),de}return{status:"valid",value:e.data}}get value(){return this._def.value}};So.create=(t,e)=>new So({value:t,typeName:he.ZodLiteral,...Ee(e)});function Py(t,e){return new xo({values:t,typeName:he.ZodEnum,...Ee(e)})}var xo=class extends xe{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),i=this._def.values;return oe(r,{expected:Ve.joinValues(i),received:r.parsedType,code:X.invalid_type}),de}if(this._def.values.indexOf(e.data)===-1){let r=this._getOrReturnCtx(e),i=this._def.values;return oe(r,{received:r.data,code:X.invalid_enum_value,options:i}),de}return Tt(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}};xo.create=Py;var Mo=class extends xe{_parse(e){let r=Ve.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(e);if(i.parsedType!==Q.string&&i.parsedType!==Q.number){let n=Ve.objectValues(r);return oe(i,{expected:Ve.joinValues(n),received:i.parsedType,code:X.invalid_type}),de}if(r.indexOf(e.data)===-1){let n=Ve.objectValues(r);return oe(i,{received:i.data,code:X.invalid_enum_value,options:n}),de}return Tt(e.data)}get enum(){return this._def.values}};Mo.create=(t,e)=>new Mo({values:t,typeName:he.ZodNativeEnum,...Ee(e)});var hn=class extends xe{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Q.promise&&r.common.async===!1)return oe(r,{code:X.invalid_type,expected:Q.promise,received:r.parsedType}),de;let i=r.parsedType===Q.promise?r.data:Promise.resolve(r.data);return Tt(i.then(n=>this._def.type.parseAsync(n,{path:r.path,errorMap:r.common.contextualErrorMap})))}};hn.create=(t,e)=>new hn({type:t,typeName:he.ZodPromise,...Ee(e)});var _r=class extends xe{innerType(){return this._def.schema}_parse(e){let{status:r,ctx:i}=this._processInputParams(e),n=this._def.effect||null;if(n.type==="preprocess"){let a=n.transform(i.data);return i.common.async?Promise.resolve(a).then(c=>this._def.schema._parseAsync({data:c,path:i.path,parent:i})):this._def.schema._parseSync({data:a,path:i.path,parent:i})}let s={addIssue:a=>{oe(i,a),a.fatal?r.abort():r.dirty()},get path(){return i.path}};if(s.addIssue=s.addIssue.bind(s),n.type==="refinement"){let a=c=>{let d=n.refinement(c,s);if(i.common.async)return Promise.resolve(d);if(d instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return c};if(i.common.async===!1){let c=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return c.status==="aborted"?de:(c.status==="dirty"&&r.dirty(),a(c.value),{status:r.value,value:c.value})}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(c=>c.status==="aborted"?de:(c.status==="dirty"&&r.dirty(),a(c.value).then(()=>({status:r.value,value:c.value}))))}if(n.type==="transform")if(i.common.async===!1){let a=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!uu(a))return a;let c=n.transform(a.value,s);if(c instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:c}}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(a=>uu(a)?Promise.resolve(n.transform(a.value,s)).then(c=>({status:r.value,value:c})):a);Ve.assertNever(n)}};_r.create=(t,e,r)=>new _r({schema:t,typeName:he.ZodEffects,effect:e,...Ee(r)});_r.createWithPreprocess=(t,e,r)=>new _r({schema:e,effect:{type:"preprocess",transform:t},typeName:he.ZodEffects,...Ee(r)});var yr=class extends xe{_parse(e){return this._getType(e)===Q.undefined?Tt(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};yr.create=(t,e)=>new yr({innerType:t,typeName:he.ZodOptional,...Ee(e)});var ji=class extends xe{_parse(e){return this._getType(e)===Q.null?Tt(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ji.create=(t,e)=>new ji({innerType:t,typeName:he.ZodNullable,...Ee(e)});var r1=class extends xe{_parse(e){let{ctx:r}=this._processInputParams(e),i=r.data;return r.parsedType===Q.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};r1.create=(t,e)=>new yr({innerType:t,typeName:he.ZodOptional,...Ee(e)});var Eo=class extends xe{_parse(e){if(this._getType(e)!==Q.nan){let i=this._getOrReturnCtx(e);return oe(i,{code:X.invalid_type,expected:Q.nan,received:i.parsedType}),de}return{status:"valid",value:e.data}}};Eo.create=t=>new Eo({typeName:he.ZodNaN,...Ee(t)});var i5=(t,e={},r)=>t?cn.create().superRefine((i,n)=>{if(!t(i)){let s=typeof e=="function"?e(i):e,a=typeof s=="string"?{message:s}:s;n.addIssue({code:"custom",...a,fatal:r})}}):cn.create(),Ty={object:Ge.lazycreate},he;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodPromise="ZodPromise"})(he||(he={}));var Iy=(t,e={message:`Input not instance of ${t.name}`})=>i5(r=>r instanceof t,e,!0),n5=li.create,s5=Di.create,ky=Eo.create,Oy=fo.create,o5=po.create,Ly=mo.create,Ny=go.create,Dy=yo.create,By=cn.create,zy=ai.create,jy=ui.create,qy=bo.create,Uy=vr.create,$y=Ge.create,Wy=Ge.strictCreate,Fy=rs.create,Hy=vo.create,Gy=is.create,Vy=wr.create,Ky=ns.create,Zy=wo.create,Jy=Bi.create,Yy=zi.create,Xy=_o.create,Qy=So.create,e8=xo.create,t8=Mo.create,r8=hn.create,r5=_r.create,i8=yr.create,n8=ji.create,s8=_r.createWithPreprocess,o8=()=>n5().optional(),a8=()=>s5().optional(),l8=()=>o5().optional(),ie=Object.freeze({__proto__:null,getParsedType:un,ZodParsedType:Q,makeIssue:lu,EMPTY_PATH:xy,addIssueToContext:oe,ParseStatus:Et,INVALID:de,DIRTY:My,OK:Tt,isAborted:nf,isDirty:sf,isValid:uu,isAsync:of,ZodType:xe,ZodString:li,ZodNumber:Di,ZodBigInt:fo,ZodBoolean:po,ZodDate:mo,ZodUndefined:go,ZodNull:yo,ZodAny:cn,ZodUnknown:ai,ZodNever:ui,ZodVoid:bo,ZodArray:vr,get objectUtil(){return cu},ZodObject:Ge,ZodUnion:rs,ZodDiscriminatedUnion:vo,ZodIntersection:is,ZodTuple:wr,ZodRecord:ns,ZodMap:wo,ZodSet:Bi,ZodFunction:zi,ZodLazy:_o,ZodLiteral:So,ZodEnum:xo,ZodNativeEnum:Mo,ZodPromise:hn,ZodEffects:_r,ZodTransformer:_r,ZodOptional:yr,ZodNullable:ji,ZodDefault:r1,ZodNaN:Eo,custom:i5,Schema:xe,ZodSchema:xe,late:Ty,get ZodFirstPartyTypeKind(){return he},any:By,array:Uy,bigint:Oy,boolean:o5,date:Ly,discriminatedUnion:Hy,effect:r5,enum:e8,function:Yy,instanceof:Iy,intersection:Gy,lazy:Xy,literal:Qy,map:Zy,nan:ky,nativeEnum:t8,never:jy,null:Dy,nullable:n8,number:s5,object:$y,oboolean:l8,onumber:a8,optional:i8,ostring:o8,preprocess:s8,promise:r8,record:Ky,set:Jy,strictObject:Wy,string:n5,transformer:r5,tuple:Vy,undefined:Ny,union:Fy,unknown:zy,void:qy,ZodIssueCode:X,quotelessJson:_y,ZodError:Dr,defaultErrorMap:e1,get overrideErrorMap(){return t1},setErrorMap:Sy});var u8=ie.object({title:ie.string(),description:ie.string(),fees:ie.string(),accessConstraints:ie.string()}),c8=ie.object({deliveryPoint:ie.string(),city:ie.string(),postalCode:ie.string(),country:ie.string(),email:ie.string()}),h8=ie.object({individualName:ie.string(),position:ie.string(),phone:ie.string(),address:c8}),f8=ie.object({name:ie.string(),site:ie.string(),contact:h8}),d8=ie.object({id:ie.string(),serviceIdentification:u8,serviceProvider:f8});var p8=ie.object({id:ie.string(),version:ie.number(),name:ie.string(),metadata:ie.unknown().optional(),sprite:ie.string().optional(),glyphs:ie.string().optional(),sources:ie.unknown(),layers:ie.array(ie.unknown())});function m8(t){try{return Fl(t),!0}catch{return!1}}var g8=ie.string().refine(m8,{message:"Invalid hex color"}),Ro={minZoom:0,maxZoom:32},hu=ie.number().refine(t=>t>=Ro.minZoom&&t<=Ro.maxZoom,{message:`must be between ${Ro.minZoom} and ${Ro.maxZoom}`}),y8=ie.object({name:ie.string(),title:ie.string().optional(),category:ie.string().optional(),2193:ie.string().optional(),3857:ie.string().optional(),minZoom:hu.optional(),maxZoom:hu.optional()}).refine(({minZoom:t,maxZoom:e})=>(t||Ro.minZoom)<=(e||Ro.maxZoom),{message:"minZoom may no be greater than maxZoom",path:["minZoom"]}),b8=ie.object({type:ie.nativeEnum(st),id:ie.string(),title:ie.string().optional(),category:ie.string().optional(),description:ie.string().optional(),background:g8.optional(),layers:ie.array(y8),minZoom:hu.optional(),maxZoom:hu.optional(),format:ie.union([ie.nativeEnum(qe),ie.nativeEnum(rr)]).optional()});var Co={Aws:{Region:"ap-southeast-2"},ApiKey:{QueryString:"api",TableName:"ApiKey",RequestLimitMinute:1e3},TileMetadata:{TableName:"TileMetadata",RequestLimitMinute:1e3}},Xe={PublicUrlBase:"BASEMAPS_PUBLIC_URL",AssetLocation:"BASEMAPS_ASSEST_LOCATION",TiffConcurrency:"TIFF_CONCURRENCY",TempFolder:"TEMP_FOLDER",BatchIndex:"AWS_BATCH_JOB_ARRAY_INDEX",AwsRoleDurationHours:"AWS_ROLE_DURATION_HOURS",AwsRoleConfigPath:"ROLE_CONFIG_PATH",ImportImageryBucket:"IMPORT_IMAGERY_BUCKET",ImportFilesNumberLimit:"FILES_NUMBER_LIMIT",ImportFilesSizeLimitGb:"FILES_SIZE_LIMIT_GB",Gdal:{UseDocker:"GDAL_DOCKER",DockerContainer:"GDAL_DOCKER_CONTAINER",DockerContainerTag:"GDAL_DOCKER_CONTAINER_TAG"},Analytics:{CloudFrontId:"ANALYTICS_CLOUD_FRONT_ID",CloudFrontSourceBucket:"ANALYTICS_CLOUD_FRONT_SOURCE_BUCKET",CacheBucket:"ANALYTICS_CACHE_BUCKET"},get(t){return process.env[t]},getNumber(t,e){let r=Xe.get(t);if(r===""||r==null)return e;let i=parseFloat(r);return isNaN(i)?e:i},isProduction(){return!0}};var B0=fe(n0(),1);var zr=fe(pp(),1);function Cv(t){return t<=10?zr.default.gray("TRACE"):t<=20?zr.default.magenta("DEBUG"):t<=30?zr.default.cyan("INFO"):t<=40?zr.default.yellow("WARN"):t<=50?zr.default.red("ERROR"):zr.default.bgRed("FATAL")}var qi=class{constructor(e){this.level=e}static formatObject(e){let r=[];for(let i of Object.keys(e)){if(qi.Ignore.has(i))continue;let n=e[i];if(n==null||n==="")continue;let s="",a=typeof n;if(a==="number")s=zr.default.yellow(String(n));else if(a==="string")s=zr.default.green(n);else if(a==="object"){let c=this.formatObject(n);c.length>0&&(s=`{ ${c.join(" ")} }`)}else s=String(n);s!==""&&r.push(`${zr.default.dim(i)}=${s}`)}return r}pretty(e){if(e.level<this.level)return null;let r=new Date(e.time);if(isNaN(r.getTime()))return null;let n=qi.formatObject(e).join(" ");return`[${r.toISOString()}] ${Cv(e.level)} ${zr.default.blue(e.msg)} ${n}`}};qi.Ignore=new Set(["pid","time","hostname","level","v","name","msg"]);var Sm=fe(_m(),1),Do=require("stream"),xm=require("string_decoder");function L_(t){try{return JSON.parse(t)}catch{return null}}function N_(t){t!=null&&console.error("PrettyTransformFailed",t)}var vn=class extends Do.Transform{constructor(){super(),this.pretty=new qi(-1),this.decoder=new xm.StringDecoder}static stream(e=process.stdout){let r=new Do.PassThrough;return vn.pretty(r,e),r}static pretty(e,r=process.stdout){let i=new vn;return(0,Do.pipeline)(e,(0,Sm.default)(),i,r,N_),i}_transform(e,r,i){if(r!=="buffer")return i(new Error(`Unknown encoding: ${r}`));let n=this.decoder.write(e),s=L_(n);if(s==null)return i(null,e+`
134
+ `);let a=this.pretty.pretty(s);if(a==null)return i(null,e+`
120
135
  `);i(null,a+`
121
- `)}};var Ah,Bb={level:"debug"},Ih={get(){return Ah==null&&(Ah=process.stdout.isTTY?(0,gm.default)(Bb,Mn.stream()):(0,gm.default)(Bb)),Ah},set(t){Ah=t},disable(){Ih.get().level="silent"}};var GR=.2,Yo=class{constructor(e){this.tms=e}async tile(e,r,i,n){let o=[];for(let a of e){let h=this.getTiles(a,r,i,n);h!=null&&(o=o.concat(h))}return o}getRasterTiffIntersection(e,r,i,n){let o=this.tms.tileToPixels(r,i),a=new Fe(o.x,o.y,this.tms.tileSize,this.tms.tileSize),h=e.images[0].bbox,d=this.tms.sourceToPixels(h[0],h[3],n),m=this.tms.sourceToPixels(h[2],h[1],n),p=Fe.fromUpperLeftLowerRight(d,m),w=p.intersection(a);return w==null?null:{tiff:p,intersection:w,tile:a}}createComposition(e,r,i,n,o){let a=Fe.fromJson(e.getTileBounds(r,i)),h=a.scale(n,n).add(o.tiff).round(GR),d=h.intersection(o.tile);if(d==null)return null;let m=d.subtract(h);if(m.height<.5||m.width<.5)return null;let p=h.subtract(o.tile),w={tiff:e.tif,source:{x:r,y:i,imageId:e.id,width:a.width,height:a.height},y:Math.max(0,Math.round(p.y)),x:Math.max(0,Math.round(p.x))};if((a.width<e.tileSize.width||a.height<e.tileSize.height)&&(w.extract={width:a.width,height:a.height}),a.width!==h.width||a.height!==h.height){let E=a.width!==h.width?h.width/a.width:h.height/a.height;w.resize={width:h.width,height:h.height,scale:E}}return(m.y!==0||m.x!==0||m.height!==h.height||m.width!==h.width)&&(w.crop=m),w}getTiles(e,r,i,n){let o=this.getRasterTiffIntersection(e,r,i,n);if(o==null)return null;let a=this.tms.pixelScale(n),h=e.getImageByResolution(a),d=a/h.resolution[0],m=o.intersection.subtract(o.tiff),{tileSize:p,tileCount:w}=h,E=[],_=1/d;for(let C of Yo.getRequiredTiles(m,d,p,w)){let R=this.createComposition(h,C.x,C.y,_,o);R!=null&&E.push(R)}return E.length===0?null:E}static*getRequiredTiles(e,r,i,n){let o=Math.max(Math.floor(e.x/i.width*r),0),a=Math.min(Math.ceil(e.right/i.width*r),n.x),h=Math.max(Math.floor(e.y/i.height*r),0),d=Math.min(Math.ceil(e.bottom/i.height*r),n.y);for(let m=o;m<a;m++)for(let p=h;p<d;p++)yield{x:m,y:p}}};var zb=[Ge.Jpeg,Ge.Webp,Ge.Png];function Ph(t){if(t==null)return null;let e=t.toLowerCase();return e===Ge.Png?Ge.Png:e===Ge.Webp?Ge.Webp:e===Ge.Jpeg||e==="jpg"?Ge.Jpeg:e===Ge.Avif?Ge.Avif:null}var wi;(function(t){t.WMTS="WMTS",t.Tile="tile",t.Attribution="attribution"})(wi||(wi={}));function Fb(t,e){t.set("tileSet",e.name),e.tileMatrix!=null&&t.set("projection",e.tileMatrix.projection)}function cl(t){var e;let r=Te.parse(t);return r!=null?(e=ci.tryGet(r.code))!==null&&e!==void 0?e:null:ci.find(t)}function Oh(t){if(t.length<5)return null;let e=t[0],r=cl(t[1]);if(r==null)return null;let i=parseInt(t[2],10),n=parseInt(t[3],10),[o,a]=t[4].split(".",2),h=parseInt(o,10);if(isNaN(n)||isNaN(h)||isNaN(i))return null;if(a==="pbf")return{type:wi.Tile,name:e,tileMatrix:r,x:n,y:h,z:i,ext:gr.MapboxVectorTiles};let d=Ph(a);return d==null?null:{type:wi.Tile,name:e,tileMatrix:r,x:n,y:h,z:i,ext:d}}function Ub(t){if(t.length<3)return null;let e=t[0],r=cl(t[1]);return r==null?null:{type:wi.Attribution,name:e,tileMatrix:r}}function jb(t){if(t.length>3)return null;let e=t.length<2?"":t[0];if(t.length===3){let r=cl(t[1]);return r==null?null:{type:wi.WMTS,name:e,tileMatrix:r}}return{type:wi.WMTS,name:e,tileMatrix:null}}var Wb=ve(hs(),1);var VR=24*60*60*1e3,n8=30*VR;var kh=t=>" ".repeat(t),fl=class{toString(e=0){return kh(e)+"[VNode]"}},Rn=class extends fl{constructor(e){super(),this.text=e}toString(e=0){return kh(e)+this.text}get textContent(){return this.text}set textContent(e){this.text=e}},Rs=class extends fl{constructor(e,r,i){super(),this.tag=e,this.attrs=r,this.children=i}get textContent(){return this.children.length===0?"":this.children.length===1?this.children[0].textContent:this.children.map(e=>e.textContent).join("")}set textContent(e){this.children=[new Rn(e)]}toString(e=0){let r=this.toStringAttrs(),i=kh(e),n=this.toStringChildren(e),o=`${i}<${this.tag}${r}`;return n===""?`${o} />`:`${o}>${n}</${this.tag}>`}*tags(e){this.tag===e&&(yield this);for(let r of this.elementChildren())yield*r.tags(e);return null}find(e,...r){for(let i of this.tags(e)){if(i===this)continue;if(r.length===0)return i;let n=i.find(...r);if(n!=null)return n}return null}*elementChildren(){for(let e of this.children)e instanceof Rs&&(yield e);return null}toStringAttrs(){let e=Object.keys(this.attrs);if(e.length===0)return"";let r="";for(let i of e){let n=this.attrs[i];n!=null&&(r+=` ${i}="${n}"`)}return r}toStringChildren(e=0){if(this.children.length===0)return"";if(this.children.length===1){let r=this.children[0];if(r instanceof Rn)return r.text}return`
136
+ `)}};var Uu,Mm={level:"debug"},$u={get(){return Uu==null&&(Uu=process.stdout.isTTY?(0,B0.default)(Mm,vn.stream()):(0,B0.default)(Mm)),Uu},set(t){Uu=t},disable(){$u.get().level="silent"}};var D_=.2,Bo=class{constructor(e){this.tms=e}async tile(e,r,i,n){let s=[];for(let a of e){let c=this.getTiles(a,r,i,n);c!=null&&(s=s.concat(c))}return s}getRasterTiffIntersection(e,r,i,n){let s=this.tms.tileToPixels(r,i),a=new ge(s.x,s.y,this.tms.tileSize,this.tms.tileSize),c=e.images[0].bbox,d=this.tms.sourceToPixels(c[0],c[3],n),p=this.tms.sourceToPixels(c[2],c[1],n),m=ge.fromUpperLeftLowerRight(d,p),w=m.intersection(a);return w==null?null:{tiff:m,intersection:w,tile:a}}createComposition(e,r,i,n,s){let a=ge.fromJson(e.getTileBounds(r,i)),c=a.scale(n,n).add(s.tiff).round(D_),d=c.intersection(s.tile);if(d==null)return null;let p=d.subtract(c);if(p.height<.5||p.width<.5)return null;let m=c.subtract(s.tile),w={tiff:e.tif,source:{x:r,y:i,imageId:e.id,width:a.width,height:a.height},y:Math.max(0,Math.round(m.y)),x:Math.max(0,Math.round(m.x))};if((a.width<e.tileSize.width||a.height<e.tileSize.height)&&(w.extract={width:a.width,height:a.height}),a.width!==c.width||a.height!==c.height){let S=a.width!==c.width?c.width/a.width:c.height/a.height;w.resize={width:c.width,height:c.height,scale:S}}return(p.y!==0||p.x!==0||p.height!==c.height||p.width!==c.width)&&(w.crop=p),w}getTiles(e,r,i,n){let s=this.getRasterTiffIntersection(e,r,i,n);if(s==null)return null;let a=this.tms.pixelScale(n),c=e.getImageByResolution(a),d=a/c.resolution[0],p=s.intersection.subtract(s.tiff),{tileSize:m,tileCount:w}=c,S=[],v=1/d;for(let R of Bo.getRequiredTiles(p,d,m,w)){let x=this.createComposition(c,R.x,R.y,v,s);x!=null&&S.push(x)}return S.length===0?null:S}static*getRequiredTiles(e,r,i,n){let s=Math.max(Math.floor(e.x/i.width*r),0),a=Math.min(Math.ceil(e.right/i.width*r),n.x),c=Math.max(Math.floor(e.y/i.height*r),0),d=Math.min(Math.ceil(e.bottom/i.height*r),n.y);for(let p=s;p<a;p++)for(let m=c;m<d;m++)yield{x:p,y:m}}};var Em=[qe.Jpeg,qe.Webp,qe.Png];function Wu(t){if(t==null)return null;let e=t.toLowerCase();return e===qe.Png?qe.Png:e===qe.Webp?qe.Webp:e===qe.Jpeg||e==="jpg"?qe.Jpeg:e===qe.Avif?qe.Avif:null}var di;(function(t){t.WMTS="WMTS",t.Tile="tile",t.Attribution="attribution"})(di||(di={}));function Rm(t,e){t.set("tileSet",e.name),e.tileMatrix!=null&&t.set("projection",e.tileMatrix.projection)}function p1(t){var e;let r=Se.parse(t);return r!=null?(e=sn.tryGet(r.code))!==null&&e!==void 0?e:null:sn.find(t)}function Cm(t){if(t.length<5)return null;let e=t[0],r=p1(t[1]);if(r==null)return null;let i=parseInt(t[2],10),n=parseInt(t[3],10),[s,a]=t[4].split(".",2),c=parseInt(s,10);if(isNaN(n)||isNaN(c)||isNaN(i))return null;if(a==="pbf")return{type:di.Tile,name:e,tileMatrix:r,x:n,y:c,z:i,ext:rr.MapboxVectorTiles};let d=Wu(a);return d==null?null:{type:di.Tile,name:e,tileMatrix:r,x:n,y:c,z:i,ext:d}}function Am(t){if(t.length<3)return null;let e=t[0],r=p1(t[1]);return r==null?null:{type:di.Attribution,name:e,tileMatrix:r}}function Pm(t){if(t.length>3)return null;let e=t.length<2?"aerial":t[0];if(t.length===3){let r=p1(t[1]);return r==null?null:{type:di.WMTS,name:e,tileMatrix:r}}return{type:di.WMTS,name:e,tileMatrix:null}}var Tm=fe(Zn(),1);var B_=24*60*60*1e3,LA=30*B_;var Im=new Uint16Array([7489,60,213,305,650,1181,1403,1488,1653,1758,1954,2006,2063,2634,2705,3489,3693,3849,3878,4298,4648,4833,5141,5277,5315,5343,5413,0,0,0,0,0,0,5483,5837,6541,7186,7645,8062,8288,8624,8845,9152,9211,9282,10276,10514,11528,11848,12238,12310,12986,13881,14252,14590,14888,14961,15072,15150,2048,69,77,97,98,99,102,103,108,109,110,111,112,114,115,116,117,92,98,102,109,115,127,132,139,144,149,152,166,179,185,200,207,108,105,103,32827,198,16582,80,32827,38,16422,99,117,116,101,32827,193,16577,114,101,118,101,59,16642,256,105,121,120,125,114,99,32827,194,16578,59,17424,114,59,49152,55349,56580,114,97,118,101,32827,192,16576,112,104,97,59,17297,97,99,114,59,16640,100,59,27219,256,103,112,157,161,111,110,59,16644,102,59,49152,55349,56632,112,108,121,70,117,110,99,116,105,111,110,59,24673,105,110,103,32827,197,16581,256,99,115,190,195,114,59,49152,55349,56476,105,103,110,59,25172,105,108,100,101,32827,195,16579,109,108,32827,196,16580,1024,97,99,101,102,111,114,115,117,229,251,254,279,284,290,295,298,256,99,114,234,242,107,115,108,97,115,104,59,25110,374,246,248,59,27367,101,100,59,25350,121,59,17425,384,99,114,116,261,267,276,97,117,115,101,59,25141,110,111,117,108,108,105,115,59,24876,97,59,17298,114,59,49152,55349,56581,112,102,59,49152,55349,56633,101,118,101,59,17112,99,242,275,109,112,101,113,59,25166,1792,72,79,97,99,100,101,102,104,105,108,111,114,115,117,333,337,342,384,414,418,437,439,442,476,533,627,632,638,99,121,59,17447,80,89,32827,169,16553,384,99,112,121,349,354,378,117,116,101,59,16646,256,59,105,359,360,25298,116,97,108,68,105,102,102,101,114,101,110,116,105,97,108,68,59,24901,108,101,121,115,59,24877,512,97,101,105,111,393,398,404,408,114,111,110,59,16652,100,105,108,32827,199,16583,114,99,59,16648,110,105,110,116,59,25136,111,116,59,16650,256,100,110,423,429,105,108,108,97,59,16568,116,101,114,68,111,116,59,16567,242,383,105,59,17319,114,99,108,101,512,68,77,80,84,455,459,465,470,111,116,59,25241,105,110,117,115,59,25238,108,117,115,59,25237,105,109,101,115,59,25239,111,256,99,115,482,504,107,119,105,115,101,67,111,110,116,111,117,114,73,110,116,101,103,114,97,108,59,25138,101,67,117,114,108,121,256,68,81,515,527,111,117,98,108,101,81,117,111,116,101,59,24605,117,111,116,101,59,24601,512,108,110,112,117,542,552,583,597,111,110,256,59,101,549,550,25143,59,27252,384,103,105,116,559,566,570,114,117,101,110,116,59,25185,110,116,59,25135,111,117,114,73,110,116,101,103,114,97,108,59,25134,256,102,114,588,590,59,24834,111,100,117,99,116,59,25104,110,116,101,114,67,108,111,99,107,119,105,115,101,67,111,110,116,111,117,114,73,110,116,101,103,114,97,108,59,25139,111,115,115,59,27183,99,114,59,49152,55349,56478,112,256,59,67,644,645,25299,97,112,59,25165,1408,68,74,83,90,97,99,101,102,105,111,115,672,684,688,692,696,715,727,737,742,819,1165,256,59,111,377,677,116,114,97,104,100,59,26897,99,121,59,17410,99,121,59,17413,99,121,59,17423,384,103,114,115,703,708,711,103,101,114,59,24609,114,59,24993,104,118,59,27364,256,97,121,720,725,114,111,110,59,16654,59,17428,108,256,59,116,733,734,25095,97,59,17300,114,59,49152,55349,56583,256,97,102,747,807,256,99,109,752,802,114,105,116,105,99,97,108,512,65,68,71,84,768,774,790,796,99,117,116,101,59,16564,111,372,779,781,59,17113,98,108,101,65,99,117,116,101,59,17117,114,97,118,101,59,16480,105,108,100,101,59,17116,111,110,100,59,25284,102,101,114,101,110,116,105,97,108,68,59,24902,1136,829,0,0,0,834,852,0,1029,102,59,49152,55349,56635,384,59,68,69,840,841,845,16552,111,116,59,24796,113,117,97,108,59,25168,98,108,101,768,67,68,76,82,85,86,867,882,898,975,994,1016,111,110,116,111,117,114,73,110,116,101,103,114,97,236,569,111,628,889,0,0,891,187,841,110,65,114,114,111,119,59,25043,256,101,111,903,932,102,116,384,65,82,84,912,918,929,114,114,111,119,59,25040,105,103,104,116,65,114,114,111,119,59,25044,101,229,714,110,103,256,76,82,939,964,101,102,116,256,65,82,947,953,114,114,111,119,59,26616,105,103,104,116,65,114,114,111,119,59,26618,105,103,104,116,65,114,114,111,119,59,26617,105,103,104,116,256,65,84,984,990,114,114,111,119,59,25042,101,101,59,25256,112,577,1001,0,0,1007,114,114,111,119,59,25041,111,119,110,65,114,114,111,119,59,25045,101,114,116,105,99,97,108,66,97,114,59,25125,110,768,65,66,76,82,84,97,1042,1066,1072,1118,1151,892,114,114,111,119,384,59,66,85,1053,1054,1058,24979,97,114,59,26899,112,65,114,114,111,119,59,25077,114,101,118,101,59,17169,101,102,116,722,1082,0,1094,0,1104,105,103,104,116,86,101,99,116,111,114,59,26960,101,101,86,101,99,116,111,114,59,26974,101,99,116,111,114,256,59,66,1113,1114,25021,97,114,59,26966,105,103,104,116,468,1127,0,1137,101,101,86,101,99,116,111,114,59,26975,101,99,116,111,114,256,59,66,1146,1147,25025,97,114,59,26967,101,101,256,59,65,1158,1159,25252,114,114,111,119,59,24999,256,99,116,1170,1175,114,59,49152,55349,56479,114,111,107,59,16656,2048,78,84,97,99,100,102,103,108,109,111,112,113,115,116,117,120,1213,1216,1220,1227,1246,1250,1255,1262,1269,1313,1327,1334,1362,1373,1376,1381,71,59,16714,72,32827,208,16592,99,117,116,101,32827,201,16585,384,97,105,121,1234,1239,1244,114,111,110,59,16666,114,99,32827,202,16586,59,17453,111,116,59,16662,114,59,49152,55349,56584,114,97,118,101,32827,200,16584,101,109,101,110,116,59,25096,256,97,112,1274,1278,99,114,59,16658,116,121,595,1286,0,0,1298,109,97,108,108,83,113,117,97,114,101,59,26107,101,114,121,83,109,97,108,108,83,113,117,97,114,101,59,26027,256,103,112,1318,1322,111,110,59,16664,102,59,49152,55349,56636,115,105,108,111,110,59,17301,117,256,97,105,1340,1353,108,256,59,84,1346,1347,27253,105,108,100,101,59,25154,108,105,98,114,105,117,109,59,25036,256,99,105,1367,1370,114,59,24880,109,59,27251,97,59,17303,109,108,32827,203,16587,256,105,112,1386,1391,115,116,115,59,25091,111,110,101,110,116,105,97,108,69,59,24903,640,99,102,105,111,115,1413,1416,1421,1458,1484,121,59,17444,114,59,49152,55349,56585,108,108,101,100,595,1431,0,0,1443,109,97,108,108,83,113,117,97,114,101,59,26108,101,114,121,83,109,97,108,108,83,113,117,97,114,101,59,26026,880,1466,0,1471,0,0,1476,102,59,49152,55349,56637,65,108,108,59,25088,114,105,101,114,116,114,102,59,24881,99,242,1483,1536,74,84,97,98,99,100,102,103,111,114,115,116,1512,1516,1519,1530,1536,1554,1558,1563,1565,1571,1644,1650,99,121,59,17411,32827,62,16446,109,109,97,256,59,100,1527,1528,17299,59,17372,114,101,118,101,59,16670,384,101,105,121,1543,1548,1552,100,105,108,59,16674,114,99,59,16668,59,17427,111,116,59,16672,114,59,49152,55349,56586,59,25305,112,102,59,49152,55349,56638,101,97,116,101,114,768,69,70,71,76,83,84,1589,1604,1614,1622,1627,1638,113,117,97,108,256,59,76,1598,1599,25189,101,115,115,59,25307,117,108,108,69,113,117,97,108,59,25191,114,101,97,116,101,114,59,27298,101,115,115,59,25207,108,97,110,116,69,113,117,97,108,59,27262,105,108,100,101,59,25203,99,114,59,49152,55349,56482,59,25195,1024,65,97,99,102,105,111,115,117,1669,1675,1686,1691,1694,1706,1726,1738,82,68,99,121,59,17450,256,99,116,1680,1684,101,107,59,17095,59,16478,105,114,99,59,16676,114,59,24844,108,98,101,114,116,83,112,97,99,101,59,24843,496,1711,0,1714,102,59,24845,105,122,111,110,116,97,108,76,105,110,101,59,25856,256,99,116,1731,1733,242,1705,114,111,107,59,16678,109,112,324,1744,1752,111,119,110,72,117,109,240,303,113,117,97,108,59,25167,1792,69,74,79,97,99,100,102,103,109,110,111,115,116,117,1786,1790,1795,1799,1806,1818,1822,1825,1832,1860,1912,1931,1935,1941,99,121,59,17429,108,105,103,59,16690,99,121,59,17409,99,117,116,101,32827,205,16589,256,105,121,1811,1816,114,99,32827,206,16590,59,17432,111,116,59,16688,114,59,24849,114,97,118,101,32827,204,16588,384,59,97,112,1824,1839,1855,256,99,103,1844,1847,114,59,16682,105,110,97,114,121,73,59,24904,108,105,101,243,989,500,1865,0,1890,256,59,101,1869,1870,25132,256,103,114,1875,1880,114,97,108,59,25131,115,101,99,116,105,111,110,59,25282,105,115,105,98,108,101,256,67,84,1900,1906,111,109,109,97,59,24675,105,109,101,115,59,24674,384,103,112,116,1919,1923,1928,111,110,59,16686,102,59,49152,55349,56640,97,59,17305,99,114,59,24848,105,108,100,101,59,16680,491,1946,0,1950,99,121,59,17414,108,32827,207,16591,640,99,102,111,115,117,1964,1975,1980,1986,2e3,256,105,121,1969,1973,114,99,59,16692,59,17433,114,59,49152,55349,56589,112,102,59,49152,55349,56641,483,1991,0,1996,114,59,49152,55349,56485,114,99,121,59,17416,107,99,121,59,17412,896,72,74,97,99,102,111,115,2020,2024,2028,2033,2045,2050,2056,99,121,59,17445,99,121,59,17420,112,112,97,59,17306,256,101,121,2038,2043,100,105,108,59,16694,59,17434,114,59,49152,55349,56590,112,102,59,49152,55349,56642,99,114,59,49152,55349,56486,1408,74,84,97,99,101,102,108,109,111,115,116,2085,2089,2092,2128,2147,2483,2488,2503,2509,2615,2631,99,121,59,17417,32827,60,16444,640,99,109,110,112,114,2103,2108,2113,2116,2125,117,116,101,59,16697,98,100,97,59,17307,103,59,26602,108,97,99,101,116,114,102,59,24850,114,59,24990,384,97,101,121,2135,2140,2145,114,111,110,59,16701,100,105,108,59,16699,59,17435,256,102,115,2152,2416,116,1280,65,67,68,70,82,84,85,86,97,114,2174,2217,2225,2272,2278,2300,2351,2395,912,2410,256,110,114,2179,2191,103,108,101,66,114,97,99,107,101,116,59,26600,114,111,119,384,59,66,82,2201,2202,2206,24976,97,114,59,25060,105,103,104,116,65,114,114,111,119,59,25030,101,105,108,105,110,103,59,25352,111,501,2231,0,2243,98,108,101,66,114,97,99,107,101,116,59,26598,110,468,2248,0,2258,101,101,86,101,99,116,111,114,59,26977,101,99,116,111,114,256,59,66,2267,2268,25027,97,114,59,26969,108,111,111,114,59,25354,105,103,104,116,256,65,86,2287,2293,114,114,111,119,59,24980,101,99,116,111,114,59,26958,256,101,114,2305,2327,101,384,59,65,86,2313,2314,2320,25251,114,114,111,119,59,24996,101,99,116,111,114,59,26970,105,97,110,103,108,101,384,59,66,69,2340,2341,2345,25266,97,114,59,27087,113,117,97,108,59,25268,112,384,68,84,86,2359,2370,2380,111,119,110,86,101,99,116,111,114,59,26961,101,101,86,101,99,116,111,114,59,26976,101,99,116,111,114,256,59,66,2390,2391,25023,97,114,59,26968,101,99,116,111,114,256,59,66,2405,2406,25020,97,114,59,26962,105,103,104,116,225,924,115,768,69,70,71,76,83,84,2430,2443,2453,2461,2466,2477,113,117,97,108,71,114,101,97,116,101,114,59,25306,117,108,108,69,113,117,97,108,59,25190,114,101,97,116,101,114,59,25206,101,115,115,59,27297,108,97,110,116,69,113,117,97,108,59,27261,105,108,100,101,59,25202,114,59,49152,55349,56591,256,59,101,2493,2494,25304,102,116,97,114,114,111,119,59,25050,105,100,111,116,59,16703,384,110,112,119,2516,2582,2587,103,512,76,82,108,114,2526,2551,2562,2576,101,102,116,256,65,82,2534,2540,114,114,111,119,59,26613,105,103,104,116,65,114,114,111,119,59,26615,105,103,104,116,65,114,114,111,119,59,26614,101,102,116,256,97,114,947,2570,105,103,104,116,225,959,105,103,104,116,225,970,102,59,49152,55349,56643,101,114,256,76,82,2594,2604,101,102,116,65,114,114,111,119,59,24985,105,103,104,116,65,114,114,111,119,59,24984,384,99,104,116,2622,2624,2626,242,2124,59,25008,114,111,107,59,16705,59,25194,1024,97,99,101,102,105,111,115,117,2650,2653,2656,2679,2684,2693,2699,2702,112,59,26885,121,59,17436,256,100,108,2661,2671,105,117,109,83,112,97,99,101,59,24671,108,105,110,116,114,102,59,24883,114,59,49152,55349,56592,110,117,115,80,108,117,115,59,25107,112,102,59,49152,55349,56644,99,242,2678,59,17308,1152,74,97,99,101,102,111,115,116,117,2723,2727,2733,2752,2836,2841,3473,3479,3486,99,121,59,17418,99,117,116,101,59,16707,384,97,101,121,2740,2745,2750,114,111,110,59,16711,100,105,108,59,16709,59,17437,384,103,115,119,2759,2800,2830,97,116,105,118,101,384,77,84,86,2771,2783,2792,101,100,105,117,109,83,112,97,99,101,59,24587,104,105,256,99,110,2790,2776,235,2777,101,114,121,84,104,105,238,2777,116,101,100,256,71,76,2808,2822,114,101,97,116,101,114,71,114,101,97,116,101,242,1651,101,115,115,76,101,115,243,2632,76,105,110,101,59,16394,114,59,49152,55349,56593,512,66,110,112,116,2850,2856,2871,2874,114,101,97,107,59,24672,66,114,101,97,107,105,110,103,83,112,97,99,101,59,16544,102,59,24853,1664,59,67,68,69,71,72,76,78,80,82,83,84,86,2901,2902,2922,2940,2977,3051,3076,3166,3204,3238,3288,3425,3461,27372,256,111,117,2907,2916,110,103,114,117,101,110,116,59,25186,112,67,97,112,59,25197,111,117,98,108,101,86,101,114,116,105,99,97,108,66,97,114,59,25126,384,108,113,120,2947,2954,2971,101,109,101,110,116,59,25097,117,97,108,256,59,84,2962,2963,25184,105,108,100,101,59,49152,8770,824,105,115,116,115,59,25092,114,101,97,116,101,114,896,59,69,70,71,76,83,84,2998,2999,3005,3017,3027,3032,3045,25199,113,117,97,108,59,25201,117,108,108,69,113,117,97,108,59,49152,8807,824,114,101,97,116,101,114,59,49152,8811,824,101,115,115,59,25209,108,97,110,116,69,113,117,97,108,59,49152,10878,824,105,108,100,101,59,25205,117,109,112,324,3058,3069,111,119,110,72,117,109,112,59,49152,8782,824,113,117,97,108,59,49152,8783,824,101,256,102,115,3082,3111,116,84,114,105,97,110,103,108,101,384,59,66,69,3098,3099,3105,25322,97,114,59,49152,10703,824,113,117,97,108,59,25324,115,768,59,69,71,76,83,84,3125,3126,3132,3140,3147,3160,25198,113,117,97,108,59,25200,114,101,97,116,101,114,59,25208,101,115,115,59,49152,8810,824,108,97,110,116,69,113,117,97,108,59,49152,10877,824,105,108,100,101,59,25204,101,115,116,101,100,256,71,76,3176,3193,114,101,97,116,101,114,71,114,101,97,116,101,114,59,49152,10914,824,101,115,115,76,101,115,115,59,49152,10913,824,114,101,99,101,100,101,115,384,59,69,83,3218,3219,3227,25216,113,117,97,108,59,49152,10927,824,108,97,110,116,69,113,117,97,108,59,25312,256,101,105,3243,3257,118,101,114,115,101,69,108,101,109,101,110,116,59,25100,103,104,116,84,114,105,97,110,103,108,101,384,59,66,69,3275,3276,3282,25323,97,114,59,49152,10704,824,113,117,97,108,59,25325,256,113,117,3293,3340,117,97,114,101,83,117,256,98,112,3304,3321,115,101,116,256,59,69,3312,3315,49152,8847,824,113,117,97,108,59,25314,101,114,115,101,116,256,59,69,3331,3334,49152,8848,824,113,117,97,108,59,25315,384,98,99,112,3347,3364,3406,115,101,116,256,59,69,3355,3358,49152,8834,8402,113,117,97,108,59,25224,99,101,101,100,115,512,59,69,83,84,3378,3379,3387,3398,25217,113,117,97,108,59,49152,10928,824,108,97,110,116,69,113,117,97,108,59,25313,105,108,100,101,59,49152,8831,824,101,114,115,101,116,256,59,69,3416,3419,49152,8835,8402,113,117,97,108,59,25225,105,108,100,101,512,59,69,70,84,3438,3439,3445,3455,25153,113,117,97,108,59,25156,117,108,108,69,113,117,97,108,59,25159,105,108,100,101,59,25161,101,114,116,105,99,97,108,66,97,114,59,25124,99,114,59,49152,55349,56489,105,108,100,101,32827,209,16593,59,17309,1792,69,97,99,100,102,103,109,111,112,114,115,116,117,118,3517,3522,3529,3541,3547,3552,3559,3580,3586,3616,3618,3634,3647,3652,108,105,103,59,16722,99,117,116,101,32827,211,16595,256,105,121,3534,3539,114,99,32827,212,16596,59,17438,98,108,97,99,59,16720,114,59,49152,55349,56594,114,97,118,101,32827,210,16594,384,97,101,105,3566,3570,3574,99,114,59,16716,103,97,59,17321,99,114,111,110,59,17311,112,102,59,49152,55349,56646,101,110,67,117,114,108,121,256,68,81,3598,3610,111,117,98,108,101,81,117,111,116,101,59,24604,117,111,116,101,59,24600,59,27220,256,99,108,3623,3628,114,59,49152,55349,56490,97,115,104,32827,216,16600,105,364,3639,3644,100,101,32827,213,16597,101,115,59,27191,109,108,32827,214,16598,101,114,256,66,80,3659,3680,256,97,114,3664,3667,114,59,24638,97,99,256,101,107,3674,3676,59,25566,101,116,59,25524,97,114,101,110,116,104,101,115,105,115,59,25564,1152,97,99,102,104,105,108,111,114,115,3711,3719,3722,3727,3730,3732,3741,3760,3836,114,116,105,97,108,68,59,25090,121,59,17439,114,59,49152,55349,56595,105,59,17318,59,17312,117,115,77,105,110,117,115,59,16561,256,105,112,3746,3757,110,99,97,114,101,112,108,97,110,229,1693,102,59,24857,512,59,101,105,111,3769,3770,3808,3812,27323,99,101,100,101,115,512,59,69,83,84,3784,3785,3791,3802,25210,113,117,97,108,59,27311,108,97,110,116,69,113,117,97,108,59,25212,105,108,100,101,59,25214,109,101,59,24627,256,100,112,3817,3822,117,99,116,59,25103,111,114,116,105,111,110,256,59,97,549,3833,108,59,25117,256,99,105,3841,3846,114,59,49152,55349,56491,59,17320,512,85,102,111,115,3857,3862,3867,3871,79,84,32827,34,16418,114,59,49152,55349,56596,112,102,59,24858,99,114,59,49152,55349,56492,1536,66,69,97,99,101,102,104,105,111,114,115,117,3902,3907,3911,3936,3955,4007,4010,4013,4246,4265,4276,4286,97,114,114,59,26896,71,32827,174,16558,384,99,110,114,3918,3923,3926,117,116,101,59,16724,103,59,26603,114,256,59,116,3932,3933,24992,108,59,26902,384,97,101,121,3943,3948,3953,114,111,110,59,16728,100,105,108,59,16726,59,17440,256,59,118,3960,3961,24860,101,114,115,101,256,69,85,3970,3993,256,108,113,3975,3982,101,109,101,110,116,59,25099,117,105,108,105,98,114,105,117,109,59,25035,112,69,113,117,105,108,105,98,114,105,117,109,59,26991,114,187,3961,111,59,17313,103,104,116,1024,65,67,68,70,84,85,86,97,4033,4075,4083,4130,4136,4187,4231,984,256,110,114,4038,4050,103,108,101,66,114,97,99,107,101,116,59,26601,114,111,119,384,59,66,76,4060,4061,4065,24978,97,114,59,25061,101,102,116,65,114,114,111,119,59,25028,101,105,108,105,110,103,59,25353,111,501,4089,0,4101,98,108,101,66,114,97,99,107,101,116,59,26599,110,468,4106,0,4116,101,101,86,101,99,116,111,114,59,26973,101,99,116,111,114,256,59,66,4125,4126,25026,97,114,59,26965,108,111,111,114,59,25355,256,101,114,4141,4163,101,384,59,65,86,4149,4150,4156,25250,114,114,111,119,59,24998,101,99,116,111,114,59,26971,105,97,110,103,108,101,384,59,66,69,4176,4177,4181,25267,97,114,59,27088,113,117,97,108,59,25269,112,384,68,84,86,4195,4206,4216,111,119,110,86,101,99,116,111,114,59,26959,101,101,86,101,99,116,111,114,59,26972,101,99,116,111,114,256,59,66,4226,4227,25022,97,114,59,26964,101,99,116,111,114,256,59,66,4241,4242,25024,97,114,59,26963,256,112,117,4251,4254,102,59,24861,110,100,73,109,112,108,105,101,115,59,26992,105,103,104,116,97,114,114,111,119,59,25051,256,99,104,4281,4284,114,59,24859,59,25009,108,101,68,101,108,97,121,101,100,59,27124,1664,72,79,97,99,102,104,105,109,111,113,115,116,117,4324,4337,4343,4349,4377,4382,4433,4438,4449,4455,4533,4539,4543,256,67,99,4329,4334,72,99,121,59,17449,121,59,17448,70,84,99,121,59,17452,99,117,116,101,59,16730,640,59,97,101,105,121,4360,4361,4366,4371,4375,27324,114,111,110,59,16736,100,105,108,59,16734,114,99,59,16732,59,17441,114,59,49152,55349,56598,111,114,116,512,68,76,82,85,4394,4404,4414,4425,111,119,110,65,114,114,111,119,187,1054,101,102,116,65,114,114,111,119,187,2202,105,103,104,116,65,114,114,111,119,187,4061,112,65,114,114,111,119,59,24977,103,109,97,59,17315,97,108,108,67,105,114,99,108,101,59,25112,112,102,59,49152,55349,56650,626,4461,0,0,4464,116,59,25114,97,114,101,512,59,73,83,85,4475,4476,4489,4527,26017,110,116,101,114,115,101,99,116,105,111,110,59,25235,117,256,98,112,4495,4510,115,101,116,256,59,69,4503,4504,25231,113,117,97,108,59,25233,101,114,115,101,116,256,59,69,4520,4521,25232,113,117,97,108,59,25234,110,105,111,110,59,25236,99,114,59,49152,55349,56494,97,114,59,25286,512,98,99,109,112,4552,4571,4617,4619,256,59,115,4557,4558,25296,101,116,256,59,69,4557,4565,113,117,97,108,59,25222,256,99,104,4576,4613,101,101,100,115,512,59,69,83,84,4589,4590,4596,4607,25211,113,117,97,108,59,27312,108,97,110,116,69,113,117,97,108,59,25213,105,108,100,101,59,25215,84,104,225,3980,59,25105,384,59,101,115,4626,4627,4643,25297,114,115,101,116,256,59,69,4636,4637,25219,113,117,97,108,59,25223,101,116,187,4627,1408,72,82,83,97,99,102,104,105,111,114,115,4670,4676,4681,4693,4702,4721,4726,4767,4802,4808,4817,79,82,78,32827,222,16606,65,68,69,59,24866,256,72,99,4686,4690,99,121,59,17419,121,59,17446,256,98,117,4698,4700,59,16393,59,17316,384,97,101,121,4709,4714,4719,114,111,110,59,16740,100,105,108,59,16738,59,17442,114,59,49152,55349,56599,256,101,105,4731,4745,498,4736,0,4743,101,102,111,114,101,59,25140,97,59,17304,256,99,110,4750,4760,107,83,112,97,99,101,59,49152,8287,8202,83,112,97,99,101,59,24585,108,100,101,512,59,69,70,84,4779,4780,4786,4796,25148,113,117,97,108,59,25155,117,108,108,69,113,117,97,108,59,25157,105,108,100,101,59,25160,112,102,59,49152,55349,56651,105,112,108,101,68,111,116,59,24795,256,99,116,4822,4827,114,59,49152,55349,56495,114,111,107,59,16742,2785,4855,4878,4890,4902,0,4908,4913,0,0,0,0,0,4920,4925,4983,4997,0,5119,5124,5130,5136,256,99,114,4859,4865,117,116,101,32827,218,16602,114,256,59,111,4871,4872,24991,99,105,114,59,26953,114,483,4883,0,4886,121,59,17422,118,101,59,16748,256,105,121,4894,4899,114,99,32827,219,16603,59,17443,98,108,97,99,59,16752,114,59,49152,55349,56600,114,97,118,101,32827,217,16601,97,99,114,59,16746,256,100,105,4929,4969,101,114,256,66,80,4936,4957,256,97,114,4941,4944,114,59,16479,97,99,256,101,107,4951,4953,59,25567,101,116,59,25525,97,114,101,110,116,104,101,115,105,115,59,25565,111,110,256,59,80,4976,4977,25283,108,117,115,59,25230,256,103,112,4987,4991,111,110,59,16754,102,59,49152,55349,56652,1024,65,68,69,84,97,100,112,115,5013,5038,5048,5060,1e3,5074,5079,5107,114,114,111,119,384,59,66,68,4432,5024,5028,97,114,59,26898,111,119,110,65,114,114,111,119,59,25029,111,119,110,65,114,114,111,119,59,24981,113,117,105,108,105,98,114,105,117,109,59,26990,101,101,256,59,65,5067,5068,25253,114,114,111,119,59,24997,111,119,110,225,1011,101,114,256,76,82,5086,5096,101,102,116,65,114,114,111,119,59,24982,105,103,104,116,65,114,114,111,119,59,24983,105,256,59,108,5113,5114,17362,111,110,59,17317,105,110,103,59,16750,99,114,59,49152,55349,56496,105,108,100,101,59,16744,109,108,32827,220,16604,1152,68,98,99,100,101,102,111,115,118,5159,5164,5168,5171,5182,5253,5258,5264,5270,97,115,104,59,25259,97,114,59,27371,121,59,17426,97,115,104,256,59,108,5179,5180,25257,59,27366,256,101,114,5187,5189,59,25281,384,98,116,121,5196,5200,5242,97,114,59,24598,256,59,105,5199,5205,99,97,108,512,66,76,83,84,5217,5221,5226,5236,97,114,59,25123,105,110,101,59,16508,101,112,97,114,97,116,111,114,59,26456,105,108,100,101,59,25152,84,104,105,110,83,112,97,99,101,59,24586,114,59,49152,55349,56601,112,102,59,49152,55349,56653,99,114,59,49152,55349,56497,100,97,115,104,59,25258,640,99,101,102,111,115,5287,5292,5297,5302,5308,105,114,99,59,16756,100,103,101,59,25280,114,59,49152,55349,56602,112,102,59,49152,55349,56654,99,114,59,49152,55349,56498,512,102,105,111,115,5323,5328,5330,5336,114,59,49152,55349,56603,59,17310,112,102,59,49152,55349,56655,99,114,59,49152,55349,56499,1152,65,73,85,97,99,102,111,115,117,5361,5365,5369,5373,5380,5391,5396,5402,5408,99,121,59,17455,99,121,59,17415,99,121,59,17454,99,117,116,101,32827,221,16605,256,105,121,5385,5389,114,99,59,16758,59,17451,114,59,49152,55349,56604,112,102,59,49152,55349,56656,99,114,59,49152,55349,56500,109,108,59,16760,1024,72,97,99,100,101,102,111,115,5429,5433,5439,5451,5455,5469,5472,5476,99,121,59,17430,99,117,116,101,59,16761,256,97,121,5444,5449,114,111,110,59,16765,59,17431,111,116,59,16763,498,5460,0,5467,111,87,105,100,116,232,2777,97,59,17302,114,59,24872,112,102,59,24868,99,114,59,49152,55349,56501,3041,5507,5514,5520,0,5552,5558,5567,0,0,0,0,5574,5595,5611,5727,5741,0,5781,5787,5810,5817,0,5822,99,117,116,101,32827,225,16609,114,101,118,101,59,16643,768,59,69,100,105,117,121,5532,5533,5537,5539,5544,5549,25150,59,49152,8766,819,59,25151,114,99,32827,226,16610,116,101,32955,180,774,59,17456,108,105,103,32827,230,16614,256,59,114,178,5562,59,49152,55349,56606,114,97,118,101,32827,224,16608,256,101,112,5578,5590,256,102,112,5583,5588,115,121,109,59,24885,232,5587,104,97,59,17329,256,97,112,5599,99,256,99,108,5604,5607,114,59,16641,103,59,27199,612,5616,0,0,5642,640,59,97,100,115,118,5626,5627,5631,5633,5639,25127,110,100,59,27221,59,27228,108,111,112,101,59,27224,59,27226,896,59,101,108,109,114,115,122,5656,5657,5659,5662,5695,5711,5721,25120,59,27044,101,187,5657,115,100,256,59,97,5669,5670,25121,1121,5680,5682,5684,5686,5688,5690,5692,5694,59,27048,59,27049,59,27050,59,27051,59,27052,59,27053,59,27054,59,27055,116,256,59,118,5701,5702,25119,98,256,59,100,5708,5709,25278,59,27037,256,112,116,5716,5719,104,59,25122,187,185,97,114,114,59,25468,256,103,112,5731,5735,111,110,59,16645,102,59,49152,55349,56658,896,59,69,97,101,105,111,112,4801,5755,5757,5762,5764,5767,5770,59,27248,99,105,114,59,27247,59,25162,100,59,25163,115,59,16423,114,111,120,256,59,101,4801,5778,241,5763,105,110,103,32827,229,16613,384,99,116,121,5793,5798,5800,114,59,49152,55349,56502,59,16426,109,112,256,59,101,4801,5807,241,648,105,108,100,101,32827,227,16611,109,108,32827,228,16612,256,99,105,5826,5832,111,110,105,110,244,626,110,116,59,27153,2048,78,97,98,99,100,101,102,105,107,108,110,111,112,114,115,117,5869,5873,5936,5948,5955,5960,6008,6013,6112,6118,6201,6224,5901,6461,6472,6512,111,116,59,27373,256,99,114,5878,5918,107,512,99,101,112,115,5888,5893,5901,5907,111,110,103,59,25164,112,115,105,108,111,110,59,17398,114,105,109,101,59,24629,105,109,256,59,101,5914,5915,25149,113,59,25293,374,5922,5926,101,101,59,25277,101,100,256,59,103,5932,5933,25349,101,187,5933,114,107,256,59,116,4956,5943,98,114,107,59,25526,256,111,121,5889,5953,59,17457,113,117,111,59,24606,640,99,109,112,114,116,5971,5979,5985,5988,5992,97,117,115,256,59,101,266,265,112,116,121,118,59,27056,115,233,5900,110,111,245,275,384,97,104,119,5999,6001,6003,59,17330,59,24886,101,101,110,59,25196,114,59,49152,55349,56607,103,896,99,111,115,116,117,118,119,6029,6045,6067,6081,6101,6107,6110,384,97,105,117,6036,6038,6042,240,1888,114,99,59,26095,112,187,4977,384,100,112,116,6052,6056,6061,111,116,59,27136,108,117,115,59,27137,105,109,101,115,59,27138,625,6073,0,0,6078,99,117,112,59,27142,97,114,59,26117,114,105,97,110,103,108,101,256,100,117,6093,6098,111,119,110,59,26045,112,59,26035,112,108,117,115,59,27140,101,229,5188,229,5293,97,114,111,119,59,26893,384,97,107,111,6125,6182,6197,256,99,110,6130,6179,107,384,108,115,116,6138,1451,6146,111,122,101,110,103,101,59,27115,114,105,97,110,103,108,101,512,59,100,108,114,6162,6163,6168,6173,26036,111,119,110,59,26046,101,102,116,59,26050,105,103,104,116,59,26040,107,59,25635,433,6187,0,6195,434,6191,0,6193,59,26002,59,26001,52,59,26003,99,107,59,25992,256,101,111,6206,6221,256,59,113,6211,6214,49152,61,8421,117,105,118,59,49152,8801,8421,116,59,25360,512,112,116,119,120,6233,6238,6247,6252,102,59,49152,55349,56659,256,59,116,5067,6243,111,109,187,5068,116,105,101,59,25288,1536,68,72,85,86,98,100,104,109,112,116,117,118,6277,6294,6314,6331,6359,6363,6380,6399,6405,6410,6416,6433,512,76,82,108,114,6286,6288,6290,6292,59,25943,59,25940,59,25942,59,25939,640,59,68,85,100,117,6305,6306,6308,6310,6312,25936,59,25958,59,25961,59,25956,59,25959,512,76,82,108,114,6323,6325,6327,6329,59,25949,59,25946,59,25948,59,25945,896,59,72,76,82,104,108,114,6346,6347,6349,6351,6353,6355,6357,25937,59,25964,59,25955,59,25952,59,25963,59,25954,59,25951,111,120,59,27081,512,76,82,108,114,6372,6374,6376,6378,59,25941,59,25938,59,25872,59,25868,640,59,68,85,100,117,1725,6391,6393,6395,6397,59,25957,59,25960,59,25900,59,25908,105,110,117,115,59,25247,108,117,115,59,25246,105,109,101,115,59,25248,512,76,82,108,114,6425,6427,6429,6431,59,25947,59,25944,59,25880,59,25876,896,59,72,76,82,104,108,114,6448,6449,6451,6453,6455,6457,6459,25858,59,25962,59,25953,59,25950,59,25916,59,25892,59,25884,256,101,118,291,6466,98,97,114,32827,166,16550,512,99,101,105,111,6481,6486,6490,6496,114,59,49152,55349,56503,109,105,59,24655,109,256,59,101,5914,5916,108,384,59,98,104,6504,6505,6507,16476,59,27077,115,117,98,59,26568,364,6516,6526,108,256,59,101,6521,6522,24610,116,187,6522,112,384,59,69,101,303,6533,6535,59,27310,256,59,113,1756,1755,3297,6567,0,6632,6673,6677,6706,0,6711,6736,0,0,6836,0,0,6849,0,0,6945,6958,6989,6994,0,7165,0,7180,384,99,112,114,6573,6578,6621,117,116,101,59,16647,768,59,97,98,99,100,115,6591,6592,6596,6602,6613,6617,25129,110,100,59,27204,114,99,117,112,59,27209,256,97,117,6607,6610,112,59,27211,112,59,27207,111,116,59,27200,59,49152,8745,65024,256,101,111,6626,6629,116,59,24641,238,1683,512,97,101,105,117,6640,6651,6657,6661,496,6645,0,6648,115,59,27213,111,110,59,16653,100,105,108,32827,231,16615,114,99,59,16649,112,115,256,59,115,6668,6669,27212,109,59,27216,111,116,59,16651,384,100,109,110,6683,6688,6694,105,108,32955,184,429,112,116,121,118,59,27058,116,33024,162,59,101,6701,6702,16546,114,228,434,114,59,49152,55349,56608,384,99,101,105,6717,6720,6733,121,59,17479,99,107,256,59,109,6727,6728,26387,97,114,107,187,6728,59,17351,114,896,59,69,99,101,102,109,115,6751,6752,6754,6763,6820,6826,6830,26059,59,27075,384,59,101,108,6761,6762,6765,17094,113,59,25175,101,609,6772,0,0,6792,114,114,111,119,256,108,114,6780,6785,101,102,116,59,25018,105,103,104,116,59,25019,640,82,83,97,99,100,6802,6804,6806,6810,6815,187,3911,59,25800,115,116,59,25243,105,114,99,59,25242,97,115,104,59,25245,110,105,110,116,59,27152,105,100,59,27375,99,105,114,59,27074,117,98,115,256,59,117,6843,6844,26211,105,116,187,6844,748,6855,6868,6906,0,6922,111,110,256,59,101,6861,6862,16442,256,59,113,199,198,621,6873,0,0,6882,97,256,59,116,6878,6879,16428,59,16448,384,59,102,108,6888,6889,6891,25089,238,4448,101,256,109,120,6897,6902,101,110,116,187,6889,101,243,589,487,6910,0,6919,256,59,100,4795,6914,111,116,59,27245,110,244,582,384,102,114,121,6928,6932,6935,59,49152,55349,56660,111,228,596,33024,169,59,115,341,6941,114,59,24855,256,97,111,6949,6953,114,114,59,25013,115,115,59,26391,256,99,117,6962,6967,114,59,49152,55349,56504,256,98,112,6972,6980,256,59,101,6977,6978,27343,59,27345,256,59,101,6985,6986,27344,59,27346,100,111,116,59,25327,896,100,101,108,112,114,118,119,7008,7020,7031,7042,7084,7124,7161,97,114,114,256,108,114,7016,7018,59,26936,59,26933,624,7026,0,0,7029,114,59,25310,99,59,25311,97,114,114,256,59,112,7039,7040,25014,59,26941,768,59,98,99,100,111,115,7055,7056,7062,7073,7077,7080,25130,114,99,97,112,59,27208,256,97,117,7067,7070,112,59,27206,112,59,27210,111,116,59,25229,114,59,27205,59,49152,8746,65024,512,97,108,114,118,7093,7103,7134,7139,114,114,256,59,109,7100,7101,25015,59,26940,121,384,101,118,119,7111,7124,7128,113,624,7118,0,0,7122,114,101,227,7027,117,227,7029,101,101,59,25294,101,100,103,101,59,25295,101,110,32827,164,16548,101,97,114,114,111,119,256,108,114,7150,7155,101,102,116,187,7040,105,103,104,116,187,7101,101,228,7133,256,99,105,7169,7175,111,110,105,110,244,503,110,116,59,25137,108,99,116,121,59,25389,2432,65,72,97,98,99,100,101,102,104,105,106,108,111,114,115,116,117,119,122,7224,7227,7231,7261,7273,7285,7306,7326,7340,7351,7419,7423,7437,7547,7569,7595,7611,7622,7629,114,242,897,97,114,59,26981,512,103,108,114,115,7240,7245,7250,7252,103,101,114,59,24608,101,116,104,59,24888,242,4403,104,256,59,118,7258,7259,24592,187,2314,363,7265,7271,97,114,111,119,59,26895,97,227,789,256,97,121,7278,7283,114,111,110,59,16655,59,17460,384,59,97,111,818,7292,7300,256,103,114,703,7297,114,59,25034,116,115,101,113,59,27255,384,103,108,109,7313,7316,7320,32827,176,16560,116,97,59,17332,112,116,121,118,59,27057,256,105,114,7331,7336,115,104,116,59,27007,59,49152,55349,56609,97,114,256,108,114,7347,7349,187,2268,187,4126,640,97,101,103,115,118,7362,888,7382,7388,7392,109,384,59,111,115,806,7370,7380,110,100,256,59,115,806,7377,117,105,116,59,26214,97,109,109,97,59,17373,105,110,59,25330,384,59,105,111,7399,7400,7416,16631,100,101,33024,247,59,111,7399,7408,110,116,105,109,101,115,59,25287,110,248,7415,99,121,59,17490,99,623,7430,0,0,7434,114,110,59,25374,111,112,59,25357,640,108,112,116,117,119,7448,7453,7458,7497,7509,108,97,114,59,16420,102,59,49152,55349,56661,640,59,101,109,112,115,779,7469,7479,7485,7490,113,256,59,100,850,7475,111,116,59,25169,105,110,117,115,59,25144,108,117,115,59,25108,113,117,97,114,101,59,25249,98,108,101,98,97,114,119,101,100,103,229,250,110,384,97,100,104,4398,7517,7527,111,119,110,97,114,114,111,119,243,7299,97,114,112,111,111,110,256,108,114,7538,7542,101,102,244,7348,105,103,104,244,7350,354,7551,7557,107,97,114,111,247,3906,623,7562,0,0,7566,114,110,59,25375,111,112,59,25356,384,99,111,116,7576,7587,7590,256,114,121,7581,7585,59,49152,55349,56505,59,17493,108,59,27126,114,111,107,59,16657,256,100,114,7600,7604,111,116,59,25329,105,256,59,102,7610,6166,26047,256,97,104,7616,7619,114,242,1065,97,242,4006,97,110,103,108,101,59,27046,256,99,105,7634,7637,121,59,17503,103,114,97,114,114,59,26623,2304,68,97,99,100,101,102,103,108,109,110,111,112,113,114,115,116,117,120,7681,7689,7705,7736,1400,7740,7753,7777,7806,7845,7855,7869,7905,7978,7991,8004,8014,8026,256,68,111,7686,7476,111,244,7305,256,99,115,7694,7700,117,116,101,32827,233,16617,116,101,114,59,27246,512,97,105,111,121,7714,7719,7729,7734,114,111,110,59,16667,114,256,59,99,7725,7726,25174,32827,234,16618,108,111,110,59,25173,59,17485,111,116,59,16663,256,68,114,7745,7749,111,116,59,25170,59,49152,55349,56610,384,59,114,115,7760,7761,7767,27290,97,118,101,32827,232,16616,256,59,100,7772,7773,27286,111,116,59,27288,512,59,105,108,115,7786,7787,7794,7796,27289,110,116,101,114,115,59,25575,59,24851,256,59,100,7801,7802,27285,111,116,59,27287,384,97,112,115,7813,7817,7831,99,114,59,16659,116,121,384,59,115,118,7826,7827,7829,25093,101,116,187,7827,112,256,49,59,7837,7844,307,7841,7843,59,24580,59,24581,24579,256,103,115,7850,7852,59,16715,112,59,24578,256,103,112,7860,7864,111,110,59,16665,102,59,49152,55349,56662,384,97,108,115,7876,7886,7890,114,256,59,115,7882,7883,25301,108,59,27107,117,115,59,27249,105,384,59,108,118,7898,7899,7903,17333,111,110,187,7899,59,17397,512,99,115,117,118,7914,7923,7947,7971,256,105,111,7919,7729,114,99,187,7726,617,7929,0,0,7931,237,1352,97,110,116,256,103,108,7938,7942,116,114,187,7773,101,115,115,187,7802,384,97,101,105,7954,7958,7962,108,115,59,16445,115,116,59,25183,118,256,59,68,565,7968,68,59,27256,112,97,114,115,108,59,27109,256,68,97,7983,7987,111,116,59,25171,114,114,59,26993,384,99,100,105,7998,8001,7928,114,59,24879,111,244,850,256,97,104,8009,8011,59,17335,32827,240,16624,256,109,114,8019,8023,108,32827,235,16619,111,59,24748,384,99,105,112,8033,8036,8039,108,59,16417,115,244,1390,256,101,111,8044,8052,99,116,97,116,105,111,238,1369,110,101,110,116,105,97,108,229,1401,2529,8082,0,8094,0,8097,8103,0,0,8134,8140,0,8147,0,8166,8170,8192,0,8200,8282,108,108,105,110,103,100,111,116,115,101,241,7748,121,59,17476,109,97,108,101,59,26176,384,105,108,114,8109,8115,8129,108,105,103,59,32768,64259,617,8121,0,0,8125,103,59,32768,64256,105,103,59,32768,64260,59,49152,55349,56611,108,105,103,59,32768,64257,108,105,103,59,49152,102,106,384,97,108,116,8153,8156,8161,116,59,26221,105,103,59,32768,64258,110,115,59,26033,111,102,59,16786,496,8174,0,8179,102,59,49152,55349,56663,256,97,107,1471,8183,256,59,118,8188,8189,25300,59,27353,97,114,116,105,110,116,59,27149,256,97,111,8204,8277,256,99,115,8209,8274,945,8218,8240,8248,8261,8264,0,8272,946,8226,8229,8231,8234,8236,0,8238,32827,189,16573,59,24915,32827,188,16572,59,24917,59,24921,59,24923,435,8244,0,8246,59,24916,59,24918,692,8254,8257,0,0,8259,32827,190,16574,59,24919,59,24924,53,59,24920,438,8268,0,8270,59,24922,59,24925,56,59,24926,108,59,24644,119,110,59,25378,99,114,59,49152,55349,56507,2176,69,97,98,99,100,101,102,103,105,106,108,110,111,114,115,116,118,8322,8329,8351,8357,8368,8372,8432,8437,8442,8447,8451,8466,8504,791,8510,8530,8606,256,59,108,1613,8327,59,27276,384,99,109,112,8336,8341,8349,117,116,101,59,16885,109,97,256,59,100,8348,7386,17331,59,27270,114,101,118,101,59,16671,256,105,121,8362,8366,114,99,59,16669,59,17459,111,116,59,16673,512,59,108,113,115,1598,1602,8381,8393,384,59,113,115,1598,1612,8388,108,97,110,244,1637,512,59,99,100,108,1637,8402,8405,8421,99,59,27305,111,116,256,59,111,8412,8413,27264,256,59,108,8418,8419,27266,59,27268,256,59,101,8426,8429,49152,8923,65024,115,59,27284,114,59,49152,55349,56612,256,59,103,1651,1563,109,101,108,59,24887,99,121,59,17491,512,59,69,97,106,1626,8460,8462,8464,59,27282,59,27301,59,27300,512,69,97,101,115,8475,8477,8489,8500,59,25193,112,256,59,112,8483,8484,27274,114,111,120,187,8484,256,59,113,8494,8495,27272,256,59,113,8494,8475,105,109,59,25319,112,102,59,49152,55349,56664,256,99,105,8515,8518,114,59,24842,109,384,59,101,108,1643,8526,8528,59,27278,59,27280,33536,62,59,99,100,108,113,114,1518,8544,8554,8558,8563,8569,256,99,105,8549,8551,59,27303,114,59,27258,111,116,59,25303,80,97,114,59,27029,117,101,115,116,59,27260,640,97,100,101,108,115,8580,8554,8592,1622,8603,496,8585,0,8590,112,114,111,248,8350,114,59,27e3,113,256,108,113,1599,8598,108,101,115,243,8328,105,237,1643,256,101,110,8611,8621,114,116,110,101,113,113,59,49152,8809,65024,197,8618,1280,65,97,98,99,101,102,107,111,115,121,8644,8647,8689,8693,8698,8728,8733,8751,8808,8829,114,242,928,512,105,108,109,114,8656,8660,8663,8667,114,115,240,5252,102,187,8228,105,108,244,1705,256,100,114,8672,8676,99,121,59,17482,384,59,99,119,2292,8683,8687,105,114,59,26952,59,25005,97,114,59,24847,105,114,99,59,16677,384,97,108,114,8705,8718,8723,114,116,115,256,59,117,8713,8714,26213,105,116,187,8714,108,105,112,59,24614,99,111,110,59,25273,114,59,49152,55349,56613,115,256,101,119,8739,8745,97,114,111,119,59,26917,97,114,111,119,59,26918,640,97,109,111,112,114,8762,8766,8771,8798,8803,114,114,59,25087,116,104,116,59,25147,107,256,108,114,8777,8787,101,102,116,97,114,114,111,119,59,25001,105,103,104,116,97,114,114,111,119,59,25002,102,59,49152,55349,56665,98,97,114,59,24597,384,99,108,116,8815,8820,8824,114,59,49152,55349,56509,97,115,232,8692,114,111,107,59,16679,256,98,112,8834,8839,117,108,108,59,24643,104,101,110,187,7259,2785,8867,0,8874,0,8888,8901,8910,0,8917,8947,0,0,8952,8994,9063,9058,9087,0,9094,9130,9140,99,117,116,101,32827,237,16621,384,59,105,121,1905,8880,8885,114,99,32827,238,16622,59,17464,256,99,120,8892,8895,121,59,17461,99,108,32827,161,16545,256,102,114,927,8905,59,49152,55349,56614,114,97,118,101,32827,236,16620,512,59,105,110,111,1854,8925,8937,8942,256,105,110,8930,8934,110,116,59,27148,116,59,25133,102,105,110,59,27100,116,97,59,24873,108,105,103,59,16691,384,97,111,112,8958,8986,8989,384,99,103,116,8965,8968,8983,114,59,16683,384,101,108,112,1823,8975,8979,105,110,229,1934,97,114,244,1824,104,59,16689,102,59,25271,101,100,59,16821,640,59,99,102,111,116,1268,9004,9009,9021,9025,97,114,101,59,24837,105,110,256,59,116,9016,9017,25118,105,101,59,27101,100,111,244,8985,640,59,99,101,108,112,1879,9036,9040,9051,9057,97,108,59,25274,256,103,114,9045,9049,101,114,243,5475,227,9037,97,114,104,107,59,27159,114,111,100,59,27196,512,99,103,112,116,9071,9074,9078,9083,121,59,17489,111,110,59,16687,102,59,49152,55349,56666,97,59,17337,117,101,115,116,32827,191,16575,256,99,105,9098,9103,114,59,49152,55349,56510,110,640,59,69,100,115,118,1268,9115,9117,9121,1267,59,25337,111,116,59,25333,256,59,118,9126,9127,25332,59,25331,256,59,105,1911,9134,108,100,101,59,16681,491,9144,0,9148,99,121,59,17494,108,32827,239,16623,768,99,102,109,111,115,117,9164,9175,9180,9185,9191,9205,256,105,121,9169,9173,114,99,59,16693,59,17465,114,59,49152,55349,56615,97,116,104,59,16951,112,102,59,49152,55349,56667,483,9196,0,9201,114,59,49152,55349,56511,114,99,121,59,17496,107,99,121,59,17492,1024,97,99,102,103,104,106,111,115,9227,9238,9250,9255,9261,9265,9269,9275,112,112,97,256,59,118,9235,9236,17338,59,17392,256,101,121,9243,9248,100,105,108,59,16695,59,17466,114,59,49152,55349,56616,114,101,101,110,59,16696,99,121,59,17477,99,121,59,17500,112,102,59,49152,55349,56668,99,114,59,49152,55349,56512,2944,65,66,69,72,97,98,99,100,101,102,103,104,106,108,109,110,111,112,114,115,116,117,118,9328,9345,9350,9357,9361,9486,9533,9562,9600,9806,9822,9829,9849,9853,9882,9906,9944,10077,10088,10123,10176,10241,10258,384,97,114,116,9335,9338,9340,114,242,2502,242,917,97,105,108,59,26907,97,114,114,59,26894,256,59,103,2452,9355,59,27275,97,114,59,26978,2403,9381,0,9386,0,9393,0,0,0,0,0,9397,9402,0,9414,9416,9421,0,9465,117,116,101,59,16698,109,112,116,121,118,59,27060,114,97,238,2124,98,100,97,59,17339,103,384,59,100,108,2190,9409,9411,59,27025,229,2190,59,27269,117,111,32827,171,16555,114,1024,59,98,102,104,108,112,115,116,2201,9438,9446,9449,9451,9454,9457,9461,256,59,102,2205,9443,115,59,26911,115,59,26909,235,8786,112,59,25003,108,59,26937,105,109,59,26995,108,59,24994,384,59,97,101,9471,9472,9476,27307,105,108,59,26905,256,59,115,9481,9482,27309,59,49152,10925,65024,384,97,98,114,9493,9497,9501,114,114,59,26892,114,107,59,26482,256,97,107,9506,9516,99,256,101,107,9512,9514,59,16507,59,16475,256,101,115,9521,9523,59,27019,108,256,100,117,9529,9531,59,27023,59,27021,512,97,101,117,121,9542,9547,9558,9560,114,111,110,59,16702,256,100,105,9552,9556,105,108,59,16700,236,2224,226,9513,59,17467,512,99,113,114,115,9571,9574,9581,9597,97,59,26934,117,111,256,59,114,3609,5958,256,100,117,9586,9591,104,97,114,59,26983,115,104,97,114,59,26955,104,59,25010,640,59,102,103,113,115,9611,9612,2441,9715,9727,25188,116,640,97,104,108,114,116,9624,9636,9655,9666,9704,114,114,111,119,256,59,116,2201,9633,97,233,9462,97,114,112,111,111,110,256,100,117,9647,9652,111,119,110,187,1114,112,187,2406,101,102,116,97,114,114,111,119,115,59,25031,105,103,104,116,384,97,104,115,9677,9686,9694,114,114,111,119,256,59,115,2292,2215,97,114,112,111,111,110,243,3992,113,117,105,103,97,114,114,111,247,8688,104,114,101,101,116,105,109,101,115,59,25291,384,59,113,115,9611,2451,9722,108,97,110,244,2476,640,59,99,100,103,115,2476,9738,9741,9757,9768,99,59,27304,111,116,256,59,111,9748,9749,27263,256,59,114,9754,9755,27265,59,27267,256,59,101,9762,9765,49152,8922,65024,115,59,27283,640,97,100,101,103,115,9779,9785,9789,9801,9803,112,112,114,111,248,9414,111,116,59,25302,113,256,103,113,9795,9797,244,2441,103,116,242,9356,244,2459,105,237,2482,384,105,108,114,9813,2273,9818,115,104,116,59,27004,59,49152,55349,56617,256,59,69,2460,9827,59,27281,353,9833,9846,114,256,100,117,9650,9838,256,59,108,2405,9843,59,26986,108,107,59,25988,99,121,59,17497,640,59,97,99,104,116,2632,9864,9867,9873,9878,114,242,9665,111,114,110,101,242,7432,97,114,100,59,26987,114,105,59,26106,256,105,111,9887,9892,100,111,116,59,16704,117,115,116,256,59,97,9900,9901,25520,99,104,101,187,9901,512,69,97,101,115,9915,9917,9929,9940,59,25192,112,256,59,112,9923,9924,27273,114,111,120,187,9924,256,59,113,9934,9935,27271,256,59,113,9934,9915,105,109,59,25318,1024,97,98,110,111,112,116,119,122,9961,9972,9975,10010,10031,10049,10055,10064,256,110,114,9966,9969,103,59,26604,114,59,25085,114,235,2241,103,384,108,109,114,9983,9997,10004,101,102,116,256,97,114,2534,9991,105,103,104,116,225,2546,97,112,115,116,111,59,26620,105,103,104,116,225,2557,112,97,114,114,111,119,256,108,114,10021,10025,101,102,244,9453,105,103,104,116,59,25004,384,97,102,108,10038,10041,10045,114,59,27013,59,49152,55349,56669,117,115,59,27181,105,109,101,115,59,27188,353,10059,10063,115,116,59,25111,225,4942,384,59,101,102,10071,10072,6144,26058,110,103,101,187,10072,97,114,256,59,108,10084,10085,16424,116,59,27027,640,97,99,104,109,116,10099,10102,10108,10117,10119,114,242,2216,111,114,110,101,242,7564,97,114,256,59,100,3992,10115,59,26989,59,24590,114,105,59,25279,768,97,99,104,105,113,116,10136,10141,2624,10146,10158,10171,113,117,111,59,24633,114,59,49152,55349,56513,109,384,59,101,103,2482,10154,10156,59,27277,59,27279,256,98,117,9514,10163,111,256,59,114,3615,10169,59,24602,114,111,107,59,16706,33792,60,59,99,100,104,105,108,113,114,2091,10194,9785,10204,10208,10213,10218,10224,256,99,105,10199,10201,59,27302,114,59,27257,114,101,229,9714,109,101,115,59,25289,97,114,114,59,26998,117,101,115,116,59,27259,256,80,105,10229,10233,97,114,59,27030,384,59,101,102,10240,2349,6171,26051,114,256,100,117,10247,10253,115,104,97,114,59,26954,104,97,114,59,26982,256,101,110,10263,10273,114,116,110,101,113,113,59,49152,8808,65024,197,10270,1792,68,97,99,100,101,102,104,105,108,110,111,112,115,117,10304,10309,10370,10382,10387,10400,10405,10408,10458,10466,10468,2691,10483,10498,68,111,116,59,25146,512,99,108,112,114,10318,10322,10339,10365,114,32827,175,16559,256,101,116,10327,10329,59,26178,256,59,101,10334,10335,26400,115,101,187,10335,256,59,115,4155,10344,116,111,512,59,100,108,117,4155,10355,10359,10363,111,119,238,1164,101,102,244,2319,240,5073,107,101,114,59,26030,256,111,121,10375,10380,109,109,97,59,27177,59,17468,97,115,104,59,24596,97,115,117,114,101,100,97,110,103,108,101,187,5670,114,59,49152,55349,56618,111,59,24871,384,99,100,110,10415,10420,10441,114,111,32827,181,16565,512,59,97,99,100,5220,10429,10432,10436,115,244,5799,105,114,59,27376,111,116,32955,183,437,117,115,384,59,98,100,10450,6403,10451,25106,256,59,117,7484,10456,59,27178,355,10462,10465,112,59,27355,242,8722,240,2689,256,100,112,10473,10478,101,108,115,59,25255,102,59,49152,55349,56670,256,99,116,10488,10493,114,59,49152,55349,56514,112,111,115,187,5533,384,59,108,109,10505,10506,10509,17340,116,105,109,97,112,59,25272,3072,71,76,82,86,97,98,99,100,101,102,103,104,105,106,108,109,111,112,114,115,116,117,118,119,10562,10579,10622,10633,10648,10714,10729,10773,10778,10840,10845,10883,10901,10916,10920,11012,11015,11076,11135,11182,11316,11367,11388,11497,256,103,116,10567,10571,59,49152,8921,824,256,59,118,10576,3023,49152,8811,8402,384,101,108,116,10586,10610,10614,102,116,256,97,114,10593,10599,114,114,111,119,59,25037,105,103,104,116,97,114,114,111,119,59,25038,59,49152,8920,824,256,59,118,10619,3143,49152,8810,8402,105,103,104,116,97,114,114,111,119,59,25039,256,68,100,10638,10643,97,115,104,59,25263,97,115,104,59,25262,640,98,99,110,112,116,10659,10663,10668,10673,10700,108,97,187,734,117,116,101,59,16708,103,59,49152,8736,8402,640,59,69,105,111,112,3460,10684,10688,10693,10696,59,49152,10864,824,100,59,49152,8779,824,115,59,16713,114,111,248,3460,117,114,256,59,97,10707,10708,26222,108,256,59,115,10707,2872,499,10719,0,10723,112,32955,160,2871,109,112,256,59,101,3065,3072,640,97,101,111,117,121,10740,10750,10755,10768,10771,496,10745,0,10747,59,27203,111,110,59,16712,100,105,108,59,16710,110,103,256,59,100,3454,10762,111,116,59,49152,10861,824,112,59,27202,59,17469,97,115,104,59,24595,896,59,65,97,100,113,115,120,2962,10793,10797,10811,10817,10821,10832,114,114,59,25047,114,256,104,114,10803,10806,107,59,26916,256,59,111,5106,5104,111,116,59,49152,8784,824,117,105,246,2915,256,101,105,10826,10830,97,114,59,26920,237,2968,105,115,116,256,59,115,2976,2975,114,59,49152,55349,56619,512,69,101,115,116,3013,10854,10873,10876,384,59,113,115,3004,10861,3041,384,59,113,115,3004,3013,10868,108,97,110,244,3042,105,237,3050,256,59,114,2998,10881,187,2999,384,65,97,112,10890,10893,10897,114,242,10609,114,114,59,25006,97,114,59,27378,384,59,115,118,3981,10908,3980,256,59,100,10913,10914,25340,59,25338,99,121,59,17498,896,65,69,97,100,101,115,116,10935,10938,10942,10946,10949,10998,11001,114,242,10598,59,49152,8806,824,114,114,59,24986,114,59,24613,512,59,102,113,115,3131,10958,10979,10991,116,256,97,114,10964,10969,114,114,111,247,10945,105,103,104,116,97,114,114,111,247,10896,384,59,113,115,3131,10938,10986,108,97,110,244,3157,256,59,115,3157,10996,187,3126,105,237,3165,256,59,114,3125,11006,105,256,59,101,3098,3109,105,228,3472,256,112,116,11020,11025,102,59,49152,55349,56671,33152,172,59,105,110,11033,11034,11062,16556,110,512,59,69,100,118,2953,11044,11048,11054,59,49152,8953,824,111,116,59,49152,8949,824,481,2953,11059,11061,59,25335,59,25334,105,256,59,118,3256,11068,481,3256,11073,11075,59,25342,59,25341,384,97,111,114,11083,11107,11113,114,512,59,97,115,116,2939,11093,11098,11103,108,108,101,236,2939,108,59,49152,11005,8421,59,49152,8706,824,108,105,110,116,59,27156,384,59,99,101,3218,11120,11123,117,229,3237,256,59,99,3224,11128,256,59,101,3218,11133,241,3224,512,65,97,105,116,11144,11147,11165,11175,114,242,10632,114,114,384,59,99,119,11156,11157,11161,24987,59,49152,10547,824,59,49152,8605,824,103,104,116,97,114,114,111,119,187,11157,114,105,256,59,101,3275,3286,896,99,104,105,109,112,113,117,11197,11213,11225,11012,2936,11236,11247,512,59,99,101,114,3378,11206,3383,11209,117,229,3397,59,49152,55349,56515,111,114,116,621,11013,0,0,11222,97,114,225,11094,109,256,59,101,3438,11231,256,59,113,3444,3443,115,117,256,98,112,11243,11245,229,3320,229,3339,384,98,99,112,11254,11281,11289,512,59,69,101,115,11263,11264,3362,11268,25220,59,49152,10949,824,101,116,256,59,101,3355,11275,113,256,59,113,3363,11264,99,256,59,101,3378,11287,241,3384,512,59,69,101,115,11298,11299,3423,11303,25221,59,49152,10950,824,101,116,256,59,101,3416,11310,113,256,59,113,3424,11299,512,103,105,108,114,11325,11327,11333,11335,236,3031,108,100,101,32827,241,16625,231,3139,105,97,110,103,108,101,256,108,114,11346,11356,101,102,116,256,59,101,3098,11354,241,3110,105,103,104,116,256,59,101,3275,11365,241,3287,256,59,109,11372,11373,17341,384,59,101,115,11380,11381,11385,16419,114,111,59,24854,112,59,24583,1152,68,72,97,100,103,105,108,114,115,11407,11412,11417,11422,11427,11440,11446,11475,11491,97,115,104,59,25261,97,114,114,59,26884,112,59,49152,8781,8402,97,115,104,59,25260,256,101,116,11432,11436,59,49152,8805,8402,59,49152,62,8402,110,102,105,110,59,27102,384,65,101,116,11453,11457,11461,114,114,59,26882,59,49152,8804,8402,256,59,114,11466,11469,49152,60,8402,105,101,59,49152,8884,8402,256,65,116,11480,11484,114,114,59,26883,114,105,101,59,49152,8885,8402,105,109,59,49152,8764,8402,384,65,97,110,11504,11508,11522,114,114,59,25046,114,256,104,114,11514,11517,107,59,26915,256,59,111,5095,5093,101,97,114,59,26919,4691,6805,0,0,0,0,0,0,0,0,0,0,0,0,0,11565,0,11576,11592,11616,11621,11634,11652,6919,0,0,11661,11691,0,11720,11726,0,11740,11801,11819,11838,11843,256,99,115,11569,6807,117,116,101,32827,243,16627,256,105,121,11580,11589,114,256,59,99,6814,11586,32827,244,16628,59,17470,640,97,98,105,111,115,6816,11602,11607,456,11610,108,97,99,59,16721,118,59,27192,111,108,100,59,27068,108,105,103,59,16723,256,99,114,11625,11629,105,114,59,27071,59,49152,55349,56620,879,11641,0,0,11644,0,11650,110,59,17115,97,118,101,32827,242,16626,59,27073,256,98,109,11656,3572,97,114,59,27061,512,97,99,105,116,11669,11672,11685,11688,114,242,6784,256,105,114,11677,11680,114,59,27070,111,115,115,59,27067,110,229,3666,59,27072,384,97,101,105,11697,11701,11705,99,114,59,16717,103,97,59,17353,384,99,100,110,11712,11717,461,114,111,110,59,17343,59,27062,112,102,59,49152,55349,56672,384,97,101,108,11732,11735,466,114,59,27063,114,112,59,27065,896,59,97,100,105,111,115,118,11754,11755,11758,11784,11789,11792,11798,25128,114,242,6790,512,59,101,102,109,11767,11768,11778,11781,27229,114,256,59,111,11774,11775,24884,102,187,11775,32827,170,16554,32827,186,16570,103,111,102,59,25270,114,59,27222,108,111,112,101,59,27223,59,27227,384,99,108,111,11807,11809,11815,242,11777,97,115,104,32827,248,16632,108,59,25240,105,364,11823,11828,100,101,32827,245,16629,101,115,256,59,97,475,11834,115,59,27190,109,108,32827,246,16630,98,97,114,59,25405,2785,11870,0,11901,0,11904,11933,0,11938,11961,0,0,11979,3740,0,12051,0,0,12075,12220,0,12232,114,512,59,97,115,116,1027,11879,11890,3717,33024,182,59,108,11885,11886,16566,108,101,236,1027,617,11896,0,0,11899,109,59,27379,59,27389,121,59,17471,114,640,99,105,109,112,116,11915,11919,11923,6245,11927,110,116,59,16421,111,100,59,16430,105,108,59,24624,101,110,107,59,24625,114,59,49152,55349,56621,384,105,109,111,11944,11952,11956,256,59,118,11949,11950,17350,59,17365,109,97,244,2678,110,101,59,26126,384,59,116,118,11967,11968,11976,17344,99,104,102,111,114,107,187,8189,59,17366,256,97,117,11983,11999,110,256,99,107,11989,11997,107,256,59,104,8692,11995,59,24846,246,8692,115,1152,59,97,98,99,100,101,109,115,116,12019,12020,6408,12025,12029,12036,12038,12042,12046,16427,99,105,114,59,27171,105,114,59,27170,256,111,117,7488,12034,59,27173,59,27250,110,32955,177,3741,105,109,59,27174,119,111,59,27175,384,105,112,117,12057,12064,12069,110,116,105,110,116,59,27157,102,59,49152,55349,56673,110,100,32827,163,16547,1280,59,69,97,99,101,105,110,111,115,117,3784,12095,12097,12100,12103,12161,12169,12178,12158,12214,59,27315,112,59,27319,117,229,3801,256,59,99,3790,12108,768,59,97,99,101,110,115,3784,12121,12127,12134,12136,12158,112,112,114,111,248,12099,117,114,108,121,101,241,3801,241,3790,384,97,101,115,12143,12150,12154,112,112,114,111,120,59,27321,113,113,59,27317,105,109,59,25320,105,237,3807,109,101,256,59,115,12168,3758,24626,384,69,97,115,12152,12176,12154,240,12149,384,100,102,112,3820,12185,12207,384,97,108,115,12192,12197,12202,108,97,114,59,25390,105,110,101,59,25362,117,114,102,59,25363,256,59,116,3835,12212,239,3835,114,101,108,59,25264,256,99,105,12224,12229,114,59,49152,55349,56517,59,17352,110,99,115,112,59,24584,768,102,105,111,112,115,117,12250,8930,12255,12261,12267,12273,114,59,49152,55349,56622,112,102,59,49152,55349,56674,114,105,109,101,59,24663,99,114,59,49152,55349,56518,384,97,101,111,12280,12297,12307,116,256,101,105,12286,12293,114,110,105,111,110,243,1712,110,116,59,27158,115,116,256,59,101,12304,12305,16447,241,7961,244,3860,2688,65,66,72,97,98,99,100,101,102,104,105,108,109,110,111,112,114,115,116,117,120,12352,12369,12373,12377,12512,12558,12587,12615,12642,12658,12686,12806,12821,12836,12841,12888,12910,12914,12944,12976,12983,384,97,114,116,12359,12362,12364,114,242,4275,242,989,97,105,108,59,26908,97,114,242,7269,97,114,59,26980,896,99,100,101,110,113,114,116,12392,12405,12408,12415,12431,12436,12492,256,101,117,12397,12401,59,49152,8765,817,116,101,59,16725,105,227,4462,109,112,116,121,118,59,27059,103,512,59,100,101,108,4049,12425,12427,12429,59,27026,59,27045,229,4049,117,111,32827,187,16571,114,1408,59,97,98,99,102,104,108,112,115,116,119,4060,12460,12463,12471,12473,12476,12478,12480,12483,12487,12490,112,59,26997,256,59,102,4064,12468,115,59,26912,59,26931,115,59,26910,235,8797,240,10030,108,59,26949,105,109,59,26996,108,59,24995,59,24989,256,97,105,12497,12501,105,108,59,26906,111,256,59,110,12507,12508,25142,97,108,243,3870,384,97,98,114,12519,12522,12526,114,242,6117,114,107,59,26483,256,97,107,12531,12541,99,256,101,107,12537,12539,59,16509,59,16477,256,101,115,12546,12548,59,27020,108,256,100,117,12554,12556,59,27022,59,27024,512,97,101,117,121,12567,12572,12583,12585,114,111,110,59,16729,256,100,105,12577,12581,105,108,59,16727,236,4082,226,12538,59,17472,512,99,108,113,115,12596,12599,12605,12612,97,59,26935,100,104,97,114,59,26985,117,111,256,59,114,526,525,104,59,25011,384,97,99,103,12622,12639,3908,108,512,59,105,112,115,3960,12632,12635,4252,110,229,4283,97,114,244,4009,116,59,26029,384,105,108,114,12649,4131,12654,115,104,116,59,27005,59,49152,55349,56623,256,97,111,12663,12678,114,256,100,117,12669,12671,187,1147,256,59,108,4241,12676,59,26988,256,59,118,12683,12684,17345,59,17393,384,103,110,115,12693,12793,12796,104,116,768,97,104,108,114,115,116,12708,12720,12738,12760,12772,12782,114,114,111,119,256,59,116,4060,12717,97,233,12488,97,114,112,111,111,110,256,100,117,12731,12735,111,119,238,12670,112,187,4242,101,102,116,256,97,104,12746,12752,114,114,111,119,243,4074,97,114,112,111,111,110,243,1361,105,103,104,116,97,114,114,111,119,115,59,25033,113,117,105,103,97,114,114,111,247,12491,104,114,101,101,116,105,109,101,115,59,25292,103,59,17114,105,110,103,100,111,116,115,101,241,7986,384,97,104,109,12813,12816,12819,114,242,4074,97,242,1361,59,24591,111,117,115,116,256,59,97,12830,12831,25521,99,104,101,187,12831,109,105,100,59,27374,512,97,98,112,116,12850,12861,12864,12882,256,110,114,12855,12858,103,59,26605,114,59,25086,114,235,4099,384,97,102,108,12871,12874,12878,114,59,27014,59,49152,55349,56675,117,115,59,27182,105,109,101,115,59,27189,256,97,112,12893,12903,114,256,59,103,12899,12900,16425,116,59,27028,111,108,105,110,116,59,27154,97,114,242,12771,512,97,99,104,113,12923,12928,4284,12933,113,117,111,59,24634,114,59,49152,55349,56519,256,98,117,12539,12938,111,256,59,114,532,531,384,104,105,114,12951,12955,12960,114,101,229,12792,109,101,115,59,25290,105,512,59,101,102,108,12970,4185,6177,12971,26041,116,114,105,59,27086,108,117,104,97,114,59,26984,59,24862,3425,13013,13019,13023,13100,13112,13169,0,13178,13220,0,0,13292,13296,0,13352,13384,13402,13485,13489,13514,13553,0,13846,0,0,13875,99,117,116,101,59,16731,113,117,239,10170,1280,59,69,97,99,101,105,110,112,115,121,4589,13043,13045,13055,13058,13067,13071,13087,13094,13097,59,27316,496,13050,0,13052,59,27320,111,110,59,16737,117,229,4606,256,59,100,4595,13063,105,108,59,16735,114,99,59,16733,384,69,97,115,13078,13080,13083,59,27318,112,59,27322,105,109,59,25321,111,108,105,110,116,59,27155,105,237,4612,59,17473,111,116,384,59,98,101,13108,7495,13109,25285,59,27238,896,65,97,99,109,115,116,120,13126,13130,13143,13147,13150,13155,13165,114,114,59,25048,114,256,104,114,13136,13138,235,8744,256,59,111,2614,2612,116,32827,167,16551,105,59,16443,119,97,114,59,26921,109,256,105,110,13161,240,110,117,243,241,116,59,26422,114,256,59,111,13174,8277,49152,55349,56624,512,97,99,111,121,13186,13190,13201,13216,114,112,59,26223,256,104,121,13195,13199,99,121,59,17481,59,17480,114,116,621,13209,0,0,13212,105,228,5220,97,114,97,236,11887,32827,173,16557,256,103,109,13224,13236,109,97,384,59,102,118,13233,13234,13234,17347,59,17346,1024,59,100,101,103,108,110,112,114,4779,13253,13257,13262,13270,13278,13281,13286,111,116,59,27242,256,59,113,4785,4784,256,59,69,13267,13268,27294,59,27296,256,59,69,13275,13276,27293,59,27295,101,59,25158,108,117,115,59,27172,97,114,114,59,26994,97,114,242,4413,512,97,101,105,116,13304,13320,13327,13335,256,108,115,13309,13316,108,115,101,116,109,233,13162,104,112,59,27187,112,97,114,115,108,59,27108,256,100,108,5219,13332,101,59,25379,256,59,101,13340,13341,27306,256,59,115,13346,13347,27308,59,49152,10924,65024,384,102,108,112,13358,13363,13378,116,99,121,59,17484,256,59,98,13368,13369,16431,256,59,97,13374,13375,27076,114,59,25407,102,59,49152,55349,56676,97,256,100,114,13389,1026,101,115,256,59,117,13396,13397,26208,105,116,187,13397,384,99,115,117,13408,13433,13471,256,97,117,13413,13423,112,256,59,115,4488,13419,59,49152,8851,65024,112,256,59,115,4532,13429,59,49152,8852,65024,117,256,98,112,13439,13455,384,59,101,115,4503,4508,13446,101,116,256,59,101,4503,13453,241,4509,384,59,101,115,4520,4525,13462,101,116,256,59,101,4520,13469,241,4526,384,59,97,102,4475,13478,1456,114,357,13483,1457,187,4476,97,114,242,4424,512,99,101,109,116,13497,13502,13506,13509,114,59,49152,55349,56520,116,109,238,241,105,236,13333,97,114,230,4542,256,97,114,13518,13525,114,256,59,102,13524,6079,26118,256,97,110,13530,13549,105,103,104,116,256,101,112,13539,13546,112,115,105,108,111,238,7904,104,233,11951,115,187,10322,640,98,99,109,110,112,13563,13662,4617,13707,13710,1152,59,69,100,101,109,110,112,114,115,13582,13583,13585,13589,13598,13603,13612,13617,13622,25218,59,27333,111,116,59,27325,256,59,100,4570,13594,111,116,59,27331,117,108,116,59,27329,256,69,101,13608,13610,59,27339,59,25226,108,117,115,59,27327,97,114,114,59,27001,384,101,105,117,13629,13650,13653,116,384,59,101,110,13582,13637,13643,113,256,59,113,4570,13583,101,113,256,59,113,13611,13608,109,59,27335,256,98,112,13658,13660,59,27349,59,27347,99,768,59,97,99,101,110,115,4589,13676,13682,13689,13691,13094,112,112,114,111,248,13050,117,114,108,121,101,241,4606,241,4595,384,97,101,115,13698,13704,13083,112,112,114,111,248,13082,113,241,13079,103,59,26218,1664,49,50,51,59,69,100,101,104,108,109,110,112,115,13737,13740,13743,4636,13746,13748,13760,13769,13781,13786,13791,13800,13805,32827,185,16569,32827,178,16562,32827,179,16563,59,27334,256,111,115,13753,13756,116,59,27326,117,98,59,27352,256,59,100,4642,13765,111,116,59,27332,115,256,111,117,13775,13778,108,59,26569,98,59,27351,97,114,114,59,27003,117,108,116,59,27330,256,69,101,13796,13798,59,27340,59,25227,108,117,115,59,27328,384,101,105,117,13812,13833,13836,116,384,59,101,110,4636,13820,13826,113,256,59,113,4642,13746,101,113,256,59,113,13799,13796,109,59,27336,256,98,112,13841,13843,59,27348,59,27350,384,65,97,110,13852,13856,13869,114,114,59,25049,114,256,104,114,13862,13864,235,8750,256,59,111,2603,2601,119,97,114,59,26922,108,105,103,32827,223,16607,3041,13905,13917,13920,4814,13939,13945,0,13950,14018,0,0,0,0,0,14043,14083,0,14089,14188,0,0,0,14215,626,13910,0,0,13915,103,101,116,59,25366,59,17348,114,235,3679,384,97,101,121,13926,13931,13936,114,111,110,59,16741,100,105,108,59,16739,59,17474,108,114,101,99,59,25365,114,59,49152,55349,56625,512,101,105,107,111,13958,13981,14005,14012,498,13963,0,13969,101,256,52,102,4740,4737,97,384,59,115,118,13976,13977,13979,17336,121,109,59,17361,256,99,110,13986,14002,107,256,97,115,13992,13998,112,112,114,111,248,4801,105,109,187,4780,115,240,4766,256,97,115,14010,13998,240,4801,114,110,32827,254,16638,492,799,14022,8935,101,115,33152,215,59,98,100,14031,14032,14040,16599,256,59,97,6415,14037,114,59,27185,59,27184,384,101,112,115,14049,14051,14080,225,10829,512,59,98,99,102,1158,14060,14064,14068,111,116,59,25398,105,114,59,27377,256,59,111,14073,14076,49152,55349,56677,114,107,59,27354,225,13154,114,105,109,101,59,24628,384,97,105,112,14095,14098,14180,100,229,4680,896,97,100,101,109,112,115,116,14113,14157,14144,14161,14167,14172,14175,110,103,108,101,640,59,100,108,113,114,14128,14129,14134,14144,14146,26037,111,119,110,187,7611,101,102,116,256,59,101,10240,14142,241,2350,59,25180,105,103,104,116,256,59,101,12970,14155,241,4186,111,116,59,26092,105,110,117,115,59,27194,108,117,115,59,27193,98,59,27085,105,109,101,59,27195,101,122,105,117,109,59,25570,384,99,104,116,14194,14205,14209,256,114,121,14199,14203,59,49152,55349,56521,59,17478,99,121,59,17499,114,111,107,59,16743,256,105,111,14219,14222,120,244,6007,104,101,97,100,256,108,114,14231,14240,101,102,116,97,114,114,111,247,2127,105,103,104,116,97,114,114,111,119,187,3933,2304,65,72,97,98,99,100,102,103,104,108,109,111,112,114,115,116,117,119,14288,14291,14295,14308,14320,14332,14350,14364,14371,14388,14417,14429,14443,14505,14540,14546,14570,14582,114,242,1005,97,114,59,26979,256,99,114,14300,14306,117,116,101,32827,250,16634,242,4432,114,483,14314,0,14317,121,59,17502,118,101,59,16749,256,105,121,14325,14330,114,99,32827,251,16635,59,17475,384,97,98,104,14339,14342,14347,114,242,5037,108,97,99,59,16753,97,242,5059,256,105,114,14355,14360,115,104,116,59,27006,59,49152,55349,56626,114,97,118,101,32827,249,16633,353,14375,14385,114,256,108,114,14380,14382,187,2391,187,4227,108,107,59,25984,256,99,116,14393,14413,623,14399,0,0,14410,114,110,256,59,101,14405,14406,25372,114,187,14406,111,112,59,25359,114,105,59,26104,256,97,108,14422,14426,99,114,59,16747,32955,168,841,256,103,112,14434,14438,111,110,59,16755,102,59,49152,55349,56678,768,97,100,104,108,115,117,4427,14456,14461,4978,14481,14496,111,119,110,225,5043,97,114,112,111,111,110,256,108,114,14472,14476,101,102,244,14381,105,103,104,244,14383,105,384,59,104,108,14489,14490,14492,17349,187,5114,111,110,187,14490,112,97,114,114,111,119,115,59,25032,384,99,105,116,14512,14532,14536,623,14518,0,0,14529,114,110,256,59,101,14524,14525,25373,114,187,14525,111,112,59,25358,110,103,59,16751,114,105,59,26105,99,114,59,49152,55349,56522,384,100,105,114,14553,14557,14562,111,116,59,25328,108,100,101,59,16745,105,256,59,102,14128,14568,187,6163,256,97,109,14575,14578,114,242,14504,108,32827,252,16636,97,110,103,108,101,59,27047,1920,65,66,68,97,99,100,101,102,108,110,111,112,114,115,122,14620,14623,14633,14637,14773,14776,14781,14815,14820,14824,14835,14841,14845,14849,14880,114,242,1015,97,114,256,59,118,14630,14631,27368,59,27369,97,115,232,993,256,110,114,14642,14647,103,114,116,59,27036,896,101,107,110,112,114,115,116,13539,14662,14667,14674,14685,14692,14742,97,112,112,225,9237,111,116,104,105,110,231,7830,384,104,105,114,13547,11976,14681,111,112,244,12213,256,59,104,5047,14690,239,12685,256,105,117,14697,14701,103,109,225,13235,256,98,112,14706,14724,115,101,116,110,101,113,256,59,113,14717,14720,49152,8842,65024,59,49152,10955,65024,115,101,116,110,101,113,256,59,113,14735,14738,49152,8843,65024,59,49152,10956,65024,256,104,114,14747,14751,101,116,225,13980,105,97,110,103,108,101,256,108,114,14762,14767,101,102,116,187,2341,105,103,104,116,187,4177,121,59,17458,97,115,104,187,4150,384,101,108,114,14788,14802,14807,384,59,98,101,11754,14795,14799,97,114,59,25275,113,59,25178,108,105,112,59,25326,256,98,116,14812,5224,97,242,5225,114,59,49152,55349,56627,116,114,233,14766,115,117,256,98,112,14831,14833,187,3356,187,3417,112,102,59,49152,55349,56679,114,111,240,3835,116,114,233,14772,256,99,117,14854,14859,114,59,49152,55349,56523,256,98,112,14864,14872,110,256,69,101,14720,14870,187,14718,110,256,69,101,14738,14878,187,14736,105,103,122,97,103,59,27034,896,99,101,102,111,112,114,115,14902,14907,14934,14939,14932,14945,14954,105,114,99,59,16757,256,100,105,14912,14929,256,98,103,14917,14921,97,114,59,27231,101,256,59,113,5626,14927,59,25177,101,114,112,59,24856,114,59,49152,55349,56628,112,102,59,49152,55349,56680,256,59,101,5241,14950,97,116,232,5241,99,114,59,49152,55349,56524,2787,6030,14983,0,14987,0,14992,15003,0,0,15005,15016,15019,15023,0,0,15043,15054,0,15064,6108,6111,116,114,233,6097,114,59,49152,55349,56629,256,65,97,14996,14999,114,242,963,114,242,2550,59,17342,256,65,97,15009,15012,114,242,952,114,242,2539,97,240,10003,105,115,59,25339,384,100,112,116,6052,15029,15038,256,102,108,15034,6057,59,49152,55349,56681,105,109,229,6066,256,65,97,15047,15050,114,242,974,114,242,2561,256,99,113,15058,6072,114,59,49152,55349,56525,256,112,116,6102,15068,114,233,6100,1024,97,99,101,102,105,111,115,117,15088,15101,15112,15116,15121,15125,15131,15137,99,256,117,121,15094,15099,116,101,32827,253,16637,59,17487,256,105,121,15106,15110,114,99,59,16759,59,17483,110,32827,165,16549,114,59,49152,55349,56630,99,121,59,17495,112,102,59,49152,55349,56682,99,114,59,49152,55349,56526,256,99,109,15142,15145,121,59,17486,108,32827,255,16639,1280,97,99,100,101,102,104,105,111,115,119,15170,15176,15188,15192,15204,15209,15213,15220,15226,15232,99,117,116,101,59,16762,256,97,121,15181,15186,114,111,110,59,16766,59,17463,111,116,59,16764,256,101,116,15197,15201,116,114,230,5471,97,59,17334,114,59,49152,55349,56631,99,121,59,17462,103,114,97,114,114,59,25053,112,102,59,49152,55349,56683,99,114,59,49152,55349,56527,256,106,110,15237,15239,59,24589,106,59,24588]);var km=new Uint16Array([512,97,103,108,113,9,21,24,27,621,15,0,0,18,112,59,16422,111,115,59,16423,116,59,16446,116,59,16444,117,111,116,59,16418]);var z0,z_=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]),Om=(z0=String.fromCodePoint)!==null&&z0!==void 0?z0:function(t){let e="";return t>65535&&(t-=65536,e+=String.fromCharCode(t>>>10&1023|55296),t=56320|t&1023),e+=String.fromCharCode(t),e};function Lm(t){var e;return t>=55296&&t<=57343||t>1114111?65533:(e=z_.get(t))!==null&&e!==void 0?e:t}function j0(t){return Om(Lm(t))}var ar;(function(t){t[t.NUM=35]="NUM",t[t.SEMI=59]="SEMI",t[t.ZERO=48]="ZERO",t[t.NINE=57]="NINE",t[t.LOWER_A=97]="LOWER_A",t[t.LOWER_F=102]="LOWER_F",t[t.LOWER_X=120]="LOWER_X",t[t.To_LOWER_BIT=32]="To_LOWER_BIT"})(ar||(ar={}));var ps;(function(t){t[t.VALUE_LENGTH=49152]="VALUE_LENGTH",t[t.BRANCH_LENGTH=16256]="BRANCH_LENGTH",t[t.JUMP_TABLE=127]="JUMP_TABLE"})(ps||(ps={}));function Nm(t){return function(r,i){let n="",s=0,a=0;for(;(a=r.indexOf("&",a))>=0;){if(n+=r.slice(s,a),s=a,a+=1,r.charCodeAt(a)===ar.NUM){let w=a+1,S=10,v=r.charCodeAt(w);(v|ar.To_LOWER_BIT)===ar.LOWER_X&&(S=16,a+=1,w+=1);do v=r.charCodeAt(++a);while(v>=ar.ZERO&&v<=ar.NINE||S===16&&(v|ar.To_LOWER_BIT)>=ar.LOWER_A&&(v|ar.To_LOWER_BIT)<=ar.LOWER_F);if(w!==a){let R=r.substring(w,a),x=parseInt(R,S);if(r.charCodeAt(a)===ar.SEMI)a+=1;else if(i)continue;n+=j0(x),s=a}continue}let c=0,d=1,p=0,m=t[p];for(;a<r.length&&(p=j_(t,m,p+1,r.charCodeAt(a)),!(p<0));a++,d++){m=t[p];let w=m&ps.VALUE_LENGTH;if(w){(!i||r.charCodeAt(a)===ar.SEMI)&&(c=p,d=0);let S=(w>>14)-1;if(S===0)break;p+=S}}if(c!==0){let w=(t[c]&ps.VALUE_LENGTH)>>14;n+=w===1?String.fromCharCode(t[c]&~ps.VALUE_LENGTH):w===2?String.fromCharCode(t[c+1]):String.fromCharCode(t[c+1],t[c+2]),s=a-d+1}}return n+r.slice(s)}}function j_(t,e,r,i){let n=(e&ps.BRANCH_LENGTH)>>7,s=e&ps.JUMP_TABLE;if(n===0)return s!==0&&i===s?r:-1;if(s){let d=i-s;return d<0||d>n?-1:t[r+d]-1}let a=r,c=a+n-1;for(;a<=c;){let d=a+c>>>1,p=t[d];if(p<i)a=d+1;else if(p>i)c=d-1;else return t[d+n]}return-1}var $A=Nm(Im),WA=Nm(km);var q_=new Map([[34,"&quot;"],[38,"&amp;"],[39,"&apos;"],[60,"&lt;"],[62,"&gt;"]]),U_=String.prototype.codePointAt!=null?(t,e)=>t.codePointAt(e):(t,e)=>(t.charCodeAt(e)&64512)===55296?(t.charCodeAt(e)-55296)*1024+t.charCodeAt(e+1)-56320+65536:t.charCodeAt(e);function q0(t,e){return function(i){let n,s=0,a="";for(;n=t.exec(i);)s!==n.index&&(a+=i.substring(s,n.index)),a+=e.get(n[0].charCodeAt(0)),s=n.index+1;return a+i.substring(s)}}var Fu=q0(/[&<>'"]/g,q_),Dm=q0(/["&\u00A0]/g,new Map([[34,"&quot;"],[38,"&amp;"],[160,"&nbsp;"]])),Bm=q0(/[&<>\u00A0]/g,new Map([[38,"&amp;"],[60,"&lt;"],[62,"&gt;"],[160,"&nbsp;"]]));var zm;(function(t){t[t.XML=0]="XML",t[t.HTML=1]="HTML"})(zm||(zm={}));var jm;(function(t){t[t.Legacy=0]="Legacy",t[t.Strict=1]="Strict"})(jm||(jm={}));var qm;(function(t){t[t.UTF8=0]="UTF8",t[t.ASCII=1]="ASCII",t[t.Extensive=2]="Extensive",t[t.Attribute=3]="Attribute",t[t.Text=4]="Text"})(qm||(qm={}));var Hu=t=>" ".repeat(t),m1=class{toString(e=0){return Hu(e)+"[VNode]"}},ms=class extends m1{constructor(e){super(),this.text=e}toString(e=0){return Hu(e)+this.textContent}get textContent(){return Fu(this.text)}set textContent(e){this.text=e}},zo=class extends m1{constructor(e,r,i){super(),this.tag=e,this.attrs=r,this.children=i}get textContent(){return this.children.length===0?"":this.children.length===1?this.children[0].textContent:this.children.map(e=>e.textContent).join("")}set textContent(e){this.children=[new ms(e)]}toString(e=0){let r=this.toStringAttrs(),i=Hu(e),n=this.toStringChildren(e),s=`${i}<${this.tag}${r}`;return n===""?`${s} />`:`${s}>${n}</${this.tag}>`}*tags(e){this.tag===e&&(yield this);for(let r of this.elementChildren())yield*r.tags(e);return null}find(e,...r){for(let i of this.tags(e)){if(i===this)continue;if(r.length===0)return i;let n=i.find(...r);if(n!=null)return n}return null}*elementChildren(){for(let e of this.children)e instanceof zo&&(yield e);return null}toStringAttrs(){let e=Object.keys(this.attrs);if(e.length===0)return"";let r="";for(let i of e){let n=this.attrs[i];n!=null&&(r+=` ${i}="${n}"`)}return r}toStringChildren(e=0){if(this.children.length===0)return"";if(this.children.length===1){let r=this.children[0];if(r instanceof ms)return r.textContent}return`
122
137
  ${this.children.map(r=>r.toString(e+1)).join(`
123
138
  `)}
124
- ${kh(e)}`}};function KR(t){if(t==null)return[];if(Array.isArray(t)){let e=[];for(let r of t)if(r!=null){if(typeof r=="string"||typeof r=="number"){e.push(new Rn(String(r)));continue}e.push(r)}return e}else if(typeof t=="string"||typeof t=="number")return[new Rn(String(t))];return[t]}function se(t,e,r){let i=typeof e=="object"&&!Array.isArray(e);if(!i){if(r!=null)throw new Error("Invalid input");r=e}return new Rs(t,i?e:{},KR(r))}var YR=ve($b(),1);var dl;(function(t){t.aerial="aerial"})(dl||(dl={}));var ov=ve(Hb(),1),av=ve(nv(),1);function sv(t){return[[[t[0],t[1]],[t[2],t[1]],[t[2],t[3]],[t[0],t[3]],[t[0],t[1]]]]}var{intersection:gC,union:lv}=av.default;function yC(t,e){return t[0]===e[0]&&t[1]===e[1]}function bC(t,e){return gC(t,sv(e))}function xm(t,e){let r=[];for(let i of t){let n=ov.default.polygon(i[0],e);n.length!==0&&(yC(n[0],n[n.length-1])||n.push(n[0]),r.push([n]))}return bC(r,e)}var yl=t=>(t<-360?t=-(-t%360):t>360&&(t=t%360),t<-180?360+t:t>180?t-360:t),Cs=(t,e)=>{let r=e-t;return r>180?r-360:r<-180?r+360:r},vC=(t,e)=>yl(t+(e<t?e+360-t:e-t)),Si={boxLonCenter(t){return yl(t[0]+.5*(t[2]<t[0]?360+t[2]-t[0]:t[2]-t[0]))},delta:Cs,crossesAM(t,e){return Math.sign(Cs(t,e))!==Math.sign(e-t)},normLon:yl,normExtent(t){return[yl(t[0]),t[1],yl(t[2]),t[3]]},union(t,e){if(e==null)return t.slice();let r=Si.boxLonCenter(t),i=Si.boxLonCenter(e);if(Cs(r,i)<0)return this.union(e,t);let n=t.slice(),o=vC(r,i);return Cs(o,e[0])<Cs(o,t[0])&&(n[0]=e[0]),Cs(o,e[2])>Cs(o,t[2])&&(n[2]=e[2]),e[1]<t[1]&&(n[1]=e[1]),e[3]>t[3]&&(n[3]=e[3]),n},intersects(t,e){if(t[1]>e[3]||e[1]>t[3])return!1;let r=t[0],i=e[0],n=r<t[2]?t[2]:t[2]+360,o=i<e[2]?e[2]:e[2]+360;return r<=o&&i<=n||r+360<=o&&i<=n+360||r<=o+360&&i+360<=n},ringToBbox(t){if(t.length<3)throw new Error("Invalid ring");let e=!1,r=t[0],i=r[0],n=r[1],o=i,a=n,h=i;for(let d=1;d<t.length;++d){let m=t[d],p=m[0];Si.crossesAM(h,p)&&(e=!e),e&&(p<0?p+=360:(h+=360,d===1&&(i=o=h))),p<i?i=p:p>o&&(o=p);let E=m[1];E<n?n=E:E>a&&(a=E),h=m[0]}return[this.normLon(i),n,this.normLon(o),a]},multiPolygonToBbox(t){let e=null;for(let r of t){if(r.length===0)continue;let i=r[0];if(i.length<3)continue;let n=this.ringToBbox(i);e=e==null?n:this.union(e,n)}if(e==null)throw new Error("Invalid multipolygon");return e},bboxToMultiPolygon(t){let e=[t[0],t[1]],r=[t[2],t[1]],i=[t[0],t[3]],n=[t[2],t[3]];return t[0]<t[2]?[[[e,i,n,r,e]]]:[[[e,i,[180,n[1]],[180,r[1]],e]],[[n,r,[-180,e[1]],[-180,i[1]],n]]]}};var wC=[-180,-90,180,90],_C=[180,-90,360,90];function SC(t,e,r){return[e[0]+(r[0]-e[0])*t,e[1]+(r[1]-e[1])*t]}function xC(t){let e=[];for(let r of xm(t,wC))e.push(r);for(let r of xm(t,_C))e.push(r.map(i=>i.map(n=>[n[0]-360,n[1]])));return e}function zh(t,e,r=!0){let i=!1,n=!1,o=t.map(a=>a.map(h=>{let d=[];if(h.length===0)return d;let m=h[0],p=null,w=0;for(let E of h){let _=e(E),C=_[0];if(p!=null){let R=Si.crossesAM(w,C);if(R&&(i=!0,n=!n),n&&(C<0?_[0]=C+360:p[0]=w+360),R){let I=(180-_[0])/(p[0]-_[0]),A=e(SC(I,E,m));d.push([180,A[1]])}}d.push(_),m=E,p=_,w=C}return d}));return i&&r?xC(o):o}function EC(t){return{type:"Polygon",coordinates:t}}function uv(t,e={}){return{type:"Feature",geometry:EC(t),properties:e}}function hv(t,e={}){return{type:"Feature",geometry:{type:"MultiPolygon",coordinates:t},properties:e}}var Xo=ve(cv(),1);var fv=`PROJCS["NZGD2000 / Chatham Islands TM 2000",
139
+ ${Hu(e)}`}};function F_(t){if(t==null)return[];if(Array.isArray(t)){let e=[];for(let r of t)if(r!=null){if(typeof r=="string"||typeof r=="number"){e.push(new ms(String(r)));continue}e.push(r)}return e}else if(typeof t=="string"||typeof t=="number")return[new ms(String(t))];return[t]}function J(t,e,r){let i=typeof e=="object"&&!Array.isArray(e);if(!i){if(r!=null)throw new Error("Invalid input");r=e}return new zo(t,i?e:{},F_(r))}var F0;(function(t){t.aerial="aerial"})(F0||(F0={}));var n6=fe(Wm(),1),s6=fe(r6(),1);function i6(t){return[[[t[0],t[1]],[t[2],t[1]],[t[2],t[3]],[t[0],t[3]],[t[0],t[1]]]]}var{intersection:hS,union:o6}=s6.default;function fS(t,e){return t[0]===e[0]&&t[1]===e[1]}function dS(t,e){return hS(t,i6(e))}function Y0(t,e){let r=[];for(let i of t){let n=n6.default.polygon(i[0],e);n.length!==0&&(fS(n[0],n[n.length-1])||n.push(n[0]),r.push([n]))}return dS(r,e)}var v1=t=>(t<-360?t=-(-t%360):t>360&&(t=t%360),t<-180?360+t:t>180?t-360:t),gs=(t,e)=>{let r=e-t;return r>180?r-360:r<-180?r+360:r},pS=(t,e)=>v1(t+(e<t?e+360-t:e-t)),mi={boxLonCenter(t){return v1(t[0]+.5*(t[2]<t[0]?360+t[2]-t[0]:t[2]-t[0]))},delta:gs,crossesAM(t,e){return Math.sign(gs(t,e))!==Math.sign(e-t)},normLon:v1,normExtent(t){return[v1(t[0]),t[1],v1(t[2]),t[3]]},union(t,e){if(e==null)return t.slice();let r=mi.boxLonCenter(t),i=mi.boxLonCenter(e);if(gs(r,i)<0)return this.union(e,t);let n=t.slice(),s=pS(r,i);return gs(s,e[0])<gs(s,t[0])&&(n[0]=e[0]),gs(s,e[2])>gs(s,t[2])&&(n[2]=e[2]),e[1]<t[1]&&(n[1]=e[1]),e[3]>t[3]&&(n[3]=e[3]),n},intersects(t,e){if(t[1]>e[3]||e[1]>t[3])return!1;let r=t[0],i=e[0],n=r<t[2]?t[2]:t[2]+360,s=i<e[2]?e[2]:e[2]+360;return r<=s&&i<=n||r+360<=s&&i<=n+360||r<=s+360&&i+360<=n},ringToBbox(t){if(t.length<3)throw new Error("Invalid ring");let e=!1,r=t[0],i=r[0],n=r[1],s=i,a=n,c=i;for(let d=1;d<t.length;++d){let p=t[d],m=p[0];mi.crossesAM(c,m)&&(e=!e),e&&(m<0?m+=360:(c+=360,d===1&&(i=s=c))),m<i?i=m:m>s&&(s=m);let S=p[1];S<n?n=S:S>a&&(a=S),c=p[0]}return[this.normLon(i),n,this.normLon(s),a]},multiPolygonToBbox(t){let e=null;for(let r of t){if(r.length===0)continue;let i=r[0];if(i.length<3)continue;let n=this.ringToBbox(i);e=e==null?n:this.union(e,n)}if(e==null)throw new Error("Invalid multipolygon");return e},bboxToMultiPolygon(t){let e=[t[0],t[1]],r=[t[2],t[1]],i=[t[0],t[3]],n=[t[2],t[3]];return t[0]<t[2]?[[[e,i,n,r,e]]]:[[[e,i,[180,n[1]],[180,r[1]],e]],[[n,r,[-180,e[1]],[-180,i[1]],n]]]}};var mS=[-180,-90,180,90],gS=[180,-90,360,90];function yS(t,e,r){return[e[0]+(r[0]-e[0])*t,e[1]+(r[1]-e[1])*t]}function bS(t){let e=[];for(let r of Y0(t,mS))e.push(r);for(let r of Y0(t,gS))e.push(r.map(i=>i.map(n=>[n[0]-360,n[1]])));return e}function Zu(t,e,r=!0){let i=!1,n=!1,s=t.map(a=>a.map(c=>{let d=[];if(c.length===0)return d;let p=c[0],m=null,w=0;for(let S of c){let v=e(S),R=v[0];if(m!=null){let x=mi.crossesAM(w,R);if(x&&(i=!0,n=!n),n&&(R<0?v[0]=R+360:m[0]=w+360),x){let A=(180-v[0])/(m[0]-v[0]),C=e(yS(A,S,p));d.push([180,C[1]])}}d.push(v),p=S,m=v,w=R}return d}));return i&&r?bS(s):s}function vS(t){return{type:"Polygon",coordinates:t}}function a6(t,e={}){return{type:"Feature",geometry:vS(t),properties:e}}function l6(t,e={}){return{type:"Feature",geometry:{type:"MultiPolygon",coordinates:t},properties:e}}var qo=fe(u6(),1);var c6=`PROJCS["NZGD2000 / Chatham Islands TM 2000",
125
140
  GEOGCS["NZGD2000",
126
141
  DATUM["New_Zealand_Geodetic_Datum_2000",
127
142
  SPHEROID["GRS 1980",6378137,298.257222101,
@@ -143,7 +158,7 @@ PARAMETER["false_easting",3500000],
143
158
  PARAMETER["false_northing",10000000],
144
159
  AUTHORITY["EPSG","3793"],
145
160
  AXIS["Easting",EAST],
146
- AXIS["Northing",NORTH]]`;var dv=`PROJCS["NZGD2000 / New Zealand Transverse Mercator 2000",
161
+ AXIS["Northing",NORTH]]`;var h6=`PROJCS["NZGD2000 / New Zealand Transverse Mercator 2000",
147
162
  GEOGCS["NZGD2000",
148
163
  DATUM["New_Zealand_Geodetic_Datum_2000",
149
164
  SPHEROID["GRS 1980",6378137,298.257222101,
@@ -163,14 +178,13 @@ PARAMETER["false_easting",1600000],
163
178
  PARAMETER["false_northing",10000000],
164
179
  UNIT["metre",1,
165
180
  AUTHORITY["EPSG","9001"]],
166
- AUTHORITY["EPSG","2193"]]`;Xo.default.defs(Te.Nztm2000.toEpsgString(),dv);Xo.default.defs(Te.Citm2000.toEpsgString(),fv);var Rm=new Map;function MC(t){return t==null?null:typeof t=="number"?t:"code"in t?t.code:"projection"in t?t.projection.code:null}var Kr=class{constructor(e){this.epsg=e;try{this.projection=(0,Xo.default)(e.toEpsgString(),Te.Wgs84.toEpsgString())}catch(r){throw new st(`Failed to create projection: ${e.toEpsgString()}, ${Te.Wgs84.toEpsgString()}`,500,r)}}static define(e,r){if(Rm.get(e.code)!=null)throw new Error("Duplicate projection definition: "+e.toEpsgString());Xo.default.defs(e.toEpsgString(),r)}static get(e){let r=this.tryGet(e);if(r==null)throw new Error(`Invalid projection: ${e}`);return r}static tryGet(e){let r=MC(e);if(r==null)return null;let i=Rm.get(r);if(i!=null)return i;let n=Te.tryGet(r);return n==null||Xo.default.defs(n.toEpsgString())==null?null:(i=new Kr(n),Rm.set(r,i),i)}projectMultipolygon(e,r){if(r.epsg.code===this.epsg.code)return e;let{toWgs84:i}=this,{fromWgs84:n}=r;return e.map(o=>o.map(a=>a.map(h=>n(i(h)))))}get toWgs84(){return this.projection.forward}get fromWgs84(){return this.projection.inverse}boundsToWgs84BoundingBox(e){let r=this.toWgs84([e.x,e.y]),i=this.toWgs84([e.x+e.width,e.y+e.height]);return[r[0],r[1],i[0],i[1]]}boundsToGeoJsonFeature(e,r={}){let i=[e.x,e.y],n=[e.x+e.width,e.y],o=[e.x,e.y+e.height],a=[e.x+e.width,e.y+e.height],h=zh([[[i,o,a,n,i]]],this.toWgs84),d=h.length===1?uv(h[0],r):hv(h,r);return d.bbox=this.boundsToWgs84BoundingBox(e),d}toGeoJson(e){return{type:"FeatureCollection",features:e.map(r=>this.boundsToGeoJsonFeature(r,{name:r.name}))}}static getTiffResZoom(e,r,i=1){let n=0;for(;n<e.zooms.length;++n)if(e.pixelScale(n)<=r*i)return n;if(n===e.zooms.length)return n-1;throw new Error("ResZoom not found")}static tileToWgs84Bbox(e,r){let i=e.tileToSource(r),n=e.tileToSource({x:r.x+1,y:r.y+1,z:r.z}),o=this.get(e),[a,h]=o.toWgs84([i.x,n.y]),[d,m]=o.toWgs84([n.x,i.y]);return[a,h,d,m]}static tileCenterToLatLon(e,r){let i=e.tileToSource({x:r.x+.5,y:r.y+.5,z:r.z}),[n,o]=this.get(e).toWgs84([i.x,i.y]);return Kr.wrapLatLon(o,n)}static wrapLatLon(e,r){let i={lat:e,lon:r},n=Math.floor(Math.abs(e)/90)%4,o=e>0?90:-90,a=e%90;switch(n){case 0:i.lat=a;break;case 1:i.lat=o-a,i.lon+=180;break;case 2:i.lat=-a,i.lon+=180;break;case 3:i.lat=-o+a;break}return(i.lon>180||i.lon<-180)&&(i.lon-=Math.floor((i.lon+180)/360)*360),i}static findAlignmentLevels(e,r,i){return Math.max(0,this.getTiffResZoom(e,i,2)-r.z)}static getImagePixelWidth(e,r,i){let n=e.tileToSource(r),o=e.tileToSource({x:r.x+1,y:r.y+1,z:r.z});return Math.round((o.x-n.x)/e.pixelScale(i))*2}};function mv(t){return t==null||typeof t=="string"?!1:"roleArn"in t&&typeof t.roleArn=="string"}function Jo(t){return"promise"in t?t.promise():t}function Qo(t,e){return Di(t)?typeof t.statusCode!="number"?new st(e,500,t):new st(e,t.statusCode,t):new st(e,500,t)}var nr=class extends Nt{constructor(e,r,i){super(),this.type=nr.type,this.protocol="s3",this.chunkSize=nr.DefaultChunkSize,this.maxChunkCount=nr.DefaultMaxChunkCount,this.bucket=e,this.key=r,this.remote=i}get uri(){return this.name}get name(){return`s3://${this.bucket}/${this.key}`}static isSource(e){return e.type===nr.type}get size(){return this._size?this._size:(this._size=Promise.resolve().then(async()=>(await Jo(this.remote.headObject({Bucket:this.bucket,Key:this.key}))).ContentLength||-1),this._size)}static fromUri(e,r){let i=fi(e);return i==null||i.key==null||i.protocol!=="s3"?null:new nr(i.bucket,i.key,r)}async fetchBytes(e,r){let i=this.toRange(e,r);try{let n=await this.remote.getObject({Bucket:this.bucket,Key:this.key,Range:i}).promise();if(!Buffer.isBuffer(n.Body))throw new Error("Failed to fetch object, Body is not a buffer");n.ContentRange!=null&&this._size==null&&(this._size=Promise.resolve(this.parseContentRange(n.ContentRange)));let o=n.Body;return o.buffer.slice(o.byteOffset,o.byteOffset+o.byteLength)}catch(n){throw Qo(n,`Failed to fetch ${this.name} ${i}`)}}};nr.type="aws:s3";nr.DefaultChunkSize=64*1024;nr.DefaultMaxChunkCount=32;var sr=class{constructor(e){this.protocol=sr.protocol,this.s3=e}source(e){let r=nr.fromUri(e,this.s3);if(r==null)throw new Error(`Failed to create aws s3 source from uri: ${e}`);return r}static is(e){return e.protocol===sr.protocol}static isPath(e){return e==null?!1:e.startsWith("s3://")}async*list(e,r){for await(let i of this.details(e,r))yield i.path}async*details(e,r){let i=fi(e);if(i==null)return;let n,o=r?.recursive===!1?"/":void 0,a=i.bucket,h=i.key,d=0;try{for(;;){d++;let m=await Jo(this.s3.listObjectsV2({Bucket:a,Prefix:h,ContinuationToken:n,Delimiter:o}));if(m.CommonPrefixes!=null)for(let p of m.CommonPrefixes)p.Prefix!=null&&(yield{path:`s3://${a}/${p.Prefix}`,isDirectory:!0});if(m.Contents!=null)for(let p of m.Contents)p.Key!=null&&(yield{path:`s3://${a}/${p.Key}`,size:p.Size});if(!m.IsTruncated)break;if(d>=sr.MaxListCount)throw new Error(`Failed to finish listing within ${sr.MaxListCount} list attempts`);n=m.NextContinuationToken}}catch(m){throw Qo(m,`Failed to list: "${e}"`)}}async read(e){let r=fi(e);if(r==null||r.key==null)throw new Error(`Failed to read: "${e}"`);try{return(await this.s3.getObject({Bucket:r.bucket,Key:r.key}).promise()).Body}catch(i){throw Qo(i,`Failed to read: "${e}"`)}}async write(e,r,i){let n=fi(e);if(n==null||n.key==null)throw new Error(`Failed to write: "${e}"`);try{await Jo(this.s3.upload({Bucket:n.bucket,Key:n.key,Body:r,ContentEncoding:i?.contentEncoding,ContentType:i?.contentType}))}catch(o){throw Qo(o,`Failed to write: "${e}"`)}}exists(e){return this.head(e).then(r=>r!=null)}stream(e){let r=fi(e);if(r==null||r.key==null)throw new Error(`S3: Unable to read "${e}"`);return this.s3.getObject({Bucket:r.bucket,Key:r.key}).createReadStream()}async head(e){let r=fi(e);if(r==null||r.key==null)throw new Error(`Failed to exists: "${e}"`);try{return{size:(await Jo(this.s3.headObject({Bucket:r.bucket,Key:r.key}))).ContentLength,path:e}}catch(i){if(Di(i)&&i.code==="NotFound")return null;throw Qo(i,`Failed to exists: "${e}"`)}}};sr.protocol="s3";sr.MaxListCount=100;var pv=ve(require("aws-sdk/lib/core.js"),1),gv=ve(require("aws-sdk/clients/s3.js"),1);var vr=class{static fsFromRole(e,r,i){if(typeof e=="object")return vr.fsFromRole(e.roleArn,e.externalId,e.durationSeconds);let n=vr.role(e,r,i);return new sr(new gv.default({credentials:n}))}static role(e,r,i){i=i??vr.DefaultRoleDurationSeconds;let n=`role::${e}::${r}::${i}`,o=vr.cache.get(n);return o==null&&(o=new pv.default.ChainableTemporaryCredentials({params:{RoleArn:e,ExternalId:r,RoleSessionName:"fsa-"+Math.random().toString(32)+"-"+Date.now(),DurationSeconds:i}}),vr.cache.set(n,o)),o}};vr.DefaultRoleDurationSeconds=3600;vr.cache=new Map;var yv=ve(require("aws-sdk/clients/s3.js"),1),bv=require("util"),Fh=require("zlib");var RC=(0,bv.promisify)(Fh.gunzip),Ht=gt;Ht.readJson=async function(e){let r=await this.read(e);return e.endsWith(".gz")?JSON.parse((await RC(r)).toString()):JSON.parse(r.toString())};Ht.writeJson=async function(e,r){let i=Buffer.from(JSON.stringify(r,void 0,2));if(e.endsWith(".gz")){let n=(0,Fh.createGzip)();return n.end(i),this.write(e,n)}else return this.write(e,i)};Ht.configure=function(e){if(e.type!=="s3"||!mv(e))return;let r=fi(e.path);if(r==null)throw new Error("Failed to parse URI: "+e.path);let i=`s3://${r.bucket}/`;this.register(i,vr.fsFromRole(e.roleArn,e.externalId))};Ht.register("s3://",new sr(new yv.default));function bl(t){return t[0].toUpperCase()+t.slice(1).replace(/_(\d+)-(\d+)m/g," $1.$2m").replace(/_/g," ")}function vv(t){let e=/(?:^|\D)(\d{4})(?:-(\d{2}))?(?:$|\D)/g,r=[];for(let i=e.exec(t);i!=null;i=e.exec(t))r.push(parseInt(i[1])),i[2]!=null&&r.push(parseInt(i[1].slice(0,2)+i[2]));return r.length===0?[-1,-1]:(r.sort(),[r[0],r[r.length-1]+1])}process.env.AWS_NODEJS_CONNECTION_REUSE_ENABLED="1";nt.setConfigProvider(new Fa(Wo.TileMetadata.TableName));var wv=new te(200,"ok");wv.header(me.CacheControl,"no-store");async function _v(){return wv}async function Sv(){let t=new te(200,"ok");return t.header(me.CacheControl,"no-store"),t.json({version:"v6.29.0",hash:"9097d2f045d734d0d5acd968f026fe29ab6afcda"}),t}var Xm=ve(require("fs"),1),uc=ve(require("path"),1),Kv=ve(Av(),1),Jm=ve(require("sharp"),1),Yv=ve(require("url"),1);var Wh=ve(require("sharp"),1);function AC(t){return t!=null}var jh=new Map,Tn=class{constructor(e){this.tileSize=e}isTooLarge(e){return!!(e.resize&&(e.resize.width>=Tn.MaxImageSize||e.resize.height>=Tn.MaxImageSize))}getEmptyImage(e,r){let i=[e,r.r,r.g,r.b,r.alpha].join("-"),n=jh.get(i);return n||(n=this.toImage(e,this.createImage(r)),jh.size>128&&jh.clear(),jh.set(i,n),n)}toImage(e,r){switch(e){case Ge.Jpeg:return r.jpeg().toBuffer();case Ge.Png:return r.png().toBuffer();case Ge.Webp:return r.webp().toBuffer();case Ge.Avif:return r.avif().toBuffer();default:throw new Error(`Invalid image format "${e}"`)}}async getImageBuffer(e,r,i){return e.length===0?this.getEmptyImage(r,i):this.toImage(r,this.createImage(i).composite(e))}isDirectImage(e){var r;if(e.layers.length!==1)return!1;let i=e.layers[0];if(i.x!==0||i.y!==0||i.crop!=null||i.extract!=null||i.resize!=null)return!1;let n=i.tiff.getImage(i.source.imageId),o=n.tileSize;return!(o.height!==this.tileSize||o.width!==this.tileSize||!(!((r=n.compression)===null||r===void 0)&&r.includes(e.format))||e.background.alpha!==0)}async compose(e){var r;let i=(r=e.metrics)!==null&&r!==void 0?r:new us;if(i.start("compose:overlay"),this.isDirectImage(e)){let h=e.layers[0],d=await h.tiff.getTile(h.source.x,h.source.y,h.source.imageId);return i.end("compose:overlay"),d==null?{buffer:await this.getEmptyImage(e.format,e.background),metrics:i,layers:0}:(i.start("compose:direct"),i.end("compose:direct"),{buffer:Buffer.from(d.bytes),metrics:i,layers:1})}let n=[];for(let h of e.layers)this.isTooLarge(h)||n.push(this.composeTile(h,e.resizeKernel));let o=await Promise.all(n).then(h=>h.filter(AC));i.end("compose:overlay"),i.start("compose:compress");let a=await this.getImageBuffer(o,e.format,e.background);return i.end("compose:compress"),{buffer:a,metrics:i,layers:o.length}}async composeTile(e,r){let i=await e.tiff.getTile(e.source.x,e.source.y,e.source.imageId);if(i==null)return null;let n=(0,Wh.default)(Buffer.from(i.bytes)),{extract:o,resize:a,crop:h}=e;if(o&&n.extract({top:0,left:0,width:o.width,height:o.height}),a){let d={fit:Wh.default.fit.cover,kernel:a.scale>1?r.in:r.out};n.resize(a.width,a.height,d)}return h&&n.extract({top:h.y,left:h.x,width:h.width,height:h.height}),{input:await n.toBuffer(),top:e.y,left:e.x}}createImage(e){return(0,Wh.default)({create:{width:this.tileSize,height:this.tileSize,channels:4,background:e}})}};Tn.MaxImageSize=256*2**15;var Lr;(function(t){t.NONE="application/octet-stream",t.JPEG="image/jpeg",t.JP2="image/jp2",t.WEBP="image/webp",t.LZW="application/lzw",t.DEFLATE="application/deflate"})(Lr||(Lr={}));var Im={1:Lr.NONE,5:Lr.LZW,6:Lr.JPEG,7:Lr.JPEG,8:Lr.DEFLATE,34712:Lr.JP2,50001:Lr.WEBP};var ue;(function(t){t[t.Artist=315]="Artist",t[t.BitsPerSample=258]="BitsPerSample",t[t.CellLength=265]="CellLength",t[t.CellWidth=264]="CellWidth",t[t.ColorMap=320]="ColorMap",t[t.Compression=259]="Compression",t[t.Copyright=33432]="Copyright",t[t.DateTime=306]="DateTime",t[t.ExtraSamples=338]="ExtraSamples",t[t.FillOrder=266]="FillOrder",t[t.FreeByteCounts=289]="FreeByteCounts",t[t.FreeOffsets=288]="FreeOffsets",t[t.GrayResponseCurve=291]="GrayResponseCurve",t[t.GrayResponseUnit=290]="GrayResponseUnit",t[t.HostComputer=316]="HostComputer",t[t.ImageDescription=270]="ImageDescription",t[t.ImageHeight=257]="ImageHeight",t[t.ImageWidth=256]="ImageWidth",t[t.Make=271]="Make",t[t.MaxSampleValue=281]="MaxSampleValue",t[t.MinSampleValue=280]="MinSampleValue",t[t.Model=272]="Model",t[t.NewSubFileType=254]="NewSubFileType",t[t.Orientation=274]="Orientation",t[t.PhotometricInterpretation=262]="PhotometricInterpretation",t[t.PlanarConfiguration=284]="PlanarConfiguration",t[t.ResolutionUnit=296]="ResolutionUnit",t[t.RowsPerStrip=278]="RowsPerStrip",t[t.SamplesPerPixel=277]="SamplesPerPixel",t[t.Software=305]="Software",t[t.StripByteCounts=279]="StripByteCounts",t[t.StripOffsets=273]="StripOffsets",t[t.SubFileType=255]="SubFileType",t[t.Threshholding=263]="Threshholding",t[t.XResolution=282]="XResolution",t[t.YResolution=283]="YResolution",t[t.BadFaxLines=326]="BadFaxLines",t[t.CleanFaxData=327]="CleanFaxData",t[t.ClipPath=343]="ClipPath",t[t.ConsecutiveBadFaxLines=328]="ConsecutiveBadFaxLines",t[t.Decode=433]="Decode",t[t.DefaultImageColor=434]="DefaultImageColor",t[t.DocumentName=269]="DocumentName",t[t.DotRange=336]="DotRange",t[t.HalftoneHints=321]="HalftoneHints",t[t.Indexed=346]="Indexed",t[t.JPEGTables=347]="JPEGTables",t[t.PageName=285]="PageName",t[t.PageNumber=297]="PageNumber",t[t.Predictor=317]="Predictor",t[t.PrimaryChromaticities=319]="PrimaryChromaticities",t[t.ReferenceBlackWhite=532]="ReferenceBlackWhite",t[t.SampleFormat=339]="SampleFormat",t[t.SMinSampleValue=340]="SMinSampleValue",t[t.SMaxSampleValue=341]="SMaxSampleValue",t[t.StripRowCounts=559]="StripRowCounts",t[t.SubIFDs=330]="SubIFDs",t[t.T4Options=292]="T4Options",t[t.T6Options=293]="T6Options",t[t.TileByteCounts=325]="TileByteCounts",t[t.TileHeight=323]="TileHeight",t[t.TileOffsets=324]="TileOffsets",t[t.TileWidth=322]="TileWidth",t[t.TransferFunction=301]="TransferFunction",t[t.WhitePoint=318]="WhitePoint",t[t.XClipPathUnits=344]="XClipPathUnits",t[t.XPosition=286]="XPosition",t[t.YCbCrCoefficients=529]="YCbCrCoefficients",t[t.YCbCrPositioning=531]="YCbCrPositioning",t[t.YCbCrSubSampling=530]="YCbCrSubSampling",t[t.YClipPathUnits=345]="YClipPathUnits",t[t.YPosition=287]="YPosition",t[t.ApertureValue=37378]="ApertureValue",t[t.ColorSpace=40961]="ColorSpace",t[t.DateTimeDigitized=36868]="DateTimeDigitized",t[t.DateTimeOriginal=36867]="DateTimeOriginal",t[t.ExifIFD=34665]="ExifIFD",t[t.ExifVersion=36864]="ExifVersion",t[t.ExposureTime=33434]="ExposureTime",t[t.FileSource=41728]="FileSource",t[t.Flash=37385]="Flash",t[t.FlashpixVersion=40960]="FlashpixVersion",t[t.FNumber=33437]="FNumber",t[t.ImageUniqueID=42016]="ImageUniqueID",t[t.LightSource=37384]="LightSource",t[t.MakerNote=37500]="MakerNote",t[t.ShutterSpeedValue=37377]="ShutterSpeedValue",t[t.UserComment=37510]="UserComment",t[t.IPTC=33723]="IPTC",t[t.ICCProfile=34675]="ICCProfile",t[t.XMP=700]="XMP",t[t.GDAL_METADATA=42112]="GDAL_METADATA",t[t.GDAL_NODATA=42113]="GDAL_NODATA",t[t.Photoshop=34377]="Photoshop",t[t.ModelPixelScale=33550]="ModelPixelScale",t[t.ModelTiePoint=33922]="ModelTiePoint",t[t.ModelTransformation=34264]="ModelTransformation",t[t.GeoKeyDirectory=34735]="GeoKeyDirectory",t[t.GeoDoubleParams=34736]="GeoDoubleParams",t[t.GeoAsciiParams=34737]="GeoAsciiParams"})(ue||(ue={}));var vl;(function(t){t[t.GTModelTypeGeoKey=1024]="GTModelTypeGeoKey",t[t.GTRasterTypeGeoKey=1025]="GTRasterTypeGeoKey",t[t.GTCitationGeoKey=1026]="GTCitationGeoKey",t[t.GeographicTypeGeoKey=2048]="GeographicTypeGeoKey",t[t.GeogCitationGeoKey=2049]="GeogCitationGeoKey",t[t.GeogGeodeticDatumGeoKey=2050]="GeogGeodeticDatumGeoKey",t[t.GeogPrimeMeridianGeoKey=2051]="GeogPrimeMeridianGeoKey",t[t.GeogLinearUnitsGeoKey=2052]="GeogLinearUnitsGeoKey",t[t.GeogLinearUnitSizeGeoKey=2053]="GeogLinearUnitSizeGeoKey",t[t.GeogAngularUnitsGeoKey=2054]="GeogAngularUnitsGeoKey",t[t.GeogAngularUnitSizeGeoKey=2055]="GeogAngularUnitSizeGeoKey",t[t.GeogEllipsoidGeoKey=2056]="GeogEllipsoidGeoKey",t[t.GeogSemiMajorAxisGeoKey=2057]="GeogSemiMajorAxisGeoKey",t[t.GeogSemiMinorAxisGeoKey=2058]="GeogSemiMinorAxisGeoKey",t[t.GeogInvFlatteningGeoKey=2059]="GeogInvFlatteningGeoKey",t[t.GeogAzimuthUnitsGeoKey=2060]="GeogAzimuthUnitsGeoKey",t[t.GeogPrimeMeridianLongGeoKey=2061]="GeogPrimeMeridianLongGeoKey",t[t.GeogTOWGS84GeoKey=2062]="GeogTOWGS84GeoKey",t[t.ProjectedCSTypeGeoKey=3072]="ProjectedCSTypeGeoKey",t[t.PCSCitationGeoKey=3073]="PCSCitationGeoKey",t[t.ProjectionGeoKey=3074]="ProjectionGeoKey",t[t.ProjCoordTransGeoKey=3075]="ProjCoordTransGeoKey",t[t.ProjLinearUnitsGeoKey=3076]="ProjLinearUnitsGeoKey",t[t.ProjLinearUnitSizeGeoKey=3077]="ProjLinearUnitSizeGeoKey",t[t.ProjStdParallel1GeoKey=3078]="ProjStdParallel1GeoKey",t[t.ProjStdParallel2GeoKey=3079]="ProjStdParallel2GeoKey",t[t.ProjNatOriginLongGeoKey=3080]="ProjNatOriginLongGeoKey",t[t.ProjNatOriginLatGeoKey=3081]="ProjNatOriginLatGeoKey",t[t.ProjFalseEastingGeoKey=3082]="ProjFalseEastingGeoKey",t[t.ProjFalseNorthingGeoKey=3083]="ProjFalseNorthingGeoKey",t[t.ProjFalseOriginLongGeoKey=3084]="ProjFalseOriginLongGeoKey",t[t.ProjFalseOriginLatGeoKey=3085]="ProjFalseOriginLatGeoKey",t[t.ProjFalseOriginEastingGeoKey=3086]="ProjFalseOriginEastingGeoKey",t[t.ProjFalseOriginNorthingGeoKey=3087]="ProjFalseOriginNorthingGeoKey",t[t.ProjCenterLongGeoKey=3088]="ProjCenterLongGeoKey",t[t.ProjCenterLatGeoKey=3089]="ProjCenterLatGeoKey",t[t.ProjCenterEastingGeoKey=3090]="ProjCenterEastingGeoKey",t[t.ProjCenterNorthingGeoKey=3091]="ProjCenterNorthingGeoKey",t[t.ProjScaleAtNatOriginGeoKey=3092]="ProjScaleAtNatOriginGeoKey",t[t.ProjScaleAtCenterGeoKey=3093]="ProjScaleAtCenterGeoKey",t[t.ProjAzimuthAngleGeoKey=3094]="ProjAzimuthAngleGeoKey",t[t.ProjStraightVertPoleLongGeoKey=3095]="ProjStraightVertPoleLongGeoKey",t[t.ProjRectifiedGridAngleGeoKey=3096]="ProjRectifiedGridAngleGeoKey",t[t.VerticalCSTypeGeoKey=4096]="VerticalCSTypeGeoKey",t[t.VerticalCitationGeoKey=4097]="VerticalCitationGeoKey",t[t.VerticalDatumGeoKey=4098]="VerticalDatumGeoKey",t[t.VerticalUnitsGeoKey=4099]="VerticalUnitsGeoKey"})(vl||(vl={}));var Le;(function(t){t[t.BYTE=1]="BYTE",t[t.ASCII=2]="ASCII",t[t.SHORT=3]="SHORT",t[t.LONG=4]="LONG",t[t.RATIONAL=5]="RATIONAL",t[t.SBYTE=6]="SBYTE",t[t.UNDEFINED=7]="UNDEFINED",t[t.SSHORT=8]="SSHORT",t[t.SLONG=9]="SLONG",t[t.SRATIONAL=10]="SRATIONAL",t[t.FLOAT=11]="FLOAT",t[t.DOUBLE=12]="DOUBLE",t[t.LONG8=16]="LONG8",t[t.SLONG8=17]="SLONG8",t[t.IFD8=18]="IFD8"})(Le||(Le={}));var Ee;(function(t){t[t.UInt8=1]="UInt8",t[t.UInt16=2]="UInt16",t[t.UInt32=4]="UInt32",t[t.UInt64=8]="UInt64",t[t.Double=8]="Double",t[t.Float=4]="Float"})(Ee||(Ee={}));var Iv=2**32,IC=typeof setImmediate>"u"?setTimeout:setImmediate,Gt=()=>{throw new Error("Method not implemented.")},xi=class{constructor(){this.isLittleEndian=!0,this.delayMs=xi.DefaultDelayMs,this.maxChunkCount=10,this.chunks=xi.DefaultChunkCache(),this.blankFillCount=16,this.maxConcurrentRequests=50,this.toFetch=new Set,this.toFetchPromise=null,this.byteOffset=0,this.getFloat32=Gt,this.getFloat64=Gt,this.getInt8=Gt,this.getInt16=Gt,this.getInt32=Gt,this.setFloat32=Gt,this.setFloat64=Gt,this.setInt8=Gt,this.setInt16=Gt,this.setInt32=Gt,this.setUint8=Gt,this.setUint16=Gt,this.setUint32=Gt,this.setBigInt64=Gt,this.setBigUint64=Gt}static getByteRanges(e,r=32,i=16){if(e.size===0)return{chunks:[],blankFill:[]};let n=[...e.values()].sort((d,m)=>d-m),o=[],a=[];o.push(a);let h=[];for(let d=0;d<n.length;++d){let m=n[d],p=n[d-1];if(a.length>=r)a=[m],o.push(a);else if(d===0||m===p+1)a.push(m);else if(m<p+i){for(let w=p;w<m;w++)a.push(w+1),h.push(w+1);h.pop()}else a=[m],o.push(a)}return{chunks:o,blankFill:h}}async fetchData(){if(this.toFetch.size===0)return;let e=this.toFetch;this.toFetch=new Set,this.toFetchPromise=null;let r=xi.getByteRanges(e,this.maxChunkCount,this.blankFillCount),i=[];for(let n of r.chunks){let o=n[0],a=n[n.length-1],h=o*this.chunkSize,d=a*this.chunkSize+this.chunkSize-h,m=await this.fetchBytes(h,d);if(n.length===1){i[o]=m,this.chunks.set(o,new DataView(m));continue}let p=o*this.chunkSize;for(let w of n){let E=w*this.chunkSize-p,_=m.slice(E,E+this.chunkSize);i[w]=_,this.chunks.set(w,new DataView(_))}}}async loadBytes(e,r){if(e<0)throw new Error("Offset must be positive");let i=Math.floor(e/this.chunkSize),n=Math.ceil((e+r)/this.chunkSize)-1;for(let o=i;o<=n;o++)this.chunks.has(o)||this.toFetch.add(o);if(this.toFetch.size!==0){if(this.toFetchPromise==null&&(this.toFetchPromise=new Promise(o=>IC(o,this.delayMs)).then(()=>this.fetchData())),this.toFetch.size>this.maxConcurrentRequests)throw new Error("Too many outstanding requests");await this.toFetchPromise}}getChunkId(e){return Math.floor(e/this.chunkSize)}getUint(e,r){switch(r){case Ee.UInt8:return this.getUint8(e);case Ee.UInt16:return this.getUint16(e);case Ee.UInt32:return this.getUint32(e);case Ee.UInt64:return this.getUint64(e)}}bytes(e,r){let i=this.isOneChunk(e,r);if(i){let m=this.getView(i),p=e-i*this.chunkSize;return new Uint8Array(m.buffer.slice(p,p+r))}let n=new Uint8Array(r),o=e+r,a=Math.floor(e/this.chunkSize),h=Math.ceil((e+r)/this.chunkSize)-1,d=0;for(let m=a;m<=h;m++){let p=e+d,w=m*this.chunkSize,E=this.getView(m),_=Math.min(o,w+this.chunkSize),C=E.buffer.slice(p-w,_-w);n.set(new Uint8Array(C),d),d+=C.byteLength}return n}getView(e){let r=this.chunks.get(e);if(r==null)throw new Error(`Chunk:${e} is not ready`);return r}isOneChunk(e,r){let i=e+r-1,n=Math.floor(e/this.chunkSize);return Math.floor(i/this.chunkSize)-n<1?n:null}hasBytes(e,r=1){let i=Math.floor(e/this.chunkSize),n=Math.ceil((e+r)/this.chunkSize)-1;for(let o=i;o<=n;o++)if(!this.chunks.has(o))return!1;return!0}toRange(e,r){if(r==null)return`bytes=${e}`;if(e<0)throw new Error("Cannot read from remote source with negative offset and length");return`bytes=${e}-${e+r}`}parseContentRange(e){let[r,i]=e.split(" ");if(r!=="bytes")throw new Error("Failed to parse content-range: "+e);if(i==null)throw new Error("Failed to parse content-range: "+e);let[,n]=i.split("/"),o=Number(n);if(isNaN(o))throw new Error("Failed to parse content-range: "+e);return o}get buffer(){throw new Error("Method not implemented.")}get byteLength(){if(this._byteLength)return this._byteLength;throw Error(".size() has not been fetched.")}getUint8(e){let r=Math.floor(e/this.chunkSize),i=this.chunks.get(r);if(i==null)throw new Error(`Chunk:${r} is not ready`);return i.getUint8(e-r*this.chunkSize)}getUint16(e){let r=this.isOneChunk(e,Ee.UInt16);if(r!=null)return this.getView(r).getUint16(e-r*this.chunkSize,this.isLittleEndian);let i=this.getUint8(e),n=this.getUint8(e+Ee.UInt8);return this.isLittleEndian?i+(n<<8):(i<<8)+n}getUint32(e){let r=this.isOneChunk(e,Ee.UInt32);if(r!=null)return this.getView(r).getUint32(e-r*this.chunkSize,this.isLittleEndian);let i=this.getUint16(e),n=this.getUint16(e+Ee.UInt16);return this.isLittleEndian?i+n*65536:i*65536+n}getUint64(e){let r=this.isOneChunk(e,Ee.UInt64);if(r!=null){let o=this.getView(r);return Number(o.getBigUint64(e-r*this.chunkSize,this.isLittleEndian))}let i=this.getUint32(e),n=this.getUint32(e+Ee.UInt32);return this.isLittleEndian?i+n*Iv:i*Iv+n}getBigUint64(e){let r=this.isOneChunk(e,Ee.UInt64);if(r!=null)return this.getView(r).getBigUint64(e-r*this.chunkSize,this.isLittleEndian);let i=BigInt(this.getUint32(e)),n=BigInt(this.getUint32(e+Ee.UInt32));return this.isLittleEndian?i+(n<<BigInt(32)):(i<<BigInt(32))+n}getBigInt64(){throw new Error("Not implemented.")}};xi.DefaultChunkCache=()=>new Map;xi.DefaultDelayMs=1;var Pv=ve(Om(),1);function Ov(t){switch(t){case Le.BYTE:case Le.ASCII:case Le.SBYTE:case Le.UNDEFINED:return 1;case Le.SHORT:case Le.SSHORT:return 2;case Le.LONG:case Le.SLONG:case Le.FLOAT:return 4;case Le.RATIONAL:case Le.SRATIONAL:case Le.DOUBLE:case Le.LONG8:case Le.SLONG8:case Le.IFD8:return 8;default:throw new Error(`Invalid fieldType ${t}`)}}var As={char:(t,e)=>String.fromCharCode(t.getUint8(e)),uint8:(t,e)=>t.getUint8(e),uint16:(t,e)=>t.getUint16(e),uint32:(t,e)=>t.getUint32(e),uint64:(t,e)=>t.getUint64(e),double:(t,e)=>Pv.read(t.bytes(e,Ee.Double),0,t.isLittleEndian,52,8),rational:(t,e)=>[t.getUint32(e),t.getUint32(e+4)]};function $h(t){switch(t){case Le.ASCII:return As.char;case Le.BYTE:case Le.UNDEFINED:case Le.SBYTE:return As.uint8;case Le.SHORT:case Le.SSHORT:return As.uint16;case Le.LONG:case Le.SLONG:return As.uint32;case Le.RATIONAL:case Le.SRATIONAL:return As.rational;case Le.DOUBLE:return As.double;case Le.LONG8:return As.uint64;default:throw new Error(`Unknown read type "${t}" "${Le[t]}"`)}}var An=class{constructor(e,r,i){this.tiff=r,this.byteOffset=i,this.id=e,this.name=ue[this.id],this.dataType=this.tiff.source.getUint16(i+2),this.dataCount=this.tiff.source.getUint(i+4,this.tiff.ifdConfig.pointer),this.dataTypeSize=Ov(this.dataType),this.dataLength=this.dataTypeSize*this.dataCount}get hasBytes(){return this.tiff.source.hasBytes(this.valuePointer,this.dataLength)}get isReady(){return!0}get dataTypeName(){return Le[this.dataType]}get valuePointer(){let e=this.size-this.tiff.ifdConfig.pointer;return this.isValueInline?this.byteOffset+e:this.tiff.source.getUint(this.byteOffset+e,this.tiff.ifdConfig.pointer)}get size(){return this.tiff.ifdConfig.ifd}get isValueInline(){return this.dataLength<=this.tiff.ifdConfig.pointer}readValue(){let e=this.valuePointer,r=this.dataTypeSize,i=$h(this.dataType),n=this.dataCount,o=n*r;if(n===1)return i(this.tiff.source,e);let a=[];for(let h=0;h<o;h+=r)a.push(i(this.tiff.source,e+h));return this.dataType===Le.ASCII?a.join("").trim():a}toJSON(){return{id:this.id,name:this.name,offset:this.byteOffset,isReady:this.isReady,type:this.dataTypeName,value:this.value}}};var Is=class extends An{constructor(){super(...arguments),this.value=null}get isReady(){return this.value!=null}async fetch(){return this.tiff.source.hasBytes(this.valuePointer,this.dataLength)===!1&&await this.tiff.source.loadBytes(this.valuePointer,this.dataLength),this.value=this.readValue(),this.value}};var wl=class extends An{constructor(e,r,i){super(e,r,i),this.loadedValues=null}get value(){return this.loadedValues!=null?this.loadedValues:this.hasBytes?(this.readValue(),this.loadedValues):null}async load(){await this.tiff.source.loadBytes(this.valuePointer,this.dataLength),this.readValue()}readValue(){let e=super.readValue();return typeof e=="number"?this.loadedValues=[e]:this.loadedValues=e,this.loadedValues}async getValueAt(e){if(this.loadedValues)return this.loadedValues[e];let r=this.dataTypeSize,i=this.valuePointer+r*e,n=$h(this.dataType);return this.tiff.source.hasBytes(i,r)||await this.tiff.source.loadBytes(i,r),n(this.tiff.source,i)}};var _l=class extends An{constructor(){super(...arguments),this._isRead=!1,this._value=null}get value(){return this._isRead===!1&&(this._value=this.readValue(),this._isRead=!0),this._value}};var qh={create(t,e){let r=t.source.getUint16(e);if(r===ue.TileOffsets||r===ue.TileByteCounts||r===ue.StripByteCounts||r===ue.StripOffsets)return new wl(r,t,e);let i=new _l(r,t,e);return i.hasBytes?i:new Is(r,t,e)},isStatic(t){return t instanceof _l},isLazy(t){return t instanceof Is},isOffsetArray(t){return t instanceof wl}};var PC=32767,Hh=class{constructor(e,r,i){this.tagsGeoLoaded=!1,this.tagsGeo=new Map,this.tif=e,this.id=r,this.tags=i}async init(e=!1){let r=[this.fetch(ue.Compression),this.fetch(ue.ImageHeight),this.fetch(ue.ImageWidth),this.fetch(ue.ModelPixelScale),this.fetch(ue.ModelTiePoint),this.fetch(ue.ModelTransformation),this.fetch(ue.TileHeight),this.fetch(ue.TileWidth)];e&&(r.push(this.fetch(ue.GeoKeyDirectory)),r.push(this.fetch(ue.GeoAsciiParams)),r.push(this.fetch(ue.GeoDoubleParams))),await Promise.all(r),e&&await this.loadGeoTiffTags()}value(e){let r=this.tags.get(e);return r==null?null:r.value}async loadGeoTiffTags(){if(this.tagsGeoLoaded)return;let e=this.tags.get(ue.GeoKeyDirectory);if(e==null){this.tagsGeoLoaded=!0;return}if(!e.isReady&&e instanceof Is&&await Promise.all([this.fetch(ue.GeoKeyDirectory),this.fetch(ue.GeoAsciiParams),this.fetch(ue.GeoDoubleParams)]),this.tagsGeoLoaded=!0,e.value==null)return;let r=e.value;if(!Array.isArray(r))throw new Error("Invalid geo tags found");for(let i=4;i<=r[3]*4;i+=4){let n=r[i],o=r[i+1],a=r[i+3];if(o===0){this.tagsGeo.set(n,a);continue}let h=this.tags.get(o);if(h==null||h.value==null)continue;let d=r[i+2];Array.isArray(h.value)?this.tagsGeo.set(n,h.value[a+d-1]):typeof h.value=="string"&&this.tagsGeo.set(n,h.value.substr(a,a+d-1).trim())}}valueGeo(e){if(this.tagsGeoLoaded===!1)throw new Error("loadGeoTiffTags() has not been called");return this.tagsGeo.get(e)}async fetch(e){let r=this.tags.get(e);return r==null?null:qh.isLazy(r)?r.fetch():r.value}get origin(){let e=this.value(ue.ModelTiePoint);if(e!=null&&e.length===6)return[e[3],e[4],e[5]];let r=this.value(ue.ModelTransformation);if(r!=null)return[r[3],r[7],r[11]];if(this.value(ue.NewSubFileType)===1&&this.id!==0)return this.tif.images[0].origin;throw new Error("Image does not have a geo transformation.")}get isGeoLocated(){return this.value(ue.ModelPixelScale)!=null||this.value(ue.ModelTransformation)!=null?!0:this.value(ue.NewSubFileType)===1&&this.id!==0?this.tif.images[0].isGeoLocated:!1}get resolution(){let e=this.value(ue.ModelPixelScale);if(e!=null)return[e[0],-e[1],e[2]];let r=this.value(ue.ModelTransformation);if(r!=null)return[r[0],r[5],r[10]];if(this.value(ue.NewSubFileType)===1&&this.id!==0){let i=this.tif.images[0],[n,o,a]=i.resolution,h=i.size,d=this.size;return[n*h.width/d.width,o*h.height/d.height,a]}throw new Error("Image does not have a geo transformation.")}get bbox(){let e=this.size,r=this.origin,i=this.resolution;if(r==null||e==null||i==null)throw new Error("Unable to calculate bounding box");let n=r[0],o=r[1],a=n+i[0]*e.width,h=o+i[1]*e.height;return[Math.min(n,a),Math.min(o,h),Math.max(n,a),Math.max(o,h)]}get compression(){let e=this.value(ue.Compression);return e==null||typeof e!="number"?null:Im[e]}get epsg(){let e=this.valueGeo(vl.ProjectedCSTypeGeoKey);return e===PC?null:e}get size(){return{width:this.value(ue.ImageWidth),height:this.value(ue.ImageHeight)}}get tagList(){return[...this.tags.keys()].map(e=>ue[e])}isTiled(){return this.value(ue.TileWidth)!==null}get tileSize(){return{width:this.value(ue.TileWidth),height:this.value(ue.TileHeight)}}get tileCount(){let e=this.size,r=this.tileSize,i=Math.ceil(e.width/r.width),n=Math.ceil(e.height/r.height);return{x:i,y:n}}get tileOffset(){let e=this.tags.get(ue.TileOffsets);if(e==null)throw new Error("No tile offsets found");return e}get stripCount(){let e=this.tags.get(ue.StripByteCounts);return e==null?0:e.dataCount}async getTileOffset(e){let r=this.tileOffset;if(e<0||e>r.dataCount)throw new Error(`Tile offset: ${e} out of range: 0 -> ${r.dataCount}`);return r.getValueAt(e)}getTileBounds(e,r){let{size:i,tileSize:n}=this,o=r*n.height,a=e*n.width,h=a+n.width>=i.width?i.width-a:n.width,d=o+n.height>=i.height?i.height-o:n.height;return{x:a,y:o,width:h,height:d}}async getStrip(e){if(this.isTiled())throw new Error("Cannot read stripes, tiff is tiled");let r=this.tags.get(ue.StripByteCounts),i=this.tags.get(ue.StripOffsets);if(e>=r.dataCount)throw new Error("Cannot read strip, index out of bounds");let[n,o]=await Promise.all([i.getValueAt(e),r.getValueAt(e)]);return this.getBytes(n,o)}getJpegHeader(e){let r=this.value(ue.JPEGTables);if(r==null)throw new Error("Unable to find Jpeg header");let i=r.slice(0,r.length-2),n=new Uint8Array(e.byteLength+i.length-2);return n.set(i,0),n.set(e.slice(2),i.length),n}async getBytes(e,r){let i=this.compression;if(i==null)throw new Error("Unsupported compression: "+this.value(ue.Compression));if(r===0)return null;await this.tif.source.loadBytes(e,r);let n=this.tif.source.bytes(e,r);return this.compression===Lr.JPEG?{mimeType:i,bytes:this.getJpegHeader(n)}:{mimeType:i,bytes:n}}async getTile(e,r){let i=this.compression,n=this.size,o=this.tileSize;if(o==null)throw new Error("Tiff is not tiled");if(i==null)throw new Error("Unsupported compression: "+this.value(ue.Compression));let a=Math.ceil(n.height/o.height),h=Math.ceil(n.width/o.width);if(e>=h||r>=a)throw new Error(`Tile index is outside of range x:${e} >= ${h} or y:${r} >= ${a}`);let d=r*h+e,m=h*a;if(d>=m)throw new Error(`Tile index is outside of tile range: ${d} >= ${m}`);let{offset:p,imageSize:w}=await this.getTileSize(d);return this.getBytes(p,w)}async getTileSize(e){if(this.tif.options.tileLeaderByteSize){let o=await this.getTileOffset(e);if(o===0)return{offset:0,imageSize:0};let a=this.tif.options.tileLeaderByteSize;return await this.tif.source.loadBytes(o-a,a),{offset:o,imageSize:this.tif.source.getUint(o-a,a)}}let r=this.tags.get(ue.TileByteCounts);if(r==null)throw new Error("No tile byte counts found");let[i,n]=await Promise.all([this.getTileOffset(e),r.getValueAt(e)]);return{offset:i,imageSize:n}}};var Sl;(function(t){t[t.Big=19789]="Big",t[t.Little=18761]="Little"})(Sl||(Sl={}));var Dr;(function(t){t[t.BigTiff=43]="BigTiff",t[t.Tiff=42]="Tiff"})(Dr||(Dr={}));var km="__reverse";function kv(t,e){if(t[km]==null){let r={};for(let i of Object.keys(t)){let n=t[i];r[n]=i}Object.defineProperty(t,km,{enumerable:!1,value:r,writable:!1})}return t[km][e]}var In;(function(t){t.GDAL_STRUCTURAL_METADATA_SIZE="GDAL_STRUCTURAL_METADATA_SIZE",t.LAYOUT="LAYOUT",t.BLOCK_ORDER="BLOCK_ORDER",t.BLOCK_LEADER="BLOCK_LEADER",t.BLOCK_TRAILER="BLOCK_TRAILER",t.KNOWN_INCOMPATIBLE_EDITION="KNOWN_INCOMPATIBLE_EDITION",t.MASK_INTERLEAVED_WITH_IMAGERY="MASK_INTERLEAVED_WITH_IMAGERY"})(In||(In={}));var Nm;(function(t){t.RowMajor="ROW_MAJOR"})(Nm||(Nm={}));var Lm;(function(t){t.uint32="SIZE_AS_UINT4"})(Lm||(Lm={}));var OC={uint32:Ee.UInt32},Gh=class{constructor(){this.options=new Map}get isCogOptimized(){return this.isBroken?!1:this.options.get(In.LAYOUT)==="IFDS_BEFORE_DATA"}get isBroken(){return this.options.get(In.KNOWN_INCOMPATIBLE_EDITION)==="YES"}set(e,r){this.options.set(e,r)}process(e,r,i){let n=[];for(let a=r;a<r+i;a++){let h=e.getUint8(a);h!==0&&n.push(String.fromCharCode(h))}let o=n.join("").trim().split(`
167
- `).map(a=>a.split("="));for(let[a,h]of o)this.options.set(In[a],h)}_getReverse(e,r){let i=this.options.get(r);return i==null?null:kv(e,i)}get tileOrder(){return this._getReverse(Nm,In.BLOCK_ORDER)}get tileLeader(){return this._getReverse(Lm,In.BLOCK_LEADER)}get tileLeaderByteSize(){return this.tileLeader==null?null:OC[this.tileLeader]}get isMaskInterleaved(){return this.options.get(In.MASK_INTERLEAVED_WITH_IMAGERY)==="YES"}};var Dm={version:Dr.Tiff,pointer:Ee.UInt32,offset:Ee.UInt16,ifd:Ee.UInt16+Ee.UInt16+2*Ee.UInt32},Bm={version:Dr.BigTiff,pointer:Ee.UInt64,offset:Ee.UInt64,ifd:Ee.UInt16+Ee.UInt16+2*Ee.UInt64},Ak={[Dr.BigTiff]:Bm,[Dr.Tiff]:Dm};var zm=ve(Om(),1),Vh=class{constructor(e,r=0){this.tiff=e,this.byteOffset=r,this.relativeOffset=0}get currentOffset(){return this.byteOffset+this.relativeOffset}seekTo(e){return this.byteOffset=e,this.relativeOffset=0,this}seek(e){let r=this.currentOffset;return this.relativeOffset+=e,r}bytes(e){return this.tiff.source.bytes(this.seek(e),e)}uint(e){return this.tiff.source.getUint(this.seek(e),e)}uint8(){return this.tiff.source.getUint8(this.seek(Ee.UInt8))}uint16(){return this.tiff.source.getUint16(this.seek(Ee.UInt16))}uint32(){return this.tiff.source.getUint32(this.seek(Ee.UInt32))}uint64(){return this.tiff.source.getUint64(this.seek(Ee.UInt64))}pointer(){let e=this.tiff.ifdConfig.pointer;return this.tiff.source.getUint(this.seek(e),e)}offset(){let e=this.tiff.ifdConfig.offset;return this.tiff.source.getUint(this.seek(e),e)}float(){return zm.read(this.bytes(Ee.Float),0,this.tiff.source.isLittleEndian,23,4)}double(){return zm.read(this.bytes(Ee.Double),0,this.tiff.source.isLittleEndian,52,8)}};function Nv(t,e=4,r=!0){let i=t.toString(16).padStart(e,"0");return r?"0x"+i:i}var ea=class{constructor(e){this.version=Dr.Tiff,this.images=[],this.options=new Gh,this.ifdConfig=Dm,this.isInitialized=!1,this.source=e,this.cursor=new Vh(this)}static create(e){return new ea(e).init()}init(e=!1){return this._initPromise?this._initPromise:(this._initPromise=this.doInit(e),this._initPromise)}async doInit(e=!1){return this.isInitialized?this:(await this.source.loadBytes(0,this.source.chunkSize),await this.fetchIfd(),await Promise.all(this.images.map(r=>r.init(e))),this.isInitialized=!0,this)}async fetchIfd(){let e=this.cursor.seekTo(0),r=e.uint16();if(this.source.isLittleEndian=r===Sl.Little,!this.source.isLittleEndian)throw new Error("Only little endian is supported");this.version=e.uint16();let i;if(this.version===Dr.BigTiff){if(this.ifdConfig=Bm,e.uint16()!==8)throw new Error("Only 8byte pointers are supported");if(e.uint16()!==0)throw new Error("Invalid big tiff header");i=e.pointer()}else if(this.version===Dr.Tiff)i=e.pointer();else throw new Error(`Only tiff supported version:${this.version}`);let n=i-this.cursor.currentOffset;return n>0&&n<16*1024,this.processIfd(i)}getImage(e){return this.images[e]}getImageByResolution(e){let r=this.images[0],i=r.size,[n]=r.resolution,o=n*i.width;for(let a=this.images.length-1;a>0;a--){let h=this.images[a],d=h.size;if(o/d.width-e<=.01)return h}return r}async getTile(e,r,i){let n=this.getImage(i);if(n==null)throw new Error(`Missing z: ${i}`);if(!n.isTiled())throw new Error("Tif is not tiled");return n.getTile(e,r)}async processIfd(e){this.source.hasBytes(e,4096)||await this.source.loadBytes(e,4096);let{image:r,nextOffset:i}=await this.readIfd(e);this.images.push(r),i&&await this.processIfd(i)}async readIfd(e){this.source.hasBytes(e,1024)||await this.source.loadBytes(e,this.source.chunkSize);let i=this.cursor.seekTo(e).offset(),n=e+this.ifdConfig.offset,o=new Map,a=n;for(let m=0;m<i;m++){let p=qh.create(this,a);if(a+=p.size,p.name==null)throw new Error("Unknown IFD Tag: "+Nv(p.id));o.set(p.id,p)}let h=new Hh(this,this.images.length,o);return{nextOffset:this.source.getUint(a,this.ifdConfig.pointer),image:h}}async close(){var e,r;await((r=(e=this.source)===null||e===void 0?void 0:e.close)===null||r===void 0?void 0:r.call(e))}};var Fm=class{constructor(e){vf(this,"value");vf(this,"next");this.value=e}},Ei,Ps,Os,xl=class{constructor(){Ct(this,Ei,void 0);Ct(this,Ps,void 0);Ct(this,Os,void 0);this.clear()}enqueue(e){let r=new Fm(e);ke(this,Ei)?(ke(this,Ps).next=r,it(this,Ps,r)):(it(this,Ei,r),it(this,Ps,r)),wf(this,Os)._++}dequeue(){let e=ke(this,Ei);if(!!e)return it(this,Ei,ke(this,Ei).next),wf(this,Os)._--,e.value}clear(){it(this,Ei,void 0),it(this,Ps,void 0),it(this,Os,0)}get size(){return ke(this,Os)}*[Symbol.iterator](){let e=ke(this,Ei);for(;e;)yield e.value,e=e.next}};Ei=new WeakMap,Ps=new WeakMap,Os=new WeakMap;function Um(t){if(!((Number.isInteger(t)||t===Number.POSITIVE_INFINITY)&&t>0))throw new TypeError("Expected `concurrency` to be a number from 1 and up");let e=new xl,r=0,i=()=>{r--,e.size>0&&e.dequeue()()},n=async(h,d,m)=>{r++;let p=(async()=>h(...m))();d(p);try{await p}catch{}i()},o=(h,d,m)=>{e.enqueue(n.bind(void 0,h,d,m)),(async()=>(await Promise.resolve(),r<t&&e.size>0&&e.dequeue()()))()},a=(h,...d)=>new Promise(m=>{o(h,m,d)});return Object.defineProperties(a,{activeCount:{get:()=>r},pendingCount:{get:()=>e.size},clearQueue:{value:()=>{e.clear()}}}),a}var Ie=new te(404,"Not Found"),Pn=new te(304,"Not modified");var Lv=require("crypto");var Dv=require("path"),Yr={RenderId:1,key(t){return(0,Lv.createHash)("sha256").update(JSON.stringify(t)).digest("base64")},generate(t,e){let r=t.map(n=>({...n,tiff:(0,Dv.basename)(n.tiff.source.uri)})),i={...e,tileMatrix:e.tileMatrix.identifier};return Yr.key({xyz:i,layers:r,RenderId:Yr.RenderId})},isNotModified(t,e){let r=t.header(me.IfNoneMatch);return r!=null&&r.indexOf(e)>-1?(t.set("cache",{key:e,hit:!0,match:r}),!0):!1}};var jm=class{constructor(){this.requests=[]}reset(){this.requests=[]}trace(e){let r=e.fetchBytes;e.fetchBytes=async(i,n)=>{let o={source:e.uri,offset:i,length:n};this.requests.push(o);let a=Date.now(),h=await r.apply(e,[i,n]);return o.duration=Date.now()-a,h}}},On=new jm;var Vt=class{static get(e){let r=Vt.cacheA.get(e);if(r)return r;let i=Vt.cacheB.get(e);return i==null?null:(Vt.cacheA.set(e,i),Vt.cacheB.delete(e),i)}static clear(){this.cacheA.clear(),this.cacheB.clear()}static set(e,r){Vt.cacheA.set(e,r),Vt.check()}static check(){Vt.MaxCacheSizeBytes<=0||Vt.currentSize<=Vt.MaxCacheSizeBytes||(Vt.cacheB=Vt.cacheA,Vt.cacheA=new Map)}static get currentSize(){let e=0;for(let r of Vt.cacheA.values())e+=r.source.chunkSize*r.source.chunks.size;return e}},kn=Vt;kn.cacheA=new Map,kn.cacheB=new Map,kn.MaxCacheSizeBytes=256*1024*1024;var kC=Um(ct.getNumber(ct.TiffConcurrency,25)),NC=new Tn(256),LC={in:"lanczos3",out:"lanczos3"},DC={r:0,g:0,b:0,alpha:0};function BC(t){return t.endsWith(".tif")||t.endsWith(".tiff")?t:`${t}.tiff`}var ta=class{constructor(e,r){this.type=dt.Raster;this.components=Ut.parse(e),this.tileMatrix=r,this.tiler=new Yo(this.tileMatrix)}get id(){return Tt.id(this.fullName,this.tileMatrix)}get fullName(){return Ut.componentsToName(this.components)}get title(){return this.tileSet?.title??this.components.name}get description(){return this.tileSet?.description??""}get extent(){return this.extentOverride??this.tileMatrix.extent}get format(){return this.tileSet.format??Ge.Webp}async init(e){this.tileSet=e,this.imagery=await nt.getAllImagery(this.tileSet.layers,this.tileMatrix.projection)}async initTiffs(e,r){let i=this.getTiffsForTile(e,r),n=!1,o=i.map(a=>kC(async()=>{try{await a.init()}catch(h){r.warn({error:h,tiff:a.source.uri},"TiffLoadFailed"),n=!0}}));return await Promise.all(o),n?i.filter(a=>a.images.length>0):i}async tile(e,r){if(r.ext===gr.MapboxVectorTiles)return Ie;let i=await this.initTiffs(r,e.log),n=await this.tiler.tile(i,r.x,r.y,r.z),o=Yr.generate(n,r);if(e.set("layers",n.length),Yr.isNotModified(e,o))return Pn;let a=await NC.compose({layers:n,format:r.ext,background:this.tileSet.background??DC,resizeKernel:this.tileSet.resizeKernel??LC,metrics:e.timer});e.set("layersUsed",a.layers),e.set("bytes",a.buffer.byteLength);let h=new te(200,"ok");return h.header(me.ETag,o),h.header(me.CacheControl,"public, max-age=604800"),h.buffer(a.buffer,"image/"+r.ext),h}getTiffsForTile(e,r){let i=[],n=this.tileMatrix.tileToSourceBounds(e),o=Ot.convertZoomLevel(e.z,this.tileMatrix,ci.get(Te.Google));for(let a of this.tileSet.layers){if(a.maxZoom!=null&&o>a.maxZoom||a.minZoom!=null&&o<a.minZoom)continue;let h=a[this.tileMatrix.projection.code];if(h==null){r?.warn({layer:a.name,projection:this.tileMatrix.projection.code},"Failed to lookup imagery");continue}let d=this.imagery.get(h);if(d==null){r?.warn({layer:a.name,projection:this.tileMatrix.projection.code,imgId:h},"Failed to lookup imagery");continue}if(!!n.intersects(Fe.fromJson(d.bounds)))for(let m of this.getCogsForTile(d,n))i.push(m)}return i}getCogsForTile(e,r){let i=[];for(let n of e.files){if(!r.intersects(Fe.fromJson(n)))continue;let o=Ht.join(e.uri,BC(n.name)),a=kn.get(o);if(a==null){let h=Ht.source(o);if(h==null)throw new Error(`Failed to create CogSource from ${o}`);On.trace(h),a=new ea(h),kn.set(o,a)}i.push(a)}return i}findImagery(e){let r=this.imagery.get(e);if(r!=null)return r;for(let i of this.imagery.values())if(i.name===e)return i;return null}child(e){let r=this.findImagery(e);if(r==null)return null;let i=Ut.componentsToName({...this.components,layer:r.name}),n=new ta(i,this.tileMatrix);n.tileSet={...this.tileSet},n.tileSet.background=void 0;let o=this.tileSet?.title??this.tileSet?.name;n.tileSet.title=`${o} ${bl(r.name)}`,n.extentOverride=Fe.fromJson(r.bounds);let a={name:r.name,minZoom:0,maxZoom:100};return a[this.tileMatrix.projection.code]=r.id,n.tileSet.layers=[a],n.imagery=new Map,n.imagery.set(r.id,r),n}};var Bt;(function(t){t[t.UInt8=1]="UInt8",t[t.UInt16=2]="UInt16",t[t.UInt32=4]="UInt32",t[t.UInt64=8]="UInt64",t[t.Double=8]="Double",t[t.Float=4]="Float"})(Bt||(Bt={}));var Bv=2**32,zC=typeof setImmediate>"u"?setTimeout:setImmediate,Kt=()=>{throw new Error("Method not implemented.")},Nn=class{constructor(){this.isLittleEndian=!0,this.delayMs=1,this.maxChunkCount=10,this.chunks=new Map,this.requests=[],this.isRequestsTracked=Nn.DefaultTrackRequests,this.blankFillCount=16,this.maxConcurrentRequests=50,this.toFetch=new Set,this.toFetchPromise=null,this.byteOffset=0,this.getFloat32=Kt,this.getFloat64=Kt,this.getInt8=Kt,this.getInt16=Kt,this.getInt32=Kt,this.setFloat32=Kt,this.setFloat64=Kt,this.setInt8=Kt,this.setInt16=Kt,this.setInt32=Kt,this.setUint8=Kt,this.setUint16=Kt,this.setUint32=Kt,this.setBigInt64=Kt,this.setBigUint64=Kt}static getByteRanges(e,r=32,i=16){if(e.size===0)return{chunks:[],blankFill:[]};let n=[...e.values()].sort((d,m)=>d-m),o=[],a=[];o.push(a);let h=[];for(let d=0;d<n.length;++d){let m=n[d],p=n[d-1];if(a.length>=r)a=[m],o.push(a);else if(d===0||m===p+1)a.push(m);else if(m<p+i){for(let w=p;w<m;w++)a.push(w+1),h.push(w+1);h.pop()}else a=[m],o.push(a)}return{chunks:o,blankFill:h}}async fetchData(e){if(this.toFetch.size===0)return;let r=this.toFetch;this.toFetch=new Set,this.toFetchPromise=null;let i=Nn.getByteRanges(r,this.maxChunkCount,this.blankFillCount),n=[],o=Date.now();for(let a of i.chunks){let h=a[0],d=a[a.length-1],m={startAt:o,requestStartAt:Date.now(),endAt:-1,chunks:a},p=h*this.chunkSize,w=d*this.chunkSize+this.chunkSize-p,E=Date.now(),_=await this.fetchBytes(p,w,e);if(m.endAt=Date.now(),this.isRequestsTracked&&this.requests.push(m),e?.info({uri:this.uri,source:this.type,bytes:w,chunks:a,chunkCount:a.length,duration:Date.now()-E},"FetchChunk"),a.length===1){n[h]=_,this.chunks.set(h,new DataView(_));continue}let C=h*this.chunkSize;for(let R of a){let I=R*this.chunkSize-C,A=_.slice(I,I+this.chunkSize);n[R]=A,this.chunks.set(R,new DataView(A))}}}async loadBytes(e,r,i){if(e<0)throw new Error("Offset must be positive");let n=Math.floor(e/this.chunkSize),o=Math.ceil((e+r)/this.chunkSize)-1;for(let a=n;a<=o;a++)this.chunks.has(a)||this.toFetch.add(a);if(this.toFetch.size!==0){if(this.toFetchPromise==null&&(this.toFetchPromise=new Promise(a=>zC(a,1)).then(()=>this.fetchData(i))),this.toFetch.size>this.maxConcurrentRequests)throw new Error("Too many outstanding requests");await this.toFetchPromise}}getChunkId(e){return Math.floor(e/this.chunkSize)}getUint(e,r){switch(r){case Bt.UInt8:return this.getUint8(e);case Bt.UInt16:return this.getUint16(e);case Bt.UInt32:return this.getUint32(e);case Bt.UInt64:return this.getUint64(e)}}bytes(e,r){let i=this.isOneChunk(e,r);if(i){let m=this.getView(i),p=e-i*this.chunkSize;return new Uint8Array(m.buffer.slice(p,p+r))}let n=new Uint8Array(r),o=e+r,a=Math.floor(e/this.chunkSize),h=Math.ceil((e+r)/this.chunkSize)-1,d=0;for(let m=a;m<=h;m++){let p=e+d,w=m*this.chunkSize,E=this.getView(m),_=Math.min(o,w+this.chunkSize),C=E.buffer.slice(p-w,_-w);n.set(new Uint8Array(C),d),d+=C.byteLength}return n}getView(e){let r=this.chunks.get(e);if(r==null)throw new Error(`Chunk:${e} is not ready`);return r}isOneChunk(e,r){let i=e+r-1,n=Math.floor(e/this.chunkSize);return Math.floor(i/this.chunkSize)-n<1?n:null}hasBytes(e,r=1){let i=Math.floor(e/this.chunkSize),n=Math.ceil((e+r)/this.chunkSize)-1;for(let o=i;o<=n;o++)if(!this.chunks.has(o))return!1;return!0}toRange(e,r){if(r==null)return`bytes=${e}`;if(e<0)throw new Error("Cannot read from remote source with negative offset and length");return`bytes=${e}-${e+r}`}parseContentRange(e){let[r,i]=e.split(" ");if(r!=="bytes")throw new Error("Failed to parse content-range: "+e);if(i==null)throw new Error("Failed to parse content-range: "+e);let[,n]=i.split("/"),o=Number(n);if(isNaN(o))throw new Error("Failed to parse content-range: "+e);return o}get buffer(){throw new Error("Method not implemented.")}get byteLength(){if(this._byteLength)return this._byteLength;throw Error(".size() has not been fetched.")}getUint8(e){let r=Math.floor(e/this.chunkSize),i=this.chunks.get(r);if(i==null)throw new Error(`Chunk:${r} is not ready`);return i.getUint8(e-r*this.chunkSize)}getUint16(e){let r=this.isOneChunk(e,Bt.UInt16);if(r!=null)return this.getView(r).getUint16(e-r*this.chunkSize,this.isLittleEndian);let i=this.getUint8(e),n=this.getUint8(e+Bt.UInt8);return this.isLittleEndian?i+(n<<8):(i<<8)+n}getUint32(e){let r=this.isOneChunk(e,Bt.UInt32);if(r!=null)return this.getView(r).getUint32(e-r*this.chunkSize,this.isLittleEndian);let i=this.getUint16(e),n=this.getUint16(e+Bt.UInt16);return this.isLittleEndian?i+n*65536:i*65536+n}getUint64(e){let r=this.isOneChunk(e,Bt.UInt64);if(r!=null){let o=this.getView(r);return Number(o.getBigUint64(e-r*this.chunkSize,this.isLittleEndian))}let i=this.getUint32(e),n=this.getUint32(e+Bt.UInt32);return this.isLittleEndian?i+n*Bv:i*Bv+n}getBigUint64(e){let r=this.isOneChunk(e,Bt.UInt64);if(r!=null)return this.getView(r).getBigUint64(e-r*this.chunkSize,this.isLittleEndian);let i=BigInt(this.getUint32(e)),n=BigInt(this.getUint32(e+Bt.UInt32));return this.isLittleEndian?i+(n<<BigInt(32)):(i<<BigInt(32))+n}getBigInt64(){throw new Error("Not implemented.")}};Nn.DefaultTrackRequests=!1;var qe=class{constructor(e){this.name=e}raw(e,r=0){return this.parse(e,{offset:r,startOffset:0})}read(e,r=0){let i={offset:r,startOffset:r};return{value:this.parse(e,i),offset:i.offset}}refine(e){return new Wm(this,e)}},Wm=class extends qe{constructor(e,r){super("Function:"+e.name),this.input=e,this.cb=r}get size(){return this.input.size}parse(e,r){let i=this.input.parse(e,r);return this.cb(i,e,r)}};var Kh=class extends qe{constructor(e,r,i){super(`Array:${e}:${r.name}x${i}`),this.count=i,this.type=r}get size(){return this.count*this.type.size}parse(e,r){let i=[];for(let n=0;n<this.count;n++)i.push(this.type.parse(e,r));return i}},Yh=class extends qe{constructor(e,r,i,n){super("Array:Offset:"+e),this.isLookupRequired=!0,this.isMaxLength=n,this.lengthName=i,this.type=r}get size(){throw new Error("Unable to calculate size of dynamic object: "+this.name)}parse(e,r,i){let n=[],o=i?.[this.lengthName];if(o==null||typeof o!="number")throw new Error(`${this.name}: Missing variable a "${this.lengthName}"`);this.isMaxLength&&(o-=r.offset-r.startOffset);for(let a=0;a<o;a++)n.push(this.type.parse(e,r));return n}};var zv=[];for(let t=0;t<64;t++)zv[t]=Math.pow(2,t);var El=class{constructor(e,r=0,i=e.length,n=!0){if(this.buffer=e,this.offset=r*8,this.maxOffset=i*8,this.isLittleEndian=n,!this.isLittleEndian)throw new Error("BigEndian is not supported")}get remainingBits(){return this.maxOffset-this.offset}getBitValue(e,r,i){return(e&((1<<r+i)-1&~((1<<r)-1)))>>r}skip(e){this.offset+=e}bit(){if(this.remainingBits<0)throw new Error("BitStream: Overflow "+this.remainingBits);let e=Math.floor(this.offset/8),r=this.offset%8,i=this.buffer[e];return this.offset++,this.getBitValue(i,r,1)}bool(){return this.bit()===1}bits(e){let r=e,i=0;for(;e>0;)this.bit()===1&&(i+=zv[r-e]),e--;return i}string(e){let r=[];e==null&&(e=Math.floor(this.remainingBits/8));for(let i=0;i<e;i++){let n=this.bits(8);if(n===0)break;r.push(String.fromCharCode(n))}return r.join("")}};var Zh=class extends qe{constructor(e,r){super("Bits:"+e);let i=0;this.fields=Object.keys(r).map(n=>{let o=r[n];return i+=o,{key:n,bits:o}}),this.size=Math.ceil(i/8)}parse(e,r){let i=r.offset,n={},o=new El(e,i,i+this.size);for(let{key:a,bits:h}of this.fields)n[a]=o.bits(h);return r.offset+=this.size,n}},Xh=class extends qe{constructor(e,r,i){super("BitsFlags:"+e),this.type=r,this.fields=Object.entries(i)}get size(){return this.type.size}parse(e,r){let i=this.type.parse(e,r),n={};for(let[o,a]of this.fields){let h=(i&a)===a;h&&(n[o]=h)}return n}};var Jh=class extends qe{constructor(e){super("Bytes:"+e),this.size=e}parse(e,r){let i=e.slice(r.offset,r.offset+this.size);return r.offset+=this.size,i}};var $m=class extends qe{constructor(){super(...arguments),this.size=1}parse(e,r){let i=r.offset;return r.offset+=this.size,e[i]}},qm=class extends qe{constructor(){super(...arguments),this.size=2}parse(e,r){let i=r.offset,n=e[i++],o=e[i++]<<8;return r.offset+=2,n|o}},Hm=class extends qe{constructor(){super(...arguments),this.size=4}parse(e,r){let i=r.offset,n=e[i++],o=e[i++]<<8,a=e[i++]<<16,h=e[i++]*16777216;return r.offset=i,(n|o|a)+h}},UC=2**32,Gm=class extends qe{constructor(){super(...arguments),this.size=8}parse(e,r){let i=ra.parse(e,r),n=ra.parse(e,r);return i+n*UC}},Vm=class extends qe{constructor(){super(...arguments),this.size=8}parse(e,r){let i=BigInt(ra.parse(e,r)),n=BigInt(ra.parse(e,r));return i+(n<<BigInt(32))}},Fv=new $m("UInt8"),Uv=new qm("LUInt16"),ra=new Hm("LUInt32"),jv=new Gm("LUInt64"),Wv=new Vm("BigLUInt64");var Qh=class extends qe{constructor(e,r,i){super("Lookup:"+e),this.lookup=i,this.type=r}get size(){return this.type.size}parse(e,r){let i=this.type.parse(e,r),n=this.lookup(i);if(n==null)throw new Error(`${this.name}: Failed to lookup ${i}`);return{id:i,name:n}}},ec=class extends qe{constructor(e,r,i){super("Enum:"+e),this.enumeration=i,this.type=r}get size(){return this.type.size}parse(e,r){let i=this.type.parse(e,r),n=this.enumeration[i];if(n==null)throw new Error(`${this.name}: Failed to lookup ${i}`);return{id:i,name:n}}};var ia=class extends qe{constructor(e,r){super(e),this._size=-1,this.fields=[];for(let[i,n]of Object.entries(r))this.fields.push({key:i,parser:n})}get size(){if(this._size>-1)return this._size;let e=0;for(let r of this.fields)e+=r.parser.size;return this._size=e,this._size}parse(e,r){let i={};for(let n of this.fields)i[n.key]=n.parser.parse(e,r,i);return i}},tc=class extends qe{constructor(e,r){super(e),this.fields=[],this._size=-1;let i=Object.entries(r),n=!1;for(let[o,a]of i)a.isLookupRequired&&(n=!0),this.fields.push({key:o,parser:a});i.length!==0&&(n?this.generateObjectAssign():this.generateSingleObject())}generateSingleObject(){let e=[],r='"use strict"; return {';for(let n=0;n<this.fields.length;n++)e.push(this.fields[n].parser),r+=` ${JSON.stringify(this.fields[n].key)}: _bp[${n}].parse(buf, ctx),`;r+=" };";let i=new Function("_bp","buf","ctx",r);this.parse=i.bind(null,e)}generateObjectAssign(){let e=[],r=`"use strict"; const ret = {};
181
+ AUTHORITY["EPSG","2193"]]`;qo.default.defs(Se.Nztm2000.toEpsgString(),h6);qo.default.defs(Se.Citm2000.toEpsgString(),c6);var ed=new Map;function wS(t){return t==null?null:typeof t=="number"?t:"code"in t?t.code:"projection"in t?t.projection.code:null}var qr=class{constructor(e){this.epsg=e;try{this.projection=(0,qo.default)(e.toEpsgString(),Se.Wgs84.toEpsgString())}catch(r){throw new Je(`Failed to create projection: ${e.toEpsgString()}, ${Se.Wgs84.toEpsgString()}`,500,r)}}static define(e,r){if(ed.get(e.code)!=null)throw new Error("Duplicate projection definition: "+e.toEpsgString());qo.default.defs(e.toEpsgString(),r)}static get(e){let r=this.tryGet(e);if(r==null)throw new Error(`Invalid projection: ${e}`);return r}static tryGet(e){let r=wS(e);if(r==null)return null;let i=ed.get(r);if(i!=null)return i;let n=Se.tryGet(r);return n==null||qo.default.defs(n.toEpsgString())==null?null:(i=new qr(n),ed.set(r,i),i)}projectMultipolygon(e,r){if(r.epsg.code===this.epsg.code)return e;let{toWgs84:i}=this,{fromWgs84:n}=r;return e.map(s=>s.map(a=>a.map(c=>n(i(c)))))}get toWgs84(){return this.projection.forward}get fromWgs84(){return this.projection.inverse}boundsToWgs84BoundingBox(e){let r=this.toWgs84([e.x,e.y]),i=this.toWgs84([e.x+e.width,e.y+e.height]);return[r[0],r[1],i[0],i[1]]}boundsToGeoJsonFeature(e,r={}){let i=[e.x,e.y],n=[e.x+e.width,e.y],s=[e.x,e.y+e.height],a=[e.x+e.width,e.y+e.height],c=Zu([[[i,s,a,n,i]]],this.toWgs84),d=c.length===1?a6(c[0],r):l6(c,r);return d.bbox=this.boundsToWgs84BoundingBox(e),d}toGeoJson(e){return{type:"FeatureCollection",features:e.map(r=>this.boundsToGeoJsonFeature(r,{name:r.name}))}}static getTiffResZoom(e,r,i=1){let n=0;for(;n<e.zooms.length;++n)if(e.pixelScale(n)<=r*i)return n;if(n===e.zooms.length)return n-1;throw new Error("ResZoom not found")}static tileToWgs84Bbox(e,r){let i=e.tileToSource(r),n=e.tileToSource({x:r.x+1,y:r.y+1,z:r.z}),s=this.get(e),[a,c]=s.toWgs84([i.x,n.y]),[d,p]=s.toWgs84([n.x,i.y]);return[a,c,d,p]}static tileCenterToLatLon(e,r){let i=e.tileToSource({x:r.x+.5,y:r.y+.5,z:r.z}),[n,s]=this.get(e).toWgs84([i.x,i.y]);return qr.wrapLatLon(s,n)}static wrapLatLon(e,r){let i={lat:e,lon:r},n=Math.floor(Math.abs(e)/90)%4,s=e>0?90:-90,a=e%90;switch(n){case 0:i.lat=a;break;case 1:i.lat=s-a,i.lon+=180;break;case 2:i.lat=-a,i.lon+=180;break;case 3:i.lat=-s+a;break}return(i.lon>180||i.lon<-180)&&(i.lon-=Math.floor((i.lon+180)/360)*360),i}static findAlignmentLevels(e,r,i){return Math.max(0,this.getTiffResZoom(e,i,2)-r.z)}static getImagePixelWidth(e,r,i){let n=e.tileToSource(r),s=e.tileToSource({x:r.x+1,y:r.y+1,z:r.z});return Math.round((s.x-n.x)/e.pixelScale(i))*2}};function f6(t){return t==null||typeof t=="string"?!1:"roleArn"in t&&typeof t.roleArn=="string"}var d6=fe(require("aws-sdk/lib/core.js"),1),p6=fe(require("aws-sdk/clients/s3.js"),1);function Uo(t){return"promise"in t?t.promise():t}function $o(t,e){return Ai(t)?typeof t.statusCode!="number"?new Je(e,500,t):new Je(e,t.statusCode,t):new Je(e,500,t)}var Ft=class extends xt{constructor(e,r,i){super(),this.type=Ft.type,this.protocol="s3",this.chunkSize=Ft.DefaultChunkSize,this.maxChunkCount=Ft.DefaultMaxChunkCount,this.bucket=e,this.key=r,this.remote=i}get uri(){return this.name}get name(){return`s3://${this.bucket}/${this.key}`}static isSource(e){return e.type===Ft.type}get size(){return this._size?this._size:(this._size=Promise.resolve().then(async()=>(await Uo(this.remote.headObject({Bucket:this.bucket,Key:this.key}))).ContentLength||-1),this._size)}static fromUri(e,r){let i=ni(e);return i==null||i.key==null||i.protocol!=="s3"?null:new Ft(i.bucket,i.key,r)}async fetchBytes(e,r){let i=this.toRange(e,r);try{let n=await this.remote.getObject({Bucket:this.bucket,Key:this.key,Range:i}).promise();if(!Buffer.isBuffer(n.Body))throw new Error("Failed to fetch object, Body is not a buffer");n.ContentRange!=null&&this._size==null&&(this._size=Promise.resolve(this.parseContentRange(n.ContentRange)));let s=n.Body;return s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength)}catch(n){throw $o(n,`Failed to fetch ${this.name} ${i}`)}}};Ft.type="aws:s3";Ft.DefaultChunkSize=64*1024;Ft.DefaultMaxChunkCount=32;var Ht=class{constructor(e){this.protocol=Ht.protocol,this.s3=e}source(e){let r=Ft.fromUri(e,this.s3);if(r==null)throw new Error(`Failed to create aws s3 source from uri: ${e}`);return r}static is(e){return e.protocol===Ht.protocol}static isPath(e){return e==null?!1:e.startsWith("s3://")}async*list(e,r){for await(let i of this.details(e,r))yield i.path}async*details(e,r){let i=ni(e);if(i==null)return;let n,s=r?.recursive===!1?"/":void 0,a=i.bucket,c=i.key,d=0;try{for(;;){d++;let p=await Uo(this.s3.listObjectsV2({Bucket:a,Prefix:c,ContinuationToken:n,Delimiter:s}));if(p.CommonPrefixes!=null)for(let m of p.CommonPrefixes)m.Prefix!=null&&(yield{path:`s3://${a}/${m.Prefix}`,isDirectory:!0});if(p.Contents!=null)for(let m of p.Contents)m.Key!=null&&(yield{path:`s3://${a}/${m.Key}`,size:m.Size});if(!p.IsTruncated)break;if(d>=Ht.MaxListCount)throw new Error(`Failed to finish listing within ${Ht.MaxListCount} list attempts`);n=p.NextContinuationToken}}catch(p){throw $o(p,`Failed to list: "${e}"`)}}async read(e){let r=ni(e);if(r==null||r.key==null)throw new Error(`Failed to read: "${e}"`);try{return(await this.s3.getObject({Bucket:r.bucket,Key:r.key}).promise()).Body}catch(i){throw $o(i,`Failed to read: "${e}"`)}}async write(e,r,i){let n=ni(e);if(n==null||n.key==null)throw new Error(`Failed to write: "${e}"`);try{await Uo(this.s3.upload({Bucket:n.bucket,Key:n.key,Body:r,ContentEncoding:i?.contentEncoding,ContentType:i?.contentType}))}catch(s){throw $o(s,`Failed to write: "${e}"`)}}exists(e){return this.head(e).then(r=>r!=null)}stream(e){let r=ni(e);if(r==null||r.key==null)throw new Error(`S3: Unable to read "${e}"`);return this.s3.getObject({Bucket:r.bucket,Key:r.key}).createReadStream()}async head(e){let r=ni(e);if(r==null||r.key==null)throw new Error(`Failed to exists: "${e}"`);try{return{size:(await Uo(this.s3.headObject({Bucket:r.bucket,Key:r.key}))).ContentLength,path:e}}catch(i){if(Ai(i)&&i.code==="NotFound")return null;throw $o(i,`Failed to exists: "${e}"`)}}};Ht.protocol="s3";Ht.MaxListCount=100;var Gt=class{static fsFromRole(e,r,i){if(typeof e=="object")return Gt.fsFromRole(e.roleArn,e.externalId,e.durationSeconds);let n=Gt.role(e,r,i);return new Ht(new p6.default({credentials:n}))}static role(e,r,i){i=i??Gt.DefaultRoleDurationSeconds;let n=`role::${e}::${r}::${i}`,s=Gt.cache.get(n);return s==null&&(s=new d6.default.ChainableTemporaryCredentials({params:{RoleArn:e,ExternalId:r,RoleSessionName:"fsa-"+Math.random().toString(32)+"-"+Date.now(),DurationSeconds:i}}),Gt.cache.set(n,s)),s}};Gt.DefaultRoleDurationSeconds=3600;Gt.cache=new Map;var m6=fe(require("aws-sdk/clients/s3.js"),1),g6=require("util"),Ju=require("zlib");var _S=(0,g6.promisify)(Ju.gunzip),lr=Ye;lr.readJson=async function(e){let r=await this.read(e);return e.endsWith(".gz")?JSON.parse((await _S(r)).toString()):JSON.parse(r.toString())};lr.writeJson=async function(e,r){let i=Buffer.from(JSON.stringify(r,void 0,2));if(e.endsWith(".gz")){let n=(0,Ju.createGzip)();return n.end(i),this.write(e,n)}else return this.write(e,i)};lr.configure=function(e){if(e.type!=="s3"||!f6(e))return;let r=ni(e.path);if(r==null)throw new Error("Failed to parse URI: "+e.path);let i=`s3://${r.bucket}/`;this.register(i,Gt.fsFromRole(e.roleArn,e.externalId))};lr.register("s3://",new Ht(new m6.default));function w1(t){return t[0].toUpperCase()+t.slice(1).replace(/_(\d+)-(\d+)m/g," $1.$2m").replace(/_/g," ")}function y6(t){let e=/(?:^|\D)(\d{4})(?:-(\d{2}))?(?:$|\D)/g,r=[];for(let i=e.exec(t);i!=null;i=e.exec(t))r.push(parseInt(i[1])),i[2]!=null&&r.push(parseInt(i[1].slice(0,2)+i[2]));return r.length===0?[-1,-1]:(r.sort(),[r[0],r[r.length-1]+1])}process.env.AWS_NODEJS_CONNECTION_REUSE_ENABLED="1";je.setConfigProvider(new Ua(Co.TileMetadata.TableName));var h4=fe(n0(),1);var _n="application/json",ue;(function(t){t.CacheControl="Cache-Control",t.ContentEncoding="Content-Encoding",t.ContentType="Content-Type",t.Cors="Access-Control-Allow-Origin",t.ETag="ETag",t.IfNoneMatch="If-None-Match",t.Server="Server",t.ServerTiming="Server-Timing"})(ue||(ue={}));var Wo;(function(t){t.CloudfrontId="X-Amz-Cf-Id",t.TraceId="X-Amzn-Trace-Id"})(Wo||(Wo={}));var Ur;(function(t){t.CorrelationId="X-LINZ-Correlation-Id",t.RequestId="X-LINZ-Request-Id"})(Ur||(Ur={}));var ys=class{constructor(){if(this.timers=new Map,typeof process<"u"&&typeof process.hrtime.bigint=="function"){let e=BigInt(1e6);this.getTime=()=>Number(process.hrtime.bigint()/e)}else typeof typeof performance<"u"?this.getTime=()=>performance.now():this.getTime=()=>Date.now()}start(e){let r=this.timers.get(e);if(r!=null&&r.duration==null)throw new Error(`Duplicate startTime for "${e}"`);this.timers.set(e,{start:this.getTime()})}end(e){let r=this.timers.get(e);if(r==null)throw new Error(`Missing startTime information for "${e}"`);let i=this.getTime()-r.start;return r.duration=i,i}get metrics(){if(this.timers.size===0)return;let e={};for(let[r,i]of this.timers.entries())i.duration!=null&&(e[r]=i.duration);return e}get unfinished(){let e=[];for(let[r,i]of this.timers.entries())i.duration==null&&e.push(r);if(e.length!==0)return e}};var b6=fe(Zn(),1);function kt(t){return!(typeof t!="object"||t==null)}var bs=class{constructor(e,r,i){this.logContext={},this.timer=new ys,this.headers=new Map,this.context=r,this.event=e,this.id=(0,b6.ulid)(),this.log=i,this.timer=new ys,this.log=i.child({id:this.id,aws:{lambdaId:r.awsRequestId}})}set(e,r){r==null&&(r=void 0),this.logContext[e]=r}toResponse(e){return e?.body}};var w6=require("url");var v6=fe(Zn(),1);var ur=class extends bs{constructor(e,r,i){var n;super(e,r,i),this.headers=new Map,this.correlationId=(n=this.header(Ur.CorrelationId))!==null&&n!==void 0?n:v6.ulid(),this.set("correlationId",this.correlationId)}header(e){return this._isHeadersLoaded!==!0&&(this.loadHeaders(),this._isHeadersLoaded=!0),this.headers.get(e.toLowerCase())}json(){var e;if(this.header(ue.ContentType)!==_n)throw new Error(`Invalid Content-Type: "${this.header("content-type")}"`);if(this.body==null)throw new Error("Cannot parse empty body as JSON");try{return this.isBase64Encoded?JSON.parse(Buffer.from((e=this.body)!==null&&e!==void 0?e:"","base64").toString()):JSON.parse(this.body)}catch{throw new Error("Body is not a JSON object")}}get query(){return this._query==null&&(this._query=this.loadQueryString()),this._query}get url(){return this.path}};var Fo=class extends ur{static is(e){return kt(e)&&kt(e.requestContext)&&kt(e.requestContext.elb)}toResponse(e){return{statusCode:e.status,statusDescription:e.statusDescription,body:e.body,headers:this.toHeaders(e.headers),isBase64Encoded:e.isBase64Encoded}}toHeaders(e){if(e.size===0)return;let r={};for(let i of e)r[i[0]]=i[1];return r}loadHeaders(){if(this.event.headers!=null)for(let[e,r]of Object.entries(this.event.headers))r!=null&&this.headers.set(e.toLowerCase(),r)}loadQueryString(){let e=new w6.URLSearchParams;if(this.event.queryStringParameters==null)return e;for(let[r,i]of Object.entries(this.event.queryStringParameters))e.append(r.toLowerCase(),i??"true");return e}get method(){return this.event.httpMethod.toUpperCase()}get path(){return this.event.path}get body(){return this.event.body}get isBase64Encoded(){return this.event.isBase64Encoded}};var _6=require("url");var gi=class extends ur{static is(e){return!(!kt(e)||!kt(e.requestContext)||typeof e.requestContext.apiId!="string"||typeof e.requestContext.resourceId!="string"||typeof e.requestContext.httpMethod!="string")}toResponse(e){return{statusCode:e.status,body:e.body,headers:gi.toHeaders(e),isBase64Encoded:e.isBase64Encoded}}static toHeaders(e){if(e.headers.size===0)return;let r={};for(let i of e.headers)r[i[0]]=i[1];return r}loadHeaders(){if(this.event.headers!=null)for(let[e,r]of Object.entries(this.event.headers))r!=null&&this.headers.set(e.toLowerCase(),r)}loadQueryString(){let e=new _6.URLSearchParams;if(this.event.multiValueQueryStringParameters==null)return e;for(let[r,i]of Object.entries(this.event.multiValueQueryStringParameters))if(i!=null)for(let n of i)e.append(r.toLowerCase(),n);return e}get path(){return this.event.path}get method(){return this.event.httpMethod.toUpperCase()}get body(){return this.event.body}get isBase64Encoded(){return this.event.isBase64Encoded}};var td=require("url");var Ho=class extends ur{static is(e){if(!kt(e)||!Array.isArray(e.Records))return!1;let r=e.Records[0];return kt(r)?kt(r.cf):!1}toResponse(e){if(e.status===100&&this.event!=null){let r=this.event.Records[0].cf.request;for(let[i,n]of e.headers)r.headers[i.toLowerCase()]=[{key:i,value:String(n)}];return this.event.Records[0].cf.request}return{status:String(e.status),statusDescription:e.statusDescription,body:e.body,headers:this.toHeaders(e),bodyEncoding:"text"}}toHeaders(e){if(e.headers.size===0)return{};let r={};for(let i of e.headers)r[i[0]]=[{key:i[0],value:String(i[1])}];return r}loadHeaders(){var e;for(let[r,i]of Object.entries(this.event.Records[0].cf.request.headers))this.headers.set(r.toLowerCase(),(e=i[0])===null||e===void 0?void 0:e.value)}loadQueryString(){let e=this.event.Records[0].cf.request.querystring;return e==null?new td.URLSearchParams:new td.URLSearchParams(e.toLowerCase())}get path(){return this.event.Records[0].cf.request.uri}get method(){return this.event.Records[0].cf.request.method.toUpperCase()}get body(){let e=this.event.Records[0].cf.request.body;return e==null?null:e.data}get isBase64Encoded(){var e;return((e=this.event.Records[0].cf.request.body)===null||e===void 0?void 0:e.encoding)==="base64"}};var Y=class{constructor(e,r,i){if(this._body=null,this.headers=new Map,this.status=e,this.statusDescription=r,i!=null)for(let n of Object.keys(i))this.header(n,i[n])}static is(e){return e instanceof Y}static ok(e=200,r="Ok"){return new Y(e,r)}header(e,r){let i=e.toLowerCase();if(r==null)return this.headers.get(i);this.headers.set(i,r)}get isBase64Encoded(){return Buffer.isBuffer(this._body)}json(e){return this.buffer(JSON.stringify(e),_n),this}buffer(e,r=_n){return this.header(ue.ContentType,r),this._body=e,this}get body(){return this._body==null?(this.header(ue.ContentType,_n),JSON.stringify({id:this.header(Ur.RequestId),status:this.status,message:this.statusDescription,correlationId:this.header(Ur.CorrelationId)})):Buffer.isBuffer(this._body)?this._body.toString("base64"):this._body}};var l4=fe(a4(),1),oc=class{constructor(){this.hooks={request:[],response:[]},this.router=(0,l4.default)({defaultRoute:()=>new Y(404,"Not found")})}register(e,r,i){this.router.on(e,r,async(n,s,a)=>n instanceof ur?(n.params=a,yd(n,i)):new Y(500,"Internal server error"))}hook(e,r){this.hooks[e].push(r)}get(e,r){return this.register("GET",e,r)}post(e,r){return this.register("POST",e,r)}delete(e,r){return this.register("DELETE",e,r)}options(e,r){return this.register("OPTIONS",e,r)}patch(e,r){return this.register("PATCH",e,r)}head(e,r){return this.register("HEAD",e,r)}put(e,r){return this.register("PUT",e,r)}async after(e,r){try{for(let i of this.hooks.response)await i(e,r)}catch(i){return Y.is(i)?i:(e.set("err",i),new Y(500,"Internal Server Error"))}return r}async handle(e){for(let i of this.hooks.request){let n=await gd(e,i);if(n)return this.after(e,n)}let r=await this.router.lookup(e,null);return r?this.after(e,r):this.after(e,new Y(404,"Not found"))}};var u4=require("url");var Yo=class extends ur{toResponse(e){return{statusCode:e.status,body:e.body,headers:gi.toHeaders(e),isBase64Encoded:e.isBase64Encoded}}loadHeaders(){for(let[e,r]of Object.entries(this.event.headers))this.headers.set(e.toLowerCase(),r)}loadQueryString(){return new u4.URLSearchParams(this.event.rawQueryString)}get method(){return this.event.requestContext.http.method.toUpperCase()}get path(){return this.event.rawPath}get isBase64Encoded(){return this.event.isBase64Encoded}get body(){return this.event.body==null?null:this.event.body}static is(e){return!(!kt(e)||!kt(e.requestContext)||!kt(e.requestContext.http))}};var f4="v6.30.0",ZS="c4858d318fd769e086a11e8b2a8f052b54964aab",c4={version:f4,hash:ZS};async function gd(t,e){try{return await e(t)}catch(r){return Y.is(r)?r:(t.set("err",r),new Y(500,"Internal Server Error"))}}async function yd(t,e){t.timer.start("lambda");let r=await gd(t,e),i=200;Y.is(r)&&(i=r.status,t.set("description",r.statusDescription)),t.set("status",i),t.timer.timers.size>0&&t.set("metrics",t.timer.metrics),c4.hash&&t.set("package",c4);let n=t.timer.end("lambda");return t.set("unfinished",t.timer.unfinished),t.set("duration",n),t.set("@type","report"),i>499?t.log.error(t.logContext,"Lambda:Done"):i>399?t.log.warn(t.logContext,"Lambda:Done"):t.log.info(t.logContext,"Lambda:Done"),r}function JS(t){let e={rejectOnError:!0,tracePercent:0,...t};if(isNaN(e.tracePercent)||e.tracePercent>1)throw new Error("tracePercent is not between 0-1 :"+e.tracePercent);return e}var cr=class{static request(e,r,i){if(Fo.is(e))return new Fo(e,r,i);if(Yo.is(e))return new Yo(e,r,i);if(gi.is(e))return new gi(e,r,i);if(Ho.is(e))return new Ho(e,r,i);throw new Error("Request is not a a ALB, ApiGateway or Cloudfront event")}static handler(e,r,i){let n=JS(r);function s(a,c,d){let p=new bs(a,c,i??cr.Logger);n.tracePercent>0&&Math.random()<n.tracePercent&&(p.log.level="trace"),process.env.TRACE_LAMBDA&&(p.log.level="trace"),p.log.trace({event:a},"Lambda:Start");let m=c.awsRequestId;p.set("aws",{lambdaId:m}),yd(p,e).then(w=>{if(n.rejectOnError&&Y.is(w)){if(p.logContext.err)return d(p.logContext.err);if(w.status>399)return d(p.toResponse(w))}return d(null,p.toResponse(w))})}return s}static http(e){let r=new oc;function i(n,s,a){let c=cr.request(n,s,e??cr.Logger),d=c.header(Wo.CloudfrontId),p=c.header(Wo.TraceId),m=s.awsRequestId;(d||p||m)&&c.set("aws",{cloudFrontId:d,traceId:p,lambdaId:m}),c.set("method",c.method),c.set("path",c.path),r.handle(c).then(w=>{var S;w.status===500&&w.header(ue.CacheControl,"no-store"),w.header(Ur.RequestId,c.id),w.header(Ur.CorrelationId,c.correlationId);let v=(S=c.timer.metrics)===null||S===void 0?void 0:S.lambda;v!=null&&w.header(ue.ServerTiming,`total;dur=${v}`),!w.isBase64Encoded&&w.header(ue.ContentType)==null&&w.header(ue.ContentType,_n),cr.ServerName&&w.header(ue.Server,`${cr.ServerName}-${f4}`),a(null,c.toResponse(w))})}return i.router=r,i}};cr.Logger=(0,h4.default)();cr.ServerName="linz";var lg=require("crypto");var it=class{constructor(){this.handlers={}}static action(e){let r=e.path,[i,n,...s]=(r[0]==="/"?r.slice(1):r).split("/").map(a=>decodeURIComponent(a));return n==null?{version:"v1",name:i,rest:[]}:{version:i,name:n,rest:s}}static apiKey(e){let r=e.query.get(Co.ApiKey.QueryString)??e.header("X-LINZ-Api-Key");if(r!=null&&!Array.isArray(r))return e.set(Co.ApiKey.QueryString,this.apiKey),r}async handle(e){if(e.method==="options")return new Y(200,"Options",{[ue.Cors]:"*","Access-Control-Allow-Credentials":"false","Access-Control-Allow-Methods":"OPTIONS,GET,PUT,POST,DELETE"});if(e.method!=="GET")return new Y(405,"Method not allowed");let r=it.action(e),i=r.version==="v1"?this.handlers[r.name]:null;if(i==null)return new Y(404,"Not Found");let n=await i(e);return n.header(ue.Cors,"*"),n}get(e,r){if(this.handlers[e]!=null)throw new Error(e+" already registered");this.handlers[e]=r}};var d4=new Y(200,"ok");d4.header(ue.CacheControl,"no-store");async function bd(){return d4}async function vd(){let t=new Y(200,"ok");return t.header(ue.CacheControl,"no-store"),t.json({version:"v6.30.0",hash:"c4858d318fd769e086a11e8b2a8f052b54964aab"}),t}var Sc=fe(require("path"),1);var Ne=class{constructor(e){this.name=e}raw(e,r=0){return this.parse(e,{offset:r,startOffset:0})}read(e,r=0){let i={offset:r,startOffset:r};return{value:this.parse(e,i),offset:i.offset}}refine(e){return new wd(this,e)}},wd=class extends Ne{constructor(e,r){super("Function:"+e.name),this.input=e,this.cb=r}get size(){return this.input.size}parse(e,r){let i=this.input.parse(e,r);return this.cb(i,e,r)}};var ac=class extends Ne{constructor(e,r,i){super(`Array:${e}:${r.name}x${i}`),this.count=i,this.type=r}get size(){return this.count*this.type.size}parse(e,r){let i=[];for(let n=0;n<this.count;n++)i.push(this.type.parse(e,r));return i}},lc=class extends Ne{constructor(e,r,i,n){super("Array:Offset:"+e),this.isLookupRequired=!0,this.isMaxLength=n,this.lengthName=i,this.type=r}get size(){throw new Error("Unable to calculate size of dynamic object: "+this.name)}parse(e,r,i){let n=[],s=i?.[this.lengthName];if(s==null||typeof s!="number")throw new Error(`${this.name}: Missing variable a "${this.lengthName}"`);this.isMaxLength&&(s-=r.offset-r.startOffset);for(let a=0;a<s;a++)n.push(this.type.parse(e,r));return n}};var p4=[];for(let t=0;t<64;t++)p4[t]=Math.pow(2,t);var R1=class{constructor(e,r=0,i=e.length,n=!0){if(this.buffer=e,this.offset=r*8,this.maxOffset=i*8,this.isLittleEndian=n,!this.isLittleEndian)throw new Error("BigEndian is not supported")}get remainingBits(){return this.maxOffset-this.offset}getBitValue(e,r,i){return(e&((1<<r+i)-1&~((1<<r)-1)))>>r}skip(e){this.offset+=e}bit(){if(this.remainingBits<0)throw new Error("BitStream: Overflow "+this.remainingBits);let e=Math.floor(this.offset/8),r=this.offset%8,i=this.buffer[e];return this.offset++,this.getBitValue(i,r,1)}bool(){return this.bit()===1}bits(e){let r=e,i=0;for(;e>0;)this.bit()===1&&(i+=p4[r-e]),e--;return i}string(e){let r=[];e==null&&(e=Math.floor(this.remainingBits/8));for(let i=0;i<e;i++){let n=this.bits(8);if(n===0)break;r.push(String.fromCharCode(n))}return r.join("")}};var uc=class extends Ne{constructor(e,r){super("Bits:"+e);let i=0;this.fields=Object.keys(r).map(n=>{let s=r[n];return i+=s,{key:n,bits:s}}),this.size=Math.ceil(i/8)}parse(e,r){let i=r.offset,n={},s=new R1(e,i,i+this.size);for(let{key:a,bits:c}of this.fields)n[a]=s.bits(c);return r.offset+=this.size,n}},cc=class extends Ne{constructor(e,r,i){super("BitsFlags:"+e),this.type=r,this.fields=Object.entries(i)}get size(){return this.type.size}parse(e,r){let i=this.type.parse(e,r),n={};for(let[s,a]of this.fields){let c=(i&a)===a;c&&(n[s]=c)}return n}};var hc=class extends Ne{constructor(e){super("Bytes:"+e),this.size=e}parse(e,r){let i=e.slice(r.offset,r.offset+this.size);return r.offset+=this.size,i}};var _d=class extends Ne{constructor(){super(...arguments),this.size=1}parse(e,r){let i=r.offset;return r.offset+=this.size,e[i]}},Sd=class extends Ne{constructor(){super(...arguments),this.size=2}parse(e,r){let i=r.offset,n=e[i++],s=e[i++]<<8;return r.offset+=2,n|s}},xd=class extends Ne{constructor(){super(...arguments),this.size=4}parse(e,r){let i=r.offset,n=e[i++],s=e[i++]<<8,a=e[i++]<<16,c=e[i++]*16777216;return r.offset=i,(n|s|a)+c}},YS=2**32,Md=class extends Ne{constructor(){super(...arguments),this.size=8}parse(e,r){let i=Xo.parse(e,r),n=Xo.parse(e,r);return i+n*YS}},Ed=class extends Ne{constructor(){super(...arguments),this.size=8}parse(e,r){let i=BigInt(Xo.parse(e,r)),n=BigInt(Xo.parse(e,r));return i+(n<<BigInt(32))}},m4=new _d("UInt8"),g4=new Sd("LUInt16"),Xo=new xd("LUInt32"),y4=new Md("LUInt64"),b4=new Ed("BigLUInt64");var fc=class extends Ne{constructor(e,r,i){super("Lookup:"+e),this.lookup=i,this.type=r}get size(){return this.type.size}parse(e,r){let i=this.type.parse(e,r),n=this.lookup(i);if(n==null)throw new Error(`${this.name}: Failed to lookup ${i}`);return{id:i,name:n}}},dc=class extends Ne{constructor(e,r,i){super("Enum:"+e),this.enumeration=i,this.type=r}get size(){return this.type.size}parse(e,r){let i=this.type.parse(e,r),n=this.enumeration[i];if(n==null)throw new Error(`${this.name}: Failed to lookup ${i}`);return{id:i,name:n}}};var Qo=class extends Ne{constructor(e,r){super(e),this._size=-1,this.fields=[];for(let[i,n]of Object.entries(r))this.fields.push({key:i,parser:n})}get size(){if(this._size>-1)return this._size;let e=0;for(let r of this.fields)e+=r.parser.size;return this._size=e,this._size}parse(e,r){let i={};for(let n of this.fields)i[n.key]=n.parser.parse(e,r,i);return i}},pc=class extends Ne{constructor(e,r){super(e),this.fields=[],this._size=-1;let i=Object.entries(r),n=!1;for(let[s,a]of i)a.isLookupRequired&&(n=!0),this.fields.push({key:s,parser:a});i.length!==0&&(n?this.generateObjectAssign():this.generateSingleObject())}generateSingleObject(){let e=[],r='"use strict"; return {';for(let n=0;n<this.fields.length;n++)e.push(this.fields[n].parser),r+=` ${JSON.stringify(this.fields[n].key)}: _bp[${n}].parse(buf, ctx),`;r+=" };";let i=new Function("_bp","buf","ctx",r);this.parse=i.bind(null,e)}generateObjectAssign(){let e=[],r=`"use strict"; const ret = {};
168
182
  `;for(let n=0;n<this.fields.length;n++)e.push(this.fields[n].parser),r+=`ret[${JSON.stringify(this.fields[n].key)}] = _bp[${n}].parse(buf, ctx, ret)
169
- `;r+="return ret";let i=new Function("_bp","buf","ctx",r);this.parse=i.bind(null,e)}get size(){if(this._size>-1)return this._size;let e=0;for(let r of this.fields)e+=r.parser.size;return this._size=e,this._size}parse(e,r){return{}}};function na(t,e=2){return"0x"+t.toString(16).padStart(e,"0")}var rc=class extends qe{constructor(e,r){super("Offset:"+e.name+":"+r.name),this.type=r,this.offset=e}get size(){return this.type.size}parse(e,r){let i=this.offset.parse(e,r);if(i>e.length||i<0)throw new Error(`[${this.name}]: BufferOverflow attempted read at ${na(i)}`);return this.type.parse(e,{offset:i,startOffset:i})}};var ic=class extends qe{constructor(e){super("Skip:"+e),this.size=e}parse(e,r){r.offset+=this.size}};var nc=class extends qe{constructor(){super("String")}get size(){throw new Error("Unable to calculate size from dynamic object")}parse(e,r){let i=r.offset,n=[],o=0;for(;o+i<e.length;){let a=e[i+o];if(a===0)break;n.push(String.fromCharCode(a)),o++}return r.offset+=o+1,n.join("")}},sc=class extends qe{constructor(e){super("String:"+e),this.size=e}parse(e,r){let i=r.offset;if(this.size+i>e.length)throw new Error(`BufferOverflow: ${this.name} offset: ${na(r.offset)}`);let n=[],o=0;for(;o<this.size;){let a=e[i+o];if(a===0)break;n.push(String.fromCharCode(a)),o++}return r.offset+=this.size,n.join("")}};function jC(t,e,r,i){return typeof r=="number"?new Kh(t,e,r):new Yh(t,e,r,i??!1)}var wr={u8:Fv,lu16:Uv,lu32:ra,lu64:jv,blu64:Wv,empty:new ia("Empty",{}),offset(t,e){return new rc(t,e)},string(t){return t==null?new nc:new sc(t)},bits(t,e){return new Zh(t,e)},flags(t,e,r){return new Xh(t,e,r)},object(t,e){return new tc(t,e)},static(t,e){return new ia(t,e)},lookup(t,e,r){return new Qh(t,e,r)},enum(t,e,r){return new ec(t,e,r)},bytes(t){return new Jh(t)},skip(t){return new ic(t)},array:jC};var $v;(function(t){t[t.File="0".charCodeAt(0)]="File",t[t.HardLink="1".charCodeAt(0)]="HardLink",t[t.SymLink="2".charCodeAt(0)]="SymLink",t[t.CharDeviceNode="3".charCodeAt(0)]="CharDeviceNode",t[t.BlockDeviceNode="4".charCodeAt(0)]="BlockDeviceNode",t[t.Directory="5".charCodeAt(0)]="Directory",t[t.FifoNode="6".charCodeAt(0)]="FifoNode",t[t.Reserved="7".charCodeAt(0)]="Reserved",t[t.LongName="L".charCodeAt(0)]="LongName",t[t.LongLink="K".charCodeAt(0)]="LongLink"})($v||($v={}));var WC=wr.object("TarHeader",{path:wr.string(100),skip1:wr.skip(24),size:wr.bytes(12).refine(t=>parseInt(t.toString(),8)),skip2:wr.skip(20),type:wr.u8,linkName:wr.string(100)});var qv={32:16777619n,64:1099511628211n,128:309485009821345068724781371n,256:374144419156711147060143317175368453031918731002211n,512:35835915874844867368919076489095108449946327955754392558399825615420669938882575126094039892345713852759n,1024:5016456510113118655434598811035278955030765345404790744303017523831112055108147451509157692220295382716162651878526895249385292291816524375083746691371804094271873160484737966720260389217684476157468082573n},$C={32:2166136261n,64:14695981039346656037n,128:144066263297769815596495629667062367629n,256:100029257958052580907070968620625704837092796014241193945225284501741471925557n,512:9659303129496669498009435400716310466090418745672637896108374329434462657994582932197716438449813051892206539805784495328239340083876191928701583869517785n,1024:14197795064947621068722070641403218320880622795441933960878474914617582723252296732303717722150864096521202355549365628174669108571814760471015076148029755969804077320157692458563003215304957150157403644460363550505412711285966361610267868082893823963790439336411086884584107735010676915n};function Km(t,{size:e=32}={}){if(!qv[e])throw new Error("The `size` option must be one of 32, 64, 128, 256, 512, or 1024");let r=$C[e],i=qv[e],n=!1;for(let o=0;o<t.length;o++){let a=t.charCodeAt(o);a>127&&!n&&(t=unescape(encodeURIComponent(t)),a=t.charCodeAt(o),n=!0),r^=BigInt(a),r=BigInt.asUintN(e,r*i)}return r}var oc="COT";var qC=BigInt(0),HC=BigInt(32),GC=BigInt(2**32-1),Hv=wr.object("CotarMetadata",{magic:wr.string(oc.length),version:wr.u8,count:wr.lu32}),Zr=class{constructor(e,r,i=0){this.isHeader=!0,this.source=e,this.sourceOffset=i,this.metadata=r}static hash(e){return Km(e,{size:64})}static async loadMetadata(e,r,i){if(i){await e.loadBytes(r,e.chunkSize);let o=e.bytes(r,8);return Hv.read(o).value}let n=await e.fetchBytes(-8);return Hv.read(new Uint8Array(n)).value}static async getMetadata(e,r,i){let n=await this.loadMetadata(e,r,i);if(n.magic!==oc)throw new Error(`Invalid source: ${e.uri} invalid magic found: ${n.magic}`);if(n.version===1||n.version===2)return n;throw new Error(`Invalid source: ${e.uri} invalid version found: ${n.version}`)}static async create(e,r=0,i=!0){let n=await this.getMetadata(e,r,i);return new Zr(e,n,r)}async find(e){if(this.metadata.version===1)return this._findV1(e);if(this.metadata.version===2)return this._findV2(e);throw new Error("Invalid metadata version")}async _findV2(e){let r=Zr.hash(e),i=this.metadata.count,n=Number(r%BigInt(i)),o=Number(r>>HC),a=Number(r&GC),h=null,d=null,m=n;for(;;){let p=this.sourceOffset+m*16+8;if(await this.source.loadBytes(p,16),d=this.source.getUint32(p),h=this.source.getUint32(p+4),h===o&&d===a){let w=this.source.getUint32(p+8)*512,E=this.source.getUint32(p+12);return{offset:w,size:E}}if(h===0&&d===0||(m++,m>=i&&(m=0),m===n))return null}}async _findV1(e){let r=Zr.hash(e),i=this.metadata.count,n=Number(r%BigInt(i)),o=null,a=n;for(;;){let h=this.sourceOffset+a*24+8;if(await this.source.loadBytes(h,24),o=this.source.getBigUint64(h),o===r){let d=this.source.getUint64(h+8),m=this.source.getUint64(h+16);return{offset:d,size:m}}if(o===qC||(a++,a>=i&&(a=0),a===n))return null}}};var jN=BigInt(0);var ks=class{constructor(e,r){this.source=e,this.index=r}static async fromTar(e){let r=await Zr.getMetadata(e,0,!1),i=await e.size,n=r.version===1?24:16,o=i-(r.count*n+16),a=new Zr(e,r,o);return new ks(e,a)}async get(e){let r=await this.index.find(e);return r==null?null:(await this.source.loadBytes(r.offset,r.size),this.source.bytes(r.offset,r.size))}};var Ym=class{constructor(){this.cache=new Map}get(e){let r=this.cache.get(e);if(r==null){let i=Ht.source(e);On.trace(i),r=ks.fromTar(i),this.cache.set(e,r)}return r}},KC=new Ym,lc=class{constructor(e,r){this.type=dt.Vector;this.components=Ut.parse(e),this.tileMatrix=r}async init(e){this.tileSet=e}get format(){return gr.MapboxVectorTiles}get id(){return Tt.id(this.fullName,this.tileMatrix)}get fullName(){return Ut.componentsToName(this.components)}async tile(e,r){if(r.ext!==gr.MapboxVectorTiles)return Ie;if(r.tileMatrix.identifier!==wt.identifier)return Ie;if(this.tileSet.layers.length>1)return new te(500,"Too many layers in tileset");let[i]=this.tileSet.layers;if(i[3857]==null)return new te(500,"Layer url not found from tileset Config");e.timer.start("cotar:load");let n=await KC.get(i[3857]);if(n==null)return new te(500,"Failed to load VectorTiles");e.timer.end("cotar:load");let o=(1<<r.z)-1-r.y;e.timer.start("cotar:tile");let a=await n.get(`tiles/${r.z}/${r.x}/${o}.pbf.gz`);if(a==null)return Ie;e.timer.end("cotar:tile");let h=new te(200,"Ok");return h.buffer(Buffer.from(a),"application/x-protobuf"),h.header(me.ContentEncoding,"gzip"),h}};var Zm=class{constructor(){this.CacheTime=3e4;this.cache=new Map;this.tileSets=new Map}id(e,r){if(typeof e=="string"){let i=Ut.parse(e);return`${Ut.componentsToName(i)}_${r?.identifier}`}return`${e.fullName}_${e.tileMatrix.identifier}`}add(e,r=Date.now()+this.CacheTime){let i=this.id(e);if(this.cache.has(i))throw new Error("Trying to add duplicate tile set:"+i);this.cache.set(i,{time:r,value:Promise.resolve(e)})}get(e,r){let i=this.id(e,r),n=this.cache.get(i);if(n==null||Date.now()-n.time>0){let o=this.loadTileSet(e,r);n={time:Date.now(),value:o},this.cache.set(i,n)}return n.value}async loadTileSet(e,r){let i=Ut.parse(e),n=this.id(e,r);if(i.layer!=null){let m=Ut.componentsToName({...i,layer:void 0}),p=await this.get(m,r);return p==null||p.type===dt.Vector?null:p.child(i.layer)}let o=nt.TileSet.id(e),a=await nt.TileSet.get(o);if(a==null)return this.cache.delete(n),null;let h=this.tileSets.get(n);if(h!=null&&h?.tileSet.updatedAt===a.updatedAt)return h;if(nt.isTileSetRaster(a)){let m=new ta(e,r);return await m.init(a),this.tileSets.set(n,m),m}let d=new lc(e,r);return await d.init(a),this.tileSets.set(n,d),d}async getAll(e,r){let i=Ut.parse(e),n=r==null?Array.from(ci.Defaults.values()):[r],o=[];for(let d of n)o.push(this.get(e,d));let a=await Promise.all(o),h=[];for(let d of a)if(d!=null&&d.type!==dt.Vector){if(h.push(d),i.layer!=null)d.components.name=i.name;else if(d.imagery!=null&&d.imagery.size>1)for(let m of d.imagery.keys()){let p=d.child(m);p!=null&&h.push(p)}}return h.sort((d,m)=>d.title.localeCompare(m.title))}},Tt=new Zm;var XC={},YC=[{type:wi.Tile,name:"health",tileMatrix:wt,ext:Ge.Png,x:252,y:156,z:8},{type:wi.Tile,name:"health",tileMatrix:Li,ext:Ge.Png,x:30,y:33,z:6}],Vv=256;async function ZC(t){if(Buffer.isBuffer(t.buf))return t.buf;let e=`static/expected_tile_${t.tileMatrix.identifier}_${t.x}_${t.y}_z${t.z}.${t.ext}`;try{return await Xm.promises.readFile(e)}catch(r){if(r.code!=="ENOENT")throw r;let i=uc.join(uc.dirname(Yv.default.fileURLToPath(XC.url)),"..","..",e);return await Xm.promises.readFile(i)}}async function Zv(t){for(let r of YC){let i=await Tt.get("health",r.tileMatrix);if(i==null)throw new te(500,'TileSet: "health" not found');let n=await i.tile(t,r);if(n.status!==200)return new te(500,n.statusDescription);if(!Buffer.isBuffer(n._body))throw new te(500,"Not a Buffer response content.");let o=await(0,Jm.default)(n._body).raw().toBuffer(),a=await ZC(r);r.buf=a;let h=await(0,Jm.default)(a).raw().toBuffer(),d=Buffer.alloc(h.length),m=(0,Kv.default)(h,o,d,Vv,Vv);if(m)return t.log.error({missMatchedPixels:m,projection:r.tileMatrix.identifier,xyz:{x:r.x,y:r.y,z:r.z}},"Health:MissMatch"),new te(500,"TileSet does not match.")}let e=new te(200,"ok");return e.header(me.CacheControl,"no-store"),e}var Xv=ve(hs(),1),JC=60*60*1e3,QC=24*JC,e3=91*QC;function Jv(t){if(t==null||!t.startsWith("c")&&!t.startsWith("d"))return!1;let e=t.slice(1).toUpperCase();try{let r=Xv.decodeTime(e);if(t.startsWith("d"))return!0;if(Date.now()-r>e3)return!1}catch{return!1}return!0}var Je=class{constructor(){this.handlers={}}static action(e){let r=e.path,[i,n,...o]=(r[0]==="/"?r.slice(1):r).split("/").map(a=>decodeURIComponent(a));return n==null?{version:"v1",name:i,rest:[]}:{version:i,name:n,rest:o}}static apiKey(e){let r=e.query.get(Wo.ApiKey.QueryString)??e.header("X-LINZ-Api-Key");if(r!=null&&!Array.isArray(r))return e.set(Wo.ApiKey.QueryString,this.apiKey),r}async handle(e){if(e.method==="options")return new te(200,"Options",{[me.Cors]:"*","Access-Control-Allow-Credentials":"false","Access-Control-Allow-Methods":"OPTIONS,GET,PUT,POST,DELETE"});if(e.method!=="GET")return new te(405,"Method not allowed");let r=Je.action(e),i=r.version==="v1"?this.handlers[r.name]:null;if(i==null)return new te(404,"Not Found");let n=await i(e);return n.header(me.Cors,"*"),n}get(e,r){if(this.handlers[e]!=null)throw new Error(e+" already registered");this.handlers[e]=r}};var ew=require("crypto");var t3=1+1e-10,Qm=new te(404,"Not Found"),Qv=10**8;function ep(t){return Math.round(t*Qv)/Qv}function r3(t){return[ep(t[0]),ep(t[1])]}function i3(t,e,r){if(Si.delta(t[0],t[2])<=0)return Si.bboxToMultiPolygon(t);let i=[];for(let o of e){let a=[Fe.fromJson(o).pad(t3).toPolygon()];i=lv(i,a)}return zh(i,o=>r3(r.toWgs84(o)))}async function n3(t){try{return await Ht.readJson(t)}catch(e){if(st.isCompositeError(e)&&e.code<500)return null;throw e}}function s3(t,e,r,i,n,o){let a=t.tileMatrix;return{stac_version:Ua.Version,license:e?.license??Ua.License,id:r.id,providers:e?.providers??[{name:n.serviceProvider.name,url:n.serviceProvider.site,roles:["host"]}],title:e?.title??bl(r.name),description:e?.description??"No description",extent:o,links:[],summaries:{"linz:zoom":{min:Ot.convertZoomLevel(i.minZoom?i.minZoom:0,wt,a,!0),max:Ot.convertZoomLevel(i.maxZoom?i.maxZoom:32,wt,a,!0)},"linz:priority":[1e3+t.tileSet.layers.indexOf(i)]}}}async function o3(t){let e=Kr.get(t.tileMatrix),r=new Map,i=[],n=[];for(let a of t.tileSet.layers){let h=a[e.epsg.code];if(h==null)continue;let d=t.imagery.get(h);d!=null&&r.get(d.uri)==null&&r.set(d.uri,n3(Ht.join(d.uri,"collection.json")))}let o=await nt.Provider.get(nt.Provider.id("linz"));if(o==null)return null;for(let a of t.tileSet.layers){let h=a[e.epsg.code];if(h==null)continue;let d=t.imagery.get(h);if(d==null)continue;let m=await r.get(d.uri),p=e.boundsToWgs84BoundingBox(d.bounds).map(ep),w=m?.extent.temporal.interval;if(w==null){let _=vv(d.name);if(_[0]===-1)throw new Error("Missing date in imagery name: "+d.name);w=[_.map(C=>`${C}-01-01T00:00:00Z`)]}let E={spatial:{bbox:[p]},temporal:{interval:w}};n.push({type:"Feature",stac_version:Ua.Version,id:h+"_item",collection:h,assets:{},links:[],bbox:p,geometry:{type:"MultiPolygon",coordinates:i3(p,d.files,e)},properties:{title:bl(d.name),datetime:null,start_datetime:w[0][0],end_datetime:w[0][1]}}),i.push(s3(t,m,d,a,o,E))}return{id:t.id,type:"FeatureCollection",stac_version:Ua.Version,stac_extensions:["single-file-stac"],title:t.title,description:t.description,features:n,collections:i,links:[]}}async function tw(t){let e=Je.action(t),r=Ub(e.rest);if(r==null)return Qm;Fb(t,r),t.timer.start("tileset:load");let i=await Tt.get(r.name,r.tileMatrix);if(t.timer.end("tileset:load"),i==null||i.type===dt.Vector)return Qm;let n=(0,ew.createHash)("sha256").update(JSON.stringify(i.tileSet)).digest("base64"),o=t.header(me.IfNoneMatch);if(o!=null&&o.indexOf(n)>-1)return t.set("cache",{key:n,hit:!0,match:o}),new te(304,"Not modified");t.timer.start("stac:load");let a=await o3(i);if(t.timer.end("stac:load"),a==null)return Qm;let h=new te(200,"ok");return h.header(me.ETag,n),h.header(me.CacheControl,"public, max-age=86400, stale-while-revalidate=604800"),h.json(a),h}var a3={xmlns:"http://www.opengis.net/wmts/1.0","xmlns:ows":"http://www.opengis.net/ows/1.1","xmlns:xlink":"http://www.w3.org/1999/xlink","xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","xmlns:gml":"http://www.opengis.net/gml","xsi:schemaLocation":"http://www.opengis.net/wmts/1.0 http://schemas.opengis.net/wmts/1.0/wmtsGetCapabilities_response.xsd",version:"1.0.0"};function rw(t){return Kr.get(t.tileMatrix).boundsToWgs84BoundingBox(t.extent)}function hc(t){return t.identifier===Li.identifier?Li.identifier:t.projection.toEpsgString()}var cc=class{constructor(e){this.layers=new Map;this.tileMatrixSets=new Map;this.httpBase=e.httpBase,this.provider=e.provider;for(let r of e.layers){let i=this.layers.get(r.fullName);i==null&&(i=[],this.layers.set(r.fullName,i)),i.push(r),this.tileMatrixSets.set(r.tileMatrix.identifier,r.tileMatrix)}this.apiKey=e.apiKey,this.formats=e.formats??zb}buildWgs84BoundingBox(e,r="ows:WGS84BoundingBox"){let i=rw(e[0]);for(let n=1;n<e.length;++n)i=Si.union(i,rw(e[n]));return se(r,{crs:"urn:ogc:def:crs:OGC:2:84"},i[2]>180?[se("ows:LowerCorner","-180 -90"),se("ows:UpperCorner","180 90")]:[se("ows:LowerCorner",`${i[0]} ${i[1]}`),se("ows:UpperCorner",`${i[2]} ${i[3]}`)])}buildBoundingBox(e,r){let i=r.toBbox();return se("ows:BoundingBox",{crs:e.projection.toUrn()},[se("ows:LowerCorner",`${i[e.indexX]} ${i[e.indexY]}`),se("ows:UpperCorner",`${i[e.indexX+2]} ${i[e.indexY+2]}`)])}buildProvider(){if(this.provider==null)return[];let{serviceIdentification:e,serviceProvider:r}=this.provider,{contact:i}=r;return[se("ows:ServiceIdentification",[se("ows:Title",e.title),se("ows:Abstract",e.description),se("ows:ServiceType","OGC WMTS"),se("ows:ServiceTypeVersion","1.0.0"),se("ows:Fees",e.fees),se("ows:AccessConstraints",e.accessConstraints)]),se("ows:ServiceProvider",[se("ows:ProviderName",r.name),se("ows:ProviderSite",{"xlink:href":r.site}),se("ows:ServiceContact",[se("ows:IndividualName",i.individualName),se("ows:PositionName",i.position),se("ows:ContactInfo",[se("ows:Phone",[se("ows:Voice",i.phone)]),se("ows:Address",[se("ows:DeliveryPoint",i.address.deliveryPoint),se("ows:City",i.address.city),se("ows:PostalCode",i.address.postalCode),se("ows:Country",i.address.country),se("ows:ElectronicMailAddress",i.address.email)])])])])]}buildTileUrl(e,r){let i=this.apiKey?`?api=${this.apiKey}`:"";return[this.httpBase,"v1","tiles",e.fullName,"{TileMatrixSet}","{TileMatrix}","{TileCol}",`{TileRow}.${r}${i}`].join("/")}buildResourceUrl(e,r){return se("ResourceURL",{format:"image/"+r,resourceType:"tile",template:this.buildTileUrl(e,r)})}buildLayer(e){let r=new Set,i=[];for(let o of e)r.has(o.tileMatrix.identifier)||(r.add(o.tileMatrix.identifier),i.push(se("TileMatrixSetLink",[se("TileMatrixSet",hc(o.tileMatrix))])));let[n]=e;return se("Layer",[se("ows:Title",n.title),se("ows:Abstract",n.description),se("ows:Identifier",n.fullName),...e.map(o=>this.buildBoundingBox(o.tileMatrix,o.extent)),this.buildWgs84BoundingBox(e),this.buildStyle(),...this.formats.map(o=>se("Format","image/"+o)),...i,...this.formats.map(o=>this.buildResourceUrl(n,o))])}buildStyle(){return se("Style",{isDefault:"true"},[se("ows:Title","Default Style"),se("ows:Identifier","default")])}buildTileMatrixSet(e){return se("TileMatrixSet",[se("ows:Title",e.def.title),e.def.abstract?se("ows:Abstract",e.def.abstract):null,se("ows:Identifier",hc(e)),se("ows:SupportedCRS",e.projection.toUrn()),e.def.wellKnownScaleSet?se("WellKnownScaleSet",e.def.wellKnownScaleSet):null,...e.def.tileMatrix.map(r=>se("TileMatrix",[se("ows:Identifier",r.identifier),se("ScaleDenominator",r.scaleDenominator),se("TopLeftCorner",r.topLeftCorner.join(" ")),se("TileWidth",r.tileWidth),se("TileHeight",r.tileHeight),se("MatrixWidth",r.matrixWidth),se("MatrixHeight",r.matrixHeight)]))])}toVNode(){let e=[];for(let r of this.layers.values())e.push(this.buildLayer(r));for(let r of this.tileMatrixSets.values())e.push(this.buildTileMatrixSet(r));return se("Capabilities",a3,[...this.buildProvider(),se("Contents",e)])}toXml(){return`<?xml version="1.0"?>
170
- `+this.toVNode().toString()}};async function iw(t){let{version:e,rest:r,name:i}=Je.action(t);if(r.length!==3)return Ie;let n=cl(r[1]);if(n==null)return Ie;t.timer.start("tileset:load");let o=await Tt.get(r[0],n);if(t.timer.end("tileset:load"),o==null)return Ie;let a=Je.apiKey(t),m={tiles:[[ct.get(ct.PublicUrlBase)??"",e,i,o.fullName,hc(n),"{z}","{x}","{y}"].join("/")+`.${o.format}?api=${a}`],tilejson:"3.0.0"},p=Ot.convertZoomLevel(o.tileSet.maxZoom??30,wt,n,!0),w=Ot.convertZoomLevel(o.tileSet.minZoom??0,wt,n,!0);o.tileSet.maxZoom&&(m.maxzoom=p),o.tileSet.minZoom&&(m.minzoom=w);let E=JSON.stringify(m),_=Buffer.from(E),C=new te(200,"ok");return C.header(me.CacheControl,"no-store"),C.buffer(_,"application/json"),t.set("bytes",_.byteLength),C}var nw=require("crypto"),sw=require("url");function fc(t,e){if(t==null)return"";let r=ct.get(ct.PublicUrlBase)??"";if(!t.startsWith("/"))return t;let i=new sw.URL(gt.join(r,t));return e&&i.searchParams.set("api",e),i.toString().replace(/%7B/g,"{").replace(/%7D/g,"}")}function l3(t,e){let r=JSON.parse(JSON.stringify(t.sources));for(let[i,n]of Object.entries(r)){if(n.type==="vector")n.url=fc(n.url,e);else if(n.type==="raster"&&Array.isArray(n.tiles))for(let o=0;o<n.tiles.length;o++)n.tiles[o]=fc(n.tiles[o],e);r[i]=n}return{version:8,id:t.id,name:t.name,sources:r,layers:t.layers,metadata:t.metadata??{},glyphs:fc(t.glyphs),sprite:fc(t.sprite)}}async function ow(t,e){let r=Je.apiKey(t);if(r==null)return new te(400,"Invalid API Key.");let i=e.split(".json")[0],n=nt.Style.id(i),o=await nt.Style.get(n);if(o==null)return Ie;let a=l3(o.style,r),h=Buffer.from(JSON.stringify(a)),d=(0,nw.createHash)("sha256").update(h).digest("base64");if(Yr.isNotModified(t,d))return Pn;let m=new te(200,"ok");return m.header(me.ETag,d),m.header(me.CacheControl,"no-store"),m.buffer(h,"application/json"),t.set("bytes",h.byteLength),m}var aw=require("crypto");function u3(t){let e=t.query.getAll("format");if(e==null||e.length===0)return;let r=new Set;for(let i of e){let n=Ph(i);n!=null&&r.add(n)}if(r.size!==0)return[...r.values()]}async function lw(t){let e=Je.action(t),r=jb(e.rest);if(r==null)return Ie;let i=ct.get(ct.PublicUrlBase)??"";t.timer.start("tileset:load");let n=await h3(r.name,r.tileMatrix);if(t.timer.end("tileset:load"),n.length===0)return Ie;let o=nt.Provider.id("linz"),a=await nt.Provider.get(o),h=Je.apiKey(t),d=new cc({httpBase:i,provider:a??void 0,layers:n,apiKey:h,formats:u3(t)}).toXml();if(d==null)return Ie;let m=Buffer.from(d),p=(0,aw.createHash)("sha256").update(m).digest("base64");if(Yr.isNotModified(t,p))return Pn;let w=new te(200,"ok");return w.header(me.ETag,p),w.header(me.CacheControl,"max-age=0"),w.buffer(m,"text/xml"),t.set("bytes",m.byteLength),w}async function h3(t,e){if(e!=null){let r=await Tt.get(t,e);return r==null||r.type===dt.Vector?[]:[r]}return t===""&&(t=dl.aerial),(await Tt.getAll(t,e)).filter(r=>r.type==="raster")}var uw={validate(t,e){let{tileMatrix:r,x:i,y:n,z:o,ext:a}=e;if(t.set("xyz",{x:i,y:n,z:o}),t.set("projection",r.projection.code),t.set("tileMatrix",r.identifier),t.set("extension",a),t.set("tileSet",e.name),o>r.maxZoom||o<0)throw new te(404,`Zoom not found: ${o}`);let h=r.zooms[o];if(i<0||i>h.matrixWidth)throw new te(404,`X not found: ${i}`);if(n<0||n>h.matrixHeight)throw new te(404,`Y not found: ${n}`);let d=Kr.tileCenterToLatLon(r,e);t.set("location",d)}};async function hw(t){let e=Je.action(t),r=Oh(e.rest);if(r==null)return Ie;uw.validate(t,r),t.timer.start("tileset:load");let i=await Tt.get(r.name,r.tileMatrix);return t.timer.end("tileset:load"),i==null?Ie:await i.tile(t,r)}async function cw(t){let{rest:e}=Je.action(t);if(e.length<1)return Ie;let r=Je.apiKey(t);if(!Jv(r))return new te(400,"Invalid API Key");let i=e[e.length-1].toLowerCase();return i==="attribution.json"?tw(t):i==="wmtscapabilities.xml"?lw(t):i==="tile.json"?iw(t):i.endsWith("json")&&e[e.length-2]==="style"?ow(t,i):hw(t)}var _w=require("crypto");var fw=require("crypto"),dw=require("util"),mw=require("zlib");var c3=(0,dw.promisify)(mw.gzip);function f3(t){return t==null?!1:!!(t.endsWith(".geojson")||t.endsWith(".json"))}async function pw(t){let{rest:e}=Je.action(t),[r,i]=e;if(!f3(i))return new te(404,"Not found");let n=await nt.Imagery.get(nt.Imagery.id(r));if(n==null)return new te(404,"Not found");let o=Ht.join(n.uri,i);try{let a=await Ht.read(o),h=(0,fw.createHash)("sha256").update(a).digest("base64");if(Yr.isNotModified(t,h))return Pn;let d=new te(200,"ok");return d.header(me.ETag,h),d.header(me.ContentEncoding,"gzip"),d.buffer(await c3(a),"application/json"),t.set("bytes",a.byteLength),d}catch{return t.log.warn({targetPath:o},"ImageryMetadata:Failed"),new te(404,"Not found")}}async function d3(t,e,r){if(r.identifier!==wt.identifier)return Ie;let i={xmin:r.extent.x,ymin:r.extent.y,xmax:r.extent.right,ymax:r.extent.bottom,spatialReference:{wkid:102100,latestWkid:r.projection.code}},n=new te(200,"ok");return n.json({currentVersion:10.4,name:e,capabilities:"TilesOnly",type:"indexedVector",tileMap:"tilemap",defaultStyles:"resources/styles",tiles:["tiles/{z}/{x}/{y}.pbf"],exportTilesAllowed:!1,maxExportTilesCount:0,initialExtent:i,fullExtent:i,minScale:r.zooms[0].scaleDenominator,maxScale:r.zooms[r.zooms.length-1].scaleDenominator,tileInfo:{rows:256,cols:256,dpi:96,format:"pbf",origin:{x:r.extent.x,y:r.extent.bottom},spatialReference:{wkid:102100,latestWkid:r.projection.code},lods:r.zooms.map((o,a)=>({level:a,scale:o.scaleDenominator,resolution:o.scaleDenominator*28e-5}))},resourceInfo:{styleVersion:8,tileCompression:"gzip",cacheInfo:{storageInfo:{packetSize:128,storageFormat:"compactV2"}}}}),n}async function gw(t){let{rest:e}=Je.action(t);if(e[0]!=="services")return Ie;let r=e[1];if(r==null)return Ie;if(e[2]!=="VectorTileServer")return Ie;if(e.length===3)return d3(t,r,wt);if(e[e.length-1].endsWith(".pbf")){let n=[r,wt.identifier,...e.slice(e.length-3)],o=Oh(n);if(o==null)return Ie;t.timer.start("tileset:load");let a=await Tt.get(o.name,o.tileMatrix);return t.timer.end("tileset:load"),a==null?Ie:await a.tile(t,o)}return new te(200,"ok")}var yw=ve(require("path"),1);var tp=new Map;tp.set(".png","image/png");tp.set(".json","application/json");function m3(t){return t[0]===31&&t[1]===139}async function bw(t){let e=ct.get(ct.AssetLocation);if(e==null)return Ie;let r=yw.default.extname(t.params.spriteName),i=tp.get(r);if(i==null)return Ie;try{let n=gt.join(e,gt.join("/sprites",t.params.spriteName));t.set("target",n);let o=await gt.read(n),a=te.ok().buffer(o,i);return m3(o)&&a.header("content-encoding","gzip"),a}catch(n){if(n.code===404)return Ie;throw n}}var dc=ve(require("path"),1);async function vw(t){let e=ct.get(ct.AssetLocation);if(e==null)return Ie;try{let r=gt.join(e,dc.default.join("fonts",t.params.fontStack,t.params.range))+".pbf",i=await gt.read(r);return te.ok().buffer(i,"application/x-protobuf")}catch(r){if(r.code===404)return Ie;throw r}}async function p3(t){let e=new Set;for await(let r of gt.list(t)){if(!r.endsWith(".pbf"))continue;let i=dc.default.basename(dc.default.dirname(r));i.includes("/")||e.add(i)}return[...e].sort()}async function ww(){let t=ct.get(ct.AssetLocation);if(t==null)return Ie;try{let e=gt.join(t,"/fonts"),r=await p3(e);return te.ok().buffer(JSON.stringify(r),"application/json")}catch(e){if(e.code===404)return Ie;throw e}}var Ls=new Je;Ls.get("ping",_v);Ls.get("health",Zv);Ls.get("version",Sv);Ls.get("tiles",cw);Ls.get("imagery",pw);Ls.get("esri",gw);var Ns=null;async function Sw(t){On.reset(),Ns&&clearTimeout(Ns),Ns=setTimeout(()=>t.log.warn(t.logContext,"Lambda:Slow"),1e4),Ns.unref(),t.set("name","LambdaTiler");try{let e=Je.apiKey(t);if(e!=null){let i=(0,_w.createHash)("sha256").update(e).digest("base64");t.set("api",i)}let r=await Ls.handle(t);return t.set("requests",On.requests.slice(0,100)),t.set("requestCount",On.requests.length),r}finally{Ns&&clearTimeout(Ns),Ns=null}}var Cl=mr.http(Ih.get());Cl.router.get("/v1/sprites/:spriteName",bw);Cl.router.get("/v1/fonts.json",ww);Cl.router.get("/v1/fonts/:fontStack/:range.pbf",vw);Cl.router.get("*",Sw);0&&(module.exports={handleRequest,handler});
183
+ `;r+="return ret";let i=new Function("_bp","buf","ctx",r);this.parse=i.bind(null,e)}get size(){if(this._size>-1)return this._size;let e=0;for(let r of this.fields)e+=r.parser.size;return this._size=e,this._size}parse(e,r){return{}}};function ea(t,e=2){return"0x"+t.toString(16).padStart(e,"0")}var mc=class extends Ne{constructor(e,r){super("Offset:"+e.name+":"+r.name),this.type=r,this.offset=e}get size(){return this.type.size}parse(e,r){let i=this.offset.parse(e,r);if(i>e.length||i<0)throw new Error(`[${this.name}]: BufferOverflow attempted read at ${ea(i)}`);return this.type.parse(e,{offset:i,startOffset:i})}};var gc=class extends Ne{constructor(e){super("Skip:"+e),this.size=e}parse(e,r){r.offset+=this.size}};var yc=class extends Ne{constructor(){super("String")}get size(){throw new Error("Unable to calculate size from dynamic object")}parse(e,r){let i=r.offset,n=[],s=0;for(;s+i<e.length;){let a=e[i+s];if(a===0)break;n.push(String.fromCharCode(a)),s++}return r.offset+=s+1,n.join("")}},bc=class extends Ne{constructor(e){super("String:"+e),this.size=e}parse(e,r){let i=r.offset;if(this.size+i>e.length)throw new Error(`BufferOverflow: ${this.name} offset: ${ea(r.offset)}`);let n=[],s=0;for(;s<this.size;){let a=e[i+s];if(a===0)break;n.push(String.fromCharCode(a)),s++}return r.offset+=this.size,n.join("")}};function XS(t,e,r,i){return typeof r=="number"?new ac(t,e,r):new lc(t,e,r,i??!1)}var hr={u8:m4,lu16:g4,lu32:Xo,lu64:y4,blu64:b4,empty:new Qo("Empty",{}),offset(t,e){return new mc(t,e)},string(t){return t==null?new yc:new bc(t)},bits(t,e){return new uc(t,e)},flags(t,e,r){return new cc(t,e,r)},object(t,e){return new pc(t,e)},static(t,e){return new Qo(t,e)},lookup(t,e,r){return new fc(t,e,r)},enum(t,e,r){return new dc(t,e,r)},bytes(t){return new hc(t)},skip(t){return new gc(t)},array:XS};var v4;(function(t){t[t.File="0".charCodeAt(0)]="File",t[t.HardLink="1".charCodeAt(0)]="HardLink",t[t.SymLink="2".charCodeAt(0)]="SymLink",t[t.CharDeviceNode="3".charCodeAt(0)]="CharDeviceNode",t[t.BlockDeviceNode="4".charCodeAt(0)]="BlockDeviceNode",t[t.Directory="5".charCodeAt(0)]="Directory",t[t.FifoNode="6".charCodeAt(0)]="FifoNode",t[t.Reserved="7".charCodeAt(0)]="Reserved",t[t.LongName="L".charCodeAt(0)]="LongName",t[t.LongLink="K".charCodeAt(0)]="LongLink"})(v4||(v4={}));var QS=hr.object("TarHeader",{path:hr.string(100),skip1:hr.skip(24),size:hr.bytes(12).refine(t=>parseInt(t.toString(),8)),skip2:hr.skip(20),type:hr.u8,linkName:hr.string(100)});var w4={32:16777619n,64:1099511628211n,128:309485009821345068724781371n,256:374144419156711147060143317175368453031918731002211n,512:35835915874844867368919076489095108449946327955754392558399825615420669938882575126094039892345713852759n,1024:5016456510113118655434598811035278955030765345404790744303017523831112055108147451509157692220295382716162651878526895249385292291816524375083746691371804094271873160484737966720260389217684476157468082573n},ex={32:2166136261n,64:14695981039346656037n,128:144066263297769815596495629667062367629n,256:100029257958052580907070968620625704837092796014241193945225284501741471925557n,512:9659303129496669498009435400716310466090418745672637896108374329434462657994582932197716438449813051892206539805784495328239340083876191928701583869517785n,1024:14197795064947621068722070641403218320880622795441933960878474914617582723252296732303717722150864096521202355549365628174669108571814760471015076148029755969804077320157692458563003215304957150157403644460363550505412711285966361610267868082893823963790439336411086884584107735010676915n};function Rd(t,{size:e=32}={}){if(!w4[e])throw new Error("The `size` option must be one of 32, 64, 128, 256, 512, or 1024");let r=ex[e],i=w4[e],n=!1;for(let s=0;s<t.length;s++){let a=t.charCodeAt(s);a>127&&!n&&(t=unescape(encodeURIComponent(t)),a=t.charCodeAt(s),n=!0),r^=BigInt(a),r=BigInt.asUintN(e,r*i)}return r}var vc="COT";var tx=BigInt(0),rx=BigInt(32),ix=BigInt(2**32-1),_4=hr.object("CotarMetadata",{magic:hr.string(vc.length),version:hr.u8,count:hr.lu32}),$r=class{constructor(e,r,i=0){this.isHeader=!0,this.source=e,this.sourceOffset=i,this.metadata=r}static hash(e){return Rd(e,{size:64})}static async loadMetadata(e,r,i){if(i){await e.loadBytes(r,e.chunkSize);let s=e.bytes(r,8);return _4.read(s).value}let n=await e.fetchBytes(-8);return _4.read(new Uint8Array(n)).value}static async getMetadata(e,r,i){let n=await this.loadMetadata(e,r,i);if(n.magic!==vc)throw new Error(`Invalid source: ${e.uri} invalid magic found: ${n.magic}`);if(n.version===1||n.version===2)return n;throw new Error(`Invalid source: ${e.uri} invalid version found: ${n.version}`)}static async create(e,r=0,i=!0){let n=await this.getMetadata(e,r,i);return new $r(e,n,r)}async find(e){if(this.metadata.version===1)return this._findV1(e);if(this.metadata.version===2)return this._findV2(e);throw new Error("Invalid metadata version")}async _findV2(e){let r=$r.hash(e),i=this.metadata.count,n=Number(r%BigInt(i)),s=Number(r>>rx),a=Number(r&ix),c=null,d=null,p=n;for(;;){let m=this.sourceOffset+p*16+8;if(await this.source.loadBytes(m,16),d=this.source.getUint32(m),c=this.source.getUint32(m+4),c===s&&d===a){let w=this.source.getUint32(m+8)*512,S=this.source.getUint32(m+12);return{offset:w,size:S}}if(c===0&&d===0||(p++,p>=i&&(p=0),p===n))return null}}async _findV1(e){let r=$r.hash(e),i=this.metadata.count,n=Number(r%BigInt(i)),s=null,a=n;for(;;){let c=this.sourceOffset+a*24+8;if(await this.source.loadBytes(c,24),s=this.source.getBigUint64(c),s===r){let d=this.source.getUint64(c+8),p=this.source.getUint64(c+16);return{offset:d,size:p}}if(s===tx||(a++,a>=i&&(a=0),a===n))return null}}};var qk=BigInt(0);var _s=class{constructor(e,r){this.source=e,this.index=r}static async fromTar(e){let r=await $r.getMetadata(e,0,!1),i=await e.size,n=r.version===1?24:16,s=i-(r.count*n+16),a=new $r(e,r,s);return new _s(e,a)}async get(e){let r=await this.index.find(e);return r==null?null:(await this.source.loadBytes(r.offset,r.size),this.source.bytes(r.offset,r.size))}};var Ie=new Y(404,"Not Found"),xn=new Y(304,"Not modified");var Cd=class{constructor(){this.requests=[]}reset(){this.requests=[]}trace(e){let r=e.fetchBytes;e.fetchBytes=async(i,n)=>{let s={source:e.uri,offset:i,length:n};this.requests.push(s);let a=Date.now(),c=await r.apply(e,[i,n]);return s.duration=Date.now()-a,c}}},$i=new Cd;var _c=class{static get(e){let r=_c.cache.get(e);if(r==null){let i=Ye.source(e);$i.trace(i),r=_s.fromTar(i),_c.cache.set(e,r)}return r}},ta=_c;ta.cache=new Map;async function P1(t,e,r){let i=await ta.get(t);if(i==null)return Ie;let n=await i.get(e);if(n==null)return Ie;let s=Buffer.from(n),a=Y.ok().buffer(s,r);return Ad(s)&&a.header("content-encoding","gzip"),a}function Ad(t){return t[0]===31&&t[1]===139}async function x4(t){let e=Xe.get(Xe.AssetLocation);if(e==null)return Ie;let r=decodeURIComponent(t.params.fontStack),i=Sc.default.join("fonts",r,t.params.range)+".pbf";if(e.endsWith(".tar.co"))return P1(e,i,"application/x-protobuf");try{let n=Ye.join(e,i),s=await Ye.read(n);return Y.ok().buffer(s,"application/x-protobuf")}catch(n){if(n.code===404)return Ie;throw n}}async function sx(t){let e=new Set;for await(let r of Ye.list(t)){if(!r.endsWith(".pbf"))continue;let i=Sc.default.basename(Sc.default.dirname(r));i.includes("/")||e.add(i)}return[...e].sort()}async function M4(){let t=Xe.get(Xe.AssetLocation);if(t==null)return Ie;if(t.endsWith(".tar.co"))return P1(t,"fonts.json","application/json");try{let e=Ye.join(t,"/fonts"),r=await sx(e);return Y.ok().buffer(JSON.stringify(r),"application/json")}catch(e){if(e.code===404)return Ie;throw e}}var Fd=fe(require("fs"),1),kc=fe(require("path"),1),q4=fe(I4(),1),Hd=fe(require("sharp"),1),U4=fe(require("url"),1);var Ec=fe(require("sharp"),1);function lx(t){return t!=null}var Mc=new Map,Mn=class{constructor(e){this.tileSize=e}isTooLarge(e){return!!(e.resize&&(e.resize.width>=Mn.MaxImageSize||e.resize.height>=Mn.MaxImageSize))}getEmptyImage(e,r){let i=[e,r.r,r.g,r.b,r.alpha].join("-"),n=Mc.get(i);return n||(n=this.toImage(e,this.createImage(r)),Mc.size>128&&Mc.clear(),Mc.set(i,n),n)}toImage(e,r){switch(e){case qe.Jpeg:return r.jpeg().toBuffer();case qe.Png:return r.png().toBuffer();case qe.Webp:return r.webp().toBuffer();case qe.Avif:return r.avif().toBuffer();default:throw new Error(`Invalid image format "${e}"`)}}async getImageBuffer(e,r,i){return e.length===0?this.getEmptyImage(r,i):this.toImage(r,this.createImage(i).composite(e))}isDirectImage(e){var r;if(e.layers.length!==1)return!1;let i=e.layers[0];if(i.x!==0||i.y!==0||i.crop!=null||i.extract!=null||i.resize!=null)return!1;let n=i.tiff.getImage(i.source.imageId),s=n.tileSize;return!(s.height!==this.tileSize||s.width!==this.tileSize||!(!((r=n.compression)===null||r===void 0)&&r.includes(e.format))||e.background.alpha!==0)}async compose(e){var r;let i=(r=e.metrics)!==null&&r!==void 0?r:new ys;if(i.start("compose:overlay"),this.isDirectImage(e)){let c=e.layers[0],d=await c.tiff.getTile(c.source.x,c.source.y,c.source.imageId);return i.end("compose:overlay"),d==null?{buffer:await this.getEmptyImage(e.format,e.background),metrics:i,layers:0}:(i.start("compose:direct"),i.end("compose:direct"),{buffer:Buffer.from(d.bytes),metrics:i,layers:1})}let n=[];for(let c of e.layers)this.isTooLarge(c)||n.push(this.composeTile(c,e.resizeKernel));let s=await Promise.all(n).then(c=>c.filter(lx));i.end("compose:overlay"),i.start("compose:compress");let a=await this.getImageBuffer(s,e.format,e.background);return i.end("compose:compress"),{buffer:a,metrics:i,layers:s.length}}async composeTile(e,r){let i=await e.tiff.getTile(e.source.x,e.source.y,e.source.imageId);if(i==null)return null;let n=(0,Ec.default)(Buffer.from(i.bytes)),{extract:s,resize:a,crop:c}=e;if(s&&n.extract({top:0,left:0,width:s.width,height:s.height}),a){let d={fit:Ec.default.fit.cover,kernel:a.scale>1?r.in:r.out};n.resize(a.width,a.height,d)}return c&&n.extract({top:c.y,left:c.x,width:c.width,height:c.height}),{input:await n.toBuffer(),top:e.y,left:e.x}}createImage(e){return(0,Ec.default)({create:{width:this.tileSize,height:this.tileSize,channels:4,background:e}})}};Mn.MaxImageSize=256*2**15;var Rr;(function(t){t.NONE="application/octet-stream",t.JPEG="image/jpeg",t.JP2="image/jp2",t.WEBP="image/webp",t.LZW="application/lzw",t.DEFLATE="application/deflate"})(Rr||(Rr={}));var kd={1:Rr.NONE,5:Rr.LZW,6:Rr.JPEG,7:Rr.JPEG,8:Rr.DEFLATE,34712:Rr.JP2,50001:Rr.WEBP};var ne;(function(t){t[t.Artist=315]="Artist",t[t.BitsPerSample=258]="BitsPerSample",t[t.CellLength=265]="CellLength",t[t.CellWidth=264]="CellWidth",t[t.ColorMap=320]="ColorMap",t[t.Compression=259]="Compression",t[t.Copyright=33432]="Copyright",t[t.DateTime=306]="DateTime",t[t.ExtraSamples=338]="ExtraSamples",t[t.FillOrder=266]="FillOrder",t[t.FreeByteCounts=289]="FreeByteCounts",t[t.FreeOffsets=288]="FreeOffsets",t[t.GrayResponseCurve=291]="GrayResponseCurve",t[t.GrayResponseUnit=290]="GrayResponseUnit",t[t.HostComputer=316]="HostComputer",t[t.ImageDescription=270]="ImageDescription",t[t.ImageHeight=257]="ImageHeight",t[t.ImageWidth=256]="ImageWidth",t[t.Make=271]="Make",t[t.MaxSampleValue=281]="MaxSampleValue",t[t.MinSampleValue=280]="MinSampleValue",t[t.Model=272]="Model",t[t.NewSubFileType=254]="NewSubFileType",t[t.Orientation=274]="Orientation",t[t.PhotometricInterpretation=262]="PhotometricInterpretation",t[t.PlanarConfiguration=284]="PlanarConfiguration",t[t.ResolutionUnit=296]="ResolutionUnit",t[t.RowsPerStrip=278]="RowsPerStrip",t[t.SamplesPerPixel=277]="SamplesPerPixel",t[t.Software=305]="Software",t[t.StripByteCounts=279]="StripByteCounts",t[t.StripOffsets=273]="StripOffsets",t[t.SubFileType=255]="SubFileType",t[t.Threshholding=263]="Threshholding",t[t.XResolution=282]="XResolution",t[t.YResolution=283]="YResolution",t[t.BadFaxLines=326]="BadFaxLines",t[t.CleanFaxData=327]="CleanFaxData",t[t.ClipPath=343]="ClipPath",t[t.ConsecutiveBadFaxLines=328]="ConsecutiveBadFaxLines",t[t.Decode=433]="Decode",t[t.DefaultImageColor=434]="DefaultImageColor",t[t.DocumentName=269]="DocumentName",t[t.DotRange=336]="DotRange",t[t.HalftoneHints=321]="HalftoneHints",t[t.Indexed=346]="Indexed",t[t.JPEGTables=347]="JPEGTables",t[t.PageName=285]="PageName",t[t.PageNumber=297]="PageNumber",t[t.Predictor=317]="Predictor",t[t.PrimaryChromaticities=319]="PrimaryChromaticities",t[t.ReferenceBlackWhite=532]="ReferenceBlackWhite",t[t.SampleFormat=339]="SampleFormat",t[t.SMinSampleValue=340]="SMinSampleValue",t[t.SMaxSampleValue=341]="SMaxSampleValue",t[t.StripRowCounts=559]="StripRowCounts",t[t.SubIFDs=330]="SubIFDs",t[t.T4Options=292]="T4Options",t[t.T6Options=293]="T6Options",t[t.TileByteCounts=325]="TileByteCounts",t[t.TileHeight=323]="TileHeight",t[t.TileOffsets=324]="TileOffsets",t[t.TileWidth=322]="TileWidth",t[t.TransferFunction=301]="TransferFunction",t[t.WhitePoint=318]="WhitePoint",t[t.XClipPathUnits=344]="XClipPathUnits",t[t.XPosition=286]="XPosition",t[t.YCbCrCoefficients=529]="YCbCrCoefficients",t[t.YCbCrPositioning=531]="YCbCrPositioning",t[t.YCbCrSubSampling=530]="YCbCrSubSampling",t[t.YClipPathUnits=345]="YClipPathUnits",t[t.YPosition=287]="YPosition",t[t.ApertureValue=37378]="ApertureValue",t[t.ColorSpace=40961]="ColorSpace",t[t.DateTimeDigitized=36868]="DateTimeDigitized",t[t.DateTimeOriginal=36867]="DateTimeOriginal",t[t.ExifIFD=34665]="ExifIFD",t[t.ExifVersion=36864]="ExifVersion",t[t.ExposureTime=33434]="ExposureTime",t[t.FileSource=41728]="FileSource",t[t.Flash=37385]="Flash",t[t.FlashpixVersion=40960]="FlashpixVersion",t[t.FNumber=33437]="FNumber",t[t.ImageUniqueID=42016]="ImageUniqueID",t[t.LightSource=37384]="LightSource",t[t.MakerNote=37500]="MakerNote",t[t.ShutterSpeedValue=37377]="ShutterSpeedValue",t[t.UserComment=37510]="UserComment",t[t.IPTC=33723]="IPTC",t[t.ICCProfile=34675]="ICCProfile",t[t.XMP=700]="XMP",t[t.GDAL_METADATA=42112]="GDAL_METADATA",t[t.GDAL_NODATA=42113]="GDAL_NODATA",t[t.Photoshop=34377]="Photoshop",t[t.ModelPixelScale=33550]="ModelPixelScale",t[t.ModelTiePoint=33922]="ModelTiePoint",t[t.ModelTransformation=34264]="ModelTransformation",t[t.GeoKeyDirectory=34735]="GeoKeyDirectory",t[t.GeoDoubleParams=34736]="GeoDoubleParams",t[t.GeoAsciiParams=34737]="GeoAsciiParams"})(ne||(ne={}));var T1;(function(t){t[t.GTModelTypeGeoKey=1024]="GTModelTypeGeoKey",t[t.GTRasterTypeGeoKey=1025]="GTRasterTypeGeoKey",t[t.GTCitationGeoKey=1026]="GTCitationGeoKey",t[t.GeographicTypeGeoKey=2048]="GeographicTypeGeoKey",t[t.GeogCitationGeoKey=2049]="GeogCitationGeoKey",t[t.GeogGeodeticDatumGeoKey=2050]="GeogGeodeticDatumGeoKey",t[t.GeogPrimeMeridianGeoKey=2051]="GeogPrimeMeridianGeoKey",t[t.GeogLinearUnitsGeoKey=2052]="GeogLinearUnitsGeoKey",t[t.GeogLinearUnitSizeGeoKey=2053]="GeogLinearUnitSizeGeoKey",t[t.GeogAngularUnitsGeoKey=2054]="GeogAngularUnitsGeoKey",t[t.GeogAngularUnitSizeGeoKey=2055]="GeogAngularUnitSizeGeoKey",t[t.GeogEllipsoidGeoKey=2056]="GeogEllipsoidGeoKey",t[t.GeogSemiMajorAxisGeoKey=2057]="GeogSemiMajorAxisGeoKey",t[t.GeogSemiMinorAxisGeoKey=2058]="GeogSemiMinorAxisGeoKey",t[t.GeogInvFlatteningGeoKey=2059]="GeogInvFlatteningGeoKey",t[t.GeogAzimuthUnitsGeoKey=2060]="GeogAzimuthUnitsGeoKey",t[t.GeogPrimeMeridianLongGeoKey=2061]="GeogPrimeMeridianLongGeoKey",t[t.GeogTOWGS84GeoKey=2062]="GeogTOWGS84GeoKey",t[t.ProjectedCSTypeGeoKey=3072]="ProjectedCSTypeGeoKey",t[t.PCSCitationGeoKey=3073]="PCSCitationGeoKey",t[t.ProjectionGeoKey=3074]="ProjectionGeoKey",t[t.ProjCoordTransGeoKey=3075]="ProjCoordTransGeoKey",t[t.ProjLinearUnitsGeoKey=3076]="ProjLinearUnitsGeoKey",t[t.ProjLinearUnitSizeGeoKey=3077]="ProjLinearUnitSizeGeoKey",t[t.ProjStdParallel1GeoKey=3078]="ProjStdParallel1GeoKey",t[t.ProjStdParallel2GeoKey=3079]="ProjStdParallel2GeoKey",t[t.ProjNatOriginLongGeoKey=3080]="ProjNatOriginLongGeoKey",t[t.ProjNatOriginLatGeoKey=3081]="ProjNatOriginLatGeoKey",t[t.ProjFalseEastingGeoKey=3082]="ProjFalseEastingGeoKey",t[t.ProjFalseNorthingGeoKey=3083]="ProjFalseNorthingGeoKey",t[t.ProjFalseOriginLongGeoKey=3084]="ProjFalseOriginLongGeoKey",t[t.ProjFalseOriginLatGeoKey=3085]="ProjFalseOriginLatGeoKey",t[t.ProjFalseOriginEastingGeoKey=3086]="ProjFalseOriginEastingGeoKey",t[t.ProjFalseOriginNorthingGeoKey=3087]="ProjFalseOriginNorthingGeoKey",t[t.ProjCenterLongGeoKey=3088]="ProjCenterLongGeoKey",t[t.ProjCenterLatGeoKey=3089]="ProjCenterLatGeoKey",t[t.ProjCenterEastingGeoKey=3090]="ProjCenterEastingGeoKey",t[t.ProjCenterNorthingGeoKey=3091]="ProjCenterNorthingGeoKey",t[t.ProjScaleAtNatOriginGeoKey=3092]="ProjScaleAtNatOriginGeoKey",t[t.ProjScaleAtCenterGeoKey=3093]="ProjScaleAtCenterGeoKey",t[t.ProjAzimuthAngleGeoKey=3094]="ProjAzimuthAngleGeoKey",t[t.ProjStraightVertPoleLongGeoKey=3095]="ProjStraightVertPoleLongGeoKey",t[t.ProjRectifiedGridAngleGeoKey=3096]="ProjRectifiedGridAngleGeoKey",t[t.VerticalCSTypeGeoKey=4096]="VerticalCSTypeGeoKey",t[t.VerticalCitationGeoKey=4097]="VerticalCitationGeoKey",t[t.VerticalDatumGeoKey=4098]="VerticalDatumGeoKey",t[t.VerticalUnitsGeoKey=4099]="VerticalUnitsGeoKey"})(T1||(T1={}));var Re;(function(t){t[t.BYTE=1]="BYTE",t[t.ASCII=2]="ASCII",t[t.SHORT=3]="SHORT",t[t.LONG=4]="LONG",t[t.RATIONAL=5]="RATIONAL",t[t.SBYTE=6]="SBYTE",t[t.UNDEFINED=7]="UNDEFINED",t[t.SSHORT=8]="SSHORT",t[t.SLONG=9]="SLONG",t[t.SRATIONAL=10]="SRATIONAL",t[t.FLOAT=11]="FLOAT",t[t.DOUBLE=12]="DOUBLE",t[t.LONG8=16]="LONG8",t[t.SLONG8=17]="SLONG8",t[t.IFD8=18]="IFD8"})(Re||(Re={}));var be;(function(t){t[t.UInt8=1]="UInt8",t[t.UInt16=2]="UInt16",t[t.UInt32=4]="UInt32",t[t.UInt64=8]="UInt64",t[t.Double=8]="Double",t[t.Float=4]="Float"})(be||(be={}));var k4=2**32,ux=typeof setImmediate>"u"?setTimeout:setImmediate,Ot=()=>{throw new Error("Method not implemented.")},yi=class{constructor(){this.isLittleEndian=!0,this.delayMs=yi.DefaultDelayMs,this.maxChunkCount=10,this.chunks=yi.DefaultChunkCache(),this.blankFillCount=16,this.maxConcurrentRequests=50,this.toFetch=new Set,this.toFetchPromise=null,this.byteOffset=0,this.getFloat32=Ot,this.getFloat64=Ot,this.getInt8=Ot,this.getInt16=Ot,this.getInt32=Ot,this.setFloat32=Ot,this.setFloat64=Ot,this.setInt8=Ot,this.setInt16=Ot,this.setInt32=Ot,this.setUint8=Ot,this.setUint16=Ot,this.setUint32=Ot,this.setBigInt64=Ot,this.setBigUint64=Ot}static getByteRanges(e,r=32,i=16){if(e.size===0)return{chunks:[],blankFill:[]};let n=[...e.values()].sort((d,p)=>d-p),s=[],a=[];s.push(a);let c=[];for(let d=0;d<n.length;++d){let p=n[d],m=n[d-1];if(a.length>=r)a=[p],s.push(a);else if(d===0||p===m+1)a.push(p);else if(p<m+i){for(let w=m;w<p;w++)a.push(w+1),c.push(w+1);c.pop()}else a=[p],s.push(a)}return{chunks:s,blankFill:c}}async fetchData(){if(this.toFetch.size===0)return;let e=this.toFetch;this.toFetch=new Set,this.toFetchPromise=null;let r=yi.getByteRanges(e,this.maxChunkCount,this.blankFillCount),i=[];for(let n of r.chunks){let s=n[0],a=n[n.length-1],c=s*this.chunkSize,d=a*this.chunkSize+this.chunkSize-c,p=await this.fetchBytes(c,d);if(n.length===1){i[s]=p,this.chunks.set(s,new DataView(p));continue}let m=s*this.chunkSize;for(let w of n){let S=w*this.chunkSize-m,v=p.slice(S,S+this.chunkSize);i[w]=v,this.chunks.set(w,new DataView(v))}}}async loadBytes(e,r){if(e<0)throw new Error("Offset must be positive");let i=Math.floor(e/this.chunkSize),n=Math.ceil((e+r)/this.chunkSize)-1;for(let s=i;s<=n;s++)this.chunks.has(s)||this.toFetch.add(s);if(this.toFetch.size!==0){if(this.toFetchPromise==null&&(this.toFetchPromise=new Promise(s=>ux(s,this.delayMs)).then(()=>this.fetchData())),this.toFetch.size>this.maxConcurrentRequests)throw new Error("Too many outstanding requests");await this.toFetchPromise}}getChunkId(e){return Math.floor(e/this.chunkSize)}getUint(e,r){switch(r){case be.UInt8:return this.getUint8(e);case be.UInt16:return this.getUint16(e);case be.UInt32:return this.getUint32(e);case be.UInt64:return this.getUint64(e)}}bytes(e,r){let i=this.isOneChunk(e,r);if(i){let p=this.getView(i),m=e-i*this.chunkSize;return new Uint8Array(p.buffer.slice(m,m+r))}let n=new Uint8Array(r),s=e+r,a=Math.floor(e/this.chunkSize),c=Math.ceil((e+r)/this.chunkSize)-1,d=0;for(let p=a;p<=c;p++){let m=e+d,w=p*this.chunkSize,S=this.getView(p),v=Math.min(s,w+this.chunkSize),R=S.buffer.slice(m-w,v-w);n.set(new Uint8Array(R),d),d+=R.byteLength}return n}getView(e){let r=this.chunks.get(e);if(r==null)throw new Error(`Chunk:${e} is not ready`);return r}isOneChunk(e,r){let i=e+r-1,n=Math.floor(e/this.chunkSize);return Math.floor(i/this.chunkSize)-n<1?n:null}hasBytes(e,r=1){let i=Math.floor(e/this.chunkSize),n=Math.ceil((e+r)/this.chunkSize)-1;for(let s=i;s<=n;s++)if(!this.chunks.has(s))return!1;return!0}toRange(e,r){if(r==null)return`bytes=${e}`;if(e<0)throw new Error("Cannot read from remote source with negative offset and length");return`bytes=${e}-${e+r}`}parseContentRange(e){let[r,i]=e.split(" ");if(r!=="bytes")throw new Error("Failed to parse content-range: "+e);if(i==null)throw new Error("Failed to parse content-range: "+e);let[,n]=i.split("/"),s=Number(n);if(isNaN(s))throw new Error("Failed to parse content-range: "+e);return s}get buffer(){throw new Error("Method not implemented.")}get byteLength(){if(this._byteLength)return this._byteLength;throw Error(".size() has not been fetched.")}getUint8(e){let r=Math.floor(e/this.chunkSize),i=this.chunks.get(r);if(i==null)throw new Error(`Chunk:${r} is not ready`);return i.getUint8(e-r*this.chunkSize)}getUint16(e){let r=this.isOneChunk(e,be.UInt16);if(r!=null)return this.getView(r).getUint16(e-r*this.chunkSize,this.isLittleEndian);let i=this.getUint8(e),n=this.getUint8(e+be.UInt8);return this.isLittleEndian?i+(n<<8):(i<<8)+n}getUint32(e){let r=this.isOneChunk(e,be.UInt32);if(r!=null)return this.getView(r).getUint32(e-r*this.chunkSize,this.isLittleEndian);let i=this.getUint16(e),n=this.getUint16(e+be.UInt16);return this.isLittleEndian?i+n*65536:i*65536+n}getUint64(e){let r=this.isOneChunk(e,be.UInt64);if(r!=null){let s=this.getView(r);return Number(s.getBigUint64(e-r*this.chunkSize,this.isLittleEndian))}let i=this.getUint32(e),n=this.getUint32(e+be.UInt32);return this.isLittleEndian?i+n*k4:i*k4+n}getBigUint64(e){let r=this.isOneChunk(e,be.UInt64);if(r!=null)return this.getView(r).getBigUint64(e-r*this.chunkSize,this.isLittleEndian);let i=BigInt(this.getUint32(e)),n=BigInt(this.getUint32(e+be.UInt32));return this.isLittleEndian?i+(n<<BigInt(32)):(i<<BigInt(32))+n}getBigInt64(){throw new Error("Not implemented.")}};yi.DefaultChunkCache=()=>new Map;yi.DefaultDelayMs=1;var O4=fe(Ld(),1);function L4(t){switch(t){case Re.BYTE:case Re.ASCII:case Re.SBYTE:case Re.UNDEFINED:return 1;case Re.SHORT:case Re.SSHORT:return 2;case Re.LONG:case Re.SLONG:case Re.FLOAT:return 4;case Re.RATIONAL:case Re.SRATIONAL:case Re.DOUBLE:case Re.LONG8:case Re.SLONG8:case Re.IFD8:return 8;default:throw new Error(`Invalid fieldType ${t}`)}}var xs={char:(t,e)=>String.fromCharCode(t.getUint8(e)),uint8:(t,e)=>t.getUint8(e),uint16:(t,e)=>t.getUint16(e),uint32:(t,e)=>t.getUint32(e),uint64:(t,e)=>t.getUint64(e),double:(t,e)=>O4.read(t.bytes(e,be.Double),0,t.isLittleEndian,52,8),rational:(t,e)=>[t.getUint32(e),t.getUint32(e+4)]};function Rc(t){switch(t){case Re.ASCII:return xs.char;case Re.BYTE:case Re.UNDEFINED:case Re.SBYTE:return xs.uint8;case Re.SHORT:case Re.SSHORT:return xs.uint16;case Re.LONG:case Re.SLONG:return xs.uint32;case Re.RATIONAL:case Re.SRATIONAL:return xs.rational;case Re.DOUBLE:return xs.double;case Re.LONG8:return xs.uint64;default:throw new Error(`Unknown read type "${t}" "${Re[t]}"`)}}var En=class{constructor(e,r,i){this.tiff=r,this.byteOffset=i,this.id=e,this.name=ne[this.id],this.dataType=this.tiff.source.getUint16(i+2),this.dataCount=this.tiff.source.getUint(i+4,this.tiff.ifdConfig.pointer),this.dataTypeSize=L4(this.dataType),this.dataLength=this.dataTypeSize*this.dataCount}get hasBytes(){return this.tiff.source.hasBytes(this.valuePointer,this.dataLength)}get isReady(){return!0}get dataTypeName(){return Re[this.dataType]}get valuePointer(){let e=this.size-this.tiff.ifdConfig.pointer;return this.isValueInline?this.byteOffset+e:this.tiff.source.getUint(this.byteOffset+e,this.tiff.ifdConfig.pointer)}get size(){return this.tiff.ifdConfig.ifd}get isValueInline(){return this.dataLength<=this.tiff.ifdConfig.pointer}readValue(){let e=this.valuePointer,r=this.dataTypeSize,i=Rc(this.dataType),n=this.dataCount,s=n*r;if(n===1)return i(this.tiff.source,e);let a=[];for(let c=0;c<s;c+=r)a.push(i(this.tiff.source,e+c));return this.dataType===Re.ASCII?a.join("").trim():a}toJSON(){return{id:this.id,name:this.name,offset:this.byteOffset,isReady:this.isReady,type:this.dataTypeName,value:this.value}}};var Ms=class extends En{constructor(){super(...arguments),this.value=null}get isReady(){return this.value!=null}async fetch(){return this.tiff.source.hasBytes(this.valuePointer,this.dataLength)===!1&&await this.tiff.source.loadBytes(this.valuePointer,this.dataLength),this.value=this.readValue(),this.value}};var I1=class extends En{constructor(e,r,i){super(e,r,i),this.loadedValues=null}get value(){return this.loadedValues!=null?this.loadedValues:this.hasBytes?(this.readValue(),this.loadedValues):null}async load(){await this.tiff.source.loadBytes(this.valuePointer,this.dataLength),this.readValue()}readValue(){let e=super.readValue();return typeof e=="number"?this.loadedValues=[e]:this.loadedValues=e,this.loadedValues}async getValueAt(e){if(this.loadedValues)return this.loadedValues[e];let r=this.dataTypeSize,i=this.valuePointer+r*e,n=Rc(this.dataType);return this.tiff.source.hasBytes(i,r)||await this.tiff.source.loadBytes(i,r),n(this.tiff.source,i)}};var k1=class extends En{constructor(){super(...arguments),this._isRead=!1,this._value=null}get value(){return this._isRead===!1&&(this._value=this.readValue(),this._isRead=!0),this._value}};var Cc={create(t,e){let r=t.source.getUint16(e);if(r===ne.TileOffsets||r===ne.TileByteCounts||r===ne.StripByteCounts||r===ne.StripOffsets)return new I1(r,t,e);let i=new k1(r,t,e);return i.hasBytes?i:new Ms(r,t,e)},isStatic(t){return t instanceof k1},isLazy(t){return t instanceof Ms},isOffsetArray(t){return t instanceof I1}};var cx=32767,Ac=class{constructor(e,r,i){this.tagsGeoLoaded=!1,this.tagsGeo=new Map,this.tif=e,this.id=r,this.tags=i}async init(e=!1){let r=[this.fetch(ne.Compression),this.fetch(ne.ImageHeight),this.fetch(ne.ImageWidth),this.fetch(ne.ModelPixelScale),this.fetch(ne.ModelTiePoint),this.fetch(ne.ModelTransformation),this.fetch(ne.TileHeight),this.fetch(ne.TileWidth)];e&&(r.push(this.fetch(ne.GeoKeyDirectory)),r.push(this.fetch(ne.GeoAsciiParams)),r.push(this.fetch(ne.GeoDoubleParams))),await Promise.all(r),e&&await this.loadGeoTiffTags()}value(e){let r=this.tags.get(e);return r==null?null:r.value}async loadGeoTiffTags(){if(this.tagsGeoLoaded)return;let e=this.tags.get(ne.GeoKeyDirectory);if(e==null){this.tagsGeoLoaded=!0;return}if(!e.isReady&&e instanceof Ms&&await Promise.all([this.fetch(ne.GeoKeyDirectory),this.fetch(ne.GeoAsciiParams),this.fetch(ne.GeoDoubleParams)]),this.tagsGeoLoaded=!0,e.value==null)return;let r=e.value;if(!Array.isArray(r))throw new Error("Invalid geo tags found");for(let i=4;i<=r[3]*4;i+=4){let n=r[i],s=r[i+1],a=r[i+3];if(s===0){this.tagsGeo.set(n,a);continue}let c=this.tags.get(s);if(c==null||c.value==null)continue;let d=r[i+2];Array.isArray(c.value)?this.tagsGeo.set(n,c.value[a+d-1]):typeof c.value=="string"&&this.tagsGeo.set(n,c.value.substr(a,a+d-1).trim())}}valueGeo(e){if(this.tagsGeoLoaded===!1)throw new Error("loadGeoTiffTags() has not been called");return this.tagsGeo.get(e)}async fetch(e){let r=this.tags.get(e);return r==null?null:Cc.isLazy(r)?r.fetch():r.value}get origin(){let e=this.value(ne.ModelTiePoint);if(e!=null&&e.length===6)return[e[3],e[4],e[5]];let r=this.value(ne.ModelTransformation);if(r!=null)return[r[3],r[7],r[11]];if(this.value(ne.NewSubFileType)===1&&this.id!==0)return this.tif.images[0].origin;throw new Error("Image does not have a geo transformation.")}get isGeoLocated(){return this.value(ne.ModelPixelScale)!=null||this.value(ne.ModelTransformation)!=null?!0:this.value(ne.NewSubFileType)===1&&this.id!==0?this.tif.images[0].isGeoLocated:!1}get resolution(){let e=this.value(ne.ModelPixelScale);if(e!=null)return[e[0],-e[1],e[2]];let r=this.value(ne.ModelTransformation);if(r!=null)return[r[0],r[5],r[10]];if(this.value(ne.NewSubFileType)===1&&this.id!==0){let i=this.tif.images[0],[n,s,a]=i.resolution,c=i.size,d=this.size;return[n*c.width/d.width,s*c.height/d.height,a]}throw new Error("Image does not have a geo transformation.")}get bbox(){let e=this.size,r=this.origin,i=this.resolution;if(r==null||e==null||i==null)throw new Error("Unable to calculate bounding box");let n=r[0],s=r[1],a=n+i[0]*e.width,c=s+i[1]*e.height;return[Math.min(n,a),Math.min(s,c),Math.max(n,a),Math.max(s,c)]}get compression(){let e=this.value(ne.Compression);return e==null||typeof e!="number"?null:kd[e]}get epsg(){let e=this.valueGeo(T1.ProjectedCSTypeGeoKey);return e===cx?null:e}get size(){return{width:this.value(ne.ImageWidth),height:this.value(ne.ImageHeight)}}get tagList(){return[...this.tags.keys()].map(e=>ne[e])}isTiled(){return this.value(ne.TileWidth)!==null}get tileSize(){return{width:this.value(ne.TileWidth),height:this.value(ne.TileHeight)}}get tileCount(){let e=this.size,r=this.tileSize,i=Math.ceil(e.width/r.width),n=Math.ceil(e.height/r.height);return{x:i,y:n}}get tileOffset(){let e=this.tags.get(ne.TileOffsets);if(e==null)throw new Error("No tile offsets found");return e}get stripCount(){let e=this.tags.get(ne.StripByteCounts);return e==null?0:e.dataCount}async getTileOffset(e){let r=this.tileOffset;if(e<0||e>r.dataCount)throw new Error(`Tile offset: ${e} out of range: 0 -> ${r.dataCount}`);return r.getValueAt(e)}getTileBounds(e,r){let{size:i,tileSize:n}=this,s=r*n.height,a=e*n.width,c=a+n.width>=i.width?i.width-a:n.width,d=s+n.height>=i.height?i.height-s:n.height;return{x:a,y:s,width:c,height:d}}async getStrip(e){if(this.isTiled())throw new Error("Cannot read stripes, tiff is tiled");let r=this.tags.get(ne.StripByteCounts),i=this.tags.get(ne.StripOffsets);if(e>=r.dataCount)throw new Error("Cannot read strip, index out of bounds");let[n,s]=await Promise.all([i.getValueAt(e),r.getValueAt(e)]);return this.getBytes(n,s)}getJpegHeader(e){let r=this.value(ne.JPEGTables);if(r==null)throw new Error("Unable to find Jpeg header");let i=r.slice(0,r.length-2),n=new Uint8Array(e.byteLength+i.length-2);return n.set(i,0),n.set(e.slice(2),i.length),n}async getBytes(e,r){let i=this.compression;if(i==null)throw new Error("Unsupported compression: "+this.value(ne.Compression));if(r===0)return null;await this.tif.source.loadBytes(e,r);let n=this.tif.source.bytes(e,r);return this.compression===Rr.JPEG?{mimeType:i,bytes:this.getJpegHeader(n)}:{mimeType:i,bytes:n}}async getTile(e,r){let i=this.compression,n=this.size,s=this.tileSize;if(s==null)throw new Error("Tiff is not tiled");if(i==null)throw new Error("Unsupported compression: "+this.value(ne.Compression));let a=Math.ceil(n.height/s.height),c=Math.ceil(n.width/s.width);if(e>=c||r>=a)throw new Error(`Tile index is outside of range x:${e} >= ${c} or y:${r} >= ${a}`);let d=r*c+e,p=c*a;if(d>=p)throw new Error(`Tile index is outside of tile range: ${d} >= ${p}`);let{offset:m,imageSize:w}=await this.getTileSize(d);return this.getBytes(m,w)}async getTileSize(e){if(this.tif.options.tileLeaderByteSize){let s=await this.getTileOffset(e);if(s===0)return{offset:0,imageSize:0};let a=this.tif.options.tileLeaderByteSize;return await this.tif.source.loadBytes(s-a,a),{offset:s,imageSize:this.tif.source.getUint(s-a,a)}}let r=this.tags.get(ne.TileByteCounts);if(r==null)throw new Error("No tile byte counts found");let[i,n]=await Promise.all([this.getTileOffset(e),r.getValueAt(e)]);return{offset:i,imageSize:n}}};var O1;(function(t){t[t.Big=19789]="Big",t[t.Little=18761]="Little"})(O1||(O1={}));var Cr;(function(t){t[t.BigTiff=43]="BigTiff",t[t.Tiff=42]="Tiff"})(Cr||(Cr={}));var Nd="__reverse";function N4(t,e){if(t[Nd]==null){let r={};for(let i of Object.keys(t)){let n=t[i];r[n]=i}Object.defineProperty(t,Nd,{enumerable:!1,value:r,writable:!1})}return t[Nd][e]}var Rn;(function(t){t.GDAL_STRUCTURAL_METADATA_SIZE="GDAL_STRUCTURAL_METADATA_SIZE",t.LAYOUT="LAYOUT",t.BLOCK_ORDER="BLOCK_ORDER",t.BLOCK_LEADER="BLOCK_LEADER",t.BLOCK_TRAILER="BLOCK_TRAILER",t.KNOWN_INCOMPATIBLE_EDITION="KNOWN_INCOMPATIBLE_EDITION",t.MASK_INTERLEAVED_WITH_IMAGERY="MASK_INTERLEAVED_WITH_IMAGERY"})(Rn||(Rn={}));var Dd;(function(t){t.RowMajor="ROW_MAJOR"})(Dd||(Dd={}));var Bd;(function(t){t.uint32="SIZE_AS_UINT4"})(Bd||(Bd={}));var hx={uint32:be.UInt32},Pc=class{constructor(){this.options=new Map}get isCogOptimized(){return this.isBroken?!1:this.options.get(Rn.LAYOUT)==="IFDS_BEFORE_DATA"}get isBroken(){return this.options.get(Rn.KNOWN_INCOMPATIBLE_EDITION)==="YES"}set(e,r){this.options.set(e,r)}process(e,r,i){let n=[];for(let a=r;a<r+i;a++){let c=e.getUint8(a);c!==0&&n.push(String.fromCharCode(c))}let s=n.join("").trim().split(`
184
+ `).map(a=>a.split("="));for(let[a,c]of s)this.options.set(Rn[a],c)}_getReverse(e,r){let i=this.options.get(r);return i==null?null:N4(e,i)}get tileOrder(){return this._getReverse(Dd,Rn.BLOCK_ORDER)}get tileLeader(){return this._getReverse(Bd,Rn.BLOCK_LEADER)}get tileLeaderByteSize(){return this.tileLeader==null?null:hx[this.tileLeader]}get isMaskInterleaved(){return this.options.get(Rn.MASK_INTERLEAVED_WITH_IMAGERY)==="YES"}};var zd={version:Cr.Tiff,pointer:be.UInt32,offset:be.UInt16,ifd:be.UInt16+be.UInt16+2*be.UInt32},jd={version:Cr.BigTiff,pointer:be.UInt64,offset:be.UInt64,ifd:be.UInt16+be.UInt16+2*be.UInt64},fL={[Cr.BigTiff]:jd,[Cr.Tiff]:zd};var qd=fe(Ld(),1),Tc=class{constructor(e,r=0){this.tiff=e,this.byteOffset=r,this.relativeOffset=0}get currentOffset(){return this.byteOffset+this.relativeOffset}seekTo(e){return this.byteOffset=e,this.relativeOffset=0,this}seek(e){let r=this.currentOffset;return this.relativeOffset+=e,r}bytes(e){return this.tiff.source.bytes(this.seek(e),e)}uint(e){return this.tiff.source.getUint(this.seek(e),e)}uint8(){return this.tiff.source.getUint8(this.seek(be.UInt8))}uint16(){return this.tiff.source.getUint16(this.seek(be.UInt16))}uint32(){return this.tiff.source.getUint32(this.seek(be.UInt32))}uint64(){return this.tiff.source.getUint64(this.seek(be.UInt64))}pointer(){let e=this.tiff.ifdConfig.pointer;return this.tiff.source.getUint(this.seek(e),e)}offset(){let e=this.tiff.ifdConfig.offset;return this.tiff.source.getUint(this.seek(e),e)}float(){return qd.read(this.bytes(be.Float),0,this.tiff.source.isLittleEndian,23,4)}double(){return qd.read(this.bytes(be.Double),0,this.tiff.source.isLittleEndian,52,8)}};function D4(t,e=4,r=!0){let i=t.toString(16).padStart(e,"0");return r?"0x"+i:i}var ra=class{constructor(e){this.version=Cr.Tiff,this.images=[],this.options=new Pc,this.ifdConfig=zd,this.isInitialized=!1,this.source=e,this.cursor=new Tc(this)}static create(e){return new ra(e).init()}init(e=!1){return this._initPromise?this._initPromise:(this._initPromise=this.doInit(e),this._initPromise)}async doInit(e=!1){return this.isInitialized?this:(await this.source.loadBytes(0,this.source.chunkSize),await this.fetchIfd(),await Promise.all(this.images.map(r=>r.init(e))),this.isInitialized=!0,this)}async fetchIfd(){let e=this.cursor.seekTo(0),r=e.uint16();if(this.source.isLittleEndian=r===O1.Little,!this.source.isLittleEndian)throw new Error("Only little endian is supported");this.version=e.uint16();let i;if(this.version===Cr.BigTiff){if(this.ifdConfig=jd,e.uint16()!==8)throw new Error("Only 8byte pointers are supported");if(e.uint16()!==0)throw new Error("Invalid big tiff header");i=e.pointer()}else if(this.version===Cr.Tiff)i=e.pointer();else throw new Error(`Only tiff supported version:${this.version}`);let n=i-this.cursor.currentOffset;return n>0&&n<16*1024,this.processIfd(i)}getImage(e){return this.images[e]}getImageByResolution(e){let r=this.images[0],i=r.size,[n]=r.resolution,s=n*i.width;for(let a=this.images.length-1;a>0;a--){let c=this.images[a],d=c.size;if(s/d.width-e<=.01)return c}return r}async getTile(e,r,i){let n=this.getImage(i);if(n==null)throw new Error(`Missing z: ${i}`);if(!n.isTiled())throw new Error("Tif is not tiled");return n.getTile(e,r)}async processIfd(e){this.source.hasBytes(e,4096)||await this.source.loadBytes(e,4096);let{image:r,nextOffset:i}=await this.readIfd(e);this.images.push(r),i&&await this.processIfd(i)}async readIfd(e){this.source.hasBytes(e,1024)||await this.source.loadBytes(e,this.source.chunkSize);let i=this.cursor.seekTo(e).offset(),n=e+this.ifdConfig.offset,s=new Map,a=n;for(let p=0;p<i;p++){let m=Cc.create(this,a);if(a+=m.size,m.name==null)throw new Error("Unknown IFD Tag: "+D4(m.id));s.set(m.id,m)}let c=new Ac(this,this.images.length,s);return{nextOffset:this.source.getUint(a,this.ifdConfig.pointer),image:c}}async close(){var e,r;await((r=(e=this.source)===null||e===void 0?void 0:e.close)===null||r===void 0?void 0:r.call(e))}};var Ud=class{constructor(e){$h(this,"value");$h(this,"next");this.value=e}},bi,Es,Rs,L1=class{constructor(){yt(this,bi,void 0);yt(this,Es,void 0);yt(this,Rs,void 0);this.clear()}enqueue(e){let r=new Ud(e);Me(this,bi)?(Me(this,Es).next=r,Ze(this,Es,r)):(Ze(this,bi,r),Ze(this,Es,r)),Wh(this,Rs)._++}dequeue(){let e=Me(this,bi);if(!!e)return Ze(this,bi,Me(this,bi).next),Wh(this,Rs)._--,e.value}clear(){Ze(this,bi,void 0),Ze(this,Es,void 0),Ze(this,Rs,0)}get size(){return Me(this,Rs)}*[Symbol.iterator](){let e=Me(this,bi);for(;e;)yield e.value,e=e.next}};bi=new WeakMap,Es=new WeakMap,Rs=new WeakMap;function $d(t){if(!((Number.isInteger(t)||t===Number.POSITIVE_INFINITY)&&t>0))throw new TypeError("Expected `concurrency` to be a number from 1 and up");let e=new L1,r=0,i=()=>{r--,e.size>0&&e.dequeue()()},n=async(c,d,p)=>{r++;let m=(async()=>c(...p))();d(m);try{await m}catch{}i()},s=(c,d,p)=>{e.enqueue(n.bind(void 0,c,d,p)),(async()=>(await Promise.resolve(),r<t&&e.size>0&&e.dequeue()()))()},a=(c,...d)=>new Promise(p=>{s(c,p,d)});return Object.defineProperties(a,{activeCount:{get:()=>r},pendingCount:{get:()=>e.size},clearQueue:{value:()=>{e.clear()}}}),a}var B4=require("crypto");var z4=require("path"),Wr={RenderId:1,key(t){return(0,B4.createHash)("sha256").update(JSON.stringify(t)).digest("base64")},generate(t,e){let r=t.map(n=>({...n,tiff:(0,z4.basename)(n.tiff.source.uri)})),i={...e,tileMatrix:e.tileMatrix.identifier};return Wr.key({xyz:i,layers:r,RenderId:Wr.RenderId})},isNotModified(t,e){let r=t.header(ue.IfNoneMatch);return r!=null&&r.indexOf(e)>-1?(t.set("cache",{key:e,hit:!0,match:r}),!0):!1}};var Lt=class{static get(e){let r=Lt.cacheA.get(e);if(r)return r;let i=Lt.cacheB.get(e);return i==null?null:(Lt.cacheA.set(e,i),Lt.cacheB.delete(e),i)}static clear(){this.cacheA.clear(),this.cacheB.clear()}static set(e,r){Lt.cacheA.set(e,r),Lt.check()}static check(){Lt.MaxCacheSizeBytes<=0||Lt.currentSize<=Lt.MaxCacheSizeBytes||(Lt.cacheB=Lt.cacheA,Lt.cacheA=new Map)}static get currentSize(){let e=0;for(let r of Lt.cacheA.values())e+=r.source.chunkSize*r.source.chunks.size;return e}},Cn=Lt;Cn.cacheA=new Map,Cn.cacheB=new Map,Cn.MaxCacheSizeBytes=256*1024*1024;var fx=$d(Xe.getNumber(Xe.TiffConcurrency,25)),dx=new Mn(256),px={in:"lanczos3",out:"lanczos3"},mx={r:0,g:0,b:0,alpha:0};function gx(t){return t.endsWith(".tif")||t.endsWith(".tiff")?t:`${t}.tiff`}var ia=class{constructor(e,r){this.type=st.Raster;this.components=zt.parse(e),this.tileMatrix=r,this.tiler=new Bo(this.tileMatrix)}get id(){return Ar.id(this.fullName,this.tileMatrix)}get fullName(){return zt.componentsToName(this.components)}get title(){return this.tileSet?.title??this.components.name}get description(){return this.tileSet?.description??""}get extent(){return this.extentOverride??this.tileMatrix.extent}get format(){return this.tileSet.format??qe.Webp}async init(e){this.tileSet=e,this.imagery=await je.getAllImagery(this.tileSet.layers,[this.tileMatrix.projection])}async initTiffs(e,r){let i=this.getTiffsForTile(e,r),n=!1,s=i.map(a=>fx(async()=>{try{await a.init()}catch(c){r.warn({error:c,tiff:a.source.uri},"TiffLoadFailed"),n=!0}}));return await Promise.all(s),n?i.filter(a=>a.images.length>0):i}async tile(e,r){if(r.ext===rr.MapboxVectorTiles)return Ie;let i=await this.initTiffs(r,e.log),n=await this.tiler.tile(i,r.x,r.y,r.z),s=Wr.generate(n,r);if(e.set("layers",n.length),Wr.isNotModified(e,s))return xn;let a=await dx.compose({layers:n,format:r.ext,background:this.tileSet.background??mx,resizeKernel:this.tileSet.resizeKernel??px,metrics:e.timer});e.set("layersUsed",a.layers),e.set("bytes",a.buffer.byteLength);let c=new Y(200,"ok");return c.header(ue.ETag,s),c.header(ue.CacheControl,"public, max-age=604800"),c.buffer(a.buffer,"image/"+r.ext),c}getTiffsForTile(e,r){let i=[],n=this.tileMatrix.tileToSourceBounds(e),s=_t.convertZoomLevel(e.z,this.tileMatrix,sn.get(Se.Google));for(let a of this.tileSet.layers){if(a.maxZoom!=null&&s>a.maxZoom||a.minZoom!=null&&s<a.minZoom)continue;let c=a[this.tileMatrix.projection.code];if(c==null){r?.warn({layer:a.name,projection:this.tileMatrix.projection.code},"Failed to lookup imagery");continue}let d=this.imagery.get(c);if(d==null){r?.warn({layer:a.name,projection:this.tileMatrix.projection.code,imgId:c},"Failed to lookup imagery");continue}if(!!n.intersects(ge.fromJson(d.bounds)))for(let p of this.getCogsForTile(d,n))i.push(p)}return i}getCogsForTile(e,r){let i=[];for(let n of e.files){if(!r.intersects(ge.fromJson(n)))continue;let s=lr.join(e.uri,gx(n.name)),a=Cn.get(s);if(a==null){let c=lr.source(s);if(c==null)throw new Error(`Failed to create CogSource from ${s}`);$i.trace(c),a=new ra(c),Cn.set(s,a)}i.push(a)}return i}findImagery(e){let r=this.imagery.get(e);if(r!=null)return r;for(let i of this.imagery.values())if(i.name===e)return i;return null}child(e){let r=this.findImagery(e);if(r==null)return null;let i=zt.componentsToName({...this.components,layer:r.name}),n=new ia(i,this.tileMatrix);n.tileSet={...this.tileSet},n.tileSet.background=void 0;let s=this.tileSet?.title??this.tileSet?.name;n.tileSet.title=r.title??`${s} ${w1(r.name)}`,n.extentOverride=ge.fromJson(r.bounds),r.category&&(n.tileSet.category=r.category);let a={name:r.name,minZoom:0,maxZoom:100};return a[this.tileMatrix.projection.code]=r.id,n.tileSet.layers=[a],n.imagery=new Map,n.imagery.set(r.id,r),n}};var Ic=class{constructor(e,r){this.type=st.Vector;this.components=zt.parse(e),this.tileMatrix=r}async init(e){this.tileSet=e}get format(){return rr.MapboxVectorTiles}get id(){return Ar.id(this.fullName,this.tileMatrix)}get fullName(){return zt.componentsToName(this.components)}async tile(e,r){if(r.ext!==rr.MapboxVectorTiles)return Ie;if(r.tileMatrix.identifier!==lt.identifier)return Ie;if(this.tileSet.layers.length>1)return new Y(500,"Too many layers in tileset");let[i]=this.tileSet.layers;if(i[3857]==null)return new Y(500,"Layer url not found from tileset Config");e.timer.start("cotar:load");let n=await ta.get(i[3857]);if(n==null)return new Y(500,"Failed to load VectorTiles");e.timer.end("cotar:load");let s=(1<<r.z)-1-r.y;e.timer.start("cotar:tile");let a=await n.get(`tiles/${r.z}/${r.x}/${s}.pbf.gz`);if(a==null)return Ie;e.timer.end("cotar:tile");let c=new Y(200,"Ok");return c.buffer(Buffer.from(a),"application/x-protobuf"),c.header(ue.ContentEncoding,"gzip"),c}};var Wd=class{constructor(){this.CacheTime=3e4;this.cache=new Map;this.tileSets=new Map}id(e,r){if(typeof e=="string"){let i=zt.parse(e);return`${zt.componentsToName(i)}_${r?.identifier}`}return`${e.fullName}_${e.tileMatrix.identifier}`}add(e,r=Date.now()+this.CacheTime){let i=this.id(e);if(this.cache.has(i))throw new Error("Trying to add duplicate tile set:"+i);this.cache.set(i,{time:r,value:Promise.resolve(e)})}get(e,r){let i=this.id(e,r),n=this.cache.get(i);if(n==null||Date.now()-n.time>0){let s=this.loadTileSet(e,r);n={time:Date.now(),value:s},this.cache.set(i,n)}return n.value}async loadTileSet(e,r){let i=zt.parse(e),n=this.id(e,r);if(i.layer!=null){let p=zt.componentsToName({...i,layer:void 0}),m=await this.get(p,r);return m==null||m.type===st.Vector?null:m.child(i.layer)}let s=je.TileSet.id(e),a=await je.TileSet.get(s);if(a==null)return this.cache.delete(n),null;let c=this.tileSets.get(n);if(c!=null&&c?.tileSet.updatedAt===a.updatedAt)return c;if(je.isTileSetRaster(a)){let p=new ia(e,r);return await p.init(a),this.tileSets.set(n,p),p}let d=new Ic(e,r);return await d.init(a),this.tileSets.set(n,d),d}},Ar=new Wd;var vx={},yx=[{type:di.Tile,name:"health",tileMatrix:lt,ext:qe.Png,x:252,y:156,z:8},{type:di.Tile,name:"health",tileMatrix:nn,ext:qe.Png,x:30,y:33,z:6}],j4=256;async function bx(t){if(Buffer.isBuffer(t.buf))return t.buf;let e=`static/expected_tile_${t.tileMatrix.identifier}_${t.x}_${t.y}_z${t.z}.${t.ext}`;try{return await Fd.promises.readFile(e)}catch(r){if(r.code!=="ENOENT")throw r;let i=kc.join(kc.dirname(U4.default.fileURLToPath(vx.url)),"..","..",e);return await Fd.promises.readFile(i)}}async function Gd(t){for(let r of yx){let i=await Ar.get("health",r.tileMatrix);if(i==null)throw new Y(500,'TileSet: "health" not found');let n=await i.tile(t,r);if(n.status!==200)return new Y(500,n.statusDescription);if(!Buffer.isBuffer(n._body))throw new Y(500,"Not a Buffer response content.");let s=await(0,Hd.default)(n._body).raw().toBuffer(),a=await bx(r);r.buf=a;let c=await(0,Hd.default)(a).raw().toBuffer(),d=Buffer.alloc(c.length),p=(0,q4.default)(c,s,d,j4,j4);if(p)return t.log.error({missMatchedPixels:p,projection:r.tileMatrix.identifier,xyz:{x:r.x,y:r.y,z:r.z}},"Health:MissMatch"),new Y(500,"TileSet does not match.")}let e=new Y(200,"ok");return e.header(ue.CacheControl,"no-store"),e}var $4=require("crypto"),W4=require("util"),F4=require("zlib");var wx=(0,W4.promisify)(F4.gzip);function _x(t){return t==null?!1:!!(t.endsWith(".geojson")||t.endsWith(".json"))}async function H4(t){let e=t.params.fileName;if(!_x(e))return new Y(404,"Not found");let r=await je.Imagery.get(je.Imagery.id(t.params.imageryId));if(r==null)return new Y(404,"Not found");let i=lr.join(r.uri,e);try{let n=await lr.read(i),s=(0,$4.createHash)("sha256").update(n).digest("base64");if(Wr.isNotModified(t,s))return xn;let a=new Y(200,"ok");return a.header(ue.ETag,s),a.header(ue.ContentEncoding,"gzip"),a.buffer(await wx(n),"application/json"),t.set("bytes",n.byteLength),a}catch{return t.log.warn({targetPath:i},"ImageryMetadata:Failed"),new Y(404,"Not found")}}var G4=fe(require("path"),1);var Vd=new Map;Vd.set(".png","image/png");Vd.set(".json","application/json");async function V4(t){let e=Xe.get(Xe.AssetLocation);if(e==null)return Ie;let r=G4.default.extname(t.params.spriteName),i=Vd.get(r);if(i==null)return Ie;let n=Ye.join("sprites",t.params.spriteName);if(e.endsWith(".tar.co"))return P1(e,n,i);try{let s=Ye.join(e,n);t.set("target",s);let a=await Ye.read(s),c=Y.ok().buffer(a,i);return Ad(a)&&c.header("content-encoding","gzip"),c}catch(s){if(s.code===404)return Ie;throw s}}var K4=fe(Zn(),1),Sx=60*60*1e3,xx=24*Sx,Mx=91*xx;function Z4(t){if(t==null||!t.startsWith("c")&&!t.startsWith("d"))return!1;let e=t.slice(1).toUpperCase();try{let r=K4.decodeTime(e);if(t.startsWith("d"))return!0;if(Date.now()-r>Mx)return!1}catch{return!1}return!0}var Y4=require("crypto");var Ex=1+1e-10,Kd=new Y(404,"Not Found"),J4=10**8;function Zd(t){return Math.round(t*J4)/J4}function Rx(t){return[Zd(t[0]),Zd(t[1])]}function Cx(t,e,r){if(mi.delta(t[0],t[2])<=0)return mi.bboxToMultiPolygon(t);let i=[];for(let s of e){let a=[ge.fromJson(s).pad(Ex).toPolygon()];i=o6(i,a)}return Zu(i,s=>Rx(r.toWgs84(s)))}async function Ax(t){try{return await lr.readJson(t)}catch(e){if(Je.isCompositeError(e)&&e.code<500)return null;throw e}}function Px(t,e,r,i,n,s){let a=t.tileMatrix;return{stac_version:$a.Version,license:e?.license??$a.License,id:r.id,providers:e?.providers??[{name:n.serviceProvider.name,url:n.serviceProvider.site,roles:["host"]}],title:e?.title??w1(r.name),description:e?.description??"No description",extent:s,links:[],summaries:{"linz:zoom":{min:_t.convertZoomLevel(i.minZoom?i.minZoom:0,lt,a,!0),max:_t.convertZoomLevel(i.maxZoom?i.maxZoom:32,lt,a,!0)},"linz:priority":[1e3+t.tileSet.layers.indexOf(i)]}}}async function Tx(t){let e=qr.get(t.tileMatrix),r=new Map,i=[],n=[];for(let a of t.tileSet.layers){let c=a[e.epsg.code];if(c==null)continue;let d=t.imagery.get(c);d!=null&&r.get(d.uri)==null&&r.set(d.uri,Ax(lr.join(d.uri,"collection.json")))}let s=await je.Provider.get(je.Provider.id("linz"));if(s==null)return null;for(let a of t.tileSet.layers){let c=a[e.epsg.code];if(c==null)continue;let d=t.imagery.get(c);if(d==null)continue;let p=await r.get(d.uri),m=e.boundsToWgs84BoundingBox(d.bounds).map(Zd),w=p?.extent.temporal.interval;if(w==null){let v=y6(d.name);if(v[0]===-1)throw new Error("Missing date in imagery name: "+d.name);w=[v.map(R=>`${R}-01-01T00:00:00Z`)]}let S={spatial:{bbox:[m]},temporal:{interval:w}};n.push({type:"Feature",stac_version:$a.Version,id:c+"_item",collection:c,assets:{},links:[],bbox:m,geometry:{type:"MultiPolygon",coordinates:Cx(m,d.files,e)},properties:{title:w1(d.name),datetime:null,start_datetime:w[0][0],end_datetime:w[0][1]}}),i.push(Px(t,p,d,a,s,S))}return{id:t.id,type:"FeatureCollection",stac_version:$a.Version,stac_extensions:["single-file-stac"],title:t.title,description:t.description,features:n,collections:i,links:[]}}async function X4(t){let e=it.action(t),r=Am(e.rest);if(r==null)return Kd;Rm(t,r),t.timer.start("tileset:load");let i=await Ar.get(r.name,r.tileMatrix);if(t.timer.end("tileset:load"),i==null||i.type===st.Vector)return Kd;let n=(0,Y4.createHash)("sha256").update(JSON.stringify(i.tileSet)).digest("base64"),s=t.header(ue.IfNoneMatch);if(s!=null&&s.indexOf(n)>-1)return t.set("cache",{key:n,hit:!0,match:s}),new Y(304,"Not modified");t.timer.start("stac:load");let a=await Tx(i);if(t.timer.end("stac:load"),a==null)return Kd;let c=new Y(200,"ok");return c.header(ue.ETag,n),c.header(ue.CacheControl,"public, max-age=86400, stale-while-revalidate=604800"),c.json(a),c}async function Q4(t){let{version:e,rest:r,name:i}=it.action(t);if(r.length!==3)return Ie;let n=p1(r[1]);if(n==null)return Ie;t.timer.start("tileset:load");let s=await Ar.get(r[0],n);if(t.timer.end("tileset:load"),s==null)return Ie;let a=it.apiKey(t),p={tiles:[[Xe.get(Xe.PublicUrlBase)??"",e,i,s.fullName,n.identifier,"{z}","{x}","{y}"].join("/")+`.${s.format}?api=${a}`],tilejson:"3.0.0"},m=_t.convertZoomLevel(s.tileSet.maxZoom??30,lt,n,!0),w=_t.convertZoomLevel(s.tileSet.minZoom??0,lt,n,!0);s.tileSet.maxZoom&&(p.maxzoom=m),s.tileSet.minZoom&&(p.minzoom=w);let S=JSON.stringify(p),v=Buffer.from(S),R=new Y(200,"ok");return R.header(ue.CacheControl,"no-store"),R.buffer(v,"application/json"),t.set("bytes",v.byteLength),R}var eg=require("crypto"),tg=require("url");function Oc(t,e){if(t==null)return"";let r=Xe.get(Xe.PublicUrlBase)??"";if(!t.startsWith("/"))return t;let i=new tg.URL(Ye.join(r,t));return e&&i.searchParams.set("api",e),i.toString().replace(/%7B/g,"{").replace(/%7D/g,"}")}function Ix(t,e){let r=JSON.parse(JSON.stringify(t.sources));for(let[i,n]of Object.entries(r)){if(n.type==="vector")n.url=Oc(n.url,e);else if(n.type==="raster"&&Array.isArray(n.tiles))for(let s=0;s<n.tiles.length;s++)n.tiles[s]=Oc(n.tiles[s],e);r[i]=n}return{version:8,id:t.id,name:t.name,sources:r,layers:t.layers,metadata:t.metadata??{},glyphs:Oc(t.glyphs),sprite:Oc(t.sprite)}}async function rg(t,e){let r=it.apiKey(t);if(r==null)return new Y(400,"Invalid API Key.");let i=e.split(".json")[0],n=je.Style.id(i),s=await je.Style.get(n);if(s==null)return Ie;let a=Ix(s.style,r),c=Buffer.from(JSON.stringify(a)),d=(0,eg.createHash)("sha256").update(c).digest("base64");if(Wr.isNotModified(t,d))return xn;let p=new Y(200,"ok");return p.header(ue.ETag,d),p.header(ue.CacheControl,"no-store"),p.buffer(c,"application/json"),t.set("bytes",c.byteLength),p}var ig=require("crypto");var kx={xmlns:"http://www.opengis.net/wmts/1.0","xmlns:ows":"http://www.opengis.net/ows/1.1","xmlns:xlink":"http://www.w3.org/1999/xlink","xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","xmlns:gml":"http://www.opengis.net/gml","xsi:schemaLocation":"http://www.opengis.net/wmts/1.0 http://schemas.opengis.net/wmts/1.0/wmtsGetCapabilities_response.xsd",version:"1.0.0"};function Jd(t,e){return qr.get(t).boundsToWgs84BoundingBox(e)}var Lc=class{constructor(e){this.tileMatrixSets=new Map;this.isIndividualLayers=!1;this.httpBase=e.httpBase,this.provider=e.provider,this.tileSet=e.tileSet,this.isIndividualLayers=e.isIndividualLayers;for(let r of e.tileMatrix)this.tileMatrixSets.set(r.identifier,r);this.apiKey=e.apiKey,this.formats=e.formats??Em,this.imagery=e.imagery}async loadImagery(){let e=new Set;for(let r of this.tileMatrixSets.values())for(let i of this.tileSet.layers){let n=i[r.projection.code];n!=null&&e.add(n)}this.imagery=await je.Imagery.getAll(e)}buildWgs84BoundingBox(e,r){let i;if(r.length>0){i=Jd(e,r[0]);for(let n=1;n<r.length;n++)i=mi.union(i,Jd(e,r[n]))}else i=Jd(e,e.extent);return J("ows:WGS84BoundingBox",{crs:"urn:ogc:def:crs:OGC:2:84"},i[2]>180?[J("ows:LowerCorner","-180 -90"),J("ows:UpperCorner","180 90")]:[J("ows:LowerCorner",`${i[0]} ${i[1]}`),J("ows:UpperCorner",`${i[2]} ${i[3]}`)])}buildBoundingBoxFromImagery(e,r){let i;for(let s of r){let a=s[e.projection.code];if(a==null)continue;let c=this.imagery.get(a);c!=null&&(i==null?i=ge.fromJson(c.bounds):i=i.union(ge.fromJson(c.bounds)))}if(i==null)return null;let n=i.toBbox();return J("ows:BoundingBox",{crs:e.projection.toUrn()},[J("ows:LowerCorner",`${n[e.indexX]} ${n[e.indexY]}`),J("ows:UpperCorner",`${n[e.indexX+2]} ${n[e.indexY+2]}`)])}buildProvider(){if(this.provider==null)return[];let{serviceIdentification:e,serviceProvider:r}=this.provider,{contact:i}=r;return[J("ows:ServiceIdentification",[J("ows:Title",e.title),J("ows:Abstract",e.description),J("ows:ServiceType","OGC WMTS"),J("ows:ServiceTypeVersion","1.0.0"),J("ows:Fees",e.fees),J("ows:AccessConstraints",e.accessConstraints)]),J("ows:ServiceProvider",[J("ows:ProviderName",r.name),J("ows:ProviderSite",{"xlink:href":r.site}),J("ows:ServiceContact",[J("ows:IndividualName",i.individualName),J("ows:PositionName",i.position),J("ows:ContactInfo",[J("ows:Phone",[J("ows:Voice",i.phone)]),J("ows:Address",[J("ows:DeliveryPoint",i.address.deliveryPoint),J("ows:City",i.address.city),J("ows:PostalCode",i.address.postalCode),J("ows:Country",i.address.country),J("ows:ElectronicMailAddress",i.address.email)])])])])]}buildTileUrl(e,r){let i=this.apiKey?`?api=${this.apiKey}`:"";return[this.httpBase,"v1","tiles",e,"{TileMatrixSet}","{TileMatrix}","{TileCol}",`{TileRow}.${r}${i}`].join("/")}buildResourceUrl(e,r){return J("ResourceURL",{format:"image/"+r,resourceType:"tile",template:this.buildTileUrl(e,r)})}buildLayerFromImagery(e){let r=new Set,i=[];for(let d of this.tileMatrixSets.values()){let p=e[d.projection.code];p==null||this.imagery.get(p)==null||(i.push(J("TileMatrixSetLink",[J("TileMatrixSet",d.identifier)])),r.add(d))}let n=so(e.name),s=[...r.values()],a=s[0];if(a==null)return null;let c=this.imagery.get(e[a.projection.code]??"");return c==null?null:J("Layer",[J("ows:Title",e.title??n),J("ows:Abstract",""),J("ows:Identifier",n),this.buildKeywords(c),...s.map(d=>this.buildBoundingBoxFromImagery(d,[e])),this.buildWgs84BoundingBox(a,[ge.fromJson(c.bounds)]),this.buildStyle(),...this.formats.map(d=>J("Format","image/"+d)),...i,...this.formats.map(d=>this.buildResourceUrl(n,d))])}buildLayer(e){let r=new Set,i=[];for(let p of this.tileMatrixSets.values())e.layers.find(m=>m[p.projection.code]!=null)&&(i.push(J("TileMatrixSetLink",[J("TileMatrixSet",p.identifier)])),r.add(p));let n=so(e.name),s=[...r.values()],a=s[0];if(a==null)throw new Error("No matrix sets found for layer "+e.name);let c=s.find(p=>p.identifier===lt.identifier)??a,d=[];for(let p of e.layers){let m=this.imagery.get(p[c.projection.code]??"");m!=null&&d.push(ge.fromJson(m.bounds))}return J("Layer",[J("ows:Title",e.title??n),J("ows:Abstract",e.description??""),J("ows:Identifier",n),this.buildKeywords(e),...[...r.values()].map(p=>this.buildBoundingBoxFromImagery(p,e.layers)),this.buildWgs84BoundingBox(c,d),this.buildStyle(),...this.formats.map(p=>J("Format","image/"+p)),...i,...this.formats.map(p=>this.buildResourceUrl(n,p))])}buildKeywords(e){return e.category==null?J("ows:Keywords"):J("ows:Keywords",[J("ows:Keyword",e.category)])}buildStyle(){return J("Style",{isDefault:"true"},[J("ows:Title","Default Style"),J("ows:Identifier","default")])}buildTileMatrixSet(e){return J("TileMatrixSet",[J("ows:Title",e.def.title),e.def.abstract?J("ows:Abstract",e.def.abstract):null,J("ows:Identifier",e.identifier),J("ows:SupportedCRS",e.projection.toUrn()),e.def.wellKnownScaleSet?J("WellKnownScaleSet",e.def.wellKnownScaleSet):null,...e.def.tileMatrix.map(r=>J("TileMatrix",[J("ows:Identifier",r.identifier),J("ScaleDenominator",r.scaleDenominator),J("TopLeftCorner",r.topLeftCorner.join(" ")),J("TileWidth",r.tileWidth),J("TileHeight",r.tileHeight),J("MatrixWidth",r.matrixWidth),J("MatrixHeight",r.matrixHeight)]))])}toVNode(){let e=[];if(e.push(this.buildLayer(this.tileSet)),this.isIndividualLayers){let r=new Map;for(let n of this.tileSet.layers)r.set(so(n.name),n);let i=Array.from(r.values()).sort((n,s)=>(n.title??n.name).localeCompare(s.title??s.name));for(let n of i)e.push(this.buildLayerFromImagery(n))}for(let r of this.tileMatrixSets.values())e.push(this.buildTileMatrixSet(r));return J("Capabilities",kx,[...this.buildProvider(),J("Contents",e)])}toXml(){return`<?xml version="1.0" encoding="utf-8"?>
185
+ `+this.toVNode().toString()}};function Ox(t){let e=[...t.query.getAll("format"),...t.query.getAll("tileFormat")];if(e.length===0)return;let r=new Set;for(let i of e){let n=Wu(i);n!=null&&r.add(n)}if(r.size!==0)return[...r.values()]}async function ng(t){let e=it.action(t),r=Pm(e.rest);if(r==null)return Ie;let i=Xe.get(Xe.PublicUrlBase)??"";t.timer.start("tileset:load");let n=await je.TileSet.get(je.TileSet.id(r.name??"aerial"));if(t.timer.end("tileset:load"),n==null||n.type!==st.Raster)return Ie;let s=await je.Provider.get(je.Provider.id("linz")),a=r.tileMatrix==null?[lt,nn]:[r.tileMatrix];t.timer.start("imagery:load");let c=await je.getAllImagery(n.layers,a.map(v=>v.projection));t.timer.end("imagery:load");let d=it.apiKey(t),p=new Lc({httpBase:i,provider:s??void 0,tileSet:n,tileMatrix:a,isIndividualLayers:r.tileMatrix==null,imagery:c,apiKey:d,formats:Ox(t)}).toXml();if(p==null)return Ie;let m=Buffer.from(p),w=(0,ig.createHash)("sha256").update(m).digest("base64");if(Wr.isNotModified(t,w))return xn;let S=new Y(200,"ok");return S.header(ue.ETag,w),S.header(ue.CacheControl,"max-age=0"),S.buffer(m,"text/xml"),t.set("bytes",m.byteLength),S}var sg={validate(t,e){let{tileMatrix:r,x:i,y:n,z:s,ext:a}=e;if(t.set("xyz",{x:i,y:n,z:s}),t.set("projection",r.projection.code),t.set("tileMatrix",r.identifier),t.set("extension",a),t.set("tileSet",e.name),s>r.maxZoom||s<0)throw new Y(404,`Zoom not found: ${s}`);let c=r.zooms[s];if(i<0||i>c.matrixWidth)throw new Y(404,`X not found: ${i}`);if(n<0||n>c.matrixHeight)throw new Y(404,`Y not found: ${n}`);let d=qr.tileCenterToLatLon(r,e);t.set("location",d)}};async function og(t){let e=it.action(t),r=Cm(e.rest);if(r==null)return Ie;sg.validate(t,r),t.timer.start("tileset:load");let i=await Ar.get(r.name,r.tileMatrix);return t.timer.end("tileset:load"),i==null?Ie:await i.tile(t,r)}async function ag(t){let{rest:e}=it.action(t);if(e.length<1)return Ie;let r=it.apiKey(t);if(!Z4(r))return new Y(400,"Invalid API Key");let i=e[e.length-1].toLowerCase();return i==="attribution.json"?X4(t):i==="wmtscapabilities.xml"?ng(t):i==="tile.json"?Q4(t):i.endsWith("json")&&e[e.length-2]==="style"?rg(t,i):og(t)}var ug=new it;ug.get("tiles",ag);async function cg(t){let e=it.apiKey(t);if(e!=null){let r=(0,lg.createHash)("sha256").update(e).digest("base64");t.set("api",r)}return await ug.handle(t)}var Vt=cr.http($u.get());Vt.router.hook("request",t=>{t.set("name","LambdaTiler"),$i.reset()});Vt.router.hook("response",t=>{$i.requests.length>0&&(t.set("requests",$i.requests.slice(0,100)),t.set("requestCount",$i.requests.length))});Vt.router.get("/ping",bd);Vt.router.get("/health",Gd);Vt.router.get("/version",vd);Vt.router.get("/v1/ping",bd);Vt.router.get("/v1/health",Gd);Vt.router.get("/v1/version",vd);Vt.router.get("/v1/imagery/:imageryId/:fileName",H4);Vt.router.get("/v1/sprites/:spriteName",V4);Vt.router.get("/v1/fonts.json",M4);Vt.router.get("/v1/fonts/:fontStack/:range.pbf",x4);Vt.router.get("*",cg);0&&(module.exports={handleRequest,handler});
171
186
  /*! fetch-blob. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */
172
187
  /*! formdata-polyfill. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */
173
- /*! http://mths.be/fromcodepoint v0.1.0 by @mathias */
174
188
  /*! node-domexception. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */
175
189
  /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
176
190
  /**