@signalk/freeboard-sk 3.4.0-beta.2 → 3.4.0-beta.4

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 (54) hide show
  1. package/README.md +6 -0
  2. package/package.json +3 -3
  3. package/public/assets/features/action-button-1.jpg +0 -0
  4. package/public/assets/features/action-button-2.jpg +0 -0
  5. package/public/assets/features-corpus.json +1 -1
  6. package/public/assets/help/img/navigation-route.svg +4 -0
  7. package/public/assets/help/index.html +42 -11
  8. package/public/{chunk-I6KNDLKZ.js → chunk-2GVS7ZQR.js} +1 -1
  9. package/public/{chunk-GJFI75CP.js → chunk-2QKJQDG4.js} +1 -1
  10. package/public/{chunk-N6FC7TMF.js → chunk-6LEKUMNA.js} +1 -1
  11. package/public/{chunk-6XBJQDQZ.js → chunk-AZQNOMPD.js} +1 -1
  12. package/public/{chunk-3D457EZY.js → chunk-BC2VITG4.js} +1 -1
  13. package/public/{chunk-26ZBWNUQ.js → chunk-C2FYMS67.js} +1 -1
  14. package/public/chunk-CRWXCOWS.js +1 -0
  15. package/public/{chunk-EX2EX65O.js → chunk-DC5AFSD6.js} +1 -1
  16. package/public/{chunk-FX2SMI5S.js → chunk-DN6IX7CO.js} +1 -1
  17. package/public/{chunk-M4EXFQJE.js → chunk-DSUCHYD7.js} +1 -1
  18. package/public/{chunk-ON6WKWFV.js → chunk-GJZ7P5CR.js} +1 -1
  19. package/public/{chunk-CZWRDBMY.js → chunk-IP2UNZAT.js} +1 -1
  20. package/public/{chunk-IZEHULJO.js → chunk-K4EGDHPT.js} +2 -2
  21. package/public/chunk-LEEF5WZZ.js +1 -0
  22. package/public/{chunk-VG2HTHDN.js → chunk-LMEOL7YN.js} +124 -124
  23. package/public/{chunk-ZHXEZBYI.js → chunk-MWETYHR7.js} +1 -1
  24. package/public/{chunk-UBRYY245.js → chunk-MZ3YWFFB.js} +1 -1
  25. package/public/chunk-PCGFSZCP.js +1 -0
  26. package/public/{chunk-UIEE3YOF.js → chunk-PWNYMCP2.js} +1 -1
  27. package/public/{chunk-B5DI22LT.js → chunk-PWZFOOT4.js} +1 -1
  28. package/public/{chunk-3PBISOLT.js → chunk-R6ABX6RX.js} +2 -2
  29. package/public/{chunk-Z2OUIJPL.js → chunk-RENDTMDT.js} +1 -1
  30. package/public/{chunk-A7RX2LBX.js → chunk-SIFYI3HU.js} +1 -1
  31. package/public/chunk-TIEJ5U3T.js +1 -0
  32. package/public/chunk-UVQMXSH2.js +1 -0
  33. package/public/{chunk-CKZDFNLJ.js → chunk-VBSJZWSI.js} +1 -1
  34. package/public/{chunk-V44P57GA.js → chunk-VT4GQY5X.js} +1 -1
  35. package/public/{chunk-3E3U7Z7O.js → chunk-VXYZIAGN.js} +1 -1
  36. package/public/chunk-WARJYBQ7.js +7 -0
  37. package/public/{chunk-VAE47BFB.js → chunk-WOU2FNU3.js} +1 -1
  38. package/public/chunk-XOISQHJ7.js +1 -0
  39. package/public/{chunk-O2XN7DIT.js → chunk-YBVURHD5.js} +1 -1
  40. package/public/chunk-Z2IWHI3C.js +1 -0
  41. package/public/{chunk-I3RHGD62.js → chunk-ZQSUYMH2.js} +1 -1
  42. package/public/{chunk-UXZI7A6H.js → chunk-ZZLIMAMY.js} +1 -1
  43. package/public/index.html +1 -1
  44. package/public/main-BD4IQDGT.js +358 -0
  45. package/public/{worker-2QCQHBWQ.js → worker-6LLSDQNK.js} +40 -20
  46. package/public/chunk-6W3TVG4T.js +0 -1
  47. package/public/chunk-FFPCEPCR.js +0 -7
  48. package/public/chunk-L766X4HH.js +0 -1
  49. package/public/chunk-NUFT6SHL.js +0 -1
  50. package/public/chunk-P2M2PBKT.js +0 -1
  51. package/public/chunk-PKC2MOZE.js +0 -1
  52. package/public/chunk-VCZ35SJT.js +0 -1
  53. package/public/chunk-XPTNBYFH.js +0 -1
  54. package/public/main-YMAIP3FL.js +0 -358
@@ -1,2 +1,2 @@
1
- import{T as Br,la as Bt,wc as Jt}from"./chunk-3PBISOLT.js";import{a as x,b as q,g as P}from"./chunk-BZGM3F3K.js";var Ht="plotterExt/1",T={PARSE_ERROR:-32700,INVALID_REQUEST:-32600,METHOD_NOT_FOUND:-32601,INVALID_PARAMS:-32602,INTERNAL_ERROR:-32603,HOST_ERROR:-32e3,TIMEOUT:-32001,CONNECTION_CLOSED:-32002},j=class Ie extends Error{code;data;constructor(e,r={}){super(e),this.name="RpcError",this.code=r.code??T.HOST_ERROR;let n=x({},r.data??{});r.reason!==void 0&&(n.reason=r.reason),this.data=Object.keys(n).length>0?n:void 0}get reason(){return typeof this.data?.reason=="string"?this.data.reason:void 0}toErrorObject(){return x({code:this.code,message:this.message},this.data?{data:this.data}:{})}static fromErrorObject(e){return new Ie(e.message,{code:e.code,data:e.data})}static from(e){return e instanceof Ie?e:e instanceof Error?new Ie(e.message,{code:T.INTERNAL_ERROR}):new Ie(String(e),{code:T.INTERNAL_ERROR})}},Gt="bus.ready",Wt="bus.handshake";function Hr(t,e){return t===e?!0:Gr(t.split("."),0,e.split("."),0)}function Gr(t,e,r,n){for(;e<t.length;){let i=t[e];if(i==="**"){if(e===t.length-1)return!0;for(let a=n;a<=r.length;a++)if(Gr(t,e+1,r,a))return!0;return!1}if(n>=r.length||i!=="*"&&i!==r[n])return!1;e++,n++}return n===r.length}function Qe(t,e){for(let r of t)if(Hr(r,e))return!0;return!1}function Jr(t){return t>=-180&&t<=180?t:((t+180)%360+360)%360-180}function Wr(t){let[e,,r]=t;return r>=e?r-e:r-e+360}function si(t){if(!Array.isArray(t)||t.length!==4||!t.every(l=>typeof l=="number"&&Number.isFinite(l)))return;let[e,r,n,i]=t;if(r<-90||i>90||r>i)return;let a=Jr(e),o=Jr(n);return(e<=n?n-e:Wr([a,r,o,i]))>=360?[-180,r,180,i]:[a,r,o,i]}function li(t){return{bus:Ht,msg:t}}function ui(t){if(typeof t!="object"||t===null)return null;let e=t;return e.bus!==Ht?null:ci(e.msg)?e.msg:null}function ci(t){if(typeof t!="object"||t===null)return!1;let e=t;if(e.jsonrpc!=="2.0")return!1;if(typeof e.method=="string")return e.id===void 0||typeof e.id=="string"||typeof e.id=="number";if(!(typeof e.id=="string"||typeof e.id=="number"||e.id===null))return!1;let n="result"in e,i=e.error,a=typeof i=="object"&&i!==null&&typeof i.code=="number"&&typeof i.message=="string";return n?!("error"in e):a}function pi(t){return"method"in t&&"id"in t&&t.id!==void 0}function fi(t){return"method"in t&&(!("id"in t)||t.id===void 0)}function di(t){return!("method"in t)}function yi(t,e={}){let r=e.listenWindow??globalThis,n=e.origin??r.location?.origin??"*";return{post(i,a){a?.length?t.postMessage(i,{targetOrigin:n,transfer:a}):t.postMessage(i,n)},listen(i){let a=o=>{o.source===t&&(n!=="*"&&o.origin!==n||i(o.data))};return r.addEventListener("message",a),()=>r.removeEventListener("message",a)}}}var mi=1e4,Kt=class{callTimeoutMs;port;unlisten;onError;pending=new Map;methods=new Map;eventHandlers=new Set;idPrefix=Math.random().toString(36).slice(2,8);seq=0;closed=!1;constructor(t){this.port=t.port,this.callTimeoutMs=t.callTimeoutMs??mi,this.onError=t.onError??(e=>console.warn("[plotterext-bus]",e)),this.unlisten=this.port.listen(e=>this.onData(e))}registerMethod(t,e){this.methods.set(t,e)}unregisterMethod(t){this.methods.delete(t)}onEvent(t,e){let r={patterns:t,fn:e};return this.eventHandlers.add(r),()=>this.eventHandlers.delete(r)}notify(t,e,r={}){this.send(x({jsonrpc:"2.0",method:t},e!==void 0?{params:e}:{}),r.transfer)}call(t,e,r={}){if(this.closed)return Promise.reject(new j("Bus endpoint is closed",{code:T.CONNECTION_CLOSED,reason:"CLOSED"}));let n=`${this.idPrefix}-${++this.seq}`,i=r.timeoutMs??this.callTimeoutMs;return new Promise((a,o)=>{let s=i>0?setTimeout(()=>{this.pending.delete(n),o(new j(`Call timed out after ${i}ms: ${t}`,{code:T.TIMEOUT,reason:"TIMEOUT"}))},i):null;this.pending.set(n,{resolve:a,reject:o,timer:s}),this.send(x({jsonrpc:"2.0",id:n,method:t},e!==void 0?{params:e}:{}),r.transfer)})}close(){if(!this.closed){this.closed=!0,this.unlisten();for(let[,t]of this.pending)t.timer&&clearTimeout(t.timer),t.reject(new j("Bus endpoint closed",{code:T.CONNECTION_CLOSED,reason:"CLOSED"}));this.pending.clear(),this.eventHandlers.clear()}}send(t,e){this.closed||this.port.post(li(t),e)}onData(t){let e=ui(t);e&&(di(e)?this.onResponse(e):pi(e)?this.onRequest(e):fi(e)&&this.onNotification(e.method,e.params))}onResponse(t){if(t.id===null)return;let e=this.pending.get(t.id);e&&(this.pending.delete(t.id),e.timer&&clearTimeout(e.timer),"error"in t?e.reject(j.fromErrorObject(t.error)):e.resolve(t.result))}onRequest(t){return P(this,null,function*(){let e=this.methods.get(t.method);if(!e){this.send({jsonrpc:"2.0",id:t.id,error:{code:T.METHOD_NOT_FOUND,message:`Method not found: ${t.method}`}});return}try{let r=yield e(t.params,{endpoint:this});this.send({jsonrpc:"2.0",id:t.id,result:r===void 0?null:r})}catch(r){this.send({jsonrpc:"2.0",id:t.id,error:j.from(r).toErrorObject()})}})}onNotification(t,e){for(let r of[...this.eventHandlers])if(Qe(r.patterns,t))try{r.fn(t,e)}catch(n){this.onError(n)}}};var Kr=["all","extension"];function et(t){return new j(t,{code:T.INVALID_PARAMS,reason:"events.badRequest"})}function hi(t){let e=t??{},{topic:r,scope:n="all"}=e;if(typeof r!="string"||r.length===0)throw et("events.publish requires a non-empty topic");if(r.includes("*"))throw et('events.publish topic must not contain "*"');if(r==="bus"||r.startsWith("bus."))throw et("events.publish topic must not be in the bus.* namespace");if(!Kr.includes(n))throw et(`events.publish scope must be one of: ${Kr.join(", ")}`);return"params"in e?{topic:r,scope:n,params:e.params}:{topic:r,scope:n}}var gi=class{endpoint;context;hostInfo;subs=new Map;onSubscriptionsChanged;adoptCallerId;subSeq=0;constructor(t){this.hostInfo=t.hostInfo,this.context=t.context,this.onSubscriptionsChanged=t.onSubscriptionsChanged,this.adoptCallerId=t.adoptCallerId??!1,this.endpoint=new Kt({port:t.port,callTimeoutMs:t.callTimeoutMs,onError:t.onError});for(let[e,r]of Object.entries(t.methods??{}))this.endpoint.registerMethod(e,r);this.endpoint.registerMethod("events.subscribe",e=>this.handleSubscribe(e)),this.endpoint.registerMethod("events.unsubscribe",e=>this.handleUnsubscribe(e)),this.endpoint.onEvent([Gt],(e,r)=>this.sendHandshake(r))}registerMethod(t,e){this.endpoint.registerMethod(t,e)}publish(t,e){return this.hasSubscriber(t)?(this.endpoint.notify(t,e),!0):!1}hasSubscriber(t){for(let[,e]of this.subs)if(Qe(e,t))return!0;return!1}subscribedPatterns(){let t=new Set;for(let[,e]of this.subs)for(let r of e)t.add(r);return[...t]}close(){this.endpoint.close(),this.subs.clear()}sendHandshake(t){let e=this.adoptCallerId&&t?.id?q(x({},this.context),{id:t.id}):this.context;this.endpoint.notify(Wt,q(x({},this.hostInfo),{context:e}))}handleSubscribe(t){let e=t?.patterns;if(!Array.isArray(e)||e.length===0||!e.every(n=>typeof n=="string"&&n.length>0))throw new j("events.subscribe requires a non-empty patterns array",{code:T.INVALID_PARAMS,reason:"INVALID_PATTERNS"});let r=`sub-${++this.subSeq}`;return this.subs.set(r,e),this.onSubscriptionsChanged?.(this.subscribedPatterns()),{subscriptionId:r}}handleUnsubscribe(t){let e=t?.subscriptionId;if(typeof e!="string"||!this.subs.has(e))throw new j("Unknown subscriptionId",{code:T.INVALID_PARAMS,reason:"UNKNOWN_SUBSCRIPTION"});return this.subs.delete(e),this.onSubscriptionsChanged?.(this.subscribedPatterns()),{}}};var bi=4,Zr=200,Xr={aboveCharts:{base:60,span:30},aboveResources:{base:190,span:10}},W=class extends Error{constructor(r,n){super(n);this.reason=r}reason},ge=(t,e)=>`${t}/${e}`;function Zt(t,e){return typeof t=="number"&&Number.isFinite(t)?Math.min(1,Math.max(0,t)):e}function wi(t,e){if(typeof t.configPanel!="string")return;let r=e?.find(n=>n.id===t.configPanel);return r&&r.type==="iframe"&&r.url&&(r.apiVersion===void 0||r.apiVersion==="1")?r.id:void 0}var xi=t=>typeof t=="number"&&Number.isFinite(t)&&t>0?t:void 0,ki=t=>Array.isArray(t)&&t.every(e=>typeof e=="string")?t:void 0,Yr=class t{definitions=Bt([]);settings=Bt({});latest=new Map;lastLive=new Map;sinks=new Map;requestSeq=0;persist=()=>{};configOpener=()=>{};now=()=>Date.now();setPersist(e){this.persist=e}setConfigOpener(e){this.configOpener=e}openConfigPanel(e){let r=this.entry(e);r?.configPanel&&this.configOpener(r)}entries=Jt(()=>{let e=this.settings(),r={aboveCharts:[],aboveResources:[]};for(let{extension:a,extensionName:o,def:s,panels:l,model:u}of this.definitions()){let c=ge(a,s.id),p=s.band==="aboveResources"?"aboveResources":"aboveCharts",m=e[c];r[p].push(q(x({key:c,extension:a,extensionName:o,id:s.id,title:s.title,type:u?"data":"image"},u?{model:u}:{runtime:s.runtime}),{band:p,visible:typeof m?.visible=="boolean"?m.visible:s.visible!==!1,opacity:Zt(m?.opacity,Zt(s.opacity,1)),suspended:!1,zIndex:0,minZoom:s.minZoom,maxZoom:s.maxZoom,configPanel:wi(s,l),preferredPixelRatio:u?void 0:xi(s.preferredPixelRatio),interactive:!!u&&s.interactive===!0,interactiveLayers:u?ki(s.interactiveLayers):void 0,titleProperty:typeof s.titleProperty=="string"&&s.titleProperty?s.titleProperty:"name"}))}let n=[],i=0;for(let a of["aboveCharts","aboveResources"])r[a].forEach((o,s)=>{o.zIndex=Xr[a].base+Math.min(s,Xr[a].span-1),o.visible&&(o.suspended=i>=bi,o.suspended||i++),n.push(o)});return n});active=Jt(()=>this.entries().filter(e=>e.visible&&!e.suspended));setDefinitions(e){this.definitions.set(e);let r=new Set(this.entries().map(n=>n.key));for(let n of[...this.latest.keys()])r.has(n)||this.latest.delete(n)}loadSettings(e){this.settings.set(x({},e??{}))}entry(e){return this.entries().find(r=>r.key===e)}list(e){return this.entries().filter(r=>r.extension===e).map(r=>x({id:r.id,title:r.title,type:r.type,band:r.band,visible:r.visible,opacity:r.opacity,suspended:r.suspended},r.model?{skippedLayers:r.model.skippedLayers()}:{}))}dataModel(e,r){if(typeof r!="string")throw new W("overlays.badRequest","`overlayId` is required");this.requireOwn(e,[r]);let n=this.entry(ge(e,r))?.model;if(!n)throw new W("overlays.badRequest",`Overlay "${r}" is an image overlay, not a data overlay`);return n}requireOwn(e,r){let n=new Set(this.entries().filter(a=>a.extension===e).map(a=>a.id)),i=r.filter(a=>!n.has(a));if(i.length)throw new W("overlays.unknownId",`Unknown overlay id(s): ${i.join(", ")}`)}setVisibility(e,r){this.update(e,n=>q(x({},n),{visible:r}))}setOpacity(e,r,n=!0){this.update(e,i=>q(x({},i),{opacity:Zt(r,1)}),n)}update(e,r,n=!0){let i=x({},this.settings());for(let a of e){let o=this.entry(a);o&&(i[a]=r({visible:o.visible,opacity:o.opacity}))}this.settings.set(i),n&&this.persist(i)}newRequest(e,r,n){let i=this.entry(e);if(!i)return null;let a=q(x({overlayId:i.id,requestId:`r-${++this.requestSeq}`},r),{liveInterval:Zr}),o=this.latest.get(e)?.request;return this.latest.set(e,{request:a,worldOffset:n,previousSize:o?[o.width,o.height]:void 0}),a}latestRequestsFor(e,r){return this.active().filter(n=>n.extension===e&&n.runtime===r).map(n=>this.latest.get(n.key)?.request).filter(n=>!!n)}clearRequest(e){this.latest.delete(e),this.lastLive.delete(e)}registerSink(e,r){return this.sinks.set(e,r),()=>{this.sinks.get(e)===r&&this.sinks.delete(e)}}acceptFrame(e,r,n){let i=ge(e,n.overlayId),a=this.entry(i);if(a?.type==="data")throw n.image.close(),new W("overlays.badRequest",`Overlay "${n.overlayId}" is a data overlay; the host draws it`);if(!a||r===null||a.runtime!==r)throw n.image.close(),new W("overlays.unknownId",`No overlay "${n.overlayId}" is drawn by this context`);let o=this.latest.get(i),s=this.sinks.get(i);if(!o||!s||!a.visible||a.suspended)return n.image.close(),{accepted:!1,reason:"overlays.superseded"};let l=n.image.width===o.request.width&&n.image.height===o.request.height,u=n.requestId===void 0&&!l&&n.image.width===o.previousSize?.[0]&&n.image.height===o.previousSize?.[1];if(n.requestId!==void 0&&n.requestId!==o.request.requestId||u)return n.image.close(),{accepted:!1,reason:"overlays.superseded"};if(!l)throw n.image.close(),new W("overlays.badRequest",`Frame is ${n.image.width}x${n.image.height}, request was ${o.request.width}x${o.request.height}`);if(n.requestId===void 0){let h=this.now(),O=this.lastLive.get(i);if(O!==void 0&&h-O<Zr)return n.image.close(),{accepted:!1,reason:"overlays.throttled"};this.lastLive.set(i,h)}let[c,p,m,d]=n.extent,g=o.worldOffset;return s({image:n.image,extent:[c+g,p,m+g,d]}),{accepted:!0}}static \u0275fac=function(r){return new(r||t)};static \u0275prov=Br({token:t,factory:t.\u0275fac,providedIn:"root"})};var Si=8,Oi={version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},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"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},$i={"*":{type:"source"}},zi=["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],Ai={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},"*":{type:"*"}},Ei={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:"*"}},Ii={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:"*"}},Mi={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:"*"},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"}},Pi={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"}}},Ri={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"}}},qi={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"}},Ti=["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],ji={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Ci={"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Ni={"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Di={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},_i={"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"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"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Fi={"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","property-type":"constant"}},Li={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Vi={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Ui={type:"array",value:"*"},Bi={type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},Ji={type:"enum",values:{Point:{},LineString:{},Polygon:{}}},Hi={type:"array",minimum:0,maximum:24,value:["number","color"],length:2},Gi={type:"array",value:"*",minimum:1},Wi={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}},Ki={"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}},Zi={source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},Xi={type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},Yi=["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],Qi={"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"}},ea={"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"]},"property-type":"cross-faded"},"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"}},ta={"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"}},ra={"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"}},na={"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"}},ia={"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"},"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"}},aa={"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"}},oa={"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"}},sa={duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},la={"*":{type:"string"}},St={$version:Si,$root:Oi,sources:$i,source:zi,source_vector:Ai,source_raster:Ei,source_raster_dem:Ii,source_geojson:Mi,source_video:Pi,source_image:Ri,layer:qi,layout:Ti,layout_background:ji,layout_fill:Ci,layout_circle:Ni,layout_heatmap:Di,"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:_i,layout_symbol:Fi,layout_raster:Li,layout_hillshade:Vi,"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:Ui,filter_operator:Bi,geometry_type:Ji,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:Hi,expression:Gi,light:Wi,sky:Ki,terrain:Zi,projection:Xi,paint:Yi,paint_fill:Qi,"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:ea,paint_circle:ta,paint_heatmap:ra,paint_symbol:na,paint_raster:ia,paint_hillshade:aa,"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"}},paint_background:oa,transition:sa,"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:la},ua=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function ca(t,e){let r={};for(let n in t)n!=="ref"&&(r[n]=t[n]);return ua.forEach(n=>{n in e&&(r[n]=e[n])}),r}function Ls(t){t=t.slice();let e=Object.create(null);for(let r=0;r<t.length;r++)e[t[r].id]=t[r];for(let r=0;r<t.length;r++)"ref"in t[r]&&(t[r]=ca(t[r],e[t[r].ref]));return t}var f=class{constructor(e,r,n,i){this.message=(e?`${e}: `:"")+n,i&&(this.identifier=i),r!=null&&r.__line__&&(this.line=r.__line__)}};function ke(t,...e){for(let r of e)for(let n in r)t[n]=r[n];return t}var F=class extends Error{constructor(e,r){super(r),this.message=r,this.key=e}},or=class t{constructor(e,r=[]){this.parent=e,this.bindings={};for(let[n,i]of r)this.bindings[n]=i}concat(e){return new t(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]?!0:this.parent?this.parent.has(e):!1}},Ot={kind:"null"},y={kind:"number"},k={kind:"string"},w={kind:"boolean"},K={kind:"color"},$t={kind:"projectionDefinition"},fe={kind:"object"},b={kind:"value"},pa={kind:"error"},zt={kind:"collator"},At={kind:"formatted"},Et={kind:"padding"},qe={kind:"colorArray"},It={kind:"numberArray"},We={kind:"resolvedImage"},Mt={kind:"variableAnchorOffsetCollection"};function D(t,e){return{kind:"array",itemType:t,N:e}}function E(t){if(t.kind==="array"){let e=E(t.itemType);return typeof t.N=="number"?`array<${e}, ${t.N}>`:t.itemType.kind==="value"?"array":`array<${e}>`}else return t.kind}var fa=[Ot,y,k,w,K,$t,At,fe,D(b),Et,It,qe,We,Mt];function Te(t,e){if(e.kind==="error")return null;if(t.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!Te(t.itemType,e.itemType))&&(typeof t.N!="number"||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if(t.kind==="value"){for(let r of fa)if(!Te(r,e))return null}}return`Expected ${E(t)} but found ${E(e)} instead.`}function $r(t,e){return e.some(r=>r.kind===t.kind)}function de(t,e){return e.some(r=>r==="null"?t===null:r==="array"?Array.isArray(t):r==="object"?t&&!Array.isArray(t)&&typeof t=="object":r===typeof t)}function ne(t,e){return t.kind==="array"&&e.kind==="array"?t.itemType.kind===e.itemType.kind&&typeof t.N=="number":t.kind===e.kind}var xn=.96422,kn=1,Sn=.82521,On=4/29,we=6/29,$n=3*we*we,da=we*we*we,ya=Math.PI/180,ma=180/Math.PI;function zn(t){return t=t%360,t<0&&(t+=360),t}function An([t,e,r,n]){t=Xt(t),e=Xt(e),r=Xt(r);let i,a,o=Yt((.2225045*t+.7168786*e+.0606169*r)/kn);t===e&&e===r?i=a=o:(i=Yt((.4360747*t+.3850649*e+.1430804*r)/xn),a=Yt((.0139322*t+.0971045*e+.7141733*r)/Sn));let s=116*o-16;return[s<0?0:s,500*(i-o),200*(o-a),n]}function Xt(t){return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Yt(t){return t>da?Math.pow(t,1/3):t/$n+On}function En([t,e,r,n]){let i=(t+16)/116,a=isNaN(e)?i:i+e/500,o=isNaN(r)?i:i-r/200;return i=kn*er(i),a=xn*er(a),o=Sn*er(o),[Qt(3.1338561*a-1.6168667*i-.4906146*o),Qt(-.9787684*a+1.9161415*i+.033454*o),Qt(.0719453*a-.2289914*i+1.4052427*o),n]}function Qt(t){return t=t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055,t<0?0:t>1?1:t}function er(t){return t>we?t*t*t:$n*(t-On)}function ha(t){let[e,r,n,i]=An(t),a=Math.sqrt(r*r+n*n);return[Math.round(a*1e4)?zn(Math.atan2(n,r)*ma):NaN,a,e,i]}function ga([t,e,r,n]){return t=isNaN(t)?0:t*ya,En([r,Math.cos(t)*e,Math.sin(t)*e,n])}function va([t,e,r,n]){t=zn(t),e/=100,r/=100;function i(a){let o=(a+t/30)%12,s=e*Math.min(r,1-r);return r-s*Math.max(-1,Math.min(o-3,9-o,1))}return[i(0),i(8),i(4),n]}var ba=Object.hasOwn||function(e,r){return Object.prototype.hasOwnProperty.call(e,r)};function Pe(t,e){return ba(t,e)?t[e]:void 0}function wa(t){if(t=t.toLowerCase().trim(),t==="transparent")return[0,0,0,0];let e=Pe(xa,t);if(e){let[i,a,o]=e;return[i/255,a/255,o/255,1]}if(t.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(t)){let a=t.length<6?1:2,o=1;return[tt(t.slice(o,o+=a)),tt(t.slice(o,o+=a)),tt(t.slice(o,o+=a)),tt(t.slice(o,o+a)||"ff")]}if(t.startsWith("rgb")){let i=/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/,a=t.match(i);if(a){let[o,s,l,u,c,p,m,d,g,h,O,v]=a,z=[u||" ",m||" ",h].join("");if(z===" "||z===" /"||z===",,"||z===",,,"){let C=[l,p,g].join(""),ue=C==="%%%"?100:C===""?255:0;if(ue){let Ur=[ve(+s/ue,0,1),ve(+c/ue,0,1),ve(+d/ue,0,1),O?Qr(+O,v):1];if(en(Ur))return Ur}}return}}let r=/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/,n=t.match(r);if(n){let[i,a,o,s,l,u,c,p,m]=n,d=[o||" ",l||" ",c].join("");if(d===" "||d===" /"||d===",,"||d===",,,"){let g=[+a,ve(+s,0,100),ve(+u,0,100),p?Qr(+p,m):1];if(en(g))return va(g)}}}function tt(t){return parseInt(t.padEnd(2,t),16)/255}function Qr(t,e){return ve(e?t/100:t,0,1)}function ve(t,e,r){return Math.min(Math.max(e,t),r)}function en(t){return!t.some(Number.isNaN)}var xa={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 ae(t,e,r){return t+r*(e-t)}function Se(t,e,r){return t.map((n,i)=>ae(n,e[i],r))}function ka(t){return t==="rgb"||t==="hcl"||t==="lab"}var $=class t{constructor(e,r,n,i=1,a=!0){this.r=e,this.g=r,this.b=n,this.a=i,a||(this.r*=i,this.g*=i,this.b*=i,i||this.overwriteGetter("rgb",[e,r,n,i]))}static parse(e){if(e instanceof t)return e;if(typeof e!="string")return;let r=wa(e);if(r)return new t(...r,!1)}get rgb(){let{r:e,g:r,b:n,a:i}=this,a=i||1/0;return this.overwriteGetter("rgb",[e/a,r/a,n/a,i])}get hcl(){return this.overwriteGetter("hcl",ha(this.rgb))}get lab(){return this.overwriteGetter("lab",An(this.rgb))}overwriteGetter(e,r){return Object.defineProperty(this,e,{value:r}),r}toString(){let[e,r,n,i]=this.rgb;return`rgba(${[e,r,n].map(a=>Math.round(a*255)).join(",")},${i})`}static interpolate(e,r,n,i="rgb"){switch(i){case"rgb":{let[a,o,s,l]=Se(e.rgb,r.rgb,n);return new t(a,o,s,l,!1)}case"hcl":{let[a,o,s,l]=e.hcl,[u,c,p,m]=r.hcl,d,g;if(!isNaN(a)&&!isNaN(u)){let C=u-a;u>a&&C>180?C-=360:u<a&&a-u>180&&(C+=360),d=a+n*C}else isNaN(a)?isNaN(u)?d=NaN:(d=u,(s===1||s===0)&&(g=c)):(d=a,(p===1||p===0)&&(g=o));let[h,O,v,z]=ga([d,g??ae(o,c,n),ae(s,p,n),ae(l,m,n)]);return new t(h,O,v,z,!1)}case"lab":{let[a,o,s,l]=En(Se(e.lab,r.lab,n));return new t(a,o,s,l,!1)}}}};$.black=new $(0,0,0,1);$.white=new $(1,1,1,1);$.transparent=new $(0,0,0,0);$.red=new $(1,0,0,1);var je=class{constructor(e,r,n){e?this.sensitivity=r?"variant":"case":this.sensitivity=r?"accent":"base",this.locale=n,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,r){return this.collator.compare(e,r)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}},Sa=["bottom","center","top"],Ce=class{constructor(e,r,n,i,a,o){this.text=e,this.image=r,this.scale=n,this.fontStack=i,this.textColor=a,this.verticalAlign=o}},oe=class t{constructor(e){this.sections=e}static fromString(e){return new t([new Ce(e,null,null,null,null,null)])}isEmpty(){return this.sections.length===0?!0:!this.sections.some(e=>e.text.length!==0||e.image&&e.image.name.length!==0)}static factory(e){return e instanceof t?e:t.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}},V=class t{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof t)return e;if(typeof e=="number")return new t([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(let r of e)if(typeof r!="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]];break}return new t(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,r,n){return new t(Se(e.values,r.values,n))}},U=class t{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof t)return e;if(typeof e=="number")return new t([e]);if(Array.isArray(e)){for(let r of e)if(typeof r!="number")return;return new t(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,r,n){return new t(Se(e.values,r.values,n))}},N=class t{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof t)return e;if(typeof e=="string"){let n=$.parse(e);return n?new t([n]):void 0}if(!Array.isArray(e))return;let r=[];for(let n of e){if(typeof n!="string")return;let i=$.parse(n);if(!i)return;r.push(i)}return new t(r)}toString(){return JSON.stringify(this.values)}static interpolate(e,r,n,i="rgb"){let a=[];if(e.values.length!=r.values.length)throw new Error(`colorArray: Arrays have mismatched length (${e.values.length} vs. ${r.values.length}), cannot interpolate.`);for(let o=0;o<e.values.length;o++)a.push($.interpolate(e.values[o],r.values[o],n,i));return new t(a)}},A=class extends Error{constructor(e){super(e),this.name="RuntimeError"}toJSON(){return this.message}},Oa=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]),X=class t{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof t)return e;if(!(!Array.isArray(e)||e.length<1||e.length%2!==0)){for(let r=0;r<e.length;r+=2){let n=e[r],i=e[r+1];if(typeof n!="string"||!Oa.has(n)||!Array.isArray(i)||i.length!==2||typeof i[0]!="number"||typeof i[1]!="number")return}return new t(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,r,n){let i=e.values,a=r.values;if(i.length!==a.length)throw new A(`Cannot interpolate values of different length. from: ${e.toString()}, to: ${r.toString()}`);let o=[];for(let s=0;s<i.length;s+=2){if(i[s]!==a[s])throw new A(`Cannot interpolate values containing mismatched anchors. from[${s}]: ${i[s]}, to[${s}]: ${a[s]}`);o.push(i[s]);let[l,u]=i[s+1],[c,p]=a[s+1];o.push([ae(l,c,n),ae(u,p,n)])}return new t(o)}},Q=class t{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new t({name:e,available:!1}):null}},se=class t{constructor(e,r,n){this.from=e,this.to=r,this.transition=n}static interpolate(e,r,n){return new t(e,r,n)}static parse(e){if(e instanceof t)return e;if(Array.isArray(e)&&e.length===3&&typeof e[0]=="string"&&typeof e[1]=="string"&&typeof e[2]=="number")return new t(e[0],e[1],e[2]);if(typeof e=="object"&&typeof e.from=="string"&&typeof e.to=="string"&&typeof e.transition=="number")return new t(e.from,e.to,e.transition);if(typeof e=="string")return new t(e,e,1)}};function In(t,e,r,n){return typeof t=="number"&&t>=0&&t<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof r=="number"&&r>=0&&r<=255?typeof n>"u"||typeof n=="number"&&n>=0&&n<=1?null:`Invalid rgba value [${[t,e,r,n].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof n=="number"?[t,e,r,n]:[t,e,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Ne(t){if(t===null||typeof t=="string"||typeof t=="boolean"||typeof t=="number"||t instanceof se||t instanceof $||t instanceof je||t instanceof oe||t instanceof V||t instanceof U||t instanceof N||t instanceof X||t instanceof Q)return!0;if(Array.isArray(t)){for(let e of t)if(!Ne(e))return!1;return!0}else if(typeof t=="object"){for(let e in t)if(!Ne(t[e]))return!1;return!0}else return!1}function M(t){if(t===null)return Ot;if(typeof t=="string")return k;if(typeof t=="boolean")return w;if(typeof t=="number")return y;if(t instanceof $)return K;if(t instanceof se)return $t;if(t instanceof je)return zt;if(t instanceof oe)return At;if(t instanceof V)return Et;if(t instanceof U)return It;if(t instanceof N)return qe;if(t instanceof X)return Mt;if(t instanceof Q)return We;if(Array.isArray(t)){let e=t.length,r;for(let n of t){let i=M(n);if(!r)r=i;else{if(r===i)continue;r=b;break}}return D(r||b,e)}else return fe}function Re(t){let e=typeof t;return t===null?"":e==="string"||e==="number"||e==="boolean"?String(t):t instanceof $||t instanceof se||t instanceof oe||t instanceof V||t instanceof U||t instanceof N||t instanceof X||t instanceof Q?t.toString():JSON.stringify(t)}var Oe=class t{constructor(e,r){this.type=e,this.value=r}static parse(e,r){if(e.length!==2)return r.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!Ne(e[1]))return r.error("invalid value");let n=e[1],i=M(n),a=r.expectedType;return i.kind==="array"&&i.N===0&&a&&a.kind==="array"&&(typeof a.N!="number"||a.N===0)&&(i=a),new t(i,n)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}},rt={string:k,number:y,boolean:w,object:fe},B=class t{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let n=1,i,a=e[0];if(a==="array"){let s;if(e.length>2){let u=e[1];if(typeof u!="string"||!(u in rt)||u==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);s=rt[u],n++}else s=b;let l;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return r.error('The length argument to "array" must be a positive integer literal',2);l=e[2],n++}i=D(s,l)}else{if(!rt[a])throw new Error(`Types doesn't contain name = ${a}`);i=rt[a]}let o=[];for(;n<e.length;n++){let s=r.parse(e[n],n,b);if(!s)return null;o.push(s)}return new t(i,o)}evaluate(e){for(let r=0;r<this.args.length;r++){let n=this.args[r].evaluate(e);if(Te(this.type,M(n))){if(r===this.args.length-1)throw new A(`Expected value to be of type ${E(this.type)}, but found ${E(M(n))} instead.`)}else return n}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}},tn={"to-boolean":w,"to-color":K,"to-number":y,"to-string":k},ie=class t{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let n=e[0];if(!tn[n])throw new Error(`Can't parse ${n} as it is not part of the known types`);if((n==="to-boolean"||n==="to-string")&&e.length!==2)return r.error("Expected one argument.");let i=tn[n],a=[];for(let o=1;o<e.length;o++){let s=r.parse(e[o],o,b);if(!s)return null;a.push(s)}return new t(i,a)}evaluate(e){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(e);case"color":{let r,n;for(let i of this.args){if(r=i.evaluate(e),n=null,r instanceof $)return r;if(typeof r=="string"){let a=e.parseColor(r);if(a)return a}else if(Array.isArray(r)&&(r.length<3||r.length>4?n=`Invalid rgba value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:n=In(r[0],r[1],r[2],r[3]),!n))return new $(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new A(n||`Could not parse color from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"padding":{let r;for(let n of this.args){r=n.evaluate(e);let i=V.parse(r);if(i)return i}throw new A(`Could not parse padding from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"numberArray":{let r;for(let n of this.args){r=n.evaluate(e);let i=U.parse(r);if(i)return i}throw new A(`Could not parse numberArray from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"colorArray":{let r;for(let n of this.args){r=n.evaluate(e);let i=N.parse(r);if(i)return i}throw new A(`Could not parse colorArray from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"variableAnchorOffsetCollection":{let r;for(let n of this.args){r=n.evaluate(e);let i=X.parse(r);if(i)return i}throw new A(`Could not parse variableAnchorOffsetCollection from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"number":{let r=null;for(let n of this.args){if(r=n.evaluate(e),r===null)return 0;let i=Number(r);if(!isNaN(i))return i}throw new A(`Could not convert ${JSON.stringify(r)} to number.`)}case"formatted":return oe.fromString(Re(this.args[0].evaluate(e)));case"resolvedImage":return Q.fromString(Re(this.args[0].evaluate(e)));case"projectionDefinition":return this.args[0].evaluate(e);default:return Re(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}},$a=["Unknown","Point","LineString","Polygon"],ot=class{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"?$a[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 r=this._parseColorCache.get(e);return r||(r=$.parse(e),this._parseColorCache.set(e,r)),r}},st=class t{constructor(e,r,n=[],i,a=new or,o=[]){this.registry=e,this.path=n,this.key=n.map(s=>`[${s}]`).join(""),this.scope=a,this.errors=o,this.expectedType=i,this._isConstant=r}parse(e,r,n,i,a={}){return r?this.concat(r,n,i)._parse(e,a):this._parse(e,a)}_parse(e,r){(e===null||typeof e=="string"||typeof e=="boolean"||typeof e=="number")&&(e=["literal",e]);function n(i,a,o){return o==="assert"?new B(a,[i]):o==="coerce"?new ie(a,[i]):i}if(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", []].');let i=e[0];if(typeof i!="string")return this.error(`Expression name must be a string, but found ${typeof i} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;let a=this.registry[i];if(a){let o=a.parse(e,this);if(!o)return null;if(this.expectedType){let s=this.expectedType,l=o.type;if((s.kind==="string"||s.kind==="number"||s.kind==="boolean"||s.kind==="object"||s.kind==="array")&&l.kind==="value")o=n(o,s,r.typeAnnotation||"assert");else if(s.kind==="projectionDefinition"&&["string","array"].includes(l.kind)||["color","formatted","resolvedImage"].includes(s.kind)&&["value","string"].includes(l.kind)||["padding","numberArray"].includes(s.kind)&&["value","number","array"].includes(l.kind)||s.kind==="colorArray"&&["value","string","array"].includes(l.kind)||s.kind==="variableAnchorOffsetCollection"&&["value","array"].includes(l.kind))o=n(o,s,r.typeAnnotation||"coerce");else if(this.checkSubtype(s,l))return null}if(!(o instanceof Oe)&&o.type.kind!=="resolvedImage"&&this._isConstant(o)){let s=new ot;try{o=new Oe(o.type,o.evaluate(s))}catch(l){return this.error(l.message),null}}return o}return this.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0)}else return typeof e>"u"?this.error("'undefined' value invalid. Use null instead."):typeof e=="object"?this.error('Bare objects invalid. Use ["literal", {...}] instead.'):this.error(`Expected an array, but found ${typeof e} instead.`)}concat(e,r,n){let i=typeof e=="number"?this.path.concat(e):this.path,a=n?this.scope.concat(n):this.scope;return new t(this.registry,this._isConstant,i,r||null,a,this.errors)}error(e,...r){let n=`${this.key}${r.map(i=>`[${i}]`).join("")}`;this.errors.push(new F(n,e))}checkSubtype(e,r){let n=Te(e,r);return n&&this.error(n),n}},lt=class t{constructor(e,r){this.type=r.type,this.bindings=[].concat(e),this.result=r}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(let r of this.bindings)e(r[1]);e(this.result)}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);let n=[];for(let a=1;a<e.length-1;a+=2){let o=e[a];if(typeof o!="string")return r.error(`Expected string, but found ${typeof o} instead.`,a);if(/[^a-zA-Z0-9_]/.test(o))return r.error("Variable names must contain only alphanumeric characters or '_'.",a);let s=r.parse(e[a+1],a+1);if(!s)return null;n.push([o,s])}let i=r.parse(e[e.length-1],e.length-1,r.expectedType,n);return i?new t(n,i):null}outputDefined(){return this.result.outputDefined()}},ut=class t{constructor(e,r){this.type=r.type,this.name=e,this.boundExpression=r}static parse(e,r){if(e.length!==2||typeof e[1]!="string")return r.error("'var' expression requires exactly one string literal argument.");let n=e[1];return r.scope.has(n)?new t(n,r.scope.get(n)):r.error(`Unknown variable "${n}". Make sure "${n}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}},sr=class t{constructor(e,r,n){this.type=e,this.index=r,this.input=n}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);let n=r.parse(e[1],1,y),i=r.parse(e[2],2,D(r.expectedType||b));if(!n||!i)return null;let a=i.type;return new t(a.itemType,n,i)}evaluate(e){let r=this.index.evaluate(e),n=this.input.evaluate(e);if(r<0)throw new A(`Array index out of bounds: ${r} < 0.`);if(r>=n.length)throw new A(`Array index out of bounds: ${r} > ${n.length-1}.`);if(r!==Math.floor(r))throw new A(`Array index must be an integer, but found ${r} instead.`);return n[r]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}},lr=class t{constructor(e,r){this.type=w,this.needle=e,this.haystack=r}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);let n=r.parse(e[1],1,b),i=r.parse(e[2],2,b);return!n||!i?null:$r(n.type,[w,k,y,Ot,b])?new t(n,i):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${E(n.type)} instead`)}evaluate(e){let r=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!n)return!1;if(!de(r,["boolean","string","number","null"]))throw new A(`Expected first argument to be of type boolean, string, number or null, but found ${E(M(r))} instead.`);if(!de(n,["string","array"]))throw new A(`Expected second argument to be of type array or string, but found ${E(M(n))} instead.`);return n.indexOf(r)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}},ur=class t{constructor(e,r,n){this.type=y,this.needle=e,this.haystack=r,this.fromIndex=n}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);let n=r.parse(e[1],1,b),i=r.parse(e[2],2,b);if(!n||!i)return null;if(!$r(n.type,[w,k,y,Ot,b]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${E(n.type)} instead`);if(e.length===4){let a=r.parse(e[3],3,y);return a?new t(n,i,a):null}else return new t(n,i)}evaluate(e){let r=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!de(r,["boolean","string","number","null"]))throw new A(`Expected first argument to be of type boolean, string, number or null, but found ${E(M(r))} instead.`);let i;if(this.fromIndex&&(i=this.fromIndex.evaluate(e)),de(n,["string"])){let a=n.indexOf(r,i);return a===-1?-1:[...n.slice(0,a)].length}else{if(de(n,["array"]))return n.indexOf(r,i);throw new A(`Expected second argument to be of type array or string, but found ${E(M(n))} instead.`)}}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}},cr=class t{constructor(e,r,n,i,a,o){this.inputType=e,this.type=r,this.input=n,this.cases=i,this.outputs=a,this.otherwise=o}static parse(e,r){if(e.length<5)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!==1)return r.error("Expected an even number of arguments.");let n,i;r.expectedType&&r.expectedType.kind!=="value"&&(i=r.expectedType);let a={},o=[];for(let u=2;u<e.length-1;u+=2){let c=e[u],p=e[u+1];Array.isArray(c)||(c=[c]);let m=r.concat(u);if(c.length===0)return m.error("Expected at least one branch label.");for(let g of c){if(typeof g!="number"&&typeof g!="string")return m.error("Branch labels must be numbers or strings.");if(typeof g=="number"&&Math.abs(g)>Number.MAX_SAFE_INTEGER)return m.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof g=="number"&&Math.floor(g)!==g)return m.error("Numeric branch labels must be integer values.");if(!n)n=M(g);else if(m.checkSubtype(n,M(g)))return null;if(typeof a[String(g)]<"u")return m.error("Branch labels must be unique.");a[String(g)]=o.length}let d=r.parse(p,u,i);if(!d)return null;i=i||d.type,o.push(d)}let s=r.parse(e[1],1,b);if(!s)return null;let l=r.parse(e[e.length-1],e.length-1,i);return!l||s.type.kind!=="value"&&r.concat(1).checkSubtype(n,s.type)?null:new t(n,i,s,a,o,l)}evaluate(e){let r=this.input.evaluate(e);return(M(r)===this.inputType&&this.outputs[this.cases[r]]||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()}},pr=class t{constructor(e,r,n){this.type=e,this.branches=r,this.otherwise=n}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!==0)return r.error("Expected an odd number of arguments.");let n;r.expectedType&&r.expectedType.kind!=="value"&&(n=r.expectedType);let i=[];for(let o=1;o<e.length-1;o+=2){let s=r.parse(e[o],o,w);if(!s)return null;let l=r.parse(e[o+1],o+1,n);if(!l)return null;i.push([s,l]),n=n||l.type}let a=r.parse(e[e.length-1],e.length-1,n);if(!a)return null;if(!n)throw new Error("Can't infer output type");return new t(n,i,a)}evaluate(e){for(let[r,n]of this.branches)if(r.evaluate(e))return n.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(let[r,n]of this.branches)e(r),e(n);e(this.otherwise)}outputDefined(){return this.branches.every(([e,r])=>r.outputDefined())&&this.otherwise.outputDefined()}},fr=class t{constructor(e,r,n,i){this.type=e,this.input=r,this.beginIndex=n,this.endIndex=i}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);let n=r.parse(e[1],1,b),i=r.parse(e[2],2,y);if(!n||!i)return null;if(!$r(n.type,[D(b),k,b]))return r.error(`Expected first argument to be of type array or string, but found ${E(n.type)} instead`);if(e.length===4){let a=r.parse(e[3],3,y);return a?new t(n.type,n,i,a):null}else return new t(n.type,n,i)}evaluate(e){let r=this.input.evaluate(e),n=this.beginIndex.evaluate(e),i;if(this.endIndex&&(i=this.endIndex.evaluate(e)),de(r,["string"]))return[...r].slice(n,i).join("");if(de(r,["array"]))return r.slice(n,i);throw new A(`Expected first argument to be of type array or string, but found ${E(M(r))} instead.`)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}};function Pt(t,e){let r=t.length-1,n=0,i=r,a=0,o,s;for(;n<=i;)if(a=Math.floor((n+i)/2),o=t[a],s=t[a+1],o<=e){if(a===r||e<s)return a;n=a+1}else if(o>e)i=a-1;else throw new A("Input is not a number.");return 0}var ct=class t{constructor(e,r,n){this.type=e,this.input=r,this.labels=[],this.outputs=[];for(let[i,a]of n)this.labels.push(i),this.outputs.push(a)}static parse(e,r){if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!==0)return r.error("Expected an even number of arguments.");let n=r.parse(e[1],1,y);if(!n)return null;let i=[],a=null;r.expectedType&&r.expectedType.kind!=="value"&&(a=r.expectedType);for(let o=1;o<e.length;o+=2){let s=o===1?-1/0:e[o],l=e[o+1],u=o,c=o+1;if(typeof s!="number")return r.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',u);if(i.length&&i[i.length-1][0]>=s)return r.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',u);let p=r.parse(l,c,a);if(!p)return null;a=a||p.type,i.push([s,p])}return new t(a,n,i)}evaluate(e){let r=this.labels,n=this.outputs;if(r.length===1)return n[0].evaluate(e);let i=this.input.evaluate(e);if(i<=r[0])return n[0].evaluate(e);let a=r.length;if(i>=r[a-1])return n[a-1].evaluate(e);let o=Pt(r,i);return n[o].evaluate(e)}eachChild(e){e(this.input);for(let r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}};function za(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var tr,rn;function Aa(){if(rn)return tr;rn=1,tr=t;function t(e,r,n,i){this.cx=3*e,this.bx=3*(n-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*r,this.by=3*(i-r)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=r,this.p2x=n,this.p2y=i}return t.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,r){if(r===void 0&&(r=1e-6),e<0)return 0;if(e>1)return 1;for(var n=e,i=0;i<8;i++){var a=this.sampleCurveX(n)-e;if(Math.abs(a)<r)return n;var o=this.sampleCurveDerivativeX(n);if(Math.abs(o)<1e-6)break;n=n-a/o}var s=0,l=1;for(n=e,i=0;i<20&&(a=this.sampleCurveX(n),!(Math.abs(a-e)<r));i++)e>a?s=n:l=n,n=(l-s)*.5+s;return n},solve:function(e,r){return this.sampleCurveY(this.solveCurveX(e,r))}},tr}var Ea=Aa(),Ia=za(Ea),J=class t{constructor(e,r,n,i,a){this.type=e,this.operator=r,this.interpolation=n,this.input=i,this.labels=[],this.outputs=[];for(let[o,s]of a)this.labels.push(o),this.outputs.push(s)}static interpolationFactor(e,r,n,i){let a=0;if(e.name==="exponential")a=rr(r,e.base,n,i);else if(e.name==="linear")a=rr(r,1,n,i);else if(e.name==="cubic-bezier"){let o=e.controlPoints;a=new Ia(o[0],o[1],o[2],o[3]).solve(rr(r,1,n,i))}return a}static parse(e,r){let[n,i,a,...o]=e;if(!Array.isArray(i)||i.length===0)return r.error("Expected an interpolation type expression.",1);if(i[0]==="linear")i={name:"linear"};else if(i[0]==="exponential"){let u=i[1];if(typeof u!="number")return r.error("Exponential interpolation requires a numeric base.",1,1);i={name:"exponential",base:u}}else if(i[0]==="cubic-bezier"){let u=i.slice(1);if(u.length!==4||u.some(c=>typeof c!="number"||c<0||c>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);i={name:"cubic-bezier",controlPoints:u}}else return r.error(`Unknown interpolation type ${String(i[0])}`,1,0);if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!==0)return r.error("Expected an even number of arguments.");if(a=r.parse(a,2,y),!a)return null;let s=[],l=null;(n==="interpolate-hcl"||n==="interpolate-lab")&&r.expectedType!=qe?l=K:r.expectedType&&r.expectedType.kind!=="value"&&(l=r.expectedType);for(let u=0;u<o.length;u+=2){let c=o[u],p=o[u+1],m=u+3,d=u+4;if(typeof c!="number")return r.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',m);if(s.length&&s[s.length-1][0]>=c)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',m);let g=r.parse(p,d,l);if(!g)return null;l=l||g.type,s.push([c,g])}return!ne(l,y)&&!ne(l,$t)&&!ne(l,K)&&!ne(l,Et)&&!ne(l,It)&&!ne(l,qe)&&!ne(l,Mt)&&!ne(l,D(y))?r.error(`Type ${E(l)} is not interpolatable.`):new t(l,n,i,a,s)}evaluate(e){let r=this.labels,n=this.outputs;if(r.length===1)return n[0].evaluate(e);let i=this.input.evaluate(e);if(i<=r[0])return n[0].evaluate(e);let a=r.length;if(i>=r[a-1])return n[a-1].evaluate(e);let o=Pt(r,i),s=r[o],l=r[o+1],u=t.interpolationFactor(this.interpolation,i,s,l),c=n[o].evaluate(e),p=n[o+1].evaluate(e);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return ae(c,p,u);case"color":return $.interpolate(c,p,u);case"padding":return V.interpolate(c,p,u);case"colorArray":return N.interpolate(c,p,u);case"numberArray":return U.interpolate(c,p,u);case"variableAnchorOffsetCollection":return X.interpolate(c,p,u);case"array":return Se(c,p,u);case"projectionDefinition":return se.interpolate(c,p,u)}case"interpolate-hcl":switch(this.type.kind){case"color":return $.interpolate(c,p,u,"hcl");case"colorArray":return N.interpolate(c,p,u,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return $.interpolate(c,p,u,"lab");case"colorArray":return N.interpolate(c,p,u,"lab")}}}eachChild(e){e(this.input);for(let r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}};function rr(t,e,r,n){let i=n-r,a=t-r;return i===0?0:e===1?a/i:(Math.pow(e,a)-1)/(Math.pow(e,i)-1)}var Ma={color:$.interpolate,number:ae,padding:V.interpolate,numberArray:U.interpolate,colorArray:N.interpolate,variableAnchorOffsetCollection:X.interpolate,array:Se},pt=class t{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let n=null,i=r.expectedType;i&&i.kind!=="value"&&(n=i);let a=[];for(let s of e.slice(1)){let l=r.parse(s,1+a.length,n,void 0,{typeAnnotation:"omit"});if(!l)return null;n=n||l.type,a.push(l)}if(!n)throw new Error("No output type");return i&&a.some(s=>Te(i,s.type))?new t(b,a):new t(n,a)}evaluate(e){let r=null,n=0,i;for(let a of this.args)if(n++,r=a.evaluate(e),r&&r instanceof Q&&!r.available&&(i||(i=r.name),r=null,n===this.args.length&&(r=i)),r!==null)break;return r}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}};function nn(t,e){return t==="=="||t==="!="?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 Pa(t,e,r){return e===r}function Ra(t,e,r){return e!==r}function qa(t,e,r){return e<r}function Ta(t,e,r){return e>r}function ja(t,e,r){return e<=r}function Ca(t,e,r){return e>=r}function Mn(t,e,r,n){return n.compare(e,r)===0}function Na(t,e,r,n){return!Mn(t,e,r,n)}function Da(t,e,r,n){return n.compare(e,r)<0}function _a(t,e,r,n){return n.compare(e,r)>0}function Fa(t,e,r,n){return n.compare(e,r)<=0}function La(t,e,r,n){return n.compare(e,r)>=0}function ze(t,e,r){let n=t!=="=="&&t!=="!=";return class Pn{constructor(a,o,s){this.type=w,this.lhs=a,this.rhs=o,this.collator=s,this.hasUntypedArgument=a.type.kind==="value"||o.type.kind==="value"}static parse(a,o){if(a.length!==3&&a.length!==4)return o.error("Expected two or three arguments.");let s=a[0],l=o.parse(a[1],1,b);if(!l)return null;if(!nn(s,l.type))return o.concat(1).error(`"${s}" comparisons are not supported for type '${E(l.type)}'.`);let u=o.parse(a[2],2,b);if(!u)return null;if(!nn(s,u.type))return o.concat(2).error(`"${s}" comparisons are not supported for type '${E(u.type)}'.`);if(l.type.kind!==u.type.kind&&l.type.kind!=="value"&&u.type.kind!=="value")return o.error(`Cannot compare types '${E(l.type)}' and '${E(u.type)}'.`);n&&(l.type.kind==="value"&&u.type.kind!=="value"?l=new B(u.type,[l]):l.type.kind!=="value"&&u.type.kind==="value"&&(u=new B(l.type,[u])));let c=null;if(a.length===4){if(l.type.kind!=="string"&&u.type.kind!=="string"&&l.type.kind!=="value"&&u.type.kind!=="value")return o.error("Cannot use collator to compare non-string types.");if(c=o.parse(a[3],3,zt),!c)return null}return new Pn(l,u,c)}evaluate(a){let o=this.lhs.evaluate(a),s=this.rhs.evaluate(a);if(n&&this.hasUntypedArgument){let l=M(o),u=M(s);if(l.kind!==u.kind||!(l.kind==="string"||l.kind==="number"))throw new A(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${l.kind}, ${u.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){let l=M(o),u=M(s);if(l.kind!=="string"||u.kind!=="string")return e(a,o,s)}return this.collator?r(a,o,s,this.collator.evaluate(a)):e(a,o,s)}eachChild(a){a(this.lhs),a(this.rhs),this.collator&&a(this.collator)}outputDefined(){return!0}}}var Va=ze("==",Pa,Mn),Ua=ze("!=",Ra,Na),Ba=ze("<",qa,Da),Ja=ze(">",Ta,_a),Ha=ze("<=",ja,Fa),Ga=ze(">=",Ca,La),ft=class t{constructor(e,r,n){this.type=zt,this.locale=n,this.caseSensitive=e,this.diacriticSensitive=r}static parse(e,r){if(e.length!==2)return r.error("Expected one argument.");let n=e[1];if(typeof n!="object"||Array.isArray(n))return r.error("Collator options argument must be an object.");let i=r.parse(n["case-sensitive"]===void 0?!1:n["case-sensitive"],1,w);if(!i)return null;let a=r.parse(n["diacritic-sensitive"]===void 0?!1:n["diacritic-sensitive"],1,w);if(!a)return null;let o=null;return n.locale&&(o=r.parse(n.locale,1,k),!o)?null:new t(i,a,o)}evaluate(e){return new je(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}},dr=class t{constructor(e,r,n,i,a){this.type=k,this.number=e,this.locale=r,this.currency=n,this.minFractionDigits=i,this.maxFractionDigits=a}static parse(e,r){if(e.length!==3)return r.error("Expected two arguments.");let n=r.parse(e[1],1,y);if(!n)return null;let i=e[2];if(typeof i!="object"||Array.isArray(i))return r.error("NumberFormat options argument must be an object.");let a=null;if(i.locale&&(a=r.parse(i.locale,1,k),!a))return null;let o=null;if(i.currency&&(o=r.parse(i.currency,1,k),!o))return null;let s=null;if(i["min-fraction-digits"]&&(s=r.parse(i["min-fraction-digits"],1,y),!s))return null;let l=null;return i["max-fraction-digits"]&&(l=r.parse(i["max-fraction-digits"],1,y),!l)?null:new t(n,a,o,s,l)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.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.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}},yr=class t{constructor(e){this.type=At,this.sections=e}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let n=e[1];if(!Array.isArray(n)&&typeof n=="object")return r.error("First argument must be an image or text section.");let i=[],a=!1;for(let o=1;o<=e.length-1;++o){let s=e[o];if(a&&typeof s=="object"&&!Array.isArray(s)){a=!1;let l=null;if(s["font-scale"]&&(l=r.parse(s["font-scale"],1,y),!l))return null;let u=null;if(s["text-font"]&&(u=r.parse(s["text-font"],1,D(k)),!u))return null;let c=null;if(s["text-color"]&&(c=r.parse(s["text-color"],1,K),!c))return null;let p=null;if(s["vertical-align"]){if(typeof s["vertical-align"]=="string"&&!Sa.includes(s["vertical-align"]))return r.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${s["vertical-align"]}' instead.`);if(p=r.parse(s["vertical-align"],1,k),!p)return null}let m=i[i.length-1];m.scale=l,m.font=u,m.textColor=c,m.verticalAlign=p}else{let l=r.parse(e[o],1,b);if(!l)return null;let u=l.type.kind;if(u!=="string"&&u!=="value"&&u!=="null"&&u!=="resolvedImage")return r.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");a=!0,i.push({content:l,scale:null,font:null,textColor:null,verticalAlign:null})}}return new t(i)}evaluate(e){let r=n=>{let i=n.content.evaluate(e);return M(i)===We?new Ce("",i,null,null,null,n.verticalAlign?n.verticalAlign.evaluate(e):null):new Ce(Re(i),null,n.scale?n.scale.evaluate(e):null,n.font?n.font.evaluate(e).join(","):null,n.textColor?n.textColor.evaluate(e):null,n.verticalAlign?n.verticalAlign.evaluate(e):null)};return new oe(this.sections.map(r))}eachChild(e){for(let r of this.sections)e(r.content),r.scale&&e(r.scale),r.font&&e(r.font),r.textColor&&e(r.textColor),r.verticalAlign&&e(r.verticalAlign)}outputDefined(){return!1}},mr=class t{constructor(e){this.type=We,this.input=e}static parse(e,r){if(e.length!==2)return r.error("Expected two arguments.");let n=r.parse(e[1],1,k);return n?new t(n):r.error("No image name provided.")}evaluate(e){let r=this.input.evaluate(e),n=Q.fromString(r);return n&&e.availableImages&&(n.available=e.availableImages.indexOf(r)>-1),n}eachChild(e){e(this.input)}outputDefined(){return!1}},hr=class t{constructor(e){this.type=y,this.input=e}static parse(e,r){if(e.length!==2)return r.error(`Expected 1 argument, but found ${e.length-1} instead.`);let n=r.parse(e[1],1);return n?n.type.kind!=="array"&&n.type.kind!=="string"&&n.type.kind!=="value"?r.error(`Expected argument of type string or array, but found ${E(n.type)} instead.`):new t(n):null}evaluate(e){let r=this.input.evaluate(e);if(typeof r=="string")return[...r].length;if(Array.isArray(r))return r.length;throw new A(`Expected value to be of type string or array, but found ${E(M(r))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}},Z=8192;function Wa(t,e){let r=Ka(t[0]),n=Xa(t[1]),i=Math.pow(2,e.z);return[Math.round(r*i*Z),Math.round(n*i*Z)]}function zr(t,e){let r=Math.pow(2,e.z),n=(t[0]/Z+e.x)/r,i=(t[1]/Z+e.y)/r;return[Za(n),Ya(i)]}function Ka(t){return(180+t)/360}function Za(t){return t*360-180}function Xa(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function Ya(t){return 360/Math.PI*Math.atan(Math.exp((180-t*360)*Math.PI/180))-90}function Ke(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.max(t[2],e[0]),t[3]=Math.max(t[3],e[1])}function De(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function Qa(t,e,r){return e[1]>t[1]!=r[1]>t[1]&&t[0]<(r[0]-e[0])*(t[1]-e[1])/(r[1]-e[1])+e[0]}function eo(t,e,r){let n=t[0]-e[0],i=t[1]-e[1],a=t[0]-r[0],o=t[1]-r[1];return n*o-a*i===0&&n*a<=0&&i*o<=0}function Rt(t,e,r,n){let i=[e[0]-t[0],e[1]-t[1]],a=[n[0]-r[0],n[1]-r[1]];return io(a,i)===0?!1:!!(an(t,e,r,n)&&an(r,n,t,e))}function to(t,e,r){for(let n of r)for(let i=0;i<n.length-1;++i)if(Rt(t,e,n[i],n[i+1]))return!0;return!1}function Ae(t,e,r=!1){let n=!1;for(let i of e)for(let a=0;a<i.length-1;a++){if(eo(t,i[a],i[a+1]))return r;Qa(t,i[a],i[a+1])&&(n=!n)}return n}function ro(t,e){for(let r of e)if(Ae(t,r))return!0;return!1}function Rn(t,e){for(let r of t)if(!Ae(r,e))return!1;for(let r=0;r<t.length-1;++r)if(to(t[r],t[r+1],e))return!1;return!0}function no(t,e){for(let r of e)if(Rn(t,r))return!0;return!1}function io(t,e){return t[0]*e[1]-t[1]*e[0]}function an(t,e,r,n){let i=t[0]-r[0],a=t[1]-r[1],o=e[0]-r[0],s=e[1]-r[1],l=n[0]-r[0],u=n[1]-r[1],c=i*u-l*a,p=o*u-l*s;return c>0&&p<0||c<0&&p>0}function Ar(t,e,r){let n=[];for(let i=0;i<t.length;i++){let a=[];for(let o=0;o<t[i].length;o++){let s=Wa(t[i][o],r);Ke(e,s),a.push(s)}n.push(a)}return n}function qn(t,e,r){let n=[];for(let i=0;i<t.length;i++){let a=Ar(t[i],e,r);n.push(a)}return n}function Tn(t,e,r,n){if(t[0]<r[0]||t[0]>r[2]){let i=n*.5,a=t[0]-r[0]>i?-n:r[0]-t[0]>i?n:0;a===0&&(a=t[0]-r[2]>i?-n:r[2]-t[0]>i?n:0),t[0]+=a}Ke(e,t)}function ao(t){t[0]=t[1]=1/0,t[2]=t[3]=-1/0}function on(t,e,r,n){let i=Math.pow(2,n.z)*Z,a=[n.x*Z,n.y*Z],o=[];for(let s of t)for(let l of s){let u=[l.x+a[0],l.y+a[1]];Tn(u,e,r,i),o.push(u)}return o}function sn(t,e,r,n){let i=Math.pow(2,n.z)*Z,a=[n.x*Z,n.y*Z],o=[];for(let s of t){let l=[];for(let u of s){let c=[u.x+a[0],u.y+a[1]];Ke(e,c),l.push(c)}o.push(l)}if(e[2]-e[0]<=i/2){ao(e);for(let s of o)for(let l of s)Tn(l,e,r,i)}return o}function oo(t,e){let r=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],i=t.canonicalID();if(e.type==="Polygon"){let a=Ar(e.coordinates,n,i),o=on(t.geometry(),r,n,i);if(!De(r,n))return!1;for(let s of o)if(!Ae(s,a))return!1}if(e.type==="MultiPolygon"){let a=qn(e.coordinates,n,i),o=on(t.geometry(),r,n,i);if(!De(r,n))return!1;for(let s of o)if(!ro(s,a))return!1}return!0}function so(t,e){let r=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],i=t.canonicalID();if(e.type==="Polygon"){let a=Ar(e.coordinates,n,i),o=sn(t.geometry(),r,n,i);if(!De(r,n))return!1;for(let s of o)if(!Rn(s,a))return!1}if(e.type==="MultiPolygon"){let a=qn(e.coordinates,n,i),o=sn(t.geometry(),r,n,i);if(!De(r,n))return!1;for(let s of o)if(!no(s,a))return!1}return!0}var _e=class t{constructor(e,r){this.type=w,this.geojson=e,this.geometries=r}static parse(e,r){if(e.length!==2)return r.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Ne(e[1])){let n=e[1];if(n.type==="FeatureCollection"){let i=[];for(let a of n.features){let{type:o,coordinates:s}=a.geometry;o==="Polygon"&&i.push(s),o==="MultiPolygon"&&i.push(...s)}if(i.length){let a={type:"MultiPolygon",coordinates:i};return new t(n,a)}}else if(n.type==="Feature"){let i=n.geometry.type;if(i==="Polygon"||i==="MultiPolygon")return new t(n,n.geometry)}else if(n.type==="Polygon"||n.type==="MultiPolygon")return new t(n,n)}return r.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 oo(e,this.geometries);if(e.geometryType()==="LineString")return so(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}},dt=class{constructor(e=[],r=(n,i)=>n<i?-1:n>i?1:0){if(this.data=e,this.length=this.data.length,this.compare=r,this.length>0)for(let n=(this.length>>1)-1;n>=0;n--)this._down(n)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;let e=this.data[0],r=this.data.pop();return--this.length>0&&(this.data[0]=r,this._down(0)),e}peek(){return this.data[0]}_up(e){let{data:r,compare:n}=this,i=r[e];for(;e>0;){let a=e-1>>1,o=r[a];if(n(i,o)>=0)break;r[e]=o,e=a}r[e]=i}_down(e){let{data:r,compare:n}=this,i=this.length>>1,a=r[e];for(;e<i;){let o=(e<<1)+1,s=o+1;if(s<this.length&&n(r[s],r[o])<0&&(o=s),n(r[o],a)>=0)break;r[e]=r[o],e=o}r[e]=a}};function jn(t,e,r=0,n=t.length-1,i=lo){for(;n>r;){if(n-r>600){let l=n-r+1,u=e-r+1,c=Math.log(l),p=.5*Math.exp(2*c/3),m=.5*Math.sqrt(c*p*(l-p)/l)*(u-l/2<0?-1:1),d=Math.max(r,Math.floor(e-u*p/l+m)),g=Math.min(n,Math.floor(e+(l-u)*p/l+m));jn(t,e,d,g,i)}let a=t[e],o=r,s=n;for(Me(t,r,e),i(t[n],a)>0&&Me(t,r,n);o<s;){for(Me(t,o,s),o++,s--;i(t[o],a)<0;)o++;for(;i(t[s],a)>0;)s--}i(t[r],a)===0?Me(t,r,s):(s++,Me(t,s,n)),s<=e&&(r=s+1),e<=s&&(n=s-1)}}function Me(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}function lo(t,e){return t<e?-1:t>e?1:0}function uo(t,e){if(t.length<=1)return[t];let n=[],i,a;for(let o of t){let s=po(o);s!==0&&(o.area=Math.abs(s),a===void 0&&(a=s<0),a===s<0?(i&&n.push(i),i=[o]):i.push(o))}if(i&&n.push(i),e>1)for(let o=0;o<n.length;o++)n[o].length<=e||(jn(n[o],e,1,n[o].length-1,co),n[o]=n[o].slice(0,e));return n}function co(t,e){return e.area-t.area}function po(t){let e=0;for(let r=0,n=t.length,i=n-1,a,o;r<n;i=r++)a=t[r],o=t[i],e+=(o.x-a.x)*(a.y+o.y);return e}var fo=6378.137,ln=1/298.257223563,un=ln*(2-ln),cn=Math.PI/180,Fe=class{constructor(e){let r=cn*fo*1e3,n=Math.cos(e*cn),i=1/(1-un*(1-n*n)),a=Math.sqrt(i);this.kx=r*a*n,this.ky=r*a*i*(1-un)}distance(e,r){let n=this.wrap(e[0]-r[0])*this.kx,i=(e[1]-r[1])*this.ky;return Math.sqrt(n*n+i*i)}pointOnLine(e,r){let n=1/0,i,a,o,s;for(let l=0;l<e.length-1;l++){let u=e[l][0],c=e[l][1],p=this.wrap(e[l+1][0]-u)*this.kx,m=(e[l+1][1]-c)*this.ky,d=0;(p!==0||m!==0)&&(d=(this.wrap(r[0]-u)*this.kx*p+(r[1]-c)*this.ky*m)/(p*p+m*m),d>1?(u=e[l+1][0],c=e[l+1][1]):d>0&&(u+=p/this.kx*d,c+=m/this.ky*d)),p=this.wrap(r[0]-u)*this.kx,m=(r[1]-c)*this.ky;let g=p*p+m*m;g<n&&(n=g,i=u,a=c,o=l,s=d)}return{point:[i,a],index:o,t:Math.max(0,Math.min(1,s))}}wrap(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}},gr=100,vr=50;function Cn(t,e){return e[0]-t[0]}function yt(t){return t[1]-t[0]+1}function ee(t,e){return t[1]>=t[0]&&t[1]<e}function br(t,e){if(t[0]>t[1])return[null,null];let r=yt(t);if(e){if(r===2)return[t,null];let i=Math.floor(r/2);return[[t[0],t[0]+i],[t[0]+i,t[1]]]}if(r===1)return[t,null];let n=Math.floor(r/2)-1;return[[t[0],t[0]+n],[t[0]+n+1,t[1]]]}function wr(t,e){if(!ee(e,t.length))return[1/0,1/0,-1/0,-1/0];let r=[1/0,1/0,-1/0,-1/0];for(let n=e[0];n<=e[1];++n)Ke(r,t[n]);return r}function xr(t){let e=[1/0,1/0,-1/0,-1/0];for(let r of t)for(let n of r)Ke(e,n);return e}function pn(t){return t[0]!==-1/0&&t[1]!==-1/0&&t[2]!==1/0&&t[3]!==1/0}function Er(t,e,r){if(!pn(t)||!pn(e))return NaN;let n=0,i=0;return t[2]<e[0]&&(n=e[0]-t[2]),t[0]>e[2]&&(n=t[0]-e[2]),t[1]>e[3]&&(i=t[1]-e[3]),t[3]<e[1]&&(i=e[1]-t[3]),r.distance([0,0],[n,i])}function pe(t,e,r){let n=r.pointOnLine(e,t);return r.distance(t,n.point)}function Ir(t,e,r,n,i){let a=Math.min(pe(t,[r,n],i),pe(e,[r,n],i)),o=Math.min(pe(r,[t,e],i),pe(n,[t,e],i));return Math.min(a,o)}function yo(t,e,r,n,i){if(!(ee(e,t.length)&&ee(n,r.length)))return 1/0;let o=1/0;for(let s=e[0];s<e[1];++s){let l=t[s],u=t[s+1];for(let c=n[0];c<n[1];++c){let p=r[c],m=r[c+1];if(Rt(l,u,p,m))return 0;o=Math.min(o,Ir(l,u,p,m,i))}}return o}function mo(t,e,r,n,i){if(!(ee(e,t.length)&&ee(n,r.length)))return NaN;let o=1/0;for(let s=e[0];s<=e[1];++s)for(let l=n[0];l<=n[1];++l)if(o=Math.min(o,i.distance(t[s],r[l])),o===0)return o;return o}function ho(t,e,r){if(Ae(t,e,!0))return 0;let n=1/0;for(let i of e){let a=i[0],o=i[i.length-1];if(a!==o&&(n=Math.min(n,pe(t,[o,a],r)),n===0))return n;let s=r.pointOnLine(i,t);if(n=Math.min(n,r.distance(t,s.point)),n===0)return n}return n}function go(t,e,r,n){if(!ee(e,t.length))return NaN;for(let a=e[0];a<=e[1];++a)if(Ae(t[a],r,!0))return 0;let i=1/0;for(let a=e[0];a<e[1];++a){let o=t[a],s=t[a+1];for(let l of r)for(let u=0,c=l.length,p=c-1;u<c;p=u++){let m=l[p],d=l[u];if(Rt(o,s,m,d))return 0;i=Math.min(i,Ir(o,s,m,d,n))}}return i}function fn(t,e){for(let r of t)for(let n of r)if(Ae(n,e,!0))return!0;return!1}function vo(t,e,r,n=1/0){let i=xr(t),a=xr(e);if(n!==1/0&&Er(i,a,r)>=n)return n;if(De(i,a)){if(fn(t,e))return 0}else if(fn(e,t))return 0;let o=1/0;for(let s of t)for(let l=0,u=s.length,c=u-1;l<u;c=l++){let p=s[c],m=s[l];for(let d of e)for(let g=0,h=d.length,O=h-1;g<h;O=g++){let v=d[O],z=d[g];if(Rt(p,m,v,z))return 0;o=Math.min(o,Ir(p,m,v,z,r))}}return o}function dn(t,e,r,n,i,a){if(!a)return;let o=Er(wr(n,a),i,r);o<e&&t.push([o,a,[0,0]])}function nt(t,e,r,n,i,a,o){if(!a||!o)return;let s=Er(wr(n,a),wr(i,o),r);s<e&&t.push([s,a,o])}function mt(t,e,r,n,i=1/0){let a=Math.min(n.distance(t[0],r[0][0]),i);if(a===0)return a;let o=new dt([[0,[0,t.length-1],[0,0]]],Cn),s=xr(r);for(;o.length>0;){let l=o.pop();if(l[0]>=a)continue;let u=l[1],c=e?vr:gr;if(yt(u)<=c){if(!ee(u,t.length))return NaN;if(e){let p=go(t,u,r,n);if(isNaN(p)||p===0)return p;a=Math.min(a,p)}else for(let p=u[0];p<=u[1];++p){let m=ho(t[p],r,n);if(a=Math.min(a,m),a===0)return 0}}else{let p=br(u,e);dn(o,a,n,t,s,p[0]),dn(o,a,n,t,s,p[1])}}return a}function ht(t,e,r,n,i,a=1/0){let o=Math.min(a,i.distance(t[0],r[0]));if(o===0)return o;let s=new dt([[0,[0,t.length-1],[0,r.length-1]]],Cn);for(;s.length>0;){let l=s.pop();if(l[0]>=o)continue;let u=l[1],c=l[2],p=e?vr:gr,m=n?vr:gr;if(yt(u)<=p&&yt(c)<=m){if(!ee(u,t.length)&&ee(c,r.length))return NaN;let d;if(e&&n)d=yo(t,u,r,c,i),o=Math.min(o,d);else if(e&&!n){let g=t.slice(u[0],u[1]+1);for(let h=c[0];h<=c[1];++h)if(d=pe(r[h],g,i),o=Math.min(o,d),o===0)return o}else if(!e&&n){let g=r.slice(c[0],c[1]+1);for(let h=u[0];h<=u[1];++h)if(d=pe(t[h],g,i),o=Math.min(o,d),o===0)return o}else d=mo(t,u,r,c,i),o=Math.min(o,d)}else{let d=br(u,e),g=br(c,n);nt(s,o,i,t,r,d[0],g[0]),nt(s,o,i,t,r,d[0],g[1]),nt(s,o,i,t,r,d[1],g[0]),nt(s,o,i,t,r,d[1],g[1])}}return o}function bo(t,e){let r=t.geometry(),n=r.flat().map(o=>zr([o.x,o.y],t.canonical));if(r.length===0)return NaN;let i=new Fe(n[0][1]),a=1/0;for(let o of e){switch(o.type){case"Point":a=Math.min(a,ht(n,!1,[o.coordinates],!1,i,a));break;case"LineString":a=Math.min(a,ht(n,!1,o.coordinates,!0,i,a));break;case"Polygon":a=Math.min(a,mt(n,!1,o.coordinates,i,a));break}if(a===0)return a}return a}function wo(t,e){let r=t.geometry(),n=r.flat().map(o=>zr([o.x,o.y],t.canonical));if(r.length===0)return NaN;let i=new Fe(n[0][1]),a=1/0;for(let o of e){switch(o.type){case"Point":a=Math.min(a,ht(n,!0,[o.coordinates],!1,i,a));break;case"LineString":a=Math.min(a,ht(n,!0,o.coordinates,!0,i,a));break;case"Polygon":a=Math.min(a,mt(n,!0,o.coordinates,i,a));break}if(a===0)return a}return a}function xo(t,e){let r=t.geometry();if(r.length===0||r[0].length===0)return NaN;let n=uo(r,0).map(o=>o.map(s=>s.map(l=>zr([l.x,l.y],t.canonical)))),i=new Fe(n[0][0][0][1]),a=1/0;for(let o of e)for(let s of n){switch(o.type){case"Point":a=Math.min(a,mt([o.coordinates],!1,s,i,a));break;case"LineString":a=Math.min(a,mt(o.coordinates,!0,s,i,a));break;case"Polygon":a=Math.min(a,vo(s,o.coordinates,i,a));break}if(a===0)return a}return a}function nr(t){return t.type==="MultiPolygon"?t.coordinates.map(e=>({type:"Polygon",coordinates:e})):t.type==="MultiLineString"?t.coordinates.map(e=>({type:"LineString",coordinates:e})):t.type==="MultiPoint"?t.coordinates.map(e=>({type:"Point",coordinates:e})):[t]}var Le=class t{constructor(e,r){this.type=y,this.geojson=e,this.geometries=r}static parse(e,r){if(e.length!==2)return r.error(`'distance' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Ne(e[1])){let n=e[1];if(n.type==="FeatureCollection")return new t(n,n.features.map(i=>nr(i.geometry)).flat());if(n.type==="Feature")return new t(n,nr(n.geometry));if("type"in n&&"coordinates"in n)return new t(n,nr(n))}return r.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 bo(e,this.geometries);if(e.geometryType()==="LineString")return wo(e,this.geometries);if(e.geometryType()==="Polygon")return xo(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}},Ve=class t{constructor(e){this.type=b,this.key=e}static parse(e,r){if(e.length!==2)return r.error(`Expected 1 argument, but found ${e.length-1} instead.`);let n=e[1];return n==null?r.error("Global state property must be defined."):typeof n!="string"?r.error(`Global state property must be string, but found ${typeof e[1]} instead.`):new t(n)}evaluate(e){var r;let n=(r=e.globals)===null||r===void 0?void 0:r.globalState;return!n||Object.keys(n).length===0?null:Pe(n,this.key)}eachChild(){}outputDefined(){return!1}},Mr={"==":Va,"!=":Ua,">":Ja,"<":Ba,">=":Ga,"<=":Ha,array:B,at:sr,boolean:B,case:pr,coalesce:pt,collator:ft,format:yr,image:mr,in:lr,"index-of":ur,interpolate:J,"interpolate-hcl":J,"interpolate-lab":J,length:hr,let:lt,literal:Oe,match:cr,number:B,"number-format":dr,object:B,slice:fr,step:ct,string:B,"to-boolean":ie,"to-color":ie,"to-number":ie,"to-string":ie,var:ut,within:_e,distance:Le,"global-state":Ve},le=class t{constructor(e,r,n,i){this.name=e,this.type=r,this._evaluate=n,this.args=i}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,r){let n=e[0],i=t.definitions[n];if(!i)return r.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0);let a=Array.isArray(i)?i[0]:i.type,o=Array.isArray(i)?[[i[1],i[2]]]:i.overloads,s=o.filter(([u])=>!Array.isArray(u)||u.length===e.length-1),l=null;for(let[u,c]of s){l=new st(r.registry,gt,r.path,null,r.scope);let p=[],m=!1;for(let d=1;d<e.length;d++){let g=e[d],h=Array.isArray(u)?u[d-1]:u.type,O=l.parse(g,1+p.length,h);if(!O){m=!0;break}p.push(O)}if(!m){if(Array.isArray(u)&&u.length!==p.length){l.error(`Expected ${u.length} arguments, but found ${p.length} instead.`);continue}for(let d=0;d<p.length;d++){let g=Array.isArray(u)?u[d]:u.type,h=p[d];l.concat(d+1).checkSubtype(g,h.type)}if(l.errors.length===0)return new t(n,a,c,p)}}if(s.length===1)r.errors.push(...l.errors);else{let c=(s.length?s:o).map(([m])=>So(m)).join(" | "),p=[];for(let m=1;m<e.length;m++){let d=r.parse(e[m],1+p.length);if(!d)return null;p.push(E(d.type))}r.error(`Expected arguments of type ${c}, but found (${p.join(", ")}) instead.`)}return null}static register(e,r){t.definitions=r;for(let n in r)e[n]=t}};function yn(t,[e,r,n,i]){e=e.evaluate(t),r=r.evaluate(t),n=n.evaluate(t);let a=i?i.evaluate(t):1,o=In(e,r,n,a);if(o)throw new A(o);return new $(e/255,r/255,n/255,a,!1)}function mn(t,e){return t in e}function ir(t,e){let r=e[t];return typeof r>"u"?null:r}function ko(t,e,r,n){for(;r<=n;){let i=r+n>>1;if(e[i]===t)return!0;e[i]>t?n=i-1:r=i+1}return!1}function ce(t){return{type:t}}le.register(Mr,{error:[pa,[k],(t,[e])=>{throw new A(e.evaluate(t))}],typeof:[k,[b],(t,[e])=>E(M(e.evaluate(t)))],"to-rgba":[D(y,4),[K],(t,[e])=>{let[r,n,i,a]=e.evaluate(t).rgb;return[r*255,n*255,i*255,a]}],rgb:[K,[y,y,y],yn],rgba:[K,[y,y,y,y],yn],has:{type:w,overloads:[[[k],(t,[e])=>mn(e.evaluate(t),t.properties())],[[k,fe],(t,[e,r])=>mn(e.evaluate(t),r.evaluate(t))]]},get:{type:b,overloads:[[[k],(t,[e])=>ir(e.evaluate(t),t.properties())],[[k,fe],(t,[e,r])=>ir(e.evaluate(t),r.evaluate(t))]]},"feature-state":[b,[k],(t,[e])=>ir(e.evaluate(t),t.featureState||{})],properties:[fe,[],t=>t.properties()],"geometry-type":[k,[],t=>t.geometryType()],id:[b,[],t=>t.id()],zoom:[y,[],t=>t.globals.zoom],"heatmap-density":[y,[],t=>t.globals.heatmapDensity||0],elevation:[y,[],t=>t.globals.elevation||0],"line-progress":[y,[],t=>t.globals.lineProgress||0],accumulated:[b,[],t=>t.globals.accumulated===void 0?null:t.globals.accumulated],"+":[y,ce(y),(t,e)=>{let r=0;for(let n of e)r+=n.evaluate(t);return r}],"*":[y,ce(y),(t,e)=>{let r=1;for(let n of e)r*=n.evaluate(t);return r}],"-":{type:y,overloads:[[[y,y],(t,[e,r])=>e.evaluate(t)-r.evaluate(t)],[[y],(t,[e])=>-e.evaluate(t)]]},"/":[y,[y,y],(t,[e,r])=>e.evaluate(t)/r.evaluate(t)],"%":[y,[y,y],(t,[e,r])=>e.evaluate(t)%r.evaluate(t)],ln2:[y,[],()=>Math.LN2],pi:[y,[],()=>Math.PI],e:[y,[],()=>Math.E],"^":[y,[y,y],(t,[e,r])=>Math.pow(e.evaluate(t),r.evaluate(t))],sqrt:[y,[y],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[y,[y],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[y,[y],(t,[e])=>Math.log(e.evaluate(t))],log2:[y,[y],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[y,[y],(t,[e])=>Math.sin(e.evaluate(t))],cos:[y,[y],(t,[e])=>Math.cos(e.evaluate(t))],tan:[y,[y],(t,[e])=>Math.tan(e.evaluate(t))],asin:[y,[y],(t,[e])=>Math.asin(e.evaluate(t))],acos:[y,[y],(t,[e])=>Math.acos(e.evaluate(t))],atan:[y,[y],(t,[e])=>Math.atan(e.evaluate(t))],min:[y,ce(y),(t,e)=>Math.min(...e.map(r=>r.evaluate(t)))],max:[y,ce(y),(t,e)=>Math.max(...e.map(r=>r.evaluate(t)))],abs:[y,[y],(t,[e])=>Math.abs(e.evaluate(t))],round:[y,[y],(t,[e])=>{let r=e.evaluate(t);return r<0?-Math.round(-r):Math.round(r)}],floor:[y,[y],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[y,[y],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[w,[k,b],(t,[e,r])=>t.properties()[e.value]===r.value],"filter-id-==":[w,[b],(t,[e])=>t.id()===e.value],"filter-type-==":[w,[k],(t,[e])=>t.geometryType()===e.value],"filter-<":[w,[k,b],(t,[e,r])=>{let n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n<i}],"filter-id-<":[w,[b],(t,[e])=>{let r=t.id(),n=e.value;return typeof r==typeof n&&r<n}],"filter->":[w,[k,b],(t,[e,r])=>{let n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n>i}],"filter-id->":[w,[b],(t,[e])=>{let r=t.id(),n=e.value;return typeof r==typeof n&&r>n}],"filter-<=":[w,[k,b],(t,[e,r])=>{let n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n<=i}],"filter-id-<=":[w,[b],(t,[e])=>{let r=t.id(),n=e.value;return typeof r==typeof n&&r<=n}],"filter->=":[w,[k,b],(t,[e,r])=>{let n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n>=i}],"filter-id->=":[w,[b],(t,[e])=>{let r=t.id(),n=e.value;return typeof r==typeof n&&r>=n}],"filter-has":[w,[b],(t,[e])=>e.value in t.properties()],"filter-has-id":[w,[],t=>t.id()!==null&&t.id()!==void 0],"filter-type-in":[w,[D(k)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[w,[D(b)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[w,[k,D(b)],(t,[e,r])=>r.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[w,[k,D(b)],(t,[e,r])=>ko(t.properties()[e.value],r.value,0,r.value.length-1)],all:{type:w,overloads:[[[w,w],(t,[e,r])=>e.evaluate(t)&&r.evaluate(t)],[ce(w),(t,e)=>{for(let r of e)if(!r.evaluate(t))return!1;return!0}]]},any:{type:w,overloads:[[[w,w],(t,[e,r])=>e.evaluate(t)||r.evaluate(t)],[ce(w),(t,e)=>{for(let r of e)if(r.evaluate(t))return!0;return!1}]]},"!":[w,[w],(t,[e])=>!e.evaluate(t)],"is-supported-script":[w,[k],(t,[e])=>{let r=t.globals&&t.globals.isSupportedScript;return r?r(e.evaluate(t)):!0}],upcase:[k,[k],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[k,[k],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[k,ce(b),(t,e)=>e.map(r=>Re(r.evaluate(t))).join("")],"resolved-locale":[k,[zt],(t,[e])=>e.evaluate(t).resolvedLocale()]});function So(t){return Array.isArray(t)?`(${t.map(E).join(", ")})`:`(${E(t.type)}...)`}function gt(t){if(t instanceof ut)return gt(t.boundExpression);if(t instanceof le&&t.name==="error")return!1;if(t instanceof ft)return!1;if(t instanceof _e)return!1;if(t instanceof Le)return!1;if(t instanceof Ve)return!1;let e=t instanceof ie||t instanceof B,r=!0;return t.eachChild(n=>{e?r=r&&gt(n):r=r&&n instanceof Oe}),r?qt(t)&&Tt(t,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"]):!1}function qt(t){if(t instanceof le){if(t.name==="get"&&t.args.length===1)return!1;if(t.name==="feature-state")return!1;if(t.name==="has"&&t.args.length===1)return!1;if(t.name==="properties"||t.name==="geometry-type"||t.name==="id")return!1;if(/^filter-/.test(t.name))return!1}if(t instanceof _e||t instanceof Le)return!1;let e=!0;return t.eachChild(r=>{e&&!qt(r)&&(e=!1)}),e}function Ue(t){if(t instanceof le&&t.name==="feature-state")return!1;let e=!0;return t.eachChild(r=>{e&&!Ue(r)&&(e=!1)}),e}function Tt(t,e){if(t instanceof le&&e.indexOf(t.name)>=0)return!1;let r=!0;return t.eachChild(n=>{r&&!Tt(n,e)&&(r=!1)}),r}function kr(t){return{result:"success",value:t}}function be(t){return{result:"error",value:t}}function vt(t){return t["property-type"]==="data-driven"||t["property-type"]==="cross-faded-data-driven"}function Nn(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function Pr(t){return!!t.expression&&t.expression.interpolated}function S(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":t===null?"null":typeof t}function jt(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)&&M(t)===fe}function Oo(t){return t}function $o(t){switch(t.type){case"color":return $.parse;case"padding":return V.parse;case"numberArray":return U.parse;case"colorArray":return N.parse;default:return null}}function zo(t){switch(t){case"exponential":return _n;case"interval":return Eo;case"categorical":return Ao;case"identity":return Io;default:throw new Error(`Unknown function type "${t}"`)}}function Dn(t,e){let r=t.stops&&typeof t.stops[0][0]=="object",n=r||t.property!==void 0,i=r||!n,a=t.type||(Pr(e)?"exponential":"interval"),o=$o(e);if(o&&(t=ke({},t),t.stops&&(t.stops=t.stops.map(c=>[c[0],o(c[1])])),t.default?t.default=o(t.default):t.default=o(e.default)),t.colorSpace&&!ka(t.colorSpace))throw new Error(`Unknown color space: "${t.colorSpace}"`);let s=zo(a),l,u;if(a==="categorical"){l=Object.create(null);for(let c of t.stops)l[c[0]]=c[1];u=typeof t.stops[0][0]}if(r){let c={},p=[];for(let g=0;g<t.stops.length;g++){let h=t.stops[g],O=h[0].zoom;c[O]===void 0&&(c[O]={zoom:O,type:t.type,property:t.property,default:t.default,stops:[]},p.push(O)),c[O].stops.push([h[0].value,h[1]])}let m=[];for(let g of p)m.push([c[g].zoom,Dn(c[g],e)]);let d={name:"linear"};return{kind:"composite",interpolationType:d,interpolationFactor:J.interpolationFactor.bind(void 0,d),zoomStops:m.map(g=>g[0]),evaluate({zoom:g},h){return _n({stops:m,base:t.base},e,g).evaluate(g,h)}}}else if(i){let c=a==="exponential"?{name:"exponential",base:t.base!==void 0?t.base:1}:null;return{kind:"camera",interpolationType:c,interpolationFactor:J.interpolationFactor.bind(void 0,c),zoomStops:t.stops.map(p=>p[0]),evaluate:({zoom:p})=>s(t,e,p,l,u)}}else return{kind:"source",evaluate(c,p){let m=p&&p.properties?p.properties[t.property]:void 0;return m===void 0?Ze(t.default,e.default):s(t,e,m,l,u)}}}function Ze(t,e,r){if(t!==void 0)return t;if(e!==void 0)return e;if(r!==void 0)return r}function Ao(t,e,r,n,i){let a=typeof r===i?n[r]:void 0;return Ze(a,t.default,e.default)}function Eo(t,e,r){if(S(r)!=="number")return Ze(t.default,e.default);let n=t.stops.length;if(n===1||r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[n-1][0])return t.stops[n-1][1];let i=Pt(t.stops.map(a=>a[0]),r);return t.stops[i][1]}function _n(t,e,r){let n=t.base!==void 0?t.base:1;if(S(r)!=="number")return Ze(t.default,e.default);let i=t.stops.length;if(i===1||r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[i-1][0])return t.stops[i-1][1];let a=Pt(t.stops.map(c=>c[0]),r),o=Mo(r,n,t.stops[a][0],t.stops[a+1][0]),s=t.stops[a][1],l=t.stops[a+1][1],u=Ma[e.type]||Oo;return typeof s.evaluate=="function"?{evaluate(...c){let p=s.evaluate.apply(void 0,c),m=l.evaluate.apply(void 0,c);if(!(p===void 0||m===void 0))return u(p,m,o,t.colorSpace)}}:u(s,l,o,t.colorSpace)}function Io(t,e,r){switch(e.type){case"color":r=$.parse(r);break;case"formatted":r=oe.fromString(r.toString());break;case"resolvedImage":r=Q.fromString(r.toString());break;case"padding":r=V.parse(r);break;case"colorArray":r=N.parse(r);break;case"numberArray":r=U.parse(r);break;default:S(r)!==e.type&&(e.type!=="enum"||!e.values[r])&&(r=void 0)}return Ze(r,t.default,e.default)}function Mo(t,e,r,n){let i=n-r,a=t-r;return i===0?0:e===1?a/i:(Math.pow(e,a)-1)/(Math.pow(e,i)-1)}var bt=class{constructor(e,r){this.expression=e,this._warningHistory={},this._evaluator=new ot,this._defaultValue=r?To(r):null,this._enumValues=r&&r.type==="enum"?r.values:null}evaluateWithoutErrorHandling(e,r,n,i,a,o){return this._evaluator.globals=e,this._evaluator.feature=r,this._evaluator.featureState=n,this._evaluator.canonical=i,this._evaluator.availableImages=a||null,this._evaluator.formattedSection=o,this.expression.evaluate(this._evaluator)}evaluate(e,r,n,i,a,o){this._evaluator.globals=e,this._evaluator.feature=r||null,this._evaluator.featureState=n||null,this._evaluator.canonical=i,this._evaluator.availableImages=a||null,this._evaluator.formattedSection=o||null;try{let s=this.expression.evaluate(this._evaluator);if(s==null||typeof s=="number"&&s!==s)return this._defaultValue;if(this._enumValues&&!(s in this._enumValues))throw new A(`Expected value to be one of ${Object.keys(this._enumValues).map(l=>JSON.stringify(l)).join(", ")}, but found ${JSON.stringify(s)} instead.`);return s}catch(s){return this._warningHistory[s.message]||(this._warningHistory[s.message]=!0,typeof console<"u"&&console.warn(s.message)),this._defaultValue}}};function Ct(t){return Array.isArray(t)&&t.length>0&&typeof t[0]=="string"&&t[0]in Mr}function Nt(t,e){let r=new st(Mr,gt,[],e?qo(e):void 0),n=r.parse(t,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return n?kr(new bt(n,e)):be(r.errors)}var Be=class{constructor(e,r){this.kind=e,this._styleExpression=r,this.isStateDependent=e!=="constant"&&!Ue(r.expression),this.globalStateRefs=Dt(r.expression)}evaluateWithoutErrorHandling(e,r,n,i,a,o){return this._styleExpression.evaluateWithoutErrorHandling(e,r,n,i,a,o)}evaluate(e,r,n,i,a,o){return this._styleExpression.evaluate(e,r,n,i,a,o)}},Je=class{constructor(e,r,n,i){this.kind=e,this.zoomStops=n,this._styleExpression=r,this.isStateDependent=e!=="camera"&&!Ue(r.expression),this.globalStateRefs=Dt(r.expression),this.interpolationType=i}evaluateWithoutErrorHandling(e,r,n,i,a,o){return this._styleExpression.evaluateWithoutErrorHandling(e,r,n,i,a,o)}evaluate(e,r,n,i,a,o){return this._styleExpression.evaluate(e,r,n,i,a,o)}interpolationFactor(e,r,n){return this.interpolationType?J.interpolationFactor(this.interpolationType,e,r,n):0}};function Po(t){return t._styleExpression!==void 0}function Rr(t,e){let r=Nt(t,e);if(r.result==="error")return r;let n=r.value.expression,i=qt(n);if(!i&&!vt(e))return be([new F("","data expressions not supported")]);let a=Tt(n,["zoom"]);if(!a&&!Nn(e))return be([new F("","zoom expressions not supported")]);let o=at(n);if(!o&&!a)return be([new F("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(o instanceof F)return be([o]);if(o instanceof J&&!Pr(e))return be([new F("",'"interpolate" expressions cannot be used with this property')]);if(!o)return kr(i?new Be("constant",r.value):new Be("source",r.value));let s=o instanceof J?o.interpolation:void 0;return kr(i?new Je("camera",r.value,o.labels,s):new Je("composite",r.value,o.labels,s))}var wt=class t{constructor(e,r){this._parameters=e,this._specification=r,ke(this,Dn(this._parameters,this._specification))}static deserialize(e){return new t(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}};function Ro(t,e){if(jt(t))return new wt(t,e);if(Ct(t)){let r=Rr(t,e);if(r.result==="error")throw new Error(r.value.map(n=>`${n.key}: ${n.message}`).join(", "));return r.value}else{let r=t;return e.type==="color"&&typeof t=="string"?r=$.parse(t):e.type==="padding"&&(typeof t=="number"||Array.isArray(t))?r=V.parse(t):e.type==="numberArray"&&(typeof t=="number"||Array.isArray(t))?r=U.parse(t):e.type==="colorArray"&&(typeof t=="string"||Array.isArray(t))?r=N.parse(t):e.type==="variableAnchorOffsetCollection"&&Array.isArray(t)?r=X.parse(t):e.type==="projectionDefinition"&&typeof t=="string"&&(r=se.parse(t)),{globalStateRefs:new Set,kind:"constant",evaluate:()=>r}}}function at(t){let e=null;if(t instanceof lt)e=at(t.result);else if(t instanceof pt){for(let r of t.args)if(e=at(r),e)break}else(t instanceof ct||t instanceof J)&&t.input instanceof le&&t.input.name==="zoom"&&(e=t);return e instanceof F||t.eachChild(r=>{let n=at(r);n instanceof F?e=n:!e&&n?e=new F("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&n&&e!==n&&(e=new F("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function Dt(t,e=new Set){return t instanceof Ve&&e.add(t.key),t.eachChild(r=>{Dt(r,e)}),e}function qo(t){let e={color:K,string:k,number:y,enum:k,boolean:w,formatted:At,padding:Et,numberArray:It,colorArray:qe,projectionDefinition:$t,resolvedImage:We,variableAnchorOffsetCollection:Mt};return t.type==="array"?D(e[t.value]||b,t.length):e[t.type]}function To(t){if(t.type==="color"&&jt(t.default))return new $(0,0,0,0);switch(t.type){case"color":return $.parse(t.default)||null;case"padding":return V.parse(t.default)||null;case"numberArray":return U.parse(t.default)||null;case"colorArray":return N.parse(t.default)||null;case"variableAnchorOffsetCollection":return X.parse(t.default)||null;case"projectionDefinition":return se.parse(t.default)||null;default:return t.default===void 0?null:t.default}}function _t(t){if(t===!0||t===!1)return!0;if(!Array.isArray(t)||t.length===0)return!1;switch(t[0]){case"has":return t.length>=2&&t[1]!=="$id"&&t[1]!=="$type";case"in":return t.length>=3&&(typeof t[1]!="string"||Array.isArray(t[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return t.length!==3||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(let e of t.slice(1))if(!_t(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}var jo={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Vs(t){if(t==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};_t(t)||(t=xt(t));let e=Nt(t,jo);if(e.result==="error")throw new Error(e.value.map(r=>`${r.key}: ${r.message}`).join(", "));{let r=Fn(t);return{filter:(n,i,a)=>e.value.evaluate(n,i,{},a),needGeometry:r,getGlobalStateRefs:()=>Dt(e.value.expression)}}}function Co(t,e){return t<e?-1:t>e?1:0}function Fn(t){if(!Array.isArray(t))return!1;if(t[0]==="within"||t[0]==="distance")return!0;for(let e=1;e<t.length;e++)if(Fn(t[e]))return!0;return!1}function xt(t){if(!t)return!0;let e=t[0];return t.length<=1?e!=="any":e==="=="?ar(t[1],t[2],"=="):e==="!="?it(ar(t[1],t[2],"==")):e==="<"||e===">"||e==="<="||e===">="?ar(t[1],t[2],e):e==="any"?No(t.slice(1)):e==="all"?["all"].concat(t.slice(1).map(xt)):e==="none"?["all"].concat(t.slice(1).map(xt).map(it)):e==="in"?hn(t[1],t.slice(2)):e==="!in"?it(hn(t[1],t.slice(2))):e==="has"?gn(t[1]):e==="!has"?it(gn(t[1])):!0}function ar(t,e,r){switch(t){case"$type":return[`filter-type-${r}`,e];case"$id":return[`filter-id-${r}`,e];default:return[`filter-${r}`,t,e]}}function No(t){return["any"].concat(t.map(xt))}function hn(t,e){if(e.length===0)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(r=>typeof r!=typeof e[0])?["filter-in-large",t,["literal",e.sort(Co)]]:["filter-in-small",t,["literal",e]]}}function gn(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function it(t){return["!",t]}function He(t){return typeof t=="object"?["literal",t]:t}function Us(t,e){let r=t.stops;if(!r)return Do(t,e);let n=r&&typeof r[0][0]=="object",i=n||t.property!==void 0,a=n||!i;return r=r.map(o=>!i&&e.tokens&&typeof o[1]=="string"?[o[0],Vo(o[1])]:[o[0],He(o[1])]),n?_o(t,e,r):a?Lo(t,e,r):Sr(t,e,r)}function Do(t,e){let r=["get",t.property];if(t.default===void 0)return e.type==="string"?["string",r]:r;if(e.type==="enum")return["match",r,Object.keys(e.values),r,t.default];{let n=[e.type==="color"?"to-color":e.type,r,He(t.default)];return e.type==="array"&&n.splice(1,0,e.value,e.length||null),n}}function qr(t){switch(t.colorSpace){case"hcl":return"interpolate-hcl";case"lab":return"interpolate-lab";default:return"interpolate"}}function _o(t,e,r){let n={},i={},a=[];for(let s=0;s<r.length;s++){let l=r[s],u=l[0].zoom;n[u]===void 0&&(n[u]={zoom:u,type:t.type,property:t.property,default:t.default},i[u]=[],a.push(u)),i[u].push([l[0].value,l[1]])}if(jr({},e)==="exponential"){let s=[qr(t),["linear"],["zoom"]];for(let l of a){let u=Sr(n[l],e,i[l]);xe(s,l,u,!1)}return s}else{let s=["step",["zoom"]];for(let l of a){let u=Sr(n[l],e,i[l]);xe(s,l,u,!0)}return Tr(s),s}}function Fo(t,e){if(t!==void 0)return t;if(e!==void 0)return e}function vn(t,e){let r=He(Fo(t.default,e.default));return r===void 0&&e.type==="resolvedImage"?"":r}function Sr(t,e,r){let n=jr(t,e),i=["get",t.property];if(n==="categorical"&&typeof r[0][0]=="boolean"){let a=["case"];for(let o of r)a.push(["==",i,o[0]],o[1]);return a.push(vn(t,e)),a}else if(n==="categorical"){let a=["match",i];for(let o of r)xe(a,o[0],o[1],!1);return a.push(vn(t,e)),a}else if(n==="interval"){let a=["step",["number",i]];for(let o of r)xe(a,o[0],o[1],!0);return Tr(a),t.default===void 0?a:["case",["==",["typeof",i],"number"],a,He(t.default)]}else if(n==="exponential"){let a=t.base!==void 0?t.base:1,o=[qr(t),a===1?["linear"]:["exponential",a],["number",i]];for(let s of r)xe(o,s[0],s[1],!1);return t.default===void 0?o:["case",["==",["typeof",i],"number"],o,He(t.default)]}else throw new Error(`Unknown property function type ${n}`)}function Lo(t,e,r,n=["zoom"]){let i=jr(t,e),a,o=!1;if(i==="interval")a=["step",n],o=!0;else if(i==="exponential"){let s=t.base!==void 0?t.base:1;a=[qr(t),s===1?["linear"]:["exponential",s],n]}else throw new Error(`Unknown zoom function type "${i}"`);for(let s of r)xe(a,s[0],s[1],o);return Tr(a),a}function Tr(t){t[0]==="step"&&t.length===3&&(t.push(0),t.push(t[3]))}function xe(t,e,r,n){t.length>3&&e===t[t.length-2]||(n&&t.length===2||t.push(e),t.push(r))}function jr(t,e){return t.type?t.type:e.expression.interpolated?"exponential":"interval"}function Vo(t){let e=["concat"],r=/{([^{}]+)}/g,n=0;for(let i=r.exec(t);i!==null;i=r.exec(t)){let a=t.slice(n,r.lastIndex-i[0].length);n=r.lastIndex,a.length>0&&e.push(a),e.push(["get",i[1]])}if(e.length===1)return t;if(n<t.length)e.push(t.slice(n));else if(e.length===2)return["to-string",e[1]];return e}function Ln(t){let e=t.key,r=t.value;return r?[new f(e,r,"constants have been deprecated as of v8")]:[]}function I(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function ye(t){if(Array.isArray(t))return t.map(ye);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){let e={};for(let r in t)e[r]=ye(t[r]);return e}return I(t)}function L(t){let e=t.key,r=t.value,n=t.valueSpec||{},i=t.objectElementValidators||{},a=t.style,o=t.styleSpec,s=t.validateSpec,l=[],u=S(r);if(u!=="object")return[new f(e,r,`object expected, ${u} found`)];for(let c in r){let p=c.split(".")[0],m=Pe(n,p)||n["*"],d;if(Pe(i,p))d=i[p];else if(Pe(n,p))d=s;else if(i["*"])d=i["*"];else if(n["*"])d=s;else{l.push(new f(e,r[c],`unknown property "${c}"`));continue}l=l.concat(d({key:(e&&`${e}.`)+c,value:r[c],valueSpec:m,style:a,styleSpec:o,object:r,objectKey:c,validateSpec:s},r))}for(let c in n)i[c]||n[c].required&&n[c].default===void 0&&r[c]===void 0&&l.push(new f(e,r,`missing required property "${c}"`));return l}function Cr(t){let e=t.value,r=t.valueSpec,n=t.validateSpec,i=t.style,a=t.styleSpec,o=t.key,s=t.arrayElementValidator||n;if(S(e)!=="array")return[new f(o,e,`array expected, ${S(e)} found`)];if(r.length&&e.length!==r.length)return[new f(o,e,`array length ${r.length} expected, length ${e.length} found`)];if(r["min-length"]&&e.length<r["min-length"])return[new f(o,e,`array length at least ${r["min-length"]} expected, length ${e.length} found`)];let l={type:r.value,values:r.values};a.$version<7&&(l.function=r.function),S(r.value)==="object"&&(l=r.value);let u=[];for(let c=0;c<e.length;c++)u=u.concat(s({array:e,arrayIndex:c,value:e[c],valueSpec:l,validateSpec:t.validateSpec,style:i,styleSpec:a,key:`${o}[${c}]`}));return u}function Ft(t){let e=t.key,r=t.value,n=t.valueSpec,i=S(r);return i==="number"&&r!==r&&(i="NaN"),i!=="number"?[new f(e,r,`number expected, ${i} found`)]:"minimum"in n&&r<n.minimum?[new f(e,r,`${r} is less than the minimum value ${n.minimum}`)]:"maximum"in n&&r>n.maximum?[new f(e,r,`${r} is greater than the maximum value ${n.maximum}`)]:[]}function Vn(t){let e=t.valueSpec,r=I(t.value.type),n,i={},a,o,s=r!=="categorical"&&t.value.property===void 0,l=!s,u=S(t.value.stops)==="array"&&S(t.value.stops[0])==="array"&&S(t.value.stops[0][0])==="object",c=L({key:t.key,value:t.value,valueSpec:t.styleSpec.function,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:p,default:g}});return r==="identity"&&s&&c.push(new f(t.key,t.value,'missing required property "property"')),r!=="identity"&&!t.value.stops&&c.push(new f(t.key,t.value,'missing required property "stops"')),r==="exponential"&&t.valueSpec.expression&&!Pr(t.valueSpec)&&c.push(new f(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!vt(t.valueSpec)?c.push(new f(t.key,t.value,"property functions not supported")):s&&!Nn(t.valueSpec)&&c.push(new f(t.key,t.value,"zoom functions not supported"))),(r==="categorical"||u)&&t.value.property===void 0&&c.push(new f(t.key,t.value,'"property" property is required')),c;function p(h){if(r==="identity")return[new f(h.key,h.value,'identity function may not have a "stops" property')];let O=[],v=h.value;return O=O.concat(Cr({key:h.key,value:v,valueSpec:h.valueSpec,validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec,arrayElementValidator:m})),S(v)==="array"&&v.length===0&&O.push(new f(h.key,v,"array must have at least one stop")),O}function m(h){let O=[],v=h.value,z=h.key;if(S(v)!=="array")return[new f(z,v,`array expected, ${S(v)} found`)];if(v.length!==2)return[new f(z,v,`array length 2 expected, length ${v.length} found`)];if(u){if(S(v[0])!=="object")return[new f(z,v,`object expected, ${S(v[0])} found`)];if(v[0].zoom===void 0)return[new f(z,v,"object stop key must have zoom")];if(v[0].value===void 0)return[new f(z,v,"object stop key must have value")];if(o&&o>I(v[0].zoom))return[new f(z,v[0].zoom,"stop zoom values must appear in ascending order")];I(v[0].zoom)!==o&&(o=I(v[0].zoom),a=void 0,i={}),O=O.concat(L({key:`${z}[0]`,value:v[0],valueSpec:{zoom:{}},validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec,objectElementValidators:{zoom:Ft,value:d}}))}else O=O.concat(d({key:`${z}[0]`,value:v[0],validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec},v));return Ct(ye(v[1]))?O.concat([new f(`${z}[1]`,v[1],"expressions are not allowed in function stops.")]):O.concat(h.validateSpec({key:`${z}[1]`,value:v[1],valueSpec:e,validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec}))}function d(h,O){let v=S(h.value),z=I(h.value),C=h.value!==null?h.value:O;if(!n)n=v;else if(v!==n)return[new f(h.key,C,`${v} stop domain type must match previous stop domain type ${n}`)];if(v!=="number"&&v!=="string"&&v!=="boolean")return[new f(h.key,C,"stop domain value must be a number, string, or boolean")];if(v!=="number"&&r!=="categorical"){let ue=`number expected, ${v} found`;return vt(e)&&r===void 0&&(ue+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new f(h.key,C,ue)]}return r==="categorical"&&v==="number"&&(!isFinite(z)||Math.floor(z)!==z)?[new f(h.key,C,`integer expected, found ${z}`)]:r!=="categorical"&&v==="number"&&a!==void 0&&z<a?[new f(h.key,C,"stop domain values must appear in ascending order")]:(a=z,r==="categorical"&&z in i?[new f(h.key,C,"stop domain values must be unique")]:(i[z]=!0,[]))}function g(h){return h.validateSpec({key:h.key,value:h.value,valueSpec:e,validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec})}}function $e(t){let e=(t.expressionContext==="property"?Rr:Nt)(ye(t.value),t.valueSpec);if(e.result==="error")return e.value.map(n=>new f(`${t.key}${n.key}`,t.value,n.message));let r=e.value.expression||e.value._styleExpression.expression;if(t.expressionContext==="property"&&t.propertyKey==="text-font"&&!r.outputDefined())return[new f(t.key,t.value,`Invalid data expression for "${t.propertyKey}". Output values must be contained as literals within the expression.`)];if(t.expressionContext==="property"&&t.propertyType==="layout"&&!Ue(r))return[new f(t.key,t.value,'"feature-state" data expressions are not supported with layout properties.')];if(t.expressionContext==="filter"&&!Ue(r))return[new f(t.key,t.value,'"feature-state" data expressions are not supported with filters.')];if(t.expressionContext&&t.expressionContext.indexOf("cluster")===0){if(!Tt(r,["zoom","feature-state"]))return[new f(t.key,t.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(t.expressionContext==="cluster-initial"&&!qt(r))return[new f(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Uo(t){let e=t.value,r=t.key,n=S(e);return n!=="boolean"?[new f(r,e,`boolean expected, ${n} found`)]:[]}function Or(t){let e=t.key,r=t.value,n=S(r);return n!=="string"?[new f(e,r,`color expected, ${n} found`)]:$.parse(String(r))?[]:[new f(e,r,`color expected, "${r}" found`)]}function Ge(t){let e=t.key,r=t.value,n=t.valueSpec,i=[];return Array.isArray(n.values)?n.values.indexOf(I(r))===-1&&i.push(new f(e,r,`expected one of [${n.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(n.values).indexOf(I(r))===-1&&i.push(new f(e,r,`expected one of [${Object.keys(n.values).join(", ")}], ${JSON.stringify(r)} found`)),i}function Nr(t){return _t(ye(t.value))?$e(ke({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Un(t)}function Un(t){let e=t.value,r=t.key;if(S(e)!=="array")return[new f(r,e,`array expected, ${S(e)} found`)];let n=t.styleSpec,i,a=[];if(e.length<1)return[new f(r,e,"filter array must have at least 1 element")];switch(a=a.concat(Ge({key:`${r}[0]`,value:e[0],valueSpec:n.filter_operator,style:t.style,styleSpec:t.styleSpec})),I(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&I(e[1])==="$type"&&a.push(new f(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&a.push(new f(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(i=S(e[1]),i!=="string"&&a.push(new f(`${r}[1]`,e[1],`string expected, ${i} found`)));for(let o=2;o<e.length;o++)i=S(e[o]),I(e[1])==="$type"?a=a.concat(Ge({key:`${r}[${o}]`,value:e[o],valueSpec:n.geometry_type,style:t.style,styleSpec:t.styleSpec})):i!=="string"&&i!=="number"&&i!=="boolean"&&a.push(new f(`${r}[${o}]`,e[o],`string, number, or boolean expected, ${i} found`));break;case"any":case"all":case"none":for(let o=1;o<e.length;o++)a=a.concat(Un({key:`${r}[${o}]`,value:e[o],style:t.style,styleSpec:t.styleSpec}));break;case"has":case"!has":i=S(e[1]),e.length!==2?a.push(new f(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):i!=="string"&&a.push(new f(`${r}[1]`,e[1],`string expected, ${i} found`));break}return a}function Bn(t,e){let r=t.key,n=t.validateSpec,i=t.style,a=t.styleSpec,o=t.value,s=t.objectKey,l=a[`${e}_${t.layerType}`];if(!l)return[];let u=s.match(/^(.*)-transition$/);if(e==="paint"&&u&&l[u[1]]&&l[u[1]].transition)return n({key:r,value:o,valueSpec:a.transition,style:i,styleSpec:a});let c=t.valueSpec||l[s];if(!c)return[new f(r,o,`unknown property "${s}"`)];let p;if(S(o)==="string"&&vt(c)&&!c.tokens&&(p=/^{([^}]+)}$/.exec(o)))return[new f(r,o,`"${s}" does not support interpolation syntax
2
- Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(p[1])} }\`.`)];let m=[];return t.layerType==="symbol"&&(s==="text-field"&&i&&!i.glyphs&&m.push(new f(r,o,'use of "text-field" requires a style "glyphs" property')),s==="text-font"&&jt(ye(o))&&I(o.type)==="identity"&&m.push(new f(r,o,'"text-font" does not support identity functions'))),m.concat(n({key:t.key,value:o,valueSpec:c,style:i,styleSpec:a,expressionContext:"property",propertyType:e,propertyKey:s}))}function Jn(t){return Bn(t,"paint")}function Hn(t){return Bn(t,"layout")}function Gn(t){let e=[],r=t.value,n=t.key,i=t.style,a=t.styleSpec;if(S(r)!=="object")return[new f(n,r,`object expected, ${S(r)} found`)];!r.type&&!r.ref&&e.push(new f(n,r,'either "type" or "ref" is required'));let o=I(r.type),s=I(r.ref);if(r.id){let l=I(r.id);for(let u=0;u<t.arrayIndex;u++){let c=i.layers[u];I(c.id)===l&&e.push(new f(n,r.id,`duplicate layer id "${r.id}", previously used at line ${c.id.__line__}`))}}if("ref"in r){["type","source","source-layer","filter","layout"].forEach(u=>{u in r&&e.push(new f(n,r[u],`"${u}" is prohibited for ref layers`))});let l;i.layers.forEach(u=>{I(u.id)===s&&(l=u)}),l?l.ref?e.push(new f(n,r.ref,"ref cannot reference another ref layer")):o=I(l.type):e.push(new f(n,r.ref,`ref layer "${s}" not found`))}else if(o!=="background")if(!r.source)e.push(new f(n,r,'missing required property "source"'));else{let l=i.sources&&i.sources[r.source],u=l&&I(l.type);l?u==="vector"&&o==="raster"?e.push(new f(n,r.source,`layer "${r.id}" requires a raster source`)):u!=="raster-dem"&&o==="hillshade"?e.push(new f(n,r.source,`layer "${r.id}" requires a raster-dem source`)):u!=="raster-dem"&&o==="color-relief"?e.push(new f(n,r.source,`layer "${r.id}" requires a raster-dem source`)):u==="raster"&&o!=="raster"?e.push(new f(n,r.source,`layer "${r.id}" requires a vector source`)):u==="vector"&&!r["source-layer"]?e.push(new f(n,r,`layer "${r.id}" must specify a "source-layer"`)):u==="raster-dem"&&o!=="hillshade"&&o!=="color-relief"?e.push(new f(n,r.source,"raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.")):o==="line"&&r.paint&&r.paint["line-gradient"]&&(u!=="geojson"||!l.lineMetrics)&&e.push(new f(n,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new f(n,r.source,`source "${r.source}" not found`))}return e=e.concat(L({key:n,value:r,valueSpec:a.layer,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*"(){return[]},type(){return t.validateSpec({key:`${n}.type`,value:r.type,valueSpec:a.layer.type,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,object:r,objectKey:"type"})},filter:Nr,layout(l){return L({layer:r,key:l.key,value:l.value,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*"(u){return Hn(ke({layerType:o},u))}}})},paint(l){return L({layer:r,key:l.key,value:l.value,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*"(u){return Jn(ke({layerType:o},u))}}})}}})),e}function me(t){let e=t.value,r=t.key,n=S(e);return n!=="string"?[new f(r,e,`string expected, ${n} found`)]:[]}function Bo(t){var e;let r=(e=t.sourceName)!==null&&e!==void 0?e:"",n=t.value,i=t.styleSpec,a=i.source_raster_dem,o=t.style,s=[],l=S(n);if(n===void 0)return s;if(l!=="object")return s.push(new f("source_raster_dem",n,`object expected, ${l} found`)),s;let c=I(n.encoding)==="custom",p=["redFactor","greenFactor","blueFactor","baseShift"],m=t.value.encoding?`"${t.value.encoding}"`:"Default";for(let d in n)!c&&p.includes(d)?s.push(new f(d,n[d],`In "${r}": "${d}" is only valid when "encoding" is set to "custom". ${m} encoding found`)):a[d]?s=s.concat(t.validateSpec({key:d,value:n[d],valueSpec:a[d],validateSpec:t.validateSpec,style:o,styleSpec:i})):s.push(new f(d,n[d],`unknown property "${d}"`));return s}var bn={promoteId:Jo};function Wn(t){let e=t.value,r=t.key,n=t.styleSpec,i=t.style,a=t.validateSpec;if(!e.type)return[new f(r,e,'"type" is required')];let o=I(e.type),s;switch(o){case"vector":case"raster":return s=L({key:r,value:e,valueSpec:n[`source_${o.replace("-","_")}`],style:t.style,styleSpec:n,objectElementValidators:bn,validateSpec:a}),s;case"raster-dem":return s=Bo({sourceName:r,value:e,style:t.style,styleSpec:n,validateSpec:a}),s;case"geojson":if(s=L({key:r,value:e,valueSpec:n.source_geojson,style:i,styleSpec:n,validateSpec:a,objectElementValidators:bn}),e.cluster)for(let l in e.clusterProperties){let[u,c]=e.clusterProperties[l],p=typeof u=="string"?[u,["accumulated"],["get",l]]:u;s.push(...$e({key:`${r}.${l}.map`,value:c,expressionContext:"cluster-map"})),s.push(...$e({key:`${r}.${l}.reduce`,value:p,expressionContext:"cluster-reduce"}))}return s;case"video":return L({key:r,value:e,valueSpec:n.source_video,style:i,validateSpec:a,styleSpec:n});case"image":return L({key:r,value:e,valueSpec:n.source_image,style:i,validateSpec:a,styleSpec:n});case"canvas":return[new f(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Ge({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function Jo({key:t,value:e}){if(S(e)==="string")return me({key:t,value:e});{let r=[];for(let n in e)r.push(...me({key:`${t}.${n}`,value:e[n]}));return r}}function Kn(t){let e=t.value,r=t.styleSpec,n=r.light,i=t.style,a=[],o=S(e);if(e===void 0)return a;if(o!=="object")return a=a.concat([new f("light",e,`object expected, ${o} found`)]),a;for(let s in e){let l=s.match(/^(.*)-transition$/);l&&n[l[1]]&&n[l[1]].transition?a=a.concat(t.validateSpec({key:s,value:e[s],valueSpec:r.transition,validateSpec:t.validateSpec,style:i,styleSpec:r})):n[s]?a=a.concat(t.validateSpec({key:s,value:e[s],valueSpec:n[s],validateSpec:t.validateSpec,style:i,styleSpec:r})):a=a.concat([new f(s,e[s],`unknown property "${s}"`)])}return a}function Zn(t){let e=t.value,r=t.styleSpec,n=r.sky,i=t.style,a=S(e);if(e===void 0)return[];if(a!=="object")return[new f("sky",e,`object expected, ${a} found`)];let o=[];for(let s in e)n[s]?o=o.concat(t.validateSpec({key:s,value:e[s],valueSpec:n[s],style:i,styleSpec:r})):o=o.concat([new f(s,e[s],`unknown property "${s}"`)]);return o}function Xn(t){let e=t.value,r=t.styleSpec,n=r.terrain,i=t.style,a=[],o=S(e);if(e===void 0)return a;if(o!=="object")return a=a.concat([new f("terrain",e,`object expected, ${o} found`)]),a;for(let s in e)n[s]?a=a.concat(t.validateSpec({key:s,value:e[s],valueSpec:n[s],validateSpec:t.validateSpec,style:i,styleSpec:r})):a=a.concat([new f(s,e[s],`unknown property "${s}"`)]);return a}function Ho(t){return me(t).length===0?[]:$e(t)}function Go(t){return me(t).length===0?[]:$e(t)}function Wo(t){let e=t.key,r=t.value;if(S(r)==="array"){if(r.length<1||r.length>4)return[new f(e,r,`padding requires 1 to 4 values; ${r.length} values found`)];let i={type:"number"},a=[];for(let o=0;o<r.length;o++)a=a.concat(t.validateSpec({key:`${e}[${o}]`,value:r[o],validateSpec:t.validateSpec,valueSpec:i}));return a}else return Ft({key:e,value:r,valueSpec:{}})}function Ko(t){let e=t.key,r=t.value;if(S(r)==="array"){let i={type:"number"};if(r.length<1)return[new f(e,r,"array length at least 1 expected, length 0 found")];let a=[];for(let o=0;o<r.length;o++)a=a.concat(t.validateSpec({key:`${e}[${o}]`,value:r[o],validateSpec:t.validateSpec,valueSpec:i}));return a}else return Ft({key:e,value:r,valueSpec:{}})}function Zo(t){let e=t.key,r=t.value;if(S(r)==="array"){if(r.length<1)return[new f(e,r,"array length at least 1 expected, length 0 found")];let i=[];for(let a=0;a<r.length;a++)i=i.concat(Or({key:`${e}[${a}]`,value:r[a]}));return i}else return Or({key:e,value:r})}function Xo(t){let e=t.key,r=t.value,n=S(r),i=t.styleSpec;if(n!=="array"||r.length<1||r.length%2!==0)return[new f(e,r,"variableAnchorOffsetCollection requires a non-empty array of even length")];let a=[];for(let o=0;o<r.length;o+=2)a=a.concat(Ge({key:`${e}[${o}]`,value:r[o],valueSpec:i.layout_symbol["text-anchor"]})),a=a.concat(Cr({key:`${e}[${o+1}]`,value:r[o+1],valueSpec:{length:2,value:"number"},validateSpec:t.validateSpec,style:t.style,styleSpec:i}));return a}function Yn(t){let e=[],r=t.value,n=t.key;if(Array.isArray(r)){let i=[],a=[];for(let o in r){r[o].id&&i.includes(r[o].id)&&e.push(new f(n,r,`all the sprites' ids must be unique, but ${r[o].id} is duplicated`)),i.push(r[o].id),r[o].url&&a.includes(r[o].url)&&e.push(new f(n,r,`all the sprites' URLs must be unique, but ${r[o].url} is duplicated`)),a.push(r[o].url);let s={id:{type:"string",required:!0},url:{type:"string",required:!0}};e=e.concat(L({key:`${n}[${o}]`,value:r[o],valueSpec:s,validateSpec:t.validateSpec}))}return e}else return me({key:n,value:r})}function Yo(t){let e=t.value,r=t.styleSpec,n=r.projection,i=t.style,a=S(e);if(e===void 0)return[];if(a!=="object")return[new f("projection",e,`object expected, ${a} found`)];let o=[];for(let s in e)n[s]?o=o.concat(t.validateSpec({key:s,value:e[s],valueSpec:n[s],style:i,styleSpec:r})):o=o.concat([new f(s,e[s],`unknown property "${s}"`)]);return o}function Qo(t){let e=t.key,r=t.value;r=r instanceof String?r.valueOf():r;let n=S(r);return n==="array"&&!ts(r)&&!es(r)?[new f(e,r,`projection expected, invalid array ${JSON.stringify(r)} found`)]:["array","string"].includes(n)?[]:[new f(e,r,`projection expected, invalid type "${n}" found`)]}function es(t){return!!["interpolate","step","literal"].includes(t[0])}function ts(t){return Array.isArray(t)&&t.length===3&&typeof t[0]=="string"&&typeof t[1]=="string"&&typeof t[2]=="number"}function rs(t){return!!t&&t.constructor===Object}function Qn(t){return rs(t.value)?[]:[new f(t.key,t.value,`object expected, ${S(t.value)} found`)]}var wn={"*"(){return[]},array:Cr,boolean:Uo,number:Ft,color:Or,constants:Ln,enum:Ge,filter:Nr,function:Vn,layer:Gn,object:L,source:Wn,light:Kn,sky:Zn,terrain:Xn,projection:Yo,projectionDefinition:Qo,string:me,formatted:Ho,resolvedImage:Go,padding:Wo,numberArray:Ko,colorArray:Zo,variableAnchorOffsetCollection:Xo,sprite:Yn,state:Qn};function kt(t){let e=t.value,r=t.valueSpec,n=t.styleSpec;return t.validateSpec=kt,r.expression&&jt(I(e))?Vn(t):r.expression&&Ct(ye(e))?$e(t):r.type&&wn[r.type]?wn[r.type](t):L(ke({},t,{valueSpec:r.type?n[r.type]:r}))}function ei(t){let e=t.value,r=t.key,n=me(t);return n.length||(e.indexOf("{fontstack}")===-1&&n.push(new f(r,e,'"glyphs" url must include a "{fontstack}" token')),e.indexOf("{range}")===-1&&n.push(new f(r,e,'"glyphs" url must include a "{range}" token'))),n}function _(t,e=St){let r=[];return r=r.concat(kt({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,validateSpec:kt,objectElementValidators:{glyphs:ei,"*"(){return[]}}})),t.constants&&(r=r.concat(Ln({key:"constants",value:t.constants}))),ti(r)}_.source=G(H(Wn));_.sprite=G(H(Yn));_.glyphs=G(H(ei));_.light=G(H(Kn));_.sky=G(H(Zn));_.terrain=G(H(Xn));_.state=G(H(Qn));_.layer=G(H(Gn));_.filter=G(H(Nr));_.paintProperty=G(H(Jn));_.layoutProperty=G(H(Hn));function H(t){return function(e){return t(q(x({},e),{validateSpec:kt}))}}function ti(t){return[].concat(t).sort((e,r)=>e.line-r.line)}function G(t){return function(...e){return ti(t.apply(this,e))}}var Bs=St,Js={StyleExpression:bt,StylePropertyFunction:wt,ZoomConstantExpression:Be,ZoomDependentExpression:Je,createExpression:Nt,createPropertyExpression:Rr,isExpression:Ct,isExpressionFilter:_t,isZoomExpression:Po,normalizePropertyExpression:Ro};function ri(t,e){if(typeof t!="string"||t.length===0)return null;let r=n=>{try{return new URL(n.replace(/\{[a-z]+\}/g,"0"))}catch(i){return null}};if(t.startsWith("/")&&!t.startsWith("//")){let n=r(e)?.origin;if(!n||n==="null")return null;let i=`${n}${t}`;return r(i)?.origin===n?{url:i,credentials:"include"}:null}return/^https:\/\//i.test(t)&&r(t)?.protocol==="https:"?{url:t,credentials:"omit"}:null}function Ks(t,e,r,n){return t.replace(/\{z\}/g,String(e)).replace(/\{x\}/g,String(r)).replace(/\{y\}/g,String(n))}var Y=t=>!!t&&typeof t=="object"&&!Array.isArray(t);function Zs(t){if(!Y(t)||t.version!==8)return null;let e=t.sources,r=t.layers;if(!Y(e)||!Array.isArray(r)||!Object.values(e).every(Y))return null;let n=new Set;for(let a of r){if(!Y(a)||typeof a.id!="string"||n.has(a.id))return null;n.add(a.id)}let i=Y(t.state)?t.state:void 0;return structuredClone(q(x({version:8},i?{state:i}:{}),{sources:e,layers:r}))}function ni(t,e){let r={};for(let[n,i]of Object.entries(t.state??{}))r[n]=Y(i)?i.default??null:null;return x(x({},r),e)}function Xe(t,e){if(Array.isArray(t)){if(t[0]==="literal")return t;if(t[0]==="global-state"&&typeof t[1]=="string"){let r=t[1];return["get",r,["literal",{[r]:e[r]??null}]]}return t.map(r=>Xe(r,e))}return Y(t)?Object.fromEntries(Object.entries(t).map(([r,n])=>[r,Xe(n,e)])):t}function Xs(t,e){let r=x({},t);return t.paint&&(r.paint=Xe(t.paint,e)),t.layout&&(r.layout=Xe(t.layout,e)),t.filter!==void 0&&(r.filter=Xe(t.filter,e)),r}var ns={r:256,g:1,b:1/256,base:32768},is={r:6553.6,g:25.6,b:.1,base:1e4},he=(t,e)=>typeof t=="number"&&Number.isFinite(t)?t:e;function as(t){return Array.isArray(t)&&t.length===4&&t.every(e=>typeof e=="number"&&Number.isFinite(e))?t:void 0}function os(t,e){if(t.url!==void 0&&t.tiles===void 0)return"a TileJSON url is not supported; list the tiles";if(t.scheme==="tms")return'scheme "tms" is not supported';let r=t.tiles;if(!Array.isArray(r)||r.length===0)return"no tiles";let n=r.map(o=>typeof o=="string"?/\{(?![zxy]\})[^}]*\}/.exec(o):null).find(o=>o);if(n)return`tile placeholder ${n[0]} is not supported`;let i=r.map(o=>ri(o,e));if(i.some(o=>o===null))return"a tile URL is neither server-relative nor https";let a=i;return a.some(o=>o.credentials!==a[0].credentials)?"tile URLs mix the server and other hosts":{tiles:a.map(o=>o.url),credentials:a[0].credentials}}function ss(t,e){if(!Y(t))return{error:"not a source"};let r=t.type;if(r==="raster-dem"||r==="raster"||r==="vector"){let n=os(t,e);if(typeof n=="string")return{error:n};let i={minzoom:he(t.minzoom,0),maxzoom:he(t.maxzoom,22),bounds:as(t.bounds)};if(r==="vector")return t.encoding!==void 0&&t.encoding!=="mvt"?{error:`encoding "${String(t.encoding)}"`}:x(x({type:r},n),i);let a=he(t.tileSize,512);if(r==="raster")return x(q(x({type:r},n),{tileSize:a}),i);let o=t.encoding??"mapbox",s;if(o==="terrarium")s=ns;else if(o==="mapbox")s=is;else if(o==="custom")s={r:he(t.redFactor,1),g:he(t.greenFactor,1),b:he(t.blueFactor,1),base:he(t.baseShift,0)};else return{error:`encoding "${String(o)}"`};return q(x(q(x({type:r},n),{tileSize:a}),i),{encoding:s})}if(r==="geojson"){if(t.cluster===!0)return{error:"clustering"};if(t.filter!==void 0)return{error:"a source filter"};let n=t.data;if(typeof n=="string"){let i=ri(n,e);return i?{type:r,url:i}:{error:"the data URL is neither server-relative nor https"}}return Y(n)?{type:r,data:n}:{error:"no data"}}return{error:`source type "${String(r)}"`}}function ii(t,e){return Object.fromEntries(Object.entries(t.sources).map(([r,n])=>[r,ss(n,e)]))}var ls={"color-relief":["raster-dem"],raster:["raster"],fill:["vector","geojson"],line:["vector","geojson"],circle:["vector","geojson"],symbol:["vector","geojson"]},us={"color-relief":{paint:["color-relief-color","color-relief-opacity","resampling"],layout:[]},raster:{paint:["raster-opacity","raster-resampling","raster-fade-duration"],layout:[]},fill:{paint:["fill-color","fill-opacity","fill-outline-color"],layout:[]},line:{paint:["line-color","line-width","line-opacity","line-dasharray"],layout:["line-cap","line-join","line-miter-limit"]},circle:{paint:["circle-color","circle-radius","circle-opacity","circle-stroke-color","circle-stroke-width","circle-stroke-opacity","circle-translate"],layout:[]},symbol:{paint:["text-color","text-halo-color","text-halo-width","text-opacity","text-translate"],layout:["symbol-placement","symbol-spacing","text-field","text-font","text-size","text-anchor","text-justify","text-max-width","text-letter-spacing","text-line-height","text-offset","text-rotate","text-rotation-alignment","text-padding","text-transform","text-keep-upright","text-max-angle","text-allow-overlap","text-ignore-placement","text-optional","text-pitch-alignment","icon-pitch-alignment"]}},cs=new Set(["image","within","distance"]);function Dr(t){if(Array.isArray(t)){if(t[0]==="literal")return null;if(typeof t[0]=="string"&&cs.has(t[0]))return t[0];for(let e of t){let r=Dr(e);if(r)return r}}else if(Y(t))for(let e of Object.values(t)){let r=Dr(e);if(r)return r}return null}function ps(t){if(typeof t!="string")return null;let e=$.parse(t);if(!e)return null;let r=n=>e.a>0?Math.round(n/e.a*255):0;return[r(e.r),r(e.g),r(e.b),e.a]}function fs(t){if(t===void 0)return"color-relief-color is required";if(!Array.isArray(t)||t[0]!=="interpolate"||JSON.stringify(t[1])!=='["linear"]'||JSON.stringify(t[2])!=='["elevation"]')return'color-relief-color must be ["interpolate", ["linear"], ["elevation"], \u2026]';let e=t.slice(3);if(e.length<2||e.length%2!==0)return"color-relief-color needs stop/colour pairs";let r=[],n=[];for(let i=0;i<e.length;i+=2){let a=e[i],o=ps(e[i+1]);if(typeof a!="number"||!Number.isFinite(a))return"color-relief-color stops must be literal numbers";if(r.length&&a<=r[r.length-1])return"color-relief-color stops must ascend";if(!o)return"color-relief-color colours must be literal colours";r.push(a),n.push(o)}return{stops:r,colors:n}}var te=(t,e)=>({drawable:!1,reason:t,detail:e}),ds="https://glyphs.invalid/{fontstack}/{range}.pbf";function _r(t,e,r){let n=ls[e.type];if(!n)return te("layerType",e.type);let i=typeof e.source=="string"?r[e.source]:void 0;if(!i)return te("source",`no source "${String(e.source)}"`);if("error"in i)return te("source",i.error);if(!n.includes(i.type))return te("source",`${e.type} cannot draw a ${i.type} source`);let a=x({},e.paint??{});if(e.type==="color-relief"&&"resampling"in a){if(a.resampling!=="linear"&&a.resampling!=="nearest")return te("property",'resampling must be "linear" or "nearest"');delete a.resampling}let o=_(q(x({version:8,glyphs:ds},t.state?{state:t.state}:{}),{sources:{[e.source]:t.sources[e.source]},layers:[q(x({},e),{paint:a})]})).filter(u=>u.message.startsWith("layers["));if(o.length)return te("property",o[0].message.replace(/^layers\[0\]\./,""));let s=us[e.type];for(let u of["paint","layout"]){let c=e[u]??{},p=St[`${u}_${e.type}`];for(let[m,d]of Object.entries(c))if(!(m==="visibility"||s[u].includes(m))&&JSON.stringify(d)!==JSON.stringify(p?.[m]?.default))return te("property",m)}let l=Dr([e.paint,e.layout,e.filter]);if(l)return te("property",`the "${l}" expression`);if(e.type==="color-relief"){let u=fs(e.paint?.["color-relief-color"]);if(typeof u=="string")return te("property",u)}return{drawable:!0}}var R=class extends Error{constructor(r,n){super(n);this.reason=r}reason},ys=(t,e)=>P(null,null,function*(){let r=yield fetch(t.url,{credentials:t.credentials,cache:e?"reload":"default"});if(!r.ok)throw new Error(`HTTP ${r.status} for ${t.url}`);return r.json()}),ms=new Set(["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon","GeometryCollection"]),Lt=t=>!!t&&typeof t=="object"&&!Array.isArray(t),oi=t=>Lt(t)&&t.type==="Feature";function Fr(t){return Lt(t)?t.type==="FeatureCollection"&&Array.isArray(t.features)?t.features.filter(oi):t.type==="Feature"?[t]:typeof t.type=="string"&&ms.has(t.type)?[{type:"Feature",geometry:t,properties:{}}]:null:null}var Lr=t=>typeof t=="string"||typeof t=="number"&&Number.isFinite(t),re=t=>structuredClone(t),Vr=(t,e,r)=>`${t}/${e}/${r}`,ai=class{constructor(e,r,n=ys){this.style=e;this.load=n;this.sources=ii(e,r);for(let i of e.layers)this.declared.set(i.id,i),this.current.set(i.id,re(i)),this.verdicts.set(i.id,_r(e,i,this.sources));for(let[i,a]of Object.entries(this.sources))"error"in a||a.type!=="geojson"||this.geojson.set(i,{url:a.url,features:a.url?null:this.index(Fr(a.data)??[]),generation:0,pending:[],reload:!1})}style;load;sources;declared=new Map;current=new Map;verdicts=new Map;state={};geojson=new Map;freshness=new Map;listeners=new Set;layers(){return[...this.current.values()]}layer(e){return this.current.get(e)}isDrawn(e){return this.verdicts.get(e)?.drawable===!0}skippedLayers(){let e=[];for(let[r,n]of this.verdicts)!n.drawable&&n.reason&&e.push(x({id:r,reason:n.reason},n.detail?{detail:n.detail}:{}));return e}globalState(){return ni(this.style,this.state)}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}emit(e){for(let r of[...this.listeners])r(e)}source(e){let r=typeof e=="string"?this.sources[e]:void 0;if(!r)throw new R("overlays.badRequest",`The overlay's style has no source "${String(e)}"`);return r}setLayer(e){let r=e.layer,n=typeof r=="string"?this.declared.get(r):void 0;if(!n)throw new R("overlays.badRequest",`The overlay's style has no layer "${String(r)}"`);for(let o of["paint","layout"])if(e[o]!==void 0&&!Lt(e[o]))throw new R("overlays.badRequest",`\`${o}\` must be an object of properties`);if("filter"in e&&e.filter!==null&&!Array.isArray(e.filter))throw new R("overlays.badRequest","`filter` must be an array or null");let i=re(this.current.get(n.id));for(let o of["paint","layout"]){let s=e[o];if(!s)continue;let l=x({},i[o]??{});for(let[u,c]of Object.entries(s))c!==null?l[u]=re(c):n[o]&&u in n[o]?l[u]=re(n[o][u]):delete l[u];i[o]=l}"filter"in e&&(e.filter===null?delete i.filter:i.filter=re(e.filter));let a=_r(this.style,i,this.sources);if(!a.drawable)throw new R("overlays.unsupported",`Layer "${n.id}" would not be drawn: ${a.reason}`+(a.detail?` (${a.detail})`:""));this.current.set(n.id,i),this.verdicts.set(n.id,a),this.emit({kind:"layers",layers:[n.id]})}setState(e){if(!Lt(e))throw new R("overlays.badRequest","`values` must be an object of variable values");let r=x({},this.state);for(let[n,i]of Object.entries(e))i===null?delete r[n]:r[n]=re(i);this.state=r,this.emit({kind:"state"})}geojsonSource(e){let r=this.source(e),n=this.geojson.get(e);if(!n)throw new R("overlays.badRequest",`Source "${String(e)}" is not a usable geojson source`+("error"in r?` (${r.error})`:""));return n}index(e){let r=new Map;for(let n of e)r.set(Lr(n.id)?n.id:Symbol(),n);return r}setData(e){let r=this.geojsonSource(e.source),n=e.source,i=e.data!==void 0,a=e.upsert!==void 0||e.remove!==void 0;if(i===a)throw new R("overlays.badRequest",i?"`data` cannot be combined with `upsert` or `remove`":"Give `data`, or `upsert` and/or `remove`");if(i){let u=Fr(e.data);if(!u)throw new R("overlays.badRequest","`data` must be a GeoJSON object");let c=re(u);r.url=void 0,r.generation++,r.loading=void 0,r.pending=[],r.features=this.index(c),this.emit({kind:"data",source:n,replace:c});return}let o=e.upsert??[],s=e.remove??[];if(!Array.isArray(o)||!o.every(u=>oi(u)&&Lr(u.id)))throw new R("overlays.badRequest","`upsert` must be a list of GeoJSON features, each with an `id`");if(!Array.isArray(s)||!s.every(Lr))throw new R("overlays.badRequest","`remove` must be a list of feature ids");let l={upsert:re(o),remove:s};(r.loading||!r.features)&&r.pending.push(l),r.features&&(this.applyDiff(r.features,l),this.emit(x({kind:"data",source:n},l)))}applyDiff(e,r){for(let n of r.remove??[])e.delete(n);for(let n of r.upsert??[])e.set(n.id,n)}features(e){return P(this,null,function*(){let r=this.geojson.get(e);return r?r.features?[...r.features.values()]:this.loadUrl(e,r):[]})}loadUrl(e,r){if(r.loading)return r.loading;let n=r.url,i=r.generation,a=r.reload;r.reload=!1;let o=this.load(n,a).then(s=>Fr(s)??[]).catch(s=>(console.warn(`[plotterext] could not load ${n.url}:`,s),null)).then(s=>{if(r.generation!==i)return this.features(e);r.loading=void 0;let l=s===null&&r.features?new Map(r.features):this.index(s??[]);for(let p of r.pending)this.applyDiff(l,p);r.pending=[];let u=!r.features;r.features=l;let c=[...l.values()];return u||this.emit({kind:"data",source:e,replace:c}),c});return r.loading=o,o}refresh(e){let r=this.source(e.source),n=e.source;if("error"in r)throw new R("overlays.badRequest",`Source "${n}" is not drawn (${r.error})`);let i=e.tiles;if(r.type==="geojson"){if(i!==void 0)throw new R("overlays.badRequest","`tiles` applies to tiled sources only");let o=this.geojson.get(n);if(!o.url)return;o.generation++,o.loading=void 0,o.reload=!0,o.features&&this.loadUrl(n,o);return}if(i!==void 0&&!this.validTiles(i))throw new R("overlays.badRequest","`tiles` must be a list of [z, x, y] tiles that exist at zoom z");let a=this.tileFreshness(n);if(i===void 0)a.all=!0,a.dirty.clear(),a.loadedSinceAll.clear();else for(let[o,s,l]of i){let u=Vr(o,s,l);a.dirty.add(u),a.loadedSinceAll.delete(u)}this.emit(x({kind:"refresh",source:n},i!==void 0?{tiles:re(i)}:{}))}validTiles(e){return Array.isArray(e)&&e.every(r=>{if(!Array.isArray(r)||r.length!==3||!r.every(o=>Number.isInteger(o)&&o>=0))return!1;let[n,i,a]=r;return n<=30&&i<2**n&&a<2**n})}tileFreshness(e){let r=this.freshness.get(e);return r||(r={dirty:new Set,all:!1,loadedSinceAll:new Set},this.freshness.set(e,r)),r}needsReload(e,r,n,i){let a=this.freshness.get(e);if(!a)return!1;let o=Vr(r,n,i);return a.dirty.has(o)||a.all&&!a.loadedSinceAll.has(o)}markLoaded(e,r,n,i){let a=this.freshness.get(e);if(!a)return;let o=Vr(r,n,i);a.dirty.delete(o),a.all&&a.loadedSinceAll.add(o)}};function Ye(t,e,r){return P(this,null,function*(){let{Check:n,Errors:i}=yield import("./chunk-CKZDFNLJ.js");if(n(t,e))return e;let[a]=i(t,e),o=a.keyword==="required"?`${a.instancePath}/${a.params.requiredProperties[0]} is required`:`${a.instancePath||"params"} ${a.message}`;throw new j(o,{code:T.INVALID_PARAMS,reason:r})})}var Ut=()=>import("./chunk-UIEE3YOF.js"),Ee="overlays.badRequest",hs=t=>new j(t,{code:T.INVALID_PARAMS,reason:Ee});function gs(t){return t instanceof W||t instanceof R?t.reason===Ee?hs(t.message):new j(t.message,{reason:t.reason}):t}function vs(t){if(typeof ImageBitmap<"u")return t instanceof ImageBitmap;let e=t;return!!e&&typeof e=="object"&&Number.isInteger(e.width)&&Number.isInteger(e.height)&&typeof e.close=="function"}function bs(t){return P(this,null,function*(){try{let{overlayId:e,requestId:r,extent:n,image:i}=yield Ye((yield Ut()).FrameParams,t,Ee);return{overlayId:e,requestId:r,extent:n,image:i}}catch(e){let r=t?.image;throw vs(r)&&r.close(),e}})}function Vt(t){return P(this,null,function*(){return Ye((yield Ut()).DataParams,t,Ee)})}function pl(t,e,r){let n=i=>a=>P(null,null,function*(){try{return yield i(a)}catch(o){throw gs(o)}});return{"overlay.list":n(()=>({overlays:t.list(e)})),"overlay.setVisibility":n(i=>P(null,null,function*(){let{ids:a,visible:o}=yield Ye((yield Ut()).SetVisibilityParams,i,Ee);return t.requireOwn(e,a),t.setVisibility(a.map(s=>ge(e,s)),o),{}})),"overlay.setOpacity":n(i=>P(null,null,function*(){let{ids:a,opacity:o}=yield Ye((yield Ut()).SetOpacityParams,i,Ee);return t.requireOwn(e,a),t.setOpacity(a.map(s=>ge(e,s)),o),{}})),"overlay.frame":n(i=>P(null,null,function*(){return t.acceptFrame(e,r,yield bs(i))})),"overlay.refresh":n(i=>P(null,null,function*(){let a=yield Vt(i);return t.dataModel(e,a.overlayId).refresh({source:a.source,tiles:a.tiles}),{}})),"overlay.setData":n(i=>P(null,null,function*(){let a=yield Vt(i);return t.dataModel(e,a.overlayId).setData({source:a.source,data:a.data,upsert:a.upsert,remove:a.remove}),{}})),"overlay.setLayer":n(i=>P(null,null,function*(){let a=yield Vt(i);return t.dataModel(e,a.overlayId).setLayer(x({layer:a.layer,paint:a.paint,layout:a.layout},"filter"in a?{filter:a.filter}:{})),{}})),"overlay.setState":n(i=>P(null,null,function*(){let a=yield Vt(i);return t.dataModel(e,a.overlayId).setState(a.values),{}}))}}export{T as a,j as b,Qe as c,si as d,yi as e,hi as f,gi as g,Ye as h,ge as i,Yr as j,St as k,Ls as l,$ as m,Mr as n,le as o,jt as p,Ct as q,Rr as r,Vs as s,Us as t,Bs as u,Js as v,ri as w,Ks as x,Zs as y,Xs as z,fs as A,ys as B,ai as C,vs as D,pl as E};
1
+ import{T as Br,la as Bt,wc as Jt}from"./chunk-R6ABX6RX.js";import{a as x,b as q,g as P}from"./chunk-BZGM3F3K.js";var Ht="plotterExt/1",T={PARSE_ERROR:-32700,INVALID_REQUEST:-32600,METHOD_NOT_FOUND:-32601,INVALID_PARAMS:-32602,INTERNAL_ERROR:-32603,HOST_ERROR:-32e3,TIMEOUT:-32001,CONNECTION_CLOSED:-32002},j=class Ie extends Error{code;data;constructor(e,r={}){super(e),this.name="RpcError",this.code=r.code??T.HOST_ERROR;let n=x({},r.data??{});r.reason!==void 0&&(n.reason=r.reason),this.data=Object.keys(n).length>0?n:void 0}get reason(){return typeof this.data?.reason=="string"?this.data.reason:void 0}toErrorObject(){return x({code:this.code,message:this.message},this.data?{data:this.data}:{})}static fromErrorObject(e){return new Ie(e.message,{code:e.code,data:e.data})}static from(e){return e instanceof Ie?e:e instanceof Error?new Ie(e.message,{code:T.INTERNAL_ERROR}):new Ie(String(e),{code:T.INTERNAL_ERROR})}},Gt="bus.ready",Wt="bus.handshake";function Hr(t,e){return t===e?!0:Gr(t.split("."),0,e.split("."),0)}function Gr(t,e,r,n){for(;e<t.length;){let i=t[e];if(i==="**"){if(e===t.length-1)return!0;for(let a=n;a<=r.length;a++)if(Gr(t,e+1,r,a))return!0;return!1}if(n>=r.length||i!=="*"&&i!==r[n])return!1;e++,n++}return n===r.length}function Qe(t,e){for(let r of t)if(Hr(r,e))return!0;return!1}function Jr(t){return t>=-180&&t<=180?t:((t+180)%360+360)%360-180}function Wr(t){let[e,,r]=t;return r>=e?r-e:r-e+360}function si(t){if(!Array.isArray(t)||t.length!==4||!t.every(l=>typeof l=="number"&&Number.isFinite(l)))return;let[e,r,n,i]=t;if(r<-90||i>90||r>i)return;let a=Jr(e),o=Jr(n);return(e<=n?n-e:Wr([a,r,o,i]))>=360?[-180,r,180,i]:[a,r,o,i]}function li(t){return{bus:Ht,msg:t}}function ui(t){if(typeof t!="object"||t===null)return null;let e=t;return e.bus!==Ht?null:ci(e.msg)?e.msg:null}function ci(t){if(typeof t!="object"||t===null)return!1;let e=t;if(e.jsonrpc!=="2.0")return!1;if(typeof e.method=="string")return e.id===void 0||typeof e.id=="string"||typeof e.id=="number";if(!(typeof e.id=="string"||typeof e.id=="number"||e.id===null))return!1;let n="result"in e,i=e.error,a=typeof i=="object"&&i!==null&&typeof i.code=="number"&&typeof i.message=="string";return n?!("error"in e):a}function pi(t){return"method"in t&&"id"in t&&t.id!==void 0}function fi(t){return"method"in t&&(!("id"in t)||t.id===void 0)}function di(t){return!("method"in t)}function yi(t,e={}){let r=e.listenWindow??globalThis,n=e.origin??r.location?.origin??"*";return{post(i,a){a?.length?t.postMessage(i,{targetOrigin:n,transfer:a}):t.postMessage(i,n)},listen(i){let a=o=>{o.source===t&&(n!=="*"&&o.origin!==n||i(o.data))};return r.addEventListener("message",a),()=>r.removeEventListener("message",a)}}}var mi=1e4,Kt=class{callTimeoutMs;port;unlisten;onError;pending=new Map;methods=new Map;eventHandlers=new Set;idPrefix=Math.random().toString(36).slice(2,8);seq=0;closed=!1;constructor(t){this.port=t.port,this.callTimeoutMs=t.callTimeoutMs??mi,this.onError=t.onError??(e=>console.warn("[plotterext-bus]",e)),this.unlisten=this.port.listen(e=>this.onData(e))}registerMethod(t,e){this.methods.set(t,e)}unregisterMethod(t){this.methods.delete(t)}onEvent(t,e){let r={patterns:t,fn:e};return this.eventHandlers.add(r),()=>this.eventHandlers.delete(r)}notify(t,e,r={}){this.send(x({jsonrpc:"2.0",method:t},e!==void 0?{params:e}:{}),r.transfer)}call(t,e,r={}){if(this.closed)return Promise.reject(new j("Bus endpoint is closed",{code:T.CONNECTION_CLOSED,reason:"CLOSED"}));let n=`${this.idPrefix}-${++this.seq}`,i=r.timeoutMs??this.callTimeoutMs;return new Promise((a,o)=>{let s=i>0?setTimeout(()=>{this.pending.delete(n),o(new j(`Call timed out after ${i}ms: ${t}`,{code:T.TIMEOUT,reason:"TIMEOUT"}))},i):null;this.pending.set(n,{resolve:a,reject:o,timer:s}),this.send(x({jsonrpc:"2.0",id:n,method:t},e!==void 0?{params:e}:{}),r.transfer)})}close(){if(!this.closed){this.closed=!0,this.unlisten();for(let[,t]of this.pending)t.timer&&clearTimeout(t.timer),t.reject(new j("Bus endpoint closed",{code:T.CONNECTION_CLOSED,reason:"CLOSED"}));this.pending.clear(),this.eventHandlers.clear()}}send(t,e){this.closed||this.port.post(li(t),e)}onData(t){let e=ui(t);e&&(di(e)?this.onResponse(e):pi(e)?this.onRequest(e):fi(e)&&this.onNotification(e.method,e.params))}onResponse(t){if(t.id===null)return;let e=this.pending.get(t.id);e&&(this.pending.delete(t.id),e.timer&&clearTimeout(e.timer),"error"in t?e.reject(j.fromErrorObject(t.error)):e.resolve(t.result))}onRequest(t){return P(this,null,function*(){let e=this.methods.get(t.method);if(!e){this.send({jsonrpc:"2.0",id:t.id,error:{code:T.METHOD_NOT_FOUND,message:`Method not found: ${t.method}`}});return}try{let r=yield e(t.params,{endpoint:this});this.send({jsonrpc:"2.0",id:t.id,result:r===void 0?null:r})}catch(r){this.send({jsonrpc:"2.0",id:t.id,error:j.from(r).toErrorObject()})}})}onNotification(t,e){for(let r of[...this.eventHandlers])if(Qe(r.patterns,t))try{r.fn(t,e)}catch(n){this.onError(n)}}};var Kr=["all","extension"];function et(t){return new j(t,{code:T.INVALID_PARAMS,reason:"events.badRequest"})}function hi(t){let e=t??{},{topic:r,scope:n="all"}=e;if(typeof r!="string"||r.length===0)throw et("events.publish requires a non-empty topic");if(r.includes("*"))throw et('events.publish topic must not contain "*"');if(r==="bus"||r.startsWith("bus."))throw et("events.publish topic must not be in the bus.* namespace");if(!Kr.includes(n))throw et(`events.publish scope must be one of: ${Kr.join(", ")}`);return"params"in e?{topic:r,scope:n,params:e.params}:{topic:r,scope:n}}var gi=class{endpoint;context;hostInfo;subs=new Map;onSubscriptionsChanged;adoptCallerId;subSeq=0;constructor(t){this.hostInfo=t.hostInfo,this.context=t.context,this.onSubscriptionsChanged=t.onSubscriptionsChanged,this.adoptCallerId=t.adoptCallerId??!1,this.endpoint=new Kt({port:t.port,callTimeoutMs:t.callTimeoutMs,onError:t.onError});for(let[e,r]of Object.entries(t.methods??{}))this.endpoint.registerMethod(e,r);this.endpoint.registerMethod("events.subscribe",e=>this.handleSubscribe(e)),this.endpoint.registerMethod("events.unsubscribe",e=>this.handleUnsubscribe(e)),this.endpoint.onEvent([Gt],(e,r)=>this.sendHandshake(r))}registerMethod(t,e){this.endpoint.registerMethod(t,e)}publish(t,e){return this.hasSubscriber(t)?(this.endpoint.notify(t,e),!0):!1}hasSubscriber(t){for(let[,e]of this.subs)if(Qe(e,t))return!0;return!1}subscribedPatterns(){let t=new Set;for(let[,e]of this.subs)for(let r of e)t.add(r);return[...t]}close(){this.endpoint.close(),this.subs.clear()}sendHandshake(t){let e=this.adoptCallerId&&t?.id?q(x({},this.context),{id:t.id}):this.context;this.endpoint.notify(Wt,q(x({},this.hostInfo),{context:e}))}handleSubscribe(t){let e=t?.patterns;if(!Array.isArray(e)||e.length===0||!e.every(n=>typeof n=="string"&&n.length>0))throw new j("events.subscribe requires a non-empty patterns array",{code:T.INVALID_PARAMS,reason:"INVALID_PATTERNS"});let r=`sub-${++this.subSeq}`;return this.subs.set(r,e),this.onSubscriptionsChanged?.(this.subscribedPatterns()),{subscriptionId:r}}handleUnsubscribe(t){let e=t?.subscriptionId;if(typeof e!="string"||!this.subs.has(e))throw new j("Unknown subscriptionId",{code:T.INVALID_PARAMS,reason:"UNKNOWN_SUBSCRIPTION"});return this.subs.delete(e),this.onSubscriptionsChanged?.(this.subscribedPatterns()),{}}};var bi=4,Zr=200,Xr={aboveCharts:{base:60,span:30},aboveResources:{base:190,span:10}},W=class extends Error{constructor(r,n){super(n);this.reason=r}reason},ge=(t,e)=>`${t}/${e}`;function Zt(t,e){return typeof t=="number"&&Number.isFinite(t)?Math.min(1,Math.max(0,t)):e}function wi(t,e){if(typeof t.configPanel!="string")return;let r=e?.find(n=>n.id===t.configPanel);return r&&r.type==="iframe"&&r.url&&(r.apiVersion===void 0||r.apiVersion==="1")?r.id:void 0}var xi=t=>typeof t=="number"&&Number.isFinite(t)&&t>0?t:void 0,ki=t=>Array.isArray(t)&&t.every(e=>typeof e=="string")?t:void 0,Yr=class t{definitions=Bt([]);settings=Bt({});latest=new Map;lastLive=new Map;sinks=new Map;requestSeq=0;persist=()=>{};configOpener=()=>{};now=()=>Date.now();setPersist(e){this.persist=e}setConfigOpener(e){this.configOpener=e}openConfigPanel(e){let r=this.entry(e);r?.configPanel&&this.configOpener(r)}entries=Jt(()=>{let e=this.settings(),r={aboveCharts:[],aboveResources:[]};for(let{extension:a,extensionName:o,def:s,panels:l,model:u}of this.definitions()){let c=ge(a,s.id),p=s.band==="aboveResources"?"aboveResources":"aboveCharts",m=e[c];r[p].push(q(x({key:c,extension:a,extensionName:o,id:s.id,title:s.title,type:u?"data":"image"},u?{model:u}:{runtime:s.runtime}),{band:p,visible:typeof m?.visible=="boolean"?m.visible:s.visible!==!1,opacity:Zt(m?.opacity,Zt(s.opacity,1)),suspended:!1,zIndex:0,minZoom:s.minZoom,maxZoom:s.maxZoom,configPanel:wi(s,l),preferredPixelRatio:u?void 0:xi(s.preferredPixelRatio),interactive:!!u&&s.interactive===!0,interactiveLayers:u?ki(s.interactiveLayers):void 0,titleProperty:typeof s.titleProperty=="string"&&s.titleProperty?s.titleProperty:"name"}))}let n=[],i=0;for(let a of["aboveCharts","aboveResources"])r[a].forEach((o,s)=>{o.zIndex=Xr[a].base+Math.min(s,Xr[a].span-1),o.visible&&(o.suspended=i>=bi,o.suspended||i++),n.push(o)});return n});active=Jt(()=>this.entries().filter(e=>e.visible&&!e.suspended));setDefinitions(e){this.definitions.set(e);let r=new Set(this.entries().map(n=>n.key));for(let n of[...this.latest.keys()])r.has(n)||this.latest.delete(n)}loadSettings(e){this.settings.set(x({},e??{}))}entry(e){return this.entries().find(r=>r.key===e)}list(e){return this.entries().filter(r=>r.extension===e).map(r=>x({id:r.id,title:r.title,type:r.type,band:r.band,visible:r.visible,opacity:r.opacity,suspended:r.suspended},r.model?{skippedLayers:r.model.skippedLayers()}:{}))}dataModel(e,r){if(typeof r!="string")throw new W("overlays.badRequest","`overlayId` is required");this.requireOwn(e,[r]);let n=this.entry(ge(e,r))?.model;if(!n)throw new W("overlays.badRequest",`Overlay "${r}" is an image overlay, not a data overlay`);return n}requireOwn(e,r){let n=new Set(this.entries().filter(a=>a.extension===e).map(a=>a.id)),i=r.filter(a=>!n.has(a));if(i.length)throw new W("overlays.unknownId",`Unknown overlay id(s): ${i.join(", ")}`)}setVisibility(e,r){this.update(e,n=>q(x({},n),{visible:r}))}setOpacity(e,r,n=!0){this.update(e,i=>q(x({},i),{opacity:Zt(r,1)}),n)}update(e,r,n=!0){let i=x({},this.settings());for(let a of e){let o=this.entry(a);o&&(i[a]=r({visible:o.visible,opacity:o.opacity}))}this.settings.set(i),n&&this.persist(i)}newRequest(e,r,n){let i=this.entry(e);if(!i)return null;let a=q(x({overlayId:i.id,requestId:`r-${++this.requestSeq}`},r),{liveInterval:Zr}),o=this.latest.get(e)?.request;return this.latest.set(e,{request:a,worldOffset:n,previousSize:o?[o.width,o.height]:void 0}),a}latestRequestsFor(e,r){return this.active().filter(n=>n.extension===e&&n.runtime===r).map(n=>this.latest.get(n.key)?.request).filter(n=>!!n)}clearRequest(e){this.latest.delete(e),this.lastLive.delete(e)}registerSink(e,r){return this.sinks.set(e,r),()=>{this.sinks.get(e)===r&&this.sinks.delete(e)}}acceptFrame(e,r,n){let i=ge(e,n.overlayId),a=this.entry(i);if(a?.type==="data")throw n.image.close(),new W("overlays.badRequest",`Overlay "${n.overlayId}" is a data overlay; the host draws it`);if(!a||r===null||a.runtime!==r)throw n.image.close(),new W("overlays.unknownId",`No overlay "${n.overlayId}" is drawn by this context`);let o=this.latest.get(i),s=this.sinks.get(i);if(!o||!s||!a.visible||a.suspended)return n.image.close(),{accepted:!1,reason:"overlays.superseded"};let l=n.image.width===o.request.width&&n.image.height===o.request.height,u=n.requestId===void 0&&!l&&n.image.width===o.previousSize?.[0]&&n.image.height===o.previousSize?.[1];if(n.requestId!==void 0&&n.requestId!==o.request.requestId||u)return n.image.close(),{accepted:!1,reason:"overlays.superseded"};if(!l)throw n.image.close(),new W("overlays.badRequest",`Frame is ${n.image.width}x${n.image.height}, request was ${o.request.width}x${o.request.height}`);if(n.requestId===void 0){let h=this.now(),O=this.lastLive.get(i);if(O!==void 0&&h-O<Zr)return n.image.close(),{accepted:!1,reason:"overlays.throttled"};this.lastLive.set(i,h)}let[c,p,m,d]=n.extent,g=o.worldOffset;return s({image:n.image,extent:[c+g,p,m+g,d]}),{accepted:!0}}static \u0275fac=function(r){return new(r||t)};static \u0275prov=Br({token:t,factory:t.\u0275fac,providedIn:"root"})};var Si=8,Oi={version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},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"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},$i={"*":{type:"source"}},zi=["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],Ai={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},"*":{type:"*"}},Ei={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:"*"}},Ii={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:"*"}},Mi={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:"*"},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"}},Pi={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"}}},Ri={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"}}},qi={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"}},Ti=["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],ji={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Ci={"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Ni={"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Di={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},_i={"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"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"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Fi={"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","property-type":"constant"}},Li={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Vi={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Ui={type:"array",value:"*"},Bi={type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},Ji={type:"enum",values:{Point:{},LineString:{},Polygon:{}}},Hi={type:"array",minimum:0,maximum:24,value:["number","color"],length:2},Gi={type:"array",value:"*",minimum:1},Wi={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}},Ki={"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}},Zi={source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},Xi={type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},Yi=["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],Qi={"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"}},ea={"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"]},"property-type":"cross-faded"},"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"}},ta={"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"}},ra={"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"}},na={"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"}},ia={"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"},"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"}},aa={"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"}},oa={"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"}},sa={duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},la={"*":{type:"string"}},St={$version:Si,$root:Oi,sources:$i,source:zi,source_vector:Ai,source_raster:Ei,source_raster_dem:Ii,source_geojson:Mi,source_video:Pi,source_image:Ri,layer:qi,layout:Ti,layout_background:ji,layout_fill:Ci,layout_circle:Ni,layout_heatmap:Di,"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:_i,layout_symbol:Fi,layout_raster:Li,layout_hillshade:Vi,"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:Ui,filter_operator:Bi,geometry_type:Ji,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:Hi,expression:Gi,light:Wi,sky:Ki,terrain:Zi,projection:Xi,paint:Yi,paint_fill:Qi,"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:ea,paint_circle:ta,paint_heatmap:ra,paint_symbol:na,paint_raster:ia,paint_hillshade:aa,"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"}},paint_background:oa,transition:sa,"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:la},ua=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function ca(t,e){let r={};for(let n in t)n!=="ref"&&(r[n]=t[n]);return ua.forEach(n=>{n in e&&(r[n]=e[n])}),r}function Ls(t){t=t.slice();let e=Object.create(null);for(let r=0;r<t.length;r++)e[t[r].id]=t[r];for(let r=0;r<t.length;r++)"ref"in t[r]&&(t[r]=ca(t[r],e[t[r].ref]));return t}var f=class{constructor(e,r,n,i){this.message=(e?`${e}: `:"")+n,i&&(this.identifier=i),r!=null&&r.__line__&&(this.line=r.__line__)}};function ke(t,...e){for(let r of e)for(let n in r)t[n]=r[n];return t}var F=class extends Error{constructor(e,r){super(r),this.message=r,this.key=e}},or=class t{constructor(e,r=[]){this.parent=e,this.bindings={};for(let[n,i]of r)this.bindings[n]=i}concat(e){return new t(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]?!0:this.parent?this.parent.has(e):!1}},Ot={kind:"null"},y={kind:"number"},k={kind:"string"},w={kind:"boolean"},K={kind:"color"},$t={kind:"projectionDefinition"},fe={kind:"object"},b={kind:"value"},pa={kind:"error"},zt={kind:"collator"},At={kind:"formatted"},Et={kind:"padding"},qe={kind:"colorArray"},It={kind:"numberArray"},We={kind:"resolvedImage"},Mt={kind:"variableAnchorOffsetCollection"};function D(t,e){return{kind:"array",itemType:t,N:e}}function E(t){if(t.kind==="array"){let e=E(t.itemType);return typeof t.N=="number"?`array<${e}, ${t.N}>`:t.itemType.kind==="value"?"array":`array<${e}>`}else return t.kind}var fa=[Ot,y,k,w,K,$t,At,fe,D(b),Et,It,qe,We,Mt];function Te(t,e){if(e.kind==="error")return null;if(t.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!Te(t.itemType,e.itemType))&&(typeof t.N!="number"||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if(t.kind==="value"){for(let r of fa)if(!Te(r,e))return null}}return`Expected ${E(t)} but found ${E(e)} instead.`}function $r(t,e){return e.some(r=>r.kind===t.kind)}function de(t,e){return e.some(r=>r==="null"?t===null:r==="array"?Array.isArray(t):r==="object"?t&&!Array.isArray(t)&&typeof t=="object":r===typeof t)}function ne(t,e){return t.kind==="array"&&e.kind==="array"?t.itemType.kind===e.itemType.kind&&typeof t.N=="number":t.kind===e.kind}var xn=.96422,kn=1,Sn=.82521,On=4/29,we=6/29,$n=3*we*we,da=we*we*we,ya=Math.PI/180,ma=180/Math.PI;function zn(t){return t=t%360,t<0&&(t+=360),t}function An([t,e,r,n]){t=Xt(t),e=Xt(e),r=Xt(r);let i,a,o=Yt((.2225045*t+.7168786*e+.0606169*r)/kn);t===e&&e===r?i=a=o:(i=Yt((.4360747*t+.3850649*e+.1430804*r)/xn),a=Yt((.0139322*t+.0971045*e+.7141733*r)/Sn));let s=116*o-16;return[s<0?0:s,500*(i-o),200*(o-a),n]}function Xt(t){return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Yt(t){return t>da?Math.pow(t,1/3):t/$n+On}function En([t,e,r,n]){let i=(t+16)/116,a=isNaN(e)?i:i+e/500,o=isNaN(r)?i:i-r/200;return i=kn*er(i),a=xn*er(a),o=Sn*er(o),[Qt(3.1338561*a-1.6168667*i-.4906146*o),Qt(-.9787684*a+1.9161415*i+.033454*o),Qt(.0719453*a-.2289914*i+1.4052427*o),n]}function Qt(t){return t=t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055,t<0?0:t>1?1:t}function er(t){return t>we?t*t*t:$n*(t-On)}function ha(t){let[e,r,n,i]=An(t),a=Math.sqrt(r*r+n*n);return[Math.round(a*1e4)?zn(Math.atan2(n,r)*ma):NaN,a,e,i]}function ga([t,e,r,n]){return t=isNaN(t)?0:t*ya,En([r,Math.cos(t)*e,Math.sin(t)*e,n])}function va([t,e,r,n]){t=zn(t),e/=100,r/=100;function i(a){let o=(a+t/30)%12,s=e*Math.min(r,1-r);return r-s*Math.max(-1,Math.min(o-3,9-o,1))}return[i(0),i(8),i(4),n]}var ba=Object.hasOwn||function(e,r){return Object.prototype.hasOwnProperty.call(e,r)};function Pe(t,e){return ba(t,e)?t[e]:void 0}function wa(t){if(t=t.toLowerCase().trim(),t==="transparent")return[0,0,0,0];let e=Pe(xa,t);if(e){let[i,a,o]=e;return[i/255,a/255,o/255,1]}if(t.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(t)){let a=t.length<6?1:2,o=1;return[tt(t.slice(o,o+=a)),tt(t.slice(o,o+=a)),tt(t.slice(o,o+=a)),tt(t.slice(o,o+a)||"ff")]}if(t.startsWith("rgb")){let i=/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/,a=t.match(i);if(a){let[o,s,l,u,c,p,m,d,g,h,O,v]=a,z=[u||" ",m||" ",h].join("");if(z===" "||z===" /"||z===",,"||z===",,,"){let C=[l,p,g].join(""),ue=C==="%%%"?100:C===""?255:0;if(ue){let Ur=[ve(+s/ue,0,1),ve(+c/ue,0,1),ve(+d/ue,0,1),O?Qr(+O,v):1];if(en(Ur))return Ur}}return}}let r=/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/,n=t.match(r);if(n){let[i,a,o,s,l,u,c,p,m]=n,d=[o||" ",l||" ",c].join("");if(d===" "||d===" /"||d===",,"||d===",,,"){let g=[+a,ve(+s,0,100),ve(+u,0,100),p?Qr(+p,m):1];if(en(g))return va(g)}}}function tt(t){return parseInt(t.padEnd(2,t),16)/255}function Qr(t,e){return ve(e?t/100:t,0,1)}function ve(t,e,r){return Math.min(Math.max(e,t),r)}function en(t){return!t.some(Number.isNaN)}var xa={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 ae(t,e,r){return t+r*(e-t)}function Se(t,e,r){return t.map((n,i)=>ae(n,e[i],r))}function ka(t){return t==="rgb"||t==="hcl"||t==="lab"}var $=class t{constructor(e,r,n,i=1,a=!0){this.r=e,this.g=r,this.b=n,this.a=i,a||(this.r*=i,this.g*=i,this.b*=i,i||this.overwriteGetter("rgb",[e,r,n,i]))}static parse(e){if(e instanceof t)return e;if(typeof e!="string")return;let r=wa(e);if(r)return new t(...r,!1)}get rgb(){let{r:e,g:r,b:n,a:i}=this,a=i||1/0;return this.overwriteGetter("rgb",[e/a,r/a,n/a,i])}get hcl(){return this.overwriteGetter("hcl",ha(this.rgb))}get lab(){return this.overwriteGetter("lab",An(this.rgb))}overwriteGetter(e,r){return Object.defineProperty(this,e,{value:r}),r}toString(){let[e,r,n,i]=this.rgb;return`rgba(${[e,r,n].map(a=>Math.round(a*255)).join(",")},${i})`}static interpolate(e,r,n,i="rgb"){switch(i){case"rgb":{let[a,o,s,l]=Se(e.rgb,r.rgb,n);return new t(a,o,s,l,!1)}case"hcl":{let[a,o,s,l]=e.hcl,[u,c,p,m]=r.hcl,d,g;if(!isNaN(a)&&!isNaN(u)){let C=u-a;u>a&&C>180?C-=360:u<a&&a-u>180&&(C+=360),d=a+n*C}else isNaN(a)?isNaN(u)?d=NaN:(d=u,(s===1||s===0)&&(g=c)):(d=a,(p===1||p===0)&&(g=o));let[h,O,v,z]=ga([d,g??ae(o,c,n),ae(s,p,n),ae(l,m,n)]);return new t(h,O,v,z,!1)}case"lab":{let[a,o,s,l]=En(Se(e.lab,r.lab,n));return new t(a,o,s,l,!1)}}}};$.black=new $(0,0,0,1);$.white=new $(1,1,1,1);$.transparent=new $(0,0,0,0);$.red=new $(1,0,0,1);var je=class{constructor(e,r,n){e?this.sensitivity=r?"variant":"case":this.sensitivity=r?"accent":"base",this.locale=n,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,r){return this.collator.compare(e,r)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}},Sa=["bottom","center","top"],Ce=class{constructor(e,r,n,i,a,o){this.text=e,this.image=r,this.scale=n,this.fontStack=i,this.textColor=a,this.verticalAlign=o}},oe=class t{constructor(e){this.sections=e}static fromString(e){return new t([new Ce(e,null,null,null,null,null)])}isEmpty(){return this.sections.length===0?!0:!this.sections.some(e=>e.text.length!==0||e.image&&e.image.name.length!==0)}static factory(e){return e instanceof t?e:t.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}},V=class t{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof t)return e;if(typeof e=="number")return new t([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(let r of e)if(typeof r!="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]];break}return new t(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,r,n){return new t(Se(e.values,r.values,n))}},U=class t{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof t)return e;if(typeof e=="number")return new t([e]);if(Array.isArray(e)){for(let r of e)if(typeof r!="number")return;return new t(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,r,n){return new t(Se(e.values,r.values,n))}},N=class t{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof t)return e;if(typeof e=="string"){let n=$.parse(e);return n?new t([n]):void 0}if(!Array.isArray(e))return;let r=[];for(let n of e){if(typeof n!="string")return;let i=$.parse(n);if(!i)return;r.push(i)}return new t(r)}toString(){return JSON.stringify(this.values)}static interpolate(e,r,n,i="rgb"){let a=[];if(e.values.length!=r.values.length)throw new Error(`colorArray: Arrays have mismatched length (${e.values.length} vs. ${r.values.length}), cannot interpolate.`);for(let o=0;o<e.values.length;o++)a.push($.interpolate(e.values[o],r.values[o],n,i));return new t(a)}},A=class extends Error{constructor(e){super(e),this.name="RuntimeError"}toJSON(){return this.message}},Oa=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]),X=class t{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof t)return e;if(!(!Array.isArray(e)||e.length<1||e.length%2!==0)){for(let r=0;r<e.length;r+=2){let n=e[r],i=e[r+1];if(typeof n!="string"||!Oa.has(n)||!Array.isArray(i)||i.length!==2||typeof i[0]!="number"||typeof i[1]!="number")return}return new t(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,r,n){let i=e.values,a=r.values;if(i.length!==a.length)throw new A(`Cannot interpolate values of different length. from: ${e.toString()}, to: ${r.toString()}`);let o=[];for(let s=0;s<i.length;s+=2){if(i[s]!==a[s])throw new A(`Cannot interpolate values containing mismatched anchors. from[${s}]: ${i[s]}, to[${s}]: ${a[s]}`);o.push(i[s]);let[l,u]=i[s+1],[c,p]=a[s+1];o.push([ae(l,c,n),ae(u,p,n)])}return new t(o)}},Q=class t{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new t({name:e,available:!1}):null}},se=class t{constructor(e,r,n){this.from=e,this.to=r,this.transition=n}static interpolate(e,r,n){return new t(e,r,n)}static parse(e){if(e instanceof t)return e;if(Array.isArray(e)&&e.length===3&&typeof e[0]=="string"&&typeof e[1]=="string"&&typeof e[2]=="number")return new t(e[0],e[1],e[2]);if(typeof e=="object"&&typeof e.from=="string"&&typeof e.to=="string"&&typeof e.transition=="number")return new t(e.from,e.to,e.transition);if(typeof e=="string")return new t(e,e,1)}};function In(t,e,r,n){return typeof t=="number"&&t>=0&&t<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof r=="number"&&r>=0&&r<=255?typeof n>"u"||typeof n=="number"&&n>=0&&n<=1?null:`Invalid rgba value [${[t,e,r,n].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof n=="number"?[t,e,r,n]:[t,e,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Ne(t){if(t===null||typeof t=="string"||typeof t=="boolean"||typeof t=="number"||t instanceof se||t instanceof $||t instanceof je||t instanceof oe||t instanceof V||t instanceof U||t instanceof N||t instanceof X||t instanceof Q)return!0;if(Array.isArray(t)){for(let e of t)if(!Ne(e))return!1;return!0}else if(typeof t=="object"){for(let e in t)if(!Ne(t[e]))return!1;return!0}else return!1}function M(t){if(t===null)return Ot;if(typeof t=="string")return k;if(typeof t=="boolean")return w;if(typeof t=="number")return y;if(t instanceof $)return K;if(t instanceof se)return $t;if(t instanceof je)return zt;if(t instanceof oe)return At;if(t instanceof V)return Et;if(t instanceof U)return It;if(t instanceof N)return qe;if(t instanceof X)return Mt;if(t instanceof Q)return We;if(Array.isArray(t)){let e=t.length,r;for(let n of t){let i=M(n);if(!r)r=i;else{if(r===i)continue;r=b;break}}return D(r||b,e)}else return fe}function Re(t){let e=typeof t;return t===null?"":e==="string"||e==="number"||e==="boolean"?String(t):t instanceof $||t instanceof se||t instanceof oe||t instanceof V||t instanceof U||t instanceof N||t instanceof X||t instanceof Q?t.toString():JSON.stringify(t)}var Oe=class t{constructor(e,r){this.type=e,this.value=r}static parse(e,r){if(e.length!==2)return r.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!Ne(e[1]))return r.error("invalid value");let n=e[1],i=M(n),a=r.expectedType;return i.kind==="array"&&i.N===0&&a&&a.kind==="array"&&(typeof a.N!="number"||a.N===0)&&(i=a),new t(i,n)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}},rt={string:k,number:y,boolean:w,object:fe},B=class t{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let n=1,i,a=e[0];if(a==="array"){let s;if(e.length>2){let u=e[1];if(typeof u!="string"||!(u in rt)||u==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);s=rt[u],n++}else s=b;let l;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return r.error('The length argument to "array" must be a positive integer literal',2);l=e[2],n++}i=D(s,l)}else{if(!rt[a])throw new Error(`Types doesn't contain name = ${a}`);i=rt[a]}let o=[];for(;n<e.length;n++){let s=r.parse(e[n],n,b);if(!s)return null;o.push(s)}return new t(i,o)}evaluate(e){for(let r=0;r<this.args.length;r++){let n=this.args[r].evaluate(e);if(Te(this.type,M(n))){if(r===this.args.length-1)throw new A(`Expected value to be of type ${E(this.type)}, but found ${E(M(n))} instead.`)}else return n}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}},tn={"to-boolean":w,"to-color":K,"to-number":y,"to-string":k},ie=class t{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let n=e[0];if(!tn[n])throw new Error(`Can't parse ${n} as it is not part of the known types`);if((n==="to-boolean"||n==="to-string")&&e.length!==2)return r.error("Expected one argument.");let i=tn[n],a=[];for(let o=1;o<e.length;o++){let s=r.parse(e[o],o,b);if(!s)return null;a.push(s)}return new t(i,a)}evaluate(e){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(e);case"color":{let r,n;for(let i of this.args){if(r=i.evaluate(e),n=null,r instanceof $)return r;if(typeof r=="string"){let a=e.parseColor(r);if(a)return a}else if(Array.isArray(r)&&(r.length<3||r.length>4?n=`Invalid rgba value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:n=In(r[0],r[1],r[2],r[3]),!n))return new $(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new A(n||`Could not parse color from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"padding":{let r;for(let n of this.args){r=n.evaluate(e);let i=V.parse(r);if(i)return i}throw new A(`Could not parse padding from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"numberArray":{let r;for(let n of this.args){r=n.evaluate(e);let i=U.parse(r);if(i)return i}throw new A(`Could not parse numberArray from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"colorArray":{let r;for(let n of this.args){r=n.evaluate(e);let i=N.parse(r);if(i)return i}throw new A(`Could not parse colorArray from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"variableAnchorOffsetCollection":{let r;for(let n of this.args){r=n.evaluate(e);let i=X.parse(r);if(i)return i}throw new A(`Could not parse variableAnchorOffsetCollection from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"number":{let r=null;for(let n of this.args){if(r=n.evaluate(e),r===null)return 0;let i=Number(r);if(!isNaN(i))return i}throw new A(`Could not convert ${JSON.stringify(r)} to number.`)}case"formatted":return oe.fromString(Re(this.args[0].evaluate(e)));case"resolvedImage":return Q.fromString(Re(this.args[0].evaluate(e)));case"projectionDefinition":return this.args[0].evaluate(e);default:return Re(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}},$a=["Unknown","Point","LineString","Polygon"],ot=class{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"?$a[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 r=this._parseColorCache.get(e);return r||(r=$.parse(e),this._parseColorCache.set(e,r)),r}},st=class t{constructor(e,r,n=[],i,a=new or,o=[]){this.registry=e,this.path=n,this.key=n.map(s=>`[${s}]`).join(""),this.scope=a,this.errors=o,this.expectedType=i,this._isConstant=r}parse(e,r,n,i,a={}){return r?this.concat(r,n,i)._parse(e,a):this._parse(e,a)}_parse(e,r){(e===null||typeof e=="string"||typeof e=="boolean"||typeof e=="number")&&(e=["literal",e]);function n(i,a,o){return o==="assert"?new B(a,[i]):o==="coerce"?new ie(a,[i]):i}if(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", []].');let i=e[0];if(typeof i!="string")return this.error(`Expression name must be a string, but found ${typeof i} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;let a=this.registry[i];if(a){let o=a.parse(e,this);if(!o)return null;if(this.expectedType){let s=this.expectedType,l=o.type;if((s.kind==="string"||s.kind==="number"||s.kind==="boolean"||s.kind==="object"||s.kind==="array")&&l.kind==="value")o=n(o,s,r.typeAnnotation||"assert");else if(s.kind==="projectionDefinition"&&["string","array"].includes(l.kind)||["color","formatted","resolvedImage"].includes(s.kind)&&["value","string"].includes(l.kind)||["padding","numberArray"].includes(s.kind)&&["value","number","array"].includes(l.kind)||s.kind==="colorArray"&&["value","string","array"].includes(l.kind)||s.kind==="variableAnchorOffsetCollection"&&["value","array"].includes(l.kind))o=n(o,s,r.typeAnnotation||"coerce");else if(this.checkSubtype(s,l))return null}if(!(o instanceof Oe)&&o.type.kind!=="resolvedImage"&&this._isConstant(o)){let s=new ot;try{o=new Oe(o.type,o.evaluate(s))}catch(l){return this.error(l.message),null}}return o}return this.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0)}else return typeof e>"u"?this.error("'undefined' value invalid. Use null instead."):typeof e=="object"?this.error('Bare objects invalid. Use ["literal", {...}] instead.'):this.error(`Expected an array, but found ${typeof e} instead.`)}concat(e,r,n){let i=typeof e=="number"?this.path.concat(e):this.path,a=n?this.scope.concat(n):this.scope;return new t(this.registry,this._isConstant,i,r||null,a,this.errors)}error(e,...r){let n=`${this.key}${r.map(i=>`[${i}]`).join("")}`;this.errors.push(new F(n,e))}checkSubtype(e,r){let n=Te(e,r);return n&&this.error(n),n}},lt=class t{constructor(e,r){this.type=r.type,this.bindings=[].concat(e),this.result=r}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(let r of this.bindings)e(r[1]);e(this.result)}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);let n=[];for(let a=1;a<e.length-1;a+=2){let o=e[a];if(typeof o!="string")return r.error(`Expected string, but found ${typeof o} instead.`,a);if(/[^a-zA-Z0-9_]/.test(o))return r.error("Variable names must contain only alphanumeric characters or '_'.",a);let s=r.parse(e[a+1],a+1);if(!s)return null;n.push([o,s])}let i=r.parse(e[e.length-1],e.length-1,r.expectedType,n);return i?new t(n,i):null}outputDefined(){return this.result.outputDefined()}},ut=class t{constructor(e,r){this.type=r.type,this.name=e,this.boundExpression=r}static parse(e,r){if(e.length!==2||typeof e[1]!="string")return r.error("'var' expression requires exactly one string literal argument.");let n=e[1];return r.scope.has(n)?new t(n,r.scope.get(n)):r.error(`Unknown variable "${n}". Make sure "${n}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}},sr=class t{constructor(e,r,n){this.type=e,this.index=r,this.input=n}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);let n=r.parse(e[1],1,y),i=r.parse(e[2],2,D(r.expectedType||b));if(!n||!i)return null;let a=i.type;return new t(a.itemType,n,i)}evaluate(e){let r=this.index.evaluate(e),n=this.input.evaluate(e);if(r<0)throw new A(`Array index out of bounds: ${r} < 0.`);if(r>=n.length)throw new A(`Array index out of bounds: ${r} > ${n.length-1}.`);if(r!==Math.floor(r))throw new A(`Array index must be an integer, but found ${r} instead.`);return n[r]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}},lr=class t{constructor(e,r){this.type=w,this.needle=e,this.haystack=r}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);let n=r.parse(e[1],1,b),i=r.parse(e[2],2,b);return!n||!i?null:$r(n.type,[w,k,y,Ot,b])?new t(n,i):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${E(n.type)} instead`)}evaluate(e){let r=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!n)return!1;if(!de(r,["boolean","string","number","null"]))throw new A(`Expected first argument to be of type boolean, string, number or null, but found ${E(M(r))} instead.`);if(!de(n,["string","array"]))throw new A(`Expected second argument to be of type array or string, but found ${E(M(n))} instead.`);return n.indexOf(r)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}},ur=class t{constructor(e,r,n){this.type=y,this.needle=e,this.haystack=r,this.fromIndex=n}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);let n=r.parse(e[1],1,b),i=r.parse(e[2],2,b);if(!n||!i)return null;if(!$r(n.type,[w,k,y,Ot,b]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${E(n.type)} instead`);if(e.length===4){let a=r.parse(e[3],3,y);return a?new t(n,i,a):null}else return new t(n,i)}evaluate(e){let r=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!de(r,["boolean","string","number","null"]))throw new A(`Expected first argument to be of type boolean, string, number or null, but found ${E(M(r))} instead.`);let i;if(this.fromIndex&&(i=this.fromIndex.evaluate(e)),de(n,["string"])){let a=n.indexOf(r,i);return a===-1?-1:[...n.slice(0,a)].length}else{if(de(n,["array"]))return n.indexOf(r,i);throw new A(`Expected second argument to be of type array or string, but found ${E(M(n))} instead.`)}}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}},cr=class t{constructor(e,r,n,i,a,o){this.inputType=e,this.type=r,this.input=n,this.cases=i,this.outputs=a,this.otherwise=o}static parse(e,r){if(e.length<5)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!==1)return r.error("Expected an even number of arguments.");let n,i;r.expectedType&&r.expectedType.kind!=="value"&&(i=r.expectedType);let a={},o=[];for(let u=2;u<e.length-1;u+=2){let c=e[u],p=e[u+1];Array.isArray(c)||(c=[c]);let m=r.concat(u);if(c.length===0)return m.error("Expected at least one branch label.");for(let g of c){if(typeof g!="number"&&typeof g!="string")return m.error("Branch labels must be numbers or strings.");if(typeof g=="number"&&Math.abs(g)>Number.MAX_SAFE_INTEGER)return m.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof g=="number"&&Math.floor(g)!==g)return m.error("Numeric branch labels must be integer values.");if(!n)n=M(g);else if(m.checkSubtype(n,M(g)))return null;if(typeof a[String(g)]<"u")return m.error("Branch labels must be unique.");a[String(g)]=o.length}let d=r.parse(p,u,i);if(!d)return null;i=i||d.type,o.push(d)}let s=r.parse(e[1],1,b);if(!s)return null;let l=r.parse(e[e.length-1],e.length-1,i);return!l||s.type.kind!=="value"&&r.concat(1).checkSubtype(n,s.type)?null:new t(n,i,s,a,o,l)}evaluate(e){let r=this.input.evaluate(e);return(M(r)===this.inputType&&this.outputs[this.cases[r]]||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()}},pr=class t{constructor(e,r,n){this.type=e,this.branches=r,this.otherwise=n}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!==0)return r.error("Expected an odd number of arguments.");let n;r.expectedType&&r.expectedType.kind!=="value"&&(n=r.expectedType);let i=[];for(let o=1;o<e.length-1;o+=2){let s=r.parse(e[o],o,w);if(!s)return null;let l=r.parse(e[o+1],o+1,n);if(!l)return null;i.push([s,l]),n=n||l.type}let a=r.parse(e[e.length-1],e.length-1,n);if(!a)return null;if(!n)throw new Error("Can't infer output type");return new t(n,i,a)}evaluate(e){for(let[r,n]of this.branches)if(r.evaluate(e))return n.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(let[r,n]of this.branches)e(r),e(n);e(this.otherwise)}outputDefined(){return this.branches.every(([e,r])=>r.outputDefined())&&this.otherwise.outputDefined()}},fr=class t{constructor(e,r,n,i){this.type=e,this.input=r,this.beginIndex=n,this.endIndex=i}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);let n=r.parse(e[1],1,b),i=r.parse(e[2],2,y);if(!n||!i)return null;if(!$r(n.type,[D(b),k,b]))return r.error(`Expected first argument to be of type array or string, but found ${E(n.type)} instead`);if(e.length===4){let a=r.parse(e[3],3,y);return a?new t(n.type,n,i,a):null}else return new t(n.type,n,i)}evaluate(e){let r=this.input.evaluate(e),n=this.beginIndex.evaluate(e),i;if(this.endIndex&&(i=this.endIndex.evaluate(e)),de(r,["string"]))return[...r].slice(n,i).join("");if(de(r,["array"]))return r.slice(n,i);throw new A(`Expected first argument to be of type array or string, but found ${E(M(r))} instead.`)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}};function Pt(t,e){let r=t.length-1,n=0,i=r,a=0,o,s;for(;n<=i;)if(a=Math.floor((n+i)/2),o=t[a],s=t[a+1],o<=e){if(a===r||e<s)return a;n=a+1}else if(o>e)i=a-1;else throw new A("Input is not a number.");return 0}var ct=class t{constructor(e,r,n){this.type=e,this.input=r,this.labels=[],this.outputs=[];for(let[i,a]of n)this.labels.push(i),this.outputs.push(a)}static parse(e,r){if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!==0)return r.error("Expected an even number of arguments.");let n=r.parse(e[1],1,y);if(!n)return null;let i=[],a=null;r.expectedType&&r.expectedType.kind!=="value"&&(a=r.expectedType);for(let o=1;o<e.length;o+=2){let s=o===1?-1/0:e[o],l=e[o+1],u=o,c=o+1;if(typeof s!="number")return r.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',u);if(i.length&&i[i.length-1][0]>=s)return r.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',u);let p=r.parse(l,c,a);if(!p)return null;a=a||p.type,i.push([s,p])}return new t(a,n,i)}evaluate(e){let r=this.labels,n=this.outputs;if(r.length===1)return n[0].evaluate(e);let i=this.input.evaluate(e);if(i<=r[0])return n[0].evaluate(e);let a=r.length;if(i>=r[a-1])return n[a-1].evaluate(e);let o=Pt(r,i);return n[o].evaluate(e)}eachChild(e){e(this.input);for(let r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}};function za(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var tr,rn;function Aa(){if(rn)return tr;rn=1,tr=t;function t(e,r,n,i){this.cx=3*e,this.bx=3*(n-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*r,this.by=3*(i-r)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=r,this.p2x=n,this.p2y=i}return t.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,r){if(r===void 0&&(r=1e-6),e<0)return 0;if(e>1)return 1;for(var n=e,i=0;i<8;i++){var a=this.sampleCurveX(n)-e;if(Math.abs(a)<r)return n;var o=this.sampleCurveDerivativeX(n);if(Math.abs(o)<1e-6)break;n=n-a/o}var s=0,l=1;for(n=e,i=0;i<20&&(a=this.sampleCurveX(n),!(Math.abs(a-e)<r));i++)e>a?s=n:l=n,n=(l-s)*.5+s;return n},solve:function(e,r){return this.sampleCurveY(this.solveCurveX(e,r))}},tr}var Ea=Aa(),Ia=za(Ea),J=class t{constructor(e,r,n,i,a){this.type=e,this.operator=r,this.interpolation=n,this.input=i,this.labels=[],this.outputs=[];for(let[o,s]of a)this.labels.push(o),this.outputs.push(s)}static interpolationFactor(e,r,n,i){let a=0;if(e.name==="exponential")a=rr(r,e.base,n,i);else if(e.name==="linear")a=rr(r,1,n,i);else if(e.name==="cubic-bezier"){let o=e.controlPoints;a=new Ia(o[0],o[1],o[2],o[3]).solve(rr(r,1,n,i))}return a}static parse(e,r){let[n,i,a,...o]=e;if(!Array.isArray(i)||i.length===0)return r.error("Expected an interpolation type expression.",1);if(i[0]==="linear")i={name:"linear"};else if(i[0]==="exponential"){let u=i[1];if(typeof u!="number")return r.error("Exponential interpolation requires a numeric base.",1,1);i={name:"exponential",base:u}}else if(i[0]==="cubic-bezier"){let u=i.slice(1);if(u.length!==4||u.some(c=>typeof c!="number"||c<0||c>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);i={name:"cubic-bezier",controlPoints:u}}else return r.error(`Unknown interpolation type ${String(i[0])}`,1,0);if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!==0)return r.error("Expected an even number of arguments.");if(a=r.parse(a,2,y),!a)return null;let s=[],l=null;(n==="interpolate-hcl"||n==="interpolate-lab")&&r.expectedType!=qe?l=K:r.expectedType&&r.expectedType.kind!=="value"&&(l=r.expectedType);for(let u=0;u<o.length;u+=2){let c=o[u],p=o[u+1],m=u+3,d=u+4;if(typeof c!="number")return r.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',m);if(s.length&&s[s.length-1][0]>=c)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',m);let g=r.parse(p,d,l);if(!g)return null;l=l||g.type,s.push([c,g])}return!ne(l,y)&&!ne(l,$t)&&!ne(l,K)&&!ne(l,Et)&&!ne(l,It)&&!ne(l,qe)&&!ne(l,Mt)&&!ne(l,D(y))?r.error(`Type ${E(l)} is not interpolatable.`):new t(l,n,i,a,s)}evaluate(e){let r=this.labels,n=this.outputs;if(r.length===1)return n[0].evaluate(e);let i=this.input.evaluate(e);if(i<=r[0])return n[0].evaluate(e);let a=r.length;if(i>=r[a-1])return n[a-1].evaluate(e);let o=Pt(r,i),s=r[o],l=r[o+1],u=t.interpolationFactor(this.interpolation,i,s,l),c=n[o].evaluate(e),p=n[o+1].evaluate(e);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return ae(c,p,u);case"color":return $.interpolate(c,p,u);case"padding":return V.interpolate(c,p,u);case"colorArray":return N.interpolate(c,p,u);case"numberArray":return U.interpolate(c,p,u);case"variableAnchorOffsetCollection":return X.interpolate(c,p,u);case"array":return Se(c,p,u);case"projectionDefinition":return se.interpolate(c,p,u)}case"interpolate-hcl":switch(this.type.kind){case"color":return $.interpolate(c,p,u,"hcl");case"colorArray":return N.interpolate(c,p,u,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return $.interpolate(c,p,u,"lab");case"colorArray":return N.interpolate(c,p,u,"lab")}}}eachChild(e){e(this.input);for(let r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}};function rr(t,e,r,n){let i=n-r,a=t-r;return i===0?0:e===1?a/i:(Math.pow(e,a)-1)/(Math.pow(e,i)-1)}var Ma={color:$.interpolate,number:ae,padding:V.interpolate,numberArray:U.interpolate,colorArray:N.interpolate,variableAnchorOffsetCollection:X.interpolate,array:Se},pt=class t{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let n=null,i=r.expectedType;i&&i.kind!=="value"&&(n=i);let a=[];for(let s of e.slice(1)){let l=r.parse(s,1+a.length,n,void 0,{typeAnnotation:"omit"});if(!l)return null;n=n||l.type,a.push(l)}if(!n)throw new Error("No output type");return i&&a.some(s=>Te(i,s.type))?new t(b,a):new t(n,a)}evaluate(e){let r=null,n=0,i;for(let a of this.args)if(n++,r=a.evaluate(e),r&&r instanceof Q&&!r.available&&(i||(i=r.name),r=null,n===this.args.length&&(r=i)),r!==null)break;return r}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}};function nn(t,e){return t==="=="||t==="!="?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 Pa(t,e,r){return e===r}function Ra(t,e,r){return e!==r}function qa(t,e,r){return e<r}function Ta(t,e,r){return e>r}function ja(t,e,r){return e<=r}function Ca(t,e,r){return e>=r}function Mn(t,e,r,n){return n.compare(e,r)===0}function Na(t,e,r,n){return!Mn(t,e,r,n)}function Da(t,e,r,n){return n.compare(e,r)<0}function _a(t,e,r,n){return n.compare(e,r)>0}function Fa(t,e,r,n){return n.compare(e,r)<=0}function La(t,e,r,n){return n.compare(e,r)>=0}function ze(t,e,r){let n=t!=="=="&&t!=="!=";return class Pn{constructor(a,o,s){this.type=w,this.lhs=a,this.rhs=o,this.collator=s,this.hasUntypedArgument=a.type.kind==="value"||o.type.kind==="value"}static parse(a,o){if(a.length!==3&&a.length!==4)return o.error("Expected two or three arguments.");let s=a[0],l=o.parse(a[1],1,b);if(!l)return null;if(!nn(s,l.type))return o.concat(1).error(`"${s}" comparisons are not supported for type '${E(l.type)}'.`);let u=o.parse(a[2],2,b);if(!u)return null;if(!nn(s,u.type))return o.concat(2).error(`"${s}" comparisons are not supported for type '${E(u.type)}'.`);if(l.type.kind!==u.type.kind&&l.type.kind!=="value"&&u.type.kind!=="value")return o.error(`Cannot compare types '${E(l.type)}' and '${E(u.type)}'.`);n&&(l.type.kind==="value"&&u.type.kind!=="value"?l=new B(u.type,[l]):l.type.kind!=="value"&&u.type.kind==="value"&&(u=new B(l.type,[u])));let c=null;if(a.length===4){if(l.type.kind!=="string"&&u.type.kind!=="string"&&l.type.kind!=="value"&&u.type.kind!=="value")return o.error("Cannot use collator to compare non-string types.");if(c=o.parse(a[3],3,zt),!c)return null}return new Pn(l,u,c)}evaluate(a){let o=this.lhs.evaluate(a),s=this.rhs.evaluate(a);if(n&&this.hasUntypedArgument){let l=M(o),u=M(s);if(l.kind!==u.kind||!(l.kind==="string"||l.kind==="number"))throw new A(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${l.kind}, ${u.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){let l=M(o),u=M(s);if(l.kind!=="string"||u.kind!=="string")return e(a,o,s)}return this.collator?r(a,o,s,this.collator.evaluate(a)):e(a,o,s)}eachChild(a){a(this.lhs),a(this.rhs),this.collator&&a(this.collator)}outputDefined(){return!0}}}var Va=ze("==",Pa,Mn),Ua=ze("!=",Ra,Na),Ba=ze("<",qa,Da),Ja=ze(">",Ta,_a),Ha=ze("<=",ja,Fa),Ga=ze(">=",Ca,La),ft=class t{constructor(e,r,n){this.type=zt,this.locale=n,this.caseSensitive=e,this.diacriticSensitive=r}static parse(e,r){if(e.length!==2)return r.error("Expected one argument.");let n=e[1];if(typeof n!="object"||Array.isArray(n))return r.error("Collator options argument must be an object.");let i=r.parse(n["case-sensitive"]===void 0?!1:n["case-sensitive"],1,w);if(!i)return null;let a=r.parse(n["diacritic-sensitive"]===void 0?!1:n["diacritic-sensitive"],1,w);if(!a)return null;let o=null;return n.locale&&(o=r.parse(n.locale,1,k),!o)?null:new t(i,a,o)}evaluate(e){return new je(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}},dr=class t{constructor(e,r,n,i,a){this.type=k,this.number=e,this.locale=r,this.currency=n,this.minFractionDigits=i,this.maxFractionDigits=a}static parse(e,r){if(e.length!==3)return r.error("Expected two arguments.");let n=r.parse(e[1],1,y);if(!n)return null;let i=e[2];if(typeof i!="object"||Array.isArray(i))return r.error("NumberFormat options argument must be an object.");let a=null;if(i.locale&&(a=r.parse(i.locale,1,k),!a))return null;let o=null;if(i.currency&&(o=r.parse(i.currency,1,k),!o))return null;let s=null;if(i["min-fraction-digits"]&&(s=r.parse(i["min-fraction-digits"],1,y),!s))return null;let l=null;return i["max-fraction-digits"]&&(l=r.parse(i["max-fraction-digits"],1,y),!l)?null:new t(n,a,o,s,l)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.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.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}},yr=class t{constructor(e){this.type=At,this.sections=e}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let n=e[1];if(!Array.isArray(n)&&typeof n=="object")return r.error("First argument must be an image or text section.");let i=[],a=!1;for(let o=1;o<=e.length-1;++o){let s=e[o];if(a&&typeof s=="object"&&!Array.isArray(s)){a=!1;let l=null;if(s["font-scale"]&&(l=r.parse(s["font-scale"],1,y),!l))return null;let u=null;if(s["text-font"]&&(u=r.parse(s["text-font"],1,D(k)),!u))return null;let c=null;if(s["text-color"]&&(c=r.parse(s["text-color"],1,K),!c))return null;let p=null;if(s["vertical-align"]){if(typeof s["vertical-align"]=="string"&&!Sa.includes(s["vertical-align"]))return r.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${s["vertical-align"]}' instead.`);if(p=r.parse(s["vertical-align"],1,k),!p)return null}let m=i[i.length-1];m.scale=l,m.font=u,m.textColor=c,m.verticalAlign=p}else{let l=r.parse(e[o],1,b);if(!l)return null;let u=l.type.kind;if(u!=="string"&&u!=="value"&&u!=="null"&&u!=="resolvedImage")return r.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");a=!0,i.push({content:l,scale:null,font:null,textColor:null,verticalAlign:null})}}return new t(i)}evaluate(e){let r=n=>{let i=n.content.evaluate(e);return M(i)===We?new Ce("",i,null,null,null,n.verticalAlign?n.verticalAlign.evaluate(e):null):new Ce(Re(i),null,n.scale?n.scale.evaluate(e):null,n.font?n.font.evaluate(e).join(","):null,n.textColor?n.textColor.evaluate(e):null,n.verticalAlign?n.verticalAlign.evaluate(e):null)};return new oe(this.sections.map(r))}eachChild(e){for(let r of this.sections)e(r.content),r.scale&&e(r.scale),r.font&&e(r.font),r.textColor&&e(r.textColor),r.verticalAlign&&e(r.verticalAlign)}outputDefined(){return!1}},mr=class t{constructor(e){this.type=We,this.input=e}static parse(e,r){if(e.length!==2)return r.error("Expected two arguments.");let n=r.parse(e[1],1,k);return n?new t(n):r.error("No image name provided.")}evaluate(e){let r=this.input.evaluate(e),n=Q.fromString(r);return n&&e.availableImages&&(n.available=e.availableImages.indexOf(r)>-1),n}eachChild(e){e(this.input)}outputDefined(){return!1}},hr=class t{constructor(e){this.type=y,this.input=e}static parse(e,r){if(e.length!==2)return r.error(`Expected 1 argument, but found ${e.length-1} instead.`);let n=r.parse(e[1],1);return n?n.type.kind!=="array"&&n.type.kind!=="string"&&n.type.kind!=="value"?r.error(`Expected argument of type string or array, but found ${E(n.type)} instead.`):new t(n):null}evaluate(e){let r=this.input.evaluate(e);if(typeof r=="string")return[...r].length;if(Array.isArray(r))return r.length;throw new A(`Expected value to be of type string or array, but found ${E(M(r))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}},Z=8192;function Wa(t,e){let r=Ka(t[0]),n=Xa(t[1]),i=Math.pow(2,e.z);return[Math.round(r*i*Z),Math.round(n*i*Z)]}function zr(t,e){let r=Math.pow(2,e.z),n=(t[0]/Z+e.x)/r,i=(t[1]/Z+e.y)/r;return[Za(n),Ya(i)]}function Ka(t){return(180+t)/360}function Za(t){return t*360-180}function Xa(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function Ya(t){return 360/Math.PI*Math.atan(Math.exp((180-t*360)*Math.PI/180))-90}function Ke(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.max(t[2],e[0]),t[3]=Math.max(t[3],e[1])}function De(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function Qa(t,e,r){return e[1]>t[1]!=r[1]>t[1]&&t[0]<(r[0]-e[0])*(t[1]-e[1])/(r[1]-e[1])+e[0]}function eo(t,e,r){let n=t[0]-e[0],i=t[1]-e[1],a=t[0]-r[0],o=t[1]-r[1];return n*o-a*i===0&&n*a<=0&&i*o<=0}function Rt(t,e,r,n){let i=[e[0]-t[0],e[1]-t[1]],a=[n[0]-r[0],n[1]-r[1]];return io(a,i)===0?!1:!!(an(t,e,r,n)&&an(r,n,t,e))}function to(t,e,r){for(let n of r)for(let i=0;i<n.length-1;++i)if(Rt(t,e,n[i],n[i+1]))return!0;return!1}function Ae(t,e,r=!1){let n=!1;for(let i of e)for(let a=0;a<i.length-1;a++){if(eo(t,i[a],i[a+1]))return r;Qa(t,i[a],i[a+1])&&(n=!n)}return n}function ro(t,e){for(let r of e)if(Ae(t,r))return!0;return!1}function Rn(t,e){for(let r of t)if(!Ae(r,e))return!1;for(let r=0;r<t.length-1;++r)if(to(t[r],t[r+1],e))return!1;return!0}function no(t,e){for(let r of e)if(Rn(t,r))return!0;return!1}function io(t,e){return t[0]*e[1]-t[1]*e[0]}function an(t,e,r,n){let i=t[0]-r[0],a=t[1]-r[1],o=e[0]-r[0],s=e[1]-r[1],l=n[0]-r[0],u=n[1]-r[1],c=i*u-l*a,p=o*u-l*s;return c>0&&p<0||c<0&&p>0}function Ar(t,e,r){let n=[];for(let i=0;i<t.length;i++){let a=[];for(let o=0;o<t[i].length;o++){let s=Wa(t[i][o],r);Ke(e,s),a.push(s)}n.push(a)}return n}function qn(t,e,r){let n=[];for(let i=0;i<t.length;i++){let a=Ar(t[i],e,r);n.push(a)}return n}function Tn(t,e,r,n){if(t[0]<r[0]||t[0]>r[2]){let i=n*.5,a=t[0]-r[0]>i?-n:r[0]-t[0]>i?n:0;a===0&&(a=t[0]-r[2]>i?-n:r[2]-t[0]>i?n:0),t[0]+=a}Ke(e,t)}function ao(t){t[0]=t[1]=1/0,t[2]=t[3]=-1/0}function on(t,e,r,n){let i=Math.pow(2,n.z)*Z,a=[n.x*Z,n.y*Z],o=[];for(let s of t)for(let l of s){let u=[l.x+a[0],l.y+a[1]];Tn(u,e,r,i),o.push(u)}return o}function sn(t,e,r,n){let i=Math.pow(2,n.z)*Z,a=[n.x*Z,n.y*Z],o=[];for(let s of t){let l=[];for(let u of s){let c=[u.x+a[0],u.y+a[1]];Ke(e,c),l.push(c)}o.push(l)}if(e[2]-e[0]<=i/2){ao(e);for(let s of o)for(let l of s)Tn(l,e,r,i)}return o}function oo(t,e){let r=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],i=t.canonicalID();if(e.type==="Polygon"){let a=Ar(e.coordinates,n,i),o=on(t.geometry(),r,n,i);if(!De(r,n))return!1;for(let s of o)if(!Ae(s,a))return!1}if(e.type==="MultiPolygon"){let a=qn(e.coordinates,n,i),o=on(t.geometry(),r,n,i);if(!De(r,n))return!1;for(let s of o)if(!ro(s,a))return!1}return!0}function so(t,e){let r=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],i=t.canonicalID();if(e.type==="Polygon"){let a=Ar(e.coordinates,n,i),o=sn(t.geometry(),r,n,i);if(!De(r,n))return!1;for(let s of o)if(!Rn(s,a))return!1}if(e.type==="MultiPolygon"){let a=qn(e.coordinates,n,i),o=sn(t.geometry(),r,n,i);if(!De(r,n))return!1;for(let s of o)if(!no(s,a))return!1}return!0}var _e=class t{constructor(e,r){this.type=w,this.geojson=e,this.geometries=r}static parse(e,r){if(e.length!==2)return r.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Ne(e[1])){let n=e[1];if(n.type==="FeatureCollection"){let i=[];for(let a of n.features){let{type:o,coordinates:s}=a.geometry;o==="Polygon"&&i.push(s),o==="MultiPolygon"&&i.push(...s)}if(i.length){let a={type:"MultiPolygon",coordinates:i};return new t(n,a)}}else if(n.type==="Feature"){let i=n.geometry.type;if(i==="Polygon"||i==="MultiPolygon")return new t(n,n.geometry)}else if(n.type==="Polygon"||n.type==="MultiPolygon")return new t(n,n)}return r.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 oo(e,this.geometries);if(e.geometryType()==="LineString")return so(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}},dt=class{constructor(e=[],r=(n,i)=>n<i?-1:n>i?1:0){if(this.data=e,this.length=this.data.length,this.compare=r,this.length>0)for(let n=(this.length>>1)-1;n>=0;n--)this._down(n)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;let e=this.data[0],r=this.data.pop();return--this.length>0&&(this.data[0]=r,this._down(0)),e}peek(){return this.data[0]}_up(e){let{data:r,compare:n}=this,i=r[e];for(;e>0;){let a=e-1>>1,o=r[a];if(n(i,o)>=0)break;r[e]=o,e=a}r[e]=i}_down(e){let{data:r,compare:n}=this,i=this.length>>1,a=r[e];for(;e<i;){let o=(e<<1)+1,s=o+1;if(s<this.length&&n(r[s],r[o])<0&&(o=s),n(r[o],a)>=0)break;r[e]=r[o],e=o}r[e]=a}};function jn(t,e,r=0,n=t.length-1,i=lo){for(;n>r;){if(n-r>600){let l=n-r+1,u=e-r+1,c=Math.log(l),p=.5*Math.exp(2*c/3),m=.5*Math.sqrt(c*p*(l-p)/l)*(u-l/2<0?-1:1),d=Math.max(r,Math.floor(e-u*p/l+m)),g=Math.min(n,Math.floor(e+(l-u)*p/l+m));jn(t,e,d,g,i)}let a=t[e],o=r,s=n;for(Me(t,r,e),i(t[n],a)>0&&Me(t,r,n);o<s;){for(Me(t,o,s),o++,s--;i(t[o],a)<0;)o++;for(;i(t[s],a)>0;)s--}i(t[r],a)===0?Me(t,r,s):(s++,Me(t,s,n)),s<=e&&(r=s+1),e<=s&&(n=s-1)}}function Me(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}function lo(t,e){return t<e?-1:t>e?1:0}function uo(t,e){if(t.length<=1)return[t];let n=[],i,a;for(let o of t){let s=po(o);s!==0&&(o.area=Math.abs(s),a===void 0&&(a=s<0),a===s<0?(i&&n.push(i),i=[o]):i.push(o))}if(i&&n.push(i),e>1)for(let o=0;o<n.length;o++)n[o].length<=e||(jn(n[o],e,1,n[o].length-1,co),n[o]=n[o].slice(0,e));return n}function co(t,e){return e.area-t.area}function po(t){let e=0;for(let r=0,n=t.length,i=n-1,a,o;r<n;i=r++)a=t[r],o=t[i],e+=(o.x-a.x)*(a.y+o.y);return e}var fo=6378.137,ln=1/298.257223563,un=ln*(2-ln),cn=Math.PI/180,Fe=class{constructor(e){let r=cn*fo*1e3,n=Math.cos(e*cn),i=1/(1-un*(1-n*n)),a=Math.sqrt(i);this.kx=r*a*n,this.ky=r*a*i*(1-un)}distance(e,r){let n=this.wrap(e[0]-r[0])*this.kx,i=(e[1]-r[1])*this.ky;return Math.sqrt(n*n+i*i)}pointOnLine(e,r){let n=1/0,i,a,o,s;for(let l=0;l<e.length-1;l++){let u=e[l][0],c=e[l][1],p=this.wrap(e[l+1][0]-u)*this.kx,m=(e[l+1][1]-c)*this.ky,d=0;(p!==0||m!==0)&&(d=(this.wrap(r[0]-u)*this.kx*p+(r[1]-c)*this.ky*m)/(p*p+m*m),d>1?(u=e[l+1][0],c=e[l+1][1]):d>0&&(u+=p/this.kx*d,c+=m/this.ky*d)),p=this.wrap(r[0]-u)*this.kx,m=(r[1]-c)*this.ky;let g=p*p+m*m;g<n&&(n=g,i=u,a=c,o=l,s=d)}return{point:[i,a],index:o,t:Math.max(0,Math.min(1,s))}}wrap(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}},gr=100,vr=50;function Cn(t,e){return e[0]-t[0]}function yt(t){return t[1]-t[0]+1}function ee(t,e){return t[1]>=t[0]&&t[1]<e}function br(t,e){if(t[0]>t[1])return[null,null];let r=yt(t);if(e){if(r===2)return[t,null];let i=Math.floor(r/2);return[[t[0],t[0]+i],[t[0]+i,t[1]]]}if(r===1)return[t,null];let n=Math.floor(r/2)-1;return[[t[0],t[0]+n],[t[0]+n+1,t[1]]]}function wr(t,e){if(!ee(e,t.length))return[1/0,1/0,-1/0,-1/0];let r=[1/0,1/0,-1/0,-1/0];for(let n=e[0];n<=e[1];++n)Ke(r,t[n]);return r}function xr(t){let e=[1/0,1/0,-1/0,-1/0];for(let r of t)for(let n of r)Ke(e,n);return e}function pn(t){return t[0]!==-1/0&&t[1]!==-1/0&&t[2]!==1/0&&t[3]!==1/0}function Er(t,e,r){if(!pn(t)||!pn(e))return NaN;let n=0,i=0;return t[2]<e[0]&&(n=e[0]-t[2]),t[0]>e[2]&&(n=t[0]-e[2]),t[1]>e[3]&&(i=t[1]-e[3]),t[3]<e[1]&&(i=e[1]-t[3]),r.distance([0,0],[n,i])}function pe(t,e,r){let n=r.pointOnLine(e,t);return r.distance(t,n.point)}function Ir(t,e,r,n,i){let a=Math.min(pe(t,[r,n],i),pe(e,[r,n],i)),o=Math.min(pe(r,[t,e],i),pe(n,[t,e],i));return Math.min(a,o)}function yo(t,e,r,n,i){if(!(ee(e,t.length)&&ee(n,r.length)))return 1/0;let o=1/0;for(let s=e[0];s<e[1];++s){let l=t[s],u=t[s+1];for(let c=n[0];c<n[1];++c){let p=r[c],m=r[c+1];if(Rt(l,u,p,m))return 0;o=Math.min(o,Ir(l,u,p,m,i))}}return o}function mo(t,e,r,n,i){if(!(ee(e,t.length)&&ee(n,r.length)))return NaN;let o=1/0;for(let s=e[0];s<=e[1];++s)for(let l=n[0];l<=n[1];++l)if(o=Math.min(o,i.distance(t[s],r[l])),o===0)return o;return o}function ho(t,e,r){if(Ae(t,e,!0))return 0;let n=1/0;for(let i of e){let a=i[0],o=i[i.length-1];if(a!==o&&(n=Math.min(n,pe(t,[o,a],r)),n===0))return n;let s=r.pointOnLine(i,t);if(n=Math.min(n,r.distance(t,s.point)),n===0)return n}return n}function go(t,e,r,n){if(!ee(e,t.length))return NaN;for(let a=e[0];a<=e[1];++a)if(Ae(t[a],r,!0))return 0;let i=1/0;for(let a=e[0];a<e[1];++a){let o=t[a],s=t[a+1];for(let l of r)for(let u=0,c=l.length,p=c-1;u<c;p=u++){let m=l[p],d=l[u];if(Rt(o,s,m,d))return 0;i=Math.min(i,Ir(o,s,m,d,n))}}return i}function fn(t,e){for(let r of t)for(let n of r)if(Ae(n,e,!0))return!0;return!1}function vo(t,e,r,n=1/0){let i=xr(t),a=xr(e);if(n!==1/0&&Er(i,a,r)>=n)return n;if(De(i,a)){if(fn(t,e))return 0}else if(fn(e,t))return 0;let o=1/0;for(let s of t)for(let l=0,u=s.length,c=u-1;l<u;c=l++){let p=s[c],m=s[l];for(let d of e)for(let g=0,h=d.length,O=h-1;g<h;O=g++){let v=d[O],z=d[g];if(Rt(p,m,v,z))return 0;o=Math.min(o,Ir(p,m,v,z,r))}}return o}function dn(t,e,r,n,i,a){if(!a)return;let o=Er(wr(n,a),i,r);o<e&&t.push([o,a,[0,0]])}function nt(t,e,r,n,i,a,o){if(!a||!o)return;let s=Er(wr(n,a),wr(i,o),r);s<e&&t.push([s,a,o])}function mt(t,e,r,n,i=1/0){let a=Math.min(n.distance(t[0],r[0][0]),i);if(a===0)return a;let o=new dt([[0,[0,t.length-1],[0,0]]],Cn),s=xr(r);for(;o.length>0;){let l=o.pop();if(l[0]>=a)continue;let u=l[1],c=e?vr:gr;if(yt(u)<=c){if(!ee(u,t.length))return NaN;if(e){let p=go(t,u,r,n);if(isNaN(p)||p===0)return p;a=Math.min(a,p)}else for(let p=u[0];p<=u[1];++p){let m=ho(t[p],r,n);if(a=Math.min(a,m),a===0)return 0}}else{let p=br(u,e);dn(o,a,n,t,s,p[0]),dn(o,a,n,t,s,p[1])}}return a}function ht(t,e,r,n,i,a=1/0){let o=Math.min(a,i.distance(t[0],r[0]));if(o===0)return o;let s=new dt([[0,[0,t.length-1],[0,r.length-1]]],Cn);for(;s.length>0;){let l=s.pop();if(l[0]>=o)continue;let u=l[1],c=l[2],p=e?vr:gr,m=n?vr:gr;if(yt(u)<=p&&yt(c)<=m){if(!ee(u,t.length)&&ee(c,r.length))return NaN;let d;if(e&&n)d=yo(t,u,r,c,i),o=Math.min(o,d);else if(e&&!n){let g=t.slice(u[0],u[1]+1);for(let h=c[0];h<=c[1];++h)if(d=pe(r[h],g,i),o=Math.min(o,d),o===0)return o}else if(!e&&n){let g=r.slice(c[0],c[1]+1);for(let h=u[0];h<=u[1];++h)if(d=pe(t[h],g,i),o=Math.min(o,d),o===0)return o}else d=mo(t,u,r,c,i),o=Math.min(o,d)}else{let d=br(u,e),g=br(c,n);nt(s,o,i,t,r,d[0],g[0]),nt(s,o,i,t,r,d[0],g[1]),nt(s,o,i,t,r,d[1],g[0]),nt(s,o,i,t,r,d[1],g[1])}}return o}function bo(t,e){let r=t.geometry(),n=r.flat().map(o=>zr([o.x,o.y],t.canonical));if(r.length===0)return NaN;let i=new Fe(n[0][1]),a=1/0;for(let o of e){switch(o.type){case"Point":a=Math.min(a,ht(n,!1,[o.coordinates],!1,i,a));break;case"LineString":a=Math.min(a,ht(n,!1,o.coordinates,!0,i,a));break;case"Polygon":a=Math.min(a,mt(n,!1,o.coordinates,i,a));break}if(a===0)return a}return a}function wo(t,e){let r=t.geometry(),n=r.flat().map(o=>zr([o.x,o.y],t.canonical));if(r.length===0)return NaN;let i=new Fe(n[0][1]),a=1/0;for(let o of e){switch(o.type){case"Point":a=Math.min(a,ht(n,!0,[o.coordinates],!1,i,a));break;case"LineString":a=Math.min(a,ht(n,!0,o.coordinates,!0,i,a));break;case"Polygon":a=Math.min(a,mt(n,!0,o.coordinates,i,a));break}if(a===0)return a}return a}function xo(t,e){let r=t.geometry();if(r.length===0||r[0].length===0)return NaN;let n=uo(r,0).map(o=>o.map(s=>s.map(l=>zr([l.x,l.y],t.canonical)))),i=new Fe(n[0][0][0][1]),a=1/0;for(let o of e)for(let s of n){switch(o.type){case"Point":a=Math.min(a,mt([o.coordinates],!1,s,i,a));break;case"LineString":a=Math.min(a,mt(o.coordinates,!0,s,i,a));break;case"Polygon":a=Math.min(a,vo(s,o.coordinates,i,a));break}if(a===0)return a}return a}function nr(t){return t.type==="MultiPolygon"?t.coordinates.map(e=>({type:"Polygon",coordinates:e})):t.type==="MultiLineString"?t.coordinates.map(e=>({type:"LineString",coordinates:e})):t.type==="MultiPoint"?t.coordinates.map(e=>({type:"Point",coordinates:e})):[t]}var Le=class t{constructor(e,r){this.type=y,this.geojson=e,this.geometries=r}static parse(e,r){if(e.length!==2)return r.error(`'distance' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Ne(e[1])){let n=e[1];if(n.type==="FeatureCollection")return new t(n,n.features.map(i=>nr(i.geometry)).flat());if(n.type==="Feature")return new t(n,nr(n.geometry));if("type"in n&&"coordinates"in n)return new t(n,nr(n))}return r.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 bo(e,this.geometries);if(e.geometryType()==="LineString")return wo(e,this.geometries);if(e.geometryType()==="Polygon")return xo(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}},Ve=class t{constructor(e){this.type=b,this.key=e}static parse(e,r){if(e.length!==2)return r.error(`Expected 1 argument, but found ${e.length-1} instead.`);let n=e[1];return n==null?r.error("Global state property must be defined."):typeof n!="string"?r.error(`Global state property must be string, but found ${typeof e[1]} instead.`):new t(n)}evaluate(e){var r;let n=(r=e.globals)===null||r===void 0?void 0:r.globalState;return!n||Object.keys(n).length===0?null:Pe(n,this.key)}eachChild(){}outputDefined(){return!1}},Mr={"==":Va,"!=":Ua,">":Ja,"<":Ba,">=":Ga,"<=":Ha,array:B,at:sr,boolean:B,case:pr,coalesce:pt,collator:ft,format:yr,image:mr,in:lr,"index-of":ur,interpolate:J,"interpolate-hcl":J,"interpolate-lab":J,length:hr,let:lt,literal:Oe,match:cr,number:B,"number-format":dr,object:B,slice:fr,step:ct,string:B,"to-boolean":ie,"to-color":ie,"to-number":ie,"to-string":ie,var:ut,within:_e,distance:Le,"global-state":Ve},le=class t{constructor(e,r,n,i){this.name=e,this.type=r,this._evaluate=n,this.args=i}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,r){let n=e[0],i=t.definitions[n];if(!i)return r.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0);let a=Array.isArray(i)?i[0]:i.type,o=Array.isArray(i)?[[i[1],i[2]]]:i.overloads,s=o.filter(([u])=>!Array.isArray(u)||u.length===e.length-1),l=null;for(let[u,c]of s){l=new st(r.registry,gt,r.path,null,r.scope);let p=[],m=!1;for(let d=1;d<e.length;d++){let g=e[d],h=Array.isArray(u)?u[d-1]:u.type,O=l.parse(g,1+p.length,h);if(!O){m=!0;break}p.push(O)}if(!m){if(Array.isArray(u)&&u.length!==p.length){l.error(`Expected ${u.length} arguments, but found ${p.length} instead.`);continue}for(let d=0;d<p.length;d++){let g=Array.isArray(u)?u[d]:u.type,h=p[d];l.concat(d+1).checkSubtype(g,h.type)}if(l.errors.length===0)return new t(n,a,c,p)}}if(s.length===1)r.errors.push(...l.errors);else{let c=(s.length?s:o).map(([m])=>So(m)).join(" | "),p=[];for(let m=1;m<e.length;m++){let d=r.parse(e[m],1+p.length);if(!d)return null;p.push(E(d.type))}r.error(`Expected arguments of type ${c}, but found (${p.join(", ")}) instead.`)}return null}static register(e,r){t.definitions=r;for(let n in r)e[n]=t}};function yn(t,[e,r,n,i]){e=e.evaluate(t),r=r.evaluate(t),n=n.evaluate(t);let a=i?i.evaluate(t):1,o=In(e,r,n,a);if(o)throw new A(o);return new $(e/255,r/255,n/255,a,!1)}function mn(t,e){return t in e}function ir(t,e){let r=e[t];return typeof r>"u"?null:r}function ko(t,e,r,n){for(;r<=n;){let i=r+n>>1;if(e[i]===t)return!0;e[i]>t?n=i-1:r=i+1}return!1}function ce(t){return{type:t}}le.register(Mr,{error:[pa,[k],(t,[e])=>{throw new A(e.evaluate(t))}],typeof:[k,[b],(t,[e])=>E(M(e.evaluate(t)))],"to-rgba":[D(y,4),[K],(t,[e])=>{let[r,n,i,a]=e.evaluate(t).rgb;return[r*255,n*255,i*255,a]}],rgb:[K,[y,y,y],yn],rgba:[K,[y,y,y,y],yn],has:{type:w,overloads:[[[k],(t,[e])=>mn(e.evaluate(t),t.properties())],[[k,fe],(t,[e,r])=>mn(e.evaluate(t),r.evaluate(t))]]},get:{type:b,overloads:[[[k],(t,[e])=>ir(e.evaluate(t),t.properties())],[[k,fe],(t,[e,r])=>ir(e.evaluate(t),r.evaluate(t))]]},"feature-state":[b,[k],(t,[e])=>ir(e.evaluate(t),t.featureState||{})],properties:[fe,[],t=>t.properties()],"geometry-type":[k,[],t=>t.geometryType()],id:[b,[],t=>t.id()],zoom:[y,[],t=>t.globals.zoom],"heatmap-density":[y,[],t=>t.globals.heatmapDensity||0],elevation:[y,[],t=>t.globals.elevation||0],"line-progress":[y,[],t=>t.globals.lineProgress||0],accumulated:[b,[],t=>t.globals.accumulated===void 0?null:t.globals.accumulated],"+":[y,ce(y),(t,e)=>{let r=0;for(let n of e)r+=n.evaluate(t);return r}],"*":[y,ce(y),(t,e)=>{let r=1;for(let n of e)r*=n.evaluate(t);return r}],"-":{type:y,overloads:[[[y,y],(t,[e,r])=>e.evaluate(t)-r.evaluate(t)],[[y],(t,[e])=>-e.evaluate(t)]]},"/":[y,[y,y],(t,[e,r])=>e.evaluate(t)/r.evaluate(t)],"%":[y,[y,y],(t,[e,r])=>e.evaluate(t)%r.evaluate(t)],ln2:[y,[],()=>Math.LN2],pi:[y,[],()=>Math.PI],e:[y,[],()=>Math.E],"^":[y,[y,y],(t,[e,r])=>Math.pow(e.evaluate(t),r.evaluate(t))],sqrt:[y,[y],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[y,[y],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[y,[y],(t,[e])=>Math.log(e.evaluate(t))],log2:[y,[y],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[y,[y],(t,[e])=>Math.sin(e.evaluate(t))],cos:[y,[y],(t,[e])=>Math.cos(e.evaluate(t))],tan:[y,[y],(t,[e])=>Math.tan(e.evaluate(t))],asin:[y,[y],(t,[e])=>Math.asin(e.evaluate(t))],acos:[y,[y],(t,[e])=>Math.acos(e.evaluate(t))],atan:[y,[y],(t,[e])=>Math.atan(e.evaluate(t))],min:[y,ce(y),(t,e)=>Math.min(...e.map(r=>r.evaluate(t)))],max:[y,ce(y),(t,e)=>Math.max(...e.map(r=>r.evaluate(t)))],abs:[y,[y],(t,[e])=>Math.abs(e.evaluate(t))],round:[y,[y],(t,[e])=>{let r=e.evaluate(t);return r<0?-Math.round(-r):Math.round(r)}],floor:[y,[y],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[y,[y],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[w,[k,b],(t,[e,r])=>t.properties()[e.value]===r.value],"filter-id-==":[w,[b],(t,[e])=>t.id()===e.value],"filter-type-==":[w,[k],(t,[e])=>t.geometryType()===e.value],"filter-<":[w,[k,b],(t,[e,r])=>{let n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n<i}],"filter-id-<":[w,[b],(t,[e])=>{let r=t.id(),n=e.value;return typeof r==typeof n&&r<n}],"filter->":[w,[k,b],(t,[e,r])=>{let n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n>i}],"filter-id->":[w,[b],(t,[e])=>{let r=t.id(),n=e.value;return typeof r==typeof n&&r>n}],"filter-<=":[w,[k,b],(t,[e,r])=>{let n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n<=i}],"filter-id-<=":[w,[b],(t,[e])=>{let r=t.id(),n=e.value;return typeof r==typeof n&&r<=n}],"filter->=":[w,[k,b],(t,[e,r])=>{let n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n>=i}],"filter-id->=":[w,[b],(t,[e])=>{let r=t.id(),n=e.value;return typeof r==typeof n&&r>=n}],"filter-has":[w,[b],(t,[e])=>e.value in t.properties()],"filter-has-id":[w,[],t=>t.id()!==null&&t.id()!==void 0],"filter-type-in":[w,[D(k)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[w,[D(b)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[w,[k,D(b)],(t,[e,r])=>r.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[w,[k,D(b)],(t,[e,r])=>ko(t.properties()[e.value],r.value,0,r.value.length-1)],all:{type:w,overloads:[[[w,w],(t,[e,r])=>e.evaluate(t)&&r.evaluate(t)],[ce(w),(t,e)=>{for(let r of e)if(!r.evaluate(t))return!1;return!0}]]},any:{type:w,overloads:[[[w,w],(t,[e,r])=>e.evaluate(t)||r.evaluate(t)],[ce(w),(t,e)=>{for(let r of e)if(r.evaluate(t))return!0;return!1}]]},"!":[w,[w],(t,[e])=>!e.evaluate(t)],"is-supported-script":[w,[k],(t,[e])=>{let r=t.globals&&t.globals.isSupportedScript;return r?r(e.evaluate(t)):!0}],upcase:[k,[k],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[k,[k],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[k,ce(b),(t,e)=>e.map(r=>Re(r.evaluate(t))).join("")],"resolved-locale":[k,[zt],(t,[e])=>e.evaluate(t).resolvedLocale()]});function So(t){return Array.isArray(t)?`(${t.map(E).join(", ")})`:`(${E(t.type)}...)`}function gt(t){if(t instanceof ut)return gt(t.boundExpression);if(t instanceof le&&t.name==="error")return!1;if(t instanceof ft)return!1;if(t instanceof _e)return!1;if(t instanceof Le)return!1;if(t instanceof Ve)return!1;let e=t instanceof ie||t instanceof B,r=!0;return t.eachChild(n=>{e?r=r&&gt(n):r=r&&n instanceof Oe}),r?qt(t)&&Tt(t,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"]):!1}function qt(t){if(t instanceof le){if(t.name==="get"&&t.args.length===1)return!1;if(t.name==="feature-state")return!1;if(t.name==="has"&&t.args.length===1)return!1;if(t.name==="properties"||t.name==="geometry-type"||t.name==="id")return!1;if(/^filter-/.test(t.name))return!1}if(t instanceof _e||t instanceof Le)return!1;let e=!0;return t.eachChild(r=>{e&&!qt(r)&&(e=!1)}),e}function Ue(t){if(t instanceof le&&t.name==="feature-state")return!1;let e=!0;return t.eachChild(r=>{e&&!Ue(r)&&(e=!1)}),e}function Tt(t,e){if(t instanceof le&&e.indexOf(t.name)>=0)return!1;let r=!0;return t.eachChild(n=>{r&&!Tt(n,e)&&(r=!1)}),r}function kr(t){return{result:"success",value:t}}function be(t){return{result:"error",value:t}}function vt(t){return t["property-type"]==="data-driven"||t["property-type"]==="cross-faded-data-driven"}function Nn(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function Pr(t){return!!t.expression&&t.expression.interpolated}function S(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":t===null?"null":typeof t}function jt(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)&&M(t)===fe}function Oo(t){return t}function $o(t){switch(t.type){case"color":return $.parse;case"padding":return V.parse;case"numberArray":return U.parse;case"colorArray":return N.parse;default:return null}}function zo(t){switch(t){case"exponential":return _n;case"interval":return Eo;case"categorical":return Ao;case"identity":return Io;default:throw new Error(`Unknown function type "${t}"`)}}function Dn(t,e){let r=t.stops&&typeof t.stops[0][0]=="object",n=r||t.property!==void 0,i=r||!n,a=t.type||(Pr(e)?"exponential":"interval"),o=$o(e);if(o&&(t=ke({},t),t.stops&&(t.stops=t.stops.map(c=>[c[0],o(c[1])])),t.default?t.default=o(t.default):t.default=o(e.default)),t.colorSpace&&!ka(t.colorSpace))throw new Error(`Unknown color space: "${t.colorSpace}"`);let s=zo(a),l,u;if(a==="categorical"){l=Object.create(null);for(let c of t.stops)l[c[0]]=c[1];u=typeof t.stops[0][0]}if(r){let c={},p=[];for(let g=0;g<t.stops.length;g++){let h=t.stops[g],O=h[0].zoom;c[O]===void 0&&(c[O]={zoom:O,type:t.type,property:t.property,default:t.default,stops:[]},p.push(O)),c[O].stops.push([h[0].value,h[1]])}let m=[];for(let g of p)m.push([c[g].zoom,Dn(c[g],e)]);let d={name:"linear"};return{kind:"composite",interpolationType:d,interpolationFactor:J.interpolationFactor.bind(void 0,d),zoomStops:m.map(g=>g[0]),evaluate({zoom:g},h){return _n({stops:m,base:t.base},e,g).evaluate(g,h)}}}else if(i){let c=a==="exponential"?{name:"exponential",base:t.base!==void 0?t.base:1}:null;return{kind:"camera",interpolationType:c,interpolationFactor:J.interpolationFactor.bind(void 0,c),zoomStops:t.stops.map(p=>p[0]),evaluate:({zoom:p})=>s(t,e,p,l,u)}}else return{kind:"source",evaluate(c,p){let m=p&&p.properties?p.properties[t.property]:void 0;return m===void 0?Ze(t.default,e.default):s(t,e,m,l,u)}}}function Ze(t,e,r){if(t!==void 0)return t;if(e!==void 0)return e;if(r!==void 0)return r}function Ao(t,e,r,n,i){let a=typeof r===i?n[r]:void 0;return Ze(a,t.default,e.default)}function Eo(t,e,r){if(S(r)!=="number")return Ze(t.default,e.default);let n=t.stops.length;if(n===1||r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[n-1][0])return t.stops[n-1][1];let i=Pt(t.stops.map(a=>a[0]),r);return t.stops[i][1]}function _n(t,e,r){let n=t.base!==void 0?t.base:1;if(S(r)!=="number")return Ze(t.default,e.default);let i=t.stops.length;if(i===1||r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[i-1][0])return t.stops[i-1][1];let a=Pt(t.stops.map(c=>c[0]),r),o=Mo(r,n,t.stops[a][0],t.stops[a+1][0]),s=t.stops[a][1],l=t.stops[a+1][1],u=Ma[e.type]||Oo;return typeof s.evaluate=="function"?{evaluate(...c){let p=s.evaluate.apply(void 0,c),m=l.evaluate.apply(void 0,c);if(!(p===void 0||m===void 0))return u(p,m,o,t.colorSpace)}}:u(s,l,o,t.colorSpace)}function Io(t,e,r){switch(e.type){case"color":r=$.parse(r);break;case"formatted":r=oe.fromString(r.toString());break;case"resolvedImage":r=Q.fromString(r.toString());break;case"padding":r=V.parse(r);break;case"colorArray":r=N.parse(r);break;case"numberArray":r=U.parse(r);break;default:S(r)!==e.type&&(e.type!=="enum"||!e.values[r])&&(r=void 0)}return Ze(r,t.default,e.default)}function Mo(t,e,r,n){let i=n-r,a=t-r;return i===0?0:e===1?a/i:(Math.pow(e,a)-1)/(Math.pow(e,i)-1)}var bt=class{constructor(e,r){this.expression=e,this._warningHistory={},this._evaluator=new ot,this._defaultValue=r?To(r):null,this._enumValues=r&&r.type==="enum"?r.values:null}evaluateWithoutErrorHandling(e,r,n,i,a,o){return this._evaluator.globals=e,this._evaluator.feature=r,this._evaluator.featureState=n,this._evaluator.canonical=i,this._evaluator.availableImages=a||null,this._evaluator.formattedSection=o,this.expression.evaluate(this._evaluator)}evaluate(e,r,n,i,a,o){this._evaluator.globals=e,this._evaluator.feature=r||null,this._evaluator.featureState=n||null,this._evaluator.canonical=i,this._evaluator.availableImages=a||null,this._evaluator.formattedSection=o||null;try{let s=this.expression.evaluate(this._evaluator);if(s==null||typeof s=="number"&&s!==s)return this._defaultValue;if(this._enumValues&&!(s in this._enumValues))throw new A(`Expected value to be one of ${Object.keys(this._enumValues).map(l=>JSON.stringify(l)).join(", ")}, but found ${JSON.stringify(s)} instead.`);return s}catch(s){return this._warningHistory[s.message]||(this._warningHistory[s.message]=!0,typeof console<"u"&&console.warn(s.message)),this._defaultValue}}};function Ct(t){return Array.isArray(t)&&t.length>0&&typeof t[0]=="string"&&t[0]in Mr}function Nt(t,e){let r=new st(Mr,gt,[],e?qo(e):void 0),n=r.parse(t,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return n?kr(new bt(n,e)):be(r.errors)}var Be=class{constructor(e,r){this.kind=e,this._styleExpression=r,this.isStateDependent=e!=="constant"&&!Ue(r.expression),this.globalStateRefs=Dt(r.expression)}evaluateWithoutErrorHandling(e,r,n,i,a,o){return this._styleExpression.evaluateWithoutErrorHandling(e,r,n,i,a,o)}evaluate(e,r,n,i,a,o){return this._styleExpression.evaluate(e,r,n,i,a,o)}},Je=class{constructor(e,r,n,i){this.kind=e,this.zoomStops=n,this._styleExpression=r,this.isStateDependent=e!=="camera"&&!Ue(r.expression),this.globalStateRefs=Dt(r.expression),this.interpolationType=i}evaluateWithoutErrorHandling(e,r,n,i,a,o){return this._styleExpression.evaluateWithoutErrorHandling(e,r,n,i,a,o)}evaluate(e,r,n,i,a,o){return this._styleExpression.evaluate(e,r,n,i,a,o)}interpolationFactor(e,r,n){return this.interpolationType?J.interpolationFactor(this.interpolationType,e,r,n):0}};function Po(t){return t._styleExpression!==void 0}function Rr(t,e){let r=Nt(t,e);if(r.result==="error")return r;let n=r.value.expression,i=qt(n);if(!i&&!vt(e))return be([new F("","data expressions not supported")]);let a=Tt(n,["zoom"]);if(!a&&!Nn(e))return be([new F("","zoom expressions not supported")]);let o=at(n);if(!o&&!a)return be([new F("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(o instanceof F)return be([o]);if(o instanceof J&&!Pr(e))return be([new F("",'"interpolate" expressions cannot be used with this property')]);if(!o)return kr(i?new Be("constant",r.value):new Be("source",r.value));let s=o instanceof J?o.interpolation:void 0;return kr(i?new Je("camera",r.value,o.labels,s):new Je("composite",r.value,o.labels,s))}var wt=class t{constructor(e,r){this._parameters=e,this._specification=r,ke(this,Dn(this._parameters,this._specification))}static deserialize(e){return new t(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}};function Ro(t,e){if(jt(t))return new wt(t,e);if(Ct(t)){let r=Rr(t,e);if(r.result==="error")throw new Error(r.value.map(n=>`${n.key}: ${n.message}`).join(", "));return r.value}else{let r=t;return e.type==="color"&&typeof t=="string"?r=$.parse(t):e.type==="padding"&&(typeof t=="number"||Array.isArray(t))?r=V.parse(t):e.type==="numberArray"&&(typeof t=="number"||Array.isArray(t))?r=U.parse(t):e.type==="colorArray"&&(typeof t=="string"||Array.isArray(t))?r=N.parse(t):e.type==="variableAnchorOffsetCollection"&&Array.isArray(t)?r=X.parse(t):e.type==="projectionDefinition"&&typeof t=="string"&&(r=se.parse(t)),{globalStateRefs:new Set,kind:"constant",evaluate:()=>r}}}function at(t){let e=null;if(t instanceof lt)e=at(t.result);else if(t instanceof pt){for(let r of t.args)if(e=at(r),e)break}else(t instanceof ct||t instanceof J)&&t.input instanceof le&&t.input.name==="zoom"&&(e=t);return e instanceof F||t.eachChild(r=>{let n=at(r);n instanceof F?e=n:!e&&n?e=new F("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&n&&e!==n&&(e=new F("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function Dt(t,e=new Set){return t instanceof Ve&&e.add(t.key),t.eachChild(r=>{Dt(r,e)}),e}function qo(t){let e={color:K,string:k,number:y,enum:k,boolean:w,formatted:At,padding:Et,numberArray:It,colorArray:qe,projectionDefinition:$t,resolvedImage:We,variableAnchorOffsetCollection:Mt};return t.type==="array"?D(e[t.value]||b,t.length):e[t.type]}function To(t){if(t.type==="color"&&jt(t.default))return new $(0,0,0,0);switch(t.type){case"color":return $.parse(t.default)||null;case"padding":return V.parse(t.default)||null;case"numberArray":return U.parse(t.default)||null;case"colorArray":return N.parse(t.default)||null;case"variableAnchorOffsetCollection":return X.parse(t.default)||null;case"projectionDefinition":return se.parse(t.default)||null;default:return t.default===void 0?null:t.default}}function _t(t){if(t===!0||t===!1)return!0;if(!Array.isArray(t)||t.length===0)return!1;switch(t[0]){case"has":return t.length>=2&&t[1]!=="$id"&&t[1]!=="$type";case"in":return t.length>=3&&(typeof t[1]!="string"||Array.isArray(t[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return t.length!==3||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(let e of t.slice(1))if(!_t(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}var jo={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Vs(t){if(t==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};_t(t)||(t=xt(t));let e=Nt(t,jo);if(e.result==="error")throw new Error(e.value.map(r=>`${r.key}: ${r.message}`).join(", "));{let r=Fn(t);return{filter:(n,i,a)=>e.value.evaluate(n,i,{},a),needGeometry:r,getGlobalStateRefs:()=>Dt(e.value.expression)}}}function Co(t,e){return t<e?-1:t>e?1:0}function Fn(t){if(!Array.isArray(t))return!1;if(t[0]==="within"||t[0]==="distance")return!0;for(let e=1;e<t.length;e++)if(Fn(t[e]))return!0;return!1}function xt(t){if(!t)return!0;let e=t[0];return t.length<=1?e!=="any":e==="=="?ar(t[1],t[2],"=="):e==="!="?it(ar(t[1],t[2],"==")):e==="<"||e===">"||e==="<="||e===">="?ar(t[1],t[2],e):e==="any"?No(t.slice(1)):e==="all"?["all"].concat(t.slice(1).map(xt)):e==="none"?["all"].concat(t.slice(1).map(xt).map(it)):e==="in"?hn(t[1],t.slice(2)):e==="!in"?it(hn(t[1],t.slice(2))):e==="has"?gn(t[1]):e==="!has"?it(gn(t[1])):!0}function ar(t,e,r){switch(t){case"$type":return[`filter-type-${r}`,e];case"$id":return[`filter-id-${r}`,e];default:return[`filter-${r}`,t,e]}}function No(t){return["any"].concat(t.map(xt))}function hn(t,e){if(e.length===0)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(r=>typeof r!=typeof e[0])?["filter-in-large",t,["literal",e.sort(Co)]]:["filter-in-small",t,["literal",e]]}}function gn(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function it(t){return["!",t]}function He(t){return typeof t=="object"?["literal",t]:t}function Us(t,e){let r=t.stops;if(!r)return Do(t,e);let n=r&&typeof r[0][0]=="object",i=n||t.property!==void 0,a=n||!i;return r=r.map(o=>!i&&e.tokens&&typeof o[1]=="string"?[o[0],Vo(o[1])]:[o[0],He(o[1])]),n?_o(t,e,r):a?Lo(t,e,r):Sr(t,e,r)}function Do(t,e){let r=["get",t.property];if(t.default===void 0)return e.type==="string"?["string",r]:r;if(e.type==="enum")return["match",r,Object.keys(e.values),r,t.default];{let n=[e.type==="color"?"to-color":e.type,r,He(t.default)];return e.type==="array"&&n.splice(1,0,e.value,e.length||null),n}}function qr(t){switch(t.colorSpace){case"hcl":return"interpolate-hcl";case"lab":return"interpolate-lab";default:return"interpolate"}}function _o(t,e,r){let n={},i={},a=[];for(let s=0;s<r.length;s++){let l=r[s],u=l[0].zoom;n[u]===void 0&&(n[u]={zoom:u,type:t.type,property:t.property,default:t.default},i[u]=[],a.push(u)),i[u].push([l[0].value,l[1]])}if(jr({},e)==="exponential"){let s=[qr(t),["linear"],["zoom"]];for(let l of a){let u=Sr(n[l],e,i[l]);xe(s,l,u,!1)}return s}else{let s=["step",["zoom"]];for(let l of a){let u=Sr(n[l],e,i[l]);xe(s,l,u,!0)}return Tr(s),s}}function Fo(t,e){if(t!==void 0)return t;if(e!==void 0)return e}function vn(t,e){let r=He(Fo(t.default,e.default));return r===void 0&&e.type==="resolvedImage"?"":r}function Sr(t,e,r){let n=jr(t,e),i=["get",t.property];if(n==="categorical"&&typeof r[0][0]=="boolean"){let a=["case"];for(let o of r)a.push(["==",i,o[0]],o[1]);return a.push(vn(t,e)),a}else if(n==="categorical"){let a=["match",i];for(let o of r)xe(a,o[0],o[1],!1);return a.push(vn(t,e)),a}else if(n==="interval"){let a=["step",["number",i]];for(let o of r)xe(a,o[0],o[1],!0);return Tr(a),t.default===void 0?a:["case",["==",["typeof",i],"number"],a,He(t.default)]}else if(n==="exponential"){let a=t.base!==void 0?t.base:1,o=[qr(t),a===1?["linear"]:["exponential",a],["number",i]];for(let s of r)xe(o,s[0],s[1],!1);return t.default===void 0?o:["case",["==",["typeof",i],"number"],o,He(t.default)]}else throw new Error(`Unknown property function type ${n}`)}function Lo(t,e,r,n=["zoom"]){let i=jr(t,e),a,o=!1;if(i==="interval")a=["step",n],o=!0;else if(i==="exponential"){let s=t.base!==void 0?t.base:1;a=[qr(t),s===1?["linear"]:["exponential",s],n]}else throw new Error(`Unknown zoom function type "${i}"`);for(let s of r)xe(a,s[0],s[1],o);return Tr(a),a}function Tr(t){t[0]==="step"&&t.length===3&&(t.push(0),t.push(t[3]))}function xe(t,e,r,n){t.length>3&&e===t[t.length-2]||(n&&t.length===2||t.push(e),t.push(r))}function jr(t,e){return t.type?t.type:e.expression.interpolated?"exponential":"interval"}function Vo(t){let e=["concat"],r=/{([^{}]+)}/g,n=0;for(let i=r.exec(t);i!==null;i=r.exec(t)){let a=t.slice(n,r.lastIndex-i[0].length);n=r.lastIndex,a.length>0&&e.push(a),e.push(["get",i[1]])}if(e.length===1)return t;if(n<t.length)e.push(t.slice(n));else if(e.length===2)return["to-string",e[1]];return e}function Ln(t){let e=t.key,r=t.value;return r?[new f(e,r,"constants have been deprecated as of v8")]:[]}function I(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function ye(t){if(Array.isArray(t))return t.map(ye);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){let e={};for(let r in t)e[r]=ye(t[r]);return e}return I(t)}function L(t){let e=t.key,r=t.value,n=t.valueSpec||{},i=t.objectElementValidators||{},a=t.style,o=t.styleSpec,s=t.validateSpec,l=[],u=S(r);if(u!=="object")return[new f(e,r,`object expected, ${u} found`)];for(let c in r){let p=c.split(".")[0],m=Pe(n,p)||n["*"],d;if(Pe(i,p))d=i[p];else if(Pe(n,p))d=s;else if(i["*"])d=i["*"];else if(n["*"])d=s;else{l.push(new f(e,r[c],`unknown property "${c}"`));continue}l=l.concat(d({key:(e&&`${e}.`)+c,value:r[c],valueSpec:m,style:a,styleSpec:o,object:r,objectKey:c,validateSpec:s},r))}for(let c in n)i[c]||n[c].required&&n[c].default===void 0&&r[c]===void 0&&l.push(new f(e,r,`missing required property "${c}"`));return l}function Cr(t){let e=t.value,r=t.valueSpec,n=t.validateSpec,i=t.style,a=t.styleSpec,o=t.key,s=t.arrayElementValidator||n;if(S(e)!=="array")return[new f(o,e,`array expected, ${S(e)} found`)];if(r.length&&e.length!==r.length)return[new f(o,e,`array length ${r.length} expected, length ${e.length} found`)];if(r["min-length"]&&e.length<r["min-length"])return[new f(o,e,`array length at least ${r["min-length"]} expected, length ${e.length} found`)];let l={type:r.value,values:r.values};a.$version<7&&(l.function=r.function),S(r.value)==="object"&&(l=r.value);let u=[];for(let c=0;c<e.length;c++)u=u.concat(s({array:e,arrayIndex:c,value:e[c],valueSpec:l,validateSpec:t.validateSpec,style:i,styleSpec:a,key:`${o}[${c}]`}));return u}function Ft(t){let e=t.key,r=t.value,n=t.valueSpec,i=S(r);return i==="number"&&r!==r&&(i="NaN"),i!=="number"?[new f(e,r,`number expected, ${i} found`)]:"minimum"in n&&r<n.minimum?[new f(e,r,`${r} is less than the minimum value ${n.minimum}`)]:"maximum"in n&&r>n.maximum?[new f(e,r,`${r} is greater than the maximum value ${n.maximum}`)]:[]}function Vn(t){let e=t.valueSpec,r=I(t.value.type),n,i={},a,o,s=r!=="categorical"&&t.value.property===void 0,l=!s,u=S(t.value.stops)==="array"&&S(t.value.stops[0])==="array"&&S(t.value.stops[0][0])==="object",c=L({key:t.key,value:t.value,valueSpec:t.styleSpec.function,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:p,default:g}});return r==="identity"&&s&&c.push(new f(t.key,t.value,'missing required property "property"')),r!=="identity"&&!t.value.stops&&c.push(new f(t.key,t.value,'missing required property "stops"')),r==="exponential"&&t.valueSpec.expression&&!Pr(t.valueSpec)&&c.push(new f(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!vt(t.valueSpec)?c.push(new f(t.key,t.value,"property functions not supported")):s&&!Nn(t.valueSpec)&&c.push(new f(t.key,t.value,"zoom functions not supported"))),(r==="categorical"||u)&&t.value.property===void 0&&c.push(new f(t.key,t.value,'"property" property is required')),c;function p(h){if(r==="identity")return[new f(h.key,h.value,'identity function may not have a "stops" property')];let O=[],v=h.value;return O=O.concat(Cr({key:h.key,value:v,valueSpec:h.valueSpec,validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec,arrayElementValidator:m})),S(v)==="array"&&v.length===0&&O.push(new f(h.key,v,"array must have at least one stop")),O}function m(h){let O=[],v=h.value,z=h.key;if(S(v)!=="array")return[new f(z,v,`array expected, ${S(v)} found`)];if(v.length!==2)return[new f(z,v,`array length 2 expected, length ${v.length} found`)];if(u){if(S(v[0])!=="object")return[new f(z,v,`object expected, ${S(v[0])} found`)];if(v[0].zoom===void 0)return[new f(z,v,"object stop key must have zoom")];if(v[0].value===void 0)return[new f(z,v,"object stop key must have value")];if(o&&o>I(v[0].zoom))return[new f(z,v[0].zoom,"stop zoom values must appear in ascending order")];I(v[0].zoom)!==o&&(o=I(v[0].zoom),a=void 0,i={}),O=O.concat(L({key:`${z}[0]`,value:v[0],valueSpec:{zoom:{}},validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec,objectElementValidators:{zoom:Ft,value:d}}))}else O=O.concat(d({key:`${z}[0]`,value:v[0],validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec},v));return Ct(ye(v[1]))?O.concat([new f(`${z}[1]`,v[1],"expressions are not allowed in function stops.")]):O.concat(h.validateSpec({key:`${z}[1]`,value:v[1],valueSpec:e,validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec}))}function d(h,O){let v=S(h.value),z=I(h.value),C=h.value!==null?h.value:O;if(!n)n=v;else if(v!==n)return[new f(h.key,C,`${v} stop domain type must match previous stop domain type ${n}`)];if(v!=="number"&&v!=="string"&&v!=="boolean")return[new f(h.key,C,"stop domain value must be a number, string, or boolean")];if(v!=="number"&&r!=="categorical"){let ue=`number expected, ${v} found`;return vt(e)&&r===void 0&&(ue+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new f(h.key,C,ue)]}return r==="categorical"&&v==="number"&&(!isFinite(z)||Math.floor(z)!==z)?[new f(h.key,C,`integer expected, found ${z}`)]:r!=="categorical"&&v==="number"&&a!==void 0&&z<a?[new f(h.key,C,"stop domain values must appear in ascending order")]:(a=z,r==="categorical"&&z in i?[new f(h.key,C,"stop domain values must be unique")]:(i[z]=!0,[]))}function g(h){return h.validateSpec({key:h.key,value:h.value,valueSpec:e,validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec})}}function $e(t){let e=(t.expressionContext==="property"?Rr:Nt)(ye(t.value),t.valueSpec);if(e.result==="error")return e.value.map(n=>new f(`${t.key}${n.key}`,t.value,n.message));let r=e.value.expression||e.value._styleExpression.expression;if(t.expressionContext==="property"&&t.propertyKey==="text-font"&&!r.outputDefined())return[new f(t.key,t.value,`Invalid data expression for "${t.propertyKey}". Output values must be contained as literals within the expression.`)];if(t.expressionContext==="property"&&t.propertyType==="layout"&&!Ue(r))return[new f(t.key,t.value,'"feature-state" data expressions are not supported with layout properties.')];if(t.expressionContext==="filter"&&!Ue(r))return[new f(t.key,t.value,'"feature-state" data expressions are not supported with filters.')];if(t.expressionContext&&t.expressionContext.indexOf("cluster")===0){if(!Tt(r,["zoom","feature-state"]))return[new f(t.key,t.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(t.expressionContext==="cluster-initial"&&!qt(r))return[new f(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Uo(t){let e=t.value,r=t.key,n=S(e);return n!=="boolean"?[new f(r,e,`boolean expected, ${n} found`)]:[]}function Or(t){let e=t.key,r=t.value,n=S(r);return n!=="string"?[new f(e,r,`color expected, ${n} found`)]:$.parse(String(r))?[]:[new f(e,r,`color expected, "${r}" found`)]}function Ge(t){let e=t.key,r=t.value,n=t.valueSpec,i=[];return Array.isArray(n.values)?n.values.indexOf(I(r))===-1&&i.push(new f(e,r,`expected one of [${n.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(n.values).indexOf(I(r))===-1&&i.push(new f(e,r,`expected one of [${Object.keys(n.values).join(", ")}], ${JSON.stringify(r)} found`)),i}function Nr(t){return _t(ye(t.value))?$e(ke({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Un(t)}function Un(t){let e=t.value,r=t.key;if(S(e)!=="array")return[new f(r,e,`array expected, ${S(e)} found`)];let n=t.styleSpec,i,a=[];if(e.length<1)return[new f(r,e,"filter array must have at least 1 element")];switch(a=a.concat(Ge({key:`${r}[0]`,value:e[0],valueSpec:n.filter_operator,style:t.style,styleSpec:t.styleSpec})),I(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&I(e[1])==="$type"&&a.push(new f(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&a.push(new f(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(i=S(e[1]),i!=="string"&&a.push(new f(`${r}[1]`,e[1],`string expected, ${i} found`)));for(let o=2;o<e.length;o++)i=S(e[o]),I(e[1])==="$type"?a=a.concat(Ge({key:`${r}[${o}]`,value:e[o],valueSpec:n.geometry_type,style:t.style,styleSpec:t.styleSpec})):i!=="string"&&i!=="number"&&i!=="boolean"&&a.push(new f(`${r}[${o}]`,e[o],`string, number, or boolean expected, ${i} found`));break;case"any":case"all":case"none":for(let o=1;o<e.length;o++)a=a.concat(Un({key:`${r}[${o}]`,value:e[o],style:t.style,styleSpec:t.styleSpec}));break;case"has":case"!has":i=S(e[1]),e.length!==2?a.push(new f(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):i!=="string"&&a.push(new f(`${r}[1]`,e[1],`string expected, ${i} found`));break}return a}function Bn(t,e){let r=t.key,n=t.validateSpec,i=t.style,a=t.styleSpec,o=t.value,s=t.objectKey,l=a[`${e}_${t.layerType}`];if(!l)return[];let u=s.match(/^(.*)-transition$/);if(e==="paint"&&u&&l[u[1]]&&l[u[1]].transition)return n({key:r,value:o,valueSpec:a.transition,style:i,styleSpec:a});let c=t.valueSpec||l[s];if(!c)return[new f(r,o,`unknown property "${s}"`)];let p;if(S(o)==="string"&&vt(c)&&!c.tokens&&(p=/^{([^}]+)}$/.exec(o)))return[new f(r,o,`"${s}" does not support interpolation syntax
2
+ Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(p[1])} }\`.`)];let m=[];return t.layerType==="symbol"&&(s==="text-field"&&i&&!i.glyphs&&m.push(new f(r,o,'use of "text-field" requires a style "glyphs" property')),s==="text-font"&&jt(ye(o))&&I(o.type)==="identity"&&m.push(new f(r,o,'"text-font" does not support identity functions'))),m.concat(n({key:t.key,value:o,valueSpec:c,style:i,styleSpec:a,expressionContext:"property",propertyType:e,propertyKey:s}))}function Jn(t){return Bn(t,"paint")}function Hn(t){return Bn(t,"layout")}function Gn(t){let e=[],r=t.value,n=t.key,i=t.style,a=t.styleSpec;if(S(r)!=="object")return[new f(n,r,`object expected, ${S(r)} found`)];!r.type&&!r.ref&&e.push(new f(n,r,'either "type" or "ref" is required'));let o=I(r.type),s=I(r.ref);if(r.id){let l=I(r.id);for(let u=0;u<t.arrayIndex;u++){let c=i.layers[u];I(c.id)===l&&e.push(new f(n,r.id,`duplicate layer id "${r.id}", previously used at line ${c.id.__line__}`))}}if("ref"in r){["type","source","source-layer","filter","layout"].forEach(u=>{u in r&&e.push(new f(n,r[u],`"${u}" is prohibited for ref layers`))});let l;i.layers.forEach(u=>{I(u.id)===s&&(l=u)}),l?l.ref?e.push(new f(n,r.ref,"ref cannot reference another ref layer")):o=I(l.type):e.push(new f(n,r.ref,`ref layer "${s}" not found`))}else if(o!=="background")if(!r.source)e.push(new f(n,r,'missing required property "source"'));else{let l=i.sources&&i.sources[r.source],u=l&&I(l.type);l?u==="vector"&&o==="raster"?e.push(new f(n,r.source,`layer "${r.id}" requires a raster source`)):u!=="raster-dem"&&o==="hillshade"?e.push(new f(n,r.source,`layer "${r.id}" requires a raster-dem source`)):u!=="raster-dem"&&o==="color-relief"?e.push(new f(n,r.source,`layer "${r.id}" requires a raster-dem source`)):u==="raster"&&o!=="raster"?e.push(new f(n,r.source,`layer "${r.id}" requires a vector source`)):u==="vector"&&!r["source-layer"]?e.push(new f(n,r,`layer "${r.id}" must specify a "source-layer"`)):u==="raster-dem"&&o!=="hillshade"&&o!=="color-relief"?e.push(new f(n,r.source,"raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.")):o==="line"&&r.paint&&r.paint["line-gradient"]&&(u!=="geojson"||!l.lineMetrics)&&e.push(new f(n,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new f(n,r.source,`source "${r.source}" not found`))}return e=e.concat(L({key:n,value:r,valueSpec:a.layer,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*"(){return[]},type(){return t.validateSpec({key:`${n}.type`,value:r.type,valueSpec:a.layer.type,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,object:r,objectKey:"type"})},filter:Nr,layout(l){return L({layer:r,key:l.key,value:l.value,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*"(u){return Hn(ke({layerType:o},u))}}})},paint(l){return L({layer:r,key:l.key,value:l.value,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*"(u){return Jn(ke({layerType:o},u))}}})}}})),e}function me(t){let e=t.value,r=t.key,n=S(e);return n!=="string"?[new f(r,e,`string expected, ${n} found`)]:[]}function Bo(t){var e;let r=(e=t.sourceName)!==null&&e!==void 0?e:"",n=t.value,i=t.styleSpec,a=i.source_raster_dem,o=t.style,s=[],l=S(n);if(n===void 0)return s;if(l!=="object")return s.push(new f("source_raster_dem",n,`object expected, ${l} found`)),s;let c=I(n.encoding)==="custom",p=["redFactor","greenFactor","blueFactor","baseShift"],m=t.value.encoding?`"${t.value.encoding}"`:"Default";for(let d in n)!c&&p.includes(d)?s.push(new f(d,n[d],`In "${r}": "${d}" is only valid when "encoding" is set to "custom". ${m} encoding found`)):a[d]?s=s.concat(t.validateSpec({key:d,value:n[d],valueSpec:a[d],validateSpec:t.validateSpec,style:o,styleSpec:i})):s.push(new f(d,n[d],`unknown property "${d}"`));return s}var bn={promoteId:Jo};function Wn(t){let e=t.value,r=t.key,n=t.styleSpec,i=t.style,a=t.validateSpec;if(!e.type)return[new f(r,e,'"type" is required')];let o=I(e.type),s;switch(o){case"vector":case"raster":return s=L({key:r,value:e,valueSpec:n[`source_${o.replace("-","_")}`],style:t.style,styleSpec:n,objectElementValidators:bn,validateSpec:a}),s;case"raster-dem":return s=Bo({sourceName:r,value:e,style:t.style,styleSpec:n,validateSpec:a}),s;case"geojson":if(s=L({key:r,value:e,valueSpec:n.source_geojson,style:i,styleSpec:n,validateSpec:a,objectElementValidators:bn}),e.cluster)for(let l in e.clusterProperties){let[u,c]=e.clusterProperties[l],p=typeof u=="string"?[u,["accumulated"],["get",l]]:u;s.push(...$e({key:`${r}.${l}.map`,value:c,expressionContext:"cluster-map"})),s.push(...$e({key:`${r}.${l}.reduce`,value:p,expressionContext:"cluster-reduce"}))}return s;case"video":return L({key:r,value:e,valueSpec:n.source_video,style:i,validateSpec:a,styleSpec:n});case"image":return L({key:r,value:e,valueSpec:n.source_image,style:i,validateSpec:a,styleSpec:n});case"canvas":return[new f(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Ge({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function Jo({key:t,value:e}){if(S(e)==="string")return me({key:t,value:e});{let r=[];for(let n in e)r.push(...me({key:`${t}.${n}`,value:e[n]}));return r}}function Kn(t){let e=t.value,r=t.styleSpec,n=r.light,i=t.style,a=[],o=S(e);if(e===void 0)return a;if(o!=="object")return a=a.concat([new f("light",e,`object expected, ${o} found`)]),a;for(let s in e){let l=s.match(/^(.*)-transition$/);l&&n[l[1]]&&n[l[1]].transition?a=a.concat(t.validateSpec({key:s,value:e[s],valueSpec:r.transition,validateSpec:t.validateSpec,style:i,styleSpec:r})):n[s]?a=a.concat(t.validateSpec({key:s,value:e[s],valueSpec:n[s],validateSpec:t.validateSpec,style:i,styleSpec:r})):a=a.concat([new f(s,e[s],`unknown property "${s}"`)])}return a}function Zn(t){let e=t.value,r=t.styleSpec,n=r.sky,i=t.style,a=S(e);if(e===void 0)return[];if(a!=="object")return[new f("sky",e,`object expected, ${a} found`)];let o=[];for(let s in e)n[s]?o=o.concat(t.validateSpec({key:s,value:e[s],valueSpec:n[s],style:i,styleSpec:r})):o=o.concat([new f(s,e[s],`unknown property "${s}"`)]);return o}function Xn(t){let e=t.value,r=t.styleSpec,n=r.terrain,i=t.style,a=[],o=S(e);if(e===void 0)return a;if(o!=="object")return a=a.concat([new f("terrain",e,`object expected, ${o} found`)]),a;for(let s in e)n[s]?a=a.concat(t.validateSpec({key:s,value:e[s],valueSpec:n[s],validateSpec:t.validateSpec,style:i,styleSpec:r})):a=a.concat([new f(s,e[s],`unknown property "${s}"`)]);return a}function Ho(t){return me(t).length===0?[]:$e(t)}function Go(t){return me(t).length===0?[]:$e(t)}function Wo(t){let e=t.key,r=t.value;if(S(r)==="array"){if(r.length<1||r.length>4)return[new f(e,r,`padding requires 1 to 4 values; ${r.length} values found`)];let i={type:"number"},a=[];for(let o=0;o<r.length;o++)a=a.concat(t.validateSpec({key:`${e}[${o}]`,value:r[o],validateSpec:t.validateSpec,valueSpec:i}));return a}else return Ft({key:e,value:r,valueSpec:{}})}function Ko(t){let e=t.key,r=t.value;if(S(r)==="array"){let i={type:"number"};if(r.length<1)return[new f(e,r,"array length at least 1 expected, length 0 found")];let a=[];for(let o=0;o<r.length;o++)a=a.concat(t.validateSpec({key:`${e}[${o}]`,value:r[o],validateSpec:t.validateSpec,valueSpec:i}));return a}else return Ft({key:e,value:r,valueSpec:{}})}function Zo(t){let e=t.key,r=t.value;if(S(r)==="array"){if(r.length<1)return[new f(e,r,"array length at least 1 expected, length 0 found")];let i=[];for(let a=0;a<r.length;a++)i=i.concat(Or({key:`${e}[${a}]`,value:r[a]}));return i}else return Or({key:e,value:r})}function Xo(t){let e=t.key,r=t.value,n=S(r),i=t.styleSpec;if(n!=="array"||r.length<1||r.length%2!==0)return[new f(e,r,"variableAnchorOffsetCollection requires a non-empty array of even length")];let a=[];for(let o=0;o<r.length;o+=2)a=a.concat(Ge({key:`${e}[${o}]`,value:r[o],valueSpec:i.layout_symbol["text-anchor"]})),a=a.concat(Cr({key:`${e}[${o+1}]`,value:r[o+1],valueSpec:{length:2,value:"number"},validateSpec:t.validateSpec,style:t.style,styleSpec:i}));return a}function Yn(t){let e=[],r=t.value,n=t.key;if(Array.isArray(r)){let i=[],a=[];for(let o in r){r[o].id&&i.includes(r[o].id)&&e.push(new f(n,r,`all the sprites' ids must be unique, but ${r[o].id} is duplicated`)),i.push(r[o].id),r[o].url&&a.includes(r[o].url)&&e.push(new f(n,r,`all the sprites' URLs must be unique, but ${r[o].url} is duplicated`)),a.push(r[o].url);let s={id:{type:"string",required:!0},url:{type:"string",required:!0}};e=e.concat(L({key:`${n}[${o}]`,value:r[o],valueSpec:s,validateSpec:t.validateSpec}))}return e}else return me({key:n,value:r})}function Yo(t){let e=t.value,r=t.styleSpec,n=r.projection,i=t.style,a=S(e);if(e===void 0)return[];if(a!=="object")return[new f("projection",e,`object expected, ${a} found`)];let o=[];for(let s in e)n[s]?o=o.concat(t.validateSpec({key:s,value:e[s],valueSpec:n[s],style:i,styleSpec:r})):o=o.concat([new f(s,e[s],`unknown property "${s}"`)]);return o}function Qo(t){let e=t.key,r=t.value;r=r instanceof String?r.valueOf():r;let n=S(r);return n==="array"&&!ts(r)&&!es(r)?[new f(e,r,`projection expected, invalid array ${JSON.stringify(r)} found`)]:["array","string"].includes(n)?[]:[new f(e,r,`projection expected, invalid type "${n}" found`)]}function es(t){return!!["interpolate","step","literal"].includes(t[0])}function ts(t){return Array.isArray(t)&&t.length===3&&typeof t[0]=="string"&&typeof t[1]=="string"&&typeof t[2]=="number"}function rs(t){return!!t&&t.constructor===Object}function Qn(t){return rs(t.value)?[]:[new f(t.key,t.value,`object expected, ${S(t.value)} found`)]}var wn={"*"(){return[]},array:Cr,boolean:Uo,number:Ft,color:Or,constants:Ln,enum:Ge,filter:Nr,function:Vn,layer:Gn,object:L,source:Wn,light:Kn,sky:Zn,terrain:Xn,projection:Yo,projectionDefinition:Qo,string:me,formatted:Ho,resolvedImage:Go,padding:Wo,numberArray:Ko,colorArray:Zo,variableAnchorOffsetCollection:Xo,sprite:Yn,state:Qn};function kt(t){let e=t.value,r=t.valueSpec,n=t.styleSpec;return t.validateSpec=kt,r.expression&&jt(I(e))?Vn(t):r.expression&&Ct(ye(e))?$e(t):r.type&&wn[r.type]?wn[r.type](t):L(ke({},t,{valueSpec:r.type?n[r.type]:r}))}function ei(t){let e=t.value,r=t.key,n=me(t);return n.length||(e.indexOf("{fontstack}")===-1&&n.push(new f(r,e,'"glyphs" url must include a "{fontstack}" token')),e.indexOf("{range}")===-1&&n.push(new f(r,e,'"glyphs" url must include a "{range}" token'))),n}function _(t,e=St){let r=[];return r=r.concat(kt({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,validateSpec:kt,objectElementValidators:{glyphs:ei,"*"(){return[]}}})),t.constants&&(r=r.concat(Ln({key:"constants",value:t.constants}))),ti(r)}_.source=G(H(Wn));_.sprite=G(H(Yn));_.glyphs=G(H(ei));_.light=G(H(Kn));_.sky=G(H(Zn));_.terrain=G(H(Xn));_.state=G(H(Qn));_.layer=G(H(Gn));_.filter=G(H(Nr));_.paintProperty=G(H(Jn));_.layoutProperty=G(H(Hn));function H(t){return function(e){return t(q(x({},e),{validateSpec:kt}))}}function ti(t){return[].concat(t).sort((e,r)=>e.line-r.line)}function G(t){return function(...e){return ti(t.apply(this,e))}}var Bs=St,Js={StyleExpression:bt,StylePropertyFunction:wt,ZoomConstantExpression:Be,ZoomDependentExpression:Je,createExpression:Nt,createPropertyExpression:Rr,isExpression:Ct,isExpressionFilter:_t,isZoomExpression:Po,normalizePropertyExpression:Ro};function ri(t,e){if(typeof t!="string"||t.length===0)return null;let r=n=>{try{return new URL(n.replace(/\{[a-z]+\}/g,"0"))}catch(i){return null}};if(t.startsWith("/")&&!t.startsWith("//")){let n=r(e)?.origin;if(!n||n==="null")return null;let i=`${n}${t}`;return r(i)?.origin===n?{url:i,credentials:"include"}:null}return/^https:\/\//i.test(t)&&r(t)?.protocol==="https:"?{url:t,credentials:"omit"}:null}function Ks(t,e,r,n){return t.replace(/\{z\}/g,String(e)).replace(/\{x\}/g,String(r)).replace(/\{y\}/g,String(n))}var Y=t=>!!t&&typeof t=="object"&&!Array.isArray(t);function Zs(t){if(!Y(t)||t.version!==8)return null;let e=t.sources,r=t.layers;if(!Y(e)||!Array.isArray(r)||!Object.values(e).every(Y))return null;let n=new Set;for(let a of r){if(!Y(a)||typeof a.id!="string"||n.has(a.id))return null;n.add(a.id)}let i=Y(t.state)?t.state:void 0;return structuredClone(q(x({version:8},i?{state:i}:{}),{sources:e,layers:r}))}function ni(t,e){let r={};for(let[n,i]of Object.entries(t.state??{}))r[n]=Y(i)?i.default??null:null;return x(x({},r),e)}function Xe(t,e){if(Array.isArray(t)){if(t[0]==="literal")return t;if(t[0]==="global-state"&&typeof t[1]=="string"){let r=t[1];return["get",r,["literal",{[r]:e[r]??null}]]}return t.map(r=>Xe(r,e))}return Y(t)?Object.fromEntries(Object.entries(t).map(([r,n])=>[r,Xe(n,e)])):t}function Xs(t,e){let r=x({},t);return t.paint&&(r.paint=Xe(t.paint,e)),t.layout&&(r.layout=Xe(t.layout,e)),t.filter!==void 0&&(r.filter=Xe(t.filter,e)),r}var ns={r:256,g:1,b:1/256,base:32768},is={r:6553.6,g:25.6,b:.1,base:1e4},he=(t,e)=>typeof t=="number"&&Number.isFinite(t)?t:e;function as(t){return Array.isArray(t)&&t.length===4&&t.every(e=>typeof e=="number"&&Number.isFinite(e))?t:void 0}function os(t,e){if(t.url!==void 0&&t.tiles===void 0)return"a TileJSON url is not supported; list the tiles";if(t.scheme==="tms")return'scheme "tms" is not supported';let r=t.tiles;if(!Array.isArray(r)||r.length===0)return"no tiles";let n=r.map(o=>typeof o=="string"?/\{(?![zxy]\})[^}]*\}/.exec(o):null).find(o=>o);if(n)return`tile placeholder ${n[0]} is not supported`;let i=r.map(o=>ri(o,e));if(i.some(o=>o===null))return"a tile URL is neither server-relative nor https";let a=i;return a.some(o=>o.credentials!==a[0].credentials)?"tile URLs mix the server and other hosts":{tiles:a.map(o=>o.url),credentials:a[0].credentials}}function ss(t,e){if(!Y(t))return{error:"not a source"};let r=t.type;if(r==="raster-dem"||r==="raster"||r==="vector"){let n=os(t,e);if(typeof n=="string")return{error:n};let i={minzoom:he(t.minzoom,0),maxzoom:he(t.maxzoom,22),bounds:as(t.bounds)};if(r==="vector")return t.encoding!==void 0&&t.encoding!=="mvt"?{error:`encoding "${String(t.encoding)}"`}:x(x({type:r},n),i);let a=he(t.tileSize,512);if(r==="raster")return x(q(x({type:r},n),{tileSize:a}),i);let o=t.encoding??"mapbox",s;if(o==="terrarium")s=ns;else if(o==="mapbox")s=is;else if(o==="custom")s={r:he(t.redFactor,1),g:he(t.greenFactor,1),b:he(t.blueFactor,1),base:he(t.baseShift,0)};else return{error:`encoding "${String(o)}"`};return q(x(q(x({type:r},n),{tileSize:a}),i),{encoding:s})}if(r==="geojson"){if(t.cluster===!0)return{error:"clustering"};if(t.filter!==void 0)return{error:"a source filter"};let n=t.data;if(typeof n=="string"){let i=ri(n,e);return i?{type:r,url:i}:{error:"the data URL is neither server-relative nor https"}}return Y(n)?{type:r,data:n}:{error:"no data"}}return{error:`source type "${String(r)}"`}}function ii(t,e){return Object.fromEntries(Object.entries(t.sources).map(([r,n])=>[r,ss(n,e)]))}var ls={"color-relief":["raster-dem"],raster:["raster"],fill:["vector","geojson"],line:["vector","geojson"],circle:["vector","geojson"],symbol:["vector","geojson"]},us={"color-relief":{paint:["color-relief-color","color-relief-opacity","resampling"],layout:[]},raster:{paint:["raster-opacity","raster-resampling","raster-fade-duration"],layout:[]},fill:{paint:["fill-color","fill-opacity","fill-outline-color"],layout:[]},line:{paint:["line-color","line-width","line-opacity","line-dasharray"],layout:["line-cap","line-join","line-miter-limit"]},circle:{paint:["circle-color","circle-radius","circle-opacity","circle-stroke-color","circle-stroke-width","circle-stroke-opacity","circle-translate"],layout:[]},symbol:{paint:["text-color","text-halo-color","text-halo-width","text-opacity","text-translate"],layout:["symbol-placement","symbol-spacing","text-field","text-font","text-size","text-anchor","text-justify","text-max-width","text-letter-spacing","text-line-height","text-offset","text-rotate","text-rotation-alignment","text-padding","text-transform","text-keep-upright","text-max-angle","text-allow-overlap","text-ignore-placement","text-optional","text-pitch-alignment","icon-pitch-alignment"]}},cs=new Set(["image","within","distance"]);function Dr(t){if(Array.isArray(t)){if(t[0]==="literal")return null;if(typeof t[0]=="string"&&cs.has(t[0]))return t[0];for(let e of t){let r=Dr(e);if(r)return r}}else if(Y(t))for(let e of Object.values(t)){let r=Dr(e);if(r)return r}return null}function ps(t){if(typeof t!="string")return null;let e=$.parse(t);if(!e)return null;let r=n=>e.a>0?Math.round(n/e.a*255):0;return[r(e.r),r(e.g),r(e.b),e.a]}function fs(t){if(t===void 0)return"color-relief-color is required";if(!Array.isArray(t)||t[0]!=="interpolate"||JSON.stringify(t[1])!=='["linear"]'||JSON.stringify(t[2])!=='["elevation"]')return'color-relief-color must be ["interpolate", ["linear"], ["elevation"], \u2026]';let e=t.slice(3);if(e.length<2||e.length%2!==0)return"color-relief-color needs stop/colour pairs";let r=[],n=[];for(let i=0;i<e.length;i+=2){let a=e[i],o=ps(e[i+1]);if(typeof a!="number"||!Number.isFinite(a))return"color-relief-color stops must be literal numbers";if(r.length&&a<=r[r.length-1])return"color-relief-color stops must ascend";if(!o)return"color-relief-color colours must be literal colours";r.push(a),n.push(o)}return{stops:r,colors:n}}var te=(t,e)=>({drawable:!1,reason:t,detail:e}),ds="https://glyphs.invalid/{fontstack}/{range}.pbf";function _r(t,e,r){let n=ls[e.type];if(!n)return te("layerType",e.type);let i=typeof e.source=="string"?r[e.source]:void 0;if(!i)return te("source",`no source "${String(e.source)}"`);if("error"in i)return te("source",i.error);if(!n.includes(i.type))return te("source",`${e.type} cannot draw a ${i.type} source`);let a=x({},e.paint??{});if(e.type==="color-relief"&&"resampling"in a){if(a.resampling!=="linear"&&a.resampling!=="nearest")return te("property",'resampling must be "linear" or "nearest"');delete a.resampling}let o=_(q(x({version:8,glyphs:ds},t.state?{state:t.state}:{}),{sources:{[e.source]:t.sources[e.source]},layers:[q(x({},e),{paint:a})]})).filter(u=>u.message.startsWith("layers["));if(o.length)return te("property",o[0].message.replace(/^layers\[0\]\./,""));let s=us[e.type];for(let u of["paint","layout"]){let c=e[u]??{},p=St[`${u}_${e.type}`];for(let[m,d]of Object.entries(c))if(!(m==="visibility"||s[u].includes(m))&&JSON.stringify(d)!==JSON.stringify(p?.[m]?.default))return te("property",m)}let l=Dr([e.paint,e.layout,e.filter]);if(l)return te("property",`the "${l}" expression`);if(e.type==="color-relief"){let u=fs(e.paint?.["color-relief-color"]);if(typeof u=="string")return te("property",u)}return{drawable:!0}}var R=class extends Error{constructor(r,n){super(n);this.reason=r}reason},ys=(t,e)=>P(null,null,function*(){let r=yield fetch(t.url,{credentials:t.credentials,cache:e?"reload":"default"});if(!r.ok)throw new Error(`HTTP ${r.status} for ${t.url}`);return r.json()}),ms=new Set(["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon","GeometryCollection"]),Lt=t=>!!t&&typeof t=="object"&&!Array.isArray(t),oi=t=>Lt(t)&&t.type==="Feature";function Fr(t){return Lt(t)?t.type==="FeatureCollection"&&Array.isArray(t.features)?t.features.filter(oi):t.type==="Feature"?[t]:typeof t.type=="string"&&ms.has(t.type)?[{type:"Feature",geometry:t,properties:{}}]:null:null}var Lr=t=>typeof t=="string"||typeof t=="number"&&Number.isFinite(t),re=t=>structuredClone(t),Vr=(t,e,r)=>`${t}/${e}/${r}`,ai=class{constructor(e,r,n=ys){this.style=e;this.load=n;this.sources=ii(e,r);for(let i of e.layers)this.declared.set(i.id,i),this.current.set(i.id,re(i)),this.verdicts.set(i.id,_r(e,i,this.sources));for(let[i,a]of Object.entries(this.sources))"error"in a||a.type!=="geojson"||this.geojson.set(i,{url:a.url,features:a.url?null:this.index(Fr(a.data)??[]),generation:0,pending:[],reload:!1})}style;load;sources;declared=new Map;current=new Map;verdicts=new Map;state={};geojson=new Map;freshness=new Map;listeners=new Set;layers(){return[...this.current.values()]}layer(e){return this.current.get(e)}isDrawn(e){return this.verdicts.get(e)?.drawable===!0}skippedLayers(){let e=[];for(let[r,n]of this.verdicts)!n.drawable&&n.reason&&e.push(x({id:r,reason:n.reason},n.detail?{detail:n.detail}:{}));return e}globalState(){return ni(this.style,this.state)}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}emit(e){for(let r of[...this.listeners])r(e)}source(e){let r=typeof e=="string"?this.sources[e]:void 0;if(!r)throw new R("overlays.badRequest",`The overlay's style has no source "${String(e)}"`);return r}setLayer(e){let r=e.layer,n=typeof r=="string"?this.declared.get(r):void 0;if(!n)throw new R("overlays.badRequest",`The overlay's style has no layer "${String(r)}"`);for(let o of["paint","layout"])if(e[o]!==void 0&&!Lt(e[o]))throw new R("overlays.badRequest",`\`${o}\` must be an object of properties`);if("filter"in e&&e.filter!==null&&!Array.isArray(e.filter))throw new R("overlays.badRequest","`filter` must be an array or null");let i=re(this.current.get(n.id));for(let o of["paint","layout"]){let s=e[o];if(!s)continue;let l=x({},i[o]??{});for(let[u,c]of Object.entries(s))c!==null?l[u]=re(c):n[o]&&u in n[o]?l[u]=re(n[o][u]):delete l[u];i[o]=l}"filter"in e&&(e.filter===null?delete i.filter:i.filter=re(e.filter));let a=_r(this.style,i,this.sources);if(!a.drawable)throw new R("overlays.unsupported",`Layer "${n.id}" would not be drawn: ${a.reason}`+(a.detail?` (${a.detail})`:""));this.current.set(n.id,i),this.verdicts.set(n.id,a),this.emit({kind:"layers",layers:[n.id]})}setState(e){if(!Lt(e))throw new R("overlays.badRequest","`values` must be an object of variable values");let r=x({},this.state);for(let[n,i]of Object.entries(e))i===null?delete r[n]:r[n]=re(i);this.state=r,this.emit({kind:"state"})}geojsonSource(e){let r=this.source(e),n=this.geojson.get(e);if(!n)throw new R("overlays.badRequest",`Source "${String(e)}" is not a usable geojson source`+("error"in r?` (${r.error})`:""));return n}index(e){let r=new Map;for(let n of e)r.set(Lr(n.id)?n.id:Symbol(),n);return r}setData(e){let r=this.geojsonSource(e.source),n=e.source,i=e.data!==void 0,a=e.upsert!==void 0||e.remove!==void 0;if(i===a)throw new R("overlays.badRequest",i?"`data` cannot be combined with `upsert` or `remove`":"Give `data`, or `upsert` and/or `remove`");if(i){let u=Fr(e.data);if(!u)throw new R("overlays.badRequest","`data` must be a GeoJSON object");let c=re(u);r.url=void 0,r.generation++,r.loading=void 0,r.pending=[],r.features=this.index(c),this.emit({kind:"data",source:n,replace:c});return}let o=e.upsert??[],s=e.remove??[];if(!Array.isArray(o)||!o.every(u=>oi(u)&&Lr(u.id)))throw new R("overlays.badRequest","`upsert` must be a list of GeoJSON features, each with an `id`");if(!Array.isArray(s)||!s.every(Lr))throw new R("overlays.badRequest","`remove` must be a list of feature ids");let l={upsert:re(o),remove:s};(r.loading||!r.features)&&r.pending.push(l),r.features&&(this.applyDiff(r.features,l),this.emit(x({kind:"data",source:n},l)))}applyDiff(e,r){for(let n of r.remove??[])e.delete(n);for(let n of r.upsert??[])e.set(n.id,n)}features(e){return P(this,null,function*(){let r=this.geojson.get(e);return r?r.features?[...r.features.values()]:this.loadUrl(e,r):[]})}loadUrl(e,r){if(r.loading)return r.loading;let n=r.url,i=r.generation,a=r.reload;r.reload=!1;let o=this.load(n,a).then(s=>Fr(s)??[]).catch(s=>(console.warn(`[plotterext] could not load ${n.url}:`,s),null)).then(s=>{if(r.generation!==i)return this.features(e);r.loading=void 0;let l=s===null&&r.features?new Map(r.features):this.index(s??[]);for(let p of r.pending)this.applyDiff(l,p);r.pending=[];let u=!r.features;r.features=l;let c=[...l.values()];return u||this.emit({kind:"data",source:e,replace:c}),c});return r.loading=o,o}refresh(e){let r=this.source(e.source),n=e.source;if("error"in r)throw new R("overlays.badRequest",`Source "${n}" is not drawn (${r.error})`);let i=e.tiles;if(r.type==="geojson"){if(i!==void 0)throw new R("overlays.badRequest","`tiles` applies to tiled sources only");let o=this.geojson.get(n);if(!o.url)return;o.generation++,o.loading=void 0,o.reload=!0,o.features&&this.loadUrl(n,o);return}if(i!==void 0&&!this.validTiles(i))throw new R("overlays.badRequest","`tiles` must be a list of [z, x, y] tiles that exist at zoom z");let a=this.tileFreshness(n);if(i===void 0)a.all=!0,a.dirty.clear(),a.loadedSinceAll.clear();else for(let[o,s,l]of i){let u=Vr(o,s,l);a.dirty.add(u),a.loadedSinceAll.delete(u)}this.emit(x({kind:"refresh",source:n},i!==void 0?{tiles:re(i)}:{}))}validTiles(e){return Array.isArray(e)&&e.every(r=>{if(!Array.isArray(r)||r.length!==3||!r.every(o=>Number.isInteger(o)&&o>=0))return!1;let[n,i,a]=r;return n<=30&&i<2**n&&a<2**n})}tileFreshness(e){let r=this.freshness.get(e);return r||(r={dirty:new Set,all:!1,loadedSinceAll:new Set},this.freshness.set(e,r)),r}needsReload(e,r,n,i){let a=this.freshness.get(e);if(!a)return!1;let o=Vr(r,n,i);return a.dirty.has(o)||a.all&&!a.loadedSinceAll.has(o)}markLoaded(e,r,n,i){let a=this.freshness.get(e);if(!a)return;let o=Vr(r,n,i);a.dirty.delete(o),a.all&&a.loadedSinceAll.add(o)}};function Ye(t,e,r){return P(this,null,function*(){let{Check:n,Errors:i}=yield import("./chunk-VBSJZWSI.js");if(n(t,e))return e;let[a]=i(t,e),o=a.keyword==="required"?`${a.instancePath}/${a.params.requiredProperties[0]} is required`:`${a.instancePath||"params"} ${a.message}`;throw new j(o,{code:T.INVALID_PARAMS,reason:r})})}var Ut=()=>import("./chunk-PWNYMCP2.js"),Ee="overlays.badRequest",hs=t=>new j(t,{code:T.INVALID_PARAMS,reason:Ee});function gs(t){return t instanceof W||t instanceof R?t.reason===Ee?hs(t.message):new j(t.message,{reason:t.reason}):t}function vs(t){if(typeof ImageBitmap<"u")return t instanceof ImageBitmap;let e=t;return!!e&&typeof e=="object"&&Number.isInteger(e.width)&&Number.isInteger(e.height)&&typeof e.close=="function"}function bs(t){return P(this,null,function*(){try{let{overlayId:e,requestId:r,extent:n,image:i}=yield Ye((yield Ut()).FrameParams,t,Ee);return{overlayId:e,requestId:r,extent:n,image:i}}catch(e){let r=t?.image;throw vs(r)&&r.close(),e}})}function Vt(t){return P(this,null,function*(){return Ye((yield Ut()).DataParams,t,Ee)})}function pl(t,e,r){let n=i=>a=>P(null,null,function*(){try{return yield i(a)}catch(o){throw gs(o)}});return{"overlay.list":n(()=>({overlays:t.list(e)})),"overlay.setVisibility":n(i=>P(null,null,function*(){let{ids:a,visible:o}=yield Ye((yield Ut()).SetVisibilityParams,i,Ee);return t.requireOwn(e,a),t.setVisibility(a.map(s=>ge(e,s)),o),{}})),"overlay.setOpacity":n(i=>P(null,null,function*(){let{ids:a,opacity:o}=yield Ye((yield Ut()).SetOpacityParams,i,Ee);return t.requireOwn(e,a),t.setOpacity(a.map(s=>ge(e,s)),o),{}})),"overlay.frame":n(i=>P(null,null,function*(){return t.acceptFrame(e,r,yield bs(i))})),"overlay.refresh":n(i=>P(null,null,function*(){let a=yield Vt(i);return t.dataModel(e,a.overlayId).refresh({source:a.source,tiles:a.tiles}),{}})),"overlay.setData":n(i=>P(null,null,function*(){let a=yield Vt(i);return t.dataModel(e,a.overlayId).setData({source:a.source,data:a.data,upsert:a.upsert,remove:a.remove}),{}})),"overlay.setLayer":n(i=>P(null,null,function*(){let a=yield Vt(i);return t.dataModel(e,a.overlayId).setLayer(x({layer:a.layer,paint:a.paint,layout:a.layout},"filter"in a?{filter:a.filter}:{})),{}})),"overlay.setState":n(i=>P(null,null,function*(){let a=yield Vt(i);return t.dataModel(e,a.overlayId).setState(a.values),{}}))}}export{T as a,j as b,Qe as c,si as d,yi as e,hi as f,gi as g,Ye as h,ge as i,Yr as j,St as k,Ls as l,$ as m,Mr as n,le as o,jt as p,Ct as q,Rr as r,Vs as s,Us as t,Bs as u,Js as v,ri as w,Ks as x,Zs as y,Xs as z,fs as A,ys as B,ai as C,vs as D,pl as E};