@mesh3d/cesium-vectortile-gl 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,135 @@
1
+ (function(F,N){typeof exports=="object"&&typeof module<"u"?N(exports):typeof define=="function"&&define.amd?define(["exports"],N):(F=typeof globalThis<"u"?globalThis:F||self,N(F.CVT={}))})(this,(function(F){"use strict";function N(n,e){this.x=n,this.y=e}N.prototype={clone(){return new N(this.x,this.y)},add(n){return this.clone()._add(n)},sub(n){return this.clone()._sub(n)},multByPoint(n){return this.clone()._multByPoint(n)},divByPoint(n){return this.clone()._divByPoint(n)},mult(n){return this.clone()._mult(n)},div(n){return this.clone()._div(n)},rotate(n){return this.clone()._rotate(n)},rotateAround(n,e){return this.clone()._rotateAround(n,e)},matMult(n){return this.clone()._matMult(n)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(n){return this.x===n.x&&this.y===n.y},dist(n){return Math.sqrt(this.distSqr(n))},distSqr(n){const e=n.x-this.x,t=n.y-this.y;return e*e+t*t},angle(){return Math.atan2(this.y,this.x)},angleTo(n){return Math.atan2(this.y-n.y,this.x-n.x)},angleWith(n){return this.angleWithSep(n.x,n.y)},angleWithSep(n,e){return Math.atan2(this.x*e-this.y*n,this.x*n+this.y*e)},_matMult(n){const e=n[0]*this.x+n[1]*this.y,t=n[2]*this.x+n[3]*this.y;return this.x=e,this.y=t,this},_add(n){return this.x+=n.x,this.y+=n.y,this},_sub(n){return this.x-=n.x,this.y-=n.y,this},_mult(n){return this.x*=n,this.y*=n,this},_div(n){return this.x/=n,this.y/=n,this},_multByPoint(n){return this.x*=n.x,this.y*=n.y,this},_divByPoint(n){return this.x/=n.x,this.y/=n.y,this},_unit(){return this._div(this.mag()),this},_perp(){const n=this.y;return this.y=this.x,this.x=-n,this},_rotate(n){const e=Math.cos(n),t=Math.sin(n),r=e*this.x-t*this.y,i=t*this.x+e*this.y;return this.x=r,this.y=i,this},_rotateAround(n,e){const t=Math.cos(n),r=Math.sin(n),i=e.x+t*(this.x-e.x)-r*(this.y-e.y),s=e.y+r*(this.x-e.x)+t*(this.y-e.y);return this.x=i,this.y=s,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:N},N.convert=function(n){if(n instanceof N)return n;if(Array.isArray(n))return new N(+n[0],+n[1]);if(n.x!==void 0&&n.y!==void 0)return new N(+n.x,+n.y);throw new Error("Expected [x, y] or {x, y} point format")};class Ee{constructor(e,t,r,i,s){this.properties={},this.extent=r,this.type=0,this.id=void 0,this._pbf=e,this._geometry=-1,this._keys=i,this._values=s,e.readFields(wi,this,t)}loadGeometry(){const e=this._pbf;e.pos=this._geometry;const t=e.readVarint()+e.pos,r=[];let i,s=1,o=0,a=0,l=0;for(;e.pos<t;){if(o<=0){const u=e.readVarint();s=u&7,o=u>>3}if(o--,s===1||s===2)a+=e.readSVarint(),l+=e.readSVarint(),s===1&&(i&&r.push(i),i=[]),i&&i.push(new N(a,l));else if(s===7)i&&i.push(i[0].clone());else throw new Error(`unknown command ${s}`)}return i&&r.push(i),r}bbox(){const e=this._pbf;e.pos=this._geometry;const t=e.readVarint()+e.pos;let r=1,i=0,s=0,o=0,a=1/0,l=-1/0,u=1/0,c=-1/0;for(;e.pos<t;){if(i<=0){const f=e.readVarint();r=f&7,i=f>>3}if(i--,r===1||r===2)s+=e.readSVarint(),o+=e.readSVarint(),s<a&&(a=s),s>l&&(l=s),o<u&&(u=o),o>c&&(c=o);else if(r!==7)throw new Error(`unknown command ${r}`)}return[a,u,l,c]}toGeoJSON(e,t,r){const i=this.extent*Math.pow(2,r),s=this.extent*e,o=this.extent*t,a=this.loadGeometry();function l(p){return[(p.x+s)*360/i-180,360/Math.PI*Math.atan(Math.exp((1-(p.y+o)*2/i)*Math.PI))-90]}function u(p){return p.map(l)}let c;if(this.type===1){const p=[];for(const h of a)p.push(h[0]);const d=u(p);c=p.length===1?{type:"Point",coordinates:d[0]}:{type:"MultiPoint",coordinates:d}}else if(this.type===2){const p=a.map(u);c=p.length===1?{type:"LineString",coordinates:p[0]}:{type:"MultiLineString",coordinates:p}}else if(this.type===3){const p=Un(a),d=[];for(const h of p)d.push(h.map(u));c=d.length===1?{type:"Polygon",coordinates:d[0]}:{type:"MultiPolygon",coordinates:d}}else throw new Error("unknown feature type");const f={type:"Feature",geometry:c,properties:this.properties};return this.id!=null&&(f.id=this.id),f}}Ee.types=["Unknown","Point","LineString","Polygon"];function wi(n,e,t){n===1?e.id=t.readVarint():n===2?Ci(t,e):n===3?e.type=t.readVarint():n===4&&(e._geometry=t.pos)}function Ci(n,e){const t=n.readVarint()+n.pos;for(;n.pos<t;){const r=e._keys[n.readVarint()],i=e._values[n.readVarint()];e.properties[r]=i}}function Un(n){const e=n.length;if(e<=1)return[n];const t=[];let r,i;for(let s=0;s<e;s++){const o=_i(n[s]);o!==0&&(i===void 0&&(i=o<0),i===o<0?(r&&t.push(r),r=[n[s]]):r&&r.push(n[s]))}return r&&t.push(r),t}function _i(n){let e=0;for(let t=0,r=n.length,i=r-1,s,o;t<r;i=t++)s=n[t],o=n[i],e+=(o.x-s.x)*(s.y+o.y);return e}class Ii{constructor(e,t){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(zi,this,t),this.length=this._features.length}feature(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];const t=this._pbf.readVarint()+this._pbf.pos;return new Ee(this._pbf,t,this.extent,this._keys,this._values)}}function zi(n,e,t){n===15?e.version=t.readVarint():n===1?e.name=t.readString():n===5?e.extent=t.readVarint():n===2?e._features.push(t.pos):n===3?e._keys.push(t.readString()):n===4&&e._values.push(Mi(t))}function Mi(n){let e=null;const t=n.readVarint()+n.pos;for(;n.pos<t;){const r=n.readVarint()>>3;e=r===1?n.readString():r===2?n.readFloat():r===3?n.readDouble():r===4?n.readVarint64():r===5?n.readVarint():r===6?n.readSVarint():r===7?n.readBoolean():null}if(e==null)throw new Error("unknown feature value");return e}class Ti{constructor(e,t){this.layers=e.readFields(ki,{},t)}}function ki(n,e,t){if(n===3){const r=new Ii(t,t.readVarint()+t.pos);r.length&&(e[r.name]=r)}}class $t{constructor(e,t=""){this.type=e.type,this.styleSource=e,this.path=t,this.errorEvent=new Cesium.Event}async init(){}requestTile(e,t,r){}destroy(){this.styleSource=null,this.errorEvent=null}}const Bt={};function qt(n,e){Bt[n]=e}const Ot=65536*65536,Yn=1/Ot,Si=12,Jn=typeof TextDecoder>"u"?null:new TextDecoder("utf-8"),Rt=0,Ke=1,Le=2,et=5;class Pi{constructor(e=new Uint8Array(16)){this.buf=ArrayBuffer.isView(e)?e:new Uint8Array(e),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(e,t,r=this.length){for(;this.pos<r;){const i=this.readVarint(),s=i>>3,o=this.pos;this.type=i&7,e(s,t,this),this.pos===o&&this.skip(i)}return t}readMessage(e,t){return this.readFields(e,t,this.readVarint()+this.pos)}readFixed32(){const e=this.dataView.getUint32(this.pos,!0);return this.pos+=4,e}readSFixed32(){const e=this.dataView.getInt32(this.pos,!0);return this.pos+=4,e}readFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*Ot;return this.pos+=8,e}readSFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*Ot;return this.pos+=8,e}readFloat(){const e=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,e}readDouble(){const e=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,e}readVarint(e){const t=this.buf;let r,i;return i=t[this.pos++],r=i&127,i<128||(i=t[this.pos++],r|=(i&127)<<7,i<128)||(i=t[this.pos++],r|=(i&127)<<14,i<128)||(i=t[this.pos++],r|=(i&127)<<21,i<128)?r:(i=t[this.pos],r|=(i&15)<<28,Fi(r,e,this))}readVarint64(){return this.readVarint(!0)}readSVarint(){const e=this.readVarint();return e%2===1?(e+1)/-2:e/2}readBoolean(){return!!this.readVarint()}readString(){const e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=Si&&Jn?Jn.decode(this.buf.subarray(t,e)):Gi(this.buf,t,e)}readBytes(){const e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t}readPackedVarint(e=[],t){const r=this.readPackedEnd();for(;this.pos<r;)e.push(this.readVarint(t));return e}readPackedSVarint(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSVarint());return e}readPackedBoolean(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readBoolean());return e}readPackedFloat(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFloat());return e}readPackedDouble(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readDouble());return e}readPackedFixed32(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed32());return e}readPackedSFixed32(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed32());return e}readPackedFixed64(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed64());return e}readPackedSFixed64(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed64());return e}readPackedEnd(){return this.type===Le?this.readVarint()+this.pos:this.pos+1}skip(e){const t=e&7;if(t===Rt)for(;this.buf[this.pos++]>127;);else if(t===Le)this.pos=this.readVarint()+this.pos;else if(t===et)this.pos+=4;else if(t===Ke)this.pos+=8;else throw new Error(`Unimplemented type: ${t}`)}writeTag(e,t){this.writeVarint(e<<3|t)}realloc(e){let t=this.length||16;for(;t<this.pos+e;)t*=2;if(t!==this.length){const r=new Uint8Array(t);r.set(this.buf),this.buf=r,this.dataView=new DataView(r.buffer),this.length=t}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeSFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,e&-1,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*Yn),!0),this.pos+=8}writeSFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,e&-1,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*Yn),!0),this.pos+=8}writeVarint(e){if(e=+e||0,e>268435455||e<0){Ei(e,this);return}this.realloc(4),this.buf[this.pos++]=e&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=e>>>7&127)))}writeSVarint(e){this.writeVarint(e<0?-e*2-1:e*2)}writeBoolean(e){this.writeVarint(+e)}writeString(e){e=String(e),this.realloc(e.length*4),this.pos++;const t=this.pos;this.pos=Xi(this.buf,e,this.pos);const r=this.pos-t;r>=128&&Hn(t,r,this),this.pos=t-1,this.writeVarint(r),this.pos+=r}writeFloat(e){this.realloc(4),this.dataView.setFloat32(this.pos,e,!0),this.pos+=4}writeDouble(e){this.realloc(8),this.dataView.setFloat64(this.pos,e,!0),this.pos+=8}writeBytes(e){const t=e.length;this.writeVarint(t),this.realloc(t);for(let r=0;r<t;r++)this.buf[this.pos++]=e[r]}writeRawMessage(e,t){this.pos++;const r=this.pos;e(t,this);const i=this.pos-r;i>=128&&Hn(r,i,this),this.pos=r-1,this.writeVarint(i),this.pos+=i}writeMessage(e,t,r){this.writeTag(e,Le),this.writeRawMessage(t,r)}writePackedVarint(e,t){t.length&&this.writeMessage(e,Ai,t)}writePackedSVarint(e,t){t.length&&this.writeMessage(e,Vi,t)}writePackedBoolean(e,t){t.length&&this.writeMessage(e,Bi,t)}writePackedFloat(e,t){t.length&&this.writeMessage(e,Ni,t)}writePackedDouble(e,t){t.length&&this.writeMessage(e,$i,t)}writePackedFixed32(e,t){t.length&&this.writeMessage(e,qi,t)}writePackedSFixed32(e,t){t.length&&this.writeMessage(e,Oi,t)}writePackedFixed64(e,t){t.length&&this.writeMessage(e,Ri,t)}writePackedSFixed64(e,t){t.length&&this.writeMessage(e,ji,t)}writeBytesField(e,t){this.writeTag(e,Le),this.writeBytes(t)}writeFixed32Field(e,t){this.writeTag(e,et),this.writeFixed32(t)}writeSFixed32Field(e,t){this.writeTag(e,et),this.writeSFixed32(t)}writeFixed64Field(e,t){this.writeTag(e,Ke),this.writeFixed64(t)}writeSFixed64Field(e,t){this.writeTag(e,Ke),this.writeSFixed64(t)}writeVarintField(e,t){this.writeTag(e,Rt),this.writeVarint(t)}writeSVarintField(e,t){this.writeTag(e,Rt),this.writeSVarint(t)}writeStringField(e,t){this.writeTag(e,Le),this.writeString(t)}writeFloatField(e,t){this.writeTag(e,et),this.writeFloat(t)}writeDoubleField(e,t){this.writeTag(e,Ke),this.writeDouble(t)}writeBooleanField(e,t){this.writeVarintField(e,+t)}}function Fi(n,e,t){const r=t.buf;let i,s;if(s=r[t.pos++],i=(s&112)>>4,s<128||(s=r[t.pos++],i|=(s&127)<<3,s<128)||(s=r[t.pos++],i|=(s&127)<<10,s<128)||(s=r[t.pos++],i|=(s&127)<<17,s<128)||(s=r[t.pos++],i|=(s&127)<<24,s<128)||(s=r[t.pos++],i|=(s&1)<<31,s<128))return xe(n,i,e);throw new Error("Expected varint not more than 10 bytes")}function xe(n,e,t){return t?e*4294967296+(n>>>0):(e>>>0)*4294967296+(n>>>0)}function Ei(n,e){let t,r;if(n>=0?(t=n%4294967296|0,r=n/4294967296|0):(t=~(-n%4294967296),r=~(-n/4294967296),t^4294967295?t=t+1|0:(t=0,r=r+1|0)),n>=18446744073709552e3||n<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),Li(t,r,e),Di(r,e)}function Li(n,e,t){t.buf[t.pos++]=n&127|128,n>>>=7,t.buf[t.pos++]=n&127|128,n>>>=7,t.buf[t.pos++]=n&127|128,n>>>=7,t.buf[t.pos++]=n&127|128,n>>>=7,t.buf[t.pos]=n&127}function Di(n,e){const t=(n&7)<<4;e.buf[e.pos++]|=t|((n>>>=3)?128:0),n&&(e.buf[e.pos++]=n&127|((n>>>=7)?128:0),n&&(e.buf[e.pos++]=n&127|((n>>>=7)?128:0),n&&(e.buf[e.pos++]=n&127|((n>>>=7)?128:0),n&&(e.buf[e.pos++]=n&127|((n>>>=7)?128:0),n&&(e.buf[e.pos++]=n&127)))))}function Hn(n,e,t){const r=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(Math.LN2*7));t.realloc(r);for(let i=t.pos-1;i>=n;i--)t.buf[i+r]=t.buf[i]}function Ai(n,e){for(let t=0;t<n.length;t++)e.writeVarint(n[t])}function Vi(n,e){for(let t=0;t<n.length;t++)e.writeSVarint(n[t])}function Ni(n,e){for(let t=0;t<n.length;t++)e.writeFloat(n[t])}function $i(n,e){for(let t=0;t<n.length;t++)e.writeDouble(n[t])}function Bi(n,e){for(let t=0;t<n.length;t++)e.writeBoolean(n[t])}function qi(n,e){for(let t=0;t<n.length;t++)e.writeFixed32(n[t])}function Oi(n,e){for(let t=0;t<n.length;t++)e.writeSFixed32(n[t])}function Ri(n,e){for(let t=0;t<n.length;t++)e.writeFixed64(n[t])}function ji(n,e){for(let t=0;t<n.length;t++)e.writeSFixed64(n[t])}function Gi(n,e,t){let r="",i=e;for(;i<t;){const s=n[i];let o=null,a=s>239?4:s>223?3:s>191?2:1;if(i+a>t)break;let l,u,c;a===1?s<128&&(o=s):a===2?(l=n[i+1],(l&192)===128&&(o=(s&31)<<6|l&63,o<=127&&(o=null))):a===3?(l=n[i+1],u=n[i+2],(l&192)===128&&(u&192)===128&&(o=(s&15)<<12|(l&63)<<6|u&63,(o<=2047||o>=55296&&o<=57343)&&(o=null))):a===4&&(l=n[i+1],u=n[i+2],c=n[i+3],(l&192)===128&&(u&192)===128&&(c&192)===128&&(o=(s&15)<<18|(l&63)<<12|(u&63)<<6|c&63,(o<=65535||o>=1114112)&&(o=null))),o===null?(o=65533,a=1):o>65535&&(o-=65536,r+=String.fromCharCode(o>>>10&1023|55296),o=56320|o&1023),r+=String.fromCharCode(o),i+=a}return r}function Xi(n,e,t){for(let r=0,i,s;r<e.length;r++){if(i=e.charCodeAt(r),i>55295&&i<57344)if(s)if(i<56320){n[t++]=239,n[t++]=191,n[t++]=189,s=i;continue}else i=s-55296<<10|i-56320|65536,s=null;else{i>56319||r+1===e.length?(n[t++]=239,n[t++]=191,n[t++]=189):s=i;continue}else s&&(n[t++]=239,n[t++]=191,n[t++]=189,s=null);i<128?n[t++]=i:(i<2048?n[t++]=i>>6|192:(i<65536?n[t++]=i>>12|224:(n[t++]=i>>18|240,n[t++]=i>>12&63|128),n[t++]=i>>6&63|128),n[t++]=i&63|128)}return t}class Wn extends $t{constructor(e,t){super(e,t)}async init(){const e=this.styleSource;let t=e.url;if(t&&!e.tiles){t=/^((http)|(https)|(data:)|\/)/.test(t)?t:this.path+e.url;try{const r=await Cesium.Resource.fetchJson(t);for(const i in r)e[i]||(e[i]=r[i])}catch(r){this.errorEvent.raiseEvent(r)}}}async requestTile(e,t,r){const i=this.styleSource;if(!i.tiles||!i.tiles.length)return;let s=i.tiles[0].replace("{x}",e).replace("{y}",t).replace("{z}",r);s=/^((http)|(https)|(data:)|\/)/.test(s)?s:this.path+s;try{const o=await fetch(s).then(l=>l.arrayBuffer());return new Ti(new Pi(o))}catch(o){this.errorEvent.raiseEvent(o)}}}qt("vector",Wn);function jt(n,e,t,r){let i=r;const s=e+(t-e>>1);let o=t-e,a;const l=n[e],u=n[e+1],c=n[t],f=n[t+1];for(let p=e+3;p<t;p+=3){const d=Zi(n[p],n[p+1],l,u,c,f);if(d>i)a=p,i=d;else if(d===i){const h=Math.abs(p-s);h<o&&(a=p,o=h)}}i>r&&(a-e>3&&jt(n,e,a,r),n[a+2]=i,t-a>3&&jt(n,a,t,r))}function Zi(n,e,t,r,i,s){let o=i-t,a=s-r;if(o!==0||a!==0){const l=((n-t)*o+(e-r)*a)/(o*o+a*a);l>1?(t=i,r=s):l>0&&(t+=o*l,r+=a*l)}return o=n-t,a=e-r,o*o+a*a}function De(n,e,t,r){const i={id:n??null,type:e,geometry:t,tags:r,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(e==="Point"||e==="MultiPoint"||e==="LineString")tt(i,t);else if(e==="Polygon")tt(i,t[0]);else if(e==="MultiLineString")for(const s of t)tt(i,s);else if(e==="MultiPolygon")for(const s of t)tt(i,s[0]);return i}function tt(n,e){for(let t=0;t<e.length;t+=3)n.minX=Math.min(n.minX,e[t]),n.minY=Math.min(n.minY,e[t+1]),n.maxX=Math.max(n.maxX,e[t]),n.maxY=Math.max(n.maxY,e[t+1])}function Ui(n,e){const t=[];if(n.type==="FeatureCollection")for(let r=0;r<n.features.length;r++)nt(t,n.features[r],e,r);else n.type==="Feature"?nt(t,n,e):nt(t,{geometry:n},e);return t}function nt(n,e,t,r){if(!e.geometry)return;const i=e.geometry.coordinates;if(i&&i.length===0)return;const s=e.geometry.type,o=Math.pow(t.tolerance/((1<<t.maxZoom)*t.extent),2);let a=[],l=e.id;if(t.promoteId?l=e.properties[t.promoteId]:t.generateId&&(l=r||0),s==="Point")Qn(i,a);else if(s==="MultiPoint")for(const u of i)Qn(u,a);else if(s==="LineString")Gt(i,a,o,!1);else if(s==="MultiLineString")if(t.lineMetrics){for(const u of i)a=[],Gt(u,a,o,!1),n.push(De(l,"LineString",a,e.properties));return}else Xt(i,a,o,!1);else if(s==="Polygon")Xt(i,a,o,!0);else if(s==="MultiPolygon")for(const u of i){const c=[];Xt(u,c,o,!0),a.push(c)}else if(s==="GeometryCollection"){for(const u of e.geometry.geometries)nt(n,{id:l,geometry:u,properties:e.properties},t,r);return}else throw new Error("Input data is not a valid GeoJSON object.");n.push(De(l,s,a,e.properties))}function Qn(n,e){e.push(Kn(n[0]),er(n[1]),0)}function Gt(n,e,t,r){let i,s,o=0;for(let l=0;l<n.length;l++){const u=Kn(n[l][0]),c=er(n[l][1]);e.push(u,c,0),l>0&&(r?o+=(i*c-u*s)/2:o+=Math.sqrt(Math.pow(u-i,2)+Math.pow(c-s,2))),i=u,s=c}const a=e.length-3;e[2]=1,jt(e,0,a,t),e[a+2]=1,e.size=Math.abs(o),e.start=0,e.end=e.size}function Xt(n,e,t,r){for(let i=0;i<n.length;i++){const s=[];Gt(n[i],s,t,r),e.push(s)}}function Kn(n){return n/360+.5}function er(n){const e=Math.sin(n*Math.PI/180),t=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return t<0?0:t>1?1:t}function re(n,e,t,r,i,s,o,a){if(t/=e,r/=e,s>=t&&o<r)return n;if(o<t||s>=r)return null;const l=[];for(const u of n){const c=u.geometry;let f=u.type;const p=i===0?u.minX:u.minY,d=i===0?u.maxX:u.maxY;if(p>=t&&d<r){l.push(u);continue}else if(d<t||p>=r)continue;let h=[];if(f==="Point"||f==="MultiPoint")Yi(c,h,t,r,i);else if(f==="LineString")tr(c,h,t,r,i,!1,a.lineMetrics);else if(f==="MultiLineString")Zt(c,h,t,r,i,!1);else if(f==="Polygon")Zt(c,h,t,r,i,!0);else if(f==="MultiPolygon")for(const y of c){const v=[];Zt(y,v,t,r,i,!0),v.length&&h.push(v)}if(h.length){if(a.lineMetrics&&f==="LineString"){for(const y of h)l.push(De(u.id,f,y,u.tags));continue}(f==="LineString"||f==="MultiLineString")&&(h.length===1?(f="LineString",h=h[0]):f="MultiLineString"),(f==="Point"||f==="MultiPoint")&&(f=h.length===3?"Point":"MultiPoint"),l.push(De(u.id,f,h,u.tags))}}return l.length?l:null}function Yi(n,e,t,r,i){for(let s=0;s<n.length;s+=3){const o=n[s+i];o>=t&&o<=r&&be(e,n[s],n[s+1],n[s+2])}}function tr(n,e,t,r,i,s,o){let a=nr(n);const l=i===0?Ji:Hi;let u=n.start,c,f;for(let b=0;b<n.length-3;b+=3){const w=n[b],m=n[b+1],x=n[b+2],C=n[b+3],M=n[b+4],k=i===0?w:m,_=i===0?C:M;let P=!1;o&&(c=Math.sqrt(Math.pow(w-C,2)+Math.pow(m-M,2))),k<t?_>t&&(f=l(a,w,m,C,M,t),o&&(a.start=u+c*f)):k>r?_<r&&(f=l(a,w,m,C,M,r),o&&(a.start=u+c*f)):be(a,w,m,x),_<t&&k>=t&&(f=l(a,w,m,C,M,t),P=!0),_>r&&k<=r&&(f=l(a,w,m,C,M,r),P=!0),!s&&P&&(o&&(a.end=u+c*f),e.push(a),a=nr(n)),o&&(u+=c)}let p=n.length-3;const d=n[p],h=n[p+1],y=n[p+2],v=i===0?d:h;v>=t&&v<=r&&be(a,d,h,y),p=a.length-3,s&&p>=3&&(a[p]!==a[0]||a[p+1]!==a[1])&&be(a,a[0],a[1],a[2]),a.length&&e.push(a)}function nr(n){const e=[];return e.size=n.size,e.start=n.start,e.end=n.end,e}function Zt(n,e,t,r,i,s){for(const o of n)tr(o,e,t,r,i,s,!1)}function be(n,e,t,r){n.push(e,t,r)}function Ji(n,e,t,r,i,s){const o=(s-e)/(r-e);return be(n,s,t+(i-t)*o,1),o}function Hi(n,e,t,r,i,s){const o=(s-t)/(i-t);return be(n,e+(r-e)*o,s,1),o}function Wi(n,e){const t=e.buffer/e.extent;let r=n;const i=re(n,1,-1-t,t,0,-1,2,e),s=re(n,1,1-t,2+t,0,-1,2,e);return(i||s)&&(r=re(n,1,-t,1+t,0,-1,2,e)||[],i&&(r=rr(i,1).concat(r)),s&&(r=r.concat(rr(s,-1)))),r}function rr(n,e){const t=[];for(let r=0;r<n.length;r++){const i=n[r],s=i.type;let o;if(s==="Point"||s==="MultiPoint"||s==="LineString")o=Ut(i.geometry,e);else if(s==="MultiLineString"||s==="Polygon"){o=[];for(const a of i.geometry)o.push(Ut(a,e))}else if(s==="MultiPolygon"){o=[];for(const a of i.geometry){const l=[];for(const u of a)l.push(Ut(u,e));o.push(l)}}t.push(De(i.id,s,o,i.tags))}return t}function Ut(n,e){const t=[];t.size=n.size,n.start!==void 0&&(t.start=n.start,t.end=n.end);for(let r=0;r<n.length;r+=3)t.push(n[r]+e,n[r+1],n[r+2]);return t}function ir(n,e){if(n.transformed)return n;const t=1<<n.z,r=n.x,i=n.y;for(const s of n.features){const o=s.geometry,a=s.type;if(s.geometry=[],a===1)for(let l=0;l<o.length;l+=2)s.geometry.push(sr(o[l],o[l+1],e,t,r,i));else for(let l=0;l<o.length;l++){const u=[];for(let c=0;c<o[l].length;c+=2)u.push(sr(o[l][c],o[l][c+1],e,t,r,i));s.geometry.push(u)}}return n.transformed=!0,n}function sr(n,e,t,r,i,s){return[Math.round(t*(n*r-i)),Math.round(t*(e*r-s))]}function Qi(n,e,t,r,i){const s=e===i.maxZoom?0:i.tolerance/((1<<e)*i.extent),o={features:[],numPoints:0,numSimplified:0,numFeatures:n.length,source:null,x:t,y:r,z:e,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const a of n)Ki(o,a,s,i);return o}function Ki(n,e,t,r){const i=e.geometry,s=e.type,o=[];if(n.minX=Math.min(n.minX,e.minX),n.minY=Math.min(n.minY,e.minY),n.maxX=Math.max(n.maxX,e.maxX),n.maxY=Math.max(n.maxY,e.maxY),s==="Point"||s==="MultiPoint")for(let a=0;a<i.length;a+=3)o.push(i[a],i[a+1]),n.numPoints++,n.numSimplified++;else if(s==="LineString")Yt(o,i,n,t,!1,!1);else if(s==="MultiLineString"||s==="Polygon")for(let a=0;a<i.length;a++)Yt(o,i[a],n,t,s==="Polygon",a===0);else if(s==="MultiPolygon")for(let a=0;a<i.length;a++){const l=i[a];for(let u=0;u<l.length;u++)Yt(o,l[u],n,t,!0,u===0)}if(o.length){let a=e.tags||null;if(s==="LineString"&&r.lineMetrics){a={};for(const u in e.tags)a[u]=e.tags[u];a.mapbox_clip_start=i.start/i.size,a.mapbox_clip_end=i.end/i.size}const l={geometry:o,type:s==="Polygon"||s==="MultiPolygon"?3:s==="LineString"||s==="MultiLineString"?2:1,tags:a};e.id!==null&&(l.id=e.id),n.features.push(l)}}function Yt(n,e,t,r,i,s){const o=r*r;if(r>0&&e.size<(i?o:r)){t.numPoints+=e.length/3;return}const a=[];for(let l=0;l<e.length;l+=3)(r===0||e[l+2]>o)&&(t.numSimplified++,a.push(e[l],e[l+1])),t.numPoints++;i&&es(a,s),n.push(a)}function es(n,e){let t=0;for(let r=0,i=n.length,s=i-2;r<i;s=r,r+=2)t+=(n[r]-n[s])*(n[r+1]+n[s+1]);if(t>0===e)for(let r=0,i=n.length;r<i/2;r+=2){const s=n[r],o=n[r+1];n[r]=n[i-2-r],n[r+1]=n[i-1-r],n[i-2-r]=s,n[i-1-r]=o}}const ts={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class ns{constructor(e,t){t=this.options=rs(Object.create(ts),t);const r=t.debug;if(r&&console.time("preprocess data"),t.maxZoom<0||t.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(t.promoteId&&t.generateId)throw new Error("promoteId and generateId cannot be used together.");let i=Ui(e,t);this.tiles={},this.tileCoords=[],r&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",t.indexMaxZoom,t.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),i=Wi(i,t),i.length&&this.splitTile(i,0,0,0),r&&(i.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}splitTile(e,t,r,i,s,o,a){const l=[e,t,r,i],u=this.options,c=u.debug;for(;l.length;){i=l.pop(),r=l.pop(),t=l.pop(),e=l.pop();const f=1<<t,p=Jt(t,r,i);let d=this.tiles[p];if(!d&&(c>1&&console.time("creation"),d=this.tiles[p]=Qi(e,t,r,i,u),this.tileCoords.push({z:t,x:r,y:i}),c)){c>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",t,r,i,d.numFeatures,d.numPoints,d.numSimplified),console.timeEnd("creation"));const _=`z${t}`;this.stats[_]=(this.stats[_]||0)+1,this.total++}if(d.source=e,s==null){if(t===u.indexMaxZoom||d.numPoints<=u.indexMaxPoints)continue}else{if(t===u.maxZoom||t===s)continue;if(s!=null){const _=s-t;if(r!==o>>_||i!==a>>_)continue}}if(d.source=null,e.length===0)continue;c>1&&console.time("clipping");const h=.5*u.buffer/u.extent,y=.5-h,v=.5+h,b=1+h;let w=null,m=null,x=null,C=null,M=re(e,f,r-h,r+v,0,d.minX,d.maxX,u),k=re(e,f,r+y,r+b,0,d.minX,d.maxX,u);e=null,M&&(w=re(M,f,i-h,i+v,1,d.minY,d.maxY,u),m=re(M,f,i+y,i+b,1,d.minY,d.maxY,u),M=null),k&&(x=re(k,f,i-h,i+v,1,d.minY,d.maxY,u),C=re(k,f,i+y,i+b,1,d.minY,d.maxY,u),k=null),c>1&&console.timeEnd("clipping"),l.push(w||[],t+1,r*2,i*2),l.push(m||[],t+1,r*2,i*2+1),l.push(x||[],t+1,r*2+1,i*2),l.push(C||[],t+1,r*2+1,i*2+1)}}getTile(e,t,r){e=+e,t=+t,r=+r;const i=this.options,{extent:s,debug:o}=i;if(e<0||e>24)return null;const a=1<<e;t=t+a&a-1;const l=Jt(e,t,r);if(this.tiles[l])return ir(this.tiles[l],s);o>1&&console.log("drilling down to z%d-%d-%d",e,t,r);let u=e,c=t,f=r,p;for(;!p&&u>0;)u--,c=c>>1,f=f>>1,p=this.tiles[Jt(u,c,f)];return!p||!p.source?null:(o>1&&(console.log("found parent tile z%d-%d-%d",u,c,f),console.time("drilling down")),this.splitTile(p.source,u,c,f,e,t,r),o>1&&console.timeEnd("drilling down"),this.tiles[l]?ir(this.tiles[l],s):null)}}function Jt(n,e,t){return((1<<n)*t+e)*32+n}function rs(n,e){for(const t in e)n[t]=e[t];return n}function is(n,e){return new ns(n,e)}class ss{constructor(e,t){this.feature=e,this.type=e.type,this.properties=e.tags?e.tags:{},this.extent=t,"id"in e&&(typeof e.id=="string"?this.id=parseInt(e.id,10):typeof e.id!="number"||isNaN(e.id)||(this.id=e.id))}loadGeometry(){const e=[],t=this.feature.type===1?[this.feature.geometry]:this.feature.geometry;for(const r of t){const i=[];for(const s of r)i.push(new N(s[0],s[1]));e.push(i)}return e}}const or="_geojsonTileLayer";class os{constructor(e,t){this.layers={[or]:this},this.name=or,this.version=t?t.version:1,this.extent=t?t.extent:4096,this.length=e.length,this.features=e}feature(e){return new ss(this.features[e],this.extent)}}const X=8192;class ar extends $t{constructor(e,t){super(e,t)}async init(){const e=this.styleSource;let t=e.data;if(typeof t=="string"){const r=/^((http)|(https)|(data:)|\/)/.test(t)?t:this.path+t;try{t=await Cesium.Resource.fetchJson(r)}catch(i){this.errorEvent.raiseEvent(i)}}t&&t.features?.length&&(this.tileIndex=new is(t,{extent:X,buffer:e.buffer===void 0?128:e.buffer,tolerance:e.tolerance===e.tolerance?.375:e.tolerance}))}async requestTile(e,t,r){if(this.tileIndex)try{const i=this.tileIndex.getTile(r,e,t);return i?new os(i.features,{extent:X}):void 0}catch(i){this.errorEvent.raiseEvent(i)}}}qt("geojson",ar);var as=8,ls={version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number",length:2},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},"font-faces":{type:"fontFaces"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},us={"*":{type:"source"}},cs=["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],fs={type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},encoding:{type:"enum",values:{mvt:{},mlt:{}},default:"mvt"},"*":{type:"*"}},ps={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:"*"}},hs={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:"*"}},ds={type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"filter"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},ys={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"}}},ms={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"}}},gs={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"}},vs=["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],xs={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},bs={"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},ws={"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},Cs={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},_s={"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",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},Is={"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},zs={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},Ms={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},Ts={type:"boolean",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},ks={type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},Ss={type:"enum",values:{Point:{},LineString:{},Polygon:{}}},Ps={type:"array",minimum:0,maximum:24,value:["number","color"],length:2},Fs={type:"array",value:"expression_name",minimum:1},Es={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}},Ls={"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}},Ds={source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},As={type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},Vs=["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],Ns={"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"}},$s={"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},Bs={"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"}},qs={"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"}},Os={"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"}},Rs={"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"}},js={"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"}},Gs={"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"}},Xs={duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},Zs={"*":{type:"string"}},Us={type:"array",value:"interpolation_name",minimum:1},Ys={type:"enum",values:{linear:{syntax:{overloads:[{parameters:[],"output-type":"interpolation"}],parameters:[]}},exponential:{syntax:{overloads:[{parameters:["base"],"output-type":"interpolation"}],parameters:[{name:"base",type:"number literal"}]}},"cubic-bezier":{syntax:{overloads:[{parameters:["x1","y1","x2","y2"],"output-type":"interpolation"}],parameters:[{name:"x1",type:"number literal"},{name:"y1",type:"number literal"},{name:"x2",type:"number literal"},{name:"y2",type:"number literal"}]}}}},Js={$version:as,$root:ls,sources:us,source:cs,source_vector:fs,source_raster:ps,source_raster_dem:hs,source_geojson:ds,source_video:ys,source_image:ms,layer:gs,layout:vs,layout_background:xs,layout_fill:bs,layout_circle:ws,layout_heatmap:Cs,"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_line:_s,layout_symbol:Is,layout_raster:zs,layout_hillshade:Ms,"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},filter:Ts,filter_operator:ks,geometry_type:Ss,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:Ps,expression:Fs,light:Es,sky:Ls,terrain:Ds,projection:As,paint:Vs,paint_fill:Ns,"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:$s,paint_circle:Bs,paint_heatmap:qs,paint_symbol:Os,paint_raster:Rs,paint_hillshade:js,"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:Gs,transition:Xs,"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:Zs,interpolation:Us,interpolation_name:Ys};function lr(n,...e){for(const t of e)for(const r in t)n[r]=t[r];return n}class Q extends Error{constructor(e,t){super(t),this.message=t,this.key=e}}class Ht{constructor(e,t=[]){this.parent=e,this.bindings={};for(const[r,i]of t)this.bindings[r]=i}concat(e){return new Ht(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}}const rt={kind:"null"},g={kind:"number"},T={kind:"string"},z={kind:"boolean"},K={kind:"color"},it={kind:"projectionDefinition"},fe={kind:"object"},I={kind:"value"},Hs={kind:"error"},st={kind:"collator"},ot={kind:"formatted"},at={kind:"padding"},Ae={kind:"colorArray"},lt={kind:"numberArray"},Ve={kind:"resolvedImage"},ut={kind:"variableAnchorOffsetCollection"};function j(n,e){return{kind:"array",itemType:n,N:e}}function E(n){if(n.kind==="array"){const e=E(n.itemType);return typeof n.N=="number"?`array<${e}, ${n.N}>`:n.itemType.kind==="value"?"array":`array<${e}>`}else return n.kind}const Ws=[rt,g,T,z,K,it,ot,fe,j(I),at,lt,Ae,Ve,ut];function Ne(n,e){if(e.kind==="error")return null;if(n.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!Ne(n.itemType,e.itemType))&&(typeof n.N!="number"||n.N===e.N))return null}else{if(n.kind===e.kind)return null;if(n.kind==="value"){for(const t of Ws)if(!Ne(t,e))return null}}return`Expected ${E(n)} but found ${E(e)} instead.`}function Wt(n,e){return e.some(t=>t.kind===n.kind)}function pe(n,e){return e.some(t=>t==="null"?n===null:t==="array"?Array.isArray(n):t==="object"?n&&!Array.isArray(n)&&typeof n=="object":t===typeof n)}function oe(n,e){return n.kind==="array"&&e.kind==="array"?n.itemType.kind===e.itemType.kind&&typeof n.N=="number":n.kind===e.kind}const ur=.96422,cr=1,fr=.82521,pr=4/29,we=6/29,hr=3*we*we,Qs=we*we*we,Ks=Math.PI/180,eo=180/Math.PI;function dr(n){return n=n%360,n<0&&(n+=360),n}function yr([n,e,t,r]){n=Qt(n),e=Qt(e),t=Qt(t);let i,s;const o=Kt((.2225045*n+.7168786*e+.0606169*t)/cr);n===e&&e===t?i=s=o:(i=Kt((.4360747*n+.3850649*e+.1430804*t)/ur),s=Kt((.0139322*n+.0971045*e+.7141733*t)/fr));const a=116*o-16;return[a<0?0:a,500*(i-o),200*(o-s),r]}function Qt(n){return n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4)}function Kt(n){return n>Qs?Math.pow(n,1/3):n/hr+pr}function mr([n,e,t,r]){let i=(n+16)/116,s=isNaN(e)?i:i+e/500,o=isNaN(t)?i:i-t/200;return i=cr*tn(i),s=ur*tn(s),o=fr*tn(o),[en(3.1338561*s-1.6168667*i-.4906146*o),en(-.9787684*s+1.9161415*i+.033454*o),en(.0719453*s-.2289914*i+1.4052427*o),r]}function en(n){return n=n<=.00304?12.92*n:1.055*Math.pow(n,1/2.4)-.055,n<0?0:n>1?1:n}function tn(n){return n>we?n*n*n:hr*(n-pr)}function to(n){const[e,t,r,i]=yr(n),s=Math.sqrt(t*t+r*r);return[Math.round(s*1e4)?dr(Math.atan2(r,t)*eo):NaN,s,e,i]}function no([n,e,t,r]){return n=isNaN(n)?0:n*Ks,mr([t,Math.cos(n)*e,Math.sin(n)*e,r])}function ro([n,e,t,r]){n=dr(n),e/=100,t/=100;function i(s){const o=(s+n/30)%12,a=e*Math.min(t,1-t);return t-a*Math.max(-1,Math.min(o-3,9-o,1))}return[i(0),i(8),i(4),r]}const io=Object.hasOwn||function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};function gr(n,e){return io(n,e)?n[e]:void 0}function so(n){if(n=n.toLowerCase().trim(),n==="transparent")return[0,0,0,0];const e=gr(oo,n);if(e){const[i,s,o]=e;return[i/255,s/255,o/255,1]}if(n.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(n)){const s=n.length<6?1:2;let o=1;return[ct(n.slice(o,o+=s)),ct(n.slice(o,o+=s)),ct(n.slice(o,o+=s)),ct(n.slice(o,o+s)||"ff")]}if(n.startsWith("rgb")){const i=/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/,s=n.match(i);if(s){const[o,a,l,u,c,f,p,d,h,y,v,b]=s,w=[u||" ",p||" ",y].join("");if(w===" "||w===" /"||w===",,"||w===",,,"){const m=[l,f,h].join(""),x=m==="%%%"?100:m===""?255:0;if(x){const C=[Ce(+a/x,0,1),Ce(+c/x,0,1),Ce(+d/x,0,1),v?vr(+v,b):1];if(xr(C))return C}}return}}const t=/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/,r=n.match(t);if(r){const[i,s,o,a,l,u,c,f,p]=r,d=[o||" ",l||" ",c].join("");if(d===" "||d===" /"||d===",,"||d===",,,"){const h=[+s,Ce(+a,0,100),Ce(+u,0,100),f?vr(+f,p):1];if(xr(h))return ro(h)}}}function ct(n){return parseInt(n.padEnd(2,n),16)/255}function vr(n,e){return Ce(e?n/100:n,0,1)}function Ce(n,e,t){return Math.min(Math.max(e,n),t)}function xr(n){return!n.some(Number.isNaN)}const oo={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(n,e,t){return n+t*(e-n)}function _e(n,e,t){return n.map((r,i)=>ae(r,e[i],t))}function ao(n){return n==="rgb"||n==="hcl"||n==="lab"}class S{constructor(e,t,r,i=1,s=!0){this.r=e,this.g=t,this.b=r,this.a=i,s||(this.r*=i,this.g*=i,this.b*=i,i||this.overwriteGetter("rgb",[e,t,r,i]))}static parse(e){if(e instanceof S)return e;if(typeof e!="string")return;const t=so(e);if(t)return new S(...t,!1)}get rgb(){const{r:e,g:t,b:r,a:i}=this,s=i||1/0;return this.overwriteGetter("rgb",[e/s,t/s,r/s,i])}get hcl(){return this.overwriteGetter("hcl",to(this.rgb))}get lab(){return this.overwriteGetter("lab",yr(this.rgb))}overwriteGetter(e,t){return Object.defineProperty(this,e,{value:t}),t}toString(){const[e,t,r,i]=this.rgb;return`rgba(${[e,t,r].map(s=>Math.round(s*255)).join(",")},${i})`}static interpolate(e,t,r,i="rgb"){switch(i){case"rgb":{const[s,o,a,l]=_e(e.rgb,t.rgb,r);return new S(s,o,a,l,!1)}case"hcl":{const[s,o,a,l]=e.hcl,[u,c,f,p]=t.hcl;let d,h;if(!isNaN(s)&&!isNaN(u)){let m=u-s;u>s&&m>180?m-=360:u<s&&s-u>180&&(m+=360),d=s+r*m}else isNaN(s)?isNaN(u)?d=NaN:(d=u,(a===1||a===0)&&(h=c)):(d=s,(f===1||f===0)&&(h=o));const[y,v,b,w]=no([d,h??ae(o,c,r),ae(a,f,r),ae(l,p,r)]);return new S(y,v,b,w,!1)}case"lab":{const[s,o,a,l]=mr(_e(e.lab,t.lab,r));return new S(s,o,a,l,!1)}}}}S.black=new S(0,0,0,1),S.white=new S(1,1,1,1),S.transparent=new S(0,0,0,0),S.red=new S(1,0,0,1);class nn{constructor(e,t,r){e?this.sensitivity=t?"variant":"case":this.sensitivity=t?"accent":"base",this.locale=r,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,t){return this.collator.compare(e,t)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}const lo=["bottom","center","top"];class rn{constructor(e,t,r,i,s,o){this.text=e,this.image=t,this.scale=r,this.fontStack=i,this.textColor=s,this.verticalAlign=o}}class ee{constructor(e){this.sections=e}static fromString(e){return new ee([new rn(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 ee?e:ee.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}}class B{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof B)return e;if(typeof e=="number")return new B([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(const t of e)if(typeof t!="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 B(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,r){return new B(_e(e.values,t.values,r))}}class q{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof q)return e;if(typeof e=="number")return new q([e]);if(Array.isArray(e)){for(const t of e)if(typeof t!="number")return;return new q(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,r){return new q(_e(e.values,t.values,r))}}class ${constructor(e){this.values=e.slice()}static parse(e){if(e instanceof $)return e;if(typeof e=="string"){const r=S.parse(e);return r?new $([r]):void 0}if(!Array.isArray(e))return;const t=[];for(const r of e){if(typeof r!="string")return;const i=S.parse(r);if(!i)return;t.push(i)}return new $(t)}toString(){return JSON.stringify(this.values)}static interpolate(e,t,r,i="rgb"){const s=[];if(e.values.length!=t.values.length)throw new Error(`colorArray: Arrays have mismatched length (${e.values.length} vs. ${t.values.length}), cannot interpolate.`);for(let o=0;o<e.values.length;o++)s.push(S.interpolate(e.values[o],t.values[o],r,i));return new $(s)}}class L extends Error{constructor(e){super(e),this.name="RuntimeError"}toJSON(){return this.message}}const uo=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Z{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Z)return e;if(!(!Array.isArray(e)||e.length<1||e.length%2!==0)){for(let t=0;t<e.length;t+=2){const r=e[t],i=e[t+1];if(typeof r!="string"||!uo.has(r)||!Array.isArray(i)||i.length!==2||typeof i[0]!="number"||typeof i[1]!="number")return}return new Z(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,r){const i=e.values,s=t.values;if(i.length!==s.length)throw new L(`Cannot interpolate values of different length. from: ${e.toString()}, to: ${t.toString()}`);const o=[];for(let a=0;a<i.length;a+=2){if(i[a]!==s[a])throw new L(`Cannot interpolate values containing mismatched anchors. from[${a}]: ${i[a]}, to[${a}]: ${s[a]}`);o.push(i[a]);const[l,u]=i[a+1],[c,f]=s[a+1];o.push([ae(l,c,r),ae(u,f,r)])}return new Z(o)}}class te{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new te({name:e,available:!1}):null}}class U{constructor(e,t,r){this.from=e,this.to=t,this.transition=r}static interpolate(e,t,r){return new U(e,t,r)}static parse(e){if(e instanceof U)return e;if(Array.isArray(e)&&e.length===3&&typeof e[0]=="string"&&typeof e[1]=="string"&&typeof e[2]=="number")return new U(e[0],e[1],e[2]);if(typeof e=="object"&&typeof e.from=="string"&&typeof e.to=="string"&&typeof e.transition=="number")return new U(e.from,e.to,e.transition);if(typeof e=="string")return new U(e,e,1)}}function br(n,e,t,r){return typeof n=="number"&&n>=0&&n<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof t=="number"&&t>=0&&t<=255?typeof r>"u"||typeof r=="number"&&r>=0&&r<=1?null:`Invalid rgba value [${[n,e,t,r].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof r=="number"?[n,e,t,r]:[n,e,t]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function $e(n){if(n===null||typeof n=="string"||typeof n=="boolean"||typeof n=="number"||n instanceof U||n instanceof S||n instanceof nn||n instanceof ee||n instanceof B||n instanceof q||n instanceof $||n instanceof Z||n instanceof te)return!0;if(Array.isArray(n)){for(const e of n)if(!$e(e))return!1;return!0}else if(typeof n=="object"){for(const e in n)if(!$e(n[e]))return!1;return!0}else return!1}function A(n){if(n===null)return rt;if(typeof n=="string")return T;if(typeof n=="boolean")return z;if(typeof n=="number")return g;if(n instanceof S)return K;if(n instanceof U)return it;if(n instanceof nn)return st;if(n instanceof ee)return ot;if(n instanceof B)return at;if(n instanceof q)return lt;if(n instanceof $)return Ae;if(n instanceof Z)return ut;if(n instanceof te)return Ve;if(Array.isArray(n)){const e=n.length;let t;for(const r of n){const i=A(r);if(!t)t=i;else{if(t===i)continue;t=I;break}}return j(t||I,e)}else return fe}function Be(n){const e=typeof n;return n===null?"":e==="string"||e==="number"||e==="boolean"?String(n):n instanceof S||n instanceof U||n instanceof ee||n instanceof B||n instanceof q||n instanceof $||n instanceof Z||n instanceof te?n.toString():JSON.stringify(n)}class Ie{constructor(e,t){this.type=e,this.value=t}static parse(e,t){if(e.length!==2)return t.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!$e(e[1]))return t.error("invalid value");const r=e[1];let i=A(r);const s=t.expectedType;return i.kind==="array"&&i.N===0&&s&&s.kind==="array"&&(typeof s.N!="number"||s.N===0)&&(i=s),new Ie(i,r)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}const ft={string:T,number:g,boolean:z,object:fe};class W{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let r=1,i;const s=e[0];if(s==="array"){let a;if(e.length>2){const u=e[1];if(typeof u!="string"||!(u in ft)||u==="object")return t.error('The item type argument of "array" must be one of string, number, boolean',1);a=ft[u],r++}else a=I;let l;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return t.error('The length argument to "array" must be a positive integer literal',2);l=e[2],r++}i=j(a,l)}else{if(!ft[s])throw new Error(`Types doesn't contain name = ${s}`);i=ft[s]}const o=[];for(;r<e.length;r++){const a=t.parse(e[r],r,I);if(!a)return null;o.push(a)}return new W(i,o)}evaluate(e){for(let t=0;t<this.args.length;t++){const r=this.args[t].evaluate(e);if(Ne(this.type,A(r))){if(t===this.args.length-1)throw new L(`Expected value to be of type ${E(this.type)}, but found ${E(A(r))} instead.`)}else return r}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const wr={"to-boolean":z,"to-color":K,"to-number":g,"to-string":T};class le{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const r=e[0];if(!wr[r])throw new Error(`Can't parse ${r} as it is not part of the known types`);if((r==="to-boolean"||r==="to-string")&&e.length!==2)return t.error("Expected one argument.");const i=wr[r],s=[];for(let o=1;o<e.length;o++){const a=t.parse(e[o],o,I);if(!a)return null;s.push(a)}return new le(i,s)}evaluate(e){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(e);case"color":{let t,r;for(const i of this.args){if(t=i.evaluate(e),r=null,t instanceof S)return t;if(typeof t=="string"){const s=e.parseColor(t);if(s)return s}else if(Array.isArray(t)&&(t.length<3||t.length>4?r=`Invalid rgba value ${JSON.stringify(t)}: expected an array containing either three or four numeric values.`:r=br(t[0],t[1],t[2],t[3]),!r))return new S(t[0]/255,t[1]/255,t[2]/255,t[3])}throw new L(r||`Could not parse color from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"padding":{let t;for(const r of this.args){t=r.evaluate(e);const i=B.parse(t);if(i)return i}throw new L(`Could not parse padding from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"numberArray":{let t;for(const r of this.args){t=r.evaluate(e);const i=q.parse(t);if(i)return i}throw new L(`Could not parse numberArray from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"colorArray":{let t;for(const r of this.args){t=r.evaluate(e);const i=$.parse(t);if(i)return i}throw new L(`Could not parse colorArray from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"variableAnchorOffsetCollection":{let t;for(const r of this.args){t=r.evaluate(e);const i=Z.parse(t);if(i)return i}throw new L(`Could not parse variableAnchorOffsetCollection from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"number":{let t=null;for(const r of this.args){if(t=r.evaluate(e),t===null)return 0;const i=Number(t);if(!isNaN(i))return i}throw new L(`Could not convert ${JSON.stringify(t)} to number.`)}case"formatted":return ee.fromString(Be(this.args[0].evaluate(e)));case"resolvedImage":return te.fromString(Be(this.args[0].evaluate(e)));case"projectionDefinition":return this.args[0].evaluate(e);default:return Be(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const co=["Unknown","Point","LineString","Polygon"];class Cr{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"?co[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 t=this._parseColorCache.get(e);return t||(t=S.parse(e),this._parseColorCache.set(e,t)),t}}class pt{constructor(e,t,r=[],i,s=new Ht,o=[]){this.registry=e,this.path=r,this.key=r.map(a=>`[${a}]`).join(""),this.scope=s,this.errors=o,this.expectedType=i,this._isConstant=t}parse(e,t,r,i,s={}){return t?this.concat(t,r,i)._parse(e,s):this._parse(e,s)}_parse(e,t){(e===null||typeof e=="string"||typeof e=="boolean"||typeof e=="number")&&(e=["literal",e]);function r(i,s,o){return o==="assert"?new W(s,[i]):o==="coerce"?new le(s,[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", []].');const 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;const s=this.registry[i];if(s){let o=s.parse(e,this);if(!o)return null;if(this.expectedType){const a=this.expectedType,l=o.type;if((a.kind==="string"||a.kind==="number"||a.kind==="boolean"||a.kind==="object"||a.kind==="array")&&l.kind==="value")o=r(o,a,t.typeAnnotation||"assert");else if(a.kind==="projectionDefinition"&&["string","array"].includes(l.kind)||["color","formatted","resolvedImage"].includes(a.kind)&&["value","string"].includes(l.kind)||["padding","numberArray"].includes(a.kind)&&["value","number","array"].includes(l.kind)||a.kind==="colorArray"&&["value","string","array"].includes(l.kind)||a.kind==="variableAnchorOffsetCollection"&&["value","array"].includes(l.kind))o=r(o,a,t.typeAnnotation||"coerce");else if(this.checkSubtype(a,l))return null}if(!(o instanceof Ie)&&o.type.kind!=="resolvedImage"&&this._isConstant(o)){const a=new Cr;try{o=new Ie(o.type,o.evaluate(a))}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,t,r){const i=typeof e=="number"?this.path.concat(e):this.path,s=r?this.scope.concat(r):this.scope;return new pt(this.registry,this._isConstant,i,t||null,s,this.errors)}error(e,...t){const r=`${this.key}${t.map(i=>`[${i}]`).join("")}`;this.errors.push(new Q(r,e))}checkSubtype(e,t){const r=Ne(e,t);return r&&this.error(r),r}}class ht{constructor(e,t){this.type=t.type,this.bindings=[].concat(e),this.result=t}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const t of this.bindings)e(t[1]);e(this.result)}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const r=[];for(let s=1;s<e.length-1;s+=2){const o=e[s];if(typeof o!="string")return t.error(`Expected string, but found ${typeof o} instead.`,s);if(/[^a-zA-Z0-9_]/.test(o))return t.error("Variable names must contain only alphanumeric characters or '_'.",s);const a=t.parse(e[s+1],s+1);if(!a)return null;r.push([o,a])}const i=t.parse(e[e.length-1],e.length-1,t.expectedType,r);return i?new ht(r,i):null}outputDefined(){return this.result.outputDefined()}}class dt{constructor(e,t){this.type=t.type,this.name=e,this.boundExpression=t}static parse(e,t){if(e.length!==2||typeof e[1]!="string")return t.error("'var' expression requires exactly one string literal argument.");const r=e[1];return t.scope.has(r)?new dt(r,t.scope.get(r)):t.error(`Unknown variable "${r}". Make sure "${r}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}}class sn{constructor(e,t,r){this.type=e,this.index=t,this.input=r}static parse(e,t){if(e.length!==3)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const r=t.parse(e[1],1,g),i=t.parse(e[2],2,j(t.expectedType||I));if(!r||!i)return null;const s=i.type;return new sn(s.itemType,r,i)}evaluate(e){const t=this.index.evaluate(e),r=this.input.evaluate(e);if(t<0)throw new L(`Array index out of bounds: ${t} < 0.`);if(t>=r.length)throw new L(`Array index out of bounds: ${t} > ${r.length-1}.`);if(t!==Math.floor(t))throw new L(`Array index must be an integer, but found ${t} instead.`);return r[t]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class on{constructor(e,t){this.type=z,this.needle=e,this.haystack=t}static parse(e,t){if(e.length!==3)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const r=t.parse(e[1],1,I),i=t.parse(e[2],2,I);return!r||!i?null:Wt(r.type,[z,T,g,rt,I])?new on(r,i):t.error(`Expected first argument to be of type boolean, string, number or null, but found ${E(r.type)} instead`)}evaluate(e){const t=this.needle.evaluate(e),r=this.haystack.evaluate(e);if(!r)return!1;if(!pe(t,["boolean","string","number","null"]))throw new L(`Expected first argument to be of type boolean, string, number or null, but found ${E(A(t))} instead.`);if(!pe(r,["string","array"]))throw new L(`Expected second argument to be of type array or string, but found ${E(A(r))} instead.`);return r.indexOf(t)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class yt{constructor(e,t,r){this.type=g,this.needle=e,this.haystack=t,this.fromIndex=r}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);const r=t.parse(e[1],1,I),i=t.parse(e[2],2,I);if(!r||!i)return null;if(!Wt(r.type,[z,T,g,rt,I]))return t.error(`Expected first argument to be of type boolean, string, number or null, but found ${E(r.type)} instead`);if(e.length===4){const s=t.parse(e[3],3,g);return s?new yt(r,i,s):null}else return new yt(r,i)}evaluate(e){const t=this.needle.evaluate(e),r=this.haystack.evaluate(e);if(!pe(t,["boolean","string","number","null"]))throw new L(`Expected first argument to be of type boolean, string, number or null, but found ${E(A(t))} instead.`);let i;if(this.fromIndex&&(i=this.fromIndex.evaluate(e)),pe(r,["string"])){const s=r.indexOf(t,i);return s===-1?-1:[...r.slice(0,s)].length}else{if(pe(r,["array"]))return r.indexOf(t,i);throw new L(`Expected second argument to be of type array or string, but found ${E(A(r))} instead.`)}}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class an{constructor(e,t,r,i,s,o){this.inputType=e,this.type=t,this.input=r,this.cases=i,this.outputs=s,this.otherwise=o}static parse(e,t){if(e.length<5)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!==1)return t.error("Expected an even number of arguments.");let r,i;t.expectedType&&t.expectedType.kind!=="value"&&(i=t.expectedType);const s={},o=[];for(let u=2;u<e.length-1;u+=2){let c=e[u];const f=e[u+1];Array.isArray(c)||(c=[c]);const p=t.concat(u);if(c.length===0)return p.error("Expected at least one branch label.");for(const h of c){if(typeof h!="number"&&typeof h!="string")return p.error("Branch labels must be numbers or strings.");if(typeof h=="number"&&Math.abs(h)>Number.MAX_SAFE_INTEGER)return p.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof h=="number"&&Math.floor(h)!==h)return p.error("Numeric branch labels must be integer values.");if(!r)r=A(h);else if(p.checkSubtype(r,A(h)))return null;if(typeof s[String(h)]<"u")return p.error("Branch labels must be unique.");s[String(h)]=o.length}const d=t.parse(f,u,i);if(!d)return null;i=i||d.type,o.push(d)}const a=t.parse(e[1],1,I);if(!a)return null;const l=t.parse(e[e.length-1],e.length-1,i);return!l||a.type.kind!=="value"&&t.concat(1).checkSubtype(r,a.type)?null:new an(r,i,a,s,o,l)}evaluate(e){const t=this.input.evaluate(e);return(A(t)===this.inputType&&this.outputs[this.cases[t]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}}class ln{constructor(e,t,r){this.type=e,this.branches=t,this.otherwise=r}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!==0)return t.error("Expected an odd number of arguments.");let r;t.expectedType&&t.expectedType.kind!=="value"&&(r=t.expectedType);const i=[];for(let o=1;o<e.length-1;o+=2){const a=t.parse(e[o],o,z);if(!a)return null;const l=t.parse(e[o+1],o+1,r);if(!l)return null;i.push([a,l]),r=r||l.type}const s=t.parse(e[e.length-1],e.length-1,r);if(!s)return null;if(!r)throw new Error("Can't infer output type");return new ln(r,i,s)}evaluate(e){for(const[t,r]of this.branches)if(t.evaluate(e))return r.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[t,r]of this.branches)e(t),e(r);e(this.otherwise)}outputDefined(){return this.branches.every(([e,t])=>t.outputDefined())&&this.otherwise.outputDefined()}}class mt{constructor(e,t,r,i){this.type=e,this.input=t,this.beginIndex=r,this.endIndex=i}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);const r=t.parse(e[1],1,I),i=t.parse(e[2],2,g);if(!r||!i)return null;if(!Wt(r.type,[j(I),T,I]))return t.error(`Expected first argument to be of type array or string, but found ${E(r.type)} instead`);if(e.length===4){const s=t.parse(e[3],3,g);return s?new mt(r.type,r,i,s):null}else return new mt(r.type,r,i)}evaluate(e){const t=this.input.evaluate(e),r=this.beginIndex.evaluate(e);let i;if(this.endIndex&&(i=this.endIndex.evaluate(e)),pe(t,["string"]))return[...t].slice(r,i).join("");if(pe(t,["array"]))return t.slice(r,i);throw new L(`Expected first argument to be of type array or string, but found ${E(A(t))} instead.`)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function gt(n,e){const t=n.length-1;let r=0,i=t,s=0,o,a;for(;r<=i;)if(s=Math.floor((r+i)/2),o=n[s],a=n[s+1],o<=e){if(s===t||e<a)return s;r=s+1}else if(o>e)i=s-1;else throw new L("Input is not a number.");return 0}class vt{constructor(e,t,r){this.type=e,this.input=t,this.labels=[],this.outputs=[];for(const[i,s]of r)this.labels.push(i),this.outputs.push(s)}static parse(e,t){if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!==0)return t.error("Expected an even number of arguments.");const r=t.parse(e[1],1,g);if(!r)return null;const i=[];let s=null;t.expectedType&&t.expectedType.kind!=="value"&&(s=t.expectedType);for(let o=1;o<e.length;o+=2){const a=o===1?-1/0:e[o],l=e[o+1],u=o,c=o+1;if(typeof a!="number")return t.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]>=a)return t.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',u);const f=t.parse(l,c,s);if(!f)return null;s=s||f.type,i.push([a,f])}return new vt(s,r,i)}evaluate(e){const t=this.labels,r=this.outputs;if(t.length===1)return r[0].evaluate(e);const i=this.input.evaluate(e);if(i<=t[0])return r[0].evaluate(e);const s=t.length;if(i>=t[s-1])return r[s-1].evaluate(e);const o=gt(t,i);return r[o].evaluate(e)}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function fo(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var un,_r;function po(){if(_r)return un;_r=1,un=n;function n(e,t,r,i){this.cx=3*e,this.bx=3*(r-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(i-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=r,this.p2y=i}return n.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,t){if(t===void 0&&(t=1e-6),e<0)return 0;if(e>1)return 1;for(var r=e,i=0;i<8;i++){var s=this.sampleCurveX(r)-e;if(Math.abs(s)<t)return r;var o=this.sampleCurveDerivativeX(r);if(Math.abs(o)<1e-6)break;r=r-s/o}var a=0,l=1;for(r=e,i=0;i<20&&(s=this.sampleCurveX(r),!(Math.abs(s-e)<t));i++)e>s?a=r:l=r,r=(l-a)*.5+a;return r},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}},un}var ho=po(),yo=fo(ho);class Y{constructor(e,t,r,i,s){this.type=e,this.operator=t,this.interpolation=r,this.input=i,this.labels=[],this.outputs=[];for(const[o,a]of s)this.labels.push(o),this.outputs.push(a)}static interpolationFactor(e,t,r,i){let s=0;if(e.name==="exponential")s=cn(t,e.base,r,i);else if(e.name==="linear")s=cn(t,1,r,i);else if(e.name==="cubic-bezier"){const o=e.controlPoints;s=new yo(o[0],o[1],o[2],o[3]).solve(cn(t,1,r,i))}return s}static parse(e,t){let[r,i,s,...o]=e;if(!Array.isArray(i)||i.length===0)return t.error("Expected an interpolation type expression.",1);if(i[0]==="linear")i={name:"linear"};else if(i[0]==="exponential"){const u=i[1];if(typeof u!="number")return t.error("Exponential interpolation requires a numeric base.",1,1);i={name:"exponential",base:u}}else if(i[0]==="cubic-bezier"){const u=i.slice(1);if(u.length!==4||u.some(c=>typeof c!="number"||c<0||c>1))return t.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);i={name:"cubic-bezier",controlPoints:u}}else return t.error(`Unknown interpolation type ${String(i[0])}`,1,0);if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!==0)return t.error("Expected an even number of arguments.");if(s=t.parse(s,2,g),!s)return null;const a=[];let l=null;(r==="interpolate-hcl"||r==="interpolate-lab")&&t.expectedType!=Ae?l=K:t.expectedType&&t.expectedType.kind!=="value"&&(l=t.expectedType);for(let u=0;u<o.length;u+=2){const c=o[u],f=o[u+1],p=u+3,d=u+4;if(typeof c!="number")return t.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',p);if(a.length&&a[a.length-1][0]>=c)return t.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',p);const h=t.parse(f,d,l);if(!h)return null;l=l||h.type,a.push([c,h])}return!oe(l,g)&&!oe(l,it)&&!oe(l,K)&&!oe(l,at)&&!oe(l,lt)&&!oe(l,Ae)&&!oe(l,ut)&&!oe(l,j(g))?t.error(`Type ${E(l)} is not interpolatable.`):new Y(l,r,i,s,a)}evaluate(e){const t=this.labels,r=this.outputs;if(t.length===1)return r[0].evaluate(e);const i=this.input.evaluate(e);if(i<=t[0])return r[0].evaluate(e);const s=t.length;if(i>=t[s-1])return r[s-1].evaluate(e);const o=gt(t,i),a=t[o],l=t[o+1],u=Y.interpolationFactor(this.interpolation,i,a,l),c=r[o].evaluate(e),f=r[o+1].evaluate(e);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return ae(c,f,u);case"color":return S.interpolate(c,f,u);case"padding":return B.interpolate(c,f,u);case"colorArray":return $.interpolate(c,f,u);case"numberArray":return q.interpolate(c,f,u);case"variableAnchorOffsetCollection":return Z.interpolate(c,f,u);case"array":return _e(c,f,u);case"projectionDefinition":return U.interpolate(c,f,u)}case"interpolate-hcl":switch(this.type.kind){case"color":return S.interpolate(c,f,u,"hcl");case"colorArray":return $.interpolate(c,f,u,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return S.interpolate(c,f,u,"lab");case"colorArray":return $.interpolate(c,f,u,"lab")}}}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function cn(n,e,t,r){const i=r-t,s=n-t;return i===0?0:e===1?s/i:(Math.pow(e,s)-1)/(Math.pow(e,i)-1)}const mo={color:S.interpolate,number:ae,padding:B.interpolate,numberArray:q.interpolate,colorArray:$.interpolate,variableAnchorOffsetCollection:Z.interpolate,array:_e};class qe{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let r=null;const i=t.expectedType;i&&i.kind!=="value"&&(r=i);const s=[];for(const a of e.slice(1)){const l=t.parse(a,1+s.length,r,void 0,{typeAnnotation:"omit"});if(!l)return null;r=r||l.type,s.push(l)}if(!r)throw new Error("No output type");return i&&s.some(a=>Ne(i,a.type))?new qe(I,s):new qe(r,s)}evaluate(e){let t=null,r=0,i;for(const s of this.args)if(r++,t=s.evaluate(e),t&&t instanceof te&&!t.available&&(i||(i=t.name),t=null,r===this.args.length&&(t=i)),t!==null)break;return t}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}function Ir(n,e){return n==="=="||n==="!="?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 go(n,e,t){return e===t}function vo(n,e,t){return e!==t}function xo(n,e,t){return e<t}function bo(n,e,t){return e>t}function wo(n,e,t){return e<=t}function Co(n,e,t){return e>=t}function zr(n,e,t,r){return r.compare(e,t)===0}function _o(n,e,t,r){return!zr(n,e,t,r)}function Io(n,e,t,r){return r.compare(e,t)<0}function zo(n,e,t,r){return r.compare(e,t)>0}function Mo(n,e,t,r){return r.compare(e,t)<=0}function To(n,e,t,r){return r.compare(e,t)>=0}function ze(n,e,t){const r=n!=="=="&&n!=="!=";return class bi{constructor(s,o,a){this.type=z,this.lhs=s,this.rhs=o,this.collator=a,this.hasUntypedArgument=s.type.kind==="value"||o.type.kind==="value"}static parse(s,o){if(s.length!==3&&s.length!==4)return o.error("Expected two or three arguments.");const a=s[0];let l=o.parse(s[1],1,I);if(!l)return null;if(!Ir(a,l.type))return o.concat(1).error(`"${a}" comparisons are not supported for type '${E(l.type)}'.`);let u=o.parse(s[2],2,I);if(!u)return null;if(!Ir(a,u.type))return o.concat(2).error(`"${a}" 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)}'.`);r&&(l.type.kind==="value"&&u.type.kind!=="value"?l=new W(u.type,[l]):l.type.kind!=="value"&&u.type.kind==="value"&&(u=new W(l.type,[u])));let c=null;if(s.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(s[3],3,st),!c)return null}return new bi(l,u,c)}evaluate(s){const o=this.lhs.evaluate(s),a=this.rhs.evaluate(s);if(r&&this.hasUntypedArgument){const l=A(o),u=A(a);if(l.kind!==u.kind||!(l.kind==="string"||l.kind==="number"))throw new L(`Expected arguments for "${n}" to be (string, string) or (number, number), but found (${l.kind}, ${u.kind}) instead.`)}if(this.collator&&!r&&this.hasUntypedArgument){const l=A(o),u=A(a);if(l.kind!=="string"||u.kind!=="string")return e(s,o,a)}return this.collator?t(s,o,a,this.collator.evaluate(s)):e(s,o,a)}eachChild(s){s(this.lhs),s(this.rhs),this.collator&&s(this.collator)}outputDefined(){return!0}}}const ko=ze("==",go,zr),So=ze("!=",vo,_o),Po=ze("<",xo,Io),Fo=ze(">",bo,zo),Eo=ze("<=",wo,Mo),Lo=ze(">=",Co,To);class xt{constructor(e,t,r){this.type=st,this.locale=r,this.caseSensitive=e,this.diacriticSensitive=t}static parse(e,t){if(e.length!==2)return t.error("Expected one argument.");const r=e[1];if(typeof r!="object"||Array.isArray(r))return t.error("Collator options argument must be an object.");const i=t.parse(r["case-sensitive"]===void 0?!1:r["case-sensitive"],1,z);if(!i)return null;const s=t.parse(r["diacritic-sensitive"]===void 0?!1:r["diacritic-sensitive"],1,z);if(!s)return null;let o=null;return r.locale&&(o=t.parse(r.locale,1,T),!o)?null:new xt(i,s,o)}evaluate(e){return new nn(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}}class fn{constructor(e,t,r,i,s){this.type=T,this.number=e,this.locale=t,this.currency=r,this.minFractionDigits=i,this.maxFractionDigits=s}static parse(e,t){if(e.length!==3)return t.error("Expected two arguments.");const r=t.parse(e[1],1,g);if(!r)return null;const i=e[2];if(typeof i!="object"||Array.isArray(i))return t.error("NumberFormat options argument must be an object.");let s=null;if(i.locale&&(s=t.parse(i.locale,1,T),!s))return null;let o=null;if(i.currency&&(o=t.parse(i.currency,1,T),!o))return null;let a=null;if(i["min-fraction-digits"]&&(a=t.parse(i["min-fraction-digits"],1,g),!a))return null;let l=null;return i["max-fraction-digits"]&&(l=t.parse(i["max-fraction-digits"],1,g),!l)?null:new fn(r,s,o,a,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}}class pn{constructor(e){this.type=ot,this.sections=e}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const r=e[1];if(!Array.isArray(r)&&typeof r=="object")return t.error("First argument must be an image or text section.");const i=[];let s=!1;for(let o=1;o<=e.length-1;++o){const a=e[o];if(s&&typeof a=="object"&&!Array.isArray(a)){s=!1;let l=null;if(a["font-scale"]&&(l=t.parse(a["font-scale"],1,g),!l))return null;let u=null;if(a["text-font"]&&(u=t.parse(a["text-font"],1,j(T)),!u))return null;let c=null;if(a["text-color"]&&(c=t.parse(a["text-color"],1,K),!c))return null;let f=null;if(a["vertical-align"]){if(typeof a["vertical-align"]=="string"&&!lo.includes(a["vertical-align"]))return t.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${a["vertical-align"]}' instead.`);if(f=t.parse(a["vertical-align"],1,T),!f)return null}const p=i[i.length-1];p.scale=l,p.font=u,p.textColor=c,p.verticalAlign=f}else{const l=t.parse(e[o],1,I);if(!l)return null;const u=l.type.kind;if(u!=="string"&&u!=="value"&&u!=="null"&&u!=="resolvedImage")return t.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");s=!0,i.push({content:l,scale:null,font:null,textColor:null,verticalAlign:null})}}return new pn(i)}evaluate(e){const t=r=>{const i=r.content.evaluate(e);return A(i)===Ve?new rn("",i,null,null,null,r.verticalAlign?r.verticalAlign.evaluate(e):null):new rn(Be(i),null,r.scale?r.scale.evaluate(e):null,r.font?r.font.evaluate(e).join(","):null,r.textColor?r.textColor.evaluate(e):null,r.verticalAlign?r.verticalAlign.evaluate(e):null)};return new ee(this.sections.map(t))}eachChild(e){for(const t of this.sections)e(t.content),t.scale&&e(t.scale),t.font&&e(t.font),t.textColor&&e(t.textColor),t.verticalAlign&&e(t.verticalAlign)}outputDefined(){return!1}}class hn{constructor(e){this.type=Ve,this.input=e}static parse(e,t){if(e.length!==2)return t.error("Expected two arguments.");const r=t.parse(e[1],1,T);return r?new hn(r):t.error("No image name provided.")}evaluate(e){const t=this.input.evaluate(e),r=te.fromString(t);return r&&e.availableImages&&(r.available=e.availableImages.indexOf(t)>-1),r}eachChild(e){e(this.input)}outputDefined(){return!1}}class dn{constructor(e){this.type=g,this.input=e}static parse(e,t){if(e.length!==2)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);const r=t.parse(e[1],1);return r?r.type.kind!=="array"&&r.type.kind!=="string"&&r.type.kind!=="value"?t.error(`Expected argument of type string or array, but found ${E(r.type)} instead.`):new dn(r):null}evaluate(e){const t=this.input.evaluate(e);if(typeof t=="string")return[...t].length;if(Array.isArray(t))return t.length;throw new L(`Expected value to be of type string or array, but found ${E(A(t))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const ne=8192;function Do(n,e){const t=Ao(n[0]),r=No(n[1]),i=Math.pow(2,e.z);return[Math.round(t*i*ne),Math.round(r*i*ne)]}function yn(n,e){const t=Math.pow(2,e.z),r=(n[0]/ne+e.x)/t,i=(n[1]/ne+e.y)/t;return[Vo(r),$o(i)]}function Ao(n){return(180+n)/360}function Vo(n){return n*360-180}function No(n){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+n*Math.PI/360)))/360}function $o(n){return 360/Math.PI*Math.atan(Math.exp((180-n*360)*Math.PI/180))-90}function Oe(n,e){n[0]=Math.min(n[0],e[0]),n[1]=Math.min(n[1],e[1]),n[2]=Math.max(n[2],e[0]),n[3]=Math.max(n[3],e[1])}function Re(n,e){return!(n[0]<=e[0]||n[2]>=e[2]||n[1]<=e[1]||n[3]>=e[3])}function Bo(n,e,t){return e[1]>n[1]!=t[1]>n[1]&&n[0]<(t[0]-e[0])*(n[1]-e[1])/(t[1]-e[1])+e[0]}function qo(n,e,t){const r=n[0]-e[0],i=n[1]-e[1],s=n[0]-t[0],o=n[1]-t[1];return r*o-s*i===0&&r*s<=0&&i*o<=0}function bt(n,e,t,r){const i=[e[0]-n[0],e[1]-n[1]],s=[r[0]-t[0],r[1]-t[1]];return Go(s,i)===0?!1:!!(Tr(n,e,t,r)&&Tr(t,r,n,e))}function Oo(n,e,t){for(const r of t)for(let i=0;i<r.length-1;++i)if(bt(n,e,r[i],r[i+1]))return!0;return!1}function Me(n,e,t=!1){let r=!1;for(const i of e)for(let s=0;s<i.length-1;s++){if(qo(n,i[s],i[s+1]))return t;Bo(n,i[s],i[s+1])&&(r=!r)}return r}function Ro(n,e){for(const t of e)if(Me(n,t))return!0;return!1}function Mr(n,e){for(const t of n)if(!Me(t,e))return!1;for(let t=0;t<n.length-1;++t)if(Oo(n[t],n[t+1],e))return!1;return!0}function jo(n,e){for(const t of e)if(Mr(n,t))return!0;return!1}function Go(n,e){return n[0]*e[1]-n[1]*e[0]}function Tr(n,e,t,r){const i=n[0]-t[0],s=n[1]-t[1],o=e[0]-t[0],a=e[1]-t[1],l=r[0]-t[0],u=r[1]-t[1],c=i*u-l*s,f=o*u-l*a;return c>0&&f<0||c<0&&f>0}function mn(n,e,t){const r=[];for(let i=0;i<n.length;i++){const s=[];for(let o=0;o<n[i].length;o++){const a=Do(n[i][o],t);Oe(e,a),s.push(a)}r.push(s)}return r}function kr(n,e,t){const r=[];for(let i=0;i<n.length;i++){const s=mn(n[i],e,t);r.push(s)}return r}function Sr(n,e,t,r){if(n[0]<t[0]||n[0]>t[2]){const i=r*.5;let s=n[0]-t[0]>i?-r:t[0]-n[0]>i?r:0;s===0&&(s=n[0]-t[2]>i?-r:t[2]-n[0]>i?r:0),n[0]+=s}Oe(e,n)}function Xo(n){n[0]=n[1]=1/0,n[2]=n[3]=-1/0}function Pr(n,e,t,r){const i=Math.pow(2,r.z)*ne,s=[r.x*ne,r.y*ne],o=[];for(const a of n)for(const l of a){const u=[l.x+s[0],l.y+s[1]];Sr(u,e,t,i),o.push(u)}return o}function Fr(n,e,t,r){const i=Math.pow(2,r.z)*ne,s=[r.x*ne,r.y*ne],o=[];for(const a of n){const l=[];for(const u of a){const c=[u.x+s[0],u.y+s[1]];Oe(e,c),l.push(c)}o.push(l)}if(e[2]-e[0]<=i/2){Xo(e);for(const a of o)for(const l of a)Sr(l,e,t,i)}return o}function Zo(n,e){const t=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],i=n.canonicalID();if(e.type==="Polygon"){const s=mn(e.coordinates,r,i),o=Pr(n.geometry(),t,r,i);if(!Re(t,r))return!1;for(const a of o)if(!Me(a,s))return!1}if(e.type==="MultiPolygon"){const s=kr(e.coordinates,r,i),o=Pr(n.geometry(),t,r,i);if(!Re(t,r))return!1;for(const a of o)if(!Ro(a,s))return!1}return!0}function Uo(n,e){const t=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],i=n.canonicalID();if(e.type==="Polygon"){const s=mn(e.coordinates,r,i),o=Fr(n.geometry(),t,r,i);if(!Re(t,r))return!1;for(const a of o)if(!Mr(a,s))return!1}if(e.type==="MultiPolygon"){const s=kr(e.coordinates,r,i),o=Fr(n.geometry(),t,r,i);if(!Re(t,r))return!1;for(const a of o)if(!jo(a,s))return!1}return!0}class he{constructor(e,t){this.type=z,this.geojson=e,this.geometries=t}static parse(e,t){if(e.length!==2)return t.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if($e(e[1])){const r=e[1];if(r.type==="FeatureCollection"){const i=[];for(const s of r.features){const{type:o,coordinates:a}=s.geometry;o==="Polygon"&&i.push(a),o==="MultiPolygon"&&i.push(...a)}if(i.length){const s={type:"MultiPolygon",coordinates:i};return new he(r,s)}}else if(r.type==="Feature"){const i=r.geometry.type;if(i==="Polygon"||i==="MultiPolygon")return new he(r,r.geometry)}else if(r.type==="Polygon"||r.type==="MultiPolygon")return new he(r,r)}return t.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 Zo(e,this.geometries);if(e.geometryType()==="LineString")return Uo(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}class Er{constructor(e=[],t=(r,i)=>r<i?-1:r>i?1:0){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let r=(this.length>>1)-1;r>=0;r--)this._down(r)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;const e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:t,compare:r}=this,i=t[e];for(;e>0;){const s=e-1>>1,o=t[s];if(r(i,o)>=0)break;t[e]=o,e=s}t[e]=i}_down(e){const{data:t,compare:r}=this,i=this.length>>1,s=t[e];for(;e<i;){let o=(e<<1)+1;const a=o+1;if(a<this.length&&r(t[a],t[o])<0&&(o=a),r(t[o],s)>=0)break;t[e]=t[o],e=o}t[e]=s}}function Yo(n,e){if(n.length<=1)return[n];const r=[];let i,s;for(const o of n){const a=Jo(o);a!==0&&(o.area=Math.abs(a),s===void 0&&(s=a<0),s===a<0?(i&&r.push(i),i=[o]):i.push(o))}return i&&r.push(i),r}function Jo(n){let e=0;for(let t=0,r=n.length,i=r-1,s,o;t<r;i=t++)s=n[t],o=n[i],e+=(o.x-s.x)*(s.y+o.y);return e}const Ho=6378.137,Lr=1/298.257223563,Dr=Lr*(2-Lr),Ar=Math.PI/180;class gn{constructor(e){const t=Ar*Ho*1e3,r=Math.cos(e*Ar),i=1/(1-Dr*(1-r*r)),s=Math.sqrt(i);this.kx=t*s*r,this.ky=t*s*i*(1-Dr)}distance(e,t){const r=this.wrap(e[0]-t[0])*this.kx,i=(e[1]-t[1])*this.ky;return Math.sqrt(r*r+i*i)}pointOnLine(e,t){let r=1/0,i,s,o,a;for(let l=0;l<e.length-1;l++){let u=e[l][0],c=e[l][1],f=this.wrap(e[l+1][0]-u)*this.kx,p=(e[l+1][1]-c)*this.ky,d=0;(f!==0||p!==0)&&(d=(this.wrap(t[0]-u)*this.kx*f+(t[1]-c)*this.ky*p)/(f*f+p*p),d>1?(u=e[l+1][0],c=e[l+1][1]):d>0&&(u+=f/this.kx*d,c+=p/this.ky*d)),f=this.wrap(t[0]-u)*this.kx,p=(t[1]-c)*this.ky;const h=f*f+p*p;h<r&&(r=h,i=u,s=c,o=l,a=d)}return{point:[i,s],index:o,t:Math.max(0,Math.min(1,a))}}wrap(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}}const vn=100,xn=50;function Vr(n,e){return e[0]-n[0]}function wt(n){return n[1]-n[0]+1}function ie(n,e){return n[1]>=n[0]&&n[1]<e}function bn(n,e){if(n[0]>n[1])return[null,null];const t=wt(n);if(e){if(t===2)return[n,null];const i=Math.floor(t/2);return[[n[0],n[0]+i],[n[0]+i,n[1]]]}if(t===1)return[n,null];const r=Math.floor(t/2)-1;return[[n[0],n[0]+r],[n[0]+r+1,n[1]]]}function wn(n,e){if(!ie(e,n.length))return[1/0,1/0,-1/0,-1/0];const t=[1/0,1/0,-1/0,-1/0];for(let r=e[0];r<=e[1];++r)Oe(t,n[r]);return t}function Cn(n){const e=[1/0,1/0,-1/0,-1/0];for(const t of n)for(const r of t)Oe(e,r);return e}function Nr(n){return n[0]!==-1/0&&n[1]!==-1/0&&n[2]!==1/0&&n[3]!==1/0}function _n(n,e,t){if(!Nr(n)||!Nr(e))return NaN;let r=0,i=0;return n[2]<e[0]&&(r=e[0]-n[2]),n[0]>e[2]&&(r=n[0]-e[2]),n[1]>e[3]&&(i=n[1]-e[3]),n[3]<e[1]&&(i=e[1]-n[3]),t.distance([0,0],[r,i])}function de(n,e,t){const r=t.pointOnLine(e,n);return t.distance(n,r.point)}function In(n,e,t,r,i){const s=Math.min(de(n,[t,r],i),de(e,[t,r],i)),o=Math.min(de(t,[n,e],i),de(r,[n,e],i));return Math.min(s,o)}function Wo(n,e,t,r,i){if(!(ie(e,n.length)&&ie(r,t.length)))return 1/0;let o=1/0;for(let a=e[0];a<e[1];++a){const l=n[a],u=n[a+1];for(let c=r[0];c<r[1];++c){const f=t[c],p=t[c+1];if(bt(l,u,f,p))return 0;o=Math.min(o,In(l,u,f,p,i))}}return o}function Qo(n,e,t,r,i){if(!(ie(e,n.length)&&ie(r,t.length)))return NaN;let o=1/0;for(let a=e[0];a<=e[1];++a)for(let l=r[0];l<=r[1];++l)if(o=Math.min(o,i.distance(n[a],t[l])),o===0)return o;return o}function Ko(n,e,t){if(Me(n,e,!0))return 0;let r=1/0;for(const i of e){const s=i[0],o=i[i.length-1];if(s!==o&&(r=Math.min(r,de(n,[o,s],t)),r===0))return r;const a=t.pointOnLine(i,n);if(r=Math.min(r,t.distance(n,a.point)),r===0)return r}return r}function ea(n,e,t,r){if(!ie(e,n.length))return NaN;for(let s=e[0];s<=e[1];++s)if(Me(n[s],t,!0))return 0;let i=1/0;for(let s=e[0];s<e[1];++s){const o=n[s],a=n[s+1];for(const l of t)for(let u=0,c=l.length,f=c-1;u<c;f=u++){const p=l[f],d=l[u];if(bt(o,a,p,d))return 0;i=Math.min(i,In(o,a,p,d,r))}}return i}function $r(n,e){for(const t of n)for(const r of t)if(Me(r,e,!0))return!0;return!1}function ta(n,e,t,r=1/0){const i=Cn(n),s=Cn(e);if(r!==1/0&&_n(i,s,t)>=r)return r;if(Re(i,s)){if($r(n,e))return 0}else if($r(e,n))return 0;let o=1/0;for(const a of n)for(let l=0,u=a.length,c=u-1;l<u;c=l++){const f=a[c],p=a[l];for(const d of e)for(let h=0,y=d.length,v=y-1;h<y;v=h++){const b=d[v],w=d[h];if(bt(f,p,b,w))return 0;o=Math.min(o,In(f,p,b,w,t))}}return o}function Br(n,e,t,r,i,s){if(!s)return;const o=_n(wn(r,s),i,t);o<e&&n.push([o,s,[0,0]])}function Ct(n,e,t,r,i,s,o){if(!s||!o)return;const a=_n(wn(r,s),wn(i,o),t);a<e&&n.push([a,s,o])}function _t(n,e,t,r,i=1/0){let s=Math.min(r.distance(n[0],t[0][0]),i);if(s===0)return s;const o=new Er([[0,[0,n.length-1],[0,0]]],Vr),a=Cn(t);for(;o.length>0;){const l=o.pop();if(l[0]>=s)continue;const u=l[1],c=e?xn:vn;if(wt(u)<=c){if(!ie(u,n.length))return NaN;if(e){const f=ea(n,u,t,r);if(isNaN(f)||f===0)return f;s=Math.min(s,f)}else for(let f=u[0];f<=u[1];++f){const p=Ko(n[f],t,r);if(s=Math.min(s,p),s===0)return 0}}else{const f=bn(u,e);Br(o,s,r,n,a,f[0]),Br(o,s,r,n,a,f[1])}}return s}function It(n,e,t,r,i,s=1/0){let o=Math.min(s,i.distance(n[0],t[0]));if(o===0)return o;const a=new Er([[0,[0,n.length-1],[0,t.length-1]]],Vr);for(;a.length>0;){const l=a.pop();if(l[0]>=o)continue;const u=l[1],c=l[2],f=e?xn:vn,p=r?xn:vn;if(wt(u)<=f&&wt(c)<=p){if(!ie(u,n.length)&&ie(c,t.length))return NaN;let d;if(e&&r)d=Wo(n,u,t,c,i),o=Math.min(o,d);else if(e&&!r){const h=n.slice(u[0],u[1]+1);for(let y=c[0];y<=c[1];++y)if(d=de(t[y],h,i),o=Math.min(o,d),o===0)return o}else if(!e&&r){const h=t.slice(c[0],c[1]+1);for(let y=u[0];y<=u[1];++y)if(d=de(n[y],h,i),o=Math.min(o,d),o===0)return o}else d=Qo(n,u,t,c,i),o=Math.min(o,d)}else{const d=bn(u,e),h=bn(c,r);Ct(a,o,i,n,t,d[0],h[0]),Ct(a,o,i,n,t,d[0],h[1]),Ct(a,o,i,n,t,d[1],h[0]),Ct(a,o,i,n,t,d[1],h[1])}}return o}function na(n,e){const t=n.geometry(),r=t.flat().map(o=>yn([o.x,o.y],n.canonical));if(t.length===0)return NaN;const i=new gn(r[0][1]);let s=1/0;for(const o of e){switch(o.type){case"Point":s=Math.min(s,It(r,!1,[o.coordinates],!1,i,s));break;case"LineString":s=Math.min(s,It(r,!1,o.coordinates,!0,i,s));break;case"Polygon":s=Math.min(s,_t(r,!1,o.coordinates,i,s));break}if(s===0)return s}return s}function ra(n,e){const t=n.geometry(),r=t.flat().map(o=>yn([o.x,o.y],n.canonical));if(t.length===0)return NaN;const i=new gn(r[0][1]);let s=1/0;for(const o of e){switch(o.type){case"Point":s=Math.min(s,It(r,!0,[o.coordinates],!1,i,s));break;case"LineString":s=Math.min(s,It(r,!0,o.coordinates,!0,i,s));break;case"Polygon":s=Math.min(s,_t(r,!0,o.coordinates,i,s));break}if(s===0)return s}return s}function ia(n,e){const t=n.geometry();if(t.length===0||t[0].length===0)return NaN;const r=Yo(t).map(o=>o.map(a=>a.map(l=>yn([l.x,l.y],n.canonical)))),i=new gn(r[0][0][0][1]);let s=1/0;for(const o of e)for(const a of r){switch(o.type){case"Point":s=Math.min(s,_t([o.coordinates],!1,a,i,s));break;case"LineString":s=Math.min(s,_t(o.coordinates,!0,a,i,s));break;case"Polygon":s=Math.min(s,ta(a,o.coordinates,i,s));break}if(s===0)return s}return s}function zn(n){return n.type==="MultiPolygon"?n.coordinates.map(e=>({type:"Polygon",coordinates:e})):n.type==="MultiLineString"?n.coordinates.map(e=>({type:"LineString",coordinates:e})):n.type==="MultiPoint"?n.coordinates.map(e=>({type:"Point",coordinates:e})):[n]}class ye{constructor(e,t){this.type=g,this.geojson=e,this.geometries=t}static parse(e,t){if(e.length!==2)return t.error(`'distance' expression requires exactly one argument, but found ${e.length-1} instead.`);if($e(e[1])){const r=e[1];if(r.type==="FeatureCollection")return new ye(r,r.features.map(i=>zn(i.geometry)).flat());if(r.type==="Feature")return new ye(r,zn(r.geometry));if("type"in r&&"coordinates"in r)return new ye(r,zn(r))}return t.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 na(e,this.geometries);if(e.geometryType()==="LineString")return ra(e,this.geometries);if(e.geometryType()==="Polygon")return ia(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}class je{constructor(e){this.type=I,this.key=e}static parse(e,t){if(e.length!==2)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);const r=e[1];return r==null?t.error("Global state property must be defined."):typeof r!="string"?t.error(`Global state property must be string, but found ${typeof e[1]} instead.`):new je(r)}evaluate(e){var t;const r=(t=e.globals)===null||t===void 0?void 0:t.globalState;return!r||Object.keys(r).length===0?null:gr(r,this.key)}eachChild(){}outputDefined(){return!1}}const Te={"==":ko,"!=":So,">":Fo,"<":Po,">=":Lo,"<=":Eo,array:W,at:sn,boolean:W,case:ln,coalesce:qe,collator:xt,format:pn,image:hn,in:on,"index-of":yt,interpolate:Y,"interpolate-hcl":Y,"interpolate-lab":Y,length:dn,let:ht,literal:Ie,match:an,number:W,"number-format":fn,object:W,slice:mt,step:vt,string:W,"to-boolean":le,"to-color":le,"to-number":le,"to-string":le,var:dt,within:he,distance:ye,"global-state":je};class J{constructor(e,t,r,i){this.name=e,this.type=t,this._evaluate=r,this.args=i}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,t){const r=e[0],i=J.definitions[r];if(!i)return t.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0);const s=Array.isArray(i)?i[0]:i.type,o=Array.isArray(i)?[[i[1],i[2]]]:i.overloads,a=o.filter(([u])=>!Array.isArray(u)||u.length===e.length-1);let l=null;for(const[u,c]of a){l=new pt(t.registry,zt,t.path,null,t.scope);const f=[];let p=!1;for(let d=1;d<e.length;d++){const h=e[d],y=Array.isArray(u)?u[d-1]:u.type,v=l.parse(h,1+f.length,y);if(!v){p=!0;break}f.push(v)}if(!p){if(Array.isArray(u)&&u.length!==f.length){l.error(`Expected ${u.length} arguments, but found ${f.length} instead.`);continue}for(let d=0;d<f.length;d++){const h=Array.isArray(u)?u[d]:u.type,y=f[d];l.concat(d+1).checkSubtype(h,y.type)}if(l.errors.length===0)return new J(r,s,c,f)}}if(a.length===1)t.errors.push(...l.errors);else{const c=(a.length?a:o).map(([p])=>oa(p)).join(" | "),f=[];for(let p=1;p<e.length;p++){const d=t.parse(e[p],1+f.length);if(!d)return null;f.push(E(d.type))}t.error(`Expected arguments of type ${c}, but found (${f.join(", ")}) instead.`)}return null}static register(e,t){J.definitions=t;for(const r in t)e[r]=J}}function qr(n,[e,t,r,i]){e=e.evaluate(n),t=t.evaluate(n),r=r.evaluate(n);const s=i?i.evaluate(n):1,o=br(e,t,r,s);if(o)throw new L(o);return new S(e/255,t/255,r/255,s,!1)}function Or(n,e){return n in e}function Mn(n,e){const t=e[n];return typeof t>"u"?null:t}function sa(n,e,t,r){for(;t<=r;){const i=t+r>>1;if(e[i]===n)return!0;e[i]>n?r=i-1:t=i+1}return!1}function me(n){return{type:n}}J.register(Te,{error:[Hs,[T],(n,[e])=>{throw new L(e.evaluate(n))}],typeof:[T,[I],(n,[e])=>E(A(e.evaluate(n)))],"to-rgba":[j(g,4),[K],(n,[e])=>{const[t,r,i,s]=e.evaluate(n).rgb;return[t*255,r*255,i*255,s]}],rgb:[K,[g,g,g],qr],rgba:[K,[g,g,g,g],qr],has:{type:z,overloads:[[[T],(n,[e])=>Or(e.evaluate(n),n.properties())],[[T,fe],(n,[e,t])=>Or(e.evaluate(n),t.evaluate(n))]]},get:{type:I,overloads:[[[T],(n,[e])=>Mn(e.evaluate(n),n.properties())],[[T,fe],(n,[e,t])=>Mn(e.evaluate(n),t.evaluate(n))]]},"feature-state":[I,[T],(n,[e])=>Mn(e.evaluate(n),n.featureState||{})],properties:[fe,[],n=>n.properties()],"geometry-type":[T,[],n=>n.geometryType()],id:[I,[],n=>n.id()],zoom:[g,[],n=>n.globals.zoom],"heatmap-density":[g,[],n=>n.globals.heatmapDensity||0],elevation:[g,[],n=>n.globals.elevation||0],"line-progress":[g,[],n=>n.globals.lineProgress||0],accumulated:[I,[],n=>n.globals.accumulated===void 0?null:n.globals.accumulated],"+":[g,me(g),(n,e)=>{let t=0;for(const r of e)t+=r.evaluate(n);return t}],"*":[g,me(g),(n,e)=>{let t=1;for(const r of e)t*=r.evaluate(n);return t}],"-":{type:g,overloads:[[[g,g],(n,[e,t])=>e.evaluate(n)-t.evaluate(n)],[[g],(n,[e])=>-e.evaluate(n)]]},"/":[g,[g,g],(n,[e,t])=>e.evaluate(n)/t.evaluate(n)],"%":[g,[g,g],(n,[e,t])=>e.evaluate(n)%t.evaluate(n)],ln2:[g,[],()=>Math.LN2],pi:[g,[],()=>Math.PI],e:[g,[],()=>Math.E],"^":[g,[g,g],(n,[e,t])=>Math.pow(e.evaluate(n),t.evaluate(n))],sqrt:[g,[g],(n,[e])=>Math.sqrt(e.evaluate(n))],log10:[g,[g],(n,[e])=>Math.log(e.evaluate(n))/Math.LN10],ln:[g,[g],(n,[e])=>Math.log(e.evaluate(n))],log2:[g,[g],(n,[e])=>Math.log(e.evaluate(n))/Math.LN2],sin:[g,[g],(n,[e])=>Math.sin(e.evaluate(n))],cos:[g,[g],(n,[e])=>Math.cos(e.evaluate(n))],tan:[g,[g],(n,[e])=>Math.tan(e.evaluate(n))],asin:[g,[g],(n,[e])=>Math.asin(e.evaluate(n))],acos:[g,[g],(n,[e])=>Math.acos(e.evaluate(n))],atan:[g,[g],(n,[e])=>Math.atan(e.evaluate(n))],min:[g,me(g),(n,e)=>Math.min(...e.map(t=>t.evaluate(n)))],max:[g,me(g),(n,e)=>Math.max(...e.map(t=>t.evaluate(n)))],abs:[g,[g],(n,[e])=>Math.abs(e.evaluate(n))],round:[g,[g],(n,[e])=>{const t=e.evaluate(n);return t<0?-Math.round(-t):Math.round(t)}],floor:[g,[g],(n,[e])=>Math.floor(e.evaluate(n))],ceil:[g,[g],(n,[e])=>Math.ceil(e.evaluate(n))],"filter-==":[z,[T,I],(n,[e,t])=>n.properties()[e.value]===t.value],"filter-id-==":[z,[I],(n,[e])=>n.id()===e.value],"filter-type-==":[z,[T],(n,[e])=>n.geometryType()===e.value],"filter-<":[z,[T,I],(n,[e,t])=>{const r=n.properties()[e.value],i=t.value;return typeof r==typeof i&&r<i}],"filter-id-<":[z,[I],(n,[e])=>{const t=n.id(),r=e.value;return typeof t==typeof r&&t<r}],"filter->":[z,[T,I],(n,[e,t])=>{const r=n.properties()[e.value],i=t.value;return typeof r==typeof i&&r>i}],"filter-id->":[z,[I],(n,[e])=>{const t=n.id(),r=e.value;return typeof t==typeof r&&t>r}],"filter-<=":[z,[T,I],(n,[e,t])=>{const r=n.properties()[e.value],i=t.value;return typeof r==typeof i&&r<=i}],"filter-id-<=":[z,[I],(n,[e])=>{const t=n.id(),r=e.value;return typeof t==typeof r&&t<=r}],"filter->=":[z,[T,I],(n,[e,t])=>{const r=n.properties()[e.value],i=t.value;return typeof r==typeof i&&r>=i}],"filter-id->=":[z,[I],(n,[e])=>{const t=n.id(),r=e.value;return typeof t==typeof r&&t>=r}],"filter-has":[z,[I],(n,[e])=>e.value in n.properties()],"filter-has-id":[z,[],n=>n.id()!==null&&n.id()!==void 0],"filter-type-in":[z,[j(T)],(n,[e])=>e.value.indexOf(n.geometryType())>=0],"filter-id-in":[z,[j(I)],(n,[e])=>e.value.indexOf(n.id())>=0],"filter-in-small":[z,[T,j(I)],(n,[e,t])=>t.value.indexOf(n.properties()[e.value])>=0],"filter-in-large":[z,[T,j(I)],(n,[e,t])=>sa(n.properties()[e.value],t.value,0,t.value.length-1)],all:{type:z,overloads:[[[z,z],(n,[e,t])=>e.evaluate(n)&&t.evaluate(n)],[me(z),(n,e)=>{for(const t of e)if(!t.evaluate(n))return!1;return!0}]]},any:{type:z,overloads:[[[z,z],(n,[e,t])=>e.evaluate(n)||t.evaluate(n)],[me(z),(n,e)=>{for(const t of e)if(t.evaluate(n))return!0;return!1}]]},"!":[z,[z],(n,[e])=>!e.evaluate(n)],"is-supported-script":[z,[T],(n,[e])=>{const t=n.globals&&n.globals.isSupportedScript;return t?t(e.evaluate(n)):!0}],upcase:[T,[T],(n,[e])=>e.evaluate(n).toUpperCase()],downcase:[T,[T],(n,[e])=>e.evaluate(n).toLowerCase()],concat:[T,me(I),(n,e)=>e.map(t=>Be(t.evaluate(n))).join("")],"resolved-locale":[T,[st],(n,[e])=>e.evaluate(n).resolvedLocale()]});function oa(n){return Array.isArray(n)?`(${n.map(E).join(", ")})`:`(${E(n.type)}...)`}function zt(n){if(n instanceof dt)return zt(n.boundExpression);if(n instanceof J&&n.name==="error")return!1;if(n instanceof xt)return!1;if(n instanceof he)return!1;if(n instanceof ye)return!1;if(n instanceof je)return!1;const e=n instanceof le||n instanceof W;let t=!0;return n.eachChild(r=>{e?t=t&&zt(r):t=t&&r instanceof Ie}),t?Tn(n)&&Sn(n,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"]):!1}function Tn(n){if(n instanceof J){if(n.name==="get"&&n.args.length===1)return!1;if(n.name==="feature-state")return!1;if(n.name==="has"&&n.args.length===1)return!1;if(n.name==="properties"||n.name==="geometry-type"||n.name==="id")return!1;if(/^filter-/.test(n.name))return!1}if(n instanceof he||n instanceof ye)return!1;let e=!0;return n.eachChild(t=>{e&&!Tn(t)&&(e=!1)}),e}function kn(n){if(n instanceof J&&n.name==="feature-state")return!1;let e=!0;return n.eachChild(t=>{e&&!kn(t)&&(e=!1)}),e}function Sn(n,e){if(n instanceof J&&e.indexOf(n.name)>=0)return!1;let t=!0;return n.eachChild(r=>{t&&!Sn(r,e)&&(t=!1)}),t}function Pn(n){return{result:"success",value:n}}function ke(n){return{result:"error",value:n}}function aa(n){return n["property-type"]==="data-driven"||n["property-type"]==="cross-faded-data-driven"}function la(n){return!!n.expression&&n.expression.parameters.indexOf("zoom")>-1}function Rr(n){return!!n.expression&&n.expression.interpolated}function Fn(n){return n instanceof Number?"number":n instanceof String?"string":n instanceof Boolean?"boolean":Array.isArray(n)?"array":n===null?"null":typeof n}function jr(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)&&A(n)===fe}function ua(n){return n}function ca(n){switch(n.type){case"color":return S.parse;case"padding":return B.parse;case"numberArray":return q.parse;case"colorArray":return $.parse;default:return null}}function fa(n){switch(n){case"exponential":return Xr;case"interval":return ha;case"categorical":return pa;case"identity":return da;default:throw new Error(`Unknown function type "${n}"`)}}function Gr(n,e){const t=n.stops&&typeof n.stops[0][0]=="object",r=t||n.property!==void 0,i=t||!r,s=n.type||(Rr(e)?"exponential":"interval"),o=ca(e);if(o&&(n=lr({},n),n.stops&&(n.stops=n.stops.map(c=>[c[0],o(c[1])])),n.default?n.default=o(n.default):n.default=o(e.default)),n.colorSpace&&!ao(n.colorSpace))throw new Error(`Unknown color space: "${n.colorSpace}"`);const a=fa(s);let l,u;if(s==="categorical"){l=Object.create(null);for(const c of n.stops)l[c[0]]=c[1];u=typeof n.stops[0][0]}if(t){const c={},f=[];for(let h=0;h<n.stops.length;h++){const y=n.stops[h],v=y[0].zoom;c[v]===void 0&&(c[v]={zoom:v,type:n.type,property:n.property,default:n.default,stops:[]},f.push(v)),c[v].stops.push([y[0].value,y[1]])}const p=[];for(const h of f)p.push([c[h].zoom,Gr(c[h],e)]);const d={name:"linear"};return{kind:"composite",interpolationType:d,interpolationFactor:Y.interpolationFactor.bind(void 0,d),zoomStops:p.map(h=>h[0]),evaluate({zoom:h},y){return Xr({stops:p,base:n.base},e,h).evaluate(h,y)}}}else if(i){const c=s==="exponential"?{name:"exponential",base:n.base!==void 0?n.base:1}:null;return{kind:"camera",interpolationType:c,interpolationFactor:Y.interpolationFactor.bind(void 0,c),zoomStops:n.stops.map(f=>f[0]),evaluate:({zoom:f})=>a(n,e,f,l,u)}}else return{kind:"source",evaluate(c,f){const p=f&&f.properties?f.properties[n.property]:void 0;return p===void 0?Ge(n.default,e.default):a(n,e,p,l,u)}}}function Ge(n,e,t){if(n!==void 0)return n;if(e!==void 0)return e;if(t!==void 0)return t}function pa(n,e,t,r,i){const s=typeof t===i?r[t]:void 0;return Ge(s,n.default,e.default)}function ha(n,e,t){if(Fn(t)!=="number")return Ge(n.default,e.default);const r=n.stops.length;if(r===1||t<=n.stops[0][0])return n.stops[0][1];if(t>=n.stops[r-1][0])return n.stops[r-1][1];const i=gt(n.stops.map(s=>s[0]),t);return n.stops[i][1]}function Xr(n,e,t){const r=n.base!==void 0?n.base:1;if(Fn(t)!=="number")return Ge(n.default,e.default);const i=n.stops.length;if(i===1||t<=n.stops[0][0])return n.stops[0][1];if(t>=n.stops[i-1][0])return n.stops[i-1][1];const s=gt(n.stops.map(c=>c[0]),t),o=ya(t,r,n.stops[s][0],n.stops[s+1][0]),a=n.stops[s][1],l=n.stops[s+1][1],u=mo[e.type]||ua;return typeof a.evaluate=="function"?{evaluate(...c){const f=a.evaluate.apply(void 0,c),p=l.evaluate.apply(void 0,c);if(!(f===void 0||p===void 0))return u(f,p,o,n.colorSpace)}}:u(a,l,o,n.colorSpace)}function da(n,e,t){switch(e.type){case"color":t=S.parse(t);break;case"formatted":t=ee.fromString(t.toString());break;case"resolvedImage":t=te.fromString(t.toString());break;case"padding":t=B.parse(t);break;case"colorArray":t=$.parse(t);break;case"numberArray":t=q.parse(t);break;default:Fn(t)!==e.type&&(e.type!=="enum"||!e.values[t])&&(t=void 0)}return Ge(t,n.default,e.default)}function ya(n,e,t,r){const i=r-t,s=n-t;return i===0?0:e===1?s/i:(Math.pow(e,s)-1)/(Math.pow(e,i)-1)}class En{constructor(e,t,r){this.expression=e,this._warningHistory={},this._evaluator=new Cr,this._defaultValue=t?xa(t):null,this._enumValues=t&&t.type==="enum"?t.values:null,this._globalState=r}evaluateWithoutErrorHandling(e,t,r,i,s,o){return this._globalState&&(e=Se(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=t,this._evaluator.featureState=r,this._evaluator.canonical=i,this._evaluator.availableImages=s||null,this._evaluator.formattedSection=o,this.expression.evaluate(this._evaluator)}evaluate(e,t,r,i,s,o){this._globalState&&(e=Se(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=t||null,this._evaluator.featureState=r||null,this._evaluator.canonical=i,this._evaluator.availableImages=s||null,this._evaluator.formattedSection=o||null;try{const a=this.expression.evaluate(this._evaluator);if(a==null||typeof a=="number"&&a!==a)return this._defaultValue;if(this._enumValues&&!(a in this._enumValues))throw new L(`Expected value to be one of ${Object.keys(this._enumValues).map(l=>JSON.stringify(l)).join(", ")}, but found ${JSON.stringify(a)} instead.`);return a}catch(a){return this._warningHistory[a.message]||(this._warningHistory[a.message]=!0,typeof console<"u"&&console.warn(a.message)),this._defaultValue}}}function Zr(n){return Array.isArray(n)&&n.length>0&&typeof n[0]=="string"&&n[0]in Te}function Ln(n,e,t){const r=new pt(Te,zt,[],e?va(e):void 0),i=r.parse(n,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return i?Pn(new En(i,e,t)):ke(r.errors)}class Mt{constructor(e,t,r){this.kind=e,this._styleExpression=t,this.isStateDependent=e!=="constant"&&!kn(t.expression),this.globalStateRefs=St(t.expression),this._globalState=r}evaluateWithoutErrorHandling(e,t,r,i,s,o){return this._globalState&&(e=Se(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,t,r,i,s,o)}evaluate(e,t,r,i,s,o){return this._globalState&&(e=Se(e,this._globalState)),this._styleExpression.evaluate(e,t,r,i,s,o)}}class Tt{constructor(e,t,r,i,s){this.kind=e,this.zoomStops=r,this._styleExpression=t,this.isStateDependent=e!=="camera"&&!kn(t.expression),this.globalStateRefs=St(t.expression),this.interpolationType=i,this._globalState=s}evaluateWithoutErrorHandling(e,t,r,i,s,o){return this._globalState&&(e=Se(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,t,r,i,s,o)}evaluate(e,t,r,i,s,o){return this._globalState&&(e=Se(e,this._globalState)),this._styleExpression.evaluate(e,t,r,i,s,o)}interpolationFactor(e,t,r){return this.interpolationType?Y.interpolationFactor(this.interpolationType,e,t,r):0}}function ma(n){return n._styleExpression!==void 0}function Ur(n,e,t){const r=Ln(n,e,t);if(r.result==="error")return r;const i=r.value.expression,s=Tn(i);if(!s&&!aa(e))return ke([new Q("","data expressions not supported")]);const o=Sn(i,["zoom"]);if(!o&&!la(e))return ke([new Q("","zoom expressions not supported")]);const a=kt(i);if(!a&&!o)return ke([new Q("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(a instanceof Q)return ke([a]);if(a instanceof Y&&!Rr(e))return ke([new Q("",'"interpolate" expressions cannot be used with this property')]);if(!a)return Pn(s?new Mt("constant",r.value,t):new Mt("source",r.value,t));const l=a instanceof Y?a.interpolation:void 0;return Pn(s?new Tt("camera",r.value,a.labels,l,t):new Tt("composite",r.value,a.labels,l,t))}class Xe{constructor(e,t){this._parameters=e,this._specification=t,lr(this,Gr(this._parameters,this._specification))}static deserialize(e){return new Xe(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function ga(n,e,t){if(jr(n))return new Xe(n,e);if(Zr(n)){const r=Ur(n,e,t);if(r.result==="error")throw new Error(r.value.map(i=>`${i.key}: ${i.message}`).join(", "));return r.value}else{let r=n;return e.type==="color"&&typeof n=="string"?r=S.parse(n):e.type==="padding"&&(typeof n=="number"||Array.isArray(n))?r=B.parse(n):e.type==="numberArray"&&(typeof n=="number"||Array.isArray(n))?r=q.parse(n):e.type==="colorArray"&&(typeof n=="string"||Array.isArray(n))?r=$.parse(n):e.type==="variableAnchorOffsetCollection"&&Array.isArray(n)?r=Z.parse(n):e.type==="projectionDefinition"&&typeof n=="string"&&(r=U.parse(n)),{globalStateRefs:new Set,_globalState:null,kind:"constant",evaluate:()=>r}}}function kt(n){let e=null;if(n instanceof ht)e=kt(n.result);else if(n instanceof qe){for(const t of n.args)if(e=kt(t),e)break}else(n instanceof vt||n instanceof Y)&&n.input instanceof J&&n.input.name==="zoom"&&(e=n);return e instanceof Q||n.eachChild(t=>{const r=kt(t);r instanceof Q?e=r:!e&&r?e=new Q("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&r&&e!==r&&(e=new Q("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function St(n,e=new Set){return n instanceof je&&e.add(n.key),n.eachChild(t=>{St(t,e)}),e}function va(n){const e={color:K,string:T,number:g,enum:T,boolean:z,formatted:ot,padding:at,numberArray:lt,colorArray:Ae,projectionDefinition:it,resolvedImage:Ve,variableAnchorOffsetCollection:ut};return n.type==="array"?j(e[n.value]||I,n.length):e[n.type]}function xa(n){if(n.type==="color"&&jr(n.default))return new S(0,0,0,0);switch(n.type){case"color":return S.parse(n.default)||null;case"padding":return B.parse(n.default)||null;case"numberArray":return q.parse(n.default)||null;case"colorArray":return $.parse(n.default)||null;case"variableAnchorOffsetCollection":return Z.parse(n.default)||null;case"projectionDefinition":return U.parse(n.default)||null;default:return n.default===void 0?null:n.default}}function Se(n,e){const{zoom:t,heatmapDensity:r,elevation:i,lineProgress:s,isSupportedScript:o,accumulated:a}=n??{};return{zoom:t,heatmapDensity:r,elevation:i,lineProgress:s,isSupportedScript:o,accumulated:a,globalState:e}}function Dn(n){if(n===!0||n===!1)return!0;if(!Array.isArray(n)||n.length===0)return!1;switch(n[0]){case"has":return n.length>=2&&n[1]!=="$id"&&n[1]!=="$type";case"in":return n.length>=3&&(typeof n[1]!="string"||Array.isArray(n[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return n.length!==3||Array.isArray(n[1])||Array.isArray(n[2]);case"any":case"all":for(const e of n.slice(1))if(!Dn(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}const ba={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function wa(n,e){if(n==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};Dn(n)||(n=Pt(n));const t=Ln(n,ba,e);if(t.result==="error")throw new Error(t.value.map(r=>`${r.key}: ${r.message}`).join(", "));{const r=Yr(n);return{filter:(i,s,o)=>t.value.evaluate(i,s,{},o),needGeometry:r,getGlobalStateRefs:()=>St(t.value.expression)}}}function Ca(n,e){return n<e?-1:n>e?1:0}function Yr(n){if(!Array.isArray(n))return!1;if(n[0]==="within"||n[0]==="distance")return!0;for(let e=1;e<n.length;e++)if(Yr(n[e]))return!0;return!1}function Pt(n){if(!n)return!0;const e=n[0];return n.length<=1?e!=="any":e==="=="?An(n[1],n[2],"=="):e==="!="?Ft(An(n[1],n[2],"==")):e==="<"||e===">"||e==="<="||e===">="?An(n[1],n[2],e):e==="any"?_a(n.slice(1)):e==="all"?["all"].concat(n.slice(1).map(Pt)):e==="none"?["all"].concat(n.slice(1).map(Pt).map(Ft)):e==="in"?Jr(n[1],n.slice(2)):e==="!in"?Ft(Jr(n[1],n.slice(2))):e==="has"?Hr(n[1]):e==="!has"?Ft(Hr(n[1])):!0}function An(n,e,t){switch(n){case"$type":return[`filter-type-${t}`,e];case"$id":return[`filter-id-${t}`,e];default:return[`filter-${t}`,n,e]}}function _a(n){return["any"].concat(n.map(Pt))}function Jr(n,e){if(e.length===0)return!1;switch(n){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(t=>typeof t!=typeof e[0])?["filter-in-large",n,["literal",e.sort(Ca)]]:["filter-in-small",n,["literal",e]]}}function Hr(n){switch(n){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",n]}}function Ft(n){return["!",n]}const Ia={StyleExpression:En,StylePropertyFunction:Xe,ZoomConstantExpression:Mt,ZoomDependentExpression:Tt,createExpression:Ln,createPropertyExpression:Ur,isExpression:Zr,isExpressionFilter:Dn,isZoomExpression:ma,normalizePropertyExpression:ga};class Vn{constructor(e,t={}){this.data=t,this.props=new Map;const r=Js[e];for(const i in r)if(Object.hasOwnProperty.call(r,i)){const s=r[i],o=t[i],a=Ia.normalizePropertyExpression(o===void 0?s.default:o,s);this.props.set(i,a)}}resolveTokens(e,t){return t.replace(/{([^{}]+)}/g,(r,i)=>e&&i in e?String(e[i]):"")}getDataConstValue(e,t){const r=this.props.get(e);return r&&r.evaluate({zoom:t})}getDataValue(e,t,r){const i=this.props.get(e);return i&&i.evaluate({zoom:t},r)}}class Wr{constructor(e){this.data=e,this.type=e.type,this.id=e.id,this.minzoom=e.minzoom||0,this.maxzoom=e.maxzoom||24,this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=null,this.paint=new Vn("paint_"+e.type,e.paint),this.layout=new Vn("layout_"+e.type,e.layout),e.filter&&(this.filter=wa(e.filter))}convertColor(e,t){const r=e.a>0?1/e.a:1;return t||(t=new Cesium.Color),t.red=e.r*r,t.green=e.g*r,t.blue=e.b*r,t.alpha=e.a,t}}class Qr{constructor(e){this.styleLayers=e,this.renderLayers=[],this.layerIndexMap={},this.list=[],this.tileIdCommands=[],this.tileCommands=[]}init(){const{styleLayers:e,renderLayers:t,layerIndexMap:r}=this;for(let i=0;i<e.length;i++){const s=e[i];t[i]=[],r[s.id]=i}this.tileIdCommands.length=0,this.tileCommands.length=0}beginFrame(){const e=this.renderLayers;for(const t of e)t.length=0;this.tileIdCommands.length=0,this.tileCommands.length=0}push(e){const t=this.layerIndexMap[e.id];this.renderLayers[t].push(e)}getList(){const e=this.list;e.length=0;const t=this.renderLayers;for(const r of t)r&&e.push(...r);return e}destroy(){this.styleLayers.length=0,this.renderLayers.length=0,this.layerIndexMap=null,this.init()}}function za(n,e,t=2){const r=e&&e.length,i=r?e[0]*t:n.length;let s=Kr(n,0,i,t,!0);const o=[];if(!s||s.next===s.prev)return o;let a,l,u;if(r&&(s=Pa(n,e,s,t)),n.length>80*t){a=n[0],l=n[1];let c=a,f=l;for(let p=t;p<i;p+=t){const d=n[p],h=n[p+1];d<a&&(a=d),h<l&&(l=h),d>c&&(c=d),h>f&&(f=h)}u=Math.max(c-a,f-l),u=u!==0?32767/u:0}return Ze(s,o,t,a,l,u,0),o}function Kr(n,e,t,r,i){let s;if(i===Oa(n,e,t,r)>0)for(let o=e;o<t;o+=r)s=ri(o/r|0,n[o],n[o+1],s);else for(let o=t-r;o>=e;o-=r)s=ri(o/r|0,n[o],n[o+1],s);return s&&Pe(s,s.next)&&(Je(s),s=s.next),s}function ge(n,e){if(!n)return n;e||(e=n);let t=n,r;do if(r=!1,!t.steiner&&(Pe(t,t.next)||D(t.prev,t,t.next)===0)){if(Je(t),t=e=t.prev,t===t.next)break;r=!0}else t=t.next;while(r||t!==e);return e}function Ze(n,e,t,r,i,s,o){if(!n)return;!o&&s&&Aa(n,r,i,s);let a=n;for(;n.prev!==n.next;){const l=n.prev,u=n.next;if(s?Ta(n,r,i,s):Ma(n)){e.push(l.i,n.i,u.i),Je(n),n=u.next,a=u.next;continue}if(n=u,n===a){o?o===1?(n=ka(ge(n),e),Ze(n,e,t,r,i,s,2)):o===2&&Sa(n,e,t,r,i,s):Ze(ge(n),e,t,r,i,s,1);break}}}function Ma(n){const e=n.prev,t=n,r=n.next;if(D(e,t,r)>=0)return!1;const i=e.x,s=t.x,o=r.x,a=e.y,l=t.y,u=r.y,c=Math.min(i,s,o),f=Math.min(a,l,u),p=Math.max(i,s,o),d=Math.max(a,l,u);let h=r.next;for(;h!==e;){if(h.x>=c&&h.x<=p&&h.y>=f&&h.y<=d&&Ue(i,a,s,l,o,u,h.x,h.y)&&D(h.prev,h,h.next)>=0)return!1;h=h.next}return!0}function Ta(n,e,t,r){const i=n.prev,s=n,o=n.next;if(D(i,s,o)>=0)return!1;const a=i.x,l=s.x,u=o.x,c=i.y,f=s.y,p=o.y,d=Math.min(a,l,u),h=Math.min(c,f,p),y=Math.max(a,l,u),v=Math.max(c,f,p),b=Nn(d,h,e,t,r),w=Nn(y,v,e,t,r);let m=n.prevZ,x=n.nextZ;for(;m&&m.z>=b&&x&&x.z<=w;){if(m.x>=d&&m.x<=y&&m.y>=h&&m.y<=v&&m!==i&&m!==o&&Ue(a,c,l,f,u,p,m.x,m.y)&&D(m.prev,m,m.next)>=0||(m=m.prevZ,x.x>=d&&x.x<=y&&x.y>=h&&x.y<=v&&x!==i&&x!==o&&Ue(a,c,l,f,u,p,x.x,x.y)&&D(x.prev,x,x.next)>=0))return!1;x=x.nextZ}for(;m&&m.z>=b;){if(m.x>=d&&m.x<=y&&m.y>=h&&m.y<=v&&m!==i&&m!==o&&Ue(a,c,l,f,u,p,m.x,m.y)&&D(m.prev,m,m.next)>=0)return!1;m=m.prevZ}for(;x&&x.z<=w;){if(x.x>=d&&x.x<=y&&x.y>=h&&x.y<=v&&x!==i&&x!==o&&Ue(a,c,l,f,u,p,x.x,x.y)&&D(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function ka(n,e){let t=n;do{const r=t.prev,i=t.next.next;!Pe(r,i)&&ti(r,t,t.next,i)&&Ye(r,i)&&Ye(i,r)&&(e.push(r.i,t.i,i.i),Je(t),Je(t.next),t=n=i),t=t.next}while(t!==n);return ge(t)}function Sa(n,e,t,r,i,s){let o=n;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&$a(o,a)){let l=ni(o,a);o=ge(o,o.next),l=ge(l,l.next),Ze(o,e,t,r,i,s,0),Ze(l,e,t,r,i,s,0);return}a=a.next}o=o.next}while(o!==n)}function Pa(n,e,t,r){const i=[];for(let s=0,o=e.length;s<o;s++){const a=e[s]*r,l=s<o-1?e[s+1]*r:n.length,u=Kr(n,a,l,r,!1);u===u.next&&(u.steiner=!0),i.push(Na(u))}i.sort(Fa);for(let s=0;s<i.length;s++)t=Ea(i[s],t);return t}function Fa(n,e){let t=n.x-e.x;if(t===0&&(t=n.y-e.y,t===0)){const r=(n.next.y-n.y)/(n.next.x-n.x),i=(e.next.y-e.y)/(e.next.x-e.x);t=r-i}return t}function Ea(n,e){const t=La(n,e);if(!t)return e;const r=ni(t,n);return ge(r,r.next),ge(t,t.next)}function La(n,e){let t=e;const r=n.x,i=n.y;let s=-1/0,o;if(Pe(n,t))return t;do{if(Pe(n,t.next))return t.next;if(i<=t.y&&i>=t.next.y&&t.next.y!==t.y){const f=t.x+(i-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(f<=r&&f>s&&(s=f,o=t.x<t.next.x?t:t.next,f===r))return o}t=t.next}while(t!==e);if(!o)return null;const a=o,l=o.x,u=o.y;let c=1/0;t=o;do{if(r>=t.x&&t.x>=l&&r!==t.x&&ei(i<u?r:s,i,l,u,i<u?s:r,i,t.x,t.y)){const f=Math.abs(i-t.y)/(r-t.x);Ye(t,n)&&(f<c||f===c&&(t.x>o.x||t.x===o.x&&Da(o,t)))&&(o=t,c=f)}t=t.next}while(t!==a);return o}function Da(n,e){return D(n.prev,n,e.prev)<0&&D(e.next,n,n.next)<0}function Aa(n,e,t,r){let i=n;do i.z===0&&(i.z=Nn(i.x,i.y,e,t,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==n);i.prevZ.nextZ=null,i.prevZ=null,Va(i)}function Va(n){let e,t=1;do{let r=n,i;n=null;let s=null;for(e=0;r;){e++;let o=r,a=0;for(let u=0;u<t&&(a++,o=o.nextZ,!!o);u++);let l=t;for(;a>0||l>0&&o;)a!==0&&(l===0||!o||r.z<=o.z)?(i=r,r=r.nextZ,a--):(i=o,o=o.nextZ,l--),s?s.nextZ=i:n=i,i.prevZ=s,s=i;r=o}s.nextZ=null,t*=2}while(e>1);return n}function Nn(n,e,t,r,i){return n=(n-t)*i|0,e=(e-r)*i|0,n=(n|n<<8)&16711935,n=(n|n<<4)&252645135,n=(n|n<<2)&858993459,n=(n|n<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,n|e<<1}function Na(n){let e=n,t=n;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==n);return t}function ei(n,e,t,r,i,s,o,a){return(i-o)*(e-a)>=(n-o)*(s-a)&&(n-o)*(r-a)>=(t-o)*(e-a)&&(t-o)*(s-a)>=(i-o)*(r-a)}function Ue(n,e,t,r,i,s,o,a){return!(n===o&&e===a)&&ei(n,e,t,r,i,s,o,a)}function $a(n,e){return n.next.i!==e.i&&n.prev.i!==e.i&&!Ba(n,e)&&(Ye(n,e)&&Ye(e,n)&&qa(n,e)&&(D(n.prev,n,e.prev)||D(n,e.prev,e))||Pe(n,e)&&D(n.prev,n,n.next)>0&&D(e.prev,e,e.next)>0)}function D(n,e,t){return(e.y-n.y)*(t.x-e.x)-(e.x-n.x)*(t.y-e.y)}function Pe(n,e){return n.x===e.x&&n.y===e.y}function ti(n,e,t,r){const i=Lt(D(n,e,t)),s=Lt(D(n,e,r)),o=Lt(D(t,r,n)),a=Lt(D(t,r,e));return!!(i!==s&&o!==a||i===0&&Et(n,t,e)||s===0&&Et(n,r,e)||o===0&&Et(t,n,r)||a===0&&Et(t,e,r))}function Et(n,e,t){return e.x<=Math.max(n.x,t.x)&&e.x>=Math.min(n.x,t.x)&&e.y<=Math.max(n.y,t.y)&&e.y>=Math.min(n.y,t.y)}function Lt(n){return n>0?1:n<0?-1:0}function Ba(n,e){let t=n;do{if(t.i!==n.i&&t.next.i!==n.i&&t.i!==e.i&&t.next.i!==e.i&&ti(t,t.next,n,e))return!0;t=t.next}while(t!==n);return!1}function Ye(n,e){return D(n.prev,n,n.next)<0?D(n,e,n.next)>=0&&D(n,n.prev,e)>=0:D(n,e,n.prev)<0||D(n,n.next,e)<0}function qa(n,e){let t=n,r=!1;const i=(n.x+e.x)/2,s=(n.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&i<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(r=!r),t=t.next;while(t!==n);return r}function ni(n,e){const t=$n(n.i,n.x,n.y),r=$n(e.i,e.x,e.y),i=n.next,s=e.prev;return n.next=e,e.prev=n,t.next=i,i.prev=t,r.next=t,t.prev=r,s.next=r,r.prev=s,r}function ri(n,e,t,r){const i=$n(n,e,t);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function Je(n){n.next.prev=n.prev,n.prev.next=n.next,n.prevZ&&(n.prevZ.nextZ=n.nextZ),n.nextZ&&(n.nextZ.prevZ=n.prevZ)}function $n(n,e,t){return{i:n,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Oa(n,e,t,r){let i=0;for(let s=e,o=t-r;s<t;s+=r)i+=(n[o]-n[s])*(n[s+1]+n[o+1]),o=s;return i}class se{constructor(e,t){if(t>e)throw new Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=e,this._minGranularity=t}getGranularityForZoomLevel(e){const t=1<<e;return Math.max(Math.floor(this._baseZoomGranularity/t),this._minGranularity,1)}}const Nt=class Nt{constructor(e){this.fill=e.fill,this.line=e.line,this.tile=e.tile,this.stencil=e.stencil,this.circle=e.circle}};Nt.noSubdivision=new Nt({fill:new se(0,0),line:new se(0,0),tile:new se(0,0),stencil:new se(0,0),circle:1});let Dt=Nt;const ue=3;class Bn{constructor(e,t,r){const i=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;const o=new Int32Array(this.arrayBuffer);e=o[0],t=o[1],r=o[2],this.d=t+2*r;for(let u=0;u<this.d*this.d;u++){const c=o[ue+u],f=o[ue+u+1];i.push(c===f?null:o.subarray(c,f))}const a=o[ue+i.length],l=o[ue+i.length+1];this.keys=o.subarray(a,l),this.bboxes=o.subarray(l),this.insert=this._insertReadonly}else{this.d=t+2*r;for(let o=0;o<this.d*this.d;o++)i.push([]);this.keys=[],this.bboxes=[]}this.n=t,this.extent=e,this.padding=r,this.scale=t/e,this.uid=0;const s=r/t*e;this.min=-s,this.max=e+s}insert(e,t,r,i,s){this._forEachCell(t,r,i,s,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(t),this.bboxes.push(r),this.bboxes.push(i),this.bboxes.push(s)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(e,t,r,i,s,o){this.cells[s].push(o)}query(e,t,r,i,s){const o=this.min,a=this.max;if(e<=o&&t<=o&&a<=r&&a<=i&&!s)return Array.prototype.slice.call(this.keys);{const l=[],u={};return this._forEachCell(e,t,r,i,this._queryCell,l,u,s),l}}_queryCell(e,t,r,i,s,o,a,l){const u=this.cells[s];if(u!==null){const c=this.keys,f=this.bboxes;for(let p=0;p<u.length;p++){const d=u[p];if(a[d]===void 0){const h=d*4;(l?l(f[h+0],f[h+1],f[h+2],f[h+3]):e<=f[h+2]&&t<=f[h+3]&&r>=f[h+0]&&i>=f[h+1])?(a[d]=!0,o.push(c[d])):a[d]=!1}}}}_forEachCell(e,t,r,i,s,o,a,l){const u=this._convertToCellCoord(e),c=this._convertToCellCoord(t),f=this._convertToCellCoord(r),p=this._convertToCellCoord(i);for(let d=u;d<=f;d++)for(let h=c;h<=p;h++){const y=this.d*h+d;if(!(l&&!l(this._convertFromCellCoord(d),this._convertFromCellCoord(h),this._convertFromCellCoord(d+1),this._convertFromCellCoord(h+1)))&&s.call(this,e,t,r,i,y,o,a,l))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const e=this.cells,t=ue+this.cells.length+1+1;let r=0;for(let o=0;o<this.cells.length;o++)r+=this.cells[o].length;const i=new Int32Array(t+r+this.keys.length+this.bboxes.length);i[0]=this.extent,i[1]=this.n,i[2]=this.padding;let s=t;for(let o=0;o<e.length;o++){const a=e[o];i[ue+o]=s,i.set(a,s),s+=a.length}return i[ue+e.length]=s,i.set(this.keys,s),s+=this.keys.length,i[ue+e.length+1]=s,i.set(this.bboxes,s),s+=this.bboxes.length,i.buffer}static serialize(e,t){const r=e.toArrayBuffer();return t&&t.push(r),{buffer:r}}static deserialize(e){return new Bn(e.buffer)}}function Ra(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var qn,ii;function ja(){if(ii)return qn;ii=1,qn=n;function n(e,t,r,i){this.cx=3*e,this.bx=3*(r-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(i-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=r,this.p2y=i}return n.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,t){if(t===void 0&&(t=1e-6),e<0)return 0;if(e>1)return 1;for(var r=e,i=0;i<8;i++){var s=this.sampleCurveX(r)-e;if(Math.abs(s)<t)return r;var o=this.sampleCurveDerivativeX(r);if(Math.abs(o)<1e-6)break;r=r-s/o}var a=0,l=1;for(r=e,i=0;i<20&&(s=this.sampleCurveX(r),!(Math.abs(s-e)<t));i++)e>s?a=r:l=r,r=(l-a)*.5+a;return r},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}},qn}var Ga=ja();const Xa=Ra(Ga);function Za(n,e,t,r){const i=new Xa(n,e,t,r);return s=>i.solve(s)}Za(.25,.1,.25,1);function si(n,e,t){return Math.min(t,Math.max(e,n))}const oi={};function O(n){oi[n]||(typeof console<"u"&&console.warn(n),oi[n]=!0)}class Ua extends Error{constructor(e,t,r,i){super(`AJAXError: ${t} (${e}): ${r}`),this.status=e,this.statusText=t,this.url=r,this.body=i}}const ai={};function R(n,e,t={}){if(ai[n])throw new Error(`${n} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:n,writeable:!1}),ai[n]={klass:e,omit:t.omit||[],shallow:t.shallow||[]}}R("Object",Object),R("Set",Set),R("TransferableGridIndex",Bn),R("Color",S),R("Error",Error),R("AJAXError",Ua),R("ResolvedImage",te),R("StylePropertyFunction",Xe),R("StyleExpression",En,{omit:["_evaluator"]}),R("ZoomDependentExpression",Tt),R("ZoomConstantExpression",Mt),R("CompoundExpression",J,{omit:["_evaluate"]});for(const n in Te)Te[n]._classRegistryKey||R(`Expression_${n}`,Te[n]);R("SubdivisionGranularityExpression",se),R("SubdivisionGranularitySetting",Dt);const Fe=-32768,He=32767;class Ya{constructor(e,t){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=e,this._granularityCellSize=X/e,this._canonical=t}_getKey(e,t){return e=e+32768,t=t+32768,e<<16|t<<0}_vertexToIndex(e,t){if(e<-32768||t<-32768||e>32767||t>32767)throw new Error("Vertex coordinates are out of signed 16 bit integer range.");const r=Math.round(e)|0,i=Math.round(t)|0,s=this._getKey(r,i);if(this._vertexDictionary.has(s))return this._vertexDictionary.get(s);const o=this._vertexBuffer.length/2;return this._vertexDictionary.set(s,o),this._vertexBuffer.push(r,i),o}_subdivideTrianglesScanline(e){if(this._granularity<2)return Wa(this._vertexBuffer,e);const t=[],r=e.length;for(let i=0;i<r;i+=3){const s=[e[i+0],e[i+1],e[i+2]],o=[this._vertexBuffer[e[i+0]*2+0],this._vertexBuffer[e[i+0]*2+1],this._vertexBuffer[e[i+1]*2+0],this._vertexBuffer[e[i+1]*2+1],this._vertexBuffer[e[i+2]*2+0],this._vertexBuffer[e[i+2]*2+1]];let a=1/0,l=1/0,u=-1/0,c=-1/0;for(let y=0;y<3;y++){const v=o[y*2],b=o[y*2+1];a=Math.min(a,v),u=Math.max(u,v),l=Math.min(l,b),c=Math.max(c,b)}if(a===u||l===c)continue;const f=Math.floor(a/this._granularityCellSize),p=Math.ceil(u/this._granularityCellSize),d=Math.floor(l/this._granularityCellSize),h=Math.ceil(c/this._granularityCellSize);if(f===p&&d===h){t.push(...s);continue}for(let y=d;y<h;y++){const v=this._scanlineGenerateVertexRingForCellRow(y,o,s);Qa(this._vertexBuffer,v,t)}}return t}_scanlineGenerateVertexRingForCellRow(e,t,r){const i=e*this._granularityCellSize,s=i+this._granularityCellSize,o=[];for(let a=0;a<3;a++){const l=t[a*2],u=t[a*2+1],c=t[(a+1)*2%6],f=t[((a+1)*2+1)%6],p=t[(a+2)*2%6],d=t[((a+2)*2+1)%6],h=c-l,y=f-u,v=h===0,b=y===0,w=(i-u)/y,m=(s-u)/y,x=Math.min(w,m),C=Math.max(w,m);if(!b&&(x>=1||C<=0)||b&&(u<i||u>s)){f>=i&&f<=s&&o.push(r[(a+1)%3]);continue}if(!b&&x>0){const _=l+h*x,P=u+y*x;o.push(this._vertexToIndex(_,P))}const M=l+h*Math.max(x,0),k=l+h*Math.min(C,1);if(v||this._generateIntraEdgeVertices(o,l,u,c,f,M,k),!b&&C<1){const _=l+h*C,P=u+y*C;o.push(this._vertexToIndex(_,P))}(b||f>=i&&f<=s)&&o.push(r[(a+1)%3]),!b&&(f<=i||f>=s)&&this._generateInterEdgeVertices(o,l,u,c,f,p,d,k,i,s)}return o}_generateIntraEdgeVertices(e,t,r,i,s,o,a){const l=i-t,u=s-r,c=u===0,f=c?Math.min(t,i):Math.min(o,a),p=c?Math.max(t,i):Math.max(o,a),d=Math.floor(f/this._granularityCellSize)+1,h=Math.ceil(p/this._granularityCellSize)-1;if(c?t<i:o<a)for(let v=d;v<=h;v++){const b=v*this._granularityCellSize,w=r+u*(b-t)/l;e.push(this._vertexToIndex(b,w))}else for(let v=h;v>=d;v--){const b=v*this._granularityCellSize,w=r+u*(b-t)/l;e.push(this._vertexToIndex(b,w))}}_generateInterEdgeVertices(e,t,r,i,s,o,a,l,u,c){const f=s-r,p=o-i,d=a-s,h=(u-s)/d,y=(c-s)/d,v=Math.min(h,y),b=Math.max(h,y),w=i+p*v;let m=Math.floor(Math.min(w,l)/this._granularityCellSize)+1,x=Math.ceil(Math.max(w,l)/this._granularityCellSize)-1,C=l<w;const M=d===0;if(M&&(a===u||a===c))return;if(M||v>=1||b<=0){const _=t-o,P=r-a,V=(u-a)/P,H=(c-a)/P,G=Math.min(V,H),ce=o+_*G;m=Math.floor(Math.min(ce,l)/this._granularityCellSize)+1,x=Math.ceil(Math.max(ce,l)/this._granularityCellSize)-1,C=l<ce}const k=f>0?c:u;if(C)for(let _=m;_<=x;_++){const P=_*this._granularityCellSize;e.push(this._vertexToIndex(P,k))}else for(let _=x;_>=m;_--){const P=_*this._granularityCellSize;e.push(this._vertexToIndex(P,k))}}_generateOutline(e){const t=[];for(const r of e){const i=li(r,this._granularity,!0),s=this._pointArrayToIndices(i),o=[];for(let a=1;a<s.length;a++)o.push(s[a-1]),o.push(s[a]);t.push(o)}return t}_handlePoles(e){let t=!1,r=!1;this._canonical&&(this._canonical.y===0&&(t=!0),this._canonical.y===(1<<this._canonical.z)-1&&(r=!0)),(t||r)&&this._fillPoles(e,t,r)}_ensureNoPoleVertices(){const e=this._vertexBuffer;for(let t=0;t<e.length;t+=2){const r=e[t+1];r===Fe&&(e[t+1]=Fe+1),r===He&&(e[t+1]=He-1)}}_generatePoleQuad(e,t,r,i,s,o){i>s!=(o===Fe)?(e.push(t),e.push(r),e.push(this._vertexToIndex(i,o)),e.push(r),e.push(this._vertexToIndex(s,o)),e.push(this._vertexToIndex(i,o))):(e.push(r),e.push(t),e.push(this._vertexToIndex(i,o)),e.push(this._vertexToIndex(s,o)),e.push(r),e.push(this._vertexToIndex(i,o)))}_fillPoles(e,t,r){const i=this._vertexBuffer,s=0,o=X,a=e.length;for(let l=2;l<a;l+=3){const u=e[l-2],c=e[l-1],f=e[l],p=i[u*2],d=i[u*2+1],h=i[c*2],y=i[c*2+1],v=i[f*2],b=i[f*2+1];t&&(d===s&&y===s&&this._generatePoleQuad(e,u,c,p,h,Fe),y===s&&b===s&&this._generatePoleQuad(e,c,f,h,v,Fe),b===s&&d===s&&this._generatePoleQuad(e,f,u,v,p,Fe)),r&&(d===o&&y===o&&this._generatePoleQuad(e,u,c,p,h,He),y===o&&b===o&&this._generatePoleQuad(e,c,f,h,v,He),b===o&&d===o&&this._generatePoleQuad(e,f,u,v,p,He))}}_initializeVertices(e){for(let t=0;t<e.length;t+=2)this._vertexToIndex(e[t],e[t+1])}subdividePolygonInternal(e,t){if(this._used)throw new Error("Subdivision: multiple use not allowed.");this._used=!0;const{flattened:r,holeIndices:i}=Ha(e);this._initializeVertices(r);let s;try{const a=za(r,i),l=this._convertIndices(r,a);s=this._subdivideTrianglesScanline(l)}catch(a){console.error(a)}let o=[];return t&&(o=this._generateOutline(e)),this._ensureNoPoleVertices(),this._handlePoles(s),{verticesFlattened:this._vertexBuffer,indicesTriangles:s,indicesLineList:o}}_convertIndices(e,t){const r=[];for(let i=0;i<t.length;i++){const s=e[t[i]*2],o=e[t[i]*2+1];r.push(this._vertexToIndex(s,o))}return r}_pointArrayToIndices(e){const t=[];for(let r=0;r<e.length;r++){const i=e[r];t.push(this._vertexToIndex(i.x,i.y))}return t}}function Ja(n,e,t,r=!0){return new Ya(t,e).subdividePolygonInternal(n,r)}function li(n,e,t=!1){if(!n||n.length<1)return[];if(n.length<2)return[];const r=n[0],i=n[n.length-1],s=t&&(r.x!==i.x||r.y!==i.y);if(e<2)return s?[...n,n[0]]:[...n];const o=Math.floor(X/e),a=[];a.push(new N(n[0].x,n[0].y));const l=n.length,u=s?l:l-1;for(let c=0;c<u;c++){const f=n[c],p=c<l-1?n[c+1]:n[0],d=f.x,h=f.y,y=p.x,v=p.y,b=d!==y,w=h!==v;if(!b&&!w)continue;const m=y-d,x=v-h,C=Math.abs(m),M=Math.abs(x);let k=d,_=h;for(;;){const V=m>0?(Math.floor(k/o)+1)*o:(Math.ceil(k/o)-1)*o,H=x>0?(Math.floor(_/o)+1)*o:(Math.ceil(_/o)-1)*o,G=Math.abs(k-V),ce=Math.abs(_-H),ll=Math.abs(k-y),ul=Math.abs(_-v),vi=b?G/C:Number.POSITIVE_INFINITY,xi=w?ce/M:Number.POSITIVE_INFINITY;if((ll<=G||!b)&&(ul<=ce||!w))break;if(vi<xi&&b||!w){k=V,_=_+x*vi;const ve=new N(k,Math.round(_));(a[a.length-1].x!==ve.x||a[a.length-1].y!==ve.y)&&a.push(ve)}else{k=k+m*xi,_=H;const ve=new N(Math.round(k),_);(a[a.length-1].x!==ve.x||a[a.length-1].y!==ve.y)&&a.push(ve)}}const P=new N(y,v);(a[a.length-1].x!==P.x||a[a.length-1].y!==P.y)&&a.push(P)}return a}function Ha(n){const e=[],t=[];for(const r of n)if(r.length!==0){r!==n[0]&&e.push(t.length/2);for(let i=0;i<r.length;i++)t.push(r[i].x),t.push(r[i].y)}return{flattened:t,holeIndices:e}}function Wa(n,e){const t=[];for(let r=0;r<e.length;r+=3){const i=e[r],s=e[r+1],o=e[r+2],a=n[i*2],l=n[i*2+1],u=n[s*2],c=n[s*2+1],f=n[o*2],p=n[o*2+1],d=u-a,h=c-l,y=f-a,v=p-l;d*v-h*y>0?(t.push(i),t.push(o),t.push(s)):(t.push(i),t.push(s),t.push(o))}return t}function Qa(n,e,t){if(e.length===0)throw new Error("Subdivision vertex ring is empty.");let r=0,i=n[e[0]*2];for(let l=1;l<e.length;l++){const u=n[e[l]*2];u<i&&(i=u,r=l)}const s=e.length;let o=r,a=(o+1)%s;for(;;){const l=o-1>=0?o-1:s-1,u=(a+1)%s,c=n[e[l]*2],f=n[e[l]*2+1],p=n[e[u]*2],d=n[e[u]*2+1],h=n[e[o]*2],y=n[e[o]*2+1],v=n[e[a]*2],b=n[e[a]*2+1];let w=!1;if(c<p)w=!0;else if(c>p)w=!1;else{const m=v-h,C=b-y,M=-m,k=y<b?1:-1,_=((c-h)*C+(f-y)*M)*k,P=((p-h)*C+(d-y)*M)*k;_>P&&(w=!0)}if(w){const m=e[l],x=e[o],C=e[a];m!==x&&m!==C&&x!==C&&t.push(C,x,m),o--,o<0&&(o=s-1)}else{const m=e[u],x=e[o],C=e[a];m!==x&&m!==C&&x!==C&&t.push(C,x,m),a++,a>=s&&(a=0)}if(l===u)break}}const ui={globe:new Dt({fill:new se(128,2),line:new se(512,0),tile:new se(128,32),stencil:new se(128,1),circle:3})};let On=null,ci=0,Rn=null;function Ka(n,e){return Rn===null&&(Rn=Cesium.TerrainProvider.getEstimatedLevelZeroGeometricErrorForAHeightmap(e.ellipsoid,128,e.getNumberOfXTilesAtLevel(0))),Rn/(1<<n)}function el(n,e){const t=Ka(e.z,e.tilingScheme),r=e.distanceToCamera,i=n.context.drawingBufferHeight,s=n.camera.frustum.sseDenominator;let o=t*i/(r*s);return n.fog.enabled&&(o-=Cesium.Math.fog(r,n.fog.density)*n.fog.sse),o/=n.pixelRatio,o}function tl(){On===null&&(On=Cesium.RenderState.fromCache({id:"vt_tile-depth",blending:Cesium.BlendingState.DISABLED,depthTest:{enabled:!0},depthMask:!0,cull:{enabled:!0},stencilMask:Cesium.StencilConstants.CESIUM_3D_TILE_MASK,stencilTest:{backFunction:519,backOperation:{fail:7680,zFail:7680,zPass:7681},enabled:!0,frontFunction:519,frontOperation:{fail:7680,zFail:7680,zPass:7681},mask:128,reference:128},colorMask:{red:!1,green:!1,blue:!1,alpha:!1}}))}class At{constructor(e){tl(),this.x=e.x,this.y=e.y,this.z=e.z,this.parent=e.parent,this.children=[],this.tilingScheme=e.tilingScheme,this.rectangle=this.tilingScheme.tileXYToRectangle(this.x,this.y,this.z),this.tileBoundingRegion=new Cesium.TileBoundingRegion({rectangle:this.rectangle,minimumHeight:0,maximumHeight:0,ellipsoid:this.tilingScheme.ellipsoid,computeBoundingVolumes:!0}),this.layers=[],this.visualizers=[],this.sources={},this.tileId=null,this.lastVisitTime=0,this.state="none",this.tileId={x:this.x,y:this.y,z:this.z,key:ci++,color:Cesium.Color.fromRgba(ci-1),tileColor:Cesium.Color.fromRandom({alpha:1})};const t=X*Math.pow(2,this.z),r=X*this.x,i=X*this.y;this.transformPoint=function(s,o,a){return a[0]=(s+r)*360/t-180,a[1]=360/Math.PI*Math.atan(Math.exp((1-(o+i)*2/t)*Math.PI))-90,a}}createChildren(){var e=[{x:this.x*2,y:this.y*2+1,z:this.z+1},{x:this.x*2+1,y:this.y*2+1,z:this.z+1},{x:this.x*2,y:this.y*2,z:this.z+1},{x:this.x*2+1,y:this.y*2,z:this.z+1}];for(const{x:r,y:i,z:s}of e){var t=new At({x:r,y:i,z:s,tilingScheme:this.tilingScheme,parent:this});this.children.push(t)}}visit(e,t){const r=this.tileBoundingRegion;if(this.distanceToCamera=r.distanceToCamera(e),this.visibility=e.cullingVolume.computeVisibility(r),this.visibility==Cesium.Intersect.OUTSIDE)return;const i=e.maximumScreenSpaceError;el(e,this)>=i?t.visitChildren(this):t.accept(this)}async getSources(e){const t={},r=e._styleJson;for(const i of r.layers){const s=i.source,o=e.sources[s];o&&!t[s]&&(t[s]=o)}for(const i in t){const s=t[i];try{const o=await s.requestTile(this.x,this.y,this.z,e);o&&(this.sources[i]=o)}catch{}}e.numLoading--,this.state="loaded"}async createRenderLayers(e,t){const r=this.sources,i=t._styleLayers,s=this.layers,o=this.visualizers,a={};for(const l of i){const u=r[l.source],c=jn[l.type],f=Gn[l.type],p=l.type==="background";if(!p&&!u||!c)continue;const d=[];if(!p){const v=(l.source&&t.sources[l.source].type)=="geojson"?"_geojsonTileLayer":l.sourceLayer,b=u.layers[v];if(!b)continue;const w=b.length;for(let m=0;m<w;m++){const x=b.feature(m);l.filter&&!l.filter.filter({zoom:this.z},x)||d.push(x)}if(!d.length)continue}const h=new c(d,l,this);if(s.push(h),f){let y=a[l.type];y||(y=new f(this),a[l.type]=y,o.push(y)),y.addLayer(d,h,e,t)}}this.state="ready"}update(e,t,r){this.primitive||(this.primitive=new Cesium.Primitive({geometryInstances:new Cesium.GeometryInstance({geometry:new Cesium.RectangleGeometry({rectangle:this.rectangle})}),compressVertices:!1,asynchronous:!1,appearance:new Cesium.MaterialAppearance({flat:!0,translucent:!1,material:Cesium.Material.fromType("Color",{color:Cesium.Color.fromAlpha(this.tileId.tileColor,.25)}),renderState:{blending:Cesium.BlendingState.ALPHA_BLEND,depthMask:!1,depthTest:{enabled:!0},cull:{enabled:!1}}})}),this.primitive.name="_tile-color_");const i=this.commandList||[],s=this.tileIdCommands||[],o=this.tileDepthCommands||[];if(!i.length){const a=e.commandList;if(e.commandList=i,this.primitive.update(e),i.length){const l=this.tileId.color;for(const u of i){u.pass=Cesium.Pass.CESIUM_3D_TILE;const c=Cesium.DrawCommand.shallowClone(u);c.renderState=Cesium.RenderState.fromCache({id:"tileId",blending:{enabled:!1},depthTest:{enabled:!1},depthMask:!0,cull:{enabled:!0}}),c.layerType="tile-id",c.uniformMap={...u.uniformMap},c.uniformMap.color_0=function(){return l},s.push(c);const f=Cesium.DrawCommand.shallowClone(u);f.pass=Cesium.Pass.CESIUM_3D_TILE,f.renderState=On,o.layerType="tile-depth",o.push(f)}this.tileIdCommands=s,this.tileDepthCommands=o}this.commandList=i,e.commandList=a}for(const a of s)t.tileIdCommands.push(a);if(r.showTileColor&&i.length&&t.tileCommands.push(...i),o.length&&t.tileCommands.push(...o),this.state=="none"&&r.numLoading<1&&(r.numLoading++,this.state="loading",this.getSources(r)),this.state==="loaded"&&r.numInitializing<1&&(this.state="initializing",r.numInitializing++,this.createRenderLayers(e,r)),this.state==="ready"){for(const a of this.visualizers)a.update(e,r);for(const a of this.layers)t.push(a)}}unload(){this.primitive&&(this.primitive.destroy(),this.primitive=null),this.tileGeometry=null,this.commandList&&(this.commandList.length=0),this.tileIdCommands&&(this.tileIdCommands.length=0),this.tileDepthCommands&&(this.tileDepthCommands.length=0);for(const e of this.visualizers)e.destroy();this.visualizers.length=0;for(const e of this.layers)e.destroy();this.layers.length=0,this.sources={},this.state="none"}destroy(){if(this.unload(),this.tileId=null,this.tilingScheme=null,this.parent=null,this.children){for(const e of this.children)e.destroy();this.children.length=0,this.children=null}}}class nl{constructor(e){this.maximumLevel=24,this.show=!0,this.showTileColor=!!e.showTileColor,this.ready=!1,this.tilingScheme=new Cesium.WebMercatorTilingScheme,this.readyEvent=new Cesium.Event,this.errorEvent=new Cesium.Event,this._styleJson=null,this._style=e.style,this._rootTiles=[],this._cacheTiles=[],this._tilesToRender=[],this._styleLayers=[],this._renderList=new Qr(this._styleLayers),this.numLoading=0,this.numInitializing=0,this.tileIdTexture=null,requestAnimationFrame(()=>{this.init()})}async init(){let e=this._style;if(!e){this.errorEvent.raiseEvent(new Error("请传入 style 参数"));return}this.path="",typeof e=="string"&&(this.path=e.split("/").slice(0,-1).join("/"),this.path&&(this.path+="/"),e=await Cesium.Resource.fetchJson(e)),this.sources={};for(const o in e.sources){const a=e.sources[o],l=Bt[a.type];if(l){this.sources[o]=new l(a,this.path);try{await this.sources[o].init(),this.maximumLevel=Math.min(a.maxzoom||24,this.maximumLevel)}catch(u){this.errorEvent.raiseEvent(u)}}}for(let o=0;o<e.layers.length;o++)this._styleLayers[o]=new Wr(e.layers[o]);const t=this.tilingScheme.getNumberOfXTilesAtLevel(0),r=this.tilingScheme.getNumberOfYTilesAtLevel(0);let i=0;for(let o=0;o<r;o++)for(let a=0;a<t;a++){var s=new At({parent:this,x:a,y:o,z:0,tilingScheme:this.tilingScheme});s.createChildren(),this._rootTiles[i++]=s}this._renderList.init(),this._styleJson=e,this.ready=!0,this.readyEvent.raiseEvent(this)}executeTileIdCommands(e){const t=this._renderList.tileIdCommands;if(t.length>0){const r=e.context;let i=this._tileIdFbo;i||(i=new Cesium.FramebufferManager({depthStencil:!0,supportsDepthTexture:!0}),this._tileIdFbo=i,this._idClearCommand=new Cesium.ClearCommand({color:new Cesium.Color(0,0,0,0),depth:1,stencil:0}));const s=r.floatingPointTexture?Cesium.PixelDatatype.FLOAT:Cesium.PixelDatatype.UNSIGNED_BYTE,o=r.drawingBufferWidth,a=r.drawingBufferHeight;i.update(r,o,a,1,s),i.clear(r,this._idClearCommand);const l=i.framebuffer;for(const u of t)u.framebuffer=l,u.execute(r);this.tileIdTexture=i.getColorTexture(0)}}update(e){if(!this.ready||!this.show)return;e.context.webgl2&&O("webgl2模式下贴地线面的支持将导致性能下降");const t=this._renderList;t.beginFrame(),this.numInitializing=0;const r=e.camera._scene,s=r.globe._surface._debug.suspendLodUpdate;this.scene=r;const o=s?this._tilesToRender:rl(e,this);s||o.sort((u,c)=>u.distanceToCamera-c.distanceToCamera);for(const u of o)u.lastVisitTime=e.frameNumber,u.expired=!1,u.update(e,t,this);const a=t.getList();for(const u of a)u.update(e,this);e.commandList.push(...t.tileCommands),this.executeTileIdCommands(e);const l=[];for(const u of this._cacheTiles)u.lastVisitTime<e.frameNumber&&(u.expired||l.push(u));if(l.sort((u,c)=>u.lastVisitTime-c.lastVisitTime),l.length>100){for(const u of l)if(u.unload(),u.expired=!0,l.length<=50)break}}destroy(){const e=this.scene,t=this._rootTiles;if(this.scene=null,e&&e.primitives.contains(this)&&e.primitives.remove(this),t){for(const r of t)r.destroy();t.length=0,this._rootTiles=null}if(this._cacheTiles&&(this._cacheTiles.length=0,this._cacheTiles=null),this.sources){for(const r in this.sources)Object.hasOwnProperty.call(this.sources,r)&&this.sources[r].destroy();this.sources=null}this._styleLayers=null,this._renderList&&(this._renderList.destroy(),this._renderList=null),this._tilesToRender&&(this._tilesToRender.length=0,this._tilesToRender=null),this._tileIdFbo&&(this._tileIdFbo.destroy(),this.tileIdTexture=null,this._tileIdFbo=null,this._idClearCommand=null),this._styleJson=null}isDestroyed(){return!1}}function rl(n,e){const t=[...e._rootTiles],r=e._tilesToRender,i={visitChildren(s){if(s.z>=e.maximumLevel)return r.push(s);if(s.children.length==0){s.createChildren();for(const o of s.children)e._cacheTiles.push(o)}for(const o of s.children)t.push(o)},accept(s){r.push(s)}};r.length=0;do t.shift().visit(n,i);while(t.length>0);return r}class We{constructor(e,t,r){this.sourceFeatures=e,this.style=t,this.tile=r,this.features=[],this.firstBatchId=-1,this.lastBatchId=-1,this.offsets=[],this.counts=[],this.commandList=[]}get id(){return this.style.id}get type(){return this.style.type}update(e,t){if(this.style.layout.getDataConstValue("visibility",this.tile.z)==="none")return;const i=this.commandList;if(i&&i.length)for(const s of i)e.commandList.push(s)}isDestroyed(){return!1}destroy(){this.commandList&&(this.commandList.length=0),this.sourceFeatures&&(this.sourceFeatures.length=0),this.style=null,this.offsets=null,this.counts=null,this.tile=null,this.isDestroyed=function(){return!0}}}class Vt{constructor(e,t=[]){this.tile=e,this.layers=t,this.state="none"}addLayer(e,t,r,i){}update(e,t){}destroy(){this.tile=null,this.layers.length=0,this.isDestroyed=function(){return!0}}isDestroyed(){return!1}}const jn={},Gn={};function Qe(n,e,t){jn[n]=e,Gn[n]=t}class fi extends We{createPrimitve(e,t){const r=this.style,i=this.tile,s=r.convertColor(r.paint.getDataConstValue("background-color",i.z)),o=r.paint.getDataConstValue("background-opacity",i.z);if(r.paint.getDataConstValue("background-pattern",i.z))return O("background图层:不支持纹理填充");s.alpha*=o;const l=new Cesium.Primitive({geometryInstances:new Cesium.GeometryInstance({geometry:new Cesium.RectangleGeometry({rectangle:this.tile.rectangle})}),compressVertices:!1,asynchronous:!1,appearance:new Cesium.MaterialAppearance({translucent:!1,material:Cesium.Material.fromType("Color",{color:s}),flat:!0})});this.primitive=l}update(e,t){if(this.primitive||this.createPrimitve(e,t),this.primitive&&!this.commandList.length){const r=e.commandList,i=e.commandList=this.commandList;if(this.primitive.update(e),i.length>0){const s=Cesium.RenderState.fromCache({blending:Cesium.BlendingState.ALPHA_BLEND,depthMask:!1,depthTest:{enabled:!0},cull:{enabled:!0}});for(const o of i)o.renderState=s,o.pass=Cesium.Pass.CESIUM_3D_TILE}e.commandList=r}super.update(e,t)}destroy(){this.primitive=this.primitive&&this.primitive.destroy(),super.destroy()}}Qe("background",fi);const Xn=Math.pow(2,15-1)-1,pi=-Xn-1;function hi(n){const e=X/n.extent,t=n.loadGeometry();for(let r=0;r<t.length;r++){const i=t[r];for(let s=0;s<i.length;s++){const o=i[s],a=Math.round(o.x*e),l=Math.round(o.y*e);o.x=si(a,pi,Xn),o.y=si(l,pi,Xn),(a<o.x||a>o.x+1||l<o.y||l>o.y+1)&&O("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return t}class il extends Vt{constructor(e,t){super(e,t),this.geometryInstances=[],this.primitive=null,this.commandsReady=!1}addLayer(e,t,r,i){const s=t.style,{tile:o,geometryInstances:a}=this,l=ui.globe.line.getGranularityForZoomLevel(o.z)/2,u=this;let c=0;const f=i.sources[t.style.source].styleSource.promoteId;for(const p of e){const d=Ee.types[p.type],h=p.properties;if(d!=="Polygon")continue;if(s.paint.getDataValue("fill-pattern",o.z,p)){O("fill图层:不支持纹理填充(fill-pattern)");continue}const v=p.id||h[f],b=s.convertColor(s.paint.getDataValue("fill-color",o.z,p)),w=s.paint.getDataValue("fill-opacity",o.z,p),m=hi(p),x=Un(m);for(const C of x){if(C.some(_=>_.length<3))continue;const M=a.length;c==0&&(t.firstBatchId=M),t.lastBatchId=M;const k={coordinates:C,featureId:c,fillColor:b,fillOpacity:w,properties:h,id:v,batchId:M};u.addFeature(k,l),c++}}t.offsets=[],t.counts=[],this.layers.push(t)}addFeature(e,t){const r=this.geometryInstances,{coordinates:i,fillColor:s,fillOpacity:o}=e,a=s.toBytes();a[3]=Math.floor(a[3]*o);const l=Ja(i,this.tile,t,!1),u=l.verticesFlattened,c=[0,0],f=new Cesium.Cartesian3,p=u.length/2,d=new Float64Array(p*3),h=new Float32Array(p*3),y=new Float32Array(p*2);for(let C=0,M=0;C<u.length;C+=2,M++){const k=u[C],_=u[C+1],P=this.tile.transformPoint(k,_,c),V=Cesium.Cartesian3.fromDegrees(P[0],P[1],0,null,f);d[M*3]=V.x,d[M*3+1]=V.y,d[M*3+2]=V.z;const H=Cesium.Cartesian3.normalize(V,V);h[M*3]=H.x,h[M*3+1]=H.y,h[M*3+2]=H.z,y[M*2]=k/X,y[M*2+1]=_/X}const v=new(p>65535?Uint32Array:p>255?Uint16Array:Uint8Array)(l.indicesTriangles),b=new Cesium.Geometry({attributes:{position:{componentDatatype:Cesium.ComponentDatatype.DOUBLE,componentsPerAttribute:3,normalize:!1,values:d},normal:{componentDatatype:Cesium.ComponentDatatype.FLOAT,componentsPerAttribute:3,normalize:!1,values:h},st:{componentDatatype:Cesium.ComponentDatatype.FLOAT,componentsPerAttribute:2,normalize:!1,values:y}},primitiveType:Cesium.PrimitiveType.TRIANGLES,indices:v,boundingSphere:Cesium.BoundingSphere.fromVertices(d)}),w=Cesium.Cartographic.fromCartesian(b.boundingSphere.center);w.height=0;const m=Cesium.Cartographic.toCartesian(w,null,f),x=new Cesium.GeometryInstance({geometry:b,attributes:{color:new Cesium.GeometryInstanceAttribute({componentDatatype:Cesium.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:4,normalize:!0,value:a})},id:new Cesium.Entity({position:m,id:e.id,properties:e.properties})});r.push(x)}createPrimitive(){const e=new Cesium.Primitive({geometryInstances:this.geometryInstances,asynchronous:!(this.geometryInstances[0].geometry instanceof Cesium.Geometry),appearance:new Cesium.PerInstanceColorAppearance({flat:!0,translucent:!1,renderState:{depthMask:!1},fragmentShaderSource:`
2
+ in vec4 v_color;
3
+
4
+ uniform vec4 tileId;
5
+ uniform sampler2D tileIdTexture;
6
+
7
+ void main()
8
+ {
9
+ vec2 id_st = gl_FragCoord.xy / czm_viewport.zw;
10
+ vec4 bgId = texture(tileIdTexture, id_st);
11
+ if (!all(equal(bgId, tileId)))
12
+ {
13
+ discard;
14
+ }
15
+ out_FragColor = v_color;
16
+ }
17
+ `})});let t=this;Object.defineProperties(e,{_geometries:{get(){return this._geometries_},set(r){this._geometries_=r,r?t.onGeometriesLoaded(r):t=null}},_batchTable:{get(){return this._batchTable_},set(r){this._batchTable_=r,r&&t.onBatchTableCreated(r)}}}),this.primitive=e}onGeometriesLoaded(e){for(let t=0;t<e.length;t++){const r={},i=e[t],s=i.attributes.batchId.values,o=i.indices;let a=-1,l=null;for(let u=0;u<o.length;u++){const c=o[u],f=s[c];a!==f&&(a=f,l=r[a]={begin:u,end:u}),l.end=u}for(const u of this.layers){const{firstBatchId:c,lastBatchId:f}=u;if(c===-1||f===-1)continue;let p=-1,d=-1;for(let h=c;h<=f;h++){const y=r[h];y&&(p===-1&&(p=y.begin),d=y.end)}p===-1||d===-1||(u.offsets[t]=p,u.counts[t]=d-p+1)}}}onBatchTableCreated(e){this._batchTable=e}createLayerCommands(e,t){const r=Cesium.RenderState.fromCache({id:"fill",blending:Cesium.BlendingState.ALPHA_BLEND,depthMask:!1,depthTest:{enabled:!0},cull:{enabled:!0}}),i=this.tile.tileId;this.renderState=r;for(let s=0;s<this.layers.length;s++){const o=this.layers[s],a=o.commandList=[];for(let l=0;l<e.length;l++){const u=o.offsets[l],c=o.counts[l];if(typeof u!="number"||typeof c!="number")continue;const f=e[l];f.uniformMap.tileIdTexture=function(){return t.tileIdTexture},f.uniformMap.tileId=function(){return i.color},f.pass=Cesium.Pass.CESIUM_3D_TILE;const p=Cesium.DrawCommand.shallowClone(f);p.pass=Cesium.Pass.CESIUM_3D_TILE,p.renderState=r,p.layerType="fill",p.offset=u,p.count=c,a.push(p)}}this.state="done"}update(e,t){if(this.geometryInstances&&(super.update(e,t),!this.primitive&&this.geometryInstances.length&&this.createPrimitive(),this.primitive&&this.state!=="done"&&this.state!=="error")){const r=e.commandList,i=e.commandList=[];try{this.primitive.update(e)}catch(s){this.geometryInstances=[],this.state="error",s.stack?console.trace(s.stack):console.error(s);return}i.length>0&&this.createLayerCommands(i,t),e.commandList=r,this.geometryInstances=[]}}destroy(){this.primitive=this.primitive&&this.primitive.destroy(),this._batchTable=null,this.geometryInstances=null,super.destroy()}isDestroyed(){return!1}}class di extends We{update(e,t){super.update(e,t)}}Qe("fill",di,il);const sl=Ee.prototype.toGeoJSON;class ol extends Vt{constructor(e,t){super(e,t),this.geometryInstances=[],this.primitive=null,this.commandsReady=!1}addLayer(e,t,r,i){const s=t.style,{tile:o,geometryInstances:a}=this,l=ui.globe.line.getGranularityForZoomLevel(o.z),u=this,c=i.sources[t.style.source].styleSource.promoteId;let f=0;const p=s.paint.getDataConstValue("line-dasharray",o.z);if(p&&p.length){p.length%2>0&&p.push(0),t.dashLength=0;for(let h=0;h<p.length;h++)t.dashLength+=p[h];t.dasharray=p,p.length>8&&O("line图层:line-dasharray 超过最大长度(8)")}function d(h,y,v,b,w,m){if(h.length<2)return;const x=a.length;f==0&&(t.firstBatchId=x),t.lastBatchId=x;const C={coordinates:h,featureId:f,lineColor:v,lineOpacity:b,lineWidth:y,properties:m,id:w,batchId:x};u.addFeature(C),f++}for(const h of e){const y=Ee.types[h.type];if(y==="Point"||y==="Unknown")continue;const v=h.properties,b=hi(h);for(let G=0;G<b.length;G++)b[G]=li(b[G],l);const w=sl.call({extent:X,type:h.type,properties:v,loadGeometry(){return b}},o.x,o.y,o.z);if(!w.geometry)continue;const m=h.id||v[c],x=s.paint.getDataValue("line-width",o.z,h),C=s.convertColor(s.paint.getDataValue("line-color",o.z,h)),M=s.paint.getDataValue("line-opacity",o.z,h);if(s.paint.getDataValue("line-pattern",o.z,h)){O("line图层:不支持纹理填充(line-pattern)");continue}const _=s.paint.getDataValue("line-join",o.z,h),P=s.paint.getDataValue("line-cap",o.z,h);_!=="miter"&&O("line图层:line-join 仅支持 miter 模式"),P!=="butt"&&O("line图层:line-cap 仅支持 butt 模式");const V=w.geometry.type,H=w.geometry.coordinates;if(V=="LineString")d(H,x,C,M,m,v);else if(V=="MultiLineString"||V=="Polygon")for(const G of H)d(G,x,C,M,m,v);else if(V=="MultiPolygon")for(const G of H)for(const ce of G)d(ce,x,C,M,m,v);else O("line图层:不支持几何类型:"+V)}t.offsets=[],t.counts=[],this.layers.push(t)}addFeature(e){const t=this.geometryInstances,{coordinates:r,lineColor:i,lineWidth:s,lineOpacity:o}=e,a=i.toBytes();a[3]=Math.floor(a[3]*o);const l=r.map(d=>Cesium.Cartesian3.fromDegrees(d[0],d[1])),u=Cesium.BoundingSphere.fromPoints(l),c=Cesium.Cartographic.fromCartesian(u.center);c.height=0;const f=Cesium.Cartographic.toCartesian(c,null,cartesian),p=new Cesium.GeometryInstance({geometry:new Cesium.PolylineGeometry({positions:l,width:s}),attributes:{color:new Cesium.GeometryInstanceAttribute({componentDatatype:Cesium.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:4,normalize:!0,value:a})},id:new Cesium.Entity({position:f,id:e.id,properties:e.properties})});t.push(p)}createPrimitive(){const e=new Cesium.Primitive({geometryInstances:this.geometryInstances,asynchronous:!0,appearance:new Cesium.PolylineMaterialAppearance({flat:!0,translucent:!1,vertexShaderSource:`
18
+ ${Cesium._shadersPolylineCommon}
19
+
20
+ in vec4 color;
21
+ out vec4 v_color;
22
+ in vec3 position3DHigh;
23
+ in vec3 position3DLow;
24
+ in vec3 prevPosition3DHigh;
25
+ in vec3 prevPosition3DLow;
26
+ in vec3 nextPosition3DHigh;
27
+ in vec3 nextPosition3DLow;
28
+ in vec2 expandAndWidth;
29
+ in vec2 st;
30
+ in float batchId;
31
+
32
+ out float v_width;
33
+ out vec2 v_st;
34
+ out float v_polylineAngle;
35
+
36
+ void main()
37
+ {
38
+ float expandDir = expandAndWidth.x;
39
+ float width = abs(expandAndWidth.y) + 0.5;
40
+ bool usePrev = expandAndWidth.y < 0.0;
41
+
42
+ vec4 p = czm_computePosition();
43
+ vec4 prev = czm_computePrevPosition();
44
+ vec4 next = czm_computeNextPosition();
45
+
46
+ float angle;
47
+ vec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, angle);
48
+ gl_Position = czm_viewportOrthographic * positionWC;
49
+
50
+ v_width = width;
51
+ v_st.s = st.s;
52
+ v_st.t = czm_writeNonPerspective(st.t, gl_Position.w);
53
+ v_polylineAngle = angle;
54
+ v_color = color;
55
+ }
56
+ `,fragmentShaderSource:`
57
+ in vec2 v_st;
58
+
59
+ uniform vec4 tileId;
60
+ uniform sampler2D tileIdTexture;
61
+
62
+ void main()
63
+ {
64
+ vec2 id_st = gl_FragCoord.xy / czm_viewport.zw;
65
+ vec4 bgId = texture(tileIdTexture, id_st);
66
+ if (all(equal(bgId, tileId)) == false)
67
+ {
68
+ discard;
69
+ }
70
+
71
+ czm_materialInput materialInput;
72
+
73
+ vec2 st = v_st;
74
+ st.t = czm_readNonPerspective(st.t, gl_FragCoord.w);
75
+
76
+ materialInput.s = st.s;
77
+ materialInput.st = st;
78
+ materialInput.str = vec3(st, 0.0);
79
+
80
+ czm_material material = czm_getMaterial(materialInput);
81
+ out_FragColor = vec4(material.diffuse + material.emission, material.alpha);
82
+
83
+ czm_writeLogDepth();
84
+ }
85
+ `,material:new Cesium.Material({fabric:{source:`
86
+ const int maxArrayLength = 8;
87
+
88
+ in float v_width;
89
+ in vec4 v_color;
90
+ uniform float dashLength;
91
+ uniform float arrayLength;
92
+ uniform float dasharray[maxArrayLength];
93
+ in float v_polylineAngle;
94
+
95
+ mat2 rotate(float rad) {
96
+ float c = cos(rad);
97
+ float s = sin(rad);
98
+ return mat2(
99
+ c, s,
100
+ -s, c
101
+ );
102
+ }
103
+
104
+ czm_material czm_getMaterial(czm_materialInput materialInput)
105
+ {
106
+ czm_material material = czm_getDefaultMaterial(materialInput);
107
+
108
+ vec2 pos = rotate(v_polylineAngle) * gl_FragCoord.xy;
109
+
110
+ // Get the relative position within the dash from 0 to 1
111
+ float dashPosition = fract(pos.x / (v_width * dashLength * czm_pixelRatio));
112
+
113
+ float currDashPos = 0.;
114
+ for (int i = 0; i < maxArrayLength; i += 2) {
115
+ if(float(i) >= arrayLength) break;
116
+
117
+ float gapStart = currDashPos + dasharray[i] / dashLength;
118
+ float gapEnd = gapStart + dasharray[i + 1] / dashLength;
119
+
120
+ if(dashPosition > gapStart && dashPosition < gapEnd) {
121
+ discard;
122
+ break;
123
+ }
124
+
125
+ currDashPos = gapEnd;
126
+ }
127
+
128
+ vec4 fragColor = v_color;
129
+ fragColor = czm_gammaCorrect(fragColor);
130
+ material.emission = fragColor.rgb;
131
+ material.alpha = fragColor.a;
132
+ return material;
133
+ }
134
+ `}})})});let t=this;Object.defineProperties(e,{_geometries:{get(){return this._geometries_},set(r){this._geometries_=r,r?t.onGeometriesLoaded(r):t=null}},_batchTable:{get(){return this._batchTable_},set(r){this._batchTable_=r,r&&t.onBatchTableCreated(r)}}}),this.primitive=e}onGeometriesLoaded(e){for(let t=0;t<e.length;t++){const r={},i=e[t],s=i.attributes.batchId.values,o=i.indices;let a=-1,l=null;for(let u=0;u<o.length;u++){const c=o[u],f=s[c];a!==f&&(a=f,l=r[a]={begin:u,end:u}),l.end=u}for(const u of this.layers){const{firstBatchId:c,lastBatchId:f}=u;if(c===-1||f===-1)continue;let p=-1,d=-1;for(let h=c;h<=f;h++){const y=r[h];y&&(p===-1&&(p=y.begin),d=y.end)}p===-1||d===-1||(u.offsets[t]=p,u.counts[t]=d-p+1)}}}onBatchTableCreated(e){this._batchTable=e}createLayerCommands(e,t){const r=Cesium.RenderState.fromCache({id:"line",blending:Cesium.BlendingState.ALPHA_BLEND,depthMask:!1,depthTest:{enabled:!0},cull:{enabled:!0},colorMask:{red:!0,green:!0,blue:!0,alpha:!0}}),i=this.tile.tileId;function s(o,a){return o={...o},o.tileIdTexture=function(){return t.tileIdTexture},o.tileId=function(){return i.color},o.dasharray=function(){return a.dasharray},o.dashLength=function(){return a.dashLength},o.arrayLength=function(){return a.dasharray.length},o}for(let o=0;o<this.layers.length;o++){const a=this.layers[o],l=a.commandList=[];for(let u=0;u<e.length;u++){const c=a.offsets[u],f=a.counts[u];if(typeof c!="number"||typeof f!="number")continue;const p=e[u],d=Cesium.DrawCommand.shallowClone(p);d.pass=Cesium.Pass.CESIUM_3D_TILE,d.uniformMap=s(d.uniformMap,a),d.renderState=r,d.offset=c,d.count=f,l.push(d)}}this.state="done"}update(e,t){if(this.geometryInstances){if(super.update(e,t),!this.primitive&&this.geometryInstances.length&&this.createPrimitive(),this.primitive&&this.state!=="done"&&this.state!=="error"){const r=e.commandList,i=e.commandList=[];try{this.primitive.update(e)}catch(s){this.geometryInstances=[],this.state="error",s.stack?console.trace(s.stack):console.error(s);return}i.length>0&&this.createLayerCommands(i,t),e.commandList=r,this.geometryInstances=[]}this.primitive&&e.camera.pitch>-1.309&&O("line图层:不支持透视,建议保持相机俯仰角(pitch)小于 -75 度")}}destroy(){this.primitive=this.primitive&&this.primitive.destroy(),this._batchTable=null,this.geometryInstances=null,super.destroy()}isDestroyed(){return!1}}class yi extends We{constructor(e,t,r){super(e,t,r),this.primitive=null,this.dasharray=[],this.dashLength=0}createPrimitve(e,t){const r=new Cesium.PolylineCollection,i=this.sourceFeatures,s=this.style,o=this.tile;function a(l,u,c){if(l.length<2)return;const f=l.map(p=>Cesium.Cartesian3.fromDegrees(p[0],p[1]));r.add({positions:f,width:u,material:Cesium.Material.fromType("Color",{color:s.convertColor(c)})})}for(const l of i){const u=l.toGeoJSON(o.x,o.y,o.z);if(!u.geometry)continue;const c=s.paint.getDataValue("line-width",o.z,l),f=s.paint.getDataValue("line-color",o.z,l),p=u.geometry.type,d=u.geometry.coordinates;if(p=="LineString")a(d,c,f);else if(p=="MultiLineString"||p=="Polygon")for(const h of d)a(h,c,f);else if(p=="MultiPolygon")for(const h of d)for(const y of h)a(y,c,f);else console.log("暂不支持几何类型:"+p)}this.primitive=r}update(e,t){super.update(e,t)}destroy(){this.primitive=this.primitive&&this.primitive.destroy(),super.destroy()}}Qe("line",yi,ol);let Zn=null,mi=null;class al extends Vt{constructor(e,t){Zn===null&&(Zn=new Cesium.Cartesian3,mi=new Cesium.Cartesian3),super(e,t),this.labels=[],this.primitive=null,this.dotCutOff=.0035}isOccluded(e,t){const r=Cesium.Cartesian3.subtract(e,t,Zn);Cesium.Cartesian3.normalize(r,r);const i=Cesium.Cartesian3.normalize(t,mi);return Cesium.Cartesian3.dot(r,i)<this.dotCutOff}addLayer(e,t,r,i){const s=t.style,{tile:o,labels:a}=this,l=o.rectangle;function u(c,f,p,d,h,y,v){if(!Cesium.Rectangle.contains(l,Cesium.Cartographic.fromDegrees(c[0],c[1])))return;const b=new Cesium.Label({position:Cesium.Cartesian3.fromDegrees(c[0],c[1]),text:f,font:d+"px "+p,fillColor:h,style:y&&Cesium.LabelStyle.FILL_AND_OUTLINE,outlineWidth:y*d,outlineColor:v,disableDepthTestDistance:1/0});a.push(b),t.labels.push(b)}for(const c of e){const f=c.toGeoJSON(o.x,o.y,o.z);if(!f.geometry)continue;const p=c.properties,d=s.layout.getDataValue("icon-image",o.z,c),h=s.layout.getDataValue("text-field",o.z,c);let y=h&&s.layout.resolveTokens(p,h);if(d){O("symbol图层:不支持图标");continue}if(!y)continue;const v=s.layout.getDataValue("text-max-width",o.z,c)*3,b=s.layout.getDataValue("text-rotation-alignment",o.z,c),w=s.layout.getDataValue("text-pitch-alignment",o.z,c);y.length>v&&O("symbol图层: 不支持 text-max-width,无自动换行效果"),b==="map"&&O("symbol图层:text-rotation-alignment 仅支持 viewport"),w==="map"&&O("symbol图层:text-pitch-alignment 仅支持 viewport");const m=s.layout.getDataValue("text-font",o.z,c),x=s.layout.getDataValue("text-size",o.z,c),C=s.convertColor(s.paint.getDataValue("text-color",o.z,c)),M=s.convertColor(s.paint.getDataValue("text-halo-color",o.z,c)),k=s.paint.getDataValue("text-halo-width",o.z,c),_=f.geometry.type,P=f.geometry.coordinates;_=="Point"?u(P,y,m,x,C,k,M):_=="MultiPoint"?P.forEach(V=>{u(V,y,m,x,C,k,M)}):O("symbol图层:不支持符号沿线布局")}this.layers.push(t)}createPrimitive(){const e=new Cesium.LabelCollection;for(let t=0;t<this.labels.length;t++)this.labels[t]=e.add(this.labels[t]);this.primitive=e}update(e,t){!this.primitive&&this.labels?.length&&this.createPrimitive();const r=e.camera.positionWC;for(const i of this.labels)i.show=!this.isOccluded(r,i.position);this.primitive&&this.primitive.update(e)}destroy(){this.primitive=this.primitive&&this.primitive.destroy(),super.destroy()}isDestroyed(){return!1}}class gi extends We{constructor(e,t,r){super(e,t,r),this.labels=[]}update(e,t){super.update(e,t)}}Qe("symbol",gi,al),F.BackgroundRenderLayer=fi,F.FillRenderLayer=di,F.GeoJSONSource=ar,F.ILayerVisualizer=Vt,F.IRenderLayer=We,F.ISource=$t,F.LayerVisualizers=Gn,F.LineRenderLayer=yi,F.RenderLayers=jn,F.Sources=Bt,F.StyleLayer=Wr,F.StyleLayerProperties=Vn,F.SymbolRenderLayer=gi,F.VectorSource=Wn,F.VectorTileLOD=At,F.VectorTileRenderList=Qr,F.VectorTileset=nl,F.registerRenderLayer=Qe,F.registerSource=qt,Object.defineProperty(F,Symbol.toStringTag,{value:"Module"})}));
135
+ //# sourceMappingURL=cvt-gl.min.js.map