Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@nextgis/paint

Package Overview
Dependencies
Maintainers
3
Versions
89
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nextgis/paint - npm Package Compare versions

Comparing version 1.19.0 to 2.0.0-alpha.0

212

lib/index.d.ts

@@ -1,16 +0,10 @@

import type { Expression } from '@nextgis/expression';
import type { Feature } from 'geojson';
import type { PropertiesFilter } from '@nextgis/properties-filter';
import { Expression } from '@nextgis/expression';
import { PropertiesFilter } from '@nextgis/properties-filter';
import { Feature } from 'geojson';
export declare interface Base3DPaint {
type?: Paint3DType;
color?: string | Expression;
fill?: boolean;
fillColor?: string | Expression;
stroke?: boolean;
strokeWidth?: number | Expression;
strokeColor?: string | Expression;
type PaintType = 'circle' | 'path' | 'pin' | 'icon' | 'get-paint';
interface BasePaintTypes {
type?: PaintType;
}
export declare interface BasePaint extends BasePaintTypes {
interface BasePaint extends BasePaintTypes {
color?: string | Expression;

@@ -28,81 +22,11 @@ opacity?: number | Expression;

}
declare interface BasePaintTypes {
type?: PaintType;
}
export declare interface CirclePaint extends BasePaint {
interface CirclePaint extends BasePaint {
type?: 'circle';
radius?: number | Expression;
}
export declare function createExpressionCallback(paint: Record<string, any>): GetPaintCallback | undefined;
export declare interface Ellipsoid3DPaint extends Base3DPaint {
type: 'ellipsoid';
length: number;
width: number;
height: number;
}
export declare type GeometryPaint = PathPaint & CirclePaint & PinPaint;
export declare interface GetCustomPaintOptions extends BasePaintTypes {
type: 'get-paint';
from: string | GetPaintFunction;
options?: any;
}
export declare interface GetPaint3DCallback<F extends Feature = Feature> {
(feature: F): VectorAdapterLayerPaint;
type?: Paint3DType;
paint?: VectorAdapterLayerPaint3D;
}
export declare interface GetPaintCallback<F extends Feature = Feature> {
(feature: F): VectorAdapterLayerPaint;
type?: PaintType;
paint?: CirclePaint | PathPaint | PinPaint;
}
export declare type GetPaintFunction = (opt?: any) => VectorAdapterLayerPaint;
/**
* @deprecated use IconPaint instead
*/
export declare type IconOptions = IconPaint | PinPaint;
export declare interface IconPaint extends BasePaintTypes {
type: 'icon';
className?: string;
html?: string;
svg?: HTMLElement;
iconSize?: [number, number];
iconAnchor?: [number, number];
rotate?: number;
}
export declare function isBasePaint(paint: Paint): paint is GeometryPaint;
export declare function isIcon(paint: IconPaint): paint is IconPaint;
export declare function isPaint(paint: Paint): paint is VectorAdapterLayerPaint;
export declare function isPaintCallback(paint: Paint): paint is GetPaintCallback;
export declare function isPropertiesPaint(paint: Paint): paint is PropertiesPaint;
export declare type Paint<F extends Feature = Feature, P extends Properties | null = F['properties']> = VectorAdapterLayerPaint | GetPaintCallback<F> | PropertiesPaint<P extends null ? Properties : P>;
export declare type Paint3D<F extends Feature = Feature, P extends Properties | null = F['properties']> = VectorAdapterLayerPaint3D | GetPaintCallback<F> | PropertyPaint3D<P extends null ? Properties : P>;
export declare type Paint3DType = 'ellipsoid' | 'sphere';
export declare type PaintType = 'circle' | 'path' | 'pin' | 'icon' | 'get-paint';
export declare interface PathPaint extends BasePaint {
interface PathPaint extends BasePaint {
type?: 'path';
}
export declare interface PinPaint extends BasePaint {
type GeometryPaint = PathPaint & CirclePaint & PinPaint;
interface PinPaint extends BasePaint {
type?: 'pin';

@@ -121,46 +45,92 @@ size?: number | Expression;

}
export declare function preparePaint({ paint, defaultPaint, getPaintFunctions, }: PreparePaintOptions): Paint;
export declare interface PreparePaintOptions {
paint: Paint;
defaultPaint?: GeometryPaint;
getPaintFunctions?: {
[name: string]: GetPaintFunction;
};
interface IconPaint extends BasePaintTypes {
type: 'icon';
className?: string;
html?: string;
svg?: HTMLElement;
iconSize?: [number, number];
iconAnchor?: [number, number];
rotate?: number;
}
declare type Properties = {
/**
* @deprecated use IconPaint instead
*/
type IconOptions = IconPaint | PinPaint;
type GetPaintFunction = (opt?: any) => VectorAdapterLayerPaint;
interface GetCustomPaintOptions extends BasePaintTypes {
type: 'get-paint';
from: string | GetPaintFunction;
options?: any;
}
type Properties = {
[name: string]: any;
};
export declare type PropertiesPaint<P extends Properties = Properties> = [
VectorAdapterLayerPaint | undefined,
...PropertyPaint<P>[]
type PropertyPaint<P extends Properties = Properties> = [
PropertiesFilter<P>,
VectorAdapterLayerPaint
];
export declare type PropertiesPaint3D<P extends Properties = Properties> = [
VectorAdapterLayerPaint3D | undefined,
...PropertyPaint<P>[]
type PropertiesPaint<P extends Properties = Properties> = [
VectorAdapterLayerPaint | undefined,
...PropertyPaint<P>[]
];
export declare type PropertyPaint<P extends Properties = Properties> = [
PropertiesFilter<P>,
VectorAdapterLayerPaint
];
export declare type PropertyPaint3D<P extends Properties = Properties> = [
PropertiesFilter<P>,
VectorAdapterLayerPaint3D
];
export declare interface Sphere3DPaint extends Base3DPaint {
type VectorAdapterLayerPaint = CirclePaint | PathPaint | IconPaint | PinPaint | GetCustomPaintOptions;
interface GetPaintCallback<F extends Feature = Feature> {
(feature: F): VectorAdapterLayerPaint;
type?: PaintType;
paint?: CirclePaint | PathPaint | PinPaint;
}
type Paint<F extends Feature = Feature, P extends Properties | null = F['properties']> = VectorAdapterLayerPaint | GetPaintCallback<F> | PropertiesPaint<P extends null ? Properties : P>;
type Paint3DType = 'ellipsoid' | 'sphere';
type VectorAdapterLayerPaint3D = Sphere3DPaint | Ellipsoid3DPaint;
interface Base3DPaint {
type?: Paint3DType;
color?: string | Expression;
fill?: boolean;
fillColor?: string | Expression;
stroke?: boolean;
strokeWidth?: number | Expression;
strokeColor?: string | Expression;
}
interface Ellipsoid3DPaint extends Base3DPaint {
type: 'ellipsoid';
length: number;
width: number;
height: number;
}
interface Sphere3DPaint extends Base3DPaint {
type: 'sphere';
radius: number;
}
interface GetPaint3DCallback<F extends Feature = Feature> {
(feature: F): VectorAdapterLayerPaint;
type?: Paint3DType;
paint?: VectorAdapterLayerPaint3D;
}
type PropertiesPaint3D<P extends Properties = Properties> = [
VectorAdapterLayerPaint3D | undefined,
...PropertyPaint<P>[]
];
type PropertyPaint3D<P extends Properties = Properties> = [
PropertiesFilter<P>,
VectorAdapterLayerPaint3D
];
type Paint3D<F extends Feature = Feature, P extends Properties | null = F['properties']> = VectorAdapterLayerPaint3D | GetPaintCallback<F> | PropertyPaint3D<P extends null ? Properties : P>;
export declare type VectorAdapterLayerPaint = CirclePaint | PathPaint | IconPaint | PinPaint | GetCustomPaintOptions;
declare function isPropertiesPaint(paint: Paint): paint is PropertiesPaint;
declare function isPaint(paint: Paint): paint is VectorAdapterLayerPaint;
declare function isBasePaint(paint: Paint): paint is GeometryPaint;
declare function isPaintCallback(paint: Paint): paint is GetPaintCallback;
declare function isIcon(paint: IconPaint): paint is IconPaint;
export declare type VectorAdapterLayerPaint3D = Sphere3DPaint | Ellipsoid3DPaint;
declare function createExpressionCallback(paint: Record<string, any>): GetPaintCallback | undefined;
export { }
interface PreparePaintOptions {
paint: Paint;
defaultPaint?: GeometryPaint;
getPaintFunctions?: {
[name: string]: GetPaintFunction;
};
}
declare function preparePaint({ paint, defaultPaint, getPaintFunctions, }: PreparePaintOptions): Paint;
export { type Base3DPaint, type BasePaint, type CirclePaint, type Ellipsoid3DPaint, type GeometryPaint, type GetCustomPaintOptions, type GetPaint3DCallback, type GetPaintCallback, type GetPaintFunction, type IconOptions, type IconPaint, type Paint, type Paint3D, type Paint3DType, type PaintType, type PathPaint, type PinPaint, type PreparePaintOptions, type PropertiesPaint, type PropertiesPaint3D, type PropertyPaint, type PropertyPaint3D, type Sphere3DPaint, type VectorAdapterLayerPaint, type VectorAdapterLayerPaint3D, createExpressionCallback, isBasePaint, isIcon, isPaint, isPaintCallback, isPropertiesPaint, preparePaint };

@@ -1,2 +0,2 @@

/** Bundle of @nextgis/paint; version: 1.19.0; author: NextGIS */
/** Bundle of @nextgis/paint; version: 2.0.0-alpha.0; author: NextGIS */
'use strict';

@@ -10,187 +10,185 @@

function isPropertiesPaint(paint) {
if (Array.isArray(paint)) {
return true;
}
return false;
if (Array.isArray(paint)) {
return true;
}
return false;
}
function isPaint(paint) {
if (Object.prototype.toString.call(paint) === '[object Object]') {
return true;
}
return false;
if (Object.prototype.toString.call(paint) === "[object Object]") {
return true;
}
return false;
}
function isBasePaint(paint) {
if (isPaint(paint)) {
if (paint.type === 'get-paint' || paint.type === 'icon') {
return false;
}
return true;
if (isPaint(paint)) {
if (paint.type === "get-paint" || paint.type === "icon") {
return false;
}
return false;
return true;
}
return false;
}
function isPaintCallback(paint) {
if (typeof paint === 'function') {
return true;
}
return false;
if (typeof paint === "function") {
return true;
}
return false;
}
function isIcon(paint) {
return paint.type === 'icon' || 'html' in paint;
return paint.type === "icon" || "html" in paint;
}
function createPropertyExpressionCb(expression$1) {
return (feature) => {
const properties = feature.properties;
if (properties) {
return expression.evaluate(expression$1, properties);
}
return false;
};
return (feature) => {
const properties = feature.properties;
if (properties) {
return expression.evaluate(expression$1, properties);
}
return false;
};
}
const excludeExpressionList = ['iconSize', 'iconAnchor'];
const excludeExpressionList = ["iconSize", "iconAnchor"];
function createExpressionCallback(paint) {
let withExpression = false;
const expressions = {};
for (const p in paint) {
if (excludeExpressionList.indexOf(p) === -1) {
const p_ = p;
const val = paint[p_];
if (expression.isExpression(val)) {
withExpression = true;
expressions[p_] = createPropertyExpressionCb(val);
}
}
let withExpression = false;
const expressions = {};
for (const p in paint) {
if (excludeExpressionList.indexOf(p) === -1) {
const p_ = p;
const val = paint[p_];
if (expression.isExpression(val)) {
withExpression = true;
expressions[p_] = createPropertyExpressionCb(val);
}
}
if (withExpression) {
return (feature) => {
const fromCb = {};
for (const p in expressions) {
fromCb[p] = expressions[p](feature);
}
return { ...paint, ...fromCb };
};
}
return;
}
if (withExpression) {
return (feature) => {
const fromCb = {};
for (const p in expressions) {
fromCb[p] = expressions[p](feature);
}
return { ...paint, ...fromCb };
};
}
return;
}
function updatePaintOptionFromCallback(paint, getPaintFunctions) {
if (typeof paint.from === 'function') {
return paint.from(paint.options);
if (typeof paint.from === "function") {
return paint.from(paint.options);
} else if (typeof paint.from === "string" && getPaintFunctions) {
const from = getPaintFunctions[paint.from];
if (from) {
return from(paint.options);
}
else if (typeof paint.from === 'string' && getPaintFunctions) {
const from = getPaintFunctions[paint.from];
if (from) {
return from(paint.options);
}
}
}
}
function createPropertiesPaint(propertiesPaint) {
let mask = {};
const paintsFilters = [];
for (const p of propertiesPaint) {
if (p) {
if (Array.isArray(p)) {
paintsFilters.push(p);
}
else {
mask = p;
}
}
let mask = {};
const paintsFilters = [];
for (const p of propertiesPaint) {
if (p) {
if (Array.isArray(p)) {
paintsFilters.push(p);
} else {
mask = p;
}
}
return (feature) => {
const paint = paintsFilters.find((x) => propertiesFilter.featureFilter(feature, x[0]));
if (paint) {
return { ...mask, ...paint[1] };
}
return mask;
}
return (feature) => {
const paint = paintsFilters.find((x) => propertiesFilter.featureFilter(feature, x[0]));
if (paint) {
return { ...mask, ...paint[1] };
}
return mask;
};
}
function expressionCallback({
paint,
defaultPaint
}) {
const expressionCallback2 = createExpressionCallback(paint);
if (expressionCallback2) {
const expressionPaintCb = (feature) => {
return preparePaint({
paint: expressionCallback2(feature),
defaultPaint
});
};
expressionPaintCb.paint = finalizePaint({ paint, defaultPaint });
return expressionPaintCb;
}
return finalizePaint({ paint, defaultPaint });
}
function expressionCallback({ paint, defaultPaint, }) {
const expressionCallback = createExpressionCallback(paint);
if (expressionCallback) {
const expressionPaintCb = (feature) => {
return preparePaint({
paint: expressionCallback(feature),
defaultPaint,
});
};
expressionPaintCb.paint = finalizePaint({ paint, defaultPaint });
return expressionPaintCb;
}
return finalizePaint({ paint, defaultPaint });
}
function finalizePaint({ paint, defaultPaint }) {
var _a;
let newPaint = { ...defaultPaint };
newPaint = { ...newPaint, ...paint };
newPaint.fill = (_a = newPaint.fill) !== null && _a !== void 0 ? _a : true;
newPaint.stroke =
newPaint.stroke !== undefined
? newPaint.stroke
: !newPaint.fill || !!(newPaint.strokeColor || newPaint.strokeOpacity);
return newPaint;
var _a;
let newPaint = { ...defaultPaint };
newPaint = { ...newPaint, ...paint };
newPaint.fill = (_a = newPaint.fill) != null ? _a : true;
newPaint.stroke = newPaint.stroke !== void 0 ? newPaint.stroke : !newPaint.fill || !!(newPaint.strokeColor || newPaint.strokeOpacity);
return newPaint;
}
function preparePaint({ paint, defaultPaint, getPaintFunctions, }) {
if (!paint) {
throw new Error('paint is empty');
function preparePaint({
paint,
defaultPaint,
getPaintFunctions
}) {
if (!paint) {
throw new Error("paint is empty");
}
let newPaint = { ...defaultPaint };
if (isPaintCallback(paint)) {
const getPaintFunction = (feature) => {
const getPaint = preparePaint({
paint: paint(feature),
defaultPaint,
getPaintFunctions
});
getPaint.type = paint.type;
return getPaint;
};
getPaintFunction.type = paint.type;
return getPaintFunction;
} else if (isPropertiesPaint(paint)) {
return (feature) => {
return preparePaint({
paint: createPropertiesPaint(paint)(feature),
defaultPaint,
getPaintFunctions
});
};
} else if (paint.type === "get-paint") {
const getPaint = updatePaintOptionFromCallback(paint, getPaintFunctions);
if (getPaint) {
newPaint = preparePaint({
paint: getPaint,
defaultPaint,
getPaintFunctions
});
}
let newPaint = { ...defaultPaint };
if (isPaintCallback(paint)) {
const getPaintFunction = (feature) => {
const getPaint = preparePaint({
paint: paint(feature),
defaultPaint,
getPaintFunctions,
});
getPaint.type = paint.type;
return getPaint;
};
getPaintFunction.type = paint.type;
return getPaintFunction;
} else if (paint.type === "icon") {
return paint;
} else {
newPaint = expressionCallback({ paint, defaultPaint });
}
if (isPaintCallback(newPaint)) {
return newPaint;
}
if ("color" in newPaint) {
if (!newPaint.strokeColor) {
newPaint.strokeColor = newPaint.color;
}
else if (isPropertiesPaint(paint)) {
return (feature) => {
return preparePaint({
paint: createPropertiesPaint(paint)(feature),
defaultPaint,
getPaintFunctions,
});
};
if (!newPaint.fillColor) {
newPaint.fillColor = newPaint.color;
}
else if (paint.type === 'get-paint') {
const getPaint = updatePaintOptionFromCallback(paint, getPaintFunctions);
if (getPaint) {
newPaint = preparePaint({
paint: getPaint,
defaultPaint,
getPaintFunctions,
});
}
}
if ("opacity" in newPaint) {
if (newPaint.strokeOpacity === void 0) {
newPaint.strokeOpacity = newPaint.opacity;
}
else if (paint.type === 'icon') {
return paint;
if (newPaint.fillOpacity === void 0) {
newPaint.fillOpacity = newPaint.opacity;
}
else {
newPaint = expressionCallback({ paint, defaultPaint });
}
if (isPaintCallback(newPaint)) {
return newPaint;
}
if ('color' in newPaint) {
if (!newPaint.strokeColor) {
newPaint.strokeColor = newPaint.color;
}
if (!newPaint.fillColor) {
newPaint.fillColor = newPaint.color;
}
}
if ('opacity' in newPaint) {
if (newPaint.strokeOpacity === undefined) {
newPaint.strokeOpacity = newPaint.opacity;
}
if (newPaint.fillOpacity === undefined) {
newPaint.fillOpacity = newPaint.opacity;
}
}
return newPaint;
}
return newPaint;
}

@@ -197,0 +195,0 @@

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@nextgis/expression"),n=require("@nextgis/properties-filter");function i(t){return!!Array.isArray(t)}function e(t){return"[object Object]"===Object.prototype.toString.call(t)}function r(t){return"function"==typeof t}function o(n){return i=>{const e=i.properties;return!!e&&t.evaluate(n,e)}}const a=["iconSize","iconAnchor"];function s(n){let i=!1;const e={};for(const r in n)if(-1===a.indexOf(r)){const a=r,s=n[a];t.isExpression(s)&&(i=!0,e[a]=o(s))}if(i)return t=>{const i={};for(const n in e)i[n]=e[n](t);return{...n,...i}}}function c(t){let i={};const e=[];for(const n of t)n&&(Array.isArray(n)?e.push(n):i=n);return t=>{const r=e.find((i=>n.featureFilter(t,i[0])));return r?{...i,...r[1]}:i}}function p({paint:t,defaultPaint:n}){var i;let e={...n};return e={...e,...t},e.fill=null===(i=e.fill)||void 0===i||i,e.stroke=void 0!==e.stroke?e.stroke:!e.fill||!(!e.strokeColor&&!e.strokeOpacity),e}function f({paint:t,defaultPaint:n,getPaintFunctions:e}){if(!t)throw new Error("paint is empty");let o={...n};if(r(t)){const i=i=>{const r=f({paint:t(i),defaultPaint:n,getPaintFunctions:e});return r.type=t.type,r};return i.type=t.type,i}if(i(t))return i=>f({paint:c(t)(i),defaultPaint:n,getPaintFunctions:e});if("get-paint"===t.type){const i=function(t,n){if("function"==typeof t.from)return t.from(t.options);if("string"==typeof t.from&&n){const i=n[t.from];if(i)return i(t.options)}}(t,e);i&&(o=f({paint:i,defaultPaint:n,getPaintFunctions:e}))}else{if("icon"===t.type)return t;o=function({paint:t,defaultPaint:n}){const i=s(t);if(i){const e=t=>f({paint:i(t),defaultPaint:n});return e.paint=p({paint:t,defaultPaint:n}),e}return p({paint:t,defaultPaint:n})}({paint:t,defaultPaint:n})}return r(o)||("color"in o&&(o.strokeColor||(o.strokeColor=o.color),o.fillColor||(o.fillColor=o.color)),"opacity"in o&&(void 0===o.strokeOpacity&&(o.strokeOpacity=o.opacity),void 0===o.fillOpacity&&(o.fillOpacity=o.opacity))),o}exports.createExpressionCallback=s,exports.isBasePaint=function(t){return!!e(t)&&("get-paint"!==t.type&&"icon"!==t.type)},exports.isIcon=function(t){return"icon"===t.type||"html"in t},exports.isPaint=e,exports.isPaintCallback=r,exports.isPropertiesPaint=i,exports.preparePaint=f;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@nextgis/expression"),n=require("@nextgis/properties-filter");function i(t){return!!Array.isArray(t)}function e(t){return"[object Object]"===Object.prototype.toString.call(t)}function r(t){return"function"==typeof t}function o(n){return i=>{const e=i.properties;return!!e&&t.evaluate(n,e)}}const a=["iconSize","iconAnchor"];function s(n){let i=!1;const e={};for(const r in n)if(-1===a.indexOf(r)){const a=r,s=n[a];t.isExpression(s)&&(i=!0,e[a]=o(s))}if(i)return t=>{const i={};for(const n in e)i[n]=e[n](t);return{...n,...i}}}function c(t){let i={};const e=[];for(const n of t)n&&(Array.isArray(n)?e.push(n):i=n);return t=>{const r=e.find((i=>n.featureFilter(t,i[0])));return r?{...i,...r[1]}:i}}function p({paint:t,defaultPaint:n}){var i;let e={...n};return e={...e,...t},e.fill=null==(i=e.fill)||i,e.stroke=void 0!==e.stroke?e.stroke:!e.fill||!(!e.strokeColor&&!e.strokeOpacity),e}function f({paint:t,defaultPaint:n,getPaintFunctions:e}){if(!t)throw new Error("paint is empty");let o={...n};if(r(t)){const i=i=>{const r=f({paint:t(i),defaultPaint:n,getPaintFunctions:e});return r.type=t.type,r};return i.type=t.type,i}if(i(t))return i=>f({paint:c(t)(i),defaultPaint:n,getPaintFunctions:e});if("get-paint"===t.type){const i=function(t,n){if("function"==typeof t.from)return t.from(t.options);if("string"==typeof t.from&&n){const i=n[t.from];if(i)return i(t.options)}}(t,e);i&&(o=f({paint:i,defaultPaint:n,getPaintFunctions:e}))}else{if("icon"===t.type)return t;o=function({paint:t,defaultPaint:n}){const i=s(t);if(i){const e=t=>f({paint:i(t),defaultPaint:n});return e.paint=p({paint:t,defaultPaint:n}),e}return p({paint:t,defaultPaint:n})}({paint:t,defaultPaint:n})}return r(o)||("color"in o&&(o.strokeColor||(o.strokeColor=o.color),o.fillColor||(o.fillColor=o.color)),"opacity"in o&&(void 0===o.strokeOpacity&&(o.strokeOpacity=o.opacity),void 0===o.fillOpacity&&(o.fillOpacity=o.opacity))),o}exports.createExpressionCallback=s,exports.isBasePaint=function(t){return!!e(t)&&("get-paint"!==t.type&&"icon"!==t.type)},exports.isIcon=function(t){return"icon"===t.type||"html"in t},exports.isPaint=e,exports.isPaintCallback=r,exports.isPropertiesPaint=i,exports.preparePaint=f;
//# sourceMappingURL=paint.cjs.prod.js.map

@@ -1,924 +0,973 @@

/** Bundle of @nextgis/paint; version: 1.19.0; author: NextGIS */
/** Bundle of @nextgis/paint; version: 2.0.0-alpha.0; author: NextGIS */
function isPropertiesPaint(paint) {
if (Array.isArray(paint)) {
return true;
}
return false;
if (Array.isArray(paint)) {
return true;
}
return false;
}
function isPaint(paint) {
if (Object.prototype.toString.call(paint) === '[object Object]') {
return true;
}
return false;
if (Object.prototype.toString.call(paint) === "[object Object]") {
return true;
}
return false;
}
function isBasePaint(paint) {
if (isPaint(paint)) {
if (paint.type === 'get-paint' || paint.type === 'icon') {
return false;
}
return true;
if (isPaint(paint)) {
if (paint.type === "get-paint" || paint.type === "icon") {
return false;
}
return false;
return true;
}
return false;
}
function isPaintCallback(paint) {
if (typeof paint === 'function') {
return true;
}
return false;
if (typeof paint === "function") {
return true;
}
return false;
}
function isIcon(paint) {
return paint.type === 'icon' || 'html' in paint;
return paint.type === "icon" || "html" in paint;
}
function evaluateArgs(cb) {
return (args, data) => {
const unwrap = args.map((a) => a());
return cb(unwrap, data);
};
return (args, data) => {
const unwrap = args.map((a) => a());
return cb(unwrap, data);
};
}
function not([expr]) {
return !expr;
return !expr;
}
function notEqual([a, b]) {
return a !== b;
return a !== b;
}
function lessThan([left, right]) {
return left < right;
return left < right;
}
function lessThanOrEqual([left, right]) {
return left <= right;
return left <= right;
}
function equal([left, right]) {
return left === right;
return left === right;
}
function greaterThan([left, right]) {
return left > right;
return left > right;
}
function greaterThanOrEqual([left, right]) {
return left >= right;
return left >= right;
}
const coalesce = (args) => {
for (let i = 0; i < args.length; i++) {
const arg = args[i]();
if (arg !== null && arg !== undefined) {
return arg;
}
for (let i = 0; i < args.length; i++) {
const arg = args[i]();
if (arg !== null && arg !== void 0) {
return arg;
}
return null;
}
return null;
};
const all = (args) => {
for (let i = 0; i < args.length; i++) {
const arg = args[i]();
if (!arg) {
return false;
}
for (let i = 0; i < args.length; i++) {
const arg = args[i]();
if (!arg) {
return false;
}
return true;
}
return true;
};
const any = (args) => {
for (let i = 0; i < args.length; i++) {
const arg = args[i]();
if (arg) {
return true;
}
for (let i = 0; i < args.length; i++) {
const arg = args[i]();
if (arg) {
return true;
}
return false;
}
return false;
};
const match = (args) => {
const [lookupFn, ...cases] = args;
const lookup = lookupFn();
// remove last odd item from cases array
const defValue = cases.splice(-1, cases.length % 2)[0];
for (let fry = 0; fry < cases.length - 1; fry += 2) {
const key = cases[fry]();
if (key === lookup) {
return cases[fry + 1]();
}
const [lookupFn, ...cases] = args;
const lookup = lookupFn();
const defValue = cases.splice(-1, cases.length % 2)[0];
for (let fry = 0; fry < cases.length - 1; fry += 2) {
const key = cases[fry]();
if (key === lookup) {
return cases[fry + 1]();
}
return defValue();
}
return defValue();
};
const caseFunc = (args) => {
if (args.length < 2) {
throw new Error('The "case" function requires at least a condition and a corresponding output.');
if (args.length < 2) {
throw new Error(
'The "case" function requires at least a condition and a corresponding output.'
);
}
if (args.length % 2 === 0) {
throw new Error(
"Missing a fallback value or unmatched condition-output pair."
);
}
for (let i = 0; i < args.length - 1; i += 2) {
const condition = args[i]();
const value = args[i + 1]();
if (condition) {
return value;
}
if (args.length % 2 === 0) {
throw new Error('Missing a fallback value or unmatched condition-output pair.');
}
for (let i = 0; i < args.length - 1; i += 2) {
const condition = args[i]();
const value = args[i + 1]();
if (condition) {
return value;
}
}
const fallback = args[args.length - 1];
return fallback();
}
const fallback = args[args.length - 1];
return fallback();
};
const decisionExpressions = {
'!': evaluateArgs(not),
'!=': evaluateArgs(notEqual),
'<': evaluateArgs(lessThan),
'<=': evaluateArgs(lessThanOrEqual),
'==': evaluateArgs(equal),
'>': evaluateArgs(greaterThan),
'>=': evaluateArgs(greaterThanOrEqual),
coalesce,
all,
any,
case: caseFunc,
match,
"!": evaluateArgs(not),
"!=": evaluateArgs(notEqual),
"<": evaluateArgs(lessThan),
"<=": evaluateArgs(lessThanOrEqual),
"==": evaluateArgs(equal),
">": evaluateArgs(greaterThan),
">=": evaluateArgs(greaterThanOrEqual),
coalesce,
all,
any,
case: caseFunc,
match
};
const COLORS = {
aliceblue: '#f0f8ff',
antiquewhite: '#faebd7',
aqua: '#00ffff',
aquamarine: '#7fffd4',
azure: '#f0ffff',
beige: '#f5f5dc',
bisque: '#ffe4c4',
black: '#000000',
blanchedalmond: '#ffebcd',
blue: '#0000ff',
blueviolet: '#8a2be2',
brown: '#a52a2a',
burlywood: '#deb887',
cadetblue: '#5f9ea0',
chartreuse: '#7fff00',
chocolate: '#d2691e',
coral: '#ff7f50',
cornflowerblue: '#6495ed',
cornsilk: '#fff8dc',
crimson: '#dc143c',
cyan: '#00ffff',
darkblue: '#00008b',
darkcyan: '#008b8b',
darkgoldenrod: '#b8860b',
darkgray: '#a9a9a9',
darkgreen: '#006400',
darkkhaki: '#bdb76b',
darkmagenta: '#8b008b',
darkolivegreen: '#556b2f',
darkorange: '#ff8c00',
darkorchid: '#9932cc',
darkred: '#8b0000',
darksalmon: '#e9967a',
darkseagreen: '#8fbc8f',
darkslateblue: '#483d8b',
darkslategray: '#2f4f4f',
darkturquoise: '#00ced1',
darkviolet: '#9400d3',
deeppink: '#ff1493',
deepskyblue: '#00bfff',
dimgray: '#696969',
dodgerblue: '#1e90ff',
firebrick: '#b22222',
floralwhite: '#fffaf0',
forestgreen: '#228b22',
fuchsia: '#ff00ff',
gainsboro: '#dcdcdc',
ghostwhite: '#f8f8ff',
gold: '#ffd700',
goldenrod: '#daa520',
gray: '#808080',
green: '#008000',
greenyellow: '#adff2f',
honeydew: '#f0fff0',
hotpink: '#ff69b4',
'indianred ': '#cd5c5c',
indigo: '#4b0082',
ivory: '#fffff0',
khaki: '#f0e68c',
lavender: '#e6e6fa',
lavenderblush: '#fff0f5',
lawngreen: '#7cfc00',
lemonchiffon: '#fffacd',
lightblue: '#add8e6',
lightcoral: '#f08080',
lightcyan: '#e0ffff',
lightgoldenrodyellow: '#fafad2',
lightgrey: '#d3d3d3',
lightgreen: '#90ee90',
lightpink: '#ffb6c1',
lightsalmon: '#ffa07a',
lightseagreen: '#20b2aa',
lightskyblue: '#87cefa',
lightslategray: '#778899',
lightsteelblue: '#b0c4de',
lightyellow: '#ffffe0',
lime: '#00ff00',
limegreen: '#32cd32',
linen: '#faf0e6',
magenta: '#ff00ff',
maroon: '#800000',
mediumaquamarine: '#66cdaa',
mediumblue: '#0000cd',
mediumorchid: '#ba55d3',
mediumpurple: '#9370d8',
mediumseagreen: '#3cb371',
mediumslateblue: '#7b68ee',
mediumspringgreen: '#00fa9a',
mediumturquoise: '#48d1cc',
mediumvioletred: '#c71585',
midnightblue: '#191970',
mintcream: '#f5fffa',
mistyrose: '#ffe4e1',
moccasin: '#ffe4b5',
navajowhite: '#ffdead',
navy: '#000080',
oldlace: '#fdf5e6',
olive: '#808000',
olivedrab: '#6b8e23',
orange: '#ffa500',
orangered: '#ff4500',
orchid: '#da70d6',
palegoldenrod: '#eee8aa',
palegreen: '#98fb98',
paleturquoise: '#afeeee',
palevioletred: '#d87093',
papayawhip: '#ffefd5',
peachpuff: '#ffdab9',
peru: '#cd853f',
pink: '#ffc0cb',
plum: '#dda0dd',
powderblue: '#b0e0e6',
purple: '#800080',
rebeccapurple: '#663399',
red: '#ff0000',
rosybrown: '#bc8f8f',
royalblue: '#4169e1',
saddlebrown: '#8b4513',
salmon: '#fa8072',
sandybrown: '#f4a460',
seagreen: '#2e8b57',
seashell: '#fff5ee',
sienna: '#a0522d',
silver: '#c0c0c0',
skyblue: '#87ceeb',
slateblue: '#6a5acd',
slategray: '#708090',
snow: '#fffafa',
springgreen: '#00ff7f',
steelblue: '#4682b4',
tan: '#d2b48c',
teal: '#008080',
thistle: '#d8bfd8',
tomato: '#ff6347',
turquoise: '#40e0d0',
violet: '#ee82ee',
wheat: '#f5deb3',
white: '#ffffff',
whitesmoke: '#f5f5f5',
yellow: '#ffff00',
yellowgreen: '#9acd32',
aliceblue: "#f0f8ff",
antiquewhite: "#faebd7",
aqua: "#00ffff",
aquamarine: "#7fffd4",
azure: "#f0ffff",
beige: "#f5f5dc",
bisque: "#ffe4c4",
black: "#000000",
blanchedalmond: "#ffebcd",
blue: "#0000ff",
blueviolet: "#8a2be2",
brown: "#a52a2a",
burlywood: "#deb887",
cadetblue: "#5f9ea0",
chartreuse: "#7fff00",
chocolate: "#d2691e",
coral: "#ff7f50",
cornflowerblue: "#6495ed",
cornsilk: "#fff8dc",
crimson: "#dc143c",
cyan: "#00ffff",
darkblue: "#00008b",
darkcyan: "#008b8b",
darkgoldenrod: "#b8860b",
darkgray: "#a9a9a9",
darkgreen: "#006400",
darkkhaki: "#bdb76b",
darkmagenta: "#8b008b",
darkolivegreen: "#556b2f",
darkorange: "#ff8c00",
darkorchid: "#9932cc",
darkred: "#8b0000",
darksalmon: "#e9967a",
darkseagreen: "#8fbc8f",
darkslateblue: "#483d8b",
darkslategray: "#2f4f4f",
darkturquoise: "#00ced1",
darkviolet: "#9400d3",
deeppink: "#ff1493",
deepskyblue: "#00bfff",
dimgray: "#696969",
dodgerblue: "#1e90ff",
firebrick: "#b22222",
floralwhite: "#fffaf0",
forestgreen: "#228b22",
fuchsia: "#ff00ff",
gainsboro: "#dcdcdc",
ghostwhite: "#f8f8ff",
gold: "#ffd700",
goldenrod: "#daa520",
gray: "#808080",
green: "#008000",
greenyellow: "#adff2f",
honeydew: "#f0fff0",
hotpink: "#ff69b4",
"indianred ": "#cd5c5c",
indigo: "#4b0082",
ivory: "#fffff0",
khaki: "#f0e68c",
lavender: "#e6e6fa",
lavenderblush: "#fff0f5",
lawngreen: "#7cfc00",
lemonchiffon: "#fffacd",
lightblue: "#add8e6",
lightcoral: "#f08080",
lightcyan: "#e0ffff",
lightgoldenrodyellow: "#fafad2",
lightgrey: "#d3d3d3",
lightgreen: "#90ee90",
lightpink: "#ffb6c1",
lightsalmon: "#ffa07a",
lightseagreen: "#20b2aa",
lightskyblue: "#87cefa",
lightslategray: "#778899",
lightsteelblue: "#b0c4de",
lightyellow: "#ffffe0",
lime: "#00ff00",
limegreen: "#32cd32",
linen: "#faf0e6",
magenta: "#ff00ff",
maroon: "#800000",
mediumaquamarine: "#66cdaa",
mediumblue: "#0000cd",
mediumorchid: "#ba55d3",
mediumpurple: "#9370d8",
mediumseagreen: "#3cb371",
mediumslateblue: "#7b68ee",
mediumspringgreen: "#00fa9a",
mediumturquoise: "#48d1cc",
mediumvioletred: "#c71585",
midnightblue: "#191970",
mintcream: "#f5fffa",
mistyrose: "#ffe4e1",
moccasin: "#ffe4b5",
navajowhite: "#ffdead",
navy: "#000080",
oldlace: "#fdf5e6",
olive: "#808000",
olivedrab: "#6b8e23",
orange: "#ffa500",
orangered: "#ff4500",
orchid: "#da70d6",
palegoldenrod: "#eee8aa",
palegreen: "#98fb98",
paleturquoise: "#afeeee",
palevioletred: "#d87093",
papayawhip: "#ffefd5",
peachpuff: "#ffdab9",
peru: "#cd853f",
pink: "#ffc0cb",
plum: "#dda0dd",
powderblue: "#b0e0e6",
purple: "#800080",
rebeccapurple: "#663399",
red: "#ff0000",
rosybrown: "#bc8f8f",
royalblue: "#4169e1",
saddlebrown: "#8b4513",
salmon: "#fa8072",
sandybrown: "#f4a460",
seagreen: "#2e8b57",
seashell: "#fff5ee",
sienna: "#a0522d",
silver: "#c0c0c0",
skyblue: "#87ceeb",
slateblue: "#6a5acd",
slategray: "#708090",
snow: "#fffafa",
springgreen: "#00ff7f",
steelblue: "#4682b4",
tan: "#d2b48c",
teal: "#008080",
thistle: "#d8bfd8",
tomato: "#ff6347",
turquoise: "#40e0d0",
violet: "#ee82ee",
wheat: "#f5deb3",
white: "#ffffff",
whitesmoke: "#f5f5f5",
yellow: "#ffff00",
yellowgreen: "#9acd32"
};
function isHex(hex) {
return typeof hex === 'string' && /^#([A-Fa-f0-9]{3}){1,2}$/.test(hex);
return typeof hex === "string" && /^#([A-Fa-f0-9]{3}){1,2}$/.test(hex);
}
function isRgb(hex) {
const r =
const r = (
// eslint-disable-next-line max-len
/^rgb(a?)\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)(?:\s*,\s*([01](?:\.\d+)?))?\s*\)$/;
return typeof hex === 'string' && r.test(hex);
/^rgb(a?)\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)(?:\s*,\s*([01](?:\.\d+)?))?\s*\)$/
);
return typeof hex === "string" && r.test(hex);
}
function isColorObj(obj) {
if (typeof obj === 'object' && obj !== null) {
const hasRgb = 'r' in obj && 'g' in obj && 'b' in obj;
const hasValidAlpha = !('a' in obj) || (typeof obj.a === 'number' && obj.a >= 0 && obj.a <= 1);
return hasRgb && hasValidAlpha;
}
return false;
if (typeof obj === "object" && obj !== null) {
const hasRgb = "r" in obj && "g" in obj && "b" in obj;
const hasValidAlpha = !("a" in obj) || typeof obj.a === "number" && obj.a >= 0 && obj.a <= 1;
return hasRgb && hasValidAlpha;
}
return false;
}
function isColorName(name) {
if (typeof name === 'string' && name in COLORS) {
return true;
}
return false;
if (typeof name === "string" && name in COLORS) {
return true;
}
return false;
}
function toColor(value) {
if (isHex(value)) {
return hexToColor(value);
}
else if (isColorName(value)) {
return colorNameToColor(value);
}
else if (isRgb(value)) {
return rgbToColor(value);
}
else if (isColorObj(value)) {
return colorObjectToColor(value);
}
throw new Error(`The '${value}' cannot be converted to color`);
if (isHex(value)) {
return hexToColor(value);
} else if (isColorName(value)) {
return colorNameToColor(value);
} else if (isRgb(value)) {
return rgbToColor(value);
} else if (isColorObj(value)) {
return colorObjectToColor(value);
}
throw new Error(`The '${value}' cannot be converted to color`);
}
function colorNameToColor(name) {
return hexToColor(COLORS[name]);
return hexToColor(COLORS[name]);
}
function hexToColor(hex) {
const shortRGB = /^#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])$/;
const shortRGBA = /^#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])$/;
const longRGB = /^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/;
const longRGBA = /^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/;
let result;
if ((result = shortRGB.exec(hex))) {
return [
parseInt(result[1] + result[1], 16),
parseInt(result[2] + result[2], 16),
parseInt(result[3] + result[3], 16),
];
}
else if ((result = shortRGBA.exec(hex))) {
return [
parseInt(result[1] + result[1], 16),
parseInt(result[2] + result[2], 16),
parseInt(result[3] + result[3], 16),
parseInt(result[4] + result[4], 16) / 255,
];
}
else if ((result = longRGB.exec(hex))) {
return [
parseInt(result[1], 16),
parseInt(result[2], 16),
parseInt(result[3], 16),
];
}
else if ((result = longRGBA.exec(hex))) {
return [
parseInt(result[1], 16),
parseInt(result[2], 16),
parseInt(result[3], 16),
parseInt(result[4], 16) / 255,
];
}
throw new Error(`The '${hex}' Is not valid hex`);
const shortRGB = /^#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])$/;
const shortRGBA = /^#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])$/;
const longRGB = /^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/;
const longRGBA = /^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/;
let result;
if (result = shortRGB.exec(hex)) {
return [
parseInt(result[1] + result[1], 16),
parseInt(result[2] + result[2], 16),
parseInt(result[3] + result[3], 16)
];
} else if (result = shortRGBA.exec(hex)) {
return [
parseInt(result[1] + result[1], 16),
parseInt(result[2] + result[2], 16),
parseInt(result[3] + result[3], 16),
parseInt(result[4] + result[4], 16) / 255
];
} else if (result = longRGB.exec(hex)) {
return [
parseInt(result[1], 16),
parseInt(result[2], 16),
parseInt(result[3], 16)
];
} else if (result = longRGBA.exec(hex)) {
return [
parseInt(result[1], 16),
parseInt(result[2], 16),
parseInt(result[3], 16),
parseInt(result[4], 16) / 255
];
}
throw new Error(`The '${hex}' Is not valid hex`);
}
function rgbToColor(rgb) {
const rgbPattern = /^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/;
const rgbaPattern = /^rgba\((\d+),\s*(\d+),\s*(\d+),\s*([\d.]+)\)$/;
let matches;
if ((matches = rgb.match(rgbPattern))) {
return [
parseInt(matches[1], 10),
parseInt(matches[2], 10),
parseInt(matches[3], 10),
];
}
else if ((matches = rgb.match(rgbaPattern))) {
return [
parseInt(matches[1], 10),
parseInt(matches[2], 10),
parseInt(matches[3], 10),
parseFloat(matches[4]),
];
}
throw new Error(`The '${rgb}' Is not valid rgb`);
const rgbPattern = /^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/;
const rgbaPattern = /^rgba\((\d+),\s*(\d+),\s*(\d+),\s*([\d.]+)\)$/;
let matches;
if (matches = rgb.match(rgbPattern)) {
return [
parseInt(matches[1], 10),
parseInt(matches[2], 10),
parseInt(matches[3], 10)
];
} else if (matches = rgb.match(rgbaPattern)) {
return [
parseInt(matches[1], 10),
parseInt(matches[2], 10),
parseInt(matches[3], 10),
parseFloat(matches[4])
];
}
throw new Error(`The '${rgb}' Is not valid rgb`);
}
function colorObjectToColor({ r, g, b, a }) {
return [r, g, b, ...(a !== undefined ? [a] : [])];
return [r, g, b, ...a !== void 0 ? [a] : []];
}
function colorToRGB(array) {
return `rgb(${array.join(',')})`;
return `rgb(${array.join(",")})`;
}
function linearInterpolation(input, input1, output1, input2, output2) {
if (typeof output1 === 'number' && typeof output2 === 'number') {
return (output1 + ((input - input1) / (input2 - input1)) * (output2 - output1));
}
try {
const outputColor1 = toColor(output1);
const outputColor2 = toColor(output2);
return colorToRGB(outputColor1.map((val, index) => {
return Math.ceil(linearInterpolation(input, input1, val, input2, outputColor2[index]));
}));
}
catch (er) {
console.log(er);
}
throw new Error('Unsupported output type for linear interpolation.');
if (typeof output1 === "number" && typeof output2 === "number") {
return output1 + (input - input1) / (input2 - input1) * (output2 - output1);
}
try {
const outputColor1 = toColor(output1);
const outputColor2 = toColor(output2);
return colorToRGB(
outputColor1.map((val, index) => {
return Math.ceil(
linearInterpolation(input, input1, val, input2, outputColor2[index])
);
})
);
} catch (er) {
console.log(er);
}
throw new Error("Unsupported output type for linear interpolation.");
}
const interpolate = ([interpolationFn, inputFn, ...stops]) => {
if (stops.length < 2) {
throw new Error('At least two stops are required');
const interpolate = ([
interpolationFn,
inputFn,
...stops
]) => {
if (stops.length < 2) {
throw new Error("At least two stops are required");
}
if (stops.length < 2 || stops.length % 2 !== 0) {
throw new Error("Invalid stops provided.");
}
const input = inputFn();
if (typeof input !== "number") {
throw new Error("Input must be a number.");
}
const interpolation = interpolationFn();
for (let i = 0; i < stops.length - 2; i += 2) {
const stopInput1 = stops[i]();
const stopOutput1 = stops[i + 1]();
const stopInput2 = stops[i + 2]();
const stopOutput2 = stops[i + 3]();
if (input >= stopInput1 && input <= stopInput2) {
if (interpolation[0] === "linear") {
return linearInterpolation(
input,
stopInput1,
stopOutput1,
stopInput2,
stopOutput2
);
}
}
if (stops.length < 2 || stops.length % 2 !== 0) {
throw new Error('Invalid stops provided.');
}
const input = inputFn();
if (typeof input !== 'number') {
throw new Error('Input must be a number.');
}
const interpolation = interpolationFn();
for (let i = 0; i < stops.length - 2; i += 2) {
const stopInput1 = stops[i]();
const stopOutput1 = stops[i + 1]();
const stopInput2 = stops[i + 2]();
const stopOutput2 = stops[i + 3]();
if (input >= stopInput1 && input <= stopInput2) {
if (interpolation[0] === 'linear') {
return linearInterpolation(input, stopInput1, stopOutput1, stopInput2, stopOutput2);
}
// else if (interpolation[0] === 'exponential') {
// const base = interpolation[1];
// return exponentialInterpolation(
// input,
// base,
// stopInput1,
// stopOutput1,
// stopInput2,
// stopOutput2,
// );
// }
}
}
throw new Error('Invalid interpolation type.');
}
throw new Error("Invalid interpolation type.");
};
const step = (args) => {
const [inputFn, defaultValue, ...stops] = args;
const input = inputFn();
if (typeof input !== 'number') {
return defaultValue();
const [inputFn, defaultValue, ...stops] = args;
const input = inputFn();
if (typeof input !== "number") {
return defaultValue();
}
for (let i = 0; i < stops.length - 2; i += 2) {
const stopInput = stops[i]();
const stopOutput = stops[i + 1]();
const nextStopInput = stops[i + 2]();
if (input >= stopInput && input < nextStopInput) {
return stopOutput;
}
for (let i = 0; i < stops.length - 2; i += 2) {
const stopInput = stops[i]();
const stopOutput = stops[i + 1]();
const nextStopInput = stops[i + 2]();
if (input >= stopInput && input < nextStopInput) {
return stopOutput;
}
}
if (input >= stops[stops.length - 2]()) {
return stops[stops.length - 1]();
}
return defaultValue();
}
if (input >= stops[stops.length - 2]()) {
return stops[stops.length - 1]();
}
return defaultValue();
};
const interpolationExpressions = {
step,
interpolate,
step,
interpolate
};
function get([key, objExp], data) {
const target = objExp || data;
if (target && typeof target === 'object' && key in target) {
return target[key];
}
return null;
const target = objExp || data;
if (target && typeof target === "object" && key in target) {
return target[key];
}
return null;
}
function has([key, objExp], data) {
const target = objExp || data;
return !!(target && typeof target === 'object' && key in target);
const target = objExp || data;
return !!(target && typeof target === "object" && key in target);
}
function at([index, array]) {
return array[index];
return array[index];
}
function inFunc([keyword, input]) {
if (typeof input === 'string') {
return input.includes(String(keyword));
}
else if (Array.isArray(input)) {
return input.includes(keyword);
}
throw new Error(`Invalid input type for 'in'. Expected string or array, got ${typeof input}.`);
if (typeof input === "string") {
return input.includes(String(keyword));
} else if (Array.isArray(input)) {
return input.includes(keyword);
}
throw new Error(
`Invalid input type for 'in'. Expected string or array, got ${typeof input}.`
);
}
const length = ([item]) => {
if (typeof item === 'string' || Array.isArray(item)) {
return item.length;
}
return undefined;
if (typeof item === "string" || Array.isArray(item)) {
return item.length;
}
return void 0;
};
function indexOf([keyword, input, startIndex]) {
if (typeof input === 'string') {
return input.indexOf(String(keyword), startIndex);
}
else if (Array.isArray(input)) {
return input.indexOf(keyword, startIndex);
}
throw new Error(`Invalid input type for 'index-of'. Expected string or array, got ${typeof input}.`);
if (typeof input === "string") {
return input.indexOf(String(keyword), startIndex);
} else if (Array.isArray(input)) {
return input.indexOf(keyword, startIndex);
}
throw new Error(
`Invalid input type for 'index-of'. Expected string or array, got ${typeof input}.`
);
}
function slice(args) {
const [input, startIndex, endIndex] = args;
if (typeof input === 'string') {
return input.slice(startIndex, endIndex);
}
else if (Array.isArray(input)) {
return input.slice(startIndex, endIndex);
}
throw new Error(`Invalid input type for 'slice'. Expected string or array, got ${typeof input}.`);
const [input, startIndex, endIndex] = args;
if (typeof input === "string") {
return input.slice(startIndex, endIndex);
} else if (Array.isArray(input)) {
return input.slice(startIndex, endIndex);
}
throw new Error(
`Invalid input type for 'slice'. Expected string or array, got ${typeof input}.`
);
}
const lookupExpressions = {
get: evaluateArgs(get),
length: evaluateArgs(length),
at: evaluateArgs(at),
has: evaluateArgs(has),
in: evaluateArgs(inFunc),
'index-of': evaluateArgs(indexOf),
slice: evaluateArgs(slice),
get: evaluateArgs(get),
length: evaluateArgs(length),
at: evaluateArgs(at),
has: evaluateArgs(has),
in: evaluateArgs(inFunc),
"index-of": evaluateArgs(indexOf),
slice: evaluateArgs(slice)
};
const mathExpressions = {
'+': evaluateArgs((args) => args.reduce((a, b) => a + b, 0)),
'-': evaluateArgs((args) => args.reduce((a, b) => a - b)),
'*': evaluateArgs((args) => args.reduce((a, b) => a * b, 1)),
'/': evaluateArgs((args) => args.reduce((a, b) => a / b)),
'%': evaluateArgs((args) => args[0] % args[1]),
'^': evaluateArgs((args) => Math.pow(args[0], args[1])),
abs: evaluateArgs((args) => Math.abs(args[0])),
acos: evaluateArgs((args) => Math.acos(args[0])),
asin: evaluateArgs((args) => Math.asin(args[0])),
atan: evaluateArgs((args) => Math.atan(args[0])),
ceil: evaluateArgs((args) => Math.ceil(args[0])),
cos: evaluateArgs((args) => Math.cos(args[0])),
e: () => Math.E,
floor: evaluateArgs((args) => Math.floor(args[0])),
ln: evaluateArgs((args) => Math.log(args[0])),
ln2: () => Math.LN2,
log10: evaluateArgs((args) => Math.log10(args[0])),
log2: evaluateArgs((args) => Math.log2(args[0])),
max: evaluateArgs((args) => Math.max(...args)),
min: evaluateArgs((args) => Math.min(...args)),
pi: () => Math.PI,
round: evaluateArgs((args) => Math.round(args[0])),
sin: evaluateArgs((args) => Math.sin(args[0])),
sqrt: evaluateArgs((args) => Math.sqrt(args[0])),
tan: evaluateArgs((args) => Math.tan(args[0])),
"+": evaluateArgs((args) => args.reduce((a, b) => a + b, 0)),
"-": evaluateArgs((args) => args.reduce((a, b) => a - b)),
"*": evaluateArgs((args) => args.reduce((a, b) => a * b, 1)),
"/": evaluateArgs((args) => args.reduce((a, b) => a / b)),
"%": evaluateArgs((args) => args[0] % args[1]),
"^": evaluateArgs((args) => Math.pow(args[0], args[1])),
abs: evaluateArgs((args) => Math.abs(args[0])),
acos: evaluateArgs((args) => Math.acos(args[0])),
asin: evaluateArgs((args) => Math.asin(args[0])),
atan: evaluateArgs((args) => Math.atan(args[0])),
ceil: evaluateArgs((args) => Math.ceil(args[0])),
cos: evaluateArgs((args) => Math.cos(args[0])),
e: () => Math.E,
floor: evaluateArgs((args) => Math.floor(args[0])),
ln: evaluateArgs((args) => Math.log(args[0])),
ln2: () => Math.LN2,
log10: evaluateArgs((args) => Math.log10(args[0])),
log2: evaluateArgs((args) => Math.log2(args[0])),
max: evaluateArgs((args) => Math.max(...args)),
min: evaluateArgs((args) => Math.min(...args)),
pi: () => Math.PI,
round: evaluateArgs((args) => Math.round(args[0])),
sin: evaluateArgs((args) => Math.sin(args[0])),
sqrt: evaluateArgs((args) => Math.sqrt(args[0])),
tan: evaluateArgs((args) => Math.tan(args[0]))
};
const stringExpressions = {
concat: evaluateArgs((args) => args.reduce((a, b) => String(a) + String(b), '')),
downcase: evaluateArgs((args) => String(args[0]).toLowerCase()),
upcase: evaluateArgs((args) => String(args[0]).toUpperCase()),
concat: evaluateArgs((args) => args.reduce((a, b) => String(a) + String(b), "")),
downcase: evaluateArgs((args) => String(args[0]).toLowerCase()),
upcase: evaluateArgs((args) => String(args[0]).toUpperCase())
};
const tryConvert = (converter, arg, data) => {
try {
const result = converter(arg, data);
if (result !== undefined) {
return result;
}
try {
const result = converter(arg, data);
if (result !== void 0) {
return result;
}
catch {
// ignore errors
}
return undefined;
} catch (e) {
}
return void 0;
};
function fallback(cb) {
return (args, data) => {
for (const arg of args) {
const result = tryConvert(cb, arg, data);
if (result !== undefined) {
return result;
}
}
throw new Error(`Received a mismatched type`);
};
return (args, data) => {
for (const arg of args) {
const result = tryConvert(cb, arg, data);
if (result !== void 0) {
return result;
}
}
throw new Error(`Received a mismatched type`);
};
}
const array = (args) => {
const [firstArg, secondArg, thirdArg] = args;
let requiredType = undefined;
let requiredLength = undefined;
let value;
if (typeof firstArg === 'string' &&
['string', 'number', 'boolean'].includes(firstArg)) {
requiredType = firstArg;
if (typeof secondArg === 'number') {
requiredLength = secondArg;
value = thirdArg;
}
else {
value = secondArg;
}
const [firstArg, secondArg, thirdArg] = args;
let requiredType = void 0;
let requiredLength = void 0;
let value;
if (typeof firstArg === "string" && ["string", "number", "boolean"].includes(firstArg)) {
requiredType = firstArg;
if (typeof secondArg === "number") {
requiredLength = secondArg;
value = thirdArg;
} else {
value = secondArg;
}
else if (Array.isArray(firstArg)) {
value = firstArg;
}
if (!Array.isArray(value)) {
throw new Error('Expected an array');
}
if (requiredType && !value.every((item) => typeof item === requiredType)) {
throw new Error(`Expected all items in array to be of type ${requiredType}`);
}
if (requiredLength && value.length !== requiredLength) {
throw new Error(`Expected array of length ${requiredLength}`);
}
return value;
} else if (Array.isArray(firstArg)) {
value = firstArg;
}
if (!Array.isArray(value)) {
throw new Error("Expected an array");
}
if (requiredType && !value.every((item) => typeof item === requiredType)) {
throw new Error(
`Expected all items in array to be of type ${requiredType}`
);
}
if (requiredLength && value.length !== requiredLength) {
throw new Error(`Expected array of length ${requiredLength}`);
}
return value;
};
function typeOfValue(value) {
if (value === null)
return 'null';
switch (typeof value) {
case 'string':
return 'string';
case 'number':
return 'number';
case 'boolean':
return 'boolean';
case 'object':
if (Array.isArray(value)) {
let arrayType = 'value';
if (value.every((item) => typeof item === 'number')) {
arrayType = 'number';
}
else if (value.every((item) => typeof item === 'string')) {
arrayType = 'string';
}
else if (value.every((item) => typeof item === 'boolean')) {
arrayType = 'boolean';
}
return `array<${arrayType}, ${value.length}>`;
}
else {
return 'object';
}
default:
return 'undefined';
}
if (value === null)
return "null";
switch (typeof value) {
case "string":
return "string";
case "number":
return "number";
case "boolean":
return "boolean";
case "object":
if (Array.isArray(value)) {
let arrayType = "value";
if (value.every((item) => typeof item === "number")) {
arrayType = "number";
} else if (value.every((item) => typeof item === "string")) {
arrayType = "string";
} else if (value.every((item) => typeof item === "boolean")) {
arrayType = "boolean";
}
return `array<${arrayType}, ${value.length}>`;
} else {
return "object";
}
default:
return "undefined";
}
}
const typeExpressions = {
array: evaluateArgs(array),
boolean: evaluateArgs(fallback((arg) => (typeof arg === 'boolean' ? arg : undefined))),
literal: evaluateArgs(([arg]) => arg),
number: evaluateArgs(fallback((arg) => (typeof arg === 'number' ? arg : undefined))),
object: evaluateArgs(fallback((arg) => arg !== null && typeof arg === 'object' && !Array.isArray(arg)
? arg
: undefined)),
string: evaluateArgs(fallback((arg) => (typeof arg === 'string' ? arg : undefined))),
'to-boolean': evaluateArgs(fallback(Boolean)),
'to-number': evaluateArgs(fallback(Number)),
'to-string': evaluateArgs(fallback(String)),
typeof: evaluateArgs(([arg]) => typeOfValue(arg)),
array: evaluateArgs(array),
boolean: evaluateArgs(
fallback((arg) => typeof arg === "boolean" ? arg : void 0)
),
literal: evaluateArgs(([arg]) => arg),
number: evaluateArgs(fallback((arg) => typeof arg === "number" ? arg : void 0)),
object: evaluateArgs(
fallback(
(arg) => arg !== null && typeof arg === "object" && !Array.isArray(arg) ? arg : void 0
)
),
string: evaluateArgs(fallback((arg) => typeof arg === "string" ? arg : void 0)),
"to-boolean": evaluateArgs(fallback(Boolean)),
"to-number": evaluateArgs(fallback(Number)),
"to-string": evaluateArgs(fallback(String)),
typeof: evaluateArgs(([arg]) => typeOfValue(arg))
};
var __defProp$3 = Object.defineProperty;
var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues$3 = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp$3.call(b, prop))
__defNormalProp$3(a, prop, b[prop]);
if (__getOwnPropSymbols$3)
for (var prop of __getOwnPropSymbols$3(b)) {
if (__propIsEnum$3.call(b, prop))
__defNormalProp$3(a, prop, b[prop]);
}
return a;
};
function isExpression(value) {
if (Array.isArray(value)) {
const [lookup, ...cases] = value;
const l = lookup;
return (typeof l === 'string' &&
l !== 'literal' &&
l in expressions &&
cases.length > 0);
}
return false;
if (Array.isArray(value)) {
const [lookup, ...cases] = value;
const l = lookup;
return typeof l === "string" && l !== "literal" && l in expressions && cases.length > 0;
}
return false;
}
const expressions = {
...mathExpressions,
...typeExpressions,
...stringExpressions,
...lookupExpressions,
...decisionExpressions,
...interpolationExpressions,
};
const expressions = __spreadValues$3(__spreadValues$3(__spreadValues$3(__spreadValues$3(__spreadValues$3(__spreadValues$3({}, mathExpressions), typeExpressions), stringExpressions), lookupExpressions), decisionExpressions), interpolationExpressions);
function evaluate(expression, data = {}) {
const [name, ...args] = expression;
const expressionFun = expressions[name];
if (expressionFun) {
return expressionFun(args.map((arg) => () => (isExpression(arg) ? evaluate(arg, data) : arg)), data);
}
throw new Error(`Expression "${name}" is not supported.`);
const [name, ...args] = expression;
const expressionFun = expressions[name];
if (expressionFun) {
return expressionFun(
args.map((arg) => () => isExpression(arg) ? evaluate(arg, data) : arg),
data
);
}
throw new Error(`Expression "${name}" is not supported.`);
}
var __defProp$2 = Object.defineProperty;
var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues$2 = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp$2.call(b, prop))
__defNormalProp$2(a, prop, b[prop]);
if (__getOwnPropSymbols$2)
for (var prop of __getOwnPropSymbols$2(b)) {
if (__propIsEnum$2.call(b, prop))
__defNormalProp$2(a, prop, b[prop]);
}
return a;
};
function createPropertyExpressionCb(expression) {
return (feature) => {
const properties = feature.properties;
if (properties) {
return evaluate(expression, properties);
}
return false;
};
return (feature) => {
const properties = feature.properties;
if (properties) {
return evaluate(expression, properties);
}
return false;
};
}
const excludeExpressionList = ['iconSize', 'iconAnchor'];
const excludeExpressionList = ["iconSize", "iconAnchor"];
function createExpressionCallback(paint) {
let withExpression = false;
const expressions = {};
for (const p in paint) {
if (excludeExpressionList.indexOf(p) === -1) {
const p_ = p;
const val = paint[p_];
if (isExpression(val)) {
withExpression = true;
expressions[p_] = createPropertyExpressionCb(val);
}
}
let withExpression = false;
const expressions = {};
for (const p in paint) {
if (excludeExpressionList.indexOf(p) === -1) {
const p_ = p;
const val = paint[p_];
if (isExpression(val)) {
withExpression = true;
expressions[p_] = createPropertyExpressionCb(val);
}
}
if (withExpression) {
return (feature) => {
const fromCb = {};
for (const p in expressions) {
fromCb[p] = expressions[p](feature);
}
return { ...paint, ...fromCb };
};
}
return;
}
if (withExpression) {
return (feature) => {
const fromCb = {};
for (const p in expressions) {
fromCb[p] = expressions[p](feature);
}
return __spreadValues$2(__spreadValues$2({}, paint), fromCb);
};
}
return;
}
var __defProp$1 = Object.defineProperty;
var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues$1 = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp$1.call(b, prop))
__defNormalProp$1(a, prop, b[prop]);
if (__getOwnPropSymbols$1)
for (var prop of __getOwnPropSymbols$1(b)) {
if (__propIsEnum$1.call(b, prop))
__defNormalProp$1(a, prop, b[prop]);
}
return a;
};
function reEscape(s) {
return s.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&');
return s.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
}
function like(b, a, iLike) {
a = String(a);
b = String(b);
if (a === b)
return true;
if (iLike && a.toUpperCase() === b.toUpperCase())
return true;
const re = `^${reEscape(a)}$`.replace(/%/g, '.*').replace('_', '.');
return new RegExp(re, iLike ? 'i' : '').exec(b) !== null;
a = String(a);
b = String(b);
if (a === b)
return true;
if (iLike && a.toUpperCase() === b.toUpperCase())
return true;
const re = `^${reEscape(a)}$`.replace(/%/g, ".*").replace("_", ".");
return new RegExp(re, iLike ? "i" : "").exec(b) !== null;
}
const operationsAliases = {
// greater(>)
gt: (a, b) => a > b,
// lower(<)
lt: (a, b) => a < b,
// greater or equal(>=)
ge: (a, b) => a >= b,
// lower or equal(<=)
le: (a, b) => a <= b,
// equal(=)
eq: (a, b) => a === b,
// not equal(!=)
ne: (a, b) => a !== b,
in: (a, b) => b.indexOf(a) !== -1,
notin: (a, b) => b.indexOf(a) === -1,
// LIKE SQL statement(for strings compare)
like: (a, b) => {
return like(a, b);
},
// ILIKE SQL statement(for strings compare)
ilike: (a, b) => {
return like(a, b, true);
},
// greater(>)
gt: (a, b) => a > b,
// lower(<)
lt: (a, b) => a < b,
// greater or equal(>=)
ge: (a, b) => a >= b,
// lower or equal(<=)
le: (a, b) => a <= b,
// equal(=)
eq: (a, b) => a === b,
// not equal(!=)
ne: (a, b) => a !== b,
in: (a, b) => b.indexOf(a) !== -1,
notin: (a, b) => b.indexOf(a) === -1,
// LIKE SQL statement(for strings compare)
like: (a, b) => {
return like(a, b);
},
// ILIKE SQL statement(for strings compare)
ilike: (a, b) => {
return like(a, b, true);
}
};
function isPropertyFilter(filter) {
const pf = filter;
if (pf.length === 3 &&
typeof pf[0] === 'string' &&
typeof pf[1] === 'string') {
return true;
}
return false;
const pf = filter;
if (pf.length === 3 && typeof pf[0] === "string" && typeof pf[1] === "string") {
return true;
}
return false;
}
function featureFilter(feature, filters) {
const properties = { ...feature.properties };
if (properties) {
// workaround to filter by feature id
properties.$id = feature.id;
return propertiesFilter(properties, filters);
}
return false;
const properties = __spreadValues$1({}, feature.properties);
if (properties) {
properties.$id = feature.id;
return propertiesFilter(properties, filters);
}
return false;
}
function propertiesFilter(properties, filters) {
const logic = typeof filters[0] === 'string' ? filters[0] : 'all';
const filterFunction = (p) => {
if (isPropertyFilter(p)) {
const [field, operation, value] = p;
const operationExec = operationsAliases[operation];
if (operationExec) {
if (operation === 'like' || operation === 'ilike') {
if (typeof field === 'string') {
let prop = '';
const value_ = field.replace(/^%?(\w+)%?$/, (match, cleanField) => {
prop = properties[cleanField];
return field.replace(cleanField, value);
});
return operationExec(prop, value_);
}
}
return operationExec(properties[field], value);
}
return false;
const logic = typeof filters[0] === "string" ? filters[0] : "all";
const filterFunction = (p) => {
if (isPropertyFilter(p)) {
const [field, operation, value] = p;
const operationExec = operationsAliases[operation];
if (operationExec) {
if (operation === "like" || operation === "ilike") {
if (typeof field === "string") {
let prop = "";
const value_ = field.replace(/^%?(\w+)%?$/, (match, cleanField) => {
prop = properties[cleanField];
return field.replace(cleanField, value);
});
return operationExec(prop, value_);
}
}
else {
return propertiesFilter(properties, p);
}
};
const filters_ = filters.filter((x) => Array.isArray(x));
return logic === 'any'
? filters_.some(filterFunction)
: filters_.every(filterFunction);
return operationExec(properties[field], value);
}
return false;
} else {
return propertiesFilter(properties, p);
}
};
const filters_ = filters.filter((x) => Array.isArray(x));
return logic === "any" ? filters_.some(filterFunction) : filters_.every(filterFunction);
}
var __defProp = Object.defineProperty;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
function updatePaintOptionFromCallback(paint, getPaintFunctions) {
if (typeof paint.from === 'function') {
return paint.from(paint.options);
if (typeof paint.from === "function") {
return paint.from(paint.options);
} else if (typeof paint.from === "string" && getPaintFunctions) {
const from = getPaintFunctions[paint.from];
if (from) {
return from(paint.options);
}
else if (typeof paint.from === 'string' && getPaintFunctions) {
const from = getPaintFunctions[paint.from];
if (from) {
return from(paint.options);
}
}
}
}
function createPropertiesPaint(propertiesPaint) {
let mask = {};
const paintsFilters = [];
for (const p of propertiesPaint) {
if (p) {
if (Array.isArray(p)) {
paintsFilters.push(p);
}
else {
mask = p;
}
}
let mask = {};
const paintsFilters = [];
for (const p of propertiesPaint) {
if (p) {
if (Array.isArray(p)) {
paintsFilters.push(p);
} else {
mask = p;
}
}
return (feature) => {
const paint = paintsFilters.find((x) => featureFilter(feature, x[0]));
if (paint) {
return { ...mask, ...paint[1] };
}
return mask;
}
return (feature) => {
const paint = paintsFilters.find((x) => featureFilter(feature, x[0]));
if (paint) {
return __spreadValues(__spreadValues({}, mask), paint[1]);
}
return mask;
};
}
function expressionCallback({
paint,
defaultPaint
}) {
const expressionCallback2 = createExpressionCallback(paint);
if (expressionCallback2) {
const expressionPaintCb = (feature) => {
return preparePaint({
paint: expressionCallback2(feature),
defaultPaint
});
};
expressionPaintCb.paint = finalizePaint({ paint, defaultPaint });
return expressionPaintCb;
}
return finalizePaint({ paint, defaultPaint });
}
function expressionCallback({ paint, defaultPaint, }) {
const expressionCallback = createExpressionCallback(paint);
if (expressionCallback) {
const expressionPaintCb = (feature) => {
return preparePaint({
paint: expressionCallback(feature),
defaultPaint,
});
};
expressionPaintCb.paint = finalizePaint({ paint, defaultPaint });
return expressionPaintCb;
}
return finalizePaint({ paint, defaultPaint });
}
function finalizePaint({ paint, defaultPaint }) {
var _a;
let newPaint = { ...defaultPaint };
newPaint = { ...newPaint, ...paint };
newPaint.fill = (_a = newPaint.fill) !== null && _a !== void 0 ? _a : true;
newPaint.stroke =
newPaint.stroke !== undefined
? newPaint.stroke
: !newPaint.fill || !!(newPaint.strokeColor || newPaint.strokeOpacity);
return newPaint;
var _a;
let newPaint = __spreadValues({}, defaultPaint);
newPaint = __spreadValues(__spreadValues({}, newPaint), paint);
newPaint.fill = (_a = newPaint.fill) != null ? _a : true;
newPaint.stroke = newPaint.stroke !== void 0 ? newPaint.stroke : !newPaint.fill || !!(newPaint.strokeColor || newPaint.strokeOpacity);
return newPaint;
}
function preparePaint({ paint, defaultPaint, getPaintFunctions, }) {
if (!paint) {
throw new Error('paint is empty');
function preparePaint({
paint,
defaultPaint,
getPaintFunctions
}) {
if (!paint) {
throw new Error("paint is empty");
}
let newPaint = __spreadValues({}, defaultPaint);
if (isPaintCallback(paint)) {
const getPaintFunction = (feature) => {
const getPaint = preparePaint({
paint: paint(feature),
defaultPaint,
getPaintFunctions
});
getPaint.type = paint.type;
return getPaint;
};
getPaintFunction.type = paint.type;
return getPaintFunction;
} else if (isPropertiesPaint(paint)) {
return (feature) => {
return preparePaint({
paint: createPropertiesPaint(paint)(feature),
defaultPaint,
getPaintFunctions
});
};
} else if (paint.type === "get-paint") {
const getPaint = updatePaintOptionFromCallback(paint, getPaintFunctions);
if (getPaint) {
newPaint = preparePaint({
paint: getPaint,
defaultPaint,
getPaintFunctions
});
}
let newPaint = { ...defaultPaint };
if (isPaintCallback(paint)) {
const getPaintFunction = (feature) => {
const getPaint = preparePaint({
paint: paint(feature),
defaultPaint,
getPaintFunctions,
});
getPaint.type = paint.type;
return getPaint;
};
getPaintFunction.type = paint.type;
return getPaintFunction;
} else if (paint.type === "icon") {
return paint;
} else {
newPaint = expressionCallback({ paint, defaultPaint });
}
if (isPaintCallback(newPaint)) {
return newPaint;
}
if ("color" in newPaint) {
if (!newPaint.strokeColor) {
newPaint.strokeColor = newPaint.color;
}
else if (isPropertiesPaint(paint)) {
return (feature) => {
return preparePaint({
paint: createPropertiesPaint(paint)(feature),
defaultPaint,
getPaintFunctions,
});
};
if (!newPaint.fillColor) {
newPaint.fillColor = newPaint.color;
}
else if (paint.type === 'get-paint') {
const getPaint = updatePaintOptionFromCallback(paint, getPaintFunctions);
if (getPaint) {
newPaint = preparePaint({
paint: getPaint,
defaultPaint,
getPaintFunctions,
});
}
}
if ("opacity" in newPaint) {
if (newPaint.strokeOpacity === void 0) {
newPaint.strokeOpacity = newPaint.opacity;
}
else if (paint.type === 'icon') {
return paint;
if (newPaint.fillOpacity === void 0) {
newPaint.fillOpacity = newPaint.opacity;
}
else {
newPaint = expressionCallback({ paint, defaultPaint });
}
if (isPaintCallback(newPaint)) {
return newPaint;
}
if ('color' in newPaint) {
if (!newPaint.strokeColor) {
newPaint.strokeColor = newPaint.color;
}
if (!newPaint.fillColor) {
newPaint.fillColor = newPaint.color;
}
}
if ('opacity' in newPaint) {
if (newPaint.strokeOpacity === undefined) {
newPaint.strokeOpacity = newPaint.opacity;
}
if (newPaint.fillOpacity === undefined) {
newPaint.fillOpacity = newPaint.opacity;
}
}
return newPaint;
}
return newPaint;
}

@@ -925,0 +974,0 @@

@@ -1,2 +0,2 @@

function e(e){return!!Array.isArray(e)}function r(e){return"[object Object]"===Object.prototype.toString.call(e)}function t(e){return!!r(e)&&("get-paint"!==e.type&&"icon"!==e.type)}function n(e){return"function"==typeof e}function o(e){return"icon"===e.type||"html"in e}function a(e){return(r,t)=>{const n=r.map((e=>e()));return e(n,t)}}const f={"!":a((function([e]){return!e})),"!=":a((function([e,r]){return e!==r})),"<":a((function([e,r]){return e<r})),"<=":a((function([e,r]){return e<=r})),"==":a((function([e,r]){return e===r})),">":a((function([e,r]){return e>r})),">=":a((function([e,r]){return e>=r})),coalesce:e=>{for(let r=0;r<e.length;r++){const t=e[r]();if(null!=t)return t}return null},all:e=>{for(let r=0;r<e.length;r++){if(!e[r]())return!1}return!0},any:e=>{for(let r=0;r<e.length;r++){if(e[r]())return!0}return!1},case:e=>{if(e.length<2)throw new Error('The "case" function requires at least a condition and a corresponding output.');if(e.length%2==0)throw new Error("Missing a fallback value or unmatched condition-output pair.");for(let r=0;r<e.length-1;r+=2){const t=e[r](),n=e[r+1]();if(t)return n}return(0,e[e.length-1])()},match:e=>{const[r,...t]=e,n=r(),o=t.splice(-1,t.length%2)[0];for(let a=0;a<t.length-1;a+=2){if(t[a]()===n)return t[a+1]()}return o()}},i={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4","indianred ":"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};function l(e){if("string"==typeof(t=e)&&/^#([A-Fa-f0-9]{3}){1,2}$/.test(t))return u(e);if("string"==typeof(r=e)&&r in i)return function(e){return u(i[e])}(e);if(function(e){return"string"==typeof e&&/^rgb(a?)\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)(?:\s*,\s*([01](?:\.\d+)?))?\s*\)$/.test(e)}(e))return function(e){const r=/^rgba\((\d+),\s*(\d+),\s*(\d+),\s*([\d.]+)\)$/;let t;if(t=e.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/))return[parseInt(t[1],10),parseInt(t[2],10),parseInt(t[3],10)];if(t=e.match(r))return[parseInt(t[1],10),parseInt(t[2],10),parseInt(t[3],10),parseFloat(t[4])];throw new Error(`The '${e}' Is not valid rgb`)}(e);if(function(e){if("object"==typeof e&&null!==e)return"r"in e&&"g"in e&&"b"in e&&(!("a"in e)||"number"==typeof e.a&&e.a>=0&&e.a<=1);return!1}(e))return function({r:e,g:r,b:t,a:n}){return[e,r,t,...void 0!==n?[n]:[]]}(e);var r,t;throw new Error(`The '${e}' cannot be converted to color`)}function u(e){let r;if(r=/^#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])$/.exec(e))return[parseInt(r[1]+r[1],16),parseInt(r[2]+r[2],16),parseInt(r[3]+r[3],16)];if(r=/^#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])$/.exec(e))return[parseInt(r[1]+r[1],16),parseInt(r[2]+r[2],16),parseInt(r[3]+r[3],16),parseInt(r[4]+r[4],16)/255];if(r=/^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/.exec(e))return[parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16)];if(r=/^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/.exec(e))return[parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16),parseInt(r[4],16)/255];throw new Error(`The '${e}' Is not valid hex`)}function c(e,r,t,n,o){if("number"==typeof t&&"number"==typeof o)return t+(e-r)/(n-r)*(o-t);try{const a=l(t),f=l(o);return function(e){return`rgb(${e.join(",")})`}(a.map(((t,o)=>Math.ceil(c(e,r,t,n,f[o])))))}catch(a){console.log(a)}throw new Error("Unsupported output type for linear interpolation.")}const s={step:e=>{const[r,t,...n]=e,o=r();if("number"!=typeof o)return t();for(let a=0;a<n.length-2;a+=2){const e=n[a](),r=n[a+1](),t=n[a+2]();if(o>=e&&o<t)return r}return o>=n[n.length-2]()?n[n.length-1]():t()},interpolate:([e,r,...t])=>{if(t.length<2)throw new Error("At least two stops are required");if(t.length<2||t.length%2!=0)throw new Error("Invalid stops provided.");const n=r();if("number"!=typeof n)throw new Error("Input must be a number.");const o=e();for(let a=0;a<t.length-2;a+=2){const e=t[a](),r=t[a+1](),f=t[a+2](),i=t[a+3]();if(n>=e&&n<=f&&"linear"===o[0])return c(n,e,r,f,i)}throw new Error("Invalid interpolation type.")}};const d={get:a((function([e,r],t){const n=r||t;return n&&"object"==typeof n&&e in n?n[e]:null})),length:a((([e])=>{if("string"==typeof e||Array.isArray(e))return e.length})),at:a((function([e,r]){return r[e]})),has:a((function([e,r],t){const n=r||t;return!(!n||"object"!=typeof n||!(e in n))})),in:a((function([e,r]){if("string"==typeof r)return r.includes(String(e));if(Array.isArray(r))return r.includes(e);throw new Error(`Invalid input type for 'in'. Expected string or array, got ${typeof r}.`)})),"index-of":a((function([e,r,t]){if("string"==typeof r)return r.indexOf(String(e),t);if(Array.isArray(r))return r.indexOf(e,t);throw new Error(`Invalid input type for 'index-of'. Expected string or array, got ${typeof r}.`)})),slice:a((function(e){const[r,t,n]=e;if("string"==typeof r)return r.slice(t,n);if(Array.isArray(r))return r.slice(t,n);throw new Error(`Invalid input type for 'slice'. Expected string or array, got ${typeof r}.`)}))},p={"+":a((e=>e.reduce(((e,r)=>e+r),0))),"-":a((e=>e.reduce(((e,r)=>e-r)))),"*":a((e=>e.reduce(((e,r)=>e*r),1))),"/":a((e=>e.reduce(((e,r)=>e/r)))),"%":a((e=>e[0]%e[1])),"^":a((e=>Math.pow(e[0],e[1]))),abs:a((e=>Math.abs(e[0]))),acos:a((e=>Math.acos(e[0]))),asin:a((e=>Math.asin(e[0]))),atan:a((e=>Math.atan(e[0]))),ceil:a((e=>Math.ceil(e[0]))),cos:a((e=>Math.cos(e[0]))),e:()=>Math.E,floor:a((e=>Math.floor(e[0]))),ln:a((e=>Math.log(e[0]))),ln2:()=>Math.LN2,log10:a((e=>Math.log10(e[0]))),log2:a((e=>Math.log2(e[0]))),max:a((e=>Math.max(...e))),min:a((e=>Math.min(...e))),pi:()=>Math.PI,round:a((e=>Math.round(e[0]))),sin:a((e=>Math.sin(e[0]))),sqrt:a((e=>Math.sqrt(e[0]))),tan:a((e=>Math.tan(e[0])))},g={concat:a((e=>e.reduce(((e,r)=>String(e)+String(r)),""))),downcase:a((e=>String(e[0]).toLowerCase())),upcase:a((e=>String(e[0]).toUpperCase()))},y=(e,r,t)=>{try{const n=e(r,t);if(void 0!==n)return n}catch{}};function b(e){return(r,t)=>{for(const n of r){const r=y(e,n,t);if(void 0!==r)return r}throw new Error("Received a mismatched type")}}function h(e){if(Array.isArray(e)){const[r,...t]=e;return"string"==typeof r&&"literal"!==r&&r in m&&t.length>0}return!1}const m={...p,...{array:a((e=>{const[r,t,n]=e;let o,a,f;if("string"==typeof r&&["string","number","boolean"].includes(r)?(o=r,"number"==typeof t?(a=t,f=n):f=t):Array.isArray(r)&&(f=r),!Array.isArray(f))throw new Error("Expected an array");if(o&&!f.every((e=>typeof e===o)))throw new Error(`Expected all items in array to be of type ${o}`);if(a&&f.length!==a)throw new Error(`Expected array of length ${a}`);return f})),boolean:a(b((e=>"boolean"==typeof e?e:void 0))),literal:a((([e])=>e)),number:a(b((e=>"number"==typeof e?e:void 0))),object:a(b((e=>null===e||"object"!=typeof e||Array.isArray(e)?void 0:e))),string:a(b((e=>"string"==typeof e?e:void 0))),"to-boolean":a(b(Boolean)),"to-number":a(b(Number)),"to-string":a(b(String)),typeof:a((([e])=>function(e){if(null===e)return"null";switch(typeof e){case"string":return"string";case"number":return"number";case"boolean":return"boolean";case"object":if(Array.isArray(e)){let r="value";return e.every((e=>"number"==typeof e))?r="number":e.every((e=>"string"==typeof e))?r="string":e.every((e=>"boolean"==typeof e))&&(r="boolean"),`array<${r}, ${e.length}>`}return"object";default:return"undefined"}}(e)))},...g,...d,...f,...s};function w(e,r={}){const[t,...n]=e,o=m[t];if(o)return o(n.map((e=>()=>h(e)?w(e,r):e)),r);throw new Error(`Expression "${t}" is not supported.`)}function k(e){return r=>{const t=r.properties;return!!t&&w(e,t)}}const v=["iconSize","iconAnchor"];function A(e){let r=!1;const t={};for(const n in e)if(-1===v.indexOf(n)){const o=n,a=e[o];h(a)&&(r=!0,t[o]=k(a))}if(r)return r=>{const n={};for(const e in t)n[e]=t[e](r);return{...e,...n}}}function I(e,r,t){if((r=String(r))===(e=String(e)))return!0;if(t&&r.toUpperCase()===e.toUpperCase())return!0;const n=`^${o=r,o.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}$`.replace(/%/g,".*").replace("_",".");var o;return null!==new RegExp(n,t?"i":"").exec(e)}const E={gt:(e,r)=>e>r,lt:(e,r)=>e<r,ge:(e,r)=>e>=r,le:(e,r)=>e<=r,eq:(e,r)=>e===r,ne:(e,r)=>e!==r,in:(e,r)=>-1!==r.indexOf(e),notin:(e,r)=>-1===r.indexOf(e),like:(e,r)=>I(e,r),ilike:(e,r)=>I(e,r,!0)};function $(e,r){const t={...e.properties};return!!t&&(t.$id=e.id,x(t,r))}function x(e,r){const t="string"==typeof r[0]?r[0]:"all",n=r=>{if(3===(t=r).length&&"string"==typeof t[0]&&"string"==typeof t[1]){const[t,n,o]=r,a=E[n];if(a){if(("like"===n||"ilike"===n)&&"string"==typeof t){let r="";const n=t.replace(/^%?(\w+)%?$/,((n,a)=>(r=e[a],t.replace(a,o))));return a(r,n)}return a(e[t],o)}return!1}return x(e,r);var t},o=r.filter((e=>Array.isArray(e)));return"any"===t?o.some(n):o.every(n)}function M(e){let r={};const t=[];for(const n of e)n&&(Array.isArray(n)?t.push(n):r=n);return e=>{const n=t.find((r=>$(e,r[0])));return n?{...r,...n[1]}:r}}function F({paint:e,defaultPaint:r}){var t;let n={...r};return n={...n,...e},n.fill=null===(t=n.fill)||void 0===t||t,n.stroke=void 0!==n.stroke?n.stroke:!n.fill||!(!n.strokeColor&&!n.strokeOpacity),n}function P({paint:r,defaultPaint:t,getPaintFunctions:o}){if(!r)throw new Error("paint is empty");let a={...t};if(n(r)){const e=e=>{const n=P({paint:r(e),defaultPaint:t,getPaintFunctions:o});return n.type=r.type,n};return e.type=r.type,e}if(e(r))return e=>P({paint:M(r)(e),defaultPaint:t,getPaintFunctions:o});if("get-paint"===r.type){const e=function(e,r){if("function"==typeof e.from)return e.from(e.options);if("string"==typeof e.from&&r){const t=r[e.from];if(t)return t(e.options)}}(r,o);e&&(a=P({paint:e,defaultPaint:t,getPaintFunctions:o}))}else{if("icon"===r.type)return r;a=function({paint:e,defaultPaint:r}){const t=A(e);if(t){const n=e=>P({paint:t(e),defaultPaint:r});return n.paint=F({paint:e,defaultPaint:r}),n}return F({paint:e,defaultPaint:r})}({paint:r,defaultPaint:t})}return n(a)||("color"in a&&(a.strokeColor||(a.strokeColor=a.color),a.fillColor||(a.fillColor=a.color)),"opacity"in a&&(void 0===a.strokeOpacity&&(a.strokeOpacity=a.opacity),void 0===a.fillOpacity&&(a.fillOpacity=a.opacity))),a}export{A as createExpressionCallback,t as isBasePaint,o as isIcon,r as isPaint,n as isPaintCallback,e as isPropertiesPaint,P as preparePaint};
function e(e){return!!Array.isArray(e)}function r(e){return"[object Object]"===Object.prototype.toString.call(e)}function t(e){return!!r(e)&&("get-paint"!==e.type&&"icon"!==e.type)}function n(e){return"function"==typeof e}function o(e){return"icon"===e.type||"html"in e}function a(e){return(r,t)=>{const n=r.map((e=>e()));return e(n,t)}}const f={"!":a((function([e]){return!e})),"!=":a((function([e,r]){return e!==r})),"<":a((function([e,r]){return e<r})),"<=":a((function([e,r]){return e<=r})),"==":a((function([e,r]){return e===r})),">":a((function([e,r]){return e>r})),">=":a((function([e,r]){return e>=r})),coalesce:e=>{for(let r=0;r<e.length;r++){const t=e[r]();if(null!=t)return t}return null},all:e=>{for(let r=0;r<e.length;r++){if(!e[r]())return!1}return!0},any:e=>{for(let r=0;r<e.length;r++){if(e[r]())return!0}return!1},case:e=>{if(e.length<2)throw new Error('The "case" function requires at least a condition and a corresponding output.');if(e.length%2==0)throw new Error("Missing a fallback value or unmatched condition-output pair.");for(let r=0;r<e.length-1;r+=2){const t=e[r](),n=e[r+1]();if(t)return n}return(0,e[e.length-1])()},match:e=>{const[r,...t]=e,n=r(),o=t.splice(-1,t.length%2)[0];for(let a=0;a<t.length-1;a+=2){if(t[a]()===n)return t[a+1]()}return o()}},i={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4","indianred ":"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};function l(e){if("string"==typeof(t=e)&&/^#([A-Fa-f0-9]{3}){1,2}$/.test(t))return c(e);if("string"==typeof(r=e)&&r in i)return function(e){return c(i[e])}(e);if(function(e){return"string"==typeof e&&/^rgb(a?)\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)(?:\s*,\s*([01](?:\.\d+)?))?\s*\)$/.test(e)}(e))return function(e){const r=/^rgba\((\d+),\s*(\d+),\s*(\d+),\s*([\d.]+)\)$/;let t;if(t=e.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/))return[parseInt(t[1],10),parseInt(t[2],10),parseInt(t[3],10)];if(t=e.match(r))return[parseInt(t[1],10),parseInt(t[2],10),parseInt(t[3],10),parseFloat(t[4])];throw new Error(`The '${e}' Is not valid rgb`)}(e);if(function(e){if("object"==typeof e&&null!==e)return"r"in e&&"g"in e&&"b"in e&&(!("a"in e)||"number"==typeof e.a&&e.a>=0&&e.a<=1);return!1}(e))return function({r:e,g:r,b:t,a:n}){return[e,r,t,...void 0!==n?[n]:[]]}(e);var r,t;throw new Error(`The '${e}' cannot be converted to color`)}function c(e){let r;if(r=/^#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])$/.exec(e))return[parseInt(r[1]+r[1],16),parseInt(r[2]+r[2],16),parseInt(r[3]+r[3],16)];if(r=/^#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])$/.exec(e))return[parseInt(r[1]+r[1],16),parseInt(r[2]+r[2],16),parseInt(r[3]+r[3],16),parseInt(r[4]+r[4],16)/255];if(r=/^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/.exec(e))return[parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16)];if(r=/^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/.exec(e))return[parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16),parseInt(r[4],16)/255];throw new Error(`The '${e}' Is not valid hex`)}function u(e,r,t,n,o){if("number"==typeof t&&"number"==typeof o)return t+(e-r)/(n-r)*(o-t);try{const a=l(t),f=l(o);return function(e){return`rgb(${e.join(",")})`}(a.map(((t,o)=>Math.ceil(u(e,r,t,n,f[o])))))}catch(a){console.log(a)}throw new Error("Unsupported output type for linear interpolation.")}const s={step:e=>{const[r,t,...n]=e,o=r();if("number"!=typeof o)return t();for(let a=0;a<n.length-2;a+=2){const e=n[a](),r=n[a+1](),t=n[a+2]();if(o>=e&&o<t)return r}return o>=n[n.length-2]()?n[n.length-1]():t()},interpolate:([e,r,...t])=>{if(t.length<2)throw new Error("At least two stops are required");if(t.length<2||t.length%2!=0)throw new Error("Invalid stops provided.");const n=r();if("number"!=typeof n)throw new Error("Input must be a number.");const o=e();for(let a=0;a<t.length-2;a+=2){const e=t[a](),r=t[a+1](),f=t[a+2](),i=t[a+3]();if(n>=e&&n<=f&&"linear"===o[0])return u(n,e,r,f,i)}throw new Error("Invalid interpolation type.")}};const p={get:a((function([e,r],t){const n=r||t;return n&&"object"==typeof n&&e in n?n[e]:null})),length:a((([e])=>{if("string"==typeof e||Array.isArray(e))return e.length})),at:a((function([e,r]){return r[e]})),has:a((function([e,r],t){const n=r||t;return!(!n||"object"!=typeof n||!(e in n))})),in:a((function([e,r]){if("string"==typeof r)return r.includes(String(e));if(Array.isArray(r))return r.includes(e);throw new Error(`Invalid input type for 'in'. Expected string or array, got ${typeof r}.`)})),"index-of":a((function([e,r,t]){if("string"==typeof r)return r.indexOf(String(e),t);if(Array.isArray(r))return r.indexOf(e,t);throw new Error(`Invalid input type for 'index-of'. Expected string or array, got ${typeof r}.`)})),slice:a((function(e){const[r,t,n]=e;if("string"==typeof r)return r.slice(t,n);if(Array.isArray(r))return r.slice(t,n);throw new Error(`Invalid input type for 'slice'. Expected string or array, got ${typeof r}.`)}))},d={"+":a((e=>e.reduce(((e,r)=>e+r),0))),"-":a((e=>e.reduce(((e,r)=>e-r)))),"*":a((e=>e.reduce(((e,r)=>e*r),1))),"/":a((e=>e.reduce(((e,r)=>e/r)))),"%":a((e=>e[0]%e[1])),"^":a((e=>Math.pow(e[0],e[1]))),abs:a((e=>Math.abs(e[0]))),acos:a((e=>Math.acos(e[0]))),asin:a((e=>Math.asin(e[0]))),atan:a((e=>Math.atan(e[0]))),ceil:a((e=>Math.ceil(e[0]))),cos:a((e=>Math.cos(e[0]))),e:()=>Math.E,floor:a((e=>Math.floor(e[0]))),ln:a((e=>Math.log(e[0]))),ln2:()=>Math.LN2,log10:a((e=>Math.log10(e[0]))),log2:a((e=>Math.log2(e[0]))),max:a((e=>Math.max(...e))),min:a((e=>Math.min(...e))),pi:()=>Math.PI,round:a((e=>Math.round(e[0]))),sin:a((e=>Math.sin(e[0]))),sqrt:a((e=>Math.sqrt(e[0]))),tan:a((e=>Math.tan(e[0])))},b={concat:a((e=>e.reduce(((e,r)=>String(e)+String(r)),""))),downcase:a((e=>String(e[0]).toLowerCase())),upcase:a((e=>String(e[0]).toUpperCase()))},y=(e,r,t)=>{try{const n=e(r,t);if(void 0!==n)return n}catch(n){}};function g(e){return(r,t)=>{for(const n of r){const r=y(e,n,t);if(void 0!==r)return r}throw new Error("Received a mismatched type")}}const h={array:a((e=>{const[r,t,n]=e;let o,a,f;if("string"==typeof r&&["string","number","boolean"].includes(r)?(o=r,"number"==typeof t?(a=t,f=n):f=t):Array.isArray(r)&&(f=r),!Array.isArray(f))throw new Error("Expected an array");if(o&&!f.every((e=>typeof e===o)))throw new Error(`Expected all items in array to be of type ${o}`);if(a&&f.length!==a)throw new Error(`Expected array of length ${a}`);return f})),boolean:a(g((e=>"boolean"==typeof e?e:void 0))),literal:a((([e])=>e)),number:a(g((e=>"number"==typeof e?e:void 0))),object:a(g((e=>null===e||"object"!=typeof e||Array.isArray(e)?void 0:e))),string:a(g((e=>"string"==typeof e?e:void 0))),"to-boolean":a(g(Boolean)),"to-number":a(g(Number)),"to-string":a(g(String)),typeof:a((([e])=>function(e){if(null===e)return"null";switch(typeof e){case"string":return"string";case"number":return"number";case"boolean":return"boolean";case"object":if(Array.isArray(e)){let r="value";return e.every((e=>"number"==typeof e))?r="number":e.every((e=>"string"==typeof e))?r="string":e.every((e=>"boolean"==typeof e))&&(r="boolean"),`array<${r}, ${e.length}>`}return"object";default:return"undefined"}}(e)))};var m=Object.defineProperty,w=Object.getOwnPropertySymbols,v=Object.prototype.hasOwnProperty,k=Object.prototype.propertyIsEnumerable,A=(e,r,t)=>r in e?m(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,O=(e,r)=>{for(var t in r||(r={}))v.call(r,t)&&A(e,t,r[t]);if(w)for(var t of w(r))k.call(r,t)&&A(e,t,r[t]);return e};function I(e){if(Array.isArray(e)){const[r,...t]=e;return"string"==typeof r&&"literal"!==r&&r in E&&t.length>0}return!1}const E=O(O(O(O(O(O({},d),h),b),p),f),s);function j(e,r={}){const[t,...n]=e,o=E[t];if(o)return o(n.map((e=>()=>I(e)?j(e,r):e)),r);throw new Error(`Expression "${t}" is not supported.`)}var P=Object.defineProperty,$=Object.getOwnPropertySymbols,x=Object.prototype.hasOwnProperty,M=Object.prototype.propertyIsEnumerable,F=(e,r,t)=>r in e?P(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,S=(e,r)=>{for(var t in r||(r={}))x.call(r,t)&&F(e,t,r[t]);if($)for(var t of $(r))M.call(r,t)&&F(e,t,r[t]);return e};function q(e){return r=>{const t=r.properties;return!!t&&j(e,t)}}const C=["iconSize","iconAnchor"];function T(e){let r=!1;const t={};for(const n in e)if(-1===C.indexOf(n)){const o=n,a=e[o];I(a)&&(r=!0,t[o]=q(a))}if(r)return r=>{const n={};for(const e in t)n[e]=t[e](r);return S(S({},e),n)}}var U=Object.defineProperty,z=Object.getOwnPropertySymbols,L=Object.prototype.hasOwnProperty,N=Object.prototype.propertyIsEnumerable,R=(e,r,t)=>r in e?U(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,B=(e,r)=>{for(var t in r||(r={}))L.call(r,t)&&R(e,t,r[t]);if(z)for(var t of z(r))N.call(r,t)&&R(e,t,r[t]);return e};function _(e,r,t){if((r=String(r))===(e=String(e)))return!0;if(t&&r.toUpperCase()===e.toUpperCase())return!0;const n=`^${o=r,o.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}$`.replace(/%/g,".*").replace("_",".");var o;return null!==new RegExp(n,t?"i":"").exec(e)}const D={gt:(e,r)=>e>r,lt:(e,r)=>e<r,ge:(e,r)=>e>=r,le:(e,r)=>e<=r,eq:(e,r)=>e===r,ne:(e,r)=>e!==r,in:(e,r)=>-1!==r.indexOf(e),notin:(e,r)=>-1===r.indexOf(e),like:(e,r)=>_(e,r),ilike:(e,r)=>_(e,r,!0)};function G(e,r){const t=B({},e.properties);return!!t&&(t.$id=e.id,H(t,r))}function H(e,r){const t="string"==typeof r[0]?r[0]:"all",n=r=>{if(3===(t=r).length&&"string"==typeof t[0]&&"string"==typeof t[1]){const[t,n,o]=r,a=D[n];if(a){if(("like"===n||"ilike"===n)&&"string"==typeof t){let r="";const n=t.replace(/^%?(\w+)%?$/,((n,a)=>(r=e[a],t.replace(a,o))));return a(r,n)}return a(e[t],o)}return!1}return H(e,r);var t},o=r.filter((e=>Array.isArray(e)));return"any"===t?o.some(n):o.every(n)}var J=Object.defineProperty,K=Object.getOwnPropertySymbols,Q=Object.prototype.hasOwnProperty,V=Object.prototype.propertyIsEnumerable,W=(e,r,t)=>r in e?J(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,X=(e,r)=>{for(var t in r||(r={}))Q.call(r,t)&&W(e,t,r[t]);if(K)for(var t of K(r))V.call(r,t)&&W(e,t,r[t]);return e};function Y(e){let r={};const t=[];for(const n of e)n&&(Array.isArray(n)?t.push(n):r=n);return e=>{const n=t.find((r=>G(e,r[0])));return n?X(X({},r),n[1]):r}}function Z({paint:e,defaultPaint:r}){var t;let n=X({},r);return n=X(X({},n),e),n.fill=null==(t=n.fill)||t,n.stroke=void 0!==n.stroke?n.stroke:!n.fill||!(!n.strokeColor&&!n.strokeOpacity),n}function ee({paint:r,defaultPaint:t,getPaintFunctions:o}){if(!r)throw new Error("paint is empty");let a=X({},t);if(n(r)){const e=e=>{const n=ee({paint:r(e),defaultPaint:t,getPaintFunctions:o});return n.type=r.type,n};return e.type=r.type,e}if(e(r))return e=>ee({paint:Y(r)(e),defaultPaint:t,getPaintFunctions:o});if("get-paint"===r.type){const e=function(e,r){if("function"==typeof e.from)return e.from(e.options);if("string"==typeof e.from&&r){const t=r[e.from];if(t)return t(e.options)}}(r,o);e&&(a=ee({paint:e,defaultPaint:t,getPaintFunctions:o}))}else{if("icon"===r.type)return r;a=function({paint:e,defaultPaint:r}){const t=T(e);if(t){const n=e=>ee({paint:t(e),defaultPaint:r});return n.paint=Z({paint:e,defaultPaint:r}),n}return Z({paint:e,defaultPaint:r})}({paint:r,defaultPaint:t})}return n(a)||("color"in a&&(a.strokeColor||(a.strokeColor=a.color),a.fillColor||(a.fillColor=a.color)),"opacity"in a&&(void 0===a.strokeOpacity&&(a.strokeOpacity=a.opacity),void 0===a.fillOpacity&&(a.fillOpacity=a.opacity))),a}export{T as createExpressionCallback,t as isBasePaint,o as isIcon,r as isPaint,n as isPaintCallback,e as isPropertiesPaint,ee as preparePaint};
//# sourceMappingURL=paint.esm-browser.prod.js.map

@@ -1,2 +0,2 @@

/** Bundle of @nextgis/paint; version: 1.19.0; author: NextGIS */
/** Bundle of @nextgis/paint; version: 2.0.0-alpha.0; author: NextGIS */
import { isExpression, evaluate } from '@nextgis/expression';

@@ -6,187 +6,217 @@ import { featureFilter } from '@nextgis/properties-filter';

function isPropertiesPaint(paint) {
if (Array.isArray(paint)) {
return true;
}
return false;
if (Array.isArray(paint)) {
return true;
}
return false;
}
function isPaint(paint) {
if (Object.prototype.toString.call(paint) === '[object Object]') {
return true;
}
return false;
if (Object.prototype.toString.call(paint) === "[object Object]") {
return true;
}
return false;
}
function isBasePaint(paint) {
if (isPaint(paint)) {
if (paint.type === 'get-paint' || paint.type === 'icon') {
return false;
}
return true;
if (isPaint(paint)) {
if (paint.type === "get-paint" || paint.type === "icon") {
return false;
}
return false;
return true;
}
return false;
}
function isPaintCallback(paint) {
if (typeof paint === 'function') {
return true;
}
return false;
if (typeof paint === "function") {
return true;
}
return false;
}
function isIcon(paint) {
return paint.type === 'icon' || 'html' in paint;
return paint.type === "icon" || "html" in paint;
}
var __defProp$1 = Object.defineProperty;
var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues$1 = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp$1.call(b, prop))
__defNormalProp$1(a, prop, b[prop]);
if (__getOwnPropSymbols$1)
for (var prop of __getOwnPropSymbols$1(b)) {
if (__propIsEnum$1.call(b, prop))
__defNormalProp$1(a, prop, b[prop]);
}
return a;
};
function createPropertyExpressionCb(expression) {
return (feature) => {
const properties = feature.properties;
if (properties) {
return evaluate(expression, properties);
}
return false;
};
return (feature) => {
const properties = feature.properties;
if (properties) {
return evaluate(expression, properties);
}
return false;
};
}
const excludeExpressionList = ['iconSize', 'iconAnchor'];
const excludeExpressionList = ["iconSize", "iconAnchor"];
function createExpressionCallback(paint) {
let withExpression = false;
const expressions = {};
for (const p in paint) {
if (excludeExpressionList.indexOf(p) === -1) {
const p_ = p;
const val = paint[p_];
if (isExpression(val)) {
withExpression = true;
expressions[p_] = createPropertyExpressionCb(val);
}
}
let withExpression = false;
const expressions = {};
for (const p in paint) {
if (excludeExpressionList.indexOf(p) === -1) {
const p_ = p;
const val = paint[p_];
if (isExpression(val)) {
withExpression = true;
expressions[p_] = createPropertyExpressionCb(val);
}
}
if (withExpression) {
return (feature) => {
const fromCb = {};
for (const p in expressions) {
fromCb[p] = expressions[p](feature);
}
return { ...paint, ...fromCb };
};
}
return;
}
if (withExpression) {
return (feature) => {
const fromCb = {};
for (const p in expressions) {
fromCb[p] = expressions[p](feature);
}
return __spreadValues$1(__spreadValues$1({}, paint), fromCb);
};
}
return;
}
var __defProp = Object.defineProperty;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
function updatePaintOptionFromCallback(paint, getPaintFunctions) {
if (typeof paint.from === 'function') {
return paint.from(paint.options);
if (typeof paint.from === "function") {
return paint.from(paint.options);
} else if (typeof paint.from === "string" && getPaintFunctions) {
const from = getPaintFunctions[paint.from];
if (from) {
return from(paint.options);
}
else if (typeof paint.from === 'string' && getPaintFunctions) {
const from = getPaintFunctions[paint.from];
if (from) {
return from(paint.options);
}
}
}
}
function createPropertiesPaint(propertiesPaint) {
let mask = {};
const paintsFilters = [];
for (const p of propertiesPaint) {
if (p) {
if (Array.isArray(p)) {
paintsFilters.push(p);
}
else {
mask = p;
}
}
let mask = {};
const paintsFilters = [];
for (const p of propertiesPaint) {
if (p) {
if (Array.isArray(p)) {
paintsFilters.push(p);
} else {
mask = p;
}
}
return (feature) => {
const paint = paintsFilters.find((x) => featureFilter(feature, x[0]));
if (paint) {
return { ...mask, ...paint[1] };
}
return mask;
}
return (feature) => {
const paint = paintsFilters.find((x) => featureFilter(feature, x[0]));
if (paint) {
return __spreadValues(__spreadValues({}, mask), paint[1]);
}
return mask;
};
}
function expressionCallback({
paint,
defaultPaint
}) {
const expressionCallback2 = createExpressionCallback(paint);
if (expressionCallback2) {
const expressionPaintCb = (feature) => {
return preparePaint({
paint: expressionCallback2(feature),
defaultPaint
});
};
expressionPaintCb.paint = finalizePaint({ paint, defaultPaint });
return expressionPaintCb;
}
return finalizePaint({ paint, defaultPaint });
}
function expressionCallback({ paint, defaultPaint, }) {
const expressionCallback = createExpressionCallback(paint);
if (expressionCallback) {
const expressionPaintCb = (feature) => {
return preparePaint({
paint: expressionCallback(feature),
defaultPaint,
});
};
expressionPaintCb.paint = finalizePaint({ paint, defaultPaint });
return expressionPaintCb;
}
return finalizePaint({ paint, defaultPaint });
}
function finalizePaint({ paint, defaultPaint }) {
var _a;
let newPaint = { ...defaultPaint };
newPaint = { ...newPaint, ...paint };
newPaint.fill = (_a = newPaint.fill) !== null && _a !== void 0 ? _a : true;
newPaint.stroke =
newPaint.stroke !== undefined
? newPaint.stroke
: !newPaint.fill || !!(newPaint.strokeColor || newPaint.strokeOpacity);
return newPaint;
var _a;
let newPaint = __spreadValues({}, defaultPaint);
newPaint = __spreadValues(__spreadValues({}, newPaint), paint);
newPaint.fill = (_a = newPaint.fill) != null ? _a : true;
newPaint.stroke = newPaint.stroke !== void 0 ? newPaint.stroke : !newPaint.fill || !!(newPaint.strokeColor || newPaint.strokeOpacity);
return newPaint;
}
function preparePaint({ paint, defaultPaint, getPaintFunctions, }) {
if (!paint) {
throw new Error('paint is empty');
function preparePaint({
paint,
defaultPaint,
getPaintFunctions
}) {
if (!paint) {
throw new Error("paint is empty");
}
let newPaint = __spreadValues({}, defaultPaint);
if (isPaintCallback(paint)) {
const getPaintFunction = (feature) => {
const getPaint = preparePaint({
paint: paint(feature),
defaultPaint,
getPaintFunctions
});
getPaint.type = paint.type;
return getPaint;
};
getPaintFunction.type = paint.type;
return getPaintFunction;
} else if (isPropertiesPaint(paint)) {
return (feature) => {
return preparePaint({
paint: createPropertiesPaint(paint)(feature),
defaultPaint,
getPaintFunctions
});
};
} else if (paint.type === "get-paint") {
const getPaint = updatePaintOptionFromCallback(paint, getPaintFunctions);
if (getPaint) {
newPaint = preparePaint({
paint: getPaint,
defaultPaint,
getPaintFunctions
});
}
let newPaint = { ...defaultPaint };
if (isPaintCallback(paint)) {
const getPaintFunction = (feature) => {
const getPaint = preparePaint({
paint: paint(feature),
defaultPaint,
getPaintFunctions,
});
getPaint.type = paint.type;
return getPaint;
};
getPaintFunction.type = paint.type;
return getPaintFunction;
} else if (paint.type === "icon") {
return paint;
} else {
newPaint = expressionCallback({ paint, defaultPaint });
}
if (isPaintCallback(newPaint)) {
return newPaint;
}
if ("color" in newPaint) {
if (!newPaint.strokeColor) {
newPaint.strokeColor = newPaint.color;
}
else if (isPropertiesPaint(paint)) {
return (feature) => {
return preparePaint({
paint: createPropertiesPaint(paint)(feature),
defaultPaint,
getPaintFunctions,
});
};
if (!newPaint.fillColor) {
newPaint.fillColor = newPaint.color;
}
else if (paint.type === 'get-paint') {
const getPaint = updatePaintOptionFromCallback(paint, getPaintFunctions);
if (getPaint) {
newPaint = preparePaint({
paint: getPaint,
defaultPaint,
getPaintFunctions,
});
}
}
if ("opacity" in newPaint) {
if (newPaint.strokeOpacity === void 0) {
newPaint.strokeOpacity = newPaint.opacity;
}
else if (paint.type === 'icon') {
return paint;
if (newPaint.fillOpacity === void 0) {
newPaint.fillOpacity = newPaint.opacity;
}
else {
newPaint = expressionCallback({ paint, defaultPaint });
}
if (isPaintCallback(newPaint)) {
return newPaint;
}
if ('color' in newPaint) {
if (!newPaint.strokeColor) {
newPaint.strokeColor = newPaint.color;
}
if (!newPaint.fillColor) {
newPaint.fillColor = newPaint.color;
}
}
if ('opacity' in newPaint) {
if (newPaint.strokeOpacity === undefined) {
newPaint.strokeOpacity = newPaint.opacity;
}
if (newPaint.fillOpacity === undefined) {
newPaint.fillOpacity = newPaint.opacity;
}
}
return newPaint;
}
return newPaint;
}

@@ -193,0 +223,0 @@

@@ -1,2 +0,2 @@

import{isExpression as t,evaluate as n}from"@nextgis/expression";import{featureFilter as i}from"@nextgis/properties-filter";function o(t){return!!Array.isArray(t)}function r(t){return"[object Object]"===Object.prototype.toString.call(t)}function e(t){return!!r(t)&&("get-paint"!==t.type&&"icon"!==t.type)}function f(t){return"function"==typeof t}function c(t){return"icon"===t.type||"html"in t}function a(t){return i=>{const o=i.properties;return!!o&&n(t,o)}}const u=["iconSize","iconAnchor"];function p(n){let i=!1;const o={};for(const r in n)if(-1===u.indexOf(r)){const e=r,f=n[e];t(f)&&(i=!0,o[e]=a(f))}if(i)return t=>{const i={};for(const n in o)i[n]=o[n](t);return{...n,...i}}}function l(t){let n={};const o=[];for(const i of t)i&&(Array.isArray(i)?o.push(i):n=i);return t=>{const r=o.find((n=>i(t,n[0])));return r?{...n,...r[1]}:n}}function s({paint:t,defaultPaint:n}){var i;let o={...n};return o={...o,...t},o.fill=null===(i=o.fill)||void 0===i||i,o.stroke=void 0!==o.stroke?o.stroke:!o.fill||!(!o.strokeColor&&!o.strokeOpacity),o}function y({paint:t,defaultPaint:n,getPaintFunctions:i}){if(!t)throw new Error("paint is empty");let r={...n};if(f(t)){const o=o=>{const r=y({paint:t(o),defaultPaint:n,getPaintFunctions:i});return r.type=t.type,r};return o.type=t.type,o}if(o(t))return o=>y({paint:l(t)(o),defaultPaint:n,getPaintFunctions:i});if("get-paint"===t.type){const o=function(t,n){if("function"==typeof t.from)return t.from(t.options);if("string"==typeof t.from&&n){const i=n[t.from];if(i)return i(t.options)}}(t,i);o&&(r=y({paint:o,defaultPaint:n,getPaintFunctions:i}))}else{if("icon"===t.type)return t;r=function({paint:t,defaultPaint:n}){const i=p(t);if(i){const o=t=>y({paint:i(t),defaultPaint:n});return o.paint=s({paint:t,defaultPaint:n}),o}return s({paint:t,defaultPaint:n})}({paint:t,defaultPaint:n})}return f(r)||("color"in r&&(r.strokeColor||(r.strokeColor=r.color),r.fillColor||(r.fillColor=r.color)),"opacity"in r&&(void 0===r.strokeOpacity&&(r.strokeOpacity=r.opacity),void 0===r.fillOpacity&&(r.fillOpacity=r.opacity))),r}export{p as createExpressionCallback,e as isBasePaint,c as isIcon,r as isPaint,f as isPaintCallback,o as isPropertiesPaint,y as preparePaint};
import{isExpression as t,evaluate as n}from"@nextgis/expression";import{featureFilter as r}from"@nextgis/properties-filter";function e(t){return!!Array.isArray(t)}function o(t){return"[object Object]"===Object.prototype.toString.call(t)}function i(t){return!!o(t)&&("get-paint"!==t.type&&"icon"!==t.type)}function a(t){return"function"==typeof t}function f(t){return"icon"===t.type||"html"in t}var c=Object.defineProperty,p=Object.getOwnPropertySymbols,l=Object.prototype.hasOwnProperty,u=Object.prototype.propertyIsEnumerable,s=(t,n,r)=>n in t?c(t,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[n]=r,y=(t,n)=>{for(var r in n||(n={}))l.call(n,r)&&s(t,r,n[r]);if(p)for(var r of p(n))u.call(n,r)&&s(t,r,n[r]);return t};function b(t){return r=>{const e=r.properties;return!!e&&n(t,e)}}const O=["iconSize","iconAnchor"];function P(n){let r=!1;const e={};for(const o in n)if(-1===O.indexOf(o)){const i=o,a=n[i];t(a)&&(r=!0,e[i]=b(a))}if(r)return t=>{const r={};for(const n in e)r[n]=e[n](t);return y(y({},n),r)}}var d=Object.defineProperty,m=Object.getOwnPropertySymbols,g=Object.prototype.hasOwnProperty,v=Object.prototype.propertyIsEnumerable,j=(t,n,r)=>n in t?d(t,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[n]=r,k=(t,n)=>{for(var r in n||(n={}))g.call(n,r)&&j(t,r,n[r]);if(m)for(var r of m(n))v.call(n,r)&&j(t,r,n[r]);return t};function w(t){let n={};const e=[];for(const r of t)r&&(Array.isArray(r)?e.push(r):n=r);return t=>{const o=e.find((n=>r(t,n[0])));return o?k(k({},n),o[1]):n}}function h({paint:t,defaultPaint:n}){var r;let e=k({},n);return e=k(k({},e),t),e.fill=null==(r=e.fill)||r,e.stroke=void 0!==e.stroke?e.stroke:!e.fill||!(!e.strokeColor&&!e.strokeOpacity),e}function x({paint:t,defaultPaint:n,getPaintFunctions:r}){if(!t)throw new Error("paint is empty");let o=k({},n);if(a(t)){const e=e=>{const o=x({paint:t(e),defaultPaint:n,getPaintFunctions:r});return o.type=t.type,o};return e.type=t.type,e}if(e(t))return e=>x({paint:w(t)(e),defaultPaint:n,getPaintFunctions:r});if("get-paint"===t.type){const e=function(t,n){if("function"==typeof t.from)return t.from(t.options);if("string"==typeof t.from&&n){const r=n[t.from];if(r)return r(t.options)}}(t,r);e&&(o=x({paint:e,defaultPaint:n,getPaintFunctions:r}))}else{if("icon"===t.type)return t;o=function({paint:t,defaultPaint:n}){const r=P(t);if(r){const e=t=>x({paint:r(t),defaultPaint:n});return e.paint=h({paint:t,defaultPaint:n}),e}return h({paint:t,defaultPaint:n})}({paint:t,defaultPaint:n})}return a(o)||("color"in o&&(o.strokeColor||(o.strokeColor=o.color),o.fillColor||(o.fillColor=o.color)),"opacity"in o&&(void 0===o.strokeOpacity&&(o.strokeOpacity=o.opacity),void 0===o.fillOpacity&&(o.fillOpacity=o.opacity))),o}export{P as createExpressionCallback,i as isBasePaint,f as isIcon,o as isPaint,a as isPaintCallback,e as isPropertiesPaint,x as preparePaint};
//# sourceMappingURL=paint.esm-bundler.prod.js.map

@@ -1,2 +0,2 @@

/** Bundle of @nextgis/paint; version: 1.19.0; author: NextGIS */
/** Bundle of @nextgis/paint; version: 2.0.0-alpha.0; author: NextGIS */
var Paint = (function (exports) {

@@ -6,986 +6,972 @@ 'use strict';

function isPropertiesPaint(paint) {
if (Array.isArray(paint)) {
return true;
}
return false;
if (Array.isArray(paint)) {
return true;
}
return false;
}
function isPaint(paint) {
if (Object.prototype.toString.call(paint) === '[object Object]') {
return true;
}
return false;
if (Object.prototype.toString.call(paint) === "[object Object]") {
return true;
}
return false;
}
function isBasePaint(paint) {
if (isPaint(paint)) {
if (paint.type === 'get-paint' || paint.type === 'icon') {
return false;
}
return true;
if (isPaint(paint)) {
if (paint.type === "get-paint" || paint.type === "icon") {
return false;
}
return false;
return true;
}
return false;
}
function isPaintCallback(paint) {
if (typeof paint === 'function') {
return true;
}
return false;
if (typeof paint === "function") {
return true;
}
return false;
}
function isIcon(paint) {
return paint.type === 'icon' || 'html' in paint;
return paint.type === "icon" || "html" in paint;
}
/******************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
var __assign = function() {
__assign = Object.assign || function __assign(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
function __spreadArray(to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
}
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
var e = new Error(message);
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
};
function evaluateArgs(cb) {
return function (args, data) {
var unwrap = args.map(function (a) { return a(); });
return cb(unwrap, data);
};
return (args, data) => {
const unwrap = args.map((a) => a());
return cb(unwrap, data);
};
}
function not(_a) {
var expr = _a[0];
return !expr;
function not([expr]) {
return !expr;
}
function notEqual(_a) {
var a = _a[0], b = _a[1];
return a !== b;
function notEqual([a, b]) {
return a !== b;
}
function lessThan(_a) {
var left = _a[0], right = _a[1];
return left < right;
function lessThan([left, right]) {
return left < right;
}
function lessThanOrEqual(_a) {
var left = _a[0], right = _a[1];
return left <= right;
function lessThanOrEqual([left, right]) {
return left <= right;
}
function equal(_a) {
var left = _a[0], right = _a[1];
return left === right;
function equal([left, right]) {
return left === right;
}
function greaterThan(_a) {
var left = _a[0], right = _a[1];
return left > right;
function greaterThan([left, right]) {
return left > right;
}
function greaterThanOrEqual(_a) {
var left = _a[0], right = _a[1];
return left >= right;
function greaterThanOrEqual([left, right]) {
return left >= right;
}
var coalesce = function (args) {
for (var i = 0; i < args.length; i++) {
var arg = args[i]();
if (arg !== null && arg !== undefined) {
return arg;
}
const coalesce = (args) => {
for (let i = 0; i < args.length; i++) {
const arg = args[i]();
if (arg !== null && arg !== void 0) {
return arg;
}
return null;
}
return null;
};
var all = function (args) {
for (var i = 0; i < args.length; i++) {
var arg = args[i]();
if (!arg) {
return false;
}
const all = (args) => {
for (let i = 0; i < args.length; i++) {
const arg = args[i]();
if (!arg) {
return false;
}
return true;
}
return true;
};
var any = function (args) {
for (var i = 0; i < args.length; i++) {
var arg = args[i]();
if (arg) {
return true;
}
const any = (args) => {
for (let i = 0; i < args.length; i++) {
const arg = args[i]();
if (arg) {
return true;
}
return false;
}
return false;
};
var match = function (args) {
var lookupFn = args[0], cases = args.slice(1);
var lookup = lookupFn();
// remove last odd item from cases array
var defValue = cases.splice(-1, cases.length % 2)[0];
for (var fry = 0; fry < cases.length - 1; fry += 2) {
var key = cases[fry]();
if (key === lookup) {
return cases[fry + 1]();
}
const match = (args) => {
const [lookupFn, ...cases] = args;
const lookup = lookupFn();
const defValue = cases.splice(-1, cases.length % 2)[0];
for (let fry = 0; fry < cases.length - 1; fry += 2) {
const key = cases[fry]();
if (key === lookup) {
return cases[fry + 1]();
}
return defValue();
}
return defValue();
};
var caseFunc = function (args) {
if (args.length < 2) {
throw new Error('The "case" function requires at least a condition and a corresponding output.');
const caseFunc = (args) => {
if (args.length < 2) {
throw new Error(
'The "case" function requires at least a condition and a corresponding output.'
);
}
if (args.length % 2 === 0) {
throw new Error(
"Missing a fallback value or unmatched condition-output pair."
);
}
for (let i = 0; i < args.length - 1; i += 2) {
const condition = args[i]();
const value = args[i + 1]();
if (condition) {
return value;
}
if (args.length % 2 === 0) {
throw new Error('Missing a fallback value or unmatched condition-output pair.');
}
for (var i = 0; i < args.length - 1; i += 2) {
var condition = args[i]();
var value = args[i + 1]();
if (condition) {
return value;
}
}
var fallback = args[args.length - 1];
return fallback();
}
const fallback = args[args.length - 1];
return fallback();
};
var decisionExpressions = {
'!': evaluateArgs(not),
'!=': evaluateArgs(notEqual),
'<': evaluateArgs(lessThan),
'<=': evaluateArgs(lessThanOrEqual),
'==': evaluateArgs(equal),
'>': evaluateArgs(greaterThan),
'>=': evaluateArgs(greaterThanOrEqual),
coalesce: coalesce,
all: all,
any: any,
case: caseFunc,
match: match,
const decisionExpressions = {
"!": evaluateArgs(not),
"!=": evaluateArgs(notEqual),
"<": evaluateArgs(lessThan),
"<=": evaluateArgs(lessThanOrEqual),
"==": evaluateArgs(equal),
">": evaluateArgs(greaterThan),
">=": evaluateArgs(greaterThanOrEqual),
coalesce,
all,
any,
case: caseFunc,
match
};
var COLORS = {
aliceblue: '#f0f8ff',
antiquewhite: '#faebd7',
aqua: '#00ffff',
aquamarine: '#7fffd4',
azure: '#f0ffff',
beige: '#f5f5dc',
bisque: '#ffe4c4',
black: '#000000',
blanchedalmond: '#ffebcd',
blue: '#0000ff',
blueviolet: '#8a2be2',
brown: '#a52a2a',
burlywood: '#deb887',
cadetblue: '#5f9ea0',
chartreuse: '#7fff00',
chocolate: '#d2691e',
coral: '#ff7f50',
cornflowerblue: '#6495ed',
cornsilk: '#fff8dc',
crimson: '#dc143c',
cyan: '#00ffff',
darkblue: '#00008b',
darkcyan: '#008b8b',
darkgoldenrod: '#b8860b',
darkgray: '#a9a9a9',
darkgreen: '#006400',
darkkhaki: '#bdb76b',
darkmagenta: '#8b008b',
darkolivegreen: '#556b2f',
darkorange: '#ff8c00',
darkorchid: '#9932cc',
darkred: '#8b0000',
darksalmon: '#e9967a',
darkseagreen: '#8fbc8f',
darkslateblue: '#483d8b',
darkslategray: '#2f4f4f',
darkturquoise: '#00ced1',
darkviolet: '#9400d3',
deeppink: '#ff1493',
deepskyblue: '#00bfff',
dimgray: '#696969',
dodgerblue: '#1e90ff',
firebrick: '#b22222',
floralwhite: '#fffaf0',
forestgreen: '#228b22',
fuchsia: '#ff00ff',
gainsboro: '#dcdcdc',
ghostwhite: '#f8f8ff',
gold: '#ffd700',
goldenrod: '#daa520',
gray: '#808080',
green: '#008000',
greenyellow: '#adff2f',
honeydew: '#f0fff0',
hotpink: '#ff69b4',
'indianred ': '#cd5c5c',
indigo: '#4b0082',
ivory: '#fffff0',
khaki: '#f0e68c',
lavender: '#e6e6fa',
lavenderblush: '#fff0f5',
lawngreen: '#7cfc00',
lemonchiffon: '#fffacd',
lightblue: '#add8e6',
lightcoral: '#f08080',
lightcyan: '#e0ffff',
lightgoldenrodyellow: '#fafad2',
lightgrey: '#d3d3d3',
lightgreen: '#90ee90',
lightpink: '#ffb6c1',
lightsalmon: '#ffa07a',
lightseagreen: '#20b2aa',
lightskyblue: '#87cefa',
lightslategray: '#778899',
lightsteelblue: '#b0c4de',
lightyellow: '#ffffe0',
lime: '#00ff00',
limegreen: '#32cd32',
linen: '#faf0e6',
magenta: '#ff00ff',
maroon: '#800000',
mediumaquamarine: '#66cdaa',
mediumblue: '#0000cd',
mediumorchid: '#ba55d3',
mediumpurple: '#9370d8',
mediumseagreen: '#3cb371',
mediumslateblue: '#7b68ee',
mediumspringgreen: '#00fa9a',
mediumturquoise: '#48d1cc',
mediumvioletred: '#c71585',
midnightblue: '#191970',
mintcream: '#f5fffa',
mistyrose: '#ffe4e1',
moccasin: '#ffe4b5',
navajowhite: '#ffdead',
navy: '#000080',
oldlace: '#fdf5e6',
olive: '#808000',
olivedrab: '#6b8e23',
orange: '#ffa500',
orangered: '#ff4500',
orchid: '#da70d6',
palegoldenrod: '#eee8aa',
palegreen: '#98fb98',
paleturquoise: '#afeeee',
palevioletred: '#d87093',
papayawhip: '#ffefd5',
peachpuff: '#ffdab9',
peru: '#cd853f',
pink: '#ffc0cb',
plum: '#dda0dd',
powderblue: '#b0e0e6',
purple: '#800080',
rebeccapurple: '#663399',
red: '#ff0000',
rosybrown: '#bc8f8f',
royalblue: '#4169e1',
saddlebrown: '#8b4513',
salmon: '#fa8072',
sandybrown: '#f4a460',
seagreen: '#2e8b57',
seashell: '#fff5ee',
sienna: '#a0522d',
silver: '#c0c0c0',
skyblue: '#87ceeb',
slateblue: '#6a5acd',
slategray: '#708090',
snow: '#fffafa',
springgreen: '#00ff7f',
steelblue: '#4682b4',
tan: '#d2b48c',
teal: '#008080',
thistle: '#d8bfd8',
tomato: '#ff6347',
turquoise: '#40e0d0',
violet: '#ee82ee',
wheat: '#f5deb3',
white: '#ffffff',
whitesmoke: '#f5f5f5',
yellow: '#ffff00',
yellowgreen: '#9acd32',
const COLORS = {
aliceblue: "#f0f8ff",
antiquewhite: "#faebd7",
aqua: "#00ffff",
aquamarine: "#7fffd4",
azure: "#f0ffff",
beige: "#f5f5dc",
bisque: "#ffe4c4",
black: "#000000",
blanchedalmond: "#ffebcd",
blue: "#0000ff",
blueviolet: "#8a2be2",
brown: "#a52a2a",
burlywood: "#deb887",
cadetblue: "#5f9ea0",
chartreuse: "#7fff00",
chocolate: "#d2691e",
coral: "#ff7f50",
cornflowerblue: "#6495ed",
cornsilk: "#fff8dc",
crimson: "#dc143c",
cyan: "#00ffff",
darkblue: "#00008b",
darkcyan: "#008b8b",
darkgoldenrod: "#b8860b",
darkgray: "#a9a9a9",
darkgreen: "#006400",
darkkhaki: "#bdb76b",
darkmagenta: "#8b008b",
darkolivegreen: "#556b2f",
darkorange: "#ff8c00",
darkorchid: "#9932cc",
darkred: "#8b0000",
darksalmon: "#e9967a",
darkseagreen: "#8fbc8f",
darkslateblue: "#483d8b",
darkslategray: "#2f4f4f",
darkturquoise: "#00ced1",
darkviolet: "#9400d3",
deeppink: "#ff1493",
deepskyblue: "#00bfff",
dimgray: "#696969",
dodgerblue: "#1e90ff",
firebrick: "#b22222",
floralwhite: "#fffaf0",
forestgreen: "#228b22",
fuchsia: "#ff00ff",
gainsboro: "#dcdcdc",
ghostwhite: "#f8f8ff",
gold: "#ffd700",
goldenrod: "#daa520",
gray: "#808080",
green: "#008000",
greenyellow: "#adff2f",
honeydew: "#f0fff0",
hotpink: "#ff69b4",
"indianred ": "#cd5c5c",
indigo: "#4b0082",
ivory: "#fffff0",
khaki: "#f0e68c",
lavender: "#e6e6fa",
lavenderblush: "#fff0f5",
lawngreen: "#7cfc00",
lemonchiffon: "#fffacd",
lightblue: "#add8e6",
lightcoral: "#f08080",
lightcyan: "#e0ffff",
lightgoldenrodyellow: "#fafad2",
lightgrey: "#d3d3d3",
lightgreen: "#90ee90",
lightpink: "#ffb6c1",
lightsalmon: "#ffa07a",
lightseagreen: "#20b2aa",
lightskyblue: "#87cefa",
lightslategray: "#778899",
lightsteelblue: "#b0c4de",
lightyellow: "#ffffe0",
lime: "#00ff00",
limegreen: "#32cd32",
linen: "#faf0e6",
magenta: "#ff00ff",
maroon: "#800000",
mediumaquamarine: "#66cdaa",
mediumblue: "#0000cd",
mediumorchid: "#ba55d3",
mediumpurple: "#9370d8",
mediumseagreen: "#3cb371",
mediumslateblue: "#7b68ee",
mediumspringgreen: "#00fa9a",
mediumturquoise: "#48d1cc",
mediumvioletred: "#c71585",
midnightblue: "#191970",
mintcream: "#f5fffa",
mistyrose: "#ffe4e1",
moccasin: "#ffe4b5",
navajowhite: "#ffdead",
navy: "#000080",
oldlace: "#fdf5e6",
olive: "#808000",
olivedrab: "#6b8e23",
orange: "#ffa500",
orangered: "#ff4500",
orchid: "#da70d6",
palegoldenrod: "#eee8aa",
palegreen: "#98fb98",
paleturquoise: "#afeeee",
palevioletred: "#d87093",
papayawhip: "#ffefd5",
peachpuff: "#ffdab9",
peru: "#cd853f",
pink: "#ffc0cb",
plum: "#dda0dd",
powderblue: "#b0e0e6",
purple: "#800080",
rebeccapurple: "#663399",
red: "#ff0000",
rosybrown: "#bc8f8f",
royalblue: "#4169e1",
saddlebrown: "#8b4513",
salmon: "#fa8072",
sandybrown: "#f4a460",
seagreen: "#2e8b57",
seashell: "#fff5ee",
sienna: "#a0522d",
silver: "#c0c0c0",
skyblue: "#87ceeb",
slateblue: "#6a5acd",
slategray: "#708090",
snow: "#fffafa",
springgreen: "#00ff7f",
steelblue: "#4682b4",
tan: "#d2b48c",
teal: "#008080",
thistle: "#d8bfd8",
tomato: "#ff6347",
turquoise: "#40e0d0",
violet: "#ee82ee",
wheat: "#f5deb3",
white: "#ffffff",
whitesmoke: "#f5f5f5",
yellow: "#ffff00",
yellowgreen: "#9acd32"
};
function isHex(hex) {
return typeof hex === 'string' && /^#([A-Fa-f0-9]{3}){1,2}$/.test(hex);
return typeof hex === "string" && /^#([A-Fa-f0-9]{3}){1,2}$/.test(hex);
}
function isRgb(hex) {
var r =
const r = (
// eslint-disable-next-line max-len
/^rgb(a?)\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)(?:\s*,\s*([01](?:\.\d+)?))?\s*\)$/;
return typeof hex === 'string' && r.test(hex);
/^rgb(a?)\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)(?:\s*,\s*([01](?:\.\d+)?))?\s*\)$/
);
return typeof hex === "string" && r.test(hex);
}
function isColorObj(obj) {
if (typeof obj === 'object' && obj !== null) {
var hasRgb = 'r' in obj && 'g' in obj && 'b' in obj;
var hasValidAlpha = !('a' in obj) || (typeof obj.a === 'number' && obj.a >= 0 && obj.a <= 1);
return hasRgb && hasValidAlpha;
}
return false;
if (typeof obj === "object" && obj !== null) {
const hasRgb = "r" in obj && "g" in obj && "b" in obj;
const hasValidAlpha = !("a" in obj) || typeof obj.a === "number" && obj.a >= 0 && obj.a <= 1;
return hasRgb && hasValidAlpha;
}
return false;
}
function isColorName(name) {
if (typeof name === 'string' && name in COLORS) {
return true;
}
return false;
if (typeof name === "string" && name in COLORS) {
return true;
}
return false;
}
function toColor(value) {
if (isHex(value)) {
return hexToColor(value);
}
else if (isColorName(value)) {
return colorNameToColor(value);
}
else if (isRgb(value)) {
return rgbToColor(value);
}
else if (isColorObj(value)) {
return colorObjectToColor(value);
}
throw new Error("The '".concat(value, "' cannot be converted to color"));
if (isHex(value)) {
return hexToColor(value);
} else if (isColorName(value)) {
return colorNameToColor(value);
} else if (isRgb(value)) {
return rgbToColor(value);
} else if (isColorObj(value)) {
return colorObjectToColor(value);
}
throw new Error(`The '${value}' cannot be converted to color`);
}
function colorNameToColor(name) {
return hexToColor(COLORS[name]);
return hexToColor(COLORS[name]);
}
function hexToColor(hex) {
var shortRGB = /^#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])$/;
var shortRGBA = /^#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])$/;
var longRGB = /^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/;
var longRGBA = /^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/;
var result;
if ((result = shortRGB.exec(hex))) {
return [
parseInt(result[1] + result[1], 16),
parseInt(result[2] + result[2], 16),
parseInt(result[3] + result[3], 16),
];
}
else if ((result = shortRGBA.exec(hex))) {
return [
parseInt(result[1] + result[1], 16),
parseInt(result[2] + result[2], 16),
parseInt(result[3] + result[3], 16),
parseInt(result[4] + result[4], 16) / 255,
];
}
else if ((result = longRGB.exec(hex))) {
return [
parseInt(result[1], 16),
parseInt(result[2], 16),
parseInt(result[3], 16),
];
}
else if ((result = longRGBA.exec(hex))) {
return [
parseInt(result[1], 16),
parseInt(result[2], 16),
parseInt(result[3], 16),
parseInt(result[4], 16) / 255,
];
}
throw new Error("The '".concat(hex, "' Is not valid hex"));
const shortRGB = /^#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])$/;
const shortRGBA = /^#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])$/;
const longRGB = /^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/;
const longRGBA = /^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/;
let result;
if (result = shortRGB.exec(hex)) {
return [
parseInt(result[1] + result[1], 16),
parseInt(result[2] + result[2], 16),
parseInt(result[3] + result[3], 16)
];
} else if (result = shortRGBA.exec(hex)) {
return [
parseInt(result[1] + result[1], 16),
parseInt(result[2] + result[2], 16),
parseInt(result[3] + result[3], 16),
parseInt(result[4] + result[4], 16) / 255
];
} else if (result = longRGB.exec(hex)) {
return [
parseInt(result[1], 16),
parseInt(result[2], 16),
parseInt(result[3], 16)
];
} else if (result = longRGBA.exec(hex)) {
return [
parseInt(result[1], 16),
parseInt(result[2], 16),
parseInt(result[3], 16),
parseInt(result[4], 16) / 255
];
}
throw new Error(`The '${hex}' Is not valid hex`);
}
function rgbToColor(rgb) {
var rgbPattern = /^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/;
var rgbaPattern = /^rgba\((\d+),\s*(\d+),\s*(\d+),\s*([\d.]+)\)$/;
var matches;
if ((matches = rgb.match(rgbPattern))) {
return [
parseInt(matches[1], 10),
parseInt(matches[2], 10),
parseInt(matches[3], 10),
];
}
else if ((matches = rgb.match(rgbaPattern))) {
return [
parseInt(matches[1], 10),
parseInt(matches[2], 10),
parseInt(matches[3], 10),
parseFloat(matches[4]),
];
}
throw new Error("The '".concat(rgb, "' Is not valid rgb"));
const rgbPattern = /^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/;
const rgbaPattern = /^rgba\((\d+),\s*(\d+),\s*(\d+),\s*([\d.]+)\)$/;
let matches;
if (matches = rgb.match(rgbPattern)) {
return [
parseInt(matches[1], 10),
parseInt(matches[2], 10),
parseInt(matches[3], 10)
];
} else if (matches = rgb.match(rgbaPattern)) {
return [
parseInt(matches[1], 10),
parseInt(matches[2], 10),
parseInt(matches[3], 10),
parseFloat(matches[4])
];
}
throw new Error(`The '${rgb}' Is not valid rgb`);
}
function colorObjectToColor(_a) {
var r = _a.r, g = _a.g, b = _a.b, a = _a.a;
return __spreadArray([r, g, b], (a !== undefined ? [a] : []), true);
function colorObjectToColor({ r, g, b, a }) {
return [r, g, b, ...a !== void 0 ? [a] : []];
}
function colorToRGB(array) {
return "rgb(".concat(array.join(','), ")");
return `rgb(${array.join(",")})`;
}
function linearInterpolation(input, input1, output1, input2, output2) {
if (typeof output1 === 'number' && typeof output2 === 'number') {
return (output1 + ((input - input1) / (input2 - input1)) * (output2 - output1));
}
try {
var outputColor1 = toColor(output1);
var outputColor2_1 = toColor(output2);
return colorToRGB(outputColor1.map(function (val, index) {
return Math.ceil(linearInterpolation(input, input1, val, input2, outputColor2_1[index]));
}));
}
catch (er) {
console.log(er);
}
throw new Error('Unsupported output type for linear interpolation.');
if (typeof output1 === "number" && typeof output2 === "number") {
return output1 + (input - input1) / (input2 - input1) * (output2 - output1);
}
try {
const outputColor1 = toColor(output1);
const outputColor2 = toColor(output2);
return colorToRGB(
outputColor1.map((val, index) => {
return Math.ceil(
linearInterpolation(input, input1, val, input2, outputColor2[index])
);
})
);
} catch (er) {
console.log(er);
}
throw new Error("Unsupported output type for linear interpolation.");
}
var interpolate = function (_a) {
var interpolationFn = _a[0], inputFn = _a[1], stops = _a.slice(2);
if (stops.length < 2) {
throw new Error('At least two stops are required');
const interpolate = ([
interpolationFn,
inputFn,
...stops
]) => {
if (stops.length < 2) {
throw new Error("At least two stops are required");
}
if (stops.length < 2 || stops.length % 2 !== 0) {
throw new Error("Invalid stops provided.");
}
const input = inputFn();
if (typeof input !== "number") {
throw new Error("Input must be a number.");
}
const interpolation = interpolationFn();
for (let i = 0; i < stops.length - 2; i += 2) {
const stopInput1 = stops[i]();
const stopOutput1 = stops[i + 1]();
const stopInput2 = stops[i + 2]();
const stopOutput2 = stops[i + 3]();
if (input >= stopInput1 && input <= stopInput2) {
if (interpolation[0] === "linear") {
return linearInterpolation(
input,
stopInput1,
stopOutput1,
stopInput2,
stopOutput2
);
}
}
if (stops.length < 2 || stops.length % 2 !== 0) {
throw new Error('Invalid stops provided.');
}
var input = inputFn();
if (typeof input !== 'number') {
throw new Error('Input must be a number.');
}
var interpolation = interpolationFn();
for (var i = 0; i < stops.length - 2; i += 2) {
var stopInput1 = stops[i]();
var stopOutput1 = stops[i + 1]();
var stopInput2 = stops[i + 2]();
var stopOutput2 = stops[i + 3]();
if (input >= stopInput1 && input <= stopInput2) {
if (interpolation[0] === 'linear') {
return linearInterpolation(input, stopInput1, stopOutput1, stopInput2, stopOutput2);
}
// else if (interpolation[0] === 'exponential') {
// const base = interpolation[1];
// return exponentialInterpolation(
// input,
// base,
// stopInput1,
// stopOutput1,
// stopInput2,
// stopOutput2,
// );
// }
}
}
throw new Error('Invalid interpolation type.');
}
throw new Error("Invalid interpolation type.");
};
var step = function (args) {
var inputFn = args[0], defaultValue = args[1], stops = args.slice(2);
var input = inputFn();
if (typeof input !== 'number') {
return defaultValue();
const step = (args) => {
const [inputFn, defaultValue, ...stops] = args;
const input = inputFn();
if (typeof input !== "number") {
return defaultValue();
}
for (let i = 0; i < stops.length - 2; i += 2) {
const stopInput = stops[i]();
const stopOutput = stops[i + 1]();
const nextStopInput = stops[i + 2]();
if (input >= stopInput && input < nextStopInput) {
return stopOutput;
}
for (var i = 0; i < stops.length - 2; i += 2) {
var stopInput = stops[i]();
var stopOutput = stops[i + 1]();
var nextStopInput = stops[i + 2]();
if (input >= stopInput && input < nextStopInput) {
return stopOutput;
}
}
if (input >= stops[stops.length - 2]()) {
return stops[stops.length - 1]();
}
return defaultValue();
}
if (input >= stops[stops.length - 2]()) {
return stops[stops.length - 1]();
}
return defaultValue();
};
var interpolationExpressions = {
step: step,
interpolate: interpolate,
const interpolationExpressions = {
step,
interpolate
};
function get(_a, data) {
var key = _a[0], objExp = _a[1];
var target = objExp || data;
if (target && typeof target === 'object' && key in target) {
return target[key];
}
return null;
function get([key, objExp], data) {
const target = objExp || data;
if (target && typeof target === "object" && key in target) {
return target[key];
}
return null;
}
function has(_a, data) {
var key = _a[0], objExp = _a[1];
var target = objExp || data;
return !!(target && typeof target === 'object' && key in target);
function has([key, objExp], data) {
const target = objExp || data;
return !!(target && typeof target === "object" && key in target);
}
function at(_a) {
var index = _a[0], array = _a[1];
return array[index];
function at([index, array]) {
return array[index];
}
function inFunc(_a) {
var keyword = _a[0], input = _a[1];
if (typeof input === 'string') {
return input.includes(String(keyword));
}
else if (Array.isArray(input)) {
return input.includes(keyword);
}
throw new Error("Invalid input type for 'in'. Expected string or array, got ".concat(typeof input, "."));
function inFunc([keyword, input]) {
if (typeof input === "string") {
return input.includes(String(keyword));
} else if (Array.isArray(input)) {
return input.includes(keyword);
}
throw new Error(
`Invalid input type for 'in'. Expected string or array, got ${typeof input}.`
);
}
var length = function (_a) {
var item = _a[0];
if (typeof item === 'string' || Array.isArray(item)) {
return item.length;
}
return undefined;
const length = ([item]) => {
if (typeof item === "string" || Array.isArray(item)) {
return item.length;
}
return void 0;
};
function indexOf(_a) {
var keyword = _a[0], input = _a[1], startIndex = _a[2];
if (typeof input === 'string') {
return input.indexOf(String(keyword), startIndex);
}
else if (Array.isArray(input)) {
return input.indexOf(keyword, startIndex);
}
throw new Error("Invalid input type for 'index-of'. Expected string or array, got ".concat(typeof input, "."));
function indexOf([keyword, input, startIndex]) {
if (typeof input === "string") {
return input.indexOf(String(keyword), startIndex);
} else if (Array.isArray(input)) {
return input.indexOf(keyword, startIndex);
}
throw new Error(
`Invalid input type for 'index-of'. Expected string or array, got ${typeof input}.`
);
}
function slice(args) {
var input = args[0], startIndex = args[1], endIndex = args[2];
if (typeof input === 'string') {
return input.slice(startIndex, endIndex);
}
else if (Array.isArray(input)) {
return input.slice(startIndex, endIndex);
}
throw new Error("Invalid input type for 'slice'. Expected string or array, got ".concat(typeof input, "."));
const [input, startIndex, endIndex] = args;
if (typeof input === "string") {
return input.slice(startIndex, endIndex);
} else if (Array.isArray(input)) {
return input.slice(startIndex, endIndex);
}
throw new Error(
`Invalid input type for 'slice'. Expected string or array, got ${typeof input}.`
);
}
var lookupExpressions = {
get: evaluateArgs(get),
length: evaluateArgs(length),
at: evaluateArgs(at),
has: evaluateArgs(has),
in: evaluateArgs(inFunc),
'index-of': evaluateArgs(indexOf),
slice: evaluateArgs(slice),
const lookupExpressions = {
get: evaluateArgs(get),
length: evaluateArgs(length),
at: evaluateArgs(at),
has: evaluateArgs(has),
in: evaluateArgs(inFunc),
"index-of": evaluateArgs(indexOf),
slice: evaluateArgs(slice)
};
var mathExpressions = {
'+': evaluateArgs(function (args) { return args.reduce(function (a, b) { return a + b; }, 0); }),
'-': evaluateArgs(function (args) { return args.reduce(function (a, b) { return a - b; }); }),
'*': evaluateArgs(function (args) { return args.reduce(function (a, b) { return a * b; }, 1); }),
'/': evaluateArgs(function (args) { return args.reduce(function (a, b) { return a / b; }); }),
'%': evaluateArgs(function (args) { return args[0] % args[1]; }),
'^': evaluateArgs(function (args) { return Math.pow(args[0], args[1]); }),
abs: evaluateArgs(function (args) { return Math.abs(args[0]); }),
acos: evaluateArgs(function (args) { return Math.acos(args[0]); }),
asin: evaluateArgs(function (args) { return Math.asin(args[0]); }),
atan: evaluateArgs(function (args) { return Math.atan(args[0]); }),
ceil: evaluateArgs(function (args) { return Math.ceil(args[0]); }),
cos: evaluateArgs(function (args) { return Math.cos(args[0]); }),
e: function () { return Math.E; },
floor: evaluateArgs(function (args) { return Math.floor(args[0]); }),
ln: evaluateArgs(function (args) { return Math.log(args[0]); }),
ln2: function () { return Math.LN2; },
log10: evaluateArgs(function (args) { return Math.log10(args[0]); }),
log2: evaluateArgs(function (args) { return Math.log2(args[0]); }),
max: evaluateArgs(function (args) { return Math.max.apply(Math, args); }),
min: evaluateArgs(function (args) { return Math.min.apply(Math, args); }),
pi: function () { return Math.PI; },
round: evaluateArgs(function (args) { return Math.round(args[0]); }),
sin: evaluateArgs(function (args) { return Math.sin(args[0]); }),
sqrt: evaluateArgs(function (args) { return Math.sqrt(args[0]); }),
tan: evaluateArgs(function (args) { return Math.tan(args[0]); }),
const mathExpressions = {
"+": evaluateArgs((args) => args.reduce((a, b) => a + b, 0)),
"-": evaluateArgs((args) => args.reduce((a, b) => a - b)),
"*": evaluateArgs((args) => args.reduce((a, b) => a * b, 1)),
"/": evaluateArgs((args) => args.reduce((a, b) => a / b)),
"%": evaluateArgs((args) => args[0] % args[1]),
"^": evaluateArgs((args) => Math.pow(args[0], args[1])),
abs: evaluateArgs((args) => Math.abs(args[0])),
acos: evaluateArgs((args) => Math.acos(args[0])),
asin: evaluateArgs((args) => Math.asin(args[0])),
atan: evaluateArgs((args) => Math.atan(args[0])),
ceil: evaluateArgs((args) => Math.ceil(args[0])),
cos: evaluateArgs((args) => Math.cos(args[0])),
e: () => Math.E,
floor: evaluateArgs((args) => Math.floor(args[0])),
ln: evaluateArgs((args) => Math.log(args[0])),
ln2: () => Math.LN2,
log10: evaluateArgs((args) => Math.log10(args[0])),
log2: evaluateArgs((args) => Math.log2(args[0])),
max: evaluateArgs((args) => Math.max(...args)),
min: evaluateArgs((args) => Math.min(...args)),
pi: () => Math.PI,
round: evaluateArgs((args) => Math.round(args[0])),
sin: evaluateArgs((args) => Math.sin(args[0])),
sqrt: evaluateArgs((args) => Math.sqrt(args[0])),
tan: evaluateArgs((args) => Math.tan(args[0]))
};
var stringExpressions = {
concat: evaluateArgs(function (args) { return args.reduce(function (a, b) { return String(a) + String(b); }, ''); }),
downcase: evaluateArgs(function (args) { return String(args[0]).toLowerCase(); }),
upcase: evaluateArgs(function (args) { return String(args[0]).toUpperCase(); }),
const stringExpressions = {
concat: evaluateArgs((args) => args.reduce((a, b) => String(a) + String(b), "")),
downcase: evaluateArgs((args) => String(args[0]).toLowerCase()),
upcase: evaluateArgs((args) => String(args[0]).toUpperCase())
};
var tryConvert = function (converter, arg, data) {
try {
var result = converter(arg, data);
if (result !== undefined) {
return result;
}
const tryConvert = (converter, arg, data) => {
try {
const result = converter(arg, data);
if (result !== void 0) {
return result;
}
catch (_a) {
// ignore errors
}
return undefined;
} catch (e) {
}
return void 0;
};
function fallback(cb) {
return function (args, data) {
for (var _i = 0, args_1 = args; _i < args_1.length; _i++) {
var arg = args_1[_i];
var result = tryConvert(cb, arg, data);
if (result !== undefined) {
return result;
}
}
throw new Error("Received a mismatched type");
};
return (args, data) => {
for (const arg of args) {
const result = tryConvert(cb, arg, data);
if (result !== void 0) {
return result;
}
}
throw new Error(`Received a mismatched type`);
};
}
var array = function (args) {
var firstArg = args[0], secondArg = args[1], thirdArg = args[2];
var requiredType = undefined;
var requiredLength = undefined;
var value;
if (typeof firstArg === 'string' &&
['string', 'number', 'boolean'].includes(firstArg)) {
requiredType = firstArg;
if (typeof secondArg === 'number') {
requiredLength = secondArg;
value = thirdArg;
}
else {
value = secondArg;
}
const array = (args) => {
const [firstArg, secondArg, thirdArg] = args;
let requiredType = void 0;
let requiredLength = void 0;
let value;
if (typeof firstArg === "string" && ["string", "number", "boolean"].includes(firstArg)) {
requiredType = firstArg;
if (typeof secondArg === "number") {
requiredLength = secondArg;
value = thirdArg;
} else {
value = secondArg;
}
else if (Array.isArray(firstArg)) {
value = firstArg;
}
if (!Array.isArray(value)) {
throw new Error('Expected an array');
}
if (requiredType && !value.every(function (item) { return typeof item === requiredType; })) {
throw new Error("Expected all items in array to be of type ".concat(requiredType));
}
if (requiredLength && value.length !== requiredLength) {
throw new Error("Expected array of length ".concat(requiredLength));
}
return value;
} else if (Array.isArray(firstArg)) {
value = firstArg;
}
if (!Array.isArray(value)) {
throw new Error("Expected an array");
}
if (requiredType && !value.every((item) => typeof item === requiredType)) {
throw new Error(
`Expected all items in array to be of type ${requiredType}`
);
}
if (requiredLength && value.length !== requiredLength) {
throw new Error(`Expected array of length ${requiredLength}`);
}
return value;
};
function typeOfValue(value) {
if (value === null)
return 'null';
switch (typeof value) {
case 'string':
return 'string';
case 'number':
return 'number';
case 'boolean':
return 'boolean';
case 'object':
if (Array.isArray(value)) {
var arrayType = 'value';
if (value.every(function (item) { return typeof item === 'number'; })) {
arrayType = 'number';
}
else if (value.every(function (item) { return typeof item === 'string'; })) {
arrayType = 'string';
}
else if (value.every(function (item) { return typeof item === 'boolean'; })) {
arrayType = 'boolean';
}
return "array<".concat(arrayType, ", ").concat(value.length, ">");
}
else {
return 'object';
}
default:
return 'undefined';
}
if (value === null)
return "null";
switch (typeof value) {
case "string":
return "string";
case "number":
return "number";
case "boolean":
return "boolean";
case "object":
if (Array.isArray(value)) {
let arrayType = "value";
if (value.every((item) => typeof item === "number")) {
arrayType = "number";
} else if (value.every((item) => typeof item === "string")) {
arrayType = "string";
} else if (value.every((item) => typeof item === "boolean")) {
arrayType = "boolean";
}
return `array<${arrayType}, ${value.length}>`;
} else {
return "object";
}
default:
return "undefined";
}
}
var typeExpressions = {
array: evaluateArgs(array),
boolean: evaluateArgs(fallback(function (arg) { return (typeof arg === 'boolean' ? arg : undefined); })),
literal: evaluateArgs(function (_a) {
var arg = _a[0];
return arg;
}),
number: evaluateArgs(fallback(function (arg) { return (typeof arg === 'number' ? arg : undefined); })),
object: evaluateArgs(fallback(function (arg) {
return arg !== null && typeof arg === 'object' && !Array.isArray(arg)
? arg
: undefined;
})),
string: evaluateArgs(fallback(function (arg) { return (typeof arg === 'string' ? arg : undefined); })),
'to-boolean': evaluateArgs(fallback(Boolean)),
'to-number': evaluateArgs(fallback(Number)),
'to-string': evaluateArgs(fallback(String)),
typeof: evaluateArgs(function (_a) {
var arg = _a[0];
return typeOfValue(arg);
}),
const typeExpressions = {
array: evaluateArgs(array),
boolean: evaluateArgs(
fallback((arg) => typeof arg === "boolean" ? arg : void 0)
),
literal: evaluateArgs(([arg]) => arg),
number: evaluateArgs(fallback((arg) => typeof arg === "number" ? arg : void 0)),
object: evaluateArgs(
fallback(
(arg) => arg !== null && typeof arg === "object" && !Array.isArray(arg) ? arg : void 0
)
),
string: evaluateArgs(fallback((arg) => typeof arg === "string" ? arg : void 0)),
"to-boolean": evaluateArgs(fallback(Boolean)),
"to-number": evaluateArgs(fallback(Number)),
"to-string": evaluateArgs(fallback(String)),
typeof: evaluateArgs(([arg]) => typeOfValue(arg))
};
var __defProp$3 = Object.defineProperty;
var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues$3 = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp$3.call(b, prop))
__defNormalProp$3(a, prop, b[prop]);
if (__getOwnPropSymbols$3)
for (var prop of __getOwnPropSymbols$3(b)) {
if (__propIsEnum$3.call(b, prop))
__defNormalProp$3(a, prop, b[prop]);
}
return a;
};
function isExpression(value) {
if (Array.isArray(value)) {
var lookup = value[0], cases = value.slice(1);
var l = lookup;
return (typeof l === 'string' &&
l !== 'literal' &&
l in expressions &&
cases.length > 0);
}
return false;
if (Array.isArray(value)) {
const [lookup, ...cases] = value;
const l = lookup;
return typeof l === "string" && l !== "literal" && l in expressions && cases.length > 0;
}
return false;
}
var expressions = __assign(__assign(__assign(__assign(__assign(__assign({}, mathExpressions), typeExpressions), stringExpressions), lookupExpressions), decisionExpressions), interpolationExpressions);
function evaluate(expression, data) {
if (data === void 0) { data = {}; }
var name = expression[0], args = expression.slice(1);
var expressionFun = expressions[name];
if (expressionFun) {
return expressionFun(args.map(function (arg) { return function () { return (isExpression(arg) ? evaluate(arg, data) : arg); }; }), data);
}
throw new Error("Expression \"".concat(name, "\" is not supported."));
const expressions = __spreadValues$3(__spreadValues$3(__spreadValues$3(__spreadValues$3(__spreadValues$3(__spreadValues$3({}, mathExpressions), typeExpressions), stringExpressions), lookupExpressions), decisionExpressions), interpolationExpressions);
function evaluate(expression, data = {}) {
const [name, ...args] = expression;
const expressionFun = expressions[name];
if (expressionFun) {
return expressionFun(
args.map((arg) => () => isExpression(arg) ? evaluate(arg, data) : arg),
data
);
}
throw new Error(`Expression "${name}" is not supported.`);
}
var __defProp$2 = Object.defineProperty;
var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues$2 = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp$2.call(b, prop))
__defNormalProp$2(a, prop, b[prop]);
if (__getOwnPropSymbols$2)
for (var prop of __getOwnPropSymbols$2(b)) {
if (__propIsEnum$2.call(b, prop))
__defNormalProp$2(a, prop, b[prop]);
}
return a;
};
function createPropertyExpressionCb(expression) {
return function (feature) {
var properties = feature.properties;
if (properties) {
return evaluate(expression, properties);
}
return false;
};
return (feature) => {
const properties = feature.properties;
if (properties) {
return evaluate(expression, properties);
}
return false;
};
}
var excludeExpressionList = ['iconSize', 'iconAnchor'];
const excludeExpressionList = ["iconSize", "iconAnchor"];
function createExpressionCallback(paint) {
var withExpression = false;
var expressions = {};
for (var p in paint) {
if (excludeExpressionList.indexOf(p) === -1) {
var p_ = p;
var val = paint[p_];
if (isExpression(val)) {
withExpression = true;
expressions[p_] = createPropertyExpressionCb(val);
}
}
let withExpression = false;
const expressions = {};
for (const p in paint) {
if (excludeExpressionList.indexOf(p) === -1) {
const p_ = p;
const val = paint[p_];
if (isExpression(val)) {
withExpression = true;
expressions[p_] = createPropertyExpressionCb(val);
}
}
if (withExpression) {
return function (feature) {
var fromCb = {};
for (var p in expressions) {
fromCb[p] = expressions[p](feature);
}
return __assign(__assign({}, paint), fromCb);
};
}
return;
}
if (withExpression) {
return (feature) => {
const fromCb = {};
for (const p in expressions) {
fromCb[p] = expressions[p](feature);
}
return __spreadValues$2(__spreadValues$2({}, paint), fromCb);
};
}
return;
}
var __defProp$1 = Object.defineProperty;
var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues$1 = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp$1.call(b, prop))
__defNormalProp$1(a, prop, b[prop]);
if (__getOwnPropSymbols$1)
for (var prop of __getOwnPropSymbols$1(b)) {
if (__propIsEnum$1.call(b, prop))
__defNormalProp$1(a, prop, b[prop]);
}
return a;
};
function reEscape(s) {
return s.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&');
return s.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
}
function like(b, a, iLike) {
a = String(a);
b = String(b);
if (a === b)
return true;
if (iLike && a.toUpperCase() === b.toUpperCase())
return true;
var re = "^".concat(reEscape(a), "$").replace(/%/g, '.*').replace('_', '.');
return new RegExp(re, iLike ? 'i' : '').exec(b) !== null;
a = String(a);
b = String(b);
if (a === b)
return true;
if (iLike && a.toUpperCase() === b.toUpperCase())
return true;
const re = `^${reEscape(a)}$`.replace(/%/g, ".*").replace("_", ".");
return new RegExp(re, iLike ? "i" : "").exec(b) !== null;
}
var operationsAliases = {
// greater(>)
gt: function (a, b) { return a > b; },
// lower(<)
lt: function (a, b) { return a < b; },
// greater or equal(>=)
ge: function (a, b) { return a >= b; },
// lower or equal(<=)
le: function (a, b) { return a <= b; },
// equal(=)
eq: function (a, b) { return a === b; },
// not equal(!=)
ne: function (a, b) { return a !== b; },
in: function (a, b) { return b.indexOf(a) !== -1; },
notin: function (a, b) { return b.indexOf(a) === -1; },
// LIKE SQL statement(for strings compare)
like: function (a, b) {
return like(a, b);
},
// ILIKE SQL statement(for strings compare)
ilike: function (a, b) {
return like(a, b, true);
},
const operationsAliases = {
// greater(>)
gt: (a, b) => a > b,
// lower(<)
lt: (a, b) => a < b,
// greater or equal(>=)
ge: (a, b) => a >= b,
// lower or equal(<=)
le: (a, b) => a <= b,
// equal(=)
eq: (a, b) => a === b,
// not equal(!=)
ne: (a, b) => a !== b,
in: (a, b) => b.indexOf(a) !== -1,
notin: (a, b) => b.indexOf(a) === -1,
// LIKE SQL statement(for strings compare)
like: (a, b) => {
return like(a, b);
},
// ILIKE SQL statement(for strings compare)
ilike: (a, b) => {
return like(a, b, true);
}
};
function isPropertyFilter(filter) {
var pf = filter;
if (pf.length === 3 &&
typeof pf[0] === 'string' &&
typeof pf[1] === 'string') {
return true;
}
return false;
const pf = filter;
if (pf.length === 3 && typeof pf[0] === "string" && typeof pf[1] === "string") {
return true;
}
return false;
}
function featureFilter(feature, filters) {
var properties = __assign({}, feature.properties);
if (properties) {
// workaround to filter by feature id
properties.$id = feature.id;
return propertiesFilter(properties, filters);
}
return false;
const properties = __spreadValues$1({}, feature.properties);
if (properties) {
properties.$id = feature.id;
return propertiesFilter(properties, filters);
}
return false;
}
function propertiesFilter(properties, filters) {
var logic = typeof filters[0] === 'string' ? filters[0] : 'all';
var filterFunction = function (p) {
if (isPropertyFilter(p)) {
var field_1 = p[0], operation = p[1], value_1 = p[2];
var operationExec = operationsAliases[operation];
if (operationExec) {
if (operation === 'like' || operation === 'ilike') {
if (typeof field_1 === 'string') {
var prop_1 = '';
var value_ = field_1.replace(/^%?(\w+)%?$/, function (match, cleanField) {
prop_1 = properties[cleanField];
return field_1.replace(cleanField, value_1);
});
return operationExec(prop_1, value_);
}
}
return operationExec(properties[field_1], value_1);
}
return false;
const logic = typeof filters[0] === "string" ? filters[0] : "all";
const filterFunction = (p) => {
if (isPropertyFilter(p)) {
const [field, operation, value] = p;
const operationExec = operationsAliases[operation];
if (operationExec) {
if (operation === "like" || operation === "ilike") {
if (typeof field === "string") {
let prop = "";
const value_ = field.replace(/^%?(\w+)%?$/, (match, cleanField) => {
prop = properties[cleanField];
return field.replace(cleanField, value);
});
return operationExec(prop, value_);
}
}
else {
return propertiesFilter(properties, p);
}
};
var filters_ = filters.filter(function (x) { return Array.isArray(x); });
return logic === 'any'
? filters_.some(filterFunction)
: filters_.every(filterFunction);
return operationExec(properties[field], value);
}
return false;
} else {
return propertiesFilter(properties, p);
}
};
const filters_ = filters.filter((x) => Array.isArray(x));
return logic === "any" ? filters_.some(filterFunction) : filters_.every(filterFunction);
}
var __defProp = Object.defineProperty;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
function updatePaintOptionFromCallback(paint, getPaintFunctions) {
if (typeof paint.from === 'function') {
return paint.from(paint.options);
if (typeof paint.from === "function") {
return paint.from(paint.options);
} else if (typeof paint.from === "string" && getPaintFunctions) {
const from = getPaintFunctions[paint.from];
if (from) {
return from(paint.options);
}
else if (typeof paint.from === 'string' && getPaintFunctions) {
var from = getPaintFunctions[paint.from];
if (from) {
return from(paint.options);
}
}
}
}
function createPropertiesPaint(propertiesPaint) {
var mask = {};
var paintsFilters = [];
for (var _i = 0, propertiesPaint_1 = propertiesPaint; _i < propertiesPaint_1.length; _i++) {
var p = propertiesPaint_1[_i];
if (p) {
if (Array.isArray(p)) {
paintsFilters.push(p);
}
else {
mask = p;
}
}
let mask = {};
const paintsFilters = [];
for (const p of propertiesPaint) {
if (p) {
if (Array.isArray(p)) {
paintsFilters.push(p);
} else {
mask = p;
}
}
return function (feature) {
var paint = paintsFilters.find(function (x) { return featureFilter(feature, x[0]); });
if (paint) {
return __assign(__assign({}, mask), paint[1]);
}
return mask;
}
return (feature) => {
const paint = paintsFilters.find((x) => featureFilter(feature, x[0]));
if (paint) {
return __spreadValues(__spreadValues({}, mask), paint[1]);
}
return mask;
};
}
function expressionCallback({
paint,
defaultPaint
}) {
const expressionCallback2 = createExpressionCallback(paint);
if (expressionCallback2) {
const expressionPaintCb = (feature) => {
return preparePaint({
paint: expressionCallback2(feature),
defaultPaint
});
};
expressionPaintCb.paint = finalizePaint({ paint, defaultPaint });
return expressionPaintCb;
}
return finalizePaint({ paint, defaultPaint });
}
function expressionCallback(_a) {
var paint = _a.paint, defaultPaint = _a.defaultPaint;
var expressionCallback = createExpressionCallback(paint);
if (expressionCallback) {
var expressionPaintCb = function (feature) {
return preparePaint({
paint: expressionCallback(feature),
defaultPaint: defaultPaint,
});
};
expressionPaintCb.paint = finalizePaint({ paint: paint, defaultPaint: defaultPaint });
return expressionPaintCb;
function finalizePaint({ paint, defaultPaint }) {
var _a;
let newPaint = __spreadValues({}, defaultPaint);
newPaint = __spreadValues(__spreadValues({}, newPaint), paint);
newPaint.fill = (_a = newPaint.fill) != null ? _a : true;
newPaint.stroke = newPaint.stroke !== void 0 ? newPaint.stroke : !newPaint.fill || !!(newPaint.strokeColor || newPaint.strokeOpacity);
return newPaint;
}
function preparePaint({
paint,
defaultPaint,
getPaintFunctions
}) {
if (!paint) {
throw new Error("paint is empty");
}
let newPaint = __spreadValues({}, defaultPaint);
if (isPaintCallback(paint)) {
const getPaintFunction = (feature) => {
const getPaint = preparePaint({
paint: paint(feature),
defaultPaint,
getPaintFunctions
});
getPaint.type = paint.type;
return getPaint;
};
getPaintFunction.type = paint.type;
return getPaintFunction;
} else if (isPropertiesPaint(paint)) {
return (feature) => {
return preparePaint({
paint: createPropertiesPaint(paint)(feature),
defaultPaint,
getPaintFunctions
});
};
} else if (paint.type === "get-paint") {
const getPaint = updatePaintOptionFromCallback(paint, getPaintFunctions);
if (getPaint) {
newPaint = preparePaint({
paint: getPaint,
defaultPaint,
getPaintFunctions
});
}
return finalizePaint({ paint: paint, defaultPaint: defaultPaint });
}
function finalizePaint(_a) {
var _b;
var paint = _a.paint, defaultPaint = _a.defaultPaint;
var newPaint = __assign({}, defaultPaint);
newPaint = __assign(__assign({}, newPaint), paint);
newPaint.fill = (_b = newPaint.fill) !== null && _b !== void 0 ? _b : true;
newPaint.stroke =
newPaint.stroke !== undefined
? newPaint.stroke
: !newPaint.fill || !!(newPaint.strokeColor || newPaint.strokeOpacity);
} else if (paint.type === "icon") {
return paint;
} else {
newPaint = expressionCallback({ paint, defaultPaint });
}
if (isPaintCallback(newPaint)) {
return newPaint;
}
function preparePaint(_a) {
var paint = _a.paint, defaultPaint = _a.defaultPaint, getPaintFunctions = _a.getPaintFunctions;
if (!paint) {
throw new Error('paint is empty');
}
if ("color" in newPaint) {
if (!newPaint.strokeColor) {
newPaint.strokeColor = newPaint.color;
}
var newPaint = __assign({}, defaultPaint);
if (isPaintCallback(paint)) {
var getPaintFunction = function (feature) {
var getPaint = preparePaint({
paint: paint(feature),
defaultPaint: defaultPaint,
getPaintFunctions: getPaintFunctions,
});
getPaint.type = paint.type;
return getPaint;
};
getPaintFunction.type = paint.type;
return getPaintFunction;
if (!newPaint.fillColor) {
newPaint.fillColor = newPaint.color;
}
else if (isPropertiesPaint(paint)) {
return function (feature) {
return preparePaint({
paint: createPropertiesPaint(paint)(feature),
defaultPaint: defaultPaint,
getPaintFunctions: getPaintFunctions,
});
};
}
if ("opacity" in newPaint) {
if (newPaint.strokeOpacity === void 0) {
newPaint.strokeOpacity = newPaint.opacity;
}
else if (paint.type === 'get-paint') {
var getPaint = updatePaintOptionFromCallback(paint, getPaintFunctions);
if (getPaint) {
newPaint = preparePaint({
paint: getPaint,
defaultPaint: defaultPaint,
getPaintFunctions: getPaintFunctions,
});
}
if (newPaint.fillOpacity === void 0) {
newPaint.fillOpacity = newPaint.opacity;
}
else if (paint.type === 'icon') {
return paint;
}
else {
newPaint = expressionCallback({ paint: paint, defaultPaint: defaultPaint });
}
if (isPaintCallback(newPaint)) {
return newPaint;
}
if ('color' in newPaint) {
if (!newPaint.strokeColor) {
newPaint.strokeColor = newPaint.color;
}
if (!newPaint.fillColor) {
newPaint.fillColor = newPaint.color;
}
}
if ('opacity' in newPaint) {
if (newPaint.strokeOpacity === undefined) {
newPaint.strokeOpacity = newPaint.opacity;
}
if (newPaint.fillOpacity === undefined) {
newPaint.fillOpacity = newPaint.opacity;
}
}
return newPaint;
}
return newPaint;
}

@@ -1001,4 +987,2 @@

Object.defineProperty(exports, '__esModule', { value: true });
return exports;

@@ -1005,0 +989,0 @@

@@ -1,2 +0,2 @@

var Paint=function(r){"use strict";function n(r){return!!Array.isArray(r)}function e(r){return"[object Object]"===Object.prototype.toString.call(r)}function t(r){return"function"==typeof r}var i=function(){return i=Object.assign||function(r){for(var n,e=1,t=arguments.length;e<t;e++)for(var i in n=arguments[e])Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i]);return r},i.apply(this,arguments)};function a(r){return function(n,e){var t=n.map((function(r){return r()}));return r(t,e)}}"function"==typeof SuppressedError&&SuppressedError;var o={"!":a((function(r){return!r[0]})),"!=":a((function(r){return r[0]!==r[1]})),"<":a((function(r){return r[0]<r[1]})),"<=":a((function(r){return r[0]<=r[1]})),"==":a((function(r){return r[0]===r[1]})),">":a((function(r){return r[0]>r[1]})),">=":a((function(r){return r[0]>=r[1]})),coalesce:function(r){for(var n=0;n<r.length;n++){var e=r[n]();if(null!=e)return e}return null},all:function(r){for(var n=0;n<r.length;n++){if(!r[n]())return!1}return!0},any:function(r){for(var n=0;n<r.length;n++){if(r[n]())return!0}return!1},case:function(r){if(r.length<2)throw new Error('The "case" function requires at least a condition and a corresponding output.');if(r.length%2==0)throw new Error("Missing a fallback value or unmatched condition-output pair.");for(var n=0;n<r.length-1;n+=2){var e=r[n](),t=r[n+1]();if(e)return t}return(0,r[r.length-1])()},match:function(r){for(var n=r[0],e=r.slice(1),t=n(),i=e.splice(-1,e.length%2)[0],a=0;a<e.length-1;a+=2){if(e[a]()===t)return e[a+1]()}return i()}},f={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4","indianred ":"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};function u(r){if("string"==typeof(a=r)&&/^#([A-Fa-f0-9]{3}){1,2}$/.test(a))return c(r);if("string"==typeof(i=r)&&i in f)return function(r){return c(f[r])}(r);if(function(r){return"string"==typeof r&&/^rgb(a?)\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)(?:\s*,\s*([01](?:\.\d+)?))?\s*\)$/.test(r)}(r))return function(r){var n,e=/^rgba\((\d+),\s*(\d+),\s*(\d+),\s*([\d.]+)\)$/;if(n=r.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/))return[parseInt(n[1],10),parseInt(n[2],10),parseInt(n[3],10)];if(n=r.match(e))return[parseInt(n[1],10),parseInt(n[2],10),parseInt(n[3],10),parseFloat(n[4])];throw new Error("The '".concat(r,"' Is not valid rgb"))}(r);if("object"==typeof(t=r)&&null!==t&&"r"in t&&"g"in t&&"b"in t&&(!("a"in t)||"number"==typeof t.a&&t.a>=0&&t.a<=1))return function(r,n,e){if(e||2===arguments.length)for(var t,i=0,a=n.length;i<a;i++)!t&&i in n||(t||(t=Array.prototype.slice.call(n,0,i)),t[i]=n[i]);return r.concat(t||Array.prototype.slice.call(n))}([(n=r).r,n.g,n.b],void 0!==(e=n.a)?[e]:[],!0);var n,e,t,i,a;throw new Error("The '".concat(r,"' cannot be converted to color"))}function c(r){var n;if(n=/^#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])$/.exec(r))return[parseInt(n[1]+n[1],16),parseInt(n[2]+n[2],16),parseInt(n[3]+n[3],16)];if(n=/^#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])$/.exec(r))return[parseInt(n[1]+n[1],16),parseInt(n[2]+n[2],16),parseInt(n[3]+n[3],16),parseInt(n[4]+n[4],16)/255];if(n=/^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/.exec(r))return[parseInt(n[1],16),parseInt(n[2],16),parseInt(n[3],16)];if(n=/^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/.exec(r))return[parseInt(n[1],16),parseInt(n[2],16),parseInt(n[3],16),parseInt(n[4],16)/255];throw new Error("The '".concat(r,"' Is not valid hex"))}function l(r,n,e,t,i){if("number"==typeof e&&"number"==typeof i)return e+(r-n)/(t-n)*(i-e);try{var a=u(e),o=u(i);return function(r){return"rgb(".concat(r.join(","),")")}(a.map((function(e,i){return Math.ceil(l(r,n,e,t,o[i]))})))}catch(f){console.log(f)}throw new Error("Unsupported output type for linear interpolation.")}var s={step:function(r){var n=r[0],e=r[1],t=r.slice(2),i=n();if("number"!=typeof i)return e();for(var a=0;a<t.length-2;a+=2){var o=t[a](),f=t[a+1](),u=t[a+2]();if(i>=o&&i<u)return f}return i>=t[t.length-2]()?t[t.length-1]():e()},interpolate:function(r){var n=r[0],e=r[1],t=r.slice(2);if(t.length<2)throw new Error("At least two stops are required");if(t.length<2||t.length%2!=0)throw new Error("Invalid stops provided.");var i=e();if("number"!=typeof i)throw new Error("Input must be a number.");for(var a=n(),o=0;o<t.length-2;o+=2){var f=t[o](),u=t[o+1](),c=t[o+2](),s=t[o+3]();if(i>=f&&i<=c&&"linear"===a[0])return l(i,f,u,c,s)}throw new Error("Invalid interpolation type.")}};var d={get:a((function(r,n){var e=r[0],t=r[1]||n;return t&&"object"==typeof t&&e in t?t[e]:null})),length:a((function(r){var n=r[0];if("string"==typeof n||Array.isArray(n))return n.length})),at:a((function(r){return r[1][r[0]]})),has:a((function(r,n){var e=r[1]||n;return!(!e||"object"!=typeof e||!(r[0]in e))})),in:a((function(r){var n=r[0],e=r[1];if("string"==typeof e)return e.includes(String(n));if(Array.isArray(e))return e.includes(n);throw new Error("Invalid input type for 'in'. Expected string or array, got ".concat(typeof e,"."))})),"index-of":a((function(r){var n=r[0],e=r[1],t=r[2];if("string"==typeof e)return e.indexOf(String(n),t);if(Array.isArray(e))return e.indexOf(n,t);throw new Error("Invalid input type for 'index-of'. Expected string or array, got ".concat(typeof e,"."))})),slice:a((function(r){var n=r[0],e=r[1],t=r[2];if("string"==typeof n)return n.slice(e,t);if(Array.isArray(n))return n.slice(e,t);throw new Error("Invalid input type for 'slice'. Expected string or array, got ".concat(typeof n,"."))}))},p={"+":a((function(r){return r.reduce((function(r,n){return r+n}),0)})),"-":a((function(r){return r.reduce((function(r,n){return r-n}))})),"*":a((function(r){return r.reduce((function(r,n){return r*n}),1)})),"/":a((function(r){return r.reduce((function(r,n){return r/n}))})),"%":a((function(r){return r[0]%r[1]})),"^":a((function(r){return Math.pow(r[0],r[1])})),abs:a((function(r){return Math.abs(r[0])})),acos:a((function(r){return Math.acos(r[0])})),asin:a((function(r){return Math.asin(r[0])})),atan:a((function(r){return Math.atan(r[0])})),ceil:a((function(r){return Math.ceil(r[0])})),cos:a((function(r){return Math.cos(r[0])})),e:function(){return Math.E},floor:a((function(r){return Math.floor(r[0])})),ln:a((function(r){return Math.log(r[0])})),ln2:function(){return Math.LN2},log10:a((function(r){return Math.log10(r[0])})),log2:a((function(r){return Math.log2(r[0])})),max:a((function(r){return Math.max.apply(Math,r)})),min:a((function(r){return Math.min.apply(Math,r)})),pi:function(){return Math.PI},round:a((function(r){return Math.round(r[0])})),sin:a((function(r){return Math.sin(r[0])})),sqrt:a((function(r){return Math.sqrt(r[0])})),tan:a((function(r){return Math.tan(r[0])}))},g={concat:a((function(r){return r.reduce((function(r,n){return String(r)+String(n)}),"")})),downcase:a((function(r){return String(r[0]).toLowerCase()})),upcase:a((function(r){return String(r[0]).toUpperCase()}))},y=function(r,n,e){try{var t=r(n,e);if(void 0!==t)return t}catch(i){}};function b(r){return function(n,e){for(var t=0,i=n;t<i.length;t++){var a=y(r,i[t],e);if(void 0!==a)return a}throw new Error("Received a mismatched type")}}var h={array:a((function(r){var n,e=r[0],t=r[1],i=r[2],a=void 0,o=void 0;if("string"==typeof e&&["string","number","boolean"].includes(e)?(a=e,"number"==typeof t?(o=t,n=i):n=t):Array.isArray(e)&&(n=e),!Array.isArray(n))throw new Error("Expected an array");if(a&&!n.every((function(r){return typeof r===a})))throw new Error("Expected all items in array to be of type ".concat(a));if(o&&n.length!==o)throw new Error("Expected array of length ".concat(o));return n})),boolean:a(b((function(r){return"boolean"==typeof r?r:void 0}))),literal:a((function(r){return r[0]})),number:a(b((function(r){return"number"==typeof r?r:void 0}))),object:a(b((function(r){return null===r||"object"!=typeof r||Array.isArray(r)?void 0:r}))),string:a(b((function(r){return"string"==typeof r?r:void 0}))),"to-boolean":a(b(Boolean)),"to-number":a(b(Number)),"to-string":a(b(String)),typeof:a((function(r){return function(r){if(null===r)return"null";switch(typeof r){case"string":return"string";case"number":return"number";case"boolean":return"boolean";case"object":if(Array.isArray(r)){var n="value";return r.every((function(r){return"number"==typeof r}))?n="number":r.every((function(r){return"string"==typeof r}))?n="string":r.every((function(r){return"boolean"==typeof r}))&&(n="boolean"),"array<".concat(n,", ").concat(r.length,">")}return"object";default:return"undefined"}}(r[0])}))};function v(r){if(Array.isArray(r)){var n=r[0],e=r.slice(1);return"string"==typeof n&&"literal"!==n&&n in m&&e.length>0}return!1}var m=i(i(i(i(i(i({},p),h),g),d),o),s);function w(r,n){void 0===n&&(n={});var e=r[0],t=r.slice(1),i=m[e];if(i)return i(t.map((function(r){return function(){return v(r)?w(r,n):r}})),n);throw new Error('Expression "'.concat(e,'" is not supported.'))}function k(r){return function(n){var e=n.properties;return!!e&&w(r,e)}}var A=["iconSize","iconAnchor"];function E(r){var n=!1,e={};for(var t in r)if(-1===A.indexOf(t)){var a=t,o=r[a];v(o)&&(n=!0,e[a]=k(o))}if(n)return function(n){var t={};for(var a in e)t[a]=e[a](n);return i(i({},r),t)}}function I(r,n,e){if((n=String(n))===(r=String(r)))return!0;if(e&&n.toUpperCase()===r.toUpperCase())return!0;var t,i="^".concat((t=n,t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")),"$").replace(/%/g,".*").replace("_",".");return null!==new RegExp(i,e?"i":"").exec(r)}var M={gt:function(r,n){return r>n},lt:function(r,n){return r<n},ge:function(r,n){return r>=n},le:function(r,n){return r<=n},eq:function(r,n){return r===n},ne:function(r,n){return r!==n},in:function(r,n){return-1!==n.indexOf(r)},notin:function(r,n){return-1===n.indexOf(r)},like:function(r,n){return I(r,n)},ilike:function(r,n){return I(r,n,!0)}};function x(r,n){var e=i({},r.properties);return!!e&&(e.$id=r.id,P(e,n))}function P(r,n){var e="string"==typeof n[0]?n[0]:"all",t=function(n){if(3===(u=n).length&&"string"==typeof u[0]&&"string"==typeof u[1]){var e=n[0],t=n[1],i=n[2],a=M[t];if(a){if(("like"===t||"ilike"===t)&&"string"==typeof e){var o="",f=e.replace(/^%?(\w+)%?$/,(function(n,t){return o=r[t],e.replace(t,i)}));return a(o,f)}return a(r[e],i)}return!1}return P(r,n);var u},i=n.filter((function(r){return Array.isArray(r)}));return"any"===e?i.some(t):i.every(t)}function F(r){for(var n={},e=[],t=0,a=r;t<a.length;t++){var o=a[t];o&&(Array.isArray(o)?e.push(o):n=o)}return function(r){var t=e.find((function(n){return x(r,n[0])}));return t?i(i({},n),t[1]):n}}function O(r){var n,e=r.paint,t=i({},r.defaultPaint);return(t=i(i({},t),e)).fill=null===(n=t.fill)||void 0===n||n,t.stroke=void 0!==t.stroke?t.stroke:!t.fill||!(!t.strokeColor&&!t.strokeOpacity),t}function j(r){var e=r.paint,a=r.defaultPaint,o=r.getPaintFunctions;if(!e)throw new Error("paint is empty");var f=i({},a);if(t(e)){var u=function(r){var n=j({paint:e(r),defaultPaint:a,getPaintFunctions:o});return n.type=e.type,n};return u.type=e.type,u}if(n(e))return function(r){return j({paint:F(e)(r),defaultPaint:a,getPaintFunctions:o})};if("get-paint"===e.type){var c=function(r,n){if("function"==typeof r.from)return r.from(r.options);if("string"==typeof r.from&&n){var e=n[r.from];if(e)return e(r.options)}}(e,o);c&&(f=j({paint:c,defaultPaint:a,getPaintFunctions:o}))}else{if("icon"===e.type)return e;f=function(r){var n=r.paint,e=r.defaultPaint,t=E(n);if(t){var i=function(r){return j({paint:t(r),defaultPaint:e})};return i.paint=O({paint:n,defaultPaint:e}),i}return O({paint:n,defaultPaint:e})}({paint:e,defaultPaint:a})}return t(f)||("color"in f&&(f.strokeColor||(f.strokeColor=f.color),f.fillColor||(f.fillColor=f.color)),"opacity"in f&&(void 0===f.strokeOpacity&&(f.strokeOpacity=f.opacity),void 0===f.fillOpacity&&(f.fillOpacity=f.opacity))),f}return r.createExpressionCallback=E,r.isBasePaint=function(r){return!!e(r)&&("get-paint"!==r.type&&"icon"!==r.type)},r.isIcon=function(r){return"icon"===r.type||"html"in r},r.isPaint=e,r.isPaintCallback=t,r.isPropertiesPaint=n,r.preparePaint=j,Object.defineProperty(r,"__esModule",{value:!0}),r}({});
var Paint=function(e){"use strict";function r(e){return!!Array.isArray(e)}function t(e){return"[object Object]"===Object.prototype.toString.call(e)}function n(e){return"function"==typeof e}function o(e){return(r,t)=>{const n=r.map((e=>e()));return e(n,t)}}const a={"!":o((function([e]){return!e})),"!=":o((function([e,r]){return e!==r})),"<":o((function([e,r]){return e<r})),"<=":o((function([e,r]){return e<=r})),"==":o((function([e,r]){return e===r})),">":o((function([e,r]){return e>r})),">=":o((function([e,r]){return e>=r})),coalesce:e=>{for(let r=0;r<e.length;r++){const t=e[r]();if(null!=t)return t}return null},all:e=>{for(let r=0;r<e.length;r++){if(!e[r]())return!1}return!0},any:e=>{for(let r=0;r<e.length;r++){if(e[r]())return!0}return!1},case:e=>{if(e.length<2)throw new Error('The "case" function requires at least a condition and a corresponding output.');if(e.length%2==0)throw new Error("Missing a fallback value or unmatched condition-output pair.");for(let r=0;r<e.length-1;r+=2){const t=e[r](),n=e[r+1]();if(t)return n}return(0,e[e.length-1])()},match:e=>{const[r,...t]=e,n=r(),o=t.splice(-1,t.length%2)[0];for(let a=0;a<t.length-1;a+=2){if(t[a]()===n)return t[a+1]()}return o()}},i={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4","indianred ":"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};function f(e){if("string"==typeof(t=e)&&/^#([A-Fa-f0-9]{3}){1,2}$/.test(t))return l(e);if("string"==typeof(r=e)&&r in i)return function(e){return l(i[e])}(e);if(function(e){return"string"==typeof e&&/^rgb(a?)\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)(?:\s*,\s*([01](?:\.\d+)?))?\s*\)$/.test(e)}(e))return function(e){const r=/^rgba\((\d+),\s*(\d+),\s*(\d+),\s*([\d.]+)\)$/;let t;if(t=e.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/))return[parseInt(t[1],10),parseInt(t[2],10),parseInt(t[3],10)];if(t=e.match(r))return[parseInt(t[1],10),parseInt(t[2],10),parseInt(t[3],10),parseFloat(t[4])];throw new Error(`The '${e}' Is not valid rgb`)}(e);if(function(e){if("object"==typeof e&&null!==e)return"r"in e&&"g"in e&&"b"in e&&(!("a"in e)||"number"==typeof e.a&&e.a>=0&&e.a<=1);return!1}(e))return function({r:e,g:r,b:t,a:n}){return[e,r,t,...void 0!==n?[n]:[]]}(e);var r,t;throw new Error(`The '${e}' cannot be converted to color`)}function l(e){let r;if(r=/^#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])$/.exec(e))return[parseInt(r[1]+r[1],16),parseInt(r[2]+r[2],16),parseInt(r[3]+r[3],16)];if(r=/^#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])$/.exec(e))return[parseInt(r[1]+r[1],16),parseInt(r[2]+r[2],16),parseInt(r[3]+r[3],16),parseInt(r[4]+r[4],16)/255];if(r=/^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/.exec(e))return[parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16)];if(r=/^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/.exec(e))return[parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16),parseInt(r[4],16)/255];throw new Error(`The '${e}' Is not valid hex`)}function c(e,r,t,n,o){if("number"==typeof t&&"number"==typeof o)return t+(e-r)/(n-r)*(o-t);try{const a=f(t),i=f(o);return function(e){return`rgb(${e.join(",")})`}(a.map(((t,o)=>Math.ceil(c(e,r,t,n,i[o])))))}catch(a){console.log(a)}throw new Error("Unsupported output type for linear interpolation.")}const u={step:e=>{const[r,t,...n]=e,o=r();if("number"!=typeof o)return t();for(let a=0;a<n.length-2;a+=2){const e=n[a](),r=n[a+1](),t=n[a+2]();if(o>=e&&o<t)return r}return o>=n[n.length-2]()?n[n.length-1]():t()},interpolate:([e,r,...t])=>{if(t.length<2)throw new Error("At least two stops are required");if(t.length<2||t.length%2!=0)throw new Error("Invalid stops provided.");const n=r();if("number"!=typeof n)throw new Error("Input must be a number.");const o=e();for(let a=0;a<t.length-2;a+=2){const e=t[a](),r=t[a+1](),i=t[a+2](),f=t[a+3]();if(n>=e&&n<=i&&"linear"===o[0])return c(n,e,r,i,f)}throw new Error("Invalid interpolation type.")}};const s={get:o((function([e,r],t){const n=r||t;return n&&"object"==typeof n&&e in n?n[e]:null})),length:o((([e])=>{if("string"==typeof e||Array.isArray(e))return e.length})),at:o((function([e,r]){return r[e]})),has:o((function([e,r],t){const n=r||t;return!(!n||"object"!=typeof n||!(e in n))})),in:o((function([e,r]){if("string"==typeof r)return r.includes(String(e));if(Array.isArray(r))return r.includes(e);throw new Error(`Invalid input type for 'in'. Expected string or array, got ${typeof r}.`)})),"index-of":o((function([e,r,t]){if("string"==typeof r)return r.indexOf(String(e),t);if(Array.isArray(r))return r.indexOf(e,t);throw new Error(`Invalid input type for 'index-of'. Expected string or array, got ${typeof r}.`)})),slice:o((function(e){const[r,t,n]=e;if("string"==typeof r)return r.slice(t,n);if(Array.isArray(r))return r.slice(t,n);throw new Error(`Invalid input type for 'slice'. Expected string or array, got ${typeof r}.`)}))},p={"+":o((e=>e.reduce(((e,r)=>e+r),0))),"-":o((e=>e.reduce(((e,r)=>e-r)))),"*":o((e=>e.reduce(((e,r)=>e*r),1))),"/":o((e=>e.reduce(((e,r)=>e/r)))),"%":o((e=>e[0]%e[1])),"^":o((e=>Math.pow(e[0],e[1]))),abs:o((e=>Math.abs(e[0]))),acos:o((e=>Math.acos(e[0]))),asin:o((e=>Math.asin(e[0]))),atan:o((e=>Math.atan(e[0]))),ceil:o((e=>Math.ceil(e[0]))),cos:o((e=>Math.cos(e[0]))),e:()=>Math.E,floor:o((e=>Math.floor(e[0]))),ln:o((e=>Math.log(e[0]))),ln2:()=>Math.LN2,log10:o((e=>Math.log10(e[0]))),log2:o((e=>Math.log2(e[0]))),max:o((e=>Math.max(...e))),min:o((e=>Math.min(...e))),pi:()=>Math.PI,round:o((e=>Math.round(e[0]))),sin:o((e=>Math.sin(e[0]))),sqrt:o((e=>Math.sqrt(e[0]))),tan:o((e=>Math.tan(e[0])))},d={concat:o((e=>e.reduce(((e,r)=>String(e)+String(r)),""))),downcase:o((e=>String(e[0]).toLowerCase())),upcase:o((e=>String(e[0]).toUpperCase()))},b=(e,r,t)=>{try{const n=e(r,t);if(void 0!==n)return n}catch(n){}};function y(e){return(r,t)=>{for(const n of r){const r=b(e,n,t);if(void 0!==r)return r}throw new Error("Received a mismatched type")}}const g={array:o((e=>{const[r,t,n]=e;let o,a,i;if("string"==typeof r&&["string","number","boolean"].includes(r)?(o=r,"number"==typeof t?(a=t,i=n):i=t):Array.isArray(r)&&(i=r),!Array.isArray(i))throw new Error("Expected an array");if(o&&!i.every((e=>typeof e===o)))throw new Error(`Expected all items in array to be of type ${o}`);if(a&&i.length!==a)throw new Error(`Expected array of length ${a}`);return i})),boolean:o(y((e=>"boolean"==typeof e?e:void 0))),literal:o((([e])=>e)),number:o(y((e=>"number"==typeof e?e:void 0))),object:o(y((e=>null===e||"object"!=typeof e||Array.isArray(e)?void 0:e))),string:o(y((e=>"string"==typeof e?e:void 0))),"to-boolean":o(y(Boolean)),"to-number":o(y(Number)),"to-string":o(y(String)),typeof:o((([e])=>function(e){if(null===e)return"null";switch(typeof e){case"string":return"string";case"number":return"number";case"boolean":return"boolean";case"object":if(Array.isArray(e)){let r="value";return e.every((e=>"number"==typeof e))?r="number":e.every((e=>"string"==typeof e))?r="string":e.every((e=>"boolean"==typeof e))&&(r="boolean"),`array<${r}, ${e.length}>`}return"object";default:return"undefined"}}(e)))};var h=Object.defineProperty,m=Object.getOwnPropertySymbols,w=Object.prototype.hasOwnProperty,v=Object.prototype.propertyIsEnumerable,k=(e,r,t)=>r in e?h(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,A=(e,r)=>{for(var t in r||(r={}))w.call(r,t)&&k(e,t,r[t]);if(m)for(var t of m(r))v.call(r,t)&&k(e,t,r[t]);return e};function O(e){if(Array.isArray(e)){const[r,...t]=e;return"string"==typeof r&&"literal"!==r&&r in I&&t.length>0}return!1}const I=A(A(A(A(A(A({},p),g),d),s),a),u);function P(e,r={}){const[t,...n]=e,o=I[t];if(o)return o(n.map((e=>()=>O(e)?P(e,r):e)),r);throw new Error(`Expression "${t}" is not supported.`)}var E=Object.defineProperty,j=Object.getOwnPropertySymbols,$=Object.prototype.hasOwnProperty,x=Object.prototype.propertyIsEnumerable,M=(e,r,t)=>r in e?E(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,F=(e,r)=>{for(var t in r||(r={}))$.call(r,t)&&M(e,t,r[t]);if(j)for(var t of j(r))x.call(r,t)&&M(e,t,r[t]);return e};function S(e){return r=>{const t=r.properties;return!!t&&P(e,t)}}const q=["iconSize","iconAnchor"];function C(e){let r=!1;const t={};for(const n in e)if(-1===q.indexOf(n)){const o=n,a=e[o];O(a)&&(r=!0,t[o]=S(a))}if(r)return r=>{const n={};for(const e in t)n[e]=t[e](r);return F(F({},e),n)}}var T=Object.defineProperty,U=Object.getOwnPropertySymbols,z=Object.prototype.hasOwnProperty,B=Object.prototype.propertyIsEnumerable,L=(e,r,t)=>r in e?T(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,N=(e,r)=>{for(var t in r||(r={}))z.call(r,t)&&L(e,t,r[t]);if(U)for(var t of U(r))B.call(r,t)&&L(e,t,r[t]);return e};function R(e,r,t){if((r=String(r))===(e=String(e)))return!0;if(t&&r.toUpperCase()===e.toUpperCase())return!0;const n=`^${o=r,o.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}$`.replace(/%/g,".*").replace("_",".");var o;return null!==new RegExp(n,t?"i":"").exec(e)}const _={gt:(e,r)=>e>r,lt:(e,r)=>e<r,ge:(e,r)=>e>=r,le:(e,r)=>e<=r,eq:(e,r)=>e===r,ne:(e,r)=>e!==r,in:(e,r)=>-1!==r.indexOf(e),notin:(e,r)=>-1===r.indexOf(e),like:(e,r)=>R(e,r),ilike:(e,r)=>R(e,r,!0)};function D(e,r){const t=N({},e.properties);return!!t&&(t.$id=e.id,G(t,r))}function G(e,r){const t="string"==typeof r[0]?r[0]:"all",n=r=>{if(3===(t=r).length&&"string"==typeof t[0]&&"string"==typeof t[1]){const[t,n,o]=r,a=_[n];if(a){if(("like"===n||"ilike"===n)&&"string"==typeof t){let r="";const n=t.replace(/^%?(\w+)%?$/,((n,a)=>(r=e[a],t.replace(a,o))));return a(r,n)}return a(e[t],o)}return!1}return G(e,r);var t},o=r.filter((e=>Array.isArray(e)));return"any"===t?o.some(n):o.every(n)}var H=Object.defineProperty,J=Object.getOwnPropertySymbols,K=Object.prototype.hasOwnProperty,Q=Object.prototype.propertyIsEnumerable,V=(e,r,t)=>r in e?H(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,W=(e,r)=>{for(var t in r||(r={}))K.call(r,t)&&V(e,t,r[t]);if(J)for(var t of J(r))Q.call(r,t)&&V(e,t,r[t]);return e};function X(e){let r={};const t=[];for(const n of e)n&&(Array.isArray(n)?t.push(n):r=n);return e=>{const n=t.find((r=>D(e,r[0])));return n?W(W({},r),n[1]):r}}function Y({paint:e,defaultPaint:r}){var t;let n=W({},r);return n=W(W({},n),e),n.fill=null==(t=n.fill)||t,n.stroke=void 0!==n.stroke?n.stroke:!n.fill||!(!n.strokeColor&&!n.strokeOpacity),n}function Z({paint:e,defaultPaint:t,getPaintFunctions:o}){if(!e)throw new Error("paint is empty");let a=W({},t);if(n(e)){const r=r=>{const n=Z({paint:e(r),defaultPaint:t,getPaintFunctions:o});return n.type=e.type,n};return r.type=e.type,r}if(r(e))return r=>Z({paint:X(e)(r),defaultPaint:t,getPaintFunctions:o});if("get-paint"===e.type){const r=function(e,r){if("function"==typeof e.from)return e.from(e.options);if("string"==typeof e.from&&r){const t=r[e.from];if(t)return t(e.options)}}(e,o);r&&(a=Z({paint:r,defaultPaint:t,getPaintFunctions:o}))}else{if("icon"===e.type)return e;a=function({paint:e,defaultPaint:r}){const t=C(e);if(t){const n=e=>Z({paint:t(e),defaultPaint:r});return n.paint=Y({paint:e,defaultPaint:r}),n}return Y({paint:e,defaultPaint:r})}({paint:e,defaultPaint:t})}return n(a)||("color"in a&&(a.strokeColor||(a.strokeColor=a.color),a.fillColor||(a.fillColor=a.color)),"opacity"in a&&(void 0===a.strokeOpacity&&(a.strokeOpacity=a.opacity),void 0===a.fillOpacity&&(a.fillOpacity=a.opacity))),a}return e.createExpressionCallback=C,e.isBasePaint=function(e){return!!t(e)&&("get-paint"!==e.type&&"icon"!==e.type)},e.isIcon=function(e){return"icon"===e.type||"html"in e},e.isPaint=t,e.isPaintCallback=n,e.isPropertiesPaint=r,e.preparePaint=Z,e}({});
//# sourceMappingURL=paint.global.prod.js.map
{
"name": "@nextgis/paint",
"version": "1.19.0",
"version": "2.0.0-alpha.0",
"description": "Create style for vector layer",

@@ -11,8 +11,8 @@ "main": "index.js",

"dependencies": {
"@nextgis/expression": "^1.19.0",
"@nextgis/properties-filter": "^1.19.0",
"@nextgis/expression": "^2.0.0-alpha.0",
"@nextgis/properties-filter": "^2.0.0-alpha.0",
"@types/geojson": "^7946.0.8"
},
"devDependencies": {
"@nextgis/build-tools": "^1.19.0"
"@nextgis/build-tools": "^2.0.0-alpha.0"
},

@@ -53,3 +53,3 @@ "buildOptions": {

},
"gitHead": "d634208dde1cf94e340f2cf1e3254c3c599fec0d"
"gitHead": "6a4a43d17a08e468d2362f1ae9590094e39aa6cc"
}

@@ -26,2 +26,2 @@ # Paint

[![http://nextgis.com](https://nextgis.ru/img/nextgis.png)](http://nextgis.com)
[![http://nextgis.com](https://nextgis.com/img/nextgis.png)](http://nextgis.com)

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc