text: (self.webpackChunkgeonode_mapstore_client=self.webpackChunkgeonode_mapstore_client||[]).push([[1125],{11125:function(e,t,r){"use strict";var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},n.apply(this,arguments)},o=this&&this.__rest||function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r},a=this&&this.__spreadArrays||function(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;var n=Array(e),o=0;for(t=0;t<r;t++)for(var a=arguments[t],i=0,c=a.length;i<c;i++,o++)n[o]=a[i];return n};Object.defineProperty(t,"__esModule",{value:!0}),t.GeoCSSStyleParser=void 0;var i=r(31937).default,c=r(84596),l=r(1469),s=r(14293),u=r(81763),p=r(18446),f=r(85564),h=r(47037),m=r(13311),y=function(){function e(){this.title="GeoCSS Style Parser",this.warnings=[],this.getFisrtValidPesudoselector=function(e,t){return(m(t,(function(t){return!s(t[e])}))||{})[e]||{}}}return e.prototype.addWarning=function(e){this.warnings.push(e)},e.prototype.getWarnings=function(){return a(this.warnings)},e.prototype.readExpression=function(e){if(void 0===e)return null;if("string"==typeof e||e instanceof String)return e;if(!isNaN(e))return e;var t=e[0],r=e.slice(1);switch(t){case"array":return r;case"get":case"hex":case"symbol":case"url":return r[0];case"bool":return"true"===r[0];default:return e}},e.prototype.readSelectorsExpression=function(t){var r=this;if(t){var n=t[0],o=t.slice(1);switch(n){case"any":case"all":var i=e.combinationMap[n];return a([i],o.map((function(e){return r.readSelectorsExpression(e)})));case">":case"<":case">=":case"<=":case"!=":case"==":case"like":case"ilike":return[e.comparisonMap[n],this.readExpression(o[0]),this.readExpression(o[1])];case"isnull":return["==",this.readExpression(o[0]),null];default:return}}},e.prototype.getFilterFromSelectors=function(e){var t=this.readSelectorsExpression(e);if(t)return"||"!==t[0]&&"&&"!==t[0]||2!==t.length?t:t[1]},e.prototype.getScaleDenominatorFromSelectors=function(e){var t=e&&this.readExpression(e["min-scale"]),r=e&&this.readExpression(e["max-scale"]),o=!s(t)&&{min:t[2]},a=!s(r)&&{max:r[2]};return o||a?n(n({},o),a):void 0},e.prototype.getMarkSymbolizerFromGeoCSSRule=function(e){var t,r=this.readExpression(e.mark);switch(r){case"circle":case"square":case"triangle":case"star":case"cross":case"x":t=r.charAt(0).toUpperCase()+r.slice(1);break;case"shape://vertline":case"shape://horline":case"shape://slash":case"shape://backslash":case"shape://dot":case"shape://plus":case"shape://times":case"shape://oarrow":case"shape://carrow":t=r;break;default:throw new Error("MarkSymbolizer cannot be parsed. Unsupported WellKnownName.")}var o=this.readExpression(e["mark-size"]),a=this.readExpression(e["mark-rotation"]),i=this.readExpression(e["mark-opacity"]),c=e[":mark"]||{},l=i,u=this.readExpression(c["fill-opacity"]),p=this.readExpression(c.fill),f=this.readExpression(c.rotation)||a,h=this.readExpression(c.size)||o,m=this.readExpression(c.stroke),y=this.readExpression(c["stroke-width"]),g=this.readExpression(c["stroke-opacity"]),d=t&&{wellKnownName:t},v=!s(l)&&{opacity:l},S=!s(u)&&{fillOpacity:u},x=p&&{color:p},b=!s(f)&&{rotate:f},w=!s(h)&&{radius:h/2},k=m&&{strokeColor:m},E=!s(y)&&{strokeWidth:y},C=!s(g)&&{strokeOpacity:g};return n(n(n(n(n(n(n(n(n({kind:"Mark"},d),v),S),x),b),w),k),E),C)},e.prototype.getIconSymbolizerFromGeoCSSRule=function(e){var t=this.readExpression(e.mark),r=this.readExpression(e["mark-size"]),o=this.readExpression(e["mark-rotation"]),a=this.readExpression(e["mark-opacity"]),i=t&&{image:t},c=!s(a)&&{opacity:a},l=!s(o)&&{rotate:o},u=!s(r)&&{size:r};return n(n(n(n({kind:"Icon"},i),c),l),u)},e.prototype.getPointSymbolizerFromGeoCSSRule=function(e){return"url"===e.mark[0]?this.getIconSymbolizerFromGeoCSSRule(e):this.getMarkSymbolizerFromGeoCSSRule(e)},e.prototype.getLineSymbolizerFromGeoCSSRule=function(e){var t=this.readExpression(e.stroke),r=this.readExpression(e["stroke-width"]),o=this.readExpression(e["stroke-opacity"]),a=this.readExpression(e["stroke-linejoin"]),i=this.readExpression(e["stroke-linecap"]),c=this.readExpression(e["stroke-dasharray"]),l=this.readExpression(e["stroke-dashoffset"]),u=this.readExpression(e["stroke-offset"]),p="symbol"===e.stroke[0]||"url"===e.stroke[0]?this.getPointSymbolizerFromGeoCSSRule({mark:e.stroke,"mark-size":e["stroke-size"],"mark-rotation":e["stroke-rotation"],":mark":e[":stroke"]}):void 0,f=!p&&t&&{color:t},h=p&&{graphicStroke:p},m=!s(r)&&{width:r},y=!s(o)&&{opacity:o},g=a&&{join:a},d=i&&{cap:i},v=c&&{dasharray:c},S=l&&{dashOffset:l},x=!s(u)&&{perpendicularOffset:u};return n(n(n(n(n(n(n(n(n({kind:"Line"},f),h),m),y),g),d),v),S),x)},e.prototype.getFillSymbolizerFromGeoCSSRule=function(e){var t=this.readExpression(e.fill),r=this.readExpression(e["fill-opacity"]),o=this.readExpression(e.stroke),a=this.readExpression(e["stroke-width"]),i=this.readExpression(e["stroke-opacity"]),c=this.readExpression(e["stroke-dasharray"]),l="symbol"===e.fill[0]||"url"===e.fill[0]?this.getPointSymbolizerFromGeoCSSRule({mark:e.fill,"mark-size":e["fill-size"],"mark-rotation":e["fill-rotation"],":mark":e[":fill"]}):void 0,u=!l&&t&&{color:t},p=l&&{graphicFill:l},f=!t&&{opacity:0},h=!s(r)&&{fillOpacity:r},m=o&&{outlineColor:o},y=!s(a)&&{outlineWidth:a},g=!s(i)&&{outlineOpacity:i},d=c&&{outlineDasharray:c};return n(n(n(n(n(n(n(n({kind:"Fill"},u),p),f),h),m),y),g),d)},e.prototype.getTextSymbolizerLabelFromGeoCSSProperty=function(e){var t=function e(t){if(void 0===t)return null;if("string"==typeof t||t instanceof String)return t;if(!isNaN(t))return t;var r=t[0],n=t.slice(1);switch(r){case"text":return n.map((function(t){return e(t)}));case"brace":return e(n[0]);case"get":return"{{"+n[0]+"}}";default:return t}}(e);return l(t)?t.join(""):t},e.prototype.getTextSymbolizerFromGeoCSSRule=function(e){var t=this.getTextSymbolizerLabelFromGeoCSSProperty(e.label),r=this.readExpression(e["font-fill"]),o=this.readExpression(e["halo-radius"]),a=this.readExpression(e["halo-color"]),i=this.readExpression(e["label-offset"]),l=this.readExpression(e["label-rotation"]),u=this.readExpression(e["font-family"]),p=this.readExpression(e["font-style"]),f=this.readExpression(e["font-weight"]),h=this.readExpression(e["font-size"]),m=t&&{label:t},y=r&&{color:r},g=!s(o)&&{haloWidth:o},d=a&&{haloColor:a},v=i&&{offset:i},S=!s(l)&&{rotate:l},x=u&&{font:c(u)},b=p&&{fontStyle:p},w=f&&{fontWeight:f},k=!s(h)&&{size:h};return n(n(n(n(n(n(n(n(n(n({kind:"Text"},m),y),g),d),v),S),x),b),w),k)},e.prototype.getColorMapFromGeoCSSProperty=function(e){var t=this,r=e["raster-color-map"]&&this.readExpression(e["raster-color-map"]).map((function(e){var r=t.readExpression(e[1]),n=t.readExpression(e[2]),o=t.readExpression(e[3]);return{color:r,quantity:n,label:t.readExpression(e[4]),opacity:o}}));if(r&&0!==r.length){var o=this.readExpression(e["raster-color-map-type"]);return n({type:o||"ramp"},r&&{colorMapEntries:r})}},e.prototype.getContrastEnhancementFromGeoCSSPropertyContrastEnhancement=function(e,t){var r=this.readExpression(e["raster-contrast-enhancement"]),o=this.readExpression(e["raster-gamma"]);if(void 0!==t){var a=c(r),i=c(o);if(3!==a.length&&1!==a.length||3!==i.length&&1!==i.length)throw new Error("\n          optional raster-contrast-enhancement and raster-gamma properties\n          should use one or three values separated by space\n          eg:\n\n          raster-channels: 0 1 2; /* rgb */\n          raster-contrast-enhancement: nomalize nomalize nomalize;\n          raster-gamma: 0.5 0.5 0.5;\n\n          /* or */\n\n          raster-channels: 0 1 2; /* rgb */\n          raster-contrast-enhancement: nomalize;\n          raster-gamma: 0.5;\n\n        ");var u=a[0],p=i[0];void 0!==u&&void 0===a[t]&&this.addWarning("Used first value of raster-contrast-enhancement for all rgb channel"),void 0!==p&&void 0===i[t]&&this.addWarning("Used first value of raster-gamma for all rgb channel");var f=a[t]||u,h=s(i[t])?p:i[t],m=f&&{enhancementType:this.readExpression(f)},y=!s(h)&&{gammaValue:this.readExpression(h)};return n(n({},m),y)}if(l(r)||l(o))throw new Error("\n          optional raster-contrast-enhancement and raster-gamma properties\n          should use one value when used with gray channel\n          eg:\n\n          raster-channels: 0; /* gray */\n          raster-contrast-enhancement: nomalize;\n          raster-gamma: 0.5;\n\n      ");var g=this.readExpression(r),d=this.readExpression(o);if(!s(g)||!s(d)){var v=g&&{enhancementType:g},S=!s(d)&&{gammaValue:d};return n(n({},v),S)}},e.prototype.getChannelFromGeoCSSChannel=function(e,t,r){var o=this.getContrastEnhancementFromGeoCSSPropertyContrastEnhancement(t,r);return n({sourceChannelName:e+""},o&&{contrastEnhancement:o})},e.prototype.getChannelSelectionFromGeoCSSPropertyChannelSelection=function(e){var t=this.readExpression(e["raster-channels"]);if("auto"!==t){if(l(t)&&3===t.length){var r=t[0],n=t[1],o=t[2];return{redChannel:this.getChannelFromGeoCSSChannel(r,e,0),greenChannel:this.getChannelFromGeoCSSChannel(n,e,1),blueChannel:this.getChannelFromGeoCSSChannel(o,e,2)}}if(u(t)||h(t))return{grayChannel:this.getChannelFromGeoCSSChannel(t,e)};throw new Error("\n      Cannot parse raster-channels. It does not match the auto, gray or rgb structure\n      eg:\n\n      raster-channels: auto;\n      raster-channels: 0; /* gray */\n      raster-channels: 7 2 4; /* rgb */\n\n    ")}},e.prototype.getRasterSymbolizerFromGeoCSSRule=function(e){var t=this.readExpression(e["raster-opacity"]),r=this.getColorMapFromGeoCSSProperty(e),o=this.getChannelSelectionFromGeoCSSPropertyChannelSelection(e),a=!o&&this.getContrastEnhancementFromGeoCSSPropertyContrastEnhancement(e),i=!s(t)&&{opacity:t},c=r&&{colorMap:r},l=o&&{channelSelection:o},u=a&&{contrastEnhancement:a};return n(n(n(n({kind:"Raster"},i),c),l),u)},e.prototype.getSymbolizerTypesFromProperties=function(e){var t=[];return e.mark?t.push("point"):!e.stroke||"none"!==e.fill&&e.fill?e.fill&&"none"!==e.fill?t.push("polygon"):void 0!==e["raster-channels"]&&t.push("raster"):t.push("line"),e.label&&t.push("text"),t},e.prototype.getSymbolizersFromRules=function(e){var t=this;return c(e).reduce((function(e,r){var n=t.getSymbolizerTypesFromProperties(r);return a(e,n.reduce((function(e,n){return"point"===n?a(e,[t.getPointSymbolizerFromGeoCSSRule(r)]):"line"===n?a(e,[t.getLineSymbolizerFromGeoCSSRule(r)]):"polygon"===n?a(e,[t.getFillSymbolizerFromGeoCSSRule(r)]):"text"===n?a(e,[t.getTextSymbolizerFromGeoCSSRule(r)]):"raster"===n?a(e,[t.getRasterSymbolizerFromGeoCSSRule(r)]):a(e)}),[]))}),[]).reduce((function(e,t){var r=!!e.find((function(e){return p(e,t)}));return a(e,r?[]:[t])}),[])},e.prototype.getRulesFromGeoCSSSelectors=function(e){for(var t=this,r=[],i=0;i<e.length;i++){var c=e[i],s=r[r.length-1]||{},u=s.group;void 0!==u&&u===c.group?r[r.length-1]=n(n({},s),{properties:a(l(s.properties)?s.properties:[s.properties],[c.properties])}):r.push(c)}return r.map((function(e){var r=e.title,a=void 0===r?"":r,i=e.selector,c=e.properties,l=o(e,["title","selector","properties"]),s=t.getFilterFromSelectors(i),u=t.getScaleDenominatorFromSelectors(l),p=t.getSymbolizersFromRules(c),f=u&&{scaleDenominator:u},h=p&&{symbolizers:p};return n(n(n({name:a},s&&{filter:s}),f),h)}))},e.prototype.geoCSSObjectToGeoStylerStyle=function(e){var t=e.directive,r=void 0===t?{}:t,n=e.rules;return"Flat"!==r["@mode"]&&this.addWarning("Supported only 'Flat' mode, other directive will be translated as flat GeoCSS"),{name:r["@styleTitle"]||"",rules:this.getRulesFromGeoCSSSelectors(n)}},e.prototype.readStyle=function(e){var t=this;return this.warnings=[],new Promise((function(r,n){try{var o=i.read(e);r(t.geoCSSObjectToGeoStylerStyle(o))}catch(e){n(e)}}))},e.prototype.writeStyle=function(e){var t=this;return this.warnings=[],new Promise((function(r,n){try{var o=t.geoStylerStyleToGeoCSSObject(e);r(i.write(o))}catch(e){n(e)}}))},e.prototype.geoStylerStyleToGeoCSSObject=function(e){var t=this.getGeoCSSRulesFromRules(e.rules);return{directive:{"@mode":"Flat","@styleTitle":e.name},rules:t}},e.prototype.getGeoCSSRulesFromRules=function(e){var t=this;return f(e.map((function(e,r){var o=e.name,i=t.getSelectorsFromFilter(e.filter),c=o&&{title:o},l=e.scaleDenominator||{},p=l.min,f=l.max,h=!(!u(p)&&!u(f)),m=u(p)&&{"min-scale":[">",["get","@sd"],p]},y=u(f)&&{"max-scale":["<",["get","@sd"],f]},g=t.getGeoCSSPropertiesFromSymbolizers(e.symbolizers),d=g.reduce((function(e,t){return a(e,Object.keys(t))}),[]);return g.map((function(e){return n(n(n(n({selector:h&&"*"===i?["any",["all"]]:i},c),m),y),{properties:d.reduce((function(r,o){var a;return n(n({},r),((a={})[o]=s(e[o])?":"===o[0]?t.getFisrtValidPesudoselector(o,g):void 0:e[o],a))}),{}),group:r})}))})))},e.prototype.readFilterExpression=function(e){var t=this;if(e){var r=e[0],n=e.slice(1);switch(r){case"||":case"&&":return a([{"||":"any","&&":"all"}[r]],n.map((function(e){return t.readFilterExpression(e)})));case">":case"<":case">=":case"<=":case"!=":case"==":case"*=":return"=="===r&&null===n[1]?["isnull",["get",n[0]]]:[{"==":"==",">":">",">=":">=","<":"<","<=":"<=","!=":"!=","*=":"like"}[r],["get",n[0]],n[1]];default:return}}},e.prototype.getSelectorsFromFilter=function(e){return e?this.readFilterExpression(e):"*"},e.prototype.getGeoCSSPropertiesFromSymbolizers=function(e){var t=this;return e.map((function(e){switch(e.kind){case"Mark":return t.getGeoCSSPropertiesFromMarkSymbolizer(e);case"Icon":return t.getGeoCSSPropertiesFromIconSymbolizer(e);case"Text":return t.getGeoCSSPropertiesFromTextSymbolizer(e);case"Line":return t.getGeoCSSPropertiesFromLineSymbolizer(e);case"Fill":return t.getGeoCSSPropertiesFromFillSymbolizer(e);case"Raster":return t.getGeoCSSPropertiesFromRasterSymbolizer(e);default:return null}})).filter((function(e){return e}))},e.prototype.getGeoCSSPropertiesFromMarkSymbolizer=function(e,t){var r,o,a,i;void 0===t&&(t="mark");var c=e.wellKnownName&&["symbol",e.wellKnownName.toLowerCase()],l=e.opacity,u=void 0!==e.radius&&2*e.radius,p=e.rotate,f=e.color&&["hex",e.color],h=e.fillOpacity,m=e.strokeColor&&["hex",e.strokeColor],y=e.strokeWidth,g=e.strokeOpacity,d=f||m,v=c&&((r={})[t]=c,r),S="mark"===t&&!s(l)&&{"mark-opacity":l},x=!d&&!1!==u&&!s(u)&&((o={})[t+"-size"]=u,o),b=!d&&!s(p)&&((a={})[t+"-rotation"]=p,a),w=f&&{fill:f},k=h&&{"fill-opacity":h},E=m&&{stroke:m},C=y&&{"stroke-width":y},R=g&&{"stroke-opacity":g},F=!1!==u&&!s(u)&&{size:u},O=!s(p)&&{rotation:p},j=d&&((i={})[":"+t]=n(n(n(n(n(n(n({},w),k),E),C),R),F),O),i);return n(n(n(n(n({},v),S),x),b),j)},e.prototype.getGeoCSSPropertiesFromIconSymbolizer=function(e,t){var r,o,a,i;void 0===t&&(t="mark");var c=e.image&&["url",e.image],l=e.opacity,u=e.size,p=e.rotate,f=c&&((r={})[t]=c,r),h="mark"===t&&!s(l)&&((o={})[t+"-opacity"]=l,o),m=!s(u)&&((a={})[t+"-size"]=u,a),y=!s(p)&&((i={})[t+"-rotation"]=p,i);return n(n(n(n({},f),h),m),y)},e.prototype.getGeoCSSLabelPropertyFromTextSymbolizer=function(e){if(e){var t=e.split(/(\{\{)|(\}\})/g).filter((function(e){return e}));return t.map((function(e,r){return"{{"===e||"}}"===e?null:"{{"===t[r-1]&&"}}"===t[r+1]?["brace",["get",e]]:e})).filter((function(e){return null!==e}))}},e.prototype.getGeoCSSPropertiesFromTextSymbolizer=function(e){var t=this.getGeoCSSLabelPropertyFromTextSymbolizer(e.label),r=e.font,o=e.color&&["hex",e.color],i=e.size,c=e.fontStyle,l=e.fontWeight,u=e.offset&&a(["array"],e.offset),p=e.rotate,f=e.haloWidth,h=e.haloColor&&["hex",e.haloColor],m=t&&{label:a(["text"],t)},y=r&&{"font-family":a(["array"],r)},g=o&&{"font-fill":o},d=!s(i)&&{"font-size":i},v=c&&{"font-style":["get",c]},S=l&&{"font-weight":["get",l]},x=u&&{"label-offset":u},b=!s(p)&&{"label-rotation":p},w=!s(f)&&{"halo-radius":f},k=h&&{"halo-color":h};return n(n(n(n(n(n(n(n(n(n({},m),x),b),y),g),d),v),S),w),k)},e.prototype.getGeoCSSPropertiesFromLineSymbolizer=function(e){var t=e.color&&["hex",e.color],r=e.width,o=e.opacity,i=e.join,c=e.cap,l=e.dasharray&&a(["array"],e.dasharray),u=e.dashOffset,p=e.graphicStroke?"Mark"===e.graphicStroke.kind?this.getGeoCSSPropertiesFromMarkSymbolizer(e.graphicStroke,"stroke"):"Icon"===e.graphicStroke.kind?this.getGeoCSSPropertiesFromIconSymbolizer(e.graphicStroke,"stroke"):void 0:void 0,f=!p&&t&&{stroke:t},h=!s(r)&&{"stroke-width":r},m=!s(o)&&{"stroke-opacity":o},y=i&&{"stroke-linejoin":i},g=c&&{"stroke-linecap":c},d=l&&{"stroke-dasharray":l},v=u&&{"stroke-dashoffset":u};return n(n(n(n(n(n(n(n({},f),h),m),y),g),d),v),p)},e.prototype.getGeoCSSPropertiesFromFillSymbolizer=function(e){var t=e.color&&["hex",e.color],r=e.fillOpacity,o=e.outlineColor&&["hex",e.outlineColor],i=e.outlineWidth,c=e.outlineOpacity,l=e.outlineDasharray&&a(["array"],e.outlineDasharray),u=e.graphicFill?"Mark"===e.graphicFill.kind?this.getGeoCSSPropertiesFromMarkSymbolizer(e.graphicFill,"fill"):"Icon"===e.graphicFill.kind?this.getGeoCSSPropertiesFromIconSymbolizer(e.graphicFill,"fill"):void 0:void 0,p=!u&&t&&{fill:t},f=!s(r)&&{"fill-opacity":r},h=o&&{stroke:o},m=!s(i)&&{"stroke-width":i},y=!s(c)&&{"stroke-opacity":c},g=l&&{"stroke-dasharray":l};return n(n(n(n(n(n(n({},p),f),h),m),y),g),u)},e.prototype.getGeoCSSColorMapFromColorMap=function(e){if(e){var t=e.colorMapEntries&&e.colorMapEntries.length>0&&e.colorMapEntries.map((function(e){return["color-map-entry",["hex",e.color],e.quantity,e.opacity,e.label].filter((function(e){return!s(e)}))})).filter((function(e){return e.length>1})),r=e.type&&{"raster-color-map-type":["get",e.type]},o=t&&t.length>0&&{"raster-color-map":a(["array"],t)};return n(n({},r),o)}},e.prototype.getGeoCSSChannelSelectionFromChannelSelection=function(e){var t=e&&e.redChannel,r=e&&e.greenChannel,o=e&&e.blueChannel;if(t&&r&&o){var a=t.sourceChannelName,i=r.sourceChannelName,c=o.sourceChannelName,l=t.contrastEnhancement,u=l.enhancementType,p=l.gammaValue,f=r.contrastEnhancement,h=f.enhancementType,m=f.gammaValue,y=o.contrastEnhancement,g=y.enhancementType,d=y.gammaValue,v=u&&h&&g&&{"raster-contrast-enhancement":["array",["get",u],["get",h],["get",g]]},S=!s(p)&&!s(m)&&!s(d)&&{"raster-gamma":["array",p,m,d]};return n(n({"raster-channels":["array",parseFloat(a),parseFloat(i),parseFloat(c)]},v),S)}var x=e&&e.grayChannel;if(x){var b=x.sourceChannelName,w=x.contrastEnhancement,k=w.enhancementType,E=w.gammaValue;return v=k&&{"raster-contrast-enhancement":["get",k]},S=!s(E)&&{"raster-gamma":E},n(n({"raster-channels":parseFloat(b)},v),S)}return{"raster-channels":["get","auto"]}},e.prototype.getGeoCSSPropertiesFromRasterSymbolizer=function(e){var t=!s(e.opacity)&&{"raster-opacity":e.opacity},r=this.getGeoCSSColorMapFromColorMap(e.colorMap),o=this.getGeoCSSChannelSelectionFromChannelSelection(e.channelSelection),a=e&&e.contrastEnhancement||{},i=a.enhancementType,c=a.gammaValue,l=o["raster-channels"]&&"auto"===o["raster-channels"][1],u=l&&i&&{"raster-contrast-enhancement":["get",i]},p=l&&!s(c)&&{"raster-gamma":c};return n(n(n(n(n({},o),u),p),t),r)},e.title="GeoCSS Style Parser",e.combinationMap={all:"&&",any:"||"},e.comparisonMap={"==":"==",">":">",">=":">=","<":"<","<=":"<=","!=":"!=",like:"*=",ilike:"*="},e}();t.GeoCSSStyleParser=y,t.default=y},31937:e=>{self,e.exports=(()=>{var e={271:function(e,t){var r,n;void 0===(n="function"==typeof(r=function(){"use strict";var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,r="boolean"==typeof(new RegExp).sticky;function n(e){return e&&"[object RegExp]"===t.call(e)}function o(e){return e&&"object"==typeof e&&!n(e)&&!Array.isArray(e)}function a(e){return"("+e+")"}function i(e){return e.length?"(?:"+e.map((function(e){return"(?:"+e+")"})).join("|")+")":"(?!)"}function c(e){if("string"==typeof e)return"(?:"+e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")+")";if(n(e)){if(e.ignoreCase)throw new Error("RegExp /i flag not allowed");if(e.global)throw new Error("RegExp /g flag is implied");if(e.sticky)throw new Error("RegExp /y flag is implied");if(e.multiline)throw new Error("RegExp /m flag is implied");return e.source}throw new Error("Not a pattern: "+e)}function l(t,r){if(o(r)||(r={match:r}),r.include)throw new Error("Matching rules cannot also include states");var a={defaultType:t,lineBreaks:!!r.error||!!r.fallback,pop:!1,next:null,push:null,error:!1,fallback:!1,value:null,type:null,shouldThrow:!1};for(var i in r)e.call(r,i)&&(a[i]=r[i]);if("string"==typeof a.type&&t!==a.type)throw new Error("Type transform cannot be a string (type '"+a.type+"' for token '"+t+"')");var c=a.match;return a.match=Array.isArray(c)?c:c?[c]:[],a.match.sort((function(e,t){return n(e)&&n(t)?0:n(t)?-1:n(e)?1:t.length-e.length})),a}function s(e){return Array.isArray(e)?function(e){for(var t=[],r=0;r<e.length;r++){var n=e[r];if(n.include)for(var o=[].concat(n.include),a=0;a<o.length;a++)t.push({include:o[a]});else{if(!n.type)throw new Error("Rule has no type: "+JSON.stringify(n));t.push(l(n.type,n))}}return t}(e):function(e){for(var t=Object.getOwnPropertyNames(e),r=[],n=0;n<t.length;n++){var a=t[n],i=e[a],c=[].concat(i);if("include"!==a){var s=[];c.forEach((function(e){o(e)?(s.length&&r.push(l(a,s)),r.push(l(a,e)),s=[]):s.push(e)})),s.length&&r.push(l(a,s))}else for(var u=0;u<c.length;u++)r.push({include:c[u]})}return r}(e)}var u=l("error",{lineBreaks:!0,shouldThrow:!0});function p(e,t){for(var o=null,l=Object.create(null),s=!0,p=null,f=[],h=[],m=0;m<e.length;m++)e[m].fallback&&(s=!1);for(m=0;m<e.length;m++){var y=e[m];if(y.include)throw new Error("Inheritance is not allowed in stateless lexers");if(y.error||y.fallback){if(o)throw!y.fallback==!o.fallback?new Error("Multiple "+(y.fallback?"fallback":"error")+" rules not allowed (for token '"+y.defaultType+"')"):new Error("fallback and error are mutually exclusive (for token '"+y.defaultType+"')");o=y}var g=y.match.slice();if(s)for(;g.length&&"string"==typeof g[0]&&1===g[0].length;)l[g.shift().charCodeAt(0)]=y;if(y.pop||y.push||y.next){if(!t)throw new Error("State-switching options are not allowed in stateless lexers (for token '"+y.defaultType+"')");if(y.fallback)throw new Error("State-switching options are not allowed on fallback tokens (for token '"+y.defaultType+"')")}if(0!==g.length){s=!1,f.push(y);for(var d=0;d<g.length;d++){var v=g[d];if(n(v))if(null===p)p=v.unicode;else if(p!==v.unicode&&!1===y.fallback)throw new Error("If one rule is /u then all must be")}var S=i(g.map(c)),x=new RegExp(S);if(x.test(""))throw new Error("RegExp matches empty string: "+x);if(new RegExp("|"+S).exec("").length-1>0)throw new Error("RegExp has capture groups: "+x+"\nUse (?: … ) instead");if(!y.lineBreaks&&x.test("\n"))throw new Error("Rule should declare lineBreaks: "+x);h.push(a(S))}}var b=o&&o.fallback,w=r&&!b?"ym":"gm",k=r||b?"":"|";return!0===p&&(w+="u"),{regexp:new RegExp(i(h)+k,w),groups:f,fast:l,error:o||u}}function f(e,t,r){var n=e&&(e.push||e.next);if(n&&!r[n])throw new Error("Missing state '"+n+"' (in token '"+e.defaultType+"' of state '"+t+"')");if(e&&e.pop&&1!=+e.pop)throw new Error("pop must be 1 (in token '"+e.defaultType+"' of state '"+t+"')")}var h=function(e,t){this.startState=t,this.states=e,this.buffer="",this.stack=[],this.reset()};h.prototype.reset=function(e,t){return this.buffer=e||"",this.index=0,this.line=t?t.line:1,this.col=t?t.col:1,this.queuedToken=t?t.queuedToken:null,this.queuedThrow=t?t.queuedThrow:null,this.setState(t?t.state:this.startState),this.stack=t&&t.stack?t.stack.slice():[],this},h.prototype.save=function(){return{line:this.line,col:this.col,state:this.state,stack:this.stack.slice(),queuedToken:this.queuedToken,queuedThrow:this.queuedThrow}},h.prototype.setState=function(e){if(e&&this.state!==e){this.state=e;var t=this.states[e];this.groups=t.groups,this.error=t.error,this.re=t.regexp,this.fast=t.fast}},h.prototype.popState=function(){this.setState(this.stack.pop())},h.prototype.pushState=function(e){this.stack.push(this.state),this.setState(e)};var m=r?function(e,t){return e.exec(t)}:function(e,t){var r=e.exec(t);return 0===r[0].length?null:r};function y(){return this.value}if(h.prototype._getGroup=function(e){for(var t=this.groups.length,r=0;r<t;r++)if(void 0!==e[r+1])return this.groups[r];throw new Error("Cannot find token type for matched text")},h.prototype.next=function(){var e=this.index;if(this.queuedGroup){var t=this._token(this.queuedGroup,this.queuedText,e);return this.queuedGroup=null,this.queuedText="",t}var r=this.buffer;if(e!==r.length){if(i=this.fast[r.charCodeAt(e)])return this._token(i,r.charAt(e),e);var n=this.re;n.lastIndex=e;var o=m(n,r),a=this.error;if(null==o)return this._token(a,r.slice(e,r.length),e);var i=this._getGroup(o),c=o[0];return a.fallback&&o.index!==e?(this.queuedGroup=i,this.queuedText=c,this._token(a,r.slice(e,o.index),e)):this._token(i,c,e)}},h.prototype._token=function(e,t,r){var n=0;if(e.lineBreaks){var o=/\n/g,a=1;if("\n"===t)n=1;else for(;o.exec(t);)n++,a=o.lastIndex}var i={type:"function"==typeof e.type&&e.type(t)||e.defaultType,value:"function"==typeof e.value?e.value(t):t,text:t,toString:y,offset:r,lineBreaks:n,line:this.line,col:this.col},c=t.length;if(this.index+=c,this.line+=n,0!==n?this.col=c-a+1:this.col+=c,e.shouldThrow)throw new Error(this.formatError(i,"invalid syntax"));return e.pop?this.popState():e.push?this.pushState(e.push):e.next&&this.setState(e.next),i},"undefined"!=typeof Symbol&&Symbol.iterator){var g=function(e){this.lexer=e};g.prototype.next=function(){var e=this.lexer.next();return{value:e,done:!e}},g.prototype[Symbol.iterator]=function(){return this},h.prototype[Symbol.iterator]=function(){return new g(this)}}return h.prototype.formatError=function(e,t){if(null==e){var r=this.buffer.slice(this.index);e={text:r,offset:this.index,lineBreaks:-1===r.indexOf("\n")?0:1,line:this.line,col:this.col}}var n=Math.max(0,e.offset-e.col+1),o=e.lineBreaks?e.text.indexOf("\n"):e.text.length,a=this.buffer.substring(n,e.offset+o);return t+=" at line "+e.line+" col "+e.col+":\n\n",(t+="  "+a+"\n")+"  "+Array(e.col).join(" ")+"^"},h.prototype.clone=function(){return new h(this.states,this.state)},h.prototype.has=function(e){return!0},{compile:function(e){var t=p(s(e));return new h({start:t},"start")},states:function(e,t){var r=e.$all?s(e.$all):[];delete e.$all;var n=Object.getOwnPropertyNames(e);t||(t=n[0]);for(var o=Object.create(null),a=0;a<n.length;a++)o[S=n[a]]=s(e[S]).concat(r);for(a=0;a<n.length;a++)for(var i=o[S=n[a]],c=Object.create(null),l=0;l<i.length;l++){var u=i[l];if(u.include){var m=[l,1];if(u.include!==S&&!c[u.include]){c[u.include]=!0;var y=o[u.include];if(!y)throw new Error("Cannot include nonexistent state '"+u.include+"' (in state '"+S+"')");for(var g=0;g<y.length;g++){var d=y[g];-1===i.indexOf(d)&&m.push(d)}}i.splice.apply(i,m),l--}}var v=Object.create(null);for(a=0;a<n.length;a++){var S;v[S=n[a]]=p(o[S],!0)}for(a=0;a<n.length;a++){var x=n[a],b=v[x],w=b.groups;for(l=0;l<w.length;l++)f(w[l],x,v);var k=Object.getOwnPropertyNames(b.fast);for(l=0;l<k.length;l++)f(b.fast[k[l]],x,v)}return new h(v,t)},error:Object.freeze({error:!0}),fallback:Object.freeze({fallback:!0}),keywords:function(e){for(var t=Object.create(null),r=Object.create(null),n=Object.getOwnPropertyNames(e),o=0;o<n.length;o++){var a=n[o],i=e[a];(Array.isArray(i)?i:[i]).forEach((function(e){if((r[e.length]=r[e.length]||[]).push(e),"string"!=typeof e)throw new Error("keyword must be string (in keyword '"+a+"')");t[e]=a}))}function c(e){return JSON.stringify(e)}var l="";for(var s in l+="switch (value.length) {\n",r){var u=r[s];l+="case "+s+":\n",l+="switch (value) {\n",u.forEach((function(e){var r=t[e];l+="case "+c(e)+": return "+c(r)+"\n"})),l+="}\n"}return l+="}\n",Function("value",l)}}})?r.apply(t,[]):r)||(e.exports=n)}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var a=t[n]={exports:{}};return e[n].call(a.exports,a,a.exports,r),a.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{"use strict";r.r(n),r.d(n,{default:()=>Ge});var e=r(271),t=r.n(e);function o(e){return m(e)||s(e)||f(e)||p()}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){c(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function c(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e){return function(e){if(Array.isArray(e))return h(e)}(e)||s(e)||f(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function u(e,t){return m(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a=[],i=!0,c=!1;try{for(r=r.call(e);!(i=(n=r.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(e){c=!0,o=e}finally{try{i||null==r.return||r.return()}finally{if(c)throw o}}return a}}(e,t)||f(e,t)||p()}function p(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function f(e,t){if(e){if("string"==typeof e)return h(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?h(e,t):void 0}}function h(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function m(e){if(Array.isArray(e))return e}var y="(?:\r|\t|\f|\n| ){0,}",g="(?:\r|\t|\f|\n| ){1,}",d="[0-9]",v="}".concat(y,";"),S="".concat(d,"{1,}"),x="".concat(d,"{1,}(?:\\.").concat(d,"{0,}|)(?:k|M|G|)"),b="\\[".concat(y,"(?:@scale|@sd)").concat(y,"(?:>=|>)").concat(y).concat(x).concat(y,"\\]"),w="\\[".concat(y,"(?:@scale|@sd)").concat(y,"(?:<=|<)").concat(y).concat(x).concat(y,"\\]"),k="(?:-|)[_a-zA-Z]".concat("[\\-\\_a-zA-Z0-9]","{0,}"),E="#".concat(k,"(?:\\:").concat(k,"|)(?:\\.[^\\\"|\\'|\\[|\\]|\\r|\\t|\\f|\\n| ]{1,}|)"),C="mark|stroke|fill|symbol|shield|background",R=":(?:".concat(C,")"),F=":nth\\-(?:".concat(C,")\\(").concat(S,"\\)"),O="".concat(k,"(?:\\:").concat(k,"|)"),j=O,G="\\'[^\\\"|\\'|\\[|\\]]{0,}\\'",z="\\[(?:".concat(G,"|").concat('\\"[^\\"|\\\'|\\[|\\]]{0,}\\"',"|[^\\\"|\\'|\\[|\\]]{0,}){1,}\\]"),P="(?:".concat("\\/\\*[^\\*\\/]*?\\*\\/","|").concat(g,"){0,}"),T="(?:\\*|"+b+"|"+w+"|"+E+"|"+R+"|"+F+"|"+j+"|"+z+")",M="".concat(T,"(?:").concat(y).concat(T,"|").concat(y).concat("\\,").concat(y).concat(T,"){0,}"),I="[a-zA-Z0-9-\\._\\]\\:\\/\\?\\#\\[\\]\\@\\|\\$\\&'\\*\\+\\,\\;\\=]{1,}",A="(?:"+"\\'".concat(I,"\\'")+"|"+I+")",N="url".concat(y,"\\(").concat(y).concat(A).concat(y,"\\)"),_="symbol".concat(y,"\\(").concat(y).concat(A).concat(y,"\\)"),B="[a-fA-F0-9]",L="#(?:".concat(B).concat(B).concat(B).concat(B).concat(B).concat(B,"|").concat(B).concat(B).concat(B,")"),q="".concat(d,"{1,}(?:\\.").concat(d,"{0,}|)(?:k|M|G|px|m|ft|%|deg|)"),$="\\[".concat(y,"[^\\[;]*?").concat(y,"\\]"),W="@".concat(k),D="(?:none|"+L+"|"+q+"|\\'.*?\\'|"+W+")",K="(?:none|"+"".concat(O).concat(y,"\\(").concat(y).concat(D,"(?:").concat(y,",").concat(y).concat(D).concat(y,"){0,}").concat(y,"\\)")+"|"+L+"|"+q+"|\\'.*?\\'|"+W+")",V="".concat(O).concat(y,"\\(").concat(y).concat(K,"(?:").concat(y,",").concat(y).concat(K).concat(y,"){0,}").concat(y,"\\)"),U="\\'[^;\\'\\[\\]]*?\\'",Z="(?:".concat($,"|").concat(U,"){1,}"),J="(?:none|"+N+"|"+_+"|"+V+"|"+L+"|"+q+"|"+k+"|"+W+"|"+Z+"|"+$+")",Q="".concat(J,"(?:").concat(g).concat(J,"){1,}"),H="(?:"+J+"|"+Q+")",X=""+P+k+"(?:\r|\t|\f|\n| ){0,}:"+y+H+"(?:\r|\t|\f|\n| ){0,}(?:,"+y+H+"){0,};",Y="@(?:mode|styleTitle|styleAbstract)".concat(g).concat(G,";"),ee="".concat(g,"(?:in|IN|not in|NOT IN|is|IS|like|ilike|LIKE|ILIKE|\\=|\\>|\\>\\=|\\<|\\<\\=|\\<\\>)").concat(g);function te(e){if(e.match(/'/g))return e.replace(new RegExp("\\'([^\\\"|\\'|\\[|\\]]{0,})\\'","g"),"$1");var t=parseFloat(e);if(!isNaN(t))return t;var r=e.trim();return"true"===r||"false"===r?["bool",r]:r}function re(e,t){if(e.match(new RegExp(Q))){var r=e.match(new RegExp(J,"g"));return["array"].concat(l(r.map((function(e){return re(e)}))))}if(e.match(new RegExp(N)))return["url",e.replace(new RegExp("url".concat(y,"\\(").concat(y,"(").concat(A,")").concat(y,"\\)"),"g"),"$1").replace(/'(.*?)'/g,"$1")];if(e.match(new RegExp(_)))return["symbol",e.replace(new RegExp("symbol".concat(y,"\\(").concat(y,"(").concat(A,")").concat(y,"\\)"),"g"),"$1").replace(/'(.*?)'/g,"$1")];if(e.match(new RegExp($))&&"label"!==t){var n,o=e.replace(new RegExp("\\[".concat(y,"([^\\[;]*?)").concat(y,"\\]"),"g"),"$1"),a=null===(n=o.match(new RegExp("".concat(H,"(?:").concat(g,"(\\*|\\/|\\+|\\-)").concat(g).concat(H,"){0,}"))))||void 0===n?void 0:n[1],i=o.match(new RegExp(H,"g"));return a?["brace",[a,re(null==i?void 0:i[0]),re(null==i?void 0:i[1])]]:["brace",re(i[0])]}if(e.match(new RegExp(V))){var c,s=null===(c=e.match(O))||void 0===c?void 0:c[0],u=e.replace(s,"").match(new RegExp(K,"g"));return[s].concat(l(u.map((function(e){return re(e)}))))}if(e.match(new RegExp(Z))){var p=e.match(new RegExp("".concat($,"|").concat(U),"g")).map((function(e){return e.match(new RegExp(U))&&!e.match(new RegExp($))?e.replace(/'([^;'[\]]*?)'/,"$1"):re(e)}));return 1===p.length?p[0]:["text"].concat(l(p))}if(e.match(new RegExp(L)))return["hex",e];if(e.match(new RegExp(q))){var f,h=parseFloat(e.replace(/k|M|G|px|m|ft|%|deg/g,"")),m=null===(f=e.match(/(?:k|M|G|px|m|ft|%|deg)/g))||void 0===f?void 0:f[0];return m?["measure",h,m]:h}return e.match(new RegExp(k))?["get",e]:e}var ne=t().compile({directive:{match:new RegExp(Y),value:function(e){return{key:e.match(/@(:?mode|styleTitle|styleAbstract)/)[0],value:e.match(/'.*?'/)[0].replace(/'(.*?)'/g,"$1")}}},whitespace:{match:new RegExp(g),lineBreaks:!0,value:function(e){return{value:e}}},property:{match:new RegExp(X),value:function(e){var t=e.match(new RegExp(P))[0].trim(),r=e.match(new RegExp(k+y+":"))[0].replace(/:/,"").trim(),n=e.replace(new RegExp(P),"").replace(new RegExp(k+y+":"),"").match(new RegExp("".concat(J,"(?:").concat(g).concat(J,"){0,}"),"g")).map((function(e){return re(e,r)}));return{comment:t,key:r,value:n}}},openBrace:{match:new RegExp("{"),value:function(e){return{value:e}}},closeBraceSemicolon:{match:new RegExp(v),value:function(e){return{value:e}}},closeBrace:{match:new RegExp("}"),value:function(e){return{value:e}}},selector:{match:new RegExp(P+M),value:function(e){var t,r,n,o,a,i,c=e.match(new RegExp(P))[0].trim(),s=null==c||null===(t=c.match(new RegExp("@title".concat(y,"(\\:){0,1}").concat(y,".*?\\*\\/"))))||void 0===t||null===(r=t[0])||void 0===r||null===(n=r.replace(new RegExp("@title".concat(y,"(\\:){0,1}|\\*\\/"),"g"),""))||void 0===n?void 0:n.trim(),p=null==c||null===(o=c.match(new RegExp("@source".concat(y,"(\\:){0,1}").concat(y,".*?\\*\\/"))))||void 0===o||null===(a=o[0])||void 0===a||null===(i=a.replace(new RegExp("@source".concat(y,"(\\:){0,1}|\\*\\/"),"g"),""))||void 0===i?void 0:i.trim(),f=e.replace(new RegExp(P),"").split(new RegExp("\\]".concat(y,",").concat(y,"\\["),"g"));return{source:p,title:s,comment:c,value:f.map((function(e,t){return 0===t?e+"]":t===f.length-1?"["+e:"["+e+"]"})).map((function(e){return e.match(new RegExp(T,"g")).map((function(e){return function(e){if(e.match(new RegExp("\\*"))&&!e.match(new RegExp(z)))return{value:e,type:"allSelector"};if(e.match(new RegExp(b))){var t,r,n=null===(t=e.match(/>=|>/g))||void 0===t?void 0:t[0],o=u(e.replace(/\[|\]/g,"").split(new RegExp("".concat(y,"(?:>=|>)").concat(y))),2),a=o[0],i=o[1],c=parseFloat(i.replace(/k|M|G/g,"")),s=null===(r=i.match(/(?:k|M|G)/g))||void 0===r?void 0:r[0];return{value:e,type:"minScaleSelector",expression:[n,["get",a],s?["measure",c,s]:c]}}if(e.match(new RegExp(w))){var p,f,h=null===(p=e.match(/<=|</g))||void 0===p?void 0:p[0],m=u(e.replace(/\[|\]/g,"").split(new RegExp("".concat(y,"(?:<=|<)").concat(y))),2),d=m[0],v=m[1],S=parseFloat(v.replace(/k|M|G/g,"")),x=null===(f=v.match(/(?:k|M|G)/g))||void 0===f?void 0:f[0];return{value:e,type:"maxScaleSelector",expression:[h,["get",d],x?["measure",S,x]:S]}}if(e.match(new RegExp(E)))return{value:e,type:"idSelector"};if(e.match(new RegExp(R)))return{value:e,type:"pseudoClassSelector"};if(e.match(new RegExp(F)))return{value:e,type:"numberedPseudoClassSelector"};if(e.match(new RegExp(z))){var k={"=":"==",">":">",">=":">=","<":"<","<=":"<=","<>":"!=",like:"like",ilike:"ilike",LIKE:"like",ILIKE:"ilike"},C="".concat(g,"(?:or|OR)").concat(g),O="".concat(g,"(?:and|AND)").concat(g),G=e.match(new RegExp(C,"g"))&&"any",P=e.match(new RegExp(O,"g"))&&"all";if(G&&P)throw new Error("or and operators");var T=G?C:O,M=e.replace(/\[|\]/g,"").split(new RegExp(T,"g")).map((function(t){var r,n,o,a=new RegExp(ee),i=null===(r=t.match(a))||void 0===r||null===(n=r[0])||void 0===n||null===(o=n.trim)||void 0===o?void 0:o.call(n),c=t.split(new RegExp(ee));if(k[i])return[k[i],["get",c[0]],te(c[1])];if(!("is"!==i&&"IS"!==i||"null"!==c[1]&&"NULL"!==c[1]))return["isnull",["get",c[0]]];if("in"===i||"not in"===i||"IN"===i||"NOT IN"===i){var l=c[1].replace(/\(|\)/g,"").split(",").map((function(e){return te(e.trim())})),s=["in",["get",c[0]],["literal",l]];return"not in"===i||"NOT IN"===i?["!",s]:s}throw new Error("\n                operator not supported in selector: ".concat(e,"\n                supported operators: ").concat(Object.keys(k).join(" ")))}));return{value:e,expression:M.length>1?[G||P].concat(l(M)):M[0],type:"eCQLSelector"}}return e.match(new RegExp(j))?{value:e,type:"typeNameSelector"}:{value:e,type:"basicSelector"}}(e)}))}))}}}});function oe(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(e){return t.reduce((function(e,t){return t(e)}),e)}}function ae(e){return ne.reset(e),Array.from(ne)}function ie(e){return e.map((function(e){var t=e.type,r=e.value,n=e.line,o=e.col,a=e.text;return i(i({},r),{},{type:t,line:n,col:o,text:a})}))}var ce=["typeNameSelector"];function le(e){var t=["pseudoClassSelector","numberedPseudoClassSelector","allSelector","typeNameSelector"];return e.filter((function(e){return"selector"===e.type})).forEach((function(e){var r=e.value,n=e.line,o=e.col,a=e.text,i=e.level,c=r.map((function(e){return e.map((function(e){return e.type}))})).reduce((function(e,t){return[].concat(l(e),l(t))}));if(c.length>1&&c.find((function(e){return-1!==t.indexOf(e)})))throw{line:n,col:o,text:a};if(1===c.length&&-1!==ce.indexOf(c[0])&&1!==i)throw{line:n,col:o,text:a}})),e}function se(e){var t=0,r=0,n=0,o=0;return e.filter((function(e){var t=e.type;return"whitespace"!==t&&"directive"!==t})).map((function(e){r=t;var a=(e||{}).type;"openBrace"===a&&(t++,o++),"closeBrace"!==a&&"closeBraceSemicolon"!==a||t--;var c="selector"===a||"closeBrace"===a||"closeBraceSemicolon"===a?t+1:t,l=n;return 1===r&&1===c&&"closeBrace"===a&&(n++,o=0,l=n-1),i(i(i({},e),"selector"===a&&{rule:o}),{},{level:c,group:l})}))}function ue(e){var t=e.reduce((function(e,t){var r="".concat(t.group,":").concat(t.level);return i(i({},e),{},c({},r,e[r]?[].concat(l(e[r]),[t]):[t]))}),{});return Object.keys(t).map((function(e){return t[e].reduce((function(e,t){if(e.length>0){var r=e.filter((function(t,r){return r<e.length-1})),n=[].concat(l(e[e.length-1]),[t]);return[].concat(l(r),[n],l("closeBrace"===t.type||"closeBraceSemicolon"===t.type?[[]]:[]))}return[[t]]}),[])}))}function pe(e){return e.reduce((function(e,t){return[].concat(l(e),l(t.filter((function(e){return e.length>0})).map((function(e){return e.map((function(t){return i(i({},t),{},{rule:e[0].rule})}))}))))}),[])}function fe(e){return l(e).sort((function(e,t){return e[0].group===t[0].group?e[0].rule>t[0].rule?1:-1:e[0].group>t[0].group?1:-1}))}function he(e){return e.map((function(e){var t=e.find((function(e){return"selector"===e.type}))||{},r=t.title,n=t.value,o=t.level,a=t.group,l=t.rule,s=e.filter((function(e){return"property"===e.type})).reduce((function(e,t){return i(i({},e),{},c({},t.key,t.value))}),{});return i(i({},r&&{title:r}),{},{selector:n,properties:s,level:o,group:a,rule:l})}))}function me(e){return e.map((function(t,r){var n=t.level,o=t.group;if(1===n)return t;var a=[].concat(l(e.filter((function(e,t){return t<r&&e.group===o&&e.level<n}))),[t]);return 1===a.length?t:i(i({},t),{},{activeRules:a})}))}function ye(e){return e&&1===e.length&&1===e[0].length&&e[0][0]||{}}function ge(e){var t=e.reduce((function(e,t){var r=t.level,n=t.group,o=t.rule,a=t.activeRules,l=t.selector,s=t.properties;if(!a)return e;if("pseudoClassSelector"===ye(l).type||"numberedPseudoClassSelector"===ye(l).type){var u,p=a[a.length-2],f=p.level,h=p.group,m=p.rule;return i(i({},e),{},(c(u={},"".concat(r,":").concat(n,":").concat(o),"remove"),c(u,"".concat(f,":").concat(h,":").concat(m),i(i({},e["".concat(f,":").concat(h,":").concat(m)]),{},c({},l[0][0].value,s))),u))}return e}),{});return e.filter((function(e){var r=e.level,n=e.group,o=e.rule;return"remove"!==t["".concat(r,":").concat(n,":").concat(o)]})).map((function(e){var r=e.level,n=e.group,o=e.properties,a=e.rule;return t["".concat(r,":").concat(n,":").concat(a)]?i(i({},e),{},{properties:i(i({},o),t["".concat(r,":").concat(n,":").concat(a)])}):e}))}function de(e){return e.map((function(e){var t=e.activeRules;if(!t)return e;var r=(t.find((function(e){return"typeNameSelector"===ye(e.selector).type}))||{}).selector,n=ye(r).value;return i(i({},e),{},{layer:n,activeRules:t.filter((function(e){return"typeNameSelector"!==ye(e.selector).type}))})}))}function ve(e){return e.map((function(e){var t=e.activeRules,r=e.layer;if(!t){var n=e.selector,o=e.properties,a=e.title;return i(i(i({},a&&{title:a}),r&&{layer:r}),{},{selector:n,properties:o})}var c=t.map((function(e){return e.selector})).reduce((function(e,t){var r=[];return e.forEach((function(e){t.forEach((function(t){r.push([].concat(l(e),l(t)))}))})),r})),s=t.map((function(e){return e.properties})).reduce((function(e,t){return i(i({},e),t)})),u=t.map((function(e){return e.title})).reduce((function(e,t){return[].concat(l(e),l(t&&[t]||[]))}),[]).join(", ");return i(i(i({},u&&{title:u}),r&&{layer:r}),{},{selector:c,properties:s})}))}function Se(e){return e.reduce((function(e,t){var r=function(e){return e.reduce((function(e,t,r){var n,o,a=t.filter((function(e){return"minScaleSelector"===e.type})),s=t.filter((function(e){return"maxScaleSelector"===e.type})),u=[a[a.length-1],s[s.length-1]],p="".concat((null==u||null===(n=u[0])||void 0===n?void 0:n.value)||"").concat((null==u||null===(o=u[1])||void 0===o?void 0:o.value)||"")||"noScale";return e[p]?i(i({},e),{},c({},p,{selectorIndex:[].concat(l(e[p].selectorIndex),[r]),scales:u})):i(i({},e),{},c({},p,{selectorIndex:[r],scales:u}))}),{})}(t.selector),n=t.selector.map((function(e){return e.filter((function(e){var t=e.type;return!("minScaleSelector"===t||"maxScaleSelector"===t)}))})),o=n.map((function(e){return e.map((function(e){return e.type}))})).reduce((function(e,t){return[].concat(l(e),l(t))}));return[].concat(l(e),l(Object.keys(r).map((function(e){var a,c,s=r[e],u=s.selectorIndex,p=void 0===u?[]:u,f=s.scales,h=null===(a=f[0])||void 0===a?void 0:a.expression,m=null===(c=f[1])||void 0===c?void 0:c.expression,y=1===o.length&&"allSelector"===o[0];return i(i(i({},t),{},{selector:y?"*":["any"].concat(l(n.filter((function(e,t){return-1!==p.indexOf(t)})).map((function(e){return["all"].concat(l(e.map((function(e){return null==e?void 0:e.expression}))))}))))},h&&{"min-scale":h}),m&&{"max-scale":m})}))))}),[])}function xe(e){return e.filter((function(e){var t=e.properties;return Object.keys(t).length>0}))}function be(e,t){return Object.keys(e).reduce((function(r,n){return i(i({},r),{},c({},n,void 0===e[n][t]?e[n][0]:e[n][t]))}),{})}function we(e){var t=0;return e.reduce((function(e,r){t++;var n=Object.keys(null==r?void 0:r.properties),o=Math.max.apply(null,n.filter((function(e){return!e.match(new RegExp("(?:".concat(R,"|").concat(F,")")))})).map((function(e){var t,n;return null==r||null===(t=r.properties)||void 0===t||null===(n=t[e])||void 0===n?void 0:n.length})).filter((function(e){return e}))),a=Object.keys(l(new Array(o))).map((function(e){return n.reduce((function(t,n){var o,a;if(n.match(new RegExp(R)))return i(i({},t),{},c({},n,be(null==r||null===(a=r.properties)||void 0===a?void 0:a[n],e)));if(n.match(new RegExp(F))){var l,s=n.match(new RegExp(":nth\\-((?:".concat(C,"))\\((").concat(S,")\\)"))),u=null==s?void 0:s[1],p=null==s?void 0:s[2];return i(i({},t),void 0!==p&&parseFloat(p)-1+""===e&&c({},":".concat(u),be(null==r||null===(l=r.properties)||void 0===l?void 0:l[n],e)))}var f=null!==(o=null==r?void 0:r.properties[n][e])&&void 0!==o?o:null==r?void 0:r.properties[n][0];return i(i({},t),null!=f&&c({},n,f))}),{})}));return[].concat(l(e),l(a.map((function(e){return i(i({},r),{},{properties:e,group:t})}))))}),[])}function ke(e,t){if(void 0!==e){if("string"==typeof e||e instanceof String)return"'".concat(e,"'");if(!isNaN(e))return e;var r=o(e),n=r[0],a=r.slice(1);switch(n){case"+":case"-":case"*":case"/":return"".concat(ke(a[0])," ").concat(n," ").concat(ke(a[1]));case"any":return a.map((function(e){return ke(e)})).join(" or ");case"all":return a.map((function(e){return ke(e)})).join(" and ");case"isnull":return ke(a[0])+" is null";case">":case"<":case">=":case"<=":case"!=":case"==":case"like":case"ilike":return ke(a[0])+" "+{"==":"=",">":">",">=":">=","<":"<","<=":"<=","!=":"<>",like:"like",ilike:"ilike",LIKE:"like",ILIKE:"ilike"}[n]+" "+ke(a[1]);case"!":return ke(a[0],{prefix:"not "});case"in":return ke(a[0])+" "+((null==t?void 0:t.prefix)||"")+"in ("+a.filter((function(e,t){return t>0})).map((function(e){return ke(e)})).join("")+")";case"bool":case"get":case"hex":return a[0];case"literal":return a[0].map((function(e){return ke(e)})).join(", ");case"measure":return"".concat(a[0]).concat(a[1]||"");case"recode":case"categorize":case"interpolate":case"color-map-entry":case"env":return"".concat(n,"(").concat(a.map((function(e){return ke(e)})).join(", "),")");case"url":case"symbol":return"".concat(n,"('").concat(a[0],"')");case"brace":return"[".concat(a.map((function(e){return ke(e)})),"]");case"array":return a.map((function(e){return ke(e)})).join(" ");case"text":return a.map((function(e){return ke(e)})).join("");default:return e}}}function Ee(e){for(var t=[],r=0;r<e.length;r++){var n=e[r],o=t[t.length-1]||{},a=o.group;void 0!==a&&a===n.group?t[t.length-1]=i(i({},o),{},{properties:[].concat(l(Array.isArray(o.properties)?o.properties:[o.properties]),[n.properties])}):t.push(n)}return t}function Ce(e,t){if(t){var r=Array.isArray(e)?e:[e];return Object.keys(r[0]).reduce((function(e,t){return i(i({},e),{},c({},t,Ce(r.map((function(e){return e[t]})))))}),{})}var n=e.filter((function(e){return null!=e}));return 1===n.length||n.every((function(e,t,r){return e===r[0]}))?n[0]:n.join(", ")}function Re(e){return(e||[]).map((function(e){var t=(null==e?void 0:e["min-scale"])&&ke(e["min-scale"]),r=(null==e?void 0:e["max-scale"])&&ke(e["max-scale"]),n=Array.isArray(e.properties)?e.properties:[e.properties],a=Object.keys(n[0]),s=function(e){if("*"===e)return"*";var t=o(e),r=t[0],n=t.slice(1);if("any"!==r&&"all"!==r)return["any",["all",e]];if("all"===r)return["any",e];if("any"===r){var a=n.map((function(e){return"all"!==e[0]?["all",e]:e}));return["any"].concat(l(a))}return"*"}(e.selector);return i(i(i({},(null==e?void 0:e.title)&&{title:"/* @title ".concat(e.title," */")}),(null==e?void 0:e.layer)&&{layer:e.layer}),{},{selector:"any"===(null==s?void 0:s[0])?s.filter((function(e,t){return t>0})).map((function(e){return[].concat(l(e.filter((function(e,t){return t>0})).map((function(e){return"["+ke(e)+"]"}))),l(t&&["["+t+"]"]||[]),l(r&&["["+r+"]"]||[]))})):s,properties:a.reduce((function(e,t){return t.match(new RegExp("(?:".concat(R,"|").concat(F,")")))?i(i({},e),{},c({},t,Ce(n.map((function(e){return Object.keys(e[t]).reduce((function(r,n){return i(i({},r),{},c({},n,ke(e[t][n])))}),{})})),!0))):i(i({},e),{},c({},t,Ce(n.map((function(e){return ke(e[t])})))))}),{})})}))}function Fe(e){return e.map((function(e){return e.layer})).reduce((function(t,r,n){var o;if(void 0===r)return[].concat(l(t),[e[n]]);var a=null===(o=t[t.length-1])||void 0===o?void 0:o.layer;return void 0!==a&&a===r?[].concat(l(t.filter((function(e,r){return r<t.length-1}))),[{layer:r,rules:[].concat(l(t[t.length-1].rules),[e[n]])}]):[].concat(l(t),[{layer:r,rules:[e[n]]}])}),[])}function Oe(e,t){var r=(null==t?void 0:t.baseTab)||"",n=(null==t?void 0:t.tab)||"  ",o=(null==e?void 0:e.title)&&(null==e?void 0:e.title)+"\n"||"",a=(null==e?void 0:e.selector)?"*"===e.selector?"*":e.selector.map((function(e){return r+e.join("\n")})).join(",\n"):"",i=Object.keys(null==e?void 0:e.properties).reduce((function(t,o){if(o.match(new RegExp("(?:".concat(R,"|").concat(F,")")))){var a=Object.keys(e.properties[o]).reduce((function(t,a){return t+r+n+n+a+": "+e.properties[o][a]+";\n"}),"");return t+r+n+o+" {\n"+a+r+n+"};\n"}return t+r+n+o+": "+e.properties[o]+";\n"}),"");return r+o+a+" {\n"+i+r+"}\n"}function je(e){var t="  ";return e.reduce((function(e,r){return r.layer&&r.rules?e+r.layer+" {\n"+r.rules.map((function(e){return Oe(e,{tab:t,baseTab:t})})).join("")+"}\n":e+Oe(r,{tab:t})}),"")}const Ge={read:function(e){var t=oe(ae,ie)(e);return{directive:t.filter((function(e){return"directive"===e.type})).reduce((function(e,t){var r=t.key,n=t.value;return i(i({},e),{},c({},r,n))}),{}),rules:oe(se,le,ue,pe,fe,he,me,ge,de,ve,Se,xe,we)(t)}},write:function(e){return Object.keys(null==e?void 0:e.directive).reduce((function(t,r){return t+r+" '"+e.directive[r]+"';\n"}),"")+"\n"+oe(Ee,Re,Fe,je)(null==e?void 0:e.rules)}}})(),n})()}}]);