@nextgis/paint
Advanced tools
Comparing version 1.18.21 to 1.19.0
@@ -1,2 +0,2 @@ | ||
import { Expression } from '@nextgis/expression'; | ||
import type { Expression } from '@nextgis/expression'; | ||
import type { Feature } from 'geojson'; | ||
@@ -3,0 +3,0 @@ import type { PropertiesFilter } from '@nextgis/properties-filter'; |
@@ -1,2 +0,2 @@ | ||
/** Bundle of @nextgis/paint; version: 1.18.21; author: NextGIS */ | ||
/** Bundle of @nextgis/paint; version: 1.19.0; author: NextGIS */ | ||
'use strict'; | ||
@@ -3,0 +3,0 @@ |
@@ -1,2 +0,2 @@ | ||
/** Bundle of @nextgis/paint; version: 1.18.21; author: NextGIS */ | ||
/** Bundle of @nextgis/paint; version: 1.19.0; author: NextGIS */ | ||
function isPropertiesPaint(paint) { | ||
@@ -33,27 +33,2 @@ if (Array.isArray(paint)) { | ||
const tryConvert = (converter, arg, data) => { | ||
try { | ||
const result = converter(arg, data); | ||
if (result !== undefined) { | ||
return result; | ||
} | ||
} | ||
catch { | ||
// ignore errors | ||
} | ||
return undefined; | ||
}; | ||
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`); | ||
}; | ||
} | ||
function evaluateArgs(cb) { | ||
@@ -66,170 +41,2 @@ return (args, data) => { | ||
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; | ||
} | ||
} | ||
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'; | ||
} | ||
} | ||
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)), | ||
}; | ||
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])), | ||
}; | ||
function get([key, objExp], data) { | ||
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); | ||
} | ||
function at([index, array]) { | ||
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}.`); | ||
} | ||
const length = ([item]) => { | ||
if (typeof item === 'string' || Array.isArray(item)) { | ||
return item.length; | ||
} | ||
return undefined; | ||
}; | ||
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) { | ||
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), | ||
}; | ||
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()), | ||
}; | ||
function not([expr]) { | ||
@@ -328,22 +135,2 @@ return !expr; | ||
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; | ||
} | ||
} | ||
if (input >= stops[stops.length - 2]()) { | ||
return stops[stops.length - 1](); | ||
} | ||
return defaultValue(); | ||
}; | ||
const COLORS = { | ||
@@ -653,2 +440,22 @@ aliceblue: '#f0f8ff', | ||
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; | ||
} | ||
} | ||
if (input >= stops[stops.length - 2]()) { | ||
return stops[stops.length - 1](); | ||
} | ||
return defaultValue(); | ||
}; | ||
const interpolationExpressions = { | ||
@@ -659,2 +466,195 @@ step, | ||
function get([key, objExp], data) { | ||
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); | ||
} | ||
function at([index, array]) { | ||
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}.`); | ||
} | ||
const length = ([item]) => { | ||
if (typeof item === 'string' || Array.isArray(item)) { | ||
return item.length; | ||
} | ||
return undefined; | ||
}; | ||
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) { | ||
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), | ||
}; | ||
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])), | ||
}; | ||
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()), | ||
}; | ||
const tryConvert = (converter, arg, data) => { | ||
try { | ||
const result = converter(arg, data); | ||
if (result !== undefined) { | ||
return result; | ||
} | ||
} | ||
catch { | ||
// ignore errors | ||
} | ||
return undefined; | ||
}; | ||
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`); | ||
}; | ||
} | ||
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; | ||
} | ||
} | ||
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'; | ||
} | ||
} | ||
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)), | ||
}; | ||
function isExpression(value) { | ||
@@ -683,3 +683,3 @@ if (Array.isArray(value)) { | ||
if (expressionFun) { | ||
return expressionFun(args.map((arg) => () => isExpression(arg) ? evaluate(arg, data) : arg), data); | ||
return expressionFun(args.map((arg) => () => (isExpression(arg) ? evaluate(arg, data) : arg)), data); | ||
} | ||
@@ -686,0 +686,0 @@ throw new Error(`Expression "${name}" is not supported.`); |
@@ -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}const a=(e,r,t)=>{try{const n=e(r,t);if(void 0!==n)return n}catch{}};function f(e){return(r,t)=>{for(const n of r){const r=a(e,n,t);if(void 0!==r)return r}throw new Error("Received a mismatched type")}}function i(e){return(r,t)=>{const n=r.map((e=>e()));return e(n,t)}}const l={array:i((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:i(f((e=>"boolean"==typeof e?e:void 0))),literal:i((([e])=>e)),number:i(f((e=>"number"==typeof e?e:void 0))),object:i(f((e=>null===e||"object"!=typeof e||Array.isArray(e)?void 0:e))),string:i(f((e=>"string"==typeof e?e:void 0))),"to-boolean":i(f(Boolean)),"to-number":i(f(Number)),"to-string":i(f(String)),typeof:i((([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)))},u={"+":i((e=>e.reduce(((e,r)=>e+r),0))),"-":i((e=>e.reduce(((e,r)=>e-r)))),"*":i((e=>e.reduce(((e,r)=>e*r),1))),"/":i((e=>e.reduce(((e,r)=>e/r)))),"%":i((e=>e[0]%e[1])),"^":i((e=>Math.pow(e[0],e[1]))),abs:i((e=>Math.abs(e[0]))),acos:i((e=>Math.acos(e[0]))),asin:i((e=>Math.asin(e[0]))),atan:i((e=>Math.atan(e[0]))),ceil:i((e=>Math.ceil(e[0]))),cos:i((e=>Math.cos(e[0]))),e:()=>Math.E,floor:i((e=>Math.floor(e[0]))),ln:i((e=>Math.log(e[0]))),ln2:()=>Math.LN2,log10:i((e=>Math.log10(e[0]))),log2:i((e=>Math.log2(e[0]))),max:i((e=>Math.max(...e))),min:i((e=>Math.min(...e))),pi:()=>Math.PI,round:i((e=>Math.round(e[0]))),sin:i((e=>Math.sin(e[0]))),sqrt:i((e=>Math.sqrt(e[0]))),tan:i((e=>Math.tan(e[0])))};const c={get:i((function([e,r],t){const n=r||t;return n&&"object"==typeof n&&e in n?n[e]:null})),length:i((([e])=>{if("string"==typeof e||Array.isArray(e))return e.length})),at:i((function([e,r]){return r[e]})),has:i((function([e,r],t){const n=r||t;return!(!n||"object"!=typeof n||!(e in n))})),in:i((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":i((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:i((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}.`)}))},s={concat:i((e=>e.reduce(((e,r)=>String(e)+String(r)),""))),downcase:i((e=>String(e[0]).toLowerCase())),upcase:i((e=>String(e[0]).toUpperCase()))};const d={"!":i((function([e]){return!e})),"!=":i((function([e,r]){return e!==r})),"<":i((function([e,r]){return e<r})),"<=":i((function([e,r]){return e<=r})),"==":i((function([e,r]){return e===r})),">":i((function([e,r]){return e>r})),">=":i((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()}},p={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 g(e){if("string"==typeof(t=e)&&/^#([A-Fa-f0-9]{3}){1,2}$/.test(t))return y(e);if("string"==typeof(r=e)&&r in p)return function(e){return y(p[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 y(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 b(e,r,t,n,o){if("number"==typeof t&&"number"==typeof o)return t+(e-r)/(n-r)*(o-t);try{const a=g(t),f=g(o);return function(e){return`rgb(${e.join(",")})`}(a.map(((t,o)=>Math.ceil(b(e,r,t,n,f[o])))))}catch(a){console.log(a)}throw new Error("Unsupported output type for linear interpolation.")}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={...u,...l,...s,...c,...d,...{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 b(n,e,r,f,i)}throw new Error("Invalid interpolation type.")}}};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 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}; | ||
//# sourceMappingURL=paint.esm-browser.prod.js.map |
@@ -1,2 +0,2 @@ | ||
/** Bundle of @nextgis/paint; version: 1.18.21; author: NextGIS */ | ||
/** Bundle of @nextgis/paint; version: 1.19.0; author: NextGIS */ | ||
import { isExpression, evaluate } from '@nextgis/expression'; | ||
@@ -3,0 +3,0 @@ import { featureFilter } from '@nextgis/properties-filter'; |
@@ -1,2 +0,2 @@ | ||
/** Bundle of @nextgis/paint; version: 1.18.21; author: NextGIS */ | ||
/** Bundle of @nextgis/paint; version: 1.19.0; author: NextGIS */ | ||
var Paint = (function (exports) { | ||
@@ -77,28 +77,2 @@ 'use strict'; | ||
var tryConvert = function (converter, arg, data) { | ||
try { | ||
var result = converter(arg, data); | ||
if (result !== undefined) { | ||
return result; | ||
} | ||
} | ||
catch (_a) { | ||
// ignore errors | ||
} | ||
return undefined; | ||
}; | ||
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"); | ||
}; | ||
} | ||
function evaluateArgs(cb) { | ||
@@ -111,184 +85,2 @@ return function (args, data) { | ||
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; | ||
} | ||
} | ||
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; | ||
}; | ||
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'; | ||
} | ||
} | ||
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); | ||
}), | ||
}; | ||
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]); }), | ||
}; | ||
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 has(_a, data) { | ||
var key = _a[0], objExp = _a[1]; | ||
var 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 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, ".")); | ||
} | ||
var length = function (_a) { | ||
var item = _a[0]; | ||
if (typeof item === 'string' || Array.isArray(item)) { | ||
return item.length; | ||
} | ||
return undefined; | ||
}; | ||
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 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, ".")); | ||
} | ||
var lookupExpressions = { | ||
get: evaluateArgs(get), | ||
length: evaluateArgs(length), | ||
at: evaluateArgs(at), | ||
has: evaluateArgs(has), | ||
in: evaluateArgs(inFunc), | ||
'index-of': evaluateArgs(indexOf), | ||
slice: evaluateArgs(slice), | ||
}; | ||
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(); }), | ||
}; | ||
function not(_a) { | ||
@@ -394,22 +186,2 @@ var expr = _a[0]; | ||
var step = function (args) { | ||
var inputFn = args[0], defaultValue = args[1], stops = args.slice(2); | ||
var input = inputFn(); | ||
if (typeof input !== 'number') { | ||
return defaultValue(); | ||
} | ||
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(); | ||
}; | ||
var COLORS = { | ||
@@ -721,2 +493,22 @@ aliceblue: '#f0f8ff', | ||
var step = function (args) { | ||
var inputFn = args[0], defaultValue = args[1], stops = args.slice(2); | ||
var input = inputFn(); | ||
if (typeof input !== 'number') { | ||
return defaultValue(); | ||
} | ||
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(); | ||
}; | ||
var interpolationExpressions = { | ||
@@ -727,2 +519,210 @@ step: step, | ||
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 has(_a, data) { | ||
var key = _a[0], objExp = _a[1]; | ||
var 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 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, ".")); | ||
} | ||
var length = function (_a) { | ||
var item = _a[0]; | ||
if (typeof item === 'string' || Array.isArray(item)) { | ||
return item.length; | ||
} | ||
return undefined; | ||
}; | ||
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 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, ".")); | ||
} | ||
var 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]); }), | ||
}; | ||
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(); }), | ||
}; | ||
var tryConvert = function (converter, arg, data) { | ||
try { | ||
var result = converter(arg, data); | ||
if (result !== undefined) { | ||
return result; | ||
} | ||
} | ||
catch (_a) { | ||
// ignore errors | ||
} | ||
return undefined; | ||
}; | ||
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"); | ||
}; | ||
} | ||
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; | ||
} | ||
} | ||
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; | ||
}; | ||
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'; | ||
} | ||
} | ||
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); | ||
}), | ||
}; | ||
function isExpression(value) { | ||
@@ -745,3 +745,3 @@ if (Array.isArray(value)) { | ||
if (expressionFun) { | ||
return expressionFun(args.map(function (arg) { return function () { return isExpression(arg) ? evaluate(arg, data) : arg; }; }), data); | ||
return expressionFun(args.map(function (arg) { return function () { return (isExpression(arg) ? evaluate(arg, data) : arg); }; }), data); | ||
} | ||
@@ -748,0 +748,0 @@ throw new Error("Expression \"".concat(name, "\" is not supported.")); |
@@ -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"==typeof SuppressedError&&SuppressedError;var a=function(r,n,e){try{var t=r(n,e);if(void 0!==t)return t}catch(i){}};function o(r){return function(n,e){for(var t=0,i=n;t<i.length;t++){var o=a(r,i[t],e);if(void 0!==o)return o}throw new Error("Received a mismatched type")}}function f(r){return function(n,e){var t=n.map((function(r){return r()}));return r(t,e)}}var u={array:f((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:f(o((function(r){return"boolean"==typeof r?r:void 0}))),literal:f((function(r){return r[0]})),number:f(o((function(r){return"number"==typeof r?r:void 0}))),object:f(o((function(r){return null===r||"object"!=typeof r||Array.isArray(r)?void 0:r}))),string:f(o((function(r){return"string"==typeof r?r:void 0}))),"to-boolean":f(o(Boolean)),"to-number":f(o(Number)),"to-string":f(o(String)),typeof:f((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])}))},c={"+":f((function(r){return r.reduce((function(r,n){return r+n}),0)})),"-":f((function(r){return r.reduce((function(r,n){return r-n}))})),"*":f((function(r){return r.reduce((function(r,n){return r*n}),1)})),"/":f((function(r){return r.reduce((function(r,n){return r/n}))})),"%":f((function(r){return r[0]%r[1]})),"^":f((function(r){return Math.pow(r[0],r[1])})),abs:f((function(r){return Math.abs(r[0])})),acos:f((function(r){return Math.acos(r[0])})),asin:f((function(r){return Math.asin(r[0])})),atan:f((function(r){return Math.atan(r[0])})),ceil:f((function(r){return Math.ceil(r[0])})),cos:f((function(r){return Math.cos(r[0])})),e:function(){return Math.E},floor:f((function(r){return Math.floor(r[0])})),ln:f((function(r){return Math.log(r[0])})),ln2:function(){return Math.LN2},log10:f((function(r){return Math.log10(r[0])})),log2:f((function(r){return Math.log2(r[0])})),max:f((function(r){return Math.max.apply(Math,r)})),min:f((function(r){return Math.min.apply(Math,r)})),pi:function(){return Math.PI},round:f((function(r){return Math.round(r[0])})),sin:f((function(r){return Math.sin(r[0])})),sqrt:f((function(r){return Math.sqrt(r[0])})),tan:f((function(r){return Math.tan(r[0])}))};var l={get:f((function(r,n){var e=r[0],t=r[1]||n;return t&&"object"==typeof t&&e in t?t[e]:null})),length:f((function(r){var n=r[0];if("string"==typeof n||Array.isArray(n))return n.length})),at:f((function(r){return r[1][r[0]]})),has:f((function(r,n){var e=r[1]||n;return!(!e||"object"!=typeof e||!(r[0]in e))})),in:f((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":f((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:f((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,"."))}))},s={concat:f((function(r){return r.reduce((function(r,n){return String(r)+String(n)}),"")})),downcase:f((function(r){return String(r[0]).toLowerCase()})),upcase:f((function(r){return String(r[0]).toUpperCase()}))};var d={"!":f((function(r){return!r[0]})),"!=":f((function(r){return r[0]!==r[1]})),"<":f((function(r){return r[0]<r[1]})),"<=":f((function(r){return r[0]<=r[1]})),"==":f((function(r){return r[0]===r[1]})),">":f((function(r){return r[0]>r[1]})),">=":f((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()}},p={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 g(r){if("string"==typeof(a=r)&&/^#([A-Fa-f0-9]{3}){1,2}$/.test(a))return y(r);if("string"==typeof(i=r)&&i in p)return function(r){return y(p[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 y(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 b(r,n,e,t,i){if("number"==typeof e&&"number"==typeof i)return e+(r-n)/(t-n)*(i-e);try{var a=g(e),o=g(i);return function(r){return"rgb(".concat(r.join(","),")")}(a.map((function(e,i){return Math.ceil(b(r,n,e,t,o[i]))})))}catch(f){console.log(f)}throw new Error("Unsupported output type for linear interpolation.")}var h={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](),l=t[o+3]();if(i>=f&&i<=c&&"linear"===a[0])return b(i,f,u,c,l)}throw new Error("Invalid interpolation type.")}};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({},c),u),s),l),d),h);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(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}({}); | ||
//# sourceMappingURL=paint.global.prod.js.map |
{ | ||
"name": "@nextgis/paint", | ||
"version": "1.18.21", | ||
"version": "1.19.0", | ||
"description": "Create style for vector layer", | ||
@@ -11,8 +11,8 @@ "main": "index.js", | ||
"dependencies": { | ||
"@nextgis/expression": "^1.18.21", | ||
"@nextgis/properties-filter": "^1.18.21", | ||
"@nextgis/expression": "^1.19.0", | ||
"@nextgis/properties-filter": "^1.19.0", | ||
"@types/geojson": "^7946.0.8" | ||
}, | ||
"devDependencies": { | ||
"@nextgis/build-tools": "^1.18.21" | ||
"@nextgis/build-tools": "^1.19.0" | ||
}, | ||
@@ -53,3 +53,3 @@ "buildOptions": { | ||
}, | ||
"gitHead": "0b10e74f557715ec65285bfbcaab322b90605454" | ||
"gitHead": "d634208dde1cf94e340f2cf1e3254c3c599fec0d" | ||
} |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
408562