@ifc-lite/viewer 1.25.2 → 1.27.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 (116) hide show
  1. package/.turbo/turbo-build.log +40 -30
  2. package/CHANGELOG.md +110 -0
  3. package/dist/assets/{basketViewActivator-CTgyKI3U.js → basketViewActivator-B3CdrLsb.js} +7 -7
  4. package/dist/assets/{bcf-7jQby1qi.js → bcf-QeHK_Aud.js} +5 -5
  5. package/dist/assets/{browser-DXS29_v9.js → browser-BIoDDfBW.js} +1 -1
  6. package/dist/assets/{cesium-BoVuJvTC.js → cesium-CzZn5yVA.js} +319 -319
  7. package/dist/assets/{deflate-Cfp9t1Df.js → deflate-B-d0SYQM.js} +1 -1
  8. package/dist/assets/exceljs.min-DsuzKYnj.js +29 -0
  9. package/dist/assets/{exporters-DfSvJPi4.js → exporters-B4LbZFeT.js} +1434 -1179
  10. package/dist/assets/geometry.worker-BdH-E6NB.js +1 -0
  11. package/dist/assets/{geotiff-xZoE8BkO.js → geotiff-CrVtDRFq.js} +10 -10
  12. package/dist/assets/html2canvas.esm-Ge7aVWlp.js +5 -0
  13. package/dist/assets/{ids-Cu73hD0Y.js → ids-DjsGFN10.js} +21 -21
  14. package/dist/assets/ifc-lite_bg-DsYUIHm3.wasm +0 -0
  15. package/dist/assets/{index-WSbA5iy6.js → index-COYokSKc.js} +44122 -38782
  16. package/dist/assets/index-ajK6D32J.css +1 -0
  17. package/dist/assets/index.es-CY202jA3.js +6866 -0
  18. package/dist/assets/{jpeg-DhwFEbqb.js → jpeg-D4wOkf5h.js} +1 -1
  19. package/dist/assets/jspdf.es.min-DIGb9BHN.js +19571 -0
  20. package/dist/assets/jspdf.plugin.autotable-BBLUVd7n.js +2 -0
  21. package/dist/assets/{lerc-Dz6BXOVb.js → lerc-DmW0_tgf.js} +1 -1
  22. package/dist/assets/{lzw-C9z0fG2o.js → lzw-oWetY-d6.js} +1 -1
  23. package/dist/assets/{maplibre-gl-Do6O5tDc.js → maplibre-gl-BF3Z0idw.js} +1 -1
  24. package/dist/assets/{native-bridge-RvDmzO-2.js → native-bridge-BX8_tHXE.js} +1 -1
  25. package/dist/assets/{packbits-jfwifz7C.js → packbits-F8Nkp4NY.js} +1 -1
  26. package/dist/assets/{pako.esm-Cram60i4.js → pako.esm-n3Pgozwg.js} +1 -1
  27. package/dist/assets/{parser.worker-C594dWxH.js → parser.worker-D591Zu_-.js} +3 -3
  28. package/dist/assets/pdf-Dsh3HPZB.js +135 -0
  29. package/dist/assets/raw-D9iw0tmc.js +1 -0
  30. package/dist/assets/{sandbox-DDSZ7rek.js → sandbox-BAC3a-eN.js} +4235 -2716
  31. package/dist/assets/server-client-Cjwnm7il.js +706 -0
  32. package/dist/assets/{webimage-XFHVyVtC.js → webimage-BLV1dgmd.js} +1 -1
  33. package/dist/assets/xlsx-Bc2HTrjC.js +142 -0
  34. package/dist/assets/{zip-BJqVbRkU.js → zip-DFgP-l20.js} +1 -1
  35. package/dist/assets/{zstd-3q5qcl5V.js → zstd-C_1HxVrA.js} +1 -1
  36. package/dist/index.html +8 -8
  37. package/package.json +13 -9
  38. package/src/components/extensions/FlavorDialog.tsx +18 -2
  39. package/src/components/extensions/FlavorListView.tsx +12 -3
  40. package/src/components/mcp/PlaygroundChat.tsx +1 -0
  41. package/src/components/mcp/data.ts +6 -0
  42. package/src/components/mcp/playground-dispatcher.ts +277 -0
  43. package/src/components/mcp/types.ts +2 -1
  44. package/src/components/ui/combo-input.tsx +163 -0
  45. package/src/components/ui/tabs.tsx +1 -1
  46. package/src/components/viewer/ClashBcfExportDialog.tsx +271 -0
  47. package/src/components/viewer/ClashPanel.tsx +370 -0
  48. package/src/components/viewer/ClashSettingsDialog.tsx +407 -0
  49. package/src/components/viewer/CommandPalette.tsx +14 -15
  50. package/src/components/viewer/MainToolbar.tsx +155 -175
  51. package/src/components/viewer/PropertiesPanel.tsx +13 -6
  52. package/src/components/viewer/SearchInline.tsx +62 -2
  53. package/src/components/viewer/SearchModal.filter.builder.tsx +24 -393
  54. package/src/components/viewer/SearchModal.filter.editors.tsx +503 -0
  55. package/src/components/viewer/SearchModal.filter.tsx +64 -1
  56. package/src/components/viewer/SearchModal.tsx +19 -6
  57. package/src/components/viewer/ViewerLayout.tsx +5 -0
  58. package/src/components/viewer/Viewport.tsx +64 -9
  59. package/src/components/viewer/ViewportContainer.tsx +45 -3
  60. package/src/components/viewer/bcf/BCFOverlay.tsx +5 -4
  61. package/src/components/viewer/lists/ColumnHeaderMenu.tsx +84 -0
  62. package/src/components/viewer/lists/ListBuilder.tsx +789 -280
  63. package/src/components/viewer/lists/ListGroupingBar.tsx +72 -0
  64. package/src/components/viewer/lists/ListPanel.tsx +49 -5
  65. package/src/components/viewer/lists/ListResultsTable.tsx +270 -176
  66. package/src/components/viewer/lists/list-table-utils.ts +123 -0
  67. package/src/components/viewer/useGeometryStreaming.ts +21 -1
  68. package/src/generated/mcp-catalog.json +4 -0
  69. package/src/hooks/ingest/streamCleanup.test.ts +41 -0
  70. package/src/hooks/ingest/streamCleanup.ts +45 -0
  71. package/src/hooks/ingest/viewerModelIngest.ts +64 -42
  72. package/src/hooks/ingest/watchedGeometryStream.test.ts +78 -0
  73. package/src/hooks/ingest/watchedGeometryStream.ts +76 -0
  74. package/src/hooks/source-key.ts +35 -0
  75. package/src/hooks/useAlignmentLines3D.ts +139 -0
  76. package/src/hooks/useClash.ts +420 -0
  77. package/src/hooks/useGridLines3D.ts +140 -0
  78. package/src/hooks/useIfcFederation.ts +16 -2
  79. package/src/hooks/useIfcLoader.ts +5 -7
  80. package/src/lib/clash/persistence.ts +308 -0
  81. package/src/lib/geo/effective-georef.test.ts +66 -0
  82. package/src/lib/length-unit-scale.ts +41 -0
  83. package/src/lib/lists/adapter.ts +136 -11
  84. package/src/lib/lists/export/csv.ts +47 -0
  85. package/src/lib/lists/export/index.ts +49 -0
  86. package/src/lib/lists/export/model.ts +111 -0
  87. package/src/lib/lists/export/pdf.ts +67 -0
  88. package/src/lib/lists/export/xlsx.ts +83 -0
  89. package/src/lib/lists/index.ts +2 -0
  90. package/src/lib/search/filter-evaluate.test.ts +81 -0
  91. package/src/lib/search/filter-evaluate.ts +59 -87
  92. package/src/lib/search/filter-match.ts +167 -0
  93. package/src/lib/search/filter-rules.test.ts +25 -0
  94. package/src/lib/search/filter-rules.ts +75 -2
  95. package/src/lib/search/filter-schema.ts +0 -0
  96. package/src/lib/slab-edit.test.ts +72 -0
  97. package/src/lib/slab-edit.ts +159 -19
  98. package/src/sdk/adapters/export-adapter.ts +3 -3
  99. package/src/sdk/adapters/query-adapter.ts +3 -3
  100. package/src/services/extensions/host.ts +13 -0
  101. package/src/store/constants.ts +33 -25
  102. package/src/store/index.ts +29 -8
  103. package/src/store/slices/clashSlice.ts +251 -0
  104. package/src/store/slices/listSlice.ts +6 -0
  105. package/src/store/slices/mutationSlice.ts +14 -6
  106. package/src/store/slices/searchSlice.ts +29 -3
  107. package/src/store/slices/visibilitySlice.test.ts +23 -5
  108. package/src/store/slices/visibilitySlice.ts +18 -8
  109. package/src/utils/nativeSpatialDataStore.ts +6 -0
  110. package/src/utils/serverDataModel.test.ts +6 -0
  111. package/src/utils/serverDataModel.ts +7 -0
  112. package/dist/assets/geometry.worker-Cyn5BybV.js +0 -1
  113. package/dist/assets/ifc-lite_bg-ksLBP5cA.wasm +0 -0
  114. package/dist/assets/index-Bws3UAkj.css +0 -1
  115. package/dist/assets/raw-R2QfzPAR.js +0 -1
  116. package/dist/assets/server-client-Ctk8_Bof.js +0 -626
@@ -1,4 +1,4 @@
1
- import{g as B_}from"./zip-BJqVbRkU.js";function O_(Aa,Ru){for(var $r=0;$r<Ru.length;$r++){const $i=Ru[$r];if(typeof $i!="string"&&!Array.isArray($i)){for(const Zr in $i)if(Zr!=="default"&&!(Zr in Aa)){const Da=Object.getOwnPropertyDescriptor($i,Zr);Da&&Object.defineProperty(Aa,Zr,Da.get?Da:{enumerable:!0,get:()=>$i[Zr]})}}}return Object.freeze(Object.defineProperty(Aa,Symbol.toStringTag,{value:"Module"}))}var ku={exports:{}};var V_=ku.exports,jf;function j_(){return jf||(jf=1,(function(Aa,Ru){(function($r,$i){Aa.exports=$i()})(V_,(function(){var $r={},$i={};function Zr(R,p,Te){if($i[R]=Te,R==="index"){var wr="var sharedModule = {}; ("+$i.shared+")(sharedModule); ("+$i.worker+")(sharedModule);",wi={};return $i.shared(wi),$i.index($r,wi),typeof window<"u"&&$r.setWorkerUrl(window.URL.createObjectURL(new Blob([wr],{type:"text/javascript"}))),$r}}Zr("shared",["exports"],(function(R){function p(r,e,i,s){return new(i||(i=Promise))((function(o,l){function u(m){try{g(s.next(m))}catch(v){l(v)}}function d(m){try{g(s.throw(m))}catch(v){l(v)}}function g(m){var v;m.done?o(m.value):(v=m.value,v instanceof i?v:new i((function(_){_(v)}))).then(u,d)}g((s=s.apply(r,e||[])).next())}))}function Te(r,e){this.x=r,this.y=e}function wr(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var wi,qr;typeof SuppressedError=="function"&&SuppressedError,Te.prototype={clone(){return new Te(this.x,this.y)},add(r){return this.clone()._add(r)},sub(r){return this.clone()._sub(r)},multByPoint(r){return this.clone()._multByPoint(r)},divByPoint(r){return this.clone()._divByPoint(r)},mult(r){return this.clone()._mult(r)},div(r){return this.clone()._div(r)},rotate(r){return this.clone()._rotate(r)},rotateAround(r,e){return this.clone()._rotateAround(r,e)},matMult(r){return this.clone()._matMult(r)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(r){return this.x===r.x&&this.y===r.y},dist(r){return Math.sqrt(this.distSqr(r))},distSqr(r){const e=r.x-this.x,i=r.y-this.y;return e*e+i*i},angle(){return Math.atan2(this.y,this.x)},angleTo(r){return Math.atan2(this.y-r.y,this.x-r.x)},angleWith(r){return this.angleWithSep(r.x,r.y)},angleWithSep(r,e){return Math.atan2(this.x*e-this.y*r,this.x*r+this.y*e)},_matMult(r){const e=r[2]*this.x+r[3]*this.y;return this.x=r[0]*this.x+r[1]*this.y,this.y=e,this},_add(r){return this.x+=r.x,this.y+=r.y,this},_sub(r){return this.x-=r.x,this.y-=r.y,this},_mult(r){return this.x*=r,this.y*=r,this},_div(r){return this.x/=r,this.y/=r,this},_multByPoint(r){return this.x*=r.x,this.y*=r.y,this},_divByPoint(r){return this.x/=r.x,this.y/=r.y,this},_unit(){return this._div(this.mag()),this},_perp(){const r=this.y;return this.y=this.x,this.x=-r,this},_rotate(r){const e=Math.cos(r),i=Math.sin(r),s=i*this.x+e*this.y;return this.x=e*this.x-i*this.y,this.y=s,this},_rotateAround(r,e){const i=Math.cos(r),s=Math.sin(r),o=e.y+s*(this.x-e.x)+i*(this.y-e.y);return this.x=e.x+i*(this.x-e.x)-s*(this.y-e.y),this.y=o,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:Te},Te.convert=function(r){if(r instanceof Te)return r;if(Array.isArray(r))return new Te(+r[0],+r[1]);if(r.x!==void 0&&r.y!==void 0)return new Te(+r.x,+r.y);throw new Error("Expected [x, y] or {x, y} point format")};var Cn=(function(){if(qr)return wi;function r(e,i,s,o){this.cx=3*e,this.bx=3*(s-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*i,this.by=3*(o-i)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=i,this.p2x=s,this.p2y=o}return qr=1,wi=r,r.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,i){if(i===void 0&&(i=1e-6),e<0)return 0;if(e>1)return 1;for(var s=e,o=0;o<8;o++){var l=this.sampleCurveX(s)-e;if(Math.abs(l)<i)return s;var u=this.sampleCurveDerivativeX(s);if(Math.abs(u)<1e-6)break;s-=l/u}var d=0,g=1;for(s=e,o=0;o<20&&(l=this.sampleCurveX(s),!(Math.abs(l-e)<i));o++)e>l?d=s:g=s,s=.5*(g-d)+d;return s},solve:function(e,i){return this.sampleCurveY(this.solveCurveX(e,i))}},wi})(),Gt=wr(Cn);let Tr,He;function Wr(){return Tr!=null||(Tr=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),Tr}function Ti(){if(He==null&&(He=!1,Wr())){const e=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(e){for(let s=0;s<25;s++){const o=4*s;e.fillStyle=`rgb(${o},${o+1},${o+2})`,e.fillRect(s%5,Math.floor(s/5),1,1)}const i=e.getImageData(0,0,5,5).data;for(let s=0;s<100;s++)if(s%4!=3&&i[s]!==s){He=!0;break}}}return He||!1}var pe=1e-6,zt=typeof Float32Array<"u"?Float32Array:Array;function Hr(){var r=new zt(9);return zt!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[5]=0,r[6]=0,r[7]=0),r[0]=1,r[4]=1,r[8]=1,r}function An(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function fs(){var r=new zt(3);return zt!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r}function ms(r){var e=r[0],i=r[1],s=r[2];return Math.sqrt(e*e+i*i+s*s)}function qe(r,e,i){var s=new zt(3);return s[0]=r,s[1]=e,s[2]=i,s}function W(r,e,i){return r[0]=e[0]+i[0],r[1]=e[1]+i[1],r[2]=e[2]+i[2],r}function K(r,e,i){return r[0]=e[0]*i,r[1]=e[1]*i,r[2]=e[2]*i,r}function ee(r,e,i){var s=e[0],o=e[1],l=e[2],u=i[0],d=i[1],g=i[2];return r[0]=o*g-l*d,r[1]=l*u-s*g,r[2]=s*d-o*u,r}var ge,Me=ms;function $e(r,e,i){var s=e[0],o=e[1],l=e[2],u=e[3];return r[0]=i[0]*s+i[4]*o+i[8]*l+i[12]*u,r[1]=i[1]*s+i[5]*o+i[9]*l+i[13]*u,r[2]=i[2]*s+i[6]*o+i[10]*l+i[14]*u,r[3]=i[3]*s+i[7]*o+i[11]*l+i[15]*u,r}function ze(){var r=new zt(4);return zt!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r[3]=1,r}function Ge(r,e,i,s){var o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:"zyx",l=Math.PI/360;e*=l,s*=l,i*=l;var u=Math.sin(e),d=Math.cos(e),g=Math.sin(i),m=Math.cos(i),v=Math.sin(s),_=Math.cos(s);switch(o){case"xyz":r[0]=u*m*_+d*g*v,r[1]=d*g*_-u*m*v,r[2]=d*m*v+u*g*_,r[3]=d*m*_-u*g*v;break;case"xzy":r[0]=u*m*_-d*g*v,r[1]=d*g*_-u*m*v,r[2]=d*m*v+u*g*_,r[3]=d*m*_+u*g*v;break;case"yxz":r[0]=u*m*_+d*g*v,r[1]=d*g*_-u*m*v,r[2]=d*m*v-u*g*_,r[3]=d*m*_+u*g*v;break;case"yzx":r[0]=u*m*_+d*g*v,r[1]=d*g*_+u*m*v,r[2]=d*m*v-u*g*_,r[3]=d*m*_-u*g*v;break;case"zxy":r[0]=u*m*_-d*g*v,r[1]=d*g*_+u*m*v,r[2]=d*m*v+u*g*_,r[3]=d*m*_-u*g*v;break;case"zyx":r[0]=u*m*_-d*g*v,r[1]=d*g*_+u*m*v,r[2]=d*m*v-u*g*_,r[3]=d*m*_+u*g*v;break;default:throw new Error("Unknown angle order "+o)}return r}function Le(){var r=new zt(2);return zt!=Float32Array&&(r[0]=0,r[1]=0),r}function Ye(r,e){var i=new zt(2);return i[0]=r,i[1]=e,i}fs(),ge=new zt(4),zt!=Float32Array&&(ge[0]=0,ge[1]=0,ge[2]=0,ge[3]=0),fs(),qe(1,0,0),qe(0,1,0),ze(),ze(),Hr(),Le();const De=8192;function _t(r,e,i){return e*(De/(r.tileSize*Math.pow(2,i-r.tileID.overscaledZ)))}function yt(r){return r instanceof Error?r:new Error(typeof r=="string"?r:String(r))}function Zi(r,e){return(r%e+e)%e}function Ri(r,e,i){return r*(1-i)+e*i}function Sr(r){if(r<=0)return 0;if(r>=1)return 1;const e=r*r,i=e*r;return 4*(r<.5?i:3*(r-e)+i-.75)}function Xr(r,e,i,s){const o=new Gt(r,e,i,s);return l=>o.solve(l)}const gs=Xr(.25,.1,.25,1);function si(r,e,i){return Math.min(i,Math.max(e,r))}function Dn(r,e,i){const s=i-e,o=((r-e)%s+s)%s+e;return o===e?i:o}function Fi(r,...e){for(const i of e)for(const s in i)r[s]=i[s];return r}let _s=1;function Pr(r,e,i){const s={};for(const o in r)s[o]=e.call(this,r[o],o,r);return s}function Yr(r,e,i){const s={};for(const o in r)e.call(this,r[o],o,r)&&(s[o]=r[o]);return s}function ke(r){return Array.isArray(r)?r.map(ke):typeof r=="object"&&r?Pr(r,ke):r}const Ft={};function $t(r){Ft[r]||(typeof console<"u"&&console.warn(r),Ft[r]=!0)}function Si(r,e,i){return(i.y-r.y)*(e.x-r.x)>(e.y-r.y)*(i.x-r.x)}function Zt(r){return typeof WorkerGlobalScope<"u"&&r!==void 0&&r instanceof WorkerGlobalScope}let mi=null;function Kr(r){return typeof ImageBitmap<"u"&&r instanceof ImageBitmap}const za="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function ka(r,e,i,s,o){return p(this,void 0,void 0,(function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");const l=new VideoFrame(r,{timestamp:0});try{const u=l?.format;if(!u||!u.startsWith("BGR")&&!u.startsWith("RGB"))throw new Error(`Unrecognized format ${u}`);const d=u.startsWith("BGR"),g=new Uint8ClampedArray(s*o*4);if(yield l.copyTo(g,(function(m,v,_,T,b){const I=4*Math.max(-v,0),M=(Math.max(0,_)-_)*T*4+I,A=4*T,D=Math.max(0,v),F=Math.max(0,_);return{rect:{x:D,y:F,width:Math.min(m.width,v+T)-D,height:Math.min(m.height,_+b)-F},layout:[{offset:M,stride:A}]}})(r,e,i,s,o)),d)for(let m=0;m<g.length;m+=4){const v=g[m];g[m]=g[m+2],g[m+2]=v}return g}finally{l.close()}}))}let Ir,zn;function co(r,e,i,s){return r.addEventListener(e,i,s),{unsubscribe:()=>{r.removeEventListener(e,i,s)}}}function Mr(r){return r*Math.PI/180}function Jr(r){return r/Math.PI*180}const Ra={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0},Fa={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0},uo="AbortError";class ys extends Error{constructor(e=uo){super(e instanceof Error?e.message:e),this.name=uo,e instanceof Error&&e.stack&&(this.stack=e.stack)}}function rc(r){return r instanceof Error&&r.name===uo}function ho(r){if(r.aborted)throw new ys(r.reason)}const Er={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function ar(r){return Er.REGISTERED_PROTOCOLS[r.substring(0,r.indexOf("://"))]}const Li="global-dispatcher";class kn extends Error{constructor(e,i,s,o){super(`AJAXError: ${i} (${e}): ${s}`),this.status=e,this.statusText=i,this.url=s,this.body=o}}const La=()=>{var r;return Zt(self)?(r=self.worker)===null||r===void 0?void 0:r.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href},Qr=function(r,e){return p(this,void 0,void 0,(function*(){var i,s;if(r.url.includes("://")&&!/^https?:|^file:/.test(r.url)){const o=ar(r.url);if(o){const l=yield o(r,e);return l.data||r.type!=="arrayBuffer"?l:Fi(l,{data:new ArrayBuffer(0)})}if(Zt(self)&&(!((i=self.worker)===null||i===void 0)&&i.actor))return self.worker.actor.sendAsync({type:"GR",data:r,targetMapId:Li},e)}if(!(o=>{var l;return o.startsWith("file:")||((l=La())===null||l===void 0?void 0:l.startsWith("file:"))&&!/^\w+:/.test(o)})(r.url)){if(fetch&&Request&&AbortController&&Object.hasOwn(Request.prototype,"signal"))return(function(o,l){return p(this,void 0,void 0,(function*(){const u=new Request(o.url,{method:o.method||"GET",body:o.body,credentials:o.credentials,headers:o.headers,cache:o.cache,referrer:La(),referrerPolicy:o.referrerPolicy,signal:l.signal});let d,g;o.type!=="json"||u.headers.has("Accept")||u.headers.set("Accept","application/json");try{d=yield fetch(u)}catch(v){throw rc(v)?v:new kn(0,yt(v).message,o.url,new Blob)}if(!d.ok){const v=yield d.blob();throw new kn(d.status,d.statusText,o.url,v)}g=o.type==="arrayBuffer"||o.type==="image"?d.arrayBuffer():o.type==="json"?d.json():d.text();const m=yield g;return ho(l.signal),{data:m,cacheControl:d.headers.get("Cache-Control"),expires:d.headers.get("Expires"),etag:d.headers.get("ETag")}}))})(r,e);if(Zt(self)&&(!((s=self.worker)===null||s===void 0)&&s.actor))return self.worker.actor.sendAsync({type:"GR",data:r,mustQueue:!0,targetMapId:Li},e)}return(function(o,l){return new Promise(((u,d)=>{var g;const m=new XMLHttpRequest;m.open(o.method||"GET",o.url,!0),o.type!=="arrayBuffer"&&o.type!=="image"||(m.responseType="arraybuffer");for(const v in o.headers)m.setRequestHeader(v,o.headers[v]);o.type==="json"&&(m.responseType="text",!((g=o.headers)===null||g===void 0)&&g.Accept||m.setRequestHeader("Accept","application/json")),m.withCredentials=o.credentials==="include",m.onerror=()=>{d(new Error(m.statusText))},m.onload=()=>{if(!l.signal.aborted)if((m.status>=200&&m.status<300||m.status===0)&&m.response!==null){let v=m.response;if(o.type==="json")try{v=JSON.parse(m.response)}catch(_){return void d(_)}u({data:v,cacheControl:m.getResponseHeader("Cache-Control"),expires:m.getResponseHeader("Expires"),etag:m.getResponseHeader("ETag")})}else{const v=new Blob([m.response],{type:m.getResponseHeader("Content-Type")});d(new kn(m.status,m.statusText,o.url,v))}},l.signal.addEventListener("abort",(()=>{m.abort(),d(new ys(l.signal.reason))})),m.send(o.body)}))})(r,e)}))};function qi(r){if(!r||r.indexOf("://")<=0||r.startsWith("data:image/")||r.startsWith("blob:"))return!0;const e=new URL(r),i=window.location;return e.protocol===i.protocol&&e.host===i.host}function Rn(r,e,i){var s;!((s=i[r])===null||s===void 0)&&s.includes(e)||(i[r]||(i[r]=[]),i[r].push(e))}function en(r,e,i){if(i?.[r]){const s=i[r].indexOf(e);s!==-1&&i[r].splice(s,1)}}class vs{constructor(e,i={}){Fi(this,i),this.type=e}}class Fn extends vs{constructor(e,i={}){super("error",Fi({error:e},i))}}class po{on(e,i){return this._listeners||(this._listeners={}),Rn(e,i,this._listeners),{unsubscribe:()=>{this.off(e,i)}}}off(e,i){return en(e,i,this._listeners),en(e,i,this._oneTimeListeners),this}once(e,i){return i?(this._oneTimeListeners||(this._oneTimeListeners={}),Rn(e,i,this._oneTimeListeners),this):new Promise((s=>this.once(e,s)))}fire(e,i){var s,o;typeof e=="string"&&(e=new vs(e,i||{}));const l=e.type;if(this.listens(l)){e.target=this;const u=!((s=this._listeners)===null||s===void 0)&&s[l]?this._listeners[l].slice():[];for(const m of u)m.call(this,e);const d=!((o=this._oneTimeListeners)===null||o===void 0)&&o[l]?this._oneTimeListeners[l].slice():[];for(const m of d)en(l,m,this._oneTimeListeners),m.call(this,e);const g=this._eventedParent;g&&(Fi(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),g.fire(e))}else e instanceof Fn&&console.error(e.error);return this}listens(e){var i,s,o,l,u;return((s=(i=this._listeners)===null||i===void 0?void 0:i[e])===null||s===void 0?void 0:s.length)>0||((l=(o=this._oneTimeListeners)===null||o===void 0?void 0:o[e])===null||l===void 0?void 0:l.length)>0||((u=this._eventedParent)===null||u===void 0?void 0:u.listens(e))}setEventedParent(e,i){return this._eventedParent=e,this._eventedParentData=i,this}}var ce={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number",length:2},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},"font-faces":{type:"fontFaces"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},encoding:{type:"enum",values:{mvt:{},mlt:{}},default:"mvt"},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"filter"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},"color-relief":{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},filter:{type:"boolean",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"expression_name",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}},interpolation:{type:"array",value:"interpolation_name",minimum:1},interpolation_name:{type:"enum",values:{linear:{syntax:{overloads:[{parameters:[],"output-type":"interpolation"}],parameters:[]}},exponential:{syntax:{overloads:[{parameters:["base"],"output-type":"interpolation"}],parameters:[{name:"base",type:"number literal"}]}},"cubic-bezier":{syntax:{overloads:[{parameters:["x1","y1","x2","y2"],"output-type":"interpolation"}],parameters:[{name:"x1",type:"number literal"},{name:"y1",type:"number literal"},{name:"x2",type:"number literal"},{name:"y2",type:"number literal"}]}}}}};const Ba=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Oa(r,e){const i={};for(const s in r)s!=="ref"&&(i[s]=r[s]);return Ba.forEach((s=>{s in e&&(i[s]=e[s])})),i}function et(r,e){if(Array.isArray(r)){if(!Array.isArray(e)||r.length!==e.length)return!1;for(let i=0;i<r.length;i++)if(!et(r[i],e[i]))return!1;return!0}if(typeof r=="object"&&r!==null&&e!==null){if(typeof e!="object"||Object.keys(r).length!==Object.keys(e).length)return!1;for(const i in r)if(!et(r[i],e[i]))return!1;return!0}return r===e}function gi(r,e){r.push(e)}function tn(r,e,i){gi(i,{command:"addSource",args:[r,e[r]]})}function nc(r,e,i){gi(e,{command:"removeSource",args:[r]}),i[r]=!0}function sc(r,e,i,s){nc(r,i,s),tn(r,e,i)}function Fu(r,e,i){let s;for(s in r[i])if(Object.prototype.hasOwnProperty.call(r[i],s)&&s!=="data"&&!et(r[i][s],e[i][s]))return!1;for(s in e[i])if(Object.prototype.hasOwnProperty.call(e[i],s)&&s!=="data"&&!et(r[i][s],e[i][s]))return!1;return!0}function fo(r,e,i,s,o,l){r=r||{},e=e||{};for(const u in r)Object.prototype.hasOwnProperty.call(r,u)&&(et(r[u],e[u])||i.push({command:l,args:[s,u,e[u],o]}));for(const u in e)Object.prototype.hasOwnProperty.call(e,u)&&!Object.prototype.hasOwnProperty.call(r,u)&&(et(r[u],e[u])||i.push({command:l,args:[s,u,e[u],o]}))}function Va(r){return r.id}function oc(r,e){return r[e.id]=e,r}class _e{constructor(e,i,s,o){this.message=(e?`${e}: `:"")+s,o&&(this.identifier=o),i!=null&&i.__line__&&(this.line=i.__line__)}}function rn(r,...e){for(const i of e)for(const s in i)r[s]=i[s];return r}class qt extends Error{constructor(e,i){super(i),this.message=i,this.key=e}}class ja{constructor(e,i=[]){this.parent=e,this.bindings={};for(const[s,o]of i)this.bindings[s]=o}concat(e){return new ja(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}const Cr={kind:"null"},be={kind:"number"},Fe={kind:"string"},je={kind:"boolean"},Pi={kind:"color"},mo={kind:"projectionDefinition"},lr={kind:"object"},Be={kind:"value"},xs={kind:"collator"},bs={kind:"formatted"},go={kind:"padding"},Ln={kind:"colorArray"},ws={kind:"numberArray"},Bn={kind:"resolvedImage"},Ts={kind:"variableAnchorOffsetCollection"};function Wt(r,e){return{kind:"array",itemType:r,N:e}}function tt(r){if(r.kind==="array"){const e=tt(r.itemType);return typeof r.N=="number"?`array<${e}, ${r.N}>`:r.itemType.kind==="value"?"array":`array<${e}>`}return r.kind}const _o=[Cr,be,Fe,je,Pi,mo,bs,lr,Wt(Be),go,ws,Ln,Bn,Ts];function On(r,e){if(e.kind==="error")return null;if(r.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!On(r.itemType,e.itemType))&&(typeof r.N!="number"||r.N===e.N))return null}else{if(r.kind===e.kind)return null;if(r.kind==="value"){for(const i of _o)if(!On(i,e))return null}}return`Expected ${tt(r)} but found ${tt(e)} instead.`}function Ss(r,e){return e.some((i=>i.kind===r.kind))}function nn(r,e){return e.some((i=>i==="null"?r===null:i==="array"?Array.isArray(r):i==="object"?r&&!Array.isArray(r)&&typeof r=="object":i===typeof r))}function Wi(r,e){return r.kind==="array"&&e.kind==="array"?r.itemType.kind===e.itemType.kind&&typeof r.N=="number":r.kind===e.kind}const ac=.96422,sn=.82521,yo=4/29,vt=6/29,lc=3*vt*vt,cc=vt*vt*vt,Ps=Math.PI/180,uc=180/Math.PI;function hc(r){return(r%=360)<0&&(r+=360),r}function dc([r,e,i,s]){let o,l;const u=Na((.2225045*(r=vo(r))+.7168786*(e=vo(e))+.0606169*(i=vo(i)))/1);r===e&&e===i?o=l=u:(o=Na((.4360747*r+.3850649*e+.1430804*i)/ac),l=Na((.0139322*r+.0971045*e+.7141733*i)/sn));const d=116*u-16;return[d<0?0:d,500*(o-u),200*(u-l),s]}function vo(r){return r<=.04045?r/12.92:Math.pow((r+.055)/1.055,2.4)}function Na(r){return r>cc?Math.pow(r,1/3):r/lc+yo}function Ua([r,e,i,s]){let o=(r+16)/116,l=isNaN(e)?o:o+e/500,u=isNaN(i)?o:o-i/200;return o=1*$a(o),l=ac*$a(l),u=sn*$a(u),[Ga(3.1338561*l-1.6168667*o-.4906146*u),Ga(-.9787684*l+1.9161415*o+.033454*u),Ga(.0719453*l-.2289914*o+1.4052427*u),s]}function Ga(r){return(r=r<=.00304?12.92*r:1.055*Math.pow(r,1/2.4)-.055)<0?0:r>1?1:r}function $a(r){return r>vt?r*r*r:lc*(r-yo)}const Lu=Object.hasOwn||function(r,e){return Object.prototype.hasOwnProperty.call(r,e)};function Is(r,e){return Lu(r,e)?r[e]:void 0}function xo(r){return parseInt(r.padEnd(2,r),16)/255}function pc(r,e){return Vn(e?r/100:r,0,1)}function Vn(r,e,i){return Math.min(Math.max(e,r),i)}function Za(r){return!r.some(Number.isNaN)}const Ms={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function Ar(r,e,i){return r+i*(e-r)}function jn(r,e,i){return r.map(((s,o)=>Ar(s,e[o],i)))}class Ve{constructor(e,i,s,o=1,l=!0){this.r=e,this.g=i,this.b=s,this.a=o,l||(this.r*=o,this.g*=o,this.b*=o,o||this.overwriteGetter("rgb",[e,i,s,o]))}static parse(e){if(e instanceof Ve)return e;if(typeof e!="string")return;const i=(function(s){if((s=s.toLowerCase().trim())==="transparent")return[0,0,0,0];const o=Is(Ms,s);if(o){const[u,d,g]=o;return[u/255,d/255,g/255,1]}if(s.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(s)){const u=s.length<6?1:2;let d=1;return[xo(s.slice(d,d+=u)),xo(s.slice(d,d+=u)),xo(s.slice(d,d+=u)),xo(s.slice(d,d+u)||"ff")]}if(s.startsWith("rgb")){const u=s.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(u){const[d,g,m,v,_,T,b,I,M,A,D,F]=u,k=[v||" ",b||" ",A].join("");if(k===" "||k===" /"||k===",,"||k===",,,"){const L=[m,T,M].join(""),O=L==="%%%"?100:L===""?255:0;if(O){const j=[Vn(+g/O,0,1),Vn(+_/O,0,1),Vn(+I/O,0,1),D?pc(+D,F):1];if(Za(j))return j}}return}}const l=s.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(l){const[u,d,g,m,v,_,T,b,I]=l,M=[g||" ",v||" ",T].join("");if(M===" "||M===" /"||M===",,"||M===",,,"){const A=[+d,Vn(+m,0,100),Vn(+_,0,100),b?pc(+b,I):1];if(Za(A))return(function([D,F,k,L]){function O(j){const Y=(j+D/30)%12,J=F*Math.min(k,1-k);return k-J*Math.max(-1,Math.min(Y-3,9-Y,1))}return D=hc(D),F/=100,k/=100,[O(0),O(8),O(4),L]})(A)}}})(e);return i?new Ve(...i,!1):void 0}get rgb(){const{r:e,g:i,b:s,a:o}=this,l=o||1/0;return this.overwriteGetter("rgb",[e/l,i/l,s/l,o])}get hcl(){return this.overwriteGetter("hcl",(function(e){const[i,s,o,l]=dc(e),u=Math.sqrt(s*s+o*o);return[Math.round(1e4*u)?hc(Math.atan2(o,s)*uc):NaN,u,i,l]})(this.rgb))}get lab(){return this.overwriteGetter("lab",dc(this.rgb))}overwriteGetter(e,i){return Object.defineProperty(this,e,{value:i}),i}toString(){const[e,i,s,o]=this.rgb;return`rgba(${[e,i,s].map((l=>Math.round(255*l))).join(",")},${o})`}static interpolate(e,i,s,o="rgb"){switch(o){case"rgb":{const[l,u,d,g]=jn(e.rgb,i.rgb,s);return new Ve(l,u,d,g,!1)}case"hcl":{const[l,u,d,g]=e.hcl,[m,v,_,T]=i.hcl;let b,I;if(isNaN(l)||isNaN(m))isNaN(l)?isNaN(m)?b=NaN:(b=m,d!==1&&d!==0||(I=v)):(b=l,_!==1&&_!==0||(I=u));else{let k=m-l;m>l&&k>180?k-=360:m<l&&l-m>180&&(k+=360),b=l+s*k}const[M,A,D,F]=(function([k,L,O,j]){return k=isNaN(k)?0:k*Ps,Ua([O,Math.cos(k)*L,Math.sin(k)*L,j])})([b,I??Ar(u,v,s),Ar(d,_,s),Ar(g,T,s)]);return new Ve(M,A,D,F,!1)}case"lab":{const[l,u,d,g]=Ua(jn(e.lab,i.lab,s));return new Ve(l,u,d,g,!1)}}}}Ve.black=new Ve(0,0,0,1),Ve.white=new Ve(1,1,1,1),Ve.transparent=new Ve(0,0,0,0),Ve.red=new Ve(1,0,0,1);class qa{constructor(e,i,s){this.sensitivity=e?i?"variant":"case":i?"accent":"base",this.locale=s,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,i){return this.collator.compare(e,i)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}const Bu=["bottom","center","top"];class Wa{constructor(e,i,s,o,l,u){this.text=e,this.image=i,this.scale=s,this.fontStack=o,this.textColor=l,this.verticalAlign=u}}class _i{constructor(e){this.sections=e}static fromString(e){return new _i([new Wa(e,null,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some((e=>e.text.length!==0||e.image&&e.image.name.length!==0))}static factory(e){return e instanceof _i?e:_i.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map((e=>e.text)).join("")}}class Kt{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Kt)return e;if(typeof e=="number")return new Kt([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(const i of e)if(typeof i!="number")return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]]}return new Kt(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,i,s){return new Kt(jn(e.values,i.values,s))}}class dt{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof dt)return e;if(typeof e=="number")return new dt([e]);if(Array.isArray(e)){for(const i of e)if(typeof i!="number")return;return new dt(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,i,s){return new dt(jn(e.values,i.values,s))}}class Re{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Re)return e;if(typeof e=="string"){const s=Ve.parse(e);return s?new Re([s]):void 0}if(!Array.isArray(e))return;const i=[];for(const s of e){if(typeof s!="string")return;const o=Ve.parse(s);if(!o)return;i.push(o)}return new Re(i)}toString(){return JSON.stringify(this.values)}static interpolate(e,i,s,o="rgb"){const l=[];if(e.values.length!=i.values.length)throw new Error(`colorArray: Arrays have mismatched length (${e.values.length} vs. ${i.values.length}), cannot interpolate.`);for(let u=0;u<e.values.length;u++)l.push(Ve.interpolate(e.values[u],i.values[u],s,o));return new Re(l)}}class st extends Error{constructor(e){super(e),this.name="RuntimeError"}toJSON(){return this.message}}const Dr=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class oi{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof oi)return e;if(Array.isArray(e)&&!(e.length<1)&&e.length%2==0){for(let i=0;i<e.length;i+=2){const s=e[i],o=e[i+1];if(typeof s!="string"||!Dr.has(s)||!Array.isArray(o)||o.length!==2||typeof o[0]!="number"||typeof o[1]!="number")return}return new oi(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,i,s){const o=e.values,l=i.values;if(o.length!==l.length)throw new st(`Cannot interpolate values of different length. from: ${e.toString()}, to: ${i.toString()}`);const u=[];for(let d=0;d<o.length;d+=2){if(o[d]!==l[d])throw new st(`Cannot interpolate values containing mismatched anchors. from[${d}]: ${o[d]}, to[${d}]: ${l[d]}`);u.push(o[d]);const[g,m]=o[d+1],[v,_]=l[d+1];u.push([Ar(g,v,s),Ar(m,_,s)])}return new oi(u)}}class Ii{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new Ii({name:e,available:!1}):null}}class ai{constructor(e,i,s){this.from=e,this.to=i,this.transition=s}static interpolate(e,i,s){return new ai(e,i,s)}static parse(e){return e instanceof ai?e:Array.isArray(e)&&e.length===3&&typeof e[0]=="string"&&typeof e[1]=="string"&&typeof e[2]=="number"?new ai(e[0],e[1],e[2]):typeof e=="object"&&typeof e.from=="string"&&typeof e.to=="string"&&typeof e.transition=="number"?new ai(e.from,e.to,e.transition):typeof e=="string"?new ai(e,e,1):void 0}}function Nn(r,e,i,s){return typeof r=="number"&&r>=0&&r<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof i=="number"&&i>=0&&i<=255?s===void 0||typeof s=="number"&&s>=0&&s<=1?null:`Invalid rgba value [${[r,e,i,s].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof s=="number"?[r,e,i,s]:[r,e,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function zr(r){if(r===null||typeof r=="string"||typeof r=="boolean"||typeof r=="number"||r instanceof ai||r instanceof Ve||r instanceof qa||r instanceof _i||r instanceof Kt||r instanceof dt||r instanceof Re||r instanceof oi||r instanceof Ii)return!0;if(Array.isArray(r)){for(const e of r)if(!zr(e))return!1;return!0}if(typeof r=="object"){for(const e in r)if(!zr(r[e]))return!1;return!0}return!1}function Tt(r){if(r===null)return Cr;if(typeof r=="string")return Fe;if(typeof r=="boolean")return je;if(typeof r=="number")return be;if(r instanceof Ve)return Pi;if(r instanceof ai)return mo;if(r instanceof qa)return xs;if(r instanceof _i)return bs;if(r instanceof Kt)return go;if(r instanceof dt)return ws;if(r instanceof Re)return Ln;if(r instanceof oi)return Ts;if(r instanceof Ii)return Bn;if(Array.isArray(r)){const e=r.length;let i;for(const s of r){const o=Tt(s);if(i){if(i===o)continue;i=Be;break}i=o}return Wt(i||Be,e)}return lr}function on(r){const e=typeof r;return r===null?"":e==="string"||e==="number"||e==="boolean"?String(r):r instanceof Ve||r instanceof ai||r instanceof _i||r instanceof Kt||r instanceof dt||r instanceof Re||r instanceof oi||r instanceof Ii?r.toString():JSON.stringify(r)}class er{constructor(e,i){this.type=e,this.value=i}static parse(e,i){if(e.length!==2)return i.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!zr(e[1]))return i.error("invalid value");const s=e[1];let o=Tt(s);const l=i.expectedType;return o.kind!=="array"||o.N!==0||!l||l.kind!=="array"||typeof l.N=="number"&&l.N!==0||(o=l),new er(o,s)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}const bo={string:Fe,number:be,boolean:je,object:lr};class yi{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");let s,o=1;const l=e[0];if(l==="array"){let d,g;if(e.length>2){const m=e[1];if(typeof m!="string"||!(m in bo)||m==="object")return i.error('The item type argument of "array" must be one of string, number, boolean',1);d=bo[m],o++}else d=Be;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return i.error('The length argument to "array" must be a positive integer literal',2);g=e[2],o++}s=Wt(d,g)}else{if(!bo[l])throw new Error(`Types doesn't contain name = ${l}`);s=bo[l]}const u=[];for(;o<e.length;o++){const d=i.parse(e[o],o,Be);if(!d)return null;u.push(d)}return new yi(s,u)}evaluate(e){for(let i=0;i<this.args.length;i++){const s=this.args[i].evaluate(e);if(!On(this.type,Tt(s)))return s;if(i===this.args.length-1)throw new st(`Expected value to be of type ${tt(this.type)}, but found ${tt(Tt(s))} instead.`)}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}const an={"to-boolean":je,"to-color":Pi,"to-number":be,"to-string":Fe};class cr{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");const s=e[0];if(!an[s])throw new Error(`Can't parse ${s} as it is not part of the known types`);if((s==="to-boolean"||s==="to-string")&&e.length!==2)return i.error("Expected one argument.");const o=an[s],l=[];for(let u=1;u<e.length;u++){const d=i.parse(e[u],u,Be);if(!d)return null;l.push(d)}return new cr(o,l)}evaluate(e){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(e);case"color":{let i,s;for(const o of this.args){if(i=o.evaluate(e),s=null,i instanceof Ve)return i;if(typeof i=="string"){const l=e.parseColor(i);if(l)return l}else if(Array.isArray(i)&&(s=i.length<3||i.length>4?`Invalid rgba value ${JSON.stringify(i)}: expected an array containing either three or four numeric values.`:Nn(i[0],i[1],i[2],i[3]),!s))return new Ve(i[0]/255,i[1]/255,i[2]/255,i[3])}throw new st(s||`Could not parse color from value '${typeof i=="string"?i:JSON.stringify(i)}'`)}case"padding":{let i;for(const s of this.args){i=s.evaluate(e);const o=Kt.parse(i);if(o)return o}throw new st(`Could not parse padding from value '${typeof i=="string"?i:JSON.stringify(i)}'`)}case"numberArray":{let i;for(const s of this.args){i=s.evaluate(e);const o=dt.parse(i);if(o)return o}throw new st(`Could not parse numberArray from value '${typeof i=="string"?i:JSON.stringify(i)}'`)}case"colorArray":{let i;for(const s of this.args){i=s.evaluate(e);const o=Re.parse(i);if(o)return o}throw new st(`Could not parse colorArray from value '${typeof i=="string"?i:JSON.stringify(i)}'`)}case"variableAnchorOffsetCollection":{let i;for(const s of this.args){i=s.evaluate(e);const o=oi.parse(i);if(o)return o}throw new st(`Could not parse variableAnchorOffsetCollection from value '${typeof i=="string"?i:JSON.stringify(i)}'`)}case"number":{let i=null;for(const s of this.args){if(i=s.evaluate(e),i===null)return 0;const o=Number(i);if(!isNaN(o))return o}throw new st(`Could not convert ${JSON.stringify(i)} to number.`)}case"formatted":return _i.fromString(on(this.args[0].evaluate(e)));case"resolvedImage":return Ii.fromString(on(this.args[0].evaluate(e)));case"projectionDefinition":return this.args[0].evaluate(e);default:return on(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}const fc=["Unknown","Point","LineString","Polygon"];class Ha{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?fc[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(e){let i=this._parseColorCache.get(e);return i||(i=Ve.parse(e),this._parseColorCache.set(e,i)),i}}class ln{constructor(e,i,s=[],o,l=new ja,u=[]){this.registry=e,this.path=s,this.key=s.map((d=>`[${d}]`)).join(""),this.scope=l,this.errors=u,this.expectedType=o,this._isConstant=i}parse(e,i,s,o,l={}){return i?this.concat(i,s,o)._parse(e,l):this._parse(e,l)}_parse(e,i){function s(o,l,u){return u==="assert"?new yi(l,[o]):u==="coerce"?new cr(l,[o]):o}if(e!==null&&typeof e!="string"&&typeof e!="boolean"&&typeof e!="number"||(e=["literal",e]),Array.isArray(e)){if(e.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const o=e[0];if(typeof o!="string")return this.error(`Expression name must be a string, but found ${typeof o} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const l=this.registry[o];if(l){let u=l.parse(e,this);if(!u)return null;if(this.expectedType){const d=this.expectedType,g=u.type;if(d.kind!=="string"&&d.kind!=="number"&&d.kind!=="boolean"&&d.kind!=="object"&&d.kind!=="array"||g.kind!=="value"){if(d.kind==="projectionDefinition"&&["string","array"].includes(g.kind)||["color","formatted","resolvedImage"].includes(d.kind)&&["value","string"].includes(g.kind)||["padding","numberArray"].includes(d.kind)&&["value","number","array"].includes(g.kind)||d.kind==="colorArray"&&["value","string","array"].includes(g.kind)||d.kind==="variableAnchorOffsetCollection"&&["value","array"].includes(g.kind))u=s(u,d,i.typeAnnotation||"coerce");else if(this.checkSubtype(d,g))return null}else u=s(u,d,i.typeAnnotation||"assert")}if(!(u instanceof er)&&u.type.kind!=="resolvedImage"&&this._isConstant(u)){const d=new Ha;try{u=new er(u.type,u.evaluate(d))}catch(g){return this.error(g.message),null}}return u}return this.error(`Unknown expression "${o}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(e===void 0?"'undefined' value invalid. Use null instead.":typeof e=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,i,s){const o=typeof e=="number"?this.path.concat(e):this.path,l=s?this.scope.concat(s):this.scope;return new ln(this.registry,this._isConstant,o,i||null,l,this.errors)}error(e,...i){const s=`${this.key}${i.map((o=>`[${o}]`)).join("")}`;this.errors.push(new qt(s,e))}checkSubtype(e,i){const s=On(e,i);return s&&this.error(s),s}}class ot{constructor(e,i){this.type=i.type,this.bindings=[].concat(e),this.result=i}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const i of this.bindings)e(i[1]);e(this.result)}static parse(e,i){if(e.length<4)return i.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const s=[];for(let l=1;l<e.length-1;l+=2){const u=e[l];if(typeof u!="string")return i.error(`Expected string, but found ${typeof u} instead.`,l);if(/[^a-zA-Z0-9_]/.test(u))return i.error("Variable names must contain only alphanumeric characters or '_'.",l);const d=i.parse(e[l+1],l+1);if(!d)return null;s.push([u,d])}const o=i.parse(e[e.length-1],e.length-1,i.expectedType,s);return o?new ot(s,o):null}outputDefined(){return this.result.outputDefined()}}class Un{constructor(e,i){this.type=i.type,this.name=e,this.boundExpression=i}static parse(e,i){if(e.length!==2||typeof e[1]!="string")return i.error("'var' expression requires exactly one string literal argument.");const s=e[1];return i.scope.has(s)?new Un(s,i.scope.get(s)):i.error(`Unknown variable "${s}". Make sure "${s}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}}class Ze{constructor(e,i,s){this.type=e,this.index=i,this.input=s}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const s=i.parse(e[1],1,be),o=i.parse(e[2],2,Wt(i.expectedType||Be));return s&&o?new Ze(o.type.itemType,s,o):null}evaluate(e){const i=this.index.evaluate(e),s=this.input.evaluate(e);if(i<0)throw new st(`Array index out of bounds: ${i} < 0.`);if(i>=s.length)throw new st(`Array index out of bounds: ${i} > ${s.length-1}.`);if(i!==Math.floor(i))throw new st(`Array index must be an integer, but found ${i} instead.`);return s[i]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class Oe{constructor(e,i){this.type=je,this.needle=e,this.haystack=i}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const s=i.parse(e[1],1,Be),o=i.parse(e[2],2,Be);return s&&o?Ss(s.type,[je,Fe,be,Cr,Be])?new Oe(s,o):i.error(`Expected first argument to be of type boolean, string, number or null, but found ${tt(s.type)} instead`):null}evaluate(e){const i=this.needle.evaluate(e),s=this.haystack.evaluate(e);if(!s)return!1;if(!nn(i,["boolean","string","number","null"]))throw new st(`Expected first argument to be of type boolean, string, number or null, but found ${tt(Tt(i))} instead.`);if(!nn(s,["string","array"]))throw new st(`Expected second argument to be of type array or string, but found ${tt(Tt(s))} instead.`);return s.indexOf(i)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class Gn{constructor(e,i,s){this.type=be,this.needle=e,this.haystack=i,this.fromIndex=s}static parse(e,i){if(e.length<=2||e.length>=5)return i.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);const s=i.parse(e[1],1,Be),o=i.parse(e[2],2,Be);if(!s||!o)return null;if(!Ss(s.type,[je,Fe,be,Cr,Be]))return i.error(`Expected first argument to be of type boolean, string, number or null, but found ${tt(s.type)} instead`);if(e.length===4){const l=i.parse(e[3],3,be);return l?new Gn(s,o,l):null}return new Gn(s,o)}evaluate(e){const i=this.needle.evaluate(e),s=this.haystack.evaluate(e);if(!nn(i,["boolean","string","number","null"]))throw new st(`Expected first argument to be of type boolean, string, number or null, but found ${tt(Tt(i))} instead.`);let o;if(this.fromIndex&&(o=this.fromIndex.evaluate(e)),nn(s,["string"])){const l=s.indexOf(i,o);return l===-1?-1:[...s.slice(0,l)].length}if(nn(s,["array"]))return s.indexOf(i,o);throw new st(`Expected second argument to be of type array or string, but found ${tt(Tt(s))} instead.`)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class We{constructor(e,i,s,o,l,u){this.inputType=e,this.type=i,this.input=s,this.cases=o,this.outputs=l,this.otherwise=u}static parse(e,i){if(e.length<5)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return i.error("Expected an even number of arguments.");let s,o;i.expectedType&&i.expectedType.kind!=="value"&&(o=i.expectedType);const l={},u=[];for(let m=2;m<e.length-1;m+=2){let v=e[m];const _=e[m+1];Array.isArray(v)||(v=[v]);const T=i.concat(m);if(v.length===0)return T.error("Expected at least one branch label.");for(const I of v){if(typeof I!="number"&&typeof I!="string")return T.error("Branch labels must be numbers or strings.");if(typeof I=="number"&&Math.abs(I)>Number.MAX_SAFE_INTEGER)return T.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof I=="number"&&Math.floor(I)!==I)return T.error("Numeric branch labels must be integer values.");if(s){if(T.checkSubtype(s,Tt(I)))return null}else s=Tt(I);if(l[String(I)]!==void 0)return T.error("Branch labels must be unique.");l[String(I)]=u.length}const b=i.parse(_,m,o);if(!b)return null;o=o||b.type,u.push(b)}const d=i.parse(e[1],1,Be);if(!d)return null;const g=i.parse(e[e.length-1],e.length-1,o);return g?d.type.kind!=="value"&&i.concat(1).checkSubtype(s,d.type)?null:new We(s,o,d,l,u,g):null}evaluate(e){const i=this.input.evaluate(e);return(Tt(i)===this.inputType&&this.outputs[this.cases[i]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))&&this.otherwise.outputDefined()}}class Hi{constructor(e,i,s){this.type=e,this.branches=i,this.otherwise=s}static parse(e,i){if(e.length<4)return i.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return i.error("Expected an odd number of arguments.");let s;i.expectedType&&i.expectedType.kind!=="value"&&(s=i.expectedType);const o=[];for(let u=1;u<e.length-1;u+=2){const d=i.parse(e[u],u,je);if(!d)return null;const g=i.parse(e[u+1],u+1,s);if(!g)return null;o.push([d,g]),s=s||g.type}const l=i.parse(e[e.length-1],e.length-1,s);if(!l)return null;if(!s)throw new Error("Can't infer output type");return new Hi(s,o,l)}evaluate(e){for(const[i,s]of this.branches)if(i.evaluate(e))return s.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[i,s]of this.branches)e(i),e(s);e(this.otherwise)}outputDefined(){return this.branches.every((([e,i])=>i.outputDefined()))&&this.otherwise.outputDefined()}}class $n{constructor(e,i,s,o){this.type=e,this.input=i,this.beginIndex=s,this.endIndex=o}static parse(e,i){if(e.length<=2||e.length>=5)return i.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);const s=i.parse(e[1],1,Be),o=i.parse(e[2],2,be);if(!s||!o)return null;if(!Ss(s.type,[Wt(Be),Fe,Be]))return i.error(`Expected first argument to be of type array or string, but found ${tt(s.type)} instead`);if(e.length===4){const l=i.parse(e[3],3,be);return l?new $n(s.type,s,o,l):null}return new $n(s.type,s,o)}evaluate(e){const i=this.input.evaluate(e),s=this.beginIndex.evaluate(e);let o;if(this.endIndex&&(o=this.endIndex.evaluate(e)),nn(i,["string"]))return[...i].slice(s,o).join("");if(nn(i,["array"]))return i.slice(s,o);throw new st(`Expected first argument to be of type array or string, but found ${tt(Tt(i))} instead.`)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function cn(r,e){const i=r.length-1;let s,o,l=0,u=i,d=0;for(;l<=u;)if(d=Math.floor((l+u)/2),s=r[d],o=r[d+1],s<=e){if(d===i||e<o)return d;l=d+1}else{if(!(s>e))throw new st("Input is not a number.");u=d-1}return 0}class Zn{constructor(e,i,s){this.type=e,this.input=i,this.labels=[],this.outputs=[];for(const[o,l]of s)this.labels.push(o),this.outputs.push(l)}static parse(e,i){if(e.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return i.error("Expected an even number of arguments.");const s=i.parse(e[1],1,be);if(!s)return null;const o=[];let l=null;i.expectedType&&i.expectedType.kind!=="value"&&(l=i.expectedType);for(let u=1;u<e.length;u+=2){const d=u===1?-1/0:e[u],g=e[u+1],m=u,v=u+1;if(typeof d!="number")return i.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',m);if(o.length&&o[o.length-1][0]>=d)return i.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',m);const _=i.parse(g,v,l);if(!_)return null;l=l||_.type,o.push([d,_])}return new Zn(l,s,o)}evaluate(e){const i=this.labels,s=this.outputs;if(i.length===1)return s[0].evaluate(e);const o=this.input.evaluate(e);if(o<=i[0])return s[0].evaluate(e);const l=i.length;return o>=i[l-1]?s[l-1].evaluate(e):s[cn(i,o)].evaluate(e)}eachChild(e){e(this.input);for(const i of this.outputs)e(i)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}}function Xa(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var wo,mc,gc=(function(){if(mc)return wo;function r(e,i,s,o){this.cx=3*e,this.bx=3*(s-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*i,this.by=3*(o-i)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=i,this.p2x=s,this.p2y=o}return mc=1,wo=r,r.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,i){if(i===void 0&&(i=1e-6),e<0)return 0;if(e>1)return 1;for(var s=e,o=0;o<8;o++){var l=this.sampleCurveX(s)-e;if(Math.abs(l)<i)return s;var u=this.sampleCurveDerivativeX(s);if(Math.abs(u)<1e-6)break;s-=l/u}var d=0,g=1;for(s=e,o=0;o<20&&(l=this.sampleCurveX(s),!(Math.abs(l-e)<i));o++)e>l?d=s:g=s,s=.5*(g-d)+d;return s},solve:function(e,i){return this.sampleCurveY(this.solveCurveX(e,i))}},wo})(),_c=Xa(gc);class It{constructor(e,i,s,o,l){this.type=e,this.operator=i,this.interpolation=s,this.input=o,this.labels=[],this.outputs=[];for(const[u,d]of l)this.labels.push(u),this.outputs.push(d)}static interpolationFactor(e,i,s,o){let l=0;if(e.name==="exponential")l=Lt(i,e.base,s,o);else if(e.name==="linear")l=Lt(i,1,s,o);else if(e.name==="cubic-bezier"){const u=e.controlPoints;l=new _c(u[0],u[1],u[2],u[3]).solve(Lt(i,1,s,o))}return l}static parse(e,i){let[s,o,l,...u]=e;if(!Array.isArray(o)||o.length===0)return i.error("Expected an interpolation type expression.",1);if(o[0]==="linear")o={name:"linear"};else if(o[0]==="exponential"){const m=o[1];if(typeof m!="number")return i.error("Exponential interpolation requires a numeric base.",1,1);o={name:"exponential",base:m}}else{if(o[0]!=="cubic-bezier")return i.error(`Unknown interpolation type ${String(o[0])}`,1,0);{const m=o.slice(1);if(m.length!==4||m.some((v=>typeof v!="number"||v<0||v>1)))return i.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);o={name:"cubic-bezier",controlPoints:m}}}if(e.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return i.error("Expected an even number of arguments.");if(l=i.parse(l,2,be),!l)return null;const d=[];let g=null;s!=="interpolate-hcl"&&s!=="interpolate-lab"||i.expectedType==Ln?i.expectedType&&i.expectedType.kind!=="value"&&(g=i.expectedType):g=Pi;for(let m=0;m<u.length;m+=2){const v=u[m],_=u[m+1],T=m+3,b=m+4;if(typeof v!="number")return i.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',T);if(d.length&&d[d.length-1][0]>=v)return i.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',T);const I=i.parse(_,b,g);if(!I)return null;g=g||I.type,d.push([v,I])}return Wi(g,be)||Wi(g,mo)||Wi(g,Pi)||Wi(g,go)||Wi(g,ws)||Wi(g,Ln)||Wi(g,Ts)||Wi(g,Wt(be))?new It(g,s,o,l,d):i.error(`Type ${tt(g)} is not interpolatable.`)}evaluate(e){const i=this.labels,s=this.outputs;if(i.length===1)return s[0].evaluate(e);const o=this.input.evaluate(e);if(o<=i[0])return s[0].evaluate(e);const l=i.length;if(o>=i[l-1])return s[l-1].evaluate(e);const u=cn(i,o),d=It.interpolationFactor(this.interpolation,o,i[u],i[u+1]),g=s[u].evaluate(e),m=s[u+1].evaluate(e);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return Ar(g,m,d);case"color":return Ve.interpolate(g,m,d);case"padding":return Kt.interpolate(g,m,d);case"colorArray":return Re.interpolate(g,m,d);case"numberArray":return dt.interpolate(g,m,d);case"variableAnchorOffsetCollection":return oi.interpolate(g,m,d);case"array":return jn(g,m,d);case"projectionDefinition":return ai.interpolate(g,m,d)}case"interpolate-hcl":switch(this.type.kind){case"color":return Ve.interpolate(g,m,d,"hcl");case"colorArray":return Re.interpolate(g,m,d,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return Ve.interpolate(g,m,d,"lab");case"colorArray":return Re.interpolate(g,m,d,"lab")}}}eachChild(e){e(this.input);for(const i of this.outputs)e(i)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}}function Lt(r,e,i,s){const o=s-i,l=r-i;return o===0?0:e===1?l/o:(Math.pow(e,l)-1)/(Math.pow(e,o)-1)}const Mi={color:Ve.interpolate,number:Ar,padding:Kt.interpolate,numberArray:dt.interpolate,colorArray:Re.interpolate,variableAnchorOffsetCollection:oi.interpolate,array:jn};class Es{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");let s=null;const o=i.expectedType;o&&o.kind!=="value"&&(s=o);const l=[];for(const d of e.slice(1)){const g=i.parse(d,1+l.length,s,void 0,{typeAnnotation:"omit"});if(!g)return null;s=s||g.type,l.push(g)}if(!s)throw new Error("No output type");const u=o&&l.some((d=>On(o,d.type)));return new Es(u?Be:s,l)}evaluate(e){let i,s=null,o=0;for(const l of this.args)if(o++,s=l.evaluate(e),s&&s instanceof Ii&&!s.available&&(i||(i=s.name),s=null,o===this.args.length&&(s=i)),s!==null)break;return s}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}function Cs(r,e){return r==="=="||r==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function kt(r,e,i,s){return s.compare(e,i)===0}function un(r,e,i){const s=r!=="=="&&r!=="!=";return class Nf{constructor(l,u,d){this.type=je,this.lhs=l,this.rhs=u,this.collator=d,this.hasUntypedArgument=l.type.kind==="value"||u.type.kind==="value"}static parse(l,u){if(l.length!==3&&l.length!==4)return u.error("Expected two or three arguments.");const d=l[0];let g=u.parse(l[1],1,Be);if(!g)return null;if(!Cs(d,g.type))return u.concat(1).error(`"${d}" comparisons are not supported for type '${tt(g.type)}'.`);let m=u.parse(l[2],2,Be);if(!m)return null;if(!Cs(d,m.type))return u.concat(2).error(`"${d}" comparisons are not supported for type '${tt(m.type)}'.`);if(g.type.kind!==m.type.kind&&g.type.kind!=="value"&&m.type.kind!=="value")return u.error(`Cannot compare types '${tt(g.type)}' and '${tt(m.type)}'.`);s&&(g.type.kind==="value"&&m.type.kind!=="value"?g=new yi(m.type,[g]):g.type.kind!=="value"&&m.type.kind==="value"&&(m=new yi(g.type,[m])));let v=null;if(l.length===4){if(g.type.kind!=="string"&&m.type.kind!=="string"&&g.type.kind!=="value"&&m.type.kind!=="value")return u.error("Cannot use collator to compare non-string types.");if(v=u.parse(l[3],3,xs),!v)return null}return new Nf(g,m,v)}evaluate(l){const u=this.lhs.evaluate(l),d=this.rhs.evaluate(l);if(s&&this.hasUntypedArgument){const g=Tt(u),m=Tt(d);if(g.kind!==m.kind||g.kind!=="string"&&g.kind!=="number")throw new st(`Expected arguments for "${r}" to be (string, string) or (number, number), but found (${g.kind}, ${m.kind}) instead.`)}if(this.collator&&!s&&this.hasUntypedArgument){const g=Tt(u),m=Tt(d);if(g.kind!=="string"||m.kind!=="string")return e(l,u,d)}return this.collator?i(l,u,d,this.collator.evaluate(l)):e(l,u,d)}eachChild(l){l(this.lhs),l(this.rhs),this.collator&&l(this.collator)}outputDefined(){return!0}}}const Ya=un("==",(function(r,e,i){return e===i}),kt),yc=un("!=",(function(r,e,i){return e!==i}),(function(r,e,i,s){return!kt(0,e,i,s)})),Ou=un("<",(function(r,e,i){return e<i}),(function(r,e,i,s){return s.compare(e,i)<0})),qn=un(">",(function(r,e,i){return e>i}),(function(r,e,i,s){return s.compare(e,i)>0})),To=un("<=",(function(r,e,i){return e<=i}),(function(r,e,i,s){return s.compare(e,i)<=0})),Ka=un(">=",(function(r,e,i){return e>=i}),(function(r,e,i,s){return s.compare(e,i)>=0}));class So{constructor(e,i,s){this.type=xs,this.locale=s,this.caseSensitive=e,this.diacriticSensitive=i}static parse(e,i){if(e.length!==2)return i.error("Expected one argument.");const s=e[1];if(typeof s!="object"||Array.isArray(s))return i.error("Collator options argument must be an object.");const o=i.parse(s["case-sensitive"]!==void 0&&s["case-sensitive"],1,je);if(!o)return null;const l=i.parse(s["diacritic-sensitive"]!==void 0&&s["diacritic-sensitive"],1,je);if(!l)return null;let u=null;return s.locale&&(u=i.parse(s.locale,1,Fe),!u)?null:new So(o,l,u)}evaluate(e){return new qa(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}}class Po{constructor(e,i,s,o,l,u){this.type=Fe,this.number=e,this.locale=i,this.currency=s,this.unit=o,this.minFractionDigits=l,this.maxFractionDigits=u}static parse(e,i){if(e.length!==3)return i.error("Expected two arguments.");const s=i.parse(e[1],1,be);if(!s)return null;const o=e[2];if(typeof o!="object"||Array.isArray(o))return i.error("NumberFormat options argument must be an object.");let l=null;if(o.locale&&(l=i.parse(o.locale,1,Fe),!l))return null;let u=null;if(o.currency&&(u=i.parse(o.currency,1,Fe),!u))return null;let d=null;if(o.unit&&(d=i.parse(o.unit,1,Fe),!d))return null;if(u&&d)return i.error("NumberFormat options `currency` and `unit` are mutually exclusive");let g=null;if(o["min-fraction-digits"]&&(g=i.parse(o["min-fraction-digits"],1,be),!g))return null;let m=null;return o["max-fraction-digits"]&&(m=i.parse(o["max-fraction-digits"],1,be),!m)?null:new Po(s,l,u,d,g,m)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":this.unit?"unit":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,unit:this.unit?this.unit.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.unit&&e(this.unit),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}}class hn{constructor(e){this.type=bs,this.sections=e}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");const s=e[1];if(!Array.isArray(s)&&typeof s=="object")return i.error("First argument must be an image or text section.");const o=[];let l=!1;for(let u=1;u<=e.length-1;++u){const d=e[u];if(l&&typeof d=="object"&&!Array.isArray(d)){l=!1;let g=null;if(d["font-scale"]&&(g=i.parse(d["font-scale"],1,be),!g))return null;let m=null;if(d["text-font"]&&(m=i.parse(d["text-font"],1,Wt(Fe)),!m))return null;let v=null;if(d["text-color"]&&(v=i.parse(d["text-color"],1,Pi),!v))return null;let _=null;if(d["vertical-align"]){if(typeof d["vertical-align"]=="string"&&!Bu.includes(d["vertical-align"]))return i.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${d["vertical-align"]}' instead.`);if(_=i.parse(d["vertical-align"],1,Fe),!_)return null}const T=o[o.length-1];T.scale=g,T.font=m,T.textColor=v,T.verticalAlign=_}else{const g=i.parse(e[u],1,Be);if(!g)return null;const m=g.type.kind;if(m!=="string"&&m!=="value"&&m!=="null"&&m!=="resolvedImage")return i.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");l=!0,o.push({content:g,scale:null,font:null,textColor:null,verticalAlign:null})}}return new hn(o)}evaluate(e){return new _i(this.sections.map((i=>{const s=i.content.evaluate(e);return Tt(s)===Bn?new Wa("",s,null,null,null,i.verticalAlign?i.verticalAlign.evaluate(e):null):new Wa(on(s),null,i.scale?i.scale.evaluate(e):null,i.font?i.font.evaluate(e).join(","):null,i.textColor?i.textColor.evaluate(e):null,i.verticalAlign?i.verticalAlign.evaluate(e):null)})))}eachChild(e){for(const i of this.sections)e(i.content),i.scale&&e(i.scale),i.font&&e(i.font),i.textColor&&e(i.textColor),i.verticalAlign&&e(i.verticalAlign)}outputDefined(){return!1}}class Wn{constructor(e){this.type=Bn,this.input=e}static parse(e,i){if(e.length!==2)return i.error("Expected two arguments.");const s=i.parse(e[1],1,Fe);return s?new Wn(s):i.error("No image name provided.")}evaluate(e){const i=this.input.evaluate(e),s=Ii.fromString(i);return s&&e.availableImages&&(s.available=e.availableImages.indexOf(i)>-1),s}eachChild(e){e(this.input)}outputDefined(){return!1}}class Ei{constructor(e){this.type=be,this.input=e}static parse(e,i){if(e.length!==2)return i.error(`Expected 1 argument, but found ${e.length-1} instead.`);const s=i.parse(e[1],1);return s?s.type.kind!=="array"&&s.type.kind!=="string"&&s.type.kind!=="value"?i.error(`Expected argument of type string or array, but found ${tt(s.type)} instead.`):new Ei(s):null}evaluate(e){const i=this.input.evaluate(e);if(typeof i=="string")return[...i].length;if(Array.isArray(i))return i.length;throw new st(`Expected value to be of type string or array, but found ${tt(Tt(i))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const Xi=8192;function Io(r,e){const i=(180+r[0])/360,s=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r[1]*Math.PI/360)))/360,o=Math.pow(2,e.z);return[Math.round(i*o*Xi),Math.round(s*o*Xi)]}function Ja(r,e){const i=Math.pow(2,e.z);return[(o=(r[0]/Xi+e.x)/i,360*o-180),(s=(r[1]/Xi+e.y)/i,360/Math.PI*Math.atan(Math.exp((180-360*s)*Math.PI/180))-90)];var s,o}function dn(r,e){r[0]=Math.min(r[0],e[0]),r[1]=Math.min(r[1],e[1]),r[2]=Math.max(r[2],e[0]),r[3]=Math.max(r[3],e[1])}function As(r,e){return!(r[0]<=e[0]||r[2]>=e[2]||r[1]<=e[1]||r[3]>=e[3])}function Vu(r,e,i){const s=r[0]-e[0],o=r[1]-e[1],l=r[0]-i[0],u=r[1]-i[1];return s*u-l*o==0&&s*l<=0&&o*u<=0}function Mo(r,e,i,s){return(o=[s[0]-i[0],s[1]-i[1]])[0]*(l=[e[0]-r[0],e[1]-r[1]])[1]-o[1]*l[0]!=0&&!(!xc(r,e,i,s)||!xc(i,s,r,e));var o,l}function ju(r,e,i){for(const s of i)for(let o=0;o<s.length-1;++o)if(Mo(r,e,s[o],s[o+1]))return!0;return!1}function ur(r,e,i=!1){let s=!1;for(const d of e)for(let g=0;g<d.length-1;g++){if(Vu(r,d[g],d[g+1]))return i;(l=d[g])[1]>(o=r)[1]!=(u=d[g+1])[1]>o[1]&&o[0]<(u[0]-l[0])*(o[1]-l[1])/(u[1]-l[1])+l[0]&&(s=!s)}var o,l,u;return s}function Nu(r,e){for(const i of e)if(ur(r,i))return!0;return!1}function Qa(r,e){for(const i of r)if(!ur(i,e))return!1;for(let i=0;i<r.length-1;++i)if(ju(r[i],r[i+1],e))return!1;return!0}function vc(r,e){for(const i of e)if(Qa(r,i))return!0;return!1}function xc(r,e,i,s){const o=s[0]-i[0],l=s[1]-i[1],u=(r[0]-i[0])*l-o*(r[1]-i[1]),d=(e[0]-i[0])*l-o*(e[1]-i[1]);return u>0&&d<0||u<0&&d>0}function Eo(r,e,i){const s=[];for(let o=0;o<r.length;o++){const l=[];for(let u=0;u<r[o].length;u++){const d=Io(r[o][u],i);dn(e,d),l.push(d)}s.push(l)}return s}function bc(r,e,i){const s=[];for(let o=0;o<r.length;o++){const l=Eo(r[o],e,i);s.push(l)}return s}function wc(r,e,i,s){if(r[0]<i[0]||r[0]>i[2]){const o=.5*s;let l=r[0]-i[0]>o?-s:i[0]-r[0]>o?s:0;l===0&&(l=r[0]-i[2]>o?-s:i[2]-r[0]>o?s:0),r[0]+=l}dn(e,r)}function Tc(r,e,i,s){const o=Math.pow(2,s.z)*Xi,l=[s.x*Xi,s.y*Xi],u=[];for(const d of r)for(const g of d){const m=[g.x+l[0],g.y+l[1]];wc(m,e,i,o),u.push(m)}return u}function Sc(r,e,i,s){const o=Math.pow(2,s.z)*Xi,l=[s.x*Xi,s.y*Xi],u=[];for(const g of r){const m=[];for(const v of g){const _=[v.x+l[0],v.y+l[1]];dn(e,_),m.push(_)}u.push(m)}if(e[2]-e[0]<=o/2){(d=e)[0]=d[1]=1/0,d[2]=d[3]=-1/0;for(const g of u)for(const m of g)wc(m,e,i,o)}var d;return u}class pn{constructor(e,i){this.type=je,this.geojson=e,this.geometries=i}static parse(e,i){if(e.length!==2)return i.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(zr(e[1])){const s=e[1];if(s.type==="FeatureCollection"){const o=[];for(const l of s.features){const{type:u,coordinates:d}=l.geometry;u==="Polygon"&&o.push(d),u==="MultiPolygon"&&o.push(...d)}if(o.length)return new pn(s,{type:"MultiPolygon",coordinates:o})}else if(s.type==="Feature"){const o=s.geometry.type;if(o==="Polygon"||o==="MultiPolygon")return new pn(s,s.geometry)}else if(s.type==="Polygon"||s.type==="MultiPolygon")return new pn(s,s)}return i.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return(function(i,s){const o=[1/0,1/0,-1/0,-1/0],l=[1/0,1/0,-1/0,-1/0],u=i.canonicalID();if(s.type==="Polygon"){const d=Eo(s.coordinates,l,u),g=Tc(i.geometry(),o,l,u);if(!As(o,l))return!1;for(const m of g)if(!ur(m,d))return!1}if(s.type==="MultiPolygon"){const d=bc(s.coordinates,l,u),g=Tc(i.geometry(),o,l,u);if(!As(o,l))return!1;for(const m of g)if(!Nu(m,d))return!1}return!0})(e,this.geometries);if(e.geometryType()==="LineString")return(function(i,s){const o=[1/0,1/0,-1/0,-1/0],l=[1/0,1/0,-1/0,-1/0],u=i.canonicalID();if(s.type==="Polygon"){const d=Eo(s.coordinates,l,u),g=Sc(i.geometry(),o,l,u);if(!As(o,l))return!1;for(const m of g)if(!Qa(m,d))return!1}if(s.type==="MultiPolygon"){const d=bc(s.coordinates,l,u),g=Sc(i.geometry(),o,l,u);if(!As(o,l))return!1;for(const m of g)if(!vc(m,d))return!1}return!0})(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let el=class{constructor(r=[],e=(i,s)=>i<s?-1:i>s?1:0){if(this.data=r,this.length=this.data.length,this.compare=e,this.length>0)for(let i=(this.length>>1)-1;i>=0;i--)this._down(i)}push(r){this.data.push(r),this._up(this.length++)}pop(){if(this.length===0)return;const r=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),r}peek(){return this.data[0]}_up(r){const{data:e,compare:i}=this,s=e[r];for(;r>0;){const o=r-1>>1,l=e[o];if(i(s,l)>=0)break;e[r]=l,r=o}e[r]=s}_down(r){const{data:e,compare:i}=this,s=this.length>>1,o=e[r];for(;r<s;){let l=1+(r<<1);const u=l+1;if(u<this.length&&i(e[u],e[l])<0&&(l=u),i(e[l],o)>=0)break;e[r]=e[l],r=l}e[r]=o}};function tl(r,e,i=0,s=r.length-1,o=Uu){for(;s>i;){if(s-i>600){const g=s-i+1,m=e-i+1,v=Math.log(g),_=.5*Math.exp(2*v/3),T=.5*Math.sqrt(v*_*(g-_)/g)*(m-g/2<0?-1:1);tl(r,e,Math.max(i,Math.floor(e-m*_/g+T)),Math.min(s,Math.floor(e+(g-m)*_/g+T)),o)}const l=r[e];let u=i,d=s;for(Hn(r,i,e),o(r[s],l)>0&&Hn(r,i,s);u<d;){for(Hn(r,u,d),u++,d--;o(r[u],l)<0;)u++;for(;o(r[d],l)>0;)d--}o(r[i],l)===0?Hn(r,i,d):(d++,Hn(r,d,s)),d<=e&&(i=d+1),e<=d&&(s=d-1)}}function Hn(r,e,i){const s=r[e];r[e]=r[i],r[i]=s}function Uu(r,e){return r<e?-1:r>e?1:0}function Co(r,e){if(r.length<=1)return[r];const i=[];let s,o;for(const l of r){const u=$u(l);u!==0&&(l.area=Math.abs(u),o===void 0&&(o=u<0),o===u<0?(s&&i.push(s),s=[l]):s.push(l))}if(s&&i.push(s),e>1)for(let l=0;l<i.length;l++)i[l].length<=e||(tl(i[l],e,1,i[l].length-1,Gu),i[l]=i[l].slice(0,e));return i}function Gu(r,e){return e.area-r.area}function $u(r){let e=0;for(let i,s,o=0,l=r.length,u=l-1;o<l;u=o++)i=r[o],s=r[u],e+=(s.x-i.x)*(i.y+s.y);return e}const Ds=1/298.257223563,Pc=Ds*(2-Ds),Ic=Math.PI/180;class il{constructor(e){const i=6378.137*Ic*1e3,s=Math.cos(e*Ic),o=1/(1-Pc*(1-s*s)),l=Math.sqrt(o);this.kx=i*l*s,this.ky=i*l*o*(1-Pc)}distance(e,i){const s=this.wrap(e[0]-i[0])*this.kx,o=(e[1]-i[1])*this.ky;return Math.sqrt(s*s+o*o)}pointOnLine(e,i){let s,o,l,u,d=1/0;for(let g=0;g<e.length-1;g++){let m=e[g][0],v=e[g][1],_=this.wrap(e[g+1][0]-m)*this.kx,T=(e[g+1][1]-v)*this.ky,b=0;_===0&&T===0||(b=(this.wrap(i[0]-m)*this.kx*_+(i[1]-v)*this.ky*T)/(_*_+T*T),b>1?(m=e[g+1][0],v=e[g+1][1]):b>0&&(m+=_/this.kx*b,v+=T/this.ky*b)),_=this.wrap(i[0]-m)*this.kx,T=(i[1]-v)*this.ky;const I=_*_+T*T;I<d&&(d=I,s=m,o=v,l=g,u=b)}return{point:[s,o],index:l,t:Math.max(0,Math.min(1,u))}}wrap(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}}function Mc(r,e){return e[0]-r[0]}function Xn(r){return r[1]-r[0]+1}function tr(r,e){return r[1]>=r[0]&&r[1]<e}function rl(r,e){if(r[0]>r[1])return[null,null];const i=Xn(r);if(e){if(i===2)return[r,null];const o=Math.floor(i/2);return[[r[0],r[0]+o],[r[0]+o,r[1]]]}if(i===1)return[r,null];const s=Math.floor(i/2)-1;return[[r[0],r[0]+s],[r[0]+s+1,r[1]]]}function nl(r,e){if(!tr(e,r.length))return[1/0,1/0,-1/0,-1/0];const i=[1/0,1/0,-1/0,-1/0];for(let s=e[0];s<=e[1];++s)dn(i,r[s]);return i}function Ao(r){const e=[1/0,1/0,-1/0,-1/0];for(const i of r)for(const s of i)dn(e,s);return e}function sl(r){return r[0]!==-1/0&&r[1]!==-1/0&&r[2]!==1/0&&r[3]!==1/0}function ol(r,e,i){if(!sl(r)||!sl(e))return NaN;let s=0,o=0;return r[2]<e[0]&&(s=e[0]-r[2]),r[0]>e[2]&&(s=r[0]-e[2]),r[1]>e[3]&&(o=r[1]-e[3]),r[3]<e[1]&&(o=e[1]-r[3]),i.distance([0,0],[s,o])}function fn(r,e,i){const s=i.pointOnLine(e,r);return i.distance(r,s.point)}function al(r,e,i,s,o){const l=Math.min(fn(r,[i,s],o),fn(e,[i,s],o)),u=Math.min(fn(i,[r,e],o),fn(s,[r,e],o));return Math.min(l,u)}function Ec(r,e,i,s,o){if(!tr(e,r.length)||!tr(s,i.length))return 1/0;let l=1/0;for(let u=e[0];u<e[1];++u){const d=r[u],g=r[u+1];for(let m=s[0];m<s[1];++m){const v=i[m],_=i[m+1];if(Mo(d,g,v,_))return 0;l=Math.min(l,al(d,g,v,_,o))}}return l}function Zu(r,e,i,s,o){if(!tr(e,r.length)||!tr(s,i.length))return NaN;let l=1/0;for(let u=e[0];u<=e[1];++u)for(let d=s[0];d<=s[1];++d)if(l=Math.min(l,o.distance(r[u],i[d])),l===0)return l;return l}function qu(r,e,i){if(ur(r,e,!0))return 0;let s=1/0;for(const o of e){const l=o[0],u=o[o.length-1];if(l!==u&&(s=Math.min(s,fn(r,[u,l],i)),s===0))return s;const d=i.pointOnLine(o,r);if(s=Math.min(s,i.distance(r,d.point)),s===0)return s}return s}function Wu(r,e,i,s){if(!tr(e,r.length))return NaN;for(let l=e[0];l<=e[1];++l)if(ur(r[l],i,!0))return 0;let o=1/0;for(let l=e[0];l<e[1];++l){const u=r[l],d=r[l+1];for(const g of i)for(let m=0,v=g.length,_=v-1;m<v;_=m++){const T=g[_],b=g[m];if(Mo(u,d,T,b))return 0;o=Math.min(o,al(u,d,T,b,s))}}return o}function Cc(r,e){for(const i of r)for(const s of i)if(ur(s,e,!0))return!0;return!1}function Je(r,e,i,s=1/0){const o=Ao(r),l=Ao(e);if(s!==1/0&&ol(o,l,i)>=s)return s;if(As(o,l)){if(Cc(r,e))return 0}else if(Cc(e,r))return 0;let u=1/0;for(const d of r)for(let g=0,m=d.length,v=m-1;g<m;v=g++){const _=d[v],T=d[g];for(const b of e)for(let I=0,M=b.length,A=M-1;I<M;A=I++){const D=b[A],F=b[I];if(Mo(_,T,D,F))return 0;u=Math.min(u,al(_,T,D,F,i))}}return u}function Ac(r,e,i,s,o,l){if(!l)return;const u=ol(nl(s,l),o,i);u<e&&r.push([u,l,[0,0]])}function Do(r,e,i,s,o,l,u){if(!l||!u)return;const d=ol(nl(s,l),nl(o,u),i);d<e&&r.push([d,l,u])}function zo(r,e,i,s,o=1/0){let l=Math.min(s.distance(r[0],i[0][0]),o);if(l===0)return l;const u=new el([[0,[0,r.length-1],[0,0]]],Mc),d=Ao(i);for(;u.length>0;){const g=u.pop();if(g[0]>=l)continue;const m=g[1],v=e?50:100;if(Xn(m)<=v){if(!tr(m,r.length))return NaN;if(e){const _=Wu(r,m,i,s);if(isNaN(_)||_===0)return _;l=Math.min(l,_)}else for(let _=m[0];_<=m[1];++_){const T=qu(r[_],i,s);if(l=Math.min(l,T),l===0)return 0}}else{const _=rl(m,e);Ac(u,l,s,r,d,_[0]),Ac(u,l,s,r,d,_[1])}}return l}function ko(r,e,i,s,o,l=1/0){let u=Math.min(l,o.distance(r[0],i[0]));if(u===0)return u;const d=new el([[0,[0,r.length-1],[0,i.length-1]]],Mc);for(;d.length>0;){const g=d.pop();if(g[0]>=u)continue;const m=g[1],v=g[2],_=e?50:100,T=s?50:100;if(Xn(m)<=_&&Xn(v)<=T){if(!tr(m,r.length)&&tr(v,i.length))return NaN;let b;if(e&&s)b=Ec(r,m,i,v,o),u=Math.min(u,b);else if(e&&!s){const I=r.slice(m[0],m[1]+1);for(let M=v[0];M<=v[1];++M)if(b=fn(i[M],I,o),u=Math.min(u,b),u===0)return u}else if(!e&&s){const I=i.slice(v[0],v[1]+1);for(let M=m[0];M<=m[1];++M)if(b=fn(r[M],I,o),u=Math.min(u,b),u===0)return u}else b=Zu(r,m,i,v,o),u=Math.min(u,b)}else{const b=rl(m,e),I=rl(v,s);Do(d,u,o,r,i,b[0],I[0]),Do(d,u,o,r,i,b[0],I[1]),Do(d,u,o,r,i,b[1],I[0]),Do(d,u,o,r,i,b[1],I[1])}}return u}function ll(r){return r.type==="MultiPolygon"?r.coordinates.map((e=>({type:"Polygon",coordinates:e}))):r.type==="MultiLineString"?r.coordinates.map((e=>({type:"LineString",coordinates:e}))):r.type==="MultiPoint"?r.coordinates.map((e=>({type:"Point",coordinates:e}))):[r]}class mn{constructor(e,i){this.type=be,this.geojson=e,this.geometries=i}static parse(e,i){if(e.length!==2)return i.error(`'distance' expression requires exactly one argument, but found ${e.length-1} instead.`);if(zr(e[1])){const s=e[1];if(s.type==="FeatureCollection")return new mn(s,s.features.map((o=>ll(o.geometry))).flat());if(s.type==="Feature")return new mn(s,ll(s.geometry));if("type"in s&&"coordinates"in s)return new mn(s,ll(s))}return i.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return(function(i,s){const o=i.geometry(),l=o.flat().map((g=>Ja([g.x,g.y],i.canonical)));if(o.length===0)return NaN;const u=new il(l[0][1]);let d=1/0;for(const g of s){switch(g.type){case"Point":d=Math.min(d,ko(l,!1,[g.coordinates],!1,u,d));break;case"LineString":d=Math.min(d,ko(l,!1,g.coordinates,!0,u,d));break;case"Polygon":d=Math.min(d,zo(l,!1,g.coordinates,u,d))}if(d===0)return d}return d})(e,this.geometries);if(e.geometryType()==="LineString")return(function(i,s){const o=i.geometry(),l=o.flat().map((g=>Ja([g.x,g.y],i.canonical)));if(o.length===0)return NaN;const u=new il(l[0][1]);let d=1/0;for(const g of s){switch(g.type){case"Point":d=Math.min(d,ko(l,!0,[g.coordinates],!1,u,d));break;case"LineString":d=Math.min(d,ko(l,!0,g.coordinates,!0,u,d));break;case"Polygon":d=Math.min(d,zo(l,!0,g.coordinates,u,d))}if(d===0)return d}return d})(e,this.geometries);if(e.geometryType()==="Polygon")return(function(i,s){const o=i.geometry();if(o.length===0||o[0].length===0)return NaN;const l=Co(o,0).map((g=>g.map((m=>m.map((v=>Ja([v.x,v.y],i.canonical))))))),u=new il(l[0][0][0][1]);let d=1/0;for(const g of s)for(const m of l){switch(g.type){case"Point":d=Math.min(d,zo([g.coordinates],!1,m,u,d));break;case"LineString":d=Math.min(d,zo(g.coordinates,!0,m,u,d));break;case"Polygon":d=Math.min(d,Je(m,g.coordinates,u,d))}if(d===0)return d}return d})(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}class zs{constructor(e){this.type=Be,this.key=e}static parse(e,i){if(e.length!==2)return i.error(`Expected 1 argument, but found ${e.length-1} instead.`);const s=e[1];return s==null?i.error("Global state property must be defined."):typeof s!="string"?i.error(`Global state property must be string, but found ${typeof e[1]} instead.`):new zs(s)}evaluate(e){var i;const s=(i=e.globals)===null||i===void 0?void 0:i.globalState;return s&&Object.keys(s).length!==0?Is(s,this.key):null}eachChild(){}outputDefined(){return!1}}const Yn={"==":Ya,"!=":yc,">":qn,"<":Ou,">=":Ka,"<=":To,array:yi,at:Ze,boolean:yi,case:Hi,coalesce:Es,collator:So,format:hn,image:Wn,in:Oe,"index-of":Gn,interpolate:It,"interpolate-hcl":It,"interpolate-lab":It,length:Ei,let:ot,literal:er,match:We,number:yi,"number-format":Po,object:yi,slice:$n,step:Zn,string:yi,"to-boolean":cr,"to-color":cr,"to-number":cr,"to-string":cr,var:Un,within:pn,distance:mn,"global-state":zs};class Bi{constructor(e,i,s,o){this.name=e,this.type=i,this._evaluate=s,this.args=o}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,i){const s=e[0],o=Bi.definitions[s];if(!o)return i.error(`Unknown expression "${s}". If you wanted a literal array, use ["literal", [...]].`,0);const l=Array.isArray(o)?o[0]:o.type,u=Array.isArray(o)?[[o[1],o[2]]]:o.overloads,d=u.filter((([m])=>!Array.isArray(m)||m.length===e.length-1));let g=null;for(const[m,v]of d){g=new ln(i.registry,Ro,i.path,null,i.scope);const _=[];let T=!1;for(let b=1;b<e.length;b++){const I=e[b],M=Array.isArray(m)?m[b-1]:m.type,A=g.parse(I,1+_.length,M);if(!A){T=!0;break}_.push(A)}if(!T)if(Array.isArray(m)&&m.length!==_.length)g.error(`Expected ${m.length} arguments, but found ${_.length} instead.`);else{for(let b=0;b<_.length;b++){const I=Array.isArray(m)?m[b]:m.type,M=_[b];g.concat(b+1).checkSubtype(I,M.type)}if(g.errors.length===0)return new Bi(s,l,v,_)}}if(d.length===1)i.errors.push(...g.errors);else{const m=(d.length?d:u).map((([_])=>{return T=_,Array.isArray(T)?`(${T.map(tt).join(", ")})`:`(${tt(T.type)}...)`;var T})).join(" | "),v=[];for(let _=1;_<e.length;_++){const T=i.parse(e[_],1+v.length);if(!T)return null;v.push(tt(T.type))}i.error(`Expected arguments of type ${m}, but found (${v.join(", ")}) instead.`)}return null}static register(e,i){Bi.definitions=i;for(const s in i)e[s]=Bi}}function Dc(r,[e,i,s,o]){e=e.evaluate(r),i=i.evaluate(r),s=s.evaluate(r);const l=o?o.evaluate(r):1,u=Nn(e,i,s,l);if(u)throw new st(u);return new Ve(e/255,i/255,s/255,l,!1)}function zc(r,e){return r in e}function cl(r,e){const i=e[r];return i===void 0?null:i}function gn(r){return{type:r}}function Ro(r){if(r instanceof Un)return Ro(r.boundExpression);if(r instanceof Bi&&r.name==="error"||r instanceof So||r instanceof pn||r instanceof mn||r instanceof zs)return!1;const e=r instanceof cr||r instanceof yi;let i=!0;return r.eachChild((s=>{i=e?i&&Ro(s):i&&s instanceof er})),!!i&&Fo(r)&&Lo(r,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"])}function Fo(r){if(r instanceof Bi&&(r.name==="get"&&r.args.length===1||r.name==="feature-state"||r.name==="has"&&r.args.length===1||r.name==="properties"||r.name==="geometry-type"||r.name==="id"||/^filter-/.test(r.name))||r instanceof pn||r instanceof mn)return!1;let e=!0;return r.eachChild((i=>{e&&!Fo(i)&&(e=!1)})),e}function ks(r){if(r instanceof Bi&&r.name==="feature-state")return!1;let e=!0;return r.eachChild((i=>{e&&!ks(i)&&(e=!1)})),e}function Lo(r,e){if(r instanceof Bi&&e.indexOf(r.name)>=0)return!1;let i=!0;return r.eachChild((s=>{i&&!Lo(s,e)&&(i=!1)})),i}function kc(r){return{result:"success",value:r}}function Kn(r){return{result:"error",value:r}}function Jn(r){return r["property-type"]==="data-driven"||r["property-type"]==="cross-faded-data-driven"}function Rc(r){return!!r.expression&&r.expression.parameters.indexOf("zoom")>-1}function ul(r){return!!r.expression&&r.expression.interpolated}function Ne(r){return r instanceof Number?"number":r instanceof String?"string":r instanceof Boolean?"boolean":Array.isArray(r)?"array":r===null?"null":typeof r}function Bo(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)&&Tt(r)===lr}function Hu(r){return r}function Fc(r,e){const i=r.stops&&typeof r.stops[0][0]=="object",s=i||!(i||r.property!==void 0),o=r.type||(ul(e)?"exponential":"interval"),l=(function(v){switch(v.type){case"color":return Ve.parse;case"padding":return Kt.parse;case"numberArray":return dt.parse;case"colorArray":return Re.parse;default:return null}})(e);if(l&&((r=rn({},r)).stops&&(r.stops=r.stops.map((v=>[v[0],l(v[1])]))),r.default=l(r.default?r.default:e.default)),r.colorSpace&&(u=r.colorSpace)!=="rgb"&&u!=="hcl"&&u!=="lab")throw new Error(`Unknown color space: "${r.colorSpace}"`);var u;const d=(function(v){switch(v){case"exponential":return Lc;case"interval":return Yu;case"categorical":return Xu;case"identity":return Ku;default:throw new Error(`Unknown function type "${v}"`)}})(o);let g,m;if(o==="categorical"){g=Object.create(null);for(const v of r.stops)g[v[0]]=v[1];m=typeof r.stops[0][0]}if(i){const v={},_=[];for(let I=0;I<r.stops.length;I++){const M=r.stops[I],A=M[0].zoom;v[A]===void 0&&(v[A]={zoom:A,type:r.type,property:r.property,default:r.default,stops:[]},_.push(A)),v[A].stops.push([M[0].value,M[1]])}const T=[];for(const I of _)T.push([v[I].zoom,Fc(v[I],e)]);const b={name:"linear"};return{kind:"composite",interpolationType:b,interpolationFactor:It.interpolationFactor.bind(void 0,b),zoomStops:T.map((I=>I[0])),evaluate:({zoom:I},M)=>Lc({stops:T,base:r.base},e,I).evaluate(I,M)}}if(s){const v=o==="exponential"?{name:"exponential",base:r.base!==void 0?r.base:1}:null;return{kind:"camera",interpolationType:v,interpolationFactor:It.interpolationFactor.bind(void 0,v),zoomStops:r.stops.map((_=>_[0])),evaluate:({zoom:_})=>d(r,e,_,g,m)}}return{kind:"source",evaluate(v,_){const T=_&&_.properties?_.properties[r.property]:void 0;return T===void 0?Rs(r.default,e.default):d(r,e,T,g,m)}}}function Rs(r,e,i){return r!==void 0?r:e!==void 0?e:i!==void 0?i:void 0}function Xu(r,e,i,s,o){return Rs(typeof i===o?s[i]:void 0,r.default,e.default)}function Yu(r,e,i){if(Ne(i)!=="number")return Rs(r.default,e.default);const s=r.stops.length;if(s===1||i<=r.stops[0][0])return r.stops[0][1];if(i>=r.stops[s-1][0])return r.stops[s-1][1];const o=cn(r.stops.map((l=>l[0])),i);return r.stops[o][1]}function Lc(r,e,i){const s=r.base!==void 0?r.base:1;if(Ne(i)!=="number")return Rs(r.default,e.default);const o=r.stops.length;if(o===1||i<=r.stops[0][0])return r.stops[0][1];if(i>=r.stops[o-1][0])return r.stops[o-1][1];const l=cn(r.stops.map((v=>v[0])),i),u=(function(v,_,T,b){const I=b-T,M=v-T;return I===0?0:_===1?M/I:(Math.pow(_,M)-1)/(Math.pow(_,I)-1)})(i,s,r.stops[l][0],r.stops[l+1][0]),d=r.stops[l][1],g=r.stops[l+1][1],m=Mi[e.type]||Hu;return typeof d.evaluate=="function"?{evaluate(...v){const _=d.evaluate.apply(void 0,v),T=g.evaluate.apply(void 0,v);if(_!==void 0&&T!==void 0)return m(_,T,u,r.colorSpace)}}:m(d,g,u,r.colorSpace)}function Ku(r,e,i){switch(e.type){case"color":i=Ve.parse(i);break;case"formatted":i=_i.fromString(i.toString());break;case"resolvedImage":i=Ii.fromString(i.toString());break;case"padding":i=Kt.parse(i);break;case"colorArray":i=Re.parse(i);break;case"numberArray":i=dt.parse(i);break;default:Ne(i)===e.type||e.type==="enum"&&e.values[i]||(i=void 0)}return Rs(i,r.default,e.default)}Bi.register(Yn,{error:[{kind:"error"},[Fe],(r,[e])=>{throw new st(e.evaluate(r))}],typeof:[Fe,[Be],(r,[e])=>tt(Tt(e.evaluate(r)))],"to-rgba":[Wt(be,4),[Pi],(r,[e])=>{const[i,s,o,l]=e.evaluate(r).rgb;return[255*i,255*s,255*o,l]}],rgb:[Pi,[be,be,be],Dc],rgba:[Pi,[be,be,be,be],Dc],has:{type:je,overloads:[[[Fe],(r,[e])=>zc(e.evaluate(r),r.properties())],[[Fe,lr],(r,[e,i])=>zc(e.evaluate(r),i.evaluate(r))]]},get:{type:Be,overloads:[[[Fe],(r,[e])=>cl(e.evaluate(r),r.properties())],[[Fe,lr],(r,[e,i])=>cl(e.evaluate(r),i.evaluate(r))]]},"feature-state":[Be,[Fe],(r,[e])=>cl(e.evaluate(r),r.featureState||{})],properties:[lr,[],r=>r.properties()],"geometry-type":[Fe,[],r=>r.geometryType()],id:[Be,[],r=>r.id()],zoom:[be,[],r=>r.globals.zoom],"heatmap-density":[be,[],r=>r.globals.heatmapDensity||0],elevation:[be,[],r=>r.globals.elevation||0],"line-progress":[be,[],r=>r.globals.lineProgress||0],accumulated:[Be,[],r=>r.globals.accumulated===void 0?null:r.globals.accumulated],"+":[be,gn(be),(r,e)=>{let i=0;for(const s of e)i+=s.evaluate(r);return i}],"*":[be,gn(be),(r,e)=>{let i=1;for(const s of e)i*=s.evaluate(r);return i}],"-":{type:be,overloads:[[[be,be],(r,[e,i])=>e.evaluate(r)-i.evaluate(r)],[[be],(r,[e])=>-e.evaluate(r)]]},"/":[be,[be,be],(r,[e,i])=>e.evaluate(r)/i.evaluate(r)],"%":[be,[be,be],(r,[e,i])=>e.evaluate(r)%i.evaluate(r)],ln2:[be,[],()=>Math.LN2],pi:[be,[],()=>Math.PI],e:[be,[],()=>Math.E],"^":[be,[be,be],(r,[e,i])=>Math.pow(e.evaluate(r),i.evaluate(r))],sqrt:[be,[be],(r,[e])=>Math.sqrt(e.evaluate(r))],log10:[be,[be],(r,[e])=>Math.log(e.evaluate(r))/Math.LN10],ln:[be,[be],(r,[e])=>Math.log(e.evaluate(r))],log2:[be,[be],(r,[e])=>Math.log(e.evaluate(r))/Math.LN2],sin:[be,[be],(r,[e])=>Math.sin(e.evaluate(r))],cos:[be,[be],(r,[e])=>Math.cos(e.evaluate(r))],tan:[be,[be],(r,[e])=>Math.tan(e.evaluate(r))],asin:[be,[be],(r,[e])=>Math.asin(e.evaluate(r))],acos:[be,[be],(r,[e])=>Math.acos(e.evaluate(r))],atan:[be,[be],(r,[e])=>Math.atan(e.evaluate(r))],min:[be,gn(be),(r,e)=>Math.min(...e.map((i=>i.evaluate(r))))],max:[be,gn(be),(r,e)=>Math.max(...e.map((i=>i.evaluate(r))))],abs:[be,[be],(r,[e])=>Math.abs(e.evaluate(r))],round:[be,[be],(r,[e])=>{const i=e.evaluate(r);return i<0?-Math.round(-i):Math.round(i)}],floor:[be,[be],(r,[e])=>Math.floor(e.evaluate(r))],ceil:[be,[be],(r,[e])=>Math.ceil(e.evaluate(r))],"filter-==":[je,[Fe,Be],(r,[e,i])=>r.properties()[e.value]===i.value],"filter-id-==":[je,[Be],(r,[e])=>r.id()===e.value],"filter-type-==":[je,[Fe],(r,[e])=>r.geometryType()===e.value],"filter-<":[je,[Fe,Be],(r,[e,i])=>{const s=r.properties()[e.value],o=i.value;return typeof s==typeof o&&s<o}],"filter-id-<":[je,[Be],(r,[e])=>{const i=r.id(),s=e.value;return typeof i==typeof s&&i<s}],"filter->":[je,[Fe,Be],(r,[e,i])=>{const s=r.properties()[e.value],o=i.value;return typeof s==typeof o&&s>o}],"filter-id->":[je,[Be],(r,[e])=>{const i=r.id(),s=e.value;return typeof i==typeof s&&i>s}],"filter-<=":[je,[Fe,Be],(r,[e,i])=>{const s=r.properties()[e.value],o=i.value;return typeof s==typeof o&&s<=o}],"filter-id-<=":[je,[Be],(r,[e])=>{const i=r.id(),s=e.value;return typeof i==typeof s&&i<=s}],"filter->=":[je,[Fe,Be],(r,[e,i])=>{const s=r.properties()[e.value],o=i.value;return typeof s==typeof o&&s>=o}],"filter-id->=":[je,[Be],(r,[e])=>{const i=r.id(),s=e.value;return typeof i==typeof s&&i>=s}],"filter-has":[je,[Be],(r,[e])=>e.value in r.properties()],"filter-has-id":[je,[],r=>r.id()!==null&&r.id()!==void 0],"filter-type-in":[je,[Wt(Fe)],(r,[e])=>e.value.indexOf(r.geometryType())>=0],"filter-id-in":[je,[Wt(Be)],(r,[e])=>e.value.indexOf(r.id())>=0],"filter-in-small":[je,[Fe,Wt(Be)],(r,[e,i])=>i.value.indexOf(r.properties()[e.value])>=0],"filter-in-large":[je,[Fe,Wt(Be)],(r,[e,i])=>(function(s,o,l,u){for(;l<=u;){const d=l+u>>1;if(o[d]===s)return!0;o[d]>s?u=d-1:l=d+1}return!1})(r.properties()[e.value],i.value,0,i.value.length-1)],all:{type:je,overloads:[[[je,je],(r,[e,i])=>e.evaluate(r)&&i.evaluate(r)],[gn(je),(r,e)=>{for(const i of e)if(!i.evaluate(r))return!1;return!0}]]},any:{type:je,overloads:[[[je,je],(r,[e,i])=>e.evaluate(r)||i.evaluate(r)],[gn(je),(r,e)=>{for(const i of e)if(i.evaluate(r))return!0;return!1}]]},"!":[je,[je],(r,[e])=>!e.evaluate(r)],"is-supported-script":[je,[Fe],(r,[e])=>{const i=r.globals&&r.globals.isSupportedScript;return!i||i(e.evaluate(r))}],upcase:[Fe,[Fe],(r,[e])=>e.evaluate(r).toUpperCase()],downcase:[Fe,[Fe],(r,[e])=>e.evaluate(r).toLowerCase()],concat:[Fe,gn(Be),(r,e)=>e.map((i=>on(i.evaluate(r)))).join("")],split:[Wt(Fe),[Fe,Fe],(r,[e,i])=>e.evaluate(r).split(i.evaluate(r))],join:[Fe,[Wt(Fe),Fe],(r,[e,i])=>e.evaluate(r).join(i.evaluate(r))],"resolved-locale":[Fe,[xs],(r,[e])=>e.evaluate(r).resolvedLocale()]});class Fs{constructor(e,i,s){this.expression=e,this._warningHistory={},this._evaluator=new Ha,this._defaultValue=i?(function(o){if(o.type==="color"&&Bo(o.default))return new Ve(0,0,0,0);switch(o.type){case"color":return Ve.parse(o.default)||null;case"padding":return Kt.parse(o.default)||null;case"numberArray":return dt.parse(o.default)||null;case"colorArray":return Re.parse(o.default)||null;case"variableAnchorOffsetCollection":return oi.parse(o.default)||null;case"projectionDefinition":return ai.parse(o.default)||null;default:return o.default===void 0?null:o.default}})(i):null,this._enumValues=i&&i.type==="enum"?i.values:null,this._globalState=s}evaluateWithoutErrorHandling(e,i,s,o,l,u){return this._globalState&&(e=es(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=i,this._evaluator.featureState=s,this._evaluator.canonical=o,this._evaluator.availableImages=l||null,this._evaluator.formattedSection=u,this.expression.evaluate(this._evaluator)}evaluate(e,i,s,o,l,u){this._globalState&&(e=es(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=i||null,this._evaluator.featureState=s||null,this._evaluator.canonical=o,this._evaluator.availableImages=l||null,this._evaluator.formattedSection=u||null;try{const d=this.expression.evaluate(this._evaluator);if(d==null||typeof d=="number"&&d!=d)return this._defaultValue;if(this._enumValues&&!(d in this._enumValues))throw new st(`Expected value to be one of ${Object.keys(this._enumValues).map((g=>JSON.stringify(g))).join(", ")}, but found ${JSON.stringify(d)} instead.`);return d}catch(d){return this._warningHistory[d.message]||(this._warningHistory[d.message]=!0,typeof console<"u"&&console.warn(d.message)),this._defaultValue}}}function Oo(r){return Array.isArray(r)&&r.length>0&&typeof r[0]=="string"&&r[0]in Yn}function Ls(r,e,i){const s=new ln(Yn,Ro,[],e?(function(l){const u={color:Pi,string:Fe,number:be,enum:Fe,boolean:je,formatted:bs,padding:go,numberArray:ws,colorArray:Ln,projectionDefinition:mo,resolvedImage:Bn,variableAnchorOffsetCollection:Ts};return l.type==="array"?Wt(u[l.value]||Be,l.length):u[l.type]})(e):void 0),o=s.parse(r,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return o?kc(new Fs(o,e,i)):Kn(s.errors)}class Vo{constructor(e,i,s){this.kind=e,this._styleExpression=i,this.isStateDependent=e!=="constant"&&!ks(i.expression),this.globalStateRefs=Qn(i.expression),this._globalState=s}evaluateWithoutErrorHandling(e,i,s,o,l,u){return this._globalState&&(e=es(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,i,s,o,l,u)}evaluate(e,i,s,o,l,u){return this._globalState&&(e=es(e,this._globalState)),this._styleExpression.evaluate(e,i,s,o,l,u)}}class jo{constructor(e,i,s,o,l){this.kind=e,this.zoomStops=s,this._styleExpression=i,this.isStateDependent=e!=="camera"&&!ks(i.expression),this.globalStateRefs=Qn(i.expression),this.interpolationType=o,this._globalState=l}evaluateWithoutErrorHandling(e,i,s,o,l,u){return this._globalState&&(e=es(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,i,s,o,l,u)}evaluate(e,i,s,o,l,u){return this._globalState&&(e=es(e,this._globalState)),this._styleExpression.evaluate(e,i,s,o,l,u)}interpolationFactor(e,i,s){return this.interpolationType?It.interpolationFactor(this.interpolationType,e,i,s):0}}function Bc(r,e,i){const s=Ls(r,e,i);if(s.result==="error")return s;const o=s.value.expression,l=Fo(o);if(!l&&!Jn(e))return Kn([new qt("","data expressions not supported")]);const u=Lo(o,["zoom"]);if(!u&&!Rc(e))return Kn([new qt("","zoom expressions not supported")]);const d=_n(o);return d||u?d instanceof qt?Kn([d]):d instanceof It&&!ul(e)?Kn([new qt("",'"interpolate" expressions cannot be used with this property')]):kc(d?new jo(l?"camera":"composite",s.value,d.labels,d instanceof It?d.interpolation:void 0,i):new Vo(l?"constant":"source",s.value,i)):Kn([new qt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class No{constructor(e,i){this._parameters=e,this._specification=i,rn(this,Fc(this._parameters,this._specification))}static deserialize(e){return new No(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function _n(r){let e=null;if(r instanceof ot)e=_n(r.result);else if(r instanceof Es){for(const i of r.args)if(e=_n(i),e)break}else(r instanceof Zn||r instanceof It)&&r.input instanceof Bi&&r.input.name==="zoom"&&(e=r);return e instanceof qt||r.eachChild((i=>{const s=_n(i);s instanceof qt?e=s:!e&&s?e=new qt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&s&&e!==s&&(e=new qt("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),e}function Qn(r,e=new Set){return r instanceof zs&&e.add(r.key),r.eachChild((i=>{Qn(i,e)})),e}function es(r,e){const{zoom:i,heatmapDensity:s,elevation:o,lineProgress:l,isSupportedScript:u,accumulated:d}=r??{};return{zoom:i,heatmapDensity:s,elevation:o,lineProgress:l,isSupportedScript:u,accumulated:d,globalState:e}}function hl(r){if(r===!0||r===!1)return!0;if(!Array.isArray(r)||r.length===0)return!1;switch(r[0]){case"has":return r.length>=2&&r[1]!=="$id"&&r[1]!=="$type";case"in":return r.length>=3&&(typeof r[1]!="string"||Array.isArray(r[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return r.length!==3||Array.isArray(r[1])||Array.isArray(r[2]);case"any":case"all":for(const e of r.slice(1))if(!hl(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}const Ju={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Bs(r,e){if(r==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};hl(r)||(r=Os(r));const i=Ls(r,Ju,e);if(i.result==="error")throw new Error(i.value.map((s=>`${s.key}: ${s.message}`)).join(", "));return{filter:(s,o,l)=>i.value.evaluate(s,o,{},l),needGeometry:dl(r),getGlobalStateRefs:()=>Qn(i.value.expression)}}function Qu(r,e){return r<e?-1:r>e?1:0}function dl(r){if(!Array.isArray(r))return!1;if(r[0]==="within"||r[0]==="distance")return!0;for(let e=1;e<r.length;e++)if(dl(r[e]))return!0;return!1}function Os(r){if(!r)return!0;const e=r[0];return r.length<=1?e!=="any":e==="=="?pl(r[1],r[2],"=="):e==="!="?Vs(pl(r[1],r[2],"==")):e==="<"||e===">"||e==="<="||e===">="?pl(r[1],r[2],e):e==="any"?(i=r.slice(1),["any"].concat(i.map(Os))):e==="all"?["all"].concat(r.slice(1).map(Os)):e==="none"?["all"].concat(r.slice(1).map(Os).map(Vs)):e==="in"?Oc(r[1],r.slice(2)):e==="!in"?Vs(Oc(r[1],r.slice(2))):e==="has"?fl(r[1]):e!=="!has"||Vs(fl(r[1]));var i}function pl(r,e,i){switch(r){case"$type":return[`filter-type-${i}`,e];case"$id":return[`filter-id-${i}`,e];default:return[`filter-${i}`,r,e]}}function Oc(r,e){if(e.length===0)return!1;switch(r){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some((i=>typeof i!=typeof e[0]))?["filter-in-large",r,["literal",e.sort(Qu)]]:["filter-in-small",r,["literal",e]]}}function fl(r){switch(r){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",r]}}function Vs(r){return["!",r]}function Uo(r){const e=typeof r;if(e==="number"||e==="boolean"||e==="string"||r==null)return JSON.stringify(r);if(Array.isArray(r)){let o="[";for(const l of r)o+=`${Uo(l)},`;return`${o}]`}const i=Object.keys(r).sort();let s="{";for(let o=0;o<i.length;o++)s+=`${JSON.stringify(i[o])}:${Uo(r[i[o]])},`;return`${s}}`}function eh(r){let e="";for(const i of Ba)e+=`/${Uo(r[i])}`;return e}function Vc(r){const e=r.value;return e?[new _e(r.key,e,"constants have been deprecated as of v8")]:[]}function St(r){return r instanceof Number||r instanceof String||r instanceof Boolean?r.valueOf():r}function yn(r){if(Array.isArray(r))return r.map(yn);if(r instanceof Object&&!(r instanceof Number||r instanceof String||r instanceof Boolean)){const e={};for(const i in r)e[i]=yn(r[i]);return e}return St(r)}function vi(r){const e=r.key,i=r.value,s=r.valueSpec||{},o=r.objectElementValidators||{},l=r.style,u=r.styleSpec,d=r.validateSpec;let g=[];const m=Ne(i);if(m!=="object")return[new _e(e,i,`object expected, ${m} found`)];for(const v in i){const _=v.split(".")[0],T=Is(s,_)||s["*"];let b;if(Is(o,_))b=o[_];else if(Is(s,_)){if(i[v]===void 0)continue;b=d}else if(o["*"])b=o["*"];else{if(!s["*"]){g.push(new _e(e,i[v],`unknown property "${v}"`));continue}b=d}g=g.concat(b({key:(e&&`${e}.`)+v,value:i[v],valueSpec:T,style:l,styleSpec:u,object:i,objectKey:v,validateSpec:d},i))}for(const v in s)o[v]||s[v].required&&s[v].default===void 0&&i[v]===void 0&&g.push(new _e(e,i,`missing required property "${v}"`));return g}function Go(r){const e=r.value,i=r.valueSpec,s=r.style,o=r.styleSpec,l=r.key,u=r.arrayElementValidator||r.validateSpec;if(Ne(e)!=="array")return[new _e(l,e,`array expected, ${Ne(e)} found`)];if(i.length&&e.length!==i.length)return[new _e(l,e,`array length ${i.length} expected, length ${e.length} found`)];let d={type:i.value,values:i.values};o.$version<7&&(d.function=i.function),Ne(i.value)==="object"&&(d=i.value);let g=[];for(let m=0;m<e.length;m++)g=g.concat(u({array:e,arrayIndex:m,value:e[m],valueSpec:d,validateSpec:r.validateSpec,style:s,styleSpec:o,key:`${l}[${m}]`}));return g}function ts(r){const e=r.key,i=r.value,s=r.valueSpec;let o=Ne(i);return o==="number"&&i!=i&&(o="NaN"),o!=="number"?[new _e(e,i,`number expected, ${o} found`)]:"minimum"in s&&i<s.minimum?[new _e(e,i,`${i} is less than the minimum value ${s.minimum}`)]:"maximum"in s&&i>s.maximum?[new _e(e,i,`${i} is greater than the maximum value ${s.maximum}`)]:[]}function $o(r){const e=r.valueSpec,i=St(r.value.type);let s,o,l,u={};const d=i!=="categorical"&&r.value.property===void 0,g=!d,m=Ne(r.value.stops)==="array"&&Ne(r.value.stops[0])==="array"&&Ne(r.value.stops[0][0])==="object",v=vi({key:r.key,value:r.value,valueSpec:r.styleSpec.function,validateSpec:r.validateSpec,style:r.style,styleSpec:r.styleSpec,objectElementValidators:{stops:function(b){if(i==="identity")return[new _e(b.key,b.value,'identity function may not have a "stops" property')];let I=[];const M=b.value;return I=I.concat(Go({key:b.key,value:M,valueSpec:b.valueSpec,validateSpec:b.validateSpec,style:b.style,styleSpec:b.styleSpec,arrayElementValidator:_})),Ne(M)==="array"&&M.length===0&&I.push(new _e(b.key,M,"array must have at least one stop")),I},default:function(b){return b.validateSpec({key:b.key,value:b.value,valueSpec:e,validateSpec:b.validateSpec,style:b.style,styleSpec:b.styleSpec})}}});return i==="identity"&&d&&v.push(new _e(r.key,r.value,'missing required property "property"')),i==="identity"||r.value.stops||v.push(new _e(r.key,r.value,'missing required property "stops"')),i==="exponential"&&r.valueSpec.expression&&!ul(r.valueSpec)&&v.push(new _e(r.key,r.value,"exponential functions not supported")),r.styleSpec.$version>=8&&(g&&!Jn(r.valueSpec)?v.push(new _e(r.key,r.value,"property functions not supported")):d&&!Rc(r.valueSpec)&&v.push(new _e(r.key,r.value,"zoom functions not supported"))),i!=="categorical"&&!m||r.value.property!==void 0||v.push(new _e(r.key,r.value,'"property" property is required')),v;function _(b){let I=[];const M=b.value,A=b.key;if(Ne(M)!=="array")return[new _e(A,M,`array expected, ${Ne(M)} found`)];if(M.length!==2)return[new _e(A,M,`array length 2 expected, length ${M.length} found`)];if(m){if(Ne(M[0])!=="object")return[new _e(A,M,`object expected, ${Ne(M[0])} found`)];if(M[0].zoom===void 0)return[new _e(A,M,"object stop key must have zoom")];if(M[0].value===void 0)return[new _e(A,M,"object stop key must have value")];if(l&&l>St(M[0].zoom))return[new _e(A,M[0].zoom,"stop zoom values must appear in ascending order")];St(M[0].zoom)!==l&&(l=St(M[0].zoom),o=void 0,u={}),I=I.concat(vi({key:`${A}[0]`,value:M[0],valueSpec:{zoom:{}},validateSpec:b.validateSpec,style:b.style,styleSpec:b.styleSpec,objectElementValidators:{zoom:ts,value:T}}))}else I=I.concat(T({key:`${A}[0]`,value:M[0],validateSpec:b.validateSpec,style:b.style,styleSpec:b.styleSpec},M));return Oo(yn(M[1]))?I.concat([new _e(`${A}[1]`,M[1],"expressions are not allowed in function stops.")]):I.concat(b.validateSpec({key:`${A}[1]`,value:M[1],valueSpec:e,validateSpec:b.validateSpec,style:b.style,styleSpec:b.styleSpec}))}function T(b,I){const M=Ne(b.value),A=St(b.value),D=b.value!==null?b.value:I;if(s){if(M!==s)return[new _e(b.key,D,`${M} stop domain type must match previous stop domain type ${s}`)]}else s=M;if(M!=="number"&&M!=="string"&&M!=="boolean")return[new _e(b.key,D,"stop domain value must be a number, string, or boolean")];if(M!=="number"&&i!=="categorical"){let F=`number expected, ${M} found`;return Jn(e)&&i===void 0&&(F+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new _e(b.key,D,F)]}return i!=="categorical"||M!=="number"||isFinite(A)&&Math.floor(A)===A?i!=="categorical"&&M==="number"&&o!==void 0&&A<o?[new _e(b.key,D,"stop domain values must appear in ascending order")]:(o=A,i==="categorical"&&A in u?[new _e(b.key,D,"stop domain values must be unique")]:(u[A]=!0,[])):[new _e(b.key,D,`integer expected, found ${A}`)]}}function kr(r){const e=(r.expressionContext==="property"?Bc:Ls)(yn(r.value),r.valueSpec);if(e.result==="error")return e.value.map((s=>new _e(`${r.key}${s.key}`,r.value,s.message)));const i=e.value.expression||e.value._styleExpression.expression;if(r.expressionContext==="property"&&r.propertyKey==="text-font"&&!i.outputDefined())return[new _e(r.key,r.value,`Invalid data expression for "${r.propertyKey}". Output values must be contained as literals within the expression.`)];if(r.expressionContext==="property"&&r.propertyType==="layout"&&!ks(i))return[new _e(r.key,r.value,'"feature-state" data expressions are not supported with layout properties.')];if(r.expressionContext==="filter"&&!ks(i))return[new _e(r.key,r.value,'"feature-state" data expressions are not supported with filters.')];if(r.expressionContext&&r.expressionContext.indexOf("cluster")===0){if(!Lo(i,["zoom","feature-state"]))return[new _e(r.key,r.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(r.expressionContext==="cluster-initial"&&!Fo(i))return[new _e(r.key,r.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function js(r){const e=r.key,i=r.value,s=Ne(i);return s!=="string"?[new _e(e,i,`color expected, ${s} found`)]:Ve.parse(String(i))?[]:[new _e(e,i,`color expected, "${i}" found`)]}function vn(r){const e=r.key,i=r.value,s=r.valueSpec,o=[];return Array.isArray(s.values)?s.values.indexOf(St(i))===-1&&o.push(new _e(e,i,`expected one of [${s.values.join(", ")}], ${JSON.stringify(i)} found`)):Object.keys(s.values).indexOf(St(i))===-1&&o.push(new _e(e,i,`expected one of [${Object.keys(s.values).join(", ")}], ${JSON.stringify(i)} found`)),o}function is(r){return hl(yn(r.value))?kr(rn({},r,{expressionContext:"filter",valueSpec:{value:"boolean"}})):jc(r)}function jc(r){const e=r.value,i=r.key;if(Ne(e)!=="array")return[new _e(i,e,`array expected, ${Ne(e)} found`)];const s=r.styleSpec;let o,l=[];if(e.length<1)return[new _e(i,e,"filter array must have at least 1 element")];switch(l=l.concat(vn({key:`${i}[0]`,value:e[0],valueSpec:s.filter_operator,style:r.style,styleSpec:r.styleSpec})),St(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&St(e[1])==="$type"&&l.push(new _e(i,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&l.push(new _e(i,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(o=Ne(e[1]),o!=="string"&&l.push(new _e(`${i}[1]`,e[1],`string expected, ${o} found`)));for(let u=2;u<e.length;u++)o=Ne(e[u]),St(e[1])==="$type"?l=l.concat(vn({key:`${i}[${u}]`,value:e[u],valueSpec:s.geometry_type,style:r.style,styleSpec:r.styleSpec})):o!=="string"&&o!=="number"&&o!=="boolean"&&l.push(new _e(`${i}[${u}]`,e[u],`string, number, or boolean expected, ${o} found`));break;case"any":case"all":case"none":for(let u=1;u<e.length;u++)l=l.concat(jc({key:`${i}[${u}]`,value:e[u],style:r.style,styleSpec:r.styleSpec}));break;case"has":case"!has":o=Ne(e[1]),e.length!==2?l.push(new _e(i,e,`filter array for "${e[0]}" operator must have 2 elements`)):o!=="string"&&l.push(new _e(`${i}[1]`,e[1],`string expected, ${o} found`))}return l}function Nc(r,e){const i=r.key,s=r.validateSpec,o=r.style,l=r.styleSpec,u=r.value,d=r.objectKey,g=l[`${e}_${r.layerType}`];if(!g)return[];const m=d.match(/^(.*)-transition$/);if(e==="paint"&&m&&g[m[1]]&&g[m[1]].transition)return s({key:i,value:u,valueSpec:l.transition,style:o,styleSpec:l});const v=r.valueSpec||g[d];if(!v)return[new _e(i,u,`unknown property "${d}"`)];let _;if(Ne(u)==="string"&&Jn(v)&&!v.tokens&&(_=/^{([^}]+)}$/.exec(u)))return[new _e(i,u,`"${d}" does not support interpolation syntax
1
+ import{g as B_}from"./zip-DFgP-l20.js";function O_(Aa,Ru){for(var $r=0;$r<Ru.length;$r++){const $i=Ru[$r];if(typeof $i!="string"&&!Array.isArray($i)){for(const Zr in $i)if(Zr!=="default"&&!(Zr in Aa)){const Da=Object.getOwnPropertyDescriptor($i,Zr);Da&&Object.defineProperty(Aa,Zr,Da.get?Da:{enumerable:!0,get:()=>$i[Zr]})}}}return Object.freeze(Object.defineProperty(Aa,Symbol.toStringTag,{value:"Module"}))}var ku={exports:{}};var V_=ku.exports,jf;function j_(){return jf||(jf=1,(function(Aa,Ru){(function($r,$i){Aa.exports=$i()})(V_,(function(){var $r={},$i={};function Zr(R,p,Te){if($i[R]=Te,R==="index"){var wr="var sharedModule = {}; ("+$i.shared+")(sharedModule); ("+$i.worker+")(sharedModule);",wi={};return $i.shared(wi),$i.index($r,wi),typeof window<"u"&&$r.setWorkerUrl(window.URL.createObjectURL(new Blob([wr],{type:"text/javascript"}))),$r}}Zr("shared",["exports"],(function(R){function p(r,e,i,s){return new(i||(i=Promise))((function(o,l){function u(m){try{g(s.next(m))}catch(v){l(v)}}function d(m){try{g(s.throw(m))}catch(v){l(v)}}function g(m){var v;m.done?o(m.value):(v=m.value,v instanceof i?v:new i((function(_){_(v)}))).then(u,d)}g((s=s.apply(r,e||[])).next())}))}function Te(r,e){this.x=r,this.y=e}function wr(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var wi,qr;typeof SuppressedError=="function"&&SuppressedError,Te.prototype={clone(){return new Te(this.x,this.y)},add(r){return this.clone()._add(r)},sub(r){return this.clone()._sub(r)},multByPoint(r){return this.clone()._multByPoint(r)},divByPoint(r){return this.clone()._divByPoint(r)},mult(r){return this.clone()._mult(r)},div(r){return this.clone()._div(r)},rotate(r){return this.clone()._rotate(r)},rotateAround(r,e){return this.clone()._rotateAround(r,e)},matMult(r){return this.clone()._matMult(r)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(r){return this.x===r.x&&this.y===r.y},dist(r){return Math.sqrt(this.distSqr(r))},distSqr(r){const e=r.x-this.x,i=r.y-this.y;return e*e+i*i},angle(){return Math.atan2(this.y,this.x)},angleTo(r){return Math.atan2(this.y-r.y,this.x-r.x)},angleWith(r){return this.angleWithSep(r.x,r.y)},angleWithSep(r,e){return Math.atan2(this.x*e-this.y*r,this.x*r+this.y*e)},_matMult(r){const e=r[2]*this.x+r[3]*this.y;return this.x=r[0]*this.x+r[1]*this.y,this.y=e,this},_add(r){return this.x+=r.x,this.y+=r.y,this},_sub(r){return this.x-=r.x,this.y-=r.y,this},_mult(r){return this.x*=r,this.y*=r,this},_div(r){return this.x/=r,this.y/=r,this},_multByPoint(r){return this.x*=r.x,this.y*=r.y,this},_divByPoint(r){return this.x/=r.x,this.y/=r.y,this},_unit(){return this._div(this.mag()),this},_perp(){const r=this.y;return this.y=this.x,this.x=-r,this},_rotate(r){const e=Math.cos(r),i=Math.sin(r),s=i*this.x+e*this.y;return this.x=e*this.x-i*this.y,this.y=s,this},_rotateAround(r,e){const i=Math.cos(r),s=Math.sin(r),o=e.y+s*(this.x-e.x)+i*(this.y-e.y);return this.x=e.x+i*(this.x-e.x)-s*(this.y-e.y),this.y=o,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:Te},Te.convert=function(r){if(r instanceof Te)return r;if(Array.isArray(r))return new Te(+r[0],+r[1]);if(r.x!==void 0&&r.y!==void 0)return new Te(+r.x,+r.y);throw new Error("Expected [x, y] or {x, y} point format")};var Cn=(function(){if(qr)return wi;function r(e,i,s,o){this.cx=3*e,this.bx=3*(s-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*i,this.by=3*(o-i)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=i,this.p2x=s,this.p2y=o}return qr=1,wi=r,r.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,i){if(i===void 0&&(i=1e-6),e<0)return 0;if(e>1)return 1;for(var s=e,o=0;o<8;o++){var l=this.sampleCurveX(s)-e;if(Math.abs(l)<i)return s;var u=this.sampleCurveDerivativeX(s);if(Math.abs(u)<1e-6)break;s-=l/u}var d=0,g=1;for(s=e,o=0;o<20&&(l=this.sampleCurveX(s),!(Math.abs(l-e)<i));o++)e>l?d=s:g=s,s=.5*(g-d)+d;return s},solve:function(e,i){return this.sampleCurveY(this.solveCurveX(e,i))}},wi})(),Gt=wr(Cn);let Tr,He;function Wr(){return Tr!=null||(Tr=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),Tr}function Ti(){if(He==null&&(He=!1,Wr())){const e=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(e){for(let s=0;s<25;s++){const o=4*s;e.fillStyle=`rgb(${o},${o+1},${o+2})`,e.fillRect(s%5,Math.floor(s/5),1,1)}const i=e.getImageData(0,0,5,5).data;for(let s=0;s<100;s++)if(s%4!=3&&i[s]!==s){He=!0;break}}}return He||!1}var pe=1e-6,zt=typeof Float32Array<"u"?Float32Array:Array;function Hr(){var r=new zt(9);return zt!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[5]=0,r[6]=0,r[7]=0),r[0]=1,r[4]=1,r[8]=1,r}function An(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function fs(){var r=new zt(3);return zt!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r}function ms(r){var e=r[0],i=r[1],s=r[2];return Math.sqrt(e*e+i*i+s*s)}function qe(r,e,i){var s=new zt(3);return s[0]=r,s[1]=e,s[2]=i,s}function W(r,e,i){return r[0]=e[0]+i[0],r[1]=e[1]+i[1],r[2]=e[2]+i[2],r}function K(r,e,i){return r[0]=e[0]*i,r[1]=e[1]*i,r[2]=e[2]*i,r}function ee(r,e,i){var s=e[0],o=e[1],l=e[2],u=i[0],d=i[1],g=i[2];return r[0]=o*g-l*d,r[1]=l*u-s*g,r[2]=s*d-o*u,r}var ge,Me=ms;function $e(r,e,i){var s=e[0],o=e[1],l=e[2],u=e[3];return r[0]=i[0]*s+i[4]*o+i[8]*l+i[12]*u,r[1]=i[1]*s+i[5]*o+i[9]*l+i[13]*u,r[2]=i[2]*s+i[6]*o+i[10]*l+i[14]*u,r[3]=i[3]*s+i[7]*o+i[11]*l+i[15]*u,r}function ze(){var r=new zt(4);return zt!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r[3]=1,r}function Ge(r,e,i,s){var o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:"zyx",l=Math.PI/360;e*=l,s*=l,i*=l;var u=Math.sin(e),d=Math.cos(e),g=Math.sin(i),m=Math.cos(i),v=Math.sin(s),_=Math.cos(s);switch(o){case"xyz":r[0]=u*m*_+d*g*v,r[1]=d*g*_-u*m*v,r[2]=d*m*v+u*g*_,r[3]=d*m*_-u*g*v;break;case"xzy":r[0]=u*m*_-d*g*v,r[1]=d*g*_-u*m*v,r[2]=d*m*v+u*g*_,r[3]=d*m*_+u*g*v;break;case"yxz":r[0]=u*m*_+d*g*v,r[1]=d*g*_-u*m*v,r[2]=d*m*v-u*g*_,r[3]=d*m*_+u*g*v;break;case"yzx":r[0]=u*m*_+d*g*v,r[1]=d*g*_+u*m*v,r[2]=d*m*v-u*g*_,r[3]=d*m*_-u*g*v;break;case"zxy":r[0]=u*m*_-d*g*v,r[1]=d*g*_+u*m*v,r[2]=d*m*v+u*g*_,r[3]=d*m*_-u*g*v;break;case"zyx":r[0]=u*m*_-d*g*v,r[1]=d*g*_+u*m*v,r[2]=d*m*v-u*g*_,r[3]=d*m*_+u*g*v;break;default:throw new Error("Unknown angle order "+o)}return r}function Le(){var r=new zt(2);return zt!=Float32Array&&(r[0]=0,r[1]=0),r}function Ye(r,e){var i=new zt(2);return i[0]=r,i[1]=e,i}fs(),ge=new zt(4),zt!=Float32Array&&(ge[0]=0,ge[1]=0,ge[2]=0,ge[3]=0),fs(),qe(1,0,0),qe(0,1,0),ze(),ze(),Hr(),Le();const De=8192;function _t(r,e,i){return e*(De/(r.tileSize*Math.pow(2,i-r.tileID.overscaledZ)))}function yt(r){return r instanceof Error?r:new Error(typeof r=="string"?r:String(r))}function Zi(r,e){return(r%e+e)%e}function Ri(r,e,i){return r*(1-i)+e*i}function Sr(r){if(r<=0)return 0;if(r>=1)return 1;const e=r*r,i=e*r;return 4*(r<.5?i:3*(r-e)+i-.75)}function Xr(r,e,i,s){const o=new Gt(r,e,i,s);return l=>o.solve(l)}const gs=Xr(.25,.1,.25,1);function si(r,e,i){return Math.min(i,Math.max(e,r))}function Dn(r,e,i){const s=i-e,o=((r-e)%s+s)%s+e;return o===e?i:o}function Fi(r,...e){for(const i of e)for(const s in i)r[s]=i[s];return r}let _s=1;function Pr(r,e,i){const s={};for(const o in r)s[o]=e.call(this,r[o],o,r);return s}function Yr(r,e,i){const s={};for(const o in r)e.call(this,r[o],o,r)&&(s[o]=r[o]);return s}function ke(r){return Array.isArray(r)?r.map(ke):typeof r=="object"&&r?Pr(r,ke):r}const Ft={};function $t(r){Ft[r]||(typeof console<"u"&&console.warn(r),Ft[r]=!0)}function Si(r,e,i){return(i.y-r.y)*(e.x-r.x)>(e.y-r.y)*(i.x-r.x)}function Zt(r){return typeof WorkerGlobalScope<"u"&&r!==void 0&&r instanceof WorkerGlobalScope}let mi=null;function Kr(r){return typeof ImageBitmap<"u"&&r instanceof ImageBitmap}const za="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function ka(r,e,i,s,o){return p(this,void 0,void 0,(function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");const l=new VideoFrame(r,{timestamp:0});try{const u=l?.format;if(!u||!u.startsWith("BGR")&&!u.startsWith("RGB"))throw new Error(`Unrecognized format ${u}`);const d=u.startsWith("BGR"),g=new Uint8ClampedArray(s*o*4);if(yield l.copyTo(g,(function(m,v,_,T,b){const I=4*Math.max(-v,0),M=(Math.max(0,_)-_)*T*4+I,A=4*T,D=Math.max(0,v),F=Math.max(0,_);return{rect:{x:D,y:F,width:Math.min(m.width,v+T)-D,height:Math.min(m.height,_+b)-F},layout:[{offset:M,stride:A}]}})(r,e,i,s,o)),d)for(let m=0;m<g.length;m+=4){const v=g[m];g[m]=g[m+2],g[m+2]=v}return g}finally{l.close()}}))}let Ir,zn;function co(r,e,i,s){return r.addEventListener(e,i,s),{unsubscribe:()=>{r.removeEventListener(e,i,s)}}}function Mr(r){return r*Math.PI/180}function Jr(r){return r/Math.PI*180}const Ra={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0},Fa={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0},uo="AbortError";class ys extends Error{constructor(e=uo){super(e instanceof Error?e.message:e),this.name=uo,e instanceof Error&&e.stack&&(this.stack=e.stack)}}function rc(r){return r instanceof Error&&r.name===uo}function ho(r){if(r.aborted)throw new ys(r.reason)}const Er={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function ar(r){return Er.REGISTERED_PROTOCOLS[r.substring(0,r.indexOf("://"))]}const Li="global-dispatcher";class kn extends Error{constructor(e,i,s,o){super(`AJAXError: ${i} (${e}): ${s}`),this.status=e,this.statusText=i,this.url=s,this.body=o}}const La=()=>{var r;return Zt(self)?(r=self.worker)===null||r===void 0?void 0:r.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href},Qr=function(r,e){return p(this,void 0,void 0,(function*(){var i,s;if(r.url.includes("://")&&!/^https?:|^file:/.test(r.url)){const o=ar(r.url);if(o){const l=yield o(r,e);return l.data||r.type!=="arrayBuffer"?l:Fi(l,{data:new ArrayBuffer(0)})}if(Zt(self)&&(!((i=self.worker)===null||i===void 0)&&i.actor))return self.worker.actor.sendAsync({type:"GR",data:r,targetMapId:Li},e)}if(!(o=>{var l;return o.startsWith("file:")||((l=La())===null||l===void 0?void 0:l.startsWith("file:"))&&!/^\w+:/.test(o)})(r.url)){if(fetch&&Request&&AbortController&&Object.hasOwn(Request.prototype,"signal"))return(function(o,l){return p(this,void 0,void 0,(function*(){const u=new Request(o.url,{method:o.method||"GET",body:o.body,credentials:o.credentials,headers:o.headers,cache:o.cache,referrer:La(),referrerPolicy:o.referrerPolicy,signal:l.signal});let d,g;o.type!=="json"||u.headers.has("Accept")||u.headers.set("Accept","application/json");try{d=yield fetch(u)}catch(v){throw rc(v)?v:new kn(0,yt(v).message,o.url,new Blob)}if(!d.ok){const v=yield d.blob();throw new kn(d.status,d.statusText,o.url,v)}g=o.type==="arrayBuffer"||o.type==="image"?d.arrayBuffer():o.type==="json"?d.json():d.text();const m=yield g;return ho(l.signal),{data:m,cacheControl:d.headers.get("Cache-Control"),expires:d.headers.get("Expires"),etag:d.headers.get("ETag")}}))})(r,e);if(Zt(self)&&(!((s=self.worker)===null||s===void 0)&&s.actor))return self.worker.actor.sendAsync({type:"GR",data:r,mustQueue:!0,targetMapId:Li},e)}return(function(o,l){return new Promise(((u,d)=>{var g;const m=new XMLHttpRequest;m.open(o.method||"GET",o.url,!0),o.type!=="arrayBuffer"&&o.type!=="image"||(m.responseType="arraybuffer");for(const v in o.headers)m.setRequestHeader(v,o.headers[v]);o.type==="json"&&(m.responseType="text",!((g=o.headers)===null||g===void 0)&&g.Accept||m.setRequestHeader("Accept","application/json")),m.withCredentials=o.credentials==="include",m.onerror=()=>{d(new Error(m.statusText))},m.onload=()=>{if(!l.signal.aborted)if((m.status>=200&&m.status<300||m.status===0)&&m.response!==null){let v=m.response;if(o.type==="json")try{v=JSON.parse(m.response)}catch(_){return void d(_)}u({data:v,cacheControl:m.getResponseHeader("Cache-Control"),expires:m.getResponseHeader("Expires"),etag:m.getResponseHeader("ETag")})}else{const v=new Blob([m.response],{type:m.getResponseHeader("Content-Type")});d(new kn(m.status,m.statusText,o.url,v))}},l.signal.addEventListener("abort",(()=>{m.abort(),d(new ys(l.signal.reason))})),m.send(o.body)}))})(r,e)}))};function qi(r){if(!r||r.indexOf("://")<=0||r.startsWith("data:image/")||r.startsWith("blob:"))return!0;const e=new URL(r),i=window.location;return e.protocol===i.protocol&&e.host===i.host}function Rn(r,e,i){var s;!((s=i[r])===null||s===void 0)&&s.includes(e)||(i[r]||(i[r]=[]),i[r].push(e))}function en(r,e,i){if(i?.[r]){const s=i[r].indexOf(e);s!==-1&&i[r].splice(s,1)}}class vs{constructor(e,i={}){Fi(this,i),this.type=e}}class Fn extends vs{constructor(e,i={}){super("error",Fi({error:e},i))}}class po{on(e,i){return this._listeners||(this._listeners={}),Rn(e,i,this._listeners),{unsubscribe:()=>{this.off(e,i)}}}off(e,i){return en(e,i,this._listeners),en(e,i,this._oneTimeListeners),this}once(e,i){return i?(this._oneTimeListeners||(this._oneTimeListeners={}),Rn(e,i,this._oneTimeListeners),this):new Promise((s=>this.once(e,s)))}fire(e,i){var s,o;typeof e=="string"&&(e=new vs(e,i||{}));const l=e.type;if(this.listens(l)){e.target=this;const u=!((s=this._listeners)===null||s===void 0)&&s[l]?this._listeners[l].slice():[];for(const m of u)m.call(this,e);const d=!((o=this._oneTimeListeners)===null||o===void 0)&&o[l]?this._oneTimeListeners[l].slice():[];for(const m of d)en(l,m,this._oneTimeListeners),m.call(this,e);const g=this._eventedParent;g&&(Fi(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),g.fire(e))}else e instanceof Fn&&console.error(e.error);return this}listens(e){var i,s,o,l,u;return((s=(i=this._listeners)===null||i===void 0?void 0:i[e])===null||s===void 0?void 0:s.length)>0||((l=(o=this._oneTimeListeners)===null||o===void 0?void 0:o[e])===null||l===void 0?void 0:l.length)>0||((u=this._eventedParent)===null||u===void 0?void 0:u.listens(e))}setEventedParent(e,i){return this._eventedParent=e,this._eventedParentData=i,this}}var ce={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number",length:2},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},"font-faces":{type:"fontFaces"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},encoding:{type:"enum",values:{mvt:{},mlt:{}},default:"mvt"},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"filter"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},"color-relief":{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},filter:{type:"boolean",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"expression_name",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}},interpolation:{type:"array",value:"interpolation_name",minimum:1},interpolation_name:{type:"enum",values:{linear:{syntax:{overloads:[{parameters:[],"output-type":"interpolation"}],parameters:[]}},exponential:{syntax:{overloads:[{parameters:["base"],"output-type":"interpolation"}],parameters:[{name:"base",type:"number literal"}]}},"cubic-bezier":{syntax:{overloads:[{parameters:["x1","y1","x2","y2"],"output-type":"interpolation"}],parameters:[{name:"x1",type:"number literal"},{name:"y1",type:"number literal"},{name:"x2",type:"number literal"},{name:"y2",type:"number literal"}]}}}}};const Ba=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Oa(r,e){const i={};for(const s in r)s!=="ref"&&(i[s]=r[s]);return Ba.forEach((s=>{s in e&&(i[s]=e[s])})),i}function et(r,e){if(Array.isArray(r)){if(!Array.isArray(e)||r.length!==e.length)return!1;for(let i=0;i<r.length;i++)if(!et(r[i],e[i]))return!1;return!0}if(typeof r=="object"&&r!==null&&e!==null){if(typeof e!="object"||Object.keys(r).length!==Object.keys(e).length)return!1;for(const i in r)if(!et(r[i],e[i]))return!1;return!0}return r===e}function gi(r,e){r.push(e)}function tn(r,e,i){gi(i,{command:"addSource",args:[r,e[r]]})}function nc(r,e,i){gi(e,{command:"removeSource",args:[r]}),i[r]=!0}function sc(r,e,i,s){nc(r,i,s),tn(r,e,i)}function Fu(r,e,i){let s;for(s in r[i])if(Object.prototype.hasOwnProperty.call(r[i],s)&&s!=="data"&&!et(r[i][s],e[i][s]))return!1;for(s in e[i])if(Object.prototype.hasOwnProperty.call(e[i],s)&&s!=="data"&&!et(r[i][s],e[i][s]))return!1;return!0}function fo(r,e,i,s,o,l){r=r||{},e=e||{};for(const u in r)Object.prototype.hasOwnProperty.call(r,u)&&(et(r[u],e[u])||i.push({command:l,args:[s,u,e[u],o]}));for(const u in e)Object.prototype.hasOwnProperty.call(e,u)&&!Object.prototype.hasOwnProperty.call(r,u)&&(et(r[u],e[u])||i.push({command:l,args:[s,u,e[u],o]}))}function Va(r){return r.id}function oc(r,e){return r[e.id]=e,r}class _e{constructor(e,i,s,o){this.message=(e?`${e}: `:"")+s,o&&(this.identifier=o),i!=null&&i.__line__&&(this.line=i.__line__)}}function rn(r,...e){for(const i of e)for(const s in i)r[s]=i[s];return r}class qt extends Error{constructor(e,i){super(i),this.message=i,this.key=e}}class ja{constructor(e,i=[]){this.parent=e,this.bindings={};for(const[s,o]of i)this.bindings[s]=o}concat(e){return new ja(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}const Cr={kind:"null"},be={kind:"number"},Fe={kind:"string"},je={kind:"boolean"},Pi={kind:"color"},mo={kind:"projectionDefinition"},lr={kind:"object"},Be={kind:"value"},xs={kind:"collator"},bs={kind:"formatted"},go={kind:"padding"},Ln={kind:"colorArray"},ws={kind:"numberArray"},Bn={kind:"resolvedImage"},Ts={kind:"variableAnchorOffsetCollection"};function Wt(r,e){return{kind:"array",itemType:r,N:e}}function tt(r){if(r.kind==="array"){const e=tt(r.itemType);return typeof r.N=="number"?`array<${e}, ${r.N}>`:r.itemType.kind==="value"?"array":`array<${e}>`}return r.kind}const _o=[Cr,be,Fe,je,Pi,mo,bs,lr,Wt(Be),go,ws,Ln,Bn,Ts];function On(r,e){if(e.kind==="error")return null;if(r.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!On(r.itemType,e.itemType))&&(typeof r.N!="number"||r.N===e.N))return null}else{if(r.kind===e.kind)return null;if(r.kind==="value"){for(const i of _o)if(!On(i,e))return null}}return`Expected ${tt(r)} but found ${tt(e)} instead.`}function Ss(r,e){return e.some((i=>i.kind===r.kind))}function nn(r,e){return e.some((i=>i==="null"?r===null:i==="array"?Array.isArray(r):i==="object"?r&&!Array.isArray(r)&&typeof r=="object":i===typeof r))}function Wi(r,e){return r.kind==="array"&&e.kind==="array"?r.itemType.kind===e.itemType.kind&&typeof r.N=="number":r.kind===e.kind}const ac=.96422,sn=.82521,yo=4/29,vt=6/29,lc=3*vt*vt,cc=vt*vt*vt,Ps=Math.PI/180,uc=180/Math.PI;function hc(r){return(r%=360)<0&&(r+=360),r}function dc([r,e,i,s]){let o,l;const u=Na((.2225045*(r=vo(r))+.7168786*(e=vo(e))+.0606169*(i=vo(i)))/1);r===e&&e===i?o=l=u:(o=Na((.4360747*r+.3850649*e+.1430804*i)/ac),l=Na((.0139322*r+.0971045*e+.7141733*i)/sn));const d=116*u-16;return[d<0?0:d,500*(o-u),200*(u-l),s]}function vo(r){return r<=.04045?r/12.92:Math.pow((r+.055)/1.055,2.4)}function Na(r){return r>cc?Math.pow(r,1/3):r/lc+yo}function Ua([r,e,i,s]){let o=(r+16)/116,l=isNaN(e)?o:o+e/500,u=isNaN(i)?o:o-i/200;return o=1*$a(o),l=ac*$a(l),u=sn*$a(u),[Ga(3.1338561*l-1.6168667*o-.4906146*u),Ga(-.9787684*l+1.9161415*o+.033454*u),Ga(.0719453*l-.2289914*o+1.4052427*u),s]}function Ga(r){return(r=r<=.00304?12.92*r:1.055*Math.pow(r,1/2.4)-.055)<0?0:r>1?1:r}function $a(r){return r>vt?r*r*r:lc*(r-yo)}const Lu=Object.hasOwn||function(r,e){return Object.prototype.hasOwnProperty.call(r,e)};function Is(r,e){return Lu(r,e)?r[e]:void 0}function xo(r){return parseInt(r.padEnd(2,r),16)/255}function pc(r,e){return Vn(e?r/100:r,0,1)}function Vn(r,e,i){return Math.min(Math.max(e,r),i)}function Za(r){return!r.some(Number.isNaN)}const Ms={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function Ar(r,e,i){return r+i*(e-r)}function jn(r,e,i){return r.map(((s,o)=>Ar(s,e[o],i)))}class Ve{constructor(e,i,s,o=1,l=!0){this.r=e,this.g=i,this.b=s,this.a=o,l||(this.r*=o,this.g*=o,this.b*=o,o||this.overwriteGetter("rgb",[e,i,s,o]))}static parse(e){if(e instanceof Ve)return e;if(typeof e!="string")return;const i=(function(s){if((s=s.toLowerCase().trim())==="transparent")return[0,0,0,0];const o=Is(Ms,s);if(o){const[u,d,g]=o;return[u/255,d/255,g/255,1]}if(s.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(s)){const u=s.length<6?1:2;let d=1;return[xo(s.slice(d,d+=u)),xo(s.slice(d,d+=u)),xo(s.slice(d,d+=u)),xo(s.slice(d,d+u)||"ff")]}if(s.startsWith("rgb")){const u=s.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(u){const[d,g,m,v,_,T,b,I,M,A,D,F]=u,k=[v||" ",b||" ",A].join("");if(k===" "||k===" /"||k===",,"||k===",,,"){const L=[m,T,M].join(""),O=L==="%%%"?100:L===""?255:0;if(O){const j=[Vn(+g/O,0,1),Vn(+_/O,0,1),Vn(+I/O,0,1),D?pc(+D,F):1];if(Za(j))return j}}return}}const l=s.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(l){const[u,d,g,m,v,_,T,b,I]=l,M=[g||" ",v||" ",T].join("");if(M===" "||M===" /"||M===",,"||M===",,,"){const A=[+d,Vn(+m,0,100),Vn(+_,0,100),b?pc(+b,I):1];if(Za(A))return(function([D,F,k,L]){function O(j){const Y=(j+D/30)%12,J=F*Math.min(k,1-k);return k-J*Math.max(-1,Math.min(Y-3,9-Y,1))}return D=hc(D),F/=100,k/=100,[O(0),O(8),O(4),L]})(A)}}})(e);return i?new Ve(...i,!1):void 0}get rgb(){const{r:e,g:i,b:s,a:o}=this,l=o||1/0;return this.overwriteGetter("rgb",[e/l,i/l,s/l,o])}get hcl(){return this.overwriteGetter("hcl",(function(e){const[i,s,o,l]=dc(e),u=Math.sqrt(s*s+o*o);return[Math.round(1e4*u)?hc(Math.atan2(o,s)*uc):NaN,u,i,l]})(this.rgb))}get lab(){return this.overwriteGetter("lab",dc(this.rgb))}overwriteGetter(e,i){return Object.defineProperty(this,e,{value:i}),i}toString(){const[e,i,s,o]=this.rgb;return`rgba(${[e,i,s].map((l=>Math.round(255*l))).join(",")},${o})`}static interpolate(e,i,s,o="rgb"){switch(o){case"rgb":{const[l,u,d,g]=jn(e.rgb,i.rgb,s);return new Ve(l,u,d,g,!1)}case"hcl":{const[l,u,d,g]=e.hcl,[m,v,_,T]=i.hcl;let b,I;if(isNaN(l)||isNaN(m))isNaN(l)?isNaN(m)?b=NaN:(b=m,d!==1&&d!==0||(I=v)):(b=l,_!==1&&_!==0||(I=u));else{let k=m-l;m>l&&k>180?k-=360:m<l&&l-m>180&&(k+=360),b=l+s*k}const[M,A,D,F]=(function([k,L,O,j]){return k=isNaN(k)?0:k*Ps,Ua([O,Math.cos(k)*L,Math.sin(k)*L,j])})([b,I??Ar(u,v,s),Ar(d,_,s),Ar(g,T,s)]);return new Ve(M,A,D,F,!1)}case"lab":{const[l,u,d,g]=Ua(jn(e.lab,i.lab,s));return new Ve(l,u,d,g,!1)}}}}Ve.black=new Ve(0,0,0,1),Ve.white=new Ve(1,1,1,1),Ve.transparent=new Ve(0,0,0,0),Ve.red=new Ve(1,0,0,1);class qa{constructor(e,i,s){this.sensitivity=e?i?"variant":"case":i?"accent":"base",this.locale=s,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,i){return this.collator.compare(e,i)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}const Bu=["bottom","center","top"];class Wa{constructor(e,i,s,o,l,u){this.text=e,this.image=i,this.scale=s,this.fontStack=o,this.textColor=l,this.verticalAlign=u}}class _i{constructor(e){this.sections=e}static fromString(e){return new _i([new Wa(e,null,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some((e=>e.text.length!==0||e.image&&e.image.name.length!==0))}static factory(e){return e instanceof _i?e:_i.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map((e=>e.text)).join("")}}class Kt{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Kt)return e;if(typeof e=="number")return new Kt([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(const i of e)if(typeof i!="number")return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]]}return new Kt(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,i,s){return new Kt(jn(e.values,i.values,s))}}class dt{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof dt)return e;if(typeof e=="number")return new dt([e]);if(Array.isArray(e)){for(const i of e)if(typeof i!="number")return;return new dt(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,i,s){return new dt(jn(e.values,i.values,s))}}class Re{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Re)return e;if(typeof e=="string"){const s=Ve.parse(e);return s?new Re([s]):void 0}if(!Array.isArray(e))return;const i=[];for(const s of e){if(typeof s!="string")return;const o=Ve.parse(s);if(!o)return;i.push(o)}return new Re(i)}toString(){return JSON.stringify(this.values)}static interpolate(e,i,s,o="rgb"){const l=[];if(e.values.length!=i.values.length)throw new Error(`colorArray: Arrays have mismatched length (${e.values.length} vs. ${i.values.length}), cannot interpolate.`);for(let u=0;u<e.values.length;u++)l.push(Ve.interpolate(e.values[u],i.values[u],s,o));return new Re(l)}}class st extends Error{constructor(e){super(e),this.name="RuntimeError"}toJSON(){return this.message}}const Dr=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class oi{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof oi)return e;if(Array.isArray(e)&&!(e.length<1)&&e.length%2==0){for(let i=0;i<e.length;i+=2){const s=e[i],o=e[i+1];if(typeof s!="string"||!Dr.has(s)||!Array.isArray(o)||o.length!==2||typeof o[0]!="number"||typeof o[1]!="number")return}return new oi(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,i,s){const o=e.values,l=i.values;if(o.length!==l.length)throw new st(`Cannot interpolate values of different length. from: ${e.toString()}, to: ${i.toString()}`);const u=[];for(let d=0;d<o.length;d+=2){if(o[d]!==l[d])throw new st(`Cannot interpolate values containing mismatched anchors. from[${d}]: ${o[d]}, to[${d}]: ${l[d]}`);u.push(o[d]);const[g,m]=o[d+1],[v,_]=l[d+1];u.push([Ar(g,v,s),Ar(m,_,s)])}return new oi(u)}}class Ii{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new Ii({name:e,available:!1}):null}}class ai{constructor(e,i,s){this.from=e,this.to=i,this.transition=s}static interpolate(e,i,s){return new ai(e,i,s)}static parse(e){return e instanceof ai?e:Array.isArray(e)&&e.length===3&&typeof e[0]=="string"&&typeof e[1]=="string"&&typeof e[2]=="number"?new ai(e[0],e[1],e[2]):typeof e=="object"&&typeof e.from=="string"&&typeof e.to=="string"&&typeof e.transition=="number"?new ai(e.from,e.to,e.transition):typeof e=="string"?new ai(e,e,1):void 0}}function Nn(r,e,i,s){return typeof r=="number"&&r>=0&&r<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof i=="number"&&i>=0&&i<=255?s===void 0||typeof s=="number"&&s>=0&&s<=1?null:`Invalid rgba value [${[r,e,i,s].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof s=="number"?[r,e,i,s]:[r,e,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function zr(r){if(r===null||typeof r=="string"||typeof r=="boolean"||typeof r=="number"||r instanceof ai||r instanceof Ve||r instanceof qa||r instanceof _i||r instanceof Kt||r instanceof dt||r instanceof Re||r instanceof oi||r instanceof Ii)return!0;if(Array.isArray(r)){for(const e of r)if(!zr(e))return!1;return!0}if(typeof r=="object"){for(const e in r)if(!zr(r[e]))return!1;return!0}return!1}function Tt(r){if(r===null)return Cr;if(typeof r=="string")return Fe;if(typeof r=="boolean")return je;if(typeof r=="number")return be;if(r instanceof Ve)return Pi;if(r instanceof ai)return mo;if(r instanceof qa)return xs;if(r instanceof _i)return bs;if(r instanceof Kt)return go;if(r instanceof dt)return ws;if(r instanceof Re)return Ln;if(r instanceof oi)return Ts;if(r instanceof Ii)return Bn;if(Array.isArray(r)){const e=r.length;let i;for(const s of r){const o=Tt(s);if(i){if(i===o)continue;i=Be;break}i=o}return Wt(i||Be,e)}return lr}function on(r){const e=typeof r;return r===null?"":e==="string"||e==="number"||e==="boolean"?String(r):r instanceof Ve||r instanceof ai||r instanceof _i||r instanceof Kt||r instanceof dt||r instanceof Re||r instanceof oi||r instanceof Ii?r.toString():JSON.stringify(r)}class er{constructor(e,i){this.type=e,this.value=i}static parse(e,i){if(e.length!==2)return i.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!zr(e[1]))return i.error("invalid value");const s=e[1];let o=Tt(s);const l=i.expectedType;return o.kind!=="array"||o.N!==0||!l||l.kind!=="array"||typeof l.N=="number"&&l.N!==0||(o=l),new er(o,s)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}const bo={string:Fe,number:be,boolean:je,object:lr};class yi{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");let s,o=1;const l=e[0];if(l==="array"){let d,g;if(e.length>2){const m=e[1];if(typeof m!="string"||!(m in bo)||m==="object")return i.error('The item type argument of "array" must be one of string, number, boolean',1);d=bo[m],o++}else d=Be;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return i.error('The length argument to "array" must be a positive integer literal',2);g=e[2],o++}s=Wt(d,g)}else{if(!bo[l])throw new Error(`Types doesn't contain name = ${l}`);s=bo[l]}const u=[];for(;o<e.length;o++){const d=i.parse(e[o],o,Be);if(!d)return null;u.push(d)}return new yi(s,u)}evaluate(e){for(let i=0;i<this.args.length;i++){const s=this.args[i].evaluate(e);if(!On(this.type,Tt(s)))return s;if(i===this.args.length-1)throw new st(`Expected value to be of type ${tt(this.type)}, but found ${tt(Tt(s))} instead.`)}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}const an={"to-boolean":je,"to-color":Pi,"to-number":be,"to-string":Fe};class cr{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");const s=e[0];if(!an[s])throw new Error(`Can't parse ${s} as it is not part of the known types`);if((s==="to-boolean"||s==="to-string")&&e.length!==2)return i.error("Expected one argument.");const o=an[s],l=[];for(let u=1;u<e.length;u++){const d=i.parse(e[u],u,Be);if(!d)return null;l.push(d)}return new cr(o,l)}evaluate(e){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(e);case"color":{let i,s;for(const o of this.args){if(i=o.evaluate(e),s=null,i instanceof Ve)return i;if(typeof i=="string"){const l=e.parseColor(i);if(l)return l}else if(Array.isArray(i)&&(s=i.length<3||i.length>4?`Invalid rgba value ${JSON.stringify(i)}: expected an array containing either three or four numeric values.`:Nn(i[0],i[1],i[2],i[3]),!s))return new Ve(i[0]/255,i[1]/255,i[2]/255,i[3])}throw new st(s||`Could not parse color from value '${typeof i=="string"?i:JSON.stringify(i)}'`)}case"padding":{let i;for(const s of this.args){i=s.evaluate(e);const o=Kt.parse(i);if(o)return o}throw new st(`Could not parse padding from value '${typeof i=="string"?i:JSON.stringify(i)}'`)}case"numberArray":{let i;for(const s of this.args){i=s.evaluate(e);const o=dt.parse(i);if(o)return o}throw new st(`Could not parse numberArray from value '${typeof i=="string"?i:JSON.stringify(i)}'`)}case"colorArray":{let i;for(const s of this.args){i=s.evaluate(e);const o=Re.parse(i);if(o)return o}throw new st(`Could not parse colorArray from value '${typeof i=="string"?i:JSON.stringify(i)}'`)}case"variableAnchorOffsetCollection":{let i;for(const s of this.args){i=s.evaluate(e);const o=oi.parse(i);if(o)return o}throw new st(`Could not parse variableAnchorOffsetCollection from value '${typeof i=="string"?i:JSON.stringify(i)}'`)}case"number":{let i=null;for(const s of this.args){if(i=s.evaluate(e),i===null)return 0;const o=Number(i);if(!isNaN(o))return o}throw new st(`Could not convert ${JSON.stringify(i)} to number.`)}case"formatted":return _i.fromString(on(this.args[0].evaluate(e)));case"resolvedImage":return Ii.fromString(on(this.args[0].evaluate(e)));case"projectionDefinition":return this.args[0].evaluate(e);default:return on(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}const fc=["Unknown","Point","LineString","Polygon"];class Ha{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?fc[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(e){let i=this._parseColorCache.get(e);return i||(i=Ve.parse(e),this._parseColorCache.set(e,i)),i}}class ln{constructor(e,i,s=[],o,l=new ja,u=[]){this.registry=e,this.path=s,this.key=s.map((d=>`[${d}]`)).join(""),this.scope=l,this.errors=u,this.expectedType=o,this._isConstant=i}parse(e,i,s,o,l={}){return i?this.concat(i,s,o)._parse(e,l):this._parse(e,l)}_parse(e,i){function s(o,l,u){return u==="assert"?new yi(l,[o]):u==="coerce"?new cr(l,[o]):o}if(e!==null&&typeof e!="string"&&typeof e!="boolean"&&typeof e!="number"||(e=["literal",e]),Array.isArray(e)){if(e.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const o=e[0];if(typeof o!="string")return this.error(`Expression name must be a string, but found ${typeof o} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const l=this.registry[o];if(l){let u=l.parse(e,this);if(!u)return null;if(this.expectedType){const d=this.expectedType,g=u.type;if(d.kind!=="string"&&d.kind!=="number"&&d.kind!=="boolean"&&d.kind!=="object"&&d.kind!=="array"||g.kind!=="value"){if(d.kind==="projectionDefinition"&&["string","array"].includes(g.kind)||["color","formatted","resolvedImage"].includes(d.kind)&&["value","string"].includes(g.kind)||["padding","numberArray"].includes(d.kind)&&["value","number","array"].includes(g.kind)||d.kind==="colorArray"&&["value","string","array"].includes(g.kind)||d.kind==="variableAnchorOffsetCollection"&&["value","array"].includes(g.kind))u=s(u,d,i.typeAnnotation||"coerce");else if(this.checkSubtype(d,g))return null}else u=s(u,d,i.typeAnnotation||"assert")}if(!(u instanceof er)&&u.type.kind!=="resolvedImage"&&this._isConstant(u)){const d=new Ha;try{u=new er(u.type,u.evaluate(d))}catch(g){return this.error(g.message),null}}return u}return this.error(`Unknown expression "${o}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(e===void 0?"'undefined' value invalid. Use null instead.":typeof e=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,i,s){const o=typeof e=="number"?this.path.concat(e):this.path,l=s?this.scope.concat(s):this.scope;return new ln(this.registry,this._isConstant,o,i||null,l,this.errors)}error(e,...i){const s=`${this.key}${i.map((o=>`[${o}]`)).join("")}`;this.errors.push(new qt(s,e))}checkSubtype(e,i){const s=On(e,i);return s&&this.error(s),s}}class ot{constructor(e,i){this.type=i.type,this.bindings=[].concat(e),this.result=i}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const i of this.bindings)e(i[1]);e(this.result)}static parse(e,i){if(e.length<4)return i.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const s=[];for(let l=1;l<e.length-1;l+=2){const u=e[l];if(typeof u!="string")return i.error(`Expected string, but found ${typeof u} instead.`,l);if(/[^a-zA-Z0-9_]/.test(u))return i.error("Variable names must contain only alphanumeric characters or '_'.",l);const d=i.parse(e[l+1],l+1);if(!d)return null;s.push([u,d])}const o=i.parse(e[e.length-1],e.length-1,i.expectedType,s);return o?new ot(s,o):null}outputDefined(){return this.result.outputDefined()}}class Un{constructor(e,i){this.type=i.type,this.name=e,this.boundExpression=i}static parse(e,i){if(e.length!==2||typeof e[1]!="string")return i.error("'var' expression requires exactly one string literal argument.");const s=e[1];return i.scope.has(s)?new Un(s,i.scope.get(s)):i.error(`Unknown variable "${s}". Make sure "${s}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}}class Ze{constructor(e,i,s){this.type=e,this.index=i,this.input=s}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const s=i.parse(e[1],1,be),o=i.parse(e[2],2,Wt(i.expectedType||Be));return s&&o?new Ze(o.type.itemType,s,o):null}evaluate(e){const i=this.index.evaluate(e),s=this.input.evaluate(e);if(i<0)throw new st(`Array index out of bounds: ${i} < 0.`);if(i>=s.length)throw new st(`Array index out of bounds: ${i} > ${s.length-1}.`);if(i!==Math.floor(i))throw new st(`Array index must be an integer, but found ${i} instead.`);return s[i]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class Oe{constructor(e,i){this.type=je,this.needle=e,this.haystack=i}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const s=i.parse(e[1],1,Be),o=i.parse(e[2],2,Be);return s&&o?Ss(s.type,[je,Fe,be,Cr,Be])?new Oe(s,o):i.error(`Expected first argument to be of type boolean, string, number or null, but found ${tt(s.type)} instead`):null}evaluate(e){const i=this.needle.evaluate(e),s=this.haystack.evaluate(e);if(!s)return!1;if(!nn(i,["boolean","string","number","null"]))throw new st(`Expected first argument to be of type boolean, string, number or null, but found ${tt(Tt(i))} instead.`);if(!nn(s,["string","array"]))throw new st(`Expected second argument to be of type array or string, but found ${tt(Tt(s))} instead.`);return s.indexOf(i)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class Gn{constructor(e,i,s){this.type=be,this.needle=e,this.haystack=i,this.fromIndex=s}static parse(e,i){if(e.length<=2||e.length>=5)return i.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);const s=i.parse(e[1],1,Be),o=i.parse(e[2],2,Be);if(!s||!o)return null;if(!Ss(s.type,[je,Fe,be,Cr,Be]))return i.error(`Expected first argument to be of type boolean, string, number or null, but found ${tt(s.type)} instead`);if(e.length===4){const l=i.parse(e[3],3,be);return l?new Gn(s,o,l):null}return new Gn(s,o)}evaluate(e){const i=this.needle.evaluate(e),s=this.haystack.evaluate(e);if(!nn(i,["boolean","string","number","null"]))throw new st(`Expected first argument to be of type boolean, string, number or null, but found ${tt(Tt(i))} instead.`);let o;if(this.fromIndex&&(o=this.fromIndex.evaluate(e)),nn(s,["string"])){const l=s.indexOf(i,o);return l===-1?-1:[...s.slice(0,l)].length}if(nn(s,["array"]))return s.indexOf(i,o);throw new st(`Expected second argument to be of type array or string, but found ${tt(Tt(s))} instead.`)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class We{constructor(e,i,s,o,l,u){this.inputType=e,this.type=i,this.input=s,this.cases=o,this.outputs=l,this.otherwise=u}static parse(e,i){if(e.length<5)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return i.error("Expected an even number of arguments.");let s,o;i.expectedType&&i.expectedType.kind!=="value"&&(o=i.expectedType);const l={},u=[];for(let m=2;m<e.length-1;m+=2){let v=e[m];const _=e[m+1];Array.isArray(v)||(v=[v]);const T=i.concat(m);if(v.length===0)return T.error("Expected at least one branch label.");for(const I of v){if(typeof I!="number"&&typeof I!="string")return T.error("Branch labels must be numbers or strings.");if(typeof I=="number"&&Math.abs(I)>Number.MAX_SAFE_INTEGER)return T.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof I=="number"&&Math.floor(I)!==I)return T.error("Numeric branch labels must be integer values.");if(s){if(T.checkSubtype(s,Tt(I)))return null}else s=Tt(I);if(l[String(I)]!==void 0)return T.error("Branch labels must be unique.");l[String(I)]=u.length}const b=i.parse(_,m,o);if(!b)return null;o=o||b.type,u.push(b)}const d=i.parse(e[1],1,Be);if(!d)return null;const g=i.parse(e[e.length-1],e.length-1,o);return g?d.type.kind!=="value"&&i.concat(1).checkSubtype(s,d.type)?null:new We(s,o,d,l,u,g):null}evaluate(e){const i=this.input.evaluate(e);return(Tt(i)===this.inputType&&this.outputs[this.cases[i]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))&&this.otherwise.outputDefined()}}class Hi{constructor(e,i,s){this.type=e,this.branches=i,this.otherwise=s}static parse(e,i){if(e.length<4)return i.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return i.error("Expected an odd number of arguments.");let s;i.expectedType&&i.expectedType.kind!=="value"&&(s=i.expectedType);const o=[];for(let u=1;u<e.length-1;u+=2){const d=i.parse(e[u],u,je);if(!d)return null;const g=i.parse(e[u+1],u+1,s);if(!g)return null;o.push([d,g]),s=s||g.type}const l=i.parse(e[e.length-1],e.length-1,s);if(!l)return null;if(!s)throw new Error("Can't infer output type");return new Hi(s,o,l)}evaluate(e){for(const[i,s]of this.branches)if(i.evaluate(e))return s.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[i,s]of this.branches)e(i),e(s);e(this.otherwise)}outputDefined(){return this.branches.every((([e,i])=>i.outputDefined()))&&this.otherwise.outputDefined()}}class $n{constructor(e,i,s,o){this.type=e,this.input=i,this.beginIndex=s,this.endIndex=o}static parse(e,i){if(e.length<=2||e.length>=5)return i.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);const s=i.parse(e[1],1,Be),o=i.parse(e[2],2,be);if(!s||!o)return null;if(!Ss(s.type,[Wt(Be),Fe,Be]))return i.error(`Expected first argument to be of type array or string, but found ${tt(s.type)} instead`);if(e.length===4){const l=i.parse(e[3],3,be);return l?new $n(s.type,s,o,l):null}return new $n(s.type,s,o)}evaluate(e){const i=this.input.evaluate(e),s=this.beginIndex.evaluate(e);let o;if(this.endIndex&&(o=this.endIndex.evaluate(e)),nn(i,["string"]))return[...i].slice(s,o).join("");if(nn(i,["array"]))return i.slice(s,o);throw new st(`Expected first argument to be of type array or string, but found ${tt(Tt(i))} instead.`)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function cn(r,e){const i=r.length-1;let s,o,l=0,u=i,d=0;for(;l<=u;)if(d=Math.floor((l+u)/2),s=r[d],o=r[d+1],s<=e){if(d===i||e<o)return d;l=d+1}else{if(!(s>e))throw new st("Input is not a number.");u=d-1}return 0}class Zn{constructor(e,i,s){this.type=e,this.input=i,this.labels=[],this.outputs=[];for(const[o,l]of s)this.labels.push(o),this.outputs.push(l)}static parse(e,i){if(e.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return i.error("Expected an even number of arguments.");const s=i.parse(e[1],1,be);if(!s)return null;const o=[];let l=null;i.expectedType&&i.expectedType.kind!=="value"&&(l=i.expectedType);for(let u=1;u<e.length;u+=2){const d=u===1?-1/0:e[u],g=e[u+1],m=u,v=u+1;if(typeof d!="number")return i.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',m);if(o.length&&o[o.length-1][0]>=d)return i.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',m);const _=i.parse(g,v,l);if(!_)return null;l=l||_.type,o.push([d,_])}return new Zn(l,s,o)}evaluate(e){const i=this.labels,s=this.outputs;if(i.length===1)return s[0].evaluate(e);const o=this.input.evaluate(e);if(o<=i[0])return s[0].evaluate(e);const l=i.length;return o>=i[l-1]?s[l-1].evaluate(e):s[cn(i,o)].evaluate(e)}eachChild(e){e(this.input);for(const i of this.outputs)e(i)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}}function Xa(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var wo,mc,gc=(function(){if(mc)return wo;function r(e,i,s,o){this.cx=3*e,this.bx=3*(s-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*i,this.by=3*(o-i)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=i,this.p2x=s,this.p2y=o}return mc=1,wo=r,r.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,i){if(i===void 0&&(i=1e-6),e<0)return 0;if(e>1)return 1;for(var s=e,o=0;o<8;o++){var l=this.sampleCurveX(s)-e;if(Math.abs(l)<i)return s;var u=this.sampleCurveDerivativeX(s);if(Math.abs(u)<1e-6)break;s-=l/u}var d=0,g=1;for(s=e,o=0;o<20&&(l=this.sampleCurveX(s),!(Math.abs(l-e)<i));o++)e>l?d=s:g=s,s=.5*(g-d)+d;return s},solve:function(e,i){return this.sampleCurveY(this.solveCurveX(e,i))}},wo})(),_c=Xa(gc);class It{constructor(e,i,s,o,l){this.type=e,this.operator=i,this.interpolation=s,this.input=o,this.labels=[],this.outputs=[];for(const[u,d]of l)this.labels.push(u),this.outputs.push(d)}static interpolationFactor(e,i,s,o){let l=0;if(e.name==="exponential")l=Lt(i,e.base,s,o);else if(e.name==="linear")l=Lt(i,1,s,o);else if(e.name==="cubic-bezier"){const u=e.controlPoints;l=new _c(u[0],u[1],u[2],u[3]).solve(Lt(i,1,s,o))}return l}static parse(e,i){let[s,o,l,...u]=e;if(!Array.isArray(o)||o.length===0)return i.error("Expected an interpolation type expression.",1);if(o[0]==="linear")o={name:"linear"};else if(o[0]==="exponential"){const m=o[1];if(typeof m!="number")return i.error("Exponential interpolation requires a numeric base.",1,1);o={name:"exponential",base:m}}else{if(o[0]!=="cubic-bezier")return i.error(`Unknown interpolation type ${String(o[0])}`,1,0);{const m=o.slice(1);if(m.length!==4||m.some((v=>typeof v!="number"||v<0||v>1)))return i.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);o={name:"cubic-bezier",controlPoints:m}}}if(e.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return i.error("Expected an even number of arguments.");if(l=i.parse(l,2,be),!l)return null;const d=[];let g=null;s!=="interpolate-hcl"&&s!=="interpolate-lab"||i.expectedType==Ln?i.expectedType&&i.expectedType.kind!=="value"&&(g=i.expectedType):g=Pi;for(let m=0;m<u.length;m+=2){const v=u[m],_=u[m+1],T=m+3,b=m+4;if(typeof v!="number")return i.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',T);if(d.length&&d[d.length-1][0]>=v)return i.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',T);const I=i.parse(_,b,g);if(!I)return null;g=g||I.type,d.push([v,I])}return Wi(g,be)||Wi(g,mo)||Wi(g,Pi)||Wi(g,go)||Wi(g,ws)||Wi(g,Ln)||Wi(g,Ts)||Wi(g,Wt(be))?new It(g,s,o,l,d):i.error(`Type ${tt(g)} is not interpolatable.`)}evaluate(e){const i=this.labels,s=this.outputs;if(i.length===1)return s[0].evaluate(e);const o=this.input.evaluate(e);if(o<=i[0])return s[0].evaluate(e);const l=i.length;if(o>=i[l-1])return s[l-1].evaluate(e);const u=cn(i,o),d=It.interpolationFactor(this.interpolation,o,i[u],i[u+1]),g=s[u].evaluate(e),m=s[u+1].evaluate(e);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return Ar(g,m,d);case"color":return Ve.interpolate(g,m,d);case"padding":return Kt.interpolate(g,m,d);case"colorArray":return Re.interpolate(g,m,d);case"numberArray":return dt.interpolate(g,m,d);case"variableAnchorOffsetCollection":return oi.interpolate(g,m,d);case"array":return jn(g,m,d);case"projectionDefinition":return ai.interpolate(g,m,d)}case"interpolate-hcl":switch(this.type.kind){case"color":return Ve.interpolate(g,m,d,"hcl");case"colorArray":return Re.interpolate(g,m,d,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return Ve.interpolate(g,m,d,"lab");case"colorArray":return Re.interpolate(g,m,d,"lab")}}}eachChild(e){e(this.input);for(const i of this.outputs)e(i)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}}function Lt(r,e,i,s){const o=s-i,l=r-i;return o===0?0:e===1?l/o:(Math.pow(e,l)-1)/(Math.pow(e,o)-1)}const Mi={color:Ve.interpolate,number:Ar,padding:Kt.interpolate,numberArray:dt.interpolate,colorArray:Re.interpolate,variableAnchorOffsetCollection:oi.interpolate,array:jn};class Es{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");let s=null;const o=i.expectedType;o&&o.kind!=="value"&&(s=o);const l=[];for(const d of e.slice(1)){const g=i.parse(d,1+l.length,s,void 0,{typeAnnotation:"omit"});if(!g)return null;s=s||g.type,l.push(g)}if(!s)throw new Error("No output type");const u=o&&l.some((d=>On(o,d.type)));return new Es(u?Be:s,l)}evaluate(e){let i,s=null,o=0;for(const l of this.args)if(o++,s=l.evaluate(e),s&&s instanceof Ii&&!s.available&&(i||(i=s.name),s=null,o===this.args.length&&(s=i)),s!==null)break;return s}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}function Cs(r,e){return r==="=="||r==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function kt(r,e,i,s){return s.compare(e,i)===0}function un(r,e,i){const s=r!=="=="&&r!=="!=";return class Nf{constructor(l,u,d){this.type=je,this.lhs=l,this.rhs=u,this.collator=d,this.hasUntypedArgument=l.type.kind==="value"||u.type.kind==="value"}static parse(l,u){if(l.length!==3&&l.length!==4)return u.error("Expected two or three arguments.");const d=l[0];let g=u.parse(l[1],1,Be);if(!g)return null;if(!Cs(d,g.type))return u.concat(1).error(`"${d}" comparisons are not supported for type '${tt(g.type)}'.`);let m=u.parse(l[2],2,Be);if(!m)return null;if(!Cs(d,m.type))return u.concat(2).error(`"${d}" comparisons are not supported for type '${tt(m.type)}'.`);if(g.type.kind!==m.type.kind&&g.type.kind!=="value"&&m.type.kind!=="value")return u.error(`Cannot compare types '${tt(g.type)}' and '${tt(m.type)}'.`);s&&(g.type.kind==="value"&&m.type.kind!=="value"?g=new yi(m.type,[g]):g.type.kind!=="value"&&m.type.kind==="value"&&(m=new yi(g.type,[m])));let v=null;if(l.length===4){if(g.type.kind!=="string"&&m.type.kind!=="string"&&g.type.kind!=="value"&&m.type.kind!=="value")return u.error("Cannot use collator to compare non-string types.");if(v=u.parse(l[3],3,xs),!v)return null}return new Nf(g,m,v)}evaluate(l){const u=this.lhs.evaluate(l),d=this.rhs.evaluate(l);if(s&&this.hasUntypedArgument){const g=Tt(u),m=Tt(d);if(g.kind!==m.kind||g.kind!=="string"&&g.kind!=="number")throw new st(`Expected arguments for "${r}" to be (string, string) or (number, number), but found (${g.kind}, ${m.kind}) instead.`)}if(this.collator&&!s&&this.hasUntypedArgument){const g=Tt(u),m=Tt(d);if(g.kind!=="string"||m.kind!=="string")return e(l,u,d)}return this.collator?i(l,u,d,this.collator.evaluate(l)):e(l,u,d)}eachChild(l){l(this.lhs),l(this.rhs),this.collator&&l(this.collator)}outputDefined(){return!0}}}const Ya=un("==",(function(r,e,i){return e===i}),kt),yc=un("!=",(function(r,e,i){return e!==i}),(function(r,e,i,s){return!kt(0,e,i,s)})),Ou=un("<",(function(r,e,i){return e<i}),(function(r,e,i,s){return s.compare(e,i)<0})),qn=un(">",(function(r,e,i){return e>i}),(function(r,e,i,s){return s.compare(e,i)>0})),To=un("<=",(function(r,e,i){return e<=i}),(function(r,e,i,s){return s.compare(e,i)<=0})),Ka=un(">=",(function(r,e,i){return e>=i}),(function(r,e,i,s){return s.compare(e,i)>=0}));class So{constructor(e,i,s){this.type=xs,this.locale=s,this.caseSensitive=e,this.diacriticSensitive=i}static parse(e,i){if(e.length!==2)return i.error("Expected one argument.");const s=e[1];if(typeof s!="object"||Array.isArray(s))return i.error("Collator options argument must be an object.");const o=i.parse(s["case-sensitive"]!==void 0&&s["case-sensitive"],1,je);if(!o)return null;const l=i.parse(s["diacritic-sensitive"]!==void 0&&s["diacritic-sensitive"],1,je);if(!l)return null;let u=null;return s.locale&&(u=i.parse(s.locale,1,Fe),!u)?null:new So(o,l,u)}evaluate(e){return new qa(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}}class Po{constructor(e,i,s,o,l,u){this.type=Fe,this.number=e,this.locale=i,this.currency=s,this.unit=o,this.minFractionDigits=l,this.maxFractionDigits=u}static parse(e,i){if(e.length!==3)return i.error("Expected two arguments.");const s=i.parse(e[1],1,be);if(!s)return null;const o=e[2];if(typeof o!="object"||Array.isArray(o))return i.error("NumberFormat options argument must be an object.");let l=null;if(o.locale&&(l=i.parse(o.locale,1,Fe),!l))return null;let u=null;if(o.currency&&(u=i.parse(o.currency,1,Fe),!u))return null;let d=null;if(o.unit&&(d=i.parse(o.unit,1,Fe),!d))return null;if(u&&d)return i.error("NumberFormat options `currency` and `unit` are mutually exclusive");let g=null;if(o["min-fraction-digits"]&&(g=i.parse(o["min-fraction-digits"],1,be),!g))return null;let m=null;return o["max-fraction-digits"]&&(m=i.parse(o["max-fraction-digits"],1,be),!m)?null:new Po(s,l,u,d,g,m)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":this.unit?"unit":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,unit:this.unit?this.unit.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.unit&&e(this.unit),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}}class hn{constructor(e){this.type=bs,this.sections=e}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");const s=e[1];if(!Array.isArray(s)&&typeof s=="object")return i.error("First argument must be an image or text section.");const o=[];let l=!1;for(let u=1;u<=e.length-1;++u){const d=e[u];if(l&&typeof d=="object"&&!Array.isArray(d)){l=!1;let g=null;if(d["font-scale"]&&(g=i.parse(d["font-scale"],1,be),!g))return null;let m=null;if(d["text-font"]&&(m=i.parse(d["text-font"],1,Wt(Fe)),!m))return null;let v=null;if(d["text-color"]&&(v=i.parse(d["text-color"],1,Pi),!v))return null;let _=null;if(d["vertical-align"]){if(typeof d["vertical-align"]=="string"&&!Bu.includes(d["vertical-align"]))return i.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${d["vertical-align"]}' instead.`);if(_=i.parse(d["vertical-align"],1,Fe),!_)return null}const T=o[o.length-1];T.scale=g,T.font=m,T.textColor=v,T.verticalAlign=_}else{const g=i.parse(e[u],1,Be);if(!g)return null;const m=g.type.kind;if(m!=="string"&&m!=="value"&&m!=="null"&&m!=="resolvedImage")return i.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");l=!0,o.push({content:g,scale:null,font:null,textColor:null,verticalAlign:null})}}return new hn(o)}evaluate(e){return new _i(this.sections.map((i=>{const s=i.content.evaluate(e);return Tt(s)===Bn?new Wa("",s,null,null,null,i.verticalAlign?i.verticalAlign.evaluate(e):null):new Wa(on(s),null,i.scale?i.scale.evaluate(e):null,i.font?i.font.evaluate(e).join(","):null,i.textColor?i.textColor.evaluate(e):null,i.verticalAlign?i.verticalAlign.evaluate(e):null)})))}eachChild(e){for(const i of this.sections)e(i.content),i.scale&&e(i.scale),i.font&&e(i.font),i.textColor&&e(i.textColor),i.verticalAlign&&e(i.verticalAlign)}outputDefined(){return!1}}class Wn{constructor(e){this.type=Bn,this.input=e}static parse(e,i){if(e.length!==2)return i.error("Expected two arguments.");const s=i.parse(e[1],1,Fe);return s?new Wn(s):i.error("No image name provided.")}evaluate(e){const i=this.input.evaluate(e),s=Ii.fromString(i);return s&&e.availableImages&&(s.available=e.availableImages.indexOf(i)>-1),s}eachChild(e){e(this.input)}outputDefined(){return!1}}class Ei{constructor(e){this.type=be,this.input=e}static parse(e,i){if(e.length!==2)return i.error(`Expected 1 argument, but found ${e.length-1} instead.`);const s=i.parse(e[1],1);return s?s.type.kind!=="array"&&s.type.kind!=="string"&&s.type.kind!=="value"?i.error(`Expected argument of type string or array, but found ${tt(s.type)} instead.`):new Ei(s):null}evaluate(e){const i=this.input.evaluate(e);if(typeof i=="string")return[...i].length;if(Array.isArray(i))return i.length;throw new st(`Expected value to be of type string or array, but found ${tt(Tt(i))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const Xi=8192;function Io(r,e){const i=(180+r[0])/360,s=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r[1]*Math.PI/360)))/360,o=Math.pow(2,e.z);return[Math.round(i*o*Xi),Math.round(s*o*Xi)]}function Ja(r,e){const i=Math.pow(2,e.z);return[(o=(r[0]/Xi+e.x)/i,360*o-180),(s=(r[1]/Xi+e.y)/i,360/Math.PI*Math.atan(Math.exp((180-360*s)*Math.PI/180))-90)];var s,o}function dn(r,e){r[0]=Math.min(r[0],e[0]),r[1]=Math.min(r[1],e[1]),r[2]=Math.max(r[2],e[0]),r[3]=Math.max(r[3],e[1])}function As(r,e){return!(r[0]<=e[0]||r[2]>=e[2]||r[1]<=e[1]||r[3]>=e[3])}function Vu(r,e,i){const s=r[0]-e[0],o=r[1]-e[1],l=r[0]-i[0],u=r[1]-i[1];return s*u-l*o==0&&s*l<=0&&o*u<=0}function Mo(r,e,i,s){return(o=[s[0]-i[0],s[1]-i[1]])[0]*(l=[e[0]-r[0],e[1]-r[1]])[1]-o[1]*l[0]!=0&&!(!xc(r,e,i,s)||!xc(i,s,r,e));var o,l}function ju(r,e,i){for(const s of i)for(let o=0;o<s.length-1;++o)if(Mo(r,e,s[o],s[o+1]))return!0;return!1}function ur(r,e,i=!1){let s=!1;for(const d of e)for(let g=0;g<d.length-1;g++){if(Vu(r,d[g],d[g+1]))return i;(l=d[g])[1]>(o=r)[1]!=(u=d[g+1])[1]>o[1]&&o[0]<(u[0]-l[0])*(o[1]-l[1])/(u[1]-l[1])+l[0]&&(s=!s)}var o,l,u;return s}function Nu(r,e){for(const i of e)if(ur(r,i))return!0;return!1}function Qa(r,e){for(const i of r)if(!ur(i,e))return!1;for(let i=0;i<r.length-1;++i)if(ju(r[i],r[i+1],e))return!1;return!0}function vc(r,e){for(const i of e)if(Qa(r,i))return!0;return!1}function xc(r,e,i,s){const o=s[0]-i[0],l=s[1]-i[1],u=(r[0]-i[0])*l-o*(r[1]-i[1]),d=(e[0]-i[0])*l-o*(e[1]-i[1]);return u>0&&d<0||u<0&&d>0}function Eo(r,e,i){const s=[];for(let o=0;o<r.length;o++){const l=[];for(let u=0;u<r[o].length;u++){const d=Io(r[o][u],i);dn(e,d),l.push(d)}s.push(l)}return s}function bc(r,e,i){const s=[];for(let o=0;o<r.length;o++){const l=Eo(r[o],e,i);s.push(l)}return s}function wc(r,e,i,s){if(r[0]<i[0]||r[0]>i[2]){const o=.5*s;let l=r[0]-i[0]>o?-s:i[0]-r[0]>o?s:0;l===0&&(l=r[0]-i[2]>o?-s:i[2]-r[0]>o?s:0),r[0]+=l}dn(e,r)}function Tc(r,e,i,s){const o=Math.pow(2,s.z)*Xi,l=[s.x*Xi,s.y*Xi],u=[];for(const d of r)for(const g of d){const m=[g.x+l[0],g.y+l[1]];wc(m,e,i,o),u.push(m)}return u}function Sc(r,e,i,s){const o=Math.pow(2,s.z)*Xi,l=[s.x*Xi,s.y*Xi],u=[];for(const g of r){const m=[];for(const v of g){const _=[v.x+l[0],v.y+l[1]];dn(e,_),m.push(_)}u.push(m)}if(e[2]-e[0]<=o/2){(d=e)[0]=d[1]=1/0,d[2]=d[3]=-1/0;for(const g of u)for(const m of g)wc(m,e,i,o)}var d;return u}class pn{constructor(e,i){this.type=je,this.geojson=e,this.geometries=i}static parse(e,i){if(e.length!==2)return i.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(zr(e[1])){const s=e[1];if(s.type==="FeatureCollection"){const o=[];for(const l of s.features){const{type:u,coordinates:d}=l.geometry;u==="Polygon"&&o.push(d),u==="MultiPolygon"&&o.push(...d)}if(o.length)return new pn(s,{type:"MultiPolygon",coordinates:o})}else if(s.type==="Feature"){const o=s.geometry.type;if(o==="Polygon"||o==="MultiPolygon")return new pn(s,s.geometry)}else if(s.type==="Polygon"||s.type==="MultiPolygon")return new pn(s,s)}return i.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return(function(i,s){const o=[1/0,1/0,-1/0,-1/0],l=[1/0,1/0,-1/0,-1/0],u=i.canonicalID();if(s.type==="Polygon"){const d=Eo(s.coordinates,l,u),g=Tc(i.geometry(),o,l,u);if(!As(o,l))return!1;for(const m of g)if(!ur(m,d))return!1}if(s.type==="MultiPolygon"){const d=bc(s.coordinates,l,u),g=Tc(i.geometry(),o,l,u);if(!As(o,l))return!1;for(const m of g)if(!Nu(m,d))return!1}return!0})(e,this.geometries);if(e.geometryType()==="LineString")return(function(i,s){const o=[1/0,1/0,-1/0,-1/0],l=[1/0,1/0,-1/0,-1/0],u=i.canonicalID();if(s.type==="Polygon"){const d=Eo(s.coordinates,l,u),g=Sc(i.geometry(),o,l,u);if(!As(o,l))return!1;for(const m of g)if(!Qa(m,d))return!1}if(s.type==="MultiPolygon"){const d=bc(s.coordinates,l,u),g=Sc(i.geometry(),o,l,u);if(!As(o,l))return!1;for(const m of g)if(!vc(m,d))return!1}return!0})(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let el=class{constructor(r=[],e=(i,s)=>i<s?-1:i>s?1:0){if(this.data=r,this.length=this.data.length,this.compare=e,this.length>0)for(let i=(this.length>>1)-1;i>=0;i--)this._down(i)}push(r){this.data.push(r),this._up(this.length++)}pop(){if(this.length===0)return;const r=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),r}peek(){return this.data[0]}_up(r){const{data:e,compare:i}=this,s=e[r];for(;r>0;){const o=r-1>>1,l=e[o];if(i(s,l)>=0)break;e[r]=l,r=o}e[r]=s}_down(r){const{data:e,compare:i}=this,s=this.length>>1,o=e[r];for(;r<s;){let l=1+(r<<1);const u=l+1;if(u<this.length&&i(e[u],e[l])<0&&(l=u),i(e[l],o)>=0)break;e[r]=e[l],r=l}e[r]=o}};function tl(r,e,i=0,s=r.length-1,o=Uu){for(;s>i;){if(s-i>600){const g=s-i+1,m=e-i+1,v=Math.log(g),_=.5*Math.exp(2*v/3),T=.5*Math.sqrt(v*_*(g-_)/g)*(m-g/2<0?-1:1);tl(r,e,Math.max(i,Math.floor(e-m*_/g+T)),Math.min(s,Math.floor(e+(g-m)*_/g+T)),o)}const l=r[e];let u=i,d=s;for(Hn(r,i,e),o(r[s],l)>0&&Hn(r,i,s);u<d;){for(Hn(r,u,d),u++,d--;o(r[u],l)<0;)u++;for(;o(r[d],l)>0;)d--}o(r[i],l)===0?Hn(r,i,d):(d++,Hn(r,d,s)),d<=e&&(i=d+1),e<=d&&(s=d-1)}}function Hn(r,e,i){const s=r[e];r[e]=r[i],r[i]=s}function Uu(r,e){return r<e?-1:r>e?1:0}function Co(r,e){if(r.length<=1)return[r];const i=[];let s,o;for(const l of r){const u=$u(l);u!==0&&(l.area=Math.abs(u),o===void 0&&(o=u<0),o===u<0?(s&&i.push(s),s=[l]):s.push(l))}if(s&&i.push(s),e>1)for(let l=0;l<i.length;l++)i[l].length<=e||(tl(i[l],e,1,i[l].length-1,Gu),i[l]=i[l].slice(0,e));return i}function Gu(r,e){return e.area-r.area}function $u(r){let e=0;for(let i,s,o=0,l=r.length,u=l-1;o<l;u=o++)i=r[o],s=r[u],e+=(s.x-i.x)*(i.y+s.y);return e}const Ds=1/298.257223563,Pc=Ds*(2-Ds),Ic=Math.PI/180;class il{constructor(e){const i=6378.137*Ic*1e3,s=Math.cos(e*Ic),o=1/(1-Pc*(1-s*s)),l=Math.sqrt(o);this.kx=i*l*s,this.ky=i*l*o*(1-Pc)}distance(e,i){const s=this.wrap(e[0]-i[0])*this.kx,o=(e[1]-i[1])*this.ky;return Math.sqrt(s*s+o*o)}pointOnLine(e,i){let s,o,l,u,d=1/0;for(let g=0;g<e.length-1;g++){let m=e[g][0],v=e[g][1],_=this.wrap(e[g+1][0]-m)*this.kx,T=(e[g+1][1]-v)*this.ky,b=0;_===0&&T===0||(b=(this.wrap(i[0]-m)*this.kx*_+(i[1]-v)*this.ky*T)/(_*_+T*T),b>1?(m=e[g+1][0],v=e[g+1][1]):b>0&&(m+=_/this.kx*b,v+=T/this.ky*b)),_=this.wrap(i[0]-m)*this.kx,T=(i[1]-v)*this.ky;const I=_*_+T*T;I<d&&(d=I,s=m,o=v,l=g,u=b)}return{point:[s,o],index:l,t:Math.max(0,Math.min(1,u))}}wrap(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}}function Mc(r,e){return e[0]-r[0]}function Xn(r){return r[1]-r[0]+1}function tr(r,e){return r[1]>=r[0]&&r[1]<e}function rl(r,e){if(r[0]>r[1])return[null,null];const i=Xn(r);if(e){if(i===2)return[r,null];const o=Math.floor(i/2);return[[r[0],r[0]+o],[r[0]+o,r[1]]]}if(i===1)return[r,null];const s=Math.floor(i/2)-1;return[[r[0],r[0]+s],[r[0]+s+1,r[1]]]}function nl(r,e){if(!tr(e,r.length))return[1/0,1/0,-1/0,-1/0];const i=[1/0,1/0,-1/0,-1/0];for(let s=e[0];s<=e[1];++s)dn(i,r[s]);return i}function Ao(r){const e=[1/0,1/0,-1/0,-1/0];for(const i of r)for(const s of i)dn(e,s);return e}function sl(r){return r[0]!==-1/0&&r[1]!==-1/0&&r[2]!==1/0&&r[3]!==1/0}function ol(r,e,i){if(!sl(r)||!sl(e))return NaN;let s=0,o=0;return r[2]<e[0]&&(s=e[0]-r[2]),r[0]>e[2]&&(s=r[0]-e[2]),r[1]>e[3]&&(o=r[1]-e[3]),r[3]<e[1]&&(o=e[1]-r[3]),i.distance([0,0],[s,o])}function fn(r,e,i){const s=i.pointOnLine(e,r);return i.distance(r,s.point)}function al(r,e,i,s,o){const l=Math.min(fn(r,[i,s],o),fn(e,[i,s],o)),u=Math.min(fn(i,[r,e],o),fn(s,[r,e],o));return Math.min(l,u)}function Ec(r,e,i,s,o){if(!tr(e,r.length)||!tr(s,i.length))return 1/0;let l=1/0;for(let u=e[0];u<e[1];++u){const d=r[u],g=r[u+1];for(let m=s[0];m<s[1];++m){const v=i[m],_=i[m+1];if(Mo(d,g,v,_))return 0;l=Math.min(l,al(d,g,v,_,o))}}return l}function Zu(r,e,i,s,o){if(!tr(e,r.length)||!tr(s,i.length))return NaN;let l=1/0;for(let u=e[0];u<=e[1];++u)for(let d=s[0];d<=s[1];++d)if(l=Math.min(l,o.distance(r[u],i[d])),l===0)return l;return l}function qu(r,e,i){if(ur(r,e,!0))return 0;let s=1/0;for(const o of e){const l=o[0],u=o[o.length-1];if(l!==u&&(s=Math.min(s,fn(r,[u,l],i)),s===0))return s;const d=i.pointOnLine(o,r);if(s=Math.min(s,i.distance(r,d.point)),s===0)return s}return s}function Wu(r,e,i,s){if(!tr(e,r.length))return NaN;for(let l=e[0];l<=e[1];++l)if(ur(r[l],i,!0))return 0;let o=1/0;for(let l=e[0];l<e[1];++l){const u=r[l],d=r[l+1];for(const g of i)for(let m=0,v=g.length,_=v-1;m<v;_=m++){const T=g[_],b=g[m];if(Mo(u,d,T,b))return 0;o=Math.min(o,al(u,d,T,b,s))}}return o}function Cc(r,e){for(const i of r)for(const s of i)if(ur(s,e,!0))return!0;return!1}function Je(r,e,i,s=1/0){const o=Ao(r),l=Ao(e);if(s!==1/0&&ol(o,l,i)>=s)return s;if(As(o,l)){if(Cc(r,e))return 0}else if(Cc(e,r))return 0;let u=1/0;for(const d of r)for(let g=0,m=d.length,v=m-1;g<m;v=g++){const _=d[v],T=d[g];for(const b of e)for(let I=0,M=b.length,A=M-1;I<M;A=I++){const D=b[A],F=b[I];if(Mo(_,T,D,F))return 0;u=Math.min(u,al(_,T,D,F,i))}}return u}function Ac(r,e,i,s,o,l){if(!l)return;const u=ol(nl(s,l),o,i);u<e&&r.push([u,l,[0,0]])}function Do(r,e,i,s,o,l,u){if(!l||!u)return;const d=ol(nl(s,l),nl(o,u),i);d<e&&r.push([d,l,u])}function zo(r,e,i,s,o=1/0){let l=Math.min(s.distance(r[0],i[0][0]),o);if(l===0)return l;const u=new el([[0,[0,r.length-1],[0,0]]],Mc),d=Ao(i);for(;u.length>0;){const g=u.pop();if(g[0]>=l)continue;const m=g[1],v=e?50:100;if(Xn(m)<=v){if(!tr(m,r.length))return NaN;if(e){const _=Wu(r,m,i,s);if(isNaN(_)||_===0)return _;l=Math.min(l,_)}else for(let _=m[0];_<=m[1];++_){const T=qu(r[_],i,s);if(l=Math.min(l,T),l===0)return 0}}else{const _=rl(m,e);Ac(u,l,s,r,d,_[0]),Ac(u,l,s,r,d,_[1])}}return l}function ko(r,e,i,s,o,l=1/0){let u=Math.min(l,o.distance(r[0],i[0]));if(u===0)return u;const d=new el([[0,[0,r.length-1],[0,i.length-1]]],Mc);for(;d.length>0;){const g=d.pop();if(g[0]>=u)continue;const m=g[1],v=g[2],_=e?50:100,T=s?50:100;if(Xn(m)<=_&&Xn(v)<=T){if(!tr(m,r.length)&&tr(v,i.length))return NaN;let b;if(e&&s)b=Ec(r,m,i,v,o),u=Math.min(u,b);else if(e&&!s){const I=r.slice(m[0],m[1]+1);for(let M=v[0];M<=v[1];++M)if(b=fn(i[M],I,o),u=Math.min(u,b),u===0)return u}else if(!e&&s){const I=i.slice(v[0],v[1]+1);for(let M=m[0];M<=m[1];++M)if(b=fn(r[M],I,o),u=Math.min(u,b),u===0)return u}else b=Zu(r,m,i,v,o),u=Math.min(u,b)}else{const b=rl(m,e),I=rl(v,s);Do(d,u,o,r,i,b[0],I[0]),Do(d,u,o,r,i,b[0],I[1]),Do(d,u,o,r,i,b[1],I[0]),Do(d,u,o,r,i,b[1],I[1])}}return u}function ll(r){return r.type==="MultiPolygon"?r.coordinates.map((e=>({type:"Polygon",coordinates:e}))):r.type==="MultiLineString"?r.coordinates.map((e=>({type:"LineString",coordinates:e}))):r.type==="MultiPoint"?r.coordinates.map((e=>({type:"Point",coordinates:e}))):[r]}class mn{constructor(e,i){this.type=be,this.geojson=e,this.geometries=i}static parse(e,i){if(e.length!==2)return i.error(`'distance' expression requires exactly one argument, but found ${e.length-1} instead.`);if(zr(e[1])){const s=e[1];if(s.type==="FeatureCollection")return new mn(s,s.features.map((o=>ll(o.geometry))).flat());if(s.type==="Feature")return new mn(s,ll(s.geometry));if("type"in s&&"coordinates"in s)return new mn(s,ll(s))}return i.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return(function(i,s){const o=i.geometry(),l=o.flat().map((g=>Ja([g.x,g.y],i.canonical)));if(o.length===0)return NaN;const u=new il(l[0][1]);let d=1/0;for(const g of s){switch(g.type){case"Point":d=Math.min(d,ko(l,!1,[g.coordinates],!1,u,d));break;case"LineString":d=Math.min(d,ko(l,!1,g.coordinates,!0,u,d));break;case"Polygon":d=Math.min(d,zo(l,!1,g.coordinates,u,d))}if(d===0)return d}return d})(e,this.geometries);if(e.geometryType()==="LineString")return(function(i,s){const o=i.geometry(),l=o.flat().map((g=>Ja([g.x,g.y],i.canonical)));if(o.length===0)return NaN;const u=new il(l[0][1]);let d=1/0;for(const g of s){switch(g.type){case"Point":d=Math.min(d,ko(l,!0,[g.coordinates],!1,u,d));break;case"LineString":d=Math.min(d,ko(l,!0,g.coordinates,!0,u,d));break;case"Polygon":d=Math.min(d,zo(l,!0,g.coordinates,u,d))}if(d===0)return d}return d})(e,this.geometries);if(e.geometryType()==="Polygon")return(function(i,s){const o=i.geometry();if(o.length===0||o[0].length===0)return NaN;const l=Co(o,0).map((g=>g.map((m=>m.map((v=>Ja([v.x,v.y],i.canonical))))))),u=new il(l[0][0][0][1]);let d=1/0;for(const g of s)for(const m of l){switch(g.type){case"Point":d=Math.min(d,zo([g.coordinates],!1,m,u,d));break;case"LineString":d=Math.min(d,zo(g.coordinates,!0,m,u,d));break;case"Polygon":d=Math.min(d,Je(m,g.coordinates,u,d))}if(d===0)return d}return d})(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}class zs{constructor(e){this.type=Be,this.key=e}static parse(e,i){if(e.length!==2)return i.error(`Expected 1 argument, but found ${e.length-1} instead.`);const s=e[1];return s==null?i.error("Global state property must be defined."):typeof s!="string"?i.error(`Global state property must be string, but found ${typeof e[1]} instead.`):new zs(s)}evaluate(e){var i;const s=(i=e.globals)===null||i===void 0?void 0:i.globalState;return s&&Object.keys(s).length!==0?Is(s,this.key):null}eachChild(){}outputDefined(){return!1}}const Yn={"==":Ya,"!=":yc,">":qn,"<":Ou,">=":Ka,"<=":To,array:yi,at:Ze,boolean:yi,case:Hi,coalesce:Es,collator:So,format:hn,image:Wn,in:Oe,"index-of":Gn,interpolate:It,"interpolate-hcl":It,"interpolate-lab":It,length:Ei,let:ot,literal:er,match:We,number:yi,"number-format":Po,object:yi,slice:$n,step:Zn,string:yi,"to-boolean":cr,"to-color":cr,"to-number":cr,"to-string":cr,var:Un,within:pn,distance:mn,"global-state":zs};class Bi{constructor(e,i,s,o){this.name=e,this.type=i,this._evaluate=s,this.args=o}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,i){const s=e[0],o=Bi.definitions[s];if(!o)return i.error(`Unknown expression "${s}". If you wanted a literal array, use ["literal", [...]].`,0);const l=Array.isArray(o)?o[0]:o.type,u=Array.isArray(o)?[[o[1],o[2]]]:o.overloads,d=u.filter((([m])=>!Array.isArray(m)||m.length===e.length-1));let g=null;for(const[m,v]of d){g=new ln(i.registry,Ro,i.path,null,i.scope);const _=[];let T=!1;for(let b=1;b<e.length;b++){const I=e[b],M=Array.isArray(m)?m[b-1]:m.type,A=g.parse(I,1+_.length,M);if(!A){T=!0;break}_.push(A)}if(!T)if(Array.isArray(m)&&m.length!==_.length)g.error(`Expected ${m.length} arguments, but found ${_.length} instead.`);else{for(let b=0;b<_.length;b++){const I=Array.isArray(m)?m[b]:m.type,M=_[b];g.concat(b+1).checkSubtype(I,M.type)}if(g.errors.length===0)return new Bi(s,l,v,_)}}if(d.length===1)i.errors.push(...g.errors);else{const m=(d.length?d:u).map((([_])=>{return T=_,Array.isArray(T)?`(${T.map(tt).join(", ")})`:`(${tt(T.type)}...)`;var T})).join(" | "),v=[];for(let _=1;_<e.length;_++){const T=i.parse(e[_],1+v.length);if(!T)return null;v.push(tt(T.type))}i.error(`Expected arguments of type ${m}, but found (${v.join(", ")}) instead.`)}return null}static register(e,i){Bi.definitions=i;for(const s in i)e[s]=Bi}}function Dc(r,[e,i,s,o]){e=e.evaluate(r),i=i.evaluate(r),s=s.evaluate(r);const l=o?o.evaluate(r):1,u=Nn(e,i,s,l);if(u)throw new st(u);return new Ve(e/255,i/255,s/255,l,!1)}function zc(r,e){return r in e}function cl(r,e){const i=e[r];return i===void 0?null:i}function gn(r){return{type:r}}function Ro(r){if(r instanceof Un)return Ro(r.boundExpression);if(r instanceof Bi&&r.name==="error"||r instanceof So||r instanceof pn||r instanceof mn||r instanceof zs)return!1;const e=r instanceof cr||r instanceof yi;let i=!0;return r.eachChild((s=>{i=e?i&&Ro(s):i&&s instanceof er})),!!i&&Fo(r)&&Lo(r,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"])}function Fo(r){if(r instanceof Bi&&(r.name==="get"&&r.args.length===1||r.name==="feature-state"||r.name==="has"&&r.args.length===1||r.name==="properties"||r.name==="geometry-type"||r.name==="id"||/^filter-/.test(r.name))||r instanceof pn||r instanceof mn)return!1;let e=!0;return r.eachChild((i=>{e&&!Fo(i)&&(e=!1)})),e}function ks(r){if(r instanceof Bi&&r.name==="feature-state")return!1;let e=!0;return r.eachChild((i=>{e&&!ks(i)&&(e=!1)})),e}function Lo(r,e){if(r instanceof Bi&&e.indexOf(r.name)>=0)return!1;let i=!0;return r.eachChild((s=>{i&&!Lo(s,e)&&(i=!1)})),i}function kc(r){return{result:"success",value:r}}function Kn(r){return{result:"error",value:r}}function Jn(r){return r["property-type"]==="data-driven"||r["property-type"]==="cross-faded-data-driven"}function Rc(r){return!!r.expression&&r.expression.parameters.indexOf("zoom")>-1}function ul(r){return!!r.expression&&r.expression.interpolated}function Ne(r){return r instanceof Number?"number":r instanceof String?"string":r instanceof Boolean?"boolean":Array.isArray(r)?"array":r===null?"null":typeof r}function Bo(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)&&Tt(r)===lr}function Hu(r){return r}function Fc(r,e){const i=r.stops&&typeof r.stops[0][0]=="object",s=i||!(i||r.property!==void 0),o=r.type||(ul(e)?"exponential":"interval"),l=(function(v){switch(v.type){case"color":return Ve.parse;case"padding":return Kt.parse;case"numberArray":return dt.parse;case"colorArray":return Re.parse;default:return null}})(e);if(l&&((r=rn({},r)).stops&&(r.stops=r.stops.map((v=>[v[0],l(v[1])]))),r.default=l(r.default?r.default:e.default)),r.colorSpace&&(u=r.colorSpace)!=="rgb"&&u!=="hcl"&&u!=="lab")throw new Error(`Unknown color space: "${r.colorSpace}"`);var u;const d=(function(v){switch(v){case"exponential":return Lc;case"interval":return Yu;case"categorical":return Xu;case"identity":return Ku;default:throw new Error(`Unknown function type "${v}"`)}})(o);let g,m;if(o==="categorical"){g=Object.create(null);for(const v of r.stops)g[v[0]]=v[1];m=typeof r.stops[0][0]}if(i){const v={},_=[];for(let I=0;I<r.stops.length;I++){const M=r.stops[I],A=M[0].zoom;v[A]===void 0&&(v[A]={zoom:A,type:r.type,property:r.property,default:r.default,stops:[]},_.push(A)),v[A].stops.push([M[0].value,M[1]])}const T=[];for(const I of _)T.push([v[I].zoom,Fc(v[I],e)]);const b={name:"linear"};return{kind:"composite",interpolationType:b,interpolationFactor:It.interpolationFactor.bind(void 0,b),zoomStops:T.map((I=>I[0])),evaluate:({zoom:I},M)=>Lc({stops:T,base:r.base},e,I).evaluate(I,M)}}if(s){const v=o==="exponential"?{name:"exponential",base:r.base!==void 0?r.base:1}:null;return{kind:"camera",interpolationType:v,interpolationFactor:It.interpolationFactor.bind(void 0,v),zoomStops:r.stops.map((_=>_[0])),evaluate:({zoom:_})=>d(r,e,_,g,m)}}return{kind:"source",evaluate(v,_){const T=_&&_.properties?_.properties[r.property]:void 0;return T===void 0?Rs(r.default,e.default):d(r,e,T,g,m)}}}function Rs(r,e,i){return r!==void 0?r:e!==void 0?e:i!==void 0?i:void 0}function Xu(r,e,i,s,o){return Rs(typeof i===o?s[i]:void 0,r.default,e.default)}function Yu(r,e,i){if(Ne(i)!=="number")return Rs(r.default,e.default);const s=r.stops.length;if(s===1||i<=r.stops[0][0])return r.stops[0][1];if(i>=r.stops[s-1][0])return r.stops[s-1][1];const o=cn(r.stops.map((l=>l[0])),i);return r.stops[o][1]}function Lc(r,e,i){const s=r.base!==void 0?r.base:1;if(Ne(i)!=="number")return Rs(r.default,e.default);const o=r.stops.length;if(o===1||i<=r.stops[0][0])return r.stops[0][1];if(i>=r.stops[o-1][0])return r.stops[o-1][1];const l=cn(r.stops.map((v=>v[0])),i),u=(function(v,_,T,b){const I=b-T,M=v-T;return I===0?0:_===1?M/I:(Math.pow(_,M)-1)/(Math.pow(_,I)-1)})(i,s,r.stops[l][0],r.stops[l+1][0]),d=r.stops[l][1],g=r.stops[l+1][1],m=Mi[e.type]||Hu;return typeof d.evaluate=="function"?{evaluate(...v){const _=d.evaluate.apply(void 0,v),T=g.evaluate.apply(void 0,v);if(_!==void 0&&T!==void 0)return m(_,T,u,r.colorSpace)}}:m(d,g,u,r.colorSpace)}function Ku(r,e,i){switch(e.type){case"color":i=Ve.parse(i);break;case"formatted":i=_i.fromString(i.toString());break;case"resolvedImage":i=Ii.fromString(i.toString());break;case"padding":i=Kt.parse(i);break;case"colorArray":i=Re.parse(i);break;case"numberArray":i=dt.parse(i);break;default:Ne(i)===e.type||e.type==="enum"&&e.values[i]||(i=void 0)}return Rs(i,r.default,e.default)}Bi.register(Yn,{error:[{kind:"error"},[Fe],(r,[e])=>{throw new st(e.evaluate(r))}],typeof:[Fe,[Be],(r,[e])=>tt(Tt(e.evaluate(r)))],"to-rgba":[Wt(be,4),[Pi],(r,[e])=>{const[i,s,o,l]=e.evaluate(r).rgb;return[255*i,255*s,255*o,l]}],rgb:[Pi,[be,be,be],Dc],rgba:[Pi,[be,be,be,be],Dc],has:{type:je,overloads:[[[Fe],(r,[e])=>zc(e.evaluate(r),r.properties())],[[Fe,lr],(r,[e,i])=>zc(e.evaluate(r),i.evaluate(r))]]},get:{type:Be,overloads:[[[Fe],(r,[e])=>cl(e.evaluate(r),r.properties())],[[Fe,lr],(r,[e,i])=>cl(e.evaluate(r),i.evaluate(r))]]},"feature-state":[Be,[Fe],(r,[e])=>cl(e.evaluate(r),r.featureState||{})],properties:[lr,[],r=>r.properties()],"geometry-type":[Fe,[],r=>r.geometryType()],id:[Be,[],r=>r.id()],zoom:[be,[],r=>r.globals.zoom],"heatmap-density":[be,[],r=>r.globals.heatmapDensity||0],elevation:[be,[],r=>r.globals.elevation||0],"line-progress":[be,[],r=>r.globals.lineProgress||0],accumulated:[Be,[],r=>r.globals.accumulated===void 0?null:r.globals.accumulated],"+":[be,gn(be),(r,e)=>{let i=0;for(const s of e)i+=s.evaluate(r);return i}],"*":[be,gn(be),(r,e)=>{let i=1;for(const s of e)i*=s.evaluate(r);return i}],"-":{type:be,overloads:[[[be,be],(r,[e,i])=>e.evaluate(r)-i.evaluate(r)],[[be],(r,[e])=>-e.evaluate(r)]]},"/":[be,[be,be],(r,[e,i])=>e.evaluate(r)/i.evaluate(r)],"%":[be,[be,be],(r,[e,i])=>e.evaluate(r)%i.evaluate(r)],ln2:[be,[],()=>Math.LN2],pi:[be,[],()=>Math.PI],e:[be,[],()=>Math.E],"^":[be,[be,be],(r,[e,i])=>Math.pow(e.evaluate(r),i.evaluate(r))],sqrt:[be,[be],(r,[e])=>Math.sqrt(e.evaluate(r))],log10:[be,[be],(r,[e])=>Math.log(e.evaluate(r))/Math.LN10],ln:[be,[be],(r,[e])=>Math.log(e.evaluate(r))],log2:[be,[be],(r,[e])=>Math.log(e.evaluate(r))/Math.LN2],sin:[be,[be],(r,[e])=>Math.sin(e.evaluate(r))],cos:[be,[be],(r,[e])=>Math.cos(e.evaluate(r))],tan:[be,[be],(r,[e])=>Math.tan(e.evaluate(r))],asin:[be,[be],(r,[e])=>Math.asin(e.evaluate(r))],acos:[be,[be],(r,[e])=>Math.acos(e.evaluate(r))],atan:[be,[be],(r,[e])=>Math.atan(e.evaluate(r))],min:[be,gn(be),(r,e)=>Math.min(...e.map((i=>i.evaluate(r))))],max:[be,gn(be),(r,e)=>Math.max(...e.map((i=>i.evaluate(r))))],abs:[be,[be],(r,[e])=>Math.abs(e.evaluate(r))],round:[be,[be],(r,[e])=>{const i=e.evaluate(r);return i<0?-Math.round(-i):Math.round(i)}],floor:[be,[be],(r,[e])=>Math.floor(e.evaluate(r))],ceil:[be,[be],(r,[e])=>Math.ceil(e.evaluate(r))],"filter-==":[je,[Fe,Be],(r,[e,i])=>r.properties()[e.value]===i.value],"filter-id-==":[je,[Be],(r,[e])=>r.id()===e.value],"filter-type-==":[je,[Fe],(r,[e])=>r.geometryType()===e.value],"filter-<":[je,[Fe,Be],(r,[e,i])=>{const s=r.properties()[e.value],o=i.value;return typeof s==typeof o&&s<o}],"filter-id-<":[je,[Be],(r,[e])=>{const i=r.id(),s=e.value;return typeof i==typeof s&&i<s}],"filter->":[je,[Fe,Be],(r,[e,i])=>{const s=r.properties()[e.value],o=i.value;return typeof s==typeof o&&s>o}],"filter-id->":[je,[Be],(r,[e])=>{const i=r.id(),s=e.value;return typeof i==typeof s&&i>s}],"filter-<=":[je,[Fe,Be],(r,[e,i])=>{const s=r.properties()[e.value],o=i.value;return typeof s==typeof o&&s<=o}],"filter-id-<=":[je,[Be],(r,[e])=>{const i=r.id(),s=e.value;return typeof i==typeof s&&i<=s}],"filter->=":[je,[Fe,Be],(r,[e,i])=>{const s=r.properties()[e.value],o=i.value;return typeof s==typeof o&&s>=o}],"filter-id->=":[je,[Be],(r,[e])=>{const i=r.id(),s=e.value;return typeof i==typeof s&&i>=s}],"filter-has":[je,[Be],(r,[e])=>e.value in r.properties()],"filter-has-id":[je,[],r=>r.id()!==null&&r.id()!==void 0],"filter-type-in":[je,[Wt(Fe)],(r,[e])=>e.value.indexOf(r.geometryType())>=0],"filter-id-in":[je,[Wt(Be)],(r,[e])=>e.value.indexOf(r.id())>=0],"filter-in-small":[je,[Fe,Wt(Be)],(r,[e,i])=>i.value.indexOf(r.properties()[e.value])>=0],"filter-in-large":[je,[Fe,Wt(Be)],(r,[e,i])=>(function(s,o,l,u){for(;l<=u;){const d=l+u>>1;if(o[d]===s)return!0;o[d]>s?u=d-1:l=d+1}return!1})(r.properties()[e.value],i.value,0,i.value.length-1)],all:{type:je,overloads:[[[je,je],(r,[e,i])=>e.evaluate(r)&&i.evaluate(r)],[gn(je),(r,e)=>{for(const i of e)if(!i.evaluate(r))return!1;return!0}]]},any:{type:je,overloads:[[[je,je],(r,[e,i])=>e.evaluate(r)||i.evaluate(r)],[gn(je),(r,e)=>{for(const i of e)if(i.evaluate(r))return!0;return!1}]]},"!":[je,[je],(r,[e])=>!e.evaluate(r)],"is-supported-script":[je,[Fe],(r,[e])=>{const i=r.globals&&r.globals.isSupportedScript;return!i||i(e.evaluate(r))}],upcase:[Fe,[Fe],(r,[e])=>e.evaluate(r).toUpperCase()],downcase:[Fe,[Fe],(r,[e])=>e.evaluate(r).toLowerCase()],concat:[Fe,gn(Be),(r,e)=>e.map((i=>on(i.evaluate(r)))).join("")],split:[Wt(Fe),[Fe,Fe],(r,[e,i])=>e.evaluate(r).split(i.evaluate(r))],join:[Fe,[Wt(Fe),Fe],(r,[e,i])=>e.evaluate(r).join(i.evaluate(r))],"resolved-locale":[Fe,[xs],(r,[e])=>e.evaluate(r).resolvedLocale()]});class Fs{constructor(e,i,s){this.expression=e,this._warningHistory={},this._evaluator=new Ha,this._defaultValue=i?(function(o){if(o.type==="color"&&Bo(o.default))return new Ve(0,0,0,0);switch(o.type){case"color":return Ve.parse(o.default)||null;case"padding":return Kt.parse(o.default)||null;case"numberArray":return dt.parse(o.default)||null;case"colorArray":return Re.parse(o.default)||null;case"variableAnchorOffsetCollection":return oi.parse(o.default)||null;case"projectionDefinition":return ai.parse(o.default)||null;default:return o.default===void 0?null:o.default}})(i):null,this._enumValues=i&&i.type==="enum"?i.values:null,this._globalState=s}evaluateWithoutErrorHandling(e,i,s,o,l,u){return this._globalState&&(e=es(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=i,this._evaluator.featureState=s,this._evaluator.canonical=o,this._evaluator.availableImages=l||null,this._evaluator.formattedSection=u,this.expression.evaluate(this._evaluator)}evaluate(e,i,s,o,l,u){this._globalState&&(e=es(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=i||null,this._evaluator.featureState=s||null,this._evaluator.canonical=o,this._evaluator.availableImages=l||null,this._evaluator.formattedSection=u||null;try{const d=this.expression.evaluate(this._evaluator);if(d==null||typeof d=="number"&&d!=d)return this._defaultValue;if(this._enumValues&&!(d in this._enumValues))throw new st(`Expected value to be one of ${Object.keys(this._enumValues).map((g=>JSON.stringify(g))).join(", ")}, but found ${JSON.stringify(d)} instead.`);return d}catch(d){return this._warningHistory[d.message]||(this._warningHistory[d.message]=!0,typeof console<"u"&&console.warn(d.message)),this._defaultValue}}}function Oo(r){return Array.isArray(r)&&r.length>0&&typeof r[0]=="string"&&r[0]in Yn}function Ls(r,e,i){const s=new ln(Yn,Ro,[],e?(function(l){const u={color:Pi,string:Fe,number:be,enum:Fe,boolean:je,formatted:bs,padding:go,numberArray:ws,colorArray:Ln,projectionDefinition:mo,resolvedImage:Bn,variableAnchorOffsetCollection:Ts};return l.type==="array"?Wt(u[l.value]||Be,l.length):u[l.type]})(e):void 0),o=s.parse(r,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return o?kc(new Fs(o,e,i)):Kn(s.errors)}class Vo{constructor(e,i,s){this.kind=e,this._styleExpression=i,this.isStateDependent=e!=="constant"&&!ks(i.expression),this.globalStateRefs=Qn(i.expression),this._globalState=s}evaluateWithoutErrorHandling(e,i,s,o,l,u){return this._globalState&&(e=es(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,i,s,o,l,u)}evaluate(e,i,s,o,l,u){return this._globalState&&(e=es(e,this._globalState)),this._styleExpression.evaluate(e,i,s,o,l,u)}}class jo{constructor(e,i,s,o,l){this.kind=e,this.zoomStops=s,this._styleExpression=i,this.isStateDependent=e!=="camera"&&!ks(i.expression),this.globalStateRefs=Qn(i.expression),this.interpolationType=o,this._globalState=l}evaluateWithoutErrorHandling(e,i,s,o,l,u){return this._globalState&&(e=es(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,i,s,o,l,u)}evaluate(e,i,s,o,l,u){return this._globalState&&(e=es(e,this._globalState)),this._styleExpression.evaluate(e,i,s,o,l,u)}interpolationFactor(e,i,s){return this.interpolationType?It.interpolationFactor(this.interpolationType,e,i,s):0}}function Bc(r,e,i){const s=Ls(r,e,i);if(s.result==="error")return s;const o=s.value.expression,l=Fo(o);if(!l&&!Jn(e))return Kn([new qt("","data expressions not supported")]);const u=Lo(o,["zoom"]);if(!u&&!Rc(e))return Kn([new qt("","zoom expressions not supported")]);const d=_n(o);return d||u?d instanceof qt?Kn([d]):d instanceof It&&!ul(e)?Kn([new qt("",'"interpolate" expressions cannot be used with this property')]):kc(d?new jo(l?"camera":"composite",s.value,d.labels,d instanceof It?d.interpolation:void 0,i):new Vo(l?"constant":"source",s.value,i)):Kn([new qt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class No{constructor(e,i){this._parameters=e,this._specification=i,rn(this,Fc(this._parameters,this._specification))}static deserialize(e){return new No(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function _n(r){let e=null;if(r instanceof ot)e=_n(r.result);else if(r instanceof Es){for(const i of r.args)if(e=_n(i),e)break}else(r instanceof Zn||r instanceof It)&&r.input instanceof Bi&&r.input.name==="zoom"&&(e=r);return e instanceof qt||r.eachChild((i=>{const s=_n(i);s instanceof qt?e=s:!e&&s?e=new qt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&s&&e!==s&&(e=new qt("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),e}function Qn(r,e=new Set){return r instanceof zs&&e.add(r.key),r.eachChild((i=>{Qn(i,e)})),e}function es(r,e){const{zoom:i,heatmapDensity:s,elevation:o,lineProgress:l,isSupportedScript:u,accumulated:d}=r??{};return{zoom:i,heatmapDensity:s,elevation:o,lineProgress:l,isSupportedScript:u,accumulated:d,globalState:e}}function hl(r){if(r===!0||r===!1)return!0;if(!Array.isArray(r)||r.length===0)return!1;switch(r[0]){case"has":return r.length>=2&&r[1]!=="$id"&&r[1]!=="$type";case"in":return r.length>=3&&(typeof r[1]!="string"||Array.isArray(r[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return r.length!==3||Array.isArray(r[1])||Array.isArray(r[2]);case"any":case"all":for(const e of r.slice(1))if(!hl(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}const Ju={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Bs(r,e){if(r==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};hl(r)||(r=Os(r));const i=Ls(r,Ju,e);if(i.result==="error")throw new Error(i.value.map((s=>`${s.key}: ${s.message}`)).join(", "));return{filter:(s,o,l)=>i.value.evaluate(s,o,{},l),needGeometry:dl(r),getGlobalStateRefs:()=>Qn(i.value.expression)}}function Qu(r,e){return r<e?-1:r>e?1:0}function dl(r){if(!Array.isArray(r))return!1;if(r[0]==="within"||r[0]==="distance")return!0;for(let e=1;e<r.length;e++)if(dl(r[e]))return!0;return!1}function Os(r){if(!r)return!0;const e=r[0];return r.length<=1?e!=="any":e==="=="?pl(r[1],r[2],"=="):e==="!="?Vs(pl(r[1],r[2],"==")):e==="<"||e===">"||e==="<="||e===">="?pl(r[1],r[2],e):e==="any"?(i=r.slice(1),["any"].concat(i.map(Os))):e==="all"?["all"].concat(r.slice(1).map(Os)):e==="none"?["all"].concat(r.slice(1).map(Os).map(Vs)):e==="in"?Oc(r[1],r.slice(2)):e==="!in"?Vs(Oc(r[1],r.slice(2))):e==="has"?fl(r[1]):e!=="!has"||Vs(fl(r[1]));var i}function pl(r,e,i){switch(r){case"$type":return[`filter-type-${i}`,e];case"$id":return[`filter-id-${i}`,e];default:return[`filter-${i}`,r,e]}}function Oc(r,e){if(e.length===0)return!1;switch(r){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some((i=>typeof i!=typeof e[0]))?["filter-in-large",r,["literal",e.sort(Qu)]]:["filter-in-small",r,["literal",e]]}}function fl(r){switch(r){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",r]}}function Vs(r){return["!",r]}function Uo(r){const e=typeof r;if(e==="number"||e==="boolean"||e==="string"||r==null)return JSON.stringify(r);if(Array.isArray(r)){let o="[";for(const l of r)o+=`${Uo(l)},`;return`${o}]`}const i=Object.keys(r).sort();let s="{";for(let o=0;o<i.length;o++)s+=`${JSON.stringify(i[o])}:${Uo(r[i[o]])},`;return`${s}}`}function eh(r){let e="";for(const i of Ba)e+=`/${Uo(r[i])}`;return e}function Vc(r){const e=r.value;return e?[new _e(r.key,e,"constants have been deprecated as of v8")]:[]}function St(r){return r instanceof Number||r instanceof String||r instanceof Boolean?r.valueOf():r}function yn(r){if(Array.isArray(r))return r.map(yn);if(r instanceof Object&&!(r instanceof Number||r instanceof String||r instanceof Boolean)){const e={};for(const i in r)e[i]=yn(r[i]);return e}return St(r)}function vi(r){const e=r.key,i=r.value,s=r.valueSpec||{},o=r.objectElementValidators||{},l=r.style,u=r.styleSpec,d=r.validateSpec;let g=[];const m=Ne(i);if(m!=="object")return[new _e(e,i,`object expected, ${m} found`)];for(const v in i){const _=v.split(".")[0],T=Is(s,_)||s["*"];let b;if(Is(o,_))b=o[_];else if(Is(s,_)){if(i[v]===void 0)continue;b=d}else if(o["*"])b=o["*"];else{if(!s["*"]){g.push(new _e(e,i[v],`unknown property "${v}"`));continue}b=d}g=g.concat(b({key:(e&&`${e}.`)+v,value:i[v],valueSpec:T,style:l,styleSpec:u,object:i,objectKey:v,validateSpec:d},i))}for(const v in s)o[v]||s[v].required&&s[v].default===void 0&&i[v]===void 0&&g.push(new _e(e,i,`missing required property "${v}"`));return g}function Go(r){const e=r.value,i=r.valueSpec,s=r.style,o=r.styleSpec,l=r.key,u=r.arrayElementValidator||r.validateSpec;if(Ne(e)!=="array")return[new _e(l,e,`array expected, ${Ne(e)} found`)];if(i.length&&e.length!==i.length)return[new _e(l,e,`array length ${i.length} expected, length ${e.length} found`)];let d={type:i.value,values:i.values};o.$version<7&&(d.function=i.function),Ne(i.value)==="object"&&(d=i.value);let g=[];for(let m=0;m<e.length;m++)g=g.concat(u({array:e,arrayIndex:m,value:e[m],valueSpec:d,validateSpec:r.validateSpec,style:s,styleSpec:o,key:`${l}[${m}]`}));return g}function ts(r){const e=r.key,i=r.value,s=r.valueSpec;let o=Ne(i);return o==="number"&&i!=i&&(o="NaN"),o!=="number"?[new _e(e,i,`number expected, ${o} found`)]:"minimum"in s&&i<s.minimum?[new _e(e,i,`${i} is less than the minimum value ${s.minimum}`)]:"maximum"in s&&i>s.maximum?[new _e(e,i,`${i} is greater than the maximum value ${s.maximum}`)]:[]}function $o(r){const e=r.valueSpec,i=St(r.value.type);let s,o,l,u={};const d=i!=="categorical"&&r.value.property===void 0,g=!d,m=Ne(r.value.stops)==="array"&&Ne(r.value.stops[0])==="array"&&Ne(r.value.stops[0][0])==="object",v=vi({key:r.key,value:r.value,valueSpec:r.styleSpec.function,validateSpec:r.validateSpec,style:r.style,styleSpec:r.styleSpec,objectElementValidators:{stops:function(b){if(i==="identity")return[new _e(b.key,b.value,'identity function may not have a "stops" property')];let I=[];const M=b.value;return I=I.concat(Go({key:b.key,value:M,valueSpec:b.valueSpec,validateSpec:b.validateSpec,style:b.style,styleSpec:b.styleSpec,arrayElementValidator:_})),Ne(M)==="array"&&M.length===0&&I.push(new _e(b.key,M,"array must have at least one stop")),I},default:function(b){return b.validateSpec({key:b.key,value:b.value,valueSpec:e,validateSpec:b.validateSpec,style:b.style,styleSpec:b.styleSpec})}}});return i==="identity"&&d&&v.push(new _e(r.key,r.value,'missing required property "property"')),i==="identity"||r.value.stops||v.push(new _e(r.key,r.value,'missing required property "stops"')),i==="exponential"&&r.valueSpec.expression&&!ul(r.valueSpec)&&v.push(new _e(r.key,r.value,"exponential functions not supported")),r.styleSpec.$version>=8&&(g&&!Jn(r.valueSpec)?v.push(new _e(r.key,r.value,"property functions not supported")):d&&!Rc(r.valueSpec)&&v.push(new _e(r.key,r.value,"zoom functions not supported"))),i!=="categorical"&&!m||r.value.property!==void 0||v.push(new _e(r.key,r.value,'"property" property is required')),v;function _(b){let I=[];const M=b.value,A=b.key;if(Ne(M)!=="array")return[new _e(A,M,`array expected, ${Ne(M)} found`)];if(M.length!==2)return[new _e(A,M,`array length 2 expected, length ${M.length} found`)];if(m){if(Ne(M[0])!=="object")return[new _e(A,M,`object expected, ${Ne(M[0])} found`)];if(M[0].zoom===void 0)return[new _e(A,M,"object stop key must have zoom")];if(M[0].value===void 0)return[new _e(A,M,"object stop key must have value")];if(l&&l>St(M[0].zoom))return[new _e(A,M[0].zoom,"stop zoom values must appear in ascending order")];St(M[0].zoom)!==l&&(l=St(M[0].zoom),o=void 0,u={}),I=I.concat(vi({key:`${A}[0]`,value:M[0],valueSpec:{zoom:{}},validateSpec:b.validateSpec,style:b.style,styleSpec:b.styleSpec,objectElementValidators:{zoom:ts,value:T}}))}else I=I.concat(T({key:`${A}[0]`,value:M[0],validateSpec:b.validateSpec,style:b.style,styleSpec:b.styleSpec},M));return Oo(yn(M[1]))?I.concat([new _e(`${A}[1]`,M[1],"expressions are not allowed in function stops.")]):I.concat(b.validateSpec({key:`${A}[1]`,value:M[1],valueSpec:e,validateSpec:b.validateSpec,style:b.style,styleSpec:b.styleSpec}))}function T(b,I){const M=Ne(b.value),A=St(b.value),D=b.value!==null?b.value:I;if(s){if(M!==s)return[new _e(b.key,D,`${M} stop domain type must match previous stop domain type ${s}`)]}else s=M;if(M!=="number"&&M!=="string"&&M!=="boolean")return[new _e(b.key,D,"stop domain value must be a number, string, or boolean")];if(M!=="number"&&i!=="categorical"){let F=`number expected, ${M} found`;return Jn(e)&&i===void 0&&(F+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new _e(b.key,D,F)]}return i!=="categorical"||M!=="number"||isFinite(A)&&Math.floor(A)===A?i!=="categorical"&&M==="number"&&o!==void 0&&A<o?[new _e(b.key,D,"stop domain values must appear in ascending order")]:(o=A,i==="categorical"&&A in u?[new _e(b.key,D,"stop domain values must be unique")]:(u[A]=!0,[])):[new _e(b.key,D,`integer expected, found ${A}`)]}}function kr(r){const e=(r.expressionContext==="property"?Bc:Ls)(yn(r.value),r.valueSpec);if(e.result==="error")return e.value.map((s=>new _e(`${r.key}${s.key}`,r.value,s.message)));const i=e.value.expression||e.value._styleExpression.expression;if(r.expressionContext==="property"&&r.propertyKey==="text-font"&&!i.outputDefined())return[new _e(r.key,r.value,`Invalid data expression for "${r.propertyKey}". Output values must be contained as literals within the expression.`)];if(r.expressionContext==="property"&&r.propertyType==="layout"&&!ks(i))return[new _e(r.key,r.value,'"feature-state" data expressions are not supported with layout properties.')];if(r.expressionContext==="filter"&&!ks(i))return[new _e(r.key,r.value,'"feature-state" data expressions are not supported with filters.')];if(r.expressionContext&&r.expressionContext.indexOf("cluster")===0){if(!Lo(i,["zoom","feature-state"]))return[new _e(r.key,r.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(r.expressionContext==="cluster-initial"&&!Fo(i))return[new _e(r.key,r.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function js(r){const e=r.key,i=r.value,s=Ne(i);return s!=="string"?[new _e(e,i,`color expected, ${s} found`)]:Ve.parse(String(i))?[]:[new _e(e,i,`color expected, "${i}" found`)]}function vn(r){const e=r.key,i=r.value,s=r.valueSpec,o=[];return Array.isArray(s.values)?s.values.indexOf(St(i))===-1&&o.push(new _e(e,i,`expected one of [${s.values.join(", ")}], ${JSON.stringify(i)} found`)):Object.keys(s.values).indexOf(St(i))===-1&&o.push(new _e(e,i,`expected one of [${Object.keys(s.values).join(", ")}], ${JSON.stringify(i)} found`)),o}function is(r){return hl(yn(r.value))?kr(rn({},r,{expressionContext:"filter",valueSpec:{value:"boolean"}})):jc(r)}function jc(r){const e=r.value,i=r.key;if(Ne(e)!=="array")return[new _e(i,e,`array expected, ${Ne(e)} found`)];const s=r.styleSpec;let o,l=[];if(e.length<1)return[new _e(i,e,"filter array must have at least 1 element")];switch(l=l.concat(vn({key:`${i}[0]`,value:e[0],valueSpec:s.filter_operator,style:r.style,styleSpec:r.styleSpec})),St(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&St(e[1])==="$type"&&l.push(new _e(i,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&l.push(new _e(i,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(o=Ne(e[1]),o!=="string"&&l.push(new _e(`${i}[1]`,e[1],`string expected, ${o} found`)));for(let u=2;u<e.length;u++)o=Ne(e[u]),St(e[1])==="$type"?l=l.concat(vn({key:`${i}[${u}]`,value:e[u],valueSpec:s.geometry_type,style:r.style,styleSpec:r.styleSpec})):o!=="string"&&o!=="number"&&o!=="boolean"&&l.push(new _e(`${i}[${u}]`,e[u],`string, number, or boolean expected, ${o} found`));break;case"any":case"all":case"none":for(let u=1;u<e.length;u++)l=l.concat(jc({key:`${i}[${u}]`,value:e[u],style:r.style,styleSpec:r.styleSpec}));break;case"has":case"!has":o=Ne(e[1]),e.length!==2?l.push(new _e(i,e,`filter array for "${e[0]}" operator must have 2 elements`)):o!=="string"&&l.push(new _e(`${i}[1]`,e[1],`string expected, ${o} found`))}return l}function Nc(r,e){const i=r.key,s=r.validateSpec,o=r.style,l=r.styleSpec,u=r.value,d=r.objectKey,g=l[`${e}_${r.layerType}`];if(!g)return[];const m=d.match(/^(.*)-transition$/);if(e==="paint"&&m&&g[m[1]]&&g[m[1]].transition)return s({key:i,value:u,valueSpec:l.transition,style:o,styleSpec:l});const v=r.valueSpec||g[d];if(!v)return[new _e(i,u,`unknown property "${d}"`)];let _;if(Ne(u)==="string"&&Jn(v)&&!v.tokens&&(_=/^{([^}]+)}$/.exec(u)))return[new _e(i,u,`"${d}" does not support interpolation syntax
2
2
  Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(_[1])} }\`.`)];const T=[];return r.layerType==="symbol"&&d==="text-font"&&Bo(yn(u))&&St(u.type)==="identity"&&T.push(new _e(i,u,'"text-font" does not support identity functions')),T.concat(s({key:r.key,value:u,valueSpec:v,style:o,styleSpec:l,expressionContext:"property",propertyType:e,propertyKey:d}))}function Uc(r){return Nc(r,"paint")}function Gc(r){return Nc(r,"layout")}function $c(r){var e,i;let s=[];const o=r.value,l=r.key,u=r.style,d=r.styleSpec;if(Ne(o)!=="object")return[new _e(l,o,`object expected, ${Ne(o)} found`)];o.type||o.ref||s.push(new _e(l,o,'either "type" or "ref" is required'));let g=St(o.type);const m=St(o.ref);if(o.id){const v=St(o.id);for(let _=0;_<r.arrayIndex;_++){const T=u.layers[_];St(T.id)===v&&s.push(new _e(l,o.id,`duplicate layer id "${o.id}", previously used at line ${T.id.__line__}`))}}if("ref"in o){let v;["type","source","source-layer","filter","layout"].forEach((_=>{_ in o&&s.push(new _e(l,o[_],`"${_}" is prohibited for ref layers`))})),u.layers.forEach((_=>{St(_.id)===m&&(v=_)})),v?v.ref?s.push(new _e(l,o.ref,"ref cannot reference another ref layer")):g=St(v.type):s.push(new _e(l,o.ref,`ref layer "${m}" not found`))}else if(g!=="background")if(o.source){const v=u.sources&&u.sources[o.source],_=v&&St(v.type);v?_==="vector"&&g==="raster"?s.push(new _e(l,o.source,`layer "${o.id}" requires a raster source`)):_!=="raster-dem"&&g==="hillshade"||_!=="raster-dem"&&g==="color-relief"?s.push(new _e(l,o.source,`layer "${o.id}" requires a raster-dem source`)):_==="raster"&&g!=="raster"?s.push(new _e(l,o.source,`layer "${o.id}" requires a vector source`)):_!=="vector"||o["source-layer"]?_==="raster-dem"&&g!=="hillshade"&&g!=="color-relief"?s.push(new _e(l,o.source,"raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.")):g!=="line"||!o.paint||!o.paint["line-gradient"]||_==="geojson"&&v.lineMetrics||s.push(new _e(l,o,`layer "${o.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):s.push(new _e(l,o,`layer "${o.id}" must specify a "source-layer"`)):s.push(new _e(l,o.source,`source "${o.source}" not found`))}else s.push(new _e(l,o,'missing required property "source"'));return g==="raster"&&(!((e=o.paint)===null||e===void 0)&&e.resampling)&&(!((i=o.paint)===null||i===void 0)&&i["raster-resampling"])&&s.push(new _e(l,o.paint,`layer "${o.id}" redundantly specifies "resampling" and "raster-resampling" paint properties, but only one is allowed. It is advised to use "resampling".`)),s=s.concat(vi({key:l,value:o,valueSpec:d.layer,style:r.style,styleSpec:r.styleSpec,validateSpec:r.validateSpec,objectElementValidators:{"*":()=>[],type:()=>r.validateSpec({key:`${l}.type`,value:o.type,valueSpec:d.layer.type,style:r.style,styleSpec:r.styleSpec,validateSpec:r.validateSpec,object:o,objectKey:"type"}),filter:is,layout:v=>vi({layer:o,key:v.key,value:v.value,style:v.style,styleSpec:v.styleSpec,validateSpec:v.validateSpec,objectElementValidators:{"*":_=>Gc(rn({layerType:g},_))}}),paint:v=>vi({layer:o,key:v.key,value:v.value,style:v.style,styleSpec:v.styleSpec,validateSpec:v.validateSpec,objectElementValidators:{"*":_=>Uc(rn({layerType:g},_))}})}})),s}function Rr(r){const e=r.value,i=r.key,s=Ne(e);return s!=="string"?[new _e(i,e,`string expected, ${s} found`)]:[]}const ml={promoteId:function({key:r,value:e}){if(Ne(e)==="string")return Rr({key:r,value:e});{const i=[];for(const s in e)i.push(...Rr({key:`${r}.${s}`,value:e[s]}));return i}}};function gl(r){const e=r.value,i=r.key,s=r.styleSpec,o=r.style,l=r.validateSpec;if(!e.type)return[new _e(i,e,'"type" is required')];const u=St(e.type);let d;switch(u){case"vector":case"raster":return d=vi({key:i,value:e,valueSpec:s[`source_${u.replace("-","_")}`],style:r.style,styleSpec:s,objectElementValidators:ml,validateSpec:l}),d;case"raster-dem":return d=(function(g){var m;const v=(m=g.sourceName)!==null&&m!==void 0?m:"",_=g.value,T=g.styleSpec,b=T.source_raster_dem,I=g.style;let M=[];const A=Ne(_);if(_===void 0)return M;if(A!=="object")return M.push(new _e("source_raster_dem",_,`object expected, ${A} found`)),M;const D=St(_.encoding)==="custom",F=["redFactor","greenFactor","blueFactor","baseShift"],k=g.value.encoding?`"${g.value.encoding}"`:"Default";for(const L in _)!D&&F.includes(L)?M.push(new _e(L,_[L],`In "${v}": "${L}" is only valid when "encoding" is set to "custom". ${k} encoding found`)):b[L]?M=M.concat(g.validateSpec({key:L,value:_[L],valueSpec:b[L],validateSpec:g.validateSpec,style:I,styleSpec:T})):M.push(new _e(L,_[L],`unknown property "${L}"`));return M})({sourceName:i,value:e,style:r.style,styleSpec:s,validateSpec:l}),d;case"geojson":if(d=vi({key:i,value:e,valueSpec:s.source_geojson,style:o,styleSpec:s,validateSpec:l,objectElementValidators:ml}),e.cluster)for(const g in e.clusterProperties){const[m,v]=e.clusterProperties[g],_=typeof m=="string"?[m,["accumulated"],["get",g]]:m;d.push(...kr({key:`${i}.${g}.map`,value:v,expressionContext:"cluster-map"})),d.push(...kr({key:`${i}.${g}.reduce`,value:_,expressionContext:"cluster-reduce"}))}return d;case"video":return vi({key:i,value:e,valueSpec:s.source_video,style:o,validateSpec:l,styleSpec:s});case"image":return vi({key:i,value:e,valueSpec:s.source_image,style:o,validateSpec:l,styleSpec:s});case"canvas":return[new _e(i,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return vn({key:`${i}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function Ns(r){const e=r.value,i=r.styleSpec,s=i.light,o=r.style;let l=[];const u=Ne(e);if(e===void 0)return l;if(u!=="object")return l=l.concat([new _e("light",e,`object expected, ${u} found`)]),l;for(const d in e){const g=d.match(/^(.*)-transition$/);l=l.concat(g&&s[g[1]]&&s[g[1]].transition?r.validateSpec({key:d,value:e[d],valueSpec:i.transition,validateSpec:r.validateSpec,style:o,styleSpec:i}):s[d]?r.validateSpec({key:d,value:e[d],valueSpec:s[d],validateSpec:r.validateSpec,style:o,styleSpec:i}):[new _e(d,e[d],`unknown property "${d}"`)])}return l}function Zc(r){const e=r.value,i=r.styleSpec,s=i.sky,o=r.style,l=Ne(e);if(e===void 0)return[];if(l!=="object")return[new _e("sky",e,`object expected, ${l} found`)];let u=[];for(const d in e)u=u.concat(s[d]?r.validateSpec({key:d,value:e[d],valueSpec:s[d],style:o,styleSpec:i}):[new _e(d,e[d],`unknown property "${d}"`)]);return u}function _l(r){const e=r.value,i=r.styleSpec,s=i.terrain,o=r.style;let l=[];const u=Ne(e);if(e===void 0)return l;if(u!=="object")return l=l.concat([new _e("terrain",e,`object expected, ${u} found`)]),l;for(const d in e)l=l.concat(s[d]?r.validateSpec({key:d,value:e[d],valueSpec:s[d],validateSpec:r.validateSpec,style:o,styleSpec:i}):[new _e(d,e[d],`unknown property "${d}"`)]);return l}function yl(r){let e=[];const i=r.value,s=r.key;if(Array.isArray(i)){const o=[],l=[];for(const u in i)i[u].id&&o.includes(i[u].id)&&e.push(new _e(s,i,`all the sprites' ids must be unique, but ${i[u].id} is duplicated`)),o.push(i[u].id),i[u].url&&l.includes(i[u].url)&&e.push(new _e(s,i,`all the sprites' URLs must be unique, but ${i[u].url} is duplicated`)),l.push(i[u].url),e=e.concat(vi({key:`${s}[${u}]`,value:i[u],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:r.validateSpec}));return e}return Rr({key:s,value:i})}function qc(r){return!!r&&r.constructor===Object}function Us(r){return qc(r.value)?[]:[new _e(r.key,r.value,`object expected, ${Ne(r.value)} found`)]}const vl={"*":()=>[],array:Go,boolean:function(r){const e=r.value,i=r.key,s=Ne(e);return s!=="boolean"?[new _e(i,e,`boolean expected, ${s} found`)]:[]},number:ts,color:js,constants:Vc,enum:vn,filter:is,function:$o,layer:$c,object:vi,source:gl,light:Ns,sky:Zc,terrain:_l,projection:function(r){const e=r.value,i=r.styleSpec,s=i.projection,o=r.style,l=Ne(e);if(e===void 0)return[];if(l!=="object")return[new _e("projection",e,`object expected, ${l} found`)];let u=[];for(const d in e)u=u.concat(s[d]?r.validateSpec({key:d,value:e[d],valueSpec:s[d],style:o,styleSpec:i}):[new _e(d,e[d],`unknown property "${d}"`)]);return u},projectionDefinition:function(r){const e=r.key;let i=r.value;i=i instanceof String?i.valueOf():i;const s=Ne(i);return s!=="array"||(function(o){return Array.isArray(o)&&o.length===3&&typeof o[0]=="string"&&typeof o[1]=="string"&&typeof o[2]=="number"})(i)||(function(o){return!!["interpolate","step","literal"].includes(o[0])})(i)?["array","string"].includes(s)?[]:[new _e(e,i,`projection expected, invalid type "${s}" found`)]:[new _e(e,i,`projection expected, invalid array ${JSON.stringify(i)} found`)]},string:Rr,formatted:function(r){return Rr(r).length===0?[]:kr(r)},resolvedImage:function(r){return Rr(r).length===0?[]:kr(r)},padding:function(r){const e=r.key,i=r.value;if(Ne(i)==="array"){if(i.length<1||i.length>4)return[new _e(e,i,`padding requires 1 to 4 values; ${i.length} values found`)];const s={type:"number"};let o=[];for(let l=0;l<i.length;l++)o=o.concat(r.validateSpec({key:`${e}[${l}]`,value:i[l],validateSpec:r.validateSpec,valueSpec:s}));return o}return ts({key:e,value:i,valueSpec:{}})},numberArray:function(r){const e=r.key,i=r.value;if(Ne(i)==="array"){const s={type:"number"};if(i.length<1)return[new _e(e,i,"array length at least 1 expected, length 0 found")];let o=[];for(let l=0;l<i.length;l++)o=o.concat(r.validateSpec({key:`${e}[${l}]`,value:i[l],validateSpec:r.validateSpec,valueSpec:s}));return o}return ts({key:e,value:i,valueSpec:{}})},colorArray:function(r){const e=r.key,i=r.value;if(Ne(i)==="array"){if(i.length<1)return[new _e(e,i,"array length at least 1 expected, length 0 found")];let s=[];for(let o=0;o<i.length;o++)s=s.concat(js({key:`${e}[${o}]`,value:i[o]}));return s}return js({key:e,value:i})},variableAnchorOffsetCollection:function(r){const e=r.key,i=r.value,s=Ne(i),o=r.styleSpec;if(s!=="array"||i.length<1||i.length%2!=0)return[new _e(e,i,"variableAnchorOffsetCollection requires a non-empty array of even length")];let l=[];for(let u=0;u<i.length;u+=2)l=l.concat(vn({key:`${e}[${u}]`,value:i[u],valueSpec:o.layout_symbol["text-anchor"]})),l=l.concat(Go({key:`${e}[${u+1}]`,value:i[u+1],valueSpec:{length:2,value:"number"},validateSpec:r.validateSpec,style:r.style,styleSpec:o}));return l},sprite:yl,state:Us,fontFaces:function(r){const e=r.key,i=r.value,s=r.validateSpec,o=r.styleSpec,l=r.style;if(!qc(i))return[new _e(e,i,`object expected, ${Ne(i)} found`)];const u=[];for(const d in i){const g=i[d],m=Ne(g);if(m==="string")u.push(...Rr({key:`${e}.${d}`,value:g}));else if(m==="array"){const v={url:{type:"string",required:!0},"unicode-range":{type:"array",value:"string"}};for(const[_,T]of g.entries())u.push(...vi({key:`${e}.${d}[${_}]`,value:T,valueSpec:v,styleSpec:o,style:l,validateSpec:s}))}else u.push(new _e(`${e}.${d}`,g,`string or array expected, ${m} found`))}return u}};function Gs(r){const e=r.value,i=r.valueSpec,s=r.styleSpec;return r.validateSpec=Gs,i.expression&&Bo(St(e))?$o(r):i.expression&&Oo(yn(e))?kr(r):i.type&&vl[i.type]?vl[i.type](r):vi(rn({},r,{valueSpec:i.type?s[i.type]:i}))}function rs(r){const e=r.value,i=r.key,s=Rr(r);return s.length||(e.indexOf("{fontstack}")===-1&&s.push(new _e(i,e,'"glyphs" url must include a "{fontstack}" token')),e.indexOf("{range}")===-1&&s.push(new _e(i,e,'"glyphs" url must include a "{range}" token'))),s}function Oi(r,e=ce){let i=[];return i=i.concat(Gs({key:"",value:r,valueSpec:e.$root,styleSpec:e,style:r,validateSpec:Gs,objectElementValidators:{glyphs:rs,"*":()=>[]}})),r.constants&&(i=i.concat(Vc({key:"constants",value:r.constants}))),Wc(i)}function Yi(r){return function(e){return r(Object.assign({},e,{validateSpec:Gs}))}}function Wc(r){return[].concat(r).sort(((e,i)=>e.line-i.line))}function Ki(r){return function(...e){return Wc(r.apply(this,e))}}Oi.source=Ki(Yi(gl)),Oi.sprite=Ki(Yi(yl)),Oi.glyphs=Ki(Yi(rs)),Oi.light=Ki(Yi(Ns)),Oi.sky=Ki(Yi(Zc)),Oi.terrain=Ki(Yi(_l)),Oi.state=Ki(Yi(Us)),Oi.layer=Ki(Yi($c)),Oi.filter=Ki(Yi(is)),Oi.paintProperty=Ki(Yi(Uc)),Oi.layoutProperty=Ki(Yi(Gc));const th={type:"enum","property-type":"data-constant",expression:{interpolated:!1,parameters:["global-state"]},values:{visible:{},none:{}},transition:!1,default:"visible"};class ih{constructor(e,i){this._globalState=i,this.setValue(e)}evaluate(){var e;return(e=this._literalValue)!==null&&e!==void 0?e:this._compiledValue.evaluate({})}setValue(e){if(e==null||e==="visible"||e==="none")return this._literalValue=e==="none"?"none":"visible",this._compiledValue=void 0,void(this._globalStateRefs=new Set);const i=Ls(e,th,this._globalState);if(i.result==="error")throw this._literalValue="visible",this._compiledValue=void 0,new Error(i.value.map((s=>`${s.key}: ${s.message}`)).join(", "));this._literalValue=void 0,this._compiledValue=i.value,this._globalStateRefs=Qn(i.value.expression)}getGlobalStateRefs(){return this._globalStateRefs}}const $s=ce,ir=Oi,Ci=ir.light,Zs=ir.sky,Hc=ir.paintProperty,rh=ir.layoutProperty;function Xc(r,e){let i=!1;if(e?.length)for(const s of e)r.fire(new Fn(new Error(s.message))),i=!0;return i}class hr{constructor(e,i,s){const o=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;const u=new Int32Array(this.arrayBuffer);e=u[0],this.d=(i=u[1])+2*(s=u[2]);for(let g=0;g<this.d*this.d;g++){const m=u[3+g],v=u[3+g+1];o.push(m===v?null:u.subarray(m,v))}const d=u[3+o.length+1];this.keys=u.subarray(u[3+o.length],d),this.bboxes=u.subarray(d),this.insert=this._insertReadonly}else{this.d=i+2*s;for(let u=0;u<this.d*this.d;u++)o.push([]);this.keys=[],this.bboxes=[]}this.n=i,this.extent=e,this.padding=s,this.scale=i/e,this.uid=0;const l=s/i*e;this.min=-l,this.max=e+l}insert(e,i,s,o,l){this._forEachCell(i,s,o,l,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(i),this.bboxes.push(s),this.bboxes.push(o),this.bboxes.push(l)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(e,i,s,o,l,u){this.cells[l].push(u)}query(e,i,s,o,l){const u=this.min,d=this.max;if(e<=u&&i<=u&&d<=s&&d<=o&&!l)return[...this.keys];{const g=[];return this._forEachCell(e,i,s,o,this._queryCell,g,{},l),g}}_queryCell(e,i,s,o,l,u,d,g){const m=this.cells[l];if(m!==null){const v=this.keys,_=this.bboxes;for(const T of m)if(d[T]===void 0){const b=4*T;(g?g(_[b+0],_[b+1],_[b+2],_[b+3]):e<=_[b+2]&&i<=_[b+3]&&s>=_[b+0]&&o>=_[b+1])?(d[T]=!0,u.push(v[T])):d[T]=!1}}}_forEachCell(e,i,s,o,l,u,d,g){const m=this._convertToCellCoord(e),v=this._convertToCellCoord(i),_=this._convertToCellCoord(s),T=this._convertToCellCoord(o);for(let b=m;b<=_;b++)for(let I=v;I<=T;I++){const M=this.d*I+b;if((!g||g(this._convertFromCellCoord(b),this._convertFromCellCoord(I),this._convertFromCellCoord(b+1),this._convertFromCellCoord(I+1)))&&l.call(this,e,i,s,o,M,u,d,g))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const e=this.cells,i=3+this.cells.length+1+1;let s=0;for(const u of this.cells)s+=u.length;const o=new Int32Array(i+s+this.keys.length+this.bboxes.length);o[0]=this.extent,o[1]=this.n,o[2]=this.padding;let l=i;for(let u=0;u<e.length;u++){const d=e[u];o[3+u]=l,o.set(d,l),l+=d.length}return o[3+e.length]=l,o.set(this.keys,l),l+=this.keys.length,o[3+e.length+1]=l,o.set(this.bboxes,l),l+=this.bboxes.length,o.buffer}static serialize(e,i){const s=e.toArrayBuffer();return i&&i.push(s),{buffer:s}}static deserialize(e){return new hr(e.buffer)}}const rr={};function Se(r,e,i={}){if(rr[r])throw new Error(`${r} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:r,writeable:!1}),rr[r]={klass:e,omit:i.omit||[],shallow:i.shallow||[]}}Se("Object",Object),Se("Set",Set),Se("TransferableGridIndex",hr),Se("Color",Ve),Se("Error",Error),Se("AJAXError",kn),Se("ResolvedImage",Ii),Se("StylePropertyFunction",No),Se("StyleExpression",Fs,{omit:["_evaluator"]}),Se("ZoomDependentExpression",jo),Se("ZoomConstantExpression",Vo),Se("CompoundExpression",Bi,{omit:["_evaluate"]});for(const r in Yn)Yn[r]._classRegistryKey||Se(`Expression_${r}`,Yn[r]);function Yc(r){var e;return r&&typeof ArrayBuffer<"u"&&(r instanceof ArrayBuffer||((e=r.constructor)===null||e===void 0?void 0:e.name)==="ArrayBuffer")}function qs(r){return r.$name||r.constructor._classRegistryKey}function Kc(r){return!(function(e){if(e===null||typeof e!="object")return!1;const i=qs(e);return i&&i!=="Object"})(r)&&(r==null||typeof r=="boolean"||typeof r=="number"||typeof r=="string"||r instanceof Boolean||r instanceof Number||r instanceof String||r instanceof Date||r instanceof RegExp||r instanceof Blob||r instanceof Error||Yc(r)||Kr(r)||ArrayBuffer.isView(r)||r instanceof ImageData)}function dr(r,e){if(Kc(r))return(Yc(r)||Kr(r))&&e&&e.push(r),ArrayBuffer.isView(r)&&e&&e.push(r.buffer),r instanceof ImageData&&e&&e.push(r.data.buffer),r;if(Array.isArray(r)){const l=[];for(const u of r)l.push(dr(u,e));return l}if(typeof r!="object")throw new Error("can't serialize object of type "+typeof r);const i=qs(r);if(!i)throw new Error(`can't serialize object of unregistered class ${r.constructor.name}`);if(!rr[i])throw new Error(`${i} is not registered.`);const{klass:s}=rr[i],o=s.serialize?s.serialize(r,e):{};if(s.serialize){if(o===e?.[e.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const l in r){if(!r.hasOwnProperty(l)||rr[i].omit.includes(l))continue;const u=r[l];o[l]=rr[i].shallow.includes(l)?u:dr(u,e)}r instanceof Error&&(o.message=r.message)}if(o.$name)throw new Error("$name property is reserved for worker serialization logic.");return i!=="Object"&&(o.$name=i),o}function Ws(r){if(Kc(r))return r;if(Array.isArray(r))return r.map(Ws);if(typeof r!="object")throw new Error("can't deserialize object of type "+typeof r);const e=qs(r)||"Object";if(!rr[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:i}=rr[e];if(!i)throw new Error(`can't deserialize unregistered class ${e}`);if(i.deserialize)return i.deserialize(r);const s=Object.create(i.prototype);for(const o of Object.keys(r)){if(o==="$name")continue;const l=r[o];s[o]=rr[e].shallow.includes(o)?l:Ws(l)}return s}class xl{constructor(){this.first=!0}update(e,i){const s=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=s,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=s,!0):(this.lastFloorZoom>s?(this.lastIntegerZoom=s+1,this.lastIntegerZoomTime=i):this.lastFloorZoom<s&&(this.lastIntegerZoom=s,this.lastIntegerZoomTime=i),e!==this.lastZoom&&(this.lastZoom=e,this.lastFloorZoom=s,!0))}}function nh(r){return/[\u02EA\u02EB\u2E80-\u2FDF\u2FF0-\u303F\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FD-\u30FF\u3105-\u312F\u31A0-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE4F\uFF00-\uFFEF]|\uD81B[\uDFE0-\uDFFF]|[\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFFF]|\uD82C[\uDC00-\uDEFB]|\uD83C[\uDE00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(r))}function xn(r){return/[\u02EA\u02EB\u1100-\u11FF\u1400-\u167F\u18B0-\u18F5\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u3007\u3012\u3013\u3020-\u302F\u3031-\u303F\u3041-\u3096\u309D-\u30FB\u30FD-\u30FF\u3105-\u312F\u3131-\u318E\u3190-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE48\uFE50-\uFE57\uFE5F-\uFE62\uFE67-\uFE6F\uFF00-\uFF07\uFF0A-\uFF0C\uFF0E-\uFF19\uFF1F-\uFF3A\uFF3C\uFF3E\uFF40-\uFF5A\uFFE0-\uFFE2\uFFE4-\uFFE7]|\uD802[\uDD80-\uDD9F]|\uD805[\uDD80-\uDDFF]|\uD806[\uDE00-\uDEBF]|\uD811[\uDC00-\uDE7F]|\uD81B[\uDFE0-\uDFE4\uDFF0-\uDFF6]|[\uD81C-\uD822\uD83D\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD30-\uDEFB]|\uD833[\uDEC0-\uDFCF]|\uD834[\uDC00-\uDDFF\uDEE0-\uDF7F]|\uD836[\uDC00-\uDEAF]|\uD83C[\uDC00-\uDE00\uDF00-\uDFFF]|\uD83E[\uDD00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(r))}function Jc(r){return/\s/u.test(String.fromCodePoint(r))}function bl(r){for(const e of r)if(xn(e.codePointAt(0)))return!0;return!1}function Zo(r){for(const e of r)if(!qo(e.codePointAt(0)))return!1;return!0}function Qc(r){const e=r.map((i=>{try{return new RegExp(`\\p{sc=${i}}`,"u").source}catch{return null}})).filter((i=>i));return new RegExp(e.join("|"),"u")}const wl=Qc(["Arab","Dupl","Mong","Ougr","Syrc"]);function qo(r){return!wl.test(String.fromCodePoint(r))}function Tl(r){return!(xn(r)||(e=r,/[\xA7\xA9\xAE\xB1\xBC-\xBE\xD7\xF7\u2016\u2020\u2021\u2030\u2031\u203B\u203C\u2042\u2047-\u2049\u2051\u2100-\u218F\u221E\u2234\u2235\u2300-\u2307\u230C-\u231F\u2324-\u2328\u232B\u237D-\u239A\u23BE-\u23CD\u23CF\u23D1-\u23DB\u23E2-\u2422\u2424-\u24FF\u25A0-\u2619\u2620-\u2767\u2776-\u2793\u2B12-\u2B2F\u2B50-\u2B59\u2BB8-\u2BEB\u3000-\u303F\u30A0-\u30FF\uE000-\uF8FF\uFE30-\uFE6F\uFF00-\uFFEF\uFFFC\uFFFD]|[\uDB80-\uDBFF][\uDC00-\uDFFF]/gim.test(String.fromCodePoint(e))));var e}const eu=Qc(["Adlm","Arab","Armi","Avst","Chrs","Cprt","Egyp","Elym","Gara","Hatr","Hebr","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogo","Syrc","Thaa","Todr","Yezi"]);function Sl(r){return eu.test(String.fromCodePoint(r))}function tu(r,e){return!(!e&&Sl(r)||/[\u0900-\u0DFF\u0F00-\u109F\u1780-\u17FF]/gim.test(String.fromCodePoint(r)))}function Pl(r){for(const e of r)if(Sl(e.codePointAt(0)))return!0;return!1}const pr=new class{constructor(){this.TIMEOUT=5e3,this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null,this.loadScriptResolve=()=>{}}setState(r){this.pluginStatus=r.pluginStatus,this.pluginURL=r.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(r){if(pr.isParsed())throw new Error("RTL text plugin already registered.");this.applyArabicShaping=r.applyArabicShaping,this.processBidirectionalText=r.processBidirectionalText,this.processStyledBidirectionalText=r.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getRTLTextPluginStatus(){return this.pluginStatus}syncState(r,e){return p(this,void 0,void 0,(function*(){if(this.isParsed())return this.getState();if(r.pluginStatus!=="loading")return this.setState(r),r;const i=r.pluginURL,s=new Promise((l=>{this.loadScriptResolve=l}));e(i);const o=new Promise((l=>setTimeout((()=>l()),this.TIMEOUT)));if(yield Promise.race([s,o]),this.isParsed()){const l={pluginStatus:"loaded",pluginURL:i};return this.setState(l),l}throw this.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${i}`)}))}};class at{constructor(e,i){this.isSupportedScript=iu,this.zoom=e,i?(this.now=i.now||0,this.fadeDuration=i.fadeDuration||0,this.zoomHistory=i.zoomHistory||new xl,this.transition=i.transition||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new xl,this.transition={})}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const e=this.zoom,i=e-Math.floor(e),s=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:i+(1-i)*s}:{fromScale:.5,toScale:1,t:1-(1-s)*i}}}function iu(r){return(function(e,i){for(const s of e)if(!tu(s.codePointAt(0),i))return!1;return!0})(r,pr.getRTLTextPluginStatus()==="loaded")}const Wo="-transition";class Hs{constructor(e,i,s){this.property=e,this.value=i,this.expression=(function(o,l,u){if(Bo(o))return new No(o,l);if(Oo(o)){const d=Bc(o,l,u);if(d.result==="error")throw new Error(d.value.map((g=>`${g.key}: ${g.message}`)).join(", "));return d.value}{let d=o;return l.type==="color"&&typeof o=="string"?d=Ve.parse(o):l.type!=="padding"||typeof o!="number"&&!Array.isArray(o)?l.type!=="numberArray"||typeof o!="number"&&!Array.isArray(o)?l.type!=="colorArray"||typeof o!="string"&&!Array.isArray(o)?l.type==="variableAnchorOffsetCollection"&&Array.isArray(o)?d=oi.parse(o):l.type==="projectionDefinition"&&typeof o=="string"&&(d=ai.parse(o)):d=Re.parse(o):d=dt.parse(o):d=Kt.parse(o),{globalStateRefs:new Set,_globalState:null,kind:"constant",evaluate:()=>d}}})(i===void 0?e.specification.default:i,e.specification,s)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}possiblyEvaluate(e,i,s){return this.property.possiblyEvaluate(this,e,i,s)}}class Il{constructor(e,i){this.property=e,this.value=new Hs(e,void 0,i)}transitioned(e,i){return new El(this.property,this.value,i,Fi({},e.transition,this.transition),e.now)}untransitioned(){return new El(this.property,this.value,null,{},0)}}class Ml{constructor(e,i){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues),this._globalState=i}hasProperty(e){return e in this._properties.defaultTransitionablePropertyValues}getValue(e){return ke(this._values[e].value.value)}setValue(e,i){Object.hasOwn(this._values,e)||(this._values[e]=new Il(this._values[e].property,this._globalState)),this._values[e].value=new Hs(this._values[e].property,i===null?void 0:ke(i),this._globalState)}getTransition(e){return ke(this._values[e].transition)}setTransition(e,i){Object.hasOwn(this._values,e)||(this._values[e]=new Il(this._values[e].property,this._globalState)),this._values[e].transition=ke(i)||void 0}serialize(){const e={};for(const i of Object.keys(this._values)){const s=this.getValue(i);s!==void 0&&(e[i]=s);const o=this.getTransition(i);o!==void 0&&(e[`${i}${Wo}`]=o)}return e}transitioned(e,i){const s=new ru(this._properties);for(const o of Object.keys(this._values))s._values[o]=this._values[o].transitioned(e,i._values[o]);return s}untransitioned(){const e=new ru(this._properties);for(const i of Object.keys(this._values))e._values[i]=this._values[i].untransitioned();return e}}class El{constructor(e,i,s,o,l){this.property=e,this.value=i,this.begin=l+o.delay||0,this.end=this.begin+o.duration||0,e.specification.transition&&(o.delay||o.duration)&&(this.prior=s)}possiblyEvaluate(e,i,s){const o=e.now||0,l=this.value.possiblyEvaluate(e,i,s),u=this.prior;if(u){if(o>this.end)return this.prior=null,l;if(this.value.isDataDriven())return this.prior=null,l;if(o<this.begin)return u.possiblyEvaluate(e,i,s);{const d=(o-this.begin)/(this.end-this.begin);return this.property.interpolate(u.possiblyEvaluate(e,i,s),l,Sr(d))}}return l}}class ru{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,i,s){const o=new Xs(this._properties);for(const l of Object.keys(this._values))o._values[l]=this._values[l].possiblyEvaluate(e,i,s);return o}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class sh{constructor(e,i){this._properties=e,this._values=Object.create(e.defaultPropertyValues),this._globalState=i}hasValue(e){return this._values[e].value!==void 0}hasProperty(e){return e in this._properties.defaultPropertyValues}getValue(e){return ke(this._values[e].value)}setValue(e,i){this._values[e]=new Hs(this._values[e].property,i===null?void 0:ke(i),this._globalState)}serialize(){const e={};for(const i of Object.keys(this._values)){const s=this.getValue(i);s!==void 0&&(e[i]=s)}return e}possiblyEvaluate(e,i,s){const o=new Xs(this._properties);for(const l of Object.keys(this._values))o._values[l]=this._values[l].possiblyEvaluate(e,i,s);return o}}class Ji{constructor(e,i,s){this.property=e,this.value=i,this.parameters=s}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,i,s,o){return this.property.evaluate(this.value,this.parameters,e,i,s,o)}}class Xs{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class Ie{constructor(e){this.specification=e}possiblyEvaluate(e,i){if(e.isDataDriven())throw new Error("Value should not be data driven");return e.expression.evaluate(i)}interpolate(e,i,s){const o=Mi[this.specification.type];return o?o(e,i,s):e}}class Ce{constructor(e,i){this.specification=e,this.overrides=i}possiblyEvaluate(e,i,s,o){return new Ji(this,e.expression.kind==="constant"||e.expression.kind==="camera"?{kind:"constant",value:e.expression.evaluate(i,null,{},s,o)}:e.expression,i)}interpolate(e,i,s){if(e.value.kind!=="constant"||i.value.kind!=="constant")return e;if(e.value.value===void 0||i.value.value===void 0)return new Ji(this,{kind:"constant",value:void 0},e.parameters);const o=Mi[this.specification.type];if(o){const l=o(e.value.value,i.value.value,s);return new Ji(this,{kind:"constant",value:l},e.parameters)}return e}evaluate(e,i,s,o,l,u){return e.kind==="constant"?e.value:e.evaluate(i,s,o,l,u)}}class Fr extends Ce{possiblyEvaluate(e,i,s,o){if(e.value===void 0)return new Ji(this,{kind:"constant",value:void 0},i);if(e.expression.kind==="constant"){const l=e.expression.evaluate(i,null,{},s,o),u=e.property.specification.type==="resolvedImage"&&typeof l!="string"?l.name:l,d=this._calculate(u,u,u,i);return new Ji(this,{kind:"constant",value:d},i)}if(e.expression.kind==="camera"){const l=this._calculate(e.expression.evaluate({zoom:i.zoom-1}),e.expression.evaluate({zoom:i.zoom}),e.expression.evaluate({zoom:i.zoom+1}),i);return new Ji(this,{kind:"constant",value:l},i)}return new Ji(this,e.expression,i)}evaluate(e,i,s,o,l,u){if(e.kind==="source"){const d=e.evaluate(i,s,o,l,u);return this._calculate(d,d,d,i)}return e.kind==="composite"?this._calculate(e.evaluate({zoom:Math.floor(i.zoom)-1},s,o),e.evaluate({zoom:Math.floor(i.zoom)},s,o),e.evaluate({zoom:Math.floor(i.zoom)+1},s,o),i):e.value}_calculate(e,i,s,o){return o.zoom>o.zoomHistory.lastIntegerZoom?{from:e,to:i}:{from:s,to:i}}interpolate(e){return e}}class nu{constructor(e){this.specification=e}possiblyEvaluate(e,i,s,o){if(e.value!==void 0){if(e.expression.kind==="constant"){const l=e.expression.evaluate(i,null,{},s,o);return this._calculate(l,l,l,i)}return this._calculate(e.expression.evaluate(new at(Math.floor(i.zoom-1),i)),e.expression.evaluate(new at(Math.floor(i.zoom),i)),e.expression.evaluate(new at(Math.floor(i.zoom+1),i)),i)}}_calculate(e,i,s,o){return o.zoom>o.zoomHistory.lastIntegerZoom?{from:e,to:i}:{from:s,to:i}}interpolate(e){return e}}class ns{constructor(e){this.specification=e}possiblyEvaluate(e,i,s,o){return!!e.expression.evaluate(i,null,{},s,o)}interpolate(){return!1}}class li{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const i in e){const s=e[i];s.specification.overridable&&this.overridableProperties.push(i);const o=this.defaultPropertyValues[i]=new Hs(s,void 0,void 0),l=this.defaultTransitionablePropertyValues[i]=new Il(s,void 0);this.defaultTransitioningPropertyValues[i]=l.untransitioned(),this.defaultPossiblyEvaluatedValues[i]=o.possiblyEvaluate({})}}}Se("DataDrivenProperty",Ce),Se("DataConstantProperty",Ie),Se("CrossFadedDataDrivenProperty",Fr),Se("CrossFadedProperty",nu),Se("ColorRampProperty",ns);const su=" is a PAINT property not a LAYOUT property. Use get/setPaintProperty instead?",Ho=" is a LAYOUT property not a PAINT property. Use get/setLayoutProperty instead?";class Vi extends po{constructor(e,i,s){if(super(),this.id=e.id,this.type=e.type,this._globalState=s,this._featureFilter={filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set},this._visibilityExpression=(function(o,l){return new ih(o,l)})(this.visibility,s),e.type!=="custom"&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type!=="background"&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter,this._featureFilter=Bs(e.filter,s)),i.layout&&(this._unevaluatedLayout=new sh(i.layout,s)),i.paint)){this._transitionablePaint=new Ml(i.paint,s);for(const o in e.paint)this.setPaintProperty(o,e.paint[o],{validate:!1});for(const o in e.layout)this.setLayoutProperty(o,e.layout[o],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Xs(i.paint)}}setFilter(e){this.filter=e,this._featureFilter=Bs(e,this._globalState)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){var i;if(e==="visibility")return this.visibility;if(!((i=this._transitionablePaint)===null||i===void 0)&&i.hasProperty(e))throw new Error(e+su);if(!this._unevaluatedLayout)throw new Error(`Cannot get layout property "${e}" on layer type "${this.type}" which has no layout properties.`);return this._unevaluatedLayout.getValue(e)}getLayoutAffectingGlobalStateRefs(){const e=new Set;for(const i of this._visibilityExpression.getGlobalStateRefs())e.add(i);if(this._unevaluatedLayout)for(const i in this._unevaluatedLayout._values){const s=this._unevaluatedLayout._values[i];for(const o of s.getGlobalStateRefs())e.add(o)}for(const i of this._featureFilter.getGlobalStateRefs())e.add(i);return e}getPaintAffectingGlobalStateRefs(){var e;const i=new globalThis.Map;if(this._transitionablePaint)for(const s in this._transitionablePaint._values){const o=this._transitionablePaint._values[s].value;for(const l of o.getGlobalStateRefs()){const u=(e=i.get(l))!==null&&e!==void 0?e:[];u.push({name:s,value:o.value}),i.set(l,u)}}return i}getVisibilityAffectingGlobalStateRefs(){return this._visibilityExpression.getGlobalStateRefs()}setLayoutProperty(e,i,s={}){var o;if(e==="visibility")return this.visibility=i,this._visibilityExpression.setValue(i),void this.recalculateVisibility();!((o=this._transitionablePaint)===null||o===void 0)&&o.hasProperty(e)?this.fire(new Fn(new Error(e+su))):i!=null&&this._validate(rh,`layers.${this.id}.layout.${e}`,e,i,s)||this._unevaluatedLayout.setValue(e,i)}getPaintProperty(e){var i,s;if(e.endsWith(Wo)){const o=e.slice(0,-11);if(o==="visibility"||!((i=this._unevaluatedLayout)===null||i===void 0)&&i.hasProperty(o))throw new Error(e+Ho);return this._transitionablePaint.getTransition(o)}if(e==="visibility"||!((s=this._unevaluatedLayout)===null||s===void 0)&&s.hasProperty(e))throw new Error(e+Ho);return this._transitionablePaint.getValue(e)}setPaintProperty(e,i,s={}){var o;if(e==="visibility"||!((o=this._unevaluatedLayout)===null||o===void 0)&&o.hasProperty(e))return this.fire(new Fn(new Error(e+Ho))),!1;if(i!=null&&this._validate(Hc,`layers.${this.id}.paint.${e}`,e,i,s))return!1;if(e.endsWith(Wo))return this._transitionablePaint.setTransition(e.slice(0,-11),i||void 0),!1;{const l=this._transitionablePaint._values[e],u=l.property.specification["property-type"]==="cross-faded-data-driven",d=l.value.isDataDriven(),g=l.value;this._transitionablePaint.setValue(e,i),this._handleSpecialPaintPropertyUpdate(e);const m=this._transitionablePaint._values[e].value;return m.isDataDriven()||d||u||this._handleOverridablePaintPropertyUpdate(e,g,m)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,i,s){return!1}isHidden(e=this.minzoom,i=!1){return!!(this.minzoom&&e<(i?Math.floor(this.minzoom):this.minzoom))||!!(this.maxzoom&&e>=this.maxzoom)||this._evaluatedVisibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculateVisibility(){this._evaluatedVisibility=this._visibilityExpression.evaluate()}recalculate(e,i){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,i)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,i)}serialize(){var e,i;const s={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:(e=this._unevaluatedLayout)===null||e===void 0?void 0:e.serialize(),paint:(i=this._transitionablePaint)===null||i===void 0?void 0:i.serialize()};return this.visibility&&(s.layout||(s.layout={}),s.layout.visibility=this.visibility),Yr(s,((o,l)=>!(o===void 0||l==="layout"&&!Object.keys(o).length||l==="paint"&&!Object.keys(o).length)))}_validate(e,i,s,o,l={}){return l?.validate!==!1&&Xc(this,e.call(ir,{key:i,layerType:this.type,objectKey:s,value:o,styleSpec:ce,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const e in this.paint._values){const i=this.paint.get(e);if(i instanceof Ji&&Jn(i.property.specification)&&(i.value.kind==="source"||i.value.kind==="composite")&&i.value.isStateDependent)return!0}return!1}}let Cl;var oh={get paint(){return Cl=Cl||new li({"raster-opacity":new Ie(ce.paint_raster["raster-opacity"]),"raster-hue-rotate":new Ie(ce.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Ie(ce.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Ie(ce.paint_raster["raster-brightness-max"]),"raster-saturation":new Ie(ce.paint_raster["raster-saturation"]),"raster-contrast":new Ie(ce.paint_raster["raster-contrast"]),resampling:new Ie(ce.paint_raster.resampling),"raster-resampling":new Ie(ce.paint_raster["raster-resampling"]),"raster-fade-duration":new Ie(ce.paint_raster["raster-fade-duration"])})}};class ah extends Vi{constructor(e,i){super(e,oh,i)}}const lh={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Ys{constructor(e,i){this._structArray=e,this._pos1=i*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class pt{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,i){return e._trim(),i&&(e.isTransferred=!0,i.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const i=Object.create(this.prototype);return i.arrayBuffer=e.arrayBuffer,i.length=e.length,i.capacity=e.arrayBuffer.byteLength/i.bytesPerElement,i._refreshViews(),i}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const i=this.uint8;this._refreshViews(),i&&this.uint8.set(i)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}freeBufferAfterUpload(){this.arrayBuffer=new ArrayBuffer(0),this._refreshViews()}}function lt(r,e=1){let i=0,s=0;return{members:r.map((o=>{const l=lh[o.type].BYTES_PER_ELEMENT,u=i=ou(i,Math.max(e,l)),d=o.components||1;return s=Math.max(s,l),i+=l*d,{name:o.name,type:o.type,components:d,offset:u}})),size:ou(i,Math.max(s,e)),alignment:e}}function ou(r,e){return Math.ceil(r/e)*e}class Ks extends pt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i){const s=this.length;return this.resize(s+1),this.emplace(s,e,i)}emplace(e,i,s){const o=2*e;return this.int16[o+0]=i,this.int16[o+1]=s,e}}Ks.prototype.bytesPerElement=4,Se("StructArrayLayout2i4",Ks);class Xo extends pt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s){const o=this.length;return this.resize(o+1),this.emplace(o,e,i,s)}emplace(e,i,s,o){const l=3*e;return this.int16[l+0]=i,this.int16[l+1]=s,this.int16[l+2]=o,e}}Xo.prototype.bytesPerElement=6,Se("StructArrayLayout3i6",Xo);class Yo extends pt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s,o){const l=this.length;return this.resize(l+1),this.emplace(l,e,i,s,o)}emplace(e,i,s,o,l){const u=4*e;return this.int16[u+0]=i,this.int16[u+1]=s,this.int16[u+2]=o,this.int16[u+3]=l,e}}Yo.prototype.bytesPerElement=8,Se("StructArrayLayout4i8",Yo);class Ko extends pt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s,o,l,u){const d=this.length;return this.resize(d+1),this.emplace(d,e,i,s,o,l,u)}emplace(e,i,s,o,l,u,d){const g=6*e;return this.int16[g+0]=i,this.int16[g+1]=s,this.int16[g+2]=o,this.int16[g+3]=l,this.int16[g+4]=u,this.int16[g+5]=d,e}}Ko.prototype.bytesPerElement=12,Se("StructArrayLayout2i4i12",Ko);class Al extends pt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s,o,l,u){const d=this.length;return this.resize(d+1),this.emplace(d,e,i,s,o,l,u)}emplace(e,i,s,o,l,u,d){const g=4*e,m=8*e;return this.int16[g+0]=i,this.int16[g+1]=s,this.uint8[m+4]=o,this.uint8[m+5]=l,this.uint8[m+6]=u,this.uint8[m+7]=d,e}}Al.prototype.bytesPerElement=8,Se("StructArrayLayout2i4ub8",Al);class Js extends pt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i){const s=this.length;return this.resize(s+1),this.emplace(s,e,i)}emplace(e,i,s){const o=2*e;return this.float32[o+0]=i,this.float32[o+1]=s,e}}Js.prototype.bytesPerElement=8,Se("StructArrayLayout2f8",Js);class fr extends pt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,s,o,l,u,d,g,m,v){const _=this.length;return this.resize(_+1),this.emplace(_,e,i,s,o,l,u,d,g,m,v)}emplace(e,i,s,o,l,u,d,g,m,v,_){const T=10*e;return this.uint16[T+0]=i,this.uint16[T+1]=s,this.uint16[T+2]=o,this.uint16[T+3]=l,this.uint16[T+4]=u,this.uint16[T+5]=d,this.uint16[T+6]=g,this.uint16[T+7]=m,this.uint16[T+8]=v,this.uint16[T+9]=_,e}}fr.prototype.bytesPerElement=20,Se("StructArrayLayout10ui20",fr);class Jo extends pt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,s,o,l,u,d,g){const m=this.length;return this.resize(m+1),this.emplace(m,e,i,s,o,l,u,d,g)}emplace(e,i,s,o,l,u,d,g,m){const v=8*e;return this.uint16[v+0]=i,this.uint16[v+1]=s,this.uint16[v+2]=o,this.uint16[v+3]=l,this.uint16[v+4]=u,this.uint16[v+5]=d,this.uint16[v+6]=g,this.uint16[v+7]=m,e}}Jo.prototype.bytesPerElement=16,Se("StructArrayLayout8ui16",Jo);class Qs extends pt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,s,o,l,u,d,g,m,v,_,T){const b=this.length;return this.resize(b+1),this.emplace(b,e,i,s,o,l,u,d,g,m,v,_,T)}emplace(e,i,s,o,l,u,d,g,m,v,_,T,b){const I=12*e;return this.int16[I+0]=i,this.int16[I+1]=s,this.int16[I+2]=o,this.int16[I+3]=l,this.uint16[I+4]=u,this.uint16[I+5]=d,this.uint16[I+6]=g,this.uint16[I+7]=m,this.int16[I+8]=v,this.int16[I+9]=_,this.int16[I+10]=T,this.int16[I+11]=b,e}}Qs.prototype.bytesPerElement=24,Se("StructArrayLayout4i4ui4i24",Qs);class Qo extends pt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s){const o=this.length;return this.resize(o+1),this.emplace(o,e,i,s)}emplace(e,i,s,o){const l=3*e;return this.float32[l+0]=i,this.float32[l+1]=s,this.float32[l+2]=o,e}}Qo.prototype.bytesPerElement=12,Se("StructArrayLayout3f12",Qo);class eo extends pt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint32[1*e+0]=i,e}}eo.prototype.bytesPerElement=4,Se("StructArrayLayout1ul4",eo);class Dl extends pt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,s,o,l,u,d,g,m){const v=this.length;return this.resize(v+1),this.emplace(v,e,i,s,o,l,u,d,g,m)}emplace(e,i,s,o,l,u,d,g,m,v){const _=10*e,T=5*e;return this.int16[_+0]=i,this.int16[_+1]=s,this.int16[_+2]=o,this.int16[_+3]=l,this.int16[_+4]=u,this.int16[_+5]=d,this.uint32[T+3]=g,this.uint16[_+8]=m,this.uint16[_+9]=v,e}}Dl.prototype.bytesPerElement=20,Se("StructArrayLayout6i1ul2ui20",Dl);class ss extends pt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s,o,l,u){const d=this.length;return this.resize(d+1),this.emplace(d,e,i,s,o,l,u)}emplace(e,i,s,o,l,u,d){const g=6*e;return this.int16[g+0]=i,this.int16[g+1]=s,this.int16[g+2]=o,this.int16[g+3]=l,this.int16[g+4]=u,this.int16[g+5]=d,e}}ss.prototype.bytesPerElement=12,Se("StructArrayLayout2i2i2i12",ss);class bn extends pt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s,o,l){const u=this.length;return this.resize(u+1),this.emplace(u,e,i,s,o,l)}emplace(e,i,s,o,l,u){const d=4*e,g=8*e;return this.float32[d+0]=i,this.float32[d+1]=s,this.float32[d+2]=o,this.int16[g+6]=l,this.int16[g+7]=u,e}}bn.prototype.bytesPerElement=16,Se("StructArrayLayout2f1f2i16",bn);class zl extends pt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s,o,l,u){const d=this.length;return this.resize(d+1),this.emplace(d,e,i,s,o,l,u)}emplace(e,i,s,o,l,u,d){const g=16*e,m=4*e,v=8*e;return this.uint8[g+0]=i,this.uint8[g+1]=s,this.float32[m+1]=o,this.float32[m+2]=l,this.int16[v+6]=u,this.int16[v+7]=d,e}}zl.prototype.bytesPerElement=16,Se("StructArrayLayout2ub2f2i16",zl);class to extends pt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,s){const o=this.length;return this.resize(o+1),this.emplace(o,e,i,s)}emplace(e,i,s,o){const l=3*e;return this.uint16[l+0]=i,this.uint16[l+1]=s,this.uint16[l+2]=o,e}}to.prototype.bytesPerElement=6,Se("StructArrayLayout3ui6",to);class wn extends pt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,o,l,u,d,g,m,v,_,T,b,I,M,A,D){const F=this.length;return this.resize(F+1),this.emplace(F,e,i,s,o,l,u,d,g,m,v,_,T,b,I,M,A,D)}emplace(e,i,s,o,l,u,d,g,m,v,_,T,b,I,M,A,D,F){const k=24*e,L=12*e,O=48*e;return this.int16[k+0]=i,this.int16[k+1]=s,this.uint16[k+2]=o,this.uint16[k+3]=l,this.uint32[L+2]=u,this.uint32[L+3]=d,this.uint32[L+4]=g,this.uint16[k+10]=m,this.uint16[k+11]=v,this.uint16[k+12]=_,this.float32[L+7]=T,this.float32[L+8]=b,this.uint8[O+36]=I,this.uint8[O+37]=M,this.uint8[O+38]=A,this.uint32[L+10]=D,this.int16[k+22]=F,e}}wn.prototype.bytesPerElement=48,Se("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",wn);class kl extends pt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,o,l,u,d,g,m,v,_,T,b,I,M,A,D,F,k,L,O,j,Y,J,re,te,ae,le){const ne=this.length;return this.resize(ne+1),this.emplace(ne,e,i,s,o,l,u,d,g,m,v,_,T,b,I,M,A,D,F,k,L,O,j,Y,J,re,te,ae,le)}emplace(e,i,s,o,l,u,d,g,m,v,_,T,b,I,M,A,D,F,k,L,O,j,Y,J,re,te,ae,le,ne){const ie=32*e,fe=16*e;return this.int16[ie+0]=i,this.int16[ie+1]=s,this.int16[ie+2]=o,this.int16[ie+3]=l,this.int16[ie+4]=u,this.int16[ie+5]=d,this.int16[ie+6]=g,this.int16[ie+7]=m,this.uint16[ie+8]=v,this.uint16[ie+9]=_,this.uint16[ie+10]=T,this.uint16[ie+11]=b,this.uint16[ie+12]=I,this.uint16[ie+13]=M,this.uint16[ie+14]=A,this.uint16[ie+15]=D,this.uint16[ie+16]=F,this.uint16[ie+17]=k,this.uint16[ie+18]=L,this.uint16[ie+19]=O,this.uint16[ie+20]=j,this.uint16[ie+21]=Y,this.uint16[ie+22]=J,this.uint32[fe+12]=re,this.float32[fe+13]=te,this.float32[fe+14]=ae,this.uint16[ie+30]=le,this.uint16[ie+31]=ne,e}}kl.prototype.bytesPerElement=64,Se("StructArrayLayout8i15ui1ul2f2ui64",kl);class ea extends pt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.float32[1*e+0]=i,e}}ea.prototype.bytesPerElement=4,Se("StructArrayLayout1f4",ea);class ta extends pt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s){const o=this.length;return this.resize(o+1),this.emplace(o,e,i,s)}emplace(e,i,s,o){const l=3*e;return this.uint16[6*e+0]=i,this.float32[l+1]=s,this.float32[l+2]=o,e}}ta.prototype.bytesPerElement=12,Se("StructArrayLayout1ui2f12",ta);class Rl extends pt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,s){const o=this.length;return this.resize(o+1),this.emplace(o,e,i,s)}emplace(e,i,s,o){const l=4*e;return this.uint32[2*e+0]=i,this.uint16[l+2]=s,this.uint16[l+3]=o,e}}Rl.prototype.bytesPerElement=8,Se("StructArrayLayout1ul2ui8",Rl);class h extends pt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i){const s=this.length;return this.resize(s+1),this.emplace(s,e,i)}emplace(e,i,s){const o=2*e;return this.uint16[o+0]=i,this.uint16[o+1]=s,e}}h.prototype.bytesPerElement=4,Se("StructArrayLayout2ui4",h);class t extends pt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint16[1*e+0]=i,e}}t.prototype.bytesPerElement=2,Se("StructArrayLayout1ui2",t);class n extends pt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,o){const l=this.length;return this.resize(l+1),this.emplace(l,e,i,s,o)}emplace(e,i,s,o,l){const u=4*e;return this.float32[u+0]=i,this.float32[u+1]=s,this.float32[u+2]=o,this.float32[u+3]=l,e}}n.prototype.bytesPerElement=16,Se("StructArrayLayout4f16",n);class a extends Ys{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new Te(this.anchorPointX,this.anchorPointY)}}a.prototype.size=20;class c extends Dl{get(e){return new a(this,e)}}Se("CollisionBoxArray",c);class f extends Ys{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(e){this._structArray.uint8[this._pos1+37]=e}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(e){this._structArray.uint8[this._pos1+38]=e}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(e){this._structArray.uint32[this._pos4+10]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}f.prototype.size=48;class y extends wn{get(e){return new f(this,e)}}Se("PlacedSymbolArray",y);class x extends Ys{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(e){this._structArray.uint32[this._pos4+12]=e}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}}x.prototype.size=64;class w extends kl{get(e){return new x(this,e)}}Se("SymbolInstanceArray",w);class S extends ea{getoffsetX(e){return this.float32[1*e+0]}}Se("GlyphOffsetArray",S);class P extends Xo{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}Se("SymbolLineVertexArray",P);class E extends Ys{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}}E.prototype.size=12;class C extends ta{get(e){return new E(this,e)}}Se("TextAnchorOffsetArray",C);class z extends Ys{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}}z.prototype.size=8;class B extends Rl{get(e){return new z(this,e)}}Se("FeatureIndexArray",B);class V extends Ks{}class G extends Ks{}class N extends Ks{}class $ extends Ko{}class X extends Al{}class Z extends Js{}class U extends fr{}class H extends Jo{}class q extends Qs{}class Q extends Qo{}class se extends eo{}class oe extends ss{}class de extends zl{}class he extends to{}class Pe extends h{}const ve=lt([{name:"a_pos",components:2,type:"Int16"}],4),{members:ue}=ve;class we{constructor(e=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=e}prepareSegment(e,i,s,o){const l=this.segments[this.segments.length-1];return e>we.MAX_VERTEX_ARRAY_LENGTH&&$t(`Max vertices per segment is ${we.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${we.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!l||l.vertexLength+e>we.MAX_VERTEX_ARRAY_LENGTH||l.sortKey!==o?this.createNewSegment(i,s,o):l}createNewSegment(e,i,s){const o={vertexOffset:e.length,primitiveOffset:i.length,vertexLength:0,primitiveLength:0,vaos:{}};return s!==void 0&&(o.sortKey=s),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(o),o}getOrCreateLatestSegment(e,i,s){return this.prepareSegment(0,e,i,s)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(const e of this.segments)for(const i in e.vaos)e.vaos[i].destroy()}static simpleSegment(e,i,s,o){return new we([{vertexOffset:e,primitiveOffset:i,vertexLength:s,primitiveLength:o,vaos:{},sortKey:0}])}}function Ee(r,e){return 256*(r=si(Math.floor(r),0,255))+si(Math.floor(e),0,255)}we.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Se("SegmentVector",we);const Qe=lt([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]),Pt=lt([{name:"a_dasharray_from",components:4,type:"Uint16"},{name:"a_dasharray_to",components:4,type:"Uint16"}]);var rt,Mt,Ct,Jt={exports:{}},xt={exports:{}},ci={exports:{}},Ht=(function(){if(Ct)return Jt.exports;Ct=1;var r=(rt||(rt=1,xt.exports=function(i,s){var o,l,u,d,g,m,v,_;for(l=i.length-(o=3&i.length),u=s,g=3432918353,m=461845907,_=0;_<l;)v=255&i.charCodeAt(_)|(255&i.charCodeAt(++_))<<8|(255&i.charCodeAt(++_))<<16|(255&i.charCodeAt(++_))<<24,++_,u=27492+(65535&(d=5*(65535&(u=(u^=v=(65535&(v=(v=(65535&v)*g+(((v>>>16)*g&65535)<<16)&4294967295)<<15|v>>>17))*m+(((v>>>16)*m&65535)<<16)&4294967295)<<13|u>>>19))+((5*(u>>>16)&65535)<<16)&4294967295))+((58964+(d>>>16)&65535)<<16);switch(v=0,o){case 3:v^=(255&i.charCodeAt(_+2))<<16;case 2:v^=(255&i.charCodeAt(_+1))<<8;case 1:u^=v=(65535&(v=(v=(65535&(v^=255&i.charCodeAt(_)))*g+(((v>>>16)*g&65535)<<16)&4294967295)<<15|v>>>17))*m+(((v>>>16)*m&65535)<<16)&4294967295}return u^=i.length,u=2246822507*(65535&(u^=u>>>16))+((2246822507*(u>>>16)&65535)<<16)&4294967295,u=3266489909*(65535&(u^=u>>>13))+((3266489909*(u>>>16)&65535)<<16)&4294967295,(u^=u>>>16)>>>0}),xt.exports),e=(Mt||(Mt=1,ci.exports=function(i,s){for(var o,l=i.length,u=s^l,d=0;l>=4;)o=1540483477*(65535&(o=255&i.charCodeAt(d)|(255&i.charCodeAt(++d))<<8|(255&i.charCodeAt(++d))<<16|(255&i.charCodeAt(++d))<<24))+((1540483477*(o>>>16)&65535)<<16),u=1540483477*(65535&u)+((1540483477*(u>>>16)&65535)<<16)^(o=1540483477*(65535&(o^=o>>>24))+((1540483477*(o>>>16)&65535)<<16)),l-=4,++d;switch(l){case 3:u^=(255&i.charCodeAt(d+2))<<16;case 2:u^=(255&i.charCodeAt(d+1))<<8;case 1:u=1540483477*(65535&(u^=255&i.charCodeAt(d)))+((1540483477*(u>>>16)&65535)<<16)}return u=1540483477*(65535&(u^=u>>>13))+((1540483477*(u>>>16)&65535)<<16),(u^=u>>>15)>>>0}),ci.exports);return Jt.exports=r,Jt.exports.murmur3=r,Jt.exports.murmur2=e,Jt.exports})(),Bt=wr(Ht);class Qt{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,i,s,o){this.ids.push(Lr(e)),this.positions.push(i,s,o)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const i=Lr(e);let s=0,o=this.ids.length-1;for(;s<o;){const u=s+o>>1;this.ids[u]>=i?o=u:s=u+1}const l=[];for(;this.ids[s]===i;)l.push({index:this.positions[3*s],start:this.positions[3*s+1],end:this.positions[3*s+2]}),s++;return l}static serialize(e,i){const s=new Float64Array(e.ids),o=new Uint32Array(e.positions);return Br(s,o,0,s.length-1),i&&i.push(s.buffer,o.buffer),{ids:s,positions:o}}static deserialize(e){const i=new Qt;return i.ids=e.ids,i.positions=e.positions,i.indexed=!0,i}}function Lr(r){const e=+r;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:Bt(String(r))}function Br(r,e,i,s){for(;i<s;){const o=r[i+s>>1];let l=i-1,u=s+1;for(;;){do l++;while(r[l]<o);do u--;while(r[u]>o);if(l>=u)break;Or(r,l,u),Or(e,3*l,3*u),Or(e,3*l+1,3*u+1),Or(e,3*l+2,3*u+2)}u-i<s-u?(Br(r,e,i,u),i=u+1):(Br(r,e,u+1,s),s=u)}}function Or(r,e,i){const s=r[e];r[e]=r[i],r[i]=s}Se("FeaturePositionMap",Qt);class ei{constructor(e,i){this.gl=e.gl,this.location=i}}class mr extends ei{constructor(e,i){super(e,i),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}}class Vr extends ei{constructor(e,i){super(e,i),this.current=[0,0,0,0]}set(e){e[0]===this.current[0]&&e[1]===this.current[1]&&e[2]===this.current[2]&&e[3]===this.current[3]||(this.current=e,this.gl.uniform4f(this.location,e[0],e[1],e[2],e[3]))}}class ia extends ei{constructor(e,i){super(e,i),this.current=Ve.transparent}set(e){e.r===this.current.r&&e.g===this.current.g&&e.b===this.current.b&&e.a===this.current.a||(this.current=e,this.gl.uniform4f(this.location,e.r,e.g,e.b,e.a))}}const nr=new Float32Array(16);function sr(r){return[Ee(255*r.r,255*r.g),Ee(255*r.b,255*r.a)]}class Ai{constructor(e,i,s){this.value=e,this.uniformNames=i.map((o=>`u_${o}`)),this.type=s}setUniform(e,i,s){e.set(s.constantOr(this.value))}getBinding(e,i,s){return this.type==="color"?new ia(e,i):new mr(e,i)}}class ji{constructor(e,i){this.uniformNames=i.map((s=>`u_${s}`)),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,i){this.pixelRatioFrom=i.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=i.tlbr,this.patternTo=e.tlbr}setConstantDashPositions(e,i){this.dashTo=[0,e.y,e.height,e.width],this.dashFrom=[0,i.y,i.height,i.width]}setUniform(e,i,s,o){let l=null;o==="u_pattern_to"?l=this.patternTo:o==="u_pattern_from"?l=this.patternFrom:o==="u_dasharray_to"?l=this.dashTo:o==="u_dasharray_from"?l=this.dashFrom:o==="u_pixel_ratio_to"?l=this.pixelRatioTo:o==="u_pixel_ratio_from"&&(l=this.pixelRatioFrom),l!==null&&e.set(l)}getBinding(e,i,s){return s.startsWith("u_pattern")||s.startsWith("u_dasharray_")?new Vr(e,i):new mr(e,i)}}class ft{constructor(e,i,s,o){this.expression=e,this.type=s,this.maxValue=0,this.paintVertexAttributes=i.map((l=>({name:`a_${l}`,type:"Float32",components:s==="color"?2:1,offset:0}))),this.paintVertexArray=new o}populatePaintArray(e,i,s){const o=this.paintVertexArray.length,l=this.expression.evaluate(new at(0,s),i,{},s.canonical,[],s.formattedSection);this.paintVertexArray.resize(e),this._setPaintValue(o,e,l)}updatePaintArray(e,i,s,o,l){const u=this.expression.evaluate(new at(0,l),s,o);this._setPaintValue(e,i,u)}_setPaintValue(e,i,s){if(this.type==="color"){const o=sr(s);for(let l=e;l<i;l++)this.paintVertexArray.emplace(l,o[0],o[1])}else{for(let o=e;o<i;o++)this.paintVertexArray.emplace(o,s);this.maxValue=Math.max(this.maxValue,Math.abs(s))}}upload(e){var i,s;!((i=this.paintVertexArray)===null||i===void 0)&&i.arrayBuffer.byteLength&&(!((s=this.paintVertexBuffer)===null||s===void 0)&&s.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class ct{constructor(e,i,s,o,l,u){this.expression=e,this.uniformNames=i.map((d=>`u_${d}_t`)),this.type=s,this.useIntegerZoom=o,this.zoom=l,this.maxValue=0,this.paintVertexAttributes=i.map((d=>({name:`a_${d}`,type:"Float32",components:s==="color"?4:2,offset:0}))),this.paintVertexArray=new u}populatePaintArray(e,i,s){const o=this.expression.evaluate(new at(this.zoom,s),i,{},s.canonical,[],s.formattedSection),l=this.expression.evaluate(new at(this.zoom+1,s),i,{},s.canonical,[],s.formattedSection),u=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(u,e,o,l)}updatePaintArray(e,i,s,o,l){const u=this.expression.evaluate(new at(this.zoom,l),s,o),d=this.expression.evaluate(new at(this.zoom+1,l),s,o);this._setPaintValue(e,i,u,d)}_setPaintValue(e,i,s,o){if(this.type==="color"){const l=sr(s),u=sr(o);for(let d=e;d<i;d++)this.paintVertexArray.emplace(d,l[0],l[1],u[0],u[1])}else{for(let l=e;l<i;l++)this.paintVertexArray.emplace(l,s,o);this.maxValue=Math.max(this.maxValue,Math.abs(s),Math.abs(o))}}upload(e){var i,s;!((i=this.paintVertexArray)===null||i===void 0)&&i.arrayBuffer.byteLength&&(!((s=this.paintVertexBuffer)===null||s===void 0)&&s.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,i){const s=this.useIntegerZoom?Math.floor(i.zoom):i.zoom,o=si(this.expression.interpolationFactor(s,this.zoom,this.zoom+1),0,1);e.set(o)}getBinding(e,i,s){return new mr(e,i)}}class At{constructor(e,i,s,o,l,u){this.expression=e,this.type=i,this.useIntegerZoom=s,this.zoom=o,this.layerId=u,this.zoomInPaintVertexArray=new l,this.zoomOutPaintVertexArray=new l}populatePaintArray(e,i,s){const o=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(o,e,this.getPositionIds(i),s)}updatePaintArray(e,i,s,o,l){this._setPaintValues(e,i,this.getPositionIds(s),l)}_setPaintValues(e,i,s,o){const l=this.getPositions(o);if(!l||!s)return;const u=l[s.min],d=l[s.mid],g=l[s.max];if(u&&d&&g)for(let m=e;m<i;m++)this.emplace(this.zoomInPaintVertexArray,m,d,u),this.emplace(this.zoomOutPaintVertexArray,m,d,g)}upload(e){var i,s;if(!((i=this.zoomInPaintVertexArray)===null||i===void 0)&&i.arrayBuffer.byteLength&&(!((s=this.zoomOutPaintVertexArray)===null||s===void 0)&&s.arrayBuffer.byteLength)){const o=this.getVertexAttributes();this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,o,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,o,this.expression.isStateDependent)}}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class mt extends At{getPositions(e){return e.imagePositions}getPositionIds(e){var i;return(i=e.patterns)===null||i===void 0?void 0:i[this.layerId]}getVertexAttributes(){return Qe.members}emplace(e,i,s,o){e.emplace(i,s.tlbr[0],s.tlbr[1],s.tlbr[2],s.tlbr[3],o.tlbr[0],o.tlbr[1],o.tlbr[2],o.tlbr[3],s.pixelRatio,o.pixelRatio)}}class Tn extends At{getPositions(e){return e.dashPositions}getPositionIds(e){var i;return(i=e.dashes)===null||i===void 0?void 0:i[this.layerId]}getVertexAttributes(){return Pt.members}emplace(e,i,s,o){e.emplace(i,0,s.y,s.height,s.width,0,o.y,o.height,o.width)}}class ra{constructor(e,i,s){this.binders={},this._buffers=[];const o=[];for(const l in e.paint._values){if(!s(l))continue;const u=e.paint.get(l);if(!(u instanceof Ji&&Jn(u.property.specification)))continue;const d=Fl(l,e.type),g=u.value,m=u.property.specification.type,v=u.property.useIntegerZoom,_=u.property.specification["property-type"],T=_==="cross-faded"||_==="cross-faded-data-driven";if(g.kind==="constant")this.binders[l]=T?new ji(g.value,d):new Ai(g.value,d,m),o.push(`/u_${l}`);else if(g.kind==="source"||T){const b=au(l,m,"source");this.binders[l]=T?l==="line-dasharray"?new Tn(g,m,v,i,b,e.id):new mt(g,m,v,i,b,e.id):new ft(g,d,m,b),o.push(`/a_${l}`)}else{const b=au(l,m,"composite");this.binders[l]=new ct(g,d,m,v,i,b),o.push(`/z_${l}`)}}this.cacheKey=o.sort().join("")}getMaxValue(e){const i=this.binders[e];return i instanceof ft||i instanceof ct?i.maxValue:0}populatePaintArrays(e,i,s){for(const o in this.binders){const l=this.binders[o];(l instanceof ft||l instanceof ct||l instanceof At)&&l.populatePaintArray(e,i,s)}}setConstantPatternPositions(e,i){for(const s in this.binders){const o=this.binders[s];o instanceof ji&&o.setConstantPatternPositions(e,i)}}setConstantDashPositions(e,i){for(const s in this.binders){const o=this.binders[s];o instanceof ji&&o.setConstantDashPositions(e,i)}}updatePaintArrays(e,i,s,o,l){let u=!1;for(const d in e){const g=i.getPositions(d);for(const m of g){const v=s.feature(m.index);for(const _ in this.binders){const T=this.binders[_];if((T instanceof ft||T instanceof ct||T instanceof At)&&T.expression.isStateDependent===!0){const b=o.paint.get(_);T.expression=b.value,T.updatePaintArray(m.start,m.end,v,e[d],l),u=!0}}}}return u}defines(){const e=[];for(const i in this.binders){const s=this.binders[i];(s instanceof Ai||s instanceof ji)&&e.push(...s.uniformNames.map((o=>`#define HAS_UNIFORM_${o}`)))}return e}getBinderAttributes(){const e=[];for(const i in this.binders){const s=this.binders[i];if(s instanceof ft||s instanceof ct)for(const o of s.paintVertexAttributes)e.push(o.name);else if(s instanceof At){const o=s.getVertexAttributes();for(const l of o)e.push(l.name)}}return e}getBinderUniforms(){const e=[];for(const i in this.binders){const s=this.binders[i];if(s instanceof Ai||s instanceof ji||s instanceof ct)for(const o of s.uniformNames)e.push(o)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,i){const s=[];for(const o in this.binders){const l=this.binders[o];if(l instanceof Ai||l instanceof ji||l instanceof ct){for(const u of l.uniformNames)if(i[u]){const d=l.getBinding(e,i[u],u);s.push({name:u,property:o,binding:d})}}}return s}setUniforms(e,i,s,o){for(const{name:l,property:u,binding:d}of i)this.binders[u].setUniform(d,o,s.get(u),l)}updatePaintBuffers(e){this._buffers=[];for(const i in this.binders){const s=this.binders[i];if(e&&s instanceof At){const o=e.fromScale===2?s.zoomInPaintVertexBuffer:s.zoomOutPaintVertexBuffer;o&&this._buffers.push(o)}else(s instanceof ft||s instanceof ct)&&s.paintVertexBuffer&&this._buffers.push(s.paintVertexBuffer)}}upload(e){for(const i in this.binders){const s=this.binders[i];(s instanceof ft||s instanceof ct||s instanceof At)&&s.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const i=this.binders[e];(i instanceof ft||i instanceof ct||i instanceof At)&&i.destroy()}}}class gr{constructor(e,i,s=()=>!0){this.programConfigurations={};for(const o of e)this.programConfigurations[o.id]=new ra(o,i,s);this.needsUpload=!1,this._featureMap=new Qt,this._bufferOffset=0}populatePaintArrays(e,i,s,o){for(const l in this.programConfigurations)this.programConfigurations[l].populatePaintArrays(e,i,o);i.id!==void 0&&this._featureMap.add(i.id,s,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,i,s,o){for(const l of s)this.needsUpload=this.programConfigurations[l.id].updatePaintArrays(e,this._featureMap,i,l,o)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const i in this.programConfigurations)this.programConfigurations[i].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}function Fl(r,e){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-dasharray":["dasharray_to","dasharray_from"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[r]||[r.replace(`${e}-`,"").replace(/-/g,"_")]}function au(r,e,i){const s={color:{source:Js,composite:n},number:{source:ea,composite:Js}},o=(function(l){return{"line-pattern":{source:U,composite:U},"fill-pattern":{source:U,composite:U},"fill-extrusion-pattern":{source:U,composite:U},"line-dasharray":{source:H,composite:H}}[l]})(r);return o?.[i]||s[e][i]}Se("ConstantBinder",Ai),Se("CrossFadedConstantBinder",ji),Se("SourceExpressionBinder",ft),Se("CrossFadedPatternBinder",mt),Se("CrossFadedDasharrayBinder",Tn),Se("CompositeExpressionBinder",ct),Se("ProgramConfiguration",ra,{omit:["_buffers"]}),Se("ProgramConfigurationSet",gr);const Ll=Math.pow(2,14)-1,jr=-Ll-1;function Nr(r){const e=De/r.extent,i=r.loadGeometry();for(const s of i)for(const o of s){const l=Math.round(o.x*e),u=Math.round(o.y*e);o.x=si(l,jr,Ll),o.y=si(u,jr,Ll),(l<o.x||l>o.x+1||u<o.y||u>o.y+1)&&$t("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return i}function Ur(r,e){return{type:r.type,id:r.id,properties:r.properties,geometry:e?Nr(r):[]}}const Bl=-32768;function Ol(r,e,i,s,o){r.emplaceBack(Bl+8*e+s,Bl+8*i+o)}class na{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((i=>i.id)),this.index=e.index,this.hasDependencies=!1,this.layoutVertexArray=new G,this.indexArray=new he,this.segments=new we,this.programConfigurations=new gr(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter((i=>i.isStateDependent())).map((i=>i.id))}populate(e,i,s){const o=this.layers[0],l=[];let u=null,d=!1,g=o.type==="heatmap";if(o.type==="circle"){const v=o;u=v.layout.get("circle-sort-key"),d=!u.isConstant(),g||(g=v.paint.get("circle-pitch-alignment")==="map")}const m=g?i.subdivisionGranularity.circle:1;for(const{feature:v,id:_,index:T,sourceLayerIndex:b}of e){const I=this.layers[0]._featureFilter.needGeometry,M=Ur(v,I);if(!this.layers[0]._featureFilter.filter(new at(this.zoom),M,s))continue;const A=d?u.evaluate(M,{},s):void 0,D={id:_,properties:v.properties,type:v.type,sourceLayerIndex:b,index:T,geometry:I?M.geometry:Nr(v),patterns:{},sortKey:A};l.push(D)}d&&l.sort(((v,_)=>v.sortKey-_.sortKey));for(const v of l){const{geometry:_,index:T,sourceLayerIndex:b}=v,I=e[T].feature;this.addFeature(v,_,T,s,m),i.featureIndex.insert(I,_,T,b,this.index)}}update(e,i,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,i,this.stateDependentLayers,{imagePositions:s})}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,ue),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,i,s,o,l=1){let u;switch(l){case 1:u=[0,7];break;case 3:u=[0,2,5,7];break;case 5:u=[0,1,3,4,6,7];break;case 7:u=[0,1,2,3,4,5,6,7];break;default:throw new Error(`Invalid circle bucket granularity: ${l}; valid values are 1, 3, 5, 7.`)}const d=u.length;for(const g of i)for(const m of g){const v=m.x,_=m.y;if(v<0||v>=De||_<0||_>=De)continue;const T=this.segments.prepareSegment(d*d,this.layoutVertexArray,this.indexArray,e.sortKey),b=T.vertexLength;for(let I=0;I<d;I++)for(let M=0;M<d;M++)Ol(this.layoutVertexArray,v,_,u[M],u[I]);for(let I=0;I<d-1;I++)for(let M=0;M<d-1;M++){const A=b+I*d+M,D=b+(I+1)*d+M;this.indexArray.emplaceBack(A,D+1,A+1),this.indexArray.emplaceBack(A,D,D+1)}T.vertexLength+=d*d,T.primitiveLength+=(d-1)*(d-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,{imagePositions:{},canonical:o})}}function sa(r,e){for(const i of r)if(oa(e,i))return!0;for(const i of e)if(oa(r,i))return!0;return ch(r,e)}function lu(r,e,i){return!!oa(r,e)||uh(e,r,i)}function _d(r,e){if(r.length===1)return vd(e,r[0]);for(const i of e)for(const s of i)if(oa(r,s))return!0;for(const i of r)if(vd(e,i))return!0;for(const i of e)if(ch(r,i))return!0;return!1}function Gf(r,e,i){if(r.length>1){if(ch(r,e))return!0;for(const s of e)if(uh(s,r,i))return!0}for(const s of r)if(uh(s,e,i))return!0;return!1}function ch(r,e){if(r.length===0||e.length===0)return!1;for(let i=0;i<r.length-1;i++){const s=r[i],o=r[i+1];for(let l=0;l<e.length-1;l++)if($f(s,o,e[l],e[l+1]))return!0}return!1}function $f(r,e,i,s){return Si(r,i,s)!==Si(e,i,s)&&Si(r,e,i)!==Si(r,e,s)}function uh(r,e,i){const s=i*i;if(e.length===1)return r.distSqr(e[0])<s;for(let o=1;o<e.length;o++)if(yd(r,e[o-1],e[o])<s)return!0;return!1}function yd(r,e,i){const s=e.distSqr(i);if(s===0)return r.distSqr(e);const o=((r.x-e.x)*(i.x-e.x)+(r.y-e.y)*(i.y-e.y))/s;return r.distSqr(o<0?e:o>1?i:i.sub(e)._mult(o)._add(e))}function vd(r,e){let i,s,o,l=!1;for(const u of r){i=u;for(let d=0,g=i.length-1;d<i.length;g=d++)s=i[d],o=i[g],s.y>e.y!=o.y>e.y&&e.x<(o.x-s.x)*(e.y-s.y)/(o.y-s.y)+s.x&&(l=!l)}return l}function oa(r,e){let i=!1;for(let s=0,o=r.length-1;s<r.length;o=s++){const l=r[s],u=r[o];l.y>e.y!=u.y>e.y&&e.x<(u.x-l.x)*(e.y-l.y)/(u.y-l.y)+l.x&&(i=!i)}return i}function Zf(r,e,i){const s=i[0],o=i[2];if(r.x<s.x&&e.x<s.x||r.x>o.x&&e.x>o.x||r.y<s.y&&e.y<s.y||r.y>o.y&&e.y>o.y)return!1;const l=Si(r,e,i[0]);return l!==Si(r,e,i[1])||l!==Si(r,e,i[2])||l!==Si(r,e,i[3])}function aa(r,e,i){const s=e.paint.get(r).value;return s.kind==="constant"?s.value:i.programConfigurations.get(e.id).getMaxValue(r)}function cu(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1])}function uu(r,e,i,s,o){if(!e[0]&&!e[1])return r;const l=Te.convert(e)._mult(o);i==="viewport"&&l._rotate(-s);const u=[];for(const d of r)u.push(d.sub(l));return u}function qf(r){const e=[];for(let i=0;i<r.length;i++){const s=r[i],o=e.at(-1);(i===0||o&&!s.equals(o))&&e.push(s)}return e}function Wf({queryGeometry:r,size:e},i){return lu(r,i,e)}function Hf({queryGeometry:r,size:e,transform:i,unwrappedTileID:s,getElevation:o},l){return lu(r,l,e*(i.projectTileCoordinates(l.x,l.y,s,o).signedDistanceFromCamera/i.cameraToCenterDistance))}function Xf({queryGeometry:r,size:e,transform:i,unwrappedTileID:s,getElevation:o},l){const u=i.projectTileCoordinates(l.x,l.y,s,o).signedDistanceFromCamera,d=e*(i.cameraToCenterDistance/u);return lu(r,hh(l,i,s,o),d)}function Yf({queryGeometry:r,size:e,transform:i,unwrappedTileID:s,getElevation:o},l){return lu(r,hh(l,i,s,o),e)}function xd({queryGeometry:r,size:e,transform:i,unwrappedTileID:s,getElevation:o,pitchAlignment:l="map",pitchScale:u="map"},d){const g=l==="map"?u==="map"?Wf:Hf:u==="map"?Xf:Yf,m={queryGeometry:r,size:e,transform:i,unwrappedTileID:s,getElevation:o};for(const v of d)for(const _ of v)if(g(m,_))return!0;return!1}function hh(r,e,i,s){const o=e.projectTileCoordinates(r.x,r.y,i,s).point;return new Te((.5*o.x+.5)*e.width,(.5*-o.y+.5)*e.height)}let bd,wd;Se("CircleBucket",na,{omit:["layers"]});var Kf={get paint(){return wd=wd||new li({"circle-radius":new Ce(ce.paint_circle["circle-radius"]),"circle-color":new Ce(ce.paint_circle["circle-color"]),"circle-blur":new Ce(ce.paint_circle["circle-blur"]),"circle-opacity":new Ce(ce.paint_circle["circle-opacity"]),"circle-translate":new Ie(ce.paint_circle["circle-translate"]),"circle-translate-anchor":new Ie(ce.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Ie(ce.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Ie(ce.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Ce(ce.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Ce(ce.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Ce(ce.paint_circle["circle-stroke-opacity"])})},get layout(){return bd=bd||new li({"circle-sort-key":new Ce(ce.layout_circle["circle-sort-key"])})}};class Jf extends Vi{constructor(e,i){super(e,Kf,i)}createBucket(e){return new na(e)}queryRadius(e){const i=e;return aa("circle-radius",this,i)+aa("circle-stroke-width",this,i)+cu(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:e,feature:i,featureState:s,geometry:o,transform:l,pixelsToTileUnits:u,unwrappedTileID:d,getElevation:g}){const m=uu(e,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-l.bearingInRadians,u),v=this.paint.get("circle-radius").evaluate(i,s)+this.paint.get("circle-stroke-width").evaluate(i,s),_=this.paint.get("circle-pitch-scale"),T=this.paint.get("circle-pitch-alignment");let b,I;return T==="map"?(b=m,I=v*u):(b=(function(M,A,D,F){return M.map((k=>hh(k,A,D,F)))})(m,l,d,g),I=v),xd({queryGeometry:b,size:I,transform:l,unwrappedTileID:d,getElevation:g,pitchAlignment:T,pitchScale:_},o)}}class Td extends na{}let Sd;Se("HeatmapBucket",Td,{omit:["layers"]});var Qf={get paint(){return Sd=Sd||new li({"heatmap-radius":new Ce(ce.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Ce(ce.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Ie(ce.paint_heatmap["heatmap-intensity"]),"heatmap-color":new ns(ce.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Ie(ce.paint_heatmap["heatmap-opacity"])})}};function dh(r,{width:e,height:i},s,o){if(o){if(o instanceof Uint8ClampedArray)o=new Uint8Array(o.buffer);else if(o.length!==e*i*s)throw new RangeError(`mismatched image size. expected: ${o.length} but got: ${e*i*s}`)}else o=new Uint8Array(e*i*s);return r.width=e,r.height=i,r.data=o,r}function Pd(r,{width:e,height:i},s){if(e===r.width&&i===r.height)return;const o=dh({},{width:e,height:i},s);ph(r,o,{x:0,y:0},{x:0,y:0},{width:Math.min(r.width,e),height:Math.min(r.height,i)},s),r.width=e,r.height=i,r.data=o.data}function ph(r,e,i,s,o,l){if(o.width===0||o.height===0)return e;if(o.width>r.width||o.height>r.height||i.x>r.width-o.width||i.y>r.height-o.height)throw new RangeError("out of range source coordinates for image copy");if(o.width>e.width||o.height>e.height||s.x>e.width-o.width||s.y>e.height-o.height)throw new RangeError("out of range destination coordinates for image copy");const u=r.data,d=e.data;if(u===d)throw new Error("srcData equals dstData, so image is already copied");for(let g=0;g<o.height;g++){const m=((i.y+g)*r.width+i.x)*l,v=((s.y+g)*e.width+s.x)*l;for(let _=0;_<o.width*l;_++)d[v+_]=u[m+_]}return e}class Vl{constructor(e,i){dh(this,e,1,i)}resize(e){Pd(this,e,1)}clone(){return new Vl({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,i,s,o,l){ph(e,i,s,o,l,1)}}class Di{constructor(e,i){dh(this,e,4,i)}resize(e){Pd(this,e,4)}replace(e,i){i?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new Di({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,i,s,o,l){ph(e,i,s,o,l,4)}setPixel(e,i,s){const o=4*(e*this.width+i);this.data[o+0]=Math.round(255*s.r/s.a),this.data[o+1]=Math.round(255*s.g/s.a),this.data[o+2]=Math.round(255*s.b/s.a),this.data[o+3]=Math.round(255*s.a)}}function Id(r){const e=new Uint8Array(r.length);for(let i=0;i<r.length;i+=4){const s=r[i+3];e[i+0]=Math.round(r[i+0]*s/255),e[i+1]=Math.round(r[i+1]*s/255),e[i+2]=Math.round(r[i+2]*s/255),e[i+3]=s}return e}function Md(r){const e={},i=r.resolution||256,s=r.clips?r.clips.length:1,o=r.image||new Di({width:i,height:s});if(Math.log(i)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${i}`);const l=(u,d,g)=>{e[r.evaluationKey]=g;const m=r.expression.evaluate(e);o.setPixel(u/4/i,d/4,m)};if(r.clips)for(let u=0,d=0;u<s;++u,d+=4*i)for(let g=0,m=0;g<i;g++,m+=4){const v=g/(i-1),{start:_,end:T}=r.clips[u];l(d,m,_*(1-v)+T*v)}else for(let u=0,d=0;u<i;u++,d+=4)l(0,d,u/(i-1));return o}Se("AlphaImage",Vl),Se("RGBAImage",Di);const fh="big-fb";class em extends Vi{createBucket(e){return new Td(e)}constructor(e,i){super(e,Qf,i),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){e==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Md({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(fh)&&this.heatmapFbos.delete(fh)}queryRadius(e){return aa("heatmap-radius",this,e)}queryIntersectsFeature({queryGeometry:e,feature:i,featureState:s,geometry:o,transform:l,pixelsToTileUnits:u,unwrappedTileID:d,getElevation:g}){return xd({queryGeometry:e,size:this.paint.get("heatmap-radius").evaluate(i,s)*u,transform:l,unwrappedTileID:d,getElevation:g},o)}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&!this.isHidden()}}let Ed;var tm={get paint(){return Ed=Ed||new li({"hillshade-illumination-direction":new Ie(ce.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-altitude":new Ie(ce.paint_hillshade["hillshade-illumination-altitude"]),"hillshade-illumination-anchor":new Ie(ce.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Ie(ce.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Ie(ce.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Ie(ce.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Ie(ce.paint_hillshade["hillshade-accent-color"]),"hillshade-method":new Ie(ce.paint_hillshade["hillshade-method"]),resampling:new Ie(ce.paint_hillshade.resampling)})}};class im extends Vi{constructor(e,i){super(e,tm,i),this.recalculate({zoom:0,zoomHistory:{}},void 0)}getIlluminationProperties(){let e=this.paint.get("hillshade-illumination-direction").values,i=this.paint.get("hillshade-illumination-altitude").values,s=this.paint.get("hillshade-highlight-color").values,o=this.paint.get("hillshade-shadow-color").values;const l=Math.max(e.length,i.length,s.length,o.length);e=e.concat(Array(l-e.length).fill(e.at(-1))),i=i.concat(Array(l-i.length).fill(i.at(-1))),s=s.concat(Array(l-s.length).fill(s.at(-1))),o=o.concat(Array(l-o.length).fill(o.at(-1)));const u=i.map(Mr);return{directionRadians:e.map(Mr),altitudeRadians:u,shadowColor:o,highlightColor:s}}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&!this.isHidden()}}let Cd;var rm={get paint(){return Cd=Cd||new li({"color-relief-opacity":new Ie(ce["paint_color-relief"]["color-relief-opacity"]),"color-relief-color":new ns(ce["paint_color-relief"]["color-relief-color"]),resampling:new Ie(ce["paint_color-relief"].resampling)})}};function Ad(r){return"data"in r}class mh{constructor(e,i,s,o){this.context=e,this.format=s,this.texture=e.gl.createTexture(),this._ownedHandle=this.texture,this.update(i,o)}update(e,i,s){var o;const{width:l,height:u}=e,d=(((o=this.size)===null||o===void 0?void 0:o[0])!==l||this.size[1]!==u)&&!s,{context:g}=this,{gl:m}=g;this.useMipmap=!!i?.useMipmap,m.bindTexture(m.TEXTURE_2D,this.texture),g.pixelStoreUnpackFlipY.set(!1),g.pixelStoreUnpack.set(1);const v=this.format===m.RGBA&&i?.premultiply!==!1;if(d)this.size=[l,u],Ad(e)?(g.pixelStoreUnpackPremultiplyAlpha.set(!1),this._uploadRawData(e,v,l,u,m)):(g.pixelStoreUnpackPremultiplyAlpha.set(v),this._uploadDomImage(e,m));else{const{x:_,y:T}=s||{x:0,y:0};Ad(e)?(g.pixelStoreUnpackPremultiplyAlpha.set(!1),this._updateRawData(e,v,_,T,l,u,m)):(g.pixelStoreUnpackPremultiplyAlpha.set(v),this._updateDomImage(e,_,T,m))}this.useMipmap&&this.isSizePowerOfTwo()&&m.generateMipmap(m.TEXTURE_2D),g.pixelStoreUnpackFlipY.setDefault(),g.pixelStoreUnpack.setDefault(),g.pixelStoreUnpackPremultiplyAlpha.setDefault()}_uploadDomImage(e,i){i.texImage2D(i.TEXTURE_2D,0,this.format,this.format,i.UNSIGNED_BYTE,e)}_uploadRawData(e,i,s,o,l){let{data:u}=e;i&&u&&(u=Id(u)),l.texImage2D(l.TEXTURE_2D,0,this.format,s,o,0,this.format,l.UNSIGNED_BYTE,u)}_updateDomImage(e,i,s,o){o.texSubImage2D(o.TEXTURE_2D,0,i,s,o.RGBA,o.UNSIGNED_BYTE,e)}_updateRawData(e,i,s,o,l,u,d){let{data:g}=e;i&&g&&(g=Id(g)),d.texSubImage2D(d.TEXTURE_2D,0,s,o,l,u,d.RGBA,d.UNSIGNED_BYTE,g)}bind(e,i,s){const{context:o}=this,{gl:l}=o;this.texture!==this._ownedHandle&&(this.texture=this._ownedHandle),l.bindTexture(l.TEXTURE_2D,this.texture),s!==l.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(s=l.LINEAR),e!==this.filter&&(l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MAG_FILTER,e),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MIN_FILTER,s||e),this.filter=e),i!==this.wrap&&(l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_S,i),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_T,i),this.wrap=i)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null,this._ownedHandle=null}}class Dd{constructor(e,i,s,o=1,l=1,u=1,d=0){if(this.uid=e,i.height!==i.width)throw new RangeError("DEM tiles must be square");if(s&&!["mapbox","terrarium","custom"].includes(s))return void $t(`"${s}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=i.height;const g=this.dim=i.height-2;switch(this.data=new Uint32Array(i.data.buffer),s){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=o,this.greenFactor=l,this.blueFactor=u,this.baseShift=d;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let m=0;m<g;m++)this.data[this._idx(-1,m)]=this.data[this._idx(0,m)],this.data[this._idx(g,m)]=this.data[this._idx(g-1,m)],this.data[this._idx(m,-1)]=this.data[this._idx(m,0)],this.data[this._idx(m,g)]=this.data[this._idx(m,g-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(g,-1)]=this.data[this._idx(g-1,0)],this.data[this._idx(-1,g)]=this.data[this._idx(0,g-1)],this.data[this._idx(g,g)]=this.data[this._idx(g-1,g-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let m=0;m<g;m++)for(let v=0;v<g;v++){const _=this.get(m,v);_>this.max&&(this.max=_),_<this.min&&(this.min=_)}}get(e,i){const s=new Uint8Array(this.data.buffer),o=4*this._idx(e,i);return this.unpack(s[o],s[o+1],s[o+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(e,i){if(e<-1||e>=this.dim+1||i<-1||i>=this.dim+1)throw new RangeError(`Out of range source coordinates for DEM data. x: ${e}, y: ${i}, dim: ${this.dim}`);return(i+1)*this.stride+(e+1)}unpack(e,i,s){return e*this.redFactor+i*this.greenFactor+s*this.blueFactor-this.baseShift}pack(e){return zd(e,this.getUnpackVector())}getPixels(){return new Di({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,i,s){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let o=i*this.dim,l=i*this.dim+this.dim,u=s*this.dim,d=s*this.dim+this.dim;switch(i){case-1:o=l-1;break;case 1:l=o+1}switch(s){case-1:u=d-1;break;case 1:d=u+1}const g=-i*this.dim,m=-s*this.dim;for(let v=u;v<d;v++)for(let _=o;_<l;_++)this.data[this._idx(_,v)]=e.data[this._idx(_+g,v+m)]}}function zd(r,e){const i=e[0],s=e[1],o=e[2],l=e[3],u=Math.min(i,s,o),d=Math.round((r+l)/u);return{r:Math.floor(d*u/i)%256,g:Math.floor(d*u/s)%256,b:Math.floor(d*u/o)%256}}Se("DEMData",Dd);class nm extends Vi{constructor(e,i){super(e,rm,i)}_createColorRamp(e){const i={elevationStops:[],colorStops:[]},s=this._transitionablePaint._values["color-relief-color"].value.expression;if(s instanceof Vo&&s._styleExpression.expression instanceof It){this.colorRampExpression=s;const u=s._styleExpression.expression;i.elevationStops=u.labels,i.colorStops=[];for(const d of i.elevationStops)i.colorStops.push(u.evaluate({globals:{elevation:d}}))}if(i.elevationStops.length<1&&(i.elevationStops=[0],i.colorStops=[Ve.transparent]),i.elevationStops.length<2&&(i.elevationStops.push(i.elevationStops[0]+1),i.colorStops.push(i.colorStops[0])),i.elevationStops.length<=e)return i;const o={elevationStops:[],colorStops:[]},l=(i.elevationStops.length-1)/(e-1);for(let u=0;u<i.elevationStops.length-.5;u+=l)o.elevationStops.push(i.elevationStops[Math.round(u)]),o.colorStops.push(i.colorStops[Math.round(u)]);return $t(`Too many colors in specification of ${this.id} color-relief layer, may not render properly. Max possible colors: ${e}, provided: ${i.elevationStops.length}`),o}_colorRampChanged(){return this.colorRampExpression!=this._transitionablePaint._values["color-relief-color"].value.expression}getColorRampTextures(e,i,s){if(this.colorRampTextures&&!this._colorRampChanged())return this.colorRampTextures;const o=this._createColorRamp(i),l=new Di({width:o.colorStops.length,height:1}),u=new Di({width:o.colorStops.length,height:1});for(let d=0;d<o.elevationStops.length;d++){const g=zd(o.elevationStops[d],s);u.setPixel(0,d,new Ve(g.r/255,g.g/255,g.b/255,1)),l.setPixel(0,d,o.colorStops[d])}return this.colorRampTextures={elevationTexture:new mh(e,u,e.gl.RGBA),colorTexture:new mh(e,l,e.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return!this.isHidden()&&!!this.colorRampTextures}}const sm=lt([{name:"a_pos",components:2,type:"Int16"}],4),{members:om}=sm;function hu(r,e,i){const s=i.patternDependencies;let o=!1;for(const l of e){const u=l.paint.get(`${r}-pattern`);u.isConstant()||(o=!0);const d=u.constantOr(null);d&&(o=!0,s[d.to]=!0,s[d.from]=!0)}return o}function gh(r,e,i,s,o){const{zoom:l}=s,u=o.patternDependencies;for(const d of e){const g=d.paint.get(`${r}-pattern`).value;if(g.kind!=="constant"){let m=g.evaluate({zoom:l-1},i,{},o.availableImages),v=g.evaluate({zoom:l},i,{},o.availableImages),_=g.evaluate({zoom:l+1},i,{},o.availableImages);m=m?.name?m.name:m,v=v?.name?v.name:v,_=_?.name?_.name:_,u[m]=!0,u[v]=!0,u[_]=!0,i.patterns[d.id]={min:m,mid:v,max:_}}}return i}function kd(r,e,i,s,o){let l;if(o===(function(u,d,g,m){let v=0;for(let _=d,T=g-m;_<g;_+=m)v+=(u[T]-u[_])*(u[_+1]+u[T+1]),T=_;return v})(r,e,i,s)>0)for(let u=e;u<i;u+=s)l=Bd(u/s|0,r[u],r[u+1],l);else for(let u=i-s;u>=e;u-=s)l=Bd(u/s|0,r[u],r[u+1],l);return l&&la(l,l.next)&&(Gl(l),l=l.next),l}function io(r,e){if(!r)return r;e||(e=r);let i,s=r;do if(i=!1,s.steiner||!la(s,s.next)&&Et(s.prev,s,s.next)!==0)s=s.next;else{if(Gl(s),s=e=s.prev,s===s.next)break;i=!0}while(i||s!==e);return e}function jl(r,e,i,s,o,l,u){if(!r)return;!u&&l&&(function(g,m,v,_){let T=g;do T.z===0&&(T.z=_h(T.x,T.y,m,v,_)),T.prevZ=T.prev,T.nextZ=T.next,T=T.next;while(T!==g);T.prevZ.nextZ=null,T.prevZ=null,(function(b){let I,M=1;do{let A,D=b;b=null;let F=null;for(I=0;D;){I++;let k=D,L=0;for(let j=0;j<M&&(L++,k=k.nextZ,k);j++);let O=M;for(;L>0||O>0&&k;)L!==0&&(O===0||!k||D.z<=k.z)?(A=D,D=D.nextZ,L--):(A=k,k=k.nextZ,O--),F?F.nextZ=A:b=A,A.prevZ=F,F=A;D=k}F.nextZ=null,M*=2}while(I>1)})(T)})(r,s,o,l);let d=r;for(;r.prev!==r.next;){const g=r.prev,m=r.next;if(l?lm(r,s,o,l):am(r))e.push(g.i,r.i,m.i),Gl(r),r=m.next,d=m.next;else if((r=m)===d){u?u===1?jl(r=cm(io(r),e),e,i,s,o,l,2):u===2&&um(r,e,i,s,o,l):jl(io(r),e,i,s,o,l,1);break}}}function am(r){const e=r.prev,i=r,s=r.next;if(Et(e,i,s)>=0)return!1;const o=e.x,l=i.x,u=s.x,d=e.y,g=i.y,m=s.y,v=Math.min(o,l,u),_=Math.min(d,g,m),T=Math.max(o,l,u),b=Math.max(d,g,m);let I=s.next;for(;I!==e;){if(I.x>=v&&I.x<=T&&I.y>=_&&I.y<=b&&Nl(o,d,l,g,u,m,I.x,I.y)&&Et(I.prev,I,I.next)>=0)return!1;I=I.next}return!0}function lm(r,e,i,s){const o=r.prev,l=r,u=r.next;if(Et(o,l,u)>=0)return!1;const d=o.x,g=l.x,m=u.x,v=o.y,_=l.y,T=u.y,b=Math.min(d,g,m),I=Math.min(v,_,T),M=Math.max(d,g,m),A=Math.max(v,_,T),D=_h(b,I,e,i,s),F=_h(M,A,e,i,s);let k=r.prevZ,L=r.nextZ;for(;k&&k.z>=D&&L&&L.z<=F;){if(k.x>=b&&k.x<=M&&k.y>=I&&k.y<=A&&k!==o&&k!==u&&Nl(d,v,g,_,m,T,k.x,k.y)&&Et(k.prev,k,k.next)>=0||(k=k.prevZ,L.x>=b&&L.x<=M&&L.y>=I&&L.y<=A&&L!==o&&L!==u&&Nl(d,v,g,_,m,T,L.x,L.y)&&Et(L.prev,L,L.next)>=0))return!1;L=L.nextZ}for(;k&&k.z>=D;){if(k.x>=b&&k.x<=M&&k.y>=I&&k.y<=A&&k!==o&&k!==u&&Nl(d,v,g,_,m,T,k.x,k.y)&&Et(k.prev,k,k.next)>=0)return!1;k=k.prevZ}for(;L&&L.z<=F;){if(L.x>=b&&L.x<=M&&L.y>=I&&L.y<=A&&L!==o&&L!==u&&Nl(d,v,g,_,m,T,L.x,L.y)&&Et(L.prev,L,L.next)>=0)return!1;L=L.nextZ}return!0}function cm(r,e){let i=r;do{const s=i.prev,o=i.next.next;!la(s,o)&&Fd(s,i,i.next,o)&&Ul(s,o)&&Ul(o,s)&&(e.push(s.i,i.i,o.i),Gl(i),Gl(i.next),i=r=o),i=i.next}while(i!==r);return io(i)}function um(r,e,i,s,o,l){let u=r;do{let d=u.next.next;for(;d!==u.prev;){if(u.i!==d.i&&mm(u,d)){let g=Ld(u,d);return u=io(u,u.next),g=io(g,g.next),jl(u,e,i,s,o,l,0),void jl(g,e,i,s,o,l,0)}d=d.next}u=u.next}while(u!==r)}function hm(r,e){let i=r.x-e.x;return i===0&&(i=r.y-e.y,i===0)&&(i=(r.next.y-r.y)/(r.next.x-r.x)-(e.next.y-e.y)/(e.next.x-e.x)),i}function dm(r,e){const i=(function(o,l){let u=l;const d=o.x,g=o.y;let m,v=-1/0;if(la(o,u))return u;do{if(la(o,u.next))return u.next;if(g<=u.y&&g>=u.next.y&&u.next.y!==u.y){const M=u.x+(g-u.y)*(u.next.x-u.x)/(u.next.y-u.y);if(M<=d&&M>v&&(v=M,m=u.x<u.next.x?u:u.next,M===d))return m}u=u.next}while(u!==l);if(!m)return null;const _=m,T=m.x,b=m.y;let I=1/0;u=m;do{if(d>=u.x&&u.x>=T&&d!==u.x&&Rd(g<b?d:v,g,T,b,g<b?v:d,g,u.x,u.y)){const M=Math.abs(g-u.y)/(d-u.x);Ul(u,o)&&(M<I||M===I&&(u.x>m.x||u.x===m.x&&pm(m,u)))&&(m=u,I=M)}u=u.next}while(u!==_);return m})(r,e);if(!i)return e;const s=Ld(i,r);return io(s,s.next),io(i,i.next)}function pm(r,e){return Et(r.prev,r,e.prev)<0&&Et(e.next,r,r.next)<0}function _h(r,e,i,s,o){return(r=1431655765&((r=858993459&((r=252645135&((r=16711935&((r=(r-i)*o|0)|r<<8))|r<<4))|r<<2))|r<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-s)*o|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function fm(r){let e=r,i=r;do(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next;while(e!==r);return i}function Rd(r,e,i,s,o,l,u,d){return(o-u)*(e-d)>=(r-u)*(l-d)&&(r-u)*(s-d)>=(i-u)*(e-d)&&(i-u)*(l-d)>=(o-u)*(s-d)}function Nl(r,e,i,s,o,l,u,d){return!(r===u&&e===d)&&Rd(r,e,i,s,o,l,u,d)}function mm(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!(function(i,s){let o=i;do{if(o.i!==i.i&&o.next.i!==i.i&&o.i!==s.i&&o.next.i!==s.i&&Fd(o,o.next,i,s))return!0;o=o.next}while(o!==i);return!1})(r,e)&&(Ul(r,e)&&Ul(e,r)&&(function(i,s){let o=i,l=!1;const u=(i.x+s.x)/2,d=(i.y+s.y)/2;do o.y>d!=o.next.y>d&&o.next.y!==o.y&&u<(o.next.x-o.x)*(d-o.y)/(o.next.y-o.y)+o.x&&(l=!l),o=o.next;while(o!==i);return l})(r,e)&&(Et(r.prev,r,e.prev)||Et(r,e.prev,e))||la(r,e)&&Et(r.prev,r,r.next)>0&&Et(e.prev,e,e.next)>0)}function Et(r,e,i){return(e.y-r.y)*(i.x-e.x)-(e.x-r.x)*(i.y-e.y)}function la(r,e){return r.x===e.x&&r.y===e.y}function Fd(r,e,i,s){const o=pu(Et(r,e,i)),l=pu(Et(r,e,s)),u=pu(Et(i,s,r)),d=pu(Et(i,s,e));return o!==l&&u!==d||!(o!==0||!du(r,i,e))||!(l!==0||!du(r,s,e))||!(u!==0||!du(i,r,s))||!(d!==0||!du(i,e,s))}function du(r,e,i){return e.x<=Math.max(r.x,i.x)&&e.x>=Math.min(r.x,i.x)&&e.y<=Math.max(r.y,i.y)&&e.y>=Math.min(r.y,i.y)}function pu(r){return r>0?1:r<0?-1:0}function Ul(r,e){return Et(r.prev,r,r.next)<0?Et(r,e,r.next)>=0&&Et(r,r.prev,e)>=0:Et(r,e,r.prev)<0||Et(r,r.next,e)<0}function Ld(r,e){const i=yh(r.i,r.x,r.y),s=yh(e.i,e.x,e.y),o=r.next,l=e.prev;return r.next=e,e.prev=r,i.next=o,o.prev=i,s.next=i,i.prev=s,l.next=s,s.prev=l,s}function Bd(r,e,i,s){const o=yh(r,e,i);return s?(o.next=s.next,o.prev=s,s.next.prev=o,s.next=o):(o.prev=o,o.next=o),o}function Gl(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function yh(r,e,i){return{i:r,x:e,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class ca{constructor(e,i){if(i>e)throw new Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=e,this._minGranularity=i}getGranularityForZoomLevel(e){return Math.max(Math.floor(this._baseZoomGranularity/(1<<e)),this._minGranularity,1)}}class fu{constructor(e){this.fill=e.fill,this.line=e.line,this.tile=e.tile,this.stencil=e.stencil,this.circle=e.circle}}fu.noSubdivision=new fu({fill:new ca(0,0),line:new ca(0,0),tile:new ca(0,0),stencil:new ca(0,0),circle:1}),Se("SubdivisionGranularityExpression",ca),Se("SubdivisionGranularitySetting",fu);const ua=-32768,$l=32767;class gm{constructor(e,i){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=e,this._granularityCellSize=De/e,this._canonical=i}_getKey(e,i){return(e+=32768)<<16|i+32768}_vertexToIndex(e,i){if(e<-32768||i<-32768||e>32767||i>32767)throw new Error("Vertex coordinates are out of signed 16 bit integer range.");const s=0|Math.round(e),o=0|Math.round(i),l=this._getKey(s,o);if(this._vertexDictionary.has(l))return this._vertexDictionary.get(l);const u=this._vertexBuffer.length/2;return this._vertexDictionary.set(l,u),this._vertexBuffer.push(s,o),u}_subdivideTrianglesScanline(e){if(this._granularity<2)return(function(o,l){const u=[];for(let d=0;d<l.length;d+=3){const g=l[d],m=l[d+1],v=l[d+2],_=o[2*g],T=o[2*g+1];(o[2*m]-_)*(o[2*v+1]-T)-(o[2*m+1]-T)*(o[2*v]-_)>0?(u.push(g),u.push(v),u.push(m)):(u.push(g),u.push(m),u.push(v))}return u})(this._vertexBuffer,e);const i=[],s=e.length;for(let o=0;o<s;o+=3){const l=[e[o+0],e[o+1],e[o+2]],u=[this._vertexBuffer[2*e[o+0]+0],this._vertexBuffer[2*e[o+0]+1],this._vertexBuffer[2*e[o+1]+0],this._vertexBuffer[2*e[o+1]+1],this._vertexBuffer[2*e[o+2]+0],this._vertexBuffer[2*e[o+2]+1]];let d=1/0,g=1/0,m=-1/0,v=-1/0;for(let M=0;M<3;M++){const A=u[2*M],D=u[2*M+1];d=Math.min(d,A),m=Math.max(m,A),g=Math.min(g,D),v=Math.max(v,D)}if(d===m||g===v)continue;const _=Math.floor(d/this._granularityCellSize),T=Math.ceil(m/this._granularityCellSize),b=Math.floor(g/this._granularityCellSize),I=Math.ceil(v/this._granularityCellSize);if(_!==T||b!==I)for(let M=b;M<I;M++){const A=this._scanlineGenerateVertexRingForCellRow(M,u,l);_m(this._vertexBuffer,A,i)}else i.push(...l)}return i}_scanlineGenerateVertexRingForCellRow(e,i,s){const o=e*this._granularityCellSize,l=o+this._granularityCellSize,u=[];for(let d=0;d<3;d++){const g=i[2*d],m=i[2*d+1],v=i[2*(d+1)%6],_=i[(2*(d+1)+1)%6],T=i[2*(d+2)%6],b=i[(2*(d+2)+1)%6],I=v-g,M=_-m,A=I===0,D=M===0,F=(o-m)/M,k=(l-m)/M,L=Math.min(F,k),O=Math.max(F,k);if(!D&&(L>=1||O<=0)||D&&(m<o||m>l)){_>=o&&_<=l&&u.push(s[(d+1)%3]);continue}!D&&L>0&&u.push(this._vertexToIndex(g+I*L,m+M*L));const j=g+I*Math.max(L,0),Y=g+I*Math.min(O,1);A||this._generateIntraEdgeVertices(u,g,m,v,_,j,Y),!D&&O<1&&u.push(this._vertexToIndex(g+I*O,m+M*O)),(D||_>=o&&_<=l)&&u.push(s[(d+1)%3]),!D&&(_<=o||_>=l)&&this._generateInterEdgeVertices(u,g,m,v,_,T,b,Y,o,l)}return u}_generateIntraEdgeVertices(e,i,s,o,l,u,d){const g=o-i,m=l-s,v=m===0,_=v?Math.min(i,o):Math.min(u,d),T=v?Math.max(i,o):Math.max(u,d),b=Math.floor(_/this._granularityCellSize)+1,I=Math.ceil(T/this._granularityCellSize)-1;if(v?i<o:u<d)for(let M=b;M<=I;M++){const A=M*this._granularityCellSize;e.push(this._vertexToIndex(A,s+m*(A-i)/g))}else for(let M=I;M>=b;M--){const A=M*this._granularityCellSize;e.push(this._vertexToIndex(A,s+m*(A-i)/g))}}_generateInterEdgeVertices(e,i,s,o,l,u,d,g,m,v){const _=l-s,T=u-o,b=d-l,I=(m-l)/b,M=(v-l)/b,A=Math.min(I,M),D=Math.max(I,M),F=o+T*A;let k=Math.floor(Math.min(F,g)/this._granularityCellSize)+1,L=Math.ceil(Math.max(F,g)/this._granularityCellSize)-1,O=g<F;const j=b===0;if(j&&(d===m||d===v))return;if(j||A>=1||D<=0){const J=s-d,re=u+(i-u)*Math.min((m-d)/J,(v-d)/J);k=Math.floor(Math.min(re,g)/this._granularityCellSize)+1,L=Math.ceil(Math.max(re,g)/this._granularityCellSize)-1,O=g<re}const Y=_>0?v:m;if(O)for(let J=k;J<=L;J++)e.push(this._vertexToIndex(J*this._granularityCellSize,Y));else for(let J=L;J>=k;J--)e.push(this._vertexToIndex(J*this._granularityCellSize,Y))}_generateOutline(e){const i=[];for(const s of e){const o=ro(s,this._granularity,!0),l=this._pointArrayToIndices(o),u=[];for(let d=1;d<l.length;d++)u.push(l[d-1]),u.push(l[d]);i.push(u)}return i}_handlePoles(e){let i=!1,s=!1;this._canonical&&(this._canonical.y===0&&(i=!0),this._canonical.y===(1<<this._canonical.z)-1&&(s=!0)),(i||s)&&this._fillPoles(e,i,s)}_ensureNoPoleVertices(){const e=this._vertexBuffer;for(let i=0;i<e.length;i+=2){const s=e[i+1];s===ua&&(e[i+1]=-32767),s===$l&&(e[i+1]=32766)}}_generatePoleQuad(e,i,s,o,l,u){o>l!=(u===ua)?(e.push(i),e.push(s),e.push(this._vertexToIndex(o,u)),e.push(s),e.push(this._vertexToIndex(l,u)),e.push(this._vertexToIndex(o,u))):(e.push(s),e.push(i),e.push(this._vertexToIndex(o,u)),e.push(this._vertexToIndex(l,u)),e.push(s),e.push(this._vertexToIndex(o,u)))}_fillPoles(e,i,s){const o=this._vertexBuffer,l=De,u=e.length;for(let d=2;d<u;d+=3){const g=e[d-2],m=e[d-1],v=e[d],_=o[2*g],T=o[2*g+1],b=o[2*m],I=o[2*m+1],M=o[2*v],A=o[2*v+1];i&&(T===0&&I===0&&this._generatePoleQuad(e,g,m,_,b,ua),I===0&&A===0&&this._generatePoleQuad(e,m,v,b,M,ua),A===0&&T===0&&this._generatePoleQuad(e,v,g,M,_,ua)),s&&(T===l&&I===l&&this._generatePoleQuad(e,g,m,_,b,$l),I===l&&A===l&&this._generatePoleQuad(e,m,v,b,M,$l),A===l&&T===l&&this._generatePoleQuad(e,v,g,M,_,$l))}}_initializeVertices(e){for(let i=0;i<e.length;i+=2)this._vertexToIndex(e[i],e[i+1])}subdividePolygonInternal(e,i){if(this._used)throw new Error("Subdivision: multiple use not allowed.");this._used=!0;const{flattened:s,holeIndices:o}=(function(d){const g=[],m=[];for(const v of d)if(v.length!==0){v!==d[0]&&g.push(m.length/2);for(const _ of v)m.push(_.x),m.push(_.y)}return{flattened:m,holeIndices:g}})(e);let l;this._initializeVertices(s);try{const d=(function(m,v,_=2){const T=v&&v.length,b=T?v[0]*_:m.length;let I=kd(m,0,b,_,!0);const M=[];if(!I||I.next===I.prev)return M;let A,D,F;if(T&&(I=(function(k,L,O,j){const Y=[];for(let J=0,re=L.length;J<re;J++){const te=kd(k,L[J]*j,J<re-1?L[J+1]*j:k.length,j,!1);te===te.next&&(te.steiner=!0),Y.push(fm(te))}Y.sort(hm);for(let J=0;J<Y.length;J++)O=dm(Y[J],O);return O})(m,v,I,_)),m.length>80*_){A=m[0],D=m[1];let k=A,L=D;for(let O=_;O<b;O+=_){const j=m[O],Y=m[O+1];j<A&&(A=j),Y<D&&(D=Y),j>k&&(k=j),Y>L&&(L=Y)}F=Math.max(k-A,L-D),F=F!==0?32767/F:0}return jl(I,M,_,A,D,F,0),M})(s,o),g=this._convertIndices(s,d);l=this._subdivideTrianglesScanline(g)}catch(d){console.error(d)}let u=[];return i&&(u=this._generateOutline(e)),this._ensureNoPoleVertices(),this._handlePoles(l),{verticesFlattened:this._vertexBuffer,indicesTriangles:l,indicesLineList:u}}_convertIndices(e,i){const s=[];for(const o of i)s.push(this._vertexToIndex(e[2*o],e[2*o+1]));return s}_pointArrayToIndices(e){const i=[];for(const s of e)i.push(this._vertexToIndex(s.x,s.y));return i}}function Od(r,e,i,s=!0){return new gm(i,e).subdividePolygonInternal(r,s)}function ro(r,e,i=!1){if(!r||r.length<1)return[];if(r.length<2)return[];const s=r[0],o=r[r.length-1],l=i&&(s.x!==o.x||s.y!==o.y);if(e<2)return l?[...r,r[0]]:[...r];const u=Math.floor(De/e),d=[];d.push(new Te(r[0].x,r[0].y));const g=r.length,m=l?g:g-1;for(let v=0;v<m;v++){const _=r[v],T=v<g-1?r[v+1]:r[0],b=_.x,I=_.y,M=T.x,A=T.y,D=b!==M,F=I!==A;if(!D&&!F)continue;const k=M-b,L=A-I,O=Math.abs(k),j=Math.abs(L);let Y=b,J=I;for(;;){const te=k>0?(Math.floor(Y/u)+1)*u:(Math.ceil(Y/u)-1)*u,ae=L>0?(Math.floor(J/u)+1)*u:(Math.ceil(J/u)-1)*u,le=Math.abs(Y-te),ne=Math.abs(J-ae),ie=Math.abs(Y-M),fe=Math.abs(J-A),xe=D?le/O:Number.POSITIVE_INFINITY,ye=F?ne/j:Number.POSITIVE_INFINITY;if((ie<=le||!D)&&(fe<=ne||!F))break;if(xe<ye&&D||!F){Y=te,J+=L*xe;const me=new Te(Y,Math.round(J));d[d.length-1].x===me.x&&d[d.length-1].y===me.y||d.push(me)}else{Y+=k*ye,J=ae;const me=new Te(Math.round(Y),J);d[d.length-1].x===me.x&&d[d.length-1].y===me.y||d.push(me)}}const re=new Te(M,A);d[d.length-1].x===re.x&&d[d.length-1].y===re.y||d.push(re)}return d}function _m(r,e,i){if(e.length===0)throw new Error("Subdivision vertex ring is empty.");let s=0,o=r[2*e[0]];for(let g=1;g<e.length;g++){const m=r[2*e[g]];m<o&&(o=m,s=g)}const l=e.length;let u=s,d=(u+1)%l;for(;;){const g=u-1>=0?u-1:l-1,m=(d+1)%l,v=r[2*e[g]],_=r[2*e[m]],T=r[2*e[u]],b=r[2*e[u]+1],I=r[2*e[d]+1];let M=!1;if(v<_)M=!0;else if(v>_)M=!1;else{const A=I-b,D=-(r[2*e[d]]-T),F=b<I?1:-1;((v-T)*A+(r[2*e[g]+1]-b)*D)*F>((_-T)*A+(r[2*e[m]+1]-b)*D)*F&&(M=!0)}if(M){const A=e[g],D=e[u],F=e[d];A!==D&&A!==F&&D!==F&&i.push(F,D,A),u--,u<0&&(u=l-1)}else{const A=e[m],D=e[u],F=e[d];A!==D&&A!==F&&D!==F&&i.push(F,D,A),d++,d>=l&&(d=0)}if(g===m)break}}function Vd(r,e,i,s,o,l,u,d,g){const m=o.length/2,v=u&&d&&g;if(m<we.MAX_VERTEX_ARRAY_LENGTH){const _=e.prepareSegment(m,i,s),T=_.vertexLength;for(let M=0;M<l.length;M+=3)s.emplaceBack(T+l[M],T+l[M+1],T+l[M+2]);let b,I;_.vertexLength+=m,_.primitiveLength+=l.length/3,v&&(I=u.prepareSegment(m,i,d),b=I.vertexLength,I.vertexLength+=m);for(let M=0;M<o.length;M+=2)r(o[M],o[M+1]);if(v)for(const M of g){for(let A=1;A<M.length;A+=2)d.emplaceBack(b+M[A-1],b+M[A]);I.primitiveLength+=M.length/2}}else(function(_,T,b,I,M,A){const D=[];for(let j=0;j<I.length/2;j++)D.push(-1);const F={count:0};let k=0,L=_.getOrCreateLatestSegment(T,b),O=L.vertexLength;for(let j=2;j<M.length;j+=3){const Y=M[j-2],J=M[j-1],re=M[j];let te=D[Y]<k,ae=D[J]<k,le=D[re]<k;L.vertexLength+((te?1:0)+(ae?1:0)+(le?1:0))>we.MAX_VERTEX_ARRAY_LENGTH&&(L=_.createNewSegment(T,b),k=F.count,te=!0,ae=!0,le=!0,O=0);const ne=Zl(D,I,A,F,Y,te,L),ie=Zl(D,I,A,F,J,ae,L),fe=Zl(D,I,A,F,re,le,L);b.emplaceBack(O+ne-k,O+ie-k,O+fe-k),L.primitiveLength++}})(e,i,s,o,l,r),v&&(function(_,T,b,I,M,A){const D=[];for(let j=0;j<I.length/2;j++)D.push(-1);const F={count:0};let k=0,L=_.getOrCreateLatestSegment(T,b),O=L.vertexLength;for(const j of M)for(let Y=1;Y<j.length;Y+=2){const J=j[Y-1],re=j[Y];let te=D[J]<k,ae=D[re]<k;L.vertexLength+((te?1:0)+(ae?1:0))>we.MAX_VERTEX_ARRAY_LENGTH&&(L=_.createNewSegment(T,b),k=F.count,te=!0,ae=!0,O=0);const le=Zl(D,I,A,F,J,te,L),ne=Zl(D,I,A,F,re,ae,L);b.emplaceBack(O+le-k,O+ne-k),L.primitiveLength++}})(u,i,d,o,g,r),e.forceNewSegmentOnNextPrepare(),u?.forceNewSegmentOnNextPrepare()}function Zl(r,e,i,s,o,l,u){if(l){const d=s.count;return i(e[2*o],e[2*o+1]),r[o]=s.count,s.count++,u.vertexLength++,d}return r[o]}class vh{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((i=>i.id)),this.index=e.index,this.hasDependencies=!1,this.patternFeatures=[],this.layoutVertexArray=new N,this.indexArray=new he,this.indexArray2=new Pe,this.programConfigurations=new gr(e.layers,e.zoom),this.segments=new we,this.segments2=new we,this.stateDependentLayerIds=this.layers.filter((i=>i.isStateDependent())).map((i=>i.id))}populate(e,i,s){this.hasDependencies=hu("fill",this.layers,i);const o=this.layers[0].layout.get("fill-sort-key"),l=!o.isConstant(),u=[];for(const{feature:d,id:g,index:m,sourceLayerIndex:v}of e){const _=this.layers[0]._featureFilter.needGeometry,T=Ur(d,_);if(!this.layers[0]._featureFilter.filter(new at(this.zoom),T,s))continue;const b=l?o.evaluate(T,{},s,i.availableImages):void 0,I={id:g,properties:d.properties,type:d.type,sourceLayerIndex:v,index:m,geometry:_?T.geometry:Nr(d),patterns:{},sortKey:b};u.push(I)}l&&u.sort(((d,g)=>d.sortKey-g.sortKey));for(const d of u){const{geometry:g,index:m,sourceLayerIndex:v}=d;if(this.hasDependencies){const _=gh("fill",this.layers,d,{zoom:this.zoom},i);this.patternFeatures.push(_)}else this.addFeature(d,g,m,s,{},i.subdivisionGranularity);i.featureIndex.insert(e[m].feature,g,m,v,this.index)}}update(e,i,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,i,this.stateDependentLayers,{imagePositions:s})}addFeatures(e,i,s){for(const o of this.patternFeatures)this.addFeature(o,o.geometry,o.index,i,s,e.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,om),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(e,i,s,o,l,u){for(const d of Co(i,500)){const g=Od(d,o,u.fill.getGranularityForZoomLevel(o.z)),m=this.layoutVertexArray;Vd(((v,_)=>{m.emplaceBack(v,_)}),this.segments,this.layoutVertexArray,this.indexArray,g.verticesFlattened,g.indicesTriangles,this.segments2,this.indexArray2,g.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,{imagePositions:l,canonical:o})}}let jd,Nd;Se("FillBucket",vh,{omit:["layers","patternFeatures"]});var ym={get paint(){return Nd=Nd||new li({"fill-antialias":new Ie(ce.paint_fill["fill-antialias"]),"fill-opacity":new Ce(ce.paint_fill["fill-opacity"]),"fill-color":new Ce(ce.paint_fill["fill-color"]),"fill-outline-color":new Ce(ce.paint_fill["fill-outline-color"]),"fill-translate":new Ie(ce.paint_fill["fill-translate"]),"fill-translate-anchor":new Ie(ce.paint_fill["fill-translate-anchor"]),"fill-pattern":new Fr(ce.paint_fill["fill-pattern"])})},get layout(){return jd=jd||new li({"fill-sort-key":new Ce(ce.layout_fill["fill-sort-key"])})}};class vm extends Vi{constructor(e,i){super(e,ym,i)}recalculate(e,i){super.recalculate(e,i);const s=this.paint._values["fill-outline-color"];s.value.kind==="constant"&&s.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(e){return new vh(e)}queryRadius(){return cu(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:e,geometry:i,transform:s,pixelsToTileUnits:o}){return _d(uu(e,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-s.bearingInRadians,o),i)}isTileClipped(){return!0}}const xm=lt([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),bm=lt([{name:"a_centroid",components:2,type:"Int16"}],4),{members:wm}=xm;class ql{constructor(e,i,s,o,l){this.properties={},this.extent=s,this.type=0,this.id=void 0,this._pbf=e,this._geometry=-1,this._keys=o,this._values=l,e.readFields(Tm,this,i)}loadGeometry(){const e=this._pbf;e.pos=this._geometry;const i=e.readVarint()+e.pos,s=[];let o,l=1,u=0,d=0,g=0;for(;e.pos<i;){if(u<=0){const m=e.readVarint();l=7&m,u=m>>3}if(u--,l===1||l===2)d+=e.readSVarint(),g+=e.readSVarint(),l===1&&(o&&s.push(o),o=[]),o&&o.push(new Te(d,g));else{if(l!==7)throw new Error(`unknown command ${l}`);o&&o.push(o[0].clone())}}return o&&s.push(o),s}bbox(){const e=this._pbf;e.pos=this._geometry;const i=e.readVarint()+e.pos;let s=1,o=0,l=0,u=0,d=1/0,g=-1/0,m=1/0,v=-1/0;for(;e.pos<i;){if(o<=0){const _=e.readVarint();s=7&_,o=_>>3}if(o--,s===1||s===2)l+=e.readSVarint(),u+=e.readSVarint(),l<d&&(d=l),l>g&&(g=l),u<m&&(m=u),u>v&&(v=u);else if(s!==7)throw new Error(`unknown command ${s}`)}return[d,m,g,v]}toGeoJSON(e,i,s){const o=this.extent*Math.pow(2,s),l=this.extent*e,u=this.extent*i,d=this.loadGeometry();function g(T){return[360*(T.x+l)/o-180,360/Math.PI*Math.atan(Math.exp((1-2*(T.y+u)/o)*Math.PI))-90]}function m(T){return T.map(g)}let v;if(this.type===1){const T=[];for(const I of d)T.push(I[0]);const b=m(T);v=T.length===1?{type:"Point",coordinates:b[0]}:{type:"MultiPoint",coordinates:b}}else if(this.type===2){const T=d.map(m);v=T.length===1?{type:"LineString",coordinates:T[0]}:{type:"MultiLineString",coordinates:T}}else{if(this.type!==3)throw new Error("unknown feature type");{const T=Ud(d),b=[];for(const I of T)b.push(I.map(m));v=b.length===1?{type:"Polygon",coordinates:b[0]}:{type:"MultiPolygon",coordinates:b}}}const _={type:"Feature",geometry:v,properties:this.properties};return this.id!=null&&(_.id=this.id),_}}function Tm(r,e,i){r===1?e.id=i.readVarint():r===2?(function(s,o){const l=s.readVarint()+s.pos;for(;s.pos<l;){const u=o._keys[s.readVarint()],d=o._values[s.readVarint()];o.properties[u]=d}})(i,e):r===3?e.type=i.readVarint():r===4&&(e._geometry=i.pos)}function Ud(r){const e=r.length;if(e<=1)return[r];const i=[];let s,o;for(let l=0;l<e;l++){const u=Sm(r[l]);u!==0&&(o===void 0&&(o=u<0),o===u<0?(s&&i.push(s),s=[r[l]]):s&&s.push(r[l]))}return s&&i.push(s),i}function Sm(r){let e=0;for(let i,s,o=0,l=r.length,u=l-1;o<l;u=o++)i=r[o],s=r[u],e+=(s.x-i.x)*(i.y+s.y);return e}ql.types=["Unknown","Point","LineString","Polygon"];class Pm{constructor(e,i){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(Im,this,i),this.length=this._features.length}feature(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];const i=this._pbf.readVarint()+this._pbf.pos;return new ql(this._pbf,i,this.extent,this._keys,this._values)}}function Im(r,e,i){r===15?e.version=i.readVarint():r===1?e.name=i.readString():r===5?e.extent=i.readVarint():r===2?e._features.push(i.pos):r===3?e._keys.push(i.readString()):r===4&&e._values.push((function(s){let o=null;const l=s.readVarint()+s.pos;for(;s.pos<l;){const u=s.readVarint()>>3;o=u===1?s.readString():u===2?s.readFloat():u===3?s.readDouble():u===4?s.readVarint64():u===5?s.readVarint():u===6?s.readSVarint():u===7?s.readBoolean():null}if(o==null)throw new Error("unknown feature value");return o})(i))}class Gd{constructor(e,i){this.layers=e.readFields(Mm,{},i)}}function Mm(r,e,i){if(r===3){const s=new Pm(i,i.readVarint()+i.pos);s.length&&(e[s.name]=s)}}const xh=Math.pow(2,13);function Wl(r,e,i,s,o,l,u,d){r.emplaceBack(e,i,2*Math.floor(s*xh)+u,o*xh*2,l*xh*2,Math.round(d))}class bh{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((i=>i.id)),this.index=e.index,this.hasDependencies=!1,this.layoutVertexArray=new $,this.centroidVertexArray=new V,this.indexArray=new he,this.programConfigurations=new gr(e.layers,e.zoom),this.segments=new we,this.stateDependentLayerIds=this.layers.filter((i=>i.isStateDependent())).map((i=>i.id))}populate(e,i,s){this.features=[],this.hasDependencies=hu("fill-extrusion",this.layers,i);for(const{feature:o,id:l,index:u,sourceLayerIndex:d}of e){const g=this.layers[0]._featureFilter.needGeometry,m=Ur(o,g);if(!this.layers[0]._featureFilter.filter(new at(this.zoom),m,s))continue;const v={id:l,sourceLayerIndex:d,index:u,geometry:g?m.geometry:Nr(o),properties:o.properties,type:o.type,patterns:{}};this.hasDependencies?this.features.push(gh("fill-extrusion",this.layers,v,{zoom:this.zoom},i)):this.addFeature(v,v.geometry,u,s,{},i.subdivisionGranularity),i.featureIndex.insert(o,v.geometry,u,d,this.index,!0)}}addFeatures(e,i,s){for(const o of this.features){const{geometry:l}=o;this.addFeature(o,l,o.index,i,s,e.subdivisionGranularity)}}update(e,i,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,i,this.stateDependentLayers,{imagePositions:s})}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,wm),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,bm.members,!0),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(e,i,s,o,l,u){for(const d of Co(i,500)){const g={x:0,y:0,sampleCount:0},m=this.layoutVertexArray.length;this.processPolygon(g,o,e,d,u);const v=this.layoutVertexArray.length-m,_=Math.floor(g.x/g.sampleCount),T=Math.floor(g.y/g.sampleCount);for(let b=0;b<v;b++)this.centroidVertexArray.emplaceBack(_,T)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,{imagePositions:l,canonical:o})}processPolygon(e,i,s,o,l){if(o.length<1||$d(o[0]))return;for(const _ of o)_.length!==0&&Em(e,_);const u={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},d=l.fill.getGranularityForZoomLevel(i.z),g=ql.types[s.type]==="Polygon";for(const _ of o){if(_.length===0||$d(_))continue;const T=ro(_,d,g);this._generateSideFaces(T,u)}if(!g)return;const m=Od(o,i,d,!1),v=this.layoutVertexArray;Vd(((_,T)=>{Wl(v,_,T,0,0,1,1,0)}),this.segments,this.layoutVertexArray,this.indexArray,m.verticesFlattened,m.indicesTriangles)}_generateSideFaces(e,i){let s=0;for(let o=1;o<e.length;o++){const l=e[o],u=e[o-1];if(Cm(l,u))continue;i.segment.vertexLength+4>we.MAX_VERTEX_ARRAY_LENGTH&&(i.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const d=l.sub(u)._perp()._unit(),g=u.dist(l);s+g>32768&&(s=0),Wl(this.layoutVertexArray,l.x,l.y,d.x,d.y,0,0,s),Wl(this.layoutVertexArray,l.x,l.y,d.x,d.y,0,1,s),s+=g,Wl(this.layoutVertexArray,u.x,u.y,d.x,d.y,0,0,s),Wl(this.layoutVertexArray,u.x,u.y,d.x,d.y,0,1,s);const m=i.segment.vertexLength;this.indexArray.emplaceBack(m,m+2,m+1),this.indexArray.emplaceBack(m+1,m+2,m+3),i.segment.vertexLength+=4,i.segment.primitiveLength+=2}}}function Em(r,e){for(let i=0;i<e.length;i++){const s=e[i];i===e.length-1&&e[0].x===s.x&&e[0].y===s.y||(r.x+=s.x,r.y+=s.y,r.sampleCount++)}}function Cm(r,e){return r.x===e.x&&(r.x<0||r.x>De)||r.y===e.y&&(r.y<0||r.y>De)}function $d(r){return r.every((e=>e.x<0))||r.every((e=>e.x>De))||r.every((e=>e.y<0))||r.every((e=>e.y>De))}let Zd;Se("FillExtrusionBucket",bh,{omit:["layers","features"]});var Am={get paint(){return Zd=Zd||new li({"fill-extrusion-opacity":new Ie(ce["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Ce(ce["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Ie(ce["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Ie(ce["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Fr(ce["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Ce(ce["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Ce(ce["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Ie(ce["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class Dm extends Vi{constructor(e,i){super(e,Am,i)}createBucket(e){return new bh(e)}queryRadius(){return cu(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:e,feature:i,featureState:s,geometry:o,transform:l,pixelsToTileUnits:u,pixelPosMatrix:d}){const g=uu(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-l.bearingInRadians,u),m=this.paint.get("fill-extrusion-height").evaluate(i,s),v=this.paint.get("fill-extrusion-base").evaluate(i,s),_=(function(b,I){const M=[];for(const A of b){const D=[A.x,A.y,0,1];$e(D,D,I),M.push(new Te(D[0]/D[3],D[1]/D[3]))}return M})(g,d),T=(function(b,I,M,A){const D=[],F=[],k=A[8]*I,L=A[9]*I,O=A[10]*I,j=A[11]*I,Y=A[8]*M,J=A[9]*M,re=A[10]*M,te=A[11]*M;for(const ae of b){const le=[],ne=[];for(const ie of ae){const fe=ie.x,xe=ie.y,ye=A[0]*fe+A[4]*xe+A[12],me=A[1]*fe+A[5]*xe+A[13],Ae=A[2]*fe+A[6]*xe+A[14],Xe=A[3]*fe+A[7]*xe+A[15],Ke=Ae+O,it=Xe+j,ri=ye+Y,bt=me+J,Rt=Ae+re,jt=Xe+te,ht=new Te((ye+k)/it,(me+L)/it);ht.z=Ke/it,le.push(ht);const Yt=new Te(ri/jt,bt/jt);Yt.z=Rt/jt,ne.push(Yt)}D.push(le),F.push(ne)}return[D,F]})(o,v,m,d);return(function(b,I,M){let A=1/0;_d(M,I)&&(A=qd(M,I[0]));for(let D=0;D<I.length;D++){const F=I[D],k=b[D];for(let L=0;L<F.length-1;L++){const O=F[L],j=[O,F[L+1],k[L+1],k[L],O];sa(M,j)&&(A=Math.min(A,qd(M,j)))}}return A!==1/0&&A})(T[0],T[1],_)}}function Hl(r,e){return r.x*e.x+r.y*e.y}function qd(r,e){if(r.length===1){let i=0;const s=e[i++];let o;for(;!o||s.equals(o);)if(o=e[i++],!o)return 1/0;for(;i<e.length;i++){const l=e[i],u=r[0],d=o.sub(s),g=l.sub(s),m=u.sub(s),v=Hl(d,d),_=Hl(d,g),T=Hl(g,g),b=Hl(m,d),I=Hl(m,g),M=v*T-_*_,A=(T*b-_*I)/M,D=(v*I-_*b)/M,F=s.z*(1-A-D)+o.z*A+l.z*D;if(isFinite(F))return F}return 1/0}{let i=1/0;for(const s of e)i=Math.min(i,s.z);return i}}const Wd=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class mu{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[i,s]=new Uint8Array(e,0,2);if(i!==219)throw new Error("Data does not appear to be in a KDBush format.");const o=s>>4;if(o!==1)throw new Error(`Got v${o} data when expected v1.`);const l=Wd[15&s];if(!l)throw new Error("Unrecognized array type.");const[u]=new Uint16Array(e,2,1),[d]=new Uint32Array(e,4,1);return new mu(d,u,l,e)}constructor(e,i=64,s=Float64Array,o){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+i,2),65535),this.ArrayType=s,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const l=Wd.indexOf(this.ArrayType),u=2*e*this.ArrayType.BYTES_PER_ELEMENT,d=e*this.IndexArrayType.BYTES_PER_ELEMENT,g=(8-d%8)%8;if(l<0)throw new Error(`Unexpected typed array class: ${s}.`);o&&o instanceof ArrayBuffer?(this.data=o,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+d+g,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+u+d+g),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+d+g,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+l]),new Uint16Array(this.data,2,1)[0]=i,new Uint32Array(this.data,4,1)[0]=e)}add(e,i){const s=this._pos>>1;return this.ids[s]=s,this.coords[this._pos++]=e,this.coords[this._pos++]=i,s}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return wh(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,i,s,o){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:l,coords:u,nodeSize:d}=this,g=[0,l.length-1,0],m=[];for(;g.length;){const v=g.pop()||0,_=g.pop()||0,T=g.pop()||0;if(_-T<=d){for(let A=T;A<=_;A++){const D=u[2*A],F=u[2*A+1];D>=e&&D<=s&&F>=i&&F<=o&&m.push(l[A])}continue}const b=T+_>>1,I=u[2*b],M=u[2*b+1];I>=e&&I<=s&&M>=i&&M<=o&&m.push(l[b]),(v===0?e<=I:i<=M)&&(g.push(T),g.push(b-1),g.push(1-v)),(v===0?s>=I:o>=M)&&(g.push(b+1),g.push(_),g.push(1-v))}return m}within(e,i,s){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:o,coords:l,nodeSize:u}=this,d=[0,o.length-1,0],g=[],m=s*s;for(;d.length;){const v=d.pop()||0,_=d.pop()||0,T=d.pop()||0;if(_-T<=u){for(let A=T;A<=_;A++)Xd(l[2*A],l[2*A+1],e,i)<=m&&g.push(o[A]);continue}const b=T+_>>1,I=l[2*b],M=l[2*b+1];Xd(I,M,e,i)<=m&&g.push(o[b]),(v===0?e-s<=I:i-s<=M)&&(d.push(T),d.push(b-1),d.push(1-v)),(v===0?e+s>=I:i+s>=M)&&(d.push(b+1),d.push(_),d.push(1-v))}return g}}function wh(r,e,i,s,o,l){if(o-s<=i)return;const u=s+o>>1;Hd(r,e,u,s,o,l),wh(r,e,i,s,u-1,1-l),wh(r,e,i,u+1,o,1-l)}function Hd(r,e,i,s,o,l){for(;o>s;){if(o-s>600){const m=o-s+1,v=i-s+1,_=Math.log(m),T=.5*Math.exp(2*_/3),b=.5*Math.sqrt(_*T*(m-T)/m)*(v-m/2<0?-1:1);Hd(r,e,i,Math.max(s,Math.floor(i-v*T/m+b)),Math.min(o,Math.floor(i+(m-v)*T/m+b)),l)}const u=e[2*i+l];let d=s,g=o;for(Xl(r,e,s,i),e[2*o+l]>u&&Xl(r,e,s,o);d<g;){for(Xl(r,e,d,g),d++,g--;e[2*d+l]<u;)d++;for(;e[2*g+l]>u;)g--}e[2*s+l]===u?Xl(r,e,s,g):(g++,Xl(r,e,g,o)),g<=i&&(s=g+1),i<=g&&(o=g-1)}}function Xl(r,e,i,s){Th(r,i,s),Th(e,2*i,2*s),Th(e,2*i+1,2*s+1)}function Th(r,e,i){const s=r[e];r[e]=r[i],r[i]=s}function Xd(r,e,i,s){const o=r-i,l=e-s;return o*o+l*l}function Sh(r,e,i,s){let o=s;const l=e+(i-e>>1);let u,d=i-e;const g=r[e],m=r[e+1],v=r[i],_=r[i+1];for(let T=e+3;T<i;T+=3){const b=zm(r[T],r[T+1],g,m,v,_);if(b>o)u=T,o=b;else if(b===o){const I=Math.abs(T-l);I<d&&(u=T,d=I)}}o>s&&(u-e>3&&Sh(r,e,u,s),r[u+2]=o,i-u>3&&Sh(r,u,i,s))}function zm(r,e,i,s,o,l){let u=o-i,d=l-s;if(u!==0||d!==0){const g=((r-i)*u+(e-s)*d)/(u*u+d*d);g>1?(i=o,s=l):g>0&&(i+=u*g,s+=d*g)}return u=r-i,d=e-s,u*u+d*d}function Xt(r,e,i,s){const o={type:e,geom:i},l={id:r??null,type:o.type,geometry:o.geom,tags:s,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};switch(o.type){case"Point":case"MultiPoint":Yl(l,o.geom);break;case"LineString":Yl(l,o.geom.points);break;case"Polygon":Yl(l,o.geom[0].points);break;case"MultiLineString":for(const u of o.geom)Yl(l,u.points);break;case"MultiPolygon":for(const u of o.geom)Yl(l,u[0].points)}return l}function Ph(r){r.points.length>64&&(r.points=new Float64Array(r.points))}function Yl(r,e){for(let i=0;i<e.length;i+=3)r.minX=Math.min(r.minX,e[i]),r.minY=Math.min(r.minY,e[i+1]),r.maxX=Math.max(r.maxX,e[i]),r.maxY=Math.max(r.maxY,e[i+1])}function Ih(r,e){const i=[];switch(r.type){case"FeatureCollection":for(let s=0;s<r.features.length;s++)gu(i,r.features[s],e,s);break;case"Feature":gu(i,r,e);break;default:gu(i,{geometry:r,properties:void 0},e)}return i}function gu(r,e,i,s){if(!e.geometry)return;if(e.geometry.type==="GeometryCollection")return void(function(d,g,m,v,_){for(const T of m.geometries)gu(d,{id:g.id,geometry:T,properties:g.properties},v,_)})(r,e,e.geometry,i,s);if(!e.geometry.coordinates?.length)return;const l=(function(d,g,m){return g.promoteId?d.properties?.[g.promoteId]:g.generateId?m||0:d.id})(e,i,s),u=Math.pow(i.tolerance/((1<<i.maxZoom)*i.extent),2);switch(e.geometry.type){case"Point":return void(function(d,g,m,v){const _=[];_.push(ha(m.coordinates[0]),da(m.coordinates[1]),0),d.push(Xt(g,"Point",_,v))})(r,l,e.geometry,e.properties);case"MultiPoint":return void(function(d,g,m,v){const _=[];for(const T of m.coordinates)_.push(ha(T[0]),da(T[1]),0);d.push(Xt(g,"MultiPoint",_,v))})(r,l,e.geometry,e.properties);case"LineString":return void(function(d,g,m,v,_){const T={points:[]};Mh(m.coordinates,T,v,!1),d.push(Xt(g,"LineString",T,_))})(r,l,e.geometry,u,e.properties);case"MultiLineString":return void(function(d,g,m,v,_,T){if(_.lineMetrics)for(const b of m.coordinates){const I={points:[]};Mh(b,I,v,!1),d.push(Xt(g,"LineString",I,T))}else{const b=[];Eh(m.coordinates,b,v,!1),d.push(Xt(g,"MultiLineString",b,T))}})(r,l,e.geometry,u,i,e.properties);case"Polygon":return void(function(d,g,m,v,_){const T=[];Eh(m.coordinates,T,v,!0),d.push(Xt(g,"Polygon",T,_))})(r,l,e.geometry,u,e.properties);case"MultiPolygon":return void(function(d,g,m,v,_){const T=[];for(const b of m.coordinates){const I=[];Eh(b,I,v,!0),T.push(I)}d.push(Xt(g,"MultiPolygon",T,_))})(r,l,e.geometry,u,e.properties);default:throw new Error("Input data is not a valid GeoJSON object.")}}function Mh(r,e,i,s){let o,l,u=0;for(let g=0;g<r.length;g++){const m=ha(r[g][0]),v=da(r[g][1]);e.points.push(m,v,0),g>0&&(u+=s?(o*v-m*l)/2:Math.sqrt(Math.pow(m-o,2)+Math.pow(v-l,2))),o=m,l=v}const d=e.points.length-3;e.points[2]=1,i>0&&Sh(e.points,0,d,i),e.points[d+2]=1,Ph(e),e.size=Math.abs(u),e.start=0,e.end=e.size}function Eh(r,e,i,s){for(let o=0;o<r.length;o++){const l={points:[]};Mh(r[o],l,i,s),e.push(l)}}function ha(r){return r/360+.5}function da(r){const e=Math.sin(r*Math.PI/180),i=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return i<0?0:i>1?1:i}function _u(r){const e={type:"Feature",geometry:km(r),properties:r.tags};return r.id!=null&&(e.id=r.id),e}function km(r){const{type:e,geometry:i}=r;switch(e){case"Point":return{type:e,coordinates:Yd(i[0],i[1])};case"MultiPoint":return{type:e,coordinates:yu(i)};case"LineString":return{type:e,coordinates:yu(i.points)};case"MultiLineString":case"Polygon":return{type:e,coordinates:i.map((s=>yu(s.points)))};case"MultiPolygon":return{type:e,coordinates:i.map((s=>s.map((o=>yu(o.points)))))}}}function yu(r){const e=[];for(let i=0;i<r.length;i+=3)e.push(Yd(r[i],r[i+1]));return e}function Yd(r,e){return[Kd(r),Jd(e)]}function Kd(r){return 360*(r-.5)}function Jd(r){const e=(180-360*r)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}var ui;function Sn(r,e,i,s,o,l,u,d){if(s/=e,l>=(i/=e)&&u<s)return r;if(u<i||l>=s)return null;const g=[];for(const m of r){const v=o===ui.X?m.minX:m.minY,_=o===ui.X?m.maxX:m.maxY;if(v>=i&&_<s)g.push(m);else if(!(_<i||v>=s))switch(m.type){case"Point":case"MultiPoint":Rm(m,g,i,s,o);continue;case"LineString":Fm(m,g,i,s,o,d);continue;case"MultiLineString":Lm(m,g,i,s,o);continue;case"Polygon":Bm(m,g,i,s,o);continue;case"MultiPolygon":Om(m,g,i,s,o);continue}}return g.length?g:null}function Rm(r,e,i,s,o){const l=[];(function(u,d,g,m,v){for(let _=0;_<u.length;_+=3){const T=u[_+v];T>=g&&T<=m&&pa(d,u[_],u[_+1],u[_+2])}})(r.geometry,l,i,s,o),l.length&&e.push(Xt(r.id,l.length===3?"Point":"MultiPoint",l,r.tags))}function Fm(r,e,i,s,o,l){const u=[];if(Qd(r.geometry,u,i,s,o,!1,l.lineMetrics),u.length)if(l.lineMetrics)for(const d of u)e.push(Xt(r.id,"LineString",d,r.tags));else e.push(u.length>1?Xt(r.id,"MultiLineString",u,r.tags):Xt(r.id,"LineString",u[0],r.tags))}function Lm(r,e,i,s,o){const l=[];Ch(r.geometry,l,i,s,o,!1),l.length&&e.push(l.length!==1?Xt(r.id,"MultiLineString",l,r.tags):Xt(r.id,"LineString",l[0],r.tags))}function Bm(r,e,i,s,o){const l=[];Ch(r.geometry,l,i,s,o,!0),l.length&&e.push(Xt(r.id,"Polygon",l,r.tags))}function Om(r,e,i,s,o){const l=[];for(const u of r.geometry){const d=[];Ch(u,d,i,s,o,!0),d.length&&l.push(d)}l.length&&e.push(Xt(r.id,"MultiPolygon",l,r.tags))}function Qd(r,e,i,s,o,l,u){let d=ep(r);const g=o===ui.X?Vm:jm;let m,v,_=r.start;for(let A=0;A<r.points.length-3;A+=3){const D=r.points[A],F=r.points[A+1],k=r.points[A+2],L=r.points[A+3],O=r.points[A+4],j=o===ui.X?D:F,Y=o===ui.X?L:O;let J=!1;u&&(m=Math.sqrt(Math.pow(D-L,2)+Math.pow(F-O,2))),j<i?Y>i&&(v=g(d,D,F,L,O,i),u&&(d.start=_+m*v)):j>s?Y<s&&(v=g(d,D,F,L,O,s),u&&(d.start=_+m*v)):pa(d.points,D,F,k),Y<i&&j>=i&&(v=g(d,D,F,L,O,i),J=!0),Y>s&&j<=s&&(v=g(d,D,F,L,O,s),J=!0),!l&&J&&(u&&(d.end=_+m*v),e.push(d),d=ep(r)),u&&(_+=m)}let T=r.points.length-3;const b=r.points[T],I=r.points[T+1],M=o===ui.X?b:I;M>=i&&M<=s&&pa(d.points,b,I,r.points[T+2]),T=d.points.length-3,l&&T>=3&&(d.points[T]!==d.points[0]||d.points[T+1]!==d.points[1])&&pa(d.points,d.points[0],d.points[1],d.points[2]),d.points.length&&(Ph(d),e.push(d))}function ep(r){return{points:[],size:r.size,start:r.start,end:r.end}}function Ch(r,e,i,s,o,l){for(const u of r)Qd(u,e,i,s,o,l,!1)}function pa(r,e,i,s){r.push(e,i,s)}function Vm(r,e,i,s,o,l){const u=(l-e)/(s-e);return pa(r.points,l,i+(o-i)*u,1),u}function jm(r,e,i,s,o,l){const u=(l-i)/(o-i);return pa(r.points,e+(s-e)*u,l,1),u}function Ah(r,e){const i=e.buffer/e.extent;let s=r;const o=Sn(r,1,-1-i,i,ui.X,-1,2,e),l=Sn(r,1,1-i,2+i,ui.X,-1,2,e);return(o||l)&&(s=Sn(r,1,-i,1+i,ui.X,-1,2,e)||[],o&&(s=tp(o,1).concat(s)),l&&(s=s.concat(tp(l,-1)))),s}function tp(r,e){const i=[];for(const s of r)switch(s.type){case"Point":case"MultiPoint":{const o=Nm(s.geometry,e);i.push(Xt(s.id,s.type,o,s.tags));continue}case"LineString":{const o=Dh(s.geometry,e);i.push(Xt(s.id,s.type,o,s.tags));continue}case"MultiLineString":case"Polygon":{const o=[];for(const l of s.geometry)o.push(Dh(l,e));i.push(Xt(s.id,s.type,o,s.tags));continue}case"MultiPolygon":{const o=[];for(const l of s.geometry){const u=[];for(const d of l)u.push(Dh(d,e));o.push(u)}i.push(Xt(s.id,s.type,o,s.tags));continue}}return i}function Nm(r,e){const i=[];for(let s=0;s<r.length;s+=3)i.push(r[s]+e,r[s+1],r[s+2]);return i}function Dh(r,e){const i={points:[],size:r.size};r.start!==void 0&&(i.start=r.start,i.end=r.end);for(let s=0;s<r.points.length;s+=3)i.points.push(r.points[s]+e,r.points[s+1],r.points[s+2]);return Ph(i),i}function Um(r,e,i){const s=!!e.newGeometry,o=e.removeAllProperties||e.removeProperties?.length>0||e.addOrUpdateProperties?.length>0;if(s){const l=r[0];let u=Ih({type:"FeatureCollection",features:[{type:"Feature",id:l.id,geometry:e.newGeometry,properties:o?ip(l.tags,e):l.tags}]},i);return u=Ah(u,i),u}if(o){const l=[];for(const u of r){const d={...u};d.tags=ip(d.tags,e),l.push(d)}return l}return r}function ip(r,e){if(e.removeAllProperties)return{};const i={...r||{}};if(e.removeProperties)for(const s of e.removeProperties)delete i[s];if(e.addOrUpdateProperties)for(const{key:s,value:o}of e.addOrUpdateProperties)i[s]=o;return i}(function(r){r[r.X=0]="X",r[r.Y=1]="Y"})(ui||(ui={}));const zh={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:r=>r};class Gm{constructor(e){this.options=Object.assign(Object.create(zh),e),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[],this.points=[]}load(e){const i=[];for(const s of e){if(!s.geometry)continue;const[o,l]=s.geometry.coordinates,[u,d]=[ha(o),da(l)];i.push({id:s.id,type:"Point",geometry:[u,d],tags:s.properties})}this.createIndex(i)}initialize(e){const i=[];for(const s of e)s.type==="Point"&&i.push(s);this.createIndex(i)}updateIndex(e,i,s){this.options=Object.assign(Object.create(zh),s.clusterOptions),this.initialize(e)}createIndex(e){const{log:i,minZoom:s,maxZoom:o}=this.options;i&&console.time("total time");const l=`prepare ${e.length} points`;i&&console.time(l),this.points=e;const u=[];for(let g=0;g<e.length;g++){const m=e[g];if(!m?.geometry)continue;let[v,_]=m.geometry;v=Math.fround(v),_=Math.fround(_),u.push(v,_,1/0,g,-1,1),this.options.reduce&&u.push(0)}let d=this.trees[o+1]=this.createTree(u);i&&console.timeEnd(l);for(let g=o;g>=s;g--){const m=Date.now();d=this.trees[g]=this.createTree(this.cluster(d,g)),i&&console.log("z%d: %d clusters in %dms",g,d.numItems,Date.now()-m)}i&&console.timeEnd("total time")}getClusters(e,i){return this.getClustersInternal(e,i).map((s=>_u(s)))}getClustersInternal(e,i){let s=((e[0]+180)%360+360)%360-180;const o=Math.max(-90,Math.min(90,e[1]));let l=e[2]===180?180:((e[2]+180)%360+360)%360-180;const u=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)s=-180,l=180;else if(s>l){const _=this.getClustersInternal([s,o,180,u],i),T=this.getClustersInternal([-180,o,l,u],i);return _.concat(T)}const d=this.trees[this.limitZoom(i)],g=d.range(ha(s),da(u),ha(l),da(o)),m=d.flatData,v=[];for(const _ of g){const T=this.stride*_;v.push(m[T+5]>1?$m(m,T,this.clusterProps):this.points[m[T+3]])}return v}getChildren(e){const i=this.getOriginId(e),s=this.getOriginZoom(e),o=new Error("No cluster with the specified id: "+e),l=this.trees[s];if(!l)throw o;const u=l.flatData;if(i*this.stride>=u.length)throw o;const d=this.options.radius/(this.options.extent*Math.pow(2,s-1)),g=l.within(u[i*this.stride],u[i*this.stride+1],d),m=[];for(const v of g){const _=v*this.stride;u[_+4]===e&&m.push(u[_+5]>1?Zm(u,_,this.clusterProps):_u(this.points[u[_+3]]))}if(m.length===0)throw o;return m}getLeaves(e,i,s){const o=[];return this.appendLeaves(o,e,i=i||10,s=s||0,0),o}getTile(e,i,s){const o=this.trees[this.limitZoom(e)];if(!o)return null;const l=Math.pow(2,e),{extent:u,radius:d}=this.options,g=d/u,m=(s-g)/l,v=(s+1+g)/l,_={transformed:!0,features:[],source:null,x:i,y:s,z:e};return this.addTileFeatures(o.range((i-g)/l,m,(i+1+g)/l,v),o.flatData,i,s,l,_),i===0&&this.addTileFeatures(o.range(1-g/l,m,1,v),o.flatData,l,s,l,_),i===l-1&&this.addTileFeatures(o.range(0,m,g/l,v),o.flatData,-1,s,l,_),_}getClusterExpansionZoom(e){return this.getOriginZoom(e)}appendLeaves(e,i,s,o,l){const u=this.getChildren(i);for(const d of u){const g=d.properties;if(g?.cluster?l+g.point_count<=o?l+=g.point_count:l=this.appendLeaves(e,g.cluster_id,s,o,l):l<o?l++:e.push(d),e.length===s)break}return l}createTree(e){const i=new mu(e.length/this.stride|0,this.options.nodeSize,Float32Array);for(let s=0;s<e.length;s+=this.stride)i.add(e[s],e[s+1]);return i.finish(),i.flatData=e,i.data=null,i}addTileFeatures(e,i,s,o,l,u){for(const d of e){const g=d*this.stride,m=i[g+5]>1;let v,_,T;if(m)v=kh(i,g,this.clusterProps),_=i[g],T=i[g+1];else{const M=this.points[i[g+3]];v=M.tags,[_,T]=M.geometry}const b={type:1,geometry:[[Math.round(this.options.extent*(_*l-s)),Math.round(this.options.extent*(T*l-o))]],tags:v};let I;I=m||this.options.generateId?i[g+3]:this.points[i[g+3]].id,I!==void 0&&(b.id=I),u.features.push(b)}}limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}cluster(e,i){const{radius:s,extent:o,reduce:l,minPoints:u}=this.options,d=s/(o*Math.pow(2,i)),g=e.flatData,m=[],v=this.stride;for(let _=0;_<g.length;_+=v){if(g[_+2]<=i)continue;g[_+2]=i;const T=g[_],b=g[_+1],I=e.within(g[_],g[_+1],d),M=g[_+5];let A=M;for(const D of I){const F=D*v;g[F+2]>i&&(A+=g[F+5])}if(A>M&&A>=u){let D,F=T*M,k=b*M,L=-1;const O=(_/v<<5)+(i+1)+this.points.length;for(const j of I){const Y=j*v;if(g[Y+2]<=i)continue;g[Y+2]=i;const J=g[Y+5];F+=g[Y]*J,k+=g[Y+1]*J,g[Y+4]=O,l&&(D||(D=this.map(g,_,!0),L=this.clusterProps.length,this.clusterProps.push(D)),l(D,this.map(g,Y)))}g[_+4]=O,m.push(F/A,k/A,1/0,O,-1,A),l&&m.push(L)}else{for(let D=0;D<v;D++)m.push(g[_+D]);if(A>1)for(const D of I){const F=D*v;if(!(g[F+2]<=i)){g[F+2]=i;for(let k=0;k<v;k++)m.push(g[F+k])}}}}return m}getOriginId(e){return e-this.points.length>>5}getOriginZoom(e){return(e-this.points.length)%32}map(e,i,s){if(e[i+5]>1){const u=this.clusterProps[e[i+6]];return s?Object.assign({},u):u}const o=this.points[e[i+3]].tags,l=this.options.map(o);return s&&l===o?Object.assign({},l):l}}function $m(r,e,i){return{id:r[e+3],type:"Point",tags:kh(r,e,i),geometry:[r[e],r[e+1]]}}function Zm(r,e,i){return{type:"Feature",id:r[e+3],properties:kh(r,e,i),geometry:{type:"Point",coordinates:[Kd(r[e]),Jd(r[e+1])]}}}function kh(r,e,i){const s=r[e+5],o=s>=1e4?`${Math.round(s/1e3)}k`:s>=1e3?Math.round(s/100)/10+"k":s,l=r[e+6],u=l===-1?{}:Object.assign({},i[l]);return Object.assign(u,{cluster:!0,cluster_id:r[e+3],point_count:s,point_count_abbreviated:o})}const Rh="geojsonvt_clip_start",Fh="geojsonvt_clip_end";function rp(r,e,i,s,o){const l=e===o.maxZoom?0:o.tolerance/((1<<e)*o.extent),u={transformed:!1,features:[],source:null,x:i,y:s,z:e,minX:2,minY:1,maxX:-1,maxY:0,numPoints:0,numSimplified:0,numFeatures:r.length};for(const d of r)qm(u,d,l,o);return u}function qm(r,e,i,s){switch(r.minX=Math.min(r.minX,e.minX),r.minY=Math.min(r.minY,e.minY),r.maxX=Math.max(r.maxX,e.maxX),r.maxY=Math.max(r.maxY,e.maxY),e.type){case"Point":case"MultiPoint":return void(function(o,l){const u=[];for(let g=0;g<l.geometry.length;g+=3)u.push(l.geometry[g],l.geometry[g+1]),o.numPoints++,o.numSimplified++;if(!u.length)return;const d={type:1,tags:l.tags||null,geometry:u};l.id!==null&&(d.id=l.id),o.features.push(d)})(r,e);case"LineString":return void(function(o,l,u,d){const g=[];if(Lh(g,l.geometry,o,u,!1,!1),!g.length)return;let m=l.tags||null;if(d.lineMetrics){m={};for(const _ in l.tags)m[_]=l.tags[_];m[Rh]=l.geometry.start/l.geometry.size,m[Fh]=l.geometry.end/l.geometry.size}const v={type:2,tags:m,geometry:g};l.id!==null&&(v.id=l.id),o.features.push(v)})(r,e,i,s);case"MultiLineString":case"Polygon":return void(function(o,l,u){const d=[];for(let m=0;m<l.geometry.length;m++)Lh(d,l.geometry[m],o,u,l.type==="Polygon",m===0);if(!d.length)return;const g={type:l.type==="Polygon"?3:2,tags:l.tags||null,geometry:d};l.id!==null&&(g.id=l.id),o.features.push(g)})(r,e,i);case"MultiPolygon":return void(function(o,l,u){const d=[];for(let m=0;m<l.geometry.length;m++){const v=l.geometry[m];for(let _=0;_<v.length;_++)Lh(d,v[_],o,u,!0,_===0)}if(!d.length)return;const g={type:3,tags:l.tags||null,geometry:d};l.id!==null&&(g.id=l.id),o.features.push(g)})(r,e,i)}}function Lh(r,e,i,s,o,l){const u=s*s;if(s>0&&e.size<(o?u:s))return void(i.numPoints+=e.points.length/3);const d=[];for(let g=0;g<e.points.length;g+=3)(s===0||e.points[g+2]>u)&&(i.numSimplified++,d.push(e.points[g],e.points[g+1])),i.numPoints++;o&&(function(g,m){let v=0;for(let _=0,T=g.length,b=T-2;_<T;b=_,_+=2)v+=(g[_]-g[b])*(g[_+1]+g[b+1]);if(v>0===m)for(let _=0,T=g.length;_<T/2;_+=2){const b=g[_],I=g[_+1];g[_]=g[T-2-_],g[_+1]=g[T-1-_],g[T-2-_]=b,g[T-1-_]=I}})(d,l),r.push(d)}function np(r,e){if(r.transformed)return r;const i=1<<r.z,s=r.x,o=r.y;for(const l of r.features)l.type===1?Wm(l,e,i,s,o):Hm(l,e,i,s,o);return r.transformed=!0,r}function Wm(r,e,i,s,o){const l=r,u=r.geometry,d=[];for(let g=0;g<u.length;g+=2)d.push(sp(u[g],u[g+1],e,i,s,o));return l.geometry=d,l}function Hm(r,e,i,s,o){const l=r,u=r.geometry,d=[];for(const g of u){const m=[];for(let v=0;v<g.length;v+=2)m.push(sp(g[v],g[v+1],e,i,s,o));d.push(m)}return l.geometry=d,l}function sp(r,e,i,s,o,l){return[Math.round(i*(r*s-o)),Math.round(i*(e*s-l))]}class Xm{constructor(e){this.options=e,this.total=0,this.stats={},this.tiles={},this.tileCoords=[],this.stats={},this.total=0}initialize(e){this.splitTile(e,0,0,0),this.options.debug&&(e.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}updateIndex(e,i,s){s.debug>1&&(console.log("invalidating tiles"),console.time("invalidating")),this.invalidateTiles(i),s.debug>1&&console.timeEnd("invalidating");const[o,l,u]=[0,0,0],d=rp(e,o,l,u,s);d.source=e;const g=vu(o,l,u);if(this.tiles[g]=d,this.tileCoords.push({z:o,x:l,y:u,id:g}),s.debug){const m=`z${o}`;this.stats[m]=(this.stats[m]||0)+1,this.total++}}getClusterExpansionZoom(e){return null}getChildren(e){return null}getLeaves(e,i,s){return null}getTile(e,i,s){const{extent:o,debug:l}=this.options,u=1<<e,d=vu(e,i=i+u&u-1,s);if(this.tiles[d])return np(this.tiles[d],o);l>1&&console.log("drilling down to z%d-%d-%d",e,i,s);let g,m=e,v=i,_=s;for(;!g&&m>0;)m--,v>>=1,_>>=1,g=this.tiles[vu(m,v,_)];return g?.source?(l>1&&(console.log("found parent tile z%d-%d-%d",m,v,_),console.time("drilling down")),this.splitTile(g.source,m,v,_,e,i,s),l>1&&console.timeEnd("drilling down"),this.tiles[d]?np(this.tiles[d],o):null):null}splitTile(e,i,s,o,l,u,d){const g=[e,i,s,o],m=this.options,v=m.debug;for(;g.length;){o=g.pop(),s=g.pop(),i=g.pop(),e=g.pop();const _=1<<i,T=vu(i,s,o);let b=this.tiles[T];if(!b&&(v>1&&console.time("creation"),b=this.tiles[T]=rp(e,i,s,o,m),this.tileCoords.push({z:i,x:s,y:o,id:T}),v)){v>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",i,s,o,b.numFeatures,b.numPoints,b.numSimplified),console.timeEnd("creation"));const J=`z${i}`;this.stats[J]=(this.stats[J]||0)+1,this.total++}if(b.source=e,l==null){if(i===m.indexMaxZoom||b.numPoints<=m.indexMaxPoints)continue}else{if(i===m.maxZoom||i===l)continue;if(l!=null){const J=l-i;if(s!==u>>J||o!==d>>J)continue}}if(b.source=null,!e.length)continue;v>1&&console.time("clipping");const I=.5*m.buffer/m.extent,M=.5-I,A=.5+I,D=1+I;let F=null,k=null,L=null,O=null;const j=Sn(e,_,s-I,s+A,ui.X,b.minX,b.maxX,m),Y=Sn(e,_,s+M,s+D,ui.X,b.minX,b.maxX,m);j&&(F=Sn(j,_,o-I,o+A,ui.Y,b.minY,b.maxY,m),k=Sn(j,_,o+M,o+D,ui.Y,b.minY,b.maxY,m)),Y&&(L=Sn(Y,_,o-I,o+A,ui.Y,b.minY,b.maxY,m),O=Sn(Y,_,o+M,o+D,ui.Y,b.minY,b.maxY,m)),v>1&&console.timeEnd("clipping"),g.push(F||[],i+1,2*s,2*o),g.push(k||[],i+1,2*s,2*o+1),g.push(L||[],i+1,2*s+1,2*o),g.push(O||[],i+1,2*s+1,2*o+1)}}invalidateTiles(e){if(!e.length)return;const i=this.options,{debug:s}=i;let o=1/0,l=-1/0,u=1/0,d=-1/0;for(const v of e)o=Math.min(o,v.minX),l=Math.max(l,v.maxX),u=Math.min(u,v.minY),d=Math.max(d,v.maxY);const g=i.buffer/i.extent,m=new Set;for(const v in this.tiles){const _=this.tiles[v],T=1<<_.z,b=(_.x-g)/T,I=(_.x+1+g)/T,M=(_.y-g)/T,A=(_.y+1+g)/T;if(l<b||o>=I||d<M||u>=A)continue;let D=!1;for(const F of e)if(F.maxX>=b&&F.minX<I&&F.maxY>=M&&F.minY<A){D=!0;break}if(D){if(s){s>1&&console.log("invalidate tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",_.z,_.x,_.y,_.numFeatures,_.numPoints,_.numSimplified);const F=`z${_.z}`;this.stats[F]=(this.stats[F]||0)-1,this.total--}delete this.tiles[v],m.add(v)}}m.size&&(this.tileCoords=this.tileCoords.filter((v=>!m.has(v.id))))}}function vu(r,e,i){return 32*((1<<r)*i+e)+r}const Ym={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,updateable:!1,cluster:!1,clusterOptions:zh,debug:0},Km=lt([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:Jm}=Km,Qm=lt([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:eg}=Qm,tg=Math.cos(Math.PI/180*37.5),op=Math.pow(2,14)/.5;class Bh{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((i=>i.id)),this.index=e.index,this.hasDependencies=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={};for(const i of this.layers)this.gradients[i.id]={};this.layoutVertexArray=new X,this.layoutVertexArray2=new Z,this.indexArray=new he,this.programConfigurations=new gr(e.layers,e.zoom),this.segments=new we,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((i=>i.isStateDependent())).map((i=>i.id))}populate(e,i,s){this.hasDependencies=hu("line",this.layers,i)||this.hasLineDasharray(this.layers);const o=this.layers[0].layout.get("line-sort-key"),l=!o.isConstant(),u=[];for(const{feature:d,id:g,index:m,sourceLayerIndex:v}of e){const _=this.layers[0]._featureFilter.needGeometry,T=Ur(d,_);if(!this.layers[0]._featureFilter.filter(new at(this.zoom),T,s))continue;const b=l?o.evaluate(T,{},s):void 0,I={id:g,properties:d.properties,type:d.type,sourceLayerIndex:v,index:m,geometry:_?T.geometry:Nr(d),patterns:{},dashes:{},sortKey:b};u.push(I)}l&&u.sort(((d,g)=>d.sortKey-g.sortKey));for(const d of u){const{geometry:g,index:m,sourceLayerIndex:v}=d;this.hasDependencies?(hu("line",this.layers,i)?gh("line",this.layers,d,{zoom:this.zoom},i):this.hasLineDasharray(this.layers)&&this.addLineDashDependencies(this.layers,d,this.zoom,i),this.patternFeatures.push(d)):this.addFeature(d,g,m,s,{},{},i.subdivisionGranularity),i.featureIndex.insert(e[m].feature,g,m,v,this.index)}}update(e,i,s,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,i,this.stateDependentLayers,{imagePositions:s,dashPositions:o})}addFeatures(e,i,s,o){for(const l of this.patternFeatures)this.addFeature(l,l.geometry,l.index,i,s,o,e.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,eg)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Jm),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&Object.hasOwn(e.properties,Rh)&&Object.hasOwn(e.properties,Fh))return{start:+e.properties[Rh],end:+e.properties[Fh]}}addFeature(e,i,s,o,l,u,d){const g=this.layers[0].layout,m=g.get("line-join").evaluate(e,{}),v=g.get("line-cap").evaluate(e,{}),_=g.get("line-miter-limit").evaluate(e,{}),T=g.get("line-round-limit").evaluate(e,{});this.lineClips=this.lineFeatureClips(e);for(const b of i)this.addLine(b,e,m,v,_,T,o,d);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,{imagePositions:l,dashPositions:u,canonical:o})}addLine(e,i,s,o,l,u,d,g){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,e=ro(e,d?g.line.getGranularityForZoomLevel(d.z):1),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let k=0;k<e.length-1;k++)this.totalDistance+=e[k].dist(e[k+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const m=ql.types[i.type]==="Polygon";let v=e.length;for(;v>=2&&e[v-1].equals(e[v-2]);)v--;let _=0;for(;_<v-1&&e[_].equals(e[_+1]);)_++;if(v<(m?3:2))return;s==="bevel"&&(l=1.05);const T=this.overscaling<=16?122880/(512*this.overscaling):0,b=this.segments.prepareSegment(10*v,this.layoutVertexArray,this.indexArray);let I,M,A,D,F;this.e1=this.e2=-1,m&&(I=e[v-2],F=e[_].sub(I)._unit()._perp());for(let k=_;k<v;k++){if(A=k===v-1?m?e[_+1]:void 0:e[k+1],A&&e[k].equals(A))continue;F&&(D=F),I&&(M=I),I=e[k],F=A?A.sub(I)._unit()._perp():D,D||(D=F);let L=D.add(F);L.x===0&&L.y===0||L._unit();const O=D.x*F.x+D.y*F.y,j=L.x*F.x+L.y*F.y,Y=j!==0?1/j:1/0,J=2*Math.sqrt(2-2*j),re=j<tg&&M&&A,te=D.x*F.y-D.y*F.x>0;if(re&&k>_){const ne=I.dist(M);if(ne>2*T){const ie=I.sub(I.sub(M)._mult(T/ne)._round());this.updateDistance(M,ie),this.addCurrentVertex(ie,D,0,0,b),M=ie}}const ae=M&&A;let le=ae?s:m?"butt":o;if(ae&&le==="round"&&(Y<u?le="miter":Y<=2&&(le="fakeround")),le==="miter"&&Y>l&&(le="bevel"),le==="bevel"&&(Y>2&&(le="flipbevel"),Y<l&&(le="miter")),M&&this.updateDistance(M,I),le==="miter")L._mult(Y),this.addCurrentVertex(I,L,0,0,b);else if(le==="flipbevel"){if(Y>100)L=F.mult(-1);else{const ne=Y*D.add(F).mag()/D.sub(F).mag();L._perp()._mult(ne*(te?-1:1))}this.addCurrentVertex(I,L,0,0,b),this.addCurrentVertex(I,L.mult(-1),0,0,b)}else if(le==="bevel"||le==="fakeround"){const ne=-Math.sqrt(Y*Y-1),ie=te?ne:0,fe=te?0:ne;if(M&&this.addCurrentVertex(I,D,ie,fe,b),le==="fakeround"){const xe=Math.round(180*J/Math.PI/20);for(let ye=1;ye<xe;ye++){let me=ye/xe;if(me!==.5){const Xe=me-.5;me+=me*Xe*(me-1)*((1.0904+O*(O*(3.55645-1.43519*O)-3.2452))*Xe*Xe+(.848013+O*(.215638*O-1.06021)))}const Ae=F.sub(D)._mult(me)._add(D)._unit()._mult(te?-1:1);this.addHalfVertex(I,Ae.x,Ae.y,!1,te,0,b)}}A&&this.addCurrentVertex(I,F,-ie,-fe,b)}else if(le==="butt")this.addCurrentVertex(I,L,0,0,b);else if(le==="square"){const ne=M?1:-1;this.addCurrentVertex(I,L,ne,ne,b)}else le==="round"&&(M&&(this.addCurrentVertex(I,D,0,0,b),this.addCurrentVertex(I,D,1,1,b,!0)),A&&(this.addCurrentVertex(I,F,-1,-1,b,!0),this.addCurrentVertex(I,F,0,0,b)));if(re&&k<v-1){const ne=I.dist(A);if(ne>2*T){const ie=I.add(A.sub(I)._mult(T/ne)._round());this.updateDistance(I,ie),this.addCurrentVertex(ie,F,0,0,b),I=ie}}}}addCurrentVertex(e,i,s,o,l,u=!1){const d=i.y*o-i.x,g=-i.y-i.x*o;this.addHalfVertex(e,i.x+i.y*s,i.y-i.x*s,u,!1,s,l),this.addHalfVertex(e,d,g,u,!0,-o,l),this.distance>op/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,i,s,o,l,u))}addHalfVertex({x:e,y:i},s,o,l,u,d,g){const m=.5*(this.lineClips?this.scaledDistance*(op-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+(l?1:0),(i<<1)+(u?1:0),Math.round(63*s)+128,Math.round(63*o)+128,1+(d===0?0:d<0?-1:1)|(63&m)<<2,m>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const v=g.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,v,this.e2),g.primitiveLength++),u?this.e2=v:this.e1=v}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(e,i){this.distance+=e.dist(i),this.updateScaledDistance()}hasLineDasharray(e){for(const i of e){const s=i.paint.get("line-dasharray");if(s&&!s.isConstant())return!0}return!1}addLineDashDependencies(e,i,s,o){for(const l of e){const u=l.paint.get("line-dasharray");if(!u||u.value.kind==="constant")continue;const d=l.layout.get("line-cap").evaluate(i,{})==="round",g={dasharray:u.value.evaluate({zoom:s-1},i,{}),round:d},m={dasharray:u.value.evaluate({zoom:s},i,{}),round:d},v={dasharray:u.value.evaluate({zoom:s+1},i,{}),round:d},_=`${g.dasharray.join(",")},${g.round}`,T=`${m.dasharray.join(",")},${m.round}`,b=`${v.dasharray.join(",")},${v.round}`;o.dashDependencies[_]=g,o.dashDependencies[T]=m,o.dashDependencies[b]=v,i.dashes[l.id]={min:_,mid:T,max:b}}}}let ap,lp;Se("LineBucket",Bh,{omit:["layers","patternFeatures"]});var cp={get paint(){return lp=lp||new li({"line-opacity":new Ce(ce.paint_line["line-opacity"]),"line-color":new Ce(ce.paint_line["line-color"]),"line-translate":new Ie(ce.paint_line["line-translate"]),"line-translate-anchor":new Ie(ce.paint_line["line-translate-anchor"]),"line-width":new Ce(ce.paint_line["line-width"]),"line-gap-width":new Ce(ce.paint_line["line-gap-width"]),"line-offset":new Ce(ce.paint_line["line-offset"]),"line-blur":new Ce(ce.paint_line["line-blur"]),"line-dasharray":new Fr(ce.paint_line["line-dasharray"]),"line-pattern":new Fr(ce.paint_line["line-pattern"]),"line-gradient":new ns(ce.paint_line["line-gradient"])})},get layout(){return ap=ap||new li({"line-cap":new Ce(ce.layout_line["line-cap"]),"line-join":new Ce(ce.layout_line["line-join"]),"line-miter-limit":new Ce(ce.layout_line["line-miter-limit"]),"line-round-limit":new Ce(ce.layout_line["line-round-limit"]),"line-sort-key":new Ce(ce.layout_line["line-sort-key"])})}};class ig extends Ce{possiblyEvaluate(e,i){return i=new at(Math.floor(i.zoom),{now:i.now,fadeDuration:i.fadeDuration,zoomHistory:i.zoomHistory,transition:i.transition}),super.possiblyEvaluate(e,i)}evaluate(e,i,s,o){return i=Fi({},i,{zoom:Math.floor(i.zoom)}),super.evaluate(e,i,s,o)}}let xu;class rg extends Vi{constructor(e,i){super(e,cp,i),this.gradientVersion=0,xu||(xu=new ig(cp.paint.properties["line-width"].specification),xu.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if(e==="line-gradient"){const i=this.gradientExpression();this.stepInterpolant=!!(function(s){return s._styleExpression!==void 0})(i)&&i._styleExpression.expression instanceof Zn,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(e,i){super.recalculate(e,i),this.paint._values["line-floorwidth"]=xu.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new Bh(e)}queryRadius(e){const i=e,s=up(aa("line-width",this,i),aa("line-gap-width",this,i)),o=aa("line-offset",this,i);return s/2+Math.abs(o)+cu(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:e,feature:i,featureState:s,geometry:o,transform:l,pixelsToTileUnits:u}){const d=uu(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-l.bearingInRadians,u),g=u/2*up(this.paint.get("line-width").evaluate(i,s),this.paint.get("line-gap-width").evaluate(i,s)),m=this.paint.get("line-offset").evaluate(i,s);return m&&(o=(function(v,_){const T=[];for(const b of v){const I=qf(b),M=[];for(let A=0;A<I.length;A++){const D=I[A],F=I[A-1],k=I[A+1],L=A===0?new Te(0,0):D.sub(F)._unit()._perp(),O=A===I.length-1?new Te(0,0):k.sub(D)._unit()._perp(),j=L._add(O)._unit(),Y=j.x*O.x+j.y*O.y;Y!==0&&j._mult(1/Y),M.push(j._mult(_)._add(D))}T.push(M)}return T})(o,m*u)),(function(v,_,T){for(const b of _){if(v.length>=3){for(const I of b)if(oa(v,I))return!0}if(Gf(v,b,T))return!0}return!1})(d,o,g)}isTileClipped(){return!0}}function up(r,e){return e>0?e+2*r:r}const ng=lt([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),sg=lt([{name:"a_projected_pos",components:3,type:"Float32"}],4);lt([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const og=lt([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);lt([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const hp=lt([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),ag=lt([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function lg(r,e,i){const s=e.layout.get("text-transform").evaluate(i,{});return s==="uppercase"?r=r.toLocaleUpperCase():s==="lowercase"&&(r=r.toLocaleLowerCase()),pr.applyArabicShaping&&(r=pr.applyArabicShaping(r)),r}function cg(r,e,i){for(const s of r.sections)s.text=lg(s.text,e,i);return r}lt([{name:"triangle",components:3,type:"Uint16"}]),lt([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),lt([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),lt([{type:"Float32",name:"offsetX"}]),lt([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),lt([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);var Ot=24;const Kl={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","⋯":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"},ug={10:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},hg={40:!0};function dp(r,e,i,s,o,l){if("fontStack"in e){const u=i[e.fontStack],d=u?.[r];return d?d.metrics.advance*e.scale+o:0}{const u=s[e.imageName];return u?u.displaySize[0]*e.scale*Ot/l+o:0}}function pp(r,e,i,s){const o=Math.pow(r-e,2);return s?r<e?o/2:2*o:o+Math.abs(i)*i}function dg(r,e,i){let s=0;return r===10&&(s-=1e4),i&&(s+=150),r!==40&&r!==65288||(s+=50),e!==41&&e!==65289||(s+=50),s}function fp(r,e,i,s,o,l){let u=null,d=pp(e,i,o,l);for(const g of s){const m=pp(e-g.x,i,o,l)+g.badness;m<=d&&(u=g,d=m)}return{index:r,x:e,priorBreak:u,badness:d}}function mp(r){return r?mp(r.priorBreak).concat(r.index):[]}class fa{constructor(e="",i=[],s=[]){this.text=e,this.sections=i,this.sectionIndex=s,this.imageSectionID=null}static fromFeature(e,i){const s=new fa;for(const o of e.sections)o.image?s.addImageSection(o):s.addTextSection(o,i);return s}length(){return[...this.text].length}getSection(e){return this.sections[this.sectionIndex[e]]}getSectionIndex(e){return this.sectionIndex[e]}verticalizePunctuation(){this.text=(function(e){let i="",s={premature:!0,value:void 0};const o=e[Symbol.iterator]();let l=o.next();const u=e[Symbol.iterator]();u.next();let d=u.next();for(;!l.done;)i+=!d.done&&Tl(d.value.codePointAt(0))&&!Kl[d.value]||!s.premature&&Tl(s.value.codePointAt(0))&&!Kl[s.value]||!Kl[l.value]?l.value:Kl[l.value],s={value:l.value,premature:!1},l=o.next(),d=u.next();return i})(this.text)}hasZeroWidthSpaces(){return this.text.includes("​")}trim(){const e=this.text.match(/^\s*/),i=e?e[0].length:0,s=this.text.match(/\S\s*$/),o=s?s[0].length-1:0;this.text=this.text.substring(i,this.text.length-o),this.sectionIndex=this.sectionIndex.slice(i,this.sectionIndex.length-o)}substring(e,i){const s=[...this.text].slice(e,i).join(""),o=this.sectionIndex.slice(e,i);return new fa(s,this.sections,o)}toCodeUnitIndex(e){return[...this.text].slice(0,e).join("").length}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce(((e,i)=>Math.max(e,this.sections[i].scale)),0)}getMaxImageSize(e){let i=0,s=0;for(let o=0;o<this.length();o++){const l=this.getSection(o);if("imageName"in l){const u=e[l.imageName];if(!u)continue;const d=u.displaySize;i=Math.max(i,d[0]),s=Math.max(s,d[1])}}return{maxImageWidth:i,maxImageHeight:s}}addTextSection(e,i){this.text+=e.text,this.sections.push({scale:e.scale||1,verticalAlign:e.verticalAlign||"bottom",fontStack:e.fontStack||i});const s=this.sections.length-1;this.sectionIndex.push(...[...e.text].map((()=>s)))}addImageSection(e){const i=e.image?e.image.name:"";if(i.length===0)return void $t("Can't add FormattedSection with an empty image.");const s=this.getNextImageSectionCharCode();s?(this.text+=String.fromCharCode(s),this.sections.push({scale:1,verticalAlign:e.verticalAlign||"bottom",imageName:i}),this.sectionIndex.push(this.sections.length-1)):$t("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}determineLineBreaks(e,i,s,o,l){const u=[],d=this.determineAverageLineWidth(e,i,s,o,l),g=this.hasZeroWidthSpaces();let m=0,v=0;const _=this.text[Symbol.iterator]();let T=_.next();const b=this.text[Symbol.iterator]();b.next();let I=b.next();const M=this.text[Symbol.iterator]();M.next(),M.next();let A=M.next();for(;!T.done;){const D=this.getSection(v),F=T.value.codePointAt(0);if(Jc(F)||(m+=dp(F,D,s,o,e,l)),!I.done){const k=nh(F),L=I.value.codePointAt(0);(ug[F]||k||"imageName"in D||!A.done&&hg[L])&&u.push(fp(v+1,m,d,u,dg(F,L,k&&g),!1))}v++,T=_.next(),I=b.next(),A=M.next()}return mp(fp(this.length(),m,d,u,0,!0))}determineAverageLineWidth(e,i,s,o,l){let u=0,d=0;for(const g of this.text){const m=this.getSection(d);u+=dp(g.codePointAt(0),m,s,o,e,l),d++}return u/Math.max(1,Math.ceil(u/i))}}const Oh=4294967296,gp=1/Oh,_p=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");class bu{constructor(e=new Uint8Array(16)){this.buf=ArrayBuffer.isView(e)?e:new Uint8Array(e),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(e,i,s=this.length){for(;this.pos<s;){const o=this.readVarint(),l=o>>3,u=this.pos;this.type=7&o,e(l,i,this),this.pos===u&&this.skip(o)}return i}readMessage(e,i){return this.readFields(e,i,this.readVarint()+this.pos)}readFixed32(){const e=this.dataView.getUint32(this.pos,!0);return this.pos+=4,e}readSFixed32(){const e=this.dataView.getInt32(this.pos,!0);return this.pos+=4,e}readFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*Oh;return this.pos+=8,e}readSFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*Oh;return this.pos+=8,e}readFloat(){const e=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,e}readDouble(){const e=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,e}readVarint(e){const i=this.buf;let s,o;return o=i[this.pos++],s=127&o,o<128?s:(o=i[this.pos++],s|=(127&o)<<7,o<128?s:(o=i[this.pos++],s|=(127&o)<<14,o<128?s:(o=i[this.pos++],s|=(127&o)<<21,o<128?s:(o=i[this.pos],s|=(15&o)<<28,(function(l,u,d){const g=d.buf;let m,v;if(v=g[d.pos++],m=(112&v)>>4,v<128||(v=g[d.pos++],m|=(127&v)<<3,v<128)||(v=g[d.pos++],m|=(127&v)<<10,v<128)||(v=g[d.pos++],m|=(127&v)<<17,v<128)||(v=g[d.pos++],m|=(127&v)<<24,v<128)||(v=g[d.pos++],m|=(1&v)<<31,v<128))return ma(l,m,u);throw new Error("Expected varint not more than 10 bytes")})(s,e,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){const e=this.readVarint();return e%2==1?(e+1)/-2:e/2}readBoolean(){return!!this.readVarint()}readString(){const e=this.readVarint()+this.pos,i=this.pos;return this.pos=e,e-i>=12&&_p?_p.decode(this.buf.subarray(i,e)):(function(s,o,l){let u="",d=o;for(;d<l;){const g=s[d];let m,v,_,T=null,b=g>239?4:g>223?3:g>191?2:1;if(d+b>l)break;b===1?g<128&&(T=g):b===2?(m=s[d+1],(192&m)==128&&(T=(31&g)<<6|63&m,T<=127&&(T=null))):b===3?(m=s[d+1],v=s[d+2],(192&m)==128&&(192&v)==128&&(T=(15&g)<<12|(63&m)<<6|63&v,(T<=2047||T>=55296&&T<=57343)&&(T=null))):b===4&&(m=s[d+1],v=s[d+2],_=s[d+3],(192&m)==128&&(192&v)==128&&(192&_)==128&&(T=(15&g)<<18|(63&m)<<12|(63&v)<<6|63&_,(T<=65535||T>=1114112)&&(T=null))),T===null?(T=65533,b=1):T>65535&&(T-=65536,u+=String.fromCharCode(T>>>10&1023|55296),T=56320|1023&T),u+=String.fromCharCode(T),d+=b}return u})(this.buf,i,e)}readBytes(){const e=this.readVarint()+this.pos,i=this.buf.subarray(this.pos,e);return this.pos=e,i}readPackedVarint(e=[],i){const s=this.readPackedEnd();for(;this.pos<s;)e.push(this.readVarint(i));return e}readPackedSVarint(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readSVarint());return e}readPackedBoolean(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readBoolean());return e}readPackedFloat(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readFloat());return e}readPackedDouble(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readDouble());return e}readPackedFixed32(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readFixed32());return e}readPackedSFixed32(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readSFixed32());return e}readPackedFixed64(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readFixed64());return e}readPackedSFixed64(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readSFixed64());return e}readPackedEnd(){return this.type===2?this.readVarint()+this.pos:this.pos+1}skip(e){const i=7&e;if(i===0)for(;this.buf[this.pos++]>127;);else if(i===2)this.pos=this.readVarint()+this.pos;else if(i===5)this.pos+=4;else{if(i!==1)throw new Error(`Unimplemented type: ${i}`);this.pos+=8}}writeTag(e,i){this.writeVarint(e<<3|i)}realloc(e){let i=this.length||16;for(;i<this.pos+e;)i*=2;if(i!==this.length){const s=new Uint8Array(i);s.set(this.buf),this.buf=s,this.dataView=new DataView(s.buffer),this.length=i}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeSFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,-1&e,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*gp),!0),this.pos+=8}writeSFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,-1&e,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*gp),!0),this.pos+=8}writeVarint(e){(e=+e||0)>268435455||e<0?(function(i,s){let o,l;if(i>=0?(o=i%4294967296|0,l=i/4294967296|0):(o=~(-i%4294967296),l=~(-i/4294967296),4294967295^o?o=o+1|0:(o=0,l=l+1|0)),i>=18446744073709552e3||i<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");s.realloc(10),(function(u,d,g){g.buf[g.pos++]=127&u|128,u>>>=7,g.buf[g.pos++]=127&u|128,u>>>=7,g.buf[g.pos++]=127&u|128,u>>>=7,g.buf[g.pos++]=127&u|128,g.buf[g.pos]=127&(u>>>=7)})(o,0,s),(function(u,d){const g=(7&u)<<4;d.buf[d.pos++]|=g|((u>>>=3)?128:0),u&&(d.buf[d.pos++]=127&u|((u>>>=7)?128:0),u&&(d.buf[d.pos++]=127&u|((u>>>=7)?128:0),u&&(d.buf[d.pos++]=127&u|((u>>>=7)?128:0),u&&(d.buf[d.pos++]=127&u|((u>>>=7)?128:0),u&&(d.buf[d.pos++]=127&u)))))})(l,s)})(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=e>>>7&127))))}writeSVarint(e){this.writeVarint(e<0?2*-e-1:2*e)}writeBoolean(e){this.writeVarint(+e)}writeString(e){e=String(e),this.realloc(4*e.length),this.pos++;const i=this.pos;this.pos=(function(o,l,u){for(let d,g,m=0;m<l.length;m++){if(d=l.charCodeAt(m),d>55295&&d<57344){if(!g){d>56319||m+1===l.length?(o[u++]=239,o[u++]=191,o[u++]=189):g=d;continue}if(d<56320){o[u++]=239,o[u++]=191,o[u++]=189,g=d;continue}d=g-55296<<10|d-56320|65536,g=null}else g&&(o[u++]=239,o[u++]=191,o[u++]=189,g=null);d<128?o[u++]=d:(d<2048?o[u++]=d>>6|192:(d<65536?o[u++]=d>>12|224:(o[u++]=d>>18|240,o[u++]=d>>12&63|128),o[u++]=d>>6&63|128),o[u++]=63&d|128)}return u})(this.buf,e,this.pos);const s=this.pos-i;s>=128&&yp(i,s,this),this.pos=i-1,this.writeVarint(s),this.pos+=s}writeFloat(e){this.realloc(4),this.dataView.setFloat32(this.pos,e,!0),this.pos+=4}writeDouble(e){this.realloc(8),this.dataView.setFloat64(this.pos,e,!0),this.pos+=8}writeBytes(e){const i=e.length;this.writeVarint(i),this.realloc(i);for(let s=0;s<i;s++)this.buf[this.pos++]=e[s]}writeRawMessage(e,i){this.pos++;const s=this.pos;e(i,this);const o=this.pos-s;o>=128&&yp(s,o,this),this.pos=s-1,this.writeVarint(o),this.pos+=o}writeMessage(e,i,s){this.writeTag(e,2),this.writeRawMessage(i,s)}writePackedVarint(e,i){i.length&&this.writeMessage(e,pg,i)}writePackedSVarint(e,i){i.length&&this.writeMessage(e,fg,i)}writePackedBoolean(e,i){i.length&&this.writeMessage(e,_g,i)}writePackedFloat(e,i){i.length&&this.writeMessage(e,mg,i)}writePackedDouble(e,i){i.length&&this.writeMessage(e,gg,i)}writePackedFixed32(e,i){i.length&&this.writeMessage(e,yg,i)}writePackedSFixed32(e,i){i.length&&this.writeMessage(e,vg,i)}writePackedFixed64(e,i){i.length&&this.writeMessage(e,xg,i)}writePackedSFixed64(e,i){i.length&&this.writeMessage(e,bg,i)}writeBytesField(e,i){this.writeTag(e,2),this.writeBytes(i)}writeFixed32Field(e,i){this.writeTag(e,5),this.writeFixed32(i)}writeSFixed32Field(e,i){this.writeTag(e,5),this.writeSFixed32(i)}writeFixed64Field(e,i){this.writeTag(e,1),this.writeFixed64(i)}writeSFixed64Field(e,i){this.writeTag(e,1),this.writeSFixed64(i)}writeVarintField(e,i){this.writeTag(e,0),this.writeVarint(i)}writeSVarintField(e,i){this.writeTag(e,0),this.writeSVarint(i)}writeStringField(e,i){this.writeTag(e,2),this.writeString(i)}writeFloatField(e,i){this.writeTag(e,5),this.writeFloat(i)}writeDoubleField(e,i){this.writeTag(e,1),this.writeDouble(i)}writeBooleanField(e,i){this.writeVarintField(e,+i)}}function ma(r,e,i){return i?4294967296*e+(r>>>0):4294967296*(e>>>0)+(r>>>0)}function yp(r,e,i){const s=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));i.realloc(s);for(let o=i.pos-1;o>=r;o--)i.buf[o+s]=i.buf[o]}function pg(r,e){for(let i=0;i<r.length;i++)e.writeVarint(r[i])}function fg(r,e){for(let i=0;i<r.length;i++)e.writeSVarint(r[i])}function mg(r,e){for(let i=0;i<r.length;i++)e.writeFloat(r[i])}function gg(r,e){for(let i=0;i<r.length;i++)e.writeDouble(r[i])}function _g(r,e){for(let i=0;i<r.length;i++)e.writeBoolean(r[i])}function yg(r,e){for(let i=0;i<r.length;i++)e.writeFixed32(r[i])}function vg(r,e){for(let i=0;i<r.length;i++)e.writeSFixed32(r[i])}function xg(r,e){for(let i=0;i<r.length;i++)e.writeFixed64(r[i])}function bg(r,e){for(let i=0;i<r.length;i++)e.writeSFixed64(r[i])}function wg(r,e,i){r===1&&i.readMessage(Tg,e)}function Tg(r,e,i){if(r===3){const{id:s,bitmap:o,width:l,height:u,left:d,top:g,advance:m}=i.readMessage(Sg,{});e.push({id:s,bitmap:new Vl({width:l+6,height:u+6},o),metrics:{width:l,height:u,left:d,top:g,advance:m}})}}function Sg(r,e,i){r===1?e.id=i.readVarint():r===2?e.bitmap=i.readBytes():r===3?e.width=i.readVarint():r===4?e.height=i.readVarint():r===5?e.left=i.readSVarint():r===6?e.top=i.readSVarint():r===7&&(e.advance=i.readVarint())}function vp(r){let e=0,i=0;for(const u of r)e+=u.w*u.h,i=Math.max(i,u.w);r.sort(((u,d)=>d.h-u.h));const s=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),i),h:1/0}];let o=0,l=0;for(const u of r)for(let d=s.length-1;d>=0;d--){const g=s[d];if(!(u.w>g.w||u.h>g.h)){if(u.x=g.x,u.y=g.y,l=Math.max(l,u.y+u.h),o=Math.max(o,u.x+u.w),u.w===g.w&&u.h===g.h){const m=s.pop();m&&d<s.length&&(s[d]=m)}else u.h===g.h?(g.x+=u.w,g.w-=u.w):u.w===g.w?(g.y+=u.h,g.h-=u.h):(s.push({x:g.x+u.w,y:g.y,w:g.w-u.w,h:u.h}),g.y+=u.h,g.h-=u.h);break}}return{w:o,h:l,fill:e/(o*l)||0}}class Vh{constructor(e,{pixelRatio:i,version:s,stretchX:o,stretchY:l,content:u,textFitWidth:d,textFitHeight:g}){this.paddedRect=e,this.pixelRatio=i,this.stretchX=o,this.stretchY=l,this.content=u,this.version=s,this.textFitWidth=d,this.textFitHeight=g}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}}class xp{constructor(e,i){const s={},o={};this.haveRenderCallbacks=[];const l=[];this.addImages(e,s,l),this.addImages(i,o,l);const{w:u,h:d}=vp(l),g=new Di({width:u||1,height:d||1});for(const m in e){const v=e[m],_=s[m].paddedRect;Di.copy(v.data,g,{x:0,y:0},{x:_.x+1,y:_.y+1},v.data)}for(const m in i){const v=i[m],_=o[m].paddedRect,T=_.x+1,b=_.y+1,I=v.data.width,M=v.data.height;Di.copy(v.data,g,{x:0,y:0},{x:T,y:b},v.data),Di.copy(v.data,g,{x:0,y:M-1},{x:T,y:b-1},{width:I,height:1}),Di.copy(v.data,g,{x:0,y:0},{x:T,y:b+M},{width:I,height:1}),Di.copy(v.data,g,{x:I-1,y:0},{x:T-1,y:b},{width:1,height:M}),Di.copy(v.data,g,{x:0,y:0},{x:T+I,y:b},{width:1,height:M})}this.image=g,this.iconPositions=s,this.patternPositions=o}addImages(e,i,s){for(const o in e){const l=e[o],u={x:0,y:0,w:l.data.width+2,h:l.data.height+2};s.push(u),i[o]=new Vh(u,l),l.hasRenderCallback&&this.haveRenderCallbacks.push(o)}}patchUpdatedImages(e,i){e.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const s in e.updatedImages)this.patchUpdatedImage(this.iconPositions[s],e.getImage(s),i),this.patchUpdatedImage(this.patternPositions[s],e.getImage(s),i)}patchUpdatedImage(e,i,s){if(!e||!i||e.version===i.version)return;e.version=i.version;const[o,l]=e.tl;s.update(i.data,void 0,{x:o,y:l})}}var os;function wu(r,e,i,s,o,l,u,d,g,m,v,_,T,b,I){const M=fa.fromFeature(r,o);let A;_===R.ax.vertical&&M.verticalizePunctuation();let D=M.determineLineBreaks(m,l,e,s,b);const{processBidirectionalText:F,processStyledBidirectionalText:k}=pr;if(F&&M.sections.length===1){A=[],D=D.map((Y=>M.toCodeUnitIndex(Y)));const j=F(M.toString(),D);for(const Y of j){const J=[...Y].map((()=>0));A.push(new fa(Y,M.sections,J))}}else if(k){A=[],D=D.map((re=>M.toCodeUnitIndex(re)));let j=0;const Y=[];for(const re of M.text)Y.push(...Array(re.length).fill(M.sectionIndex[j])),j++;const J=k(M.text,Y,D);for(const re of J){const te=[];let ae="";for(const le of re[0])te.push(re[1][ae.length]),ae+=le;A.push(new fa(re[0],M.sections,te))}}else A=(function(j,Y){const J=[];let re=0;for(const te of Y)J.push(j.substring(re,te)),re=te;return re<j.length()&&J.push(j.substring(re,j.length())),J})(M,D);const L=[],O={positionedLines:L,text:M.toString(),top:v[1],bottom:v[1],left:v[0],right:v[0],writingMode:_,iconsInText:!1,verticalizable:!1};return(function(j,Y,J,re,te,ae,le,ne,ie,fe,xe,ye){let me=0,Ae=0,Xe=0,Ke=0;const it=ne==="right"?1:ne==="left"?0:.5,ri=Ot/ye;let bt=0;for(const ht of te){ht.trim();const Yt=ht.getMaxScale(),di={positionedGlyphs:[],lineOffset:0};j.positionedLines[bt]=di;const pi=di.positionedGlyphs;let zi=0;if(!ht.length()){Ae+=ae,++bt;continue}const ni=Pg(re,ht,ri);let ki=0;for(const Nt of ht.text){const gt=ht.getSection(ki),Dt=Nt.codePointAt(0),wt=Ig(ie,xe,Dt),Ut={glyph:Dt,imageName:null,x:me,y:Ae+-17,vertical:wt,scale:1,fontStack:"",sectionIndex:ht.getSectionIndex(ki),metrics:null,rect:null};let Mn;if("fontStack"in gt){if(Mn=Mg(gt,Dt,wt,ni,Y,J),!Mn)continue;Ut.fontStack=gt.fontStack}else{if(j.iconsInText=!0,gt.scale*=ri,Mn=Eg(gt,wt,Yt,ni,re),!Mn)continue;zi=Math.max(zi,Mn.imageOffset),Ut.imageName=gt.imageName}const{rect:vr,metrics:ic,baselineOffset:ps}=Mn;Ut.y+=ps,Ut.scale=gt.scale,Ut.metrics=ic,Ut.rect=vr,pi.push(Ut),wt?(j.verticalizable=!0,me+=("imageName"in gt?ic.advance:Ot)*gt.scale+fe):me+=ic.advance*gt.scale+fe,ki++}pi.length!==0&&(Xe=Math.max(me-fe,Xe),Cg(pi,0,pi.length-1,it)),me=0,di.lineOffset=Math.max(zi,(Yt-1)*Ot);const or=ae*Yt+zi;Ae+=or,Ke=Math.max(or,Ke),++bt}const{horizontalAlign:Rt,verticalAlign:jt}=jh(le);(function(ht,Yt,di,pi,zi,ni,ki,or,Nt){const gt=(Yt-di)*zi;let Dt=0;Dt=ni!==ki?-or*pi- -17:-pi*Nt*ki+.5*ki;for(const wt of ht)for(const Ut of wt.positionedGlyphs)Ut.x+=gt,Ut.y+=Dt})(j.positionedLines,it,Rt,jt,Xe,Ke,ae,Ae,te.length),j.top+=-jt*Ae,j.bottom=j.top+Ae,j.left+=-Rt*Xe,j.right=j.left+Xe})(O,e,i,s,A,u,d,g,_,m,T,I),!(function(j){for(const Y of j)if(Y.positionedGlyphs.length!==0)return!1;return!0})(L)&&O}function jh(r){let e=.5,i=.5;switch(r){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(r){case"bottom":case"bottom-right":case"bottom-left":i=1;break;case"top":case"top-right":case"top-left":i=0}return{horizontalAlign:e,verticalAlign:i}}function Pg(r,e,i){const s=e.getMaxScale()*Ot,{maxImageWidth:o,maxImageHeight:l}=e.getMaxImageSize(r),u=Math.max(s,l*i);return{verticalLineContentWidth:Math.max(s,o*i),horizontalLineContentHeight:u}}function bp(r){switch(r){case"top":return 0;case"center":return .5;default:return 1}}function Ig(r,e,i){return!(r===R.ax.horizontal||!e&&!xn(i)||e&&(Jc(i)||(s=i,/\p{sc=Arab}/u.test(String.fromCodePoint(s)))));var s}function Mg(r,e,i,s,o,l){const u=l[r.fontStack],d=(function(m,v,_,T){if(m?.rect)return m;const b=v[_.fontStack],I=b?.[T];return I?{rect:null,metrics:I.metrics}:null})(u?.[e],o,r,e);if(d===null)return null;let g;if(i)g=s.verticalLineContentWidth-r.scale*Ot;else{const m=bp(r.verticalAlign);g=(s.horizontalLineContentHeight-r.scale*Ot)*m}return{rect:d.rect,metrics:d.metrics,baselineOffset:g}}function Eg(r,e,i,s,o){const l=o[r.imageName];if(!l)return null;const u=l.paddedRect,d=l.displaySize,g={width:d[0],height:d[1],left:1,top:-3,advance:e?d[1]:d[0]};let m;if(e)m=s.verticalLineContentWidth-d[1]*r.scale;else{const v=bp(r.verticalAlign);m=(s.horizontalLineContentHeight-d[1]*r.scale)*v}return{rect:u,metrics:g,baselineOffset:m,imageOffset:(e?d[0]:d[1])*r.scale-Ot*i}}function Cg(r,e,i,s){if(s===0)return;const o=r[i],l=(r[i].x+o.metrics.advance*o.scale)*s;for(let u=e;u<=i;u++)r[u].x-=l}function Ag(r,e,i){const{horizontalAlign:s,verticalAlign:o}=jh(i),l=e[0]-r.displaySize[0]*s,u=e[1]-r.displaySize[1]*o;return{image:r,top:u,bottom:u+r.displaySize[1],left:l,right:l+r.displaySize[0]}}function wp(r){var e,i;let s=r.left,o=r.top,l=r.right-s,u=r.bottom-o;const d=(e=r.image.textFitWidth)!==null&&e!==void 0?e:"stretchOrShrink",g=(i=r.image.textFitHeight)!==null&&i!==void 0?i:"stretchOrShrink",m=(r.image.content[2]-r.image.content[0])/(r.image.content[3]-r.image.content[1]);if(g==="proportional"){if(d==="stretchOnly"&&l/u<m||d==="proportional"){const v=Math.ceil(u*m);s*=v/l,l=v}}else if(d==="proportional"&&g==="stretchOnly"&&m!==0&&l/u>m){const v=Math.ceil(l/m);o*=v/u,u=v}return{x1:s,y1:o,x2:s+l,y2:o+u}}function Tp(r,e,i,s,o,l){const u=r.image;let d;if(u.content){const A=u.content,D=u.pixelRatio||1;d=[A[0]/D,A[1]/D,u.displaySize[0]-A[2]/D,u.displaySize[1]-A[3]/D]}const g=e.left*l,m=e.right*l;let v,_,T,b;i==="width"||i==="both"?(b=o[0]+g-s[3],_=o[0]+m+s[1]):(b=o[0]+(g+m-u.displaySize[0])/2,_=b+u.displaySize[0]);const I=e.top*l,M=e.bottom*l;return i==="height"||i==="both"?(v=o[1]+I-s[0],T=o[1]+M+s[2]):(v=o[1]+(I+M-u.displaySize[1])/2,T=v+u.displaySize[1]),{image:u,top:v,right:_,bottom:T,left:b,collisionPadding:d}}Se("ImagePosition",Vh),Se("ImageAtlas",xp),R.ax=void 0,(os=R.ax||(R.ax={}))[os.none=0]="none",os[os.horizontal=1]="horizontal",os[os.vertical=2]="vertical",os[os.horizontalOnly=3]="horizontalOnly";const Pn=128,as=32640;function Sp(r,e){const{expression:i}=e;if(i.kind==="constant")return{kind:"constant",layoutSize:i.evaluate(new at(r+1))};if(i.kind==="source")return{kind:"source"};{const{zoomStops:s,interpolationType:o}=i;let l=0;for(;l<s.length&&s[l]<=r;)l++;l=Math.max(0,l-1);let u=l;for(;u<s.length&&s[u]<r+1;)u++;u=Math.min(s.length-1,u);const d=s[l],g=s[u];return i.kind==="composite"?{kind:"composite",minZoom:d,maxZoom:g,interpolationType:o}:{kind:"camera",minZoom:d,maxZoom:g,minSize:i.evaluate(new at(d)),maxSize:i.evaluate(new at(g)),interpolationType:o}}}function Nh(r,e,i){let s="never";const o=r.get(e);return o?s=o:r.get(i)&&(s="always"),s}const Dg=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Tu(r,e,i,s,o,l,u,d,g,m,v,_,T){const b=d?Math.min(as,Math.round(d[0])):0,I=d?Math.min(as,Math.round(d[1])):0;r.emplaceBack(e,i,Math.round(32*s),Math.round(32*o),l,u,(b<<1)+(g?1:0),I,16*m,16*v,256*_,256*T)}function Uh(r,e,i){r.emplaceBack(e.x,e.y,i),r.emplaceBack(e.x,e.y,i),r.emplaceBack(e.x,e.y,i),r.emplaceBack(e.x,e.y,i)}function zg(r){for(const e of r.sections)if(Pl(e.text))return!0;return!1}class Gh{constructor(e){this.layoutVertexArray=new q,this.indexArray=new he,this.programConfigurations=e,this.segments=new we,this.dynamicLayoutVertexArray=new Q,this.opacityVertexArray=new se,this.hasVisibleVertices=!1,this.placedSymbolArray=new y}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(e,i,s,o){this.isEmpty()||(s&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,ng.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,i),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,sg.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,Dg,!0),this.opacityVertexBuffer.itemSize=1),(s||o)&&this.programConfigurations.upload(e))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}Se("SymbolBuffers",Gh);class $h{constructor(e,i,s){this.layoutVertexArray=new e,this.layoutAttributes=i,this.indexArray=new s,this.segments=new we,this.collisionVertexArray=new de}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,og.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}Se("CollisionBuffers",$h);class ga{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((u=>u.id)),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasDependencies=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[];const i=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Sp(this.zoom,i["text-size"]),this.iconSizeData=Sp(this.zoom,i["icon-size"]);const s=this.layers[0].layout,o=s.get("symbol-sort-key"),l=s.get("symbol-z-order");this.canOverlap=Nh(s,"text-overlap","text-allow-overlap")!=="never"||Nh(s,"icon-overlap","icon-allow-overlap")!=="never"||s.get("text-ignore-placement")||s.get("icon-ignore-placement"),this.sortFeaturesByKey=l!=="viewport-y"&&!o.isConstant(),this.sortFeaturesByY=(l==="viewport-y"||l==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,s.get("symbol-placement")==="point"&&(this.writingModes=s.get("text-writing-mode").map((u=>R.ax[u]))),this.stateDependentLayerIds=this.layers.filter((u=>u.isStateDependent())).map((u=>u.id)),this.sourceID=e.sourceID}createArrays(){this.text=new Gh(new gr(this.layers,this.zoom,(e=>e.startsWith("text")))),this.icon=new Gh(new gr(this.layers,this.zoom,(e=>e.startsWith("icon")))),this.glyphOffsetArray=new S,this.lineVertexArray=new P,this.symbolInstances=new w,this.textAnchorOffsets=new C}calculateGlyphDependencies(e,i,s,o,l){for(const u of e)if(i[u.codePointAt(0)]=!0,(s||o)&&l){const d=Kl[u];d&&(i[d.codePointAt(0)]=!0)}}populate(e,i,s){var o;const l=this.layers[0],u=l.layout,d=u.get("text-font"),g=u.get("text-field"),m=u.get("icon-image"),v=(g.value.kind!=="constant"||g.value.value instanceof _i&&!g.value.value.isEmpty()||g.value.value.toString().length>0)&&(d.value.kind!=="constant"||d.value.value.length>0),_=m.value.kind!=="constant"||!!m.value.value||Object.keys(m.parameters).length>0,T=u.get("symbol-sort-key");if(this.features=[],!v&&!_)return;const b=i.iconDependencies,I=i.glyphDependencies,M=i.availableImages,A=new at(this.zoom);for(const{feature:D,id:F,index:k,sourceLayerIndex:L}of e){const O=l._featureFilter.needGeometry,j=Ur(D,O);if(!l._featureFilter.filter(A,j,s))continue;let Y,J;if(O||(j.geometry=Nr(D)),v){const te=l.getValueAndResolveTokens("text-field",j,s,M),ae=_i.factory(te);this.hasRTLText||(this.hasRTLText=zg(ae)),(!this.hasRTLText||pr.getRTLTextPluginStatus()==="unavailable"||this.hasRTLText&&pr.isParsed())&&(Y=cg(ae,l,j))}if(_){const te=l.getValueAndResolveTokens("icon-image",j,s,M);J=te instanceof Ii?te:Ii.fromString(te)}if(!Y&&!J)continue;const re=this.sortFeaturesByKey?T.evaluate(j,{},s):void 0;if(this.features.push({id:F,text:Y,icon:J,index:k,sourceLayerIndex:L,geometry:j.geometry,properties:D.properties,type:ql.types[D.type],sortKey:re}),J&&(b[J.name]=!0),Y){const te=d.evaluate(j,{},s).join(","),ae=u.get("text-rotation-alignment")!=="viewport"&&u.get("symbol-placement")!=="point";this.allowVerticalPlacement=(o=this.writingModes)===null||o===void 0?void 0:o.includes(R.ax.vertical);for(const le of Y.sections)if(le.image)b[le.image.name]=!0;else{const ne=bl(Y.toString()),ie=le.fontStack||te;I[ie]||(I[ie]={}),this.calculateGlyphDependencies(le.text,I[ie],ae,this.allowVerticalPlacement,ne)}}}u.get("symbol-placement")==="line"&&(this.features=(function(D){const F={},k={},L=[];let O=0;function j(te){L.push(D[te]),O++}function Y(te,ae,le){const ne=k[te];return delete k[te],k[ae]=ne,L[ne].geometry[0].pop(),L[ne].geometry[0]=L[ne].geometry[0].concat(le[0]),ne}function J(te,ae,le){const ne=F[ae];return delete F[ae],F[te]=ne,L[ne].geometry[0].shift(),L[ne].geometry[0]=le[0].concat(L[ne].geometry[0]),ne}function re(te,ae,le){const ne=le?ae[0][ae[0].length-1]:ae[0][0];return`${te}:${ne.x}:${ne.y}`}for(let te=0;te<D.length;te++){const ae=D[te],le=ae.geometry,ne=ae.text?ae.text.toString():null;if(!ne){j(te);continue}const ie=re(ne,le),fe=re(ne,le,!0);if(ie in k&&fe in F&&k[ie]!==F[fe]){const xe=J(ie,fe,le),ye=Y(ie,fe,L[xe].geometry);delete F[ie],delete k[fe],k[re(ne,L[ye].geometry,!0)]=ye,L[xe].geometry=null}else ie in k?Y(ie,fe,le):fe in F?J(ie,fe,le):(j(te),F[ie]=O-1,k[fe]=O-1)}return L.filter((te=>te.geometry))})(this.features)),this.sortFeaturesByKey&&this.features.sort(((D,F)=>D.sortKey-F.sortKey))}update(e,i,s){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,i,this.layers,{imagePositions:s}),this.icon.programConfigurations.updatePaintArrays(e,i,this.layers,{imagePositions:s}))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,i){const s=this.lineVertexArray.length;if(e.segment!==void 0){let o=e.dist(i[e.segment+1]),l=e.dist(i[e.segment]);const u={};for(let d=e.segment+1;d<i.length;d++)u[d]={x:i[d].x,y:i[d].y,tileUnitDistanceFromAnchor:o},d<i.length-1&&(o+=i[d+1].dist(i[d]));for(let d=e.segment||0;d>=0;d--)u[d]={x:i[d].x,y:i[d].y,tileUnitDistanceFromAnchor:l},d>0&&(l+=i[d-1].dist(i[d]));for(let d=0;d<i.length;d++){const g=u[d];this.lineVertexArray.emplaceBack(g.x,g.y,g.tileUnitDistanceFromAnchor)}}return{lineStartIndex:s,lineLength:this.lineVertexArray.length-s}}addSymbols(e,i,s,o,l,u,d,g,m,v,_,T){const b=e.indexArray,I=e.layoutVertexArray,M=e.segments.prepareSegment(4*i.length,I,b,this.canOverlap?u.sortKey:void 0),A=this.glyphOffsetArray.length,D=M.vertexLength,F=this.allowVerticalPlacement&&d===R.ax.vertical?Math.PI/2:0,k=u.text&&u.text.sections;for(let L=0;L<i.length;L++){const{tl:O,tr:j,bl:Y,br:J,tex:re,pixelOffsetTL:te,pixelOffsetBR:ae,minFontScaleX:le,minFontScaleY:ne,glyphOffset:ie,isSDF:fe,sectionIndex:xe}=i[L],ye=M.vertexLength,me=ie[1];Tu(I,g.x,g.y,O.x,me+O.y,re.x,re.y,s,fe,te.x,te.y,le,ne),Tu(I,g.x,g.y,j.x,me+j.y,re.x+re.w,re.y,s,fe,ae.x,te.y,le,ne),Tu(I,g.x,g.y,Y.x,me+Y.y,re.x,re.y+re.h,s,fe,te.x,ae.y,le,ne),Tu(I,g.x,g.y,J.x,me+J.y,re.x+re.w,re.y+re.h,s,fe,ae.x,ae.y,le,ne),Uh(e.dynamicLayoutVertexArray,g,F),b.emplaceBack(ye,ye+2,ye+1),b.emplaceBack(ye+1,ye+2,ye+3),M.vertexLength+=4,M.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(ie[0]),L!==i.length-1&&xe===i[L+1].sectionIndex||e.programConfigurations.populatePaintArrays(I.length,u,u.index,{imagePositions:{},canonical:T,formattedSection:k?.[xe]})}e.placedSymbolArray.emplaceBack(g.x,g.y,A,this.glyphOffsetArray.length-A,D,m,v,g.segment,s?s[0]:0,s?s[1]:0,o[0],o[1],d,0,!1,0,_)}_addCollisionDebugVertex(e,i,s,o,l,u){return i.emplaceBack(0,0),e.emplaceBack(s.x,s.y,o,l,Math.round(u.x),Math.round(u.y))}addCollisionDebugVertices(e,i,s,o,l,u,d){const g=l.segments.prepareSegment(4,l.layoutVertexArray,l.indexArray),m=g.vertexLength,v=l.layoutVertexArray,_=l.collisionVertexArray,T=d.anchorX,b=d.anchorY;this._addCollisionDebugVertex(v,_,u,T,b,new Te(e,i)),this._addCollisionDebugVertex(v,_,u,T,b,new Te(s,i)),this._addCollisionDebugVertex(v,_,u,T,b,new Te(s,o)),this._addCollisionDebugVertex(v,_,u,T,b,new Te(e,o)),g.vertexLength+=4;const I=l.indexArray;I.emplaceBack(m,m+1),I.emplaceBack(m+1,m+2),I.emplaceBack(m+2,m+3),I.emplaceBack(m+3,m),g.primitiveLength+=4}addDebugCollisionBoxes(e,i,s,o){for(let l=e;l<i;l++){const u=this.collisionBoxArray.get(l);this.addCollisionDebugVertices(u.x1,u.y1,u.x2,u.y2,o?this.textCollisionBox:this.iconCollisionBox,u.anchorPoint,s)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new $h(oe,hp.members,Pe),this.iconCollisionBox=new $h(oe,hp.members,Pe);for(let e=0;e<this.symbolInstances.length;e++){const i=this.symbolInstances.get(e);this.addDebugCollisionBoxes(i.textBoxStartIndex,i.textBoxEndIndex,i,!0),this.addDebugCollisionBoxes(i.verticalTextBoxStartIndex,i.verticalTextBoxEndIndex,i,!0),this.addDebugCollisionBoxes(i.iconBoxStartIndex,i.iconBoxEndIndex,i,!1),this.addDebugCollisionBoxes(i.verticalIconBoxStartIndex,i.verticalIconBoxEndIndex,i,!1)}}_deserializeCollisionBoxesForSymbol(e,i,s,o,l,u,d,g,m){const v={};for(let _=i;_<s;_++){const T=e.get(_);v.textBox={x1:T.x1,y1:T.y1,x2:T.x2,y2:T.y2,anchorPointX:T.anchorPointX,anchorPointY:T.anchorPointY},v.textFeatureIndex=T.featureIndex;break}for(let _=o;_<l;_++){const T=e.get(_);v.verticalTextBox={x1:T.x1,y1:T.y1,x2:T.x2,y2:T.y2,anchorPointX:T.anchorPointX,anchorPointY:T.anchorPointY},v.verticalTextFeatureIndex=T.featureIndex;break}for(let _=u;_<d;_++){const T=e.get(_);v.iconBox={x1:T.x1,y1:T.y1,x2:T.x2,y2:T.y2,anchorPointX:T.anchorPointX,anchorPointY:T.anchorPointY},v.iconFeatureIndex=T.featureIndex;break}for(let _=g;_<m;_++){const T=e.get(_);v.verticalIconBox={x1:T.x1,y1:T.y1,x2:T.x2,y2:T.y2,anchorPointX:T.anchorPointX,anchorPointY:T.anchorPointY},v.verticalIconFeatureIndex=T.featureIndex;break}return v}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let i=0;i<this.symbolInstances.length;i++){const s=this.symbolInstances.get(i);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,s.textBoxStartIndex,s.textBoxEndIndex,s.verticalTextBoxStartIndex,s.verticalTextBoxEndIndex,s.iconBoxStartIndex,s.iconBoxEndIndex,s.verticalIconBoxStartIndex,s.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(e,i){const s=e.placedSymbolArray.get(i),o=s.vertexStartIndex+4*s.numGlyphs;for(let l=s.vertexStartIndex;l<o;l+=4)e.indexArray.emplaceBack(l,l+2,l+1),e.indexArray.emplaceBack(l+1,l+2,l+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const i=Math.sin(e),s=Math.cos(e),o=[],l=[],u=[];for(let d=0;d<this.symbolInstances.length;++d){u.push(d);const g=this.symbolInstances.get(d);o.push(0|Math.round(i*g.anchorX+s*g.anchorY)),l.push(g.featureIndex)}return u.sort(((d,g)=>o[d]-o[g]||l[g]-l[d])),u}addToSortKeyRanges(e,i){const s=this.sortKeyRanges[this.sortKeyRanges.length-1];s?.sortKey===i?s.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:i,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const i of this.symbolInstanceIndexes){const s=this.symbolInstances.get(i);this.featureSortOrder.push(s.featureIndex);const o=[s.rightJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.leftJustifiedTextSymbolIndex];for(let l=0;l<o.length;l++){const u=o[l];u>=0&&o.indexOf(u)===l&&this.addIndicesForPlacedSymbol(this.text,u)}s.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,s.verticalPlacedTextSymbolIndex),s.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,s.placedIconSymbolIndex),s.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,s.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let Pp,Ip;Se("SymbolBucket",ga,{omit:["layers","collisionBoxArray","features","compareText"]}),ga.MAX_GLYPHS=65535,ga.addDynamicAttributes=Uh;var Zh={get paint(){return Ip=Ip||new li({"icon-opacity":new Ce(ce.paint_symbol["icon-opacity"]),"icon-color":new Ce(ce.paint_symbol["icon-color"]),"icon-halo-color":new Ce(ce.paint_symbol["icon-halo-color"]),"icon-halo-width":new Ce(ce.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Ce(ce.paint_symbol["icon-halo-blur"]),"icon-translate":new Ie(ce.paint_symbol["icon-translate"]),"icon-translate-anchor":new Ie(ce.paint_symbol["icon-translate-anchor"]),"text-opacity":new Ce(ce.paint_symbol["text-opacity"]),"text-color":new Ce(ce.paint_symbol["text-color"],{runtimeType:Pi,getOverride:r=>r.textColor,hasOverride:r=>!!r.textColor}),"text-halo-color":new Ce(ce.paint_symbol["text-halo-color"]),"text-halo-width":new Ce(ce.paint_symbol["text-halo-width"]),"text-halo-blur":new Ce(ce.paint_symbol["text-halo-blur"]),"text-translate":new Ie(ce.paint_symbol["text-translate"]),"text-translate-anchor":new Ie(ce.paint_symbol["text-translate-anchor"])})},get layout(){return Pp=Pp||new li({"symbol-placement":new Ie(ce.layout_symbol["symbol-placement"]),"symbol-spacing":new Ie(ce.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Ie(ce.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Ce(ce.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Ie(ce.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Ie(ce.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Ie(ce.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Ie(ce.layout_symbol["icon-ignore-placement"]),"icon-optional":new Ie(ce.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Ie(ce.layout_symbol["icon-rotation-alignment"]),"icon-size":new Ce(ce.layout_symbol["icon-size"]),"icon-text-fit":new Ie(ce.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Ie(ce.layout_symbol["icon-text-fit-padding"]),"icon-image":new Ce(ce.layout_symbol["icon-image"]),"icon-rotate":new Ce(ce.layout_symbol["icon-rotate"]),"icon-padding":new Ce(ce.layout_symbol["icon-padding"]),"icon-keep-upright":new Ie(ce.layout_symbol["icon-keep-upright"]),"icon-offset":new Ce(ce.layout_symbol["icon-offset"]),"icon-anchor":new Ce(ce.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Ie(ce.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Ie(ce.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Ie(ce.layout_symbol["text-rotation-alignment"]),"text-field":new Ce(ce.layout_symbol["text-field"]),"text-font":new Ce(ce.layout_symbol["text-font"]),"text-size":new Ce(ce.layout_symbol["text-size"]),"text-max-width":new Ce(ce.layout_symbol["text-max-width"]),"text-line-height":new Ie(ce.layout_symbol["text-line-height"]),"text-letter-spacing":new Ce(ce.layout_symbol["text-letter-spacing"]),"text-justify":new Ce(ce.layout_symbol["text-justify"]),"text-radial-offset":new Ce(ce.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Ie(ce.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new Ce(ce.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new Ce(ce.layout_symbol["text-anchor"]),"text-max-angle":new Ie(ce.layout_symbol["text-max-angle"]),"text-writing-mode":new Ie(ce.layout_symbol["text-writing-mode"]),"text-rotate":new Ce(ce.layout_symbol["text-rotate"]),"text-padding":new Ie(ce.layout_symbol["text-padding"]),"text-keep-upright":new Ie(ce.layout_symbol["text-keep-upright"]),"text-transform":new Ce(ce.layout_symbol["text-transform"]),"text-offset":new Ce(ce.layout_symbol["text-offset"]),"text-allow-overlap":new Ie(ce.layout_symbol["text-allow-overlap"]),"text-overlap":new Ie(ce.layout_symbol["text-overlap"]),"text-ignore-placement":new Ie(ce.layout_symbol["text-ignore-placement"]),"text-optional":new Ie(ce.layout_symbol["text-optional"])})}};class Mp{constructor(e){if(e.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=e.property.overrides?e.property.overrides.runtimeType:Cr,this.defaultValue=e}evaluate(e){if(e.formattedSection){const i=this.defaultValue.property.overrides;if(i?.hasOverride(e.formattedSection))return i.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Se("FormatSectionOverride",Mp,{omit:["defaultValue"]});class Su extends Vi{constructor(e,i){super(e,Zh,i)}recalculate(e,i){if(super.recalculate(e,i),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){const s=this.layout.get("text-writing-mode");if(s){const o=[];for(const l of s)o.includes(l)||o.push(l);this.layout._values["text-writing-mode"]=o}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,i,s,o){const l=this.layout.get(e).evaluate(i,{},s,o),u=this._unevaluatedLayout._values[e];return u.isDataDriven()||Oo(u.value)||!l?l:(function(d,g){return g.replace(/{([^{}]+)}/g,((m,v)=>d&&v in d?String(d[v]):""))})(i.properties,l)}createBucket(e){return new ga(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const e of Zh.paint.overridableProperties){if(!Su.hasPaintOverride(this.layout,e))continue;const i=this.paint.get(e),s=new Mp(i),o=new Fs(s,i.property.specification);let l=null;l=i.value.kind==="constant"||i.value.kind==="source"?new Vo("source",o):new jo("composite",o,i.value.zoomStops),this.paint._values[e]=new Ji(i.property,l,i.parameters)}}_handleOverridablePaintPropertyUpdate(e,i,s){return!(!this.layout||i.isDataDriven()||s.isDataDriven())&&Su.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,i){const s=e.get("text-field"),o=Zh.paint.properties[i];let l=!1;const u=d=>{var g;for(const m of d)if(!((g=o.overrides)===null||g===void 0)&&g.hasOverride(m))return void(l=!0)};if(s.value.kind==="constant"&&s.value.value instanceof _i)u(s.value.value.sections);else if(s.value.kind==="source"||s.value.kind==="composite"){const d=m=>{l||(m instanceof er&&Tt(m.value)===bs?u(m.value.sections):m instanceof hn?u(m.sections):m.eachChild(d))},g=s.value;g._styleExpression&&d(g._styleExpression.expression)}return l}}let Ep;var kg={get paint(){return Ep=Ep||new li({"background-color":new Ie(ce.paint_background["background-color"]),"background-pattern":new nu(ce.paint_background["background-pattern"]),"background-opacity":new Ie(ce.paint_background["background-opacity"])})}};class Rg extends Vi{constructor(e,i){super(e,kg,i)}}class Fg extends Vi{constructor(e,i){super(e,{},i),this.onAdd=s=>{this.implementation.onAdd&&this.implementation.onAdd(s,s.painter.context.gl)},this.onRemove=s=>{this.implementation.onRemove&&this.implementation.onRemove(s,s.painter.context.gl)},this.implementation=e}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class Lg{constructor(e){this._methodToThrottle=e,this._triggered=!1,this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()}}trigger(){var e;this._triggered||(this._triggered=!0,(e=this._channel)===null||e===void 0||e.port1.postMessage(!0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}const Bg={once:!0},qh=63710088e-1;class ls{constructor(e,i){if(isNaN(e)||isNaN(i))throw new Error(`Invalid LngLat object: (${e}, ${i})`);if(this.lng=+e,this.lat=+i,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new ls(Dn(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const i=Math.PI/180,s=this.lat*i,o=e.lat*i,l=Math.sin(s)*Math.sin(o)+Math.cos(s)*Math.cos(o)*Math.cos((e.lng-this.lng)*i);return qh*Math.acos(Math.min(l,1))}static convert(e){if(e instanceof ls)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new ls(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new ls(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}const Cp=2*Math.PI*qh;function Ap(r){return Cp*Math.cos(r*Math.PI/180)}function Dp(r){return(180+r)/360}function zp(r){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r*Math.PI/360)))/360}function kp(r,e){return r/Ap(e)}function Rp(r){return 360*r-180}function Pu(r){return 360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180))-90}function Fp(r,e){return r*Ap(Pu(e))}class Jl{constructor(e,i,s=0){this.x=+e,this.y=+i,this.z=+s}static fromLngLat(e,i=0){const s=ls.convert(e);return new Jl(Dp(s.lng),zp(s.lat),kp(i,s.lat))}toLngLat(){return new ls(Rp(this.x),Pu(this.y))}toAltitude(){return Fp(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/Cp*(e=Pu(this.y),1/Math.cos(e*Math.PI/180));var e}}function Lp(r,e,i){var s=2*Math.PI*6378137/256/Math.pow(2,i);return[r*s-2*Math.PI*6378137/2,e*s-2*Math.PI*6378137/2]}class Wh{constructor(e,i,s){if(!(function(o,l,u){return!(o<0||o>25||u<0||u>=Math.pow(2,o)||l<0||l>=Math.pow(2,o))})(e,i,s))throw new Error(`x=${i}, y=${s}, z=${e} outside of bounds. 0<=x<${Math.pow(2,e)}, 0<=y<${Math.pow(2,e)} 0<=z<=25 `);this.z=e,this.x=i,this.y=s,this.key=_a(0,e,e,i,s)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,i,s){const o=(u=this.y,d=this.z,g=Lp(256*(l=this.x),256*(u=Math.pow(2,d)-u-1),d),m=Lp(256*(l+1),256*(u+1),d),g[0]+","+g[1]+","+m[0]+","+m[1]);var l,u,d,g,m;const v=(function(_,T,b){let I="";for(let M=_;M>0;M--){const A=1<<M-1;I+=(T&A?1:0)+(b&A?2:0)}return I})(this.z,this.x,this.y);return e[(this.x+this.y)%e.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(s==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,i>1?"@2x":"").replace(/{quadkey}/g,v).replace(/{bbox-epsg-3857}/g,o)}isChildOf(e){const i=this.z-e.z;return i>0&&e.x===this.x>>i&&e.y===this.y>>i}getTilePoint(e){const i=Math.pow(2,this.z);return new Te((e.x*i-this.x)*De,(e.y*i-this.y)*De)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Bp{constructor(e,i){this.wrap=e,this.canonical=i,this.key=_a(e,i.z,i.z,i.x,i.y)}}class Ni{constructor(e,i,s,o,l){if(this.terrainRttPosMatrix32f=null,e<s)throw new Error(`overscaledZ should be >= z; overscaledZ = ${e}; z = ${s}`);this.overscaledZ=e,this.wrap=i,this.canonical=new Wh(s,+o,+l),this.key=_a(i,e,s,o,l)}clone(){return new Ni(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const i=this.canonical.z-e;return e>this.canonical.z?new Ni(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Ni(e,this.wrap,e,this.canonical.x>>i,this.canonical.y>>i)}isOverscaled(){return this.overscaledZ>this.canonical.z}calculateScaledKey(e,i){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const s=this.canonical.z-e;return e>this.canonical.z?_a(this.wrap*+i,e,this.canonical.z,this.canonical.x,this.canonical.y):_a(this.wrap*+i,e,e,this.canonical.x>>s,this.canonical.y>>s)}isChildOf(e){if(e.wrap!==this.wrap||this.overscaledZ-e.overscaledZ<=0)return!1;if(e.overscaledZ===0)return this.overscaledZ>0;const i=this.canonical.z-e.canonical.z;return!(i<0)&&e.canonical.x===this.canonical.x>>i&&e.canonical.y===this.canonical.y>>i}children(e){if(this.overscaledZ>=e)return[new Ni(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const i=this.canonical.z+1,s=2*this.canonical.x,o=2*this.canonical.y;return[new Ni(i,this.wrap,i,s,o),new Ni(i,this.wrap,i,s+1,o),new Ni(i,this.wrap,i,s,o+1),new Ni(i,this.wrap,i,s+1,o+1)]}isLessThan(e){return this.wrap<e.wrap||!(this.wrap>e.wrap)&&(this.overscaledZ<e.overscaledZ||!(this.overscaledZ>e.overscaledZ)&&(this.canonical.x<e.canonical.x||!(this.canonical.x>e.canonical.x)&&this.canonical.y<e.canonical.y))}wrapped(){return new Ni(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new Ni(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Bp(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new Jl(e.x-this.wrap,e.y))}normalizeCoordinates(e,i,s=8192){if(e>=0&&e<s&&i>=0&&i<s)return{tileID:this,x:e,y:i};const o=Math.floor(e/s),l=Math.floor(i/s),u=e-o*s,d=i-l*s,g=this.canonical.z,m=1<<g,v=this.canonical.y+l;if(v<0||v>=m)return null;let _=this.canonical.x+o,T=this.wrap;return _<0?(T-=Math.ceil(-_/m),_=(_%m+m)%m):_>=m&&(T+=Math.floor(_/m),_%=m),{tileID:new Ni(this.overscaledZ,T,g,_,v),x:u,y:d}}}function _a(r,e,i,s,o){(r*=2)<0&&(r=-1*r-1);const l=1<<i;return(l*l*r+l*o+s).toString(36)+i.toString(36)+e.toString(36)}Se("CanonicalTileID",Wh),Se("OverscaledTileID",Ni,{omit:["terrainRttPosMatrix32f"]});class no{constructor(){this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0}extend(e){return this.minX=Math.min(this.minX,e.x),this.minY=Math.min(this.minY,e.y),this.maxX=Math.max(this.maxX,e.x),this.maxY=Math.max(this.maxY,e.y),this}expandBy(e){return this.minX-=e,this.minY-=e,this.maxX+=e,this.maxY+=e,(this.minX>this.maxX||this.minY>this.maxY)&&(this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0),this}shrinkBy(e){return this.expandBy(-e)}map(e){const i=new no;return i.extend(e(new Te(this.minX,this.minY))),i.extend(e(new Te(this.maxX,this.minY))),i.extend(e(new Te(this.minX,this.maxY))),i.extend(e(new Te(this.maxX,this.maxY))),i}static fromPoints(e){const i=new no;for(const s of e)i.extend(s);return i}contains(e){return e.x>=this.minX&&e.x<=this.maxX&&e.y>=this.minY&&e.y<=this.maxY}empty(){return this.minX>this.maxX}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}covers(e){return!this.empty()&&!e.empty()&&e.minX>=this.minX&&e.maxX<=this.maxX&&e.minY>=this.minY&&e.maxY<=this.maxY}intersects(e){return!this.empty()&&!e.empty()&&e.minX<=this.maxX&&e.maxX>=this.minX&&e.minY<=this.maxY&&e.maxY>=this.minY}}class Op{constructor(e){this._stringToNumber={},this._numberToString=[];for(let i=0;i<e.length;i++){const s=e[i];this._stringToNumber[s]=i,this._numberToString[i]=s}}encode(e){return this._stringToNumber[e]}decode(e){if(e>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${e} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[e]}}class Vp{constructor(e,i,s,o,l){this.type="Feature",this._vectorTileFeature=e,this._x=s,this._y=o,this._z=i,this.properties=e.properties,this.id=l}projectPoint(e,i,s,o){return[360*(e.x+i)/o-180,360/Math.PI*Math.atan(Math.exp((1-2*(e.y+s)/o)*Math.PI))-90]}projectLine(e,i,s,o){return e.map((l=>this.projectPoint(l,i,s,o)))}get geometry(){if(this._geometry)return this._geometry;const e=this._vectorTileFeature,i=e.extent*Math.pow(2,this._z),s=e.extent*this._x,o=e.extent*this._y,l=e.loadGeometry();switch(e.type){case 1:{const u=[];for(const g of l)u.push(g[0]);const d=this.projectLine(u,s,o,i);this._geometry=u.length===1?{type:"Point",coordinates:d[0]}:{type:"MultiPoint",coordinates:d};break}case 2:{const u=l.map((d=>this.projectLine(d,s,o,i)));this._geometry=u.length===1?{type:"LineString",coordinates:u[0]}:{type:"MultiLineString",coordinates:u};break}case 3:{const u=Ud(l),d=[];for(const g of u)d.push(g.map((m=>this.projectLine(m,s,o,i))));this._geometry=d.length===1?{type:"Polygon",coordinates:d[0]}:{type:"MultiPolygon",coordinates:d};break}default:throw new Error(`unknown feature type: ${e.type}`)}return this._geometry}set geometry(e){this._geometry=e}toJSON(){const e={geometry:this.geometry};for(const i in this)i!=="_geometry"&&i!=="_vectorTileFeature"&&i!=="_x"&&i!=="_y"&&i!=="_z"&&(e[i]=this[i]);return e}}class ya{constructor(e,i,s){this._name=e,this.dataBuffer=i,typeof s=="number"?this._size=s:(this.nullabilityBuffer=s,this._size=s.size())}getValue(e){return this.nullabilityBuffer&&!this.nullabilityBuffer.get(e)?null:this.getValueFromBuffer(e)}has(e){return this.nullabilityBuffer?.get(e)||!this.nullabilityBuffer}get name(){return this._name}get size(){return this._size}}class Iu extends ya{}class Hh extends Iu{getValueFromBuffer(e){return this.dataBuffer[e]}}class Xh extends Iu{getValueFromBuffer(e){return this.dataBuffer[e]}}class jp extends ya{constructor(e,i,s,o){super(e,i,o),this.delta=s}}class Yh extends jp{constructor(e,i,s,o){super(e,Int32Array.of(i),s,o)}getValueFromBuffer(e){return this.dataBuffer[0]+e*this.delta}}class Kh extends ya{constructor(e,i,s,o){super(e,o?Int32Array.of(i):Uint32Array.of(i),s)}getValueFromBuffer(e){return this.dataBuffer[0]}}class Og{constructor(e,i,s,o,l=4096){this._name=e,this._geometryVector=i,this._idVector=s,this._propertyVectors=o,this._extent=l}get name(){return this._name}get idVector(){return this._idVector}get geometryVector(){return this._geometryVector}get propertyVectors(){return this._propertyVectors}getPropertyVector(e){return this.propertyVectorsMap||(this.propertyVectorsMap=new Map(this._propertyVectors.map((i=>[i.name,i])))),this.propertyVectorsMap.get(e)}get numFeatures(){return this.geometryVector.numGeometries}get extent(){return this._extent}getFeatures(){const e=[],i=this.geometryVector.getGeometries();for(let s=0;s<this.numFeatures;s++){let o;if(this.idVector){const d=this.idVector.getValue(s);o=this.containsMaxSafeIntegerValues(this.idVector)&&d!==null?Number(d):d}const l={coordinates:i[s],type:this.geometryVector.geometryType(s)},u={};for(const d of this.propertyVectors){if(!d)continue;const g=d.name,m=d.getValue(s);m!==null&&(u[g]=m)}e.push({id:o,geometry:l,properties:u})}return e}containsMaxSafeIntegerValues(e){return e instanceof Hh||e instanceof Kh||e instanceof Yh||e instanceof Xh}}class Np{constructor(e){this.value=e}get(){return this.value}set(e){this.value=e}increment(){return this.value++}add(e){this.value+=e}}var Ue,cs;(function(r){r.NONE="NONE",r.DELTA="DELTA",r.COMPONENTWISE_DELTA="COMPONENTWISE_DELTA",r.RLE="RLE",r.MORTON="MORTON",r.PDE="PDE"})(Ue||(Ue={})),(function(r){r.NONE="NONE",r.FAST_PFOR="FAST_PFOR",r.VARINT="VARINT",r.ALP="ALP"})(cs||(cs={}));const Jh=new Uint32Array(33);Jh[0]=0;for(let r=1;r<=32;r++)Jh[r]=r===32?4294967295:4294967295>>>32-r;const Qh=Jh,In=256;function ed(r,e){return r-r%e}function Vg(r){const e=r>>>0;return((255&e)<<24|(65280&e)<<8|e>>>8&65280|e>>>24&255)>>>0}const td=(function(){if(!Number.isFinite(65536))return 65536;const r=ed(Math.floor(65536),In);return r===0?In:r})(),jg=3*td/In+td|0;function Up(){const r=new Uint8Array(jg);return{dataToBePacked:new Array(33),dataPointers:new Int32Array(33),byteContainer:r,byteContainerI32:new Int32Array(r.buffer,r.byteOffset,r.byteLength>>>2),exceptionSizes:new Int32Array(33)}}function Ng(r,e,i,s,o){switch(o){case 1:(function(l,u,d,g){let m=g,v=u;for(let _=0;_<8;_++){const T=l[v++]>>>0;d[m++]=T>>>0&1,d[m++]=T>>>1&1,d[m++]=T>>>2&1,d[m++]=T>>>3&1,d[m++]=T>>>4&1,d[m++]=T>>>5&1,d[m++]=T>>>6&1,d[m++]=T>>>7&1,d[m++]=T>>>8&1,d[m++]=T>>>9&1,d[m++]=T>>>10&1,d[m++]=T>>>11&1,d[m++]=T>>>12&1,d[m++]=T>>>13&1,d[m++]=T>>>14&1,d[m++]=T>>>15&1,d[m++]=T>>>16&1,d[m++]=T>>>17&1,d[m++]=T>>>18&1,d[m++]=T>>>19&1,d[m++]=T>>>20&1,d[m++]=T>>>21&1,d[m++]=T>>>22&1,d[m++]=T>>>23&1,d[m++]=T>>>24&1,d[m++]=T>>>25&1,d[m++]=T>>>26&1,d[m++]=T>>>27&1,d[m++]=T>>>28&1,d[m++]=T>>>29&1,d[m++]=T>>>30&1,d[m++]=T>>>31&1}})(r,e,i,s);break;case 2:(function(l,u,d,g){let m=g,v=u;for(let _=0;_<8;_++){const T=l[v++]>>>0,b=l[v++]>>>0;d[m++]=T>>>0&3,d[m++]=T>>>2&3,d[m++]=T>>>4&3,d[m++]=T>>>6&3,d[m++]=T>>>8&3,d[m++]=T>>>10&3,d[m++]=T>>>12&3,d[m++]=T>>>14&3,d[m++]=T>>>16&3,d[m++]=T>>>18&3,d[m++]=T>>>20&3,d[m++]=T>>>22&3,d[m++]=T>>>24&3,d[m++]=T>>>26&3,d[m++]=T>>>28&3,d[m++]=T>>>30&3,d[m++]=b>>>0&3,d[m++]=b>>>2&3,d[m++]=b>>>4&3,d[m++]=b>>>6&3,d[m++]=b>>>8&3,d[m++]=b>>>10&3,d[m++]=b>>>12&3,d[m++]=b>>>14&3,d[m++]=b>>>16&3,d[m++]=b>>>18&3,d[m++]=b>>>20&3,d[m++]=b>>>22&3,d[m++]=b>>>24&3,d[m++]=b>>>26&3,d[m++]=b>>>28&3,d[m++]=b>>>30&3}})(r,e,i,s);break;case 3:(function(l,u,d,g){let m=g,v=u;for(let _=0;_<8;_++){const T=l[v++]>>>0,b=l[v++]>>>0,I=l[v++]>>>0;d[m++]=T>>>0&7,d[m++]=T>>>3&7,d[m++]=T>>>6&7,d[m++]=T>>>9&7,d[m++]=T>>>12&7,d[m++]=T>>>15&7,d[m++]=T>>>18&7,d[m++]=T>>>21&7,d[m++]=T>>>24&7,d[m++]=T>>>27&7,d[m++]=7&(T>>>30|(1&b)<<2),d[m++]=b>>>1&7,d[m++]=b>>>4&7,d[m++]=b>>>7&7,d[m++]=b>>>10&7,d[m++]=b>>>13&7,d[m++]=b>>>16&7,d[m++]=b>>>19&7,d[m++]=b>>>22&7,d[m++]=b>>>25&7,d[m++]=b>>>28&7,d[m++]=7&(b>>>31|(3&I)<<1),d[m++]=I>>>2&7,d[m++]=I>>>5&7,d[m++]=I>>>8&7,d[m++]=I>>>11&7,d[m++]=I>>>14&7,d[m++]=I>>>17&7,d[m++]=I>>>20&7,d[m++]=I>>>23&7,d[m++]=I>>>26&7,d[m++]=I>>>29&7}})(r,e,i,s);break;case 4:(function(l,u,d,g){let m=g,v=u;for(let _=0;_<8;_++){const T=l[v++]>>>0,b=l[v++]>>>0,I=l[v++]>>>0,M=l[v++]>>>0;d[m++]=T>>>0&15,d[m++]=T>>>4&15,d[m++]=T>>>8&15,d[m++]=T>>>12&15,d[m++]=T>>>16&15,d[m++]=T>>>20&15,d[m++]=T>>>24&15,d[m++]=T>>>28&15,d[m++]=b>>>0&15,d[m++]=b>>>4&15,d[m++]=b>>>8&15,d[m++]=b>>>12&15,d[m++]=b>>>16&15,d[m++]=b>>>20&15,d[m++]=b>>>24&15,d[m++]=b>>>28&15,d[m++]=I>>>0&15,d[m++]=I>>>4&15,d[m++]=I>>>8&15,d[m++]=I>>>12&15,d[m++]=I>>>16&15,d[m++]=I>>>20&15,d[m++]=I>>>24&15,d[m++]=I>>>28&15,d[m++]=M>>>0&15,d[m++]=M>>>4&15,d[m++]=M>>>8&15,d[m++]=M>>>12&15,d[m++]=M>>>16&15,d[m++]=M>>>20&15,d[m++]=M>>>24&15,d[m++]=M>>>28&15}})(r,e,i,s);break;case 5:(function(l,u,d,g){let m=g,v=u;for(let _=0;_<8;_++){const T=l[v++]>>>0,b=l[v++]>>>0,I=l[v++]>>>0,M=l[v++]>>>0,A=l[v++]>>>0;d[m++]=T>>>0&31,d[m++]=T>>>5&31,d[m++]=T>>>10&31,d[m++]=T>>>15&31,d[m++]=T>>>20&31,d[m++]=T>>>25&31,d[m++]=31&(T>>>30|(7&b)<<2),d[m++]=b>>>3&31,d[m++]=b>>>8&31,d[m++]=b>>>13&31,d[m++]=b>>>18&31,d[m++]=b>>>23&31,d[m++]=31&(b>>>28|(1&I)<<4),d[m++]=I>>>1&31,d[m++]=I>>>6&31,d[m++]=I>>>11&31,d[m++]=I>>>16&31,d[m++]=I>>>21&31,d[m++]=I>>>26&31,d[m++]=31&(I>>>31|(15&M)<<1),d[m++]=M>>>4&31,d[m++]=M>>>9&31,d[m++]=M>>>14&31,d[m++]=M>>>19&31,d[m++]=M>>>24&31,d[m++]=31&(M>>>29|(3&A)<<3),d[m++]=A>>>2&31,d[m++]=A>>>7&31,d[m++]=A>>>12&31,d[m++]=A>>>17&31,d[m++]=A>>>22&31,d[m++]=A>>>27&31}})(r,e,i,s);break;case 6:(function(l,u,d,g){let m=g,v=u;for(let _=0;_<8;_++){const T=l[v++]>>>0,b=l[v++]>>>0,I=l[v++]>>>0,M=l[v++]>>>0,A=l[v++]>>>0,D=l[v++]>>>0;d[m++]=T>>>0&63,d[m++]=T>>>6&63,d[m++]=T>>>12&63,d[m++]=T>>>18&63,d[m++]=T>>>24&63,d[m++]=63&(T>>>30|(15&b)<<2),d[m++]=b>>>4&63,d[m++]=b>>>10&63,d[m++]=b>>>16&63,d[m++]=b>>>22&63,d[m++]=63&(b>>>28|(3&I)<<4),d[m++]=I>>>2&63,d[m++]=I>>>8&63,d[m++]=I>>>14&63,d[m++]=I>>>20&63,d[m++]=I>>>26&63,d[m++]=M>>>0&63,d[m++]=M>>>6&63,d[m++]=M>>>12&63,d[m++]=M>>>18&63,d[m++]=M>>>24&63,d[m++]=63&(M>>>30|(15&A)<<2),d[m++]=A>>>4&63,d[m++]=A>>>10&63,d[m++]=A>>>16&63,d[m++]=A>>>22&63,d[m++]=63&(A>>>28|(3&D)<<4),d[m++]=D>>>2&63,d[m++]=D>>>8&63,d[m++]=D>>>14&63,d[m++]=D>>>20&63,d[m++]=D>>>26&63}})(r,e,i,s);break;case 7:(function(l,u,d,g){let m=g,v=u;for(let _=0;_<8;_++){const T=l[v++]>>>0,b=l[v++]>>>0,I=l[v++]>>>0,M=l[v++]>>>0,A=l[v++]>>>0,D=l[v++]>>>0,F=l[v++]>>>0;d[m++]=T>>>0&127,d[m++]=T>>>7&127,d[m++]=T>>>14&127,d[m++]=T>>>21&127,d[m++]=127&(T>>>28|(7&b)<<4),d[m++]=b>>>3&127,d[m++]=b>>>10&127,d[m++]=b>>>17&127,d[m++]=b>>>24&127,d[m++]=127&(b>>>31|(63&I)<<1),d[m++]=I>>>6&127,d[m++]=I>>>13&127,d[m++]=I>>>20&127,d[m++]=127&(I>>>27|(3&M)<<5),d[m++]=M>>>2&127,d[m++]=M>>>9&127,d[m++]=M>>>16&127,d[m++]=M>>>23&127,d[m++]=127&(M>>>30|(31&A)<<2),d[m++]=A>>>5&127,d[m++]=A>>>12&127,d[m++]=A>>>19&127,d[m++]=127&(A>>>26|(1&D)<<6),d[m++]=D>>>1&127,d[m++]=D>>>8&127,d[m++]=D>>>15&127,d[m++]=D>>>22&127,d[m++]=127&(D>>>29|(15&F)<<3),d[m++]=F>>>4&127,d[m++]=F>>>11&127,d[m++]=F>>>18&127,d[m++]=F>>>25&127}})(r,e,i,s);break;case 8:(function(l,u,d,g){let m=g,v=u;for(let _=0;_<8;_++){const T=l[v++]>>>0,b=l[v++]>>>0,I=l[v++]>>>0,M=l[v++]>>>0,A=l[v++]>>>0,D=l[v++]>>>0,F=l[v++]>>>0,k=l[v++]>>>0;d[m++]=T>>>0&255,d[m++]=T>>>8&255,d[m++]=T>>>16&255,d[m++]=T>>>24&255,d[m++]=b>>>0&255,d[m++]=b>>>8&255,d[m++]=b>>>16&255,d[m++]=b>>>24&255,d[m++]=I>>>0&255,d[m++]=I>>>8&255,d[m++]=I>>>16&255,d[m++]=I>>>24&255,d[m++]=M>>>0&255,d[m++]=M>>>8&255,d[m++]=M>>>16&255,d[m++]=M>>>24&255,d[m++]=A>>>0&255,d[m++]=A>>>8&255,d[m++]=A>>>16&255,d[m++]=A>>>24&255,d[m++]=D>>>0&255,d[m++]=D>>>8&255,d[m++]=D>>>16&255,d[m++]=D>>>24&255,d[m++]=F>>>0&255,d[m++]=F>>>8&255,d[m++]=F>>>16&255,d[m++]=F>>>24&255,d[m++]=k>>>0&255,d[m++]=k>>>8&255,d[m++]=k>>>16&255,d[m++]=k>>>24&255}})(r,e,i,s);break;case 16:(function(l,u,d,g){let m=g,v=u;for(let _=0;_<128;_++){const T=l[v++]>>>0;d[m++]=65535&T,d[m++]=T>>>16&65535}})(r,e,i,s);break;default:(function(l,u,d,g,m){const v=Qh[m]>>>0;let _=u,T=0,b=l[_]>>>0,I=g;for(let M=0;M<8;M++){for(let A=0;A<32;A++)if(T+m<=32)d[I+A]=b>>>T&v,T+=m,T===32&&(T=0,_++,A!==31&&(b=l[_]>>>0));else{const D=32-T,F=b>>>T;_++,b=l[_]>>>0;const k=m-D;d[I+A]=(F|(b&-1>>>32-k>>>0)<<D)&v,T=k}I+=32,T=0,M<7&&(b=l[_]>>>0)}})(r,e,i,s,o)}return e+(o<<3)|0}function Ug(r,e,i,s){if(i+2>e)throw new Error(`FastPFOR decode: byteContainer underflow at block=${s} (need 2 bytes for [bitWidth, exceptionCount], bytePos=${i}, byteSize=${e})`);const o=r[i++],l=r[i++];if(o>32)throw new Error(`FastPFOR decode: invalid bitWidth=${o} at block=${s} (expected 0..32). This likely indicates corrupted or truncated input.`);return{bitWidth:o,exceptionCount:l,bytePosIn:i}}function Gg(r,e,i,s,o,l,u,d,g){const{maxBits:m,exceptionBitWidth:v,bytePosIn:_}=(function(A,D,F,k,L,O){if(F+1>D)throw new Error(`FastPFOR decode: exception header underflow at block=${O} (need 1 byte for maxBits, bytePos=${F}, byteSize=${D})`);const j=A[F++];if(j<k||j>32)throw new Error(`FastPFOR decode: invalid maxBits=${j} at block=${O} (bitWidth=${k}, expected ${k}..32)`);const Y=j-k|0;if(Y<1||Y>32)throw new Error(`FastPFOR decode: invalid exceptionBitWidth=${Y} at block=${O} (bitWidth=${k}, maxBits=${j})`);if(F+L>D)throw new Error(`FastPFOR decode: exception positions underflow at block=${O} (need=${L}, have=${D-F})`);return{maxBits:j,exceptionBitWidth:Y,bytePosIn:F}})(o,l,u,i,s,g);if(u=_,v===1){const A=1<<i;for(let D=0;D<s;D=D+1|0)r[o[u++]+e|0]|=A;return u}const T=d.dataToBePacked[v];if(!T)throw new Error(`FastPFOR decode: missing exception stream for exceptionBitWidth=${v} (bitWidth=${i}, maxBits=${m}) at block ${g}`);const b=d.dataPointers;let I=0|b[v];const M=0|d.exceptionSizes[v];if(I+s>M)throw new Error(`FastPFOR decode: exception stream overflow for exceptionBitWidth=${v} (ptr=${I}, need ${s}, size=${M}) at block ${g}`);for(let A=0;A<s;A=A+1|0){const D=o[u++],F=0|T[I++];r[D+e|0]|=F<<i}return b[v]=I,u}function $g(r,e,i,s,o,l){const u=0|i,d=0|r[u];if(d<=0||u+d>r.length-1)throw new Error(`FastPFOR decode: invalid whereMeta=${d} at pageStart=${u} (expected > 0 and pageStart+whereMeta < encoded.length=${r.length})`);const g=u+1|0,m=u+d|0,v=r[m]>>>0,_=v+3>>>2,T=m+1,b=T+_;if(b>=r.length)throw new Error(`FastPFOR decode: invalid byteSize=${v} (metaInts=${_}, pageStart=${u}, packedEnd=${m}, byteContainerStart=${T}) causes bitmapPos=${b} out of bounds (encoded.length=${r.length})`);const I=(function(D,F,k,L){L.byteContainer.length<k&&(L.byteContainer=new Uint8Array(2*k),L.byteContainerI32=void 0);const O=L.byteContainer,j=k>>>2;if(3&O.byteOffset)for(let J=0;J<j;J=J+1|0){const re=0|D[F+J|0],te=J<<2;O[te]=255&re,O[te+1|0]=re>>>8&255,O[te+2|0]=re>>>16&255,O[te+3|0]=re>>>24&255}else{let J=L.byteContainerI32;(!J||J.buffer!==O.buffer||J.byteOffset!==O.byteOffset||J.length<j)&&(J=L.byteContainerI32=new Int32Array(O.buffer,O.byteOffset,O.byteLength>>>2)),J.set(D.subarray(F,F+j))}const Y=3&k;if(Y>0){const J=0|D[F+j|0],re=j<<2;for(let te=0;te<Y;te=te+1|0)O[re+te|0]=J>>>(te<<3)&255}return O})(r,T,v,l),M=v,A=(function(D,F,k){const L=0|D[F++],O=k.dataToBePacked;for(let j=2;j<=32;j=j+1|0){if(!(L>>>j-1&1))continue;if(F>=D.length)throw new Error(`FastPFOR decode: truncated exception stream header (bitWidth=${j}, streamWordIndex=${F}, needWords=1, availableWords=${D.length-F}, encodedWords=${D.length})`);const Y=D[F++]>>>0,J=ed(Y+31,32),re=Y*j+31>>>5;if(F+re>D.length)throw new Error(`FastPFOR decode: truncated exception stream (bitWidth=${j}, size=${Y}, streamWordIndex=${F}, needWords=${re}, availableWords=${D.length-F}, encodedWords=${D.length})`);let te=O[j];(!te||te.length<J)&&(te=O[j]=new Uint32Array(J));let ae=0;for(;ae<Y;ae=ae+32|0)Zg(D,F,te,ae,j),F=F+j|0;F=F-((ae-Y|0)*j>>>5)|0,k.exceptionSizes[j]=Y}return F})(r,b,l);return l.dataPointers.fill(0),(function(D,F,k,L,O,j,Y,J,re,te){let ae=0|k,le=0;for(let ne=0;ne<Y;ne=ne+1|0){const ie=Ug(J,re,le,ne);le=ie.bytePosIn;const fe=ie.bitWidth,xe=ie.exceptionCount,ye=j+ne*In|0;switch(fe){case 0:O.fill(0,ye,ye+In);break;case 32:for(let me=0;me<In;me=me+1|0)O[ye+me|0]=0|D[ae+me|0];ae=ae+In|0;break;default:ae=Ng(D,ae,O,ye,fe)}xe>0&&(le=Gg(O,ye,fe,xe,J,re,le,te,ne))}if(ae!==L)throw new Error(`FastPFOR decode: packed region mismatch (pageStart=${F}, packedStart=${k}, consumedPackedEnd=${ae}, expectedPackedEnd=${L}, packedWords=${L-k}, encoded.length=${D.length})`)})(r,u,g,m,e,0|s,o/In|0,I,M,l),A}function Zg(r,e,i,s,o){switch(o){case 2:return void(function(m,v,_,T){let b=T;const I=m[v]>>>0,M=m[v+1]>>>0;_[b++]=I>>>0&3,_[b++]=I>>>2&3,_[b++]=I>>>4&3,_[b++]=I>>>6&3,_[b++]=I>>>8&3,_[b++]=I>>>10&3,_[b++]=I>>>12&3,_[b++]=I>>>14&3,_[b++]=I>>>16&3,_[b++]=I>>>18&3,_[b++]=I>>>20&3,_[b++]=I>>>22&3,_[b++]=I>>>24&3,_[b++]=I>>>26&3,_[b++]=I>>>28&3,_[b++]=I>>>30&3,_[b++]=M>>>0&3,_[b++]=M>>>2&3,_[b++]=M>>>4&3,_[b++]=M>>>6&3,_[b++]=M>>>8&3,_[b++]=M>>>10&3,_[b++]=M>>>12&3,_[b++]=M>>>14&3,_[b++]=M>>>16&3,_[b++]=M>>>18&3,_[b++]=M>>>20&3,_[b++]=M>>>22&3,_[b++]=M>>>24&3,_[b++]=M>>>26&3,_[b++]=M>>>28&3,_[b]=M>>>30&3})(r,e,i,s);case 3:return void(function(m,v,_,T){let b=T;const I=m[v]>>>0,M=m[v+1]>>>0,A=m[v+2]>>>0;_[b++]=I>>>0&7,_[b++]=I>>>3&7,_[b++]=I>>>6&7,_[b++]=I>>>9&7,_[b++]=I>>>12&7,_[b++]=I>>>15&7,_[b++]=I>>>18&7,_[b++]=I>>>21&7,_[b++]=I>>>24&7,_[b++]=I>>>27&7,_[b++]=7&(I>>>30|(1&M)<<2),_[b++]=M>>>1&7,_[b++]=M>>>4&7,_[b++]=M>>>7&7,_[b++]=M>>>10&7,_[b++]=M>>>13&7,_[b++]=M>>>16&7,_[b++]=M>>>19&7,_[b++]=M>>>22&7,_[b++]=M>>>25&7,_[b++]=M>>>28&7,_[b++]=7&(M>>>31|(3&A)<<1),_[b++]=A>>>2&7,_[b++]=A>>>5&7,_[b++]=A>>>8&7,_[b++]=A>>>11&7,_[b++]=A>>>14&7,_[b++]=A>>>17&7,_[b++]=A>>>20&7,_[b++]=A>>>23&7,_[b++]=A>>>26&7,_[b]=A>>>29&7})(r,e,i,s);case 4:return void(function(m,v,_,T){let b=T;const I=m[v]>>>0,M=m[v+1]>>>0,A=m[v+2]>>>0,D=m[v+3]>>>0;_[b++]=I>>>0&15,_[b++]=I>>>4&15,_[b++]=I>>>8&15,_[b++]=I>>>12&15,_[b++]=I>>>16&15,_[b++]=I>>>20&15,_[b++]=I>>>24&15,_[b++]=I>>>28&15,_[b++]=M>>>0&15,_[b++]=M>>>4&15,_[b++]=M>>>8&15,_[b++]=M>>>12&15,_[b++]=M>>>16&15,_[b++]=M>>>20&15,_[b++]=M>>>24&15,_[b++]=M>>>28&15,_[b++]=A>>>0&15,_[b++]=A>>>4&15,_[b++]=A>>>8&15,_[b++]=A>>>12&15,_[b++]=A>>>16&15,_[b++]=A>>>20&15,_[b++]=A>>>24&15,_[b++]=A>>>28&15,_[b++]=D>>>0&15,_[b++]=D>>>4&15,_[b++]=D>>>8&15,_[b++]=D>>>12&15,_[b++]=D>>>16&15,_[b++]=D>>>20&15,_[b++]=D>>>24&15,_[b]=D>>>28&15})(r,e,i,s);case 5:return void(function(m,v,_,T){let b=T;const I=m[v]>>>0,M=m[v+1]>>>0,A=m[v+2]>>>0,D=m[v+3]>>>0,F=m[v+4]>>>0;_[b++]=I>>>0&31,_[b++]=I>>>5&31,_[b++]=I>>>10&31,_[b++]=I>>>15&31,_[b++]=I>>>20&31,_[b++]=I>>>25&31,_[b++]=31&(I>>>30|(7&M)<<2),_[b++]=M>>>3&31,_[b++]=M>>>8&31,_[b++]=M>>>13&31,_[b++]=M>>>18&31,_[b++]=M>>>23&31,_[b++]=31&(M>>>28|(1&A)<<4),_[b++]=A>>>1&31,_[b++]=A>>>6&31,_[b++]=A>>>11&31,_[b++]=A>>>16&31,_[b++]=A>>>21&31,_[b++]=A>>>26&31,_[b++]=31&(A>>>31|(15&D)<<1),_[b++]=D>>>4&31,_[b++]=D>>>9&31,_[b++]=D>>>14&31,_[b++]=D>>>19&31,_[b++]=D>>>24&31,_[b++]=31&(D>>>29|(3&F)<<3),_[b++]=F>>>2&31,_[b++]=F>>>7&31,_[b++]=F>>>12&31,_[b++]=F>>>17&31,_[b++]=F>>>22&31,_[b]=F>>>27&31})(r,e,i,s);case 6:return void(function(m,v,_,T){let b=T;const I=m[v]>>>0,M=m[v+1]>>>0,A=m[v+2]>>>0,D=m[v+3]>>>0,F=m[v+4]>>>0,k=m[v+5]>>>0;_[b++]=I>>>0&63,_[b++]=I>>>6&63,_[b++]=I>>>12&63,_[b++]=I>>>18&63,_[b++]=I>>>24&63,_[b++]=63&(I>>>30|(15&M)<<2),_[b++]=M>>>4&63,_[b++]=M>>>10&63,_[b++]=M>>>16&63,_[b++]=M>>>22&63,_[b++]=63&(M>>>28|(3&A)<<4),_[b++]=A>>>2&63,_[b++]=A>>>8&63,_[b++]=A>>>14&63,_[b++]=A>>>20&63,_[b++]=A>>>26&63,_[b++]=D>>>0&63,_[b++]=D>>>6&63,_[b++]=D>>>12&63,_[b++]=D>>>18&63,_[b++]=D>>>24&63,_[b++]=63&(D>>>30|(15&F)<<2),_[b++]=F>>>4&63,_[b++]=F>>>10&63,_[b++]=F>>>16&63,_[b++]=F>>>22&63,_[b++]=63&(F>>>28|(3&k)<<4),_[b++]=k>>>2&63,_[b++]=k>>>8&63,_[b++]=k>>>14&63,_[b++]=k>>>20&63,_[b]=k>>>26&63})(r,e,i,s);case 7:return void(function(m,v,_,T){let b=T;const I=m[v]>>>0,M=m[v+1]>>>0,A=m[v+2]>>>0,D=m[v+3]>>>0,F=m[v+4]>>>0,k=m[v+5]>>>0,L=m[v+6]>>>0;_[b++]=I>>>0&127,_[b++]=I>>>7&127,_[b++]=I>>>14&127,_[b++]=I>>>21&127,_[b++]=127&(I>>>28|(7&M)<<4),_[b++]=M>>>3&127,_[b++]=M>>>10&127,_[b++]=M>>>17&127,_[b++]=M>>>24&127,_[b++]=127&(M>>>31|(63&A)<<1),_[b++]=A>>>6&127,_[b++]=A>>>13&127,_[b++]=A>>>20&127,_[b++]=127&(A>>>27|(3&D)<<5),_[b++]=D>>>2&127,_[b++]=D>>>9&127,_[b++]=D>>>16&127,_[b++]=D>>>23&127,_[b++]=127&(D>>>30|(31&F)<<2),_[b++]=F>>>5&127,_[b++]=F>>>12&127,_[b++]=F>>>19&127,_[b++]=127&(F>>>26|(1&k)<<6),_[b++]=k>>>1&127,_[b++]=k>>>8&127,_[b++]=k>>>15&127,_[b++]=k>>>22&127,_[b++]=127&(k>>>29|(15&L)<<3),_[b++]=L>>>4&127,_[b++]=L>>>11&127,_[b++]=L>>>18&127,_[b]=L>>>25&127})(r,e,i,s);case 8:return void(function(m,v,_,T){let b=T;const I=m[v]>>>0,M=m[v+1]>>>0,A=m[v+2]>>>0,D=m[v+3]>>>0,F=m[v+4]>>>0,k=m[v+5]>>>0,L=m[v+6]>>>0,O=m[v+7]>>>0;_[b++]=I>>>0&255,_[b++]=I>>>8&255,_[b++]=I>>>16&255,_[b++]=I>>>24&255,_[b++]=M>>>0&255,_[b++]=M>>>8&255,_[b++]=M>>>16&255,_[b++]=M>>>24&255,_[b++]=A>>>0&255,_[b++]=A>>>8&255,_[b++]=A>>>16&255,_[b++]=A>>>24&255,_[b++]=D>>>0&255,_[b++]=D>>>8&255,_[b++]=D>>>16&255,_[b++]=D>>>24&255,_[b++]=F>>>0&255,_[b++]=F>>>8&255,_[b++]=F>>>16&255,_[b++]=F>>>24&255,_[b++]=k>>>0&255,_[b++]=k>>>8&255,_[b++]=k>>>16&255,_[b++]=k>>>24&255,_[b++]=L>>>0&255,_[b++]=L>>>8&255,_[b++]=L>>>16&255,_[b++]=L>>>24&255,_[b++]=O>>>0&255,_[b++]=O>>>8&255,_[b++]=O>>>16&255,_[b]=O>>>24&255})(r,e,i,s);case 9:return void(function(m,v,_,T){let b=T;const I=m[v]>>>0,M=m[v+1]>>>0,A=m[v+2]>>>0,D=m[v+3]>>>0,F=m[v+4]>>>0,k=m[v+5]>>>0,L=m[v+6]>>>0,O=m[v+7]>>>0,j=m[v+8]>>>0;_[b++]=I>>>0&511,_[b++]=I>>>9&511,_[b++]=I>>>18&511,_[b++]=511&(I>>>27|(15&M)<<5),_[b++]=M>>>4&511,_[b++]=M>>>13&511,_[b++]=M>>>22&511,_[b++]=511&(M>>>31|(255&A)<<1),_[b++]=A>>>8&511,_[b++]=A>>>17&511,_[b++]=511&(A>>>26|(7&D)<<6),_[b++]=D>>>3&511,_[b++]=D>>>12&511,_[b++]=D>>>21&511,_[b++]=511&(D>>>30|(127&F)<<2),_[b++]=F>>>7&511,_[b++]=F>>>16&511,_[b++]=511&(F>>>25|(3&k)<<7),_[b++]=k>>>2&511,_[b++]=k>>>11&511,_[b++]=k>>>20&511,_[b++]=511&(k>>>29|(63&L)<<3),_[b++]=L>>>6&511,_[b++]=L>>>15&511,_[b++]=511&(L>>>24|(1&O)<<8),_[b++]=O>>>1&511,_[b++]=O>>>10&511,_[b++]=O>>>19&511,_[b++]=511&(O>>>28|(31&j)<<4),_[b++]=j>>>5&511,_[b++]=j>>>14&511,_[b]=j>>>23&511})(r,e,i,s);case 10:return void(function(m,v,_,T){let b=T;const I=m[v]>>>0,M=m[v+1]>>>0,A=m[v+2]>>>0,D=m[v+3]>>>0,F=m[v+4]>>>0,k=m[v+5]>>>0,L=m[v+6]>>>0,O=m[v+7]>>>0,j=m[v+8]>>>0,Y=m[v+9]>>>0;_[b++]=I>>>0&1023,_[b++]=I>>>10&1023,_[b++]=I>>>20&1023,_[b++]=1023&(I>>>30|(255&M)<<2),_[b++]=M>>>8&1023,_[b++]=M>>>18&1023,_[b++]=1023&(M>>>28|(63&A)<<4),_[b++]=A>>>6&1023,_[b++]=A>>>16&1023,_[b++]=1023&(A>>>26|(15&D)<<6),_[b++]=D>>>4&1023,_[b++]=D>>>14&1023,_[b++]=1023&(D>>>24|(3&F)<<8),_[b++]=F>>>2&1023,_[b++]=F>>>12&1023,_[b++]=F>>>22&1023,_[b++]=k>>>0&1023,_[b++]=k>>>10&1023,_[b++]=k>>>20&1023,_[b++]=1023&(k>>>30|(255&L)<<2),_[b++]=L>>>8&1023,_[b++]=L>>>18&1023,_[b++]=1023&(L>>>28|(63&O)<<4),_[b++]=O>>>6&1023,_[b++]=O>>>16&1023,_[b++]=1023&(O>>>26|(15&j)<<6),_[b++]=j>>>4&1023,_[b++]=j>>>14&1023,_[b++]=1023&(j>>>24|(3&Y)<<8),_[b++]=Y>>>2&1023,_[b++]=Y>>>12&1023,_[b]=Y>>>22&1023})(r,e,i,s);case 11:return void(function(m,v,_,T){let b=T;const I=m[v]>>>0,M=m[v+1]>>>0,A=m[v+2]>>>0,D=m[v+3]>>>0,F=m[v+4]>>>0,k=m[v+5]>>>0,L=m[v+6]>>>0,O=m[v+7]>>>0,j=m[v+8]>>>0,Y=m[v+9]>>>0,J=m[v+10]>>>0;_[b++]=I>>>0&2047,_[b++]=I>>>11&2047,_[b++]=2047&(I>>>22|(1&M)<<10),_[b++]=M>>>1&2047,_[b++]=M>>>12&2047,_[b++]=2047&(M>>>23|(3&A)<<9),_[b++]=A>>>2&2047,_[b++]=A>>>13&2047,_[b++]=2047&(A>>>24|(7&D)<<8),_[b++]=D>>>3&2047,_[b++]=D>>>14&2047,_[b++]=2047&(D>>>25|(15&F)<<7),_[b++]=F>>>4&2047,_[b++]=F>>>15&2047,_[b++]=2047&(F>>>26|(31&k)<<6),_[b++]=k>>>5&2047,_[b++]=k>>>16&2047,_[b++]=2047&(k>>>27|(63&L)<<5),_[b++]=L>>>6&2047,_[b++]=L>>>17&2047,_[b++]=2047&(L>>>28|(127&O)<<4),_[b++]=O>>>7&2047,_[b++]=O>>>18&2047,_[b++]=2047&(O>>>29|(255&j)<<3),_[b++]=j>>>8&2047,_[b++]=j>>>19&2047,_[b++]=2047&(j>>>30|(511&Y)<<2),_[b++]=Y>>>9&2047,_[b++]=Y>>>20&2047,_[b++]=2047&(Y>>>31|(1023&J)<<1),_[b++]=J>>>10&2047,_[b]=J>>>21&2047})(r,e,i,s);case 12:return void(function(m,v,_,T){let b=T;const I=m[v]>>>0,M=m[v+1]>>>0,A=m[v+2]>>>0,D=m[v+3]>>>0,F=m[v+4]>>>0,k=m[v+5]>>>0,L=m[v+6]>>>0,O=m[v+7]>>>0,j=m[v+8]>>>0,Y=m[v+9]>>>0,J=m[v+10]>>>0,re=m[v+11]>>>0;_[b++]=I>>>0&4095,_[b++]=I>>>12&4095,_[b++]=4095&(I>>>24|(15&M)<<8),_[b++]=M>>>4&4095,_[b++]=M>>>16&4095,_[b++]=4095&(M>>>28|(255&A)<<4),_[b++]=A>>>8&4095,_[b++]=A>>>20&4095,_[b++]=D>>>0&4095,_[b++]=D>>>12&4095,_[b++]=4095&(D>>>24|(15&F)<<8),_[b++]=F>>>4&4095,_[b++]=F>>>16&4095,_[b++]=4095&(F>>>28|(255&k)<<4),_[b++]=k>>>8&4095,_[b++]=k>>>20&4095,_[b++]=L>>>0&4095,_[b++]=L>>>12&4095,_[b++]=4095&(L>>>24|(15&O)<<8),_[b++]=O>>>4&4095,_[b++]=O>>>16&4095,_[b++]=4095&(O>>>28|(255&j)<<4),_[b++]=j>>>8&4095,_[b++]=j>>>20&4095,_[b++]=Y>>>0&4095,_[b++]=Y>>>12&4095,_[b++]=4095&(Y>>>24|(15&J)<<8),_[b++]=J>>>4&4095,_[b++]=J>>>16&4095,_[b++]=4095&(J>>>28|(255&re)<<4),_[b++]=re>>>8&4095,_[b]=re>>>20&4095})(r,e,i,s);case 16:return void(function(m,v,_,T){let b=T;const I=m[v]>>>0,M=m[v+1]>>>0,A=m[v+2]>>>0,D=m[v+3]>>>0,F=m[v+4]>>>0,k=m[v+5]>>>0,L=m[v+6]>>>0,O=m[v+7]>>>0,j=m[v+8]>>>0,Y=m[v+9]>>>0,J=m[v+10]>>>0,re=m[v+11]>>>0,te=m[v+12]>>>0,ae=m[v+13]>>>0,le=m[v+14]>>>0,ne=m[v+15]>>>0;_[b++]=I>>>0&65535,_[b++]=I>>>16&65535,_[b++]=M>>>0&65535,_[b++]=M>>>16&65535,_[b++]=A>>>0&65535,_[b++]=A>>>16&65535,_[b++]=D>>>0&65535,_[b++]=D>>>16&65535,_[b++]=F>>>0&65535,_[b++]=F>>>16&65535,_[b++]=k>>>0&65535,_[b++]=k>>>16&65535,_[b++]=L>>>0&65535,_[b++]=L>>>16&65535,_[b++]=O>>>0&65535,_[b++]=O>>>16&65535,_[b++]=j>>>0&65535,_[b++]=j>>>16&65535,_[b++]=Y>>>0&65535,_[b++]=Y>>>16&65535,_[b++]=J>>>0&65535,_[b++]=J>>>16&65535,_[b++]=re>>>0&65535,_[b++]=re>>>16&65535,_[b++]=te>>>0&65535,_[b++]=te>>>16&65535,_[b++]=ae>>>0&65535,_[b++]=ae>>>16&65535,_[b++]=le>>>0&65535,_[b++]=le>>>16&65535,_[b++]=ne>>>0&65535,_[b]=ne>>>16&65535})(r,e,i,s);case 32:for(let m=0;m<32;m=m+1|0)i[s+m|0]=0|r[e+m|0];return}const l=Qh[o]>>>0;let u=e,d=0,g=r[u]>>>0;for(let m=0;m<32;m++)if(d+o<=32)i[s+m]=g>>>d&l,d+=o,d===32&&(d=0,u++,m!==31&&(g=r[u]>>>0));else{const v=32-d,_=g>>>d;u++,g=r[u]>>>0,i[s+m]=(_|(g&Qh[o-v]>>>0)<<v)&l,d=o-v}}function hi(r,e,i){const s=new Uint32Array(i);let o=0,l=e.get();for(let u=0;u<s.length;u++){let d=r[l++],g=127&d;d<128||(d=r[l++],g|=(127&d)<<7,d<128||(d=r[l++],g|=(127&d)<<14,d<128||(d=r[l++],g|=(127&d)<<21,d<128||(d=r[l++],g|=(15&d)<<28)))),s[o++]=g}return e.set(l),s}function va(r,e,i){const s=new BigUint64Array(i);for(let o=0;o<s.length;o++)s[o]=qg(r,e);return s}function qg(r,e){let i=0n,s=0,o=e.get();for(;o<r.length;){const l=r[o++];if(i|=BigInt(127&l)<<BigInt(s),!(128&l))break;if(s+=7,s>=64)throw new Error("Varint too long")}return e.set(o),i}function Wg(r,e){let i,s;return s=r[e.get()],e.increment(),i=127&s,s<128?i:(s=r[e.get()],e.increment(),i|=(127&s)<<7,s<128?i:(s=r[e.get()],e.increment(),i|=(127&s)<<14,s<128?i:(s=r[e.get()],e.increment(),i|=(127&s)<<21,s<128?i:(s=r[e.get()],i|=(15&s)<<28,(function(o,l,u){let d,g;if(g=l[u.get()],u.increment(),d=(112&g)>>4,g<128||(g=l[u.get()],u.increment(),d|=(127&g)<<3,g<128)||(g=l[u.get()],u.increment(),d|=(127&g)<<10,g<128)||(g=l[u.get()],u.increment(),d|=(127&g)<<17,g<128)||(g=l[u.get()],u.increment(),d|=(127&g)<<24,g<128)||(g=l[u.get()],u.increment(),d|=(1&g)<<31,g<128))return 4294967296*d+(o>>>0);throw new Error("Expected varint not more than 10 bytes")})(i,r,e)))))}function nt(r){return r>>>1^-(1&r)}function xi(r){return r>>1n^-(1n&r)}function xa(r){return r%2==1?(r+1)/-2:r/2}function id(r,e,i){if(i===void 0){i=0;for(let l=0;l<e;l++)i+=r[l]}const s=new Uint32Array(i);let o=0;for(let l=0;l<e;l++){const u=r[l];s.fill(r[l+e],o,o+u),o+=u}return s}function rd(r,e,i){if(i===void 0){i=0;for(let l=0;l<e;l++)i+=Number(r[l])}const s=new BigUint64Array(i);let o=0;for(let l=0;l<e;l++){const u=Number(r[l]);s.fill(r[l+e],o,o+u),o+=u}return s}function Gp(r,e,i){const s=new Float64Array(i);let o=0;for(let l=0;l<e;l++){const u=r[l];s.fill(r[l+e],o,o+u),o+=u}return s}function $p(r){const e=new Int32Array(r.length);e[0]=nt(r[0]);const i=r.length/4*4;let s=1;if(i>=4)for(;s<i-4;s+=4){const o=r[s+1],l=r[s+2],u=r[s+3];e[s]=nt(r[s])+e[s-1],e[s+1]=nt(o)+e[s],e[s+2]=nt(l)+e[s+1],e[s+3]=nt(u)+e[s+2]}for(;s!==r.length;++s)e[s]=nt(r[s])+e[s-1];return e}function Zp(r){const e=new BigInt64Array(r.length);e[0]=xi(r[0]);const i=r.length/4*4;let s=1;if(i>=4)for(;s<i-4;s+=4){const o=r[s+1],l=r[s+2],u=r[s+3];e[s]=xi(r[s])+e[s-1],e[s+1]=xi(o)+e[s],e[s+2]=xi(l)+e[s+1],e[s+3]=xi(u)+e[s+2]}for(;s!==e.length;++s)e[s]=xi(r[s])+e[s-1];return e}function nd(r){const e=r.length/4*4;let i=1;if(e>=4)for(let s=r[0];i<e-4;i+=4)s=r[i]+=s,s=r[i+1]+=s,s=r[i+2]+=s,s=r[i+3]+=s;for(;i!==r.length;)r[i]+=r[i-1],++i}var ti,_r,so,Ui,ut,Vt,qp,us;function bi(r,e){const i=(function(s,o){const l=s[o.get()],u=Object.values(ti)[l>>4];let d=null;switch(u){case ti.DATA:d={dictionaryType:Object.values(_r)[15&l]};break;case ti.OFFSET:d={offsetType:Object.values(so)[15&l]};break;case ti.LENGTH:d={lengthType:Object.values(Ui)[15&l]}}o.increment();const g=s[o.get()],m=Object.values(Ue)[g>>5],v=Object.values(Ue)[g>>2&7],_=Object.values(cs)[3&g];o.increment();const T=hi(s,o,2),b=T[0];return{physicalStreamType:u,logicalStreamType:d,logicalLevelTechnique1:m,logicalLevelTechnique2:v,physicalLevelTechnique:_,numValues:b,byteLength:T[1],decompressedCount:b}})(r,e);return i.logicalLevelTechnique1===Ue.MORTON?(function(s,o,l){const u=hi(o,l,2);return{physicalStreamType:s.physicalStreamType,logicalStreamType:s.logicalStreamType,logicalLevelTechnique1:s.logicalLevelTechnique1,logicalLevelTechnique2:s.logicalLevelTechnique2,physicalLevelTechnique:s.physicalLevelTechnique,numValues:s.numValues,byteLength:s.byteLength,decompressedCount:s.decompressedCount,numBits:u[0],coordinateShift:u[1]}})(i,r,e):Ue.RLE!==i.logicalLevelTechnique1&&Ue.RLE!==i.logicalLevelTechnique2||cs.NONE===i.physicalLevelTechnique?i:(function(s,o,l){const u=hi(o,l,2);return{physicalStreamType:s.physicalStreamType,logicalStreamType:s.logicalStreamType,logicalLevelTechnique1:s.logicalLevelTechnique1,logicalLevelTechnique2:s.logicalLevelTechnique2,physicalLevelTechnique:s.physicalLevelTechnique,numValues:s.numValues,byteLength:s.byteLength,decompressedCount:u[1],runs:u[0],numRleValues:u[1]}})(i,r,e)}(function(r){r.PRESENT="PRESENT",r.DATA="DATA",r.OFFSET="OFFSET",r.LENGTH="LENGTH"})(ti||(ti={})),(function(r){r.NONE="NONE",r.SINGLE="SINGLE",r.SHARED="SHARED",r.VERTEX="VERTEX",r.MORTON="MORTON",r.FSST="FSST"})(_r||(_r={})),(function(r){r.VERTEX="VERTEX",r.INDEX="INDEX",r.STRING="STRING",r.KEY="KEY"})(so||(so={})),(function(r){r.VAR_BINARY="VAR_BINARY",r.GEOMETRIES="GEOMETRIES",r.PARTS="PARTS",r.RINGS="RINGS",r.TRIANGLES="TRIANGLES",r.SYMBOL="SYMBOL",r.DICTIONARY="DICTIONARY"})(Ui||(Ui={})),(function(r){r[r.FLAT=0]="FLAT",r[r.CONST=1]="CONST",r[r.SEQUENCE=2]="SEQUENCE",r[r.DICTIONARY=3]="DICTIONARY",r[r.FSST_DICTIONARY=4]="FSST_DICTIONARY"})(ut||(ut={}));class yr{constructor(e,i){this.values=e,this._size=i}get(e){const i=Math.floor(e/8);return(this.values[i]>>e%8&1)==1}set(e,i){const s=Math.floor(e/8);this.values[s]=this.values[s]|(i?1:0)<<e%8}getInt(e){const i=Math.floor(e/8);return this.values[i]>>e%8&1}size(){return this._size}getBuffer(){return this.values}}function ba(r,e,i){if(!e)return r;const s=e.size(),o=new r.constructor(s);let l=0;for(let u=0;u<s;u++)o[u]=e.get(u)?r[l++]:i;return o}function sd(r,e,i,s,o){return(function(l,u,d,g){let m;switch(u.logicalLevelTechnique1){case Ue.DELTA:if(u.logicalLevelTechnique2===Ue.RLE){const v=u;if(!g)return(function(_,T,b){const I=new Int32Array(b);let M=0,A=0;for(let D=0;D<T;D++){const F=_[D],k=nt(_[D+T]);for(let L=0;L<F;L++)A+=k,I[M++]=A}return I})(l,v.runs,v.numRleValues);m=$p(l=id(l,v.runs,v.numRleValues))}else m=$p(l);break;case Ue.RLE:m=(function(v,_,T){if(T===void 0){T=0;for(let M=0;M<_;M++)T+=v[M]}const b=new Int32Array(T);let I=0;for(let M=0;M<_;M++){const A=v[M];let D=v[M+_];D=nt(D),b.fill(D,I,I+A),I+=A}return b})(l,u.runs,u.numRleValues);break;case Ue.MORTON:nd(l),m=new Int32Array(l);break;case Ue.COMPONENTWISE_DELTA:m=(function(v){if(v.length<2)return new Int32Array(v);const _=new Int32Array(v.length);_[0]=nt(v[0]),_[1]=nt(v[1]);const T=v.length/4*4;let b=2;if(T>=4)for(;b<T-4;b+=4){const I=v[b+1],M=v[b+2],A=v[b+3];_[b]=nt(v[b])+_[b-2],_[b+1]=nt(I)+_[b-1],_[b+2]=nt(M)+_[b],_[b+3]=nt(A)+_[b+1]}for(;b!==v.length;b+=2)_[b]=nt(v[b])+_[b-2],_[b+1]=nt(v[b+1])+_[b-1];return _})(l);break;case Ue.NONE:m=(function(v){const _=new Int32Array(v.length);for(let T=0;T<v.length;T++)_[T]=nt(v[T]);return _})(l);break;default:throw new Error(`The specified Logical level technique is not supported: ${u.logicalLevelTechnique1}`)}return g?ba(m,g,0):m})(wa(r,e,i),i,0,o)}function Gi(r,e,i,s,o){return(function(l,u,d,g){let m;switch(u.logicalLevelTechnique1){case Ue.DELTA:m=(function(v){const _=new Uint32Array(v.length);_[0]=nt(v[0])>>>0;for(let T=1;T<v.length;T++)_[T]=_[T-1]+nt(v[T])>>>0;return _})(u.logicalLevelTechnique2===Ue.RLE?id(l,u.runs,u.numRleValues):l);break;case Ue.RLE:m=id(l,u.runs,u.numRleValues);break;case Ue.MORTON:nd(l),m=l;break;case Ue.COMPONENTWISE_DELTA:m=(function(v){if(v.length<2)return new Uint32Array(v);const _=new Uint32Array(v.length);_[0]=nt(v[0])>>>0,_[1]=nt(v[1])>>>0;for(let T=2;T<v.length;T+=2)_[T]=_[T-2]+nt(v[T])>>>0,_[T+1]=_[T-1]+nt(v[T+1])>>>0;return _})(l);break;case Ue.NONE:m=l;break;default:throw new Error(`The specified Logical level technique is not supported: ${u.logicalLevelTechnique1}`)}return g?ba(m,g,0):m})(wa(r,e,i),i,0,o)}function hs(r,e,i){return(function(s,o){if(o.logicalLevelTechnique1===Ue.DELTA&&o.logicalLevelTechnique2===Ue.NONE)return(function(l){const u=new Int32Array(l.length+1);u[0]=0,u[1]=nt(l[0]);let d=u[1];for(let g=2;g!==u.length;++g)d+=nt(l[g-1]),u[g]=u[g-1]+d;return new Uint32Array(u)})(s);if(o.logicalLevelTechnique1===Ue.RLE&&o.logicalLevelTechnique2===Ue.NONE)return(function(l,u,d){const g=new Uint32Array(d+1);g[0]=0;let m=1,v=g[0];for(let _=0;_<u;_++){const T=l[_],b=l[_+u];for(let I=m;I<m+T;I++)g[I]=b+v,v=g[I];m+=T}return g})(s,o.runs,o.numRleValues);if(o.logicalLevelTechnique1===Ue.NONE&&o.logicalLevelTechnique2===Ue.NONE){(function(u){let d=0;for(let g=0;g<u.length;g++)u[g]+=d,d=u[g]})(s);const l=new Uint32Array(o.numValues+1);return l[0]=0,l.set(s,1),l}if(o.logicalLevelTechnique1===Ue.DELTA&&o.logicalLevelTechnique2===Ue.RLE){const l=(function(u,d,g){const m=new Int32Array(g+1);m[0]=0;let v=1,_=m[0];for(let T=0;T<d;T++){const b=u[T];let I=u[T+d];I=nt(I);for(let M=v;M<v+b;M++)m[M]=I+_,_=m[M];v+=b}return m})(s,o.runs,o.numRleValues);return nd(l),new Uint32Array(l)}throw new Error("Only delta encoding is supported for transforming length to offset streams yet.")})(wa(r,e,i),i)}function wa(r,e,i){const s=i.physicalLevelTechnique;switch(s){case cs.FAST_PFOR:return(function(o,l,u,d){return(function(g,m,v,_,T){const b=_.get();if(3&v)throw new Error(`FastPFOR: invalid encodedByteLength=${v} at offset=${b} (encodedBytes.length=${g.length}; expected a multiple of 4 bytes for an int32 big-endian word stream)`);const I=v>>>2,M=(function(D,F){if(F<=D.encodedWords.length)return D.encodedWords;const k=new Uint32Array(Math.max(16,2*F));return D.encodedWords=k,k})(T,I);(function(D,F,k,L){if(F<0||k<0||F+k>D.length)throw new RangeError(`decodeBigEndianInt32sInto: out of bounds (offset=${F}, byteLength=${k}, bytes.length=${D.length})`);const O=Math.floor(k/4),j=k%4!=0,Y=j?O+1:O;if(L.length<Y)throw new RangeError(`decodeBigEndianInt32sInto: out.length=${L.length} < ${Y}`);if(O>0){const J=D.byteOffset+F;if(3&J)for(let re=0;re<O;re++){const te=F+4*re;L[re]=D[te]<<24|D[te+1]<<16|D[te+2]<<8|D[te+3]}else{const re=new Uint32Array(D.buffer,J,O);for(let te=0;te<O;te++)L[te]=0|Vg(re[te])}}if(j){const J=F+4*O,re=k-4*O;let te=0;for(let ae=0;ae<re;ae++)te|=D[J+ae]<<24-8*ae;L[O]=0|te}})(g,b,v,M);const A=(function(D,F,k){let L=0,O=0;const j=new Uint32Array(F),Y=k??Up();if(D.length>0){const J=0|D[L];if(L=L+1|0,255&J)throw new Error(`FastPFOR decode: invalid alignedLength=${J} (expected multiple of 256)`);if(O+J>j.length)throw new Error(`FastPFOR decode: output buffer too small (outPos=${O}, alignedLength=${J}, out.length=${j.length})`);L=(function(re,te,ae,le,ne,ie){const fe=le+ed(ne,In);let xe=le,ye=ae;for(;xe!==fe;){const me=Math.min(td,fe-xe);ye=$g(re,te,ye,xe,me,ie),xe=xe+me|0}return ye})(D,j,L,O,J,Y),O=O+J|0}return(function(J,re,te,ae,le,ne){if(ne===0)return re;let ie=0,fe=re;const xe=re+te,ye=le;let me=le;const Ae=le+ne;let Xe=0,Ke=0;for(;fe<xe&&me<Ae;){const it=J[fe]>>>ie&255;if(ie+=8,fe+=ie>>>5,ie&=31,Xe|=(127&it)<<Ke,128&it)ae[me++]=0|Xe,Xe=0,Ke=0;else if(Ke+=7,Ke>28)throw new Error(`FastPFOR VByte: unterminated value (expected MSB=1 terminator within 5 bytes; shift=${Ke}, partial=${Xe}, decoded=${me-ye}/${ne}, inPos=${fe}, inEnd=${xe})`)}if(me!==Ae)throw new Error(`FastPFOR VByte: truncated stream (decoded=${me-ye}, expected=${ne}, consumedWords=${fe-re}/${te}, vbyteStart=${re}, vbyteEnd=${xe})`)})(D,L,D.length-L|0,j,O,F-O|0),j})(M.subarray(0,I),m,T.decoderWorkspace);return _.add(v),A})(o,l,u,d,(function(g=16){if(g<0)throw new RangeError(`initialEncodedWordCapacity must be >= 0, got ${g}`);const m=Math.max(16,0|g);return{encodedWords:new Uint32Array(m),decoderWorkspace:Up()}})(u>>>2))})(r,i.numValues,i.byteLength,e);case cs.VARINT:return hi(r,e,i.numValues);case cs.NONE:{const o=e.get();e.add(i.byteLength);const l=r.subarray(o,e.get());return new Uint32Array(l)}default:throw new Error(`Specified physicalLevelTechnique ${s} is not supported (yet).`)}}function od(r,e,i){const s=wa(r,e,i);return s.length===1?s[0]:(function(o){return o[1]})(s)}function Wp(r,e,i){return(function(s){if(s.length===2){const o=nt(s[1]);return[o,o]}return[nt(s[2]),nt(s[3])]})(wa(r,e,i))}function Hp(r,e,i){return(function(s){if(s.length===2){const o=xi(s[1]);return[o,o]}return[xi(s[2]),xi(s[3])]})(va(r,e,i.numValues))}function Xp(r,e,i,s){return(function(o,l,u){let d;switch(l.logicalLevelTechnique1){case Ue.DELTA:d=(function(g){const m=new BigUint64Array(g.length);m[0]=BigInt.asUintN(64,xi(g[0]));for(let v=1;v<g.length;v++)m[v]=BigInt.asUintN(64,m[v-1]+xi(g[v]));return m})(l.logicalLevelTechnique2===Ue.RLE?rd(o,l.runs,l.numRleValues):o);break;case Ue.RLE:d=rd(o,l.runs,l.numRleValues);break;case Ue.NONE:d=o;break;default:throw new Error(`The specified Logical level technique is not supported: ${l.logicalLevelTechnique1}`)}return u?ba(d,u,0n):d})(va(r,e,i.numValues),i,s)}function Yp(r,e,i){const s=va(r,e,i.numValues);return s.length===1?s[0]:(function(o){return o[1]})(s)}function Mu(r,e,i,s,o="int32"){const l=r.logicalLevelTechnique1;if(l===Ue.RLE)return r.runs===1?ut.CONST:ut.FLAT;if(l!==Ue.DELTA||r.logicalLevelTechnique2!==Ue.RLE)return r.numValues===1?ut.CONST:ut.FLAT;const u=e instanceof yr?e.size():e;if(r.numRleValues!==u)return ut.FLAT;if(r.runs===1)return ut.SEQUENCE;if(r.runs!==2)return r.numValues===1?ut.CONST:ut.FLAT;const d=s.get();if(r.physicalLevelTechnique===cs.VARINT)return(function(v,_,T){const b=new Np(_.get());if(T==="int64"){const M=va(v,b,4);return M[2]===2n&&M[3]===2n}const I=hi(v,b,4);return I[2]===2&&I[3]===2})(i,s,o)?ut.SEQUENCE:r.numValues===1?ut.CONST:ut.FLAT;const g=s.get(),m=new Int32Array(i.buffer,i.byteOffset+g,4);return s.set(d),m[2]===2&&m[3]===2?ut.SEQUENCE:r.numValues===1?ut.CONST:ut.FLAT}class Kp extends Iu{getValueFromBuffer(e){return this.dataBuffer[e]}}class Jp extends jp{constructor(e,i,s,o){super(e,BigInt64Array.of(i),s,o)}getValueFromBuffer(e){return this.dataBuffer[0]+BigInt(e)*this.delta}}function ad(r,e,i){return{x:Qp(r,e)-i,y:Qp(r>>1,e)-i}}function Qp(r,e){let i=0;for(let s=0;s<e;s++)i|=(r&1<<2*s)>>s;return i}function Ta(r,e,i,s,o,l,u){return r===us.MORTON?(function(d,g,m,v,_,T){const b=new Array(_?v+1:v);for(let I=0;I<v;I++){const M=ad(d[g[m+I]],T.numBits,T.coordinateShift);b[I]=new Te(M.x,M.y)}return _&&(b[b.length-1]=b[0]),b})(e,i,s,o,l,u):(function(d,g,m,v,_){const T=new Array(_?v+1:v);for(let b=0;b<2*v;b+=2){const I=2*g[m+b/2];T[b/2]=new Te(d[I],d[I+1])}return _&&(T[T.length-1]=T[0]),T})(e,i,s,o,l)}function Sa(r,e,i,s){const o=new Array(s?i+1:i);for(let l=0;l<2*i;l+=2)o[l/2]=new Te(r[e+l],r[e+l+1]);return s&&(o[o.length-1]=o[0]),o}(function(r){r[r.POINT=0]="POINT",r[r.LINESTRING=1]="LINESTRING",r[r.POLYGON=2]="POLYGON",r[r.MULTIPOINT=3]="MULTIPOINT",r[r.MULTILINESTRING=4]="MULTILINESTRING",r[r.MULTIPOLYGON=5]="MULTIPOLYGON"})(Vt||(Vt={})),(function(r){r[r.POINT=0]="POINT",r[r.LINESTRING=1]="LINESTRING",r[r.POLYGON=2]="POLYGON"})(qp||(qp={})),(function(r){r[r.MORTON=0]="MORTON",r[r.VEC_2=1]="VEC_2",r[r.VEC_3=2]="VEC_3"})(us||(us={}));class ef{constructor(e,i,s,o,l){this._vertexBufferType=e,this._topologyVector=i,this._vertexOffsets=s,this._vertexBuffer=o,this._mortonSettings=l}get vertexBufferType(){return this._vertexBufferType}get topologyVector(){return this._topologyVector}get vertexOffsets(){return this._vertexOffsets}get vertexBuffer(){return this._vertexBuffer}getSimpleEncodedVertex(e){const i=this.vertexOffsets?2*this.vertexOffsets[e]:2*e;return[this.vertexBuffer[i],this.vertexBuffer[i+1]]}getVertex(e){if(this.vertexOffsets&&this.mortonSettings){const s=ad(this.vertexBuffer[this.vertexOffsets[e]],this.mortonSettings.numBits,this.mortonSettings.coordinateShift);return[s.x,s.y]}const i=this.vertexOffsets?2*this.vertexOffsets[e]:2*e;return[this.vertexBuffer[i],this.vertexBuffer[i+1]]}getGeometries(){return(function(e){const i=new Array(e.numGeometries);let s=1,o=1,l=1,u=0,d=0,g=0;const m=e.mortonSettings,v=e.topologyVector,_=v.geometryOffsets,T=v.partOffsets,b=v.ringOffsets,I=e.vertexOffsets,M=!I||I.length===0,A=e.containsPolygonGeometry(),D=e.vertexBuffer;for(let F=0;F<e.numGeometries;F++)switch(e.geometryType(F)){case Vt.POINT:{let k,L;if(M)k=D[d++],L=D[d++];else if(e.vertexBufferType===us.MORTON){const O=ad(D[I[g++]],m.numBits,m.coordinateShift);k=O.x,L=O.y}else{const O=2*I[g++];k=D[O],L=D[O+1]}i[u++]=[[new Te(k,L)]],_&&l++,T&&s++,b&&o++}break;case Vt.MULTIPOINT:{const k=_[l]-_[l-1];l++;const L=new Array(k);if(M)for(let O=0;O<k;O++){const j=D[d++],Y=D[d++];L[O]=new Te(j,Y)}else for(let O=0;O<k;O++){const j=2*I[g++];L[O]=new Te(D[j],D[j+1])}i[u++]=L.map((O=>[O])),s+=k,o+=k}break;case Vt.LINESTRING:{let k,L;A?(k=b[o]-b[o-1],o++):k=T[s]-T[s-1],s++,M?(L=Sa(D,d,k,!1),d+=2*k):(L=Ta(e.vertexBufferType,D,I,g,k,!1,m),g+=k),i[u++]=[L],_&&l++}break;case Vt.POLYGON:{const k=T[s]-T[s-1];s++;const L=new Array(k-1);let O,j=b[o]-b[o-1];if(o++,M){O=Sa(D,d,j,!0),d+=2*j;for(let Y=0;Y<L.length;Y++)j=b[o]-b[o-1],o++,L[Y]=Sa(D,d,j,!0),d+=2*j}else{O=Ta(e.vertexBufferType,D,I,g,j,!0,m),g+=j;for(let Y=0;Y<L.length;Y++)j=b[o]-b[o-1],o++,L[Y]=Ta(e.vertexBufferType,D,I,g,j,!0,m),g+=j}i[u++]=[O].concat(L),_&&l++}break;case Vt.MULTILINESTRING:{const k=_[l]-_[l-1];l++;const L=new Array(k);for(let O=0;O<k;O++){let j;if(A?(j=b[o]-b[o-1],o++):j=T[s]-T[s-1],s++,M)L[O]=Sa(D,d,j,!1),d+=2*j;else{const Y=Ta(e.vertexBufferType,D,I,g,j,!1,m);L[O]=Y,g+=j}}i[u++]=L}break;case Vt.MULTIPOLYGON:{const k=_[l]-_[l-1];l++;const L=new Array(k);for(let O=0;O<k;O++){const j=T[s]-T[s-1];let Y;s++;const J=new Array(j-1),re=b[o]-b[o-1];o++,M?(Y=Sa(D,d,re,!0),d+=2*re):(Y=Ta(e.vertexBufferType,D,I,g,re,!0,m),g+=re);for(let te=0;te<J.length;te++){const ae=b[o]-b[o-1];o++,M?(J[te]=Sa(D,d,ae,!0),d+=2*ae):(J[te]=Ta(e.vertexBufferType,D,I,g,ae,!0,m),g+=ae)}L[O]=[Y].concat(J)}i[u++]=L.flat()}break;default:throw new Error("The specified geometry type is currently not supported.")}return i})(this)}get mortonSettings(){return this._mortonSettings}}class tf extends ef{constructor(e,i,s,o,l,u,d){super(s,o,l,u,d),this._numGeometries=e,this._geometryType=i}geometryType(e){return this._geometryType}get numGeometries(){return this._numGeometries}containsPolygonGeometry(){return this._geometryType===Vt.POLYGON||this._geometryType===Vt.MULTIPOLYGON}containsSingleGeometryType(){return!0}}class rf extends ef{constructor(e,i,s,o,l,u){super(e,s,o,l,u),this._geometryTypes=i}geometryType(e){return this._geometryTypes[e]}get numGeometries(){return this._geometryTypes.length}containsPolygonGeometry(){for(let e=0;e<this.numGeometries;e++)if(this.geometryType(e)===Vt.POLYGON||this.geometryType(e)===Vt.MULTIPOLYGON)return!0;return!1}containsSingleGeometryType(){return!1}}class nf{constructor(e,i,s,o){this._triangleOffsets=e,this._indexBuffer=i,this._vertexBuffer=s,this._topologyVector=o}get triangleOffsets(){return this._triangleOffsets}get indexBuffer(){return this._indexBuffer}get vertexBuffer(){return this._vertexBuffer}get topologyVector(){return this._topologyVector}getGeometries(){if(!this._topologyVector)throw new Error("Cannot convert GpuVector to coordinates without topology information");const e=new Array(this.numGeometries),i=this._topologyVector,s=i.partOffsets,o=i.ringOffsets,l=i.geometryOffsets;let u=0,d=1,g=1,m=1;for(let v=0;v<this.numGeometries;v++)switch(this.geometryType(v)){case Vt.POLYGON:{const _=s[d]-s[d-1];d++;const T=[];for(let b=0;b<_;b++){const I=o[g]-o[g-1];g++;const M=[];for(let A=0;A<I;A++){const D=this._vertexBuffer[u++],F=this._vertexBuffer[u++];M.push(new Te(D,F))}M.length>0&&M.push(M[0]),T.push(M)}e[v]=T,l&&m++}break;case Vt.MULTIPOLYGON:{const _=l[m]-l[m-1];m++;const T=[];for(let b=0;b<_;b++){const I=s[d]-s[d-1];d++;for(let M=0;M<I;M++){const A=o[g]-o[g-1];g++;const D=[];for(let F=0;F<A;F++){const k=this._vertexBuffer[u++],L=this._vertexBuffer[u++];D.push(new Te(k,L))}D.length>0&&D.push(D[0]),T.push(D)}}e[v]=T}}return e}[Symbol.iterator](){return null}}function sf(r,e,i,s,o,l){return new Hg(r,e,i,s,o,l)}class Hg extends nf{constructor(e,i,s,o,l,u){super(s,o,l,u),this._numGeometries=e,this._geometryType=i}geometryType(e){return this._geometryType}get numGeometries(){return this._numGeometries}containsSingleGeometryType(){return!0}}function of(r,e,i,s,o){return new Xg(r,e,i,s,o)}class Xg extends nf{constructor(e,i,s,o,l){super(i,s,o,l),this._geometryTypes=e}geometryType(e){return this._geometryTypes[e]}get numGeometries(){return this._geometryTypes.length}containsSingleGeometryType(){return!1}}function Yg(r,e,i,s,o){const l=bi(r,i);let u,d,g,m;if(Mu(l,s,r,i)===ut.CONST){const F=od(r,i,l);let k,L,O,j;for(let Y=0;Y<e-1;Y++){const J=bi(r,i);switch(J.physicalStreamType){case ti.LENGTH:switch(J.logicalStreamType.lengthType){case Ui.GEOMETRIES:k=hs(r,i,J);break;case Ui.PARTS:L=hs(r,i,J);break;case Ui.RINGS:O=hs(r,i,J);break;case Ui.TRIANGLES:j=hs(r,i,J)}break;case ti.OFFSET:switch(J.logicalStreamType.offsetType){case so.VERTEX:u=Gi(r,i,J);break;case so.INDEX:m=Gi(r,i,J)}break;case ti.DATA:_r.VERTEX===J.logicalStreamType.dictionaryType?d=sd(r,i,J):(g={numBits:J.numBits,coordinateShift:J.coordinateShift},d=Gi(r,i,J))}}return m?k!==void 0||L!==void 0?sf(s,F,j,m,d,{geometryOffsets:k,partOffsets:L,ringOffsets:O}):sf(s,F,j,m,d):g===void 0?(function(Y,J,re,te,ae){return new tf(Y,J,us.VEC_2,re,te,ae)})(s,F,{geometryOffsets:k,partOffsets:L,ringOffsets:O},u,d):(function(Y,J,re,te,ae,le){return new tf(Y,J,us.MORTON,re,te,ae,le)})(s,F,{geometryOffsets:k,partOffsets:L,ringOffsets:O},u,d,g)}const v=Gi(r,i,l);let _,T,b,I,M,A,D;for(let F=0;F<e-1;F++){const k=bi(r,i);switch(k.physicalStreamType){case ti.LENGTH:switch(k.logicalStreamType.lengthType){case Ui.GEOMETRIES:_=Gi(r,i,k);break;case Ui.PARTS:T=Gi(r,i,k);break;case Ui.RINGS:b=Gi(r,i,k);break;case Ui.TRIANGLES:I=hs(r,i,k)}break;case ti.OFFSET:switch(k.logicalStreamType.offsetType){case so.VERTEX:u=Gi(r,i,k);break;case so.INDEX:m=Gi(r,i,k)}break;case ti.DATA:_r.VERTEX===k.logicalStreamType.dictionaryType?d=sd(r,i,k):(g={numBits:k.numBits,coordinateShift:k.coordinateShift},d=Gi(r,i,k))}}return _?(M=ld(v,_,2),T&&b?(A=af(v,M,T,!1),D=(function(F,k,L,O){const j=new Uint32Array(L[L.length-1]+1);let Y=0;j[0]=Y;let J=1,re=1,te=0;for(let ae=0;ae<F.length;ae++){const le=F[ae],ne=k[ae+1]-k[ae];if(le!==0&&le!==3)for(let ie=0;ie<ne;ie++){const fe=L[J]-L[J-1];J++;for(let xe=0;xe<fe;xe++)Y=j[re++]=Y+O[te++]}else for(let ie=0;ie<ne;ie++)j[re++]=++Y,J++}return j})(v,M,A,b)):T&&(A=(function(F,k,L){const O=new Uint32Array(k[k.length-1]+1);let j=0;O[0]=j;let Y=1,J=0;for(let re=0;re<F.length;re++){const te=F[re],ae=k[re+1]-k[re];if(te===4||te===1)for(let le=0;le<ae;le++)j=O[Y++]=j+L[J++];else for(let le=0;le<ae;le++)O[Y++]=++j}return O})(v,M,T))):T&&b?(A=ld(v,T,1),D=af(v,A,b,!0)):T&&(A=ld(v,T,0)),m&&!A?of(v,I,m,d):m?of(v,I,m,d,{geometryOffsets:M,partOffsets:A,ringOffsets:D}):g===void 0?(function(F,k,L,O){return new rf(us.VEC_2,F,k,L,O)})(v,{geometryOffsets:M,partOffsets:A,ringOffsets:D},u,d):(function(F,k,L,O,j){return new rf(us.MORTON,F,k,L,O,j)})(v,{geometryOffsets:M,partOffsets:A,ringOffsets:D},u,d,g)}function ld(r,e,i){const s=new Uint32Array(r.length+1);let o=0;s[0]=o;let l=0;for(let u=0;u<r.length;u++)o=s[u+1]=o+(r[u]>i?e[l++]:1);return s}function af(r,e,i,s){const o=new Uint32Array(e[e.length-1]+1);let l=0;o[0]=l;let u=1,d=0;for(let g=0;g<r.length;g++){const m=r[g],v=e[g+1]-e[g];if(m===5||m===2||s&&(m===4||m===1))for(let _=0;_<v;_++)l=o[u++]=l+i[d++];else for(let _=0;_<v;_++)o[u++]=++l}return o}class Kg extends ya{constructor(e,i,s){super(e,i.getBuffer(),s),this.dataVector=i}getValueFromBuffer(e){return this.dataVector.get(e)}}class Jg extends Iu{getValueFromBuffer(e){return this.dataBuffer[e]}}class lf extends ya{constructor(e,i,s,o){super(e,o?BigInt64Array.of(i):BigUint64Array.of(i),s)}getValueFromBuffer(e){return this.dataBuffer[0]}}function Ql(r,e,i,s,o){const l=(function(u,d,g,m){const v=new Uint8Array(d);let _=0;const T=m.get()+g;for(;_<d&&!(m.get()>=T);){const b=u[m.increment()];if(b<=127){const I=b+3,M=u[m.increment()],A=Math.min(_+I,d);v.fill(M,_,A),_=A}else{const I=256-b;for(let M=0;M<I&&_<d;M++)v[_++]=u[m.increment()]}}return m.set(T),v})(r,Math.ceil(e/8),i,s);return o?(function(u,d,g){if(!g)return u;const m=g.size(),v=new yr(u,d),_=new yr(new Uint8Array(Math.ceil(m/8)),m);let T=0;for(let b=0;b<m;b++){const I=!!g.get(b)&&v.get(T++);_.set(b,I)}return _.getBuffer()})(l,e,o):l}const Qg=new TextDecoder;function cd(r,e,i){return i-e>=12?Qg.decode(r.subarray(e,i)):(function(s,o,l){let u="",d=o;for(;d<l;){const g=s[d];let m,v,_,T=null,b=g>239?4:g>223?3:g>191?2:1;if(d+b>l)break;b===1?g<128&&(T=g):b===2?(m=s[d+1],(192&m)==128&&(T=(31&g)<<6|63&m,T<=127&&(T=null))):b===3?(m=s[d+1],v=s[d+2],(192&m)==128&&(192&v)==128&&(T=(15&g)<<12|(63&m)<<6|63&v,(T<=2047||T>=55296&&T<=57343)&&(T=null))):b===4&&(m=s[d+1],v=s[d+2],_=s[d+3],(192&m)==128&&(192&v)==128&&(192&_)==128&&(T=(15&g)<<18|(63&m)<<12|(63&v)<<6|63&_,(T<=65535||T>=1114112)&&(T=null))),T===null?(T=65533,b=1):T>65535&&(T-=65536,u+=String.fromCharCode(T>>>10&1023|55296),T=56320|1023&T),u+=String.fromCharCode(T),d+=b}return u})(r,e,i)}class ud extends ya{constructor(e,i,s,o){super(e,s,o),this.offsetBuffer=i}}class cf extends ud{constructor(e,i,s,o){super(e,i,s,o??i.length-1)}getValueFromBuffer(e){return cd(this.dataBuffer,this.offsetBuffer[e],this.offsetBuffer[e+1])}}class Pa extends ud{constructor(e,i,s,o,l){super(e,s,o,l??i.length),this.indexBuffer=i,this.indexBuffer=i}getValueFromBuffer(e){const i=this.indexBuffer[e];return cd(this.dataBuffer,this.offsetBuffer[i],this.offsetBuffer[i+1])}}class uf extends ud{constructor(e,i,s,o,l,u,d){super(e,s,o,d),this.indexBuffer=i,this.symbolOffsetBuffer=l,this.symbolTableBuffer=u}getValueFromBuffer(e){this.decodedDictionary==null&&(this.symbolLengthBuffer==null&&(this.symbolLengthBuffer=this.offsetToLengthBuffer(this.symbolOffsetBuffer)),this.decodedDictionary=(function(s,o,l){const u=[],d=new Array(o.length).fill(0);for(let g=1;g<o.length;g++)d[g]=d[g-1]+o[g-1];for(let g=0;g<l.length;g++)if(l[g]===255)u.push(l[++g]);else{const m=o[l[g]],v=d[l[g]];for(let _=0;_<m;_++)u.push(s[v+_])}return new Uint8Array(u)})(this.symbolTableBuffer,this.symbolLengthBuffer,this.dataBuffer));const i=this.indexBuffer[e];return cd(this.decodedDictionary,this.offsetBuffer[i],this.offsetBuffer[i+1])}offsetToLengthBuffer(e){const i=new Uint32Array(e.length-1);let s=e[0];for(let o=1;o<e.length;o++){const l=e[o];i[o-1]=l-s,s=l}return i}}function e_(r,e,i,s,o,l){return i.type==="scalarType"?(function(u,d,g,m,v,_){let T=null;if(u===0)return null;if(_.nullable){const I=bi(d,g),M=I.numValues,A=g.get(),D=Ql(d,M,I.byteLength,g);g.set(A+I.byteLength),T=new yr(D,I.numValues)}const b=T??m;switch(v.physicalType){case 4:case 3:return(function(I,M,A,D,F){const k=bi(I,M),L=Mu(k,F,I,M),O=D.physicalType===3;if(L===ut.FLAT){const Y=ec(F)?F:void 0,J=O?sd(I,M,k,0,Y):Gi(I,M,k,0,Y);return new Hh(A.name,J,F)}if(L===ut.SEQUENCE){const Y=Wp(I,M,k);return new Yh(A.name,Y[0],Y[1],k.numRleValues)}const j=O?(function(Y,J,re){const te=wa(Y,J,re);return te.length===1?nt(te[0]):(function(ae){return nt(ae[1])})(te)})(I,M,k):od(I,M,k);return new Kh(A.name,j,F,O)})(d,g,_,v,b);case 9:return(function(I,M,A,D,F){let k=null,L=null,O=null,j=null,Y=null,J=F??null,re=null,te=null;for(let ae=0;ae<D;ae++){const le=bi(M,A);switch(le.physicalStreamType){case ti.PRESENT:{const ne=Ql(M,le.numValues,le.byteLength,A),ie=new yr(ne,le.numValues);J=F??ie;break}case ti.OFFSET:L=Gi(M,A,le,0,J);break;case ti.LENGTH:{const ne=hs(M,A,le);Ui.DICTIONARY===le.logicalStreamType.lengthType?k=ne:Ui.SYMBOL===le.logicalStreamType.lengthType?j=ne:re=ne;break}case ti.DATA:{const ne=M.subarray(A.get(),A.get()+le.byteLength);A.add(le.byteLength);const ie=le.logicalStreamType.dictionaryType;_r.FSST===ie?Y=ne:_r.SINGLE===ie||_r.SHARED===ie?O=ne:_r.NONE===ie&&(te=ne);break}}}return(function(ae,le,ne,ie,fe,xe,ye){return le?new uf(ae,ne,ie,fe,xe,le,ye):null})(I,Y,L,k,O,j,J)??(function(ae,le,ne,ie,fe){return le?fe?new Pa(ae,ne,ie,le,fe):new Pa(ae,ne,ie,le):null})(I,O,L,k,J)??(function(ae,le,ne,ie,fe){if(!le||!ne)return null;if(ie)return fe?new Pa(ae,ie,le,ne,fe):new Pa(ae,ie,le,ne);if(fe&&fe.size()!==le.length-1){const xe=new Uint32Array(fe.size());let ye=0;for(let me=0;me<fe.size();me++)xe[me]=fe.get(me)?ye++:0;return new Pa(ae,xe,le,ne,fe)}return fe?new cf(ae,le,ne,fe):new cf(ae,le,ne)})(I,re,te,L,J)})(_.name,d,g,_.nullable?u-1:u,T);case 0:return(function(I,M,A,D,F){const k=bi(I,M),L=k.numValues,O=M.get(),j=ec(F)?F:void 0,Y=Ql(I,L,k.byteLength,M,j);M.set(O+k.byteLength);const J=new yr(Y,L);return new Kg(A.name,J,F)})(d,g,_,0,b);case 6:case 5:return(function(I,M,A,D,F){const k=bi(I,M),L=Mu(k,D,I,M,"int64"),O=F.physicalType===5;if(L===ut.FLAT){const Y=ec(D)?D:void 0,J=O?(function(re,te,ae,le){return(function(ne,ie,fe){let xe;switch(ie.logicalLevelTechnique1){case Ue.DELTA:if(ie.logicalLevelTechnique2===Ue.RLE){const ye=ie;if(!fe)return(function(me,Ae,Xe){const Ke=new BigInt64Array(Xe);let it=0,ri=0n;for(let bt=0;bt<Ae;bt++){const Rt=Number(me[bt]),jt=xi(me[bt+Ae]);for(let ht=0;ht<Rt;ht++)ri+=jt,Ke[it++]=ri}return Ke})(ne,ye.runs,ye.numRleValues);xe=Zp(ne=rd(ne,ye.runs,ye.numRleValues))}else xe=Zp(ne);break;case Ue.RLE:xe=(function(ye,me,Ae){if(Ae===void 0){Ae=0;for(let it=0;it<me;it++)Ae+=Number(ye[it])}const Xe=new BigInt64Array(Ae);let Ke=0;for(let it=0;it<me;it++){const ri=Number(ye[it]);let bt=ye[it+me];bt=xi(bt),Xe.fill(bt,Ke,Ke+ri),Ke+=ri}return Xe})(ne,ie.runs,ie.numRleValues);break;case Ue.NONE:xe=(function(ye){const me=new BigInt64Array(ye.length);for(let Ae=0;Ae<ye.length;Ae++)me[Ae]=xi(ye[Ae]);return me})(ne);break;default:throw new Error(`The specified Logical level technique is not supported: ${ie.logicalLevelTechnique1}`)}return fe?ba(xe,fe,0n):xe})(va(re,te,ae.numValues),ae,le)})(I,M,k,Y):Xp(I,M,k,Y);return new Kp(A.name,J,D)}if(L===ut.SEQUENCE){const Y=Hp(I,M,k);return new Jp(A.name,Y[0],Y[1],k.numRleValues)}const j=O?(function(Y,J,re){const te=va(Y,J,re.numValues);return te.length===1?xi(te[0]):(function(ae){return xi(ae[1])})(te)})(I,M,k):Yp(I,M,k);return new lf(A.name,j,D,O)})(d,g,_,b,v);case 7:return(function(I,M,A,D){const F=bi(I,M),k=ec(D)?D:void 0,L=(function(O,j,Y,J){const re=j.get(),te=re+Y*Float32Array.BYTES_PER_ELEMENT,ae=new Uint8Array(O.subarray(re,te)).buffer,le=new Float32Array(ae);return j.set(te),J?ba(le,J,0):le})(I,M,F.numValues,k);return new Jg(A.name,L,D)})(d,g,_,b);case 8:return(function(I,M,A,D){const F=bi(I,M),k=ec(D)?D:void 0,L=(function(O,j,Y,J){const re=j.get(),te=re+Y*Float64Array.BYTES_PER_ELEMENT,ae=new Uint8Array(O.subarray(re,te)).buffer,le=new Float64Array(ae);return j.set(te),J?ba(le,J,0):le})(I,M,F.numValues,k);return new Xh(A.name,L,D)})(d,g,_,b);default:throw new Error(`The specified data type for the field is currently not supported: ${v}`)}})(s,r,e,o,i.scalarType,i):s===0?null:(function(u,d,g,m){let v=null,_=null,T=null,b=null,I=!1;for(;!I;){const F=bi(u,d);switch(F.physicalStreamType){case ti.LENGTH:Ui.DICTIONARY===F.logicalStreamType.lengthType?v=hs(u,d,F):T=hs(u,d,F);break;case ti.DATA:_r.SINGLE===F.logicalStreamType.dictionaryType||_r.SHARED===F.logicalStreamType.dictionaryType?(_=u.subarray(d.get(),d.get()+F.byteLength),I=!0):b=u.subarray(d.get(),d.get()+F.byteLength),d.add(F.byteLength)}}const M=g.complexType.children,A=[];let D=0;for(const F of M){const k=hi(u,d,1)[0];if(k===0)continue;const L=F.name?`${g.name}${F.name}`:g.name;if(k!==2||F.type!=="scalarField"||F.scalarField.physicalType!==9)throw new Error("Currently only optional string fields are implemented for a struct.");const O=bi(u,d),j=Ql(u,O.numValues,O.byteLength,d),Y=bi(u,d),J=Gi(u,d,Y,0,Y.decompressedCount!==m?new yr(j,O.numValues):void 0);A[D++]=b?new uf(L,J,v,_,T,b,new yr(j,O.numValues)):new Pa(L,J,v,_,new yr(j,O.numValues))}return A})(r,e,i,o)}function ec(r){return r instanceof yr}function hf(r){switch(r){case 0:case 1:case 2:case 3:{const e={};e.nullable=!!(1&r),e.columnScope=0;const i={type:"logicalType",logicalType:0};return i.longID=!!(2&r),e.scalarType=i,e.type="scalarType",e}case 4:{const e={nullable:!1,columnScope:0},i={type:"physicalType",physicalType:0};return e.type="complexType",e.complexType=i,e}case 30:{const e={nullable:!1,columnScope:0},i={type:"physicalType",physicalType:1};return e.type="complexType",e.complexType=i,e}default:return(function(e){let i;switch(e){case 10:case 11:i=0;break;case 12:case 13:i=1;break;case 14:case 15:i=2;break;case 16:case 17:i=3;break;case 18:case 19:i=4;break;case 20:case 21:i=5;break;case 22:case 23:i=6;break;case 24:case 25:i=7;break;case 26:case 27:i=8;break;case 28:case 29:i=9;break;default:return null}const s={};s.nullable=!!(1&e),s.columnScope=0;const o={type:"physicalType"};return o.physicalType=i,s.type="scalarType",s.scalarType=o,s})(r)}}function df(r){return r>=10}function pf(r){return r===30}function t_(r){if(r.type==="scalarType"){const e=r.scalarType;if(e.type==="physicalType")switch(e.physicalType){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:default:return!1;case 9:return!0}if(e.type==="logicalType")return!1}else if(r.type==="complexType"){const e=r.complexType;if(e.type==="physicalType")switch(e.physicalType){case 0:case 1:return!0;default:return!1}}return console.warn("Unexpected column type in hasStreamCount",r),!1}function i_(r){return r.type==="complexType"&&r.complexType?.type==="physicalType"&&r.complexType.physicalType===0}const r_=new TextDecoder;function hd(r,e){const i=hi(r,e,1)[0];if(i===0)return"";const s=e.get(),o=r.subarray(s,s+i);return e.add(i),r_.decode(o)}function ff(r,e){const i=hi(r,e,1)[0]>>>0;if(i<10||i>30)throw new Error(`Unsupported field type code ${i}. Supported: 10-29(scalars), 30(STRUCT)`);const s=hf(i);if(df(i)&&(s.name=hd(r,e)),pf(i)){const o=hi(r,e,1)[0]>>>0;s.complexType.children=new Array(o);for(let l=0;l<o;l++)s.complexType.children[l]=ff(r,e)}return(function(o){return{name:o.name,nullable:o.nullable,scalarField:o.scalarType,complexField:o.complexType,type:o.type==="scalarType"?"scalarField":"complexField"}})(s)}function n_(r,e){const i=hi(r,e,1)[0]>>>0,s=hf(i);if(!s)throw new Error(`Unsupported column type code ${i}. Supported: 0-3(ID), 4(GEOMETRY), 10-29(scalars), 30(STRUCT)`);if(df(i)?s.name=hd(r,e):i>=0&&i<=3?s.name="id":i===4&&(s.name="geometry"),pf(i)){const o=hi(r,e,1)[0]>>>0,l=s.complexType;l.children=new Array(o);for(let u=0;u<o;u++)l.children[u]=ff(r,e)}return s}function s_(r,e){const i={featureTables:[]},s={};s.name=hd(r,e);const o=hi(r,e,1)[0]>>>0,l=hi(r,e,1)[0]>>>0;s.columns=new Array(l);for(let u=0;u<l;u++)s.columns[u]=n_(r,e);return i.featureTables.push(s),[i,o]}function o_(r,e,i,s,o,l,u=!1){const d=e.scalarType;if(!d||d.type!=="logicalType"||d.logicalType!==0)throw new Error(`ID column must be a logical ID scalar type: ${s}`);const g=d.longID?6:4,m=typeof l=="number"?void 0:l,v=Mu(o,l,r,i,g===6?"int64":"int32");if(g===4)switch(v){case ut.FLAT:{const _=Gi(r,i,o,0,m);return new Hh(s,_,l)}case ut.SEQUENCE:{const _=Wp(r,i,o);return new Yh(s,_[0],_[1],o.numRleValues)}case ut.CONST:{const _=od(r,i,o);return new Kh(s,_,l,!1)}}switch(v){case ut.FLAT:{if(u){const T=(function(b,I,M){const A=(function(D,F,k){const L=new Float64Array(k);for(let O=0;O<k;O++)L[O]=Wg(D,F);return L})(b,I,M.numValues);return(function(D,F){switch(F.logicalLevelTechnique1){case Ue.DELTA:return F.logicalLevelTechnique2===Ue.RLE&&(D=Gp(D,F.runs,F.numRleValues)),(function(k){k[0]=xa(k[0]);const L=k.length/4*4;let O=1;if(L>=4)for(;O<L-4;O+=4){const j=k[O+1],Y=k[O+2],J=k[O+3];k[O]=xa(k[O])+k[O-1],k[O+1]=xa(j)+k[O],k[O+2]=xa(Y)+k[O+1],k[O+3]=xa(J)+k[O+2]}for(;O!==k.length;++O)k[O]=xa(k[O])+k[O-1]})(D),D;case Ue.RLE:return(function(k,L){return Gp(k,L.runs,L.numRleValues)})(D,F);case Ue.NONE:return D;default:throw new Error(`The specified Logical level technique is not supported: ${F.logicalLevelTechnique1}`)}})(A,M)})(r,i,o);return new Xh(s,T,l)}const _=Xp(r,i,o,m);return new Kp(s,_,l)}case ut.SEQUENCE:{const _=Hp(r,i,o);return new Jp(s,_[0],_[1],o.numRleValues)}case ut.CONST:{const _=Yp(r,i,o);return new lf(s,_,l,!1)}}throw new Error("Vector type not supported for id column.")}class a_{constructor(e,i){var s;switch(this._featureData=e,this.properties=this._featureData.properties||{},(s=this._featureData.geometry)===null||s===void 0?void 0:s.type){case Vt.POINT:case Vt.MULTIPOINT:this.type=1;break;case Vt.LINESTRING:case Vt.MULTILINESTRING:this.type=2;break;case Vt.POLYGON:case Vt.MULTIPOLYGON:this.type=3;break;default:this.type=0}this.extent=i,this.id=Number(this._featureData.id)}loadGeometry(){const e=[];for(const i of this._featureData.geometry.coordinates){const s=[];for(const o of i)s.push(new Te(o.x,o.y));e.push(s)}return e}}class l_{constructor(e){this.features=[],this.featureTable=e,this.name=e.name,this.extent=e.extent,this.version=2,this.features=e.getFeatures(),this.length=this.features.length}feature(e){return new a_(this.features[e],this.extent)}}class mf{constructor(e){this.layers={};const i=(function(s,o,l=!0){const u=new Np(0),d=[];for(;u.get()<s.length;){const m=hi(s,u,1)[0]>>>0,v=u.get()+m;if(v>s.length)throw new Error(`Block overruns tile: ${v} > ${s.length}`);if(hi(s,u,1)[0]>>>0!=1){u.set(v);continue}const[_,T]=s_(s,u),b=_.featureTables[0];let I=null,M=null;const A=[];let D=0;for(const k of b.columns){const L=k.name;if((g=k).type==="scalarType"&&g.scalarType?.type==="logicalType"&&g.scalarType.logicalType===0){let O=null;if(k.nullable){const Y=bi(s,u),J=u.get(),re=Ql(s,Y.numValues,Y.byteLength,u);u.set(J+Y.byteLength),O=new yr(re,Y.numValues)}const j=bi(s,u);D=O?O.size():j.decompressedCount,I=o_(s,k,u,L,j,O??D,l)}else if(i_(k)){const O=hi(s,u,1)[0];if(D===0){const j=u.get();D=bi(s,u).decompressedCount,u.set(j)}M=Yg(s,O,u,D)}else{const O=t_(k)?hi(s,u,1)[0]:1;if(O===0)continue;const j=e_(s,u,k,O,D);if(j)if(Array.isArray(j))for(const Y of j)A.push(Y);else A.push(j)}}const F=new Og(b.name,M,I,A,T);d.push(F),u.set(v)}var g;return d})(new Uint8Array(e));this.layers=i.reduce(((s,o)=>Object.assign(Object.assign({},s),{[o.name]:new l_(o)})),{})}}class c_{constructor(e,i){this.feature=e,this.type=e.type,this.properties=e.tags?e.tags:{},this.extent=i,"id"in e&&(typeof e.id=="string"?this.id=parseInt(e.id,10):typeof e.id!="number"||isNaN(e.id)||(this.id=e.id))}loadGeometry(){const e=[],i=this.feature.type===1?[this.feature.geometry]:this.feature.geometry;for(const s of i){const o=[];for(const l of s)o.push(new Te(l[0],l[1]));e.push(o)}return e}}const tc="_geojsonTileLayer";function u_(r,e,i=""){e.writeVarintField(15,r.version||1),e.writeStringField(1,r.name||""),e.writeVarintField(5,r.extent||4096);const s={jsonPrefix:i,keys:[],values:[],keycache:{},valuecache:{}};for(let u=0;u<r.length;u++)s.feature=r.feature(u),e.writeMessage(2,h_,s);const o=s.keys;for(const u of o)e.writeStringField(3,u);const l=s.values;for(const u of l)e.writeMessage(4,f_,u)}function h_(r,e){if(!r.feature)return;const i=r.feature;i.id!==void 0&&e.writeVarintField(1,i.id),e.writeMessage(2,d_,r),e.writeVarintField(3,i.type),e.writeMessage(4,p_,i)}function d_(r,e){for(const i in r.feature?.properties){let s=r.feature.properties[i],o=r.keycache[i];if(s==null)continue;o===void 0&&(r.keys.push(i),o=r.keys.length-1,r.keycache[i]=o),e.writeVarint(o),typeof s!="string"&&typeof s!="boolean"&&typeof s!="number"&&(s=r.jsonPrefix+JSON.stringify(s));const l=typeof s+":"+s;let u=r.valuecache[l];u===void 0&&(r.values.push(s),u=r.values.length-1,r.valuecache[l]=u),e.writeVarint(u)}}function dd(r,e){return(e<<3)+(7&r)}function gf(r){return r<<1^r>>31}function p_(r,e){const i=r.loadGeometry(),s=r.type;let o=0,l=0;for(const u of i){let d=1;s===1&&(d=u.length),e.writeVarint(dd(1,d));const g=s===3?u.length-1:u.length;for(let m=0;m<g;m++){m===1&&s!==1&&e.writeVarint(dd(2,g-1));const v=u[m].x-o,_=u[m].y-l;e.writeVarint(gf(v)),e.writeVarint(gf(_)),o+=v,l+=_}r.type===3&&e.writeVarint(dd(7,1))}}function f_(r,e){const i=typeof r;i==="string"?e.writeStringField(1,r):i==="boolean"?e.writeBooleanField(7,r):i==="number"&&(r%1!=0?e.writeDoubleField(3,r):r<0?e.writeSVarintField(6,r):e.writeVarintField(5,r))}class _f{constructor(e,i){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new hr(De,16,0),this.grid3D=new hr(De,16,0),this.featureIndexArray=new B,this.promoteId=i}insert(e,i,s,o,l,u){const d=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(s,o,l);const g=u?this.grid3D:this.grid;for(const m of i){const v=[1/0,1/0,-1/0,-1/0];for(const _ of m)v[0]=Math.min(v[0],_.x),v[1]=Math.min(v[1],_.y),v[2]=Math.max(v[2],_.x),v[3]=Math.max(v[3],_.y);v[0]<De&&v[1]<De&&v[2]>=0&&v[3]>=0&&g.insert(d,v[0],v[1],v[2],v[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=this.encoding!=="mlt"?new Gd(new bu(this.rawTileData)).layers:new mf(this.rawTileData).layers,this.sourceLayerCoder=new Op(this.vtLayers?Object.keys(this.vtLayers).sort():[tc])),this.vtLayers}query(e,i,s,o){this.loadVTLayers();const l=e.params,u=De/e.tileSize/e.scale,d=Bs(l.filter,l.globalState),g=e.queryGeometry,m=e.queryPadding*u,v=no.fromPoints(g),_=this.grid.query(v.minX-m,v.minY-m,v.maxX+m,v.maxY+m),T=no.fromPoints(e.cameraQueryGeometry).expandBy(m),b=this.grid3D.query(T.minX,T.minY,T.maxX,T.maxY,((A,D,F,k)=>(function(L,O,j,Y,J){for(const te of L)if(O<=te.x&&j<=te.y&&Y>=te.x&&J>=te.y)return!0;const re=[new Te(O,j),new Te(O,J),new Te(Y,J),new Te(Y,j)];if(L.length>2){for(const te of re)if(oa(L,te))return!0}for(let te=0;te<L.length-1;te++)if(Zf(L[te],L[te+1],re))return!0;return!1})(e.cameraQueryGeometry,A-m,D-m,F+m,k+m)));for(const A of b)_.push(A);_.sort(m_);const I={};let M;for(const A of _){if(A===M)continue;M=A;const D=this.featureIndexArray.get(A);let F=null;this.loadMatchingFeature(I,D.bucketIndex,D.sourceLayerIndex,D.featureIndex,d,l.layers,l.availableImages,i,s,o,((k,L,O)=>(F||(F=Nr(k)),L.queryIntersectsFeature({queryGeometry:g,feature:k,featureState:O,geometry:F,zoom:this.z,transform:e.transform,pixelsToTileUnits:u,pixelPosMatrix:e.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:e.getElevation}))))}return I}loadMatchingFeature(e,i,s,o,l,u,d,g,m,v,_){const T=this.bucketLayerIDs[i];if(u&&!T.some((A=>u.has(A))))return;const b=this.sourceLayerCoder.decode(s),I=this.vtLayers[b].feature(o);if(l.needGeometry){const A=Ur(I,!0);if(!l.filter(new at(this.tileID.overscaledZ),A,this.tileID.canonical))return}else if(!l.filter(new at(this.tileID.overscaledZ),I))return;const M=this.getId(I,b);for(const A of T){if(u&&!u.has(A))continue;const D=g[A];if(!D)continue;let F={};M&&v&&(F=v.getState(D.sourceLayer||tc,M));const k=Fi({},m[A]);k.paint=yf(k.paint,D.paint,I,F,d),k.layout=yf(k.layout,D.layout,I,F,d);const L=!_||_(I,D,F);if(!L)continue;const O=new Vp(I,this.z,this.x,this.y,M);O.layer=k;let j=e[A];j===void 0&&(j=e[A]=[]),j.push({featureIndex:o,feature:O,intersectionZ:L})}}lookupSymbolFeatures(e,i,s,o,l,u,d,g){const m={};this.loadVTLayers();const v=Bs(l.filterSpec,l.globalState);for(const _ of e)this.loadMatchingFeature(m,s,o,_,v,u,d,g,i);return m}hasLayer(e){for(const i of this.bucketLayerIDs)for(const s of i)if(e===s)return!0;return!1}getId(e,i){var s;let o=e.id;return this.promoteId&&(o=e.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[i]],typeof o=="boolean"&&(o=Number(o)),o===void 0&&(!((s=e.properties)===null||s===void 0)&&s.cluster)&&this.promoteId&&(o=Number(e.properties.cluster_id))),o}}function yf(r,e,i,s,o){return Pr(r,((l,u)=>{const d=e instanceof Xs?e.get(u):null;return d?.evaluate?d.evaluate(i,s,o):d}))}function m_(r,e){return e-r}function vf(r,e,i,s,o){const l=[];for(const u of r){let d;for(let g=0;g<u.length-1;g++){let m=u[g],v=u[g+1];m.x<e&&v.x<e||(m.x<e?m=new Te(e,m.y+(e-m.x)/(v.x-m.x)*(v.y-m.y))._round():v.x<e&&(v=new Te(e,m.y+(e-m.x)/(v.x-m.x)*(v.y-m.y))._round()),m.y<i&&v.y<i||(m.y<i?m=new Te(m.x+(i-m.y)/(v.y-m.y)*(v.x-m.x),i)._round():v.y<i&&(v=new Te(m.x+(i-m.y)/(v.y-m.y)*(v.x-m.x),i)._round()),m.x>=s&&v.x>=s||(m.x>=s?m=new Te(s,m.y+(s-m.x)/(v.x-m.x)*(v.y-m.y))._round():v.x>=s&&(v=new Te(s,m.y+(s-m.x)/(v.x-m.x)*(v.y-m.y))._round()),m.y>=o&&v.y>=o||(m.y>=o?m=new Te(m.x+(o-m.y)/(v.y-m.y)*(v.x-m.x),o)._round():v.y>=o&&(v=new Te(m.x+(o-m.y)/(v.y-m.y)*(v.x-m.x),o)._round()),d&&m.equals(d[d.length-1])||(d=[m],l.push(d)),d.push(v)))))}}return l}function xf(r,e,i,s,o){switch(e){case 1:return(function(l,u,d,g){const m=[];for(const v of l)for(const _ of v){const T=g===0?_.x:_.y;T>=u&&T<=d&&m.push([_])}return m})(r,i,s,o);case 2:return bf(r,i,s,o,!1);case 3:return bf(r,i,s,o,!0)}return[]}function g_(r,e,i,s,o){const l=s===0?__:y_;let u=[];const d=[];for(let v=0;v<r.length-1;v++){const _=r[v],T=r[v+1],b=s===0?_.x:_.y,I=s===0?T.x:T.y;let M=!1;b<e?I>e&&u.push(l(_,T,e)):b>i?I<i&&u.push(l(_,T,i)):u.push(_),I<e&&b>=e&&(u.push(l(_,T,e)),M=!0),I>i&&b<=i&&(u.push(l(_,T,i)),M=!0),!o&&M&&(d.push(u),u=[])}const g=r.length-1,m=s===0?r[g].x:r[g].y;return m>=e&&m<=i&&u.push(r[g]),o&&u.length>0&&!u[0].equals(u[u.length-1])&&u.push(new Te(u[0].x,u[0].y)),u.length>0&&d.push(u),d}function bf(r,e,i,s,o){const l=[];for(const u of r){const d=g_(u,e,i,s,o);d.length>0&&l.push(...d)}return l}function __(r,e,i){return new Te(i,r.y+(i-r.x)/(e.x-r.x)*(e.y-r.y))}function y_(r,e,i){return new Te(r.x+(i-r.y)/(e.y-r.y)*(e.x-r.x),i)}Se("FeatureIndex",_f,{omit:["rawTileData","sourceLayerCoder"]});class ds extends Te{constructor(e,i,s,o){super(e,i),this.angle=s,o!==void 0&&(this.segment=o)}clone(){return new ds(this.x,this.y,this.angle,this.segment)}}function wf(r,e,i,s,o){if(e.segment===void 0||i===0)return!0;let l=e,u=e.segment+1,d=0;for(;d>-i/2;){if(u--,u<0)return!1;d-=r[u].dist(l),l=r[u]}d+=r[u].dist(r[u+1]),u++;const g=[];let m=0;for(;d<i/2;){const v=r[u],_=r[u+1];if(!_)return!1;let T=r[u-1].angleTo(v)-v.angleTo(_);for(T=Math.abs((T+3*Math.PI)%(2*Math.PI)-Math.PI),g.push({distance:d,angleDelta:T}),m+=T;d-g[0].distance>s;)m-=g.shift().angleDelta;if(m>o)return!1;u++,d+=v.dist(_)}return!0}function Tf(r){let e=0;for(let i=0;i<r.length-1;i++)e+=r[i].dist(r[i+1]);return e}function Sf(r,e,i){return r?.6*e*i:0}function Pf(r,e){return Math.max(r?r.right-r.left:0,e?e.right-e.left:0)}function v_(r,e,i,s,o,l){const u=Sf(i,o,l),d=Pf(i,s)*l;let g=0;const m=Tf(r)/2;for(let v=0;v<r.length-1;v++){const _=r[v],T=r[v+1],b=_.dist(T);if(g+b>m){const I=(m-g)/b,M=Mi.number(_.x,T.x,I),A=Mi.number(_.y,T.y,I),D=new ds(M,A,T.angleTo(_),v);return D._round(),!u||wf(r,D,d,u,e)?D:void 0}g+=b}}function x_(r,e,i,s,o,l,u,d,g){const m=Sf(s,l,u),v=Pf(s,o),_=v*u,T=r[0].x===0||r[0].x===g||r[0].y===0||r[0].y===g;return e-_<e/4&&(e=_+e/4),If(r,T?e/2*d%e:(v/2+2*l)*u*d%e,e,m,i,_,T,!1,g)}function If(r,e,i,s,o,l,u,d,g){const m=l/2,v=Tf(r);let _=0,T=e-i,b=[];for(let I=0;I<r.length-1;I++){const M=r[I],A=r[I+1],D=M.dist(A),F=A.angleTo(M);for(;T+i<_+D;){T+=i;const k=(T-_)/D,L=Mi.number(M.x,A.x,k),O=Mi.number(M.y,A.y,k);if(L>=0&&L<g&&O>=0&&O<g&&T-m>=0&&T+m<=v){const j=new ds(L,O,F,I);j._round(),s&&!wf(r,j,l,s,o)||b.push(j)}}_+=D}return d||b.length||u||(b=If(r,_/2,i,s,o,l,u,!0,g)),b}function Mf(r,e,i,s){const o=[],l=r.image,u=l.pixelRatio,d=l.paddedRect.w-2,g=l.paddedRect.h-2;let m={x1:r.left,y1:r.top,x2:r.right,y2:r.bottom};const v=l.stretchX||[[0,d]],_=l.stretchY||[[0,g]],T=(ie,fe)=>ie+fe[1]-fe[0],b=v.reduce(T,0),I=_.reduce(T,0),M=d-b,A=g-I;let D=0,F=b,k=0,L=I,O=0,j=M,Y=0,J=A;if(l.content&&s){const ie=l.content,fe=ie[2]-ie[0],xe=ie[3]-ie[1];(l.textFitWidth||l.textFitHeight)&&(m=wp(r)),D=Eu(v,0,ie[0]),k=Eu(_,0,ie[1]),F=Eu(v,ie[0],ie[2]),L=Eu(_,ie[1],ie[3]),O=ie[0]-D,Y=ie[1]-k,j=fe-F,J=xe-L}const re=m.x1,te=m.y1,ae=m.x2-re,le=m.y2-te,ne=(ie,fe,xe,ye)=>{const me=Cu(ie.stretch-D,F,ae,re),Ae=Au(ie.fixed-O,j,ie.stretch,b),Xe=Cu(fe.stretch-k,L,le,te),Ke=Au(fe.fixed-Y,J,fe.stretch,I),it=Cu(xe.stretch-D,F,ae,re),ri=Au(xe.fixed-O,j,xe.stretch,b),bt=Cu(ye.stretch-k,L,le,te),Rt=Au(ye.fixed-Y,J,ye.stretch,I),jt=new Te(me,Xe),ht=new Te(it,Xe),Yt=new Te(it,bt),di=new Te(me,bt),pi=new Te(Ae/u,Ke/u),zi=new Te(ri/u,Rt/u),ni=e*Math.PI/180;if(ni){const Nt=Math.sin(ni),gt=Math.cos(ni),Dt=[gt,-Nt,Nt,gt];jt._matMult(Dt),ht._matMult(Dt),di._matMult(Dt),Yt._matMult(Dt)}const ki=ie.stretch+ie.fixed,or=fe.stretch+fe.fixed;return{tl:jt,tr:ht,bl:di,br:Yt,tex:{x:l.paddedRect.x+1+ki,y:l.paddedRect.y+1+or,w:xe.stretch+xe.fixed-ki,h:ye.stretch+ye.fixed-or},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:pi,pixelOffsetBR:zi,minFontScaleX:j/u/ae,minFontScaleY:J/u/le,isSDF:i}};if(s&&(l.stretchX||l.stretchY)){const ie=Ef(v,M,b),fe=Ef(_,A,I);for(let xe=0;xe<ie.length-1;xe++){const ye=ie[xe],me=ie[xe+1];for(let Ae=0;Ae<fe.length-1;Ae++)o.push(ne(ye,fe[Ae],me,fe[Ae+1]))}}else o.push(ne({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:d+1},{fixed:0,stretch:g+1}));return o}function Eu(r,e,i){let s=0;for(const o of r)s+=Math.max(e,Math.min(i,o[1]))-Math.max(e,Math.min(i,o[0]));return s}function Ef(r,e,i){const s=[{fixed:-1,stretch:0}];for(const[o,l]of r){const u=s[s.length-1];s.push({fixed:o-u.stretch,stretch:u.stretch}),s.push({fixed:o-u.stretch,stretch:u.stretch+(l-o)})}return s.push({fixed:e+1,stretch:i}),s}function Cu(r,e,i,s){return r/e*i+s}function Au(r,e,i,s){return r-e*i/s}Se("Anchor",ds);class Du{constructor(e,i,s,o,l,u,d,g,m,v){var _;if(this.boxStartIndex=e.length,m){let T=u.top,b=u.bottom;const I=u.collisionPadding;I&&(T-=I[1],b+=I[3]);let M=b-T;M>0&&(M=Math.max(10,M),this.circleDiameter=M)}else{const T=!((_=u.image)===null||_===void 0)&&_.content&&(u.image.textFitWidth||u.image.textFitHeight)?wp(u):{x1:u.left,y1:u.top,x2:u.right,y2:u.bottom};T.y1=T.y1*d-g[0],T.y2=T.y2*d+g[2],T.x1=T.x1*d-g[3],T.x2=T.x2*d+g[1];const b=u.collisionPadding;if(b&&(T.x1-=b[0]*d,T.y1-=b[1]*d,T.x2+=b[2]*d,T.y2+=b[3]*d),v){const I=new Te(T.x1,T.y1),M=new Te(T.x2,T.y1),A=new Te(T.x1,T.y2),D=new Te(T.x2,T.y2),F=v*Math.PI/180;I._rotate(F),M._rotate(F),A._rotate(F),D._rotate(F),T.x1=Math.min(I.x,M.x,A.x,D.x),T.x2=Math.max(I.x,M.x,A.x,D.x),T.y1=Math.min(I.y,M.y,A.y,D.y),T.y2=Math.max(I.y,M.y,A.y,D.y)}e.emplaceBack(i.x,i.y,T.x1,T.y1,T.x2,T.y2,s,o,l)}this.boxEndIndex=e.length}}class b_{constructor(e=[],i=(s,o)=>s<o?-1:s>o?1:0){if(this.data=e,this.length=this.data.length,this.compare=i,this.length>0)for(let s=(this.length>>1)-1;s>=0;s--)this._down(s)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;const e=this.data[0],i=this.data.pop();return--this.length>0&&(this.data[0]=i,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:i,compare:s}=this,o=i[e];for(;e>0;){const l=e-1>>1,u=i[l];if(s(o,u)>=0)break;i[e]=u,e=l}i[e]=o}_down(e){const{data:i,compare:s}=this,o=this.length>>1,l=i[e];for(;e<o;){let u=1+(e<<1);const d=u+1;if(d<this.length&&s(i[d],i[u])<0&&(u=d),s(i[u],l)>=0)break;i[e]=i[u],e=u}i[e]=l}}function w_(r,e=1){const i=no.fromPoints(r[0]),s=Math.min(i.width(),i.height());let o=s/2;const l=new b_([],T_),{minX:u,minY:d,maxX:g,maxY:m}=i;if(s===0)return new Te(u,d);for(let T=u;T<g;T+=s)for(let b=d;b<m;b+=s)l.push(new Ia(T+o,b+o,o,r));const v=(function(T){let b=0,I=0,M=0;const A=T[0];for(let D=0,F=A.length,k=F-1;D<F;k=D++){const L=A[D],O=A[k],j=L.x*O.y-O.x*L.y;I+=(L.x+O.x)*j,M+=(L.y+O.y)*j,b+=3*j}return new Ia(I/b,M/b,0,T)})(r);let _=v;for(;l.length;){const T=l.pop();(T.d>_.d||!_.d)&&(_=T),T.max-_.d<=e||(o=T.h/2,l.push(new Ia(T.p.x-o,T.p.y-o,o,r)),l.push(new Ia(T.p.x+o,T.p.y-o,o,r)),l.push(new Ia(T.p.x-o,T.p.y+o,o,r)),l.push(new Ia(T.p.x+o,T.p.y+o,o,r)))}return v.d>0&&_.d-v.d<=e?v.p:_.p}function T_(r,e){return e.max-r.max}class Ia{constructor(e,i,s,o){this.p=new Te(e,i),this.h=s,this.d=(function(l,u){let d=!1,g=1/0;for(const m of u)for(let v=0,_=m.length,T=_-1;v<_;T=v++){const b=m[v],I=m[T];b.y>l.y!=I.y>l.y&&l.x<(I.x-b.x)*(l.y-b.y)/(I.y-b.y)+b.x&&(d=!d),g=Math.min(g,yd(l,b,I))}return(d?1:-1)*Math.sqrt(g)})(this.p,o),this.max=this.d+this.h*Math.SQRT2}}var ii;R.aM=void 0,(ii=R.aM||(R.aM={}))[ii.center=1]="center",ii[ii.left=2]="left",ii[ii.right=3]="right",ii[ii.top=4]="top",ii[ii.bottom=5]="bottom",ii[ii["top-left"]=6]="top-left",ii[ii["top-right"]=7]="top-right",ii[ii["bottom-left"]=8]="bottom-left",ii[ii["bottom-right"]=9]="bottom-right";const pd=Number.POSITIVE_INFINITY;function Cf(r,e){return e[1]!==pd?(function(i,s,o){let l=0,u=0;switch(s=Math.abs(s),o=Math.abs(o),i){case"top-right":case"top-left":case"top":u=o-7;break;case"bottom-right":case"bottom-left":case"bottom":u=7-o}switch(i){case"top-right":case"bottom-right":case"right":l=-s;break;case"top-left":case"bottom-left":case"left":l=s}return[l,u]})(r,e[0],e[1]):(function(i,s){let o=0,l=0;s<0&&(s=0);const u=s/Math.SQRT2;switch(i){case"top-right":case"top-left":l=u-7;break;case"bottom-right":case"bottom-left":l=7-u;break;case"bottom":l=7-s;break;case"top":l=s-7}switch(i){case"top-right":case"bottom-right":o=-u;break;case"top-left":case"bottom-left":o=u;break;case"left":o=s;break;case"right":o=-s}return[o,l]})(r,e[0])}function Af(r,e,i){var s;const o=r.layout,l=(s=o.get("text-variable-anchor-offset"))===null||s===void 0?void 0:s.evaluate(e,{},i);if(l){const d=l.values,g=[];for(let m=0;m<d.length;m+=2){const v=g[m]=d[m],_=d[m+1].map((T=>T*Ot));v.startsWith("top")?_[1]-=7:v.startsWith("bottom")&&(_[1]+=7),g[m+1]=_}return new oi(g)}const u=o.get("text-variable-anchor");if(u){let d;d=r._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[o.get("text-radial-offset").evaluate(e,{},i)*Ot,pd]:o.get("text-offset").evaluate(e,{},i).map((m=>m*Ot));const g=[];for(const m of u)g.push(m,Cf(m,d));return new oi(g)}return null}function fd(r){switch(r){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function S_(r,e,i,s,o,l,u,d,g,m,v,_){let T=l.textMaxSize.evaluate(e,{});T===void 0&&(T=u);const b=r.layers[0].layout,I=b.get("icon-offset").evaluate(e,{},v),M=zf(i.horizontal),A=u/24,D=r.tilePixelRatio*A,F=r.tilePixelRatio*T/24,k=r.tilePixelRatio*d,L=r.tilePixelRatio*b.get("symbol-spacing"),O=b.get("text-padding")*r.tilePixelRatio,j=(function(xe,ye,me,Ae=1){const Xe=xe.get("icon-padding").evaluate(ye,{},me),Ke=Xe?.values;return[Ke[0]*Ae,Ke[1]*Ae,Ke[2]*Ae,Ke[3]*Ae]})(b,e,v,r.tilePixelRatio),Y=b.get("text-max-angle")/180*Math.PI,J=b.get("text-rotation-alignment")!=="viewport"&&b.get("symbol-placement")!=="point",re=b.get("icon-rotation-alignment")==="map"&&b.get("symbol-placement")!=="point",te=b.get("symbol-placement"),ae=L/2,le=b.get("icon-text-fit");let ne;s&&le!=="none"&&(r.allowVerticalPlacement&&i.vertical&&(ne=Tp(s,i.vertical,le,b.get("icon-text-fit-padding"),I,A)),M&&(s=Tp(s,M,le,b.get("icon-text-fit-padding"),I,A)));const ie=v?_.line.getGranularityForZoomLevel(v.z):1,fe=(xe,ye)=>{ye.x<0||ye.x>=De||ye.y<0||ye.y>=De||(function(me,Ae,Xe,Ke,it,ri,bt,Rt,jt,ht,Yt,di,pi,zi,ni,ki,or,Nt,gt,Dt,wt,Ut,Mn,vr,ic){const ps=me.addToLineVertexArray(Ae,Xe);let oo,Ma,Ea,Ca,kf=0,Rf=0,Ff=0,Lf=0,md=-1,gd=-1;const En={};let Bf=Bt("");if(me.allowVerticalPlacement&&Ke.vertical){const fi=Rt.layout.get("text-rotate").evaluate(wt,{},vr)+90;Ea=new Du(jt,Ae,ht,Yt,di,Ke.vertical,pi,zi,ni,fi),bt&&(Ca=new Du(jt,Ae,ht,Yt,di,bt,or,Nt,ni,fi))}if(it){const fi=Rt.layout.get("icon-rotate").evaluate(wt,{}),Qi=Rt.layout.get("icon-text-fit")!=="none",ao=Mf(it,fi,Mn,Qi),br=bt?Mf(bt,fi,Mn,Qi):void 0;Ma=new Du(jt,Ae,ht,Yt,di,it,or,Nt,!1,fi),kf=4*ao.length;const lo=me.iconSizeData;let Gr=null;lo.kind==="source"?(Gr=[Pn*Rt.layout.get("icon-size").evaluate(wt,{})],Gr[0]>as&&$t(`${me.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):lo.kind==="composite"&&(Gr=[Pn*Ut.compositeIconSizes[0].evaluate(wt,{},vr),Pn*Ut.compositeIconSizes[1].evaluate(wt,{},vr)],(Gr[0]>as||Gr[1]>as)&&$t(`${me.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),me.addSymbols(me.icon,ao,Gr,Dt,gt,wt,R.ax.none,Ae,ps.lineStartIndex,ps.lineLength,-1,vr),md=me.icon.placedSymbolArray.length-1,br&&(Rf=4*br.length,me.addSymbols(me.icon,br,Gr,Dt,gt,wt,R.ax.vertical,Ae,ps.lineStartIndex,ps.lineLength,-1,vr),gd=me.icon.placedSymbolArray.length-1)}const Of=Object.keys(Ke.horizontal);for(const fi of Of){const Qi=Ke.horizontal[fi];if(!oo){Bf=Bt(Qi.text);const br=Rt.layout.get("text-rotate").evaluate(wt,{},vr);oo=new Du(jt,Ae,ht,Yt,di,Qi,pi,zi,ni,br)}const ao=Qi.positionedLines.length===1;if(Ff+=Df(me,Ae,Qi,ri,Rt,ni,wt,ki,ps,Ke.vertical?R.ax.horizontal:R.ax.horizontalOnly,ao?Of:[fi],En,md,Ut,vr),ao)break}Ke.vertical&&(Lf+=Df(me,Ae,Ke.vertical,ri,Rt,ni,wt,ki,ps,R.ax.vertical,["vertical"],En,gd,Ut,vr));const I_=oo?oo.boxStartIndex:me.collisionBoxArray.length,M_=oo?oo.boxEndIndex:me.collisionBoxArray.length,E_=Ea?Ea.boxStartIndex:me.collisionBoxArray.length,C_=Ea?Ea.boxEndIndex:me.collisionBoxArray.length,A_=Ma?Ma.boxStartIndex:me.collisionBoxArray.length,D_=Ma?Ma.boxEndIndex:me.collisionBoxArray.length,z_=Ca?Ca.boxStartIndex:me.collisionBoxArray.length,k_=Ca?Ca.boxEndIndex:me.collisionBoxArray.length;let xr=-1;const zu=(fi,Qi)=>fi?.circleDiameter?Math.max(fi.circleDiameter,Qi):Qi;xr=zu(oo,xr),xr=zu(Ea,xr),xr=zu(Ma,xr),xr=zu(Ca,xr);const Vf=xr>-1?1:0;Vf&&(xr*=ic/Ot),me.glyphOffsetArray.length>=ga.MAX_GLYPHS&&$t("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),wt.sortKey!==void 0&&me.addToSortKeyRanges(me.symbolInstances.length,wt.sortKey);const R_=Af(Rt,wt,vr),[F_,L_]=(function(fi,Qi){const ao=fi.length,br=Qi?.values;if(br?.length>0)for(let lo=0;lo<br.length;lo+=2){const Gr=br[lo+1];fi.emplaceBack(R.aM[br[lo]],Gr[0],Gr[1])}return[ao,fi.length]})(me.textAnchorOffsets,R_);me.symbolInstances.emplaceBack(Ae.x,Ae.y,En.right>=0?En.right:-1,En.center>=0?En.center:-1,En.left>=0?En.left:-1,En.vertical||-1,md,gd,Bf,I_,M_,E_,C_,A_,D_,z_,k_,ht,Ff,Lf,kf,Rf,Vf,0,pi,xr,F_,L_)})(r,ye,xe,i,s,o,ne,r.layers[0],r.collisionBoxArray,e.index,e.sourceLayerIndex,r.index,D,[O,O,O,O],J,g,k,j,re,I,e,l,m,v,u)};if(te==="line")for(const xe of vf(e.geometry,0,0,De,De)){const ye=ro(xe,ie),me=x_(ye,L,Y,i.vertical||M,s,24,F,r.overscaling,De);for(const Ae of me)M&&P_(r,M.text,ae,Ae)||fe(ye,Ae)}else if(te==="line-center"){for(const xe of e.geometry)if(xe.length>1){const ye=ro(xe,ie),me=v_(ye,Y,i.vertical||M,s,24,F);me&&fe(ye,me)}}else if(e.type==="Polygon")for(const xe of Co(e.geometry,0)){const ye=w_(xe,16);fe(ro(xe[0],ie,!0),new ds(ye.x,ye.y,0))}else if(e.type==="LineString")for(const xe of e.geometry){const ye=ro(xe,ie);fe(ye,new ds(ye[0].x,ye[0].y,0))}else if(e.type==="Point")for(const xe of e.geometry)for(const ye of xe)fe([ye],new ds(ye.x,ye.y,0))}function Df(r,e,i,s,o,l,u,d,g,m,v,_,T,b,I){const M=(function(F,k,L,O,j,Y,J,re){const te=O.layout.get("text-rotate").evaluate(Y,{})*Math.PI/180,ae=[];for(const le of k.positionedLines)for(const ne of le.positionedGlyphs){if(!ne.rect)continue;const ie=ne.rect||{};let fe=4,xe=!0,ye=1,me=0;const Ae=(j||re)&&ne.vertical,Xe=ne.metrics.advance*ne.scale/2;if(re&&k.verticalizable&&(me=le.lineOffset/2-(ne.imageName?-(Ot-ne.metrics.width*ne.scale)/2:(ne.scale-1)*Ot)),ne.imageName){const Nt=J[ne.imageName];xe=Nt.sdf,ye=Nt.pixelRatio,fe=1/ye}const Ke=j?[ne.x+Xe,ne.y]:[0,0];let it=j?[0,0]:[ne.x+Xe+L[0],ne.y+L[1]-me],ri=[0,0];Ae&&(ri=it,it=[0,0]);const bt=ne.metrics.isDoubleResolution?2:1,Rt=(ne.metrics.left-fe)*ne.scale-Xe+it[0],jt=(-ne.metrics.top-fe)*ne.scale+it[1],ht=Rt+ie.w/bt*ne.scale/ye,Yt=jt+ie.h/bt*ne.scale/ye,di=new Te(Rt,jt),pi=new Te(ht,jt),zi=new Te(Rt,Yt),ni=new Te(ht,Yt);if(Ae){const Nt=new Te(-Xe,Xe- -17),gt=-Math.PI/2,Dt=12-Xe,wt=new Te(22-Dt,-(ne.imageName?Dt:0)),Ut=new Te(...ri);di._rotateAround(gt,Nt)._add(wt)._add(Ut),pi._rotateAround(gt,Nt)._add(wt)._add(Ut),zi._rotateAround(gt,Nt)._add(wt)._add(Ut),ni._rotateAround(gt,Nt)._add(wt)._add(Ut)}if(te){const Nt=Math.sin(te),gt=Math.cos(te),Dt=[gt,-Nt,Nt,gt];di._matMult(Dt),pi._matMult(Dt),zi._matMult(Dt),ni._matMult(Dt)}const ki=new Te(0,0),or=new Te(0,0);ae.push({tl:di,tr:pi,bl:zi,br:ni,tex:ie,writingMode:k.writingMode,glyphOffset:Ke,sectionIndex:ne.sectionIndex,isSDF:xe,pixelOffsetTL:ki,pixelOffsetBR:or,minFontScaleX:0,minFontScaleY:0})}return ae})(0,i,d,o,l,u,s,r.allowVerticalPlacement),A=r.textSizeData;let D=null;A.kind==="source"?(D=[Pn*o.layout.get("text-size").evaluate(u,{})],D[0]>as&&$t(`${r.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):A.kind==="composite"&&(D=[Pn*b.compositeTextSizes[0].evaluate(u,{},I),Pn*b.compositeTextSizes[1].evaluate(u,{},I)],(D[0]>as||D[1]>as)&&$t(`${r.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),r.addSymbols(r.text,M,D,d,l,u,m,e,g.lineStartIndex,g.lineLength,T,I);for(const F of v)_[F]=r.text.placedSymbolArray.length-1;return 4*M.length}function zf(r){for(const e in r)return r[e];return null}function P_(r,e,i,s){const o=r.compareText;if(e in o){const l=o[e];for(let u=l.length-1;u>=0;u--)if(s.dist(l[u])<i)return!0}else o[e]=[];return o[e].push(s),!1}R.$=rc,R.A=zt,R.B=Wo,R.C=Xc,R.D=Ie,R.E=po,R.F=ir,R.G=function([r,e,i]){return e+=90,e*=Math.PI/180,i*=Math.PI/180,{x:r*Math.cos(e)*Math.sin(i),y:r*Math.sin(e)*Math.sin(i),z:r*Math.cos(i)}},R.H=Mi,R.I=Vh,R.J=at,R.K=Zs,R.L=function(r){if(mi==null){const e=r.navigator?r.navigator.userAgent:null;mi=!!r.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return mi},R.M=Li,R.N=class{constructor(r,e){this.target=r,this.mapId=e,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new Lg((()=>this.process())),this.subscription=co(this.target,"message",(i=>this.receive(i)),!1),this.globalScope=Zt(self)?r:window}registerMessageHandler(r,e){this.messageHandlers[r]=e}unregisterMessageHandler(r){delete this.messageHandlers[r]}sendAsync(r,e){return new Promise(((i,s)=>{const o=Math.round(1e18*Math.random()).toString(36).substring(0,10),l=e?co(e.signal,"abort",(()=>{l?.unsubscribe(),delete this.resolveRejects[o];const g={id:o,type:"<cancel>",origin:location.origin,targetMapId:r.targetMapId,sourceMapId:this.mapId};this.target.postMessage(g)}),Bg):null;this.resolveRejects[o]={resolve:g=>{l?.unsubscribe(),i(g)},reject:g=>{l?.unsubscribe(),s(g)}};const u=[],d=Object.assign(Object.assign({},r),{id:o,sourceMapId:this.mapId,origin:location.origin,data:dr(r.data,u)});this.target.postMessage(d,{transfer:u})}))}receive(r){const e=r.data,i=e.id,s=["file://","resource://android","null"],o=[e.origin,location.origin],l=e.origin===location.origin,u=o.some((d=>s.includes(d)));if((l||u)&&(!e.targetMapId||this.mapId===e.targetMapId)){if(e.type==="<cancel>"){delete this.tasks[i];const d=this.abortControllers[i];return delete this.abortControllers[i],void(d&&d.abort())}if(Zt(self)||e.mustQueue)return this.tasks[i]=e,this.taskQueue.push(i),void this.invoker.trigger();this.processTask(i,e)}}process(){if(this.taskQueue.length===0)return;const r=this.taskQueue.shift(),e=this.tasks[r];delete this.tasks[r],this.taskQueue.length>0&&this.invoker.trigger(),e&&this.processTask(r,e)}processTask(r,e){return p(this,void 0,void 0,(function*(){if(e.type==="<response>"){const o=this.resolveRejects[r];return delete this.resolveRejects[r],o?void(e.error?o.reject(yt(Ws(e.error))):o.resolve(Ws(e.data))):void 0}if(!this.messageHandlers[e.type])return void this.completeTask(r,new Error(`Could not find a registered handler for ${e.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const i=Ws(e.data),s=new AbortController;this.abortControllers[r]=s;try{const o=yield this.messageHandlers[e.type](e.sourceMapId,i,s);this.completeTask(r,null,o)}catch(o){this.completeTask(r,yt(o))}}))}completeTask(r,e,i){const s=[];delete this.abortControllers[r];const o={id:r,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:e?dr(e):null,data:dr(i,s)};this.target.postMessage(o,{transfer:s})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},R.O=function(){var r=new zt(16);return zt!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=0,r[12]=0,r[13]=0,r[14]=0),r[0]=1,r[5]=1,r[10]=1,r[15]=1,r},R.P=Te,R.Q=function(r,e,i){var s,o,l,u,d,g,m,v,_,T,b,I,M=i[0],A=i[1],D=i[2];return e===r?(r[12]=e[0]*M+e[4]*A+e[8]*D+e[12],r[13]=e[1]*M+e[5]*A+e[9]*D+e[13],r[14]=e[2]*M+e[6]*A+e[10]*D+e[14],r[15]=e[3]*M+e[7]*A+e[11]*D+e[15]):(o=e[1],l=e[2],u=e[3],d=e[4],g=e[5],m=e[6],v=e[7],_=e[8],T=e[9],b=e[10],I=e[11],r[0]=s=e[0],r[1]=o,r[2]=l,r[3]=u,r[4]=d,r[5]=g,r[6]=m,r[7]=v,r[8]=_,r[9]=T,r[10]=b,r[11]=I,r[12]=s*M+d*A+_*D+e[12],r[13]=o*M+g*A+T*D+e[13],r[14]=l*M+m*A+b*D+e[14],r[15]=u*M+v*A+I*D+e[15]),r},R.R=Di,R.S=function(r,e,i){var s=i[0],o=i[1],l=i[2];return r[0]=e[0]*s,r[1]=e[1]*s,r[2]=e[2]*s,r[3]=e[3]*s,r[4]=e[4]*o,r[5]=e[5]*o,r[6]=e[6]*o,r[7]=e[7]*o,r[8]=e[8]*l,r[9]=e[9]*l,r[10]=e[10]*l,r[11]=e[11]*l,r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r},R.T=mh,R.U=function(r,e,i){var s=e[0],o=e[1],l=e[2],u=e[3],d=e[4],g=e[5],m=e[6],v=e[7],_=e[8],T=e[9],b=e[10],I=e[11],M=e[12],A=e[13],D=e[14],F=e[15],k=i[0],L=i[1],O=i[2],j=i[3];return r[0]=k*s+L*d+O*_+j*M,r[1]=k*o+L*g+O*T+j*A,r[2]=k*l+L*m+O*b+j*D,r[3]=k*u+L*v+O*I+j*F,r[4]=(k=i[4])*s+(L=i[5])*d+(O=i[6])*_+(j=i[7])*M,r[5]=k*o+L*g+O*T+j*A,r[6]=k*l+L*m+O*b+j*D,r[7]=k*u+L*v+O*I+j*F,r[8]=(k=i[8])*s+(L=i[9])*d+(O=i[10])*_+(j=i[11])*M,r[9]=k*o+L*g+O*T+j*A,r[10]=k*l+L*m+O*b+j*D,r[11]=k*u+L*v+O*I+j*F,r[12]=(k=i[12])*s+(L=i[13])*d+(O=i[14])*_+(j=i[15])*M,r[13]=k*o+L*g+O*T+j*A,r[14]=k*l+L*m+O*b+j*D,r[15]=k*u+L*v+O*I+j*F,r},R.V=function(r,e){const i={};for(const s of e)s in r&&(i[s]=r[s]);return i},R.W=ls,R.X=Dn,R.Y=zp,R.Z=Dp,R._=p,R.a=ys,R.a$=function(r){var e=new zt(3);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e},R.a0=Wr,R.a1=Ti,R.a2=ka,R.a3=Ni,R.a4=Rp,R.a5=Pu,R.a6=De,R.a7=Jl,R.a8=no,R.a9=25,R.aA=function(r){var e=r[0],i=r[1];return Math.sqrt(e*e+i*i)},R.aB=function(r){return r[0]=0,r[1]=0,r},R.aC=function(r,e,i){return r[0]=e[0]*i,r[1]=e[1]*i,r},R.aD=Uh,R.aE=$e,R.aF=function(r,e,i,s){const o=e.y-r.y,l=e.x-r.x,u=s.y-i.y,d=s.x-i.x,g=u*l-d*o;if(g===0)return null;const m=(d*(r.y-i.y)-u*(r.x-i.x))/g;return new Te(r.x+m*l,r.y+m*o)},R.aG=vf,R.aH=sa,R.aI=function(r){let e=1/0,i=1/0,s=-1/0,o=-1/0;for(const l of r)e=Math.min(e,l.x),i=Math.min(i,l.y),s=Math.max(s,l.x),o=Math.max(o,l.y);return[e,i,s,o]},R.aJ=Ot,R.aK=_t,R.aL=function(r,e,i,s,o=!1){if(!i[0]&&!i[1])return[0,0];const l=o?s==="map"?-r.bearingInRadians:0:s==="viewport"?r.bearingInRadians:0;if(l){const u=Math.sin(l),d=Math.cos(l);i=[i[0]*d-i[1]*u,i[0]*u+i[1]*d]}return[o?i[0]:_t(e,i[0],r.zoom),o?i[1]:_t(e,i[1],r.zoom)]},R.aN=Nh,R.aO=fd,R.aP=jh,R.aQ=r=>r.type==="symbol",R.aR=mu,R.aS=lt,R.aT=fu,R.aU=V,R.aV=we,R.aW=he,R.aX=Jr,R.aY=Fp,R.aZ=K,R.a_=W,R.aa=Wh,R.ab=r=>{const e=window.document.createElement("video");return e.muted=!0,new Promise((i=>{e.onloadstart=()=>{i(e)};for(const s of r){const o=window.document.createElement("source");qi(s)||(e.crossOrigin="Anonymous"),o.src=s,e.appendChild(o)}}))},R.ac=_e,R.ad=function(){return _s++},R.ae=c,R.af=ga,R.ag=tc,R.ah=Bs,R.ai=Ur,R.aj=Vp,R.ak=function(r){const e={};if(r.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,((i,s,o,l)=>{const u=o||l;return e[s]=!u||u.toLowerCase(),""})),e["max-age"]){const i=parseInt(e["max-age"],10);isNaN(i)?delete e["max-age"]:e["max-age"]=i}return e},R.al=si,R.am=85.051129,R.an=Mr,R.ao=function(r){return Math.pow(2,r)},R.ap=An,R.aq=kp,R.ar=function(r){return Math.log(r)/Math.LN2},R.as=function(r){var e=r[0],i=r[1];return e*e+i*i},R.at=function(r){if(!r.length)return new Set;const e=Math.max(...r.map((g=>g.canonical.z)));let i=1/0,s=-1/0,o=1/0,l=-1/0;const u=[];for(const g of r){const{x:m,y:v,z:_}=g.canonical,T=Math.pow(2,e-_),b=m*T,I=v*T;u.push({id:g,x:b,y:I}),b<i&&(i=b),b>s&&(s=b),I<o&&(o=I),I>l&&(l=I)}const d=new Set;for(const g of u)g.x!==i&&g.x!==s&&g.y!==o&&g.y!==l||d.add(g.id);return d},R.au=function(r,e){const i=Math.abs(2*r.wrap)-+(r.wrap<0),s=Math.abs(2*e.wrap)-+(e.wrap<0);return r.overscaledZ-e.overscaledZ||s-i||e.canonical.y-r.canonical.y||e.canonical.x-r.canonical.x},R.av=class{constructor(r,e){this.max=r,this.onRemove=e,this.reset()}reset(){for(const r in this.data)for(const e of this.data[r])e.timeout&&clearTimeout(e.timeout),this.onRemove(e.value);return this.data={},this.order=[],this}add(r,e,i){const s=r.wrapped().key;this.data[s]===void 0&&(this.data[s]=[]);const o={value:e,timeout:void 0};if(i!==void 0&&(o.timeout=setTimeout((()=>{this.remove(r,o)}),i)),this.data[s].push(o),this.order.push(s),this.order.length>this.max){const l=this._getAndRemoveByKey(this.order[0]);l&&this.onRemove(l)}return this}has(r){return r.wrapped().key in this.data}getAndRemove(r){return this.has(r)?this._getAndRemoveByKey(r.wrapped().key):null}_getAndRemoveByKey(r){const e=this.data[r].shift();return e.timeout&&clearTimeout(e.timeout),this.data[r].length===0&&delete this.data[r],this.order.splice(this.order.indexOf(r),1),e.value}getByKey(r){const e=this.data[r];return e?e[0].value:null}get(r){return this.has(r)?this.data[r.wrapped().key][0].value:null}remove(r,e){if(!this.has(r))return this;const i=r.wrapped().key,s=e===void 0?0:this.data[i].indexOf(e),o=this.data[i][s];return this.data[i].splice(s,1),o.timeout&&clearTimeout(o.timeout),this.data[i].length===0&&delete this.data[i],this.onRemove(o.value),this.order.splice(this.order.indexOf(i),1),this}setMaxSize(r){for(this.max=r;this.order.length>this.max;){const e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}filter(r){const e=[];for(const i in this.data)for(const s of this.data[i])r(s.value)||e.push(s);for(const i of e)this.remove(i.value.tileID,i)}},R.aw=function(r,e){let i=0,s=0;if(r.kind==="constant")s=r.layoutSize;else if(r.kind!=="source"){const{interpolationType:o,minZoom:l,maxZoom:u}=r,d=o?si(It.interpolationFactor(o,e,l,u),0,1):0;r.kind==="camera"?s=Mi.number(r.minSize,r.maxSize,d):i=d}return{uSizeT:i,uSize:s}},R.ay=function(r,{uSize:e,uSizeT:i},{lowerSize:s,upperSize:o}){return r.kind==="source"?s/Pn:r.kind==="composite"?Mi.number(s/Pn,o/Pn,i):e},R.az=Le,R.b=Kr,R.b$=ia,R.b0=function(r,e,i){return r[0]=e[0]-i[0],r[1]=e[1]-i[1],r[2]=e[2]-i[2],r},R.b1=function(r,e){var i=e[0],s=e[1],o=e[2],l=i*i+s*s+o*o;return l>0&&(l=1/Math.sqrt(l)),r[0]=e[0]*l,r[1]=e[1]*l,r[2]=e[2]*l,r},R.b2=ee,R.b3=function(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]},R.b4=function(r,e,i){return r[0]=e[0]*i[0],r[1]=e[1]*i[1],r[2]=e[2]*i[2],r[3]=e[3]*i[3],r},R.b5=ms,R.b6=function(r,e,i){const s=e[0]*i[0]+e[1]*i[1]+e[2]*i[2];return s===0?null:(-(r[0]*i[0]+r[1]*i[1]+r[2]*i[2])-i[3])/s},R.b7=Me,R.b8=function(r,e,i){return r[0]=e[0]*i,r[1]=e[1]*i,r[2]=e[2]*i,r[3]=e[3]*i,r},R.b9=function(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]+r[3]},R.bA=Ge,R.bB=function(r,e,i){var s=i[0],o=i[1],l=i[2],u=i[3],d=e[0],g=e[1],m=e[2],v=o*m-l*g,_=l*d-s*m,T=s*g-o*d;return r[0]=d+u*(v+=v)+o*(T+=T)-l*(_+=_),r[1]=g+u*_+l*v-s*T,r[2]=m+u*T+s*_-o*v,r},R.bC=function(r,e,i){const s=(o=[r[0],r[1],r[2],e[0],e[1],e[2],i[0],i[1],i[2]])[0]*((v=o[8])*(u=o[4])-(d=o[5])*(m=o[7]))+o[1]*(-v*(l=o[3])+d*(g=o[6]))+o[2]*(m*l-u*g);var o,l,u,d,g,m,v;if(s===0)return null;const _=ee([],[e[0],e[1],e[2]],[i[0],i[1],i[2]]),T=ee([],[i[0],i[1],i[2]],[r[0],r[1],r[2]]),b=ee([],[r[0],r[1],r[2]],[e[0],e[1],e[2]]),I=K([],_,-r[3]);return W(I,I,K([],T,-e[3])),W(I,I,K([],b,-i[3])),K(I,I,1/s),I},R.bD=qh,R.bE=function(){return new Float64Array(4)},R.bF=function(r,e,i,s){var o=[],l=[];return o[0]=e[0]-i[0],o[1]=e[1]-i[1],o[2]=e[2]-i[2],l[0]=o[0]*Math.cos(s)-o[1]*Math.sin(s),l[1]=o[0]*Math.sin(s)+o[1]*Math.cos(s),l[2]=o[2],r[0]=l[0]+i[0],r[1]=l[1]+i[1],r[2]=l[2]+i[2],r},R.bG=function(r,e,i,s){var o=[],l=[];return o[0]=e[0]-i[0],o[1]=e[1]-i[1],o[2]=e[2]-i[2],l[0]=o[0],l[1]=o[1]*Math.cos(s)-o[2]*Math.sin(s),l[2]=o[1]*Math.sin(s)+o[2]*Math.cos(s),r[0]=l[0]+i[0],r[1]=l[1]+i[1],r[2]=l[2]+i[2],r},R.bH=function(r,e,i,s){var o=[],l=[];return o[0]=e[0]-i[0],o[1]=e[1]-i[1],o[2]=e[2]-i[2],l[0]=o[2]*Math.sin(s)+o[0]*Math.cos(s),l[1]=o[1],l[2]=o[2]*Math.cos(s)-o[0]*Math.sin(s),r[0]=l[0]+i[0],r[1]=l[1]+i[1],r[2]=l[2]+i[2],r},R.bI=function(r,e,i){var s=Math.sin(i),o=Math.cos(i),l=e[0],u=e[1],d=e[2],g=e[3],m=e[8],v=e[9],_=e[10],T=e[11];return e!==r&&(r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[0]=l*o-m*s,r[1]=u*o-v*s,r[2]=d*o-_*s,r[3]=g*o-T*s,r[8]=l*s+m*o,r[9]=u*s+v*o,r[10]=d*s+_*o,r[11]=g*s+T*o,r},R.bJ=function(r,e){const i=Zi(r,360),s=Zi(e,360),o=s-i,l=s>i?o-360:o+360;return Math.abs(o)<Math.abs(l)?o:l},R.bK=function(r){return r[0]=0,r[1]=0,r[2]=0,r},R.bL=function(r,e,i,s){const o=Math.sqrt(r*r+e*e),l=Math.sqrt(i*i+s*s);r/=o,e/=o,i/=l,s/=l;const u=Math.acos(r*i+e*s);return-e*i+r*s>0?u:-u},R.bM=function(r,e){const i=Zi(r,2*Math.PI),s=Zi(e,2*Math.PI);return Math.min(Math.abs(i-s),Math.abs(i-s+2*Math.PI),Math.abs(i-s-2*Math.PI))},R.bN=function(){const r={},e=ce.$version;for(const i in ce.$root){const s=ce.$root[i];if(s.required){let o=null;o=i==="version"?e:s.type==="array"?[]:{},o!=null&&(r[i]=o)}}return r},R.bO=La,R.bP=xl,R.bQ=function r(e,i){if(Array.isArray(e)){if(!Array.isArray(i)||e.length!==i.length)return!1;for(let s=0;s<e.length;s++)if(!r(e[s],i[s]))return!1;return!0}if(typeof e=="object"&&e!==null&&i!==null){if(typeof i!="object"||Object.keys(e).length!==Object.keys(i).length)return!1;for(const s in e)if(!r(e[s],i[s]))return!1;return!0}return e===i},R.bR=ho,R.bS=function(r){r=r.slice();const e=Object.create(null);for(let i=0;i<r.length;i++)e[r[i].id]=r[i];for(let i=0;i<r.length;i++)"ref"in r[i]&&(r[i]=Oa(r[i],e[r[i].ref]));return r},R.bT=function(r,e){if(r.type==="custom")return new Fg(r,e);switch(r.type){case"background":return new Rg(r,e);case"circle":return new Jf(r,e);case"color-relief":return new nm(r,e);case"fill":return new vm(r,e);case"fill-extrusion":return new Dm(r,e);case"heatmap":return new em(r,e);case"hillshade":return new im(r,e);case"line":return new rg(r,e);case"raster":return new ah(r,e);case"symbol":return new Su(r,e)}},R.bU=r=>r.type==="raster",R.bV=ke,R.bW=function(r,e){if(!r)return[{command:"setStyle",args:[e]}];let i=[];try{if(!et(r.version,e.version))return[{command:"setStyle",args:[e]}];et(r.center,e.center)||i.push({command:"setCenter",args:[e.center]}),et(r.state,e.state)||i.push({command:"setGlobalState",args:[e.state]}),et(r.centerAltitude,e.centerAltitude)||i.push({command:"setCenterAltitude",args:[e.centerAltitude]}),et(r.zoom,e.zoom)||i.push({command:"setZoom",args:[e.zoom]}),et(r.bearing,e.bearing)||i.push({command:"setBearing",args:[e.bearing]}),et(r.pitch,e.pitch)||i.push({command:"setPitch",args:[e.pitch]}),et(r.roll,e.roll)||i.push({command:"setRoll",args:[e.roll]}),et(r.sprite,e.sprite)||i.push({command:"setSprite",args:[e.sprite]}),et(r.glyphs,e.glyphs)||i.push({command:"setGlyphs",args:[e.glyphs]}),et(r.transition,e.transition)||i.push({command:"setTransition",args:[e.transition]}),et(r.light,e.light)||i.push({command:"setLight",args:[e.light]}),et(r.terrain,e.terrain)||i.push({command:"setTerrain",args:[e.terrain]}),et(r.sky,e.sky)||i.push({command:"setSky",args:[e.sky]}),et(r.projection,e.projection)||i.push({command:"setProjection",args:[e.projection]});const s={},o=[];(function(u,d,g,m){let v;for(v in d=d||{},u=u||{})Object.prototype.hasOwnProperty.call(u,v)&&(Object.prototype.hasOwnProperty.call(d,v)||nc(v,g,m));for(v in d)Object.prototype.hasOwnProperty.call(d,v)&&(Object.prototype.hasOwnProperty.call(u,v)?et(u[v],d[v])||(u[v].type==="geojson"&&d[v].type==="geojson"&&Fu(u,d,v)?gi(g,{command:"setGeoJSONSourceData",args:[v,d[v].data]}):sc(v,d,g,m)):tn(v,d,g))})(r.sources,e.sources,o,s);const l=[];r.layers&&r.layers.forEach((u=>{"source"in u&&s[u.source]?i.push({command:"removeLayer",args:[u.id]}):l.push(u)})),i=i.concat(o),(function(u,d,g){d=d||[];const m=(u=u||[]).map(Va),v=d.map(Va),_=u.reduce(oc,{}),T=d.reduce(oc,{}),b=m.slice(),I=Object.create(null);let M,A,D,F,k;for(let L=0,O=0;L<m.length;L++)M=m[L],Object.prototype.hasOwnProperty.call(T,M)?O++:(gi(g,{command:"removeLayer",args:[M]}),b.splice(b.indexOf(M,O),1));for(let L=0,O=0;L<v.length;L++)M=v[v.length-1-L],b[b.length-1-L]!==M&&(Object.prototype.hasOwnProperty.call(_,M)?(gi(g,{command:"removeLayer",args:[M]}),b.splice(b.lastIndexOf(M,b.length-O),1)):O++,F=b[b.length-L],gi(g,{command:"addLayer",args:[T[M],F]}),b.splice(b.length-L,0,M),I[M]=!0);for(let L=0;L<v.length;L++)if(M=v[L],A=_[M],D=T[M],!I[M]&&!et(A,D))if(et(A.source,D.source)&&et(A["source-layer"],D["source-layer"])&&et(A.type,D.type)){for(k in fo(A.layout,D.layout,g,M,null,"setLayoutProperty"),fo(A.paint,D.paint,g,M,null,"setPaintProperty"),et(A.filter,D.filter)||gi(g,{command:"setFilter",args:[M,D.filter]}),et(A.minzoom,D.minzoom)&&et(A.maxzoom,D.maxzoom)||gi(g,{command:"setLayerZoomRange",args:[M,D.minzoom,D.maxzoom]}),A)Object.prototype.hasOwnProperty.call(A,k)&&k!=="layout"&&k!=="paint"&&k!=="filter"&&k!=="metadata"&&k!=="minzoom"&&k!=="maxzoom"&&(k.indexOf("paint.")===0?fo(A[k],D[k],g,M,k.slice(6),"setPaintProperty"):et(A[k],D[k])||gi(g,{command:"setLayerProperty",args:[M,k,D[k]]}));for(k in D)Object.prototype.hasOwnProperty.call(D,k)&&!Object.prototype.hasOwnProperty.call(A,k)&&k!=="layout"&&k!=="paint"&&k!=="filter"&&k!=="metadata"&&k!=="minzoom"&&k!=="maxzoom"&&(k.indexOf("paint.")===0?fo(A[k],D[k],g,M,k.slice(6),"setPaintProperty"):et(A[k],D[k])||gi(g,{command:"setLayerProperty",args:[M,k,D[k]]}))}else gi(g,{command:"removeLayer",args:[M]}),F=b[b.lastIndexOf(M)+1],gi(g,{command:"addLayer",args:[D,F]})})(l,e.layers,i)}catch(s){console.warn("Unable to compute style diff:",s),i=[{command:"setStyle",args:[e]}]}return i},R.bX=function(r){const e=[],i=r.id;return i===void 0&&e.push({message:`layers.${i}: missing required property "id"`}),r.render===void 0&&e.push({message:`layers.${i}: missing required method "render"`}),r.renderingMode&&r.renderingMode!=="2d"&&r.renderingMode!=="3d"&&e.push({message:`layers.${i}: property "renderingMode" must be either "2d" or "3d"`}),e},R.bY=Pr,R.bZ=Yr,R.b_=class extends ei{constructor(r,e){super(r,e),this.current=0}set(r){this.current!==r&&(this.current=r,this.gl.uniform1i(this.location,r))}},R.ba=Bp,R.bb=_a,R.bc=function(r,e,i,s,o){var l=1/Math.tan(e/2);if(r[0]=l/i,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=l,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=-1,r[12]=0,r[13]=0,r[15]=0,o!=null&&o!==1/0){var u=1/(s-o);r[10]=(o+s)*u,r[14]=2*o*s*u}else r[10]=-1,r[14]=-2*s;return r},R.bd=function(r){var e=new zt(16);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[8]=r[8],e[9]=r[9],e[10]=r[10],e[11]=r[11],e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15],e},R.be=function(r,e,i){var s=Math.sin(i),o=Math.cos(i),l=e[0],u=e[1],d=e[2],g=e[3],m=e[4],v=e[5],_=e[6],T=e[7];return e!==r&&(r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[0]=l*o+m*s,r[1]=u*o+v*s,r[2]=d*o+_*s,r[3]=g*o+T*s,r[4]=m*o-l*s,r[5]=v*o-u*s,r[6]=_*o-d*s,r[7]=T*o-g*s,r},R.bf=function(r,e,i){var s=Math.sin(i),o=Math.cos(i),l=e[4],u=e[5],d=e[6],g=e[7],m=e[8],v=e[9],_=e[10],T=e[11];return e!==r&&(r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[4]=l*o+m*s,r[5]=u*o+v*s,r[6]=d*o+_*s,r[7]=g*o+T*s,r[8]=m*o-l*s,r[9]=v*o-u*s,r[10]=_*o-d*s,r[11]=T*o-g*s,r},R.bg=function(r,e){var i=e[0],s=e[1],o=e[2],l=e[3],u=e[4],d=e[5],g=e[6],m=e[7],v=e[8],_=e[9],T=e[10],b=e[11],I=e[12],M=e[13],A=e[14],D=e[15],F=i*d-s*u,k=i*g-o*u,L=i*m-l*u,O=s*g-o*d,j=s*m-l*d,Y=o*m-l*g,J=v*M-_*I,re=v*A-T*I,te=v*D-b*I,ae=_*A-T*M,le=_*D-b*M,ne=T*D-b*A,ie=F*ne-k*le+L*ae+O*te-j*re+Y*J;return ie?(r[0]=(d*ne-g*le+m*ae)*(ie=1/ie),r[1]=(o*le-s*ne-l*ae)*ie,r[2]=(M*Y-A*j+D*O)*ie,r[3]=(T*j-_*Y-b*O)*ie,r[4]=(g*te-u*ne-m*re)*ie,r[5]=(i*ne-o*te+l*re)*ie,r[6]=(A*L-I*Y-D*k)*ie,r[7]=(v*Y-T*L+b*k)*ie,r[8]=(u*le-d*te+m*J)*ie,r[9]=(s*te-i*le-l*J)*ie,r[10]=(I*j-M*L+D*F)*ie,r[11]=(_*L-v*j-b*F)*ie,r[12]=(d*re-u*ae-g*J)*ie,r[13]=(i*ae-s*re+o*J)*ie,r[14]=(M*k-I*O-A*F)*ie,r[15]=(v*O-_*k+T*F)*ie,r):null},R.bh=function(){const r=new Float32Array(16);return An(r),r},R.bi=function(){const r=new Float64Array(16);return An(r),r},R.bj=function(){return new Float64Array(16)},R.bk=function(r,e,i){const s=new Float64Array(4);return Ge(s,r,e-90,i),s},R.bl=function(r,e,i,s){var o,l,u,d,g,m=e[0],v=e[1],_=e[2],T=e[3],b=i[0],I=i[1],M=i[2],A=i[3];return(l=m*b+v*I+_*M+T*A)<0&&(l=-l,b=-b,I=-I,M=-M,A=-A),1-l>pe?(o=Math.acos(l),u=Math.sin(o),d=Math.sin((1-s)*o)/u,g=Math.sin(s*o)/u):(d=1-s,g=s),r[0]=d*m+g*b,r[1]=d*v+g*I,r[2]=d*_+g*M,r[3]=d*T+g*A,r},R.bm=function(r){const e=new Float64Array(9);var i,s,o,l,u,d,g,m,v,_,T,b,I,M,A,D,F,k;_=(o=(s=r)[0])*(g=o+o),T=(l=s[1])*g,I=(u=s[2])*g,M=u*(m=l+l),D=(d=s[3])*g,F=d*m,k=d*(v=u+u),(i=e)[0]=1-(b=l*m)-(A=u*v),i[3]=T-k,i[6]=I+F,i[1]=T+k,i[4]=1-_-A,i[7]=M-D,i[2]=I-F,i[5]=M+D,i[8]=1-_-b;const L=Jr(-Math.asin(si(e[2],-1,1)));let O,j;return Math.hypot(e[5],e[8])<.001?(O=0,j=-Jr(Math.atan2(e[3],e[4]))):(O=Jr(e[5]===0&&e[8]===0?0:Math.atan2(e[5],e[8])),j=Jr(e[1]===0&&e[0]===0?0:Math.atan2(e[1],e[0]))),{roll:O,pitch:L+90,bearing:j}},R.bn=function(r,e){return r.roll==e.roll&&r.pitch==e.pitch&&r.bearing==e.bearing},R.bo=Ve,R.bp=mr,R.bq=ua,R.br=$l,R.bs=ca,R.bt=Ri,R.bu=Sr,R.bv=ai,R.bw=function(r,e,i,s,o){return Ri(s,o,si((r-e)/(i-e),0,1))},R.bx=function(r,e,i,s){return r[0]=e[0]+i[0]*s,r[1]=e[1]+i[1]*s,r[2]=e[2]+i[2]*s,r},R.by=Zi,R.bz=function(){return new Float64Array(3)},R.c=Er,R.c$=Ls,R.c0=class extends ei{constructor(r,e){super(r,e),this.current=nr}set(r){if(r[12]!==this.current[12]||r[0]!==this.current[0])return this.current=r,void this.gl.uniformMatrix4fv(this.location,!1,r);for(let e=1;e<16;e++)if(r[e]!==this.current[e]){this.current=r,this.gl.uniformMatrix4fv(this.location,!1,r);break}}},R.c1=Vr,R.c2=class extends ei{constructor(r,e){super(r,e),this.current=[0,0,0]}set(r){r[0]===this.current[0]&&r[1]===this.current[1]&&r[2]===this.current[2]||(this.current=r,this.gl.uniform3f(this.location,r[0],r[1],r[2]))}},R.c3=class extends ei{constructor(r,e){super(r,e),this.current=[0,0]}set(r){r[0]===this.current[0]&&r[1]===this.current[1]||(this.current=r,this.gl.uniform2f(this.location,r[0],r[1]))}},R.c4=Hr,R.c5=function(r,e){var i=Math.sin(e),s=Math.cos(e);return r[0]=s,r[1]=i,r[2]=0,r[3]=-i,r[4]=s,r[5]=0,r[6]=0,r[7]=0,r[8]=1,r},R.c6=function(r,e,i){var s=e[0],o=e[1],l=e[2];return r[0]=s*i[0]+o*i[3]+l*i[6],r[1]=s*i[1]+o*i[4]+l*i[7],r[2]=s*i[2]+o*i[5]+l*i[8],r},R.c7=function(r,e,i,s,o,l,u){var d=1/(e-i),g=1/(s-o),m=1/(l-u);return r[0]=-2*d,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*g,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=2*m,r[11]=0,r[12]=(e+i)*d,r[13]=(o+s)*g,r[14]=(u+l)*m,r[15]=1,r},R.c8=class extends ei{constructor(r,e){super(r,e),this.current=new Array}set(r){if(r!=this.current){this.current=r;const e=new Float32Array(4*r.length);for(let i=0;i<r.length;i++)e[4*i]=r[i].r,e[4*i+1]=r[i].g,e[4*i+2]=r[i].b,e[4*i+3]=r[i].a;this.gl.uniform4fv(this.location,e)}}},R.c9=class extends ei{constructor(r,e){super(r,e),this.current=new Array}set(r){if(r!=this.current){this.current=r;const e=new Float32Array(r);this.gl.uniform1fv(this.location,e)}}},R.cA=function(r,e){return Ra[e]&&"touches"in r},R.cB=function(r){return Ra[r]||Fa[r]},R.cC=function(r,e,i){var s=e[0],o=e[1];return r[0]=i[0]*s+i[4]*o+i[12],r[1]=i[1]*s+i[5]*o+i[13],r},R.cD=function(r,e){const{x:i,y:s}=Jl.fromLngLat(e);return!(r<0||r>25||s<0||s>=1||i<0||i>=1)},R.cE=function(r,e){return r[0]=e[0],r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=e[1],r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=e[2],r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r},R.cF=class extends Xo{},R.cG=kn,R.cH=function(r,e){Er.REGISTERED_PROTOCOLS[r]=e},R.cI=function(r){delete Er.REGISTERED_PROTOCOLS[r]},R.cJ=function(r,e){const i={};for(let o=0;o<r.length;o++){const l=e&&e[r[o].id]||eh(r[o]);e&&(e[r[o].id]=l);let u=i[l];u||(u=i[l]=[]),u.push(r[o])}const s=[];for(const o in i)s.push(i[o]);return s},R.cK=Se,R.cL=Op,R.cM=_f,R.cN=xp,R.cO=function(r){var e,i;r.bucket.createArrays(),r.bucket.tilePixelRatio=De/(512*r.bucket.overscaling),r.bucket.compareText={},r.bucket.iconsNeedLinear=!1;const s=r.bucket.layers[0],o=s.layout,l=s._unevaluatedLayout._values,u={layoutIconSize:l["icon-size"].possiblyEvaluate(new at(r.bucket.zoom+1),r.canonical),layoutTextSize:l["text-size"].possiblyEvaluate(new at(r.bucket.zoom+1),r.canonical),textMaxSize:l["text-size"].possiblyEvaluate(new at(18))};if(r.bucket.textSizeData.kind==="composite"){const{minZoom:_,maxZoom:T}=r.bucket.textSizeData;u.compositeTextSizes=[l["text-size"].possiblyEvaluate(new at(_),r.canonical),l["text-size"].possiblyEvaluate(new at(T),r.canonical)]}if(r.bucket.iconSizeData.kind==="composite"){const{minZoom:_,maxZoom:T}=r.bucket.iconSizeData;u.compositeIconSizes=[l["icon-size"].possiblyEvaluate(new at(_),r.canonical),l["icon-size"].possiblyEvaluate(new at(T),r.canonical)]}const d=o.get("text-line-height")*Ot,g=o.get("text-rotation-alignment")!=="viewport"&&o.get("symbol-placement")!=="point",m=o.get("text-keep-upright"),v=o.get("text-size");for(const _ of r.bucket.features){const T=o.get("text-font").evaluate(_,{},r.canonical).join(","),b=v.evaluate(_,{},r.canonical),I=u.layoutTextSize.evaluate(_,{},r.canonical),M=u.layoutIconSize.evaluate(_,{},r.canonical),A={horizontal:{},vertical:void 0},D=_.text;let F,k=[0,0];if(D){const j=D.toString(),Y=o.get("text-letter-spacing").evaluate(_,{},r.canonical)*Ot,J=Zo(j)?Y:0,re=o.get("text-anchor").evaluate(_,{},r.canonical),te=Af(s,_,r.canonical);if(!te){const ie=o.get("text-radial-offset").evaluate(_,{},r.canonical);k=ie?Cf(re,[ie*Ot,pd]):o.get("text-offset").evaluate(_,{},r.canonical).map((fe=>fe*Ot))}let ae=g?"center":o.get("text-justify").evaluate(_,{},r.canonical);const le=o.get("symbol-placement")==="point"?o.get("text-max-width").evaluate(_,{},r.canonical)*Ot:1/0,ne=()=>{r.bucket.allowVerticalPlacement&&bl(j)&&(A.vertical=wu(D,r.glyphMap,r.glyphPositions,r.imagePositions,T,le,d,re,"left",J,k,R.ax.vertical,!0,I,b))};if(!g&&te){const ie=new Set;if(ae==="auto")for(let xe=0;xe<te.values.length;xe+=2)ie.add(fd(te.values[xe]));else ie.add(ae);let fe=!1;for(const xe of ie)if(!A.horizontal[xe])if(fe)A.horizontal[xe]=A.horizontal[0];else{const ye=wu(D,r.glyphMap,r.glyphPositions,r.imagePositions,T,le,d,"center",xe,J,k,R.ax.horizontal,!1,I,b);ye&&(A.horizontal[xe]=ye,fe=ye.positionedLines.length===1)}ne()}else{ae==="auto"&&(ae=fd(re));const ie=wu(D,r.glyphMap,r.glyphPositions,r.imagePositions,T,le,d,re,ae,J,k,R.ax.horizontal,!1,I,b);ie&&(A.horizontal[ae]=ie),ne(),bl(j)&&g&&m&&(A.vertical=wu(D,r.glyphMap,r.glyphPositions,r.imagePositions,T,le,d,re,ae,J,k,R.ax.vertical,!1,I,b))}}let L=!1;if(!((e=_.icon)===null||e===void 0)&&e.name){const j=r.imageMap[_.icon.name];j&&(F=Ag(r.imagePositions[_.icon.name],o.get("icon-offset").evaluate(_,{},r.canonical),o.get("icon-anchor").evaluate(_,{},r.canonical)),L=!!j.sdf,r.bucket.sdfIcons===void 0?r.bucket.sdfIcons=L:r.bucket.sdfIcons!==L&&$t("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(j.pixelRatio!==r.bucket.pixelRatio||o.get("icon-rotate").constantOr(1)!==0)&&(r.bucket.iconsNeedLinear=!0))}const O=zf(A.horizontal)||A.vertical;(i=r.bucket).iconsInText||(i.iconsInText=!!O&&O.iconsInText),(O||F)&&S_(r.bucket,_,A,F,r.imageMap,u,I,M,k,L,r.canonical,r.subdivisionGranularity)}r.showCollisionBoxes&&r.bucket.generateCollisionDebugBuffers()},R.cP=vh,R.cQ=bh,R.cR=Bh,R.cS=function(r,e=""){const i=new bu;return(function(s,o,l=""){for(const u in s.layers)o.writeMessage(3,((d,g)=>u_(d,g,l)),s.layers[u])})(r,i,e),i.finish()},R.cT=function(r,e,i,s,o,l){let u=xf(r,e,i,o,0);return u=xf(u,e,s,l,1),u},R.cU=class{constructor(r){this.maxEntries=r,this.map=new Map}get(r){const e=this.map.get(r);return e!==void 0&&(this.map.delete(r),this.map.set(r,e)),e}set(r,e){if(this.map.has(r))this.map.delete(r);else if(this.map.size>=this.maxEntries){const i=this.map.keys().next().value;this.map.delete(i)}this.map.set(r,e)}clear(){this.map.clear()}},R.cV=Gd,R.cW=bu,R.cX=mf,R.cY=function(r,e,i,s,o){return p(this,void 0,void 0,(function*(){if(Ti())try{return yield ka(r,e,i,s,o)}catch{}return(function(l,u,d,g,m){const v=l.width,_=l.height;Ir&&zn||(Ir=new OffscreenCanvas(v,_),zn=Ir.getContext("2d",{willReadFrequently:!0})),Ir.width=v,Ir.height=_,zn.drawImage(l,0,0,v,_);const T=zn.getImageData(u,d,g,m);return zn.clearRect(0,0,v,_),T.data})(r,e,i,s,o)}))},R.cZ=Dd,R.c_=class{constructor(r,e){this.layers={[tc]:this},this.name=tc,this.version=e?e.version:1,this.extent=e?e.extent:4096,this.length=r.length,this.features=r}feature(r){return new c_(this.features[r],this.extent)}},R.ca=class extends bn{},R.cb=ag,R.cc=class extends to{},R.cd=fh,R.ce=function(r){return r<=1?1:Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))},R.cf=Md,R.cg=function(r,e,i){var s=e[0],o=e[1],l=e[2],u=i[3]*s+i[7]*o+i[11]*l+i[15];return r[0]=(i[0]*s+i[4]*o+i[8]*l+i[12])/(u=u||1),r[1]=(i[1]*s+i[5]*o+i[9]*l+i[13])/u,r[2]=(i[2]*s+i[6]*o+i[10]*l+i[14])/u,r},R.ch=class extends Yo{},R.ci=class extends t{},R.cj=function(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]&&r[3]===e[3]&&r[4]===e[4]&&r[5]===e[5]&&r[6]===e[6]&&r[7]===e[7]&&r[8]===e[8]&&r[9]===e[9]&&r[10]===e[10]&&r[11]===e[11]&&r[12]===e[12]&&r[13]===e[13]&&r[14]===e[14]&&r[15]===e[15]},R.ck=function(r,e){var i=r[0],s=r[1],o=r[2],l=r[3],u=r[4],d=r[5],g=r[6],m=r[7],v=r[8],_=r[9],T=r[10],b=r[11],I=r[12],M=r[13],A=r[14],D=r[15],F=e[0],k=e[1],L=e[2],O=e[3],j=e[4],Y=e[5],J=e[6],re=e[7],te=e[8],ae=e[9],le=e[10],ne=e[11],ie=e[12],fe=e[13],xe=e[14],ye=e[15];return Math.abs(i-F)<=pe*Math.max(1,Math.abs(i),Math.abs(F))&&Math.abs(s-k)<=pe*Math.max(1,Math.abs(s),Math.abs(k))&&Math.abs(o-L)<=pe*Math.max(1,Math.abs(o),Math.abs(L))&&Math.abs(l-O)<=pe*Math.max(1,Math.abs(l),Math.abs(O))&&Math.abs(u-j)<=pe*Math.max(1,Math.abs(u),Math.abs(j))&&Math.abs(d-Y)<=pe*Math.max(1,Math.abs(d),Math.abs(Y))&&Math.abs(g-J)<=pe*Math.max(1,Math.abs(g),Math.abs(J))&&Math.abs(m-re)<=pe*Math.max(1,Math.abs(m),Math.abs(re))&&Math.abs(v-te)<=pe*Math.max(1,Math.abs(v),Math.abs(te))&&Math.abs(_-ae)<=pe*Math.max(1,Math.abs(_),Math.abs(ae))&&Math.abs(T-le)<=pe*Math.max(1,Math.abs(T),Math.abs(le))&&Math.abs(b-ne)<=pe*Math.max(1,Math.abs(b),Math.abs(ne))&&Math.abs(I-ie)<=pe*Math.max(1,Math.abs(I),Math.abs(ie))&&Math.abs(M-fe)<=pe*Math.max(1,Math.abs(M),Math.abs(fe))&&Math.abs(A-xe)<=pe*Math.max(1,Math.abs(A),Math.abs(xe))&&Math.abs(D-ye)<=pe*Math.max(1,Math.abs(D),Math.abs(ye))},R.cl=function(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r},R.cm=r=>r.type==="circle",R.cn=r=>r.type==="heatmap",R.co=r=>r.type==="line",R.cp=r=>r.type==="fill",R.cq=r=>r.type==="fill-extrusion",R.cr=r=>r.type==="hillshade",R.cs=r=>r.type==="color-relief",R.ct=r=>r.type==="background",R.cu=r=>r.type==="custom",R.cv=Xr,R.cw=function(r,e,i){if(e<=0)return r;const s=1/e;return i===void 0||Math.abs(i)<1e-10?Math.round(r*s)/s:(i>0?Math.ceil(r*s-1e-9):Math.floor(r*s+1e-10))/s},R.cx=function(r,e,i){const s=Ye(e.x-i.x,e.y-i.y),o=Ye(r.x-i.x,r.y-i.y);var l,u;return Jr(Math.atan2(s[0]*o[1]-s[1]*o[0],(l=s)[0]*(u=o)[0]+l[1]*u[1]))},R.cy=gs,R.cz=function(r,e){var i;if(!Fa[e])return!1;const s=r?.target,o=((i=s?.ownerDocument)===null||i===void 0?void 0:i.defaultView)||window;return r instanceof o.MouseEvent||r instanceof o.WheelEvent},R.d=yt,R.d0=class{constructor(r,e){const i=(e=this.options=Object.assign({},Ym,e)).debug;if(i&&console.time("preprocess data"),e.maxZoom<0||e.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(e.promoteId&&e.generateId)throw new Error("promoteId and generateId cannot be used together.");let s=Ih(r,e);i&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",e.indexMaxZoom,e.indexMaxPoints),console.time("generate tiles")),s=Ah(s,e),e.updateable&&(this.source=s),this.initializeIndex(s,e)}initializeIndex(r,e){this.tileIndex=e.cluster?new Gm(e.clusterOptions):new Xm(e),r.length&&this.tileIndex.initialize(r)}getTile(r,e,i){return e=+e,i=+i,(r=+r)<0||r>24?null:this.tileIndex.getTile(r,e,i)}updateData(r,e){const i=this.options;if(!i.updateable)throw new Error("to update tile geojson `updateable` option must be set to true");let{affected:s,source:o}=(function(l,u,d){const g=(function(v,_){return v?{removeAll:v.removeAll,remove:new Set(v.remove||[]),add:new Map(v.add?.map((T=>[_.promoteId?T.properties[_.promoteId]:T.id,T]))),update:new Map(v.update?.map((T=>[T.id,T])))}:{remove:new Set,add:new Map,update:new Map}})(u,d);let m=[];if(g.removeAll&&(m=l,l=[]),g.remove.size||g.add.size){const v=[];for(const _ of l)(g.remove.has(_.id)||g.add.has(_.id))&&v.push(_);if(v.length){m.push(...v);const _=new Set(v.map((T=>T.id)));l=l.filter((T=>!_.has(T.id)))}if(g.add.size){let _=Ih({type:"FeatureCollection",features:Array.from(g.add.values())},d);_=Ah(_,d),m.push(..._),l.push(..._)}}if(g.update.size){const v=new Map,_=[];for(const T of l)g.update.has(T.id)?v.set(T.id,[...v.get(T.id)||[],T]):_.push(T);for(const[T,b]of g.update){const I=v.get(T);if(!I||I.length===0)continue;const M=Um(I,b,d);m.push(...I,...M),_.push(...M)}l=_}return{affected:m,source:l}})(this.source,r,i);e&&({affected:s,source:o}=this.filterUpdate(o,s,e)),s.length&&(this.source=o,this.tileIndex.updateIndex(o,s,i))}filterUpdate(r,e,i){const s=new Set;for(const o of r)o.id!=null&&(i(_u(o))||(e.push(o),s.add(o.id)));return{affected:e,source:r=r.filter((o=>!s.has(o.id)))}}getData(){if(!this.options.updateable)throw new Error("to retrieve data the `updateable` option must be set to true");return{type:"FeatureCollection",features:this.source.map((r=>_u(r)))}}updateClusterOptions(r,e){const i=this.options.cluster;this.options.cluster=r,this.options.clusterOptions=e,i!=r?this.initializeIndex(this.source,this.options):this.tileIndex.updateIndex(this.source,[],this.options)}getClusterExpansionZoom(r){return this.tileIndex.getClusterExpansionZoom(r)}getClusterChildren(r){return this.tileIndex.getChildren(r)}getClusterLeaves(r,e,i){return this.tileIndex.getLeaves(r,e,i)}},R.d1=pr,R.e=Fi,R.f=qi,R.g=ar,R.h=r=>p(void 0,void 0,void 0,(function*(){if(r.byteLength===0)return createImageBitmap(new ImageData(1,1));const e=new Blob([new Uint8Array(r)],{type:"image/png"});try{return createImageBitmap(e)}catch(i){throw new Error(`Could not load image because of ${yt(i).message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}})),R.i=Zt,R.j=r=>new Promise(((e,i)=>{const s=new Image;s.onload=()=>{e(s),URL.revokeObjectURL(s.src),s.onload=null,window.requestAnimationFrame((()=>s.src=za))},s.onerror=()=>i(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const o=new Blob([new Uint8Array(r)],{type:"image/png"});s.src=r.byteLength?URL.createObjectURL(o):za})),R.k=(r,e)=>Qr(Fi(r,{type:"json"}),e),R.l=Fn,R.m=Qr,R.n=vs,R.o=(r,e)=>Qr(Fi(r,{type:"arrayBuffer"}),e),R.p=vp,R.q=function(r){return new bu(r).readFields(wg,[])},R.r=function(r){return/[\u02EA\u02EB\u1100-\u11FF\u2E80-\u2FDF\u3000-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE4F\uFF00-\uFFEF]|\uD81B[\uDFE0-\uDFFF]|[\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFFF]|\uD82C[\uDC00-\uDEFB]|\uD83C[\uDE00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(r))},R.s=co,R.t=Vl,R.u=li,R.v=$s,R.w=$t,R.x=ce,R.y=Ml,R.z=Ci})),Zr("worker",["./shared"],(function(R){class p{constructor(W,K){this.keyCache={},W&&this.replace(W,K)}replace(W,K){this._layerConfigs={},this._layers={},this.update(W,[],K)}update(W,K,ee){for(const Me of W){this._layerConfigs[Me.id]=Me;const $e=this._layers[Me.id]=R.bT(Me,ee);$e._featureFilter=R.ah($e.filter,ee),this.keyCache[Me.id]&&delete this.keyCache[Me.id]}for(const Me of K)delete this.keyCache[Me],delete this._layerConfigs[Me],delete this._layers[Me];this.familiesBySource={};const ge=R.cJ(Object.values(this._layerConfigs),this.keyCache);for(const Me of ge){const $e=Me.map((_t=>this._layers[_t.id])),ze=$e[0];if(ze.isHidden())continue;const Ge=ze.source||"";let Le=this.familiesBySource[Ge];Le||(Le=this.familiesBySource[Ge]={});const Ye=ze.sourceLayer||R.ag;let De=Le[Ye];De||(De=Le[Ye]=[]),De.push($e)}}}class Te{constructor(W){const K={},ee=[];for(const ze in W){const Ge=W[ze],Le=K[ze]={};for(const Ye in Ge){const De=Ge[+Ye];if(!De||De.bitmap.width===0||De.bitmap.height===0)continue;const _t={x:0,y:0,w:De.bitmap.width+2,h:De.bitmap.height+2};ee.push(_t),Le[Ye]={rect:_t,metrics:De.metrics}}}const{w:ge,h:Me}=R.p(ee),$e=new R.t({width:ge||1,height:Me||1});for(const ze in W){const Ge=W[ze];for(const Le in Ge){const Ye=Ge[+Le];if(!Ye||Ye.bitmap.width===0||Ye.bitmap.height===0)continue;const De=K[ze][Le].rect;R.t.copy(Ye.bitmap,$e,{x:0,y:0},{x:De.x+1,y:De.y+1},Ye.bitmap)}}this.image=$e,this.positions=K}}R.cK("GlyphAtlas",Te);class wr{constructor(W){this.tileID=new R.a3(W.tileID.overscaledZ,W.tileID.wrap,W.tileID.canonical.z,W.tileID.canonical.x,W.tileID.canonical.y),this.uid=W.uid,this.zoom=W.zoom,this.pixelRatio=W.pixelRatio,this.tileSize=W.tileSize,this.source=W.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=W.showCollisionBoxes,this.collectResourceTiming=!!W.collectResourceTiming,this.returnDependencies=!!W.returnDependencies,this.promoteId=W.promoteId,this.inFlightDependencies=[]}parse(W,K,ee,ge,Me){return R._(this,void 0,void 0,(function*(){this.status="parsing",this.data=W,this.collisionBoxArray=new R.ae;const $e=new R.cL(Object.keys(W.layers).sort()),ze=new R.cM(this.tileID,this.promoteId);ze.bucketLayerIDs=[];const Ge={},Le={featureIndex:ze,iconDependencies:{},patternDependencies:{},glyphDependencies:{},dashDependencies:{},availableImages:ee,subdivisionGranularity:Me},Ye=K.familiesBySource[this.source];for(const ke in Ye){const Ft=W.layers[ke];if(!Ft)continue;Ft.version===1&&R.w(`Vector tile source "${this.source}" layer "${ke}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const $t=$e.encode(ke),Si=[];for(let Zt=0;Zt<Ft.length;Zt++){const mi=Ft.feature(Zt),Kr=ze.getId(mi,ke);Si.push({feature:mi,id:Kr,index:Zt,sourceLayerIndex:$t})}for(const Zt of Ye[ke]){const mi=Zt[0];mi.source!==this.source&&R.w(`layer.source = ${mi.source} does not equal this.source = ${this.source}`),mi.isHidden(this.zoom,!0)||(wi(Zt,this.zoom,ee),(Ge[mi.id]=mi.createBucket({index:ze.bucketLayerIDs.length,layers:Zt,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:$t,sourceID:this.source})).populate(Si,Le,this.tileID.canonical),ze.bucketLayerIDs.push(Zt.map((Kr=>Kr.id))))}}const De=R.bY(Le.glyphDependencies,(ke=>Object.keys(ke).map(Number)));for(const ke of this.inFlightDependencies)ke?.abort();this.inFlightDependencies=[];let _t=Promise.resolve({});if(Object.keys(De).length){const ke=new AbortController;this.inFlightDependencies.push(ke),_t=ge.sendAsync({type:"GG",data:{stacks:De,source:this.source,tileID:this.tileID,type:"glyphs"}},ke)}const yt=Object.keys(Le.iconDependencies);let Zi=Promise.resolve({});if(yt.length){const ke=new AbortController;this.inFlightDependencies.push(ke),Zi=ge.sendAsync({type:"GI",data:{icons:yt,source:this.source,tileID:this.tileID,type:"icons"}},ke)}const Ri=Object.keys(Le.patternDependencies);let Sr=Promise.resolve({});if(Ri.length){const ke=new AbortController;this.inFlightDependencies.push(ke),Sr=ge.sendAsync({type:"GI",data:{icons:Ri,source:this.source,tileID:this.tileID,type:"patterns"}},ke)}const Xr=Le.dashDependencies;let gs=Promise.resolve({});if(Object.keys(Xr).length){const ke=new AbortController;this.inFlightDependencies.push(ke),gs=ge.sendAsync({type:"GDA",data:{dashes:Xr}},ke)}const[si,Dn,Fi,_s]=yield Promise.all([_t,Zi,Sr,gs]),Pr=new Te(si),Yr=new R.cN(Dn,Fi);for(const ke in Ge){const Ft=Ge[ke];Ft instanceof R.af?(wi(Ft.layers,this.zoom,ee),R.cO({bucket:Ft,glyphMap:si,glyphPositions:Pr.positions,imageMap:Dn,imagePositions:Yr.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical,subdivisionGranularity:Le.subdivisionGranularity})):Ft.hasDependencies&&(Ft instanceof R.cP||Ft instanceof R.cQ||Ft instanceof R.cR)&&(wi(Ft.layers,this.zoom,ee),Ft.addFeatures(Le,this.tileID.canonical,Yr.patternPositions,_s))}return this.status="done",{buckets:Object.values(Ge).filter((ke=>!ke.isEmpty())),featureIndex:ze,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Pr.image,imageAtlas:Yr,dashPositions:_s,glyphMap:this.returnDependencies?si:null,iconMap:this.returnDependencies?Dn:null,glyphPositions:this.returnDependencies?Pr.positions:null}}))}}function wi(qe,W,K){const ee=new R.J(W);for(const ge of qe)ge.recalculate(ee,K)}class qr{constructor(){this.loading={},this.loaded={},this.parsing={}}startLoading(W,K){this.loading[W]=K}finishLoading(W){delete this.loading[W]}abort(W){const K=this.loading[W];K?.abort&&(K.abort.abort(),delete this.loading[W])}setParsing(W,K){this.parsing[W]=K}consumeParsing(W){const K=this.parsing[W];if(K)return delete this.parsing[W],K}clearParsing(W){delete this.parsing[W]}markLoaded(W,K){this.loaded[W]=K}getLoaded(W){const K=this.loaded[W];if(K)return K}removeLoaded(W){delete this.loaded[W]}clearLoaded(){this.loaded={}}}class Cn{constructor(W){this.start=`${W}#start`,this.end=`${W}#end`,this.measure=W,performance.mark(this.start)}finish(){performance.mark(this.end);let W=performance.getEntriesByName(this.measure);return W.length===0&&(performance.measure(this.measure,this.start,this.end),W=performance.getEntriesByName(this.measure),performance.clearMarks(this.start),performance.clearMarks(this.end),performance.clearMeasures(this.measure)),W}}class Gt{constructor(W,K,ee,ge,Me){this.type=W,this.properties=ee||{},this.extent=Me,this.pointsArray=K,this.id=ge}loadGeometry(){return this.pointsArray.map((W=>W.map((K=>new R.P(K.x,K.y)))))}}class Tr{constructor(W,K,ee){this.version=2,this._myFeatures=W,this.name=K,this.length=W.length,this.extent=ee}feature(W){return this._myFeatures[W]}}class He{constructor(){this.layers={}}addLayer(W){this.layers[W.name]=W}}function Wr(qe){let W=R.cS(qe);return W.byteOffset===0&&W.byteLength===W.buffer.byteLength||(W=new Uint8Array(W)),{vectorTile:qe,rawData:W.buffer}}function Ti(qe,W,K){const{extent:ee}=qe,ge=Math.pow(2,K.z-W.z),Me=(K.x-W.x*ge)*ee,$e=(K.y-W.y*ge)*ee,ze=[];for(let Ge=0;Ge<qe.length;Ge++){const Le=qe.feature(Ge);let Ye=Le.loadGeometry();for(const _t of Ye)for(const yt of _t)yt.x=yt.x*ge-Me,yt.y=yt.y*ge-$e;const De=128;Ye=R.cT(Ye,Le.type,-De,-De,ee+De,ee+De),Ye.length!==0&&ze.push(new Gt(Le.type,Ye,Le.properties,Le.id,ee))}return new Tr(ze,qe.name,ee)}class pe{constructor(W,K,ee){this.actor=W,this.layerIndex=K,this.availableImages=ee,this.tileState=new qr,this.overzoomedTileResultCache=new R.cU(1e3)}loadVectorTile(W,K){try{return{vectorTile:W.encoding!=="mlt"?new R.cV(new R.cW(K)):new R.cX(K),rawData:K}}catch(ee){const ge=new Uint8Array(K);let Me=`Unable to parse the tile at ${W.request.url}, `;throw Me+=ge[0]===31&&ge[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${R.d(ee).message}`,new Error(Me)}}loadTile(W){return R._(this,void 0,void 0,(function*(){const{uid:K,overzoomParameters:ee}=W;ee&&(W.request=ee.overzoomRequest);const ge=this._startRequestTiming(W),Me=new wr(W);this.tileState.startLoading(K,Me);const $e=new AbortController;Me.abort=$e;try{const ze=yield R.o(W.request,$e);if(W.etag&&W.etag===ze.etag)return this.tileState.finishLoading(K),this._getEtagUnmodifiedResult(ze,ge);const Ge=this.loadVectorTile(W,ze.data);if(this.tileState.finishLoading(K),!Ge)return null;let{vectorTile:Le,rawData:Ye}=Ge;ee&&({vectorTile:Le,rawData:Ye}=this._getOverzoomTile(W,Le));const De=this._getExpiryData(ze),_t=this._finishRequestTiming(ge);Me.vectorTile=Le,this.tileState.markLoaded(K,Me);const yt={rawData:Ye,cacheControl:De,resourceTiming:_t};this.tileState.setParsing(K,yt);try{return yield this._parseWorkerTile(Me,W,yt)}finally{this.tileState.clearParsing(K)}}catch(ze){throw this.tileState.finishLoading(K),Me.status="done",this.tileState.markLoaded(K,Me),ze}}))}_getEtagUnmodifiedResult(W,K){const ee=this._getExpiryData(W),ge=this._finishRequestTiming(K);return R.e({etagUnmodified:!0},ee,ge)}_parseWorkerTile(W,K,ee){return R._(this,void 0,void 0,(function*(){let ge=yield W.parse(W.vectorTile,this.layerIndex,this.availableImages,this.actor,K.subdivisionGranularity);if(ee){const{rawData:Me,cacheControl:$e,resourceTiming:ze}=ee;ge=R.e({rawTileData:Me.slice(0),encoding:K.encoding},ge,$e,ze)}return ge}))}_getExpiryData({expires:W,cacheControl:K,etag:ee}){const ge={};return W&&(ge.expires=W),K&&(ge.cacheControl=K),ee&&(ge.etag=ee),ge}_startRequestTiming(W){var K;if(!((K=W.request)===null||K===void 0)&&K.collectResourceTiming)return new Cn(W.request.url)}_finishRequestTiming(W){const K=W?.finish();return K?{resourceTiming:JSON.parse(JSON.stringify(K))}:{}}_getOverzoomTile(W,K){var ee;const{tileID:ge,source:Me,overzoomParameters:$e}=W,{maxZoomTileID:ze}=$e,Ge=`${ze.key}_${ge.key}_${(ee=W.request)===null||ee===void 0?void 0:ee.url}`,Le=this.overzoomedTileResultCache.get(Ge);if(Le)return Le;const Ye=new He,De=this.layerIndex.familiesBySource[Me];for(const yt in De){const Zi=K.layers[yt];if(!Zi)continue;const Ri=Ti(Zi,ze,ge.canonical);Ri.length>0&&Ye.addLayer(Ri)}const _t=Wr(Ye);return this.overzoomedTileResultCache.set(Ge,_t),_t}reloadTile(W){return R._(this,void 0,void 0,(function*(){const K=W.uid,ee=this.tileState.getLoaded(K);if(!ee)throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");if(ee.showCollisionBoxes=W.showCollisionBoxes,ee.status==="parsing"){const ge=this.tileState.consumeParsing(K);return yield this._parseWorkerTile(ee,W,ge)}if(ee.status==="done"&&ee.vectorTile)return yield this._parseWorkerTile(ee,W)}))}abortTile(W){return R._(this,void 0,void 0,(function*(){this.tileState.abort(W.uid)}))}removeTile(W){return R._(this,void 0,void 0,(function*(){this.tileState.removeLoaded(W.uid)}))}}class zt{constructor(){this.loaded={}}loadTile(W){return R._(this,void 0,void 0,(function*(){const{uid:K,encoding:ee,rawImageData:ge,redFactor:Me,greenFactor:$e,blueFactor:ze,baseShift:Ge}=W,Le=ge.width+2,Ye=ge.height+2,De=R.b(ge)?new R.R({width:Le,height:Ye},yield R.cY(ge,-1,-1,Le,Ye)):ge,_t=new R.cZ(K,De,ee,Me,$e,ze,Ge);return this.loaded||(this.loaded={}),this.loaded[K]=_t,_t}))}removeTile(W){const K=this.loaded,ee=W.uid;K?.[ee]&&delete K[ee]}}class Hr{constructor(W,K,ee,ge=An){this.actor=W,this.layerIndex=K,this.availableImages=ee,this.tileState=new qr,this._createGeoJSONIndex=ge}loadVectorTile(W){if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const{z:K,x:ee,y:ge}=W.tileID.canonical,Me=this._geoJSONIndex.getTile(K,ee,ge);return Me?Wr(new R.c_(Me.features,{version:2,extent:R.a6})):null}loadTile(W){return R._(this,void 0,void 0,(function*(){const{uid:K}=W,ee=new wr(W);ee.abort=new AbortController;try{const ge=this.loadVectorTile(W);if(!ge)return null;const{vectorTile:Me,rawData:$e}=ge;ee.vectorTile=Me,this.tileState.markLoaded(K,ee);const ze={rawData:$e};this.tileState.setParsing(K,ze);try{return yield this._parseWorkerTile(ee,W,ze)}finally{this.tileState.clearParsing(K)}}catch(ge){throw ee.status="done",this.tileState.markLoaded(K,ee),ge}}))}_reloadLoadedTile(W){return R._(this,void 0,void 0,(function*(){const K=W.uid,ee=this.tileState.getLoaded(K);if(!ee)throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");if(ee.showCollisionBoxes=W.showCollisionBoxes,ee.status==="parsing"){const ge=this.tileState.consumeParsing(K);return yield this._parseWorkerTile(ee,W,ge)}if(ee.status==="done"&&ee.vectorTile)return yield this._parseWorkerTile(ee,W)}))}_parseWorkerTile(W,K,ee){return R._(this,void 0,void 0,(function*(){let ge=yield W.parse(W.vectorTile,this.layerIndex,this.availableImages,this.actor,K.subdivisionGranularity);if(ee){const{rawData:Me}=ee;ge=R.e({rawTileData:Me.slice(0),encoding:"mvt"},ge)}return ge}))}abortTile(W){return R._(this,void 0,void 0,(function*(){this.tileState.abort(W.uid)}))}removeTile(W){return R._(this,void 0,void 0,(function*(){this.tileState.removeLoaded(W.uid)}))}loadData(W){return R._(this,void 0,void 0,(function*(){var K;(K=this._pendingRequest)===null||K===void 0||K.abort();const ee=this._startRequestTiming(W);this._pendingRequest=new AbortController;try{yield this.loadAndProcessGeoJSON(W,this._pendingRequest),delete this._pendingRequest,this.tileState.clearLoaded();const ge={};return W.request&&(ge.data=W.data),this._finishRequestTiming(ee,W,ge),ge}catch(ge){if(delete this._pendingRequest,!R.$(ge))throw ge;return{abandoned:!0}}}))}_startRequestTiming(W){var K;if(!((K=W.request)===null||K===void 0)&&K.collectResourceTiming)return new Cn(W.request.url)}_finishRequestTiming(W,K,ee){const ge=W?.finish();ge&&(ee.resourceTiming={[K.source]:JSON.parse(JSON.stringify(ge))})}reloadTile(W){return this.tileState.getLoaded(W.uid)?this._reloadLoadedTile(W):this.loadTile(W)}loadAndProcessGeoJSON(W,K){return R._(this,void 0,void 0,(function*(){var ee;if(W.request&&(W.data=(yield R.k(W.request,K)).data),W.data)return W.data=this._filterGeoJSON(W.data,W.filter),void(this._geoJSONIndex=this._createGeoJSONIndex(W.data,W));if(W.dataDiff)return(ee=this._geoJSONIndex)!==null&&ee!==void 0||(this._geoJSONIndex=this._createGeoJSONIndex({type:"FeatureCollection",features:[]},W)),void this._geoJSONIndex.updateData(W.dataDiff,this._getFilterPredicate(W.filter));if(W.updateCluster&&this._geoJSONIndex.updateClusterOptions(W.geojsonVtOptions.cluster,fs(W)),this._geoJSONIndex==null)throw new Error(`Input data given to '${W.source}' is not a valid GeoJSON object.`)}))}_filterGeoJSON(W,K){if(W.type!=="FeatureCollection")return W;const ee=this._getFilterPredicate(K);return ee?{type:"FeatureCollection",features:W.features.filter((ge=>ee(ge)))}:W}_getFilterPredicate(W){if(typeof W!="boolean"&&!W?.length)return;const K=R.c$(W,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(K.result==="error")throw new Error(K.value.map((ee=>`${ee.key}: ${ee.message}`)).join(", "));return ee=>K.value.evaluate({zoom:0},ee)}removeSource(W){return R._(this,void 0,void 0,(function*(){var K;(K=this._pendingRequest)===null||K===void 0||K.abort()}))}getClusterExpansionZoom(W){return this._geoJSONIndex.getClusterExpansionZoom(W.clusterId)}getClusterChildren(W){return this._geoJSONIndex.getClusterChildren(W.clusterId)}getClusterLeaves(W){return this._geoJSONIndex.getClusterLeaves(W.clusterId,W.limit,W.offset)}}function An(qe,W){const K=R.e(W.geojsonVtOptions||{},{updateable:!0,clusterOptions:fs(W)});return new R.d0(qe,K)}function fs({geojsonVtOptions:qe,clusterProperties:W}){if(!W||!qe.clusterOptions)return qe.clusterOptions;const K={},ee={},ge={accumulated:null,zoom:0},Me={properties:null},$e=Object.keys(W);for(const ze of $e){const[Ge,Le]=W[ze],Ye=R.c$(Le),De=R.c$(typeof Ge=="string"?[Ge,["accumulated"],["get",ze]]:Ge);K[ze]=Ye.value,ee[ze]=De.value}return qe.clusterOptions.map=ze=>{Me.properties=ze;const Ge={};for(const Le of $e)Ge[Le]=K[Le].evaluate(ge,Me);return Ge},qe.clusterOptions.reduce=(ze,Ge)=>{Me.properties=Ge;for(const Le of $e)ge.accumulated=ze[Le],ze[Le]=ee[Le].evaluate(ge,Me)},qe.clusterOptions}class ms{constructor(W){this.self=W,this.actor=new R.N(W),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.globalStates=new Map,this.self.registerWorkerSource=(K,ee)=>{if(this.externalWorkerSourceTypes[K])throw new Error(`Worker source with name "${K}" already registered.`);this.externalWorkerSourceTypes[K]=ee},this.self.addProtocol=R.cH,this.self.removeProtocol=R.cI,this.self.registerRTLTextPlugin=K=>{R.d1.setMethods(K)},this.self.makeRequest=R.m,this.actor.registerMessageHandler("LDT",((K,ee)=>this._getDEMWorkerSource(K,ee.source).loadTile(ee))),this.actor.registerMessageHandler("RDT",((K,ee)=>R._(this,void 0,void 0,(function*(){this._getDEMWorkerSource(K,ee.source).removeTile(ee)})))),this.actor.registerMessageHandler("GCEZ",((K,ee)=>R._(this,void 0,void 0,(function*(){return this._getWorkerSource(K,ee.type,ee.source).getClusterExpansionZoom(ee)})))),this.actor.registerMessageHandler("GCC",((K,ee)=>R._(this,void 0,void 0,(function*(){return this._getWorkerSource(K,ee.type,ee.source).getClusterChildren(ee)})))),this.actor.registerMessageHandler("GCL",((K,ee)=>R._(this,void 0,void 0,(function*(){return this._getWorkerSource(K,ee.type,ee.source).getClusterLeaves(ee)})))),this.actor.registerMessageHandler("LD",((K,ee)=>this._getWorkerSource(K,ee.type,ee.source).loadData(ee))),this.actor.registerMessageHandler("LT",((K,ee)=>this._getWorkerSource(K,ee.type,ee.source).loadTile(ee))),this.actor.registerMessageHandler("RT",((K,ee)=>this._getWorkerSource(K,ee.type,ee.source).reloadTile(ee))),this.actor.registerMessageHandler("AT",((K,ee)=>this._getWorkerSource(K,ee.type,ee.source).abortTile(ee))),this.actor.registerMessageHandler("RMT",((K,ee)=>this._getWorkerSource(K,ee.type,ee.source).removeTile(ee))),this.actor.registerMessageHandler("RS",((K,ee)=>R._(this,void 0,void 0,(function*(){var ge,Me;if(!(!((Me=(ge=this.workerSources[K])===null||ge===void 0?void 0:ge[ee.type])===null||Me===void 0)&&Me[ee.source]))return;const $e=this.workerSources[K][ee.type][ee.source];delete this.workerSources[K][ee.type][ee.source],$e.removeSource!==void 0&&$e.removeSource(ee)})))),this.actor.registerMessageHandler("RM",(K=>R._(this,void 0,void 0,(function*(){delete this.layerIndexes[K],delete this.availableImages[K],delete this.workerSources[K],delete this.demWorkerSources[K],this.globalStates.delete(K)})))),this.actor.registerMessageHandler("SR",((K,ee)=>R._(this,void 0,void 0,(function*(){this.referrer=ee})))),this.actor.registerMessageHandler("SRPS",((K,ee)=>this._syncRTLPluginState(K,ee))),this.actor.registerMessageHandler("IS",((K,ee)=>R._(this,void 0,void 0,(function*(){this.self.importScripts(ee)})))),this.actor.registerMessageHandler("SI",((K,ee)=>this._setImages(K,ee))),this.actor.registerMessageHandler("UL",((K,ee)=>R._(this,void 0,void 0,(function*(){this._getLayerIndex(K).update(ee.layers,ee.removedIds,this._getGlobalState(K))})))),this.actor.registerMessageHandler("UGS",((K,ee)=>R._(this,void 0,void 0,(function*(){const ge=this._getGlobalState(K);for(const Me in ee)ge[Me]=ee[Me]})))),this.actor.registerMessageHandler("SL",((K,ee)=>R._(this,void 0,void 0,(function*(){this._getLayerIndex(K).replace(ee,this._getGlobalState(K))}))))}_getGlobalState(W){let K=this.globalStates.get(W);return K||(K={},this.globalStates.set(W,K)),K}_setImages(W,K){return R._(this,void 0,void 0,(function*(){this.availableImages[W]=K;for(const ee in this.workerSources[W]){const ge=this.workerSources[W][ee];for(const Me in ge)ge[Me].availableImages=K}}))}_syncRTLPluginState(W,K){return R._(this,void 0,void 0,(function*(){return yield R.d1.syncState(K,this.self.importScripts)}))}_getAvailableImages(W){let K=this.availableImages[W];return K||(K=[]),K}_getLayerIndex(W){let K=this.layerIndexes[W];return K||(K=this.layerIndexes[W]=new p),K}_getWorkerSource(W,K,ee){var ge,Me;if((ge=this.workerSources)[W]||(ge[W]={}),(Me=this.workerSources[W])[K]||(Me[K]={}),!this.workerSources[W][K][ee]){const $e={sendAsync:(ze,Ge)=>(ze.targetMapId=W,this.actor.sendAsync(ze,Ge))};switch(K){case"vector":this.workerSources[W][K][ee]=new pe($e,this._getLayerIndex(W),this._getAvailableImages(W));break;case"geojson":this.workerSources[W][K][ee]=new Hr($e,this._getLayerIndex(W),this._getAvailableImages(W));break;default:this.workerSources[W][K][ee]=new this.externalWorkerSourceTypes[K]($e,this._getLayerIndex(W),this._getAvailableImages(W))}}return this.workerSources[W][K][ee]}_getDEMWorkerSource(W,K){var ee,ge;return(ee=this.demWorkerSources)[W]||(ee[W]={}),(ge=this.demWorkerSources[W])[K]||(ge[K]=new zt),this.demWorkerSources[W][K]}}return R.i(self)&&(self.worker=new ms(self)),ms})),Zr("index",["exports","./shared"],(function(R,p){var Te="5.24.0";function wr(){var h=new p.A(4);return p.A!=Float32Array&&(h[1]=0,h[2]=0),h[0]=1,h[3]=1,h}let wi,qr,Cn;const Gt={frame(h,t,n,a){const c=a||window,f=c.requestAnimationFrame((x=>{y(),t(x)})),{unsubscribe:y}=p.s(h.signal,"abort",(()=>{y(),c.cancelAnimationFrame(f),n(new p.a(h.signal.reason))}),!1)},frameAsync(h,t){return new Promise(((n,a)=>{this.frame(h,n,a,t)}))},getImageData(h,t=0){return this.getImageCanvasContext(h).getImageData(-t,-t,h.width+2*t,h.height+2*t)},getImageCanvasContext(h){const t=window.document.createElement("canvas"),n=t.getContext("2d",{willReadFrequently:!0});if(!n)throw new Error("failed to create canvas 2d context");return t.width=h.width,t.height=h.height,n.drawImage(h,0,0,h.width,h.height),n},resolveURL:h=>(wi||(wi=document.createElement("a")),wi.href=h,wi.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return Cn!==void 0?Cn:!!matchMedia&&(qr!=null||(qr=matchMedia("(prefers-reduced-motion: reduce)")),qr.matches)},set prefersReducedMotion(h){Cn=h}},Tr=new class{constructor(){this._frozenAt=null}getCurrentTime(){return this._frozenAt!==null?this._frozenAt:performance.now()}setNow(h){this._frozenAt=h}restoreNow(){this._frozenAt=null}isFrozen(){return this._frozenAt!==null}};function He(){return Tr.getCurrentTime()}var Wr,Ti;class pe{static create(t,n,a){const c=window.document.createElement(t);return n!==void 0&&(c.className=n),a&&a.appendChild(c),c}static createNS(t,n){return window.document.createElementNS(t,n)}static disableDrag(){pe.docStyle&&pe.selectProp&&(pe.userSelect=pe.docStyle[pe.selectProp],pe.docStyle[pe.selectProp]="none")}static enableDrag(){pe.docStyle&&pe.selectProp&&(pe.docStyle[pe.selectProp]=pe.userSelect)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",pe.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",pe.suppressClickInternal,!0),window.setTimeout((()=>{window.removeEventListener("click",pe.suppressClickInternal,!0)}),0)}static getScale(t){const n=t.getBoundingClientRect();return{x:n.width/t.offsetWidth||1,y:n.height/t.offsetHeight||1,boundingClientRect:n}}static getPoint(t,n,a){const c=n.boundingClientRect;return new p.P((a.clientX-c.left)/n.x-t.clientLeft,(a.clientY-c.top)/n.y-t.clientTop)}static mousePos(t,n){const a=pe.getScale(t);return pe.getPoint(t,a,n)}static touchPos(t,n){const a=[],c=pe.getScale(t);for(const f of n)a.push(pe.getPoint(t,c,f));return a}static sanitize(t){const n=new DOMParser().parseFromString(t,"text/html").body||document.createElement("body"),a=n.querySelectorAll("script");for(const c of a)c.remove();return pe.clean(n),n.innerHTML}static isPossiblyDangerous(t,n){const a=n.replace(/\s+/g,"").toLowerCase();return!(!["src","href","xlink:href"].includes(t)||!a.includes("javascript:")&&!a.includes("data:"))||!!t.startsWith("on")||void 0}static clean(t){const n=t.children;for(const a of n)pe.removeAttributes(a),pe.clean(a)}static removeAttributes(t){for(const{name:n,value:a}of t.attributes)pe.isPossiblyDangerous(n,a)&&t.removeAttribute(n)}}pe.docStyle=typeof window<"u"&&((Wr=window.document)===null||Wr===void 0?void 0:Wr.documentElement.style),pe.selectProp=!pe.docStyle||"userSelect"in pe.docStyle?"userSelect":"webkitUserSelect",(function(h){let t,n,a,c;h.resetRequestQueue=()=>{t=[],n=0,a=0,c={}},h.addThrottleControl=w=>{const S=a++;return c[S]=w,S},h.removeThrottleControl=w=>{delete c[w],y()},h.getImage=(w,S,P=!0)=>new Promise(((E,C)=>{w.headers||(w.headers={}),w.headers.accept="image/webp,*/*",p.e(w,{type:"image"}),t.push({abortController:S,requestParameters:w,supportImageRefresh:P,state:"queued",onError:z=>{C(z)},onSuccess:z=>{E(z)}}),y()}));const f=w=>p._(this,void 0,void 0,(function*(){w.state="running";const{requestParameters:S,supportImageRefresh:P,onError:E,onSuccess:C,abortController:z}=w,B=P===!1&&!p.i(self)&&!p.g(S.url)&&(!S.headers||Object.keys(S.headers).reduce(((N,$)=>N&&$==="accept"),!0));n++;const V=B?x(S,z):p.m(S,z);try{const N=yield V;delete w.abortController,w.state="completed",N.data instanceof HTMLImageElement||p.b(N.data)?C(N):N.data&&C({data:yield(G=N.data,typeof createImageBitmap=="function"?p.h(G):p.j(G)),cacheControl:N.cacheControl,expires:N.expires})}catch(N){delete w.abortController,E(p.d(N))}finally{n--,y()}var G})),y=()=>{const w=(()=>{for(const S of Object.keys(c))if(c[S]())return!0;return!1})()?p.c.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:p.c.MAX_PARALLEL_IMAGE_REQUESTS;for(let S=n;S<w&&t.length>0;S++){const P=t.shift();P.abortController.signal.aborted?S--:f(P)}},x=(w,S)=>new Promise(((P,E)=>{const C=new Image,z=w.url,B=w.credentials;B&&B==="include"?C.crossOrigin="use-credentials":(B&&B==="same-origin"||!p.f(z))&&(C.crossOrigin="anonymous"),S.signal.addEventListener("abort",(()=>{C.src="",E(new p.a(S.signal.reason))})),C.fetchPriority="high",C.onload=()=>{C.onerror=C.onload=null,P({data:C})},C.onerror=()=>{C.onerror=C.onload=null,S.signal.aborted||E(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."))},C.src=z}))})(Ti||(Ti={})),Ti.resetRequestQueue();class zt{constructor(t){this._transformRequestFn=t??null}transformRequest(t,n){return this._transformRequestFn&&this._transformRequestFn(t,n)||{url:t}}setTransformRequest(t){this._transformRequestFn=t}}function Hr(h){const t=[];if(typeof h=="string")t.push({id:"default",url:h});else if(h&&h.length>0){const n=[];for(const{id:a,url:c}of h){const f=`${a}${c}`;n.includes(f)||(n.push(f),t.push({id:a,url:c}))}}return t}function An(h,t,n){try{const a=new URL(h);return a.pathname+=`${t}${n}`,a.toString()}catch{throw new Error(`Invalid sprite URL "${h}", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically`)}}function fs(h){const{userImage:t}=h;return!(!t?.render||!t.render()||(h.data.replace(new Uint8Array(t.data.buffer)),0))}class ms extends p.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new p.R({width:1,height:1}),this.dirty=!0}destroy(){this.atlasTexture&&(this.atlasTexture.destroy(),this.atlasTexture=null);for(const t of Object.keys(this.images))this.removeImage(t);this.patterns={},this.atlasImage=new p.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(t){if(this.loaded!==t&&(this.loaded=t,t)){for(const{ids:n,promiseResolve:a}of this.requestors)a(this._getImagesForIds(n));this.requestors=[]}}getImage(t){const n=this.images[t];if(n&&!n.data&&n.spriteData){const a=n.spriteData;n.data=new p.R({width:a.width,height:a.height},a.context.getImageData(a.x,a.y,a.width,a.height).data),n.spriteData=null}return n}addImage(t,n){if(this.images[t])throw new Error(`Image id ${t} already exist, use updateImage instead`);this._validate(t,n)&&(this.images[t]=n)}_validate(t,n){let a=!0;const c=n.data||n.spriteData;return this._validateStretch(n.stretchX,c?.width)||(this.fire(new p.l(new Error(`Image "${t}" has invalid "stretchX" value`))),a=!1),this._validateStretch(n.stretchY,c?.height)||(this.fire(new p.l(new Error(`Image "${t}" has invalid "stretchY" value`))),a=!1),this._validateContent(n.content,n)||(this.fire(new p.l(new Error(`Image "${t}" has invalid "content" value`))),a=!1),a}_validateStretch(t,n){if(!t)return!0;let a=0;for(const c of t){if(c[0]<a||c[1]<c[0]||n<c[1])return!1;a=c[1]}return!0}_validateContent(t,n){if(!t)return!0;if(t.length!==4)return!1;const a=n.spriteData,c=a?.width||n.data.width,f=a?.height||n.data.height;return!(t[0]<0||c<t[0]||t[1]<0||f<t[1]||t[2]<0||c<t[2]||t[3]<0||f<t[3]||t[2]<t[0]||!(t[3]>=t[1]))}updateImage(t,n,a=!0){const c=this.getImage(t);if(a&&(c.data.width!==n.data.width||c.data.height!==n.data.height))throw new Error(`size mismatch between old image (${c.data.width}x${c.data.height}) and new image (${n.data.width}x${n.data.height}).`);n.version=c.version+1,this.images[t]=n,this.updatedImages[t]=!0}removeImage(t){var n;const a=this.images[t];delete this.images[t],delete this.patterns[t],!((n=a.userImage)===null||n===void 0)&&n.onRemove&&a.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(t){return new Promise(((n,a)=>{let c=!0;if(!this.isLoaded())for(const f of t)this.images[f]||(c=!1);this.isLoaded()||c?n(this._getImagesForIds(t)):this.requestors.push({ids:t,promiseResolve:n})}))}_getImagesForIds(t){var n;const a={};for(const c of t){let f=this.getImage(c);f||(this.fire(new p.n("styleimagemissing",{id:c})),f=this.getImage(c)),f?a[c]={data:f.data.clone(),pixelRatio:f.pixelRatio,sdf:f.sdf,version:f.version,stretchX:f.stretchX,stretchY:f.stretchY,content:f.content,textFitWidth:f.textFitWidth,textFitHeight:f.textFitHeight,hasRenderCallback:!!(!((n=f.userImage)===null||n===void 0)&&n.render)}:p.w(`Image "${c}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}return a}getPixelSize(){const{width:t,height:n}=this.atlasImage;return{width:t,height:n}}getPattern(t){const n=this.patterns[t],a=this.getImage(t);if(!a)return null;if(n&&n.position.version===a.version)return n.position;if(n)n.position.version=a.version;else{const c={w:a.data.width+2,h:a.data.height+2,x:0,y:0},f=new p.I(c,a);this.patterns[t]={bin:c,position:f}}return this._updatePatternAtlas(),this.patterns[t].position}bind(t){const n=t.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new p.T(t,this.atlasImage,n.RGBA),this.atlasTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}_updatePatternAtlas(){const t=[];for(const f in this.patterns)t.push(this.patterns[f].bin);const{w:n,h:a}=p.p(t),c=this.atlasImage;c.resize({width:n||1,height:a||1});for(const f in this.patterns){const{bin:y}=this.patterns[f],x=y.x+1,w=y.y+1,S=this.getImage(f).data,P=S.width,E=S.height;p.R.copy(S,c,{x:0,y:0},{x,y:w},{width:P,height:E}),p.R.copy(S,c,{x:0,y:E-1},{x,y:w-1},{width:P,height:1}),p.R.copy(S,c,{x:0,y:0},{x,y:w+E},{width:P,height:1}),p.R.copy(S,c,{x:P-1,y:0},{x:x-1,y:w},{width:1,height:E}),p.R.copy(S,c,{x:0,y:0},{x:x+P,y:w},{width:1,height:E})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(t){for(const n of t){if(this.callbackDispatchedThisFrame[n])continue;this.callbackDispatchedThisFrame[n]=!0;const a=this.getImage(n);a||p.w(`Image with ID: "${n}" was not found`),fs(a)&&this.updateImage(n,a)}}cloneImages(){const t={};for(const n in this.images){const a=this.images[n];t[n]=Object.assign(Object.assign({},a),{data:a.data?a.data.clone():null})}return t}}const qe=1e20,W=new Float64Array(256);for(let h=0;h<256;h++){const t=.5-Math.pow(h/255,.45454545454545453);W[h]=t*Math.abs(t)}function K(h,t,n,a,c,f,y,x,w){for(let S=t;S<t+a;S++)ee(h,n*f+S,f,c,y,x,w);for(let S=n;S<n+c;S++)ee(h,S*f+t,1,a,y,x,w)}function ee(h,t,n,a,c,f,y){f[0]=0,y[0]=-qe,y[1]=qe,c[0]=h[t];for(let x=1,w=0,S=0;x<a;x++){c[x]=h[t+x*n];const P=x*x;do{const E=f[w];S=(c[x]-c[E]+P-E*E)/(x-E)/2}while(S<=y[w]&&--w>-1);w++,f[w]=x,y[w]=S,y[w+1]=qe}for(let x=0,w=0;x<a;x++){for(;y[w+1]<x;)w++;const S=f[w],P=x-S;h[t+x*n]=c[S]+P*P}}W[255]=-qe;const ge=p.v.layout_symbol["text-font"].default.join(",");class Me{constructor(t,n,a){this.requestManager=t,this.localIdeographFontFamily=n,this.entries={},this.lang=a}setURL(t){this.url=t}getGlyphs(t){return p._(this,void 0,void 0,(function*(){const n=[];for(const f in t)for(const y of t[f])n.push(this._getAndCacheGlyphsPromise(f,y));const a=yield Promise.all(n),c={};for(const{stack:f,id:y,glyph:x}of a)c[f]||(c[f]={}),c[f][y]=x&&{id:x.id,bitmap:x.bitmap.clone(),metrics:x.metrics};return c}))}_getAndCacheGlyphsPromise(t,n){return p._(this,void 0,void 0,(function*(){var a,c;(a=(c=this.entries)[t])!==null&&a!==void 0||(c[t]={glyphs:{},requests:{},ranges:{}});const f=this.entries[t];let y=f.glyphs[n];return y!==void 0?{stack:t,id:n,glyph:y}:!this.url||this._charUsesLocalIdeographFontFamily(n)?(y=f.glyphs[n]=this._drawGlyph(f,t,n),{stack:t,id:n,glyph:y}):yield this._downloadAndCacheRangePromise(t,n)}))}_downloadAndCacheRangePromise(t,n){return p._(this,void 0,void 0,(function*(){var a;const c=this.entries[t],f=Math.floor(n/256);if(c.ranges[f])return{stack:t,id:n,glyph:null};(a=c.requests)[f]||(a[f]=Me.loadGlyphRange(t,f,this.url,this.requestManager));try{const y=yield c.requests[f];for(const x in y)c.glyphs[+x]=y[+x];return c.ranges[f]=!0,{stack:t,id:n,glyph:y[n]||null}}catch(y){const x=c.glyphs[n]=this._drawGlyph(c,t,n);return this._warnOnMissingGlyphRange(x,f,n,p.d(y)),{stack:t,id:n,glyph:x}}}))}_warnOnMissingGlyphRange(t,n,a,c){const f=256*n,y=f+255,x=a.toString(16).padStart(4,"0").toUpperCase();p.w(`Unable to load glyph range ${n}, ${f}-${y}. Rendering codepoint U+${x} locally instead. ${c}`)}_charUsesLocalIdeographFontFamily(t){return!!this.localIdeographFontFamily&&p.r(t)}_drawGlyph(t,n,a){const c=n===ge&&this.localIdeographFontFamily!==""&&this._charUsesLocalIdeographFontFamily(a),f=c?"ideographTinySDF":"tinySDF";t[f]||(t[f]=this._createTinySDF(c?this.localIdeographFontFamily:n));const y=t[f].draw(String.fromCodePoint(a)),x=/^\p{gc=Cf}+$/u.test(String.fromCodePoint(a));return{id:a,bitmap:new p.t({width:y.width||60,height:y.height||60},y.data),metrics:{width:x?0:y.glyphWidth/2||24,height:y.glyphHeight/2||24,left:y.glyphLeft/2+.5||0,top:y.glyphTop/2-27.5||-8,advance:x?0:y.glyphAdvance/2||24,isDoubleResolution:!0}}}_createTinySDF(t){const n=t?t.split(","):[];n.push("sans-serif");const a=n.map((c=>/[-\w]+/.test(c)?c:`'${CSS.escape(c)}'`)).join(",");return new Me.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:a,fontWeight:this._fontWeight(n[0]),fontStyle:this._fontStyle(n[0]),lang:this.lang})}_fontStyle(t){return/italic/i.test(t)?"italic":/oblique/i.test(t)?"oblique":"normal"}_fontWeight(t){const n={thin:100,hairline:100,"extra light":200,"ultra light":200,light:300,normal:400,regular:400,medium:500,semibold:600,demibold:600,bold:700,"extra bold":800,"ultra bold":800,black:900,heavy:900,"extra black":950,"ultra black":950};let a;for(const[c,f]of Object.entries(n))new RegExp(`\\b${c}\\b`,"i").test(t)&&(a=`${f}`);return a}destroy(){for(const t in this.entries){const n=this.entries[t];n.tinySDF=null,n.ideographTinySDF=null,n.glyphs={},n.requests={},n.ranges={}}this.entries={}}}Me.loadGlyphRange=function(h,t,n,a){return p._(this,void 0,void 0,(function*(){const c=256*t,f=c+255,y=yield a.transformRequest(n.replace("{fontstack}",h).replace("{range}",`${c}-${f}`),"Glyphs"),x=yield p.o(y,new AbortController);if(!x?.data)throw new Error(`Could not load glyph range. range: ${t}, ${c}-${f}`);const w={};for(const S of p.q(x.data))w[S.id]=S;return w}))},Me.TinySDF=class{constructor({fontSize:h=24,buffer:t=3,radius:n=8,cutoff:a=.25,fontFamily:c="sans-serif",fontWeight:f="normal",fontStyle:y="normal",lang:x=null}={}){this.buffer=t,this.radius=n,this.cutoff=a,this.lang=x;const w=this.size=h+4*t,S=this._createCanvas(w),P=this.ctx=S.getContext("2d",{willReadFrequently:!0});P.font=`${y} ${f} ${h}px ${c}`,P.textBaseline="alphabetic",P.textAlign="left",P.fillStyle="black",this.gridOuter=new Float64Array(w*w),this.gridInner=new Float64Array(w*w),this.f=new Float64Array(w),this.z=new Float64Array(w+1),this.v=new Uint16Array(w)}_createCanvas(h){if(typeof OffscreenCanvas<"u")return new OffscreenCanvas(h,h);const t=document.createElement("canvas");return t.width=t.height=h,t}draw(h){const{width:t,actualBoundingBoxAscent:n,actualBoundingBoxDescent:a,actualBoundingBoxLeft:c,actualBoundingBoxRight:f}=this.ctx.measureText(h),y=Math.ceil(n),x=Math.floor(c),w=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(f)-x)),S=Math.max(0,Math.min(this.size-this.buffer,y+Math.ceil(a))),P=w+2*this.buffer,E=S+2*this.buffer,C=Math.max(P*E,0),z=new Uint8ClampedArray(C),B={data:z,width:P,height:E,glyphWidth:w,glyphHeight:S,glyphTop:y,glyphLeft:x,glyphAdvance:t};if(w===0||S===0)return B;const{ctx:V,buffer:G,gridInner:N,gridOuter:$}=this;this.lang&&(V.lang=this.lang),V.clearRect(G,G,w,S),V.fillText(h,G-x,G+y);const X=V.getImageData(G,G,w,S);$.fill(qe,0,C),N.fill(0,0,C);let Z=3;for(let q=0;q<S;q++){let Q=(q+G)*P+G;for(let se=0;se<w;se++,Z+=4,Q++){const oe=X.data[Z];if(oe===0)continue;const de=W[oe];$[Q]=Math.max(0,de),N[Q]=Math.max(0,-de)}}K($,0,0,P,E,P,this.f,this.v,this.z),K(N,G,G,w,S,P,this.f,this.v,this.z);const U=255/this.radius,H=255*(1-this.cutoff);for(let q=0;q<C;q++){const Q=Math.sqrt($[q])-Math.sqrt(N[q]);z[q]=Math.round(H-U*Q)}return B}};class $e{constructor(){this.specification=p.x.light.position}possiblyEvaluate(t,n){return p.G(t.expression.evaluate(n))}interpolate(t,n,a){return{x:p.H.number(t.x,n.x,a),y:p.H.number(t.y,n.y,a),z:p.H.number(t.z,n.z,a)}}}let ze;class Ge extends p.E{constructor(t){super(),ze||(ze=new p.u({anchor:new p.D(p.x.light.anchor),position:new $e,color:new p.D(p.x.light.color),intensity:new p.D(p.x.light.intensity)})),this._transitionable=new p.y(ze,void 0),this.setLight(t),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(t,n={}){if(!this._validate(p.z,t,n))for(const a in t){const c=t[a];a.endsWith(p.B)?this._transitionable.setTransition(a.slice(0,-p.B.length),c):this._transitionable.setValue(a,c)}}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,n,a){return a?.validate!==!1&&p.C(this,t.call(p.F,{value:n,style:{glyphs:!0,sprite:!0},styleSpec:p.x}))}}const Le=new p.u({"sky-color":new p.D(p.x.sky["sky-color"]),"horizon-color":new p.D(p.x.sky["horizon-color"]),"fog-color":new p.D(p.x.sky["fog-color"]),"fog-ground-blend":new p.D(p.x.sky["fog-ground-blend"]),"horizon-fog-blend":new p.D(p.x.sky["horizon-fog-blend"]),"sky-horizon-blend":new p.D(p.x.sky["sky-horizon-blend"]),"atmosphere-blend":new p.D(p.x.sky["atmosphere-blend"])});class Ye extends p.E{constructor(t){super(),this._transitionable=new p.y(Le,void 0),this.setSky(t),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new p.J(0))}setSky(t,n={}){if(!this._validate(p.K,t,n)){t||(t={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0});for(const a in t){const c=t[a];a.endsWith(p.B)?this._transitionable.setTransition(a.slice(0,-p.B.length),c):this._transitionable.setValue(a,c)}}}getSky(){return this._transitionable.serialize()}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,n,a={}){return a?.validate!==!1&&p.C(this,t.call(p.F,p.e({value:n,style:{glyphs:!0,sprite:!0},styleSpec:p.x})))}calculateFogBlendOpacity(t){return t<60?0:t<70?(t-60)/10:1}}class De{constructor(t,n){this.width=t,this.height=n,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(t,n){var a;const c=t.join(",")+String(n);return(a=this.dashEntry)[c]||(a[c]=this.addDash(t,n)),this.dashEntry[c]}getDashRanges(t,n,a){const c=[];let f=t.length%2==1?-t[t.length-1]*a:0,y=t[0]*a,x=!0;c.push({left:f,right:y,isDash:x,zeroLength:t[0]===0});let w=t[0];for(let S=1;S<t.length;S++){x=!x;const P=t[S];f=w*a,w+=P,y=w*a,c.push({left:f,right:y,isDash:x,zeroLength:P===0})}return c}addRoundDash(t,n,a){const c=n/2;for(let f=-a;f<=a;f++){const y=this.width*(this.nextRow+a+f);let x=0,w=t[x];for(let S=0;S<this.width;S++){S/w.right>1&&(w=t[++x]);const P=Math.abs(S-w.left),E=Math.abs(S-w.right),C=Math.min(P,E);let z;const B=f/a*(c+1);if(w.isDash){const V=c-Math.abs(B);z=Math.sqrt(C*C+V*V)}else z=c-Math.sqrt(C*C+B*B);this.data[y+S]=Math.max(0,Math.min(255,z+128))}}}addRegularDash(t){for(let x=t.length-1;x>=0;--x){const w=t[x],S=t[x+1];w.zeroLength?t.splice(x,1):S&&S.isDash===w.isDash&&(S.left=w.left,t.splice(x,1))}const n=t[0],a=t[t.length-1];n.isDash===a.isDash&&(n.left=a.left-this.width,a.right=n.right+this.width);const c=this.width*this.nextRow;let f=0,y=t[f];for(let x=0;x<this.width;x++){x/y.right>1&&(y=t[++f]);const w=Math.abs(x-y.left),S=Math.abs(x-y.right),P=Math.min(w,S);this.data[c+x]=Math.max(0,Math.min(255,(y.isDash?P:-P)+128))}}addDash(t,n){const a=n?7:0,c=2*a+1;if(this.nextRow+c>this.height)return p.w("LineAtlas out of space"),null;let f=0;for(const x of t)f+=x;if(f!==0){const x=this.width/f,w=this.getDashRanges(t,this.width,x);n?this.addRoundDash(w,x,a):this.addRegularDash(w)}const y={y:this.nextRow+a,height:2*a,width:f};return this.nextRow+=c,this.dirty=!0,y}bind(t){const n=t.gl;this.texture?(n.bindTexture(n.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,n.texSubImage2D(n.TEXTURE_2D,0,0,0,this.width,this.height,n.ALPHA,n.UNSIGNED_BYTE,this.data))):(this.texture=n.createTexture(),n.bindTexture(n.TEXTURE_2D,this.texture),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.REPEAT),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.REPEAT),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),n.texImage2D(n.TEXTURE_2D,0,n.ALPHA,this.width,this.height,0,n.ALPHA,n.UNSIGNED_BYTE,this.data))}}const _t="maplibre_preloaded_worker_pool";class yt{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length<yt.workerCount;)this.workers.push(new Worker(p.c.WORKER_URL));return this.active[t]=!0,this.workers.slice()}release(t){if(delete this.active[t],this.numActive()===0){for(const n of this.workers)n.terminate();this.workers=null}}isPreloaded(){return!!this.active[_t]}numActive(){return Object.keys(this.active).length}}const Zi=Math.floor(Gt.hardwareConcurrency/2);let Ri,Sr;function Xr(){return Ri||(Ri=new yt),Ri}yt.workerCount=p.L(globalThis)?Math.max(Math.min(Zi,3),1):1;class gs{constructor(t,n){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=n;const a=this.workerPool.acquire(n);for(let c=0;c<a.length;c++){const f=new p.N(a[c],n);f.name=`Worker ${c}`,this.actors.push(f)}if(!this.actors.length)throw new Error("No actors found")}broadcast(t,n){const a=[];for(const c of this.actors)a.push(c.sendAsync({type:t,data:n}));return Promise.all(a)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(t=!0){for(const n of this.actors)n.remove();this.actors=[],t&&this.workerPool.release(this.id)}registerMessageHandler(t,n){for(const a of this.actors)a.registerMessageHandler(t,n)}unregisterMessageHandler(t){for(const n of this.actors)n.unregisterMessageHandler(t)}}function si(){return Sr||(Sr=new gs(Xr(),p.M),Sr.registerMessageHandler("GR",((h,t,n)=>p.m(t,n)))),Sr}function Dn(h,t){const n=p.O();return p.Q(n,n,[1,1,0]),p.S(n,n,[.5*h.width,.5*h.height,1]),h.calculatePosMatrix?p.U(n,n,h.calculatePosMatrix(t.toUnwrapped())):n}function Fi(h,t,n,a,c,f,y){var x;const w=(function(C,z,B){if(C)for(const V of C){const G=z[V];if(G?.source===B&&G.type==="fill-extrusion")return!0}else for(const V in z){const G=z[V];if(G.source===B&&G.type==="fill-extrusion")return!0}return!1})((x=c?.layers)!==null&&x!==void 0?x:null,t,h.id),S=f.maxPitchScaleFactor(),P=h.tilesIn(a,S,w);P.sort(_s);const E=[];for(const C of P)E.push({wrappedTileID:C.tileID.wrapped().key,queryResults:C.tile.queryRenderedFeatures(t,n,h.getState(),C.queryGeometry,C.cameraQueryGeometry,C.scale,c,f,S,Dn(f,C.tileID),y?(z,B)=>y(C.tileID,z,B):void 0)});return(function(C,z){for(const B in C)for(const V of C[B])Pr(V,z);return C})((function(C){const z={},B={};for(const{queryResults:V,wrappedTileID:G}of C){B[G]||(B[G]={});const N=B[G];for(const $ in V){const X=V[$];N[$]||(N[$]={});const Z=N[$];z[$]||(z[$]=[]);for(const U of X)Z[U.featureIndex]||(Z[U.featureIndex]=!0,z[$].push(U))}}return z})(E),h)}function _s(h,t){const n=h.tileID,a=t.tileID;return n.overscaledZ-a.overscaledZ||n.canonical.y-a.canonical.y||n.wrap-a.wrap||n.canonical.x-a.canonical.x}function Pr(h,t){const n=h.feature,a=t.getFeatureState(n.layer["source-layer"],n.id);n.source=n.layer.source,n.layer["source-layer"]&&(n.sourceLayer=n.layer["source-layer"]),n.state=a}function Yr(h,t,n,a){return p._(this,void 0,void 0,(function*(){let c=h;if(h.url?c=(yield p.k(yield t.transformRequest(h.url,"Source"),n)).data:yield Gt.frameAsync(n,a),!c)return null;const f=p.V(p.e(c,h),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in c&&c.vector_layers&&(f.vectorLayerIds=c.vector_layers.map((y=>y.id))),f}))}class ke{constructor(t,n){t&&(n?this.setSouthWest(t).setNorthEast(n):Array.isArray(t)&&(t.length===4?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1])))}setNorthEast(t){return this._ne=t instanceof p.W?new p.W(t.lng,t.lat):p.W.convert(t),this}setSouthWest(t){return this._sw=t instanceof p.W?new p.W(t.lng,t.lat):p.W.convert(t),this}extend(t){const n=this._sw,a=this._ne;let c,f;if(t instanceof p.W)c=t,f=t;else{if(!(t instanceof ke))return Array.isArray(t)?t.length===4||t.every(Array.isArray)?this.extend(ke.convert(t)):this.extend(p.W.convert(t)):t&&("lng"in t||"lon"in t)&&"lat"in t?this.extend(p.W.convert(t)):this;if(c=t._sw,f=t._ne,!c||!f)return this}return n||a?(n.lng=Math.min(c.lng,n.lng),n.lat=Math.min(c.lat,n.lat),a.lng=Math.max(f.lng,a.lng),a.lat=Math.max(f.lat,a.lat)):(this._sw=new p.W(c.lng,c.lat),this._ne=new p.W(f.lng,f.lat)),this}getCenter(){return new p.W((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new p.W(this.getWest(),this.getNorth())}getSouthEast(){return new p.W(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(t){const{lng:n,lat:a}=p.W.convert(t);let c=this._sw.lng<=n&&n<=this._ne.lng;return this._sw.lng>this._ne.lng&&(c=this._sw.lng>=n&&n>=this._ne.lng),this._sw.lat<=a&&a<=this._ne.lat&&c}intersects(t){if(!((t=ke.convert(t)).getNorth()>=this.getSouth()&&t.getSouth()<=this.getNorth()))return!1;const n=Math.abs(this.getEast()-this.getWest()),a=Math.abs(t.getEast()-t.getWest());if(n>=360||a>=360)return!0;const c=p.X(this.getWest(),-180,180),f=p.X(this.getEast(),-180,180),y=p.X(t.getWest(),-180,180),x=p.X(t.getEast(),-180,180),w=c>f,S=y>x;return!(!w||!S)||(w?x>=c||y<=f:S?f>=y||c<=x:y<=f&&x>=c)}static convert(t){return t instanceof ke?t:t&&new ke(t)}static fromLngLat(t,n=0){const a=360*n/40075017,c=a/Math.cos(Math.PI/180*t.lat);return new ke(new p.W(t.lng-c,t.lat-a),new p.W(t.lng+c,t.lat+a))}adjustAntiMeridian(){const t=new p.W(this._sw.lng,this._sw.lat),n=new p.W(this._ne.lng,this._ne.lat);return new ke(t,t.lng>n.lng?new p.W(n.lng+360,n.lat):n)}}class Ft{constructor(t,n,a){this.bounds=ke.convert(this.validateBounds(t)),this.minzoom=n||0,this.maxzoom=a||24}validateBounds(t){return Array.isArray(t)&&t.length===4?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]}contains(t){const n=Math.pow(2,t.z),a=Math.floor(p.Z(this.bounds.getWest())*n),c=Math.floor(p.Y(this.bounds.getNorth())*n),f=Math.ceil(p.Z(this.bounds.getEast())*n),y=Math.ceil(p.Y(this.bounds.getSouth())*n);return t.x>=a&&t.x<f&&t.y>=c&&t.y<y}}class $t extends p.E{constructor(t,n,a,c){if(super(),this.id=t,this.dispatcher=a,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,p.e(this,p.V(n,["url","scheme","tileSize","promoteId","encoding"])),this._options=p.e({type:"vector"},n),this._collectResourceTiming=n.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(c)}load(){return p._(this,arguments,void 0,(function*(t=!1){this._loaded=!1,this.fire(new p.n("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const n=yield Yr(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=!0,n&&(p.e(this,n),n.bounds&&(this.tileBounds=new Ft(n.bounds,this.minzoom,this.maxzoom)),this.fire(new p.n("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new p.n("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:t})))}catch(n){this._tileJSONRequest=null,this._loaded=!0,p.$(n)||this.fire(new p.l(p.d(n)))}}))}loaded(){return this._loaded}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load()}setSourceProperty(t){this._tileJSONRequest&&this._tileJSONRequest.abort(),t(),this.load(!0)}setTiles(t){return this.setSourceProperty((()=>{this._options.tiles=t})),this}setUrl(t){return this.setSourceProperty((()=>{this.url=t,this._options.url=t})),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return p.e({},this._options)}loadTile(t){return p._(this,void 0,void 0,(function*(){const n=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),a={request:yield this.map._requestManager.transformRequest(n,"Tile"),uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity,encoding:this.encoding,overzoomParameters:yield this._getOverzoomParameters(t),etag:t.etag};a.request.collectResourceTiming=this._collectResourceTiming;let c="RT";if(t.actor&&t.state!=="expired"){if(t.state==="loading")return new Promise(((f,y)=>{t.reloadPromise={resolve:f,reject:y}}))}else t.actor=this.dispatcher.getActor(),c="LT";t.abortController=new AbortController;try{const f=yield t.actor.sendAsync({type:c,data:a},t.abortController);if(delete t.abortController,t.aborted)return;this._afterTileLoadWorkerResponse(t,f);const y={};return f?.etagUnmodified&&(y.unmodified=!0),y}catch(f){if(delete t.abortController,t.aborted)return;if(f&&f.status!==404)throw f;this._afterTileLoadWorkerResponse(t,null)}}))}_getOverzoomParameters(t){return p._(this,void 0,void 0,(function*(){if(t.tileID.canonical.z<=this.maxzoom||this.map._zoomLevelsToOverscale===void 0)return;const n=t.tileID.scaledTo(this.maxzoom).canonical,a=n.url(this.tiles,this.map.getPixelRatio(),this.scheme);return{maxZoomTileID:n,overzoomRequest:yield this.map._requestManager.transformRequest(a,"Tile")}}))}_afterTileLoadWorkerResponse(t,n){if(n?.resourceTiming&&(t.resourceTiming=n.resourceTiming),n&&this.map._refreshExpiredTiles&&t.setExpiryData(n),t.etag=n?.etag,t.loadVectorData(n,this.map.painter),t.reloadPromise){const a=t.reloadPromise;t.reloadPromise=null,this.loadTile(t).then(a.resolve).catch(a.reject)}}abortTile(t){return p._(this,void 0,void 0,(function*(){t.abortController&&(t.abortController.abort(),delete t.abortController),t.actor&&(yield t.actor.sendAsync({type:"AT",data:{uid:t.uid,type:this.type,source:this.id}}))}))}unloadTile(t){return p._(this,void 0,void 0,(function*(){t.unloadVectorData(),t.actor&&(yield t.actor.sendAsync({type:"RMT",data:{uid:t.uid,type:this.type,source:this.id}}))}))}hasTransition(){return!1}}class Si extends p.E{constructor(t,n,a,c){super(),this.id=t,this.dispatcher=a,this.setEventedParent(c),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=p.e({type:"raster"},n),p.e(this,p.V(n,["url","scheme","tileSize"]))}load(){return p._(this,arguments,void 0,(function*(t=!1){this._loaded=!1,this.fire(new p.n("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const n=yield Yr(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=!0,n&&(p.e(this,n),n.bounds&&(this.tileBounds=new Ft(n.bounds,this.minzoom,this.maxzoom)),this.fire(new p.n("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new p.n("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:t})))}catch(n){this._tileJSONRequest=null,this._loaded=!0,p.$(n)||this.fire(new p.l(p.d(n)))}}))}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(t){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),t(),this.load(!0)}setTiles(t){return this.setSourceProperty((()=>{this._options.tiles=t})),this}setUrl(t){return this.setSourceProperty((()=>{this.url=t,this._options.url=t})),this}serialize(){return p.e({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t){return p._(this,void 0,void 0,(function*(){const n=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.abortController=new AbortController;try{const a=yield Ti.getImage(yield this.map._requestManager.transformRequest(n,"Tile"),t.abortController,this.map._refreshExpiredTiles);if(delete t.abortController,t.aborted)return void(t.state="unloaded");if(a?.data){this.map._refreshExpiredTiles&&(a.cacheControl||a.expires)&&t.setExpiryData({cacheControl:a.cacheControl,expires:a.expires});const c=this.map.painter.context,f=c.gl,y=a.data;t.texture=this.map.painter.getTileTexture(y.width),t.texture?t.texture.update(y,{useMipmap:!0}):(t.texture=new p.T(c,y,f.RGBA,{useMipmap:!0}),t.texture.bind(f.LINEAR,f.CLAMP_TO_EDGE,f.LINEAR_MIPMAP_NEAREST)),t.state="loaded"}}catch(a){if(delete t.abortController,t.aborted)t.state="unloaded";else if(a)throw t.state="errored",a}}))}abortTile(t){return p._(this,void 0,void 0,(function*(){t.abortController&&(t.abortController.abort(),delete t.abortController)}))}unloadTile(t){return p._(this,void 0,void 0,(function*(){t.texture&&this.map.painter.saveTileTexture(t.texture)}))}hasTransition(){return!1}}class Zt extends Si{constructor(t,n,a,c){super(t,n,a,c),this.type="raster-dem",this.maxzoom=22,this._options=p.e({type:"raster-dem"},n),this.encoding=n.encoding||"mapbox",this.redFactor=n.redFactor,this.greenFactor=n.greenFactor,this.blueFactor=n.blueFactor,this.baseShift=n.baseShift}loadTile(t){return p._(this,void 0,void 0,(function*(){const n=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),a=yield this.map._requestManager.transformRequest(n,"Tile");t.neighboringTiles=this._getNeighboringTiles(t.tileID),t.abortController=new AbortController;try{const c=yield Ti.getImage(a,t.abortController,this.map._refreshExpiredTiles);if(delete t.abortController,t.aborted)return void(t.state="unloaded");if(c?.data){const f=c.data;this.map._refreshExpiredTiles&&(c.cacheControl||c.expires)&&t.setExpiryData({cacheControl:c.cacheControl,expires:c.expires});const y=p.b(f)&&p.a0()?f:yield this.readImageNow(f),x={type:this.type,uid:t.uid,source:this.id,rawImageData:y,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(t.actor&&t.state!=="expired"&&t.state!=="reloading")return;t.actor&&t.state!=="expired"||(t.actor=this.dispatcher.getActor()),t.dem=yield t.actor.sendAsync({type:"LDT",data:x}),t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.state="loaded"}}catch(c){if(delete t.abortController,t.aborted)t.state="unloaded";else if(c)throw t.state="errored",c}}))}readImageNow(t){return p._(this,void 0,void 0,(function*(){if(typeof VideoFrame<"u"&&p.a1()){const n=t.width+2,a=t.height+2;try{return new p.R({width:n,height:a},yield p.a2(t,-1,-1,n,a))}catch{}}return Gt.getImageData(t,1)}))}_getNeighboringTiles(t){const n=t.canonical,a=Math.pow(2,n.z),c=(n.x-1+a)%a,f=n.x===0?t.wrap-1:t.wrap,y=(n.x+1+a)%a,x=n.x+1===a?t.wrap+1:t.wrap,w={};return w[new p.a3(t.overscaledZ,f,n.z,c,n.y).key]={backfilled:!1},w[new p.a3(t.overscaledZ,x,n.z,y,n.y).key]={backfilled:!1},n.y>0&&(w[new p.a3(t.overscaledZ,f,n.z,c,n.y-1).key]={backfilled:!1},w[new p.a3(t.overscaledZ,t.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},w[new p.a3(t.overscaledZ,x,n.z,y,n.y-1).key]={backfilled:!1}),n.y+1<a&&(w[new p.a3(t.overscaledZ,f,n.z,c,n.y+1).key]={backfilled:!1},w[new p.a3(t.overscaledZ,t.wrap,n.z,n.x,n.y+1).key]={backfilled:!1},w[new p.a3(t.overscaledZ,x,n.z,y,n.y+1).key]={backfilled:!1}),w}unloadTile(t){return p._(this,void 0,void 0,(function*(){t.demTexture&&this.map.painter.saveTileTexture(t.demTexture),t.fbo&&(t.fbo.destroy(),delete t.fbo),t.dem&&delete t.dem,delete t.neighboringTiles,t.state="unloaded",t.actor&&(yield t.actor.sendAsync({type:"RDT",data:{type:this.type,uid:t.uid,source:this.id}}))}))}}function mi(h,t){return t?h.properties[t]:h.id}function Kr(h,t){const n={id:h.id};if(t.removeAllProperties&&(delete h.removeProperties,delete h.addOrUpdateProperties,delete t.removeProperties),t.removeProperties)for(const a of t.removeProperties){const c=h.addOrUpdateProperties.findIndex((f=>f.key===a));c>-1&&h.addOrUpdateProperties.splice(c,1)}return(h.removeAllProperties||t.removeAllProperties)&&(n.removeAllProperties=!0),(h.removeProperties||t.removeProperties)&&(n.removeProperties=[...h.removeProperties||[],...t.removeProperties||[]]),(h.addOrUpdateProperties||t.addOrUpdateProperties)&&(n.addOrUpdateProperties=[...h.addOrUpdateProperties||[],...t.addOrUpdateProperties||[]]),(h.newGeometry||t.newGeometry)&&(n.newGeometry=t.newGeometry||h.newGeometry),n}function za(h){var t,n;if(!h)return{};const a={};return a.removeAll=h.removeAll,a.remove=new Set(h.remove||[]),a.add=new Map((t=h.add)===null||t===void 0?void 0:t.map((c=>[c.id,c]))),a.update=new Map((n=h.update)===null||n===void 0?void 0:n.map((c=>[c.id,c]))),a}function ka(h){return h&&h.length!==0?typeof h[0]=="number"?[h]:h.flatMap((t=>ka(t))):[]}function Ir(h){return h.type==="GeometryCollection"?h.geometries.flatMap((t=>Ir(t))):ka(h.coordinates)}function zn(h){const t=new ke;let n;switch(h.type){case"FeatureCollection":n=h.features.flatMap((a=>Ir(a.geometry)));break;case"Feature":n=Ir(h.geometry);break;default:n=Ir(h)}if(n.length===0)return t;for(const a of n){const[c,f]=a;t.extend([c,f])}return t}class co extends p.E{constructor(t,n,a,c){super(),this.id=t,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._isUpdatingWorker=!1,this._pendingWorkerUpdate={data:n.data},this.actor=a.getActor(),this.setEventedParent(c),this._data=typeof n.data=="string"?{url:n.data}:{geojson:n.data},this._options=p.e({},n),this._collectResourceTiming=n.collectResourceTiming,n.maxzoom!==void 0&&(this.maxzoom=n.maxzoom),n.type&&(this.type=n.type),n.attribution&&(this.attribution=n.attribution),this.promoteId=n.promoteId,n.clusterMaxZoom!==void 0&&this.maxzoom<=n.clusterMaxZoom&&p.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${n.clusterMaxZoom}".`),this.workerOptions=p.e({source:this.id,geojsonVtOptions:{buffer:this._pixelsToTileUnits(n.buffer!==void 0?n.buffer:128),tolerance:this._pixelsToTileUnits(n.tolerance!==void 0?n.tolerance:.375),extent:p.a6,maxZoom:this.maxzoom,lineMetrics:n.lineMetrics||!1,generateId:n.generateId||!1,promoteId:typeof n.promoteId=="string"?n.promoteId:void 0,cluster:n.cluster||!1,clusterOptions:{maxZoom:this._getClusterMaxZoom(n.clusterMaxZoom),minPoints:Math.max(2,n.clusterMinPoints||2),extent:p.a6,radius:this._pixelsToTileUnits(n.clusterRadius||50),log:!1,generateId:n.generateId||!1}},clusterProperties:n.clusterProperties,filter:n.filter},n.workerOptions)}_hasPendingWorkerUpdate(){return this._pendingWorkerUpdate.data!==void 0||this._pendingWorkerUpdate.diff!==void 0||this._pendingWorkerUpdate.updateCluster}_pixelsToTileUnits(t){return t*(p.a6/this.tileSize)}_getClusterMaxZoom(t){const n=t?Math.round(t):this.maxzoom-1;return Number.isInteger(t)||t===void 0||p.w(`Integer expected for option 'clusterMaxZoom': provided value "${t}" rounded to "${n}"`),n}load(){return p._(this,void 0,void 0,(function*(){yield this._updateWorkerData()}))}onAdd(t){this.map=t,this.load()}setData(t,n){this._data=typeof t=="string"?{url:t}:{geojson:t},this._pendingWorkerUpdate={data:t};const a=this._updateWorkerData();return n?a:this}updateData(t,n){this._pendingWorkerUpdate.diff=(function(c,f){if(!c)return f||{};if(!f)return c||{};const y=za(c),x=za(f);(function(S,P){P.removeAll&&(S.add.clear(),S.update.clear(),S.remove.clear(),P.remove.clear());for(const E of P.remove)S.add.delete(E),S.update.delete(E);for(const[E,C]of P.update){const z=S.update.get(E);z&&(P.update.set(E,Kr(z,C)),S.update.delete(E))}})(y,x);const w={};if((y.removeAll||x.removeAll)&&(w.removeAll=!0),w.remove=new Set([...y.remove,...x.remove]),w.add=new Map([...y.add,...x.add]),w.update=new Map([...y.update,...x.update]),w.remove.size&&w.add.size)for(const S of w.add.keys())w.remove.delete(S);return(function(S){const P={};return S.removeAll&&(P.removeAll=S.removeAll),S.remove&&(P.remove=Array.from(S.remove)),S.add&&(P.add=Array.from(S.add.values())),S.update&&(P.update=Array.from(S.update.values())),P})(w)})(this._pendingWorkerUpdate.diff,t);const a=this._updateWorkerData();return n?a:this}getData(){return p._(this,void 0,void 0,(function*(){return this._data.url&&(yield this.once("data")),this._data.geojson?this._data.geojson:{type:"FeatureCollection",features:Array.from(this._data.updateable.values())}}))}getBounds(){return p._(this,void 0,void 0,(function*(){return zn(yield this.getData())}))}setClusterOptions(t){return this.workerOptions.geojsonVtOptions.cluster=t.cluster,t.clusterRadius!==void 0&&(this.workerOptions.geojsonVtOptions.clusterOptions.radius=this._pixelsToTileUnits(t.clusterRadius)),t.clusterMaxZoom!==void 0&&(this.workerOptions.geojsonVtOptions.clusterOptions.maxZoom=this._getClusterMaxZoom(t.clusterMaxZoom)),this._pendingWorkerUpdate.updateCluster=!0,this._updateWorkerData(),this}getClusterExpansionZoom(t){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:t,source:this.id}})}getClusterChildren(t){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:t,source:this.id}})}getClusterLeaves(t,n,a){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:t,limit:n,offset:a}})}_updateWorkerData(){return p._(this,void 0,void 0,(function*(){if(this._isUpdatingWorker)return;if(!this._hasPendingWorkerUpdate())return void p.w(`No pending worker updates for GeoJSONSource ${this.id}.`);const{data:t,diff:n,updateCluster:a}=this._pendingWorkerUpdate,c=this._getLoadGeoJSONParameters(t,n,a);t!==void 0?this._pendingWorkerUpdate.data=void 0:n?this._pendingWorkerUpdate.diff=void 0:a&&(this._pendingWorkerUpdate.updateCluster=void 0),yield this._dispatchWorkerUpdate(c)}))}_getLoadGeoJSONParameters(t,n,a){return p._(this,void 0,void 0,(function*(){const c=p.e({type:this.type},this.workerOptions);return typeof t=="string"?(c.request=yield this.map._requestManager.transformRequest(Gt.resolveURL(t),"Source"),c.request.collectResourceTiming=this._collectResourceTiming,c):t!==void 0?(c.data=t,c):n?(c.dataDiff=n,c):a?(c.updateCluster=!0,c):void 0}))}_dispatchWorkerUpdate(t){return p._(this,void 0,void 0,(function*(){this._isUpdatingWorker=!0,this.fire(new p.n("dataloading",{dataType:"source"}));try{const n=yield t,a=yield this.actor.sendAsync({type:"LD",data:n});if(this._isUpdatingWorker=!1,this._removed||a.abandoned)return void this.fire(new p.n("dataabort",{dataType:"source"}));a.data&&(this._data={geojson:a.data});const c=this._applyDiffToSource(n.dataDiff),f=this._getShouldReloadTileOptions(c),y={dataType:"source"};this._applyResourceTiming(y,a),this.fire(new p.n("data",Object.assign(Object.assign({},y),{sourceDataType:"metadata"}))),this.fire(new p.n("data",Object.assign(Object.assign({},y),{sourceDataType:"content",shouldReloadTileOptions:f})))}catch(n){if(this._isUpdatingWorker=!1,this._removed)return void this.fire(new p.n("dataabort",{dataType:"source"}));this.fire(new p.l(p.d(n)))}finally{this._hasPendingWorkerUpdate()&&this._updateWorkerData()}}))}_applyResourceTiming(t,n){var a;if(!this._collectResourceTiming)return;const c=(a=n.resourceTiming)===null||a===void 0?void 0:a[this.id];if(!c)return;const f=c.slice(0);f?.length&&p.e(t,{resourceTiming:f})}_applyDiffToSource(t){if(!t)return;const n=typeof this.promoteId=="string"?this.promoteId:void 0;if(!this._data.url&&!this._data.updateable){const c=(function(f,y){const x=new Map;if(f==null||f.type==null)return x;if(f.type==="Feature"){const w=mi(f,y);return w==null?void 0:(x.set(w,f),x)}if(f.type==="FeatureCollection"){const w=new Set;for(const S of f.features){const P=mi(S,y);if(P==null||w.has(P))return;w.add(P),x.set(P,S)}return x}})(this._data.geojson,n);if(!c)throw new Error(`GeoJSONSource "${this.id}": GeoJSON data is not compatible with updateData`);this._data={updateable:c}}if(!this._data.updateable)return;const a=(function(c,f,y){var x,w;const S=[];if(f.removeAll)c.clear();else if(f.remove)for(const P of f.remove){const E=c.get(P);E&&(S.push(E.geometry),c.delete(P))}if(f.add)for(const P of f.add){const E=mi(P,y);if(E==null)continue;const C=c.get(E);C&&S.push(C.geometry),S.push(P.geometry),c.set(E,P)}if(f.update)for(const P of f.update){const E=c.get(P.id);if(!E)continue;const C=!!P.newGeometry,z=P.removeAllProperties||((x=P.removeProperties)===null||x===void 0?void 0:x.length)>0||((w=P.addOrUpdateProperties)===null||w===void 0?void 0:w.length)>0;if(!C&&!z)continue;S.push(E.geometry);const B=Object.assign({},E);if(c.set(P.id,B),C&&(S.push(P.newGeometry),B.geometry=P.newGeometry),z){if(B.properties=P.removeAllProperties?{}:Object.assign({},B.properties||{}),P.removeProperties)for(const V of P.removeProperties)delete B.properties[V];if(P.addOrUpdateProperties)for(const{key:V,value:G}of P.addOrUpdateProperties)B.properties[V]=G}}return S})(this._data.updateable,t,n);return t.removeAll||this._options.cluster?void 0:a}_getShouldReloadTileOptions(t){if(t)return{affectedBounds:t.filter(Boolean).map((n=>zn(n)))}}shouldReloadTile(t,{affectedBounds:n}){if(t.state==="loading")return!0;if(t.state==="unloaded")return!1;const{buffer:a,extent:c}=this.workerOptions.geojsonVtOptions,f=(function({x:y,y:x,z:w},S=0){const P=p.a4((y-S)/Math.pow(2,w)),E=p.a5((x+1+S)/Math.pow(2,w)),C=p.a4((y+1+S)/Math.pow(2,w)),z=p.a5((x-S)/Math.pow(2,w));return new ke([P,E],[C,z])})(t.tileID.canonical,a/c);for(const y of n)if(f.intersects(y))return!0;return!1}loaded(){return!this._isUpdatingWorker&&!this._hasPendingWorkerUpdate()}loadTile(t){return p._(this,void 0,void 0,(function*(){const n=t.actor?"RT":"LT";t.actor=this.actor;const a={type:this.type,uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity};t.abortController=new AbortController;const c=yield this.actor.sendAsync({type:n,data:a},t.abortController);delete t.abortController,t.unloadVectorData(),t.aborted||t.loadVectorData(c,this.map.painter,n==="RT")}))}abortTile(t){return p._(this,void 0,void 0,(function*(){t.abortController&&(t.abortController.abort(),delete t.abortController),t.aborted=!0}))}unloadTile(t){return p._(this,void 0,void 0,(function*(){t.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:t.uid,type:this.type,source:this.id}})}))}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return p.e({},this._options,{type:this.type,data:this._data.updateable?{type:"FeatureCollection",features:Array.from(this._data.updateable.values())}:this._data.url||this._data.geojson})}hasTransition(){return!1}}class Mr extends p.E{constructor(t,n,a,c){super(),this.flippedWindingOrder=!1,this.id=t,this.dispatcher=a,this.coordinates=n.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(c),this.options=n}load(t){return p._(this,void 0,void 0,(function*(){this._loaded=!1,this.fire(new p.n("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const n=yield Ti.getImage(yield this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,n?.data&&(this.image=n.data,t&&(this.coordinates=t),this._finishLoading())}catch(n){this._request=null,this._loaded=!0,p.$(n)||this.fire(new p.l(p.d(n)))}}))}loaded(){return this._loaded}updateImage(t){return t.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=t.url,this.load(t.coordinates).finally((()=>this.texture=null)),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new p.n("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(t){this.coordinates=t;const n=t.map(p.a7.fromLngLat);var a;return this.tileID=(function(c){const f=p.a8.fromPoints(c),y=f.width(),x=f.height(),w=Math.max(y,x),S=Math.max(0,Math.floor(-Math.log(w)/Math.LN2)),P=Math.pow(2,S);return new p.aa(S,Math.floor((f.minX+f.maxX)/2*P),Math.floor((f.minY+f.maxY)/2*P))})(n),this.terrainTileRanges=this._getOverlappingTileRanges(n),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=n.map((c=>this.tileID.getTilePoint(c)._round())),this.flippedWindingOrder=((a=this.tileCoords)[1].x-a[0].x)*(a[2].y-a[0].y)-(a[1].y-a[0].y)*(a[2].x-a[0].x)<0,this.fire(new p.n("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const t=this.map.painter.context,n=t.gl;this.texture||(this.texture=new p.T(t,this.image,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let a=!1;for(const c in this.tiles){const f=this.tiles[c];f.state!=="loaded"&&(f.state="loaded",f.texture=this.texture,a=!0)}a&&this.fire(new p.n("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(t){return p._(this,void 0,void 0,(function*(){var n;!((n=this.tileID)===null||n===void 0)&&n.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={}):t.state="errored"}))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}_getOverlappingTileRanges(t){const{minX:n,minY:a,maxX:c,maxY:f}=p.a8.fromPoints(t),y={};for(let x=0;x<=p.a9;x++){const w=Math.pow(2,x),S=Math.floor(n*w),P=Math.floor(a*w),E=Math.floor(c*w),C=Math.floor(f*w),z=(S%w+w)%w,B=E%w,V=Math.floor(S/w),G=Math.floor(E/w);y[x]={minWrap:V,maxWrap:G,minTileXWrapped:z,maxTileXWrapped:B,minTileY:P,maxTileY:C}}return y}}class Jr extends Mr{constructor(t,n,a,c){super(t,n,a,c),this._onPlayingHandler=()=>{var f;(f=this.map)===null||f===void 0||f.triggerRepaint()},this.roundZoom=!0,this.type="video",this.options=n}load(){return p._(this,void 0,void 0,(function*(){this._loaded=!1;const t=this.options;this.urls=[];for(const n of t.urls)this.urls.push((yield this.map._requestManager.transformRequest(n,"Source")).url);try{const n=yield p.ab(this.urls);if(this._loaded=!0,!n)return;this.video=n,this.video.loop=!0,this.video.addEventListener("playing",this._onPlayingHandler),this.map&&this.video.play(),this._finishLoading()}catch(n){this.fire(new p.l(p.d(n)))}}))}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){const n=this.video.seekable;t<n.start(0)||t>n.end(0)?this.fire(new p.l(new p.ac(`sources.${this.id}`,null,`Playback for this video can be set only between the ${n.start(0)} and ${n.end(0)}-second mark.`))):this.video.currentTime=t}}getVideo(){return this.video}onAdd(t){this.map||(this.map=t,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}onRemove(){super.onRemove(),this.video&&(this.video.removeEventListener("playing",this._onPlayingHandler),this.video.pause())}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const t=this.map.painter.context,n=t.gl;this.texture?this.video.paused||(this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),n.texSubImage2D(n.TEXTURE_2D,0,0,0,n.RGBA,n.UNSIGNED_BYTE,this.video)):(this.texture=new p.T(t,this.video,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let a=!1;for(const c in this.tiles){const f=this.tiles[c];f.state!=="loaded"&&(f.state="loaded",f.texture=this.texture,a=!0)}a&&this.fire(new p.n("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class Ra extends Mr{constructor(t,n,a,c){super(t,n,a,c),n.coordinates?Array.isArray(n.coordinates)&&n.coordinates.length===4&&!n.coordinates.some((f=>!Array.isArray(f)||f.length!==2||f.some((y=>typeof y!="number"))))||this.fire(new p.l(new p.ac(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new p.l(new p.ac(`sources.${t}`,null,'missing required property "coordinates"'))),n.animate&&typeof n.animate!="boolean"&&this.fire(new p.l(new p.ac(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),n.canvas?typeof n.canvas=="string"||n.canvas instanceof HTMLCanvasElement||this.fire(new p.l(new p.ac(`sources.${t}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new p.l(new p.ac(`sources.${t}`,null,'missing required property "canvas"'))),this.options=n,this.animate=n.animate===void 0||n.animate}load(){return p._(this,void 0,void 0,(function*(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new p.l(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}))}getCanvas(){return this.canvas}onAdd(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let t=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,t=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,t=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const n=this.map.painter.context,a=n.gl;this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):(this.texture=new p.T(n,this.canvas,a.RGBA,{premultiply:!0}),this.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE));let c=!1;for(const f in this.tiles){const y=this.tiles[f];y.state!=="loaded"&&(y.state="loaded",y.texture=this.texture,c=!0)}c&&this.fire(new p.n("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",animate:this.animate,canvas:this.options.canvas,coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const t of[this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return!0;return!1}}const Fa={},uo=h=>{switch(h){case"geojson":return co;case"image":return Mr;case"raster":return Si;case"raster-dem":return Zt;case"vector":return $t;case"video":return Jr;case"canvas":return Ra}return Fa[h]},ys="RTLPluginLoaded";class rc extends p.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=si()}_syncState(t){return this.status=t,this.dispatcher.broadcast("SRPS",{pluginStatus:t,pluginURL:this.url}).catch((n=>{throw this.status="error",n}))}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(t){return p._(this,arguments,void 0,(function*(n,a=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=Gt.resolveURL(n),!this.url)throw new Error(`requested url ${n} is invalid`);if(this.status==="unavailable"){if(!a)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()}))}_requestImport(){return p._(this,void 0,void 0,(function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new p.n(ys))}))}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let ho=null;function Er(){return ho||(ho=new rc),ho}var ar,Li;(function(h){h[h.Base=0]="Base",h[h.Parent=1]="Parent"})(ar||(ar={})),(function(h){h[h.Departing=0]="Departing",h[h.Incoming=1]="Incoming"})(Li||(Li={}));class kn{constructor(t,n){this.timeAdded=0,this.fadeEndTime=0,this.fadeOpacity=1,this.tileID=t,this.uid=p.ad(),this.uses=0,this.tileSize=n,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttFingerprint={},this.expiredRequestCount=0,this.state="loading"}isRenderable(t){return this.hasData()&&(!this.fadeEndTime||this.fadeOpacity>0)&&(t||!this.holdingForSymbolFade())}setCrossFadeLogic({fadingRole:t,fadingDirection:n,fadingParentID:a,fadeEndTime:c}){this.resetFadeLogic(),this.fadingRole=t,this.fadingDirection=n,this.fadingParentID=a,this.fadeEndTime=c}setSelfFadeLogic(t){this.resetFadeLogic(),this.selfFading=!0,this.fadeEndTime=t}resetFadeLogic(){this.fadingRole=null,this.fadingDirection=null,this.fadingParentID=null,this.selfFading=!1,this.timeAdded=He(),this.fadeEndTime=0,this.fadeOpacity=1}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(t){this.demTexture&&t.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(t,n,a){if(t?.etagUnmodified!==!0)if(this.hasData()&&this.unloadVectorData(),this.state="loaded",t){t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestEncoding=t.encoding,this.latestFeatureIndex.rawTileData=t.rawTileData,this.latestFeatureIndex.encoding=t.encoding):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData,this.latestFeatureIndex.encoding=this.latestEncoding)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=(function(c,f){const y={};if(!f)return y;for(const x of c){const w=x.layerIds.map((S=>f.getLayer(S))).filter(Boolean);if(w.length!==0){x.layers=w,x.stateDependentLayerIds&&(x.stateDependentLayers=x.stateDependentLayerIds.map((S=>w.filter((P=>P.id===S))[0])));for(const S of w)y[S.id]=x}}return y})(t.buckets,n?.style),this.hasSymbolBuckets=!1;for(const c in this.buckets){const f=this.buckets[c];if(f instanceof p.af){if(this.hasSymbolBuckets=!0,!a)break;f.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const c in this.buckets){const f=this.buckets[c];if(f instanceof p.af&&f.hasRTLText){this.hasRTLText=!0,Er().lazyLoad();break}}this.queryPadding=0;for(const c in this.buckets){const f=this.buckets[c];this.queryPadding=Math.max(this.queryPadding,n.style.getLayer(c).queryRadius(f))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage),this.dashPositions=t.dashPositions}else this.collisionBoxArray=new p.ae;else this.state="loaded"}unloadVectorData(){for(const t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.imageAtlas=null,this.dashPositions=null,this.latestFeatureIndex=null,this.state="unloaded"}getBucket(t){return this.buckets[t.id]}upload(t){for(const a in this.buckets){const c=this.buckets[a];c.uploadPending()&&c.upload(t)}const n=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new p.T(t,this.imageAtlas.image,n.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new p.T(t,this.glyphAtlasImage,n.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,n,a,c,f,y,x,w,S,P,E){var C;return!((C=this.latestFeatureIndex)===null||C===void 0)&&C.rawTileData?this.latestFeatureIndex.query({queryGeometry:c,cameraQueryGeometry:f,scale:y,tileSize:this.tileSize,pixelPosMatrix:P,transform:w,params:x,queryPadding:this.queryPadding*S,getElevation:E},t,n,a):{}}querySourceFeatures(t,n){const a=this.latestFeatureIndex;if(!a?.rawTileData)return;const c=a.loadVTLayers(),f=n?.sourceLayer?n.sourceLayer:"",y=c[p.ag]||c[f];if(!y)return;const x=p.ah(n?.filter,n?.globalState),{z:w,x:S,y:P}=this.tileID.canonical,E={z:w,x:S,y:P};for(let C=0;C<y.length;C++){const z=y.feature(C);if(x.needGeometry){const G=p.ai(z,!0);if(!x.filter(new p.J(this.tileID.overscaledZ),G,this.tileID.canonical))continue}else if(!x.filter(new p.J(this.tileID.overscaledZ),z))continue;const B=a.getId(z,f),V=new p.aj(z,w,S,P,B);V.tile=E,t.push(V)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(t){const n=this.expirationTime;if(t.cacheControl){const a=p.ak(t.cacheControl);a["max-age"]&&(this.expirationTime=Date.now()+1e3*a["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){const a=Date.now();let c=!1;if(this.expirationTime>a)c=!1;else if(n)if(this.expirationTime<n)c=!0;else{const f=this.expirationTime-n;f?this.expirationTime=a+Math.max(f,3e4):c=!0}else c=!0;c?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),Math.pow(2,31)-1)}setFeatureState(t,n){var a,c,f;if(!(!((a=this.latestFeatureIndex)===null||a===void 0)&&a.rawTileData)||Object.keys(t).length===0)return;const y=this.latestFeatureIndex.loadVTLayers();for(const x in this.buckets){if(!n.style.hasLayer(x))continue;const w=this.buckets[x],S=w.layers[0].sourceLayer||p.ag,P=y[S],E=t[S];if(!P||!E||Object.keys(E).length===0)continue;w.update(E,P,((c=this.imageAtlas)===null||c===void 0?void 0:c.patternPositions)||{},this.dashPositions||{});const C=(f=n?.style)===null||f===void 0?void 0:f.getLayer(x);C&&(this.queryPadding=Math.max(this.queryPadding,C.queryRadius(w)))}}holdingForSymbolFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<He()}clearSymbolFadeHold(){this.symbolFadeHoldUntil=void 0}setSymbolHoldDuration(t){this.symbolFadeHoldUntil=He()+t}setDependencies(t,n){const a={};for(const c of n)a[c]=!0;this.dependencies[t]=a}hasDependency(t,n){for(const a of t){const c=this.dependencies[a];if(c){for(const f of n)if(c[f])return!0}}return!1}}class La{constructor(){this.state={},this.stateChanges={},this.deletedStates={},this.revision=0}updateState(t,n,a){var c,f,y,x,w;const S=String(n);if((x=this.stateChanges)[t]||(x[t]={}),(w=this.stateChanges[t])[S]||(w[S]={}),p.e(this.stateChanges[t][S],a),this.deletedStates[t]===null){this.deletedStates[t]={};for(const P in this.state[t])P!==S&&(this.deletedStates[t][P]=null)}else if(((c=this.deletedStates[t])===null||c===void 0?void 0:c[S])===null){this.deletedStates[t][S]={};for(const P in this.state[t][S])a[P]||(this.deletedStates[t][S][P]=null)}else for(const P in a)((y=(f=this.deletedStates[t])===null||f===void 0?void 0:f[S])===null||y===void 0?void 0:y[P])===null&&delete this.deletedStates[t][S][P]}removeFeatureState(t,n,a){var c,f,y;if(this.deletedStates[t]===null)return;const x=String(n);if((f=this.deletedStates)[t]||(f[t]={}),a&&n!==void 0)this.deletedStates[t][x]!==null&&((y=this.deletedStates[t])[x]||(y[x]={}),this.deletedStates[t][x][a]=null);else if(n!==void 0)if(!((c=this.stateChanges[t])===null||c===void 0)&&c[x])for(a in this.deletedStates[t][x]={},this.stateChanges[t][x])this.deletedStates[t][x][a]=null;else this.deletedStates[t][x]=null;else this.deletedStates[t]=null}getState(t,n){const a=String(n),c=p.e({},(this.state[t]||{})[a],(this.stateChanges[t]||{})[a]);if(this.deletedStates[t]===null)return{};if(this.deletedStates[t]){const f=this.deletedStates[t][n];if(f===null)return{};for(const y in f)delete c[y]}return c}initializeTileState(t,n){t.setFeatureState(this.state,n)}coalesceChanges(t,n){var a,c,f;const y={};for(const x in this.stateChanges){(a=this.state)[x]||(a[x]={});const w={};for(const S in this.stateChanges[x])(c=this.state[x])[S]||(c[S]={}),p.e(this.state[x][S],this.stateChanges[x][S]),w[S]=this.state[x][S];y[x]=w}for(const x in this.deletedStates){(f=this.state)[x]||(f[x]={});const w={};if(this.deletedStates[x]===null)for(const S in this.state[x])w[S]={},this.state[x][S]={};else for(const S in this.deletedStates[x]){if(this.deletedStates[x][S]===null)this.state[x][S]={};else for(const P of Object.keys(this.deletedStates[x][S]))delete this.state[x][S][P];w[S]=this.state[x][S]}y[x]||(y[x]={}),p.e(y[x],w)}this.stateChanges={},this.deletedStates={},Object.keys(y).length!==0&&(this.revision++,t.setFeatureState(y,n))}}const Qr=89.25;function qi(h,t){const n=p.al(t.lat,-p.am,p.am);return new p.P(p.Z(t.lng)*h,p.Y(n)*h)}function Rn(h,t){return new p.a7(t.x/h,t.y/h).toLngLat()}function en(h){return h.cameraToCenterDistance*Math.min(.85*Math.tan(p.an(90-h.pitch)),Math.tan(p.an(Qr-h.pitch)))}function vs(h,t){const n=h.canonical,a=t/p.ao(n.z),c=n.x+Math.pow(2,n.z)*h.wrap,f=p.ap(new Float64Array(16));return p.Q(f,f,[c*a,n.y*a,0]),p.S(f,f,[a/p.a6,a/p.a6,1]),f}function Fn(h,t,n,a,c){const f=p.a7.fromLngLat(h,t),y=c*p.aq(1,h.lat),{x,y:w,z:S}=po(n,a);return new p.a7(f.x+y*-x,f.y+y*-w,f.z+y*-S)}function po(h,t){const n=p.an(h),a=p.an(t),c=Math.cos(-n),f=Math.sin(n);return{x:f*Math.sin(a),y:-f*Math.cos(a),z:c}}function ce(h,t,n){const a=t.intersectsFrustum(h);if(!n||a===0)return a;const c=t.intersectsPlane(n);return c===0?0:a===2&&c===2?2:1}function Ba(h,t,n){let a=0;const c=(n-t)/10;for(let f=0;f<10;f++)a+=c*Math.pow(Math.cos(t+(f+.5)/10*(n-t)),h);return a}function Oa(h,t){return function(n,a,c,f,y){const x=2*((h-1)/p.ar(Math.cos(p.an(Qr-y))/Math.cos(p.an(Qr)))-1),w=Math.acos(c/f),S=2*Ba(x-1,0,p.an(y/2)),P=Math.min(p.an(Qr),w+p.an(y/2)),E=Ba(x-1,Math.min(P,w-p.an(y/2)),P),C=Math.atan(a/c),z=Math.hypot(a,c);let B=n;return B+=p.ar(f/z/Math.max(.5,Math.cos(p.an(y/2)))),B+=x*p.ar(Math.cos(C))/2,B-=p.ar(Math.max(1,E/S/t))/2,B}}const et=Oa(9.314,3);function gi(h,t){const n=(t.roundZoom?Math.round:Math.floor)(h.zoom+p.ar(h.tileSize/t.tileSize));return Math.max(0,n)}function tn(h,t){const n=h.getCameraFrustum(),a=h.getClippingPlane(),c=h.screenPointToMercatorCoordinate(h.getCameraPoint()),f=p.a7.fromLngLat(h.center,h.elevation);c.z=f.z+Math.cos(h.pitchInRadians)*h.cameraToCenterDistance/h.worldSize;const y=h.getCoveringTilesDetailsProvider(),x=y.allowVariableZoom(h,t),w=gi(h,t),S=t.minzoom||0,P=t.maxzoom!==void 0?t.maxzoom:h.maxZoom,E=Math.min(Math.max(0,w),P),C=Math.pow(2,E),z=[C*c.x,C*c.y,0],B=[C*f.x,C*f.y,0],V=Math.hypot(f.x-c.x,f.y-c.y),G=Math.abs(f.z-c.z),N=Math.hypot(V,G),$=U=>({zoom:0,x:0,y:0,wrap:U,fullyVisible:!1}),X=[],Z=[];if(h.renderWorldCopies&&y.allowWorldCopies())for(let U=1;U<=3;U++)X.push($(-U)),X.push($(U));for(X.push($(0));X.length>0;){const U=X.pop(),H=U.x,q=U.y;let Q=U.fullyVisible;const se={x:H,y:q,z:U.zoom},oe=y.getTileBoundingVolume(se,U.wrap,h.elevation,t);if(!Q){const ve=ce(n,oe,a);if(ve===0)continue;Q=ve===2}const de=y.distanceToTile2d(c.x,c.y,se,oe);let he=w;x&&(he=(t.calculateTileZoom||et)(h.zoom+p.ar(h.tileSize/t.tileSize),de,G,N,h.fov)),he=(t.roundZoom?Math.round:Math.floor)(he),he=Math.max(0,he);const Pe=Math.min(he,P);if(U.wrap=y.getWrap(f,se,U.wrap),U.zoom>=Pe){if(U.zoom<S)continue;const ve=E-U.zoom,ue=z[0]-.5-(H<<ve),we=z[1]-.5-(q<<ve),Ee=t.reparseOverscaled?Math.max(U.zoom,he):U.zoom;Z.push({tileID:new p.a3(U.zoom===P?Ee:U.zoom,U.wrap,U.zoom,H,q),distanceSq:p.as([B[0]-.5-H,B[1]-.5-q]),tileDistanceToCamera:Math.sqrt(ue*ue+we*we)})}else for(let ve=0;ve<4;ve++)X.push({zoom:U.zoom+1,x:(H<<1)+ve%2,y:(q<<1)+(ve>>1),wrap:U.wrap,fullyVisible:Q})}return Z.sort(((U,H)=>U.distanceSq-H.distanceSq)).map((U=>U.tileID))}const nc=p.a8.fromPoints([new p.P(0,0),new p.P(p.a6,p.a6)]);function sc(h){return h==="raster"||h==="image"||h==="video"}function Fu(h,t,n,a,c,f,y){if(!t.hasData())return!1;const{tileID:x,fadingRole:w,fadingDirection:S,fadingParentID:P}=t;if(w===ar.Base&&S===Li.Incoming&&P)return n[P.key]=P,!0;const E=Math.max(x.overscaledZ-c,f);for(let C=x.overscaledZ-1;C>=E;C--){const z=x.scaledTo(C),B=h.getLoadedTile(z);if(B)return t.setCrossFadeLogic({fadingRole:ar.Base,fadingDirection:Li.Incoming,fadingParentID:B.tileID,fadeEndTime:a+y}),B.setCrossFadeLogic({fadingRole:ar.Parent,fadingDirection:Li.Departing,fadeEndTime:a+y}),n[z.key]=z,!0}return!1}function fo(h,t,n,a,c,f){if(!t.hasData())return!1;const y=t.tileID.children(c);let x=Va(h,t,y,n,a,c,f);if(x)return!0;for(const w of y)Va(h,t,w.children(c),n,a,c,f)&&(x=!0);return x}function Va(h,t,n,a,c,f,y){if(n[0].overscaledZ>=f)return!1;let x=!1;for(const w of n){const S=h.getLoadedTile(w);if(!S)continue;const{fadingRole:P,fadingDirection:E,fadingParentID:C}=S;P===ar.Base&&E===Li.Departing&&C||(S.setCrossFadeLogic({fadingRole:ar.Base,fadingDirection:Li.Departing,fadingParentID:t.tileID,fadeEndTime:c+y}),t.setCrossFadeLogic({fadingRole:ar.Parent,fadingDirection:Li.Incoming,fadeEndTime:c+y})),a[w.key]=w,x=!0}return x}function oc(h,t,n,a){const c=h.tileID;return!!h.selfFading||!h.hasData()&&!!t.has(c)&&(h.setSelfFadeLogic(n+a),!0)}function _e(h,t){var n;h.needsHillshadePrepare=!0,h.needsTerrainPrepare=!0;let a=t.tileID.canonical.x-h.tileID.canonical.x;const c=t.tileID.canonical.y-h.tileID.canonical.y,f=Math.pow(2,h.tileID.canonical.z),y=t.tileID.key;a===0&&c===0||Math.abs(c)>1||(Math.abs(a)>1&&(Math.abs(a+f)===1?a+=f:Math.abs(a-f)===1&&(a-=f)),t.dem&&h.dem&&(h.dem.backfillBorder(t.dem,a,c),!((n=h.neighboringTiles)===null||n===void 0)&&n[y]&&(h.neighboringTiles[y].backfilled=!0)))}class rn{constructor(){this._tiles={}}handleWrapJump(t){const n={};for(const a in this._tiles){const c=this._tiles[a];c.tileID=c.tileID.unwrapTo(c.tileID.wrap+t),n[c.tileID.key]=c}this._tiles=n}setFeatureState(t,n){for(const a in this._tiles)this._tiles[a].setFeatureState(t,n)}getAllTiles(){return Object.values(this._tiles)}getAllIds(t=!1){return t?Object.values(this._tiles).map((n=>n.tileID)).sort(p.au).map((n=>n.key)):Object.keys(this._tiles)}getTileById(t){return this._tiles[t]}setTile(t,n){this._tiles[t]=n}deleteTileById(t){delete this._tiles[t]}getLoadedTile(t){const n=this.getTileById(t.key);return n?.hasData()?n:null}isIdRenderable(t,n=!1){var a;return(a=this.getTileById(t))===null||a===void 0?void 0:a.isRenderable(n)}getRenderableIds(t=0,n){const a=[];for(const c of this.getAllIds())this.isIdRenderable(c,n)&&a.push(this.getTileById(c));return n?a.sort(((c,f)=>{const y=c.tileID,x=f.tileID,w=new p.P(y.canonical.x,y.canonical.y)._rotate(-t),S=new p.P(x.canonical.x,x.canonical.y)._rotate(-t);return y.overscaledZ-x.overscaledZ||S.y-w.y||S.x-w.x})).map((c=>c.tileID.key)):a.map((c=>c.tileID)).sort(p.au).map((c=>c.key))}}class qt extends p.E{constructor(t,n,a){super(),this.id=t,this.dispatcher=a,this.on("data",(c=>{this._dataHandler(c)})),this.on("dataloading",(()=>{this._sourceErrored=!1})),this.on("error",(()=>{this._sourceErrored=this._source.loaded()})),this._source=((c,f,y,x)=>{const w=new(uo(f.type))(c,f,y,x);if(w.id!==c)throw new Error(`Expected Source id to be ${c} instead of ${w.id}`);return w})(t,n,a,this),this._inViewTiles=new rn,this._outOfViewCache=new p.av(0,(c=>this._unloadTile(c))),this._timers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._rasterFadeDuration=0,this._maxFadingAncestorLevels=5,this._state=new La,this._didEmitContent=!1,this._updated=!1}onAdd(t){var n;this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._maxTileCacheZoomLevels=t?t._maxTileCacheZoomLevels:null,!((n=this._source)===null||n===void 0)&&n.onAdd&&this._source.onAdd(t)}onRemove(t){var n;for(const a of this._inViewTiles.getAllTiles())a.unloadVectorData();this.clearTiles(),!((n=this._source)===null||n===void 0)&&n.onRemove&&this._source.onRemove(t),this._inViewTiles=new rn}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if(!(this.used===void 0&&this.usedForTerrain===void 0||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(const t of this._inViewTiles.getAllTiles())if(t.state!=="loaded"&&t.state!=="errored")return!1;return!0}getSource(){return this._source}getState(){return this._state}pause(){this._paused=!0}resume(){if(!this._paused)return;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(t,n,a){return p._(this,void 0,void 0,(function*(){try{const c=yield this._source.loadTile(t);this._tileLoaded(t,n,a,c)}catch(c){t.state="errored",c.status!==404?this._source.fire(new p.l(p.d(c),{tile:t})):this.update(this.transform,this.terrain)}}))}_unloadTile(t){this._source.unloadTile&&this._source.unloadTile(t)}_abortTile(t){this._source.abortTile&&this._source.abortTile(t),this._source.fire(new p.n("dataabort",{tile:t,coord:t.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._inViewTiles,this.map?this.map.painter:null);for(const n of this._inViewTiles.getAllTiles())n.upload(t),n.prepare(this.map.style.imageManager)}getIds(){return this._inViewTiles.getAllIds(!0)}getRenderableIds(t){var n;return this._inViewTiles.getRenderableIds((n=this.transform)===null||n===void 0?void 0:n.bearingInRadians,t)}hasRenderableParent(t){const n=t.overscaledZ-1;if(n>=this._source.minzoom){const a=this.getLoadedTile(t.scaledTo(n));if(a)return this._inViewTiles.isIdRenderable(a.tileID.key)}return!1}reload(t,n=void 0){if(this._paused)this._shouldReloadOnResume=!0;else{this._outOfViewCache.reset();for(const a of this._inViewTiles.getAllIds()){const c=this._inViewTiles.getTileById(a);n&&!this._source.shouldReloadTile(c,n)||(t?this._reloadTile(a,"expired"):c.state!=="errored"&&this._reloadTile(a,"reloading"))}}}_reloadTile(t,n){return p._(this,void 0,void 0,(function*(){const a=this._inViewTiles.getTileById(t);a&&(a.state!=="loading"&&(a.state=n),yield this._loadTile(a,t,n))}))}_tileLoaded(t,n,a,c){t.timeAdded=He(),t.selfFading&&(t.fadeEndTime=t.timeAdded+this._rasterFadeDuration),a==="expired"&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(n,t),c?.unmodified||(this.getSource().type==="raster-dem"&&t.dem&&(function(f,y){var x,w,S;const P=y.getRenderableIds();for(const E of P){if(!(!((x=f.neighboringTiles)===null||x===void 0)&&x[E]))continue;const C=y.getTileById(E);f.neighboringTiles[E].backfilled||_e(f,C),!((S=(w=C.neighboringTiles)===null||w===void 0?void 0:w[f.tileID.key])===null||S===void 0)&&S.backfilled||_e(C,f)}})(t,this._inViewTiles),this._state.initializeTileState(t,this.map?this.map.painter:null),t.aborted||this._source.fire(new p.n("data",{dataType:"source",tile:t,coord:t.tileID})))}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._inViewTiles.getTileById(t)}_retainLoadedChildren(t,n){const a=this._getLoadedDescendents(n),c=new Set;for(const f of n){const y=a[f.key];if(!y?.length){c.add(f);continue}const x=f.overscaledZ+qt.maxOverzooming,w=y.filter((E=>E.tileID.overscaledZ<=x));if(!w.length){c.add(f);continue}const S=Math.min(...w.map((E=>E.tileID.overscaledZ))),P=w.filter((E=>E.tileID.overscaledZ===S)).map((E=>E.tileID));for(const E of P)t[E.key]=E;this._areDescendentsComplete(P,S,f.overscaledZ)||c.add(f)}return c}_getLoadedDescendents(t){var n;const a={};for(const c of this._inViewTiles.getAllTiles().filter((f=>f.hasData())))for(const f of t)c.tileID.isChildOf(f)&&(a[n=f.key]||(a[n]=[]),a[f.key].push(c));return a}_areDescendentsComplete(t,n,a){return t.length===1&&t[0].isOverscaled()?t[0].overscaledZ===n:Math.pow(4,n-a)===t.length}getLoadedTile(t){return this._inViewTiles.getLoadedTile(t)}updateCacheSize(t){const n=Math.ceil(t.width/this._source.tileSize)+1,a=Math.ceil(t.height/this._source.tileSize)+1,c=Math.floor(n*a*(this._maxTileCacheZoomLevels===null?p.c.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),f=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,c):c;this._outOfViewCache.setMaxSize(f)}handleWrapJump(t){const n=Math.round((t-(this._prevLng===void 0?t:this._prevLng))/360);this._prevLng=t,n&&(this._inViewTiles.handleWrapJump(n),this._resetTileReloadTimers())}update(t,n){if(!this._sourceLoaded||this._paused)return;let a;this.transform=t,this.terrain=n,this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this.used||this.usedForTerrain?this._source.tileID?a=t.getVisibleUnwrappedCoordinates(this._source.tileID).map((w=>new p.a3(w.canonical.z,w.wrap,w.canonical.z,w.canonical.x,w.canonical.y))):(a=tn(t,{tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.type==="vector"&&this.map._zoomLevelsToOverscale!==void 0?t.maxZoom-this.map._zoomLevelsToOverscale:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:n,calculateTileZoom:this._source.calculateTileZoom}),this._source.hasTile&&(a=a.filter((w=>this._source.hasTile(w))))):a=[],this.usedForTerrain&&(a=this._addTerrainIdealTiles(a));const c=a.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,c&&this.fire(new p.n("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const f=gi(t,this._source),y=this._updateRetainedTiles(a,f),x=sc(this._source.type);x&&this._rasterFadeDuration>0&&!n&&(function(w,S,P,E,C,z,B){const V=He(),G=p.at(S);for(const N of S){const $=w.getTileById(N.key);$.fadingDirection!==Li.Departing&&$.fadeOpacity!==0||$.resetFadeLogic(),Fu(w,$,P,V,E,C,B)||fo(w,$,P,V,z,B)||oc($,G,V,B)||$.resetFadeLogic()}})(this._inViewTiles,a,y,this._maxFadingAncestorLevels,this._source.minzoom,this._source.maxzoom,this._rasterFadeDuration),x?this._cleanUpRasterTiles(y):this._cleanUpVectorTiles(y)}_cleanUpRasterTiles(t){for(const n of this._inViewTiles.getAllIds())t[n]||this._removeTile(n)}_cleanUpVectorTiles(t){for(const n of this._inViewTiles.getAllIds()){const a=this._inViewTiles.getTileById(n);t[n]?a.clearSymbolFadeHold():a.hasSymbolBuckets?a.holdingForSymbolFade()?a.symbolFadeFinished()&&this._removeTile(n):a.setSymbolHoldDuration(this.map._fadeDuration):this._removeTile(n)}}_addTerrainIdealTiles(t){const n=[];for(const a of t)if(a.canonical.z>this._source.minzoom){const c=a.scaledTo(a.canonical.z-1);n.push(c);const f=a.scaledTo(Math.max(this._source.minzoom,Math.min(a.canonical.z,5)));n.push(f)}return t.concat(n)}releaseSymbolFadeTiles(){for(const t of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(t).holdingForSymbolFade()&&this._removeTile(t)}_updateRetainedTiles(t,n){var a;const c=new Set;for(const S of t)this._addTile(S).hasData()||c.add(S);const f=t.reduce(((S,P)=>(S[P.key]=P,S)),{}),y=this._retainLoadedChildren(f,c),x={},w=Math.max(n-qt.maxUnderzooming,this._source.minzoom);for(const S of y){let P=this._inViewTiles.getTileById(S.key),E=P?.wasRequested();for(let C=S.overscaledZ-1;C>=w;--C){const z=S.scaledTo(C);if(x[z.key])break;if(x[z.key]=!0,P=this.getTile(z),!P&&E&&(P=this._addTile(z)),P){const B=P.hasData();if((B||!(!((a=this.map)===null||a===void 0)&&a.cancelPendingTileRequestsWhileZooming)||E)&&(f[z.key]=z),E=P.wasRequested(),B)break}}}return f}_addTile(t){let n=this._inViewTiles.getTileById(t.key);if(n)return n;n=this._outOfViewCache.getAndRemove(t),n&&(n.resetFadeLogic(),this._setTileReloadTimer(t.key,n),n.tileID=t,this._state.initializeTileState(n,this.map?this.map.painter:null));const a=n;return n||(n=new kn(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(n,t.key,n.state)),n.uses++,this._inViewTiles.setTile(t.key,n),a||this._source.fire(new p.n("dataloading",{tile:n,coord:n.tileID,dataType:"source"})),n}_setTileReloadTimer(t,n){this._clearTileReloadTimer(t);const a=n.getExpiryTimeout();a&&(this._timers[t]=setTimeout((()=>{this._reloadTile(t,"expired"),delete this._timers[t]}),a))}_clearTileReloadTimer(t){const n=this._timers[t];n&&(clearTimeout(n),delete this._timers[t])}_resetTileReloadTimers(){for(const t in this._timers)clearTimeout(this._timers[t]),delete this._timers[t];for(const t of this._inViewTiles.getAllIds()){const n=this._inViewTiles.getTileById(t);this._setTileReloadTimer(t,n)}}refreshTiles(t){for(const n of this._inViewTiles.getAllIds()){const a=this._inViewTiles.getTileById(n);(this._inViewTiles.isIdRenderable(n)||a.state=="errored")&&t.some((c=>c.equals(a.tileID.canonical)))&&this._reloadTile(n,"expired")}}_removeTile(t){const n=this._inViewTiles.getTileById(t);n&&(n.uses--,this._inViewTiles.deleteTileById(t),this._clearTileReloadTimer(t),n.uses>0||(n.hasData()&&n.state!=="reloading"?this._outOfViewCache.add(n.tileID,n,n.getExpiryTimeout()):(n.aborted=!0,this._abortTile(n),this._unloadTile(n))))}_dataHandler(t){t.dataType==="source"&&(t.sourceDataType!=="metadata"?t.sourceDataType==="content"&&this._sourceLoaded&&!this._paused&&(this.reload(t.sourceDataChanged,t.shouldReloadTileOptions),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0):this._sourceLoaded=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t of this._inViewTiles.getAllIds())this._removeTile(t);this._outOfViewCache.reset()}tilesIn(t,n,a){const c=[],f=this.transform;if(!f)return c;const y=f.getCoveringTilesDetailsProvider().allowWorldCopies(),x=a?f.getCameraQueryGeometry(t):t,w=z=>f.screenPointToMercatorCoordinate(z,this.terrain),S=this.transformBbox(t,w,!y),P=this.transformBbox(x,w,!y),E=this.getIds(),C=p.a8.fromPoints(P);for(const z of E){const B=this._inViewTiles.getTileById(z);if(B.holdingForSymbolFade())continue;const V=y?[B.tileID]:[B.tileID.unwrapTo(-1),B.tileID.unwrapTo(0)],G=Math.pow(2,f.zoom-B.tileID.overscaledZ),N=n*B.queryPadding*p.a6/B.tileSize/G;for(const $ of V){const X=C.map((Z=>$.getTilePoint(new p.a7(Z.x,Z.y))));if(X.expandBy(N),X.intersects(nc)){const Z=S.map((H=>$.getTilePoint(H))),U=P.map((H=>$.getTilePoint(H)));c.push({tile:B,tileID:y?$:$.unwrapTo(0),queryGeometry:Z,cameraQueryGeometry:U,scale:G})}}}return c}transformBbox(t,n,a){let c=t.map(n);if(a){const f=p.a8.fromPoints(t);f.shrinkBy(.001*Math.min(f.width(),f.height()));const y=f.map(n);p.a8.fromPoints(c).covers(y)||(c=c.map((x=>x.x>.5?new p.a7(x.x-1,x.y,x.z):x)))}return c}getVisibleCoordinates(t){const n=this.getRenderableIds(t).map((a=>this._inViewTiles.getTileById(a).tileID));return this.transform&&this.transform.populateCache(n),n}hasTransition(){return!!this._source.hasTransition()||sc(this._source.type)&&(function(t,n){if(n<=0)return!1;const a=He();for(const c of t.getAllTiles())if(c.fadeEndTime>=a)return!0;return!1})(this._inViewTiles,this._rasterFadeDuration)}setRasterFadeDuration(t){this._rasterFadeDuration=t}setFeatureState(t,n,a){t||(t=p.ag),this._state.updateState(t,n,a)}removeFeatureState(t,n,a){t||(t=p.ag),this._state.removeFeatureState(t,n,a)}getFeatureState(t,n){return t||(t=p.ag),this._state.getState(t,n)}setDependencies(t,n,a){const c=this._inViewTiles.getTileById(t);c&&c.setDependencies(n,a)}reloadTilesForDependencies(t,n){for(const a of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(a).hasDependency(t,n)&&this._reloadTile(a,"reloading");this._outOfViewCache.filter((a=>!a.hasDependency(t,n)))}areTilesLoaded(){for(const t of this._inViewTiles.getAllTiles())if(t.state!=="loaded"&&t.state!=="errored")return!1;return!0}}qt.maxUnderzooming=10,qt.maxOverzooming=3;class ja{constructor(t,n){this.reset(t,n)}reset(t,n){this.points=t||[],this._distances=[0];for(let a=1;a<this.points.length;a++)this._distances[a]=this._distances[a-1]+this.points[a].dist(this.points[a-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(n||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(t){if(this.points.length===1)return this.points[0];t=p.al(t,0,1);let n=1,a=this._distances[n];const c=t*this.paddedLength+this.padding;for(;a<c&&n<this._distances.length;)a=this._distances[++n];const f=n-1,y=this._distances[f],x=a-y,w=x>0?(c-y)/x:0;return this.points[f].mult(1-w).add(this.points[n].mult(w))}}function Cr(h,t){let n=!0;return h==="always"||h!=="never"&&t!=="never"||(n=!1),n}class be{constructor(t,n,a){const c=this.boxCells=[],f=this.circleCells=[];this.xCellCount=Math.ceil(t/a),this.yCellCount=Math.ceil(n/a);for(let y=0;y<this.xCellCount*this.yCellCount;y++)c.push([]),f.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=n,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/n,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(t,n,a,c,f){this._forEachCell(n,a,c,f,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(n),this.bboxes.push(a),this.bboxes.push(c),this.bboxes.push(f)}insertCircle(t,n,a,c){this._forEachCell(n-c,a-c,n+c,a+c,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(n),this.circles.push(a),this.circles.push(c)}_insertBoxCell(t,n,a,c,f,y){this.boxCells[f].push(y)}_insertCircleCell(t,n,a,c,f,y){this.circleCells[f].push(y)}_query(t,n,a,c,f,y,x){if(a<0||t>this.width||c<0||n>this.height)return[];const w=[];if(t<=0&&n<=0&&this.width<=a&&this.height<=c){if(f)return[{key:null,x1:t,y1:n,x2:a,y2:c}];for(let S=0;S<this.boxKeys.length;S++)w.push({key:this.boxKeys[S],x1:this.bboxes[4*S],y1:this.bboxes[4*S+1],x2:this.bboxes[4*S+2],y2:this.bboxes[4*S+3]});for(let S=0;S<this.circleKeys.length;S++){const P=this.circles[3*S],E=this.circles[3*S+1],C=this.circles[3*S+2];w.push({key:this.circleKeys[S],x1:P-C,y1:E-C,x2:P+C,y2:E+C})}}else this._forEachCell(t,n,a,c,this._queryCell,w,{hitTest:f,overlapMode:y,seenUids:{box:{},circle:{}}},x);return w}query(t,n,a,c){return this._query(t,n,a,c,!1,null)}hitTest(t,n,a,c,f,y){return this._query(t,n,a,c,!0,f,y).length>0}hitTestCircle(t,n,a,c,f){const y=t-a,x=t+a,w=n-a,S=n+a;if(x<0||y>this.width||S<0||w>this.height)return!1;const P=[];return this._forEachCell(y,w,x,S,this._queryCellCircle,P,{hitTest:!0,overlapMode:c,circle:{x:t,y:n,radius:a},seenUids:{box:{},circle:{}}},f),P.length>0}_queryCell(t,n,a,c,f,y,x,w){const{seenUids:S,hitTest:P,overlapMode:E}=x,C=this.boxCells[f],z=1e-6;if(C!==null){const V=this.bboxes;for(const G of C)if(!S.box[G]){S.box[G]=!0;const N=4*G,$=this.boxKeys[G];if(t<=V[N+2]+z&&n<=V[N+3]+z&&a>=V[N+0]-z&&c>=V[N+1]-z&&(!w||w($))&&(!P||!Cr(E,$.overlapMode))&&(y.push({key:$,x1:V[N],y1:V[N+1],x2:V[N+2],y2:V[N+3]}),P))return!0}}const B=this.circleCells[f];if(B!==null){const V=this.circles;for(const G of B)if(!S.circle[G]){S.circle[G]=!0;const N=3*G,$=this.circleKeys[G];if(this._circleAndRectCollide(V[N],V[N+1],V[N+2],t,n,a,c)&&(!w||w($))&&(!P||!Cr(E,$.overlapMode))){const X=V[N],Z=V[N+1],U=V[N+2];if(y.push({key:$,x1:X-U,y1:Z-U,x2:X+U,y2:Z+U}),P)return!0}}}return!1}_queryCellCircle(t,n,a,c,f,y,x,w){const{circle:S,seenUids:P,overlapMode:E}=x,C=this.boxCells[f];if(C!==null){const B=this.bboxes;for(const V of C)if(!P.box[V]){P.box[V]=!0;const G=4*V,N=this.boxKeys[V];if(this._circleAndRectCollide(S.x,S.y,S.radius,B[G+0],B[G+1],B[G+2],B[G+3])&&(!w||w(N))&&!Cr(E,N.overlapMode))return y.push(!0),!0}}const z=this.circleCells[f];if(z!==null){const B=this.circles;for(const V of z)if(!P.circle[V]){P.circle[V]=!0;const G=3*V,N=this.circleKeys[V];if(this._circlesCollide(B[G],B[G+1],B[G+2],S.x,S.y,S.radius)&&(!w||w(N))&&!Cr(E,N.overlapMode))return y.push(!0),!0}}}_forEachCell(t,n,a,c,f,y,x,w){const S=this._convertToXCellCoord(t),P=this._convertToYCellCoord(n),E=this._convertToXCellCoord(a),C=this._convertToYCellCoord(c);for(let z=S;z<=E;z++)for(let B=P;B<=C;B++)if(f.call(this,t,n,a,c,this.xCellCount*B+z,y,x,w))return}_convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}_convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}_circlesCollide(t,n,a,c,f,y){const x=c-t,w=f-n,S=a+y;return S*S>x*x+w*w}_circleAndRectCollide(t,n,a,c,f,y,x){const w=(y-c)/2,S=Math.abs(t-(c+w));if(S>w+a)return!1;const P=(x-f)/2,E=Math.abs(n-(f+P));if(E>P+a)return!1;if(S<=w||E<=P)return!0;const C=S-w,z=E-P;return C*C+z*z<=a*a}}function Fe(h,t){const n=1/(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]),a=1/(t[8]*t[8]+t[9]*t[9]+t[10]*t[10]),c=t[0]*n,f=t[4]*n,y=t[8]*a,x=t[1]*n,w=t[5]*n,S=t[9]*a,P=t[2]*n,E=t[6]*n,C=t[10]*a;h[0]=c,h[1]=f,h[2]=y,h[4]=x,h[5]=w,h[6]=S,h[8]=P,h[9]=E,h[10]=C;const z=t[12],B=t[13],V=t[14];return h[12]=-c*z-x*B-P*V,h[13]=-f*z-w*B-E*V,h[14]=-y*z-S*B-C*V,h[3]=0,h[7]=0,h[11]=0,h[15]=1,h}const je=p.O();function Pi(h,t,n){const a=p.O();if(!h){const{vecSouth:E,vecEast:C}=lr(t),z=wr();z[0]=C[0],z[1]=C[1],z[2]=E[0],z[3]=E[1],c=z,(P=(y=(f=z)[0])*(S=f[3])-(w=f[2])*(x=f[1]))&&(c[0]=S*(P=1/P),c[1]=-x*P,c[2]=-w*P,c[3]=y*P),a[0]=z[0],a[1]=z[1],a[4]=z[2],a[5]=z[3]}var c,f,y,x,w,S,P;return p.S(a,a,[1/n,1/n,1]),a}function mo(h,t,n,a){if(h){const c=p.O();if(!t){const{vecSouth:f,vecEast:y}=lr(n);c[0]=y[0],c[1]=y[1],c[4]=f[0],c[5]=f[1]}return p.S(c,c,[a,a,1]),c}return n.pixelsToClipSpaceMatrix}function lr(h){const t=Math.cos(h.rollInRadians),n=Math.sin(h.rollInRadians),a=Math.cos(h.pitchInRadians),c=Math.cos(h.bearingInRadians),f=Math.sin(h.bearingInRadians),y=p.az();y[0]=-c*a*n-f*t,y[1]=-f*a*n+c*t;const x=p.aA(y);x<1e-9?p.aB(y):p.aC(y,y,1/x);const w=p.az();w[0]=c*a*t-f*n,w[1]=f*a*t+c*n;const S=p.aA(w);return S<1e-9?p.aB(w):p.aC(w,w,1/S),{vecEast:w,vecSouth:y}}function Be(h,t,n,a){let c;a?(c=[h,t,a(h,t),1],p.aE(c,c,n)):(c=[h,t,0,1],yo(c,c,n));const f=c[3];return{point:new p.P(c[0]/f,c[1]/f),signedDistanceFromCamera:f,isOccluded:!1}}function xs(h,t){return .5+h/t*.5}function bs(h,t){return h.x>=-t[0]&&h.x<=t[0]&&h.y>=-t[1]&&h.y<=t[1]}function go(h,t,n,a,c,f,y,x,w,S,P,E,C){const z=n?h.textSizeData:h.iconSizeData,B=p.aw(z,t.transform.zoom),V=[256/t.width*2+1,256/t.height*2+1],G=n?h.text.dynamicLayoutVertexArray:h.icon.dynamicLayoutVertexArray;G.clear();const N=h.lineVertexArray,$=n?h.text.placedSymbolArray:h.icon.placedSymbolArray,X=t.transform.width/t.transform.height;let Z=!1;for(let U=0;U<$.length;U++){const H=$.get(U);if(H.hidden||H.writingMode===p.ax.vertical&&!Z){sn(H.numGlyphs,G);continue}Z=!1;const q=new p.P(H.anchorX,H.anchorY),Q={getElevation:C,pitchedLabelPlaneMatrix:a,lineVertexArray:N,pitchWithMap:f,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:t.transform,tileAnchorPoint:q,unwrappedTileID:w,width:S,height:P,translation:E},se=On(H.anchorX,H.anchorY,Q);if(!bs(se.point,V)){sn(H.numGlyphs,G);continue}const oe=xs(t.transform.cameraToCenterDistance,se.signedDistanceFromCamera),de=p.ay(z,B,H),he=f?de*t.transform.getPitchedTextCorrection(H.anchorX,H.anchorY,w)/oe:de*oe,Pe=Bn({projectionContext:Q,pitchedLabelPlaneMatrixInverse:c,symbol:H,fontSize:he,flip:!1,keepUpright:y,glyphOffsetArray:h.glyphOffsetArray,dynamicLayoutVertexArray:G,aspectRatio:X,rotateToLine:x});Z=Pe.useVertical,(Pe.notEnoughRoom||Z||Pe.needsFlipping&&Bn({projectionContext:Q,pitchedLabelPlaneMatrixInverse:c,symbol:H,fontSize:he,flip:!0,keepUpright:y,glyphOffsetArray:h.glyphOffsetArray,dynamicLayoutVertexArray:G,aspectRatio:X,rotateToLine:x}).notEnoughRoom)&&sn(H.numGlyphs,G)}n?h.text.dynamicLayoutVertexBuffer.updateData(G):h.icon.dynamicLayoutVertexBuffer.updateData(G)}function Ln(h,t,n,a,c,f,y,x){const w=f.glyphStartIndex+f.numGlyphs,S=f.lineStartIndex,P=f.lineStartIndex+f.lineLength,E=t.getoffsetX(f.glyphStartIndex),C=t.getoffsetX(w-1),z=Wi(h*E,n,a,c,f.segment,S,P,x,y);if(!z)return null;const B=Wi(h*C,n,a,c,f.segment,S,P,x,y);return B?x.projectionCache.anyProjectionOccluded?null:{first:z,last:B}:null}function ws(h,t,n,a){return h===p.ax.horizontal&&Math.abs(n.y-t.y)>Math.abs(n.x-t.x)*a?{useVertical:!0}:(h===p.ax.vertical?t.y<n.y:t.x>n.x)?{needsFlipping:!0}:null}function Bn(h){const{projectionContext:t,pitchedLabelPlaneMatrixInverse:n,symbol:a,fontSize:c,flip:f,keepUpright:y,glyphOffsetArray:x,dynamicLayoutVertexArray:w,aspectRatio:S,rotateToLine:P}=h,E=c/24,C=a.lineOffsetX*E,z=a.lineOffsetY*E;let B;if(a.numGlyphs>1){const V=a.glyphStartIndex+a.numGlyphs,G=a.lineStartIndex,N=a.lineStartIndex+a.lineLength,$=Ln(E,x,C,z,f,a,P,t);if(!$)return{notEnoughRoom:!0};const X=_o($.first.point.x,$.first.point.y,t,n),Z=_o($.last.point.x,$.last.point.y,t,n);if(y&&!f){const U=ws(a.writingMode,X,Z,S);if(U)return U}B=[$.first];for(let U=a.glyphStartIndex+1;U<V-1;U++){const H=Wi(E*x.getoffsetX(U),C,z,f,a.segment,G,N,t,P);if(!H)return{notEnoughRoom:!0};B.push(H)}B.push($.last)}else{if(y&&!f){const G=tt(t.tileAnchorPoint.x,t.tileAnchorPoint.y,t).point,N=a.lineStartIndex+a.segment+1,$=new p.P(t.lineVertexArray.getx(N),t.lineVertexArray.gety(N)),X=tt($.x,$.y,t),Z=X.signedDistanceFromCamera>0?X.point:Ts(t.tileAnchorPoint,$,G,1,t),U=_o(G.x,G.y,t,n),H=_o(Z.x,Z.y,t,n),q=ws(a.writingMode,U,H,S);if(q)return q}const V=Wi(E*x.getoffsetX(a.glyphStartIndex),C,z,f,a.segment,a.lineStartIndex,a.lineStartIndex+a.lineLength,t,P);if(!V||t.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};B=[V]}for(const V of B)p.aD(w,V.point,V.angle);return{}}function Ts(h,t,n,a,c){const f=h.add(h.sub(t)._unit()),y=tt(f.x,f.y,c).point,x=n.sub(y);return n.add(x._mult(a/x.mag()))}function Wt(h,t,n){const a=t.projectionCache;if(a.projections[h])return a.projections[h];const c=new p.P(t.lineVertexArray.getx(h),t.lineVertexArray.gety(h)),f=tt(c.x,c.y,t);if(f.signedDistanceFromCamera>0)return a.projections[h]=f.point,a.anyProjectionOccluded||(a.anyProjectionOccluded=f.isOccluded),f.point;const y=h-n.direction;return Ts(n.distanceFromAnchor===0?t.tileAnchorPoint:new p.P(t.lineVertexArray.getx(y),t.lineVertexArray.gety(y)),c,n.previousVertex,n.absOffsetX-n.distanceFromAnchor+1,t)}function tt(h,t,n){const a=h+n.translation[0],c=t+n.translation[1];let f;return n.pitchWithMap?(f=Be(a,c,n.pitchedLabelPlaneMatrix,n.getElevation),f.isOccluded=!1):(f=n.transform.projectTileCoordinates(a,c,n.unwrappedTileID,n.getElevation),f.point.x=(.5*f.point.x+.5)*n.width,f.point.y=(.5*-f.point.y+.5)*n.height),f}function _o(h,t,n,a){if(n.pitchWithMap){const c=[h,t,0,1];return p.aE(c,c,a),n.transform.projectTileCoordinates(c[0]/c[3],c[1]/c[3],n.unwrappedTileID,n.getElevation).point}return{x:h/n.width*2-1,y:1-t/n.height*2}}function On(h,t,n){return n.transform.projectTileCoordinates(h,t,n.unwrappedTileID,n.getElevation)}function Ss(h,t,n){return h._unit()._perp()._mult(t*n)}function nn(h,t,n,a,c,f,y,x,w){if(x.projectionCache.offsets[h])return x.projectionCache.offsets[h];const S=n.add(t);if(h+w.direction<a||h+w.direction>=c)return x.projectionCache.offsets[h]=S,S;const P=Wt(h+w.direction,x,w),E=Ss(P.sub(n),y,w.direction),C=n.add(E),z=P.add(E);return x.projectionCache.offsets[h]=p.aF(f,S,C,z)||S,x.projectionCache.offsets[h]}function Wi(h,t,n,a,c,f,y,x,w){const S=a?h-t:h+t;let P=S>0?1:-1,E=0;a&&(P*=-1,E=Math.PI),P<0&&(E+=Math.PI);let C,z=P>0?f+c:f+c+1;x.projectionCache.cachedAnchorPoint?C=x.projectionCache.cachedAnchorPoint:(C=tt(x.tileAnchorPoint.x,x.tileAnchorPoint.y,x).point,x.projectionCache.cachedAnchorPoint=C);let B,V,G=C,N=C,$=0,X=0;const Z=Math.abs(S),U=[];let H;for(;$+X<=Z;){if(z+=P,z<f||z>=y)return null;$+=X,N=G,V=B;const se={absOffsetX:Z,direction:P,distanceFromAnchor:$,previousVertex:N};if(G=Wt(z,x,se),n===0)U.push(N),H=G.sub(N);else{let oe;const de=G.sub(N);oe=de.mag()===0?Ss(Wt(z+P,x,se).sub(G),n,P):Ss(de,n,P),V||(V=N.add(oe)),B=nn(z,oe,G,f,y,V,n,x,se),U.push(V),H=B.sub(V)}X=H.mag()}const q=H._mult((Z-$)/X)._add(V||N),Q=E+Math.atan2(G.y-N.y,G.x-N.x);return U.push(q),{point:q,angle:w?Q:0,path:U}}const ac=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function sn(h,t){for(let n=0;n<h;n++){const a=t.length;t.resize(a+4),t.float32.set(ac,3*a)}}function yo(h,t,n){const a=t[0],c=t[1];return h[0]=n[0]*a+n[4]*c+n[12],h[1]=n[1]*a+n[5]*c+n[13],h[3]=n[3]*a+n[7]*c+n[15],h}const vt=100;class lc{constructor(t,n=new be(t.width+200,t.height+200,25),a=new be(t.width+200,t.height+200,25)){this.transform=t,this.grid=n,this.ignoredGrid=a,this.pitchFactor=Math.cos(t.pitch*Math.PI/180)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+vt,this.screenBottomBoundary=t.height+vt,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(t,n,a,c,f,y,x,w,S,P,E,C){const z=this.projectAndGetPerspectiveRatio(t.anchorPointX+w[0],t.anchorPointY+w[1],f,P,C),B=a*z.perspectiveRatio;let V;if(y||x)V=this._projectCollisionBox(t,B,c,f,y,x,w,z,P,E,C);else{const H=z.x+(E?E.x*B:0),q=z.y+(E?E.y*B:0);V={allPointsOccluded:!1,box:[H+t.x1*B,q+t.y1*B,H+t.x2*B,q+t.y2*B]}}const[G,N,$,X]=V.box,Z=y?V.allPointsOccluded:z.isOccluded;let U=Z;return U||(U=z.perspectiveRatio<this.perspectiveRatioCutoff),U||(U=!this.isInsideGrid(G,N,$,X)),U||n!=="always"&&this.grid.hitTest(G,N,$,X,n,S)?{box:[G,N,$,X],placeable:!1,offscreen:!1,occluded:Z}:{box:[G,N,$,X],placeable:!0,offscreen:this.isOffscreen(G,N,$,X),occluded:Z}}placeCollisionCircles(t,n,a,c,f,y,x,w,S,P,E,C,z,B){const V=[],G=new p.P(n.anchorX,n.anchorY),N=this.getPerspectiveRatio(G.x,G.y,y,B),$=(S?f*this.transform.getPitchedTextCorrection(n.anchorX,n.anchorY,y)/N:f*N)/p.aJ,X={getElevation:B,pitchedLabelPlaneMatrix:x,lineVertexArray:a,pitchWithMap:S,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:this.transform,tileAnchorPoint:G,unwrappedTileID:y,width:this.transform.width,height:this.transform.height,translation:z},Z=Ln($,c,n.lineOffsetX*$,n.lineOffsetY*$,!1,n,!1,X);let U=!1,H=!1,q=!0;if(Z){const Q=.5*E*N+C,se=new p.P(-100,-100),oe=new p.P(this.screenRightBoundary,this.screenBottomBoundary),de=new ja,he=Z.first,Pe=Z.last;let ve=[];for(let Ee=he.path.length-1;Ee>=1;Ee--)ve.push(he.path[Ee]);for(let Ee=1;Ee<Pe.path.length;Ee++)ve.push(Pe.path[Ee]);const ue=2.5*Q;if(S){const Ee=this.projectPathToScreenSpace(ve,X);ve=Ee.some((Qe=>Qe.signedDistanceFromCamera<=0))?[]:Ee.map((Qe=>Qe.point))}let we=[];if(ve.length>0){const Ee=ve[0].clone(),Qe=ve[0].clone();for(let Pt=1;Pt<ve.length;Pt++)Ee.x=Math.min(Ee.x,ve[Pt].x),Ee.y=Math.min(Ee.y,ve[Pt].y),Qe.x=Math.max(Qe.x,ve[Pt].x),Qe.y=Math.max(Qe.y,ve[Pt].y);we=Ee.x>=se.x&&Qe.x<=oe.x&&Ee.y>=se.y&&Qe.y<=oe.y?[ve]:Qe.x<se.x||Ee.x>oe.x||Qe.y<se.y||Ee.y>oe.y?[]:p.aG([ve],se.x,se.y,oe.x,oe.y)}for(const Ee of we){de.reset(Ee,.25*Q);let Qe=0;Qe=de.length<=.5*Q?1:Math.ceil(de.paddedLength/ue)+1;for(let Pt=0;Pt<Qe;Pt++){const rt=Pt/Math.max(Qe-1,1),Mt=de.lerp(rt),Ct=Mt.x+vt,Jt=Mt.y+vt;V.push(Ct,Jt,Q,0);const xt=Ct-Q,ci=Jt-Q,Ht=Ct+Q,Bt=Jt+Q;if(q&&(q=this.isOffscreen(xt,ci,Ht,Bt)),H||(H=this.isInsideGrid(xt,ci,Ht,Bt)),t!=="always"&&this.grid.hitTestCircle(Ct,Jt,Q,t,P)&&(U=!0,!w))return{circles:[],offscreen:!1,collisionDetected:U}}}}return{circles:!w&&U||!H||N<this.perspectiveRatioCutoff?[]:V,offscreen:q,collisionDetected:U}}projectPathToScreenSpace(t,n){const a=(function(c,f){const y=je;return(function(x,w){const S=1/(w[0]*w[5]-w[1]*w[4]);x[0]=w[5]*S,x[1]=-w[1]*S,x[2]=0,x[3]=0,x[4]=-w[4]*S,x[5]=w[0]*S,x[6]=0,x[7]=0,x[8]=0,x[9]=0,x[10]=1/w[10],x[11]=0,x[12]=0,x[13]=0,x[14]=0,x[15]=1/w[15]})(y,f.pitchedLabelPlaneMatrix),c.map((x=>{const w=Be(x.x,x.y,y,f.getElevation),S=f.transform.projectTileCoordinates(w.point.x,w.point.y,f.unwrappedTileID,f.getElevation);return S.point.x=(.5*S.point.x+.5)*f.width,S.point.y=(.5*-S.point.y+.5)*f.height,S}))})(t,n);return(function(c){let f=0,y=0,x=0,w=0;for(let S=0;S<c.length;S++)c[S].isOccluded?(x=S+1,w=0):(w++,w>y&&(y=w,f=x));return c.slice(f,f+y)})(a)}queryRenderedSymbols(t){if(t.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const n=[],a=new p.a8;for(const E of t){const C=new p.P(E.x+vt,E.y+vt);a.extend(C),n.push(C)}const{minX:c,minY:f,maxX:y,maxY:x}=a,w=this.grid.query(c,f,y,x).concat(this.ignoredGrid.query(c,f,y,x)),S={},P={};for(const E of w){const C=E.key;if(S[C.bucketInstanceId]===void 0&&(S[C.bucketInstanceId]={}),S[C.bucketInstanceId][C.featureIndex])continue;const z=[new p.P(E.x1,E.y1),new p.P(E.x2,E.y1),new p.P(E.x2,E.y2),new p.P(E.x1,E.y2)];p.aH(n,z)&&(S[C.bucketInstanceId][C.featureIndex]=!0,P[C.bucketInstanceId]===void 0&&(P[C.bucketInstanceId]=[]),P[C.bucketInstanceId].push(C.featureIndex))}return P}insertCollisionBox(t,n,a,c,f,y){(a?this.ignoredGrid:this.grid).insert({bucketInstanceId:c,featureIndex:f,collisionGroupID:y,overlapMode:n},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,n,a,c,f,y){const x=a?this.ignoredGrid:this.grid,w={bucketInstanceId:c,featureIndex:f,collisionGroupID:y,overlapMode:n};for(let S=0;S<t.length;S+=4)x.insertCircle(w,t[S],t[S+1],t[S+2])}projectAndGetPerspectiveRatio(t,n,a,c,f){if(f){let y;c?(y=[t,n,c(t,n),1],p.aE(y,y,f)):(y=[t,n,0,1],yo(y,y,f));const x=y[3];return{x:(y[0]/x+1)/2*this.transform.width+vt,y:(-y[1]/x+1)/2*this.transform.height+vt,perspectiveRatio:.5+this.transform.cameraToCenterDistance/x*.5,isOccluded:!1,signedDistanceFromCamera:x}}{const y=this.transform.projectTileCoordinates(t,n,a,c);return{x:(y.point.x+1)/2*this.transform.width+vt,y:(1-y.point.y)/2*this.transform.height+vt,perspectiveRatio:.5+this.transform.cameraToCenterDistance/y.signedDistanceFromCamera*.5,isOccluded:y.isOccluded,signedDistanceFromCamera:y.signedDistanceFromCamera}}}getPerspectiveRatio(t,n,a,c){const f=this.transform.projectTileCoordinates(t,n,a,c);return .5+this.transform.cameraToCenterDistance/f.signedDistanceFromCamera*.5}isOffscreen(t,n,a,c){return a<vt||t>=this.screenRightBoundary||c<vt||n>this.screenBottomBoundary}isInsideGrid(t,n,a,c){return a>=0&&t<this.gridRightBoundary&&c>=0&&n<this.gridBottomBoundary}getViewportMatrix(){const t=p.ap([]);return p.Q(t,t,[-100,-100,0]),t}_projectCollisionBox(t,n,a,c,f,y,x,w,S,P,E){let C=1,z=0,B=0,V=1;const G=t.anchorPointX+x[0],N=t.anchorPointY+x[1];if(y&&!f){const ve=this.projectAndGetPerspectiveRatio(G+1,N,c,S,E),ue=ve.x-w.x,we=Math.atan((ve.y-w.y)/ue)+(ue<0?Math.PI:0),Ee=Math.sin(we),Qe=Math.cos(we);C=Qe,z=Ee,B=-Ee,V=Qe}else if(!y&&f){const ve=lr(this.transform);C=ve.vecEast[0],z=ve.vecEast[1],B=ve.vecSouth[0],V=ve.vecSouth[1]}let $=w.x,X=w.y,Z=n;f&&($=G,X=N,Z=Math.pow(2,-(this.transform.zoom-a.overscaledZ)),Z*=this.transform.getPitchedTextCorrection(G,N,c),P||(Z*=p.al(.5+w.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))),P&&($+=C*P.x*Z+B*P.y*Z,X+=z*P.x*Z+V*P.y*Z);const U=t.x1*Z,H=t.x2*Z,q=(U+H)/2,Q=t.y1*Z,se=t.y2*Z,oe=(Q+se)/2,de=[{offsetX:U,offsetY:Q},{offsetX:q,offsetY:Q},{offsetX:H,offsetY:Q},{offsetX:H,offsetY:oe},{offsetX:H,offsetY:se},{offsetX:q,offsetY:se},{offsetX:U,offsetY:se},{offsetX:U,offsetY:oe}];let he=[];for(const{offsetX:ve,offsetY:ue}of de)he.push(new p.P($+C*ve+B*ue,X+z*ve+V*ue));let Pe=!1;if(f){const ve=he.map((ue=>this.projectAndGetPerspectiveRatio(ue.x,ue.y,c,S,E)));Pe=ve.some((ue=>!ue.isOccluded)),he=ve.map((ue=>new p.P(ue.x,ue.y)))}else Pe=!0;return{box:p.aI(he),allPointsOccluded:!Pe}}}class cc{constructor(t,n,a,c){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?n:-n))):c&&a?1:0,this.placed=a}isHidden(){return this.opacity===0&&!this.placed}}class Ps{constructor(t,n,a,c,f){this.text=new cc(t?t.text:null,n,a,f),this.icon=new cc(t?t.icon:null,n,c,f)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class uc{constructor(t,n,a){this.text=t,this.icon=n,this.skipFade=a}}class hc{constructor(t,n,a,c,f){this.bucketInstanceId=t,this.featureIndex=n,this.sourceLayerIndex=a,this.bucketIndex=c,this.tileID=f}}class dc{constructor(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}}get(t){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[t]){const n=++this.maxGroupID;this.collisionGroups[t]={ID:n,predicate:a=>a.collisionGroupID===n}}return this.collisionGroups[t]}}function vo(h,t,n,a,c){const{horizontalAlign:f,verticalAlign:y}=p.aP(h);return new p.P(-(f-.5)*t+a[0]*c,-(y-.5)*n+a[1]*c)}class Na{constructor(t,n,a,c,f){this.transform=t.clone(),this.terrain=n,this.collisionIndex=new lc(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=a,this.retainedQueryData={},this.collisionGroups=new dc(c),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=f,f&&(f.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(t){const n=this.terrain;return n?(a,c)=>n.getElevation(t,a,c):null}getBucketParts(t,n,a,c){const f=a.getBucket(n),y=a.latestFeatureIndex;if(!f||!y||n.id!==f.layerIds[0])return;const x=a.collisionBoxArray,w=f.layers[0].layout,S=f.layers[0].paint,P=Math.pow(2,this.transform.zoom-a.tileID.overscaledZ),E=a.tileSize/p.a6,C=a.tileID.toUnwrapped(),z=w.get("text-rotation-alignment")==="map",B=p.aK(a,1,this.transform.zoom),V=p.aL(this.collisionIndex.transform,a,S.get("text-translate"),S.get("text-translate-anchor")),G=p.aL(this.collisionIndex.transform,a,S.get("icon-translate"),S.get("icon-translate-anchor")),N=Pi(z,this.transform,B);this.retainedQueryData[f.bucketInstanceId]=new hc(f.bucketInstanceId,y,f.sourceLayerIndex,f.index,a.tileID);const $={bucket:f,layout:w,translationText:V,translationIcon:G,unwrappedTileID:C,pitchedLabelPlaneMatrix:N,scale:P,textPixelRatio:E,holdingForFade:a.holdingForSymbolFade(),collisionBoxArray:x,partiallyEvaluatedTextSize:p.aw(f.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(f.sourceID)};if(c)for(const X of f.sortKeyRanges){const{sortKey:Z,symbolInstanceStart:U,symbolInstanceEnd:H}=X;t.push({sortKey:Z,symbolInstanceStart:U,symbolInstanceEnd:H,parameters:$})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:f.symbolInstances.length,parameters:$})}attemptAnchorPlacement(t,n,a,c,f,y,x,w,S,P,E,C,z,B,V,G,N,$,X,Z){var U,H,q;const Q=p.aM[t.textAnchor],se=[t.textOffset0,t.textOffset1],oe=vo(Q,a,c,se,f),de=this.collisionIndex.placeCollisionBox(n,C,w,S,P,x,y,G,E.predicate,X,oe,Z);if((!$||this.collisionIndex.placeCollisionBox($,C,w,S,P,x,y,N,E.predicate,X,oe,Z).placeable)&&de.placeable){let he;if(!((U=this.prevPlacement)===null||U===void 0)&&U.variableOffsets[z.crossTileID]&&(!((q=(H=this.prevPlacement)===null||H===void 0?void 0:H.placements[z.crossTileID])===null||q===void 0)&&q.text)&&(he=this.prevPlacement.variableOffsets[z.crossTileID].anchor),z.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[z.crossTileID]={textOffset:se,width:a,height:c,anchor:Q,textBoxScale:f,prevAnchor:he},this.markUsedJustification(B,Q,z,V),B.allowVerticalPlacement&&(this.markUsedOrientation(B,V,z),this.placedOrientations[z.crossTileID]=V),{shift:oe,placedGlyphBoxes:de}}}placeLayerBucketPart(t,n,a){const{bucket:c,layout:f,translationText:y,translationIcon:x,unwrappedTileID:w,pitchedLabelPlaneMatrix:S,textPixelRatio:P,holdingForFade:E,collisionBoxArray:C,partiallyEvaluatedTextSize:z,collisionGroup:B}=t.parameters,V=f.get("text-optional"),G=f.get("icon-optional"),N=p.aN(f,"text-overlap","text-allow-overlap"),$=N==="always",X=p.aN(f,"icon-overlap","icon-allow-overlap"),Z=X==="always",U=f.get("text-rotation-alignment")==="map",H=f.get("text-pitch-alignment")==="map",q=f.get("icon-text-fit")!=="none",Q=f.get("symbol-z-order")==="viewport-y",se=$&&(Z||!c.hasIconData()||G),oe=Z&&($||!c.hasTextData()||V);!c.collisionArrays&&C&&c.deserializeCollisionBoxes(C);const de=this.retainedQueryData[c.bucketInstanceId].tileID,he=this._getTerrainElevationFunc(de),Pe=this.transform.getFastPathSimpleProjectionMatrix(de),ve=(ue,we,Ee)=>{var Qe,Pt;if(n[ue.crossTileID])return;if(E)return void(this.placements[ue.crossTileID]=new uc(!1,!1,!1));let rt=!1,Mt=!1,Ct=!0,Jt=null,xt={box:null,placeable:!1,offscreen:null,occluded:!1},ci={placeable:!1},Ht=null,Bt=null,Qt=null,Lr=0,Br=0,Or=0;we.textFeatureIndex?Lr=we.textFeatureIndex:ue.useRuntimeCollisionCircles&&(Lr=ue.featureIndex),we.verticalTextFeatureIndex&&(Br=we.verticalTextFeatureIndex);const ei=we.textBox;if(ei){const nr=ft=>{let ct=p.ax.horizontal;if(c.allowVerticalPlacement&&!ft&&this.prevPlacement){const At=this.prevPlacement.placedOrientations[ue.crossTileID];At&&(this.placedOrientations[ue.crossTileID]=At,ct=At,this.markUsedOrientation(c,ct,ue))}return ct},sr=(ft,ct)=>{if(c.allowVerticalPlacement&&ue.numVerticalGlyphVertices>0&&we.verticalTextBox){for(const At of c.writingModes)if(At===p.ax.vertical?(xt=ct(),ci=xt):xt=ft(),xt?.placeable)break}else xt=ft()},Ai=ue.textAnchorOffsetStartIndex,ji=ue.textAnchorOffsetEndIndex;if(ji===Ai){const ft=(ct,At)=>{const mt=this.collisionIndex.placeCollisionBox(ct,N,P,de,w,H,U,y,B.predicate,he,void 0,Pe);return mt?.placeable&&(this.markUsedOrientation(c,At,ue),this.placedOrientations[ue.crossTileID]=At),mt};sr((()=>ft(ei,p.ax.horizontal)),(()=>{const ct=we.verticalTextBox;return c.allowVerticalPlacement&&ue.numVerticalGlyphVertices>0&&ct?ft(ct,p.ax.vertical):{box:null,offscreen:null}})),nr(xt?.placeable)}else{let ft=p.aM[(Pt=(Qe=this.prevPlacement)===null||Qe===void 0?void 0:Qe.variableOffsets[ue.crossTileID])===null||Pt===void 0?void 0:Pt.anchor];const ct=(mt,Tn,ra)=>{const gr=mt.x2-mt.x1,Fl=mt.y2-mt.y1,au=ue.textBoxScale,Ll=q&&X==="never"?Tn:null;let jr=null,Nr=N==="never"?1:2,Ur="never";ft&&Nr++;for(let Bl=0;Bl<Nr;Bl++){for(let Ol=Ai;Ol<ji;Ol++){const na=c.textAnchorOffsets.get(Ol);if(ft&&na.textAnchor!==ft)continue;const sa=this.attemptAnchorPlacement(na,mt,gr,Fl,au,U,H,P,de,w,B,Ur,ue,c,ra,y,x,Ll,he);if(sa&&(jr=sa.placedGlyphBoxes,jr?.placeable))return rt=!0,Jt=sa.shift,jr}ft?ft=null:Ur=N}return a&&!jr&&(jr={box:this.collisionIndex.placeCollisionBox(ei,"always",P,de,w,H,U,y,B.predicate,he,void 0,Pe).box,offscreen:!1,placeable:!1,occluded:!1}),jr};sr((()=>ct(ei,we.iconBox,p.ax.horizontal)),(()=>{const mt=we.verticalTextBox;return c.allowVerticalPlacement&&!xt?.placeable&&ue.numVerticalGlyphVertices>0&&mt?ct(mt,we.verticalIconBox,p.ax.vertical):{box:null,occluded:!0,offscreen:null}})),xt&&(rt=xt.placeable,Ct=xt.offscreen);const At=nr(xt?.placeable);if(!rt&&this.prevPlacement){const mt=this.prevPlacement.variableOffsets[ue.crossTileID];mt&&(this.variableOffsets[ue.crossTileID]=mt,this.markUsedJustification(c,mt.anchor,ue,At))}}}if(Ht=xt,rt=Ht?.placeable,Ct=Ht?.offscreen,ue.useRuntimeCollisionCircles&&ue.centerJustifiedTextSymbolIndex>=0){const nr=c.text.placedSymbolArray.get(ue.centerJustifiedTextSymbolIndex),sr=p.ay(c.textSizeData,z,nr),Ai=f.get("text-padding");Bt=this.collisionIndex.placeCollisionCircles(N,nr,c.lineVertexArray,c.glyphOffsetArray,sr,w,S,a,H,B.predicate,ue.collisionCircleDiameter,Ai,y,he),Bt.circles.length&&Bt.collisionDetected&&!a&&p.w("Collisions detected, but collision boxes are not shown"),rt=$||Bt.circles.length>0&&!Bt.collisionDetected,Ct&&(Ct=Bt.offscreen)}if(we.iconFeatureIndex&&(Or=we.iconFeatureIndex),we.iconBox){const nr=sr=>this.collisionIndex.placeCollisionBox(sr,X,P,de,w,H,U,x,B.predicate,he,q&&Jt?Jt:void 0,Pe);ci&&ci.placeable&&we.verticalIconBox?(Qt=nr(we.verticalIconBox),Mt=Qt.placeable):(Qt=nr(we.iconBox),Mt=Qt.placeable),Ct&&(Ct=Qt.offscreen)}const mr=V||ue.numHorizontalGlyphVertices===0&&ue.numVerticalGlyphVertices===0,Vr=G||ue.numIconVertices===0;mr||Vr?Vr?mr||Mt&&(Mt=rt):rt=Mt&&rt:Mt=rt=Mt&&rt;const ia=Mt&&Qt.placeable;if(rt&&Ht.placeable&&this.collisionIndex.insertCollisionBox(Ht.box,N,f.get("text-ignore-placement"),c.bucketInstanceId,ci&&ci.placeable&&Br?Br:Lr,B.ID),ia&&this.collisionIndex.insertCollisionBox(Qt.box,X,f.get("icon-ignore-placement"),c.bucketInstanceId,Or,B.ID),Bt&&rt&&this.collisionIndex.insertCollisionCircles(Bt.circles,N,f.get("text-ignore-placement"),c.bucketInstanceId,Lr,B.ID),a&&this.storeCollisionData(c.bucketInstanceId,Ee,we,Ht,Qt,Bt),ue.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(c.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[ue.crossTileID]=new uc((rt||se)&&!Ht?.occluded,(Mt||oe)&&!Qt?.occluded,Ct||c.justReloaded),n[ue.crossTileID]=!0};if(Q){if(t.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const ue=c.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let we=ue.length-1;we>=0;--we){const Ee=ue[we];ve(c.symbolInstances.get(Ee),c.collisionArrays[Ee],Ee)}}else for(let ue=t.symbolInstanceStart;ue<t.symbolInstanceEnd;ue++)ve(c.symbolInstances.get(ue),c.collisionArrays[ue],ue);c.justReloaded=!1}storeCollisionData(t,n,a,c,f,y){if(a.textBox||a.iconBox){let x,w;this.collisionBoxArrays.has(t)?x=this.collisionBoxArrays.get(t):(x=new Map,this.collisionBoxArrays.set(t,x)),x.has(n)?w=x.get(n):(w={text:null,icon:null},x.set(n,w)),a.textBox&&(w.text=c.box),a.iconBox&&(w.icon=f.box)}if(y){let x=this.collisionCircleArrays[t];x===void 0&&(x=this.collisionCircleArrays[t]=[]);for(let w=0;w<y.circles.length;w+=4)x.push(y.circles[w+0]-vt),x.push(y.circles[w+1]-vt),x.push(y.circles[w+2]),x.push(y.collisionDetected?1:0)}}markUsedJustification(t,n,a,c){let f;f=c===p.ax.vertical?a.verticalPlacedTextSymbolIndex:{left:a.leftJustifiedTextSymbolIndex,center:a.centerJustifiedTextSymbolIndex,right:a.rightJustifiedTextSymbolIndex}[p.aO(n)];const y=[a.leftJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.rightJustifiedTextSymbolIndex,a.verticalPlacedTextSymbolIndex];for(const x of y)x>=0&&(t.text.placedSymbolArray.get(x).crossTileID=f>=0&&x!==f?0:a.crossTileID)}markUsedOrientation(t,n,a){const c=n===p.ax.horizontal||n===p.ax.horizontalOnly?n:0,f=n===p.ax.vertical?n:0,y=[a.leftJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.rightJustifiedTextSymbolIndex];for(const x of y)t.text.placedSymbolArray.get(x).placedOrientation=c;a.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(a.verticalPlacedTextSymbolIndex).placedOrientation=f)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const n=this.prevPlacement;let a=!1;this.prevZoomAdjustment=n?n.zoomAdjustment(this.transform.zoom):0;const c=n?n.symbolFadeChange(t):1,f=n?n.opacities:{},y=n?n.variableOffsets:{},x=n?n.placedOrientations:{};for(const w in this.placements){const S=this.placements[w],P=f[w];P?(this.opacities[w]=new Ps(P,c,S.text,S.icon),a||(a=S.text!==P.text.placed),a||(a=S.icon!==P.icon.placed)):(this.opacities[w]=new Ps(null,c,S.text,S.icon,S.skipFade),a||(a=S.text||S.icon))}for(const w in f){const S=f[w];if(!this.opacities[w]){const P=new Ps(S,c,!1,!1);P.isHidden()||(this.opacities[w]=P,a||(a=S.text.placed),a||(a=S.icon.placed))}}for(const w in y)this.variableOffsets[w]||!this.opacities[w]||this.opacities[w].isHidden()||(this.variableOffsets[w]=y[w]);for(const w in x)this.placedOrientations[w]||!this.opacities[w]||this.opacities[w].isHidden()||(this.placedOrientations[w]=x[w]);if(n&&n.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");a?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=n?n.lastPlacementChangeTime:t)}updateLayerOpacities(t,n){const a={};for(const c of n){const f=c.getBucket(t);f&&c.latestFeatureIndex&&t.id===f.layerIds[0]&&this.updateBucketOpacities(f,c.tileID,a,c.collisionBoxArray)}}updateBucketOpacities(t,n,a,c){t.hasTextData()&&(t.text.opacityVertexArray.clear(),t.text.hasVisibleVertices=!1),t.hasIconData()&&(t.icon.opacityVertexArray.clear(),t.icon.hasVisibleVertices=!1),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();const f=t.layers[0],y=f.layout,x=new Ps(null,0,!1,!1,!0),w=y.get("text-allow-overlap"),S=y.get("icon-allow-overlap"),P=f._unevaluatedLayout.hasValue("text-variable-anchor")||f._unevaluatedLayout.hasValue("text-variable-anchor-offset"),E=y.get("text-rotation-alignment")==="map",C=y.get("text-pitch-alignment")==="map",z=y.get("icon-text-fit")!=="none",B=new Ps(null,0,w&&(S||!t.hasIconData()||y.get("icon-optional")),S&&(w||!t.hasTextData()||y.get("text-optional")),!0);!t.collisionArrays&&c&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(c);const V=(N,$,X)=>{for(let Z=0;Z<$/4;Z++)N.opacityVertexArray.emplaceBack(X);N.hasVisibleVertices||(N.hasVisibleVertices=X!==Ms)},G=this.collisionBoxArrays.get(t.bucketInstanceId);for(let N=0;N<t.symbolInstances.length;N++){const $=t.symbolInstances.get(N),{numHorizontalGlyphVertices:X,numVerticalGlyphVertices:Z,crossTileID:U}=$;let H=this.opacities[U];a[U]?H=x:H||(H=B,this.opacities[U]=H),a[U]=!0;const q=$.numIconVertices>0,Q=this.placedOrientations[$.crossTileID],se=Q===p.ax.vertical,oe=Q===p.ax.horizontal||Q===p.ax.horizontalOnly;if(X>0||Z>0){const he=Za(H.text);V(t.text,X,se?Ms:he),V(t.text,Z,oe?Ms:he);const Pe=H.text.isHidden(),ve=[$.rightJustifiedTextSymbolIndex,$.centerJustifiedTextSymbolIndex,$.leftJustifiedTextSymbolIndex];for(const Ee of ve)Ee>=0&&(t.text.placedSymbolArray.get(Ee).hidden=Pe||se?1:0);$.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get($.verticalPlacedTextSymbolIndex).hidden=Pe||oe?1:0);const ue=this.variableOffsets[$.crossTileID];ue&&this.markUsedJustification(t,ue.anchor,$,Q);const we=this.placedOrientations[$.crossTileID];we&&(this.markUsedJustification(t,"left",$,we),this.markUsedOrientation(t,we,$))}if(q){const he=Za(H.icon),Pe=!(z&&$.verticalPlacedIconSymbolIndex&&se);$.placedIconSymbolIndex>=0&&(V(t.icon,$.numIconVertices,Pe?he:Ms),t.icon.placedSymbolArray.get($.placedIconSymbolIndex).hidden=H.icon.isHidden()),$.verticalPlacedIconSymbolIndex>=0&&(V(t.icon,$.numVerticalIconVertices,Pe?Ms:he),t.icon.placedSymbolArray.get($.verticalPlacedIconSymbolIndex).hidden=H.icon.isHidden())}const de=G?.has(N)?G.get(N):{text:null,icon:null};if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const he=t.collisionArrays[N];if(he){let Pe=new p.P(0,0);if(he.textBox||he.verticalTextBox){let ve=!0;if(P){const ue=this.variableOffsets[U];ue?(Pe=vo(ue.anchor,ue.width,ue.height,ue.textOffset,ue.textBoxScale),E&&Pe._rotate(C?-this.transform.bearingInRadians:this.transform.bearingInRadians)):ve=!1}if(he.textBox||he.verticalTextBox){let ue;he.textBox&&(ue=se),he.verticalTextBox&&(ue=oe),Ua(t.textCollisionBox.collisionVertexArray,H.text.placed,!ve||ue,de.text,Pe.x,Pe.y)}}if(he.iconBox||he.verticalIconBox){const ve=!!(!oe&&he.verticalIconBox);let ue;he.iconBox&&(ue=ve),he.verticalIconBox&&(ue=!ve),Ua(t.iconCollisionBox.collisionVertexArray,H.icon.placed,ue,de.icon,z?Pe.x:0,z?Pe.y:0)}}}}if(t.sortFeatures(-this.transform.bearingInRadians),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexBuffer&&t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexBuffer&&t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.text.opacityVertexArray.length!==t.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${t.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${t.text.layoutVertexArray.length}) / 4`);if(t.icon.opacityVertexArray.length!==t.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${t.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${t.icon.layoutVertexArray.length}) / 4`);t.bucketInstanceId in this.collisionCircleArrays&&(t.collisionCircleArray=this.collisionCircleArrays[t.bucketInstanceId],delete this.collisionCircleArrays[t.bucketInstanceId])}symbolFadeChange(t){return this.fadeDuration===0?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return this.stale||t-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(t,n){const a=this.zoomAtLastRecencyCheck===n?1-this.zoomAdjustment(n):1;return this.zoomAtLastRecencyCheck=n,this.commitTime+this.fadeDuration*a>t}setStale(){this.stale=!0}}function Ua(h,t,n,a,c,f){a&&a.length!==0||(a=[0,0,0,0]);const y=a[0]-vt,x=a[1]-vt,w=a[2]-vt,S=a[3]-vt;h.emplaceBack(t?1:0,n?1:0,c||0,f||0,y,x),h.emplaceBack(t?1:0,n?1:0,c||0,f||0,w,x),h.emplaceBack(t?1:0,n?1:0,c||0,f||0,w,S),h.emplaceBack(t?1:0,n?1:0,c||0,f||0,y,S)}const Ga=Math.pow(2,25),$a=Math.pow(2,24),Lu=Math.pow(2,17),Is=Math.pow(2,16),xo=Math.pow(2,9),pc=Math.pow(2,8),Vn=Math.pow(2,1);function Za(h){if(h.opacity===0&&!h.placed)return 0;if(h.opacity===1&&h.placed)return 4294967295;const t=h.placed?1:0,n=Math.floor(127*h.opacity);return n*Ga+t*$a+n*Lu+t*Is+n*xo+t*pc+n*Vn+t}const Ms=0;class Ar{constructor(t){this._sortAcrossTiles=t.layout.get("symbol-z-order")!=="viewport-y"&&!t.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(t,n,a,c,f){const y=this._bucketParts;for(;this._currentTileIndex<t.length;)if(n.getBucketParts(y,c,t[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,f())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,y.sort(((x,w)=>x.sortKey-w.sortKey)));this._currentPartIndex<y.length;)if(n.placeLayerBucketPart(y[this._currentPartIndex],this._seenCrossTileIDs,a),this._currentPartIndex++,f())return!0;return!1}}class jn{constructor(t,n,a,c,f,y,x,w){this.placement=new Na(t,n,y,x,w),this._currentPlacementIndex=a.length-1,this._forceFullPlacement=c,this._showCollisionBoxes=f,this._done=!1}isDone(){return this._done}continuePlacement(t,n,a){const c=He(),f=()=>!this._forceFullPlacement&&He()-c>2;for(;this._currentPlacementIndex>=0;){const y=n[t[this._currentPlacementIndex]],x=this.placement.collisionIndex.transform.zoom;if(p.aQ(y)&&y.layout&&(!y.minzoom||y.minzoom<=x)&&(!y.maxzoom||y.maxzoom>x)){if(this._inProgressLayer||(this._inProgressLayer=new Ar(y)),this._inProgressLayer.continuePlacement(a[y.source],this.placement,this._showCollisionBoxes,y,f))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const Ve=512/p.a6/2;class qa{constructor(t,n,a){this.tileID=t,this.bucketInstanceId=a,this._symbolsByKey={};const c=new Map;for(let f=0;f<n.length;f++){const y=n.get(f),x=y.key,w=c.get(x);w?w.push(y):c.set(x,[y])}for(const[f,y]of c){const x={positions:y.map((w=>({x:Math.floor(w.anchorX*Ve),y:Math.floor(w.anchorY*Ve)}))),crossTileIDs:y.map((w=>w.crossTileID))};if(x.positions.length>128){const w=new p.aR(x.positions.length,16,Uint16Array);for(const{x:S,y:P}of x.positions)w.add(S,P);w.finish(),delete x.positions,x.index=w}this._symbolsByKey[f]=x}}getScaledCoordinates(t,n){const{x:a,y:c,z:f}=this.tileID.canonical,{x:y,y:x,z:w}=n.canonical,S=Ve/Math.pow(2,w-f),P=(x*p.a6+t.anchorY)*S,E=c*p.a6*Ve;return{x:Math.floor((y*p.a6+t.anchorX)*S-a*p.a6*Ve),y:Math.floor(P-E)}}findMatches(t,n,a){const c=this.tileID.canonical.z<n.canonical.z?1:Math.pow(2,this.tileID.canonical.z-n.canonical.z);for(let f=0;f<t.length;f++){const y=t.get(f);if(y.crossTileID)continue;const x=this._symbolsByKey[y.key];if(!x)continue;const w=this.getScaledCoordinates(y,n);if(x.index){const S=x.index.range(w.x-c,w.y-c,w.x+c,w.y+c).sort();for(const P of S){const E=x.crossTileIDs[P];if(!a[E]){a[E]=!0,y.crossTileID=E;break}}}else if(x.positions)for(let S=0;S<x.positions.length;S++){const P=x.positions[S],E=x.crossTileIDs[S];if(Math.abs(P.x-w.x)<=c&&Math.abs(P.y-w.y)<=c&&!a[E]){a[E]=!0,y.crossTileID=E;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map((({crossTileIDs:t})=>t))}}class Bu{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Wa{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const n=Math.round((t-this.lng)/360);if(n!==0)for(const a in this.indexes){const c=this.indexes[a],f={};for(const y in c){const x=c[y];x.tileID=x.tileID.unwrapTo(x.tileID.wrap+n),f[x.tileID.key]=x}this.indexes[a]=f}this.lng=t}addBucket(t,n,a){var c,f,y;if(!((c=this.indexes[t.overscaledZ])===null||c===void 0)&&c[t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===n.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let w=0;w<n.symbolInstances.length;w++)n.symbolInstances.get(w).crossTileID=0;(f=this.usedCrossTileIDs)[y=t.overscaledZ]||(f[y]={});const x=this.usedCrossTileIDs[t.overscaledZ];for(const w in this.indexes){const S=this.indexes[w];if(Number(w)>t.overscaledZ)for(const P in S){const E=S[P];E.tileID.isChildOf(t)&&E.findMatches(n.symbolInstances,t,x)}else{const P=S[t.scaledTo(Number(w)).key];P&&P.findMatches(n.symbolInstances,t,x)}}for(let w=0;w<n.symbolInstances.length;w++){const S=n.symbolInstances.get(w);S.crossTileID||(S.crossTileID=a.generate(),x[S.crossTileID]=!0)}return this.indexes[t.overscaledZ]===void 0&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new qa(t,n.symbolInstances,n.bucketInstanceId),!0}removeBucketCrossTileIDs(t,n){for(const a of n.getCrossTileIDsLists())for(const c of a)delete this.usedCrossTileIDs[t][c]}removeStaleBuckets(t){let n=!1;for(const a in this.indexes){const c=this.indexes[a];for(const f in c)t[c[f].bucketInstanceId]||(this.removeBucketCrossTileIDs(a,c[f]),delete c[f],n=!0)}return n}}class _i{constructor(){this.layerIndexes={},this.crossTileIDs=new Bu,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,n,a){let c=this.layerIndexes[t.id];c===void 0&&(c=this.layerIndexes[t.id]=new Wa);let f=!1;const y={};c.handleWrapJump(a);for(const x of n){const w=x.getBucket(t);t.id===w?.layerIds[0]&&(w.bucketInstanceId||(this.maxBucketInstanceId+=1,w.bucketInstanceId=this.maxBucketInstanceId),c.addBucket(x.tileID,w,this.crossTileIDs)&&(f=!0),y[w.bucketInstanceId]=!0)}return c.removeStaleBuckets(y)&&(f=!0),f}pruneUnusedLayers(t){const n={};for(const a of t)n[a]=!0;for(const a in this.layerIndexes)n[a]||delete this.layerIndexes[a]}}var Kt="void main() {fragColor=vec4(1.0);}";const dt={prelude:Re(`#ifdef GL_ES
3
3
  precision mediump float;
4
4
  #else