{"version":3,"file":"gl-style-migrate.cjs","names":["v8","stringifyPretty","Reference","types","expressions","expressions","minimist"],"sources":["../node_modules/minimist/index.js","../src/reference/latest.ts","../node_modules/json-stringify-pretty-compact/index.js","../src/format.ts","../src/visit.ts","../src/migrate/v8.ts","../src/expression/types.ts","../src/expression/types/color_spaces.ts","../src/util/get_own.ts","../src/expression/types/parse_css_color.ts","../src/util/interpolate-primitives.ts","../src/expression/types/color.ts","../src/expression/types/collator.ts","../src/expression/types/formatted.ts","../src/expression/types/padding.ts","../src/expression/types/number_array.ts","../src/expression/types/color_array.ts","../src/expression/runtime_error.ts","../src/expression/types/variable_anchor_offset_collection.ts","../src/expression/types/resolved_image.ts","../src/expression/types/projection_definition.ts","../src/expression/values.ts","../src/expression/definitions/literal.ts","../src/expression/definitions/assertion.ts","../src/expression/definitions/coercion.ts","../src/expression/definitions/let.ts","../src/expression/definitions/var.ts","../src/expression/definitions/at.ts","../src/expression/definitions/in.ts","../src/expression/definitions/index_of.ts","../src/expression/definitions/match.ts","../src/expression/definitions/case.ts","../src/expression/definitions/slice.ts","../src/expression/stops.ts","../src/expression/definitions/step.ts","../node_modules/@mapbox/unitbezier/index.js","../src/expression/definitions/interpolate.ts","../src/expression/definitions/coalesce.ts","../src/expression/definitions/comparison.ts","../src/expression/definitions/collator.ts","../src/expression/definitions/number_format.ts","../src/expression/definitions/format.ts","../src/expression/definitions/image.ts","../src/expression/definitions/length.ts","../src/util/geometry_util.ts","../src/expression/definitions/within.ts","../node_modules/tinyqueue/index.js","../node_modules/quickselect/index.js","../src/util/classify_rings.ts","../src/util/cheap_ruler.ts","../src/expression/definitions/distance.ts","../src/expression/definitions/semiliteral.ts","../src/expression/definitions/global_state.ts","../src/expression/definitions/index.ts","../src/expression/index.ts","../src/function/convert.ts","../src/feature_filter/index.ts","../src/feature_filter/convert.ts","../src/migrate/expressions.ts","../src/migrate/migrate_colors.ts","../src/migrate.ts","../bin/gl-style-migrate.ts"],"sourcesContent":["'use strict';\n\nfunction hasKey(obj, keys) {\n\tvar o = obj;\n\tkeys.slice(0, -1).forEach(function (key) {\n\t\to = o[key] || {};\n\t});\n\n\tvar key = keys[keys.length - 1];\n\treturn key in o;\n}\n\nfunction isNumber(x) {\n\tif (typeof x === 'number') { return true; }\n\tif ((/^0x[0-9a-f]+$/i).test(x)) { return true; }\n\treturn (/^[-+]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(e[-+]?\\d+)?$/).test(x);\n}\n\nfunction isConstructorOrProto(obj, key) {\n\treturn (key === 'constructor' && typeof obj[key] === 'function') || key === '__proto__';\n}\n\nmodule.exports = function (args, opts) {\n\tif (!opts) { opts = {}; }\n\n\tvar flags = {\n\t\tbools: {},\n\t\tstrings: {},\n\t\tunknownFn: null,\n\t};\n\n\tif (typeof opts.unknown === 'function') {\n\t\tflags.unknownFn = opts.unknown;\n\t}\n\n\tif (typeof opts.boolean === 'boolean' && opts.boolean) {\n\t\tflags.allBools = true;\n\t} else {\n\t\t[].concat(opts.boolean).filter(Boolean).forEach(function (key) {\n\t\t\tflags.bools[key] = true;\n\t\t});\n\t}\n\n\tvar aliases = {};\n\n\tfunction aliasIsBoolean(key) {\n\t\treturn aliases[key].some(function (x) {\n\t\t\treturn flags.bools[x];\n\t\t});\n\t}\n\n\tObject.keys(opts.alias || {}).forEach(function (key) {\n\t\taliases[key] = [].concat(opts.alias[key]);\n\t\taliases[key].forEach(function (x) {\n\t\t\taliases[x] = [key].concat(aliases[key].filter(function (y) {\n\t\t\t\treturn x !== y;\n\t\t\t}));\n\t\t});\n\t});\n\n\t[].concat(opts.string).filter(Boolean).forEach(function (key) {\n\t\tflags.strings[key] = true;\n\t\tif (aliases[key]) {\n\t\t\t[].concat(aliases[key]).forEach(function (k) {\n\t\t\t\tflags.strings[k] = true;\n\t\t\t});\n\t\t}\n\t});\n\n\tvar defaults = opts.default || {};\n\n\tvar argv = { _: [] };\n\n\tfunction argDefined(key, arg) {\n\t\treturn (flags.allBools && (/^--[^=]+$/).test(arg))\n\t\t\t|| flags.strings[key]\n\t\t\t|| flags.bools[key]\n\t\t\t|| aliases[key];\n\t}\n\n\tfunction setKey(obj, keys, value) {\n\t\tvar o = obj;\n\t\tfor (var i = 0; i < keys.length - 1; i++) {\n\t\t\tvar key = keys[i];\n\t\t\tif (isConstructorOrProto(o, key)) { return; }\n\t\t\tif (o[key] === undefined) { o[key] = {}; }\n\t\t\tif (\n\t\t\t\to[key] === Object.prototype\n\t\t\t\t|| o[key] === Number.prototype\n\t\t\t\t|| o[key] === String.prototype\n\t\t\t) {\n\t\t\t\to[key] = {};\n\t\t\t}\n\t\t\tif (o[key] === Array.prototype) { o[key] = []; }\n\t\t\to = o[key];\n\t\t}\n\n\t\tvar lastKey = keys[keys.length - 1];\n\t\tif (isConstructorOrProto(o, lastKey)) { return; }\n\t\tif (\n\t\t\to === Object.prototype\n\t\t\t|| o === Number.prototype\n\t\t\t|| o === String.prototype\n\t\t) {\n\t\t\to = {};\n\t\t}\n\t\tif (o === Array.prototype) { o = []; }\n\t\tif (o[lastKey] === undefined || flags.bools[lastKey] || typeof o[lastKey] === 'boolean') {\n\t\t\to[lastKey] = value;\n\t\t} else if (Array.isArray(o[lastKey])) {\n\t\t\to[lastKey].push(value);\n\t\t} else {\n\t\t\to[lastKey] = [o[lastKey], value];\n\t\t}\n\t}\n\n\tfunction setArg(key, val, arg) {\n\t\tif (arg && flags.unknownFn && !argDefined(key, arg)) {\n\t\t\tif (flags.unknownFn(arg) === false) { return; }\n\t\t}\n\n\t\tvar value = !flags.strings[key] && isNumber(val)\n\t\t\t? Number(val)\n\t\t\t: val;\n\t\tsetKey(argv, key.split('.'), value);\n\n\t\t(aliases[key] || []).forEach(function (x) {\n\t\t\tsetKey(argv, x.split('.'), value);\n\t\t});\n\t}\n\n\tObject.keys(flags.bools).forEach(function (key) {\n\t\tsetArg(key, defaults[key] === undefined ? false : defaults[key]);\n\t});\n\n\tvar notFlags = [];\n\n\tif (args.indexOf('--') !== -1) {\n\t\tnotFlags = args.slice(args.indexOf('--') + 1);\n\t\targs = args.slice(0, args.indexOf('--'));\n\t}\n\n\tfor (var i = 0; i < args.length; i++) {\n\t\tvar arg = args[i];\n\t\tvar key;\n\t\tvar next;\n\n\t\tif ((/^--.+=/).test(arg)) {\n\t\t\t// Using [\\s\\S] instead of . because js doesn't support the\n\t\t\t// 'dotall' regex modifier. See:\n\t\t\t// http://stackoverflow.com/a/1068308/13216\n\t\t\tvar m = arg.match(/^--([^=]+)=([\\s\\S]*)$/);\n\t\t\tkey = m[1];\n\t\t\tvar value = m[2];\n\t\t\tif (flags.bools[key]) {\n\t\t\t\tvalue = value !== 'false';\n\t\t\t}\n\t\t\tsetArg(key, value, arg);\n\t\t} else if ((/^--no-.+/).test(arg)) {\n\t\t\tkey = arg.match(/^--no-(.+)/)[1];\n\t\t\tsetArg(key, false, arg);\n\t\t} else if ((/^--.+/).test(arg)) {\n\t\t\tkey = arg.match(/^--(.+)/)[1];\n\t\t\tnext = args[i + 1];\n\t\t\tif (\n\t\t\t\tnext !== undefined\n\t\t\t\t&& !(/^(-|--)[^-]/).test(next)\n\t\t\t\t&& !flags.bools[key]\n\t\t\t\t&& !flags.allBools\n\t\t\t\t&& (aliases[key] ? !aliasIsBoolean(key) : true)\n\t\t\t) {\n\t\t\t\tsetArg(key, next, arg);\n\t\t\t\ti += 1;\n\t\t\t} else if ((/^(true|false)$/).test(next)) {\n\t\t\t\tsetArg(key, next === 'true', arg);\n\t\t\t\ti += 1;\n\t\t\t} else {\n\t\t\t\tsetArg(key, flags.strings[key] ? '' : true, arg);\n\t\t\t}\n\t\t} else if ((/^-[^-]+/).test(arg)) {\n\t\t\tvar letters = arg.slice(1, -1).split('');\n\n\t\t\tvar broken = false;\n\t\t\tfor (var j = 0; j < letters.length; j++) {\n\t\t\t\tnext = arg.slice(j + 2);\n\n\t\t\t\tif (next === '-') {\n\t\t\t\t\tsetArg(letters[j], next, arg);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tif ((/[A-Za-z]/).test(letters[j]) && next[0] === '=') {\n\t\t\t\t\tsetArg(letters[j], next.slice(1), arg);\n\t\t\t\t\tbroken = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\t(/[A-Za-z]/).test(letters[j])\n\t\t\t\t\t&& (/-?\\d+(\\.\\d*)?(e-?\\d+)?$/).test(next)\n\t\t\t\t) {\n\t\t\t\t\tsetArg(letters[j], next, arg);\n\t\t\t\t\tbroken = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tif (letters[j + 1] && letters[j + 1].match(/\\W/)) {\n\t\t\t\t\tsetArg(letters[j], arg.slice(j + 2), arg);\n\t\t\t\t\tbroken = true;\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tsetArg(letters[j], flags.strings[letters[j]] ? '' : true, arg);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tkey = arg.slice(-1)[0];\n\t\t\tif (!broken && key !== '-') {\n\t\t\t\tif (\n\t\t\t\t\targs[i + 1]\n\t\t\t\t\t&& !(/^(-|--)[^-]/).test(args[i + 1])\n\t\t\t\t\t&& !flags.bools[key]\n\t\t\t\t\t&& (aliases[key] ? !aliasIsBoolean(key) : true)\n\t\t\t\t) {\n\t\t\t\t\tsetArg(key, args[i + 1], arg);\n\t\t\t\t\ti += 1;\n\t\t\t\t} else if (args[i + 1] && (/^(true|false)$/).test(args[i + 1])) {\n\t\t\t\t\tsetArg(key, args[i + 1] === 'true', arg);\n\t\t\t\t\ti += 1;\n\t\t\t\t} else {\n\t\t\t\t\tsetArg(key, flags.strings[key] ? '' : true, arg);\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tif (!flags.unknownFn || flags.unknownFn(arg) !== false) {\n\t\t\t\targv._.push(flags.strings._ || !isNumber(arg) ? arg : Number(arg));\n\t\t\t}\n\t\t\tif (opts.stopEarly) {\n\t\t\t\targv._.push.apply(argv._, args.slice(i + 1));\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tObject.keys(defaults).forEach(function (k) {\n\t\tif (!hasKey(argv, k.split('.'))) {\n\t\t\tsetKey(argv, k.split('.'), defaults[k]);\n\n\t\t\t(aliases[k] || []).forEach(function (x) {\n\t\t\t\tsetKey(argv, x.split('.'), defaults[k]);\n\t\t\t});\n\t\t}\n\t});\n\n\tif (opts['--']) {\n\t\targv['--'] = notFlags.slice();\n\t} else {\n\t\tnotFlags.forEach(function (k) {\n\t\t\targv._.push(k);\n\t\t});\n\t}\n\n\treturn argv;\n};\n","import v8 from './v8.json' with {type: 'json'};\n\n/**\n * The style specification reference, i.e. the contents of `v8.json`, Inferred from the JSON itself.\n */\nexport type StyleSpecificationReference = typeof v8;\n\nconst latest: StyleSpecificationReference = v8;\n\nexport {latest};\n","// Note: This regex matches even invalid JSON strings, but since we’re\n// working on the output of `JSON.stringify` we know that only valid strings\n// are present (unless the user supplied a weird `options.indent` but in\n// that case we don’t care since the output would be invalid anyway).\nconst stringOrChar = /(\"(?:[^\\\\\"]|\\\\.)*\")|[:,]/g;\n\nexport default function stringify(passedObj, options = {}) {\n  const indent = JSON.stringify(\n    [1],\n    undefined,\n    options.indent === undefined ? 2 : options.indent\n  ).slice(2, -3);\n\n  const maxLength =\n    indent === \"\"\n      ? Infinity\n      : options.maxLength === undefined\n      ? 80\n      : options.maxLength;\n\n  let { replacer } = options;\n\n  return (function _stringify(obj, currentIndent, reserved) {\n    if (obj && typeof obj.toJSON === \"function\") {\n      obj = obj.toJSON();\n    }\n\n    const string = JSON.stringify(obj, replacer);\n\n    if (string === undefined) {\n      return string;\n    }\n\n    const length = maxLength - currentIndent.length - reserved;\n\n    if (string.length <= length) {\n      const prettified = string.replace(\n        stringOrChar,\n        (match, stringLiteral) => {\n          return stringLiteral || `${match} `;\n        }\n      );\n      if (prettified.length <= length) {\n        return prettified;\n      }\n    }\n\n    if (replacer != null) {\n      obj = JSON.parse(string);\n      replacer = undefined;\n    }\n\n    if (typeof obj === \"object\" && obj !== null) {\n      const nextIndent = currentIndent + indent;\n      const items = [];\n      let index = 0;\n      let start;\n      let end;\n\n      if (Array.isArray(obj)) {\n        start = \"[\";\n        end = \"]\";\n        const { length } = obj;\n        for (; index < length; index++) {\n          items.push(\n            _stringify(obj[index], nextIndent, index === length - 1 ? 0 : 1) ||\n              \"null\"\n          );\n        }\n      } else {\n        start = \"{\";\n        end = \"}\";\n        const keys = Object.keys(obj);\n        const { length } = keys;\n        for (; index < length; index++) {\n          const key = keys[index];\n          const keyPart = `${JSON.stringify(key)}: `;\n          const value = _stringify(\n            obj[key],\n            nextIndent,\n            keyPart.length + (index === length - 1 ? 0 : 1)\n          );\n          if (value !== undefined) {\n            items.push(keyPart + value);\n          }\n        }\n      }\n\n      if (items.length > 0) {\n        return [start, indent + items.join(`,\\n${nextIndent}`), end].join(\n          `\\n${currentIndent}`\n        );\n      }\n    }\n\n    return string;\n  })(passedObj, \"\", 0);\n}\n","import {latest} from './reference/latest';\nimport stringifyPretty from 'json-stringify-pretty-compact';\n\nfunction sortKeysBy(obj, reference) {\n    const result = {};\n    for (const key in reference) {\n        if (obj[key] !== undefined) {\n            result[key] = obj[key];\n        }\n    }\n    for (const key in obj) {\n        if (result[key] === undefined) {\n            result[key] = obj[key];\n        }\n    }\n    return result;\n}\n\n/**\n * Format a MapLibre Style.  Returns a stringified style with its keys\n * sorted in the same order as the reference style.\n *\n * The optional `space` argument is passed to\n * [`JSON.stringify`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify)\n * to generate formatted output.\n *\n * If `space` is unspecified, a default of `2` spaces will be used.\n *\n * @private\n * @param {Object} style a MapLibre Style\n * @param {number} [space] space argument to pass to `JSON.stringify`\n * @returns {string} stringified formatted JSON\n * @example\n * var fs = require('fs');\n * var format = require('maplibre-gl-style-spec').format;\n * var style = fs.readFileSync('./source.json', 'utf8');\n * fs.writeFileSync('./dest.json', format(style));\n * fs.writeFileSync('./dest.min.json', format(style, 0));\n */\nexport function format(style, space = 2) {\n    style = sortKeysBy(style, latest.$root);\n\n    if (style.layers) {\n        style.layers = style.layers.map((layer) => sortKeysBy(layer, latest.layer));\n    }\n\n    return stringifyPretty(style, {indent: space});\n}\n","import Reference from './reference/v8.json' with {type: 'json'};\nimport type {StylePropertySpecification} from '.';\nimport type {\n    StyleSpecification,\n    SourceSpecification,\n    LayerSpecification,\n    PropertyValueSpecification,\n    DataDrivenPropertyValueSpecification\n} from './types.g';\n\nfunction getPropertyReference(propertyName: string): StylePropertySpecification | null {\n    for (let i = 0; i < Reference.layout.length; i++) {\n        for (const key in Reference[Reference.layout[i]]) {\n            if (key === propertyName) return Reference[Reference.layout[i]][key];\n        }\n    }\n    for (let i = 0; i < Reference.paint.length; i++) {\n        for (const key in Reference[Reference.paint[i]]) {\n            if (key === propertyName) return Reference[Reference.paint[i]][key];\n        }\n    }\n\n    return null;\n}\n\nexport function eachSource(style: StyleSpecification, callback: (_: SourceSpecification) => void) {\n    for (const k in style.sources) {\n        callback(style.sources[k]);\n    }\n}\n\nexport function eachLayer(style: StyleSpecification, callback: (_: LayerSpecification) => void) {\n    for (const layer of style.layers) {\n        callback(layer);\n    }\n}\n\ntype PropertyCallback = (a: {\n    path: [string, 'paint' | 'layout', string]; // [layerid, paint/layout, property key],\n    key: string;\n    value: PropertyValueSpecification<unknown> | DataDrivenPropertyValueSpecification<unknown>;\n    reference: StylePropertySpecification | null;\n    set: (\n        a: PropertyValueSpecification<unknown> | DataDrivenPropertyValueSpecification<unknown>\n    ) => void;\n}) => void;\n\nexport function eachProperty(\n    style: StyleSpecification,\n    options: {\n        paint?: boolean;\n        layout?: boolean;\n    },\n    callback: PropertyCallback\n) {\n    function inner(layer: LayerSpecification, propertyType: 'paint' | 'layout') {\n        const properties = layer[propertyType];\n        if (!properties) return;\n        Object.keys(properties).forEach((key) => {\n            callback({\n                path: [layer.id, propertyType, key],\n                key,\n                value: properties[key],\n                reference: getPropertyReference(key),\n                set(x) {\n                    properties[key] = x;\n                }\n            });\n        });\n    }\n\n    eachLayer(style, (layer) => {\n        if (options.paint) {\n            inner(layer, 'paint');\n        }\n        if (options.layout) {\n            inner(layer, 'layout');\n        }\n    });\n}\n","import {eachSource, eachLayer, eachProperty} from '../visit';\nimport type {LayerSpecification, StyleSpecification} from '../types.g';\n\nfunction eachLayout(\n    layer: LayerSpecification,\n    callback: (_: LayerSpecification['layout'], __: string) => void\n) {\n    for (const k in layer) {\n        if (k.indexOf('layout') === 0) {\n            callback(layer[k], k);\n        }\n    }\n}\n\nfunction eachPaint(\n    layer: LayerSpecification,\n    callback: (_: LayerSpecification['paint'], __: string) => void\n) {\n    for (const k in layer) {\n        if (k.indexOf('paint') === 0) {\n            callback(layer[k], k);\n        }\n    }\n}\n\nfunction resolveConstant(style: StyleSpecification, value: any) {\n    if (typeof value === 'string' && value[0] === '@') {\n        return resolveConstant(style, (style as any).constants[value]);\n    } else {\n        return value;\n    }\n}\n\nfunction isFunction(value) {\n    return Array.isArray(value.stops);\n}\n\nfunction renameProperty(obj: Object, from: string, to: string) {\n    obj[to] = obj[from];\n    delete obj[from];\n}\n\nexport function migrateV8(style: StyleSpecification) {\n    style.version = 8;\n\n    // Rename properties, reverse coordinates in source and layers\n    eachSource(style, (source) => {\n        if (source.type === 'video' && source['url'] !== undefined) {\n            renameProperty(source, 'url', 'urls');\n        }\n        if (source.type === 'video') {\n            source.coordinates.forEach((coord) => {\n                return coord.reverse();\n            });\n        }\n    });\n\n    eachLayer(style, (layer) => {\n        eachLayout(layer, (layout) => {\n            if (layout['symbol-min-distance'] !== undefined) {\n                renameProperty(layout, 'symbol-min-distance', 'symbol-spacing');\n            }\n        });\n\n        eachPaint(layer, (paint) => {\n            if (paint['background-image'] !== undefined) {\n                renameProperty(paint, 'background-image', 'background-pattern');\n            }\n            if (paint['line-image'] !== undefined) {\n                renameProperty(paint, 'line-image', 'line-pattern');\n            }\n            if (paint['fill-image'] !== undefined) {\n                renameProperty(paint, 'fill-image', 'fill-pattern');\n            }\n        });\n    });\n\n    // Inline Constants\n    eachProperty(style, {paint: true, layout: true}, (property) => {\n        const value = resolveConstant(style, property.value);\n\n        if (isFunction(value)) {\n            value.stops.forEach((stop) => {\n                stop[1] = resolveConstant(style, stop[1]);\n            });\n        }\n\n        property.set(value);\n    });\n    delete style['constants'];\n\n    eachLayer(style, (layer) => {\n        // get rid of text-max-size, icon-max-size\n        // turn text-size, icon-size into layout properties\n        // https://github.com/mapbox/mapbox-gl-style-spec/issues/255\n\n        eachLayout(layer, (layout) => {\n            delete layout['text-max-size'];\n            delete layout['icon-max-size'];\n        });\n\n        eachPaint(layer, (paint) => {\n            if (paint['text-size']) {\n                if (!layer.layout) layer.layout = {};\n                layer.layout['text-size'] = paint['text-size'];\n                delete paint['text-size'];\n            }\n\n            if (paint['icon-size']) {\n                if (!layer.layout) layer.layout = {};\n                layer.layout['icon-size'] = paint['icon-size'];\n                delete paint['icon-size'];\n            }\n        });\n    });\n\n    function migrateFontStack(font) {\n        function splitAndTrim(string) {\n            return string.split(',').map((s) => {\n                return s.trim();\n            });\n        }\n\n        if (Array.isArray(font)) {\n            // Assume it's a previously migrated font-array.\n            return font;\n        } else if (typeof font === 'string') {\n            return splitAndTrim(font);\n        } else if (typeof font === 'object') {\n            font.stops.forEach((stop) => {\n                stop[1] = splitAndTrim(stop[1]);\n            });\n            return font;\n        } else {\n            throw new Error('unexpected font value');\n        }\n    }\n\n    eachLayer(style, (layer) => {\n        eachLayout(layer, (layout) => {\n            if (layout['text-font']) {\n                layout['text-font'] = migrateFontStack(layout['text-font']);\n            }\n        });\n    });\n\n    // Reverse order of symbol layers. This is an imperfect migration.\n    //\n    // The order of a symbol layer in the layers list affects two things:\n    // - how it is drawn relative to other layers (like oneway arrows below bridges)\n    // - the placement priority compared to other layers\n    //\n    // It's impossible to reverse the placement priority without breaking the draw order\n    // in some cases. This migration only reverses the order of symbol layers that\n    // are above all other types of layers.\n    //\n    // Symbol layers that are at the top of the map preserve their priority.\n    // Symbol layers that are below another type (line, fill) of layer preserve their draw order.\n\n    let firstSymbolLayer = 0;\n    for (let i = style.layers.length - 1; i >= 0; i--) {\n        const layer = style.layers[i];\n        if (layer.type !== 'symbol') {\n            firstSymbolLayer = i + 1;\n            break;\n        }\n    }\n\n    const symbolLayers = style.layers.splice(firstSymbolLayer);\n    symbolLayers.reverse();\n    style.layers = style.layers.concat(symbolLayers);\n\n    return style;\n}\n","export type NullTypeT = {\n    kind: 'null';\n};\nexport type NumberTypeT = {\n    kind: 'number';\n};\nexport type StringTypeT = {\n    kind: 'string';\n};\nexport type BooleanTypeT = {\n    kind: 'boolean';\n};\nexport type ColorTypeT = {\n    kind: 'color';\n};\nexport type ProjectionDefinitionTypeT = {\n    kind: 'projectionDefinition';\n};\nexport type ObjectTypeT = {\n    kind: 'object';\n};\nexport type ValueTypeT = {\n    kind: 'value';\n};\nexport type ErrorTypeT = {\n    kind: 'error';\n};\nexport type CollatorTypeT = {\n    kind: 'collator';\n};\nexport type FormattedTypeT = {\n    kind: 'formatted';\n};\nexport type PaddingTypeT = {\n    kind: 'padding';\n};\nexport type NumberArrayTypeT = {\n    kind: 'numberArray';\n};\nexport type ColorArrayTypeT = {\n    kind: 'colorArray';\n};\nexport type ResolvedImageTypeT = {\n    kind: 'resolvedImage';\n};\nexport type VariableAnchorOffsetCollectionTypeT = {\n    kind: 'variableAnchorOffsetCollection';\n};\n\nexport type EvaluationKind = 'constant' | 'source' | 'camera' | 'composite';\n\nexport type Type =\n    | NullTypeT\n    | NumberTypeT\n    | StringTypeT\n    | BooleanTypeT\n    | ColorTypeT\n    | ProjectionDefinitionTypeT\n    | ObjectTypeT\n    | ValueTypeT\n    | ArrayType\n    | ErrorTypeT\n    | CollatorTypeT\n    | FormattedTypeT\n    | PaddingTypeT\n    | NumberArrayTypeT\n    | ColorArrayTypeT\n    | ResolvedImageTypeT\n    | VariableAnchorOffsetCollectionTypeT;\n\nexport interface ArrayType<T extends Type = Type> {\n    kind: 'array';\n    itemType: T;\n    N: number;\n}\n\nexport type NativeType = 'number' | 'string' | 'boolean' | 'null' | 'array' | 'object';\n\nexport const NullType = {kind: 'null'} as NullTypeT;\nexport const NumberType = {kind: 'number'} as NumberTypeT;\nexport const StringType = {kind: 'string'} as StringTypeT;\nexport const BooleanType = {kind: 'boolean'} as BooleanTypeT;\nexport const ColorType = {kind: 'color'} as ColorTypeT;\nexport const ProjectionDefinitionType = {\n    kind: 'projectionDefinition'\n} as ProjectionDefinitionTypeT;\nexport const ObjectType = {kind: 'object'} as ObjectTypeT;\nexport const ValueType = {kind: 'value'} as ValueTypeT;\nexport const ErrorType = {kind: 'error'} as ErrorTypeT;\nexport const CollatorType = {kind: 'collator'} as CollatorTypeT;\nexport const FormattedType = {kind: 'formatted'} as FormattedTypeT;\nexport const PaddingType = {kind: 'padding'} as PaddingTypeT;\nexport const ColorArrayType = {kind: 'colorArray'} as ColorArrayTypeT;\nexport const NumberArrayType = {kind: 'numberArray'} as NumberArrayTypeT;\nexport const ResolvedImageType = {kind: 'resolvedImage'} as ResolvedImageTypeT;\nexport const VariableAnchorOffsetCollectionType = {\n    kind: 'variableAnchorOffsetCollection'\n} as VariableAnchorOffsetCollectionTypeT;\n\nexport function array<T extends Type>(itemType: T, N?: number | null): ArrayType<T> {\n    return {\n        kind: 'array',\n        itemType,\n        N\n    };\n}\n\nexport function typeToString(type: Type): string {\n    if (type.kind === 'array') {\n        const itemType = typeToString(type.itemType);\n        return typeof type.N === 'number'\n            ? `array<${itemType}, ${type.N}>`\n            : type.itemType.kind === 'value'\n              ? 'array'\n              : `array<${itemType}>`;\n    } else {\n        return type.kind;\n    }\n}\n\nconst valueMemberTypes = [\n    NullType,\n    NumberType,\n    StringType,\n    BooleanType,\n    ColorType,\n    ProjectionDefinitionType,\n    FormattedType,\n    ObjectType,\n    array(ValueType),\n    PaddingType,\n    NumberArrayType,\n    ColorArrayType,\n    ResolvedImageType,\n    VariableAnchorOffsetCollectionType\n];\n\n/**\n * Returns null if `t` is a subtype of `expected`; otherwise returns an\n * error message.\n * @private\n */\nexport function checkSubtype(expected: Type, t: Type): string {\n    if (t.kind === 'error') {\n        // Error is a subtype of every type\n        return null;\n    } else if (expected.kind === 'array') {\n        if (\n            t.kind === 'array' &&\n            ((t.N === 0 && t.itemType.kind === 'value') ||\n                !checkSubtype(expected.itemType, t.itemType)) &&\n            (typeof expected.N !== 'number' || expected.N === t.N)\n        ) {\n            return null;\n        }\n    } else if (expected.kind === t.kind) {\n        return null;\n    } else if (expected.kind === 'value') {\n        for (const memberType of valueMemberTypes) {\n            if (!checkSubtype(memberType, t)) {\n                return null;\n            }\n        }\n    }\n\n    return `Expected ${typeToString(expected)} but found ${typeToString(t)} instead.`;\n}\n\nexport function isValidType(provided: Type, allowedTypes: Array<Type>): boolean {\n    return allowedTypes.some((t) => t.kind === provided.kind);\n}\n\nexport function isValidNativeType(provided: any, allowedTypes: Array<NativeType>): boolean {\n    return allowedTypes.some((t) => {\n        if (t === 'null') {\n            return provided === null;\n        } else if (t === 'array') {\n            return Array.isArray(provided);\n        } else if (t === 'object') {\n            return provided && !Array.isArray(provided) && typeof provided === 'object';\n        } else {\n            return t === typeof provided;\n        }\n    });\n}\n\n/**\n * Verify whether the specified type is of the same type as the specified sample.\n *\n * @param provided Type to verify\n * @param sample Sample type to reference\n * @returns `true` if both objects are of the same type, `false` otherwise\n * @example basic types\n * if (verifyType(outputType, ValueType)) {\n *     // type narrowed to:\n *     outputType.kind; // 'value'\n * }\n * @example array types\n * if (verifyType(outputType, array(NumberType))) {\n *     // type narrowed to:\n *     outputType.kind; // 'array'\n *     outputType.itemType; // NumberTypeT\n *     outputType.itemType.kind; // 'number'\n * }\n */\nexport function verifyType<T extends Type>(provided: Type, sample: T): provided is T {\n    if (provided.kind === 'array' && sample.kind === 'array') {\n        return provided.itemType.kind === sample.itemType.kind && typeof provided.N === 'number';\n    }\n    return provided.kind === sample.kind;\n}\n","/**\n * @param r Red component 0..1\n * @param g Green component 0..1\n * @param b Blue component 0..1\n * @param alpha Alpha component 0..1\n */\nexport type RGBColor = [r: number, g: number, b: number, alpha: number];\n\n/**\n * @param h Hue as degrees 0..360\n * @param s Saturation as percentage 0..100\n * @param l Lightness as percentage 0..100\n * @param alpha Alpha component 0..1\n */\nexport type HSLColor = [h: number, s: number, l: number, alpha: number];\n\n/**\n * @param h Hue as degrees 0..360\n * @param c Chroma 0..~230\n * @param l Lightness as percentage 0..100\n * @param alpha Alpha component 0..1\n */\nexport type HCLColor = [h: number, c: number, l: number, alpha: number];\n\n/**\n * @param l Lightness as percentage 0..100\n * @param a A axis value -125..125\n * @param b B axis value -125..125\n * @param alpha Alpha component 0..1\n */\nexport type LABColor = [l: number, a: number, b: number, alpha: number];\n\n/**\n * @param l Lightness 0..1\n * @param c Chroma 0..~0.4\n * @param h Hue as degrees 0..360, `NaN` when missing\n * @param alpha Alpha component 0..1\n */\nexport type OKLCHColor = [l: number, c: number, h: number, alpha: number];\n\n/**\n * @param l Lightness 0..1\n * @param a A axis value -0.4..0.4\n * @param b B axis value -0.4..0.4\n * @param alpha Alpha component 0..1\n */\nexport type OKLABColor = [l: number, a: number, b: number, alpha: number];\n\n/**\n * @param r Red component 0..1\n * @param g Green component 0..1\n * @param b Blue component 0..1\n * @param alpha Alpha component 0..1\n */\nexport type DisplayP3Color = [r: number, g: number, b: number, alpha: number];\n\n// See https://observablehq.com/@mbostock/lab-and-rgb\nconst Xn = 0.96422,\n    Yn = 1,\n    Zn = 0.82521,\n    t0 = 4 / 29,\n    t1 = 6 / 29,\n    t2 = 3 * t1 * t1,\n    t3 = t1 * t1 * t1,\n    deg2rad = Math.PI / 180,\n    rad2deg = 180 / Math.PI;\n\nfunction constrainAngle(angle: number): number {\n    angle = angle % 360;\n    if (angle < 0) {\n        angle += 360;\n    }\n    return angle;\n}\n\nexport function rgbToLab([r, g, b, alpha]: RGBColor): LABColor {\n    r = rgb2xyz(r);\n    g = rgb2xyz(g);\n    b = rgb2xyz(b);\n    let x, z;\n    const y = xyz2lab((0.2225045 * r + 0.7168786 * g + 0.0606169 * b) / Yn);\n    if (r === g && g === b) {\n        x = z = y;\n    } else {\n        x = xyz2lab((0.4360747 * r + 0.3850649 * g + 0.1430804 * b) / Xn);\n        z = xyz2lab((0.0139322 * r + 0.0971045 * g + 0.7141733 * b) / Zn);\n    }\n\n    const l = 116 * y - 16;\n    return [l, 500 * (x - y), 200 * (y - z), alpha];\n}\n\nfunction rgb2xyz(x: number): number {\n    const abs = Math.abs(x);\n    return abs <= 0.04045 ? x / 12.92 : Math.sign(x) * Math.pow((abs + 0.055) / 1.055, 2.4);\n}\n\nfunction xyz2lab(t: number): number {\n    return t > t3 ? Math.pow(t, 1 / 3) : t / t2 + t0;\n}\n\nexport function labToRgb([l, a, b, alpha]: LABColor): RGBColor {\n    let y = (l + 16) / 116,\n        x = isNaN(a) ? y : y + a / 500,\n        z = isNaN(b) ? y : y - b / 200;\n\n    y = Yn * lab2xyz(y);\n    x = Xn * lab2xyz(x);\n    z = Zn * lab2xyz(z);\n\n    return [\n        xyz2rgb(3.1338561 * x - 1.6168667 * y - 0.4906146 * z), // D50 -> sRGB\n        xyz2rgb(-0.9787684 * x + 1.9161415 * y + 0.033454 * z),\n        xyz2rgb(0.0719453 * x - 0.2289914 * y + 1.4052427 * z),\n        alpha\n    ];\n}\n\nfunction xyz2rgb(x: number): number {\n    const abs = Math.abs(x);\n    return abs <= 0.00304 ? 12.92 * x : Math.sign(x) * (1.055 * Math.pow(abs, 1 / 2.4) - 0.055);\n}\n\nfunction lab2xyz(t: number): number {\n    return t > t1 ? t * t * t : t2 * (t - t0);\n}\n\nexport function rgbToHcl(rgbColor: RGBColor): HCLColor {\n    const [l, a, b, alpha] = rgbToLab(rgbColor);\n    const c = Math.sqrt(a * a + b * b);\n    const h = Math.round(c * 10000) ? constrainAngle(Math.atan2(b, a) * rad2deg) : NaN;\n    return [h, c, l, alpha];\n}\n\nexport function hclToRgb([h, c, l, alpha]: HCLColor): RGBColor {\n    h = isNaN(h) ? 0 : h * deg2rad;\n    return labToRgb([l, Math.cos(h) * c, Math.sin(h) * c, alpha]);\n}\n\n// https://drafts.csswg.org/css-color-4/#hsl-to-rgb\nexport function hslToRgb([h, s, l, alpha]: HSLColor): RGBColor {\n    h = constrainAngle(h);\n    s /= 100;\n    l /= 100;\n\n    function f(n) {\n        const k = (n + h / 30) % 12;\n        const a = s * Math.min(l, 1 - l);\n        return l - a * Math.max(-1, Math.min(k - 3, 9 - k, 1));\n    }\n\n    return [f(0), f(8), f(4), alpha];\n}\n\ntype Vector3 = [number, number, number];\ntype Matrix3 = [Vector3, Vector3, Vector3];\n\n// The matrices of https://drafts.csswg.org/css-color-4/#color-conversion-code\nconst linearSrgbToXyz: Matrix3 = [\n    [506752 / 1228815, 87881 / 245763, 12673 / 70218],\n    [87098 / 409605, 175762 / 245763, 12673 / 175545],\n    [7918 / 409605, 87881 / 737289, 1001167 / 1053270]\n];\nconst xyzToLinearSrgb: Matrix3 = [\n    [12831 / 3959, -329 / 214, -1974 / 3959],\n    [-851781 / 878810, 1648619 / 878810, 36519 / 878810],\n    [705 / 12673, -2585 / 12673, 705 / 667]\n];\nconst xyzToLms: Matrix3 = [\n    [0.819022437996703, 0.3619062600528904, -0.1288737815209879],\n    [0.0329836539323885, 0.9292868615863434, 0.0361446663506424],\n    [0.0481771893596242, 0.2642395317527308, 0.6335478284694309]\n];\nconst lmsToOklab: Matrix3 = [\n    [0.210454268309314, 0.7936177747023054, -0.0040720430116193],\n    [1.9779985324311684, -2.4285922420485799, 0.450593709617411],\n    [0.0259040424655478, 0.7827717124575296, -0.8086757549230774]\n];\nconst oklabToLms: Matrix3 = [\n    [1, 0.3963377773761749, 0.2158037573099136],\n    [1, -0.1055613458156586, -0.0638541728258133],\n    [1, -0.0894841775298119, -1.2914855480194092]\n];\nconst lmsToXyz: Matrix3 = [\n    [1.2268798758459243, -0.5578149944602171, 0.2813910456659647],\n    [-0.0405757452148008, 1.112286803280317, -0.0717110580655164],\n    [-0.0763729366746601, -0.4214933324022432, 1.5869240198367816]\n];\n\nfunction multiply(m: Matrix3, [x, y, z]: Vector3): Vector3 {\n    return [\n        m[0][0] * x + m[0][1] * y + m[0][2] * z,\n        m[1][0] * x + m[1][1] * y + m[1][2] * z,\n        m[2][0] * x + m[2][1] * y + m[2][2] * z\n    ];\n}\n\nfunction linearToSrgb(x: number): number {\n    const abs = Math.abs(x);\n    return abs > 0.0031308 ? Math.sign(x) * (1.055 * Math.pow(abs, 1 / 2.4) - 0.055) : 12.92 * x;\n}\n\nfunction srgbToOklab([r, g, b]: Vector3): Vector3 {\n    const [l, m, s] = multiply(\n        xyzToLms,\n        multiply(linearSrgbToXyz, [rgb2xyz(r), rgb2xyz(g), rgb2xyz(b)])\n    );\n    return multiply(lmsToOklab, [Math.cbrt(l), Math.cbrt(m), Math.cbrt(s)]);\n}\n\nfunction oklabToSrgb(lab: Vector3): Vector3 {\n    const [l, m, s] = multiply(oklabToLms, lab);\n    const [r, g, b] = multiply(\n        xyzToLinearSrgb,\n        multiply(lmsToXyz, [l * l * l, m * m * m, s * s * s])\n    );\n    return [linearToSrgb(r), linearToSrgb(g), linearToSrgb(b)];\n}\n\nexport function rgbToOklab([r, g, b, alpha]: RGBColor): OKLABColor {\n    const [l, okA, okB] = srgbToOklab([r, g, b]);\n    return [l, okA, okB, alpha];\n}\n\n// A hue is powerless, and missing, at a chroma of at most 0.000004: https://drafts.csswg.org/css-color-4/#powerless\nexport function rgbToOklch([r, g, b, alpha]: RGBColor): OKLCHColor {\n    const [l, okA, okB] = srgbToOklab([r, g, b]);\n    const c = Math.sqrt(okA * okA + okB * okB);\n    if (c <= 0.000004) {\n        return [l, 0, NaN, alpha];\n    }\n    return [l, c, constrainAngle(Math.atan2(okB, okA) * rad2deg), alpha];\n}\n\n// Keeps the conversion finite: past this chroma, the clipped color stops changing\nconst maxChroma = 1e6;\n\n// A color outside sRGB keeps its channels outside 0..1\nexport function oklchToRgb([l, c, h, alpha]: OKLCHColor): RGBColor {\n    const hue = isNaN(h) ? 0 : h * deg2rad;\n    const chroma = Math.min(c, maxChroma);\n    const [r, g, b] = oklabToSrgb([l, chroma * Math.cos(hue), chroma * Math.sin(hue)]);\n    return [r, g, b, alpha];\n}\n\nexport function oklabToRgb([l, a, b, alpha]: OKLABColor): RGBColor {\n    return oklchToRgb([l, Math.hypot(a, b), Math.atan2(b, a) * rad2deg, alpha]);\n}\n\nconst linearDisplayP3ToXyz: Matrix3 = [\n    [608311 / 1250200, 189793 / 714400, 198249 / 1000160],\n    [35783 / 156275, 247089 / 357200, 198249 / 2500400],\n    [0, 32229 / 714400, 5220557 / 5000800]\n];\nconst xyzToLinearDisplayP3: Matrix3 = [\n    [446124 / 178915, -333277 / 357830, -72051 / 178915],\n    [-14852 / 17905, 63121 / 35810, 423 / 17905],\n    [11844 / 330415, -50337 / 660830, 316169 / 330415]\n];\n\n// Keeps the conversion finite: past this component, the clipped color stops changing\nconst maxDisplayP3Component = 1e6;\n\n// Display P3 shares sRGB's transfer function: https://drafts.csswg.org/css-color-4/#predefined-display-p3\nexport function displayP3ToRgb([r, g, b, alpha]: DisplayP3Color): RGBColor {\n    const [lr, lg, lb] = [r, g, b].map((x) =>\n        rgb2xyz(Math.min(Math.max(x, -maxDisplayP3Component), maxDisplayP3Component))\n    );\n    const linear = multiply(xyzToLinearSrgb, multiply(linearDisplayP3ToXyz, [lr, lg, lb]));\n    const [sr, sg, sb] = linear.map(linearToSrgb);\n    return [sr, sg, sb, alpha];\n}\n\n// Clips a color outside Display P3 channel by channel, as browsers draw one\nexport function rgbToDisplayP3([r, g, b, alpha]: RGBColor): DisplayP3Color {\n    const linear = multiply(\n        xyzToLinearDisplayP3,\n        multiply(linearSrgbToXyz, [rgb2xyz(r), rgb2xyz(g), rgb2xyz(b)])\n    );\n    const [pr, pg, pb] = linear.map((x) => Math.min(Math.max(linearToSrgb(x), 0), 1));\n    return [pr, pg, pb, alpha];\n}\n","type HasOwnPropertyFn = <TObject extends object>(\n    obj: TObject,\n    key: PropertyKey\n) => key is keyof TObject;\n\n// polyfill for Object.hasOwn\nconst hasOwnProperty: HasOwnPropertyFn =\n    (Object.hasOwn as HasOwnPropertyFn) ||\n    function hasOwnProperty<T extends object>(object: T, key: PropertyKey): key is keyof T {\n        return Object.prototype.hasOwnProperty.call(object, key);\n    };\n\nexport function getOwn<T extends object>(object: T, key: PropertyKey): T[keyof T] | undefined {\n    return hasOwnProperty(object, key) ? object[key] : undefined;\n}\n","import {getOwn} from '../../util/get_own';\nimport {displayP3ToRgb, HSLColor, hslToRgb, oklabToRgb, oklchToRgb, RGBColor} from './color_spaces';\n\n/**\n * CSS color parser compliant with CSS Color 4 Specification.\n * Supports: named colors, `transparent` keyword, all rgb hex notations,\n * rgb(), rgba(), hsl(), hsla(), oklch() and oklab() functions, and color() in Display P3.\n * Does not round the parsed values to integers from the range 0..255.\n *\n * Syntax:\n *\n * <alpha-value> = <number> | <percentage>\n *         <hue> = <number> | <angle>\n *\n *         rgb() = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <number>{3} [ / <alpha-value> ]? )\n *         rgb() = rgb( <percentage>#{3} , <alpha-value>? )    | rgb( <number>#{3} , <alpha-value>? )\n *\n *         hsl() = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? )\n *         hsl() = hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )\n *\n *       oklch() = oklch( [ <percentage> | <number> | none ]{2} [ <hue> | none ] [ / [ <alpha-value> | none ] ]? )\n *\n *       oklab() = oklab( [ <percentage> | <number> | none ]{3} [ / [ <alpha-value> | none ] ]? )\n *\n *       color() = color( display-p3 [ <percentage> | <number> | none ]{3} [ / [ <alpha-value> | none ] ]? )\n *\n * Caveats:\n *   - in rgb() and hsl(), <angle> - <number> with optional `deg` suffix; `grad`, `rad`, `turn` are not supported\n *   - in rgb() and hsl(), `none` keyword is not supported\n *   - a color outside sRGB keeps its red, green and blue outside 0..1\n *   - color() supports only the display-p3 color space\n *   - comments inside rgb()/hsl()/oklch()/oklab()/color() are not supported\n *   - legacy color syntax rgba() is supported with an identical grammar and behavior to rgb()\n *   - legacy color syntax hsla() is supported with an identical grammar and behavior to hsl()\n *\n * @param input CSS color string to parse.\n * @returns Color in sRGB color space, with `red`, `green`, `blue`\n * and `alpha` channels normalized to the range 0..1 (outside it for a color outside sRGB),\n * or `undefined` if the input is not a valid color string.\n */\nexport function parseCssColor(input: string): RGBColor | undefined {\n    input = input.toLowerCase().trim();\n\n    if (input === 'transparent') {\n        return [0, 0, 0, 0];\n    }\n\n    // 'white', 'black', 'blue'\n    const namedColorsMatch = getOwn(namedColors, input);\n    if (namedColorsMatch) {\n        const [r, g, b] = namedColorsMatch;\n        return [r / 255, g / 255, b / 255, 1];\n    }\n\n    // #f0c, #f0cf, #ff00cc, #ff00ccff\n    if (input.startsWith('#')) {\n        const hexRegexp = /^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/;\n        if (hexRegexp.test(input)) {\n            const step = input.length < 6 ? 1 : 2;\n            let i = 1;\n            return [\n                parseHex(input.slice(i, (i += step))),\n                parseHex(input.slice(i, (i += step))),\n                parseHex(input.slice(i, (i += step))),\n                parseHex(input.slice(i, i + step) || 'ff')\n            ];\n        }\n    }\n\n    // rgb(128 0 0), rgb(50% 0% 0%), rgba(255,0,255,0.6), rgb(255 0 255 / 60%), rgb(100% 0% 100% /.6)\n    if (input.startsWith('rgb')) {\n        const rgbRegExp =\n            /^rgba?\\(\\s*([\\de.+-]+)(%)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)(%)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)(%)?(?:\\s*([,\\/])\\s*([\\de.+-]+)(%)?)?\\s*\\)$/;\n        const rgbMatch = input.match(rgbRegExp);\n        if (rgbMatch) {\n            const [\n                _, // eslint-disable-line @typescript-eslint/no-unused-vars\n                r, // <numeric>\n                rp, // %         (optional)\n                f1, // ,         (optional)\n                g, // <numeric>\n                gp, // %         (optional)\n                f2, // ,         (optional)\n                b, // <numeric>\n                bp, // %         (optional)\n                f3, // ,|/       (optional)\n                a, // <numeric> (optional)\n                ap // %         (optional)\n            ] = rgbMatch;\n\n            const argFormat = [f1 || ' ', f2 || ' ', f3].join('');\n            if (\n                argFormat === '  ' ||\n                argFormat === '  /' ||\n                argFormat === ',,' ||\n                argFormat === ',,,'\n            ) {\n                const valFormat = [rp, gp, bp].join('');\n                const maxValue = valFormat === '%%%' ? 100 : valFormat === '' ? 255 : 0;\n                if (maxValue) {\n                    const rgba: RGBColor = [\n                        clamp(+r / maxValue, 0, 1),\n                        clamp(+g / maxValue, 0, 1),\n                        clamp(+b / maxValue, 0, 1),\n                        a ? parseAlpha(+a, ap) : 1\n                    ];\n                    if (validateNumbers(rgba)) {\n                        return rgba;\n                    }\n                    // invalid numbers\n                }\n                // values must be all numbers or all percentages\n            }\n            return; // comma optional syntax requires no commas at all\n        }\n    }\n\n    // hsl(120 50% 80%), hsla(120deg,50%,80%,.9), hsl(12e1 50% 80% / 90%)\n    const hslRegExp =\n        /^hsla?\\(\\s*([\\de.+-]+)(?:deg)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)%(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)%(?:\\s*([,\\/])\\s*([\\de.+-]+)(%)?)?\\s*\\)$/;\n    const hslMatch = input.match(hslRegExp);\n    if (hslMatch) {\n        const [\n            _, // eslint-disable-line @typescript-eslint/no-unused-vars\n            h, // <numeric>\n            f1, // ,         (optional)\n            s, // <numeric>\n            f2, // ,         (optional)\n            l, // <numeric>\n            f3, // ,|/       (optional)\n            a, // <numeric> (optional)\n            ap // %         (optional)\n        ] = hslMatch;\n\n        const argFormat = [f1 || ' ', f2 || ' ', f3].join('');\n        if (\n            argFormat === '  ' ||\n            argFormat === '  /' ||\n            argFormat === ',,' ||\n            argFormat === ',,,'\n        ) {\n            const hsla: HSLColor = [\n                +h,\n                clamp(+s, 0, 100),\n                clamp(+l, 0, 100),\n                a ? parseAlpha(+a, ap) : 1\n            ];\n            if (validateNumbers(hsla)) {\n                return hslToRgb(hsla);\n            }\n            // invalid numbers\n        }\n        // comma optional syntax requires no commas at all\n    }\n\n    // oklch(62.8% 0.258 29.23), oklch(0.7 40% 0.5turn / 50%), oklch(70% 0 none)\n    const oklchMatch = input.match(oklchRegExp);\n    if (oklchMatch) {\n        const [, l, c, h, a] = oklchMatch;\n        const oklch = [\n            parseColorArgument(l, 1),\n            parseColorArgument(c, 0.4),\n            parseColorArgument(h, 1),\n            a === undefined ? 1 : parseColorArgument(a, 1)\n        ];\n        if (oklch.every(Number.isFinite)) {\n            return oklchToRgb([\n                clamp(oklch[0], 0, 1),\n                Math.max(oklch[1], 0),\n                oklch[2] % 360,\n                clamp(oklch[3], 0, 1)\n            ]);\n        }\n    }\n\n    // oklab(62.8% 0.225 0.126), oklab(0.7 -40% 20% / 50%), oklab(70% none none)\n    const oklabMatch = input.match(oklabRegExp);\n    if (oklabMatch) {\n        const [, l, a, b, alpha] = oklabMatch;\n        const oklab = [\n            parseColorArgument(l, 1),\n            parseColorArgument(a, 0.4),\n            parseColorArgument(b, 0.4),\n            alpha === undefined ? 1 : parseColorArgument(alpha, 1)\n        ];\n        if (oklab.every(Number.isFinite)) {\n            return oklabToRgb([clamp(oklab[0], 0, 1), oklab[1], oklab[2], clamp(oklab[3], 0, 1)]);\n        }\n    }\n\n    // color(display-p3 1 0.5 0), color(display-p3 100% 50% 0% / 50%), color(display-p3 1 none 0)\n    const displayP3Match = input.match(displayP3RegExp);\n    if (displayP3Match) {\n        const [, r, g, b, alpha] = displayP3Match;\n        const p3 = [\n            parseColorArgument(r, 1),\n            parseColorArgument(g, 1),\n            parseColorArgument(b, 1),\n            alpha === undefined ? 1 : parseColorArgument(alpha, 1)\n        ];\n        if (p3.every(Number.isFinite)) {\n            return displayP3ToRgb([p3[0], p3[1], p3[2], clamp(p3[3], 0, 1)]);\n        }\n    }\n}\n\nconst cssNumber = '[+-]?(?:\\\\d+(?:\\\\.\\\\d+)?|\\\\.\\\\d+)(?:e[+-]?\\\\d+)?';\nconst oklchRegExp = new RegExp(\n    `^oklch\\\\(\\\\s*(none|${cssNumber}%?)\\\\s+(none|${cssNumber}%?)\\\\s+(none|${cssNumber}(?:deg|grad|rad|turn)?)\\\\s*(?:\\\\/\\\\s*(none|${cssNumber}%?)\\\\s*)?\\\\)$`\n);\nconst oklabRegExp = new RegExp(\n    `^oklab\\\\(\\\\s*(none|${cssNumber}%?)\\\\s+(none|${cssNumber}%?)\\\\s+(none|${cssNumber}%?)\\\\s*(?:\\\\/\\\\s*(none|${cssNumber}%?)\\\\s*)?\\\\)$`\n);\nconst displayP3RegExp = new RegExp(\n    `^color\\\\(\\\\s*display-p3\\\\s+(none|${cssNumber}%?)\\\\s+(none|${cssNumber}%?)\\\\s+(none|${cssNumber}%?)\\\\s*(?:\\\\/\\\\s*(none|${cssNumber}%?)\\\\s*)?\\\\)$`\n);\n\nconst degreesPerUnit: Record<string, number> = {deg: 1, grad: 0.9, rad: 180 / Math.PI, turn: 360};\n\n/**\n * @param argument `none`, a number, or a number with a `%` or angle unit.\n * @param percentReference The value of `100%`.\n * @returns The value, in degrees within one turn for an angle with a unit, or `0` for `none`.\n */\nfunction parseColorArgument(argument: string, percentReference: number): number {\n    if (argument === 'none') {\n        return 0;\n    }\n    const [, value, unit] = argument.match(/^(.+?)(%|[a-z]+)?$/);\n    if (unit === '%') {\n        return (+value / 100) * percentReference;\n    }\n    return unit ? (+value % (360 / degreesPerUnit[unit])) * degreesPerUnit[unit] : +value;\n}\n\nfunction parseHex(hex: string): number {\n    return parseInt(hex.padEnd(2, hex), 16) / 255;\n}\n\nfunction parseAlpha(a: number, asPercentage: string | undefined): number {\n    return clamp(asPercentage ? a / 100 : a, 0, 1);\n}\n\nfunction clamp(n: number, min: number, max: number): number {\n    return Math.min(Math.max(min, n), max);\n}\n\n/**\n * The regular expression for numeric values is not super specific, and it may\n * happen that it will accept a value that is not a valid number. In order to\n * detect and eliminate such values this function exists.\n *\n * @param array Array of uncertain numbers.\n * @returns `true` if the specified array contains only valid numbers, `false` otherwise.\n */\nfunction validateNumbers(array: number[]): boolean {\n    return !array.some(Number.isNaN);\n}\n\n/**\n * To generate:\n * - visit {@link https://www.w3.org/TR/css-color-4/#named-colors}\n * - run in the console:\n * @example\n * copy(`{\\n${[...document.querySelector('.named-color-table tbody').children].map((tr) => `${tr.cells[2].textContent.trim()}: [${tr.cells[4].textContent.trim().split(/\\s+/).join(', ')}],`).join('\\n')}\\n}`);\n */\nconst namedColors: Record<string, [number, number, number]> = {\n    aliceblue: [240, 248, 255],\n    antiquewhite: [250, 235, 215],\n    aqua: [0, 255, 255],\n    aquamarine: [127, 255, 212],\n    azure: [240, 255, 255],\n    beige: [245, 245, 220],\n    bisque: [255, 228, 196],\n    black: [0, 0, 0],\n    blanchedalmond: [255, 235, 205],\n    blue: [0, 0, 255],\n    blueviolet: [138, 43, 226],\n    brown: [165, 42, 42],\n    burlywood: [222, 184, 135],\n    cadetblue: [95, 158, 160],\n    chartreuse: [127, 255, 0],\n    chocolate: [210, 105, 30],\n    coral: [255, 127, 80],\n    cornflowerblue: [100, 149, 237],\n    cornsilk: [255, 248, 220],\n    crimson: [220, 20, 60],\n    cyan: [0, 255, 255],\n    darkblue: [0, 0, 139],\n    darkcyan: [0, 139, 139],\n    darkgoldenrod: [184, 134, 11],\n    darkgray: [169, 169, 169],\n    darkgreen: [0, 100, 0],\n    darkgrey: [169, 169, 169],\n    darkkhaki: [189, 183, 107],\n    darkmagenta: [139, 0, 139],\n    darkolivegreen: [85, 107, 47],\n    darkorange: [255, 140, 0],\n    darkorchid: [153, 50, 204],\n    darkred: [139, 0, 0],\n    darksalmon: [233, 150, 122],\n    darkseagreen: [143, 188, 143],\n    darkslateblue: [72, 61, 139],\n    darkslategray: [47, 79, 79],\n    darkslategrey: [47, 79, 79],\n    darkturquoise: [0, 206, 209],\n    darkviolet: [148, 0, 211],\n    deeppink: [255, 20, 147],\n    deepskyblue: [0, 191, 255],\n    dimgray: [105, 105, 105],\n    dimgrey: [105, 105, 105],\n    dodgerblue: [30, 144, 255],\n    firebrick: [178, 34, 34],\n    floralwhite: [255, 250, 240],\n    forestgreen: [34, 139, 34],\n    fuchsia: [255, 0, 255],\n    gainsboro: [220, 220, 220],\n    ghostwhite: [248, 248, 255],\n    gold: [255, 215, 0],\n    goldenrod: [218, 165, 32],\n    gray: [128, 128, 128],\n    green: [0, 128, 0],\n    greenyellow: [173, 255, 47],\n    grey: [128, 128, 128],\n    honeydew: [240, 255, 240],\n    hotpink: [255, 105, 180],\n    indianred: [205, 92, 92],\n    indigo: [75, 0, 130],\n    ivory: [255, 255, 240],\n    khaki: [240, 230, 140],\n    lavender: [230, 230, 250],\n    lavenderblush: [255, 240, 245],\n    lawngreen: [124, 252, 0],\n    lemonchiffon: [255, 250, 205],\n    lightblue: [173, 216, 230],\n    lightcoral: [240, 128, 128],\n    lightcyan: [224, 255, 255],\n    lightgoldenrodyellow: [250, 250, 210],\n    lightgray: [211, 211, 211],\n    lightgreen: [144, 238, 144],\n    lightgrey: [211, 211, 211],\n    lightpink: [255, 182, 193],\n    lightsalmon: [255, 160, 122],\n    lightseagreen: [32, 178, 170],\n    lightskyblue: [135, 206, 250],\n    lightslategray: [119, 136, 153],\n    lightslategrey: [119, 136, 153],\n    lightsteelblue: [176, 196, 222],\n    lightyellow: [255, 255, 224],\n    lime: [0, 255, 0],\n    limegreen: [50, 205, 50],\n    linen: [250, 240, 230],\n    magenta: [255, 0, 255],\n    maroon: [128, 0, 0],\n    mediumaquamarine: [102, 205, 170],\n    mediumblue: [0, 0, 205],\n    mediumorchid: [186, 85, 211],\n    mediumpurple: [147, 112, 219],\n    mediumseagreen: [60, 179, 113],\n    mediumslateblue: [123, 104, 238],\n    mediumspringgreen: [0, 250, 154],\n    mediumturquoise: [72, 209, 204],\n    mediumvioletred: [199, 21, 133],\n    midnightblue: [25, 25, 112],\n    mintcream: [245, 255, 250],\n    mistyrose: [255, 228, 225],\n    moccasin: [255, 228, 181],\n    navajowhite: [255, 222, 173],\n    navy: [0, 0, 128],\n    oldlace: [253, 245, 230],\n    olive: [128, 128, 0],\n    olivedrab: [107, 142, 35],\n    orange: [255, 165, 0],\n    orangered: [255, 69, 0],\n    orchid: [218, 112, 214],\n    palegoldenrod: [238, 232, 170],\n    palegreen: [152, 251, 152],\n    paleturquoise: [175, 238, 238],\n    palevioletred: [219, 112, 147],\n    papayawhip: [255, 239, 213],\n    peachpuff: [255, 218, 185],\n    peru: [205, 133, 63],\n    pink: [255, 192, 203],\n    plum: [221, 160, 221],\n    powderblue: [176, 224, 230],\n    purple: [128, 0, 128],\n    rebeccapurple: [102, 51, 153],\n    red: [255, 0, 0],\n    rosybrown: [188, 143, 143],\n    royalblue: [65, 105, 225],\n    saddlebrown: [139, 69, 19],\n    salmon: [250, 128, 114],\n    sandybrown: [244, 164, 96],\n    seagreen: [46, 139, 87],\n    seashell: [255, 245, 238],\n    sienna: [160, 82, 45],\n    silver: [192, 192, 192],\n    skyblue: [135, 206, 235],\n    slateblue: [106, 90, 205],\n    slategray: [112, 128, 144],\n    slategrey: [112, 128, 144],\n    snow: [255, 250, 250],\n    springgreen: [0, 255, 127],\n    steelblue: [70, 130, 180],\n    tan: [210, 180, 140],\n    teal: [0, 128, 128],\n    thistle: [216, 191, 216],\n    tomato: [255, 99, 71],\n    turquoise: [64, 224, 208],\n    violet: [238, 130, 238],\n    wheat: [245, 222, 179],\n    white: [255, 255, 255],\n    whitesmoke: [245, 245, 245],\n    yellow: [255, 255, 0],\n    yellowgreen: [154, 205, 50]\n};\n","export function interpolateNumber(from: number, to: number, t: number): number {\n    return from + t * (to - from);\n}\n\nexport function interpolateArray<T extends number[]>(from: T, to: T, t: number): T {\n    return from.map((d, i) => {\n        return interpolateNumber(d, to[i], t);\n    }) as T;\n}\n","import {\n    DisplayP3Color,\n    HCLColor,\n    hclToRgb,\n    LABColor,\n    labToRgb,\n    OKLABColor,\n    oklabToRgb,\n    OKLCHColor,\n    oklchToRgb,\n    RGBColor,\n    rgbToDisplayP3,\n    rgbToHcl,\n    rgbToLab,\n    rgbToOklab,\n    rgbToOklch\n} from './color_spaces';\nimport {parseCssColor} from './parse_css_color';\nimport {interpolateArray, interpolateNumber} from '../../util/interpolate-primitives';\n\nexport type InterpolationColorSpace = 'rgb' | 'hcl' | 'lab' | 'oklch' | 'oklab';\n\n/**\n * Checks whether the specified color space is one of the supported interpolation color spaces.\n *\n * @param colorSpace Color space key to verify.\n * @returns `true` if the specified color space is one of the supported\n * interpolation color spaces, `false` otherwise\n */\nexport function isSupportedInterpolationColorSpace(\n    colorSpace: string\n): colorSpace is InterpolationColorSpace {\n    return (\n        colorSpace === 'rgb' ||\n        colorSpace === 'hcl' ||\n        colorSpace === 'lab' ||\n        colorSpace === 'oklch' ||\n        colorSpace === 'oklab'\n    );\n}\n\n/**\n * Color representation used by WebGL.\n * Defined in sRGB color space and pre-blended with alpha.\n * A color outside sRGB is clipped to it channel by channel, and keeps its\n * unclipped value for `displayP3` and color interpolation.\n * @private\n */\nexport class Color {\n    readonly r: number;\n    readonly g: number;\n    readonly b: number;\n    readonly a: number;\n\n    /**\n     * @param r Red component premultiplied by `alpha` 0..1\n     * @param g Green component premultiplied by `alpha` 0..1\n     * @param b Blue component premultiplied by `alpha` 0..1\n     * @param [alpha=1] Alpha component 0..1\n     * @param [premultiplied=true] Whether the `r`, `g` and `b` values have already\n     * been multiplied by alpha. If `true` nothing happens if `false` then they will\n     * be multiplied automatically.\n     */\n    constructor(r: number, g: number, b: number, alpha = 1, premultiplied = true) {\n        if (!premultiplied && (Math.min(r, g, b) < 0 || Math.max(r, g, b) > 1)) {\n            this.overwriteGetter('unclippedRgb', [r, g, b, alpha]);\n            r = Math.min(Math.max(r, 0), 1);\n            g = Math.min(Math.max(g, 0), 1);\n            b = Math.min(Math.max(b, 0), 1);\n        }\n        this.r = r;\n        this.g = g;\n        this.b = b;\n        this.a = alpha;\n\n        if (!premultiplied) {\n            this.r *= alpha;\n            this.g *= alpha;\n            this.b *= alpha;\n\n            if (!alpha) {\n                // alpha = 0 erases completely rgb channels. This behavior is not desirable\n                // if this particular color is later used in color interpolation.\n                // Because of that, a reference to original color is saved.\n                this.overwriteGetter('rgb', [r, g, b, alpha]);\n            }\n        }\n    }\n\n    static black = new Color(0, 0, 0, 1);\n    static white = new Color(1, 1, 1, 1);\n    static transparent = new Color(0, 0, 0, 0);\n    static red = new Color(1, 0, 0, 1);\n\n    /**\n     * Parses CSS color strings and converts colors to sRGB color space if needed.\n     * Officially supported color formats:\n     * - keyword, e.g. 'aquamarine' or 'steelblue'\n     * - hex (with 3, 4, 6 or 8 digits), e.g. '#f0f' or '#e9bebea9'\n     * - rgb and rgba, e.g. 'rgb(0,240,120)' or 'rgba(0%,94%,47%,0.1)' or 'rgb(0 240 120 / .3)'\n     * - hsl and hsla, e.g. 'hsl(0,0%,83%)' or 'hsla(0,0%,83%,.5)' or 'hsl(0 0% 83% / 20%)'\n     * - oklch, e.g. 'oklch(62.8% 0.258 29.23)' or 'oklch(0.7 40% 0.5turn / 50%)'\n     * - oklab, e.g. 'oklab(62.8% 0.225 0.126)' or 'oklab(0.7 -40% 20% / 50%)'\n     * - display-p3, e.g. 'color(display-p3 1 0.5 0)' or 'color(display-p3 100% 50% 0% / 50%)'\n     *\n     * @param input CSS color string to parse.\n     * @returns A `Color` instance, or `undefined` if the input is not a valid color string.\n     */\n    static parse(input: Color | string | undefined | null): Color | undefined {\n        // in zoom-and-property function input could be an instance of Color class\n        if (input instanceof Color) {\n            return input;\n        }\n\n        if (typeof input !== 'string') {\n            return;\n        }\n\n        const rgba = parseCssColor(input);\n        if (rgba) {\n            return new Color(...rgba, false);\n        }\n    }\n\n    /**\n     * Used by 'to-rgba' expression.\n     *\n     * @returns Gien color, with reversed alpha blending, in sRGB color space.\n     */\n    get rgb(): RGBColor {\n        const {r, g, b, a} = this;\n        const f = a || Infinity; // reverse alpha blending factor\n        return this.overwriteGetter('rgb', [r / f, g / f, b / f, a]);\n    }\n\n    /**\n     * Used in color interpolation.\n     *\n     * @returns Gien color, with reversed alpha blending, in HCL color space.\n     */\n    get hcl(): HCLColor {\n        return this.overwriteGetter('hcl', rgbToHcl(this.unclippedRgb));\n    }\n\n    /**\n     * Used in color interpolation.\n     *\n     * @returns Gien color, with reversed alpha blending, in LAB color space.\n     */\n    get lab(): LABColor {\n        return this.overwriteGetter('lab', rgbToLab(this.unclippedRgb));\n    }\n\n    /**\n     * Used in color interpolation.\n     *\n     * @returns Given color, with reversed alpha blending, in OKLCH color space.\n     */\n    get oklch(): OKLCHColor {\n        return this.overwriteGetter('oklch', rgbToOklch(this.unclippedRgb));\n    }\n\n    /**\n     * Used in color interpolation.\n     *\n     * @returns Given color, with reversed alpha blending, in OKLAB color space.\n     */\n    get oklab(): OKLABColor {\n        return this.overwriteGetter('oklab', rgbToOklab(this.unclippedRgb));\n    }\n\n    /**\n     * Used by a renderer that draws in Display P3.\n     *\n     * @returns Given color, with reversed alpha blending, in Display P3, clipped to it channel by channel.\n     */\n    get displayP3(): DisplayP3Color {\n        return this.overwriteGetter('displayP3', rgbToDisplayP3(this.unclippedRgb));\n    }\n\n    /**\n     * @returns Given color, with reversed alpha blending, in sRGB color space,\n     * with channels outside 0..1 for a color outside sRGB.\n     */\n    private get unclippedRgb(): RGBColor {\n        return this.rgb;\n    }\n\n    /**\n     * Lazy getter pattern. When getter is called for the first time lazy value\n     * is calculated and then overwrites getter function in given object instance.\n     *\n     * @example:\n     * const redColor = Color.parse('red');\n     * let x = redColor.hcl; // this will invoke `get hcl()`, which will calculate\n     * // the value of red in HCL space and invoke this `overwriteGetter` function\n     * // which in turn will set a field with a key 'hcl' in the `redColor` object.\n     * // In other words it will override `get hcl()` from its `Color` prototype\n     * // with its own property: hcl = [calculated red value in hcl].\n     * let y = redColor.hcl; // next call will no longer invoke getter but simply\n     * // return the previously calculated value\n     * x === y; // true - `x` is exactly the same object as `y`\n     *\n     * @param getterKey Getter key\n     * @param lazyValue Lazily calculated value to be memoized by current instance\n     * @private\n     */\n    private overwriteGetter<T>(getterKey: string, lazyValue: T): T {\n        Object.defineProperty(this, getterKey, {value: lazyValue});\n        return lazyValue;\n    }\n\n    /**\n     * Used by 'to-string' expression.\n     *\n     * @returns Serialized color in format `rgba(r,g,b,a)`\n     * where r,g,b are numbers within 0..255 and alpha is number within 1..0\n     *\n     * @example\n     * var purple = new Color.parse('purple');\n     * purple.toString; // = \"rgba(128,0,128,1)\"\n     * var translucentGreen = new Color.parse('rgba(26, 207, 26, .73)');\n     * translucentGreen.toString(); // = \"rgba(26,207,26,0.73)\"\n     */\n    toString(): string {\n        const [r, g, b, a] = this.rgb;\n        return `rgba(${[r, g, b].map((n) => Math.round(n * 255)).join(',')},${a})`;\n    }\n\n    static interpolate(\n        from: Color,\n        to: Color,\n        t: number,\n        spaceKey: InterpolationColorSpace = 'rgb'\n    ): Color {\n        switch (spaceKey) {\n            case 'rgb': {\n                const [r, g, b, alpha] = interpolateArray(from.unclippedRgb, to.unclippedRgb, t);\n                return new Color(r, g, b, alpha, false);\n            }\n            case 'hcl': {\n                const [hue0, chroma0, light0, alphaF] = from.hcl;\n                const [hue1, chroma1, light1, alphaT] = to.hcl;\n\n                // https://github.com/gka/chroma.js/blob/cd1b3c0926c7a85cbdc3b1453b3a94006de91a92/src/interpolator/_hsx.js\n                let hue, chroma;\n\n                if (!isNaN(hue0) && !isNaN(hue1)) {\n                    let dh = hue1 - hue0;\n                    if (hue1 > hue0 && dh > 180) {\n                        dh -= 360;\n                    } else if (hue1 < hue0 && hue0 - hue1 > 180) {\n                        dh += 360;\n                    }\n                    hue = hue0 + t * dh;\n                } else if (!isNaN(hue0)) {\n                    hue = hue0;\n                    if (light1 === 1 || light1 === 0) chroma = chroma0;\n                } else if (!isNaN(hue1)) {\n                    hue = hue1;\n                    if (light0 === 1 || light0 === 0) chroma = chroma1;\n                } else {\n                    hue = NaN;\n                }\n\n                const [r, g, b, alpha] = hclToRgb([\n                    hue,\n                    chroma ?? interpolateNumber(chroma0, chroma1, t),\n                    interpolateNumber(light0, light1, t),\n                    interpolateNumber(alphaF, alphaT, t)\n                ]);\n                return new Color(r, g, b, alpha, false);\n            }\n            case 'lab': {\n                const [r, g, b, alpha] = labToRgb(interpolateArray(from.lab, to.lab, t));\n                return new Color(r, g, b, alpha, false);\n            }\n            case 'oklch': {\n                // https://drafts.csswg.org/css-color-4/#interpolation\n                const [light0, chroma0, h0, alpha0] = from.oklch;\n                const [light1, chroma1, h1, alpha1] = to.oklch;\n                let hue0 = isNaN(h0) ? h1 : h0;\n                let hue1 = isNaN(h1) ? h0 : h1;\n                if (hue1 - hue0 > 180) {\n                    hue0 += 360;\n                } else if (hue1 - hue0 < -180) {\n                    hue1 += 360;\n                }\n                const alpha = interpolateNumber(alpha0, alpha1, t);\n                const divisor = alpha === 0 ? 1 : alpha;\n                const [r, g, b] = oklchToRgb([\n                    interpolateNumber(light0 * alpha0, light1 * alpha1, t) / divisor,\n                    interpolateNumber(chroma0 * alpha0, chroma1 * alpha1, t) / divisor,\n                    interpolateNumber(hue0, hue1, t),\n                    alpha\n                ]);\n                return new Color(r, g, b, alpha, false);\n            }\n            case 'oklab': {\n                // https://drafts.csswg.org/css-color-4/#interpolation\n                const [light0, a0, b0, alpha0] = from.oklab;\n                const [light1, a1, b1, alpha1] = to.oklab;\n                const alpha = interpolateNumber(alpha0, alpha1, t);\n                const divisor = alpha === 0 ? 1 : alpha;\n                const [r, g, b] = oklabToRgb([\n                    interpolateNumber(light0 * alpha0, light1 * alpha1, t) / divisor,\n                    interpolateNumber(a0 * alpha0, a1 * alpha1, t) / divisor,\n                    interpolateNumber(b0 * alpha0, b1 * alpha1, t) / divisor,\n                    alpha\n                ]);\n                return new Color(r, g, b, alpha, false);\n            }\n        }\n    }\n}\n","export class Collator {\n    locale: string | null;\n    sensitivity: 'base' | 'accent' | 'case' | 'variant';\n    collator: Intl.Collator;\n\n    constructor(caseSensitive: boolean, diacriticSensitive: boolean, locale: string | null) {\n        if (caseSensitive) this.sensitivity = diacriticSensitive ? 'variant' : 'case';\n        else this.sensitivity = diacriticSensitive ? 'accent' : 'base';\n\n        this.locale = locale;\n        this.collator = new Intl.Collator(this.locale ? this.locale : [], {\n            sensitivity: this.sensitivity,\n            usage: 'search'\n        });\n    }\n\n    compare(lhs: string, rhs: string): number {\n        return this.collator.compare(lhs, rhs);\n    }\n\n    resolvedLocale(): string {\n        // We create a Collator without \"usage: search\" because we don't want\n        // the search options encoded in our result (e.g. \"en-u-co-search\")\n        return new Intl.Collator(this.locale ? this.locale : []).resolvedOptions().locale;\n    }\n}\n","import type {Color} from '../../expression/types/color';\nimport type {ResolvedImage} from '../types/resolved_image';\n\nexport const VERTICAL_ALIGN_OPTIONS = ['bottom', 'center', 'top'] as const;\nexport type VerticalAlign = (typeof VERTICAL_ALIGN_OPTIONS)[number];\n\nexport class FormattedSection {\n    text: string;\n    image: ResolvedImage | null;\n    scale: number | null;\n    fontStack: string | null;\n    textColor: Color | null;\n    verticalAlign: VerticalAlign | null;\n\n    constructor(\n        text: string,\n        image: ResolvedImage | null,\n        scale: number | null,\n        fontStack: string | null,\n        textColor: Color | null,\n        verticalAlign: VerticalAlign | null\n    ) {\n        this.text = text;\n        this.image = image;\n        this.scale = scale;\n        this.fontStack = fontStack;\n        this.textColor = textColor;\n        this.verticalAlign = verticalAlign;\n    }\n}\n\nexport class Formatted {\n    sections: Array<FormattedSection>;\n\n    constructor(sections: Array<FormattedSection>) {\n        this.sections = sections;\n    }\n\n    static fromString(unformatted: string): Formatted {\n        return new Formatted([new FormattedSection(unformatted, null, null, null, null, null)]);\n    }\n\n    isEmpty(): boolean {\n        if (this.sections.length === 0) return true;\n        return !this.sections.some(\n            (section) =>\n                section.text.length !== 0 || (section.image && section.image.name.length !== 0)\n        );\n    }\n\n    static factory(text: Formatted | string): Formatted {\n        if (text instanceof Formatted) {\n            return text;\n        } else {\n            return Formatted.fromString(text);\n        }\n    }\n\n    toString(): string {\n        if (this.sections.length === 0) return '';\n        return this.sections.map((section) => section.text).join('');\n    }\n}\n","import {interpolateArray} from '../../util/interpolate-primitives';\n\n/**\n * A set of four numbers representing padding around a box. Create instances from\n * bare arrays or numeric values using the static method `Padding.parse`.\n * @private\n */\nexport class Padding {\n    /** Padding values are in CSS order: top, right, bottom, left */\n    values: [number, number, number, number];\n\n    constructor(values: [number, number, number, number]) {\n        this.values = values.slice() as [number, number, number, number];\n    }\n\n    /**\n     * Numeric padding values\n     * @param input A padding value\n     * @returns A `Padding` instance, or `undefined` if the input is not a valid padding value.\n     */\n    static parse(input?: number | number[] | Padding | null): Padding | undefined {\n        if (input instanceof Padding) {\n            return input;\n        }\n\n        // Backwards compatibility: bare number is treated the same as array with single value.\n        // Padding applies to all four sides.\n        if (typeof input === 'number') {\n            return new Padding([input, input, input, input]);\n        }\n\n        if (!Array.isArray(input)) {\n            return undefined;\n        }\n\n        if (input.length < 1 || input.length > 4) {\n            return undefined;\n        }\n\n        for (const val of input) {\n            if (typeof val !== 'number') {\n                return undefined;\n            }\n        }\n\n        // Expand shortcut properties into explicit 4-sided values\n        switch (input.length) {\n            case 1:\n                input = [input[0], input[0], input[0], input[0]];\n                break;\n            case 2:\n                input = [input[0], input[1], input[0], input[1]];\n                break;\n            case 3:\n                input = [input[0], input[1], input[2], input[1]];\n                break;\n        }\n\n        return new Padding(input as [number, number, number, number]);\n    }\n\n    toString(): string {\n        return JSON.stringify(this.values);\n    }\n\n    static interpolate(from: Padding, to: Padding, t: number): Padding {\n        return new Padding(interpolateArray(from.values, to.values, t));\n    }\n}\n","import {interpolateArray} from '../../util/interpolate-primitives';\n\n/**\n * An array of numbers. Create instances from\n * bare arrays or numeric values using the static method `NumberArray.parse`.\n * @private\n */\nexport class NumberArray {\n    values: number[];\n\n    constructor(values: number[]) {\n        this.values = values.slice();\n    }\n\n    /**\n     * Numeric NumberArray values\n     * @param input A NumberArray value\n     * @returns A `NumberArray` instance, or `undefined` if the input is not a valid NumberArray value.\n     */\n    static parse(input?: number | number[] | NumberArray | null): NumberArray | undefined {\n        if (input instanceof NumberArray) {\n            return input;\n        }\n\n        // Backwards compatibility (e.g. hillshade-illumination-direction): bare number is treated the same as array with single value.\n        if (typeof input === 'number') {\n            return new NumberArray([input]);\n        }\n\n        if (!Array.isArray(input)) {\n            return undefined;\n        }\n\n        for (const val of input) {\n            if (typeof val !== 'number') {\n                return undefined;\n            }\n        }\n\n        return new NumberArray(input);\n    }\n\n    toString(): string {\n        return JSON.stringify(this.values);\n    }\n\n    static interpolate(from: NumberArray, to: NumberArray, t: number): NumberArray {\n        return new NumberArray(interpolateArray(from.values, to.values, t));\n    }\n}\n","import {Color, InterpolationColorSpace} from './color';\n\n/**\n * An array of colors. Create instances from\n * bare arrays or strings using the static method `ColorArray.parse`.\n * @private\n */\nexport class ColorArray {\n    values: Color[];\n\n    constructor(values: Color[]) {\n        this.values = values.slice();\n    }\n\n    /**\n     * ColorArray values\n     * @param input A ColorArray value\n     * @returns A `ColorArray` instance, or `undefined` if the input is not a valid ColorArray value.\n     */\n    static parse(input?: string | string[] | ColorArray | null): ColorArray | undefined {\n        if (input instanceof ColorArray) {\n            return input;\n        }\n\n        // Backwards compatibility (e.g. hillshade-shadow-color): bare Color is treated the same as array with single value.\n        if (typeof input === 'string') {\n            const parsed_val = Color.parse(input);\n            if (!parsed_val) {\n                return undefined;\n            }\n            return new ColorArray([parsed_val]);\n        }\n\n        if (!Array.isArray(input)) {\n            return undefined;\n        }\n\n        const colors: Color[] = [];\n\n        for (const val of input) {\n            if (typeof val !== 'string') {\n                return undefined;\n            }\n            const parsed_val = Color.parse(val);\n            if (!parsed_val) {\n                return undefined;\n            }\n            colors.push(parsed_val);\n        }\n\n        return new ColorArray(colors);\n    }\n\n    toString(): string {\n        return JSON.stringify(this.values);\n    }\n\n    static interpolate(\n        from: ColorArray,\n        to: ColorArray,\n        t: number,\n        spaceKey: InterpolationColorSpace = 'rgb'\n    ): ColorArray {\n        const colors = [] as Color[];\n        if (from.values.length != to.values.length) {\n            throw new Error(\n                `colorArray: Arrays have mismatched length (${from.values.length} vs. ${to.values.length}), cannot interpolate.`\n            );\n        }\n        for (let i = 0; i < from.values.length; i++) {\n            colors.push(Color.interpolate(from.values[i], to.values[i], t, spaceKey));\n        }\n        return new ColorArray(colors);\n    }\n}\n","export class RuntimeError extends Error {\n    /**\n     * Index path of the throwing sub-expression (e.g. `[3][0]`); the empty string\n     * means the throw is at the root of the expression. Combined with the root key\n     * at the catch site to locate it in the style JSON.\n     */\n    readonly path: string;\n\n    constructor(message: string, path: string) {\n        super(message);\n        this.name = 'RuntimeError';\n        this.path = path;\n    }\n\n    toJSON() {\n        return this.message;\n    }\n}\n","import {RuntimeError} from '../runtime_error';\nimport {interpolateNumber} from '../../util/interpolate-primitives';\nimport type {VariableAnchorOffsetCollectionSpecification} from '../../types.g';\n\n/** Set of valid anchor positions, as a set for validation */\nconst anchors = new Set([\n    'center',\n    'left',\n    'right',\n    'top',\n    'bottom',\n    'top-left',\n    'top-right',\n    'bottom-left',\n    'bottom-right'\n]);\n\n/**\n * Utility class to assist managing values for text-variable-anchor-offset property. Create instances from\n * bare arrays using the static method `VariableAnchorOffsetCollection.parse`.\n * @private\n */\nexport class VariableAnchorOffsetCollection {\n    /** Series of paired of anchor (string) and offset (point) values */\n    values: VariableAnchorOffsetCollectionSpecification;\n\n    constructor(values: VariableAnchorOffsetCollectionSpecification) {\n        this.values = values.slice();\n    }\n\n    static parse(\n        input?: VariableAnchorOffsetCollectionSpecification | VariableAnchorOffsetCollection\n    ): VariableAnchorOffsetCollection | undefined {\n        if (input instanceof VariableAnchorOffsetCollection) {\n            return input;\n        }\n\n        if (!Array.isArray(input) || input.length < 1 || input.length % 2 !== 0) {\n            return undefined;\n        }\n\n        for (let i = 0; i < input.length; i += 2) {\n            // Elements in even positions should be anchor positions; Elements in odd positions should be offset values\n            const anchorValue = input[i];\n            const offsetValue = input[i + 1];\n\n            if (typeof anchorValue !== 'string' || !anchors.has(anchorValue)) {\n                return undefined;\n            }\n\n            if (\n                !Array.isArray(offsetValue) ||\n                offsetValue.length !== 2 ||\n                typeof offsetValue[0] !== 'number' ||\n                typeof offsetValue[1] !== 'number'\n            ) {\n                return undefined;\n            }\n        }\n\n        return new VariableAnchorOffsetCollection(input);\n    }\n\n    toString(): string {\n        return JSON.stringify(this.values);\n    }\n\n    static interpolate(\n        from: VariableAnchorOffsetCollection,\n        to: VariableAnchorOffsetCollection,\n        t: number,\n        key: string\n    ): VariableAnchorOffsetCollection {\n        const fromValues = from.values;\n        const toValues = to.values;\n\n        if (fromValues.length !== toValues.length) {\n            throw new RuntimeError(\n                `Cannot interpolate values of different length. from: ${from.toString()}, to: ${to.toString()}`,\n                key\n            );\n        }\n\n        const output: VariableAnchorOffsetCollectionSpecification = [];\n\n        for (let i = 0; i < fromValues.length; i += 2) {\n            // Anchor entries must match\n            if (fromValues[i] !== toValues[i]) {\n                throw new RuntimeError(\n                    `Cannot interpolate values containing mismatched anchors. from[${i}]: ${fromValues[i]}, to[${i}]: ${toValues[i]}`,\n                    key\n                );\n            }\n            output.push(fromValues[i]);\n\n            // Interpolate the offset values for each anchor\n            const [fx, fy] = fromValues[i + 1] as [number, number];\n            const [tx, ty] = toValues[i + 1] as [number, number];\n            output.push([interpolateNumber(fx, tx, t), interpolateNumber(fy, ty, t)]);\n        }\n\n        return new VariableAnchorOffsetCollection(output);\n    }\n}\n","export type ResolvedImageOptions = {\n    name: string;\n    available: boolean;\n};\n\nexport class ResolvedImage {\n    name: string;\n    available: boolean;\n\n    constructor(options: ResolvedImageOptions) {\n        this.name = options.name;\n        this.available = options.available;\n    }\n\n    toString(): string {\n        return this.name;\n    }\n\n    static fromString(name: string): ResolvedImage | null {\n        if (!name) return null; // treat empty values as no image\n        return new ResolvedImage({name, available: false});\n    }\n}\n","export class ProjectionDefinition {\n    readonly from: string;\n    readonly to: string;\n    readonly transition: number;\n\n    constructor(from: string, to: string, transition: number) {\n        this.from = from;\n        this.to = to;\n        this.transition = transition;\n    }\n\n    toString(): string {\n        if (this.from === this.to && this.transition === 1) {\n            return this.from;\n        }\n        return JSON.stringify([this.from, this.to, this.transition]);\n    }\n\n    static interpolate(from: string, to: string, t: number) {\n        return new ProjectionDefinition(from, to, t);\n    }\n\n    static parse(input?: any): ProjectionDefinition {\n        if (input instanceof ProjectionDefinition) {\n            return input;\n        }\n        if (\n            Array.isArray(input) &&\n            input.length === 3 &&\n            typeof input[0] === 'string' &&\n            typeof input[1] === 'string' &&\n            typeof input[2] === 'number'\n        ) {\n            return new ProjectionDefinition(input[0], input[1], input[2]);\n        }\n\n        if (\n            typeof input === 'object' &&\n            typeof input.from === 'string' &&\n            typeof input.to === 'string' &&\n            typeof input.transition === 'number'\n        ) {\n            return new ProjectionDefinition(input.from, input.to, input.transition);\n        }\n\n        if (typeof input === 'string') {\n            return new ProjectionDefinition(input, input, 1);\n        }\n        return undefined;\n    }\n}\n","import {Color} from './types/color';\nimport {Collator} from './types/collator';\nimport {Formatted} from './types/formatted';\nimport {Padding} from './types/padding';\nimport {NumberArray} from './types/number_array';\nimport {ColorArray} from './types/color_array';\nimport {VariableAnchorOffsetCollection} from './types/variable_anchor_offset_collection';\nimport {ResolvedImage} from './types/resolved_image';\nimport {ProjectionDefinition} from './types/projection_definition';\nimport {\n    NullType,\n    NumberType,\n    StringType,\n    BooleanType,\n    ColorType,\n    ObjectType,\n    ValueType,\n    CollatorType,\n    FormattedType,\n    ResolvedImageType,\n    array,\n    PaddingType,\n    NumberArrayType,\n    ColorArrayType,\n    VariableAnchorOffsetCollectionType,\n    ProjectionDefinitionType\n} from './types';\n\nimport type {Type} from './types';\n\nexport function validateRGBA(r: unknown, g: unknown, b: unknown, a?: unknown): string | null {\n    if (\n        !(\n            typeof r === 'number' &&\n            r >= 0 &&\n            r <= 255 &&\n            typeof g === 'number' &&\n            g >= 0 &&\n            g <= 255 &&\n            typeof b === 'number' &&\n            b >= 0 &&\n            b <= 255\n        )\n    ) {\n        const value = typeof a === 'number' ? [r, g, b, a] : [r, g, b];\n        return `Invalid rgba value [${value.join(', ')}]: 'r', 'g', and 'b' must be between 0 and 255.`;\n    }\n\n    if (!(typeof a === 'undefined' || (typeof a === 'number' && a >= 0 && a <= 1))) {\n        return `Invalid rgba value [${[r, g, b, a].join(', ')}]: 'a' must be between 0 and 1.`;\n    }\n\n    return null;\n}\n\nexport type Value =\n    | null\n    | string\n    | boolean\n    | number\n    | Color\n    | ProjectionDefinition\n    | Collator\n    | Formatted\n    | Padding\n    | NumberArray\n    | ColorArray\n    | ResolvedImage\n    | VariableAnchorOffsetCollection\n    | ReadonlyArray<Value>\n    | {\n          readonly [x: string]: Value;\n      };\n\nexport function isValue(mixed: unknown): boolean {\n    if (\n        mixed === null ||\n        typeof mixed === 'string' ||\n        typeof mixed === 'boolean' ||\n        typeof mixed === 'number' ||\n        mixed instanceof ProjectionDefinition ||\n        mixed instanceof Color ||\n        mixed instanceof Collator ||\n        mixed instanceof Formatted ||\n        mixed instanceof Padding ||\n        mixed instanceof NumberArray ||\n        mixed instanceof ColorArray ||\n        mixed instanceof VariableAnchorOffsetCollection ||\n        mixed instanceof ResolvedImage\n    ) {\n        return true;\n    } else if (Array.isArray(mixed)) {\n        for (const item of mixed) {\n            if (!isValue(item)) {\n                return false;\n            }\n        }\n        return true;\n    } else if (typeof mixed === 'object') {\n        for (const key in mixed) {\n            if (!isValue(mixed[key])) {\n                return false;\n            }\n        }\n        return true;\n    } else {\n        return false;\n    }\n}\n\nexport function typeOf(value: Value): Type {\n    if (value === null) {\n        return NullType;\n    } else if (typeof value === 'string') {\n        return StringType;\n    } else if (typeof value === 'boolean') {\n        return BooleanType;\n    } else if (typeof value === 'number') {\n        return NumberType;\n    } else if (value instanceof Color) {\n        return ColorType;\n    } else if (value instanceof ProjectionDefinition) {\n        return ProjectionDefinitionType;\n    } else if (value instanceof Collator) {\n        return CollatorType;\n    } else if (value instanceof Formatted) {\n        return FormattedType;\n    } else if (value instanceof Padding) {\n        return PaddingType;\n    } else if (value instanceof NumberArray) {\n        return NumberArrayType;\n    } else if (value instanceof ColorArray) {\n        return ColorArrayType;\n    } else if (value instanceof VariableAnchorOffsetCollection) {\n        return VariableAnchorOffsetCollectionType;\n    } else if (value instanceof ResolvedImage) {\n        return ResolvedImageType;\n    } else if (Array.isArray(value)) {\n        const length = value.length;\n        let itemType: Type | typeof undefined;\n\n        for (const item of value) {\n            const t = typeOf(item);\n            if (!itemType) {\n                itemType = t;\n            } else if (itemType === t) {\n                continue;\n            } else {\n                itemType = ValueType;\n                break;\n            }\n        }\n\n        return array(itemType || ValueType, length);\n    } else {\n        return ObjectType;\n    }\n}\n\nexport function valueToString(value: Value) {\n    const type = typeof value;\n    if (value === null) {\n        return '';\n    } else if (type === 'string' || type === 'number' || type === 'boolean') {\n        return String(value);\n    } else if (\n        value instanceof Color ||\n        value instanceof ProjectionDefinition ||\n        value instanceof Formatted ||\n        value instanceof Padding ||\n        value instanceof NumberArray ||\n        value instanceof ColorArray ||\n        value instanceof VariableAnchorOffsetCollection ||\n        value instanceof ResolvedImage\n    ) {\n        return value.toString();\n    } else {\n        return JSON.stringify(value);\n    }\n}\n","import {isValue, typeOf} from '../values';\n\nimport type {Type} from '../types';\nimport type {Value} from '../values';\nimport type {Expression} from '../expression';\nimport type {ParsingContext} from '../parsing_context';\n\nexport class Literal implements Expression {\n    type: Type;\n    value: Value;\n\n    constructor(type: Type, value: Value) {\n        this.type = type;\n        this.value = value;\n    }\n\n    static parse(args: ReadonlyArray<unknown>, context: ParsingContext): Expression {\n        if (args.length !== 2)\n            return context.error(\n                `'literal' expression requires exactly one argument, but found ${args.length - 1} instead.`\n            ) as null;\n\n        if (!isValue(args[1]))\n            return context.error(`invalid value of type \"${typeof args[1]}\"`) as null;\n\n        const value = args[1] as any;\n        let type = typeOf(value);\n\n        // special case: infer the item type if possible for zero-length arrays\n        const expected = context.expectedType;\n        if (\n            type.kind === 'array' &&\n            type.N === 0 &&\n            expected &&\n            expected.kind === 'array' &&\n            (typeof expected.N !== 'number' || expected.N === 0)\n        ) {\n            type = expected;\n        }\n\n        return new Literal(type, value);\n    }\n\n    evaluate() {\n        return this.value;\n    }\n\n    eachChild() {}\n\n    outputDefined() {\n        return true;\n    }\n}\n","import {\n    ObjectType,\n    ValueType,\n    StringType,\n    NumberType,\n    BooleanType,\n    checkSubtype,\n    typeToString,\n    array\n} from '../types';\nimport {RuntimeError} from '../runtime_error';\nimport {typeOf} from '../values';\n\nimport type {Expression} from '../expression';\nimport type {ParsingContext} from '../parsing_context';\nimport type {EvaluationContext} from '../evaluation_context';\nimport type {Type} from '../types';\n\nconst types = {\n    string: StringType,\n    number: NumberType,\n    boolean: BooleanType,\n    object: ObjectType\n};\n\nexport class Assertion implements Expression {\n    constructor(\n        public type: Type,\n        public args: Array<Expression>,\n        public readonly key: string\n    ) {}\n\n    static parse(args: ReadonlyArray<unknown>, context: ParsingContext): Expression {\n        if (args.length < 2) return context.error('Expected at least one argument.') as null;\n\n        let i = 1;\n        let type;\n\n        const name: string = args[0] as any;\n        if (name === 'array') {\n            let itemType;\n            if (args.length > 2) {\n                const type = args[1];\n                if (typeof type !== 'string' || !(type in types) || type === 'object')\n                    return context.error(\n                        'The item type argument of \"array\" must be one of string, number, boolean',\n                        1\n                    ) as null;\n                itemType = types[type];\n                i++;\n            } else {\n                itemType = ValueType;\n            }\n\n            let N;\n            if (args.length > 3) {\n                if (\n                    args[2] !== null &&\n                    (typeof args[2] !== 'number' || args[2] < 0 || args[2] !== Math.floor(args[2]))\n                ) {\n                    return context.error(\n                        'The length argument to \"array\" must be a positive integer literal',\n                        2\n                    ) as null;\n                }\n                N = args[2];\n                i++;\n            }\n\n            type = array(itemType, N);\n        } else {\n            if (!types[name]) throw new Error(`Types doesn't contain name = ${name}`);\n            type = types[name];\n        }\n\n        const parsed = [];\n        for (; i < args.length; i++) {\n            const input = context.parse(args[i], i, ValueType);\n            if (!input) return null;\n            parsed.push(input);\n        }\n\n        return new Assertion(type, parsed, context.key);\n    }\n\n    evaluate(ctx: EvaluationContext) {\n        for (let i = 0; i < this.args.length; i++) {\n            const value = this.args[i].evaluate(ctx);\n            const error = checkSubtype(this.type, typeOf(value));\n            if (!error) {\n                return value;\n            } else if (i === this.args.length - 1) {\n                throw new RuntimeError(\n                    `Expected value to be of type ${typeToString(this.type)}, but found ${typeToString(typeOf(value))} instead.`,\n                    this.key\n                );\n            }\n        }\n\n        throw new Error();\n    }\n\n    eachChild(fn: (_: Expression) => void) {\n        this.args.forEach(fn);\n    }\n\n    outputDefined(): boolean {\n        return this.args.every((arg) => arg.outputDefined());\n    }\n}\n","import {BooleanType, ColorType, NumberType, StringType, ValueType} from '../types';\nimport {valueToString, validateRGBA} from '../values';\nimport {RuntimeError} from '../runtime_error';\nimport {Formatted} from '../types/formatted';\nimport {ResolvedImage} from '../types/resolved_image';\nimport {Color} from '../types/color';\nimport {Padding} from '../types/padding';\nimport {NumberArray} from '../types/number_array';\nimport {ColorArray} from '../types/color_array';\nimport {VariableAnchorOffsetCollection} from '../types/variable_anchor_offset_collection';\nimport {ProjectionDefinition} from '../types/projection_definition';\n\nimport type {Expression} from '../expression';\nimport type {ParsingContext} from '../parsing_context';\nimport type {EvaluationContext} from '../evaluation_context';\nimport type {Type} from '../types';\n\nconst types = {\n    'to-boolean': BooleanType,\n    'to-color': ColorType,\n    'to-number': NumberType,\n    'to-string': StringType\n};\n\n/**\n * Special form for error-coalescing coercion expressions \"to-number\",\n * \"to-color\".  Since these coercions can fail at runtime, they accept multiple\n * arguments, only evaluating one at a time until one succeeds.\n *\n * @private\n */\nexport class Coercion implements Expression {\n    constructor(\n        public type: Type,\n        public args: Array<Expression>,\n        public readonly key: string\n    ) {}\n\n    static parse(args: ReadonlyArray<unknown>, context: ParsingContext): Expression {\n        if (args.length < 2) return context.error('Expected at least one argument.') as null;\n\n        const name: string = args[0] as any;\n        if (!types[name])\n            throw new Error(`Can't parse ${name} as it is not part of the known types`);\n        if ((name === 'to-boolean' || name === 'to-string') && args.length !== 2)\n            return context.error('Expected one argument.') as null;\n\n        const type = types[name];\n\n        const parsed = [];\n        for (let i = 1; i < args.length; i++) {\n            const input = context.parse(args[i], i, ValueType);\n            if (!input) return null;\n            parsed.push(input);\n        }\n\n        return new Coercion(type, parsed, context.key);\n    }\n\n    evaluate(ctx: EvaluationContext) {\n        switch (this.type.kind) {\n            case 'boolean':\n                return Boolean(this.args[0].evaluate(ctx));\n            case 'color': {\n                let input;\n                let error;\n                for (const arg of this.args) {\n                    input = arg.evaluate(ctx);\n                    error = null;\n                    if (input instanceof Color) {\n                        return input;\n                    } else if (typeof input === 'string') {\n                        const c = ctx.parseColor(input);\n                        if (c) return c;\n                    } else if (Array.isArray(input)) {\n                        if (input.length < 3 || input.length > 4) {\n                            error = `Invalid rgba value ${JSON.stringify(input)}: expected an array containing either three or four numeric values.`;\n                        } else {\n                            error = validateRGBA(input[0], input[1], input[2], input[3]);\n                        }\n                        if (!error) {\n                            return new Color(\n                                (input[0] as any) / 255,\n                                (input[1] as any) / 255,\n                                (input[2] as any) / 255,\n                                input[3] as any\n                            );\n                        }\n                    }\n                }\n                throw new RuntimeError(\n                    error ||\n                        `Could not parse color from value '${typeof input === 'string' ? input : JSON.stringify(input)}'`,\n                    this.key\n                );\n            }\n            case 'padding': {\n                let input;\n                for (const arg of this.args) {\n                    input = arg.evaluate(ctx);\n\n                    const pad = Padding.parse(input);\n                    if (pad) {\n                        return pad;\n                    }\n                }\n                throw new RuntimeError(\n                    `Could not parse padding from value '${typeof input === 'string' ? input : JSON.stringify(input)}'`,\n                    this.key\n                );\n            }\n            case 'numberArray': {\n                let input;\n                for (const arg of this.args) {\n                    input = arg.evaluate(ctx);\n\n                    const val = NumberArray.parse(input);\n                    if (val) {\n                        return val;\n                    }\n                }\n                throw new RuntimeError(\n                    `Could not parse numberArray from value '${typeof input === 'string' ? input : JSON.stringify(input)}'`,\n                    this.key\n                );\n            }\n            case 'colorArray': {\n                let input;\n                for (const arg of this.args) {\n                    input = arg.evaluate(ctx);\n\n                    const val = ColorArray.parse(input);\n                    if (val) {\n                        return val;\n                    }\n                }\n                throw new RuntimeError(\n                    `Could not parse colorArray from value '${typeof input === 'string' ? input : JSON.stringify(input)}'`,\n                    this.key\n                );\n            }\n            case 'variableAnchorOffsetCollection': {\n                let input;\n                for (const arg of this.args) {\n                    input = arg.evaluate(ctx);\n\n                    const coll = VariableAnchorOffsetCollection.parse(input);\n                    if (coll) {\n                        return coll;\n                    }\n                }\n                throw new RuntimeError(\n                    `Could not parse variableAnchorOffsetCollection from value '${typeof input === 'string' ? input : JSON.stringify(input)}'`,\n                    this.key\n                );\n            }\n            case 'number': {\n                let value = null;\n                for (const arg of this.args) {\n                    value = arg.evaluate(ctx);\n                    if (value === null) return 0;\n                    const num = Number(value);\n                    if (isNaN(num)) continue;\n                    return num;\n                }\n                throw new RuntimeError(\n                    `Could not convert ${JSON.stringify(value)} to number.`,\n                    this.key\n                );\n            }\n            case 'formatted':\n                // There is no explicit 'to-formatted' but this coercion can be implicitly\n                // created by properties that expect the 'formatted' type.\n                return Formatted.fromString(valueToString(this.args[0].evaluate(ctx)));\n            case 'resolvedImage':\n                return ResolvedImage.fromString(valueToString(this.args[0].evaluate(ctx)));\n            case 'projectionDefinition': {\n                const input = this.args[0].evaluate(ctx);\n                const proj = ProjectionDefinition.parse(input);\n                if (proj) return input;\n                throw new RuntimeError(\n                    `Could not parse projectionDefinition from value '${typeof input === 'string' ? input : JSON.stringify(input)}'`,\n                    this.key\n                );\n            }\n            default:\n                return valueToString(this.args[0].evaluate(ctx));\n        }\n    }\n\n    eachChild(fn: (_: Expression) => void) {\n        this.args.forEach(fn);\n    }\n\n    outputDefined(): boolean {\n        return this.args.every((arg) => arg.outputDefined());\n    }\n}\n","import type {Type} from '../types';\nimport type {Expression} from '../expression';\nimport type {ParsingContext} from '../parsing_context';\nimport type {EvaluationContext} from '../evaluation_context';\n\nexport class Let implements Expression {\n    type: Type;\n    bindings: Array<[string, Expression]>;\n    result: Expression;\n\n    constructor(bindings: Array<[string, Expression]>, result: Expression) {\n        this.type = result.type;\n        this.bindings = [].concat(bindings);\n        this.result = result;\n    }\n\n    evaluate(ctx: EvaluationContext) {\n        return this.result.evaluate(ctx);\n    }\n\n    eachChild(fn: (_: Expression) => void) {\n        for (const binding of this.bindings) {\n            fn(binding[1]);\n        }\n        fn(this.result);\n    }\n\n    static parse(args: ReadonlyArray<unknown>, context: ParsingContext): Expression {\n        if (args.length < 4)\n            return context.error(\n                `Expected at least 3 arguments, but found ${args.length - 1} instead.`\n            ) as null;\n\n        const bindings: Array<[string, Expression]> = [];\n        for (let i = 1; i < args.length - 1; i += 2) {\n            const name = args[i];\n\n            if (typeof name !== 'string') {\n                return context.error(\n                    `Expected string, but found ${typeof name} instead.`,\n                    i\n                ) as null;\n            }\n\n            if (/[^a-zA-Z0-9_]/.test(name)) {\n                return context.error(\n                    \"Variable names must contain only alphanumeric characters or '_'.\",\n                    i\n                ) as null;\n            }\n\n            const value = context.parse(args[i + 1], i + 1);\n            if (!value) return null;\n\n            bindings.push([name, value]);\n        }\n\n        const result = context.parse(\n            args[args.length - 1],\n            args.length - 1,\n            context.expectedType,\n            bindings\n        );\n        if (!result) return null;\n\n        return new Let(bindings, result);\n    }\n\n    outputDefined() {\n        return this.result.outputDefined();\n    }\n}\n","import type {Type} from '../types';\nimport type {Expression} from '../expression';\nimport type {ParsingContext} from '../parsing_context';\nimport type {EvaluationContext} from '../evaluation_context';\n\nexport class Var implements Expression {\n    type: Type;\n    name: string;\n    boundExpression: Expression;\n\n    constructor(name: string, boundExpression: Expression) {\n        this.type = boundExpression.type;\n        this.name = name;\n        this.boundExpression = boundExpression;\n    }\n\n    static parse(args: ReadonlyArray<unknown>, context: ParsingContext): Expression {\n        if (args.length !== 2 || typeof args[1] !== 'string')\n            return context.error(\n                \"'var' expression requires exactly one string literal argument.\"\n            ) as null;\n\n        const name = args[1];\n        if (!context.scope.has(name)) {\n            return context.error(\n                `Unknown variable \"${name}\". Make sure \"${name}\" has been bound in an enclosing \"let\" expression before using it.`,\n                1\n            ) as null;\n        }\n\n        return new Var(name, context.scope.get(name));\n    }\n\n    evaluate(ctx: EvaluationContext) {\n        return this.boundExpression.evaluate(ctx);\n    }\n\n    eachChild() {}\n\n    outputDefined() {\n        return false;\n    }\n}\n","import {array, ValueType, NumberType} from '../types';\n\nimport {RuntimeError} from '../runtime_error';\n\nimport type {Expression} from '../expression';\nimport type {ParsingContext} from '../parsing_context';\nimport type {EvaluationContext} from '../evaluation_context';\nimport type {Type, ArrayType} from '../types';\nimport type {Value} from '../values';\n\nexport class At implements Expression {\n    constructor(\n        public type: Type,\n        public index: Expression,\n        public input: Expression,\n        public readonly key: string\n    ) {}\n\n    static parse(args: ReadonlyArray<unknown>, context: ParsingContext): Expression {\n        if (args.length !== 3)\n            return context.error(\n                `Expected 2 arguments, but found ${args.length - 1} instead.`\n            ) as null;\n\n        const index = context.parse(args[1], 1, NumberType);\n        const input = context.parse(args[2], 2, array(context.expectedType || ValueType));\n\n        if (!index || !input) return null;\n\n        const t: ArrayType = input.type as any;\n        return new At(t.itemType, index, input, context.key);\n    }\n\n    evaluate(ctx: EvaluationContext) {\n        const index = this.index.evaluate(ctx) as any as number;\n        const array = this.input.evaluate(ctx) as any as Array<Value>;\n\n        if (index < 0) {\n            throw new RuntimeError(`Array index out of bounds: ${index} < 0.`, this.key);\n        }\n\n        if (index >= array.length) {\n            throw new RuntimeError(\n                `Array index out of bounds: ${index} > ${array.length - 1}.`,\n                this.key\n            );\n        }\n\n        if (index !== Math.floor(index)) {\n            throw new RuntimeError(\n                `Array index must be an integer, but found ${index} instead.`,\n                this.key\n            );\n        }\n\n        return array[index];\n    }\n\n    eachChild(fn: (_: Expression) => void) {\n        fn(this.index);\n        fn(this.input);\n    }\n\n    outputDefined() {\n        return false;\n    }\n}\n","import {\n    BooleanType,\n    StringType,\n    ValueType,\n    NullType,\n    typeToString,\n    NumberType,\n    isValidType,\n    isValidNativeType\n} from '../types';\nimport {RuntimeError} from '../runtime_error';\nimport {typeOf} from '../values';\n\nimport type {Expression} from '../expression';\nimport type {ParsingContext} from '../parsing_context';\nimport type {EvaluationContext} from '../evaluation_context';\nimport type {Type} from '../types';\n\nexport class In implements Expression {\n    type: Type = BooleanType;\n\n    constructor(\n        public needle: Expression,\n        public haystack: Expression,\n        public readonly key: string\n    ) {}\n\n    static parse(args: ReadonlyArray<unknown>, context: ParsingContext): Expression {\n        if (args.length !== 3) {\n            return context.error(\n                `Expected 2 arguments, but found ${args.length - 1} instead.`\n            ) as null;\n        }\n\n        const needle = context.parse(args[1], 1, ValueType);\n\n        const haystack = context.parse(args[2], 2, ValueType);\n\n        if (!needle || !haystack) return null;\n\n        if (!isValidType(needle.type, [BooleanType, StringType, NumberType, NullType, ValueType])) {\n            return context.error(\n                `Expected first argument to be of type boolean, string, number or null, but found ${typeToString(needle.type)} instead`\n            ) as null;\n        }\n\n        return new In(needle, haystack, context.key);\n    }\n\n    evaluate(ctx: EvaluationContext) {\n        const needle = this.needle.evaluate(ctx) as any;\n        const haystack = this.haystack.evaluate(ctx) as any;\n\n        if (!haystack) return false;\n\n        if (!isValidNativeType(needle, ['boolean', 'string', 'number', 'null'])) {\n            throw new RuntimeError(\n                `Expected first argument to be of type boolean, string, number or null, but found ${typeToString(typeOf(needle))} instead.`,\n                this.key\n            );\n        }\n\n        if (!isValidNativeType(haystack, ['string', 'array'])) {\n            throw new RuntimeError(\n                `Expected second argument to be of type array or string, but found ${typeToString(typeOf(haystack))} instead.`,\n                this.key\n            );\n        }\n\n        return haystack.indexOf(needle) >= 0;\n    }\n\n    eachChild(fn: (_: Expression) => void) {\n        fn(this.needle);\n        fn(this.haystack);\n    }\n\n    outputDefined() {\n        return true;\n    }\n}\n","import {\n    BooleanType,\n    StringType,\n    ValueType,\n    NullType,\n    typeToString,\n    NumberType,\n    isValidType,\n    isValidNativeType\n} from '../types';\nimport {RuntimeError} from '../runtime_error';\nimport {typeOf} from '../values';\n\nimport type {Expression} from '../expression';\nimport type {ParsingContext} from '../parsing_context';\nimport type {EvaluationContext} from '../evaluation_context';\nimport type {Type} from '../types';\n\nexport class IndexOf implements Expression {\n    type: Type = NumberType;\n\n    constructor(\n        public needle: Expression,\n        public haystack: Expression,\n        public readonly key: string,\n        public fromIndex?: Expression\n    ) {}\n\n    static parse(args: ReadonlyArray<unknown>, context: ParsingContext): Expression {\n        if (args.length <= 2 || args.length >= 5) {\n            return context.error(\n                `Expected 2 or 3 arguments, but found ${args.length - 1} instead.`\n            ) as null;\n        }\n\n        const needle = context.parse(args[1], 1, ValueType);\n\n        const haystack = context.parse(args[2], 2, ValueType);\n\n        if (!needle || !haystack) return null;\n        if (!isValidType(needle.type, [BooleanType, StringType, NumberType, NullType, ValueType])) {\n            return context.error(\n                `Expected first argument to be of type boolean, string, number or null, but found ${typeToString(needle.type)} instead`\n            ) as null;\n        }\n\n        if (args.length === 4) {\n            const fromIndex = context.parse(args[3], 3, NumberType);\n            if (!fromIndex) return null;\n            return new IndexOf(needle, haystack, context.key, fromIndex);\n        } else {\n            return new IndexOf(needle, haystack, context.key);\n        }\n    }\n\n    evaluate(ctx: EvaluationContext) {\n        const needle = this.needle.evaluate(ctx) as any;\n        const haystack = this.haystack.evaluate(ctx) as any;\n\n        if (!isValidNativeType(needle, ['boolean', 'string', 'number', 'null'])) {\n            throw new RuntimeError(\n                `Expected first argument to be of type boolean, string, number or null, but found ${typeToString(typeOf(needle))} instead.`,\n                this.key\n            );\n        }\n\n        let fromIndex;\n        if (this.fromIndex) {\n            fromIndex = this.fromIndex.evaluate(ctx) as number;\n        }\n\n        if (isValidNativeType(haystack, ['string'])) {\n            const rawIndex = haystack.indexOf(needle, fromIndex);\n            if (rawIndex === -1) {\n                return -1;\n            } else {\n                // The index may be affected by surrogate pairs, so get the length of the preceding substring.\n                return [...haystack.slice(0, rawIndex)].length;\n            }\n        } else if (isValidNativeType(haystack, ['array'])) {\n            return haystack.indexOf(needle, fromIndex);\n        } else {\n            throw new RuntimeError(\n                `Expected second argument to be of type array or string, but found ${typeToString(typeOf(haystack))} instead.`,\n                this.key\n            );\n        }\n    }\n\n    eachChild(fn: (_: Expression) => void) {\n        fn(this.needle);\n        fn(this.haystack);\n        if (this.fromIndex) {\n            fn(this.fromIndex);\n        }\n    }\n\n    outputDefined() {\n        return false;\n    }\n}\n","import {typeOf} from '../values';\nimport {ValueType} from '../types';\n\nimport type {Type} from '../types';\n\nimport type {Expression} from '../expression';\nimport type {ParsingContext} from '../parsing_context';\nimport type {EvaluationContext} from '../evaluation_context';\n\n// Map input label values to output expression index\ntype Cases = {\n    [k in number | string]: number;\n};\n\nexport class Match implements Expression {\n    type: Type;\n    inputType: Type;\n\n    input: Expression;\n    cases: Cases;\n    outputs: Array<Expression>;\n    otherwise: Expression;\n\n    constructor(\n        inputType: Type,\n        outputType: Type,\n        input: Expression,\n        cases: Cases,\n        outputs: Array<Expression>,\n        otherwise: Expression\n    ) {\n        this.inputType = inputType;\n        this.type = outputType;\n        this.input = input;\n        this.cases = cases;\n        this.outputs = outputs;\n        this.otherwise = otherwise;\n    }\n\n    static parse(args: ReadonlyArray<unknown>, context: ParsingContext): Expression {\n        if (args.length < 5)\n            return context.error(\n                `Expected at least 4 arguments, but found only ${args.length - 1}.`\n            ) as null;\n        if (args.length % 2 !== 1)\n            return context.error('Expected an even number of arguments.') as null;\n\n        let inputType;\n        let outputType;\n        if (context.expectedType && context.expectedType.kind !== 'value') {\n            outputType = context.expectedType;\n        }\n        const cases = {};\n        const outputs = [];\n        for (let i = 2; i < args.length - 1; i += 2) {\n            let labels = args[i] as unknown[];\n            const value = args[i + 1];\n\n            if (!Array.isArray(labels)) {\n                labels = [labels];\n            }\n\n            const labelContext = context.concat(i);\n            if (labels.length === 0) {\n                return labelContext.error('Expected at least one branch label.') as null;\n            }\n\n            for (const label of labels) {\n                if (typeof label !== 'number' && typeof label !== 'string') {\n                    return labelContext.error('Branch labels must be numbers or strings.') as null;\n                } else if (typeof label === 'number' && Math.abs(label) > Number.MAX_SAFE_INTEGER) {\n                    return labelContext.error(\n                        `Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`\n                    ) as null;\n                } else if (typeof label === 'number' && Math.floor(label) !== label) {\n                    return labelContext.error(\n                        'Numeric branch labels must be integer values.'\n                    ) as null;\n                } else if (!inputType) {\n                    inputType = typeOf(label);\n                } else if (labelContext.checkSubtype(inputType, typeOf(label))) {\n                    return null;\n                }\n\n                if (typeof cases[String(label)] !== 'undefined') {\n                    return labelContext.error('Branch labels must be unique.') as null;\n                }\n\n                cases[String(label)] = outputs.length;\n            }\n\n            const result = context.parse(value, i, outputType);\n            if (!result) return null;\n            outputType = outputType || result.type;\n            outputs.push(result);\n        }\n\n        const input = context.parse(args[1], 1, ValueType);\n        if (!input) return null;\n\n        const otherwise = context.parse(args[args.length - 1], args.length - 1, outputType);\n        if (!otherwise) return null;\n\n        if (\n            input.type.kind !== 'value' &&\n            context.concat(1).checkSubtype(inputType as any, input.type)\n        ) {\n            return null;\n        }\n\n        return new Match(inputType as any, outputType as any, input, cases, outputs, otherwise);\n    }\n\n    evaluate(ctx: EvaluationContext) {\n        const input = this.input.evaluate(ctx) as any;\n        const output =\n            (typeOf(input) === this.inputType && this.outputs[this.cases[input]]) || this.otherwise;\n        return output.evaluate(ctx);\n    }\n\n    eachChild(fn: (_: Expression) => void) {\n        fn(this.input);\n        this.outputs.forEach(fn);\n        fn(this.otherwise);\n    }\n\n    outputDefined(): boolean {\n        return this.outputs.every((out) => out.outputDefined()) && this.otherwise.outputDefined();\n    }\n}\n","import {BooleanType} from '../types';\n\nimport type {Expression} from '../expression';\nimport type {ParsingContext} from '../parsing_context';\nimport type {EvaluationContext} from '../evaluation_context';\nimport type {Type} from '../types';\n\ntype Branches = Array<[Expression, Expression]>;\n\nexport class Case implements Expression {\n    type: Type;\n\n    branches: Branches;\n    otherwise: Expression;\n\n    constructor(type: Type, branches: Branches, otherwise: Expression) {\n        this.type = type;\n        this.branches = branches;\n        this.otherwise = otherwise;\n    }\n\n    static parse(args: ReadonlyArray<unknown>, context: ParsingContext): Expression {\n        if (args.length < 4)\n            return context.error(\n                `Expected at least 3 arguments, but found only ${args.length - 1}.`\n            ) as null;\n        if (args.length % 2 !== 0)\n            return context.error('Expected an odd number of arguments.') as null;\n\n        let outputType: Type;\n        if (context.expectedType && context.expectedType.kind !== 'value') {\n            outputType = context.expectedType;\n        }\n\n        const branches = [];\n        for (let i = 1; i < args.length - 1; i += 2) {\n            const test = context.parse(args[i], i, BooleanType);\n            if (!test) return null;\n\n            const result = context.parse(args[i + 1], i + 1, outputType);\n            if (!result) return null;\n\n            branches.push([test, result]);\n\n            outputType = outputType || result.type;\n        }\n\n        const otherwise = context.parse(args[args.length - 1], args.length - 1, outputType);\n        if (!otherwise) return null;\n\n        if (!outputType) throw new Error(\"Can't infer output type\");\n        return new Case(outputType as any, branches, otherwise);\n    }\n\n    evaluate(ctx: EvaluationContext) {\n        for (const [test, expression] of this.branches) {\n            if (test.evaluate(ctx)) {\n                return expression.evaluate(ctx);\n            }\n        }\n        return this.otherwise.evaluate(ctx);\n    }\n\n    eachChild(fn: (_: Expression) => void) {\n        for (const [test, expression] of this.branches) {\n            fn(test);\n            fn(expression);\n        }\n        fn(this.otherwise);\n    }\n\n    outputDefined(): boolean {\n        return (\n            this.branches.every(([_, out]) => out.outputDefined()) && this.otherwise.outputDefined()\n        );\n    }\n}\n","import {\n    ValueType,\n    NumberType,\n    StringType,\n    array,\n    typeToString,\n    isValidType,\n    isValidNativeType\n} from '../types';\nimport {RuntimeError} from '../runtime_error';\nimport {typeOf} from '../values';\n\nimport type {Expression} from '../expression';\nimport type {ParsingContext} from '../parsing_context';\nimport type {EvaluationContext} from '../evaluation_context';\nimport type {Type} from '../types';\n\nexport class Slice implements Expression {\n    constructor(\n        public type: Type,\n        public input: Expression,\n        public beginIndex: Expression,\n        public readonly key: string,\n        public endIndex?: Expression\n    ) {}\n\n    static parse(args: ReadonlyArray<unknown>, context: ParsingContext): Expression {\n        if (args.length <= 2 || args.length >= 5) {\n            return context.error(\n                `Expected 2 or 3 arguments, but found ${args.length - 1} instead.`\n            ) as null;\n        }\n\n        const input = context.parse(args[1], 1, ValueType);\n        const beginIndex = context.parse(args[2], 2, NumberType);\n\n        if (!input || !beginIndex) return null;\n\n        if (!isValidType(input.type, [array(ValueType), StringType, ValueType])) {\n            return context.error(\n                `Expected first argument to be of type array or string, but found ${typeToString(input.type)} instead`\n            ) as null;\n        }\n\n        if (args.length === 4) {\n            const endIndex = context.parse(args[3], 3, NumberType);\n            if (!endIndex) return null;\n            return new Slice(input.type, input, beginIndex, context.key, endIndex);\n        } else {\n            return new Slice(input.type, input, beginIndex, context.key);\n        }\n    }\n\n    evaluate(ctx: EvaluationContext) {\n        const input = this.input.evaluate(ctx) as any;\n        const beginIndex = this.beginIndex.evaluate(ctx) as number;\n\n        let endIndex;\n        if (this.endIndex) {\n            endIndex = this.endIndex.evaluate(ctx) as number;\n        }\n\n        if (isValidNativeType(input, ['string'])) {\n            // Indices may be affected by surrogate pairs.\n            return [...input].slice(beginIndex, endIndex).join('');\n        } else if (isValidNativeType(input, ['array'])) {\n            return input.slice(beginIndex, endIndex);\n        } else {\n            throw new RuntimeError(\n                `Expected first argument to be of type array or string, but found ${typeToString(typeOf(input))} instead.`,\n                this.key\n            );\n        }\n    }\n\n    eachChild(fn: (_: Expression) => void) {\n        fn(this.input);\n        fn(this.beginIndex);\n        if (this.endIndex) {\n            fn(this.endIndex);\n        }\n    }\n\n    outputDefined() {\n        return false;\n    }\n}\n","import {RuntimeError} from './runtime_error';\n\nimport type {Expression} from './expression';\n\nexport type Stops = Array<[number, Expression]>;\n\n/**\n * Returns the index of the last stop <= input, or 0 if it doesn't exist.\n * @private\n */\nexport function findStopLessThanOrEqualTo(stops: Array<number>, input: number, key: string) {\n    const lastIndex = stops.length - 1;\n    let lowerIndex = 0;\n    let upperIndex = lastIndex;\n    let currentIndex = 0;\n    let currentValue, nextValue;\n\n    while (lowerIndex <= upperIndex) {\n        currentIndex = Math.floor((lowerIndex + upperIndex) / 2);\n        currentValue = stops[currentIndex];\n        nextValue = stops[currentIndex + 1];\n\n        if (currentValue <= input) {\n            if (currentIndex === lastIndex || input < nextValue) {\n                // Search complete\n                return currentIndex;\n            }\n\n            lowerIndex = currentIndex + 1;\n        } else if (currentValue > input) {\n            upperIndex = currentIndex - 1;\n        } else {\n            throw new RuntimeError('Input is not a number.', key);\n        }\n    }\n\n    return 0;\n}\n","import {NumberType} from '../types';\n\nimport {findStopLessThanOrEqualTo} from '../stops';\n\nimport type {Stops} from '../stops';\nimport type {Expression} from '../expression';\nimport type {ParsingContext} from '../parsing_context';\nimport type {EvaluationContext} from '../evaluation_context';\nimport type {Type} from '../types';\n\nexport class Step implements Expression {\n    labels: Array<number> = [];\n    outputs: Array<Expression> = [];\n\n    constructor(\n        public type: Type,\n        public input: Expression,\n        stops: Stops,\n        public readonly key: string\n    ) {\n        for (const [label, expression] of stops) {\n            this.labels.push(label);\n            this.outputs.push(expression);\n        }\n    }\n\n    static parse(args: ReadonlyArray<unknown>, context: ParsingContext): Expression {\n        if (args.length - 1 < 4) {\n            return context.error(\n                `Expected at least 4 arguments, but found only ${args.length - 1}.`\n            ) as null;\n        }\n\n        if ((args.length - 1) % 2 !== 0) {\n            return context.error('Expected an even number of arguments.') as null;\n        }\n\n        const input = context.parse(args[1], 1, NumberType);\n        if (!input) return null;\n\n        const stops: Stops = [];\n\n        let outputType: Type = null;\n        if (context.expectedType && context.expectedType.kind !== 'value') {\n            outputType = context.expectedType;\n        }\n\n        for (let i = 1; i < args.length; i += 2) {\n            const label = i === 1 ? -Infinity : args[i];\n            const value = args[i + 1];\n\n            const labelKey = i;\n            const valueKey = i + 1;\n\n            if (typeof label !== 'number') {\n                return context.error(\n                    'Input/output pairs for \"step\" expressions must be defined using literal numeric values (not computed expressions) for the input values.',\n                    labelKey\n                ) as null;\n            }\n\n            if (stops.length && stops[stops.length - 1][0] >= label) {\n                return context.error(\n                    'Input/output pairs for \"step\" expressions must be arranged with input values in strictly ascending order.',\n                    labelKey\n                ) as null;\n            }\n\n            const parsed = context.parse(value, valueKey, outputType);\n            if (!parsed) return null;\n            outputType = outputType || parsed.type;\n            stops.push([label, parsed]);\n        }\n\n        return new Step(outputType, input, stops, context.key);\n    }\n\n    evaluate(ctx: EvaluationContext) {\n        const labels = this.labels;\n        const outputs = this.outputs;\n\n        if (labels.length === 1) {\n            return outputs[0].evaluate(ctx);\n        }\n\n        const value = this.input.evaluate(ctx) as any as number;\n        if (value <= labels[0]) {\n            return outputs[0].evaluate(ctx);\n        }\n\n        const stopCount = labels.length;\n        if (value >= labels[stopCount - 1]) {\n            return outputs[stopCount - 1].evaluate(ctx);\n        }\n\n        const index = findStopLessThanOrEqualTo(labels, value, this.key);\n        return outputs[index].evaluate(ctx);\n    }\n\n    eachChild(fn: (_: Expression) => void) {\n        fn(this.input);\n        for (const expression of this.outputs) {\n            fn(expression);\n        }\n    }\n\n    outputDefined(): boolean {\n        return this.outputs.every((out) => out.outputDefined());\n    }\n}\n","\nexport default function unitBezier(p1x, p1y, p2x, p2y) {\n    // Calculate the polynomial coefficients, implicit first and last control points are (0,0) and (1,1).\n    const cx = 3 * p1x;\n    const bx = 3 * (p2x - p1x) - cx;\n    const ax = 1 - cx - bx;\n\n    const cy = 3 * p1y;\n    const by = 3 * (p2y - p1y) - cy;\n    const ay = 1 - cy - by;\n\n    return function solve(x, epsilon = 1e-6) {\n        if (x <= 0) return 0;\n        if (x >= 1) return 1;\n\n        let t = x;\n\n        // First try a few iterations of Newton's method - normally very fast.\n        // `ax t^3 + bx t^2 + cx t` expanded using Horner's rule.\n        for (let i = 0; i < 8; i++) {\n            const x2 = ((ax * t + bx) * t + cx) * t - x;\n            if (Math.abs(x2) < epsilon) return ((ay * t + by) * t + cy) * t;\n\n            const d2 = (3 * ax * t + 2 * bx) * t + cx;\n            if (Math.abs(d2) < 1e-6) break;\n\n            t -= x2 / d2;\n        }\n\n        // Fall back to the bisection method for reliability.\n        let t0 = 0;\n        let t1 = 1;\n        t = x;\n\n        for (let i = 0; i < 20; i++) {\n            const x2 = ((ax * t + bx) * t + cx) * t;\n            if (Math.abs(x2 - x) < epsilon) break;\n\n            if (x > x2) t0 = t;\n            else t1 = t;\n\n            t = (t0 + t1) * 0.5;\n        }\n\n        return ((ay * t + by) * t + cy) * t;\n    };\n}\n","import unitBezier from '@mapbox/unitbezier';\n\nimport {\n    array,\n    ArrayType,\n    ColorType,\n    ColorTypeT,\n    NumberType,\n    NumberTypeT,\n    PaddingType,\n    PaddingTypeT,\n    NumberArrayTypeT,\n    ColorArrayTypeT,\n    VariableAnchorOffsetCollectionType,\n    VariableAnchorOffsetCollectionTypeT,\n    typeToString,\n    verifyType,\n    ProjectionDefinitionType,\n    ColorArrayType,\n    NumberArrayType\n} from '../types';\nimport {findStopLessThanOrEqualTo} from '../stops';\nimport {Color} from '../types/color';\nimport {interpolateArray, interpolateNumber} from '../../util/interpolate-primitives';\nimport {Padding} from '../types/padding';\nimport {ColorArray} from '../types/color_array';\nimport {NumberArray} from '../types/number_array';\nimport {VariableAnchorOffsetCollection} from '../types/variable_anchor_offset_collection';\nimport {ProjectionDefinition} from '../types/projection_definition';\n\nimport type {Stops} from '../stops';\nimport type {Expression} from '../expression';\nimport type {ParsingContext} from '../parsing_context';\nimport type {EvaluationContext} from '../evaluation_context';\nimport type {ProjectionDefinitionTypeT, Type} from '../types';\n\nexport type InterpolationType =\n    | {\n          name: 'linear';\n      }\n    | {\n          name: 'exponential';\n          base: number;\n      }\n    | {\n          name: 'cubic-bezier';\n          controlPoints: [number, number, number, number];\n      };\ntype InterpolatedValueType =\n    | NumberTypeT\n    | ColorTypeT\n    | ProjectionDefinitionTypeT\n    | PaddingTypeT\n    | NumberArrayTypeT\n    | ColorArrayTypeT\n    | VariableAnchorOffsetCollectionTypeT\n    | ArrayType<NumberTypeT>;\nexport class Interpolate implements Expression {\n    labels: Array<number> = [];\n    outputs: Array<Expression> = [];\n\n    constructor(\n        public type: InterpolatedValueType,\n        public operator:\n            | 'interpolate'\n            | 'interpolate-hcl'\n            | 'interpolate-lab'\n            | 'interpolate-oklch'\n            | 'interpolate-oklab',\n        public interpolation: InterpolationType,\n        public input: Expression,\n        stops: Stops,\n        public readonly key: string\n    ) {\n        for (const [label, expression] of stops) {\n            this.labels.push(label);\n            this.outputs.push(expression);\n        }\n    }\n\n    static interpolationFactor(\n        interpolation: InterpolationType,\n        input: number,\n        lower: number,\n        upper: number\n    ) {\n        let t = 0;\n        if (interpolation.name === 'exponential') {\n            t = exponentialInterpolation(input, interpolation.base, lower, upper);\n        } else if (interpolation.name === 'linear') {\n            t = exponentialInterpolation(input, 1, lower, upper);\n        } else if (interpolation.name === 'cubic-bezier') {\n            const c = interpolation.controlPoints;\n            const ub = unitBezier(c[0], c[1], c[2], c[3]);\n            t = ub(exponentialInterpolation(input, 1, lower, upper));\n        }\n        return t;\n    }\n\n    static parse(args: ReadonlyArray<unknown>, context: ParsingContext): Expression {\n        let [operator, interpolation, input, ...rest] = args;\n\n        if (!Array.isArray(interpolation) || interpolation.length === 0) {\n            return context.error('Expected an interpolation type expression.', 1) as null;\n        }\n\n        if (interpolation[0] === 'linear') {\n            interpolation = {name: 'linear'};\n        } else if (interpolation[0] === 'exponential') {\n            const base = interpolation[1];\n            if (typeof base !== 'number')\n                return context.error(\n                    'Exponential interpolation requires a numeric base.',\n                    1,\n                    1\n                ) as null;\n            interpolation = {\n                name: 'exponential',\n                base\n            };\n        } else if (interpolation[0] === 'cubic-bezier') {\n            const controlPoints = interpolation.slice(1);\n            if (\n                controlPoints.length !== 4 ||\n                controlPoints.some((t) => typeof t !== 'number' || t < 0 || t > 1)\n            ) {\n                return context.error(\n                    'Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.',\n                    1\n                ) as null;\n            }\n\n            interpolation = {\n                name: 'cubic-bezier',\n                controlPoints: controlPoints as any\n            };\n        } else {\n            return context.error(\n                `Unknown interpolation type ${String(interpolation[0])}`,\n                1,\n                0\n            ) as null;\n        }\n\n        if (args.length - 1 < 4) {\n            return context.error(\n                `Expected at least 4 arguments, but found only ${args.length - 1}.`\n            ) as null;\n        }\n\n        if ((args.length - 1) % 2 !== 0) {\n            return context.error('Expected an even number of arguments.') as null;\n        }\n\n        input = context.parse(input, 2, NumberType);\n        if (!input) return null;\n\n        const stops: Stops = [];\n\n        let outputType: Type = null;\n        if (\n            (operator === 'interpolate-hcl' ||\n                operator === 'interpolate-lab' ||\n                operator === 'interpolate-oklch' ||\n                operator === 'interpolate-oklab') &&\n            context.expectedType != ColorArrayType\n        ) {\n            outputType = ColorType;\n        } else if (context.expectedType && context.expectedType.kind !== 'value') {\n            outputType = context.expectedType;\n        }\n\n        for (let i = 0; i < rest.length; i += 2) {\n            const label = rest[i];\n            const value = rest[i + 1];\n\n            const labelKey = i + 3;\n            const valueKey = i + 4;\n\n            if (typeof label !== 'number') {\n                return context.error(\n                    'Input/output pairs for \"interpolate\" expressions must be defined using literal numeric values (not computed expressions) for the input values.',\n                    labelKey\n                ) as null;\n            }\n\n            if (stops.length && stops[stops.length - 1][0] >= label) {\n                return context.error(\n                    'Input/output pairs for \"interpolate\" expressions must be arranged with input values in strictly ascending order.',\n                    labelKey\n                ) as null;\n            }\n            const parsed = context.parse(value, valueKey, outputType);\n            if (!parsed) return null;\n            outputType = outputType || parsed.type;\n            stops.push([label, parsed]);\n        }\n\n        if (\n            !verifyType(outputType, NumberType) &&\n            !verifyType(outputType, ProjectionDefinitionType) &&\n            !verifyType(outputType, ColorType) &&\n            !verifyType(outputType, PaddingType) &&\n            !verifyType(outputType, NumberArrayType) &&\n            !verifyType(outputType, ColorArrayType) &&\n            !verifyType(outputType, VariableAnchorOffsetCollectionType) &&\n            !verifyType(outputType, array(NumberType))\n        ) {\n            return context.error(`Type ${typeToString(outputType)} is not interpolatable.`) as null;\n        }\n\n        return new Interpolate(\n            outputType,\n            operator as any,\n            interpolation as InterpolationType,\n            input as Expression,\n            stops,\n            context.key\n        );\n    }\n\n    evaluate(ctx: EvaluationContext) {\n        const labels = this.labels;\n        const outputs = this.outputs;\n\n        if (labels.length === 1) {\n            return outputs[0].evaluate(ctx);\n        }\n\n        const value: number = this.input.evaluate(ctx);\n        if (value <= labels[0]) {\n            return outputs[0].evaluate(ctx);\n        }\n\n        const stopCount = labels.length;\n        if (value >= labels[stopCount - 1]) {\n            return outputs[stopCount - 1].evaluate(ctx);\n        }\n\n        const index = findStopLessThanOrEqualTo(labels, value, this.key);\n        const lower = labels[index];\n        const upper = labels[index + 1];\n        const t = Interpolate.interpolationFactor(this.interpolation, value, lower, upper);\n\n        const outputLower = outputs[index].evaluate(ctx);\n        const outputUpper = outputs[index + 1].evaluate(ctx);\n\n        switch (this.operator) {\n            case 'interpolate':\n                switch (this.type.kind) {\n                    case 'number':\n                        return interpolateNumber(outputLower, outputUpper, t);\n                    case 'color':\n                        return Color.interpolate(outputLower, outputUpper, t);\n                    case 'padding':\n                        return Padding.interpolate(outputLower, outputUpper, t);\n                    case 'colorArray':\n                        return ColorArray.interpolate(outputLower, outputUpper, t);\n                    case 'numberArray':\n                        return NumberArray.interpolate(outputLower, outputUpper, t);\n                    case 'variableAnchorOffsetCollection':\n                        return VariableAnchorOffsetCollection.interpolate(\n                            outputLower,\n                            outputUpper,\n                            t,\n                            this.key\n                        );\n                    case 'array':\n                        return interpolateArray(outputLower, outputUpper, t);\n                    case 'projectionDefinition':\n                        return ProjectionDefinition.interpolate(outputLower, outputUpper, t);\n                }\n            case 'interpolate-hcl':\n                switch (this.type.kind) {\n                    case 'color':\n                        return Color.interpolate(outputLower, outputUpper, t, 'hcl');\n                    case 'colorArray':\n                        return ColorArray.interpolate(outputLower, outputUpper, t, 'hcl');\n                }\n            case 'interpolate-lab':\n                switch (this.type.kind) {\n                    case 'color':\n                        return Color.interpolate(outputLower, outputUpper, t, 'lab');\n                    case 'colorArray':\n                        return ColorArray.interpolate(outputLower, outputUpper, t, 'lab');\n                }\n            case 'interpolate-oklch':\n                switch (this.type.kind) {\n                    case 'color':\n                        return Color.interpolate(outputLower, outputUpper, t, 'oklch');\n                    case 'colorArray':\n                        return ColorArray.interpolate(outputLower, outputUpper, t, 'oklch');\n                }\n            case 'interpolate-oklab':\n                switch (this.type.kind) {\n                    case 'color':\n                        return Color.interpolate(outputLower, outputUpper, t, 'oklab');\n                    case 'colorArray':\n                        return ColorArray.interpolate(outputLower, outputUpper, t, 'oklab');\n                }\n        }\n    }\n\n    eachChild(fn: (_: Expression) => void) {\n        fn(this.input);\n        for (const expression of this.outputs) {\n            fn(expression);\n        }\n    }\n\n    outputDefined(): boolean {\n        return this.outputs.every((out) => out.outputDefined());\n    }\n}\n\n/**\n * Returns a ratio that can be used to interpolate between exponential function\n * stops.\n * How it works: Two consecutive stop values define a (scaled and shifted) exponential function `f(x) = a * base^x + b`, where `base` is the user-specified base,\n * and `a` and `b` are constants affording sufficient degrees of freedom to fit\n * the function to the given stops.\n *\n * Here's a bit of algebra that lets us compute `f(x)` directly from the stop\n * values without explicitly solving for `a` and `b`:\n *\n * First stop value: `f(x0) = y0 = a * base^x0 + b`\n * Second stop value: `f(x1) = y1 = a * base^x1 + b`\n * => `y1 - y0 = a(base^x1 - base^x0)`\n * => `a = (y1 - y0)/(base^x1 - base^x0)`\n *\n * Desired value: `f(x) = y = a * base^x + b`\n * => `f(x) = y0 + a * (base^x - base^x0)`\n *\n * From the above, we can replace the `a` in `a * (base^x - base^x0)` and do a\n * little algebra:\n * ```\n * a * (base^x - base^x0) = (y1 - y0)/(base^x1 - base^x0) * (base^x - base^x0)\n *                     = (y1 - y0) * (base^x - base^x0) / (base^x1 - base^x0)\n * ```\n *\n * If we let `(base^x - base^x0) / (base^x1 base^x0)`, then we have\n * `f(x) = y0 + (y1 - y0) * ratio`.  In other words, `ratio` may be treated as\n * an interpolation factor between the two stops' output values.\n *\n * (Note: a slightly different form for `ratio`,\n * `(base^(x-x0) - 1) / (base^(x1-x0) - 1) `, is equivalent, but requires fewer\n * expensive `Math.pow()` operations.)\n *\n * @private\n */\nfunction exponentialInterpolation(input, base, lowerValue, upperValue) {\n    const difference = upperValue - lowerValue;\n    const progress = input - lowerValue;\n\n    if (difference === 0) {\n        return 0;\n    } else if (base === 1) {\n        return progress / difference;\n    } else {\n        return (Math.pow(base, progress) - 1) / (Math.pow(base, difference) - 1);\n    }\n}\n\nexport const interpolateFactory = {\n    color: Color.interpolate,\n    number: interpolateNumber,\n    padding: Padding.interpolate,\n    numberArray: NumberArray.interpolate,\n    colorArray: ColorArray.interpolate,\n    variableAnchorOffsetCollection: VariableAnchorOffsetCollection.interpolate,\n    array: interpolateArray\n};\n","import {checkSubtype, ValueType} from '../types';\nimport {ResolvedImage} from '../types/resolved_image';\n\nimport type {Expression} from '../expression';\nimport type {ParsingContext} from '../parsing_context';\nimport type {EvaluationContext} from '../evaluation_context';\nimport type {Type} from '../types';\n\nexport class Coalesce implements Expression {\n    type: Type;\n    args: Array<Expression>;\n\n    constructor(type: Type, args: Array<Expression>) {\n        this.type = type;\n        this.args = args;\n    }\n\n    static parse(args: ReadonlyArray<unknown>, context: ParsingContext): Expression {\n        if (args.length < 2) {\n            return context.error('Expected at least one argument.') as null;\n        }\n        let outputType: Type = null;\n        const expectedType = context.expectedType;\n        if (expectedType && expectedType.kind !== 'value') {\n            outputType = expectedType;\n        }\n        const parsedArgs = [];\n\n        for (const arg of args.slice(1)) {\n            const parsed = context.parse(arg, 1 + parsedArgs.length, outputType, undefined, {\n                typeAnnotation: 'omit'\n            });\n            if (!parsed) return null;\n            outputType = outputType || parsed.type;\n            parsedArgs.push(parsed);\n        }\n        if (!outputType) throw new Error('No output type');\n\n        // Above, we parse arguments without inferred type annotation so that\n        // they don't produce a runtime error for `null` input, which would\n        // preempt the desired null-coalescing behavior.\n        // Thus, if any of our arguments would have needed an annotation, we\n        // need to wrap the enclosing coalesce expression with it instead.\n        const needsAnnotation =\n            expectedType && parsedArgs.some((arg) => checkSubtype(expectedType, arg.type));\n\n        return needsAnnotation\n            ? new Coalesce(ValueType, parsedArgs)\n            : new Coalesce(outputType as any, parsedArgs);\n    }\n\n    evaluate(ctx: EvaluationContext) {\n        let result = null;\n        let argCount = 0;\n        let requestedImageName;\n        for (const arg of this.args) {\n            argCount++;\n            result = arg.evaluate(ctx);\n            // we need to keep track of the first requested image in a coalesce statement\n            // if coalesce can't find a valid image, we return the first image name so styleimagemissing can fire\n            if (result && result instanceof ResolvedImage && !result.available) {\n                if (!requestedImageName) {\n                    requestedImageName = result.name;\n                }\n                result = null;\n                if (argCount === this.args.length) {\n                    result = requestedImageName;\n                }\n            }\n\n            if (result !== null) break;\n        }\n        return result;\n    }\n\n    eachChild(fn: (_: Expression) => void) {\n        this.args.forEach(fn);\n    }\n\n    outputDefined(): boolean {\n        return this.args.every((arg) => arg.outputDefined());\n    }\n}\n","import {typeToString, ValueType, BooleanType, CollatorType} from '../types';\nimport {Assertion} from './assertion';\nimport {typeOf} from '../values';\nimport {RuntimeError} from '../runtime_error';\n\nimport type {Expression} from '../expression';\nimport type {EvaluationContext} from '../evaluation_context';\nimport type {ParsingContext} from '../parsing_context';\nimport type {Type} from '../types';\n\ntype ComparisonOperator = '==' | '!=' | '<' | '>' | '<=' | '>=';\n\nfunction isComparableType(op: ComparisonOperator, type: Type) {\n    if (op === '==' || op === '!=') {\n        // equality operator\n        return (\n            type.kind === 'boolean' ||\n            type.kind === 'string' ||\n            type.kind === 'number' ||\n            type.kind === 'null' ||\n            type.kind === 'value'\n        );\n    } else {\n        // ordering operator\n        return type.kind === 'string' || type.kind === 'number' || type.kind === 'value';\n    }\n}\n\nfunction eq(ctx, a, b) {\n    return a === b;\n}\nfunction neq(ctx, a, b) {\n    return a !== b;\n}\nfunction lt(ctx, a, b) {\n    return a < b;\n}\nfunction gt(ctx, a, b) {\n    return a > b;\n}\nfunction lteq(ctx, a, b) {\n    return a <= b;\n}\nfunction gteq(ctx, a, b) {\n    return a >= b;\n}\n\nfunction eqCollate(ctx, a, b, c) {\n    return c.compare(a, b) === 0;\n}\nfunction neqCollate(ctx, a, b, c) {\n    return !eqCollate(ctx, a, b, c);\n}\nfunction ltCollate(ctx, a, b, c) {\n    return c.compare(a, b) < 0;\n}\nfunction gtCollate(ctx, a, b, c) {\n    return c.compare(a, b) > 0;\n}\nfunction lteqCollate(ctx, a, b, c) {\n    return c.compare(a, b) <= 0;\n}\nfunction gteqCollate(ctx, a, b, c) {\n    return c.compare(a, b) >= 0;\n}\n\n/**\n * Special form for comparison operators, implementing the signatures:\n * - (T, T, ?Collator) => boolean\n * - (T, value, ?Collator) => boolean\n * - (value, T, ?Collator) => boolean\n *\n * For inequalities, T must be either value, string, or number. For ==/!=, it\n * can also be boolean or null.\n *\n * Equality semantics are equivalent to Javascript's strict equality (===/!==)\n * -- i.e., when the arguments' types don't match, == evaluates to false, != to\n * true.\n *\n * When types don't match in an ordering comparison, a runtime error is thrown.\n *\n * @private\n */\nfunction makeComparison(op: ComparisonOperator, compareBasic, compareWithCollator) {\n    const isOrderComparison = op !== '==' && op !== '!=';\n\n    return class Comparison implements Expression {\n        type: Type = BooleanType;\n        hasUntypedArgument: boolean;\n\n        constructor(\n            public lhs: Expression,\n            public rhs: Expression,\n            public readonly key: string,\n            public collator?: Expression | null\n        ) {\n            this.hasUntypedArgument = lhs.type.kind === 'value' || rhs.type.kind === 'value';\n        }\n\n        static parse(args: ReadonlyArray<unknown>, context: ParsingContext): Expression {\n            if (args.length !== 3 && args.length !== 4)\n                return context.error('Expected two or three arguments.') as null;\n\n            const op: ComparisonOperator = args[0] as any;\n\n            let lhs = context.parse(args[1], 1, ValueType);\n            if (!lhs) return null;\n            if (!isComparableType(op, lhs.type)) {\n                return context\n                    .concat(1)\n                    .error(\n                        `\"${op}\" comparisons are not supported for type '${typeToString(lhs.type)}'.`\n                    ) as null;\n            }\n            let rhs = context.parse(args[2], 2, ValueType);\n            if (!rhs) return null;\n            if (!isComparableType(op, rhs.type)) {\n                return context\n                    .concat(2)\n                    .error(\n                        `\"${op}\" comparisons are not supported for type '${typeToString(rhs.type)}'.`\n                    ) as null;\n            }\n\n            if (\n                lhs.type.kind !== rhs.type.kind &&\n                lhs.type.kind !== 'value' &&\n                rhs.type.kind !== 'value'\n            ) {\n                return context.error(\n                    `Cannot compare types '${typeToString(lhs.type)}' and '${typeToString(rhs.type)}'.`\n                ) as null;\n            }\n\n            if (isOrderComparison) {\n                // typing rules specific to less/greater than operators\n                if (lhs.type.kind === 'value' && rhs.type.kind !== 'value') {\n                    // (value, T)\n                    lhs = new Assertion(rhs.type, [lhs], context.key);\n                } else if (lhs.type.kind !== 'value' && rhs.type.kind === 'value') {\n                    // (T, value)\n                    rhs = new Assertion(lhs.type, [rhs], context.key);\n                }\n            }\n\n            let collator = null;\n            if (args.length === 4) {\n                if (\n                    lhs.type.kind !== 'string' &&\n                    rhs.type.kind !== 'string' &&\n                    lhs.type.kind !== 'value' &&\n                    rhs.type.kind !== 'value'\n                ) {\n                    return context.error(\n                        'Cannot use collator to compare non-string types.'\n                    ) as null;\n                }\n                collator = context.parse(args[3], 3, CollatorType);\n                if (!collator) return null;\n            }\n\n            return new Comparison(lhs, rhs, context.key, collator);\n        }\n\n        evaluate(ctx: EvaluationContext) {\n            const lhs = this.lhs.evaluate(ctx);\n            const rhs = this.rhs.evaluate(ctx);\n\n            if (isOrderComparison && this.hasUntypedArgument) {\n                const lt = typeOf(lhs);\n                const rt = typeOf(rhs);\n                // check that type is string or number, and equal\n                if (lt.kind !== rt.kind || !(lt.kind === 'string' || lt.kind === 'number')) {\n                    throw new RuntimeError(\n                        `Expected arguments for \"${op}\" to be (string, string) or (number, number), but found (${lt.kind}, ${rt.kind}) instead.`,\n                        this.key\n                    );\n                }\n            }\n\n            if (this.collator && !isOrderComparison && this.hasUntypedArgument) {\n                const lt = typeOf(lhs);\n                const rt = typeOf(rhs);\n                if (lt.kind !== 'string' || rt.kind !== 'string') {\n                    return compareBasic(ctx, lhs, rhs);\n                }\n            }\n\n            return this.collator\n                ? compareWithCollator(ctx, lhs, rhs, this.collator.evaluate(ctx))\n                : compareBasic(ctx, lhs, rhs);\n        }\n\n        eachChild(fn: (_: Expression) => void) {\n            fn(this.lhs);\n            fn(this.rhs);\n            if (this.collator) {\n                fn(this.collator);\n            }\n        }\n\n        outputDefined(): boolean {\n            return true;\n        }\n    };\n}\n\nexport const Equals = makeComparison('==', eq, eqCollate);\nexport const NotEquals = makeComparison('!=', neq, neqCollate);\nexport const LessThan = makeComparison('<', lt, ltCollate);\nexport const GreaterThan = makeComparison('>', gt, gtCollate);\nexport const LessThanOrEqual = makeComparison('<=', lteq, lteqCollate);\nexport const GreaterThanOrEqual = makeComparison('>=', gteq, gteqCollate);\n","import {StringType, BooleanType, CollatorType} from '../types';\nimport {Collator} from '../types/collator';\n\nimport type {Expression} from '../expression';\nimport type {EvaluationContext} from '../evaluation_context';\nimport type {ParsingContext} from '../parsing_context';\nimport type {Type} from '../types';\n\nexport class CollatorExpression implements Expression {\n    type: Type;\n    caseSensitive: Expression;\n    diacriticSensitive: Expression;\n    locale: Expression | null;\n\n    constructor(\n        caseSensitive: Expression,\n        diacriticSensitive: Expression,\n        locale: Expression | null\n    ) {\n        this.type = CollatorType;\n        this.locale = locale;\n        this.caseSensitive = caseSensitive;\n        this.diacriticSensitive = diacriticSensitive;\n    }\n\n    static parse(args: ReadonlyArray<unknown>, context: ParsingContext): Expression {\n        if (args.length !== 2) return context.error('Expected one argument.') as null;\n\n        const options = args[1] as any;\n        if (typeof options !== 'object' || Array.isArray(options))\n            return context.error('Collator options argument must be an object.') as null;\n\n        const caseSensitive = context.parse(\n            options['case-sensitive'] === undefined ? false : options['case-sensitive'],\n            1,\n            BooleanType\n        );\n        if (!caseSensitive) return null;\n\n        const diacriticSensitive = context.parse(\n            options['diacritic-sensitive'] === undefined ? false : options['diacritic-sensitive'],\n            1,\n            BooleanType\n        );\n        if (!diacriticSensitive) return null;\n\n        let locale = null;\n        if (options['locale']) {\n            locale = context.parse(options['locale'], 1, StringType);\n            if (!locale) return null;\n        }\n\n        return new CollatorExpression(caseSensitive, diacriticSensitive, locale);\n    }\n\n    evaluate(ctx: EvaluationContext) {\n        return new Collator(\n            this.caseSensitive.evaluate(ctx),\n            this.diacriticSensitive.evaluate(ctx),\n            this.locale ? this.locale.evaluate(ctx) : null\n        );\n    }\n\n    eachChild(fn: (_: Expression) => void) {\n        fn(this.caseSensitive);\n        fn(this.diacriticSensitive);\n        if (this.locale) {\n            fn(this.locale);\n        }\n    }\n\n    outputDefined() {\n        // Technically the set of possible outputs is the combinatoric set of Collators produced\n        // by all possible outputs of locale/caseSensitive/diacriticSensitive\n        // But for the primary use of Collators in comparison operators, we ignore the Collator's\n        // possible outputs anyway, so we can get away with leaving this false for now.\n        return false;\n    }\n}\n","import {StringType, NumberType} from '../types';\n\nimport type {Expression} from '../expression';\nimport type {EvaluationContext} from '../evaluation_context';\nimport type {ParsingContext} from '../parsing_context';\nimport type {Type} from '../types';\n\nexport class NumberFormat implements Expression {\n    type: Type;\n    number: Expression;\n    /**\n     * BCP 47 language tag\n     */\n    locale: Expression | null;\n    /**\n     * ISO 4217 currency code, required if style=currency\n     */\n    currency: Expression | null;\n    /**\n     * CLDR or ECMA-402 unit specifier, required if style=unit\n     */\n    unit: Expression | null;\n    /**\n     * @default 0\n     */\n    minFractionDigits: Expression | null;\n    /**\n     * @default 3\n     */\n    maxFractionDigits: Expression | null;\n\n    constructor(\n        number: Expression,\n        locale: Expression | null,\n        currency: Expression | null,\n        unit: Expression | null,\n        minFractionDigits: Expression | null,\n        maxFractionDigits: Expression | null\n    ) {\n        this.type = StringType;\n        this.number = number;\n        this.locale = locale;\n        this.currency = currency;\n        this.unit = unit;\n        this.minFractionDigits = minFractionDigits;\n        this.maxFractionDigits = maxFractionDigits;\n    }\n\n    static parse(args: ReadonlyArray<unknown>, context: ParsingContext): Expression {\n        if (args.length !== 3) return context.error('Expected two arguments.') as null;\n\n        const number = context.parse(args[1], 1, NumberType);\n        if (!number) return null;\n\n        const options = args[2] as any;\n        if (typeof options !== 'object' || Array.isArray(options))\n            return context.error('NumberFormat options argument must be an object.') as null;\n\n        let locale = null;\n        if (options['locale']) {\n            locale = context.parse(options['locale'], 1, StringType);\n            if (!locale) return null;\n        }\n\n        let currency = null;\n        if (options['currency']) {\n            currency = context.parse(options['currency'], 1, StringType);\n            if (!currency) return null;\n        }\n\n        let unit = null;\n        if (options['unit']) {\n            unit = context.parse(options['unit'], 1, StringType);\n            if (!unit) return null;\n        }\n\n        if (currency && unit) {\n            return context.error(\n                'NumberFormat options `currency` and `unit` are mutually exclusive'\n            ) as null;\n        }\n\n        let minFractionDigits = null;\n        if (options['min-fraction-digits']) {\n            minFractionDigits = context.parse(options['min-fraction-digits'], 1, NumberType);\n            if (!minFractionDigits) return null;\n        }\n\n        let maxFractionDigits = null;\n        if (options['max-fraction-digits']) {\n            maxFractionDigits = context.parse(options['max-fraction-digits'], 1, NumberType);\n            if (!maxFractionDigits) return null;\n        }\n\n        return new NumberFormat(\n            number,\n            locale,\n            currency,\n            unit,\n            minFractionDigits,\n            maxFractionDigits\n        );\n    }\n\n    evaluate(ctx: EvaluationContext) {\n        return new Intl.NumberFormat(this.locale ? this.locale.evaluate(ctx) : [], {\n            style: this.currency ? 'currency' : this.unit ? 'unit' : 'decimal',\n            currency: this.currency ? this.currency.evaluate(ctx) : undefined,\n            unit: this.unit ? this.unit.evaluate(ctx) : undefined,\n            minimumFractionDigits: this.minFractionDigits\n                ? this.minFractionDigits.evaluate(ctx)\n                : undefined,\n            maximumFractionDigits: this.maxFractionDigits\n                ? this.maxFractionDigits.evaluate(ctx)\n                : undefined\n        }).format(this.number.evaluate(ctx));\n    }\n\n    eachChild(fn: (_: Expression) => void) {\n        fn(this.number);\n        if (this.locale) {\n            fn(this.locale);\n        }\n        if (this.currency) {\n            fn(this.currency);\n        }\n        if (this.unit) {\n            fn(this.unit);\n        }\n        if (this.minFractionDigits) {\n            fn(this.minFractionDigits);\n        }\n        if (this.maxFractionDigits) {\n            fn(this.maxFractionDigits);\n        }\n    }\n\n    outputDefined() {\n        return false;\n    }\n}\n","import {\n    NumberType,\n    ValueType,\n    FormattedType,\n    array,\n    StringType,\n    ColorType,\n    ResolvedImageType\n} from '../types';\nimport {\n    Formatted,\n    FormattedSection,\n    VERTICAL_ALIGN_OPTIONS,\n    VerticalAlign\n} from '../types/formatted';\nimport {valueToString, typeOf} from '../values';\n\nimport type {Expression} from '../expression';\nimport type {EvaluationContext} from '../evaluation_context';\nimport type {ParsingContext} from '../parsing_context';\nimport type {Type} from '../types';\n\ntype FormattedSectionExpression = {\n    // Content of a section may be Image expression or other\n    // type of expression that is coercable to 'string'.\n    content: Expression;\n    scale: Expression | null;\n    font: Expression | null;\n    textColor: Expression | null;\n    verticalAlign: Expression | null;\n};\n\nexport class FormatExpression implements Expression {\n    type: Type;\n    sections: Array<FormattedSectionExpression>;\n\n    constructor(sections: Array<FormattedSectionExpression>) {\n        this.type = FormattedType;\n        this.sections = sections;\n    }\n\n    static parse(args: ReadonlyArray<unknown>, context: ParsingContext): Expression {\n        if (args.length < 2) {\n            return context.error('Expected at least one argument.') as null;\n        }\n\n        const firstArg = args[1];\n        if (!Array.isArray(firstArg) && typeof firstArg === 'object') {\n            return context.error('First argument must be an image or text section.') as null;\n        }\n\n        const sections: Array<FormattedSectionExpression> = [];\n        let nextTokenMayBeObject = false;\n        for (let i = 1; i <= args.length - 1; ++i) {\n            const arg = args[i] as any;\n\n            if (nextTokenMayBeObject && typeof arg === 'object' && !Array.isArray(arg)) {\n                nextTokenMayBeObject = false;\n\n                let scale = null;\n                if (arg['font-scale']) {\n                    scale = context.parse(arg['font-scale'], 1, NumberType);\n                    if (!scale) return null;\n                }\n\n                let font = null;\n                if (arg['text-font']) {\n                    font = context.parse(arg['text-font'], 1, array(StringType));\n                    if (!font) return null;\n                }\n\n                let textColor = null;\n                if (arg['text-color']) {\n                    textColor = context.parse(arg['text-color'], 1, ColorType);\n                    if (!textColor) return null;\n                }\n\n                let verticalAlign = null;\n                if (arg['vertical-align']) {\n                    if (\n                        typeof arg['vertical-align'] === 'string' &&\n                        !VERTICAL_ALIGN_OPTIONS.includes(arg['vertical-align'] as VerticalAlign)\n                    ) {\n                        return context.error(\n                            `'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${arg['vertical-align']}' instead.`\n                        ) as null;\n                    }\n\n                    verticalAlign = context.parse(arg['vertical-align'], 1, StringType);\n                    if (!verticalAlign) return null;\n                }\n\n                const lastExpression = sections[sections.length - 1];\n                lastExpression.scale = scale;\n                lastExpression.font = font;\n                lastExpression.textColor = textColor;\n                lastExpression.verticalAlign = verticalAlign;\n            } else {\n                const content = context.parse(args[i], 1, ValueType);\n                if (!content) return null;\n\n                const kind = content.type.kind;\n                if (\n                    kind !== 'string' &&\n                    kind !== 'value' &&\n                    kind !== 'null' &&\n                    kind !== 'resolvedImage'\n                )\n                    return context.error(\n                        \"Formatted text type must be 'string', 'value', 'image' or 'null'.\"\n                    ) as null;\n\n                nextTokenMayBeObject = true;\n                sections.push({\n                    content,\n                    scale: null,\n                    font: null,\n                    textColor: null,\n                    verticalAlign: null\n                });\n            }\n        }\n\n        return new FormatExpression(sections);\n    }\n\n    evaluate(ctx: EvaluationContext) {\n        const evaluateSection = (section) => {\n            const evaluatedContent = section.content.evaluate(ctx);\n            if (typeOf(evaluatedContent) === ResolvedImageType) {\n                return new FormattedSection(\n                    '',\n                    evaluatedContent,\n                    null,\n                    null,\n                    null,\n                    section.verticalAlign ? section.verticalAlign.evaluate(ctx) : null\n                );\n            }\n\n            return new FormattedSection(\n                valueToString(evaluatedContent),\n                null,\n                section.scale ? section.scale.evaluate(ctx) : null,\n                section.font ? section.font.evaluate(ctx).join(',') : null,\n                section.textColor ? section.textColor.evaluate(ctx) : null,\n                section.verticalAlign ? section.verticalAlign.evaluate(ctx) : null\n            );\n        };\n\n        return new Formatted(this.sections.map(evaluateSection));\n    }\n\n    eachChild(fn: (_: Expression) => void) {\n        for (const section of this.sections) {\n            fn(section.content);\n            if (section.scale) {\n                fn(section.scale);\n            }\n            if (section.font) {\n                fn(section.font);\n            }\n            if (section.textColor) {\n                fn(section.textColor);\n            }\n            if (section.verticalAlign) {\n                fn(section.verticalAlign);\n            }\n        }\n    }\n\n    outputDefined() {\n        // Technically the combinatoric set of all children\n        // Usually, this.text will be undefined anyway\n        return false;\n    }\n}\n","import {ResolvedImageType, StringType} from '../types';\nimport {ResolvedImage} from '../types/resolved_image';\n\nimport type {Expression} from '../expression';\nimport type {EvaluationContext} from '../evaluation_context';\nimport type {ParsingContext} from '../parsing_context';\nimport type {Type} from '../types';\n\nexport class ImageExpression implements Expression {\n    type: Type;\n    input: Expression;\n\n    constructor(input: Expression) {\n        this.type = ResolvedImageType;\n        this.input = input;\n    }\n\n    static parse(args: ReadonlyArray<unknown>, context: ParsingContext): Expression {\n        if (args.length !== 2) {\n            return context.error('Expected two arguments.') as null;\n        }\n\n        const name = context.parse(args[1], 1, StringType);\n        if (!name) return context.error('No image name provided.') as null;\n\n        return new ImageExpression(name);\n    }\n\n    evaluate(ctx: EvaluationContext) {\n        const evaluatedImageName = this.input.evaluate(ctx);\n\n        const value = ResolvedImage.fromString(evaluatedImageName);\n        if (value && ctx.availableImages)\n            value.available = ctx.availableImages.indexOf(evaluatedImageName) > -1;\n\n        return value;\n    }\n\n    eachChild(fn: (_: Expression) => void) {\n        fn(this.input);\n    }\n\n    outputDefined() {\n        // The output of image is determined by the list of available images in the evaluation context\n        return false;\n    }\n}\n","import {NumberType, typeToString} from '../types';\n\nimport {typeOf} from '../values';\nimport {RuntimeError} from '../runtime_error';\n\nimport type {Expression} from '../expression';\nimport type {ParsingContext} from '../parsing_context';\nimport type {EvaluationContext} from '../evaluation_context';\nimport type {Type} from '../types';\n\nexport class Length implements Expression {\n    type: Type = NumberType;\n\n    constructor(\n        public input: Expression,\n        public readonly key: string\n    ) {}\n\n    static parse(args: ReadonlyArray<unknown>, context: ParsingContext): Expression {\n        if (args.length !== 2)\n            return context.error(\n                `Expected 1 argument, but found ${args.length - 1} instead.`\n            ) as null;\n\n        const input = context.parse(args[1], 1);\n        if (!input) return null;\n\n        if (\n            input.type.kind !== 'array' &&\n            input.type.kind !== 'string' &&\n            input.type.kind !== 'value'\n        )\n            return context.error(\n                `Expected argument of type string or array, but found ${typeToString(input.type)} instead.`\n            ) as null;\n\n        return new Length(input, context.key);\n    }\n\n    evaluate(ctx: EvaluationContext) {\n        const input = this.input.evaluate(ctx);\n        if (typeof input === 'string') {\n            // The length may be affected by surrogate pairs.\n            return [...input].length;\n        } else if (Array.isArray(input)) {\n            return input.length;\n        } else {\n            throw new RuntimeError(\n                `Expected value to be of type string or array, but found ${typeToString(typeOf(input))} instead.`,\n                this.key\n            );\n        }\n    }\n\n    eachChild(fn: (_: Expression) => void) {\n        fn(this.input);\n    }\n\n    outputDefined() {\n        return false;\n    }\n}\n","import {ICanonicalTileID} from '../tiles_and_coordinates';\n\n// minX, minY, maxX, maxY\nexport type BBox = [number, number, number, number];\n\nexport const EXTENT = 8192;\n\nexport function getTileCoordinates(\n    p: GeoJSON.Position,\n    canonical: ICanonicalTileID\n): [number, number] {\n    const x = mercatorXfromLng(p[0]);\n    const y = mercatorYfromLat(p[1]);\n    const tilesAtZoom = Math.pow(2, canonical.z);\n    return [Math.round(x * tilesAtZoom * EXTENT), Math.round(y * tilesAtZoom * EXTENT)];\n}\n\nexport function getLngLatFromTileCoord(\n    coord: [number, number],\n    canonical: ICanonicalTileID\n): GeoJSON.Position {\n    const tilesAtZoom = Math.pow(2, canonical.z);\n    const x = (coord[0] / EXTENT + canonical.x) / tilesAtZoom;\n    const y = (coord[1] / EXTENT + canonical.y) / tilesAtZoom;\n    return [lngFromMercatorXfromLng(x), latFromMercatorY(y)];\n}\n\nfunction mercatorXfromLng(lng: number) {\n    return (180 + lng) / 360;\n}\n\nfunction lngFromMercatorXfromLng(mercatorX: number) {\n    return mercatorX * 360 - 180;\n}\n\nfunction mercatorYfromLat(lat: number) {\n    return (180 - (180 / Math.PI) * Math.log(Math.tan(Math.PI / 4 + (lat * Math.PI) / 360))) / 360;\n}\n\nfunction latFromMercatorY(mercatorY: number) {\n    return (360 / Math.PI) * Math.atan(Math.exp(((180 - mercatorY * 360) * Math.PI) / 180)) - 90;\n}\n\nexport function updateBBox(bbox: BBox, coord: GeoJSON.Position) {\n    bbox[0] = Math.min(bbox[0], coord[0]);\n    bbox[1] = Math.min(bbox[1], coord[1]);\n    bbox[2] = Math.max(bbox[2], coord[0]);\n    bbox[3] = Math.max(bbox[3], coord[1]);\n}\n\nexport function boxWithinBox(bbox1: BBox, bbox2: BBox) {\n    if (bbox1[0] <= bbox2[0]) return false;\n    if (bbox1[2] >= bbox2[2]) return false;\n    if (bbox1[1] <= bbox2[1]) return false;\n    if (bbox1[3] >= bbox2[3]) return false;\n    return true;\n}\n\nexport function rayIntersect(\n    p: [number, number],\n    p1: [number, number],\n    p2: [number, number]\n): boolean {\n    return (\n        p1[1] > p[1] !== p2[1] > p[1] &&\n        p[0] < ((p2[0] - p1[0]) * (p[1] - p1[1])) / (p2[1] - p1[1]) + p1[0]\n    );\n}\n\nfunction pointOnBoundary(p: [number, number], p1: [number, number], p2: [number, number]): boolean {\n    const x1 = p[0] - p1[0];\n    const y1 = p[1] - p1[1];\n    const x2 = p[0] - p2[0];\n    const y2 = p[1] - p2[1];\n    return x1 * y2 - x2 * y1 === 0 && x1 * x2 <= 0 && y1 * y2 <= 0;\n}\n\n// a, b are end points for line segment1, c and d are end points for line segment2\nexport function segmentIntersectSegment(\n    a: [number, number],\n    b: [number, number],\n    c: [number, number],\n    d: [number, number]\n) {\n    // check if two segments are parallel or not\n    // precondition is end point a, b is inside polygon, if line a->b is\n    // parallel to polygon edge c->d, then a->b won't intersect with c->d\n    const vectorP: [number, number] = [b[0] - a[0], b[1] - a[1]];\n    const vectorQ: [number, number] = [d[0] - c[0], d[1] - c[1]];\n    if (perp(vectorQ, vectorP) === 0) return false;\n\n    // If lines are intersecting with each other, the relative location should be:\n    // a and b lie in different sides of segment c->d\n    // c and d lie in different sides of segment a->b\n    if (twoSided(a, b, c, d) && twoSided(c, d, a, b)) return true;\n    return false;\n}\n\nexport function lineIntersectPolygon(p1, p2, polygon) {\n    for (const ring of polygon) {\n        // loop through every edge of the ring\n        for (let j = 0; j < ring.length - 1; ++j) {\n            if (segmentIntersectSegment(p1, p2, ring[j], ring[j + 1])) {\n                return true;\n            }\n        }\n    }\n    return false;\n}\n\n// ray casting algorithm for detecting if point is in polygon\nexport function pointWithinPolygon(\n    point: [number, number],\n    rings: [number, number][][],\n    trueIfOnBoundary = false\n) {\n    let inside = false;\n    for (const ring of rings) {\n        for (let j = 0; j < ring.length - 1; j++) {\n            if (pointOnBoundary(point, ring[j], ring[j + 1])) return trueIfOnBoundary;\n            if (rayIntersect(point, ring[j], ring[j + 1])) inside = !inside;\n        }\n    }\n    return inside;\n}\n\nexport function pointWithinPolygons(point: [number, number], polygons: [number, number][][][]) {\n    for (const polygon of polygons) {\n        if (pointWithinPolygon(point, polygon)) return true;\n    }\n    return false;\n}\n\nexport function lineStringWithinPolygon(line: [number, number][], polygon: [number, number][][]) {\n    // First, check if geometry points of line segments are all inside polygon\n    for (const point of line) {\n        if (!pointWithinPolygon(point, polygon)) {\n            return false;\n        }\n    }\n\n    // Second, check if there is line segment intersecting polygon edge\n    for (let i = 0; i < line.length - 1; ++i) {\n        if (lineIntersectPolygon(line[i], line[i + 1], polygon)) {\n            return false;\n        }\n    }\n    return true;\n}\n\nexport function lineStringWithinPolygons(\n    line: [number, number][],\n    polygons: [number, number][][][]\n) {\n    for (const polygon of polygons) {\n        if (lineStringWithinPolygon(line, polygon)) return true;\n    }\n    return false;\n}\n\nfunction perp(v1: [number, number], v2: [number, number]) {\n    return v1[0] * v2[1] - v1[1] * v2[0];\n}\n\n// check if p1 and p2 are in different sides of line segment q1->q2\nfunction twoSided(\n    p1: [number, number],\n    p2: [number, number],\n    q1: [number, number],\n    q2: [number, number]\n) {\n    // q1->p1 (x1, y1), q1->p2 (x2, y2), q1->q2 (x3, y3)\n    const x1 = p1[0] - q1[0];\n    const y1 = p1[1] - q1[1];\n    const x2 = p2[0] - q1[0];\n    const y2 = p2[1] - q1[1];\n    const x3 = q2[0] - q1[0];\n    const y3 = q2[1] - q1[1];\n    const det1 = x1 * y3 - x3 * y1;\n    const det2 = x2 * y3 - x3 * y2;\n    if ((det1 > 0 && det2 < 0) || (det1 < 0 && det2 > 0)) return true;\n    return false;\n}\n","import {isValue} from '../values';\nimport type {Type} from '../types';\nimport {BooleanType} from '../types';\nimport type {Expression} from '../expression';\nimport type {ParsingContext} from '../parsing_context';\nimport type {EvaluationContext} from '../evaluation_context';\nimport {ICanonicalTileID} from '../../tiles_and_coordinates';\nimport {\n    BBox,\n    EXTENT,\n    boxWithinBox,\n    getTileCoordinates,\n    lineStringWithinPolygon,\n    lineStringWithinPolygons,\n    pointWithinPolygon,\n    pointWithinPolygons,\n    updateBBox\n} from '../../util/geometry_util';\nimport {Point2D} from '../../point2d';\n\ntype GeoJSONPolygons = GeoJSON.Polygon | GeoJSON.MultiPolygon;\n\nfunction getTilePolygon(\n    coordinates: GeoJSON.Position[][],\n    bbox: BBox,\n    canonical: ICanonicalTileID\n) {\n    const polygon = [];\n    for (let i = 0; i < coordinates.length; i++) {\n        const ring = [];\n        for (let j = 0; j < coordinates[i].length; j++) {\n            const coord = getTileCoordinates(coordinates[i][j], canonical);\n            updateBBox(bbox, coord);\n            ring.push(coord);\n        }\n        polygon.push(ring);\n    }\n    return polygon;\n}\n\nfunction getTilePolygons(\n    coordinates: GeoJSON.Position[][][],\n    bbox: BBox,\n    canonical: ICanonicalTileID\n) {\n    const polygons = [];\n    for (let i = 0; i < coordinates.length; i++) {\n        const polygon = getTilePolygon(coordinates[i], bbox, canonical);\n        polygons.push(polygon);\n    }\n    return polygons;\n}\n\nfunction updatePoint(p: GeoJSON.Position, bbox: BBox, polyBBox: BBox, worldSize: number) {\n    if (p[0] < polyBBox[0] || p[0] > polyBBox[2]) {\n        const halfWorldSize = worldSize * 0.5;\n        let shift =\n            p[0] - polyBBox[0] > halfWorldSize\n                ? -worldSize\n                : polyBBox[0] - p[0] > halfWorldSize\n                  ? worldSize\n                  : 0;\n        if (shift === 0) {\n            shift =\n                p[0] - polyBBox[2] > halfWorldSize\n                    ? -worldSize\n                    : polyBBox[2] - p[0] > halfWorldSize\n                      ? worldSize\n                      : 0;\n        }\n        p[0] += shift;\n    }\n    updateBBox(bbox, p);\n}\n\nfunction resetBBox(bbox: BBox) {\n    bbox[0] = bbox[1] = Infinity;\n    bbox[2] = bbox[3] = -Infinity;\n}\n\nfunction getTilePoints(\n    geometry: Point2D[][],\n    pointBBox: BBox,\n    polyBBox: BBox,\n    canonical: ICanonicalTileID\n): [number, number][] {\n    const worldSize = Math.pow(2, canonical.z) * EXTENT;\n    const shifts = [canonical.x * EXTENT, canonical.y * EXTENT];\n    const tilePoints: [number, number][] = [];\n    for (const points of geometry) {\n        for (const point of points) {\n            const p: [number, number] = [point.x + shifts[0], point.y + shifts[1]];\n            updatePoint(p, pointBBox, polyBBox, worldSize);\n            tilePoints.push(p);\n        }\n    }\n    return tilePoints;\n}\n\nfunction getTileLines(\n    geometry: Point2D[][],\n    lineBBox: BBox,\n    polyBBox: BBox,\n    canonical: ICanonicalTileID\n): [number, number][][] {\n    const worldSize = Math.pow(2, canonical.z) * EXTENT;\n    const shifts = [canonical.x * EXTENT, canonical.y * EXTENT];\n    const tileLines: [number, number][][] = [];\n    for (const line of geometry) {\n        const tileLine: [number, number][] = [];\n        for (const point of line) {\n            const p: [number, number] = [point.x + shifts[0], point.y + shifts[1]];\n            updateBBox(lineBBox, p);\n            tileLine.push(p);\n        }\n        tileLines.push(tileLine);\n    }\n    if (lineBBox[2] - lineBBox[0] <= worldSize / 2) {\n        resetBBox(lineBBox);\n        for (const line of tileLines) {\n            for (const p of line) {\n                updatePoint(p, lineBBox, polyBBox, worldSize);\n            }\n        }\n    }\n    return tileLines;\n}\n\nfunction pointsWithinPolygons(ctx: EvaluationContext, polygonGeometry: GeoJSONPolygons) {\n    const pointBBox: BBox = [Infinity, Infinity, -Infinity, -Infinity];\n    const polyBBox: BBox = [Infinity, Infinity, -Infinity, -Infinity];\n\n    const canonical = ctx.canonicalID();\n\n    if (polygonGeometry.type === 'Polygon') {\n        const tilePolygon = getTilePolygon(polygonGeometry.coordinates, polyBBox, canonical);\n        const tilePoints = getTilePoints(ctx.geometry(), pointBBox, polyBBox, canonical);\n        if (!boxWithinBox(pointBBox, polyBBox)) return false;\n\n        for (const point of tilePoints) {\n            if (!pointWithinPolygon(point, tilePolygon)) return false;\n        }\n    }\n    if (polygonGeometry.type === 'MultiPolygon') {\n        const tilePolygons = getTilePolygons(polygonGeometry.coordinates, polyBBox, canonical);\n        const tilePoints = getTilePoints(ctx.geometry(), pointBBox, polyBBox, canonical);\n        if (!boxWithinBox(pointBBox, polyBBox)) return false;\n\n        for (const point of tilePoints) {\n            if (!pointWithinPolygons(point, tilePolygons)) return false;\n        }\n    }\n\n    return true;\n}\n\nfunction linesWithinPolygons(ctx: EvaluationContext, polygonGeometry: GeoJSONPolygons) {\n    const lineBBox: BBox = [Infinity, Infinity, -Infinity, -Infinity];\n    const polyBBox: BBox = [Infinity, Infinity, -Infinity, -Infinity];\n\n    const canonical = ctx.canonicalID();\n\n    if (polygonGeometry.type === 'Polygon') {\n        const tilePolygon = getTilePolygon(polygonGeometry.coordinates, polyBBox, canonical);\n        const tileLines = getTileLines(ctx.geometry(), lineBBox, polyBBox, canonical);\n        if (!boxWithinBox(lineBBox, polyBBox)) return false;\n\n        for (const line of tileLines) {\n            if (!lineStringWithinPolygon(line, tilePolygon)) return false;\n        }\n    }\n    if (polygonGeometry.type === 'MultiPolygon') {\n        const tilePolygons = getTilePolygons(polygonGeometry.coordinates, polyBBox, canonical);\n        const tileLines = getTileLines(ctx.geometry(), lineBBox, polyBBox, canonical);\n        if (!boxWithinBox(lineBBox, polyBBox)) return false;\n\n        for (const line of tileLines) {\n            if (!lineStringWithinPolygons(line, tilePolygons)) return false;\n        }\n    }\n    return true;\n}\n\nexport class Within implements Expression {\n    type: Type;\n    geojson: GeoJSON.GeoJSON;\n    geometries: GeoJSONPolygons;\n\n    constructor(geojson: GeoJSON.GeoJSON, geometries: GeoJSONPolygons) {\n        this.type = BooleanType;\n        this.geojson = geojson;\n        this.geometries = geometries;\n    }\n\n    static parse(args: ReadonlyArray<unknown>, context: ParsingContext): Expression {\n        if (args.length !== 2)\n            return context.error(\n                `'within' expression requires exactly one argument, but found ${args.length - 1} instead.`\n            ) as null;\n        if (isValue(args[1])) {\n            const geojson = args[1] as any;\n            if (geojson.type === 'FeatureCollection') {\n                const polygonsCoords: GeoJSON.Position[][][] = [];\n                for (const polygon of geojson.features) {\n                    const {type, coordinates} = polygon.geometry;\n                    if (type === 'Polygon') {\n                        polygonsCoords.push(coordinates);\n                    }\n                    if (type === 'MultiPolygon') {\n                        polygonsCoords.push(...coordinates);\n                    }\n                }\n                if (polygonsCoords.length) {\n                    const multipolygonWrapper: GeoJSON.MultiPolygon = {\n                        type: 'MultiPolygon',\n                        coordinates: polygonsCoords\n                    };\n                    return new Within(geojson, multipolygonWrapper);\n                }\n            } else if (geojson.type === 'Feature') {\n                const type = geojson.geometry.type;\n                if (type === 'Polygon' || type === 'MultiPolygon') {\n                    return new Within(geojson, geojson.geometry);\n                }\n            } else if (geojson.type === 'Polygon' || geojson.type === 'MultiPolygon') {\n                return new Within(geojson, geojson);\n            }\n        }\n        return context.error(\n            \"'within' expression requires valid geojson object that contains polygon geometry type.\"\n        ) as null;\n    }\n\n    evaluate(ctx: EvaluationContext) {\n        if (ctx.geometry() != null && ctx.canonicalID() != null) {\n            if (ctx.geometryType() === 'Point') {\n                return pointsWithinPolygons(ctx, this.geometries);\n            } else if (ctx.geometryType() === 'LineString') {\n                return linesWithinPolygons(ctx, this.geometries);\n            }\n        }\n        return false;\n    }\n\n    eachChild() {}\n\n    outputDefined(): boolean {\n        return true;\n    }\n}\n","\nexport default class TinyQueue {\n    constructor(data = [], compare = (a, b) => (a < b ? -1 : a > b ? 1 : 0)) {\n        this.data = data;\n        this.length = this.data.length;\n        this.compare = compare;\n\n        if (this.length > 0) {\n            for (let i = (this.length >> 1) - 1; i >= 0; i--) this._down(i);\n        }\n    }\n\n    push(item) {\n        this.data.push(item);\n        this._up(this.length++);\n    }\n\n    pop() {\n        if (this.length === 0) return undefined;\n\n        const top = this.data[0];\n        const bottom = this.data.pop();\n\n        if (--this.length > 0) {\n            this.data[0] = bottom;\n            this._down(0);\n        }\n\n        return top;\n    }\n\n    peek() {\n        return this.data[0];\n    }\n\n    _up(pos) {\n        const {data, compare} = this;\n        const item = data[pos];\n\n        while (pos > 0) {\n            const parent = (pos - 1) >> 1;\n            const current = data[parent];\n            if (compare(item, current) >= 0) break;\n            data[pos] = current;\n            pos = parent;\n        }\n\n        data[pos] = item;\n    }\n\n    _down(pos) {\n        const {data, compare} = this;\n        const halfLength = this.length >> 1;\n        const item = data[pos];\n\n        while (pos < halfLength) {\n            let bestChild = (pos << 1) + 1; // initially it is the left child\n            const right = bestChild + 1;\n\n            if (right < this.length && compare(data[right], data[bestChild]) < 0) {\n                bestChild = right;\n            }\n            if (compare(data[bestChild], item) >= 0) break;\n\n            data[pos] = data[bestChild];\n            pos = bestChild;\n        }\n\n        data[pos] = item;\n    }\n}\n","\n/**\n * Rearranges items so that all items in the [left, k] are the smallest.\n * The k-th element will have the (k - left + 1)-th smallest value in [left, right].\n *\n * @template T\n * @param {T[]} arr the array to partially sort (in place)\n * @param {number} k middle index for partial sorting (as defined above)\n * @param {number} [left=0] left index of the range to sort\n * @param {number} [right=arr.length-1] right index\n * @param {(a: T, b: T) => number} [compare = (a, b) => a - b] compare function\n */\nexport default function quickselect(arr, k, left = 0, right = arr.length - 1, compare = defaultCompare) {\n\n    while (right > left) {\n        if (right - left > 600) {\n            const n = right - left + 1;\n            const m = k - left + 1;\n            const z = Math.log(n);\n            const s = 0.5 * Math.exp(2 * z / 3);\n            const sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1);\n            const newLeft = Math.max(left, Math.floor(k - m * s / n + sd));\n            const newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd));\n            quickselect(arr, k, newLeft, newRight, compare);\n        }\n\n        const t = arr[k];\n        let i = left;\n        /** @type {number} */\n        let j = right;\n\n        swap(arr, left, k);\n        if (compare(arr[right], t) > 0) swap(arr, left, right);\n\n        while (i < j) {\n            swap(arr, i, j);\n            i++;\n            j--;\n            while (compare(arr[i], t) < 0) i++;\n            while (compare(arr[j], t) > 0) j--;\n        }\n\n        if (compare(arr[left], t) === 0) swap(arr, left, j);\n        else {\n            j++;\n            swap(arr, j, right);\n        }\n\n        if (j <= k) left = j + 1;\n        if (k <= j) right = j - 1;\n    }\n}\n\n/**\n * @template T\n * @param {T[]} arr\n * @param {number} i\n * @param {number} j\n */\nfunction swap(arr, i, j) {\n    const tmp = arr[i];\n    arr[i] = arr[j];\n    arr[j] = tmp;\n}\n\n/**\n * @template T\n * @param {T} a\n * @param {T} b\n * @returns {number}\n */\nfunction defaultCompare(a, b) {\n    return a < b ? -1 : a > b ? 1 : 0;\n}\n","import quickselect from 'quickselect';\nimport {Point2D} from '../point2d';\n\nexport type RingWithArea<T extends Point2D> = T[] & {area?: number};\n\n/**\n * Classifies an array of rings into polygons with outer rings and holes\n * @param rings - the rings to classify\n * @param maxRings - the maximum number of rings to include in a polygon, use 0 to include all rings\n * @returns an array of polygons with internal rings as holes\n */\nexport function classifyRings<T extends Point2D>(\n    rings: RingWithArea<T>[],\n    maxRings?: number\n): RingWithArea<T>[][] {\n    const len = rings.length;\n\n    if (len <= 1) return [rings];\n\n    const polygons: RingWithArea<T>[][] = [];\n    let polygon: RingWithArea<T>[];\n    let ccw: boolean | undefined;\n\n    for (const ring of rings) {\n        const area = calculateSignedArea(ring);\n        if (area === 0) continue;\n\n        ring.area = Math.abs(area);\n\n        if (ccw === undefined) ccw = area < 0;\n\n        if (ccw === area < 0) {\n            if (polygon) polygons.push(polygon);\n            polygon = [ring];\n        } else {\n            polygon.push(ring);\n        }\n    }\n    if (polygon) polygons.push(polygon);\n\n    // Earcut performance degrades with the # of rings in a polygon. For this\n    // reason, we limit strip out all but the `maxRings` largest rings.\n    if (maxRings > 1) {\n        for (let j = 0; j < polygons.length; j++) {\n            if (polygons[j].length <= maxRings) continue;\n            quickselect(polygons[j], maxRings, 1, polygons[j].length - 1, compareAreas);\n            polygons[j] = polygons[j].slice(0, maxRings);\n        }\n    }\n\n    return polygons;\n}\n\nfunction compareAreas<T extends Point2D>(a: RingWithArea<T>, b: RingWithArea<T>): number {\n    return b.area - a.area;\n}\n\n/**\n * Returns the signed area for the polygon ring.  Positive areas are exterior rings and\n * have a clockwise winding.  Negative areas are interior rings and have a counter clockwise\n * ordering.\n *\n * @param ring - Exterior or interior ring\n * @returns Signed area\n */\nfunction calculateSignedArea(ring: Point2D[]): number {\n    let sum = 0;\n    for (let i = 0, len = ring.length, j = len - 1, p1, p2; i < len; j = i++) {\n        p1 = ring[i];\n        p2 = ring[j];\n        sum += (p2.x - p1.x) * (p1.y + p2.y);\n    }\n    return sum;\n}\n","// This is taken from https://github.com/mapbox/cheap-ruler/ in order to take only the relevant parts\n\n// Values that define WGS84 ellipsoid model of the Earth\nconst RE = 6378.137; // equatorial radius\nconst FE = 1 / 298.257223563; // flattening\n\nconst E2 = FE * (2 - FE);\nconst RAD = Math.PI / 180;\n\nexport class CheapRuler {\n    private kx: number;\n    private ky: number;\n\n    constructor(lat: number) {\n        // Curvature formulas from https://en.wikipedia.org/wiki/Earth_radius#Meridional\n        const m = RAD * RE * 1000;\n        const coslat = Math.cos(lat * RAD);\n        const w2 = 1 / (1 - E2 * (1 - coslat * coslat));\n        const w = Math.sqrt(w2);\n\n        // multipliers for converting longitude and latitude degrees into distance\n        this.kx = m * w * coslat; // based on normal radius of curvature\n        this.ky = m * w * w2 * (1 - E2); // based on meridional radius of curvature\n    }\n\n    /**\n     * Given two points of the form [longitude, latitude], returns the distance.\n     *\n     * @param a - point [longitude, latitude]\n     * @param b - point [longitude, latitude]\n     * @returns distance\n     * @example\n     * const distance = ruler.distance([30.5, 50.5], [30.51, 50.49]);\n     * //=distance\n     */\n    public distance(a: [number, number], b: [number, number]) {\n        const dx = this.wrap(a[0] - b[0]) * this.kx;\n        const dy = (a[1] - b[1]) * this.ky;\n        return Math.sqrt(dx * dx + dy * dy);\n    }\n\n    /**\n     * Returns an object of the form {point, index, t}, where point is closest point on the line\n     * from the given point, index is the start index of the segment with the closest point,\n     * and t is a parameter from 0 to 1 that indicates where the closest point is on that segment.\n     *\n     * @param line - an array of points that form the line\n     * @param p - point [longitude, latitude]\n     * @returns the nearest point, its index in the array and the proportion along the line\n     * @example\n     * const point = ruler.pointOnLine(line, [-67.04, 50.5]).point;\n     * //=point\n     */\n    public pointOnLine(line: [number, number][], p: [number, number]) {\n        let minDist = Infinity;\n        let minX: number, minY: number, minI: number, minT: number;\n\n        for (let i = 0; i < line.length - 1; i++) {\n            let x = line[i][0];\n            let y = line[i][1];\n            let dx = this.wrap(line[i + 1][0] - x) * this.kx;\n            let dy = (line[i + 1][1] - y) * this.ky;\n            let t = 0;\n\n            if (dx !== 0 || dy !== 0) {\n                t =\n                    (this.wrap(p[0] - x) * this.kx * dx + (p[1] - y) * this.ky * dy) /\n                    (dx * dx + dy * dy);\n\n                if (t > 1) {\n                    x = line[i + 1][0];\n                    y = line[i + 1][1];\n                } else if (t > 0) {\n                    x += (dx / this.kx) * t;\n                    y += (dy / this.ky) * t;\n                }\n            }\n\n            dx = this.wrap(p[0] - x) * this.kx;\n            dy = (p[1] - y) * this.ky;\n\n            const sqDist = dx * dx + dy * dy;\n            if (sqDist < minDist) {\n                minDist = sqDist;\n                minX = x;\n                minY = y;\n                minI = i;\n                minT = t;\n            }\n        }\n\n        return {\n            point: [minX, minY] as [number, number],\n            index: minI,\n            t: Math.max(0, Math.min(1, minT))\n        };\n    }\n\n    private wrap(deg: number) {\n        while (deg < -180) deg += 360;\n        while (deg > 180) deg -= 360;\n        return deg;\n    }\n}\n","import TinyQueue from 'tinyqueue';\nimport {Expression} from '../expression';\nimport {ParsingContext} from '../parsing_context';\nimport {NumberType, Type} from '../types';\nimport {isValue} from '../values';\nimport {EvaluationContext} from '../evaluation_context';\nimport {\n    BBox,\n    boxWithinBox,\n    getLngLatFromTileCoord,\n    pointWithinPolygon,\n    segmentIntersectSegment,\n    updateBBox\n} from '../../util/geometry_util';\nimport {classifyRings} from '../../util/classify_rings';\nimport {CheapRuler} from '../../util/cheap_ruler';\n\ntype SimpleGeometry = GeoJSON.Polygon | GeoJSON.LineString | GeoJSON.Point;\n\nconst MinPointsSize = 100;\nconst MinLinePointsSize = 50;\n\ntype IndexRange = [number, number];\ntype DistPair = [number, IndexRange, IndexRange];\n\nfunction compareDistPair(a: DistPair, b: DistPair): number {\n    return b[0] - a[0];\n}\n\nfunction getRangeSize(range: IndexRange) {\n    return range[1] - range[0] + 1;\n}\n\nfunction isRangeSafe(range: IndexRange, threshold: number): boolean {\n    return range[1] >= range[0] && range[1] < threshold;\n}\n\nfunction splitRange(range: IndexRange, isLine: boolean): [IndexRange, IndexRange] {\n    if (range[0] > range[1]) {\n        return [null, null];\n    }\n    const size = getRangeSize(range);\n    if (isLine) {\n        if (size === 2) {\n            return [range, null];\n        }\n        const size1 = Math.floor(size / 2);\n        return [\n            [range[0], range[0] + size1],\n            [range[0] + size1, range[1]]\n        ];\n    }\n    if (size === 1) {\n        return [range, null];\n    }\n    const size1 = Math.floor(size / 2) - 1;\n    return [\n        [range[0], range[0] + size1],\n        [range[0] + size1 + 1, range[1]]\n    ];\n}\n\nfunction getBBox(coords: [number, number][], range: IndexRange): BBox {\n    if (!isRangeSafe(range, coords.length)) {\n        return [Infinity, Infinity, -Infinity, -Infinity];\n    }\n\n    const bbox: BBox = [Infinity, Infinity, -Infinity, -Infinity];\n    for (let i = range[0]; i <= range[1]; ++i) {\n        updateBBox(bbox, coords[i]);\n    }\n    return bbox;\n}\n\nfunction getPolygonBBox(polygon: [number, number][][]): BBox {\n    const bbox: BBox = [Infinity, Infinity, -Infinity, -Infinity];\n    for (const ring of polygon) {\n        for (const coord of ring) {\n            updateBBox(bbox, coord);\n        }\n    }\n    return bbox;\n}\n\nfunction isValidBBox(bbox: BBox): boolean {\n    return (\n        bbox[0] !== -Infinity &&\n        bbox[1] !== -Infinity &&\n        bbox[2] !== Infinity &&\n        bbox[3] !== Infinity\n    );\n}\n\n// Calculate the distance between two bounding boxes.\n// Calculate the delta in x and y direction, and use two fake points {0.0, 0.0}\n// and {dx, dy} to calculate the distance. Distance will be 0.0 if bounding box are overlapping.\nfunction bboxToBBoxDistance(bbox1: BBox, bbox2: BBox, ruler: CheapRuler): number {\n    if (!isValidBBox(bbox1) || !isValidBBox(bbox2)) {\n        return NaN;\n    }\n    let dx = 0.0;\n    let dy = 0.0;\n    // bbox1 in left side\n    if (bbox1[2] < bbox2[0]) {\n        dx = bbox2[0] - bbox1[2];\n    }\n    // bbox1 in right side\n    if (bbox1[0] > bbox2[2]) {\n        dx = bbox1[0] - bbox2[2];\n    }\n    // bbox1 in above side\n    if (bbox1[1] > bbox2[3]) {\n        dy = bbox1[1] - bbox2[3];\n    }\n    // bbox1 in down side\n    if (bbox1[3] < bbox2[1]) {\n        dy = bbox2[1] - bbox1[3];\n    }\n    return ruler.distance([0.0, 0.0], [dx, dy]);\n}\n\nfunction pointToLineDistance(\n    point: [number, number],\n    line: [number, number][],\n    ruler: CheapRuler\n): number {\n    const nearestPoint = ruler.pointOnLine(line, point);\n    return ruler.distance(point, nearestPoint.point);\n}\n\nfunction segmentToSegmentDistance(\n    p1: [number, number],\n    p2: [number, number],\n    q1: [number, number],\n    q2: [number, number],\n    ruler: CheapRuler\n): number {\n    const dist1 = Math.min(\n        pointToLineDistance(p1, [q1, q2], ruler),\n        pointToLineDistance(p2, [q1, q2], ruler)\n    );\n    const dist2 = Math.min(\n        pointToLineDistance(q1, [p1, p2], ruler),\n        pointToLineDistance(q2, [p1, p2], ruler)\n    );\n    return Math.min(dist1, dist2);\n}\n\nfunction lineToLineDistance(\n    line1: [number, number][],\n    range1: IndexRange,\n    line2: [number, number][],\n    range2: IndexRange,\n    ruler: CheapRuler\n): number {\n    const rangeSafe = isRangeSafe(range1, line1.length) && isRangeSafe(range2, line2.length);\n    if (!rangeSafe) {\n        return Infinity;\n    }\n\n    let dist = Infinity;\n    for (let i = range1[0]; i < range1[1]; ++i) {\n        const p1 = line1[i];\n        const p2 = line1[i + 1];\n        for (let j = range2[0]; j < range2[1]; ++j) {\n            const q1 = line2[j];\n            const q2 = line2[j + 1];\n            if (segmentIntersectSegment(p1, p2, q1, q2)) {\n                return 0.0;\n            }\n            dist = Math.min(dist, segmentToSegmentDistance(p1, p2, q1, q2, ruler));\n        }\n    }\n    return dist;\n}\n\nfunction pointsToPointsDistance(\n    points1: [number, number][],\n    range1: IndexRange,\n    points2: [number, number][],\n    range2: IndexRange,\n    ruler: CheapRuler\n): number {\n    const rangeSafe = isRangeSafe(range1, points1.length) && isRangeSafe(range2, points2.length);\n    if (!rangeSafe) {\n        return NaN;\n    }\n\n    let dist = Infinity;\n    for (let i = range1[0]; i <= range1[1]; ++i) {\n        for (let j = range2[0]; j <= range2[1]; ++j) {\n            dist = Math.min(dist, ruler.distance(points1[i], points2[j]));\n            if (dist === 0.0) {\n                return dist;\n            }\n        }\n    }\n    return dist;\n}\n\nfunction pointToPolygonDistance(\n    point: [number, number],\n    polygon: [number, number][][],\n    ruler: CheapRuler\n): number {\n    if (pointWithinPolygon(point, polygon, true)) {\n        return 0.0;\n    }\n    let dist = Infinity;\n    for (const ring of polygon) {\n        const front = ring[0];\n        const back = ring[ring.length - 1];\n        if (front !== back) {\n            dist = Math.min(dist, pointToLineDistance(point, [back, front], ruler));\n            if (dist === 0.0) {\n                return dist;\n            }\n        }\n        const nearestPoint = ruler.pointOnLine(ring, point);\n        dist = Math.min(dist, ruler.distance(point, nearestPoint.point));\n        if (dist === 0.0) {\n            return dist;\n        }\n    }\n    return dist;\n}\n\nfunction lineToPolygonDistance(\n    line: [number, number][],\n    range: IndexRange,\n    polygon: [number, number][][],\n    ruler: CheapRuler\n): number {\n    if (!isRangeSafe(range, line.length)) {\n        return NaN;\n    }\n\n    for (let i = range[0]; i <= range[1]; ++i) {\n        if (pointWithinPolygon(line[i], polygon, true)) {\n            return 0.0;\n        }\n    }\n\n    let dist = Infinity;\n    for (let i = range[0]; i < range[1]; ++i) {\n        const p1 = line[i];\n        const p2 = line[i + 1];\n        for (const ring of polygon) {\n            for (let j = 0, len = ring.length, k = len - 1; j < len; k = j++) {\n                const q1 = ring[k];\n                const q2 = ring[j];\n                if (segmentIntersectSegment(p1, p2, q1, q2)) {\n                    return 0.0;\n                }\n                dist = Math.min(dist, segmentToSegmentDistance(p1, p2, q1, q2, ruler));\n            }\n        }\n    }\n    return dist;\n}\n\nfunction polygonIntersect(poly1: [number, number][][], poly2: [number, number][][]): boolean {\n    for (const ring of poly1) {\n        for (const point of ring) {\n            if (pointWithinPolygon(point, poly2, true)) {\n                return true;\n            }\n        }\n    }\n    return false;\n}\n\nfunction polygonToPolygonDistance(\n    polygon1: [number, number][][],\n    polygon2: [number, number][][],\n    ruler,\n    currentMiniDist = Infinity\n): number {\n    const bbox1 = getPolygonBBox(polygon1);\n    const bbox2 = getPolygonBBox(polygon2);\n    if (\n        currentMiniDist !== Infinity &&\n        bboxToBBoxDistance(bbox1, bbox2, ruler) >= currentMiniDist\n    ) {\n        return currentMiniDist;\n    }\n\n    if (boxWithinBox(bbox1, bbox2)) {\n        if (polygonIntersect(polygon1, polygon2)) {\n            return 0.0;\n        }\n    } else if (polygonIntersect(polygon2, polygon1)) {\n        return 0.0;\n    }\n\n    let dist = Infinity;\n    for (const ring1 of polygon1) {\n        for (let i = 0, len1 = ring1.length, l = len1 - 1; i < len1; l = i++) {\n            const p1 = ring1[l];\n            const p2 = ring1[i];\n            for (const ring2 of polygon2) {\n                for (let j = 0, len2 = ring2.length, k = len2 - 1; j < len2; k = j++) {\n                    const q1 = ring2[k];\n                    const q2 = ring2[j];\n                    if (segmentIntersectSegment(p1, p2, q1, q2)) {\n                        return 0.0;\n                    }\n                    dist = Math.min(dist, segmentToSegmentDistance(p1, p2, q1, q2, ruler));\n                }\n            }\n        }\n    }\n    return dist;\n}\n\nfunction updateQueue(\n    distQueue: TinyQueue<DistPair>,\n    miniDist: number,\n    ruler: CheapRuler,\n    points: [number, number][],\n    polyBBox: BBox,\n    rangeA?: IndexRange\n) {\n    if (!rangeA) {\n        return;\n    }\n    const tempDist = bboxToBBoxDistance(getBBox(points, rangeA), polyBBox, ruler);\n    // Insert new pair to the queue if the bbox distance is less than\n    // miniDist, The pair with biggest distance will be at the top\n    if (tempDist < miniDist) {\n        distQueue.push([tempDist, rangeA, [0, 0]]);\n    }\n}\n\nfunction updateQueueTwoSets(\n    distQueue: TinyQueue<DistPair>,\n    miniDist: number,\n    ruler: CheapRuler,\n    pointSet1: [number, number][],\n    pointSet2: [number, number][],\n    range1?: IndexRange,\n    range2?: IndexRange\n) {\n    if (!range1 || !range2) {\n        return;\n    }\n    const tempDist = bboxToBBoxDistance(\n        getBBox(pointSet1, range1),\n        getBBox(pointSet2, range2),\n        ruler\n    );\n    // Insert new pair to the queue if the bbox distance is less than\n    // miniDist, The pair with biggest distance will be at the top\n    if (tempDist < miniDist) {\n        distQueue.push([tempDist, range1, range2]);\n    }\n}\n\n// Divide and conquer, the time complexity is O(n*lgn), faster than Brute force\n// O(n*n) Most of the time, use index for in-place processing.\nfunction pointsToPolygonDistance(\n    points: [number, number][],\n    isLine: boolean,\n    polygon: [number, number][][],\n    ruler: CheapRuler,\n    currentMiniDist = Infinity\n) {\n    let miniDist = Math.min(ruler.distance(points[0], polygon[0][0]), currentMiniDist);\n    if (miniDist === 0.0) {\n        return miniDist;\n    }\n\n    const distQueue = new TinyQueue<DistPair>(\n        [[0, [0, points.length - 1], [0, 0]]],\n        compareDistPair\n    );\n\n    const polyBBox = getPolygonBBox(polygon);\n    while (distQueue.length > 0) {\n        const distPair = distQueue.pop();\n        if (distPair[0] >= miniDist) {\n            continue;\n        }\n\n        const range = distPair[1];\n\n        // In case the set size are relatively small, we could use brute-force directly\n        const threshold = isLine ? MinLinePointsSize : MinPointsSize;\n        if (getRangeSize(range) <= threshold) {\n            if (!isRangeSafe(range, points.length)) {\n                return NaN;\n            }\n            if (isLine) {\n                const tempDist = lineToPolygonDistance(points, range, polygon, ruler);\n                if (isNaN(tempDist) || tempDist === 0.0) {\n                    return tempDist;\n                }\n                miniDist = Math.min(miniDist, tempDist);\n            } else {\n                for (let i = range[0]; i <= range[1]; ++i) {\n                    const tempDist = pointToPolygonDistance(points[i], polygon, ruler);\n                    miniDist = Math.min(miniDist, tempDist);\n                    if (miniDist === 0.0) {\n                        return 0.0;\n                    }\n                }\n            }\n        } else {\n            const newRangesA = splitRange(range, isLine);\n\n            updateQueue(distQueue, miniDist, ruler, points, polyBBox, newRangesA[0]);\n            updateQueue(distQueue, miniDist, ruler, points, polyBBox, newRangesA[1]);\n        }\n    }\n    return miniDist;\n}\n\nfunction pointSetToPointSetDistance(\n    pointSet1: [number, number][],\n    isLine1: boolean,\n    pointSet2: [number, number][],\n    isLine2: boolean,\n    ruler: CheapRuler,\n    currentMiniDist = Infinity\n): number {\n    let miniDist = Math.min(currentMiniDist, ruler.distance(pointSet1[0], pointSet2[0]));\n    if (miniDist === 0.0) {\n        return miniDist;\n    }\n\n    const distQueue = new TinyQueue<DistPair>(\n        [[0, [0, pointSet1.length - 1], [0, pointSet2.length - 1]]],\n        compareDistPair\n    );\n\n    while (distQueue.length > 0) {\n        const distPair = distQueue.pop();\n        if (distPair[0] >= miniDist) {\n            continue;\n        }\n\n        const rangeA = distPair[1];\n        const rangeB = distPair[2];\n        const threshold1 = isLine1 ? MinLinePointsSize : MinPointsSize;\n        const threshold2 = isLine2 ? MinLinePointsSize : MinPointsSize;\n\n        // In case the set size are relatively small, we could use brute-force directly\n        if (getRangeSize(rangeA) <= threshold1 && getRangeSize(rangeB) <= threshold2) {\n            if (!isRangeSafe(rangeA, pointSet1.length) && isRangeSafe(rangeB, pointSet2.length)) {\n                return NaN;\n            }\n            let tempDist: number;\n            if (isLine1 && isLine2) {\n                tempDist = lineToLineDistance(pointSet1, rangeA, pointSet2, rangeB, ruler);\n                miniDist = Math.min(miniDist, tempDist);\n            } else if (isLine1 && !isLine2) {\n                const sublibe = pointSet1.slice(rangeA[0], rangeA[1] + 1);\n                for (let i = rangeB[0]; i <= rangeB[1]; ++i) {\n                    tempDist = pointToLineDistance(pointSet2[i], sublibe, ruler);\n                    miniDist = Math.min(miniDist, tempDist);\n                    if (miniDist === 0.0) {\n                        return miniDist;\n                    }\n                }\n            } else if (!isLine1 && isLine2) {\n                const sublibe = pointSet2.slice(rangeB[0], rangeB[1] + 1);\n                for (let i = rangeA[0]; i <= rangeA[1]; ++i) {\n                    tempDist = pointToLineDistance(pointSet1[i], sublibe, ruler);\n                    miniDist = Math.min(miniDist, tempDist);\n                    if (miniDist === 0.0) {\n                        return miniDist;\n                    }\n                }\n            } else {\n                tempDist = pointsToPointsDistance(pointSet1, rangeA, pointSet2, rangeB, ruler);\n                miniDist = Math.min(miniDist, tempDist);\n            }\n        } else {\n            const newRangesA = splitRange(rangeA, isLine1);\n            const newRangesB = splitRange(rangeB, isLine2);\n            updateQueueTwoSets(\n                distQueue,\n                miniDist,\n                ruler,\n                pointSet1,\n                pointSet2,\n                newRangesA[0],\n                newRangesB[0]\n            );\n            updateQueueTwoSets(\n                distQueue,\n                miniDist,\n                ruler,\n                pointSet1,\n                pointSet2,\n                newRangesA[0],\n                newRangesB[1]\n            );\n            updateQueueTwoSets(\n                distQueue,\n                miniDist,\n                ruler,\n                pointSet1,\n                pointSet2,\n                newRangesA[1],\n                newRangesB[0]\n            );\n            updateQueueTwoSets(\n                distQueue,\n                miniDist,\n                ruler,\n                pointSet1,\n                pointSet2,\n                newRangesA[1],\n                newRangesB[1]\n            );\n        }\n    }\n    return miniDist;\n}\n\nfunction pointToGeometryDistance(ctx: EvaluationContext, geometries: SimpleGeometry[]) {\n    const tilePoints = ctx.geometry();\n    const pointPosition = tilePoints\n        .flat()\n        .map((p) => getLngLatFromTileCoord([p.x, p.y], ctx.canonical) as [number, number]);\n    if (tilePoints.length === 0) {\n        return NaN;\n    }\n    const ruler = new CheapRuler(pointPosition[0][1]);\n    let dist = Infinity;\n    for (const geometry of geometries) {\n        switch (geometry.type) {\n            case 'Point':\n                dist = Math.min(\n                    dist,\n                    pointSetToPointSetDistance(\n                        pointPosition,\n                        false,\n                        [geometry.coordinates as [number, number]],\n                        false,\n                        ruler,\n                        dist\n                    )\n                );\n                break;\n            case 'LineString':\n                dist = Math.min(\n                    dist,\n                    pointSetToPointSetDistance(\n                        pointPosition,\n                        false,\n                        geometry.coordinates as [number, number][],\n                        true,\n                        ruler,\n                        dist\n                    )\n                );\n                break;\n            case 'Polygon':\n                dist = Math.min(\n                    dist,\n                    pointsToPolygonDistance(\n                        pointPosition,\n                        false,\n                        geometry.coordinates as [number, number][][],\n                        ruler,\n                        dist\n                    )\n                );\n                break;\n        }\n        if (dist === 0.0) {\n            return dist;\n        }\n    }\n    return dist;\n}\n\nfunction lineStringToGeometryDistance(ctx: EvaluationContext, geometries: SimpleGeometry[]) {\n    const tileLine = ctx.geometry();\n    const linePositions = tileLine\n        .flat()\n        .map((p) => getLngLatFromTileCoord([p.x, p.y], ctx.canonical) as [number, number]);\n    if (tileLine.length === 0) {\n        return NaN;\n    }\n    const ruler = new CheapRuler(linePositions[0][1]);\n    let dist = Infinity;\n    for (const geometry of geometries) {\n        switch (geometry.type) {\n            case 'Point':\n                dist = Math.min(\n                    dist,\n                    pointSetToPointSetDistance(\n                        linePositions,\n                        true,\n                        [geometry.coordinates as [number, number]],\n                        false,\n                        ruler,\n                        dist\n                    )\n                );\n                break;\n            case 'LineString':\n                dist = Math.min(\n                    dist,\n                    pointSetToPointSetDistance(\n                        linePositions,\n                        true,\n                        geometry.coordinates as [number, number][],\n                        true,\n                        ruler,\n                        dist\n                    )\n                );\n                break;\n            case 'Polygon':\n                dist = Math.min(\n                    dist,\n                    pointsToPolygonDistance(\n                        linePositions,\n                        true,\n                        geometry.coordinates as [number, number][][],\n                        ruler,\n                        dist\n                    )\n                );\n                break;\n        }\n        if (dist === 0.0) {\n            return dist;\n        }\n    }\n    return dist;\n}\n\nfunction polygonToGeometryDistance(ctx: EvaluationContext, geometries: SimpleGeometry[]) {\n    const tilePolygon = ctx.geometry();\n    if (tilePolygon.length === 0 || tilePolygon[0].length === 0) {\n        return NaN;\n    }\n    const polygons = classifyRings(tilePolygon, 0).map((polygon) => {\n        return polygon.map((ring) => {\n            return ring.map(\n                (p) => getLngLatFromTileCoord([p.x, p.y], ctx.canonical) as [number, number]\n            );\n        });\n    });\n    const ruler = new CheapRuler(polygons[0][0][0][1]);\n    let dist = Infinity;\n    for (const geometry of geometries) {\n        for (const polygon of polygons) {\n            switch (geometry.type) {\n                case 'Point':\n                    dist = Math.min(\n                        dist,\n                        pointsToPolygonDistance(\n                            [geometry.coordinates as [number, number]],\n                            false,\n                            polygon,\n                            ruler,\n                            dist\n                        )\n                    );\n                    break;\n                case 'LineString':\n                    dist = Math.min(\n                        dist,\n                        pointsToPolygonDistance(\n                            geometry.coordinates as [number, number][],\n                            true,\n                            polygon,\n                            ruler,\n                            dist\n                        )\n                    );\n                    break;\n                case 'Polygon':\n                    dist = Math.min(\n                        dist,\n                        polygonToPolygonDistance(\n                            polygon,\n                            geometry.coordinates as [number, number][][],\n                            ruler,\n                            dist\n                        )\n                    );\n                    break;\n            }\n            if (dist === 0.0) {\n                return dist;\n            }\n        }\n    }\n    return dist;\n}\n\nfunction toSimpleGeometry(\n    geometry: Exclude<GeoJSON.Geometry, GeoJSON.GeometryCollection>\n): SimpleGeometry[] {\n    if (geometry.type === 'MultiPolygon') {\n        return geometry.coordinates.map((polygon) => {\n            return {\n                type: 'Polygon',\n                coordinates: polygon\n            };\n        });\n    }\n    if (geometry.type === 'MultiLineString') {\n        return geometry.coordinates.map((lineString) => {\n            return {\n                type: 'LineString',\n                coordinates: lineString\n            };\n        });\n    }\n    if (geometry.type === 'MultiPoint') {\n        return geometry.coordinates.map((point) => {\n            return {\n                type: 'Point',\n                coordinates: point\n            };\n        });\n    }\n    return [geometry];\n}\n\nexport class Distance implements Expression {\n    type: Type;\n    geojson: GeoJSON.GeoJSON;\n    geometries: SimpleGeometry[];\n\n    constructor(geojson: GeoJSON.GeoJSON, geometries: SimpleGeometry[]) {\n        this.type = NumberType;\n        this.geojson = geojson;\n        this.geometries = geometries;\n    }\n\n    static parse(args: ReadonlyArray<unknown>, context: ParsingContext): Expression {\n        if (args.length !== 2)\n            return context.error(\n                `'distance' expression requires exactly one argument, but found ${args.length - 1} instead.`\n            ) as null;\n        if (isValue(args[1])) {\n            const geojson = args[1] as any;\n            if (geojson.type === 'FeatureCollection') {\n                return new Distance(\n                    geojson,\n                    geojson.features.map((feature) => toSimpleGeometry(feature.geometry)).flat()\n                );\n            } else if (geojson.type === 'Feature') {\n                return new Distance(geojson, toSimpleGeometry(geojson.geometry));\n            } else if ('type' in geojson && 'coordinates' in geojson) {\n                return new Distance(geojson, toSimpleGeometry(geojson));\n            }\n        }\n        return context.error(\n            \"'distance' expression requires valid geojson object that contains polygon geometry type.\"\n        ) as null;\n    }\n\n    evaluate(ctx: EvaluationContext) {\n        if (ctx.geometry() != null && ctx.canonicalID() != null) {\n            if (ctx.geometryType() === 'Point') {\n                return pointToGeometryDistance(ctx, this.geometries);\n            } else if (ctx.geometryType() === 'LineString') {\n                return lineStringToGeometryDistance(ctx, this.geometries);\n            } else if (ctx.geometryType() === 'Polygon') {\n                return polygonToGeometryDistance(ctx, this.geometries);\n            }\n        }\n        return NaN;\n    }\n\n    eachChild() {}\n\n    outputDefined(): boolean {\n        return true;\n    }\n}\n","import {ValueType, array} from '../types';\n\nimport type {Expression} from '../expression';\nimport type {ParsingContext} from '../parsing_context';\nimport type {EvaluationContext} from '../evaluation_context';\nimport type {Type} from '../types';\nimport {typeOf, Value, isValue} from '../values';\nimport {Literal} from './literal';\n\nexport class Semiliteral implements Expression {\n    type: Type;\n    arr: Array<Expression>;\n\n    constructor(arr: Array<Expression>) {\n        let elementType: Type | null = null;\n        for (const expr of arr) {\n            if (!elementType) {\n                elementType = expr.type;\n            } else if (elementType === expr.type) {\n                continue;\n            } else {\n                elementType = ValueType;\n                break;\n            }\n        }\n        this.type = array(elementType ?? ValueType, arr.length);\n        this.arr = arr;\n    }\n\n    static parse(args: ReadonlyArray<unknown>, context: ParsingContext): Expression {\n        if (args.length !== 2)\n            return context.error(\n                `'semiliteral' expression requires exactly one argument, but found ${args.length - 1} instead.`\n            ) as null;\n\n        if (!isValue(args[1]))\n            return context.error(`invalid value of type \"${typeof args[1]}\"`) as null;\n\n        const value = args[1] as Value;\n        const type = typeOf(value);\n\n        if (type.kind === 'array') {\n            const arr = value as Array<unknown>;\n            const arrayContext = context.concat(1);\n            const parsed: Expression[] = [];\n            for (let i = 0; i < arr.length; i++) {\n                const item = arrayContext.parse(arr[i], i, ValueType);\n                if (!item) return null;\n                parsed.push(item);\n            }\n            return new Semiliteral(parsed);\n        } else {\n            return new Literal(type, value);\n        }\n    }\n\n    evaluate(ctx: EvaluationContext): Array<Value> {\n        return this.arr.map((arg) => arg.evaluate(ctx));\n    }\n\n    eachChild(fn: (_: Expression) => void) {\n        this.arr.forEach(fn);\n    }\n\n    outputDefined() {\n        return this.arr.every((arg) => arg.outputDefined());\n    }\n}\n","import {Type, ValueType} from '../types';\nimport type {Expression} from '../expression';\nimport {ParsingContext} from '../parsing_context';\nimport {EvaluationContext} from '../evaluation_context';\nimport {getOwn} from '../../util/get_own';\n\nexport class GlobalState implements Expression {\n    type: Type = ValueType;\n\n    constructor(public readonly key: string) {}\n\n    static parse(args: ReadonlyArray<unknown>, context: ParsingContext): Expression {\n        if (args.length !== 2) {\n            return context.error(\n                `Expected 1 argument, but found ${args.length - 1} instead.`\n            ) as null;\n        }\n\n        const key = args[1];\n\n        if (key === undefined || key === null) {\n            return context.error('Global state property must be defined.') as null;\n        }\n\n        if (typeof key !== 'string') {\n            return context.error(\n                `Global state property must be string, but found ${typeof args[1]} instead.`\n            ) as null;\n        }\n\n        return new GlobalState(key);\n    }\n\n    evaluate(ctx: EvaluationContext) {\n        const globalState = ctx.globals?.globalState;\n\n        if (!globalState || Object.keys(globalState).length === 0) return null;\n\n        return getOwn(globalState, this.key) ?? null;\n    }\n\n    eachChild() {}\n\n    outputDefined() {\n        return false;\n    }\n}\n","import {Let} from './let';\nimport {Var} from './var';\nimport {Literal} from './literal';\nimport {Assertion} from './assertion';\nimport {Coercion} from './coercion';\nimport {At} from './at';\nimport {In} from './in';\nimport {IndexOf} from './index_of';\nimport {Match} from './match';\nimport {Case} from './case';\nimport {Slice} from './slice';\nimport {Step} from './step';\nimport {Interpolate} from './interpolate';\nimport {Coalesce} from './coalesce';\nimport {\n    Equals,\n    NotEquals,\n    LessThan,\n    GreaterThan,\n    LessThanOrEqual,\n    GreaterThanOrEqual\n} from './comparison';\nimport {CollatorExpression} from './collator';\nimport {NumberFormat} from './number_format';\nimport {FormatExpression} from './format';\nimport {ImageExpression} from './image';\nimport {Length} from './length';\nimport {Within} from './within';\nimport {Distance} from './distance';\nimport {Semiliteral} from './semiliteral';\nimport {GlobalState} from './global_state';\n\nimport type {ExpressionRegistry} from '../expression';\n\nexport const expressions: ExpressionRegistry = {\n    // special forms\n    '==': Equals,\n    '!=': NotEquals,\n    '>': GreaterThan,\n    '<': LessThan,\n    '>=': GreaterThanOrEqual,\n    '<=': LessThanOrEqual,\n    array: Assertion,\n    at: At,\n    boolean: Assertion,\n    case: Case,\n    coalesce: Coalesce,\n    collator: CollatorExpression,\n    format: FormatExpression,\n    image: ImageExpression,\n    in: In,\n    'index-of': IndexOf,\n    interpolate: Interpolate,\n    'interpolate-hcl': Interpolate,\n    'interpolate-lab': Interpolate,\n    'interpolate-oklch': Interpolate,\n    'interpolate-oklab': Interpolate,\n    length: Length,\n    let: Let,\n    literal: Literal,\n    match: Match,\n    number: Assertion,\n    'number-format': NumberFormat,\n    object: Assertion,\n    semiliteral: Semiliteral,\n    slice: Slice,\n    step: Step,\n    string: Assertion,\n    'to-boolean': Coercion,\n    'to-color': Coercion,\n    'to-number': Coercion,\n    'to-string': Coercion,\n    var: Var,\n    within: Within,\n    distance: Distance,\n    'global-state': GlobalState\n};\n","import {ExpressionParsingError} from './parsing_error';\nimport {ParsingContext} from './parsing_context';\nimport {EvaluationContext} from './evaluation_context';\nimport {\n    CompoundExpression,\n    isFeatureConstant,\n    isGlobalPropertyConstant,\n    isStateConstant,\n    isExpressionConstant\n} from './compound_expression';\nimport {Step} from './definitions/step';\nimport {Interpolate} from './definitions/interpolate';\nimport {Coalesce} from './definitions/coalesce';\nimport {Let} from './definitions/let';\nimport {expressions} from './definitions';\nimport {Color} from './types/color';\nimport {Padding} from './types/padding';\nimport {NumberArray} from './types/number_array';\nimport {ColorArray} from './types/color_array';\nimport {VariableAnchorOffsetCollection} from './types/variable_anchor_offset_collection';\nimport {ProjectionDefinition} from './types/projection_definition';\nimport {GlobalState} from './definitions/global_state';\nimport {RuntimeError} from './runtime_error';\nimport {success, error} from '../util/result';\nimport {\n    supportsPropertyExpression,\n    supportsZoomExpression,\n    supportsInterpolation\n} from '../util/properties';\nimport {\n    ColorType,\n    StringType,\n    NumberType,\n    BooleanType,\n    ValueType,\n    FormattedType,\n    PaddingType,\n    ResolvedImageType,\n    VariableAnchorOffsetCollectionType,\n    array,\n    type Type,\n    type EvaluationKind,\n    ProjectionDefinitionType,\n    NumberArrayType,\n    ColorArrayType\n} from './types';\nimport {ICanonicalTileID} from '../tiles_and_coordinates';\nimport {isFunction, createFunction} from '../function';\n\nimport type {Value} from './values';\nimport type {Expression} from './expression';\nimport type {StylePropertySpecification} from '..';\nimport type {Result} from '../util/result';\nimport type {InterpolationType} from './definitions/interpolate';\nimport type {FormattedSection} from './types/formatted';\nimport type {Point2D} from '../point2d';\nimport type {StyleFunction} from '../function';\nimport type {\n    PaddingSpecification,\n    NumberArraySpecification,\n    ColorArraySpecification,\n    PropertyValueSpecification,\n    VariableAnchorOffsetCollectionSpecification\n} from '../types.g';\n\nexport type Feature = {\n    readonly type:\n        | 0\n        | 1\n        | 2\n        | 3\n        | 'Unknown'\n        | 'Point'\n        | 'MultiPoint'\n        | 'LineString'\n        | 'MultiLineString'\n        | 'Polygon'\n        | 'MultiPolygon';\n    readonly id?: any;\n    readonly properties: {[_: string]: any};\n    readonly patterns?: {\n        [_: string]: {\n            min: string;\n            mid: string;\n            max: string;\n        };\n    };\n    readonly dashes?: {\n        [_: string]: {\n            min: string;\n            mid: string;\n            max: string;\n        };\n    };\n    readonly geometry?: Array<Array<Point2D>>;\n};\n\nexport type FeatureState = {[_: string]: any};\n\nexport type GlobalProperties = Readonly<{\n    zoom: number;\n    heatmapDensity?: number;\n    elevation?: number;\n    lineProgress?: number;\n    isSupportedScript?: (_: string) => boolean;\n    accumulated?: Value;\n    globalState?: Record<string, any>;\n}>;\n\nexport class StyleExpression {\n    expression: Expression;\n\n    _evaluator: EvaluationContext;\n    _defaultValue: Value;\n    _warningHistory: {[key: string]: boolean};\n    _enumValues: {[_: string]: any};\n    readonly _globalState: Record<string, any>;\n    readonly _rootKey: string;\n\n    constructor(\n        expression: Expression,\n        rootKey: string,\n        propertySpec?: StylePropertySpecification | null,\n        globalState?: Record<string, any>\n    ) {\n        this.expression = expression;\n        this._warningHistory = {};\n        this._evaluator = new EvaluationContext();\n        this._defaultValue = propertySpec ? getDefaultValue(propertySpec) : null;\n        this._enumValues =\n            propertySpec && propertySpec.type === 'enum' ? propertySpec.values : null;\n        this._globalState = globalState;\n        this._rootKey = rootKey;\n    }\n\n    evaluateWithoutErrorHandling(\n        globals: GlobalProperties,\n        feature?: Feature,\n        featureState?: FeatureState,\n        canonical?: ICanonicalTileID,\n        availableImages?: Array<string>,\n        formattedSection?: FormattedSection\n    ): any {\n        if (this._globalState) {\n            globals = addGlobalState(globals, this._globalState);\n        }\n        this._evaluator.globals = globals;\n        this._evaluator.feature = feature;\n        this._evaluator.featureState = featureState;\n        this._evaluator.canonical = canonical;\n        this._evaluator.availableImages = availableImages || null;\n        this._evaluator.formattedSection = formattedSection;\n\n        return this.expression.evaluate(this._evaluator);\n    }\n\n    evaluate(\n        globals: GlobalProperties,\n        feature?: Feature,\n        featureState?: FeatureState,\n        canonical?: ICanonicalTileID,\n        availableImages?: Array<string>,\n        formattedSection?: FormattedSection\n    ): any {\n        if (this._globalState) {\n            globals = addGlobalState(globals, this._globalState);\n        }\n        this._evaluator.globals = globals;\n        this._evaluator.feature = feature || null;\n        this._evaluator.featureState = featureState || null;\n        this._evaluator.canonical = canonical;\n        this._evaluator.availableImages = availableImages || null;\n        this._evaluator.formattedSection = formattedSection || null;\n\n        try {\n            const val = this.expression.evaluate(this._evaluator);\n            if (val === null || val === undefined || (typeof val === 'number' && val !== val)) {\n                return this._defaultValue;\n            }\n            if (this._enumValues && !(val in this._enumValues)) {\n                throw new RuntimeError(\n                    `Expected value to be one of ${Object.keys(this._enumValues)\n                        .map((v) => JSON.stringify(v))\n                        .join(', ')}, but found ${JSON.stringify(val)} instead.`,\n                    ''\n                );\n            }\n            return val;\n        } catch (e) {\n            // A non-RuntimeError throw has no location, so treat it as the root ('').\n            const path = e instanceof RuntimeError ? e.path : '';\n            const dedupKey = `${path}|${e.message}`;\n            if (!this._warningHistory[dedupKey]) {\n                this._warningHistory[dedupKey] = true;\n                if (typeof console !== 'undefined') {\n                    console.warn(\n                        formatRuntimeWarning(this._rootKey, path, e.message, this._defaultValue)\n                    );\n                }\n            }\n            return this._defaultValue;\n        }\n    }\n}\n\n/**\n * Builds the warning logged when an expression or legacy function fails at\n * evaluation: a `rootKey + index path` location prefix, plus the fallback\n * value being used.\n * @param rootKey Caller-supplied location of the expression in the style JSON\n * @param path Index path of the throwing sub-expression ('' for the root)\n * @param message The error message from the failed evaluation\n * @param defaultValue The value being fallen back to\n * @returns The formatted warning string\n */\nfunction formatRuntimeWarning(\n    rootKey: string,\n    path: string,\n    message: string,\n    defaultValue: Value\n): string {\n    const fallback = defaultValue == null ? '' : ` Falling back to ${String(defaultValue)}.`;\n    return `${rootKey}${path}: ${message}${fallback}`;\n}\n\n/**\n * Rejects a missing or empty root key. The location prefix is what makes\n * runtime warnings actionable, so callers must always supply one; failing\n * here surfaces the programmer error at style load instead of producing\n * unattributable warnings at render time.\n * @param rootKey The root key to check\n */\nfunction assertRootKey(rootKey: string): void {\n    if (!rootKey) {\n        throw new Error(\n            'rootKey must identify the location of the expression in the style JSON, e.g. \"layers[3].paint.line-width\".'\n        );\n    }\n}\n\nexport function isExpression(expression: unknown) {\n    return (\n        Array.isArray(expression) &&\n        expression.length > 0 &&\n        typeof expression[0] === 'string' &&\n        expression[0] in expressions\n    );\n}\n\n/**\n * Parse and typecheck the given style spec JSON expression.  If\n * options.defaultValue is provided, then the resulting StyleExpression's\n * `evaluate()` method will handle errors by logging a warning (once per\n * message) and returning the default value.  Otherwise, it will throw\n * evaluation errors.\n *\n * @private\n */\nexport function createExpression(\n    expression: unknown,\n    rootKey: string,\n    propertySpec?: StylePropertySpecification | null,\n    globalState?: Record<string, any>\n): Result<StyleExpression, Array<ExpressionParsingError>> {\n    assertRootKey(rootKey);\n    const parser = new ParsingContext(\n        expressions,\n        isExpressionConstant,\n        [],\n        propertySpec ? getExpectedType(propertySpec) : undefined\n    );\n\n    // For string-valued properties, coerce to string at the top level rather than asserting.\n    const parsed = parser.parse(\n        expression,\n        undefined,\n        undefined,\n        undefined,\n        propertySpec && propertySpec.type === 'string' ? {typeAnnotation: 'coerce'} : undefined\n    );\n\n    if (!parsed) {\n        return error(parser.errors);\n    }\n\n    return success(new StyleExpression(parsed, rootKey, propertySpec, globalState));\n}\n\nexport class ZoomConstantExpression<Kind extends EvaluationKind> {\n    kind: Kind;\n    isStateDependent: boolean;\n    globalStateRefs: Set<string>;\n    _styleExpression: StyleExpression;\n    readonly _globalState: Record<string, any>;\n\n    constructor(kind: Kind, expression: StyleExpression, globalState?: Record<string, any>) {\n        this.kind = kind;\n        this._styleExpression = expression;\n        this.isStateDependent =\n            kind !== ('constant' as EvaluationKind) && !isStateConstant(expression.expression);\n        this.globalStateRefs = findGlobalStateRefs(expression.expression);\n        this._globalState = globalState;\n    }\n\n    evaluateWithoutErrorHandling(\n        globals: GlobalProperties,\n        feature?: Feature,\n        featureState?: FeatureState,\n        canonical?: ICanonicalTileID,\n        availableImages?: Array<string>,\n        formattedSection?: FormattedSection\n    ): any {\n        if (this._globalState) {\n            globals = addGlobalState(globals, this._globalState);\n        }\n        return this._styleExpression.evaluateWithoutErrorHandling(\n            globals,\n            feature,\n            featureState,\n            canonical,\n            availableImages,\n            formattedSection\n        );\n    }\n\n    evaluate(\n        globals: GlobalProperties,\n        feature?: Feature,\n        featureState?: FeatureState,\n        canonical?: ICanonicalTileID,\n        availableImages?: Array<string>,\n        formattedSection?: FormattedSection\n    ): any {\n        if (this._globalState) {\n            globals = addGlobalState(globals, this._globalState);\n        }\n        return this._styleExpression.evaluate(\n            globals,\n            feature,\n            featureState,\n            canonical,\n            availableImages,\n            formattedSection\n        );\n    }\n}\n\nexport class ZoomDependentExpression<Kind extends EvaluationKind> {\n    kind: Kind;\n    zoomStops: Array<number>;\n    isStateDependent: boolean;\n    globalStateRefs: Set<string>;\n    _styleExpression: StyleExpression;\n    interpolationType: InterpolationType;\n    readonly _globalState: Record<string, any>;\n\n    constructor(\n        kind: Kind,\n        expression: StyleExpression,\n        zoomStops: Array<number>,\n        interpolationType?: InterpolationType,\n        globalState?: Record<string, any>\n    ) {\n        this.kind = kind;\n        this.zoomStops = zoomStops;\n        this._styleExpression = expression;\n        this.isStateDependent =\n            kind !== ('camera' as EvaluationKind) && !isStateConstant(expression.expression);\n        this.globalStateRefs = findGlobalStateRefs(expression.expression);\n        this.interpolationType = interpolationType;\n        this._globalState = globalState;\n    }\n\n    evaluateWithoutErrorHandling(\n        globals: GlobalProperties,\n        feature?: Feature,\n        featureState?: FeatureState,\n        canonical?: ICanonicalTileID,\n        availableImages?: Array<string>,\n        formattedSection?: FormattedSection\n    ): any {\n        if (this._globalState) {\n            globals = addGlobalState(globals, this._globalState);\n        }\n        return this._styleExpression.evaluateWithoutErrorHandling(\n            globals,\n            feature,\n            featureState,\n            canonical,\n            availableImages,\n            formattedSection\n        );\n    }\n\n    evaluate(\n        globals: GlobalProperties,\n        feature?: Feature,\n        featureState?: FeatureState,\n        canonical?: ICanonicalTileID,\n        availableImages?: Array<string>,\n        formattedSection?: FormattedSection\n    ): any {\n        if (this._globalState) {\n            globals = addGlobalState(globals, this._globalState);\n        }\n        return this._styleExpression.evaluate(\n            globals,\n            feature,\n            featureState,\n            canonical,\n            availableImages,\n            formattedSection\n        );\n    }\n\n    interpolationFactor(input: number, lower: number, upper: number): number {\n        if (this.interpolationType) {\n            return Interpolate.interpolationFactor(this.interpolationType, input, lower, upper);\n        } else {\n            return 0;\n        }\n    }\n}\n\nexport function isZoomExpression(\n    expression: any\n): expression is ZoomConstantExpression<'source'> | ZoomDependentExpression<'source'> {\n    return (expression as ZoomConstantExpression<'source'>)._styleExpression !== undefined;\n}\n\nexport type ConstantExpression = {\n    kind: 'constant';\n    globalStateRefs: Set<string>;\n    readonly _globalState: Record<string, any>;\n    readonly evaluate: (\n        globals: GlobalProperties,\n        feature?: Feature,\n        featureState?: FeatureState,\n        canonical?: ICanonicalTileID,\n        availableImages?: Array<string>\n    ) => any;\n};\n\nexport type SourceExpression = {\n    kind: 'source';\n    isStateDependent: boolean;\n    globalStateRefs: Set<string>;\n    readonly _globalState: Record<string, any>;\n    readonly evaluate: (\n        globals: GlobalProperties,\n        feature?: Feature,\n        featureState?: FeatureState,\n        canonical?: ICanonicalTileID,\n        availableImages?: Array<string>,\n        formattedSection?: FormattedSection\n    ) => any;\n};\n\nexport type CameraExpression = {\n    kind: 'camera';\n    globalStateRefs: Set<string>;\n    readonly _globalState: Record<string, any>;\n    readonly evaluate: (\n        globals: GlobalProperties,\n        feature?: Feature,\n        featureState?: FeatureState,\n        canonical?: ICanonicalTileID,\n        availableImages?: Array<string>\n    ) => any;\n    readonly interpolationFactor: (input: number, lower: number, upper: number) => number;\n    zoomStops: Array<number>;\n    interpolationType: InterpolationType;\n};\n\nexport type CompositeExpression = {\n    kind: 'composite';\n    isStateDependent: boolean;\n    globalStateRefs: Set<string>;\n    readonly _globalState: Record<string, any>;\n    readonly evaluate: (\n        globals: GlobalProperties,\n        feature?: Feature,\n        featureState?: FeatureState,\n        canonical?: ICanonicalTileID,\n        availableImages?: Array<string>,\n        formattedSection?: FormattedSection\n    ) => any;\n    readonly interpolationFactor: (input: number, lower: number, upper: number) => number;\n    zoomStops: Array<number>;\n    interpolationType: InterpolationType;\n};\n\nexport type StylePropertyExpression =\n    | ConstantExpression\n    | SourceExpression\n    | CameraExpression\n    | CompositeExpression;\n\nexport function createPropertyExpression(\n    expressionInput: unknown,\n    rootKey: string,\n    propertySpec: StylePropertySpecification,\n    globalState?: Record<string, any>\n): Result<StylePropertyExpression, Array<ExpressionParsingError>> {\n    const expression = createExpression(expressionInput, rootKey, propertySpec, globalState);\n    if (expression.result === 'error') {\n        return expression;\n    }\n\n    const parsed = expression.value.expression;\n\n    const isFeatureConstantResult = isFeatureConstant(parsed);\n    if (!isFeatureConstantResult && !supportsPropertyExpression(propertySpec)) {\n        return error([new ExpressionParsingError('', 'data expressions not supported')]);\n    }\n\n    const isZoomConstant = isGlobalPropertyConstant(parsed, ['zoom']);\n    if (!isZoomConstant && !supportsZoomExpression(propertySpec)) {\n        return error([new ExpressionParsingError('', 'zoom expressions not supported')]);\n    }\n\n    const zoomCurve = findZoomCurve(parsed);\n    if (!zoomCurve && !isZoomConstant) {\n        return error([\n            new ExpressionParsingError(\n                '',\n                '\"zoom\" expression may only be used as input to a top-level \"step\" or \"interpolate\" expression.'\n            )\n        ]);\n    } else if (zoomCurve instanceof ExpressionParsingError) {\n        return error([zoomCurve]);\n    } else if (zoomCurve instanceof Interpolate && !supportsInterpolation(propertySpec)) {\n        return error([\n            new ExpressionParsingError(\n                '',\n                '\"interpolate\" expressions cannot be used with this property'\n            )\n        ]);\n    }\n\n    if (!zoomCurve) {\n        return success(\n            isFeatureConstantResult\n                ? (new ZoomConstantExpression(\n                      'constant',\n                      expression.value,\n                      globalState\n                  ) as ConstantExpression)\n                : (new ZoomConstantExpression(\n                      'source',\n                      expression.value,\n                      globalState\n                  ) as SourceExpression)\n        );\n    }\n\n    const interpolationType =\n        zoomCurve instanceof Interpolate ? zoomCurve.interpolation : undefined;\n\n    return success(\n        isFeatureConstantResult\n            ? (new ZoomDependentExpression(\n                  'camera',\n                  expression.value,\n                  zoomCurve.labels,\n                  interpolationType,\n                  globalState\n              ) as CameraExpression)\n            : (new ZoomDependentExpression(\n                  'composite',\n                  expression.value,\n                  zoomCurve.labels,\n                  interpolationType,\n                  globalState\n              ) as CompositeExpression)\n    );\n}\n\n// serialization wrapper for old-style stop functions normalized to the\n// expression interface\nexport class StylePropertyFunction<T> {\n    _parameters: PropertyValueSpecification<T>;\n    _specification: StylePropertySpecification;\n    readonly _rootKey: string;\n    readonly _defaultValue: Value;\n    _warningHistory: {[key: string]: boolean};\n    _innerEvaluate: (globals: GlobalProperties, feature?: Feature) => any;\n\n    kind: StyleFunction['kind'];\n    interpolationFactor: (input: number, lower: number, upper: number) => number;\n    zoomStops: Array<number>;\n    interpolationType: InterpolationType | null;\n    isStateDependent: boolean = false; // Legacy functions cannot reference feature state or global state, so these are constant.\n    globalStateRefs: Set<string> = new Set<string>();\n    readonly _globalState: Record<string, any> = null;\n\n    constructor(\n        parameters: PropertyValueSpecification<T>,\n        rootKey: string,\n        specification: StylePropertySpecification\n    ) {\n        assertRootKey(rootKey);\n        this._parameters = parameters;\n        this._specification = specification;\n        this._rootKey = rootKey;\n        this._defaultValue = getDefaultValue(specification);\n        this._warningHistory = {};\n\n        const fn = createFunction(this._parameters, this._specification);\n        this.kind = fn.kind;\n        this.interpolationFactor = fn.interpolationFactor;\n        this.zoomStops = fn.zoomStops;\n        this.interpolationType = fn.interpolationType;\n        this._innerEvaluate = fn.evaluate;\n    }\n\n    /**\n     * Evaluates the legacy function, handling a runtime throw (e.g. interpolating\n     * mismatched value types) by warning with the property location and falling\n     * back to the spec default, mirroring {@link StyleExpression.evaluate}.\n     * @param globals Global evaluation properties (e.g. zoom)\n     * @param feature The feature being evaluated, if any\n     * @returns The function result, or the spec default if evaluation throws\n     */\n    evaluate(globals: GlobalProperties, feature?: Feature): any {\n        try {\n            return this._innerEvaluate(globals, feature);\n        } catch (e) {\n            const message = e instanceof Error ? e.message : String(e);\n            // Legacy functions have no parser index path, so the location is '' (root).\n            const dedupKey = `|${message}`;\n            if (!this._warningHistory[dedupKey]) {\n                this._warningHistory[dedupKey] = true;\n                if (typeof console !== 'undefined') {\n                    console.warn(\n                        formatRuntimeWarning(this._rootKey, '', message, this._defaultValue)\n                    );\n                }\n            }\n            return this._defaultValue;\n        }\n    }\n\n    static deserialize<T>(serialized: {\n        _parameters: PropertyValueSpecification<T>;\n        _specification: StylePropertySpecification;\n        _rootKey: string;\n    }) {\n        return new StylePropertyFunction(\n            serialized._parameters,\n            serialized._rootKey,\n            serialized._specification\n        ) as StylePropertyFunction<T>;\n    }\n\n    static serialize<T>(input: StylePropertyFunction<T>) {\n        return {\n            _parameters: input._parameters,\n            _specification: input._specification,\n            _rootKey: input._rootKey\n        };\n    }\n}\n\nexport function normalizePropertyExpression<T>(\n    value: PropertyValueSpecification<T>,\n    rootKey: string,\n    specification: StylePropertySpecification,\n    globalState?: Record<string, any>\n): StylePropertyExpression {\n    if (isFunction(value)) {\n        return new StylePropertyFunction(value, rootKey, specification);\n    } else if (isExpression(value)) {\n        const expression = createPropertyExpression(value, rootKey, specification, globalState);\n        if (expression.result === 'error') {\n            // this should have been caught in validation\n            throw new Error(expression.value.map((err) => `${err.key}: ${err.message}`).join(', '));\n        }\n        return expression.value;\n    } else {\n        let constant: any = value;\n        if (specification.type === 'color' && typeof value === 'string') {\n            constant = Color.parse(value);\n        } else if (\n            specification.type === 'padding' &&\n            (typeof value === 'number' || Array.isArray(value))\n        ) {\n            constant = Padding.parse(value as PaddingSpecification);\n        } else if (\n            specification.type === 'numberArray' &&\n            (typeof value === 'number' || Array.isArray(value))\n        ) {\n            constant = NumberArray.parse(value as NumberArraySpecification);\n        } else if (\n            specification.type === 'colorArray' &&\n            (typeof value === 'string' || Array.isArray(value))\n        ) {\n            constant = ColorArray.parse(value as ColorArraySpecification);\n        } else if (\n            specification.type === 'variableAnchorOffsetCollection' &&\n            Array.isArray(value)\n        ) {\n            constant = VariableAnchorOffsetCollection.parse(\n                value as VariableAnchorOffsetCollectionSpecification\n            );\n        } else if (specification.type === 'projectionDefinition' && typeof value === 'string') {\n            constant = ProjectionDefinition.parse(value);\n        }\n        return {\n            globalStateRefs: new Set<string>(),\n            _globalState: null,\n            kind: 'constant',\n            evaluate: () => constant\n        };\n    }\n}\n\ntype ZoomCurveResult = Step | Interpolate | ExpressionParsingError | null;\n\n// Zoom-dependent expressions may only use [\"zoom\"] as the input to a top-level \"step\" or \"interpolate\"\n// expression (collectively referred to as a \"curve\"). The curve may be wrapped in one or more \"let\" or\n// \"coalesce\" expressions.\n// A `Let`'s result and a `Coalesce`'s arguments are searched twice: directly, and again through `eachChild`.\n// `seen` lets the second search reuse the first result, which keeps nested `let` and `coalesce` expressions linear.\nfunction findZoomCurve(\n    expression: Expression,\n    seen: Map<Expression, ZoomCurveResult> = new Map()\n): ZoomCurveResult {\n    if (seen.has(expression)) {\n        return seen.get(expression);\n    }\n    let result = null;\n    if (expression instanceof Let) {\n        result = findZoomCurve(expression.result, seen);\n    } else if (expression instanceof Coalesce) {\n        for (const arg of expression.args) {\n            result = findZoomCurve(arg, seen);\n            if (result) {\n                break;\n            }\n        }\n    } else if (\n        (expression instanceof Step || expression instanceof Interpolate) &&\n        expression.input instanceof CompoundExpression &&\n        expression.input.name === 'zoom'\n    ) {\n        result = expression;\n    }\n\n    if (result instanceof ExpressionParsingError) {\n        seen.set(expression, result);\n        return result;\n    }\n\n    expression.eachChild((child) => {\n        const childResult = findZoomCurve(child, seen);\n        if (childResult instanceof ExpressionParsingError) {\n            result = childResult;\n        } else if (!result && childResult) {\n            result = new ExpressionParsingError(\n                '',\n                '\"zoom\" expression may only be used as input to a top-level \"step\" or \"interpolate\" expression.'\n            );\n        } else if (result && childResult && result !== childResult) {\n            result = new ExpressionParsingError(\n                '',\n                'Only one zoom-based \"step\" or \"interpolate\" subexpression may be used in an expression.'\n            );\n        }\n    });\n\n    seen.set(expression, result);\n    return result;\n}\n\nexport function findGlobalStateRefs(\n    expression: Expression,\n    results = new Set<string>()\n): Set<string> {\n    if (expression instanceof GlobalState) {\n        results.add(expression.key);\n    }\n\n    expression.eachChild((childExpression) => {\n        findGlobalStateRefs(childExpression, results);\n    });\n    return results;\n}\n\nfunction getExpectedType(spec: StylePropertySpecification): Type {\n    const types = {\n        color: ColorType,\n        string: StringType,\n        number: NumberType,\n        enum: StringType,\n        boolean: BooleanType,\n        formatted: FormattedType,\n        padding: PaddingType,\n        numberArray: NumberArrayType,\n        colorArray: ColorArrayType,\n        projectionDefinition: ProjectionDefinitionType,\n        resolvedImage: ResolvedImageType,\n        variableAnchorOffsetCollection: VariableAnchorOffsetCollectionType\n    };\n\n    if (spec.type === 'array') {\n        return array(types[spec.value] || ValueType, spec.length);\n    }\n\n    return types[spec.type];\n}\n\nfunction getDefaultValue(spec: StylePropertySpecification): Value {\n    if (spec.type === 'color' && isFunction(spec.default)) {\n        // Special case for heatmap-color: it uses the 'default:' to define a\n        // default color ramp, but createExpression expects a simple value to fall\n        // back to in case of runtime errors\n        return new Color(0, 0, 0, 0);\n    }\n    switch (spec.type) {\n        case 'color':\n            return Color.parse(spec.default) || null;\n        case 'padding':\n            return Padding.parse(spec.default) || null;\n        case 'numberArray':\n            return NumberArray.parse(spec.default) || null;\n        case 'colorArray':\n            return ColorArray.parse(spec.default) || null;\n        case 'variableAnchorOffsetCollection':\n            return VariableAnchorOffsetCollection.parse(spec.default) || null;\n        case 'projectionDefinition':\n            return ProjectionDefinition.parse(spec.default) || null;\n        default:\n            return spec.default === undefined ? null : spec.default;\n    }\n}\n\nfunction addGlobalState(\n    globals: GlobalProperties,\n    globalState: Record<string, any>\n): GlobalProperties {\n    const {zoom, heatmapDensity, elevation, lineProgress, isSupportedScript, accumulated} =\n        globals ?? {};\n    return {\n        zoom,\n        heatmapDensity,\n        elevation,\n        lineProgress,\n        isSupportedScript,\n        accumulated,\n        globalState\n    };\n}\n","import type {StylePropertySpecification} from '..';\n\nfunction convertLiteral(value) {\n    return typeof value === 'object' ? ['literal', value] : value;\n}\n\nexport function convertFunction(parameters: any, propertySpec: StylePropertySpecification) {\n    let stops = parameters.stops;\n    if (!stops) {\n        // identity function\n        return convertIdentityFunction(parameters, propertySpec);\n    }\n\n    const zoomAndFeatureDependent = stops && typeof stops[0][0] === 'object';\n    const featureDependent = zoomAndFeatureDependent || parameters.property !== undefined;\n    const zoomDependent = zoomAndFeatureDependent || !featureDependent;\n\n    stops = stops.map((stop) => {\n        if (!featureDependent && (propertySpec as any).tokens && typeof stop[1] === 'string') {\n            return [stop[0], convertTokenString(stop[1])];\n        }\n        return [stop[0], convertLiteral(stop[1])];\n    });\n\n    if (zoomAndFeatureDependent) {\n        return convertZoomAndPropertyFunction(parameters, propertySpec, stops);\n    } else if (zoomDependent) {\n        return convertZoomFunction(parameters, propertySpec, stops);\n    } else {\n        return convertPropertyFunction(parameters, propertySpec, stops);\n    }\n}\n\nfunction convertIdentityFunction(parameters, propertySpec): Array<unknown> {\n    const get = ['get', parameters.property];\n\n    if (parameters.default === undefined) {\n        // By default, expressions for string-valued properties get coerced. To preserve\n        // legacy function semantics, insert an explicit assertion instead.\n        return propertySpec.type === 'string' ? ['string', get] : get;\n    } else if (propertySpec.type === 'enum') {\n        return ['match', get, Object.keys(propertySpec.values), get, parameters.default];\n    } else {\n        const expression = [\n            propertySpec.type === 'color' ? 'to-color' : propertySpec.type,\n            get,\n            convertLiteral(parameters.default)\n        ];\n        if (propertySpec.type === 'array') {\n            expression.splice(1, 0, propertySpec.value, propertySpec.length || null);\n        }\n        return expression;\n    }\n}\n\nfunction getInterpolateOperator(parameters) {\n    switch (parameters.colorSpace) {\n        case 'hcl':\n            return 'interpolate-hcl';\n        case 'lab':\n            return 'interpolate-lab';\n        case 'oklch':\n            return 'interpolate-oklch';\n        case 'oklab':\n            return 'interpolate-oklab';\n        default:\n            return 'interpolate';\n    }\n}\n\nfunction convertZoomAndPropertyFunction(parameters, propertySpec, stops) {\n    const featureFunctionParameters = {};\n    const featureFunctionStops = {};\n    const zoomStops = [];\n    for (let s = 0; s < stops.length; s++) {\n        const stop = stops[s];\n        const zoom = stop[0].zoom;\n        if (featureFunctionParameters[zoom] === undefined) {\n            featureFunctionParameters[zoom] = {\n                zoom,\n                type: parameters.type,\n                property: parameters.property,\n                default: parameters.default,\n                colorSpace: parameters.colorSpace\n            };\n            featureFunctionStops[zoom] = [];\n            zoomStops.push(zoom);\n        }\n        featureFunctionStops[zoom].push([stop[0].value, stop[1]]);\n    }\n\n    // the interpolation type for the zoom dimension of a zoom-and-property\n    // function is determined directly from the style property specification\n    // for which it's being used: linear for interpolatable properties, step\n    // otherwise.\n    const functionType = getFunctionType({}, propertySpec);\n    if (functionType === 'exponential') {\n        const expression = [getInterpolateOperator(parameters), ['linear'], ['zoom']];\n\n        for (const z of zoomStops) {\n            const output = convertPropertyFunction(\n                featureFunctionParameters[z],\n                propertySpec,\n                featureFunctionStops[z]\n            );\n            appendStopPair(expression, z, output, false);\n        }\n\n        return expression;\n    } else {\n        const expression = ['step', ['zoom']];\n\n        for (const z of zoomStops) {\n            const output = convertPropertyFunction(\n                featureFunctionParameters[z],\n                propertySpec,\n                featureFunctionStops[z]\n            );\n            appendStopPair(expression, z, output, true);\n        }\n\n        fixupDegenerateStepCurve(expression);\n\n        return expression;\n    }\n}\n\nfunction coalesce(a, b) {\n    if (a !== undefined) return a;\n    if (b !== undefined) return b;\n}\n\nfunction getFallback(parameters, propertySpec) {\n    const defaultValue = convertLiteral(coalesce(parameters.default, propertySpec.default));\n\n    /*\n     * Some fields with type: resolvedImage have an undefined default.\n     * Because undefined is an invalid value for resolvedImage, set fallback to\n     * an empty string instead of undefined to ensure output\n     * passes validation.\n     */\n    if (defaultValue === undefined && propertySpec.type === 'resolvedImage') {\n        return '';\n    }\n    return defaultValue;\n}\n\nfunction convertPropertyFunction(parameters, propertySpec, stops) {\n    const type = getFunctionType(parameters, propertySpec);\n    const get = ['get', parameters.property];\n    if (type === 'categorical' && typeof stops[0][0] === 'boolean') {\n        const expression: any = ['case'];\n        for (const stop of stops) {\n            expression.push(['==', get, stop[0]], stop[1]);\n        }\n\n        expression.push(getFallback(parameters, propertySpec));\n        return expression;\n    } else if (type === 'categorical') {\n        const expression = ['match', get];\n        for (const stop of stops) {\n            appendStopPair(expression, stop[0], stop[1], false);\n        }\n        expression.push(getFallback(parameters, propertySpec));\n        return expression;\n    } else if (type === 'interval') {\n        const expression = ['step', ['number', get]];\n        for (const stop of stops) {\n            appendStopPair(expression, stop[0], stop[1], true);\n        }\n        fixupDegenerateStepCurve(expression);\n        return parameters.default === undefined\n            ? expression\n            : [\n                  'case',\n                  ['==', ['typeof', get], 'number'],\n                  expression,\n                  convertLiteral(parameters.default)\n              ];\n    } else if (type === 'exponential') {\n        const base = parameters.base !== undefined ? parameters.base : 1;\n        const expression = [\n            getInterpolateOperator(parameters),\n            base === 1 ? ['linear'] : ['exponential', base],\n            ['number', get]\n        ];\n\n        for (const stop of stops) {\n            appendStopPair(expression, stop[0], stop[1], false);\n        }\n        return parameters.default === undefined\n            ? expression\n            : [\n                  'case',\n                  ['==', ['typeof', get], 'number'],\n                  expression,\n                  convertLiteral(parameters.default)\n              ];\n    } else {\n        throw new Error(`Unknown property function type ${type}`);\n    }\n}\n\nfunction convertZoomFunction(parameters, propertySpec, stops, input = ['zoom']) {\n    const type = getFunctionType(parameters, propertySpec);\n    let expression;\n    let isStep = false;\n    if (type === 'interval') {\n        expression = ['step', input];\n        isStep = true;\n    } else if (type === 'exponential') {\n        const base = parameters.base !== undefined ? parameters.base : 1;\n        expression = [\n            getInterpolateOperator(parameters),\n            base === 1 ? ['linear'] : ['exponential', base],\n            input\n        ];\n    } else {\n        throw new Error(`Unknown zoom function type \"${type}\"`);\n    }\n\n    for (const stop of stops) {\n        appendStopPair(expression, stop[0], stop[1], isStep);\n    }\n\n    fixupDegenerateStepCurve(expression);\n\n    return expression;\n}\n\nfunction fixupDegenerateStepCurve(expression) {\n    // degenerate step curve (i.e. a constant function): add a noop stop\n    if (expression[0] === 'step' && expression.length === 3) {\n        expression.push(0);\n        expression.push(expression[2]);\n    }\n}\n\nfunction appendStopPair(curve, input, output, isStep) {\n    // Skip duplicate stop values. They were not validated for functions, but they are for expressions.\n    // https://github.com/mapbox/mapbox-gl-js/issues/4107\n    if (curve.length > 3 && input === curve[curve.length - 2]) {\n        return;\n    }\n    // step curves don't get the first input value, as it is redundant.\n    if (!(isStep && curve.length === 2)) {\n        curve.push(input);\n    }\n    curve.push(output);\n}\n\nfunction getFunctionType(parameters, propertySpec) {\n    if (parameters.type) {\n        return parameters.type;\n    } else {\n        return (propertySpec.expression as any).interpolated ? 'exponential' : 'interval';\n    }\n}\n\n// \"String with {name} token\" => [\"concat\", \"String with \", [\"get\", \"name\"], \" token\"]\nexport function convertTokenString(s: string) {\n    const result: any = ['concat'];\n    const re = /{([^{}]+)}/g;\n    let pos = 0;\n    for (let match = re.exec(s); match !== null; match = re.exec(s)) {\n        const literal = s.slice(pos, re.lastIndex - match[0].length);\n        pos = re.lastIndex;\n        if (literal.length > 0) result.push(literal);\n        result.push(['get', match[1]]);\n    }\n\n    if (result.length === 1) {\n        return s;\n    }\n\n    if (pos < s.length) {\n        result.push(s.slice(pos));\n    } else if (result.length === 2) {\n        return ['to-string', result[1]];\n    }\n\n    return result;\n}\n","import {createExpression, findGlobalStateRefs} from '../expression';\nimport type {GlobalProperties, Feature} from '../expression';\nimport {ICanonicalTileID} from '../tiles_and_coordinates';\nimport {StylePropertySpecification} from '..';\nimport {ExpressionFilterSpecification, type FilterSpecification} from '../types.g';\n\ntype FilterExpression = (\n    globalProperties: GlobalProperties,\n    feature: Feature,\n    canonical?: ICanonicalTileID\n) => boolean;\n\nexport type FeatureFilter = {\n    filter: FilterExpression;\n    needGeometry: boolean;\n    getGlobalStateRefs: () => Set<string>;\n};\n\ntype MixedFilterDiagnostic = {\n    path: Array<number>;\n    legacyFilter: Array<any>;\n};\n\n/**\n * Which of the two filter syntaxes a filter node belongs to.\n *\n * - `expression`: only valid as an expression, e.g. `[\"==\", [\"get\", \"x\"], 1]`.\n * - `legacy`: only valid as a deprecated filter, e.g. `[\"!in\", \"x\", 1]`.\n * - `neutral`: valid as both *and* means the same thing in each, e.g. `[\"has\", \"x\"]` or a\n *   bare boolean. Reading it either way gives the same result, so it is no evidence of which\n *   syntax the author was writing, and it must never decide the syntax of the tree it sits in.\n *\n * Note that \"parses as both\" is not enough to be `neutral`: `[\"in\", \"name\", \"\"]` parses as\n * both, but legacy reads it as a property test and an expression reads it as a substring\n * test, so the two disagree. A node whose readings disagree stays `legacy` -- see `in` below.\n */\ntype FilterClassification = 'expression' | 'legacy' | 'neutral';\n\nfunction classifyChildren(children: Array<any>): FilterClassification {\n    let sawLegacy = false;\n    for (const child of children) {\n        const classification = classifyFilter(child);\n        // A single expression-only child settles it for the whole tree.\n        if (classification === 'expression') return 'expression';\n        if (classification === 'legacy') sawLegacy = true;\n    }\n    return sawLegacy ? 'legacy' : 'neutral';\n}\n\nfunction classifyFilter(filter: any): FilterClassification {\n    if (typeof filter === 'boolean') {\n        return 'neutral';\n    }\n\n    if (!Array.isArray(filter) || filter.length === 0) {\n        return 'legacy';\n    }\n\n    switch (filter[0]) {\n        case 'has':\n            if (filter.length < 2 || filter[1] === '$id' || filter[1] === '$type') {\n                return 'legacy';\n            }\n            // Both syntaxes read the two-element form as \"this property is present\"; only the\n            // expression takes a third argument.\n            return filter.length === 2 ? 'neutral' : 'expression';\n\n        case 'in':\n            // Legacy `[\"in\", key, ...values]` tests a property against a set, while the `in`\n            // expression tests for a substring, so the scalar form is a conflict rather than a\n            // neutral node. Keeping it legacy is what makes plain legacy `in` filters keep\n            // matching, and what lets findMixedLegacyFilter report one inside an expression.\n            return filter.length >= 3 && (typeof filter[1] !== 'string' || Array.isArray(filter[2]))\n                ? 'expression'\n                : 'legacy';\n\n        case '!in':\n        case '!has':\n            return 'legacy';\n\n        case '==':\n        case '!=':\n        case '>':\n        case '>=':\n        case '<':\n        case '<=':\n            return filter.length !== 3 || Array.isArray(filter[1]) || Array.isArray(filter[2])\n                ? 'expression'\n                : 'legacy';\n\n        case 'none':\n            return 'legacy';\n        case 'any':\n        case 'all':\n            return classifyChildren(filter.slice(1));\n\n        default:\n            return 'expression';\n    }\n}\n\nexport function isExpressionFilter(filter: any): filter is ExpressionFilterSpecification {\n    return classifyFilter(filter) !== 'legacy';\n}\n\nfunction getFilterPropertyExpression(property: string): unknown {\n    if (property === '$type') return ['geometry-type'];\n    if (property === '$id') return ['id'];\n    return ['get', property];\n}\n\nfunction getLegacyFilterExpressionSuggestion(filter: Array<any>): unknown {\n    switch (filter[0]) {\n        case '==':\n        case '!=':\n        case '<':\n        case '<=':\n        case '>':\n        case '>=':\n            if (filter.length !== 3 || typeof filter[1] !== 'string') return null;\n            return [filter[0], getFilterPropertyExpression(filter[1]), filter[2]];\n\n        case 'in':\n        case '!in': {\n            if (filter.length < 2 || typeof filter[1] !== 'string') return null;\n            const expression = [\n                'in',\n                getFilterPropertyExpression(filter[1]),\n                ['literal', filter.slice(2)]\n            ];\n            return filter[0] === '!in' ? ['!', expression] : expression;\n        }\n\n        case 'has':\n        case '!has': {\n            if (filter.length !== 2 || typeof filter[1] !== 'string') return null;\n            if (filter[1] === '$type' || filter[1] === '$id') return null;\n            const expression = ['has', filter[1]];\n            return filter[0] === '!has' ? ['!', expression] : expression;\n        }\n\n        default:\n            return null;\n    }\n}\n\nexport function getMixedFilterMessage(filter: Array<any>): string {\n    if (\n        (filter[0] === '<' || filter[0] === '<=' || filter[0] === '>' || filter[0] === '>=') &&\n        filter[1] === '$type'\n    ) {\n        return `\"$type\" cannot be use with operator \"${filter[0]}\"`;\n    }\n\n    const suggestion = getLegacyFilterExpressionSuggestion(filter);\n    if (suggestion) {\n        return `Mixing deprecated filter syntax with expression syntax is not supported. Replace ${JSON.stringify(filter)} with ${JSON.stringify(suggestion)}.`;\n    }\n\n    return `Mixing deprecated filter syntax with expression syntax is not supported. Convert ${JSON.stringify(filter)} to expression syntax.`;\n}\n\nfunction checkChild(\n    index: number,\n    path: Array<number>,\n    filter: unknown\n): MixedFilterDiagnostic | null {\n    const child = filter[index];\n    if (!Array.isArray(child)) {\n        return null;\n    }\n    if (!isExpressionFilter(child)) {\n        return {path: path.concat(index), legacyFilter: child};\n    }\n    return findMixedLegacyFilter(child, path.concat(index));\n}\n\nexport function findMixedLegacyFilter(\n    filter: unknown,\n    path: Array<number> = []\n): MixedFilterDiagnostic | null {\n    if (!Array.isArray(filter) || filter.length < 1) {\n        return null;\n    }\n\n    switch (filter[0]) {\n        case 'all':\n        case 'any':\n        case 'none':\n            for (let i = 1; i < filter.length; i++) {\n                const diagnostic = checkChild(i, path, filter);\n                if (diagnostic) return diagnostic;\n            }\n            break;\n\n        case '!': {\n            const diagnostic = checkChild(1, path, filter);\n            if (diagnostic) return diagnostic;\n            break;\n        }\n\n        case 'case':\n            for (let i = 1; i < filter.length - 1; i += 2) {\n                const diagnostic = checkChild(i, path, filter);\n                if (diagnostic) return diagnostic;\n            }\n            break;\n    }\n\n    return null;\n}\n\nexport function warnAboutMixedLegacyFilter(filter: FilterSpecification, rootKey: string) {\n    const diagnostic = findMixedLegacyFilter(filter);\n    if (!diagnostic || typeof console === 'undefined') {\n        return;\n    }\n    const path = diagnostic.path.map((index) => `[${index}]`).join('');\n    console.warn(`${rootKey}${path}: ${getMixedFilterMessage(diagnostic.legacyFilter)}`);\n}\n\nconst filterSpec = {\n    type: 'boolean',\n    default: false,\n    transition: false,\n    'property-type': 'data-driven',\n    expression: {\n        interpolated: false,\n        parameters: ['zoom', 'feature']\n    }\n};\n\n/**\n * Given a filter expressed as nested arrays, return a new function\n * that evaluates whether a given feature (with a .properties or .tags property)\n * passes its test.\n *\n * @private\n * @param filter MapLibre filter\n * @param rootKey Location of the filter in the style JSON (e.g. `layers[3].filter`),\n * used to prefix runtime warnings\n * @param [globalState] Global state object to be used for evaluating 'global-state' expressions\n * @returns filter-evaluating function\n */\nexport function featureFilter(\n    filter: FilterSpecification | void,\n    rootKey: string,\n    globalState?: Record<string, any>\n): FeatureFilter {\n    if (filter === null || filter === undefined) {\n        return {filter: () => true, needGeometry: false, getGlobalStateRefs: () => new Set()};\n    }\n\n    if (!isExpressionFilter(filter)) {\n        filter = convertFilter(filter) as ExpressionFilterSpecification;\n    } else {\n        warnAboutMixedLegacyFilter(filter, rootKey);\n    }\n\n    const compiled = createExpression(\n        filter,\n        rootKey,\n        filterSpec as StylePropertySpecification,\n        globalState\n    );\n    if (compiled.result === 'error') {\n        throw new Error(compiled.value.map((err) => `${err.key}: ${err.message}`).join(', '));\n    } else {\n        const needGeometry = geometryNeeded(filter);\n        return {\n            filter: (\n                globalProperties: GlobalProperties,\n                feature: Feature,\n                canonical?: ICanonicalTileID\n            ) => compiled.value.evaluate(globalProperties, feature, {}, canonical),\n            needGeometry,\n            getGlobalStateRefs: () => findGlobalStateRefs(compiled.value.expression)\n        };\n    }\n}\n\n// Comparison function to sort numbers and strings\nfunction compare(a, b) {\n    return a < b ? -1 : a > b ? 1 : 0;\n}\n\nfunction geometryNeeded(filter) {\n    if (!Array.isArray(filter)) return false;\n    if (filter[0] === 'within' || filter[0] === 'distance') return true;\n    for (let index = 1; index < filter.length; index++) {\n        if (geometryNeeded(filter[index])) return true;\n    }\n    return false;\n}\n\nfunction convertFilter(filter?: Array<any> | null | void): unknown {\n    if (!filter) return true;\n    const op = filter[0];\n    if (filter.length <= 1) return op !== 'any';\n    const converted =\n        op === '=='\n            ? convertComparisonOp(filter[1], filter[2], '==')\n            : op === '!='\n              ? convertNegation(convertComparisonOp(filter[1], filter[2], '=='))\n              : op === '<' || op === '>' || op === '<=' || op === '>='\n                ? convertComparisonOp(filter[1], filter[2], op)\n                : op === 'any'\n                  ? convertDisjunctionOp(filter.slice(1))\n                  : op === 'all'\n                    ? ['all' as unknown].concat(filter.slice(1).map(convertFilter))\n                    : op === 'none'\n                      ? ['all' as unknown].concat(\n                            filter.slice(1).map(convertFilter).map(convertNegation)\n                        )\n                      : op === 'in'\n                        ? convertInOp(filter[1], filter.slice(2))\n                        : op === '!in'\n                          ? convertNegation(convertInOp(filter[1], filter.slice(2)))\n                          : op === 'has'\n                            ? convertHasOp(filter[1])\n                            : op === '!has'\n                              ? convertNegation(convertHasOp(filter[1]))\n                              : true;\n    return converted;\n}\n\nfunction convertComparisonOp(property: string, value: any, op: string) {\n    switch (property) {\n        case '$type':\n            return [`filter-type-${op}`, value];\n        case '$id':\n            return [`filter-id-${op}`, value];\n        default:\n            return [`filter-${op}`, property, value];\n    }\n}\n\nfunction convertDisjunctionOp(filters: Array<Array<any>>) {\n    return ['any' as unknown].concat(filters.map(convertFilter));\n}\n\nfunction convertInOp(property: string, values: Array<any>) {\n    if (values.length === 0) {\n        return false;\n    }\n    switch (property) {\n        case '$type':\n            return ['filter-type-in', ['literal', values]];\n        case '$id':\n            return ['filter-id-in', ['literal', values]];\n        default:\n            if (values.length > 200 && !values.some((v) => typeof v !== typeof values[0])) {\n                return ['filter-in-large', property, ['literal', values.sort(compare)]];\n            } else {\n                return ['filter-in-small', property, ['literal', values]];\n            }\n    }\n}\n\nfunction convertHasOp(property: string) {\n    switch (property) {\n        case '$type':\n            return true;\n        case '$id':\n            return ['filter-has-id'];\n        default:\n            return ['filter-has', property];\n    }\n}\n\nfunction convertNegation(filter: unknown) {\n    return ['!', filter];\n}\n","import {isExpressionFilter} from './index';\n\nimport type {\n    ExpressionFilterSpecification,\n    ExpressionInputType,\n    ExpressionSpecification,\n    FilterSpecification,\n    LegacyFilterSpecification\n} from '../types.g';\n\ntype ExpectedTypes = {[_: string]: ExpressionInputType};\n\n/*\n * Convert the given filter to an expression, storing the expected types for\n * any feature properties referenced in expectedTypes.\n *\n * These expected types are needed in order to construct preflight type checks\n * needed for handling 'any' filters. A preflight type check is necessary in\n * order to mimic legacy filters' semantics around expected type mismatches.\n * For example, consider the legacy filter:\n *\n *     [\"any\", [\"all\", [\">\", \"y\", 0], [\">\", \"y\", 0]], [\">\", \"x\", 0]]\n *\n * Naively, we might convert this to the expression:\n *\n *     [\"any\", [\"all\", [\">\", [\"get\", \"y\"], 0], [\">\", [\"get\", \"z\"], 0]], [\">\", [\"get\", \"x\"], 0]]\n *\n * But if we tried to evaluate this against, say `{x: 1, y: null, z: 0}`, the\n * [\">\", [\"get\", \"y\"], 0] would cause an evaluation error, leading to the\n * entire filter returning false. Legacy filter semantics, though, ask for\n * [\">\", \"y\", 0] to simply return `false` when `y` is of the wrong type,\n * allowing the subsequent terms of the outer \"any\" expression to be evaluated\n * (resulting, in this case, in a `true` value, because x > 0).\n *\n * We account for this by inserting a preflight type-checking expression before\n * each \"any\" term, allowing us to avoid evaluating the actual converted filter\n * if any type mismatches would cause it to produce an evaluation error:\n *\n *     [\"any\",\n *       [\"case\",\n *         [\"all\", [\"==\", [\"typeof\", [\"get\", \"y\"]], \"number\"], [\"==\", [\"typeof\", [\"get\", \"z\"], \"number]],\n *         [\"all\", [\">\", [\"get\", \"y\"], 0], [\">\", [\"get\", \"z\"], 0]],\n *         false\n *       ],\n *       [\"case\",\n *         [\"==\", [\"typeof\", [\"get\", \"x\"], \"number\"]],\n *         [\">\", [\"get\", \"x\"], 0],\n *         false\n *       ]\n *     ]\n *\n * An alternative, possibly more direct approach would be to use type checks\n * in the conversion of each comparison operator, so that the converted version\n * of each individual ==, >=, etc. would mimic the legacy filter semantics. The\n * downside of this approach is that it can lead to many more type checks than\n * would otherwise be necessary: outside the context of an \"any\" expression,\n * bailing out due to a runtime type error (expression semantics) and returning\n * false (legacy filter semantics) are equivalent: they cause the filter to\n * produce a `false` result.\n */\nexport function convertFilter(\n    filter: FilterSpecification,\n    expectedTypes: ExpectedTypes = {}\n): ExpressionFilterSpecification {\n    if (isExpressionFilter(filter)) return filter;\n    if (!filter) return true;\n\n    const legacyFilter = filter as LegacyFilterSpecification;\n    const legacyOp = legacyFilter[0];\n    if (filter.length <= 1) return legacyOp !== 'any';\n\n    switch (legacyOp) {\n        case '==':\n        case '!=':\n        case '<':\n        case '>':\n        case '<=':\n        case '>=': {\n            const [, property, value] = filter;\n            return convertComparisonOp(property as string, value, legacyOp, expectedTypes);\n        }\n        case 'any': {\n            const [, ...conditions] = legacyFilter;\n            const children = conditions.map((f: LegacyFilterSpecification) => {\n                const types = {};\n                const child = convertFilter(f, types);\n                const typechecks = runtimeTypeChecks(types);\n                return typechecks === true\n                    ? child\n                    : (['case', typechecks, child, false] as ExpressionSpecification);\n            });\n            return ['any', ...children];\n        }\n        case 'all': {\n            const [, ...conditions] = legacyFilter;\n            const children = conditions.map((f) => convertFilter(f, expectedTypes));\n            return children.length > 1 ? ['all', ...children] : children[0];\n        }\n        case 'none': {\n            const [, ...conditions] = legacyFilter;\n            return ['!', convertFilter(['any', ...conditions], {})];\n        }\n        case 'in': {\n            const [, property, ...values] = legacyFilter;\n            return convertInOp(property, values);\n        }\n        case '!in': {\n            const [, property, ...values] = legacyFilter;\n            return convertInOp(property, values, true);\n        }\n        case 'has':\n            return convertHasOp(legacyFilter[1]);\n        case '!has':\n            return ['!', convertHasOp(legacyFilter[1])];\n        default:\n            return true;\n    }\n}\n\n// Given a set of feature properties and an expected type for each one,\n// construct an boolean expression that tests whether each property has the\n// right type.\n// E.g.: for {name: 'string', population: 'number'}, return\n// [ 'all',\n//   ['==', ['typeof', ['get', 'name'], 'string']],\n//   ['==', ['typeof', ['get', 'population'], 'number]]\n// ]\nfunction runtimeTypeChecks(expectedTypes: ExpectedTypes): ExpressionFilterSpecification {\n    const conditions = [];\n    for (const property in expectedTypes) {\n        const get = property === '$id' ? ['id'] : ['get', property];\n        conditions.push(['==', ['typeof', get], expectedTypes[property]]);\n    }\n    if (conditions.length === 0) return true;\n    if (conditions.length === 1) return conditions[0];\n    return ['all', ...conditions];\n}\n\nfunction convertComparisonOp(\n    property: string,\n    value: any,\n    op: string,\n    expectedTypes?: ExpectedTypes | null\n): ExpressionFilterSpecification {\n    let get;\n    if (property === '$type') {\n        return [op, ['geometry-type'], value] as ExpressionFilterSpecification;\n    } else if (property === '$id') {\n        get = ['id'];\n    } else {\n        get = ['get', property];\n    }\n\n    if (expectedTypes && value !== null) {\n        const type = typeof value as any;\n        expectedTypes[property] = type;\n    }\n\n    if (op === '==' && property !== '$id' && value === null) {\n        return [\n            'all',\n            ['has', property], // missing property != null for legacy filters\n            ['==', get, null]\n        ];\n    } else if (op === '!=' && property !== '$id' && value === null) {\n        return [\n            'any',\n            ['!', ['has', property]], // missing property != null for legacy filters\n            ['!=', get, null]\n        ];\n    }\n\n    return [op, get, value] as ExpressionFilterSpecification;\n}\n\nfunction convertInOp(\n    property: string,\n    values: Array<any>,\n    negate = false\n): ExpressionFilterSpecification {\n    if (values.length === 0) return negate;\n\n    let get: ExpressionSpecification;\n    if (property === '$type') {\n        get = ['geometry-type'];\n    } else if (property === '$id') {\n        get = ['id'];\n    } else {\n        get = ['get', property];\n    }\n\n    // Determine if the list of values to be searched is homogenously typed.\n    // If so (and if the type is string or number), then we can use a\n    // [match, input, [...values], true, false] construction rather than a\n    // bunch of `==` tests.\n    let uniformTypes = true;\n    const type = typeof values[0];\n    for (const value of values) {\n        if (typeof value !== type) {\n            uniformTypes = false;\n            break;\n        }\n    }\n\n    if (uniformTypes && (type === 'string' || type === 'number')) {\n        // Match expressions must have unique values.\n        const uniqueValues = values.sort().filter((v, i) => i === 0 || values[i - 1] !== v);\n        return ['match', get, uniqueValues, !negate, negate];\n    }\n\n    if (negate) {\n        return ['all', ...values.map((v) => ['!=', get, v] as ExpressionSpecification)];\n    } else {\n        return ['any', ...values.map((v) => ['==', get, v] as ExpressionSpecification)];\n    }\n}\n\nfunction convertHasOp(property: string): ExpressionFilterSpecification {\n    if (property === '$type') {\n        return true;\n    } else if (property === '$id') {\n        return ['!=', ['id'], null];\n    } else {\n        return ['has', property];\n    }\n}\n","import {eachLayer, eachProperty} from '../visit';\nimport {isExpression} from '../expression';\nimport {convertFunction, convertTokenString} from '../function/convert';\nimport {convertFilter} from '../feature_filter/convert';\n\nimport type {FilterSpecification, LayerSpecification, StyleSpecification} from '../types.g';\n\n/**\n * Migrate the given style object in place to use expressions. Specifically,\n * this will convert (a) \"stop\" functions, and (b) legacy filters to their\n * expression equivalents.\n * @param style The style object to migrate.\n * @returns The migrated style object.\n */\nexport function expressions(style: StyleSpecification) {\n    const converted = [];\n\n    eachLayer(style, (layer: LayerSpecification & {filter?: FilterSpecification}) => {\n        if (layer.filter) {\n            layer.filter = convertFilter(layer.filter);\n        }\n    });\n\n    eachProperty(style, {paint: true, layout: true}, ({path, key, value, reference, set}) => {\n        if (isExpression(value) || key.endsWith('-transition') || reference === null) return;\n        if (typeof value === 'object' && !Array.isArray(value)) {\n            set(convertFunction(value, reference));\n            converted.push(path.join('.'));\n        } else if ((reference as any).tokens && typeof value === 'string') {\n            set(convertTokenString(value));\n        }\n    });\n\n    return style;\n}\n","/**\n * Migrate color style values to supported format.\n *\n * @param colorToMigrate Color value to migrate, could be a string or an expression.\n * @returns Color style value in supported format.\n */\nexport function migrateColors<T>(colorToMigrate: T): T {\n    return JSON.parse(migrateHslColors(JSON.stringify(colorToMigrate)));\n}\n\n/**\n * Created to migrate from colors supported by the former CSS color parsing\n * library `csscolorparser` but not compliant with the CSS Color specification,\n * like `hsl(900, 0.15, 90%)`.\n *\n * @param colorToMigrate Serialized color style value.\n * @returns A serialized color style value in which all non-standard hsl color values\n * have been converted to a format that complies with the CSS Color specification.\n *\n * @example\n * migrateHslColors('\"hsl(900, 0.15, 90%)\"'); // returns '\"hsl(900, 15%, 90%)\"'\n * migrateHslColors('\"hsla(900, .15, .9)\"'); // returns '\"hsl(900, 15%, 90%)\"'\n * migrateHslColors('\"hsl(900, 15%, 90%)\"'); // returns '\"hsl(900, 15%, 90%)\"' - no changes\n */\nfunction migrateHslColors(colorToMigrate: string): string {\n    return colorToMigrate.replace(/\"hsla?\\((.+?)\\)\"/gi, (match, hslArgs) => {\n        const argsMatch = hslArgs.match(/^(.+?)\\s*,\\s*(.+?)\\s*,\\s*(.+?)(?:\\s*,\\s*(.+))?$/i);\n        if (argsMatch) {\n            let [h, s, l, a] = argsMatch.slice(1);\n            [s, l] = [s, l].map((v) => (v.endsWith('%') ? v : `${parseFloat(v) * 100}%`));\n            return `\"hsl${typeof a === 'string' ? 'a' : ''}(${[h, s, l, a].filter(Boolean).join(',')})\"`;\n        }\n        return match;\n    });\n}\n","import {migrateV8} from './migrate/v8';\nimport {expressions} from './migrate/expressions';\nimport {migrateColors} from './migrate/migrate_colors';\nimport {eachProperty} from './visit';\nimport type {StyleSpecification} from './types.g';\n\n/**\n * Migrate a Mapbox/MapLibre GL Style to the latest version.\n *\n * @param style - a MapLibre Style\n * @returns a migrated style\n * @example\n * const fs = require('fs');\n * const migrate = require('@maplibre/maplibre-gl-style-spec').migrate;\n * const style = fs.readFileSync('./style.json', 'utf8');\n * fs.writeFileSync('./style.json', JSON.stringify(migrate(style)));\n */\nexport function migrate(style: StyleSpecification): StyleSpecification {\n    let migrated = false;\n\n    if ((style.version as any) === 7) {\n        style = migrateV8(style);\n        migrated = true;\n    }\n\n    if (style.version === 8) {\n        migrated = !!expressions(style);\n        migrated = true;\n    }\n\n    eachProperty(style, {paint: true, layout: true}, ({value, reference, set}) => {\n        if (reference?.type === 'color') {\n            set(migrateColors(value));\n        }\n    });\n\n    if (!migrated) {\n        throw new Error(`Cannot migrate from ${style.version}`);\n    }\n\n    return style;\n}\n","import fs from 'fs';\nimport minimist from 'minimist';\nimport {format} from '../src/format';\nimport {migrate} from '../src/migrate';\nconst argv = minimist(process.argv.slice(2));\n\nif (argv.help || argv.h || (!argv._.length && process.stdin.isTTY)) {\n    help();\n} else {\n    console.log(format(migrate(JSON.parse(fs.readFileSync(argv._[0]).toString()))));\n}\n\nfunction help() {\n    console.log('usage:');\n    console.log('  gl-style-migrate style-v7.json > style-v8.json');\n}\n"],"ignoreList":[0,2,35,46,47],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;CAEA,SAAS,OAAO,KAAK,MAAM;EAC1B,IAAI,IAAI;EACR,KAAK,MAAM,GAAG,EAAE,CAAC,CAAC,QAAQ,SAAU,KAAK;GACxC,IAAI,EAAE,QAAQ,CAAC;EAChB,CAAC;EAGD,OADU,KAAK,KAAK,SAAS,MACf;CACf;CAEA,SAAS,SAAS,GAAG;EACpB,IAAI,OAAO,MAAM,UAAY,OAAO;EACpC,IAAK,iBAAkB,KAAK,CAAC,GAAK,OAAO;EACzC,OAAQ,6CAA8C,KAAK,CAAC;CAC7D;CAEA,SAAS,qBAAqB,KAAK,KAAK;EACvC,OAAQ,QAAQ,iBAAiB,OAAO,IAAI,SAAS,cAAe,QAAQ;CAC7E;CAEA,OAAO,UAAU,SAAU,MAAM,MAAM;EACtC,IAAI,CAAC,MAAQ,OAAO,CAAC;EAErB,IAAI,QAAQ;GACX,OAAO,CAAC;GACR,SAAS,CAAC;GACV,WAAW;EACZ;EAEA,IAAI,OAAO,KAAK,YAAY,YAC3B,MAAM,YAAY,KAAK;EAGxB,IAAI,OAAO,KAAK,YAAY,aAAa,KAAK,SAC7C,MAAM,WAAW;OAEjB,CAAC,CAAC,CAAC,OAAO,KAAK,OAAO,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,QAAQ,SAAU,KAAK;GAC9D,MAAM,MAAM,OAAO;EACpB,CAAC;EAGF,IAAI,UAAU,CAAC;EAEf,SAAS,eAAe,KAAK;GAC5B,OAAO,QAAQ,IAAI,CAAC,KAAK,SAAU,GAAG;IACrC,OAAO,MAAM,MAAM;GACpB,CAAC;EACF;EAEA,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,QAA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