dicom-microscopy-viewer-changed
Version:
Interactive web-based viewer for DICOM Microscopy Images
1 lines • 145 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("ol/style/Circle.js"),require("ol/style/Fill.js"),require("ol/style/Icon.js"),require("ol/render/Feature.js"),require("ol/style/Stroke.js"),require("ol/style/Style.js"),require("ol/style/Text.js"),require("ol/render/canvas.js"),require("ol/tileurlfunction.js"),require("ol/format/GeoJSON.js"),require("ol/layer/Image.js"),require("ol/layer/Layer.js"),require("ol/layer/Group.js"),require("ol/format/MVT.js"),require("ol/Map.js"),require("ol/source/Raster.js"),require("ol/source/Source.js"),require("ol/tilegrid/TileGrid.js"),require("ol/source/TileJSON.js"),require("ol/layer/Tile.js"),require("ol/layer/Vector.js"),require("ol/source/Vector.js"),require("ol/layer/VectorTile.js"),require("ol/source/VectorTile.js"),require("ol/View.js"),require("ol/proj.js"),require("ol/loadingstrategy.js"),require("ol/tilegrid.js"),require("ol/extent.js"),require("ol/util.js")):"function"==typeof define&&define.amd?define(["exports","ol/style/Circle.js","ol/style/Fill.js","ol/style/Icon.js","ol/render/Feature.js","ol/style/Stroke.js","ol/style/Style.js","ol/style/Text.js","ol/render/canvas.js","ol/tileurlfunction.js","ol/format/GeoJSON.js","ol/layer/Image.js","ol/layer/Layer.js","ol/layer/Group.js","ol/format/MVT.js","ol/Map.js","ol/source/Raster.js","ol/source/Source.js","ol/tilegrid/TileGrid.js","ol/source/TileJSON.js","ol/layer/Tile.js","ol/layer/Vector.js","ol/source/Vector.js","ol/layer/VectorTile.js","ol/source/VectorTile.js","ol/View.js","ol/proj.js","ol/loadingstrategy.js","ol/tilegrid.js","ol/extent.js","ol/util.js"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).olms={},e.ol.style.Circle,e.ol.style.Fill,e.ol.style.Icon,e.ol.render.Feature,e.ol.style.Stroke,e.ol.style.Style,e.ol.style.Text,e.ol.render.canvas,e.ol.tileurlfunction,e.ol.format.GeoJSON,e.ol.layer.Image,e.ol.layer.Layer,e.ol.layer.Group,e.ol.format.MVT,e.ol.Map,e.ol.source.Raster,e.ol.source.Source,e.ol.tilegrid.TileGrid,e.ol.source.TileJSON,e.ol.layer.Tile,e.ol.layer.Vector,e.ol.source.Vector,e.ol.layer.VectorTile,e.ol.source.VectorTile,e.ol.View,e.ol.proj,e.ol.loadingstrategy,e.ol.tilegrid,e.ol.extent,e.ol.util)}(this,(function(e,t,r,n,a,i,o,s,u,l,p,f,c,d,y,m,h,v,g,b,x,w,z,k,M,S,j,q,T,_,E){"use strict";function C(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var A=C(t),I=C(r),F=C(n),P=C(a),D=C(i),O=C(o),L=C(s),R=C(p),N=C(f),U=C(c),V=C(d),G=C(y),J=C(m),W=C(h),Z=C(v),$=C(g),B=C(b),X=C(x),H=C(w),Y=C(z),K=C(k),Q=C(M),ee=C(S);function te(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var re,ne={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 ae(e){return(e=Math.round(e))<0?0:e>255?255:e}function ie(e){return e<0?0:e>1?1:e}function oe(e){return"%"===e[e.length-1]?ae(parseFloat(e)/100*255):ae(parseInt(e))}function se(e){return"%"===e[e.length-1]?ie(parseFloat(e)/100):ie(parseFloat(e))}function ue(e,t,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?e+(t-e)*r*6:2*r<1?t:3*r<2?e+(t-e)*(2/3-r)*6:e}try{re={}.parseCSSColor=function(e){var t,r=e.replace(/ /g,"").toLowerCase();if(r in ne)return ne[r].slice();if("#"===r[0])return 4===r.length?(t=parseInt(r.substr(1),16))>=0&&t<=4095?[(3840&t)>>4|(3840&t)>>8,240&t|(240&t)>>4,15&t|(15&t)<<4,1]:null:7===r.length&&(t=parseInt(r.substr(1),16))>=0&&t<=16777215?[(16711680&t)>>16,(65280&t)>>8,255&t,1]:null;var n=r.indexOf("("),a=r.indexOf(")");if(-1!==n&&a+1===r.length){var i=r.substr(0,n),o=r.substr(n+1,a-(n+1)).split(","),s=1;switch(i){case"rgba":if(4!==o.length)return null;s=se(o.pop());case"rgb":return 3!==o.length?null:[oe(o[0]),oe(o[1]),oe(o[2]),s];case"hsla":if(4!==o.length)return null;s=se(o.pop());case"hsl":if(3!==o.length)return null;var u=(parseFloat(o[0])%360+360)%360/360,l=se(o[1]),p=se(o[2]),f=p<=.5?p*(l+1):p+l-p*l,c=2*p-f;return[ae(255*ue(c,f,u+1/3)),ae(255*ue(c,f,u)),ae(255*ue(c,f,u-1/3)),s];default:return null}}return null}}catch(e){}var le=function(e,t,r,n){void 0===n&&(n=1),this.r=e,this.g=t,this.b=r,this.a=n};le.parse=function(e){if(e){if(e instanceof le)return e;if("string"==typeof e){var t=re(e);if(t)return new le(t[0]/255*t[3],t[1]/255*t[3],t[2]/255*t[3],t[3])}}},le.prototype.toString=function(){var e=this.toArray(),t=e[0],r=e[1],n=e[2],a=e[3];return"rgba("+Math.round(t)+","+Math.round(r)+","+Math.round(n)+","+a+")"},le.prototype.toArray=function(){var e=this,t=e.r,r=e.g,n=e.b,a=e.a;return 0===a?[0,0,0,0]:[255*t/a,255*r/a,255*n/a,a]},le.prototype.toArray01=function(){var e=this,t=e.r,r=e.g,n=e.b,a=e.a;return 0===a?[0,0,0,0]:[t/a,r/a,n/a,a]},le.prototype.toArray01PremultipliedAlpha=function(){var e=this;return[e.r,e.g,e.b,e.a]},le.black=new le(0,0,0,1),le.white=new le(1,1,1,1),le.transparent=new le(0,0,0,0),le.red=new le(1,0,0,1),le.blue=new le(0,0,1,1);var pe=le;function fe(e){return"object"==typeof e?["literal",e]:e}function ce(e,t){var r=e.stops;if(!r)return function(e,t){var r=["get",e.property];if(void 0===e.default)return"string"===t.type?["string",r]:r;if("enum"===t.type)return["match",r,Object.keys(t.values),r,e.default];var n=["color"===t.type?"to-color":t.type,r,fe(e.default)];return"array"===t.type&&n.splice(1,0,t.value,t.length||null),n}(e,t);var n=r&&"object"==typeof r[0][0],a=n||void 0!==e.property,i=n||!a;return r=r.map((function(e){return!a&&t.tokens&&"string"==typeof e[1]?[e[0],be(e[1])]:[e[0],fe(e[1])]})),n?function(e,t,r){for(var n={},a={},i=[],o=0;o<r.length;o++){var s=r[o],u=s[0].zoom;void 0===n[u]&&(n[u]={zoom:u,type:e.type,property:e.property,default:e.default},a[u]=[],i.push(u)),a[u].push([s[0].value,s[1]])}var l=ge({},t);if("exponential"===l){for(var p=[de(e),["linear"],["zoom"]],f=0,c=i;f<c.length;f+=1){var d=c[f];ve(p,d,me(n[d],t,a[d]),!1)}return p}for(var y=["step",["zoom"]],m=0,h=i;m<h.length;m+=1){var v=h[m];ve(y,v,me(n[v],t,a[v]),!0)}return he(y),y}(e,t,r):i?function(e,t,r,n){void 0===n&&(n=["zoom"]);var a,i=ge(e,t),o=!1;if("interval"===i)a=["step",n],o=!0;else{if("exponential"!==i)throw new Error('Unknown zoom function type "'+i+'"');var s=void 0!==e.base?e.base:1;a=[de(e),1===s?["linear"]:["exponential",s],n]}for(var u=0,l=r;u<l.length;u+=1){var p=l[u];ve(a,p[0],p[1],o)}return he(a),a}(e,t,r):me(e,t,r)}function de(e){switch(e.colorSpace){case"hcl":return"interpolate-hcl";case"lab":return"interpolate-lab";default:return"interpolate"}}function ye(e,t){var r,n,a=fe((r=e.default,n=t.default,void 0!==r?r:void 0!==n?n:void 0));return void 0===a&&"resolvedImage"===t.type?"":a}function me(e,t,r){var n=ge(e,t),a=["get",e.property];if("categorical"===n&&"boolean"==typeof r[0][0]){for(var i=["case"],o=0,s=r;o<s.length;o+=1){var u=s[o];i.push(["==",a,u[0]],u[1])}return i.push(ye(e,t)),i}if("categorical"===n){for(var l=["match",a],p=0,f=r;p<f.length;p+=1){var c=f[p];ve(l,c[0],c[1],!1)}return l.push(ye(e,t)),l}if("interval"===n){for(var d=["step",["number",a]],y=0,m=r;y<m.length;y+=1){var h=m[y];ve(d,h[0],h[1],!0)}return he(d),void 0===e.default?d:["case",["==",["typeof",a],"number"],d,fe(e.default)]}if("exponential"===n){for(var v=void 0!==e.base?e.base:1,g=[de(e),1===v?["linear"]:["exponential",v],["number",a]],b=0,x=r;b<x.length;b+=1){var w=x[b];ve(g,w[0],w[1],!1)}return void 0===e.default?g:["case",["==",["typeof",a],"number"],g,fe(e.default)]}throw new Error("Unknown property function type "+n)}function he(e){"step"===e[0]&&3===e.length&&(e.push(0),e.push(e[3]))}function ve(e,t,r,n){e.length>3&&t===e[e.length-2]||(n&&2===e.length||e.push(t),e.push(r))}function ge(e,t){return e.type?e.type:t.expression.interpolated?"exponential":"interval"}function be(e){for(var t=["concat"],r=/{([^{}]+)}/g,n=0,a=r.exec(e);null!==a;a=r.exec(e)){var i=e.slice(n,r.lastIndex-a[0].length);n=r.lastIndex,i.length>0&&t.push(i),t.push(["get",a[1]])}if(1===t.length)return e;if(n<e.length)t.push(e.slice(n));else if(2===t.length)return["to-string",t[1]];return t}var xe=function(e){function t(t,r){e.call(this,r),this.message=r,this.key=t}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t}(Error),we=function(e,t){void 0===t&&(t=[]),this.parent=e,this.bindings={};for(var r=0,n=t;r<n.length;r+=1){var a=n[r],i=a[0],o=a[1];this.bindings[i]=o}};we.prototype.concat=function(e){return new we(this,e)},we.prototype.get=function(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.")},we.prototype.has=function(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)};var ze=we,ke={kind:"null"},Me={kind:"number"},Se={kind:"string"},je={kind:"boolean"},qe={kind:"color"},Te={kind:"object"},_e={kind:"value"},Ee={kind:"collator"},Ce={kind:"formatted"},Ae={kind:"resolvedImage"};function Ie(e,t){return{kind:"array",itemType:e,N:t}}function Fe(e){if("array"===e.kind){var t=Fe(e.itemType);return"number"==typeof e.N?"array<"+t+", "+e.N+">":"value"===e.itemType.kind?"array":"array<"+t+">"}return e.kind}var Pe=[ke,Me,Se,je,qe,Ce,Te,Ie(_e),Ae];function De(e,t){if("error"===t.kind)return null;if("array"===e.kind){if("array"===t.kind&&(0===t.N&&"value"===t.itemType.kind||!De(e.itemType,t.itemType))&&("number"!=typeof e.N||e.N===t.N))return null}else{if(e.kind===t.kind)return null;if("value"===e.kind)for(var r=0,n=Pe;r<n.length;r+=1){if(!De(n[r],t))return null}}return"Expected "+Fe(e)+" but found "+Fe(t)+" instead."}function Oe(e,t){return t.some((function(t){return t.kind===e.kind}))}function Le(e,t){return t.some((function(t){return"null"===t?null===e:"array"===t?Array.isArray(e):"object"===t?e&&!Array.isArray(e)&&"object"==typeof e:t===typeof e}))}var Re=function(e,t,r){this.sensitivity=e?t?"variant":"case":t?"accent":"base",this.locale=r,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})};Re.prototype.compare=function(e,t){return this.collator.compare(e,t)},Re.prototype.resolvedLocale=function(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale};var Ne=Re,Ue=function(e,t,r,n,a){this.text=e.normalize?e.normalize():e,this.image=t,this.scale=r,this.fontStack=n,this.textColor=a},Ve=function(e){this.sections=e};Ve.fromString=function(e){return new Ve([new Ue(e,null,null,null,null)])},Ve.prototype.isEmpty=function(){return 0===this.sections.length||!this.sections.some((function(e){return 0!==e.text.length||e.image&&0!==e.image.name.length}))},Ve.factory=function(e){return e instanceof Ve?e:Ve.fromString(e)},Ve.prototype.toString=function(){return 0===this.sections.length?"":this.sections.map((function(e){return e.text})).join("")},Ve.prototype.serialize=function(){for(var e=["format"],t=0,r=this.sections;t<r.length;t+=1){var n=r[t];if(n.image)e.push(["image",n.image.name]);else{e.push(n.text);var a={};n.fontStack&&(a["text-font"]=["literal",n.fontStack.split(",")]),n.scale&&(a["font-scale"]=n.scale),n.textColor&&(a["text-color"]=["rgba"].concat(n.textColor.toArray())),e.push(a)}}return e};var Ge=Ve,Je=function(e){this.name=e.name,this.available=e.available};Je.prototype.toString=function(){return this.name},Je.fromString=function(e){return e?new Je({name:e,available:!1}):null},Je.prototype.serialize=function(){return["image",this.name]};var We=Je;function Ze(e,t,r,n){return"number"==typeof e&&e>=0&&e<=255&&"number"==typeof t&&t>=0&&t<=255&&"number"==typeof r&&r>=0&&r<=255?void 0===n||"number"==typeof n&&n>=0&&n<=1?null:"Invalid rgba value ["+[e,t,r,n].join(", ")+"]: 'a' must be between 0 and 1.":"Invalid rgba value ["+("number"==typeof n?[e,t,r,n]:[e,t,r]).join(", ")+"]: 'r', 'g', and 'b' must be between 0 and 255."}function $e(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 pe)return!0;if(e instanceof Ne)return!0;if(e instanceof Ge)return!0;if(e instanceof We)return!0;if(Array.isArray(e)){for(var t=0,r=e;t<r.length;t+=1){if(!$e(r[t]))return!1}return!0}if("object"==typeof e){for(var n in e)if(!$e(e[n]))return!1;return!0}return!1}function Be(e){if(null===e)return ke;if("string"==typeof e)return Se;if("boolean"==typeof e)return je;if("number"==typeof e)return Me;if(e instanceof pe)return qe;if(e instanceof Ne)return Ee;if(e instanceof Ge)return Ce;if(e instanceof We)return Ae;if(Array.isArray(e)){for(var t,r=e.length,n=0,a=e;n<a.length;n+=1){var i=Be(a[n]);if(t){if(t===i)continue;t=_e;break}t=i}return Ie(t||_e,r)}return Te}function Xe(e){var t=typeof e;return null===e?"":"string"===t||"number"===t||"boolean"===t?String(e):e instanceof pe||e instanceof Ge||e instanceof We?e.toString():JSON.stringify(e)}var He=function(e,t){this.type=e,this.value=t};He.parse=function(e,t){if(2!==e.length)return t.error("'literal' expression requires exactly one argument, but found "+(e.length-1)+" instead.");if(!$e(e[1]))return t.error("invalid value");var r=e[1],n=Be(r),a=t.expectedType;return"array"!==n.kind||0!==n.N||!a||"array"!==a.kind||"number"==typeof a.N&&0!==a.N||(n=a),new He(n,r)},He.prototype.evaluate=function(){return this.value},He.prototype.eachChild=function(){},He.prototype.outputDefined=function(){return!0},He.prototype.serialize=function(){return"array"===this.type.kind||"object"===this.type.kind?["literal",this.value]:this.value instanceof pe?["rgba"].concat(this.value.toArray()):this.value instanceof Ge?this.value.serialize():this.value};var Ye=He,Ke=function(e){this.name="ExpressionEvaluationError",this.message=e};Ke.prototype.toJSON=function(){return this.message};var Qe=Ke,et={string:Se,number:Me,boolean:je,object:Te},tt=function(e,t){this.type=e,this.args=t};tt.parse=function(e,t){if(e.length<2)return t.error("Expected at least one argument.");var r,n=1,a=e[0];if("array"===a){var i,o;if(e.length>2){var s=e[1];if("string"!=typeof s||!(s in et)||"object"===s)return t.error('The item type argument of "array" must be one of string, number, boolean',1);i=et[s],n++}else i=_e;if(e.length>3){if(null!==e[2]&&("number"!=typeof e[2]||e[2]<0||e[2]!==Math.floor(e[2])))return t.error('The length argument to "array" must be a positive integer literal',2);o=e[2],n++}r=Ie(i,o)}else r=et[a];for(var u=[];n<e.length;n++){var l=t.parse(e[n],n,_e);if(!l)return null;u.push(l)}return new tt(r,u)},tt.prototype.evaluate=function(e){for(var t=0;t<this.args.length;t++){var r=this.args[t].evaluate(e);if(!De(this.type,Be(r)))return r;if(t===this.args.length-1)throw new Qe("Expected value to be of type "+Fe(this.type)+", but found "+Fe(Be(r))+" instead.")}return null},tt.prototype.eachChild=function(e){this.args.forEach(e)},tt.prototype.outputDefined=function(){return this.args.every((function(e){return e.outputDefined()}))},tt.prototype.serialize=function(){var e=this.type,t=[e.kind];if("array"===e.kind){var r=e.itemType;if("string"===r.kind||"number"===r.kind||"boolean"===r.kind){t.push(r.kind);var n=e.N;("number"==typeof n||this.args.length>1)&&t.push(n)}}return t.concat(this.args.map((function(e){return e.serialize()})))};var rt=tt,nt=function(e){this.type=Ce,this.sections=e};nt.parse=function(e,t){if(e.length<2)return t.error("Expected at least one argument.");var r=e[1];if(!Array.isArray(r)&&"object"==typeof r)return t.error("First argument must be an image or text section.");for(var n=[],a=!1,i=1;i<=e.length-1;++i){var o=e[i];if(a&&"object"==typeof o&&!Array.isArray(o)){a=!1;var s=null;if(o["font-scale"]&&!(s=t.parse(o["font-scale"],1,Me)))return null;var u=null;if(o["text-font"]&&!(u=t.parse(o["text-font"],1,Ie(Se))))return null;var l=null;if(o["text-color"]&&!(l=t.parse(o["text-color"],1,qe)))return null;var p=n[n.length-1];p.scale=s,p.font=u,p.textColor=l}else{var f=t.parse(e[i],1,_e);if(!f)return null;var c=f.type.kind;if("string"!==c&&"value"!==c&&"null"!==c&&"resolvedImage"!==c)return t.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");a=!0,n.push({content:f,scale:null,font:null,textColor:null})}}return new nt(n)},nt.prototype.evaluate=function(e){return new Ge(this.sections.map((function(t){var r=t.content.evaluate(e);return Be(r)===Ae?new Ue("",r,null,null,null):new Ue(Xe(r),null,t.scale?t.scale.evaluate(e):null,t.font?t.font.evaluate(e).join(","):null,t.textColor?t.textColor.evaluate(e):null)})))},nt.prototype.eachChild=function(e){for(var t=0,r=this.sections;t<r.length;t+=1){var n=r[t];e(n.content),n.scale&&e(n.scale),n.font&&e(n.font),n.textColor&&e(n.textColor)}},nt.prototype.outputDefined=function(){return!1},nt.prototype.serialize=function(){for(var e=["format"],t=0,r=this.sections;t<r.length;t+=1){var n=r[t];e.push(n.content.serialize());var a={};n.scale&&(a["font-scale"]=n.scale.serialize()),n.font&&(a["text-font"]=n.font.serialize()),n.textColor&&(a["text-color"]=n.textColor.serialize()),e.push(a)}return e};var at=nt,it=function(e){this.type=Ae,this.input=e};it.parse=function(e,t){if(2!==e.length)return t.error("Expected two arguments.");var r=t.parse(e[1],1,Se);return r?new it(r):t.error("No image name provided.")},it.prototype.evaluate=function(e){var t=this.input.evaluate(e),r=We.fromString(t);return r&&e.availableImages&&(r.available=e.availableImages.indexOf(t)>-1),r},it.prototype.eachChild=function(e){e(this.input)},it.prototype.outputDefined=function(){return!1},it.prototype.serialize=function(){return["image",this.input.serialize()]};var ot=it,st={"to-boolean":je,"to-color":qe,"to-number":Me,"to-string":Se},ut=function(e,t){this.type=e,this.args=t};ut.parse=function(e,t){if(e.length<2)return t.error("Expected at least one argument.");var r=e[0];if(("to-boolean"===r||"to-string"===r)&&2!==e.length)return t.error("Expected one argument.");for(var n=st[r],a=[],i=1;i<e.length;i++){var o=t.parse(e[i],i,_e);if(!o)return null;a.push(o)}return new ut(n,a)},ut.prototype.evaluate=function(e){if("boolean"===this.type.kind)return Boolean(this.args[0].evaluate(e));if("color"===this.type.kind){for(var t,r,n=0,a=this.args;n<a.length;n+=1){if(r=null,(t=a[n].evaluate(e))instanceof pe)return t;if("string"==typeof t){var i=e.parseColor(t);if(i)return i}else if(Array.isArray(t)&&!(r=t.length<3||t.length>4?"Invalid rbga value "+JSON.stringify(t)+": expected an array containing either three or four numeric values.":Ze(t[0],t[1],t[2],t[3])))return new pe(t[0]/255,t[1]/255,t[2]/255,t[3])}throw new Qe(r||"Could not parse color from value '"+("string"==typeof t?t:String(JSON.stringify(t)))+"'")}if("number"===this.type.kind){for(var o=null,s=0,u=this.args;s<u.length;s+=1){if(null===(o=u[s].evaluate(e)))return 0;var l=Number(o);if(!isNaN(l))return l}throw new Qe("Could not convert "+JSON.stringify(o)+" to number.")}return"formatted"===this.type.kind?Ge.fromString(Xe(this.args[0].evaluate(e))):"resolvedImage"===this.type.kind?We.fromString(Xe(this.args[0].evaluate(e))):Xe(this.args[0].evaluate(e))},ut.prototype.eachChild=function(e){this.args.forEach(e)},ut.prototype.outputDefined=function(){return this.args.every((function(e){return e.outputDefined()}))},ut.prototype.serialize=function(){if("formatted"===this.type.kind)return new at([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if("resolvedImage"===this.type.kind)return new ot(this.args[0]).serialize();var e=["to-"+this.type.kind];return this.eachChild((function(t){e.push(t.serialize())})),e};var lt=ut,pt=["Unknown","Point","LineString","Polygon"],ft=function(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null};ft.prototype.id=function(){return this.feature&&void 0!==this.feature.id?this.feature.id:null},ft.prototype.geometryType=function(){return this.feature?"number"==typeof this.feature.type?pt[this.feature.type]:this.feature.type:null},ft.prototype.geometry=function(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null},ft.prototype.canonicalID=function(){return this.canonical},ft.prototype.properties=function(){return this.feature&&this.feature.properties||{}},ft.prototype.distanceFromCenter=function(){if(this.featureTileCoord&&this.featureDistanceData){var e=this.featureDistanceData.center,t=this.featureDistanceData.scale,r=this.featureTileCoord,n=r.x,a=r.y,i=n*t-e[0],o=a*t-e[1];return this.featureDistanceData.bearing[0]*i+this.featureDistanceData.bearing[1]*o}return 0},ft.prototype.parseColor=function(e){var t=this._parseColorCache[e];return t||(t=this._parseColorCache[e]=pe.parse(e)),t};var ct=ft,dt=function(e,t,r,n){this.name=e,this.type=t,this._evaluate=r,this.args=n};dt.prototype.evaluate=function(e){return this._evaluate(e,this.args)},dt.prototype.eachChild=function(e){this.args.forEach(e)},dt.prototype.outputDefined=function(){return!1},dt.prototype.serialize=function(){return[this.name].concat(this.args.map((function(e){return e.serialize()})))},dt.parse=function(e,t){var r,n=e[0],a=dt.definitions[n];if(!a)return t.error('Unknown expression "'+n+'". If you wanted a literal array, use ["literal", [...]].',0);for(var i=Array.isArray(a)?a[0]:a.type,o=Array.isArray(a)?[[a[1],a[2]]]:a.overloads,s=o.filter((function(t){var r=t[0];return!Array.isArray(r)||r.length===e.length-1})),u=null,l=0,p=s;l<p.length;l+=1){var f=p[l],c=f[0],d=f[1];u=new Ut(t.registry,t.path,null,t.scope);for(var y=[],m=!1,h=1;h<e.length;h++){var v=e[h],g=Array.isArray(c)?c[h-1]:c.type,b=u.parse(v,1+y.length,g);if(!b){m=!0;break}y.push(b)}if(!m)if(Array.isArray(c)&&c.length!==y.length)u.error("Expected "+c.length+" arguments, but found "+y.length+" instead.");else{for(var x=0;x<y.length;x++){var w=Array.isArray(c)?c[x]:c.type,z=y[x];u.concat(x+1).checkSubtype(w,z.type)}if(0===u.errors.length)return new dt(n,i,d,y)}}if(1===s.length)(r=t.errors).push.apply(r,u.errors);else{for(var k=(s.length?s:o).map((function(e){var t,r=e[0];return t=r,Array.isArray(t)?"("+t.map(Fe).join(", ")+")":"("+Fe(t.type)+"...)"})).join(" | "),M=[],S=1;S<e.length;S++){var j=t.parse(e[S],1+M.length);if(!j)return null;M.push(Fe(j.type))}t.error("Expected arguments of type "+k+", but found ("+M.join(", ")+") instead.")}return null},dt.register=function(e,t){for(var r in dt.definitions=t,t)e[r]=dt};var yt=dt,mt=function(e,t,r){this.type=Ee,this.locale=r,this.caseSensitive=e,this.diacriticSensitive=t};mt.parse=function(e,t){if(2!==e.length)return t.error("Expected one argument.");var r=e[1];if("object"!=typeof r||Array.isArray(r))return t.error("Collator options argument must be an object.");var n=t.parse(void 0!==r["case-sensitive"]&&r["case-sensitive"],1,je);if(!n)return null;var a=t.parse(void 0!==r["diacritic-sensitive"]&&r["diacritic-sensitive"],1,je);if(!a)return null;var i=null;return r.locale&&!(i=t.parse(r.locale,1,Se))?null:new mt(n,a,i)},mt.prototype.evaluate=function(e){return new Ne(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)},mt.prototype.eachChild=function(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)},mt.prototype.outputDefined=function(){return!1},mt.prototype.serialize=function(){var e={};return e["case-sensitive"]=this.caseSensitive.serialize(),e["diacritic-sensitive"]=this.diacriticSensitive.serialize(),this.locale&&(e.locale=this.locale.serialize()),["collator",e]};var ht=mt,vt=8192;function gt(e,t){e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.max(e[2],t[0]),e[3]=Math.max(e[3],t[1])}function bt(e,t){return!(e[0]<=t[0])&&(!(e[2]>=t[2])&&(!(e[1]<=t[1])&&!(e[3]>=t[3])))}function xt(e,t){var r,n=(180+e[0])/360,a=(r=e[1],(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r*Math.PI/360)))/360),i=Math.pow(2,t.z);return[Math.round(n*i*vt),Math.round(a*i*vt)]}function wt(e,t,r){return t[1]>e[1]!=r[1]>e[1]&&e[0]<(r[0]-t[0])*(e[1]-t[1])/(r[1]-t[1])+t[0]}function zt(e,t){for(var r,n,a,i,o,s,u,l=!1,p=0,f=t.length;p<f;p++)for(var c=t[p],d=0,y=c.length;d<y-1;d++){if(r=e,n=c[d],a=c[d+1],i=void 0,o=void 0,s=void 0,u=void 0,i=r[0]-n[0],o=r[1]-n[1],s=r[0]-a[0],u=r[1]-a[1],i*u-s*o==0&&i*s<=0&&o*u<=0)return!1;wt(e,c[d],c[d+1])&&(l=!l)}return l}function kt(e,t){for(var r=0;r<t.length;r++)if(zt(e,t[r]))return!0;return!1}function Mt(e,t,r,n){var a=e[0]-r[0],i=e[1]-r[1],o=t[0]-r[0],s=t[1]-r[1],u=n[0]-r[0],l=n[1]-r[1],p=a*l-u*i,f=o*l-u*s;return p>0&&f<0||p<0&&f>0}function St(e,t,r){for(var n=0,a=r;n<a.length;n+=1)for(var i=a[n],o=0;o<i.length-1;++o)if(s=e,u=t,l=i[o],p=i[o+1],f=void 0,c=void 0,d=void 0,y=void 0,d=[u[0]-s[0],u[1]-s[1]],y=[p[0]-l[0],p[1]-l[1]],0!=(f=y)[0]*(c=d)[1]-f[1]*c[0]&&Mt(s,u,l,p)&&Mt(l,p,s,u))return!0;var s,u,l,p,f,c,d,y;return!1}function jt(e,t){for(var r=0;r<e.length;++r)if(!zt(e[r],t))return!1;for(var n=0;n<e.length-1;++n)if(St(e[n],e[n+1],t))return!1;return!0}function qt(e,t){for(var r=0;r<t.length;r++)if(jt(e,t[r]))return!0;return!1}function Tt(e,t,r){for(var n=[],a=0;a<e.length;a++){for(var i=[],o=0;o<e[a].length;o++){var s=xt(e[a][o],r);gt(t,s),i.push(s)}n.push(i)}return n}function _t(e,t,r){for(var n=[],a=0;a<e.length;a++){var i=Tt(e[a],t,r);n.push(i)}return n}function Et(e,t,r,n){if(e[0]<r[0]||e[0]>r[2]){var a=.5*n,i=e[0]-r[0]>a?-n:r[0]-e[0]>a?n:0;0===i&&(i=e[0]-r[2]>a?-n:r[2]-e[0]>a?n:0),e[0]+=i}gt(t,e)}function Ct(e,t,r,n){var a=Math.pow(2,n.z)*vt,i=[n.x*vt,n.y*vt],o=[];if(!e)return o;for(var s=0,u=e;s<u.length;s+=1)for(var l=0,p=u[s];l<p.length;l+=1){var f=p[l],c=[f.x+i[0],f.y+i[1]];Et(c,t,r,a),o.push(c)}return o}function At(e,t,r,n){var a,i=Math.pow(2,n.z)*vt,o=[n.x*vt,n.y*vt],s=[];if(!e)return s;for(var u=0,l=e;u<l.length;u+=1){for(var p=[],f=0,c=l[u];f<c.length;f+=1){var d=c[f],y=[d.x+o[0],d.y+o[1]];gt(t,y),p.push(y)}s.push(p)}if(t[2]-t[0]<=i/2){(a=t)[0]=a[1]=1/0,a[2]=a[3]=-1/0;for(var m=0,h=s;m<h.length;m+=1)for(var v=0,g=h[m];v<g.length;v+=1){Et(g[v],t,r,i)}}return s}var It=function(e,t){this.type=je,this.geojson=e,this.geometries=t};It.parse=function(e,t){if(2!==e.length)return t.error("'within' expression requires exactly one argument, but found "+(e.length-1)+" instead.");if($e(e[1])){var r=e[1];if("FeatureCollection"===r.type)for(var n=0;n<r.features.length;++n){var a=r.features[n].geometry.type;if("Polygon"===a||"MultiPolygon"===a)return new It(r,r.features[n].geometry)}else if("Feature"===r.type){var i=r.geometry.type;if("Polygon"===i||"MultiPolygon"===i)return new It(r,r.geometry)}else if("Polygon"===r.type||"MultiPolygon"===r.type)return new It(r,r)}return t.error("'within' expression requires valid geojson object that contains polygon geometry type.")},It.prototype.evaluate=function(e){if(null!=e.geometry()&&null!=e.canonicalID()){if("Point"===e.geometryType())return function(e,t){var r=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],a=e.canonicalID();if(!a)return!1;if("Polygon"===t.type){var i=Tt(t.coordinates,n,a),o=Ct(e.geometry(),r,n,a);if(!bt(r,n))return!1;for(var s=0,u=o;s<u.length;s+=1)if(!zt(u[s],i))return!1}if("MultiPolygon"===t.type){var l=_t(t.coordinates,n,a),p=Ct(e.geometry(),r,n,a);if(!bt(r,n))return!1;for(var f=0,c=p;f<c.length;f+=1)if(!kt(c[f],l))return!1}return!0}(e,this.geometries);if("LineString"===e.geometryType())return function(e,t){var r=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],a=e.canonicalID();if(!a)return!1;if("Polygon"===t.type){var i=Tt(t.coordinates,n,a),o=At(e.geometry(),r,n,a);if(!bt(r,n))return!1;for(var s=0,u=o;s<u.length;s+=1)if(!jt(u[s],i))return!1}if("MultiPolygon"===t.type){var l=_t(t.coordinates,n,a),p=At(e.geometry(),r,n,a);if(!bt(r,n))return!1;for(var f=0,c=p;f<c.length;f+=1)if(!qt(c[f],l))return!1}return!0}(e,this.geometries)}return!1},It.prototype.eachChild=function(){},It.prototype.outputDefined=function(){return!0},It.prototype.serialize=function(){return["within",this.geojson]};var Ft=It;function Pt(e){if(e instanceof yt){if("get"===e.name&&1===e.args.length)return!1;if("feature-state"===e.name)return!1;if("has"===e.name&&1===e.args.length)return!1;if("properties"===e.name||"geometry-type"===e.name||"id"===e.name)return!1;if(/^filter-/.test(e.name))return!1}if(e instanceof Ft)return!1;var t=!0;return e.eachChild((function(e){t&&!Pt(e)&&(t=!1)})),t}function Dt(e){if(e instanceof yt&&"feature-state"===e.name)return!1;var t=!0;return e.eachChild((function(e){t&&!Dt(e)&&(t=!1)})),t}function Ot(e,t){if(e instanceof yt&&t.indexOf(e.name)>=0)return!1;var r=!0;return e.eachChild((function(e){r&&!Ot(e,t)&&(r=!1)})),r}var Lt=function(e,t){this.type=t.type,this.name=e,this.boundExpression=t};Lt.parse=function(e,t){if(2!==e.length||"string"!=typeof e[1])return t.error("'var' expression requires exactly one string literal argument.");var r=e[1];return t.scope.has(r)?new Lt(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)},Lt.prototype.evaluate=function(e){return this.boundExpression.evaluate(e)},Lt.prototype.eachChild=function(){},Lt.prototype.outputDefined=function(){return!1},Lt.prototype.serialize=function(){return["var",this.name]};var Rt=Lt,Nt=function(e,t,r,n,a){void 0===t&&(t=[]),void 0===n&&(n=new ze),void 0===a&&(a=[]),this.registry=e,this.path=t,this.key=t.map((function(e){return"["+e+"]"})).join(""),this.scope=n,this.errors=a,this.expectedType=r};Nt.prototype.parse=function(e,t,r,n,a){return void 0===a&&(a={}),t?this.concat(t,r,n)._parse(e,a):this._parse(e,a)},Nt.prototype._parse=function(e,t){function r(e,t,r){return"assert"===r?new rt(t,[e]):"coerce"===r?new lt(t,[e]):e}if(null!==e&&"string"!=typeof e&&"boolean"!=typeof e&&"number"!=typeof e||(e=["literal",e]),Array.isArray(e)){if(0===e.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');var n=e[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 a=this.registry[n];if(a){var i=a.parse(e,this);if(!i)return null;if(this.expectedType){var o=this.expectedType,s=i.type;if("string"!==o.kind&&"number"!==o.kind&&"boolean"!==o.kind&&"object"!==o.kind&&"array"!==o.kind||"value"!==s.kind)if("color"!==o.kind&&"formatted"!==o.kind&&"resolvedImage"!==o.kind||"value"!==s.kind&&"string"!==s.kind){if(this.checkSubtype(o,s))return null}else i=r(i,o,t.typeAnnotation||"coerce");else i=r(i,o,t.typeAnnotation||"assert")}if(!(i instanceof Ye)&&"resolvedImage"!==i.type.kind&&Vt(i)){var u=new ct;try{i=new Ye(i.type,i.evaluate(u))}catch(e){return this.error(e.message),null}}return i}return this.error('Unknown expression "'+n+'". If you wanted a literal array, use ["literal", [...]].',0)}return void 0===e?this.error("'undefined' value invalid. Use null instead."):"object"==typeof e?this.error('Bare objects invalid. Use ["literal", {...}] instead.'):this.error("Expected an array, but found "+typeof e+" instead.")},Nt.prototype.concat=function(e,t,r){var n="number"==typeof e?this.path.concat(e):this.path,a=r?this.scope.concat(r):this.scope;return new Nt(this.registry,n,t||null,a,this.errors)},Nt.prototype.error=function(e){for(var t=[],r=arguments.length-1;r-- >0;)t[r]=arguments[r+1];var n=""+this.key+t.map((function(e){return"["+e+"]"})).join("");this.errors.push(new xe(n,e))},Nt.prototype.checkSubtype=function(e,t){var r=De(e,t);return r&&this.error(r),r};var Ut=Nt;function Vt(e){if(e instanceof Rt)return Vt(e.boundExpression);if(e instanceof yt&&"error"===e.name)return!1;if(e instanceof ht)return!1;if(e instanceof Ft)return!1;var t=e instanceof lt||e instanceof rt,r=!0;return e.eachChild((function(e){r=t?r&&Vt(e):r&&e instanceof Ye})),!!r&&(Pt(e)&&Ot(e,["zoom","heatmap-density","line-progress","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center"]))}function Gt(e,t){for(var r,n,a=e.length-1,i=0,o=a,s=0;i<=o;)if(r=e[s=Math.floor((i+o)/2)],n=e[s+1],r<=t){if(s===a||t<n)return s;i=s+1}else{if(!(r>t))throw new Qe("Input is not a number.");o=s-1}return 0}var Jt=function(e,t,r){this.type=e,this.input=t,this.labels=[],this.outputs=[];for(var n=0,a=r;n<a.length;n+=1){var i=a[n],o=i[0],s=i[1];this.labels.push(o),this.outputs.push(s)}};Jt.parse=function(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.");var r=t.parse(e[1],1,Me);if(!r)return null;var n=[],a=null;t.expectedType&&"value"!==t.expectedType.kind&&(a=t.expectedType);for(var i=1;i<e.length;i+=2){var o=1===i?-1/0:e[i],s=e[i+1],u=i,l=i+1;if("number"!=typeof o)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(n.length&&n[n.length-1][0]>=o)return t.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',u);var p=t.parse(s,l,a);if(!p)return null;a=a||p.type,n.push([o,p])}return new Jt(a,r,n)},Jt.prototype.evaluate=function(e){var t=this.labels,r=this.outputs;if(1===t.length)return r[0].evaluate(e);var n=this.input.evaluate(e);if(n<=t[0])return r[0].evaluate(e);var a=t.length;return n>=t[a-1]?r[a-1].evaluate(e):r[Gt(t,n)].evaluate(e)},Jt.prototype.eachChild=function(e){e(this.input);for(var t=0,r=this.outputs;t<r.length;t+=1){e(r[t])}},Jt.prototype.outputDefined=function(){return this.outputs.every((function(e){return e.outputDefined()}))},Jt.prototype.serialize=function(){for(var e=["step",this.input.serialize()],t=0;t<this.labels.length;t++)t>0&&e.push(this.labels[t]),e.push(this.outputs[t].serialize());return e};var Wt=Jt,Zt=$t;function $t(e,t,r,n){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*(n-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=n,this.p2x=r,this.p2y=n}$t.prototype.sampleCurveX=function(e){return((this.ax*e+this.bx)*e+this.cx)*e},$t.prototype.sampleCurveY=function(e){return((this.ay*e+this.by)*e+this.cy)*e},$t.prototype.sampleCurveDerivativeX=function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},$t.prototype.solveCurveX=function(e,t){var r,n,a,i,o;for(void 0===t&&(t=1e-6),a=e,o=0;o<8;o++){if(i=this.sampleCurveX(a)-e,Math.abs(i)<t)return a;var s=this.sampleCurveDerivativeX(a);if(Math.abs(s)<1e-6)break;a-=i/s}if((a=e)<(r=0))return r;if(a>(n=1))return n;for(;r<n;){if(i=this.sampleCurveX(a),Math.abs(i-e)<t)return a;e>i?r=a:n=a,a=.5*(n-r)+r}return a},$t.prototype.solve=function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))};var Bt=te(Zt);function Xt(e,t,r){return e*(1-r)+t*r}var Ht=Object.freeze({__proto__:null,number:Xt,color:function(e,t,r){return new pe(Xt(e.r,t.r,r),Xt(e.g,t.g,r),Xt(e.b,t.b,r),Xt(e.a,t.a,r))},array:function(e,t,r){return e.map((function(e,n){return Xt(e,t[n],r)}))}}),Yt=.95047,Kt=1,Qt=1.08883,er=4/29,tr=6/29,rr=3*tr*tr,nr=tr*tr*tr,ar=Math.PI/180,ir=180/Math.PI;function or(e){return e>nr?Math.pow(e,1/3):e/rr+er}function sr(e){return e>tr?e*e*e:rr*(e-er)}function ur(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function lr(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function pr(e){var t=lr(e.r),r=lr(e.g),n=lr(e.b),a=or((.4124564*t+.3575761*r+.1804375*n)/Yt),i=or((.2126729*t+.7151522*r+.072175*n)/Kt);return{l:116*i-16,a:500*(a-i),b:200*(i-or((.0193339*t+.119192*r+.9503041*n)/Qt)),alpha:e.a}}function fr(e){var t=(e.l+16)/116,r=isNaN(e.a)?t:t+e.a/500,n=isNaN(e.b)?t:t-e.b/200;return t=Kt*sr(t),r=Yt*sr(r),n=Qt*sr(n),new pe(ur(3.2404542*r-1.5371385*t-.4985314*n),ur(-.969266*r+1.8760108*t+.041556*n),ur(.0556434*r-.2040259*t+1.0572252*n),e.alpha)}function cr(e,t,r){var n=t-e;return e+r*(n>180||n<-180?n-360*Math.round(n/360):n)}var dr={forward:pr,reverse:fr,interpolate:function(e,t,r){return{l:Xt(e.l,t.l,r),a:Xt(e.a,t.a,r),b:Xt(e.b,t.b,r),alpha:Xt(e.alpha,t.alpha,r)}}},yr={forward:function(e){var t=pr(e),r=t.l,n=t.a,a=t.b,i=Math.atan2(a,n)*ir;return{h:i<0?i+360:i,c:Math.sqrt(n*n+a*a),l:r,alpha:e.a}},reverse:function(e){var t=e.h*ar,r=e.c;return fr({l:e.l,a:Math.cos(t)*r,b:Math.sin(t)*r,alpha:e.alpha})},interpolate:function(e,t,r){return{h:cr(e.h,t.h,r),c:Xt(e.c,t.c,r),l:Xt(e.l,t.l,r),alpha:Xt(e.alpha,t.alpha,r)}}},mr=function(e,t,r,n,a){this.type=e,this.operator=t,this.interpolation=r,this.input=n,this.labels=[],this.outputs=[];for(var i=0,o=a;i<o.length;i+=1){var s=o[i],u=s[0],l=s[1];this.labels.push(u),this.outputs.push(l)}};function hr(e,t,r,n){var a=n-r,i=e-r;return 0===a?0:1===t?i/a:(Math.pow(t,i)-1)/(Math.pow(t,a)-1)}mr.interpolationFactor=function(e,t,r,n){var a=0;if("exponential"===e.name)a=hr(t,e.base,r,n);else if("linear"===e.name)a=hr(t,1,r,n);else if("cubic-bezier"===e.name){var i=e.controlPoints;a=new Bt(i[0],i[1],i[2],i[3]).solve(hr(t,1,r,n))}return a},mr.parse=function(e,t){var r=e[0],n=e[1],a=e[2],i=e.slice(3);if(!Array.isArray(n)||0===n.length)return t.error("Expected an interpolation type expression.",1);if("linear"===n[0])n={name:"linear"};else if("exponential"===n[0]){var o=n[1];if("number"!=typeof o)return t.error("Exponential interpolation requires a numeric base.",1,1);n={name:"exponential",base:o}}else{if("cubic-bezier"!==n[0])return t.error("Unknown interpolation type "+String(n[0]),1,0);var s=n.slice(1);if(4!==s.length||s.some((function(e){return"number"!=typeof e||e<0||e>1})))return t.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);n={name:"cubic-bezier",controlPoints:s}}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(!(a=t.parse(a,2,Me)))return null;var u=[],l=null;"interpolate-hcl"===r||"interpolate-lab"===r?l=qe:t.expectedType&&"value"!==t.expectedType.kind&&(l=t.expectedType);for(var p=0;p<i.length;p+=2){var f=i[p],c=i[p+1],d=p+3,y=p+4;if("number"!=typeof f)return t.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',d);if(u.length&&u[u.length-1][0]>=f)return t.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',d);var m=t.parse(c,y,l);if(!m)return null;l=l||m.type,u.push([f,m])}return"number"===l.kind||"color"===l.kind||"array"===l.kind&&"number"===l.itemType.kind&&"number"==typeof l.N?new mr(l,r,n,a,u):t.error("Type "+Fe(l)+" is not interpolatable.")},mr.prototype.evaluate=function(e){var t=this.labels,r=this.outputs;if(1===t.length)return r[0].evaluate(e);var n=this.input.evaluate(e);if(n<=t[0])return r[0].evaluate(e);var a=t.length;if(n>=t[a-1])return r[a-1].evaluate(e);var i=Gt(t,n),o=t[i],s=t[i+1],u=mr.interpolationFactor(this.interpolation,n,o,s),l=r[i].evaluate(e),p=r[i+1].evaluate(e);return"interpolate"===this.operator?Ht[this.type.kind.toLowerCase()](l,p,u):"interpolate-hcl"===this.operator?yr.reverse(yr.interpolate(yr.forward(l),yr.forward(p),u)):dr.reverse(dr.interpolate(dr.forward(l),dr.forward(p),u))},mr.prototype.eachChild=function(e){e(this.input);for(var t=0,r=this.outputs;t<r.length;t+=1){e(r[t])}},mr.prototype.outputDefined=function(){return this.outputs.every((function(e){return e.outputDefined()}))},mr.prototype.serialize=function(){var e;e="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 t=[this.operator,e,this.input.serialize()],r=0;r<this.labels.length;r++)t.push(this.labels[r],this.outputs[r].serialize());return t};var vr=mr,gr=function(e,t){this.type=e,this.args=t};gr.parse=function(e,t){if(e.length<2)return t.error("Expectected at least one argument.");var r=null,n=t.expectedType;n&&"value"!==n.kind&&(r=n);for(var a=[],i=0,o=e.slice(1);i<o.length;i+=1){var s=o[i],u=t.parse(s,1+a.length,r,void 0,{typeAnnotation:"omit"});if(!u)return null;r=r||u.type,a.push(u)}var l=n&&a.some((function(e){return De(n,e.type)}));return new gr(l?_e:r,a)},gr.prototype.evaluate=function(e){for(var t,r=null,n=0,a=0,i=this.args;a<i.length;a+=1){if(n++,(r=i[a].evaluate(e))&&r instanceof We&&!r.available&&(t||(t=r),r=null,n===this.args.length))return t;if(null!==r)break}return r},gr.prototype.eachChild=function(e){this.args.forEach(e)},gr.prototype.outputDefined=function(){return this.args.every((function(e){return e.outputDefined()}))},gr.prototype.serialize=function(){var e=["coalesce"];return this.eachChild((function(t){e.push(t.serialize())})),e};var br=gr,xr=function(e,t){this.type=t.type,this.bindings=[].concat(e),this.result=t};xr.prototype.evaluate=function(e){return this.result.evaluate(e)},xr.prototype.eachChild=function(e){for(var t=0,r=this.bindings;t<r.length;t+=1){e(r[t][1])}e(this.result)},xr.parse=function(e,t){if(e.length<4)return t.error("Expected at least 3 arguments, but found "+(e.length-1)+" instead.");for(var r=[],n=1;n<e.length-1;n+=2){var a=e[n];if("string"!=typeof a)return t.error("Expected string, but found "+typeof a+" instead.",n);if(/[^a-zA-Z0-9_]/.test(a))return t.error("Variable names must contain only alphanumeric characters or '_'.",n);var i=t.parse(e[n+1],n+1);if(!i)return null;r.push([a,i])}var o=t.parse(e[e.length-1],e.length-1,t.expectedType,r);return o?new xr(r,o):null},xr.prototype.outputDefined=function(){return this.result.outputDefined()},xr.prototype.serialize=function(){for(var e=["let"],t=0,r=this.bindings;t<r.length;t+=1){var n=r[t],a=n[0],i=n[1];e.push(a,i.serialize())}return e.push(this.result.serialize()),e};var wr=xr,zr=function(e,t,r){this.type=e,this.index=t,this.input=r};zr.parse=function(e,t){if(3!==e.length)return t.error("Expected 2 arguments, but found "+(e.length-1)+" instead.");var r=t.parse(e[1],1,Me),n=t.parse(e[2],2,Ie(t.expectedType||_e));if(!r||!n)return null;var a=n.type;return new zr(a.itemType,r,n)},zr.prototype.evaluate=function(e){var t=this.index.evaluate(e),r=this.input.evaluate(e);if(t<0)throw new Qe("Array index out of bounds: "+t+" < 0.");if(t>=r.length)throw new Qe("Array index out of bounds: "+t+" > "+(r.length-1)+".");if(t!==Math.floor(t))throw new Qe("Array index must be an integer, but found "+t+" instead.");return r[t]},zr.prototype.eachChild=function(e){e(this.index),e(this.input)},zr.prototype.outputDefined=function(){return!1},zr.prototype.serialize=function(){return["at",this.index.serialize(),this.input.serialize()]};var kr=zr,Mr=function(e,t){this.type=je,this.needle=e,this.haystack=t};Mr.parse=function(e,t){if(3!==e.length)return t.error("Expected 2 arguments, but found "+(e.length-1)+" instead.");var r=t.parse(e[1],1,_e),n=t.parse(e[2],2,_e);return r&&n?Oe(r.type,[je,Se,Me,ke,_e])?new Mr(r,n):t.error("Expected first argument to be of type boolean, string, number or null, but found "+Fe(r.type)+" instead"):null},Mr.prototype.evaluate=function(e){var t=this.needle.evaluate(e),r=this.haystack.evaluate(e);if(null==r)return!1;if(!Le(t,["boolean","string","number","null"]))throw new Qe("Expected first argument to be of type boolean, string, number or null, but found "+Fe(Be(t))+" instead.");if(!Le(r,["string","array"]))throw new Qe("Expected second argument to be of type array or string, but found "+Fe(Be(r))+" instead.");return r.indexOf(t)>=0},Mr.prototype.eachChild=function(e){e(this.needle),e(this.haystack)},Mr.prototype.outputDefined=function(){return!0},Mr.prototype.serialize=function(){return["in",this.needle.serialize(),this.haystack.serialize()]};var Sr=Mr,jr=function(e,t,r){this.type=Me,this.needle=e,this.haystack=t,this.fromIndex=r};jr.parse=function(e,t){if(e.length<=2||e.length>=5)return t.error("Expected 3 or 4 arguments, but found "+(e.length-1)+" instead.");var r=t.parse(e[1],1,_e),n=t.parse(e[2],2,_e);if(!r||!n)return null;if(!Oe(r.type,[je,Se,Me,ke,_e]))return t.error("Expected first argument to be of type boolean, string, number or null, but found "+Fe(r.type)+" instead");if(4===e.length){var a=t.parse(e[3],3,Me);return a?new jr(r,n,a):null}return new jr(r,n)},jr.prototype.evaluate=function(e){var t=this.needle.evaluate(e),r=this.haystack.evaluate(e);if(!Le(t,["boolean","string","number","null"]))throw new Qe("Expected first argument to be of type boolean, string, number or null, but found "+Fe(Be(t))+" instead.");if(!Le(r,["string","array"]))throw new Qe("Expected second argument to be of type array or string, but found "+Fe(Be(r))+" instead.");if(this.fromIndex){var n=this.fromIndex.evaluate(e);return r.indexOf(t,n)}return r.indexOf(t)},jr.prototype.eachChild=function(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)},jr.prototype.outputDefined=function(){return!1},jr.prototype.serialize=function(){if(null!=this.fromIndex&&void 0!==this.fromIndex){var e=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),e]}return["index-of",this.needle.serialize(),this.haystack.serialize()]};var qr=jr,Tr=function(e,t,r,n,a,i){this.inputType=e,this.type=t,this.input=r,this.cases=n,this.outputs=a,this.otherwise=i};Tr.parse=function(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.");var r,n;t.expectedType&&"value"!==t.expectedType.kind&&(n=t.expectedType);for(var a={},i=[],o=2;o<e.length-1;o+=2){var s=e[o],u=e[o+1];Array.isArray(s)||(s=[s]);var l=t.concat(o);if(0===s.length)return l.error("Expected at least one branch label.");for(var p=0,f=s;p<f.length;p+=1){var c=f[p];if("number"!=typeof c&&"string"!=typeof c)return l.error("Branch labels must be numbers or strings.");if("number"==typeof c&&Math.abs(c)>Number.MAX_SAFE_INTEGER)return l.error("Branch labels must be integers no larger than "+Number.MAX_SAFE_INTEGER+".");if("number"==typeof c&&Math.floor(c)!==c)return l.error("Numeric branch labels must be integer values.");if(r){if(l.checkSubtype(r,Be(c)))return null}else r=Be(c);if(void 0!==a[String(c)])return l.error("Branch labels must be unique.");a[String(c)]=i.length}var d=t.parse(u,o,n);if(!d)return null;n=n||d.type,i.push(d)}var y=t.parse(e[1],1,_e);if(!y)return null;var m=t.parse(e[e.length-1],e.length-1,n);return m?"value"!==y.type.kind&&t.concat(1).checkSubtype(r,y.type)?null:new Tr(r,n,y,a,i,m):null},Tr.prototype.evaluate=function(e){var t=this.input.evaluate(e);return(Be(t)===this.inputType&&this.outputs[this.cases[t]]||this.otherwise).evaluate(e)},Tr.prototype.eachChild=function(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)},Tr.prototype.outputDefined=function(){return this.outputs.every((function(e){return e.