UNPKG

mapbox-gl

Version:
1 lines 360 kB
var mapboxgl=function(){"use strict";var t=e;function e(t,e,r,n){this.cx=3*t,this.bx=3*(r-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=n,this.p2x=r,this.p2y=n}e.prototype.sampleCurveX=function(t){return((this.ax*t+this.bx)*t+this.cx)*t},e.prototype.sampleCurveY=function(t){return((this.ay*t+this.by)*t+this.cy)*t},e.prototype.sampleCurveDerivativeX=function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},e.prototype.solveCurveX=function(t,e){var r,n,i,o,a;for(void 0===e&&(e=1e-6),i=t,a=0;a<8;a++){if(o=this.sampleCurveX(i)-t,Math.abs(o)<e)return i;var s=this.sampleCurveDerivativeX(i);if(Math.abs(s)<1e-6)break;i-=o/s}if((i=t)<(r=0))return r;if(i>(n=1))return n;for(;r<n;){if(o=this.sampleCurveX(i),Math.abs(o-t)<e)return i;t>o?r=i:n=i,i=.5*(n-r)+r}return i},e.prototype.solve=function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))};var r=n;function n(t,e){this.x=t,this.y=e}function i(t,e,r){return Math.min(r,Math.max(e,t))}function o(t){var e=[];for(var r in t)e.push(t[r]);return e}function a(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];for(var n=0,i=e;n<i.length;n+=1){var o=i[n];for(var a in o)t[a]=o[a]}return t}function s(){return function t(e){return e?(e^16*Math.random()>>e/4).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,t)}()}function u(t){return!!t&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(t)}function l(t,e){return-1!==t.indexOf(e,t.length-e.length)}function p(t,e,r){var n={};for(var i in t)n[i]=e.call(r||this,t[i],i,t);return n}function c(t){return Array.isArray(t)?t.map(c):"object"==typeof t&&t?p(t,c):t}n.prototype={clone:function(){return new n(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,r=t.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[0]*this.x+t[1]*this.y,r=t[2]*this.x+t[3]*this.y;return this.x=e,this.y=r,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),r=Math.sin(t),n=e*this.x-r*this.y,i=r*this.x+e*this.y;return this.x=n,this.y=i,this},_rotateAround:function(t,e){var r=Math.cos(t),n=Math.sin(t),i=e.x+r*(this.x-e.x)-n*(this.y-e.y),o=e.y+n*(this.x-e.x)+r*(this.y-e.y);return this.x=i,this.y=o,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},n.convert=function(t){return t instanceof n?t:Array.isArray(t)?new n(t[0],t[1]):t};var h={};function f(t){h[t]||("undefined"!=typeof console&&console.warn(t),h[t]=!0)}function y(t,e,r){return(r.y-t.y)*(e.x-t.x)>(e.y-t.y)*(r.x-t.x)}function d(t){for(var e=0,r=0,n=t.length,i=n-1,o=void 0,a=void 0;r<n;i=r++)o=t[r],e+=((a=t[i]).x-o.x)*(o.y+a.y);return e}function m(){return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope}function v(t){var e={};if(t.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(function(t,r,n,i){var o=n||i;return e[r]=!o||o.toLowerCase(),""})),e["max-age"]){var r=parseInt(e["max-age"],10);isNaN(r)?delete e["max-age"]:e["max-age"]=r}return e}var g=null;function x(t){if(null==g){var e=t.navigator?t.navigator.userAgent:null;g=!!t.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return g}function b(t){try{var e=self[t];return e.setItem("_mapbox_test_",1),e.removeItem("_mapbox_test_"),!0}catch(t){return!1}}var _=S,w=3;function S(t,e,r){var n=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;var i=new Int32Array(this.arrayBuffer);t=i[0],e=i[1],r=i[2],this.d=e+2*r;for(var o=0;o<this.d*this.d;o++){var a=i[w+o],s=i[w+o+1];n.push(a===s?null:i.subarray(a,s))}var u=i[w+n.length],l=i[w+n.length+1];this.keys=i.subarray(u,l),this.bboxes=i.subarray(l),this.insert=this._insertReadonly}else{this.d=e+2*r;for(var p=0;p<this.d*this.d;p++)n.push([]);this.keys=[],this.bboxes=[]}this.n=e,this.extent=t,this.padding=r,this.scale=e/t,this.uid=0;var c=r/e*t;this.min=-c,this.max=t+c}function k(t,e){return t(e={exports:{}},e.exports),e.exports}S.prototype.insert=function(t,e,r,n,i){this._forEachCell(e,r,n,i,this._insertCell,this.uid++),this.keys.push(t),this.bboxes.push(e),this.bboxes.push(r),this.bboxes.push(n),this.bboxes.push(i)},S.prototype._insertReadonly=function(){throw"Cannot insert into a GridIndex created from an ArrayBuffer."},S.prototype._insertCell=function(t,e,r,n,i,o){this.cells[i].push(o)},S.prototype.query=function(t,e,r,n,i){var o=this.min,a=this.max;if(t<=o&&e<=o&&a<=r&&a<=n&&!i)return Array.prototype.slice.call(this.keys);var s=[];return this._forEachCell(t,e,r,n,this._queryCell,s,{},i),s},S.prototype._queryCell=function(t,e,r,n,i,o,a,s){var u=this.cells[i];if(null!==u)for(var l=this.keys,p=this.bboxes,c=0;c<u.length;c++){var h=u[c];if(void 0===a[h]){var f=4*h;(s?s(p[f+0],p[f+1],p[f+2],p[f+3]):t<=p[f+2]&&e<=p[f+3]&&r>=p[f+0]&&n>=p[f+1])?(a[h]=!0,o.push(l[h])):a[h]=!1}}},S.prototype._forEachCell=function(t,e,r,n,i,o,a,s){for(var u=this._convertToCellCoord(t),l=this._convertToCellCoord(e),p=this._convertToCellCoord(r),c=this._convertToCellCoord(n),h=u;h<=p;h++)for(var f=l;f<=c;f++){var y=this.d*f+h;if((!s||s(this._convertFromCellCoord(h),this._convertFromCellCoord(f),this._convertFromCellCoord(h+1),this._convertFromCellCoord(f+1)))&&i.call(this,t,e,r,n,y,o,a,s))return}},S.prototype._convertFromCellCoord=function(t){return(t-this.padding)/this.scale},S.prototype._convertToCellCoord=function(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))},S.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var t=this.cells,e=w+this.cells.length+1+1,r=0,n=0;n<this.cells.length;n++)r+=this.cells[n].length;var i=new Int32Array(e+r+this.keys.length+this.bboxes.length);i[0]=this.extent,i[1]=this.n,i[2]=this.padding;for(var o=e,a=0;a<t.length;a++){var s=t[a];i[w+a]=o,i.set(s,o),o+=s.length}return i[w+t.length]=o,i.set(this.keys,o),o+=this.keys.length,i[w+t.length+1]=o,i.set(this.bboxes,o),o+=this.bboxes.length,i.buffer};var A=k((function(t,e){var r={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function n(t){return(t=Math.round(t))<0?0:t>255?255:t}function i(t){return t<0?0:t>1?1:t}function o(t){return"%"===t[t.length-1]?n(parseFloat(t)/100*255):n(parseInt(t))}function a(t){return"%"===t[t.length-1]?i(parseFloat(t)/100):i(parseFloat(t))}function s(t,e,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?t+(e-t)*r*6:2*r<1?e:3*r<2?t+(e-t)*(2/3-r)*6:t}try{e.parseCSSColor=function(t){var e,i=t.replace(/ /g,"").toLowerCase();if(i in r)return r[i].slice();if("#"===i[0])return 4===i.length?(e=parseInt(i.substr(1),16))>=0&&e<=4095?[(3840&e)>>4|(3840&e)>>8,240&e|(240&e)>>4,15&e|(15&e)<<4,1]:null:7===i.length&&(e=parseInt(i.substr(1),16))>=0&&e<=16777215?[(16711680&e)>>16,(65280&e)>>8,255&e,1]:null;var u=i.indexOf("("),l=i.indexOf(")");if(-1!==u&&l+1===i.length){var p=i.substr(0,u),c=i.substr(u+1,l-(u+1)).split(","),h=1;switch(p){case"rgba":if(4!==c.length)return null;h=a(c.pop());case"rgb":return 3!==c.length?null:[o(c[0]),o(c[1]),o(c[2]),h];case"hsla":if(4!==c.length)return null;h=a(c.pop());case"hsl":if(3!==c.length)return null;var f=(parseFloat(c[0])%360+360)%360/360,y=a(c[1]),d=a(c[2]),m=d<=.5?d*(y+1):d+y-d*y,v=2*d-m;return[n(255*s(v,m,f+1/3)),n(255*s(v,m,f)),n(255*s(v,m,f-1/3)),h];default:return null}}return null}}catch(t){}})).parseCSSColor,I=function(t,e,r,n){void 0===n&&(n=1),this.r=t,this.g=e,this.b=r,this.a=n};function z(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];for(var n=0,i=e;n<i.length;n+=1){var o=i[n];for(var a in o)t[a]=o[a]}return t}I.parse=function(t){if(t){if(t instanceof I)return t;if("string"==typeof t){var e=A(t);if(e)return new I(e[0]/255*e[3],e[1]/255*e[3],e[2]/255*e[3],e[3])}}},I.prototype.toString=function(){var t=this.toArray(),e=t[0],r=t[1],n=t[2],i=t[3];return"rgba("+Math.round(e)+","+Math.round(r)+","+Math.round(n)+","+i+")"},I.prototype.toArray=function(){var t=this.r,e=this.g,r=this.b,n=this.a;return 0===n?[0,0,0,0]:[255*t/n,255*e/n,255*r/n,n]},I.black=new I(0,0,0,1),I.white=new I(1,1,1,1),I.transparent=new I(0,0,0,0),I.red=new I(1,0,0,1);var M=function(t){function e(e,r){t.call(this,r),this.message=r,this.key=e}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Error),C=function(t,e){void 0===e&&(e=[]),this.parent=t,this.bindings={};for(var r=0,n=e;r<n.length;r+=1){var i=n[r],o=i[0],a=i[1];this.bindings[o]=a}};C.prototype.concat=function(t){return new C(this,t)},C.prototype.get=function(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error(t+" not found in scope.")},C.prototype.has=function(t){return!!this.bindings[t]||!!this.parent&&this.parent.has(t)};var P={kind:"null"},B={kind:"number"},V={kind:"string"},T={kind:"boolean"},E={kind:"color"},O={kind:"object"},F={kind:"value"},L={kind:"collator"},D={kind:"formatted"},j={kind:"resolvedImage"};function U(t,e){return{kind:"array",itemType:t,N:e}}function q(t){if("array"===t.kind){var e=q(t.itemType);return"number"==typeof t.N?"array<"+e+", "+t.N+">":"value"===t.itemType.kind?"array":"array<"+e+">"}return t.kind}var R=[P,B,V,T,E,D,O,U(F),j];function N(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!N(t.itemType,e.itemType))&&("number"!=typeof t.N||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if("value"===t.kind)for(var r=0,n=R;r<n.length;r+=1){if(!N(n[r],e))return null}}return"Expected "+q(t)+" but found "+q(e)+" instead."}var Z=function(t,e,r){this.sensitivity=t?e?"variant":"case":e?"accent":"base",this.locale=r,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})};Z.prototype.compare=function(t,e){return this.collator.compare(t,e)},Z.prototype.resolvedLocale=function(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale};var J={"Latin-1 Supplement":function(t){return t>=128&&t<=255},Arabic:function(t){return t>=1536&&t<=1791},"Arabic Supplement":function(t){return t>=1872&&t<=1919},"Arabic Extended-A":function(t){return t>=2208&&t<=2303},"Hangul Jamo":function(t){return t>=4352&&t<=4607},"Unified Canadian Aboriginal Syllabics":function(t){return t>=5120&&t<=5759},Khmer:function(t){return t>=6016&&t<=6143},"Unified Canadian Aboriginal Syllabics Extended":function(t){return t>=6320&&t<=6399},"General Punctuation":function(t){return t>=8192&&t<=8303},"Letterlike Symbols":function(t){return t>=8448&&t<=8527},"Number Forms":function(t){return t>=8528&&t<=8591},"Miscellaneous Technical":function(t){return t>=8960&&t<=9215},"Control Pictures":function(t){return t>=9216&&t<=9279},"Optical Character Recognition":function(t){return t>=9280&&t<=9311},"Enclosed Alphanumerics":function(t){return t>=9312&&t<=9471},"Geometric Shapes":function(t){return t>=9632&&t<=9727},"Miscellaneous Symbols":function(t){return t>=9728&&t<=9983},"Miscellaneous Symbols and Arrows":function(t){return t>=11008&&t<=11263},"CJK Radicals Supplement":function(t){return t>=11904&&t<=12031},"Kangxi Radicals":function(t){return t>=12032&&t<=12255},"Ideographic Description Characters":function(t){return t>=12272&&t<=12287},"CJK Symbols and Punctuation":function(t){return t>=12288&&t<=12351},Hiragana:function(t){return t>=12352&&t<=12447},Katakana:function(t){return t>=12448&&t<=12543},Bopomofo:function(t){return t>=12544&&t<=12591},"Hangul Compatibility Jamo":function(t){return t>=12592&&t<=12687},Kanbun:function(t){return t>=12688&&t<=12703},"Bopomofo Extended":function(t){return t>=12704&&t<=12735},"CJK Strokes":function(t){return t>=12736&&t<=12783},"Katakana Phonetic Extensions":function(t){return t>=12784&&t<=12799},"Enclosed CJK Letters and Months":function(t){return t>=12800&&t<=13055},"CJK Compatibility":function(t){return t>=13056&&t<=13311},"CJK Unified Ideographs Extension A":function(t){return t>=13312&&t<=19903},"Yijing Hexagram Symbols":function(t){return t>=19904&&t<=19967},"CJK Unified Ideographs":function(t){return t>=19968&&t<=40959},"Yi Syllables":function(t){return t>=40960&&t<=42127},"Yi Radicals":function(t){return t>=42128&&t<=42191},"Hangul Jamo Extended-A":function(t){return t>=43360&&t<=43391},"Hangul Syllables":function(t){return t>=44032&&t<=55215},"Hangul Jamo Extended-B":function(t){return t>=55216&&t<=55295},"Private Use Area":function(t){return t>=57344&&t<=63743},"CJK Compatibility Ideographs":function(t){return t>=63744&&t<=64255},"Arabic Presentation Forms-A":function(t){return t>=64336&&t<=65023},"Vertical Forms":function(t){return t>=65040&&t<=65055},"CJK Compatibility Forms":function(t){return t>=65072&&t<=65103},"Small Form Variants":function(t){return t>=65104&&t<=65135},"Arabic Presentation Forms-B":function(t){return t>=65136&&t<=65279},"Halfwidth and Fullwidth Forms":function(t){return t>=65280&&t<=65519}};function X(t){for(var e=0,r=t;e<r.length;e+=1){if(Y(r[e].charCodeAt(0)))return!0}return!1}function K(t){return!J.Arabic(t)&&(!J["Arabic Supplement"](t)&&(!J["Arabic Extended-A"](t)&&(!J["Arabic Presentation Forms-A"](t)&&!J["Arabic Presentation Forms-B"](t))))}function Y(t){return 746===t||747===t||!(t<4352)&&(!!J["Bopomofo Extended"](t)||(!!J.Bopomofo(t)||(!(!J["CJK Compatibility Forms"](t)||t>=65097&&t<=65103)||(!!J["CJK Compatibility Ideographs"](t)||(!!J["CJK Compatibility"](t)||(!!J["CJK Radicals Supplement"](t)||(!!J["CJK Strokes"](t)||(!(!J["CJK Symbols and Punctuation"](t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||(!!J["CJK Unified Ideographs Extension A"](t)||(!!J["CJK Unified Ideographs"](t)||(!!J["Enclosed CJK Letters and Months"](t)||(!!J["Hangul Compatibility Jamo"](t)||(!!J["Hangul Jamo Extended-A"](t)||(!!J["Hangul Jamo Extended-B"](t)||(!!J["Hangul Jamo"](t)||(!!J["Hangul Syllables"](t)||(!!J.Hiragana(t)||(!!J["Ideographic Description Characters"](t)||(!!J.Kanbun(t)||(!!J["Kangxi Radicals"](t)||(!!J["Katakana Phonetic Extensions"](t)||(!(!J.Katakana(t)||12540===t)||(!(!J["Halfwidth and Fullwidth Forms"](t)||65288===t||65289===t||65293===t||t>=65306&&t<=65310||65339===t||65341===t||65343===t||t>=65371&&t<=65503||65507===t||t>=65512&&t<=65519)||(!(!J["Small Form Variants"](t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||(!!J["Unified Canadian Aboriginal Syllabics"](t)||(!!J["Unified Canadian Aboriginal Syllabics Extended"](t)||(!!J["Vertical Forms"](t)||(!!J["Yijing Hexagram Symbols"](t)||(!!J["Yi Syllables"](t)||!!J["Yi Radicals"](t))))))))))))))))))))))))))))))}function G(t){return!(Y(t)||function(t){return!(!J["Latin-1 Supplement"](t)||167!==t&&169!==t&&174!==t&&177!==t&&188!==t&&189!==t&&190!==t&&215!==t&&247!==t)||(!(!J["General Punctuation"](t)||8214!==t&&8224!==t&&8225!==t&&8240!==t&&8241!==t&&8251!==t&&8252!==t&&8258!==t&&8263!==t&&8264!==t&&8265!==t&&8273!==t)||(!!J["Letterlike Symbols"](t)||(!!J["Number Forms"](t)||(!(!J["Miscellaneous Technical"](t)||!(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||9003===t||t>=9085&&t<=9114||t>=9150&&t<=9165||9167===t||t>=9169&&t<=9179||t>=9186&&t<=9215))||(!(!J["Control Pictures"](t)||9251===t)||(!!J["Optical Character Recognition"](t)||(!!J["Enclosed Alphanumerics"](t)||(!!J["Geometric Shapes"](t)||(!(!J["Miscellaneous Symbols"](t)||t>=9754&&t<=9759)||(!(!J["Miscellaneous Symbols and Arrows"](t)||!(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243))||(!!J["CJK Symbols and Punctuation"](t)||(!!J.Katakana(t)||(!!J["Private Use Area"](t)||(!!J["CJK Compatibility Forms"](t)||(!!J["Small Form Variants"](t)||(!!J["Halfwidth and Fullwidth Forms"](t)||(8734===t||8756===t||8757===t||t>=9984&&t<=10087||t>=10102&&t<=10131||65532===t||65533===t)))))))))))))))))}(t))}function H(t){return t>=1424&&t<=2303||J["Arabic Presentation Forms-A"](t)||J["Arabic Presentation Forms-B"](t)}function W(t,e){return!(!e&&H(t))&&!(t>=2304&&t<=3583||t>=3840&&t<=4255||J.Khmer(t))}function $(t){for(var e=0,r=t;e<r.length;e+=1){if(H(r[e].charCodeAt(0)))return!0}return!1}var Q=function(t,e,r,n,i){this.text=t,this.image=e,this.scale=r,this.fontStack=n,this.textColor=i},tt=function(t){this.sections=t};tt.fromString=function(t){return new tt([new Q(t,null,null,null,null)])},tt.prototype.isEmpty=function(){return 0===this.sections.length||!this.sections.some((function(t){return 0!==t.text.length||t.image&&0!==t.image.name.length}))},tt.factory=function(t){return t instanceof tt?t:tt.fromString(t)},tt.prototype.toString=function(){return 0===this.sections.length?"":this.sections.map((function(t){return t.text})).join("")},tt.prototype.containsRTLText=function(){for(var t=0,e=this.sections;t<e.length;t+=1){if($(e[t].text))return!0}return!1},tt.prototype.serialize=function(){for(var t=["format"],e=0,r=this.sections;e<r.length;e+=1){var n=r[e];if(n.image)t.push(["image",n.image.name]);else{t.push(n.text);var i={};n.fontStack&&(i["text-font"]=["literal",n.fontStack.split(",")]),n.scale&&(i["font-scale"]=n.scale),n.textColor&&(i["text-color"]=["rgba"].concat(n.textColor.toArray())),t.push(i)}}return t};var et=function(t){this.name=t.name,this.available=t.available};function rt(t,e,r,n){return"number"==typeof t&&t>=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof r&&r>=0&&r<=255?void 0===n||"number"==typeof n&&n>=0&&n<=1?null:"Invalid rgba value ["+[t,e,r,n].join(", ")+"]: 'a' must be between 0 and 1.":"Invalid rgba value ["+("number"==typeof n?[t,e,r,n]:[t,e,r]).join(", ")+"]: 'r', 'g', and 'b' must be between 0 and 255."}function nt(t){if(null===t)return P;if("string"==typeof t)return V;if("boolean"==typeof t)return T;if("number"==typeof t)return B;if(t instanceof I)return E;if(t instanceof Z)return L;if(t instanceof tt)return D;if(t instanceof et)return j;if(Array.isArray(t)){for(var e,r=t.length,n=0,i=t;n<i.length;n+=1){var o=nt(i[n]);if(e){if(e===o)continue;e=F;break}e=o}return U(e||F,r)}return O}function it(t){var e=typeof t;return null===t?"":"string"===e||"number"===e||"boolean"===e?String(t):t instanceof I||t instanceof tt||t instanceof et?t.toString():JSON.stringify(t)}et.prototype.toString=function(){return this.name},et.fromString=function(t){return new et({name:t,available:!1})},et.prototype.serialize=function(){return["image",this.name]};var ot=function(t,e){this.type=t,this.value=e};ot.parse=function(t,e){if(2!==t.length)return e.error("'literal' expression requires exactly one argument, but found "+(t.length-1)+" instead.");if(!function t(e){if(null===e)return!0;if("string"==typeof e)return!0;if("boolean"==typeof e)return!0;if("number"==typeof e)return!0;if(e instanceof I)return!0;if(e instanceof Z)return!0;if(e instanceof tt)return!0;if(e instanceof et)return!0;if(Array.isArray(e)){for(var r=0,n=e;r<n.length;r+=1){if(!t(n[r]))return!1}return!0}if("object"==typeof e){for(var i in e)if(!t(e[i]))return!1;return!0}return!1}(t[1]))return e.error("invalid value");var r=t[1],n=nt(r),i=e.expectedType;return"array"!==n.kind||0!==n.N||!i||"array"!==i.kind||"number"==typeof i.N&&0!==i.N||(n=i),new ot(n,r)},ot.prototype.evaluate=function(){return this.value},ot.prototype.eachChild=function(){},ot.prototype.possibleOutputs=function(){return[this.value]},ot.prototype.serialize=function(){return"array"===this.type.kind||"object"===this.type.kind?["literal",this.value]:this.value instanceof I?["rgba"].concat(this.value.toArray()):this.value instanceof tt?this.value.serialize():this.value};var at=function(t){this.name="ExpressionEvaluationError",this.message=t};at.prototype.toJSON=function(){return this.message};var st={string:V,number:B,boolean:T,object:O},ut=function(t,e){this.type=t,this.args=e};ut.parse=function(t,e){if(t.length<2)return e.error("Expected at least one argument.");var r,n=1,i=t[0];if("array"===i){var o,a;if(t.length>2){var s=t[1];if("string"!=typeof s||!(s in st)||"object"===s)return e.error('The item type argument of "array" must be one of string, number, boolean',1);o=st[s],n++}else o=F;if(t.length>3){if(null!==t[2]&&("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return e.error('The length argument to "array" must be a positive integer literal',2);a=t[2],n++}r=U(o,a)}else r=st[i];for(var u=[];n<t.length;n++){var l=e.parse(t[n],n,F);if(!l)return null;u.push(l)}return new ut(r,u)},ut.prototype.evaluate=function(t){for(var e=0;e<this.args.length;e++){var r=this.args[e].evaluate(t);if(!N(this.type,nt(r)))return r;if(e===this.args.length-1)throw new at("Expected value to be of type "+q(this.type)+", but found "+q(nt(r))+" instead.")}return null},ut.prototype.eachChild=function(t){this.args.forEach(t)},ut.prototype.possibleOutputs=function(){var t;return(t=[]).concat.apply(t,this.args.map((function(t){return t.possibleOutputs()})))},ut.prototype.serialize=function(){var t=this.type,e=[t.kind];if("array"===t.kind){var r=t.itemType;if("string"===r.kind||"number"===r.kind||"boolean"===r.kind){e.push(r.kind);var n=t.N;("number"==typeof n||this.args.length>1)&&e.push(n)}}return e.concat(this.args.map((function(t){return t.serialize()})))};var lt=function(t){this.type=D,this.sections=t};lt.parse=function(t,e){if(t.length<2)return e.error("Expected at least one argument.");var r=t[1];if(!Array.isArray(r)&&"object"==typeof r)return e.error("First argument must be an image or text section.");for(var n=[],i=!1,o=1;o<=t.length-1;++o){var a=t[o];if(i&&"object"==typeof a&&!Array.isArray(a)){i=!1;var s=null;if(a["font-scale"]&&!(s=e.parse(a["font-scale"],1,B)))return null;var u=null;if(a["text-font"]&&!(u=e.parse(a["text-font"],1,U(V))))return null;var l=null;if(a["text-color"]&&!(l=e.parse(a["text-color"],1,E)))return null;var p=n[n.length-1];p.scale=s,p.font=u,p.textColor=l}else{var c=e.parse(t[o],1,F);if(!c)return null;var h=c.type.kind;if("string"!==h&&"value"!==h&&"null"!==h&&"resolvedImage"!==h)return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");i=!0,n.push({content:c,scale:null,font:null,textColor:null})}}return new lt(n)},lt.prototype.evaluate=function(t){return new tt(this.sections.map((function(e){var r=e.content.evaluate(t);return nt(r)===j?new Q("",r,null,null,null):new Q(it(r),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.evaluate(t):null)})))},lt.prototype.eachChild=function(t){for(var e=0,r=this.sections;e<r.length;e+=1){var n=r[e];t(n.content),n.scale&&t(n.scale),n.font&&t(n.font),n.textColor&&t(n.textColor)}},lt.prototype.possibleOutputs=function(){return[void 0]},lt.prototype.serialize=function(){for(var t=["format"],e=0,r=this.sections;e<r.length;e+=1){var n=r[e];t.push(n.content.serialize());var i={};n.scale&&(i["font-scale"]=n.scale.serialize()),n.font&&(i["text-font"]=n.font.serialize()),n.textColor&&(i["text-color"]=n.textColor.serialize()),t.push(i)}return t};var pt=function(t){this.type=j,this.input=t};pt.parse=function(t,e){if(2!==t.length)return e.error("Expected two arguments.");var r=e.parse(t[1],1,V);return r?new pt(r):e.error("No image name provided.")},pt.prototype.evaluate=function(t){var e=this.input.evaluate(t),r=!1;return t.availableImages&&t.availableImages.indexOf(e)>-1&&(r=!0),new et({name:e,available:r})},pt.prototype.eachChild=function(t){t(this.input)},pt.prototype.possibleOutputs=function(){return[void 0]},pt.prototype.serialize=function(){return["image",this.input.serialize()]};var ct={"to-boolean":T,"to-color":E,"to-number":B,"to-string":V},ht=function(t,e){this.type=t,this.args=e};ht.parse=function(t,e){if(t.length<2)return e.error("Expected at least one argument.");var r=t[0];if(("to-boolean"===r||"to-string"===r)&&2!==t.length)return e.error("Expected one argument.");for(var n=ct[r],i=[],o=1;o<t.length;o++){var a=e.parse(t[o],o,F);if(!a)return null;i.push(a)}return new ht(n,i)},ht.prototype.evaluate=function(t){if("boolean"===this.type.kind)return Boolean(this.args[0].evaluate(t));if("color"===this.type.kind){for(var e,r,n=0,i=this.args;n<i.length;n+=1){if(r=null,(e=i[n].evaluate(t))instanceof I)return e;if("string"==typeof e){var o=t.parseColor(e);if(o)return o}else if(Array.isArray(e)&&!(r=e.length<3||e.length>4?"Invalid rbga value "+JSON.stringify(e)+": expected an array containing either three or four numeric values.":rt(e[0],e[1],e[2],e[3])))return new I(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new at(r||"Could not parse color from value '"+("string"==typeof e?e:String(JSON.stringify(e)))+"'")}if("number"===this.type.kind){for(var a=null,s=0,u=this.args;s<u.length;s+=1){if(null===(a=u[s].evaluate(t)))return 0;var l=Number(a);if(!isNaN(l))return l}throw new at("Could not convert "+JSON.stringify(a)+" to number.")}return"formatted"===this.type.kind?tt.fromString(it(this.args[0].evaluate(t))):"resolvedImage"===this.type.kind?et.fromString(it(this.args[0].evaluate(t))):it(this.args[0].evaluate(t))},ht.prototype.eachChild=function(t){this.args.forEach(t)},ht.prototype.possibleOutputs=function(){var t;return(t=[]).concat.apply(t,this.args.map((function(t){return t.possibleOutputs()})))},ht.prototype.serialize=function(){if("formatted"===this.type.kind)return new lt([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if("resolvedImage"===this.type.kind)return new pt(this.args[0]).serialize();var t=["to-"+this.type.kind];return this.eachChild((function(e){t.push(e.serialize())})),t};var ft=["Unknown","Point","LineString","Polygon"],yt=function(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null};yt.prototype.id=function(){return this.feature&&"id"in this.feature?this.feature.id:null},yt.prototype.geometryType=function(){return this.feature?"number"==typeof this.feature.type?ft[this.feature.type]:this.feature.type:null},yt.prototype.properties=function(){return this.feature&&this.feature.properties||{}},yt.prototype.parseColor=function(t){var e=this._parseColorCache[t];return e||(e=this._parseColorCache[t]=I.parse(t)),e};var dt=function(t,e,r,n){this.name=t,this.type=e,this._evaluate=r,this.args=n};dt.prototype.evaluate=function(t){return this._evaluate(t,this.args)},dt.prototype.eachChild=function(t){this.args.forEach(t)},dt.prototype.possibleOutputs=function(){return[void 0]},dt.prototype.serialize=function(){return[this.name].concat(this.args.map((function(t){return t.serialize()})))},dt.parse=function(t,e){var r,n=t[0],i=dt.definitions[n];if(!i)return e.error('Unknown expression "'+n+'". If you wanted a literal array, use ["literal", [...]].',0);for(var o=Array.isArray(i)?i[0]:i.type,a=Array.isArray(i)?[[i[1],i[2]]]:i.overloads,s=a.filter((function(e){var r=e[0];return!Array.isArray(r)||r.length===t.length-1})),u=null,l=0,p=s;l<p.length;l+=1){var c=p[l],h=c[0],f=c[1];u=new _t(e.registry,e.path,null,e.scope);for(var y=[],d=!1,m=1;m<t.length;m++){var v=t[m],g=Array.isArray(h)?h[m-1]:h.type,x=u.parse(v,1+y.length,g);if(!x){d=!0;break}y.push(x)}if(!d)if(Array.isArray(h)&&h.length!==y.length)u.error("Expected "+h.length+" arguments, but found "+y.length+" instead.");else{for(var b=0;b<y.length;b++){var _=Array.isArray(h)?h[b]:h.type,w=y[b];u.concat(b+1).checkSubtype(_,w.type)}if(0===u.errors.length)return new dt(n,o,f,y)}}if(1===s.length)(r=e.errors).push.apply(r,u.errors);else{for(var S=(s.length?s:a).map((function(t){var e,r=t[0];return e=r,Array.isArray(e)?"("+e.map(q).join(", ")+")":"("+q(e.type)+"...)"})).join(" | "),k=[],A=1;A<t.length;A++){var I=e.parse(t[A],1+k.length);if(!I)return null;k.push(q(I.type))}e.error("Expected arguments of type "+S+", but found ("+k.join(", ")+") instead.")}return null},dt.register=function(t,e){for(var r in dt.definitions=e,e)t[r]=dt};var mt=function(t,e,r){this.type=L,this.locale=r,this.caseSensitive=t,this.diacriticSensitive=e};function vt(t){if(t instanceof dt){if("get"===t.name&&1===t.args.length)return!1;if("feature-state"===t.name)return!1;if("has"===t.name&&1===t.args.length)return!1;if("properties"===t.name||"geometry-type"===t.name||"id"===t.name)return!1;if(/^filter-/.test(t.name))return!1}var e=!0;return t.eachChild((function(t){e&&!vt(t)&&(e=!1)})),e}function gt(t){if(t instanceof dt&&"feature-state"===t.name)return!1;var e=!0;return t.eachChild((function(t){e&&!gt(t)&&(e=!1)})),e}function xt(t,e){if(t instanceof dt&&e.indexOf(t.name)>=0)return!1;var r=!0;return t.eachChild((function(t){r&&!xt(t,e)&&(r=!1)})),r}mt.parse=function(t,e){if(2!==t.length)return e.error("Expected one argument.");var r=t[1];if("object"!=typeof r||Array.isArray(r))return e.error("Collator options argument must be an object.");var n=e.parse(void 0!==r["case-sensitive"]&&r["case-sensitive"],1,T);if(!n)return null;var i=e.parse(void 0!==r["diacritic-sensitive"]&&r["diacritic-sensitive"],1,T);if(!i)return null;var o=null;return r.locale&&!(o=e.parse(r.locale,1,V))?null:new mt(n,i,o)},mt.prototype.evaluate=function(t){return new Z(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)},mt.prototype.eachChild=function(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)},mt.prototype.possibleOutputs=function(){return[void 0]},mt.prototype.serialize=function(){var t={};return t["case-sensitive"]=this.caseSensitive.serialize(),t["diacritic-sensitive"]=this.diacriticSensitive.serialize(),this.locale&&(t.locale=this.locale.serialize()),["collator",t]};var bt=function(t,e){this.type=e.type,this.name=t,this.boundExpression=e};bt.parse=function(t,e){if(2!==t.length||"string"!=typeof t[1])return e.error("'var' expression requires exactly one string literal argument.");var r=t[1];return e.scope.has(r)?new bt(r,e.scope.get(r)):e.error('Unknown variable "'+r+'". Make sure "'+r+'" has been bound in an enclosing "let" expression before using it.',1)},bt.prototype.evaluate=function(t){return this.boundExpression.evaluate(t)},bt.prototype.eachChild=function(){},bt.prototype.possibleOutputs=function(){return[void 0]},bt.prototype.serialize=function(){return["var",this.name]};var _t=function(t,e,r,n,i){void 0===e&&(e=[]),void 0===n&&(n=new C),void 0===i&&(i=[]),this.registry=t,this.path=e,this.key=e.map((function(t){return"["+t+"]"})).join(""),this.scope=n,this.errors=i,this.expectedType=r};function wt(t,e){for(var r,n,i=t.length-1,o=0,a=i,s=0;o<=a;)if(r=t[s=Math.floor((o+a)/2)],n=t[s+1],r<=e){if(s===i||e<n)return s;o=s+1}else{if(!(r>e))throw new at("Input is not a number.");a=s-1}return 0}_t.prototype.parse=function(t,e,r,n,i){return void 0===i&&(i={}),e?this.concat(e,r,n)._parse(t,i):this._parse(t,i)},_t.prototype._parse=function(t,e){function r(t,e,r){return"assert"===r?new ut(e,[t]):"coerce"===r?new ht(e,[t]):t}if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&"number"!=typeof t||(t=["literal",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');var n=t[0];if("string"!=typeof n)return this.error("Expression name must be a string, but found "+typeof n+' instead. If you wanted a literal array, use ["literal", [...]].',0),null;var i=this.registry[n];if(i){var o=i.parse(t,this);if(!o)return null;if(this.expectedType){var a=this.expectedType,s=o.type;if("string"!==a.kind&&"number"!==a.kind&&"boolean"!==a.kind&&"object"!==a.kind&&"array"!==a.kind||"value"!==s.kind)if("color"!==a.kind&&"formatted"!==a.kind&&"resolvedImage"!==a.kind||"value"!==s.kind&&"string"!==s.kind){if(this.checkSubtype(a,s))return null}else o=r(o,a,e.typeAnnotation||"coerce");else o=r(o,a,e.typeAnnotation||"assert")}if(!(o instanceof ot)&&"resolvedImage"!==o.type.kind&&function t(e){if(e instanceof bt)return t(e.boundExpression);if(e instanceof dt&&"error"===e.name)return!1;if(e instanceof mt)return!1;var r=e instanceof ht||e instanceof ut;var n=!0;e.eachChild((function(e){n=r?n&&t(e):n&&e instanceof ot}));if(!n)return!1;return vt(e)&&xt(e,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}(o)){var u=new yt;try{o=new ot(o.type,o.evaluate(u))}catch(t){return this.error(t.message),null}}return o}return this.error('Unknown expression "'+n+'". If you wanted a literal array, use ["literal", [...]].',0)}return void 0===t?this.error("'undefined' value invalid. Use null instead."):"object"==typeof t?this.error('Bare objects invalid. Use ["literal", {...}] instead.'):this.error("Expected an array, but found "+typeof t+" instead.")},_t.prototype.concat=function(t,e,r){var n="number"==typeof t?this.path.concat(t):this.path,i=r?this.scope.concat(r):this.scope;return new _t(this.registry,n,e||null,i,this.errors)},_t.prototype.error=function(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];var n=""+this.key+e.map((function(t){return"["+t+"]"})).join("");this.errors.push(new M(n,t))},_t.prototype.checkSubtype=function(t,e){var r=N(t,e);return r&&this.error(r),r};var St=function(t,e,r){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(var n=0,i=r;n<i.length;n+=1){var o=i[n],a=o[0],s=o[1];this.labels.push(a),this.outputs.push(s)}};function kt(t,e,r){return t*(1-r)+e*r}St.parse=function(t,e){if(t.length-1<4)return e.error("Expected at least 4 arguments, but found only "+(t.length-1)+".");if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");var r=e.parse(t[1],1,B);if(!r)return null;var n=[],i=null;e.expectedType&&"value"!==e.expectedType.kind&&(i=e.expectedType);for(var o=1;o<t.length;o+=2){var a=1===o?-1/0:t[o],s=t[o+1],u=o,l=o+1;if("number"!=typeof a)return e.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',u);if(n.length&&n[n.length-1][0]>=a)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',u);var p=e.parse(s,l,i);if(!p)return null;i=i||p.type,n.push([a,p])}return new St(i,r,n)},St.prototype.evaluate=function(t){var e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);var n=this.input.evaluate(t);if(n<=e[0])return r[0].evaluate(t);var i=e.length;return n>=e[i-1]?r[i-1].evaluate(t):r[wt(e,n)].evaluate(t)},St.prototype.eachChild=function(t){t(this.input);for(var e=0,r=this.outputs;e<r.length;e+=1){t(r[e])}},St.prototype.possibleOutputs=function(){var t;return(t=[]).concat.apply(t,this.outputs.map((function(t){return t.possibleOutputs()})))},St.prototype.serialize=function(){for(var t=["step",this.input.serialize()],e=0;e<this.labels.length;e++)e>0&&t.push(this.labels[e]),t.push(this.outputs[e].serialize());return t};var At=Object.freeze({__proto__:null,number:kt,color:function(t,e,r){return new I(kt(t.r,e.r,r),kt(t.g,e.g,r),kt(t.b,e.b,r),kt(t.a,e.a,r))},array:function(t,e,r){return t.map((function(t,n){return kt(t,e[n],r)}))}}),It=.95047,zt=1,Mt=1.08883,Ct=4/29,Pt=6/29,Bt=3*Pt*Pt,Vt=Pt*Pt*Pt,Tt=Math.PI/180,Et=180/Math.PI;function Ot(t){return t>Vt?Math.pow(t,1/3):t/Bt+Ct}function Ft(t){return t>Pt?t*t*t:Bt*(t-Ct)}function Lt(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function Dt(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function jt(t){var e=Dt(t.r),r=Dt(t.g),n=Dt(t.b),i=Ot((.4124564*e+.3575761*r+.1804375*n)/It),o=Ot((.2126729*e+.7151522*r+.072175*n)/zt);return{l:116*o-16,a:500*(i-o),b:200*(o-Ot((.0193339*e+.119192*r+.9503041*n)/Mt)),alpha:t.a}}function Ut(t){var e=(t.l+16)/116,r=isNaN(t.a)?e:e+t.a/500,n=isNaN(t.b)?e:e-t.b/200;return e=zt*Ft(e),r=It*Ft(r),n=Mt*Ft(n),new I(Lt(3.2404542*r-1.5371385*e-.4985314*n),Lt(-.969266*r+1.8760108*e+.041556*n),Lt(.0556434*r-.2040259*e+1.0572252*n),t.alpha)}function qt(t,e,r){var n=e-t;return t+r*(n>180||n<-180?n-360*Math.round(n/360):n)}var Rt={forward:jt,reverse:Ut,interpolate:function(t,e,r){return{l:kt(t.l,e.l,r),a:kt(t.a,e.a,r),b:kt(t.b,e.b,r),alpha:kt(t.alpha,e.alpha,r)}}},Nt={forward:function(t){var e=jt(t),r=e.l,n=e.a,i=e.b,o=Math.atan2(i,n)*Et;return{h:o<0?o+360:o,c:Math.sqrt(n*n+i*i),l:r,alpha:t.a}},reverse:function(t){var e=t.h*Tt,r=t.c;return Ut({l:t.l,a:Math.cos(e)*r,b:Math.sin(e)*r,alpha:t.alpha})},interpolate:function(t,e,r){return{h:qt(t.h,e.h,r),c:kt(t.c,e.c,r),l:kt(t.l,e.l,r),alpha:kt(t.alpha,e.alpha,r)}}},Zt=Object.freeze({__proto__:null,lab:Rt,hcl:Nt}),Jt=function(t,e,r,n,i){this.type=t,this.operator=e,this.interpolation=r,this.input=n,this.labels=[],this.outputs=[];for(var o=0,a=i;o<a.length;o+=1){var s=a[o],u=s[0],l=s[1];this.labels.push(u),this.outputs.push(l)}};function Xt(t,e,r,n){var i=n-r,o=t-r;return 0===i?0:1===e?o/i:(Math.pow(e,o)-1)/(Math.pow(e,i)-1)}Jt.interpolationFactor=function(e,r,n,i){var o=0;if("exponential"===e.name)o=Xt(r,e.base,n,i);else if("linear"===e.name)o=Xt(r,1,n,i);else if("cubic-bezier"===e.name){var a=e.controlPoints;o=new t(a[0],a[1],a[2],a[3]).solve(Xt(r,1,n,i))}return o},Jt.parse=function(t,e){var r=t[0],n=t[1],i=t[2],o=t.slice(3);if(!Array.isArray(n)||0===n.length)return e.error("Expected an interpolation type expression.",1);if("linear"===n[0])n={name:"linear"};else if("exponential"===n[0]){var a=n[1];if("number"!=typeof a)return e.error("Exponential interpolation requires a numeric base.",1,1);n={name:"exponential",base:a}}else{if("cubic-bezier"!==n[0])return e.error("Unknown interpolation type "+String(n[0]),1,0);var s=n.slice(1);if(4!==s.length||s.some((function(t){return"number"!=typeof t||t<0||t>1})))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);n={name:"cubic-bezier",controlPoints:s}}if(t.length-1<4)return e.error("Expected at least 4 arguments, but found only "+(t.length-1)+".");if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");if(!(i=e.parse(i,2,B)))return null;var u=[],l=null;"interpolate-hcl"===r||"interpolate-lab"===r?l=E:e.expectedType&&"value"!==e.expectedType.kind&&(l=e.expectedType);for(var p=0;p<o.length;p+=2){var c=o[p],h=o[p+1],f=p+3,y=p+4;if("number"!=typeof c)return e.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',f);if(u.length&&u[u.length-1][0]>=c)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',f);var d=e.parse(h,y,l);if(!d)return null;l=l||d.type,u.push([c,d])}return"number"===l.kind||"color"===l.kind||"array"===l.kind&&"number"===l.itemType.kind&&"number"==typeof l.N?new Jt(l,r,n,i,u):e.error("Type "+q(l)+" is not interpolatable.")},Jt.prototype.evaluate=function(t){var e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);var n=this.input.evaluate(t);if(n<=e[0])return r[0].evaluate(t);var i=e.length;if(n>=e[i-1])return r[i-1].evaluate(t);var o=wt(e,n),a=e[o],s=e[o+1],u=Jt.interpolationFactor(this.interpolation,n,a,s),l=r[o].evaluate(t),p=r[o+1].evaluate(t);return"interpolate"===this.operator?At[this.type.kind.toLowerCase()](l,p,u):"interpolate-hcl"===this.operator?Nt.reverse(Nt.interpolate(Nt.forward(l),Nt.forward(p),u)):Rt.reverse(Rt.interpolate(Rt.forward(l),Rt.forward(p),u))},Jt.prototype.eachChild=function(t){t(this.input);for(var e=0,r=this.outputs;e<r.length;e+=1){t(r[e])}},Jt.prototype.possibleOutputs=function(){var t;return(t=[]).concat.apply(t,this.outputs.map((function(t){return t.possibleOutputs()})))},Jt.prototype.serialize=function(){var t;t="linear"===this.interpolation.name?["linear"]:"exponential"===this.interpolation.name?1===this.interpolation.base?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier"].concat(this.interpolation.controlPoints);for(var e=[this.operator,t,this.input.serialize()],r=0;r<this.labels.length;r++)e.push(this.labels[r],this.outputs[r].serialize());return e};var Kt=function(t,e){this.type=t,this.args=e};Kt.parse=function(t,e){if(t.length<2)return e.error("Expectected at least one argument.");var r=null,n=e.expectedType;n&&"value"!==n.kind&&(r=n);for(var i=[],o=0,a=t.slice(1);o<a.length;o+=1){var s=a[o],u=e.parse(s,1+i.length,r,void 0,{typeAnnotation:"omit"});if(!u)return null;r=r||u.type,i.push(u)}var l=n&&i.some((function(t){return N(n,t.type)}));return new Kt(l?F:r,i)},Kt.prototype.evaluate=function(t){for(var e,r=null,n=0,i=0,o=this.args;i<o.length;i+=1){if(n++,(r=o[i].evaluate(t))&&r instanceof et&&!r.available&&(e||(e=r.name),r=null,n===this.args.length&&(r=e)),null!==r)break}return r},Kt.prototype.eachChild=function(t){this.args.forEach(t)},Kt.prototype.possibleOutputs=function(){var t;return(t=[]).concat.apply(t,this.args.map((function(t){return t.possibleOutputs()})))},Kt.prototype.serialize=function(){var t=["coalesce"];return this.eachChild((function(e){t.push(e.serialize())})),t};var Yt=function(t,e){this.type=e.type,this.bindings=[].concat(t),this.result=e};Yt.prototype.evaluate=function(t){return this.result.evaluate(t)},Yt.prototype.eachChild=function(t){for(var e=0,r=this.bindings;e<r.length;e+=1){t(r[e][1])}t(this.result)},Yt.parse=function(t,e){if(t.length<4)return e.error("Expected at least 3 arguments, but found "+(t.length-1)+" instead.");for(var r=[],n=1;n<t.length-1;n+=2){var i=t[n];if("string"!=typeof i)return e.error("Expected string, but found "+typeof i+" instead.",n);if(/[^a-zA-Z0-9_]/.test(i))return e.error("Variable names must contain only alphanumeric characters or '_'.",n);var o=e.parse(t[n+1],n+1);if(!o)return null;r.push([i,o])}var a=e.parse(t[t.length-1],t.length-1,e.expectedType,r);return a?new Yt(r,a):null},Yt.prototype.possibleOutputs=function(){return this.result.possibleOutputs()},Yt.prototype.serialize=function(){for(var t=["let"],e=0,r=this.bindings;e<r.length;e+=1){var n=r[e],i=n[0],o=n[1];t.push(i,o.serialize())}return t.push(this.result.serialize()),t};var Gt=function(t,e,r){this.type=t,this.index=e,this.input=r};Gt.parse=function(t,e){if(3!==t.length)return e.error("Expected 2 arguments, but found "+(t.length-1)+" instead.");var r=e.parse(t[1],1,B),n=e.parse(t[2],2,U(e.expectedType||F));if(!r||!n)return null;var i=n.type;return new Gt(i.itemType,r,n)},Gt.prototype.evaluate=function(t){var e=this.index.evaluate(t),r=this.input.evaluate(t);if(e<0)throw new at("Array index out of bounds: "+e+" < 0.");if(e>=r.length)throw new at("Array index out of bounds: "+e+" > "+(r.length-1)+".");if(e!==Math.floor(e))throw new at("Array index must be an integer, but found "+e+" instead.");return r[e]},Gt.prototype.eachChild=function(t){t(this.index),t(this.input)},Gt.prototype.possibleOutputs=function(){return[void 0]},Gt.prototype.serialize=function(){return["at",this.index.serialize(),this.input.serialize()]};var Ht=function(t,e){this.type=T,this.needle=t,this.haystack=e};Ht.parse=function(t,e){if(3!==t.length)return e.error("Expected 2 arguments, but found "+(t.length-1)+" instead.");var r,n=e.parse(t[1],1,F),i=e.parse(t[2],2,F);return n&&i?"boolean"!==(r=n.type).kind&&"string"!==r.kind&&"number"!==r.kind&&"null"!==r.kind&&"value"!==r.kind?e.error("Expected first argument to be of type boolean, string, number or null, but found "+q(n.type)+" instead"):new Ht(n,i):null},Ht.prototype.evaluate=function(t){var e=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!e||!r)return!1;if(!function(t){return"boolean"==typeof t||"string"==typeof t||"number"==typeof t}(e))throw new at("Expected first argument to be of type boolean, string or number, but found "+q(nt(e))+" instead.");if(!function(t){return Array.isArray(t)||"string"==typeof t}(r))throw new at("Expected second argument to be of type array or string, but found "+q(nt(r))+" instead.");return r.indexOf(e)>=0},Ht.prototype.eachChild=function(t){t(this.needle),t(this.haystack)},Ht.prototype.possibleOutputs=function(){return[!0,!1]},Ht.prototype.serialize=function(){return["in",this.needle.serialize(),this.haystack.serialize()]};var Wt=function(t,e,r,n,i,o){this.inputType=t,this.type=e,this.input=r,this.cases=n,this.outputs=i,this.otherwise=o};Wt.parse=function(t,e){if(t.length<5)return e.error("Expected at least 4 arguments, but found only "+(t.length-1)+".");if(t.length%2!=1)return e.error("Expected an even number of arguments.");var r,n;e.expectedType&&"value"!==e.expectedType.kind&&(n=e.expectedType);for(var i={},o=[],a=2;a<t.length-1;a+=2){var s=t[a],u=t[a+1];Array.isArray(s)||(s=[s]);var l=e.concat(a);if(0===s.length)return l.error("Expected at least one branch label.");for(var p=0,c=s;p<c.length;p+=1){var h=c[p];if("number"!=typeof h&&"string"!=typeof h)return l.error("Branch labels must be numbers or strings.");if("number"==typeof h&&Math.abs(h)>Number.MAX_SAFE_INTEGER)return l.error("Branch labels must be integers no larger than "+Number.MAX_SAFE_INTEGER+".");if("number"==typeof h&&Math.floor(h)!==h)return l.error("Numeric branch labels must be integer values.");if(r){if(l.checkSubtype(r,nt(h)))return null}else r=nt(h);if(void 0!==i[String(h)])return l.error("Branch labels must be unique.");i[String(h)]=o.length}var f=e.parse(u,a,n);if(!f)return null;n=n||f.type,o.push(f)}var y=e.parse(t[1],1,F);if(!y)return null;var d=e.parse(t[t.length-1],t.length-1,n);return d?"value"!==y.t