{"version":3,"sources":["../../package.json","../../scripts/wael.ts","../../src/main.ts","../../src/interpreter/interpreter.ts","../../src/interpreter/types.ts","../../src/interpreter/helpers.ts","../../src/interpreter/scope.ts","../../src/interpreter/built-in-functions.ts","../../node_modules/geojson-equality-ts/index.ts","../../node_modules/@turf/helpers/index.ts","../../node_modules/@turf/invariant/index.ts","../../node_modules/@turf/clean-coords/index.ts","../../node_modules/@turf/boolean-equal/index.ts","../../src/interpreter/grammar.ts","../../src/lib.ts"],"sourcesContent":["{\n  \"name\": \"wael-lib\",\n  \"version\": \"0.0.14\",\n  \"description\": \"Well-Known Text Arithmetic Expression Language\",\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"git+https://github.com/anthonydgj/wael.git\"\n  },\n  \"files\": [\n    \"dist\",\n    \"examples\"\n  ],\n  \"browser\": {\n    \"fs\": false,\n    \"path\": false,\n    \"os\": false\n  },\n  \"type\": \"commonjs\",\n  \"main\": \"dist/cjs/index.cjs\",\n  \"module\": \"dist/esm/index.mjs\",\n  \"types\": \"dist/cjs/index.d.ts\",\n  \"exports\": {\n    \"./package.json\": \"./package.json\",\n    \".\": {\n      \"import\": {\n        \"types\": \"./dist/esm/index.d.mts\",\n        \"default\": \"./dist/esm/index.mjs\"\n      },\n      \"require\": {\n        \"types\": \"./dist/cjs/index.d.ts\",\n        \"default\": \"./dist/cjs/index.cjs\"\n      }\n    }\n  },\n  \"scripts\": {\n    \"build\": \"tsup --config ./tsup.config.ts\",\n    \"build-all\": \"npm run build-binary && npm run build-release-binaries\",\n    \"build-binary\": \"npm run build && pkg ./dist/wael/wael.cjs -t=latest --no-bytecode --public-packages \\\"*\\\" --public --out-path dist/bin/\",\n    \"build-release-binaries\": \"pkg ./dist/wael/wael.cjs -t=latest,latest-macos-arm64,latest-linuxstatic-x64,latest-win-x64 --no-bytecode --public-packages \\\"*\\\" --public --out-path dist/bin/release/\",\n    \"test\": \"jest\",\n    \"publish-lib\": \"npm run build && npm test && npm publish\"\n  },\n  \"author\": \"AnthonyDGJ\",\n  \"license\": \"MIT\",\n  \"devDependencies\": {\n    \"@types/geojson\": \"^7946.0.16\",\n    \"@types/jest\": \"^29.5.14\",\n    \"@types/sync-fetch\": \"^0.4.3\",\n    \"@types/wellknown\": \"^0.5.8\",\n    \"jest\": \"^29.7.0\",\n    \"pkg\": \"^5.8.1\",\n    \"ts-jest\": \"^29.3.2\",\n    \"ts-node\": \"^10.9.2\",\n    \"tsup\": \"^8.4.0\",\n    \"typescript\": \"^5.8.3\"\n  },\n  \"dependencies\": {\n    \"@turf/turf\": \"^7.2.0\",\n    \"chalk\": \"^4.1.2\",\n    \"fs\": \"^0.0.1-security\",\n    \"ohm-js\": \"^17.1.0\",\n    \"sync-fetch\": \"^0.6.0-2\",\n    \"tslib\": \"^2.8.1\",\n    \"wellknown\": \"^0.5.0\",\n    \"yargs\": \"^17.7.2\"\n  },\n  \"keywords\": [\n    \"wkt\",\n    \"well-known text\",\n    \"ohm\",\n    \"dsl\",\n    \"domain-specific language\",\n    \"geospatial\"\n  ]\n}\n","import * as fs from 'fs';\n\nimport { Options, OutputFormat, Wael } from \"../src/main\";\n\nimport { Interpreter } from '../src/interpreter/interpreter';\nimport chalk from 'chalk';\nimport { toString } from '../src/interpreter/helpers';\nimport yargs from 'yargs'\n\nconst readline = require('readline');\nconst packageJson = require('../package.json')\n\nconst input_files = 'input_files';\nconst version = packageJson.version;\nconst args = (yargs as any).command('$0', `${packageJson.description}\\nVersion: ${version}`)\n    .positional(input_files, {\n        array: true,\n        description: 'List of 1 or more input files'\n    })\n    .option('format', {\n        choices: Object.values(OutputFormat) as OutputFormat[],\n        description: 'Output format'\n    })\n    .option('geojson', {\n        alias: 'g',\n        boolean: true,\n        description: 'Output as GeoJSON'\n    })\n    .option('outputNonGeoJSON', {\n        alias: 'a',\n        boolean: true,\n        description: 'Output non-GeoJSON results'\n    })\n    .option('interactive', {\n        alias: 'i',\n        boolean: true,\n        description: 'Launch an interactive session'\n    })\n    .option('evaluate', {\n        alias: ['e', 'pre-evaluate'],\n        string: true,\n        description: `Evaluate the specified script text before [${input_files}]`\n    })\n    .option('post-evaluate', {\n        string: true,\n        description: `Evaluate the specified script text after [${input_files}]`\n    })\n    .option('bind-import', {\n        alias: 'b',\n        type: 'array',\n        string: true,\n        description: 'Bind imported data to a variable'\n    })\n    .version(version)\n    .parseSync();\n\nconst getJsonString = (json: any) => {\n    return JSON.stringify(json);\n}\n\n\nconst evaluateScript = args.evaluate;\nconst postEvaluateScript = args.postEvaluate;\nconst inputFiles = args._;\nconst isInteractive = args.interactive;\nconst bindImports = args.bindImport;\nconst highlightText = chalk.hex(`#1f91cf`);\nconst errorText = chalk.hex(`#bd3131`);\nconst subtleText = chalk.hex(`#777`);\n\nconst outputFormat = args.geojson ? OutputFormat.GeoJSON : \n    args.format ? args.format : OutputFormat.WKT;\n\nlet outputNonGeoJSON = args.outputNonGeoJSON;\nif (outputNonGeoJSON === undefined && isInteractive) {\n    outputNonGeoJSON = true;\n}\nconst options: Options = {\n    outputFormat,\n    scope: Interpreter.createGlobalScope(),\n    outputNonGeoJSON\n};\n\nconst wael = new Wael(options);\nlet result: any;\nlet hasEvaluated = false;\n\nconst errorExit = (message: string) => {\n    console.log(errorText(message));\n    process.exit(-1);\n}\n\nconst getSectionHeading = (label: string) => {\n    const cols = process.stdout.columns;\n    const filler = cols - label.length;\n    const splitCount = (filler % 2 === 0 ? filler : filler - 1) / 2;\n    const splitLabel = '-'.repeat(splitCount);\n    let line = splitLabel + label + splitLabel;\n    if (line.length < cols) {\n        line += '-';\n    }\n    return line;\n}\n\nconst printOutput = (output: string) => {\n    let result = options.outputFormat === OutputFormat.GeoJSON ? getJsonString(output) : output;\n    console.log(subtleText(`${result}`));\n};\n\nconst prompt = (details: string = '', script = '') => {\n    const line = getSectionHeading(` [${wael.getEvaluationCount()}] ${details}`);\n    console.log(highlightText(line))\n    if (!!script) {\n        console.log(script);\n    }\n}\n\nconst evaluate = (script: string, heading: string) => {\n    if (isInteractive) {\n        prompt(heading, script);\n    }\n    let result = wael.evaluate(script);\n    if (isInteractive) {\n        printOutput(result);\n    }\n    return result;\n}\n\nconst EXIT_CMD = `exit()`;\nconst END_TOKEN = `;;`;\n\nif (isInteractive) {\nconst instructions = \n`Starting WAEL interactive session...\n\nEnd expressions with ;; to evaluate.\nThe last evaluation result is stored in the ${Wael.IDENTIFIER_LAST} variable.\nPrevious evaluation results are stored in indexed variables $0, $1, $2, ...\n`;\nconsole.log(subtleText(instructions));\n}\n\n\n// Evaluate import bindings\nif (bindImports) {\n    for (const bindImport of bindImports) {\n        const [identifier, uri] = bindImport.split('=');\n        if (identifier && uri) {\n            try {\n                result = evaluate(`${identifier} = import('${uri.trim()}')`, `import ${identifier}`);\n            } catch (err: any) {\n                errorExit(`Unable to evaluate import binding \"${bindImport}\" \\n\\t${err.message}`);\n            }\n        } else {\n            errorExit(`Unable to evaluate import binding \"${bindImport}\"`);\n        }\n    }\n}\n\n// Evaluate initial script\nif (evaluateScript) {\n    try {\n        result = evaluate(evaluateScript, `pre-evaluate`);\n    } catch (err: any) {\n        errorExit(`Unable to evaluate pre-evaluate script: \\n\\t${err}`);\n    }\n    hasEvaluated = true;\n}\n\n// Evaluate files\nif (inputFiles && inputFiles.length > 0) {\n    inputFiles.forEach((inputFile: any) => {\n        const input = fs.readFileSync(inputFile, 'utf-8');\n        result = evaluate(input, inputFile.toString())\n        hasEvaluated = true;\n        if (options.outputFormat === OutputFormat.GeoJSON) {\n            try {\n                result = getJsonString(result);\n            } catch(err) {\n                // return raw output\n            }\n        }\n    });\n}\n\n// Evaluate initial script\nif (postEvaluateScript) {\n    try {\n        result = evaluate(postEvaluateScript, `post-evaluate`);\n    } catch (err: any) {\n        errorExit(`Unable to evaluate 'post-evaluate' script: \\n\\t${err}`);\n    }\n    hasEvaluated = true;\n}\n\n// Run interactive mode\nif (isInteractive) {\n    let currentInput = ``;\n\n    prompt();\n\n    const rl = readline.createInterface({\n      input: process.stdin,\n      output: process.stdout,\n      prompt: '',\n      terminal: true\n    });\n    \n    rl.on('line', (line: string) => {\n        if (line.toLocaleLowerCase() === EXIT_CMD) {\n            rl.close();\n        } else {\n            currentInput += `${line.trim()}\\n`;\n            const inputEndIndex = currentInput.indexOf(END_TOKEN);\n            if (inputEndIndex >= 0) {\n                try {\n                    let result = wael.evaluate(currentInput.substring(0, inputEndIndex), options);\n                    printOutput(result);\n                } catch (err) {\n                    console.error(errorText(err));\n                }\n                prompt();\n                currentInput = '';\n            }\n        }\n    });\n    \n    rl.once('close', () => {\n         // end of input\n     });\n} else {\n    if (hasEvaluated) {\n        if (typeof result !== 'undefined') {\n            if (typeof result === 'object') {\n                result = toString(result);    \n            }\n            console.log(result);\n        }\n    } else {\n        yargs.showHelp();\n    }\n}\n","import * as turf from '@turf/turf';\nimport * as wellknown from 'wellknown';\n\nimport { Interpreter } from \"./interpreter/interpreter\";\nimport { STD_LIB } from './lib';\nimport { Scope } from \"./interpreter/scope\";\n\nexport enum OutputFormat {\n    WKT = 'WKT',\n    GeoJSON = 'GeoJSON'\n}\n\nexport interface Options {\n    outputFormat?: OutputFormat,\n    outputNonGeoJSON?: boolean;\n    scope?: Scope;\n    storeHistoricalEvaluations?: boolean;\n}\n\nexport const DEFAULT_OPTIONS: Options = {\n    outputFormat: OutputFormat.WKT,\n    storeHistoricalEvaluations: true\n}\n\nexport class Wael {\n    private options: Options;\n    private evaluationCount = 0;\n    static IDENTIFIER_LAST = '$?';\n\n    constructor(\n        initialOptions?: Options\n    ) {\n        this.options = {\n            ...DEFAULT_OPTIONS,\n            ...initialOptions,\n            scope: initialOptions?.scope ?? Interpreter.createGlobalScope(),\n        };\n        \n        // Import standard library\n        Interpreter.evaluateInput(`StdLib = ${STD_LIB}; Import(StdLib()) Using (*)`, this.options.scope)\n    }\n\n    getEvaluationCount(): number {\n        return this.evaluationCount;\n    }\n\n    evaluate(input: string, overrideOptions?: Partial<Options>) {\n        const options = {\n            ...this.options,\n            ...overrideOptions\n        };\n\n        const result = Interpreter.evaluateInput(input, options.scope);\n\n        // Track evaluations\n        options.scope?.store(Wael.IDENTIFIER_LAST, result);\n        if (options.storeHistoricalEvaluations) {\n            const indexedResultLabel = `$${this.evaluationCount}`;\n            options.scope?.store(indexedResultLabel, result);\n        }\n        this.evaluationCount++;\n\n        if (typeof result === 'object' && typeof result?.type === 'string') {\n            switch(options?.outputFormat) {\n                case OutputFormat.WKT:\n                    return wellknown.stringify(result);\n                case OutputFormat.GeoJSON:\n                    return turf.feature(result) as any;\n                default:\n                    break;\n            }\n        }\n        \n        const output = Wael.getOutputString(result, options.outputFormat);\n        if (options.outputNonGeoJSON) {\n            if (options.outputFormat === OutputFormat.GeoJSON) {\n                return result ?? undefined;\n            }\n            return output;\n        } else {\n            const outputString = typeof output === 'string' ? output : JSON.stringify(output, undefined, 2)\n            throw new Error(`Invalid '${options.outputFormat}' evaluation result: ${outputString}`)\n        }\n    }\n\n    static evaluate(input: string, options?: Partial<Options>) {\n        return new Wael(options).evaluate(input);\n    }\n\n    private static getOutputString(result: any, outputFormat?: OutputFormat) {\n        if (typeof result === 'object') {\n            if (outputFormat === OutputFormat.WKT) {\n                const properties = Object.keys(result).map(key => {\n                    return `  ${key} = ${result[key]?.toString()}`\n                });\nreturn `(\n${properties.join(';\\n')}\n)`\n            } \n        }\n        return `${result}`\n    }\n}\n\n","// import ohm from 'ohm-js';\nimport * as ohm from 'ohm-js';\nimport * as turf from '@turf/turf'\n\nimport { GeometryType, UNIT } from './types';\nimport {\n    OperationNotSupported,\n    arithmeticOperationExp,\n    convertToGeometry,\n    geometryAccessor,\n    getArrayLikeItems,\n    getGeometryType,\n    isAnyGeometryType,\n    isGeometryType,\n    isNumber,\n    toString,\n    transform\n} from './helpers';\nimport { Scope, ScopeBindings } from './scope';\n\nimport { BuiltInFunctions } from './built-in-functions';\nimport { GRAMMAR } from './grammar';\nimport { readFileSync } from 'fs';\nimport syncFetch from 'sync-fetch'\n\nconst grammarString = GRAMMAR;\n\nexport namespace Interpreter {\n\n    export const IMPORT_DEFAULT_IDENTIFIER = 'Default';\n    export const IMPORT_USING_ALL = '*';\n    \n    export const STANDARD_LIBRARY: ScopeBindings = {};\n    const math: { [prop: string]: any } = {};\n    Object.getOwnPropertyNames(Math).forEach(prop => {\n        math[prop] = (Math as any)[prop];\n    });\n    STANDARD_LIBRARY['Math'] = math;\n    STANDARD_LIBRARY['Flatten'] = BuiltInFunctions.Flatten;\n    STANDARD_LIBRARY['PointCircle'] = BuiltInFunctions.PointCircle;\n    STANDARD_LIBRARY['PointGrid'] = BuiltInFunctions.PointGrid;\n    STANDARD_LIBRARY['ToLineString'] = BuiltInFunctions.ToLineString;\n    STANDARD_LIBRARY['ToMultiPoint'] = BuiltInFunctions.ToMultiPoint;\n    STANDARD_LIBRARY['ToPolygon'] = BuiltInFunctions.ToPolygon;\n    STANDARD_LIBRARY['ToGeometryCollection'] = BuiltInFunctions.ToGeometryCollection;\n    STANDARD_LIBRARY['_Rotate'] = BuiltInFunctions.Rotate;\n    STANDARD_LIBRARY['_Round'] = BuiltInFunctions.Round;\n\n    export const createGlobalScope = () => new Scope(undefined, undefined, STANDARD_LIBRARY);\n        \n    export function evaluateInput(input: string, initialScope?: Scope): any {\n        const GLOBAL_SCOPE = createGlobalScope();\n        let currentScope = initialScope || GLOBAL_SCOPE;\n        const grammar = ohm.grammar(grammarString);\n        const semantics = grammar.createSemantics();\n        semantics.addOperation('eval', {\n            stringLiteral(_leftQuote, str, _rightQuote) {\n                return str.sourceString;\n            },\n            ImportAllExpression(exp) {\n                const ret = exp.eval();\n                if (ret) {\n                    // Return data import\n                    return ret;\n                }\n\n                // Return function import object\n                const importObj = currentScope.useImports();\n                return importObj;\n            },\n            ImportUsingExpression(importAllExp, _keyword, identifierList) {\n                importAllExp.eval();\n                const identifiers = identifierList.eval();\n                let importObj;\n                if (identifiers === IMPORT_USING_ALL) {\n                    importObj = currentScope.useNamedImports(Object.keys(currentScope.availableBindings));\n                } else {\n                    importObj = currentScope.useNamedImports(identifiers);\n                }\n                return importObj;\n            },\n            ImportUsingAllParams(_) {\n                return IMPORT_USING_ALL;\n            },\n            ImportExternalExp(_keyword, importUri) {\n                const uri:string  = importUri.eval();\n\n                let data: string;\n                if (uri.startsWith('http://') || uri.startsWith('https://')) {\n                    data = syncFetch(uri).text();\n                } else {\n                    data = readFileSync(uri, 'utf8');\n                }\n                currentScope = currentScope.push();\n                let ret = undefined;\n                let bindings: ScopeBindings | undefined = undefined;\n                try {\n                    ret = convertToGeometry(JSON.parse(data));\n                } catch {\n                    try {\n                        const libRet = evaluateInput(data, currentScope);\n                        bindings = {};\n                        bindings[IMPORT_DEFAULT_IDENTIFIER] = libRet;\n                    } catch {\n                        throw new Error(`Unable to import file: ${uri}`);\n                    }\n                }\n                currentScope = currentScope.pop(bindings) || GLOBAL_SCOPE;\n                return ret;\n            },\n            ImportFunctionExp(_keyword, importFn) {\n                importFn.eval();\n            },\n            IfThenElseExp(_if, c, _then, exp1, _else, exp2) {\n                const condition = c.eval();\n                if (condition) {\n                    return exp1.eval();\n                }\n                return exp2.eval();\n            },\n            booleanValue(val) {\n                const value = val.sourceString.toLocaleLowerCase();\n                if (value === 'true') {\n                    return true;\n                }\n                if (value === 'false') {\n                    return false;\n                }\n                throw new Error(`Invalid boolean value: ${val.sourceString}`);\n            },\n            EqualityExp(v1, op, v2) {\n                const value1 = v1.eval();\n                const operator = op.sourceString;\n                const value2 = v2.eval();\n                switch (operator.trim().toLocaleLowerCase()) {\n                    case \"==\":\n                        return value1 === value2;\n                    case \"!=\":\n                        return value1 !== value2;\n                    case \"and\":\n                        return value1 && value2;\n                    case \"or\":\n                        return value1 || value2;\n                }\n                throw new Error(`Operator not supported: ${operator}`);\n            },\n            NotExp(_, exp) {\n                return !exp.eval();\n            },\n            geometryKeyword(keyword) {\n                return keyword.sourceString;\n            },\n            CompareExp(v1, op, v2) {\n                const value1 = v1.eval();\n                if (!isNumber(value1)) {\n                    throw new Error(`Expected a number for ${v1.sourceString} but got: ${toString(value1)}`)\n                }\n                const operator = op.sourceString;\n                const value2 = v2.eval();\n                if (!isNumber(value2)) {\n                    throw new Error(`Expected a number for ${v2.sourceString} but got: ${toString(value2)}`)\n                }\n                switch (operator.trim()) {\n                    case \"<\":\n                        return value1 < value2;\n                    case \"<=\":\n                        return value1 <= value2;\n                    case \">\":\n                        return value1 > value2;\n                    case \">=\":\n                        return value1 >= value2;\n                }\n                throw new Error(`Operator not supported: ${operator}`);\n            },\n            ConcatExp(g1, _op, g2) {\n                const geom1 = g1.eval();\n                const geom2 = g2.eval();\n\n                const type1 = getGeometryType(geom1);\n                const type2 = getGeometryType(geom2);\n                if (!type1 || !type2) {\n                    throw new Error(`Expected geometry types for concatenation but found geom1: ${toString(geom1)} and geom2: ${toString(geom2)}`);\n                }\n                \n                if (type1 === type2) {\n\n                    const list1: any[] = getArrayLikeItems(geom1);\n                    const list2: any[] = getArrayLikeItems(geom2);\n                    \n                    // Point collections\n                    if (\n                        type1 === GeometryType.LineString || \n                        type1 === GeometryType.MultiPoint || \n                        type1 === GeometryType.GeometryCollection     \n                    ) {\n                        const combined = list1.concat(list2);\n                        if (type1 === GeometryType.LineString) {\n                            return turf.lineString(combined).geometry;\n                        }\n                        if (type1 === GeometryType.MultiPoint) {\n                            return turf.multiPoint(combined).geometry;\n                        }\n                        if (type1 === GeometryType.GeometryCollection) {\n                            return turf.geometryCollection(combined).geometry;\n                        }\n                    }\n                }\n                \n                if (\n                    type1 === GeometryType.LineString || \n                    type1 === GeometryType.MultiPoint   \n                ) {\n                    const list1: any[] = getArrayLikeItems(geom1);\n                    let list2: any;\n                    if (\n                        type2 === GeometryType.LineString || \n                        type2 === GeometryType.MultiPoint   \n                    ) {\n                        list2 = getArrayLikeItems(geom2);\n                    } else {\n                        if (type2 === GeometryType.Point) {\n                            list2 = [geom2.coordinates];\n                        }\n                    }\n                    if (list2) {\n                        const combined = list1.concat(list2);\n                        if (type1 === GeometryType.LineString) {\n                            return turf.lineString(combined).geometry;\n                        }\n                        if (type1 === GeometryType.MultiPoint) {\n                            return turf.multiPoint(combined).geometry;\n                        }\n                        if (type1 === GeometryType.GeometryCollection) {\n                            return turf.geometryCollection(combined).geometry;\n                        }\n                    }\n                }\n\n                if (type1 === GeometryType.GeometryCollection) {\n                    return turf.geometryCollection(geom1.geometries.concat([geom2])).geometry;\n                }\n\n                if (type2 === GeometryType.GeometryCollection) {\n                    return turf.geometryCollection([geom1].concat(...geom2.geometries)).geometry;\n                }\n\n                return turf.geometryCollection([geom1, geom2]).geometry;\n            },\n            PipeExp(a, op, f) {\n                const operator = op.sourceString;\n                const val = a.eval();\n                const fn = f.eval();\n\n                if (operator === '|') {\n                    return fn(val);\n                }\n\n                if (operator === '|*') {\n                    return transform(val, fn);\n                }\n\n                const list: any[] = getArrayLikeItems(val);\n                let listFn: any;\n                switch (operator) {\n                    case '||':\n                        listFn = Array.prototype.map;\n                        break;\n                    case '|~':\n                        listFn = Array.prototype.filter;\n                        break;\n                    case '|>':\n                        listFn = Array.prototype.reduce;\n                        break;\n                    default:\n                        throw new Error(`Operator ${operator} not supported`)\n                }\n\n                if (isGeometryType(GeometryType.GeometryCollection, val)) {\n                    const mappedList = listFn.call(list, fn);\n                    if (isAnyGeometryType(mappedList)) {\n                        return mappedList;\n                    }\n                    return turf.geometryCollection(mappedList).geometry;\n                }\n\n                if (isGeometryType(GeometryType.LineString, val)) {\n                    let mappedList = listFn.call(\n                        list.map(coords => turf.point(coords).geometry),\n                        fn\n                    );\n                    if (isAnyGeometryType(mappedList)) {\n                        return mappedList;\n                    }\n                    mappedList = mappedList.map((v: any) => v.coordinates);\n                    return turf.lineString(mappedList).geometry;\n                }\n\n                if (isGeometryType(GeometryType.MultiPoint, val)) {\n                    let mappedList = listFn.call(\n                        list.map(coords => turf.point(coords).geometry),\n                        fn\n                    );\n                    if (isAnyGeometryType(mappedList)) {\n                        return mappedList;\n                    }\n                    mappedList = mappedList.map((v: any) => v.coordinates);\n                    return turf.multiPoint(mappedList).geometry;\n                }\n\n                // TODO -- Multi line types (Polygon, MultiLineString)\n\n                throw Error(`Error mapping values to geometries`);\n            },\n            TopLevel(scopedExpressions, _end) {\n                let lastValue = scopedExpressions.eval();\n                return lastValue;\n            },\n            GenerateExp(_keyword, numExp, valueExp) {\n                const num = numExp.eval();\n                if (!Number.isInteger(num) && typeof num !== 'function') {\n                    throw new Error(`Expected integer but got: ${toString(num)}`);\n                }\n                let value = valueExp.eval();\n                let mapFn;\n                if (typeof value === 'function') {\n                    mapFn = value;\n                } else if (isAnyGeometryType(value)) {\n                    mapFn = () => value;\n                } else {\n                    throw new Error(`Expected geometry type or function but got: ${toString(value)}`);\n                }\n                const items: any[] = [];\n                if (typeof num === 'function') { \n                    let i = 0;\n                    let condition = num(i);\n                    while(condition) {\n                        const result = mapFn(i);\n                        if (!isAnyGeometryType(result)) {\n                            throw new Error(`Expected geometry type return value but got: ${toString(result)}`);\n                        }\n                        items.push(result);\n                        condition = num(++i);\n                    }\n                } else {\n                    for (let i=0; i<num; i++) {\n                        const result = mapFn(i);\n                        if (!isAnyGeometryType(result)) {\n                            throw new Error(`Expected geometry type return value but got: ${toString(result)}`);\n                        }\n                        items.push(result);\n                    }\n                }\n                return turf.geometryCollection(items).geometry;\n            },\n            FunctionCallExp(callable, p) {\n                const fn = callable.eval();\n                const params = p.eval();\n                if (!fn) {\n                    throw new Error(`${callable.sourceString} is: ${fn}`);\n                }\n                const value = fn(...params);\n                return value;\n            },\n            AccessibleExp_method(val, _accessOp, prop, optionalParams: ohm.Node) {\n                const value = val.eval();\n                const identifier = prop.sourceString;\n                const isInvocation = optionalParams.children.length > 0;\n                const parameters = isInvocation ? optionalParams.children.map(c => c.eval())[0] : [];\n\n                // Function type accessor\n                if (typeof value === 'function') {\n                    if (identifier === 'bind') {\n                        return value.bind(undefined, ...parameters)\n                    }\n                    throw new OperationNotSupported(`Method ${identifier} not supported on function type`);\n                }\n                \n                // Geometry type accessor\n                if (isAnyGeometryType(value)) {\n                    return geometryAccessor(val, prop, parameters);\n                }\n\n                // Object type accessor\n                const resolvedValue = value[identifier];\n                if (typeof resolvedValue === 'function' && isInvocation) {\n                    return resolvedValue(...parameters);\n                }\n                return resolvedValue;\n            },\n            Invocation(_leftParen, list, _rightParen) {\n                return list.asIteration().children.map(c => c.eval());\n            },\n            FunctionExp(p, _, body) {\n                let params = p.eval();\n                params = Array.isArray(params) ? params : [params];\n                let fnScope = currentScope;\n                const fn = function(...values: any[]) {\n                    // Create new scope per function call.\n                    currentScope = currentScope.push({...fnScope.bindings});\n                    params.forEach((paramName: any, index: number) => {\n                        currentScope.store(paramName, values[index], undefined, false)\n                    });\n                    const ret = body.eval();\n                    const defaultBindings: ScopeBindings = {};\n                    defaultBindings[IMPORT_DEFAULT_IDENTIFIER] = ret;\n                    currentScope = currentScope.pop(defaultBindings) || GLOBAL_SCOPE;\n                    return ret;\n                };\n                const boundFn = fn.bind(currentScope);\n                boundFn.toString = function() { return `Function(${p.sourceString} => ${body.sourceString})` }\n                return boundFn;\n            },\n            FunctionParameters_multipleParams(_leftParen, identifierList, _rightParen) {\n                const params = identifierList.asIteration().children.map(c => c.sourceString);\n                return params;\n            },\n            FunctionParameters_single(identifier) {\n                return [identifier.sourceString];\n            },\n            FunctionTextExp_keyword(_keyword, _leftParen, exp, _rightParen) {\n                return exp.eval();\n            },\n            id(first, rest) {\n                const key = first.sourceString + rest.sourceString;\n                return currentScope.resolve(key);\n            },\n            AssignmentExp(exportKeyword, letKeyword, identifier, _operator, value) {\n                const isPublic = !!(exportKeyword?.children?.length);\n                const isLet = !!(letKeyword?.children?.length);\n                const variableName = identifier.sourceString;\n                const variableValue = value.eval();\n                currentScope.store(variableName, variableValue, { public: isPublic }, !isLet);\n                return variableValue;\n\n            },\n            ScopedExpressions_list(list) {\n                const expressions = list.asIteration().children.map(c => c.eval());\n                return expressions[expressions.length - 1];\n            },\n            GeneralExpression_rightComment(exp, _) {\n                return exp.eval();\n            },\n            GeneralExpression_leftComment(_, exp) {\n                return exp.eval();\n            },\n            Paren(_leftParen, exp, _rightParen) {\n                return exp.eval();\n            },\n            OptionallyParen_paren(_leftParen, exp, _rightParen) {\n                return exp.eval();\n            },\n            OptionallyBraced_brace(_leftBrace, exp, _rightBrace) {\n                return exp.eval();\n            },\n            GeometryTaggedText(_keyword, exp) {\n                return exp.eval();\n            },\n            GeometryCollectionText_present(_leftParen, list, _rightParen) {\n                const geometries = ((list || []) as any).asIteration().children.map((c: any) => c.eval());\n                return turf.geometryCollection(geometries).geometry;\n            },\n            MultiPolygonText_present(_leftParen, list, _rightParen) {\n                const polygons = list.asIteration().children.map(c => c.eval());\n                return turf.multiPolygon(polygons.map(p => p.coordinates)).geometry;\n            },\n            MultiLineStringText_present(_leftParen, list, _rightParen) {\n                const lineStrings = list.asIteration().children.map(c => c.eval());\n                return turf.multiLineString(lineStrings.map(p => p.coordinates)).geometry;\n            },\n            MultiPointText_present(_leftParen, list, _rightParen) {\n                const points = list.eval();\n                return turf.multiPoint(points.map((p: any) => p.coordinates)).geometry;\n            },\n            PolygonText_present(_leftParen, list, _rightParen) {\n                const points = list.asIteration().children.map(c => c.eval());\n                return turf.polygon(points.map(p => p.coordinates)).geometry;\n            },\n            LineStringText_present(_leftParen, list, _rightParen) {\n                const points = list.eval();\n                return turf.lineString(points.map((p: any) => p.coordinates)).geometry;\n            },\n            PointList(list) {\n                return list.asIteration().children.map(c => c.eval());\n            },\n            PointTaggedText(_, point) {\n                return point.eval();\n            },\n            PointText_present(_leftParen, point, _rightParen) {\n                return point.eval();\n            },\n            Point(x, y) {\n                return turf.point([x.eval(), y.eval()]).geometry;\n            },\n            ArithmeticAdd_plus(a, _, b) {\n                const result = arithmeticOperationExp(a, b, (a, b) => a + b);\n                if (result !== undefined) {\n                    return result;\n                }\n                throw new OperationNotSupported(`${toString(a.eval())} + ${toString(b.eval())}`);\n            },\n            ArithmeticAdd_minus(a, _, b) {\n                const result = arithmeticOperationExp(a, b, (a, b) => a - b);\n                if (result !== undefined) {\n                    return result;\n                }\n                throw new OperationNotSupported(`${toString(a.eval())} - ${toString(b.eval())}`);\n            },\n            ArithmeticMul_times(a, _, b) {\n                const result = arithmeticOperationExp(a, b, (a, b) => a * b);\n                if (result !== undefined) {\n                    return result;\n                }\n                throw new OperationNotSupported(`${toString(a.eval())} * ${toString(b.eval())}`);\n            },\n            ArithmeticMul_divide(a, _, b) {\n                const result = arithmeticOperationExp(a, b, (a, b) => a / b);\n                if (result !== undefined) {\n                    return result;\n                }\n                throw new OperationNotSupported(`${toString(a.eval())} / ${toString(b.eval())}`);\n            },\n            ArithmeticMul_mod(a, _, b) {\n                const result = arithmeticOperationExp(a, b, (a, b) => a % b);\n                if (result !== undefined) {\n                    return result;\n                }\n                throw new OperationNotSupported(`${toString(a.eval())} % ${toString(b.eval())}`);\n            },\n            ArithmeticExp_power(a, _, b) {\n                const result = arithmeticOperationExp(a, b, (a, b) => Math.pow(a, b));\n                if (result !== undefined) {\n                    return result;\n                }\n                throw new OperationNotSupported(`${toString(a.eval())} ^ ${toString(b.eval())}`);\n            },\n            ArithmeticPri_paren(_l, exp, _r) {\n                return exp.eval();\n            },\n            exactNumericLiteral_decimalWithWholeNumber(whole, _, decimal) {\n                return parseFloat(`${whole.sourceString}.${decimal.sourceString}`);\n            },\n            exactNumericLiteral_decimalWithoutWholeNumber(_, decimal) {\n                return parseFloat(`.${decimal.sourceString}`);\n            },\n            exactNumericLiteral_wholeNumber(whole) {\n                return parseInt(`${whole.sourceString}`);\n            },\n            approximateNumericLiteral(mantissa, e, exponent) {\n                return parseFloat(`${mantissa.eval()}${e}${exponent.eval()}`);\n            },\n            signedNumericLiteral_signPresent(sign, numericLiteral) {\n                return parseFloat(`${sign.sourceString}${numericLiteral.eval()}`);\n            },\n            signedNumericLiteral_signMissing(numericLiteral) {\n                return numericLiteral.eval();\n            },\n            comment(_a, _b, _c, _d, _e) {\n                return UNIT;\n            },\n            emptySet(_val) {\n                return UNIT;\n            }\n        });\n    \n        const matchResult = grammar.match(input);\n        if (matchResult.message) {\n            console.error(`Message: ${matchResult.message}`)\n        }\n        const sem = semantics(matchResult);\n        const result = sem.eval();\n        return result;\n    }\n    \n}","export type GeoJSON = any; // TODO -- use GeoJSON type\n\nexport enum GeometryType {\n    Point = 'Point',\n    LineString = 'LineString',\n    Polygon = 'Polygon',\n    MultiPoint = 'MultiPoint',\n    MultiLineString = 'MultiLineString',\n    MultiPolygon = 'MultiPolygon',\n    GeometryCollection = 'GeometryCollection'\n}\n\nexport type Unit = null;\nexport const UNIT: Unit = null;\n\n","import * as turf from '@turf/turf';\n\nimport { GeometryType } from \"./types\";\nimport { Point } from 'geojson';\n\nexport const isAnyGeometryType = (value: any) => {\n    const types = Object.values(GeometryType);\n    for (const type of types) {\n        if (isGeometryType(type, value)) {\n            return true;\n        }\n    }\n    return false;\n}\n\nexport const isGeometryType = (type: GeometryType, ...values: any) => {\n    for (const value of values) {\n        const isType = typeof value === 'object' &&\n            value?.type === type ||\n            value?.geometry?.type === type;\n        if (!isType) {\n            return false;\n        }\n    }\n    return true;\n};\n\nexport const getGeometryType = (value: any, isForDisplay = false): GeometryType | undefined => {\n    if(typeof value === 'object') {\n        const type = value?.geometry?.type || value?.type\n        if (isForDisplay && type === GeometryType.GeometryCollection) {\n            return GeometryType.GeometryCollection;\n        }\n        return type;\n    }\n    return undefined;\n}\n\n\nexport const isAGeometryType = (value: any, ...types: GeometryType[]) => {\n    for (const type of types) {\n        if(isGeometryType(type, value)) {\n            return true;\n        }\n    }\n    return false;\n};\n\nexport const getArrayLikeItems = (value: any) => {\n    if (\n        isGeometryType(GeometryType.LineString, value) ||\n        isGeometryType(GeometryType.MultiPoint, value)\n    ) {\n        return value.coordinates;\n    } else if (isGeometryType(GeometryType.GeometryCollection, value)) {\n        return value.geometries;\n    }\n    return undefined;\n};\n\nexport const isNumber = (...values: any) => {\n    return isType('number', ...values);\n}\n\nexport const isString = (...values: any) => {\n    return isType('string', ...values);\n};\n\nexport const isType = (type: string, ...values: any) => {\n    for (const value of values) {\n        const isType = typeof value === type;\n        if (!isType) {\n            return false;\n        }\n    }\n    return true;\n}\n\nexport const arithmeticOperationExp = (a: any, b: any, op: (a: any, b: any) => any) => {\n    return arithmeticOperation(a.eval(), b.eval(), op);\n}\n\nexport const arithmeticOperation = (A: any, B: any, op: (a: any, b: any) => any): any => {\n    if (isNumber(A, B)) {\n      return op(A, B);  \n    }\n    if (isNumber(A) && isAnyGeometryType(B)) {\n        return arithmeticOperation(turf.point([A, A]).geometry, B, op);\n    }\n    if (isNumber(B) && isAnyGeometryType(A)) {\n        return arithmeticOperation(A, turf.point([B, B]).geometry, op);\n    }\n    if (isGeometryType(GeometryType.Point, A, B)) {\n        return pointOperation(A, B, op);\n    }\n    if (isGeometryType(GeometryType.LineString, A, B)) {\n        return lineStringOperation(A, B, op);\n    }\n    if (isGeometryType(GeometryType.MultiPoint, A, B)) {\n        return multiPointOperation(A, B, op);\n    }\n    if (isGeometryType(GeometryType.Point, A)) {\n        return transform(B, (b => pointOperation(A, b, op)))\n    }\n    if (isGeometryType(GeometryType.Point, B)) {\n        return transform(A, (a => pointOperation(a, B, op)))\n    }\n    return undefined;\n}\n\nexport const pointOperation = (\n    A: any,\n    B: any,\n    computeFn: (a: number, b: number) => number\n) => {\n    return turf.point([\n        computeFn(A.coordinates[0], B.coordinates[0]),\n        computeFn(A.coordinates[1], B.coordinates[1]),\n    ]).geometry;\n}\n\n\nexport const lineStringOperation = (\n    A: any,\n    B: any,\n    computeFn: (a: number, b: number) => number\n) => {\n    return turf.lineString(A.coordinates.map((p: number[], index: number) => {\n        return [\n            computeFn(p[0], B.coordinates[index][0]),\n            computeFn(p[1], B.coordinates[index][1]),\n        ];\n    })).geometry;\n}\n\nexport const multiPointOperation = (\n    A: any,\n    B: any,\n    computeFn: (a: number, b: number) => number\n) => {\n    return turf.multiPoint(A.coordinates.map((p: number[], index: number) => {\n        return [\n            computeFn(p[0], B.coordinates[index][0]),\n            computeFn(p[1], B.coordinates[index][1]),\n        ];\n    })).geometry;\n}\n\nexport class OperationNotSupported extends Error {\n    constructor(message: string) {\n        super(`Operation not supported: ${message}`);\n    }\n}\n\nexport function toString(value: any) {\n    try {\n        return `${JSON.stringify(value)}`;\n    } catch (err) {\n        return `${value}`;\n    }\n}\n\nexport function transformPoints(coords: any[], coordsMapFn: (g: Point) => any): any {\n    if (!!coords) {\n        if (Array.isArray(coords)) {\n            if (coords.length > 0) {\n                const firstElement = coords[0];\n                if (Array.isArray(firstElement)) {\n                    return coords.map((c: any) => transformPoints(c, coordsMapFn));\n                } else {\n                    // coords is a point\n                    const point = turf.point(coords).geometry;\n                    return coordsMapFn(point).coordinates;\n                }\n                \n            }\n        }\n    }\n    return coords\n}\n\nexport function transform(geoJson: any, coordsMapFn: (g: Point) => any): any {    \n    if (!!geoJson) {\n\n        if (!!geoJson.features) {\n            return {\n                ...geoJson,\n                features: geoJson.features.map((feature: any) => transform(feature, coordsMapFn))\n            };\n        }\n\n        if (!!geoJson.geometries) {\n            return {\n                ...geoJson,\n                geometries: geoJson.geometries.map((geometry: any) => transform(geometry, coordsMapFn))\n            }\n        }\n\n        const geometry: any = geoJson.geometry;\n        if (!!geometry) {\n            if (geoJson.coordinates) {\n                return {\n                    ...geoJson,\n                    geometry: {\n                        ...geometry,\n                        coordinates: transformPoints(geometry.coordinates, coordsMapFn)\n                    }\n                }\n            }\n        }\n\n        const coordinates = geoJson.coordinates;\n        if (!!coordinates) {\n            return {\n                ...geoJson,\n                coordinates: transformPoints(coordinates, coordsMapFn)\n            }\n        }\n    }\n    return geoJson;\n}\n\nexport function convertToGeometry(json: any): any {\n    if (json.type === 'Feature') {\n        return json.geometry;\n    } else if (json.type === 'FeatureCollection') {\n        return {\n            type: 'GeometryCollection',\n            geometries: json.features.map((f: any) => convertToGeometry(f))\n        }\n    } else if (Array.isArray(json)) {\n        return {\n            type: 'GeometryCollection',\n            geometries: json.map((f: any) => convertToGeometry(f))\n        }\n    }\n    return json;\n}\n\nexport function geometryAccessor(v: any, p: any, params: any[]) {\n    const value = v.eval();\n    const property = p.sourceString;\n\n    if (!isAnyGeometryType(value)) {\n        throw new Error(`Expected a geometry type for value \"${v.sourceString}\" but got: ${toString(value)}`);\n    }\n\n    switch (property.toLocaleLowerCase()) {\n        case 'type':\n            if (params?.length > 1) {\n                throw new Error(`Expected no parameters for \"${property}\" for ${v.sourceString}`)\n            }\n            return getGeometryType(value, true);\n    }\n\n    if (isGeometryType(GeometryType.Point, value)) {\n        switch (property.toLocaleLowerCase()) {\n            case 'x':\n                if (params?.length > 0) {\n                    // setter\n                    if (params.length === 1) {\n                        return turf.point([\n                            params[0],\n                            value.coordinates[1]\n                        ]).geometry;\n                    }\n                    throw Error(`Expected one value in \"${property}\" setter for \"${v.sourceString}\" but got: ${toString(params)}`)\n                }\n                // getter\n                return value.coordinates[0];\n            case 'y':\n                if (params?.length > 0) {\n                    // setter\n                    if (params.length === 1) {\n                        return turf.point([\n                            value.coordinates[0],\n                            params[0]\n                        ]).geometry;\n                    }\n                    throw Error(`Expected one value in \"${property}\" setter for \"${v.sourceString}\" but got: ${toString(params)}`)\n                }\n                // getter\n                return value.coordinates[1];\n        }\n    } else if (isGeometryType(GeometryType.GeometryCollection, value)) {\n        switch (property.toLocaleLowerCase()) {\n            case 'geometryn':\n                if (params.length === 1) {\n                    const index = parseInt(params[0]);\n                    return value.geometries[index];\n                }\n                throw Error(`Expected one value in \"${property}\" setter for \"${v.sourceString}\" but got: ${toString(params)}`)\n            case 'numgeometries':\n                return value.geometries.length;\n            }\n    } else if (isGeometryType(GeometryType.LineString, value)) {\n        switch (property.toLocaleLowerCase()) {\n            case 'pointn':\n                if (params.length === 1) {\n                    const index = parseInt(params[0]);\n                    return turf.point(value.coordinates[index]).geometry;\n                }\n                throw Error(`Expected one value in \"${property}\" setter for \"${v.sourceString}\" but got: ${toString(params)}`)\n            case 'numpoints':\n                return value.coordinates.length;\n            }\n    }\n\n    throw new Error(`Property \"${property}\" not accessible on object: ${toString(value)}`);\n\n}","export interface ScopeBindings  {\n    [identifier: string]: any;\n}\n\nexport interface Metadata {\n    public: boolean;\n}\n\nexport interface ScopeBindingMetadata {\n    [identifier: string]: {\n        public?: boolean\n    };\n}\n\nexport class Scope {\n\n    bindings: ScopeBindings = {};\n    availableBindings: ScopeBindings = {};\n    private metadata: ScopeBindingMetadata = {};\n    constructor(\n        private parent?: Scope,\n        public readonly level = 0,\n        defaultBindings: ScopeBindings = {}\n    ) {\n        for (const identifier in defaultBindings) {\n            if (defaultBindings.hasOwnProperty(identifier)) {\n                this.store(identifier, defaultBindings[identifier]);\n            }\n        }\n    }\n\n    store(identifier: string, value: any, metadata?: Metadata, searchParentChain = true) {\n        let scope: Scope = this;\n        if (searchParentChain) {\n            const resolvedScope = this.resolveScope(identifier);\n            if (resolvedScope) {\n                scope = resolvedScope;\n            }\n            scope.store(identifier, value, metadata, false);\n            return;\n        }\n        this.bindings[identifier] = value;\n        if (metadata) {\n            this.metadata[identifier] = metadata;\n        }\n    };\n\n    resolveScope(identifier: string): Scope | undefined {\n        if (this.bindings.hasOwnProperty(identifier)) {\n            return this;\n        }\n\n        if (this.parent) {\n            return this.parent.resolveScope(identifier)\n        }\n\n        return undefined;\n    }\n\n    resolve(identifier: string): any {\n        const scope = this.resolveScope(identifier) ?? this\n        return scope.bindings[identifier];\n    };\n\n    push(extraBindings?: ScopeBindings): Scope {\n        return new Scope(this, this.level + 1, extraBindings);\n    }\n\n    pop(additionalBindings?: ScopeBindings): Scope | undefined {\n        const exportedBindings: ScopeBindings = {\n            ...additionalBindings\n        };\n        for (const identifier in this.metadata) {\n            const metadata = this.metadata[identifier];\n            if (metadata && metadata.public) {\n                exportedBindings[identifier] = this.bindings[identifier]\n            }\n        }\n        this.parent?.import(exportedBindings)\n        return this.parent;\n    }\n\n    import(scopeBindings: ScopeBindings) {\n        this.availableBindings = {\n            ...this.availableBindings,\n            ...scopeBindings\n        };\n    }\n\n    useImports(selectedIdentifiers?: string[]) {\n        let selectedBindings: ScopeBindings = {};\n        if (selectedIdentifiers) {\n            selectedIdentifiers.forEach(selectedIdentifier => {\n                selectedBindings[selectedIdentifier] = this.availableBindings[selectedIdentifier]\n            });\n        } else {\n            selectedBindings = this.availableBindings\n        }\n        this.availableBindings = {};\n        return selectedBindings;\n    }\n\n    useNamedImports(selectedIdentifiers: string[]) {\n        let selectedBindings: ScopeBindings = {};\n        if (selectedIdentifiers) {\n            selectedIdentifiers.forEach(selectedIdentifier => {\n                selectedBindings[selectedIdentifier] = this.availableBindings[selectedIdentifier]\n            });\n        }\n        this.bindings = {\n            ...this.bindings,\n            ...selectedBindings,\n        };\n        return selectedBindings;\n    }\n}","import * as turf from '@turf/turf';\n\nimport { OperationNotSupported, isGeometryType, toString, transform } from './helpers';\n\nimport { GeometryType } from './types';\nimport { Point } from 'geojson';\nimport booleanEqual from \"@turf/boolean-equal\"\n\nexport namespace BuiltInFunctions {\n\n    const FlattenHelper = (value: any) => {\n        const flattenedValues: any[] = [];\n        if (!!value) {\n            if (value?.type === GeometryType.GeometryCollection) {\n                for (const item of value.geometries) {\n                    flattenedValues.push(...FlattenHelper(item));\n                }\n            } else {\n                flattenedValues.push(value);\n            }\n        }\n        return flattenedValues;\n    };\n\n    export const Flatten = (value: any) => {\n        if (value?.type === GeometryType.GeometryCollection) {\n            return turf.geometryCollection(FlattenHelper(value)).geometry;\n        }\n        return value;\n    };\n\n    export const PointCircle = (radius: number, count: number) => {\n        const circlePoints: any[] = [];\n        const angleIncrement = (2 * Math.PI) / count;\n        for (let i = 0; i < count; i++) {\n            const angle = i * angleIncrement;\n            const x = radius * Math.cos(angle);\n            const y = radius * Math.sin(angle);\n            circlePoints.push(turf.point([x, y]).geometry);\n        }\n        return turf.geometryCollection(circlePoints).geometry;\n    };\n\n    export const PointGrid = (x: number, y: number, spacing = 1) => {\n        const points: any[] = [];\n        for (let i=0; i<x; i++) {\n            for (let j=0; j<y; j++) {\n                const point = turf.point([i * spacing, j * spacing]).geometry;\n                points.push(point);\n            }\n        }\n        return turf.geometryCollection(points).geometry;\n    }\n\n    const getPointsList = (value: any) => {\n        let points;\n        if (isGeometryType(GeometryType.GeometryCollection, value)) {\n            points = value?.geometries.map((f: any) => f.coordinates);\n        } else if (\n            isGeometryType(GeometryType.LineString, value) ||\n            isGeometryType(GeometryType.MultiPoint, value)\n        ) {\n            points = value?.coordinates;\n        }\n        if (points) {\n            return points;\n        }\n        throw new Error(\"Expected geometry with points list\");\n    }\n\n    export const ToLineString = (value: any) => {\n        const pointsList = getPointsList(value);\n        return turf.lineString(pointsList).geometry;\n    };\n\n    export const ToMultiPoint = (value: any) => {\n        const pointsList = getPointsList(value);\n        return turf.multiPoint(pointsList).geometry;\n    };\n\n    export const ToPolygon = (value: any) => {\n        const pointsList = getPointsList(value);\n        // Auto-close polygon\n        if (pointsList.length > 0) {\n            if (!booleanEqual(\n                turf.point(pointsList[0]).geometry,\n                turf.point(pointsList[pointsList.length - 1]).geometry\n            )) {\n                pointsList.push(pointsList[0]);\n            }\n        }\n        return turf.polygon([pointsList]).geometry;\n    };\n\n    export const ToGeometryCollection = (value: any) => {\n        const pointsList = getPointsList(value);\n        return turf.geometryCollection(pointsList.map((p: any) => turf.point(p).geometry)).geometry;\n    };\n\n    export const Rotate = (angleDegrees: number, origin: Point = turf.point([0, 0]).geometry, geometry: any) => {\n        return transform(geometry, (p: Point) => {\n            // Convert angle from degrees to radians\n            const angleRadians = (angleDegrees * Math.PI) / -180;\n            const originX = origin.coordinates[0];\n            const originY = origin.coordinates[1];\n            const x = p.coordinates[0];\n            const y = p.coordinates[1];\n\n            // Calculate the distance from the origin to the point\n            const dx = x - originX;\n            const dy = y - originY;\n\n            // Perform the rotation\n            const newX = originX + dx * Math.cos(angleRadians) - dy * Math.sin(angleRadians);\n            const newY = originY + dx * Math.sin(angleRadians) + dy * Math.cos(angleRadians);\n\n            return turf.point([newX, newY]).geometry;\n        });\n    }\n\n    export const Round = (precision = 0, val: any): any => {\n        if (typeof val === 'number') {\n            return +val.toFixed(precision);\n        }\n        if (isGeometryType(GeometryType.Point, val)) {\n            const coords = val.coordinates;\n            return turf.point([\n                Round(precision, coords[0]),\n                Round(precision, coords[1]),\n            ]).geometry;\n        }\n        throw new OperationNotSupported(`Unable to round value: ${toString(val)}`)\n    }\n}\n","import {\n  Feature,\n  LineString,\n  Position,\n  GeoJSON,\n  Point,\n  Polygon,\n  GeometryCollection,\n  FeatureCollection,\n  MultiLineString,\n  MultiPoint,\n  MultiPolygon,\n  GeoJsonProperties,\n} from \"geojson\";\n\n/**\n\n * GeoJSON equality checking utility.\n * Adapted from https://github.com/geosquare/geojson-equality\n *\n * @memberof helpers\n * @type {Class}\n */\nclass GeojsonEquality {\n  private precision: number;\n  private direction = false;\n  private compareProperties = true;\n\n  constructor(opts?: {\n    precision?: number;\n    direction?: boolean;\n    compareProperties?: boolean;\n  }) {\n    this.precision = 10 ** -(opts?.precision ?? 17);\n    this.direction = opts?.direction ?? false;\n    this.compareProperties = opts?.compareProperties ?? true;\n  }\n\n  compare(g1: GeoJSON, g2: GeoJSON): boolean {\n    if (g1.type !== g2.type) {\n      return false;\n    }\n\n    if (!sameLength(g1, g2)) {\n      return false;\n    }\n\n    switch (g1.type) {\n      case \"Point\":\n        return this.compareCoord(g1.coordinates, (g2 as Point).coordinates);\n      case \"LineString\":\n        return this.compareLine(g1.coordinates, (g2 as LineString).coordinates);\n      case \"Polygon\":\n        return this.comparePolygon(g1, g2 as Polygon);\n      case \"GeometryCollection\":\n        return this.compareGeometryCollection(g1, g2 as GeometryCollection);\n      case \"Feature\":\n        return this.compareFeature(g1, g2 as Feature);\n      case \"FeatureCollection\":\n        return this.compareFeatureCollection(g1, g2 as FeatureCollection);\n      default:\n        if (g1.type.startsWith(\"Multi\")) {\n          const g1s = explode(g1);\n          const g2s = explode(\n            g2 as MultiLineString | MultiPoint | MultiPolygon\n          );\n          return g1s.every((g1part) =>\n            g2s.some((g2part) => this.compare(g1part as any, g2part as any))\n          );\n        }\n    }\n    return false;\n  }\n\n  private compareCoord(c1: Position, c2: Position) {\n    return (\n      c1.length === c2.length &&\n      c1.every((c, i) => Math.abs(c - c2[i]) < this.precision)\n    );\n  }\n\n  private compareLine(\n    path1: Position[],\n    path2: Position[],\n    ind = 0,\n    isPoly = false\n  ): boolean {\n    if (!sameLength(path1, path2)) {\n      return false;\n    }\n    const p1 = path1;\n    let p2 = path2;\n    if (isPoly && !this.compareCoord(p1[0], p2[0])) {\n      // fix start index of both to same point\n      const startIndex = this.fixStartIndex(p2, p1);\n      if (!startIndex) {\n        return false;\n      } else {\n        p2 = startIndex;\n      }\n    }\n    // for linestring ind =0 and for polygon ind =1\n    const sameDirection = this.compareCoord(p1[ind], p2[ind]);\n    if (this.direction || sameDirection) {\n      return this.comparePath(p1, p2);\n    } else {\n      if (this.compareCoord(p1[ind], p2[p2.length - (1 + ind)])) {\n        return this.comparePath(p1.slice().reverse(), p2);\n      }\n      return false;\n    }\n  }\n\n  private fixStartIndex(sourcePath: Position[], targetPath: Position[]) {\n    //make sourcePath first point same as of targetPath\n    let correctPath,\n      ind = -1;\n    for (let i = 0; i < sourcePath.length; i++) {\n      if (this.compareCoord(sourcePath[i], targetPath[0])) {\n        ind = i;\n        break;\n      }\n    }\n    if (ind >= 0) {\n      correctPath = ([] as Position[]).concat(\n        sourcePath.slice(ind, sourcePath.length),\n        sourcePath.slice(1, ind + 1)\n      );\n    }\n    return correctPath;\n  }\n\n  private comparePath(p1: Position[], p2: Position[]) {\n    return p1.every((c, i) => this.compareCoord(c, p2[i]));\n  }\n\n  private comparePolygon(g1: Polygon, g2: Polygon) {\n    if (this.compareLine(g1.coordinates[0], g2.coordinates[0], 1, true)) {\n      const holes1 = g1.coordinates.slice(1, g1.coordinates.length);\n      const holes2 = g2.coordinates.slice(1, g2.coordinates.length);\n      return holes1.every((h1) =>\n        holes2.some((h2) => this.compareLine(h1, h2, 1, true))\n      );\n    }\n    return false;\n  }\n\n  private compareGeometryCollection(\n    g1: GeometryCollection,\n    g2: GeometryCollection\n  ) {\n    return (\n      sameLength(g1.geometries, g2.geometries) &&\n      this.compareBBox(g1, g2) &&\n      g1.geometries.every((g, i) => this.compare(g, g2.geometries[i]))\n    );\n  }\n\n  private compareFeature(g1: Feature, g2: Feature) {\n    return (\n      g1.id === g2.id &&\n      (this.compareProperties ? equal(g1.properties, g2.properties) : true) &&\n      this.compareBBox(g1, g2) &&\n      this.compare(g1.geometry, g2.geometry)\n    );\n  }\n\n  private compareFeatureCollection(\n    g1: FeatureCollection,\n    g2: FeatureCollection\n  ) {\n    return (\n      sameLength(g1.features, g2.features) &&\n      this.compareBBox(g1, g2) &&\n      g1.features.every((f, i) => this.compare(f, g2.features[i]))\n    );\n  }\n\n  private compareBBox(g1: GeoJSON, g2: GeoJSON): boolean {\n    return (\n      Boolean(!g1.bbox && !g2.bbox) ||\n      (g1.bbox && g2.bbox ? this.compareCoord(g1.bbox, g2.bbox) : false)\n    );\n  }\n}\n\nfunction sameLength(g1: any, g2: any) {\n  return g1.coordinates\n    ? g1.coordinates.length === g2.coordinates.length\n    : g1.length === g2.length;\n}\n\nfunction explode(g: MultiLineString | MultiPoint | MultiPolygon) {\n  return g.coordinates.map((part) => ({\n    type: g.type.replace(\"Multi\", \"\"),\n    coordinates: part,\n  }));\n}\n\nfunction geojsonEquality(\n  g1: GeoJSON,\n  g2: GeoJSON,\n  opts?: {\n    precision?: number;\n    direction?: boolean;\n    compareProperties?: boolean;\n  }\n): boolean {\n  const eq = new GeojsonEquality(opts);\n\n  return eq.compare(g1, g2);\n}\n\n// Adapted from https://medium.com/syncfusion/5-different-ways-to-deep-compare-javascript-objects-6708a0da9f05\nfunction equal(object1: GeoJsonProperties, object2: GeoJsonProperties) {\n  if (object1 === null && object2 === null) {\n    return true;\n  }\n\n  if (object1 === null || object2 === null) {\n    return false;\n  }\n\n  const objKeys1 = Object.keys(object1);\n  const objKeys2 = Object.keys(object2);\n\n  if (objKeys1.length !== objKeys2.length) return false;\n\n  for (var key of objKeys1) {\n    const value1 = object1[key];\n    const value2 = object2[key];\n\n    const isObjects = isObject(value1) && isObject(value2);\n\n    if (\n      (isObjects && !equal(value1, value2)) ||\n      (!isObjects && value1 !== value2)\n    ) {\n      return false;\n    }\n  }\n  return true;\n}\n\nconst isObject = (object: any) => {\n  return object != null && typeof object === \"object\";\n};\n\nexport { GeojsonEquality, geojsonEquality };\nexport default GeojsonEquality;\n","import {\n  BBox,\n  Feature,\n  FeatureCollection,\n  Geometry,\n  GeometryCollection,\n  GeometryObject,\n  LineString,\n  MultiLineString,\n  MultiPoint,\n  MultiPolygon,\n  Point,\n  Polygon,\n  Position,\n  GeoJsonProperties,\n} from \"geojson\";\n\nimport { Id } from \"./lib/geojson.js\";\nexport * from \"./lib/geojson.js\";\n\n/**\n * @module helpers\n */\n\n// TurfJS Combined Types\nexport type Coord = Feature<Point> | Point | Position;\n\n/**\n * Linear measurement units.\n *\n * ⚠️ Warning. Be aware of the implications of using radian or degree units to\n * measure distance. The distance represented by a degree of longitude *varies*\n * depending on latitude.\n *\n * See https://www.thoughtco.com/degree-of-latitude-and-longitude-distance-4070616\n * for an illustration of this behaviour.\n *\n * @typedef\n */\nexport type Units =\n  | \"meters\"\n  | \"metres\"\n  | \"millimeters\"\n  | \"millimetres\"\n  | \"centimeters\"\n  | \"centimetres\"\n  | \"kilometers\"\n  | \"kilometres\"\n  | \"miles\"\n  | \"nauticalmiles\"\n  | \"inches\"\n  | \"yards\"\n  | \"feet\"\n  | \"radians\"\n  | \"degrees\";\n\n/**\n * Area measurement units.\n *\n * @typedef\n */\nexport type AreaUnits =\n  | Exclude<Units, \"radians\" | \"degrees\">\n  | \"acres\"\n  | \"hectares\";\n\n/**\n * Grid types.\n *\n * @typedef\n */\nexport type Grid = \"point\" | \"square\" | \"hex\" | \"triangle\";\n\n/**\n * Shorthand corner identifiers.\n *\n * @typedef\n */\nexport type Corners = \"sw\" | \"se\" | \"nw\" | \"ne\" | \"center\" | \"centroid\";\n\n/**\n * Geometries made up of lines i.e. lines and polygons.\n *\n * @typedef\n */\nexport type Lines = LineString | MultiLineString | Polygon | MultiPolygon;\n\n/**\n * Convenience type for all possible GeoJSON.\n *\n * @typedef\n */\nexport type AllGeoJSON =\n  | Feature\n  | FeatureCollection\n  | Geometry\n  | GeometryCollection;\n\n/**\n * The Earth radius in kilometers. Used by Turf modules that model the Earth as a sphere. The {@link https://en.wikipedia.org/wiki/Earth_radius#Arithmetic_mean_radius mean radius} was selected because it is {@link https://rosettacode.org/wiki/Haversine_formula#:~:text=This%20value%20is%20recommended recommended } by the Haversine formula (used by turf/distance) to reduce error.\n *\n * @constant\n */\nexport const earthRadius = 6371008.8;\n\n/**\n * Unit of measurement factors based on earthRadius.\n *\n * Keys are the name of the unit, values are the number of that unit in a single radian\n *\n * @constant\n */\nexport const factors: Record<Units, number> = {\n  centimeters: earthRadius * 100,\n  centimetres: earthRadius * 100,\n  degrees: 360 / (2 * Math.PI),\n  feet: earthRadius * 3.28084,\n  inches: earthRadius * 39.37,\n  kilometers: earthRadius / 1000,\n  kilometres: earthRadius / 1000,\n  meters: earthRadius,\n  metres: earthRadius,\n  miles: earthRadius / 1609.344,\n  millimeters: earthRadius * 1000,\n  millimetres: earthRadius * 1000,\n  nauticalmiles: earthRadius / 1852,\n  radians: 1,\n  yards: earthRadius * 1.0936,\n};\n\n/**\n\n * Area of measurement factors based on 1 square meter.\n *\n * @constant\n */\nexport const areaFactors: Record<AreaUnits, number> = {\n  acres: 0.000247105,\n  centimeters: 10000,\n  centimetres: 10000,\n  feet: 10.763910417,\n  hectares: 0.0001,\n  inches: 1550.003100006,\n  kilometers: 0.000001,\n  kilometres: 0.000001,\n  meters: 1,\n  metres: 1,\n  miles: 3.86e-7,\n  nauticalmiles: 2.9155334959812285e-7,\n  millimeters: 1000000,\n  millimetres: 1000000,\n  yards: 1.195990046,\n};\n\n/**\n * Wraps a GeoJSON {@link Geometry} in a GeoJSON {@link Feature}.\n *\n * @function\n * @param {GeometryObject} geometry input geometry\n * @param {GeoJsonProperties} [properties={}] an Object of key-value pairs to add as properties\n * @param {Object} [options={}] Optional Parameters\n * @param {BBox} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature\n * @param {Id} [options.id] Identifier associated with the Feature\n * @returns {Feature<GeometryObject, GeoJsonProperties>} a GeoJSON Feature\n * @example\n * var geometry = {\n *   \"type\": \"Point\",\n *   \"coordinates\": [110, 50]\n * };\n *\n * var feature = turf.feature(geometry);\n *\n * //=feature\n */\nexport function feature<\n  G extends GeometryObject = Geometry,\n  P extends GeoJsonProperties = GeoJsonProperties,\n>(\n  geom: G | null,\n  properties?: P,\n  options: { bbox?: BBox; id?: Id } = {}\n): Feature<G, P> {\n  const feat: any = { type: \"Feature\" };\n  if (options.id === 0 || options.id) {\n    feat.id = options.id;\n  }\n  if (options.bbox) {\n    feat.bbox = options.bbox;\n  }\n  feat.properties = properties || {};\n  feat.geometry = geom;\n  return feat;\n}\n\n/**\n * Creates a GeoJSON {@link Geometry} from a Geometry string type & coordinates.\n * For GeometryCollection type use `helpers.geometryCollection`\n *\n * @function\n * @param {(\"Point\" | \"LineString\" | \"Polygon\" | \"MultiPoint\" | \"MultiLineString\" | \"MultiPolygon\")} type Geometry Type\n * @param {Array<any>} coordinates Coordinates\n * @param {Object} [options={}] Optional Parameters\n * @returns {Geometry} a GeoJSON Geometry\n * @example\n * var type = \"Point\";\n * var coordinates = [110, 50];\n * var geometry = turf.geometry(type, coordinates);\n * // => geometry\n */\nexport function geometry(\n  type:\n    | \"Point\"\n    | \"LineString\"\n    | \"Polygon\"\n    | \"MultiPoint\"\n    | \"MultiLineString\"\n    | \"MultiPolygon\",\n  coordinates: any[],\n  _options: Record<string, never> = {}\n) {\n  switch (type) {\n    case \"Point\":\n      return point(coordinates).geometry;\n    case \"LineString\":\n      return lineString(coordinates).geometry;\n    case \"Polygon\":\n      return polygon(coordinates).geometry;\n    case \"MultiPoint\":\n      return multiPoint(coordinates).geometry;\n    case \"MultiLineString\":\n      return multiLineString(coordinates).geometry;\n    case \"MultiPolygon\":\n      return multiPolygon(coordinates).geometry;\n    default:\n      throw new Error(type + \" is invalid\");\n  }\n}\n\n/**\n * Creates a {@link Point} {@link Feature} from a Position.\n *\n * @function\n * @param {Position} coordinates longitude, latitude position (each in decimal degrees)\n * @param {GeoJsonProperties} [properties={}] an Object of key-value pairs to add as properties\n * @param {Object} [options={}] Optional Parameters\n * @param {BBox} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature\n * @param {Id} [options.id] Identifier associated with the Feature\n * @returns {Feature<Point, GeoJsonProperties>} a Point feature\n * @example\n * var point = turf.point([-75.343, 39.984]);\n *\n * //=point\n */\nexport function point<P extends GeoJsonProperties = GeoJsonProperties>(\n  coordinates: Position,\n  properties?: P,\n  options: { bbox?: BBox; id?: Id } = {}\n): Feature<Point, P> {\n  if (!coordinates) {\n    throw new Error(\"coordinates is required\");\n  }\n  if (!Array.isArray(coordinates)) {\n    throw new Error(\"coordinates must be an Array\");\n  }\n  if (coordinates.length < 2) {\n    throw new Error(\"coordinates must be at least 2 numbers long\");\n  }\n  if (!isNumber(coordinates[0]) || !isNumber(coordinates[1])) {\n    throw new Error(\"coordinates must contain numbers\");\n  }\n\n  const geom: Point = {\n    type: \"Point\",\n    coordinates,\n  };\n  return feature(geom, properties, options);\n}\n\n/**\n * Creates a {@link Point} {@link FeatureCollection} from an Array of Point coordinates.\n *\n * @function\n * @param {Position[]} coordinates an array of Points\n * @param {GeoJsonProperties} [properties={}] Translate these properties to each Feature\n * @param {Object} [options={}] Optional Parameters\n * @param {BBox} [options.bbox] Bounding Box Array [west, south, east, north]\n * associated with the FeatureCollection\n * @param {Id} [options.id] Identifier associated with the FeatureCollection\n * @returns {FeatureCollection<Point>} Point Feature\n * @example\n * var points = turf.points([\n *   [-75, 39],\n *   [-80, 45],\n *   [-78, 50]\n * ]);\n *\n * //=points\n */\nexport function points<P extends GeoJsonProperties = GeoJsonProperties>(\n  coordinates: Position[],\n  properties?: P,\n  options: { bbox?: BBox; id?: Id } = {}\n): FeatureCollection<Point, P> {\n  return featureCollection(\n    coordinates.map((coords) => {\n      return point(coords, properties);\n    }),\n    options\n  );\n}\n\n/**\n * Creates a {@link Polygon} {@link Feature} from an Array of LinearRings.\n *\n * @function\n * @param {Position[][]} coordinates an array of LinearRings\n * @param {GeoJsonProperties} [properties={}] an Object of key-value pairs to add as properties\n * @param {Object} [options={}] Optional Parameters\n * @param {BBox} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature\n * @param {Id} [options.id] Identifier associated with the Feature\n * @returns {Feature<Polygon, GeoJsonProperties>} Polygon Feature\n * @example\n * var polygon = turf.polygon([[[-5, 52], [-4, 56], [-2, 51], [-7, 54], [-5, 52]]], { name: 'poly1' });\n *\n * //=polygon\n */\nexport function polygon<P extends GeoJsonProperties = GeoJsonProperties>(\n  coordinates: Position[][],\n  properties?: P,\n  options: { bbox?: BBox; id?: Id } = {}\n): Feature<Polygon, P> {\n  for (const ring of coordinates) {\n    if (ring.length < 4) {\n      throw new Error(\n        \"Each LinearRing of a Polygon must have 4 or more Positions.\"\n      );\n    }\n\n    if (ring[ring.length - 1].length !== ring[0].length) {\n      throw new Error(\"First and last Position are not equivalent.\");\n    }\n\n    for (let j = 0; j < ring[ring.length - 1].length; j++) {\n      // Check if first point of Polygon contains two numbers\n      if (ring[ring.length - 1][j] !== ring[0][j]) {\n        throw new Error(\"First and last Position are not equivalent.\");\n      }\n    }\n  }\n  const geom: Polygon = {\n    type: \"Polygon\",\n    coordinates,\n  };\n  return feature(geom, properties, options);\n}\n\n/**\n * Creates a {@link Polygon} {@link FeatureCollection} from an Array of Polygon coordinates.\n *\n * @function\n * @param {Position[][][]} coordinates an array of Polygon coordinates\n * @param {GeoJsonProperties} [properties={}] an Object of key-value pairs to add as properties\n * @param {Object} [options={}] Optional Parameters\n * @param {BBox} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature\n * @param {Id} [options.id] Identifier associated with the FeatureCollection\n * @returns {FeatureCollection<Polygon, GeoJsonProperties>} Polygon FeatureCollection\n * @example\n * var polygons = turf.polygons([\n *   [[[-5, 52], [-4, 56], [-2, 51], [-7, 54], [-5, 52]]],\n *   [[[-15, 42], [-14, 46], [-12, 41], [-17, 44], [-15, 42]]],\n * ]);\n *\n * //=polygons\n */\nexport function polygons<P extends GeoJsonProperties = GeoJsonProperties>(\n  coordinates: Position[][][],\n  properties?: P,\n  options: { bbox?: BBox; id?: Id } = {}\n): FeatureCollection<Polygon, P> {\n  return featureCollection(\n    coordinates.map((coords) => {\n      return polygon(coords, properties);\n    }),\n    options\n  );\n}\n\n/**\n * Creates a {@link LineString} {@link Feature} from an Array of Positions.\n *\n * @function\n * @param {Position[]} coordinates an array of Positions\n * @param {GeoJsonProperties} [properties={}] an Object of key-value pairs to add as properties\n * @param {Object} [options={}] Optional Parameters\n * @param {BBox} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature\n * @param {Id} [options.id] Identifier associated with the Feature\n * @returns {Feature<LineString, GeoJsonProperties>} LineString Feature\n * @example\n * var linestring1 = turf.lineString([[-24, 63], [-23, 60], [-25, 65], [-20, 69]], {name: 'line 1'});\n * var linestring2 = turf.lineString([[-14, 43], [-13, 40], [-15, 45], [-10, 49]], {name: 'line 2'});\n *\n * //=linestring1\n * //=linestring2\n */\nexport function lineString<P extends GeoJsonProperties = GeoJsonProperties>(\n  coordinates: Position[],\n  properties?: P,\n  options: { bbox?: BBox; id?: Id } = {}\n): Feature<LineString, P> {\n  if (coordinates.length < 2) {\n    throw new Error(\"coordinates must be an array of two or more positions\");\n  }\n  const geom: LineString = {\n    type: \"LineString\",\n    coordinates,\n  };\n  return feature(geom, properties, options);\n}\n\n/**\n * Creates a {@link LineString} {@link FeatureCollection} from an Array of LineString coordinates.\n *\n * @function\n * @param {Position[][]} coordinates an array of LinearRings\n * @param {GeoJsonProperties} [properties={}] an Object of key-value pairs to add as properties\n * @param {Object} [options={}] Optional Parameters\n * @param {BBox} [options.bbox] Bounding Box Array [west, south, east, north]\n * associated with the FeatureCollection\n * @param {Id} [options.id] Identifier associated with the FeatureCollection\n * @returns {FeatureCollection<LineString, GeoJsonProperties>} LineString FeatureCollection\n * @example\n * var linestrings = turf.lineStrings([\n *   [[-24, 63], [-23, 60], [-25, 65], [-20, 69]],\n *   [[-14, 43], [-13, 40], [-15, 45], [-10, 49]]\n * ]);\n *\n * //=linestrings\n */\nexport function lineStrings<P extends GeoJsonProperties = GeoJsonProperties>(\n  coordinates: Position[][],\n  properties?: P,\n  options: { bbox?: BBox; id?: Id } = {}\n): FeatureCollection<LineString, P> {\n  return featureCollection(\n    coordinates.map((coords) => {\n      return lineString(coords, properties);\n    }),\n    options\n  );\n}\n\n/**\n * Takes one or more {@link Feature|Features} and creates a {@link FeatureCollection}.\n *\n * @function\n * @param {Array<Feature<GeometryObject, GeoJsonProperties>>} features input features\n * @param {Object} [options={}] Optional Parameters\n * @param {BBox} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature\n * @param {Id} [options.id] Identifier associated with the Feature\n * @returns {FeatureCollection<GeometryObject, GeoJsonProperties>} FeatureCollection of Features\n * @example\n * var locationA = turf.point([-75.343, 39.984], {name: 'Location A'});\n * var locationB = turf.point([-75.833, 39.284], {name: 'Location B'});\n * var locationC = turf.point([-75.534, 39.123], {name: 'Location C'});\n *\n * var collection = turf.featureCollection([\n *   locationA,\n *   locationB,\n *   locationC\n * ]);\n *\n * //=collection\n */\nexport function featureCollection<\n  G extends GeometryObject = Geometry,\n  P extends GeoJsonProperties = GeoJsonProperties,\n>(\n  features: Array<Feature<G, P>>,\n  options: { bbox?: BBox; id?: Id } = {}\n): FeatureCollection<G, P> {\n  const fc: any = { type: \"FeatureCollection\" };\n  if (options.id) {\n    fc.id = options.id;\n  }\n  if (options.bbox) {\n    fc.bbox = options.bbox;\n  }\n  fc.features = features;\n  return fc;\n}\n\n/**\n * Creates a {@link Feature}<{@link MultiLineString}> based on a\n * coordinate array. Properties can be added optionally.\n *\n * @function\n * @param {Position[][]} coordinates an array of LineStrings\n * @param {GeoJsonProperties} [properties={}] an Object of key-value pairs to add as properties\n * @param {Object} [options={}] Optional Parameters\n * @param {BBox} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature\n * @param {Id} [options.id] Identifier associated with the Feature\n * @returns {Feature<MultiLineString, GeoJsonProperties>} a MultiLineString feature\n * @throws {Error} if no coordinates are passed\n * @example\n * var multiLine = turf.multiLineString([[[0,0],[10,10]]]);\n *\n * //=multiLine\n */\nexport function multiLineString<\n  P extends GeoJsonProperties = GeoJsonProperties,\n>(\n  coordinates: Position[][],\n  properties?: P,\n  options: { bbox?: BBox; id?: Id } = {}\n): Feature<MultiLineString, P> {\n  const geom: MultiLineString = {\n    type: \"MultiLineString\",\n    coordinates,\n  };\n  return feature(geom, properties, options);\n}\n\n/**\n * Creates a {@link Feature}<{@link MultiPoint}> based on a\n * coordinate array. Properties can be added optionally.\n *\n * @function\n * @param {Position[]} coordinates an array of Positions\n * @param {GeoJsonProperties} [properties={}] an Object of key-value pairs to add as properties\n * @param {Object} [options={}] Optional Parameters\n * @param {BBox} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature\n * @param {Id} [options.id] Identifier associated with the Feature\n * @returns {Feature<MultiPoint, GeoJsonProperties>} a MultiPoint feature\n * @throws {Error} if no coordinates are passed\n * @example\n * var multiPt = turf.multiPoint([[0,0],[10,10]]);\n *\n * //=multiPt\n */\nexport function multiPoint<P extends GeoJsonProperties = GeoJsonProperties>(\n  coordinates: Position[],\n  properties?: P,\n  options: { bbox?: BBox; id?: Id } = {}\n): Feature<MultiPoint, P> {\n  const geom: MultiPoint = {\n    type: \"MultiPoint\",\n    coordinates,\n  };\n  return feature(geom, properties, options);\n}\n\n/**\n * Creates a {@link Feature}<{@link MultiPolygon}> based on a\n * coordinate array. Properties can be added optionally.\n *\n * @function\n * @param {Position[][][]} coordinates an array of Polygons\n * @param {GeoJsonProperties} [properties={}] an Object of key-value pairs to add as properties\n * @param {Object} [options={}] Optional Parameters\n * @param {BBox} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature\n * @param {Id} [options.id] Identifier associated with the Feature\n * @returns {Feature<MultiPolygon, GeoJsonProperties>} a multipolygon feature\n * @throws {Error} if no coordinates are passed\n * @example\n * var multiPoly = turf.multiPolygon([[[[0,0],[0,10],[10,10],[10,0],[0,0]]]]);\n *\n * //=multiPoly\n *\n */\nexport function multiPolygon<P extends GeoJsonProperties = GeoJsonProperties>(\n  coordinates: Position[][][],\n  properties?: P,\n  options: { bbox?: BBox; id?: Id } = {}\n): Feature<MultiPolygon, P> {\n  const geom: MultiPolygon = {\n    type: \"MultiPolygon\",\n    coordinates,\n  };\n  return feature(geom, properties, options);\n}\n\n/**\n * Creates a Feature<GeometryCollection> based on a\n * coordinate array. Properties can be added optionally.\n *\n * @function\n * @param {Array<Point | LineString | Polygon | MultiPoint | MultiLineString | MultiPolygon>} geometries an array of GeoJSON Geometries\n * @param {GeoJsonProperties} [properties={}] an Object of key-value pairs to add as properties\n * @param {Object} [options={}] Optional Parameters\n * @param {BBox} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature\n * @param {Id} [options.id] Identifier associated with the Feature\n * @returns {Feature<GeometryCollection, GeoJsonProperties>} a GeoJSON GeometryCollection Feature\n * @example\n * var pt = turf.geometry(\"Point\", [100, 0]);\n * var line = turf.geometry(\"LineString\", [[101, 0], [102, 1]]);\n * var collection = turf.geometryCollection([pt, line]);\n *\n * // => collection\n */\nexport function geometryCollection<\n  P extends GeoJsonProperties = GeoJsonProperties,\n>(\n  geometries: Array<\n    Point | LineString | Polygon | MultiPoint | MultiLineString | MultiPolygon\n  >,\n  properties?: P,\n  options: { bbox?: BBox; id?: Id } = {}\n): Feature<GeometryCollection, P> {\n  const geom: GeometryCollection = {\n    type: \"GeometryCollection\",\n    geometries,\n  };\n  return feature(geom, properties, options);\n}\n\n/**\n * Round number to precision\n *\n * @function\n * @param {number} num Number\n * @param {number} [precision=0] Precision\n * @returns {number} rounded number\n * @example\n * turf.round(120.4321)\n * //=120\n *\n * turf.round(120.4321, 2)\n * //=120.43\n */\nexport function round(num: number, precision = 0): number {\n  if (precision && !(precision >= 0)) {\n    throw new Error(\"precision must be a positive number\");\n  }\n  const multiplier = Math.pow(10, precision || 0);\n  return Math.round(num * multiplier) / multiplier;\n}\n\n/**\n * Convert a distance measurement (assuming a spherical Earth) from radians to a more friendly unit.\n * Valid units: miles, nauticalmiles, inches, yards, meters, metres, kilometers, centimeters, feet\n *\n * @function\n * @param {number} radians in radians across the sphere\n * @param {Units} [units=\"kilometers\"] can be degrees, radians, miles, inches, yards, metres,\n * meters, kilometres, kilometers.\n * @returns {number} distance\n */\nexport function radiansToLength(\n  radians: number,\n  units: Units = \"kilometers\"\n): number {\n  const factor = factors[units];\n  if (!factor) {\n    throw new Error(units + \" units is invalid\");\n  }\n  return radians * factor;\n}\n\n/**\n * Convert a distance measurement (assuming a spherical Earth) from a real-world unit into radians\n * Valid units: miles, nauticalmiles, inches, yards, meters, metres, kilometers, centimeters, feet\n *\n * @function\n * @param {number} distance in real units\n * @param {Units} [units=\"kilometers\"] can be degrees, radians, miles, inches, yards, metres,\n * meters, kilometres, kilometers.\n * @returns {number} radians\n */\nexport function lengthToRadians(\n  distance: number,\n  units: Units = \"kilometers\"\n): number {\n  const factor = factors[units];\n  if (!factor) {\n    throw new Error(units + \" units is invalid\");\n  }\n  return distance / factor;\n}\n\n/**\n * Convert a distance measurement (assuming a spherical Earth) from a real-world unit into degrees\n * Valid units: miles, nauticalmiles, inches, yards, meters, metres, centimeters, kilometres, feet\n *\n * @function\n * @param {number} distance in real units\n * @param {Units} [units=\"kilometers\"] can be degrees, radians, miles, inches, yards, metres,\n * meters, kilometres, kilometers.\n * @returns {number} degrees\n */\nexport function lengthToDegrees(distance: number, units?: Units): number {\n  return radiansToDegrees(lengthToRadians(distance, units));\n}\n\n/**\n * Converts any bearing angle from the north line direction (positive clockwise)\n * and returns an angle between 0-360 degrees (positive clockwise), 0 being the north line\n *\n * @function\n * @param {number} bearing angle, between -180 and +180 degrees\n * @returns {number} angle between 0 and 360 degrees\n */\nexport function bearingToAzimuth(bearing: number): number {\n  let angle = bearing % 360;\n  if (angle < 0) {\n    angle += 360;\n  }\n  return angle;\n}\n\n/**\n * Converts any azimuth angle from the north line direction (positive clockwise)\n * and returns an angle between -180 and +180 degrees (positive clockwise), 0 being the north line\n *\n * @function\n * @param {number} angle between 0 and 360 degrees\n * @returns {number} bearing between -180 and +180 degrees\n */\nexport function azimuthToBearing(angle: number): number {\n  // Ignore full revolutions (multiples of 360)\n  angle = angle % 360;\n\n  if (angle > 180) {\n    return angle - 360;\n  } else if (angle < -180) {\n    return angle + 360;\n  }\n\n  return angle;\n}\n\n/**\n * Converts an angle in radians to degrees\n *\n * @function\n * @param {number} radians angle in radians\n * @returns {number} degrees between 0 and 360 degrees\n */\nexport function radiansToDegrees(radians: number): number {\n  // % (2 * Math.PI) radians in case someone passes value > 2π\n  const normalisedRadians = radians % (2 * Math.PI);\n  return (normalisedRadians * 180) / Math.PI;\n}\n\n/**\n * Converts an angle in degrees to radians\n *\n * @function\n * @param {number} degrees angle between 0 and 360 degrees\n * @returns {number} angle in radians\n */\nexport function degreesToRadians(degrees: number): number {\n  // % 360 degrees in case someone passes value > 360\n  const normalisedDegrees = degrees % 360;\n  return (normalisedDegrees * Math.PI) / 180;\n}\n\n/**\n * Converts a length from one unit to another.\n *\n * @function\n * @param {number} length Length to be converted\n * @param {Units} [originalUnit=\"kilometers\"] Input length unit\n * @param {Units} [finalUnit=\"kilometers\"] Returned length unit\n * @returns {number} The converted length\n */\nexport function convertLength(\n  length: number,\n  originalUnit: Units = \"kilometers\",\n  finalUnit: Units = \"kilometers\"\n): number {\n  if (!(length >= 0)) {\n    throw new Error(\"length must be a positive number\");\n  }\n  return radiansToLength(lengthToRadians(length, originalUnit), finalUnit);\n}\n\n/**\n * Converts an area from one unit to another.\n *\n * @function\n * @param {number} area Area to be converted\n * @param {AreaUnits} [originalUnit=\"meters\"] Input area unit\n * @param {AreaUnits} [finalUnit=\"kilometers\"] Returned area unit\n * @returns {number} The converted length\n */\nexport function convertArea(\n  area: number,\n  originalUnit: AreaUnits = \"meters\",\n  finalUnit: AreaUnits = \"kilometers\"\n): number {\n  if (!(area >= 0)) {\n    throw new Error(\"area must be a positive number\");\n  }\n\n  const startFactor = areaFactors[originalUnit];\n  if (!startFactor) {\n    throw new Error(\"invalid original units\");\n  }\n\n  const finalFactor = areaFactors[finalUnit];\n  if (!finalFactor) {\n    throw new Error(\"invalid final units\");\n  }\n\n  return (area / startFactor) * finalFactor;\n}\n\n/**\n * isNumber\n *\n * @function\n * @param {any} num Number to validate\n * @returns {boolean} true/false\n * @example\n * turf.isNumber(123)\n * //=true\n * turf.isNumber('foo')\n * //=false\n */\nexport function isNumber(num: any): boolean {\n  return !isNaN(num) && num !== null && !Array.isArray(num);\n}\n\n/**\n * isObject\n *\n * @function\n * @param {any} input variable to validate\n * @returns {boolean} true/false, including false for Arrays and Functions\n * @example\n * turf.isObject({elevation: 10})\n * //=true\n * turf.isObject('foo')\n * //=false\n */\nexport function isObject(input: any): boolean {\n  return input !== null && typeof input === \"object\" && !Array.isArray(input);\n}\n\n/**\n * Validate BBox\n *\n * @private\n * @param {any} bbox BBox to validate\n * @returns {void}\n * @throws {Error} if BBox is not valid\n * @example\n * validateBBox([-180, -40, 110, 50])\n * //=OK\n * validateBBox([-180, -40])\n * //=Error\n * validateBBox('Foo')\n * //=Error\n * validateBBox(5)\n * //=Error\n * validateBBox(null)\n * //=Error\n * validateBBox(undefined)\n * //=Error\n */\nexport function validateBBox(bbox: any): void {\n  if (!bbox) {\n    throw new Error(\"bbox is required\");\n  }\n  if (!Array.isArray(bbox)) {\n    throw new Error(\"bbox must be an Array\");\n  }\n  if (bbox.length !== 4 && bbox.length !== 6) {\n    throw new Error(\"bbox must be an Array of 4 or 6 numbers\");\n  }\n  bbox.forEach((num) => {\n    if (!isNumber(num)) {\n      throw new Error(\"bbox must only contain numbers\");\n    }\n  });\n}\n\n/**\n * Validate Id\n *\n * @private\n * @param {any} id Id to validate\n * @returns {void}\n * @throws {Error} if Id is not valid\n * @example\n * validateId([-180, -40, 110, 50])\n * //=Error\n * validateId([-180, -40])\n * //=Error\n * validateId('Foo')\n * //=OK\n * validateId(5)\n * //=OK\n * validateId(null)\n * //=Error\n * validateId(undefined)\n * //=Error\n */\nexport function validateId(id: any): void {\n  if (!id) {\n    throw new Error(\"id is required\");\n  }\n  if ([\"string\", \"number\"].indexOf(typeof id) === -1) {\n    throw new Error(\"id must be a number or a string\");\n  }\n}\n","import {\n  Feature,\n  FeatureCollection,\n  Geometry,\n  LineString,\n  MultiPoint,\n  MultiLineString,\n  MultiPolygon,\n  Point,\n  Polygon,\n} from \"geojson\";\nimport { isNumber } from \"@turf/helpers\";\n\n/**\n * Unwrap a coordinate from a Point Feature, Geometry or a single coordinate.\n *\n * @function\n * @param {Array<number>|Geometry<Point>|Feature<Point>} coord GeoJSON Point or an Array of numbers\n * @returns {Array<number>} coordinates\n * @example\n * var pt = turf.point([10, 10]);\n *\n * var coord = turf.getCoord(pt);\n * //= [10, 10]\n */\nfunction getCoord(coord: Feature<Point> | Point | number[]): number[] {\n  if (!coord) {\n    throw new Error(\"coord is required\");\n  }\n\n  if (!Array.isArray(coord)) {\n    if (\n      coord.type === \"Feature\" &&\n      coord.geometry !== null &&\n      coord.geometry.type === \"Point\"\n    ) {\n      return [...coord.geometry.coordinates];\n    }\n    if (coord.type === \"Point\") {\n      return [...coord.coordinates];\n    }\n  }\n  if (\n    Array.isArray(coord) &&\n    coord.length >= 2 &&\n    !Array.isArray(coord[0]) &&\n    !Array.isArray(coord[1])\n  ) {\n    return [...coord];\n  }\n\n  throw new Error(\"coord must be GeoJSON Point or an Array of numbers\");\n}\n\n/**\n * Unwrap coordinates from a Feature, Geometry Object or an Array\n *\n * @function\n * @param {Array<any>|Geometry|Feature} coords Feature, Geometry Object or an Array\n * @returns {Array<any>} coordinates\n * @example\n * var poly = turf.polygon([[[119.32, -8.7], [119.55, -8.69], [119.51, -8.54], [119.32, -8.7]]]);\n *\n * var coords = turf.getCoords(poly);\n * //= [[[119.32, -8.7], [119.55, -8.69], [119.51, -8.54], [119.32, -8.7]]]\n */\nfunction getCoords<\n  G extends\n    | Point\n    | LineString\n    | Polygon\n    | MultiPoint\n    | MultiLineString\n    | MultiPolygon,\n>(coords: any[] | Feature<G> | G): any[] {\n  if (Array.isArray(coords)) {\n    return coords;\n  }\n\n  // Feature\n  if (coords.type === \"Feature\") {\n    if (coords.geometry !== null) {\n      return coords.geometry.coordinates;\n    }\n  } else {\n    // Geometry\n    if (coords.coordinates) {\n      return coords.coordinates;\n    }\n  }\n\n  throw new Error(\n    \"coords must be GeoJSON Feature, Geometry Object or an Array\"\n  );\n}\n\n/**\n * Checks if coordinates contains a number\n *\n * @function\n * @param {Array<any>} coordinates GeoJSON Coordinates\n * @returns {boolean} true if Array contains a number\n */\nfunction containsNumber(coordinates: any[]): boolean {\n  if (\n    coordinates.length > 1 &&\n    isNumber(coordinates[0]) &&\n    isNumber(coordinates[1])\n  ) {\n    return true;\n  }\n\n  if (Array.isArray(coordinates[0]) && coordinates[0].length) {\n    return containsNumber(coordinates[0]);\n  }\n  throw new Error(\"coordinates must only contain numbers\");\n}\n\n/**\n * Enforce expectations about types of GeoJSON objects for Turf.\n *\n * @function\n * @param {GeoJSON} value any GeoJSON object\n * @param {string} type expected GeoJSON type\n * @param {string} name name of calling function\n * @throws {Error} if value is not the expected type.\n */\nfunction geojsonType(value: any, type: string, name: string): void {\n  if (!type || !name) {\n    throw new Error(\"type and name required\");\n  }\n\n  if (!value || value.type !== type) {\n    throw new Error(\n      \"Invalid input to \" +\n        name +\n        \": must be a \" +\n        type +\n        \", given \" +\n        value.type\n    );\n  }\n}\n\n/**\n * Enforce expectations about types of {@link Feature} inputs for Turf.\n * Internally this uses {@link geojsonType} to judge geometry types.\n *\n * @function\n * @param {Feature} feature a feature with an expected geometry type\n * @param {string} type expected GeoJSON type\n * @param {string} name name of calling function\n * @throws {Error} error if value is not the expected type.\n */\nfunction featureOf(feature: Feature<any>, type: string, name: string): void {\n  if (!feature) {\n    throw new Error(\"No feature passed\");\n  }\n  if (!name) {\n    throw new Error(\".featureOf() requires a name\");\n  }\n  if (!feature || feature.type !== \"Feature\" || !feature.geometry) {\n    throw new Error(\n      \"Invalid input to \" + name + \", Feature with geometry required\"\n    );\n  }\n  if (!feature.geometry || feature.geometry.type !== type) {\n    throw new Error(\n      \"Invalid input to \" +\n        name +\n        \": must be a \" +\n        type +\n        \", given \" +\n        feature.geometry.type\n    );\n  }\n}\n\n/**\n * Enforce expectations about types of {@link FeatureCollection} inputs for Turf.\n * Internally this uses {@link geojsonType} to judge geometry types.\n *\n * @function\n * @param {FeatureCollection} featureCollection a FeatureCollection for which features will be judged\n * @param {string} type expected GeoJSON type\n * @param {string} name name of calling function\n * @throws {Error} if value is not the expected type.\n */\nfunction collectionOf(\n  featureCollection: FeatureCollection<any>,\n  type: string,\n  name: string\n) {\n  if (!featureCollection) {\n    throw new Error(\"No featureCollection passed\");\n  }\n  if (!name) {\n    throw new Error(\".collectionOf() requires a name\");\n  }\n  if (!featureCollection || featureCollection.type !== \"FeatureCollection\") {\n    throw new Error(\n      \"Invalid input to \" + name + \", FeatureCollection required\"\n    );\n  }\n  for (const feature of featureCollection.features) {\n    if (!feature || feature.type !== \"Feature\" || !feature.geometry) {\n      throw new Error(\n        \"Invalid input to \" + name + \", Feature with geometry required\"\n      );\n    }\n    if (!feature.geometry || feature.geometry.type !== type) {\n      throw new Error(\n        \"Invalid input to \" +\n          name +\n          \": must be a \" +\n          type +\n          \", given \" +\n          feature.geometry.type\n      );\n    }\n  }\n}\n\n/**\n * Get Geometry from Feature or Geometry Object\n *\n * @param {Feature|Geometry} geojson GeoJSON Feature or Geometry Object\n * @returns {Geometry|null} GeoJSON Geometry Object\n * @throws {Error} if geojson is not a Feature or Geometry Object\n * @example\n * var point = {\n *   \"type\": \"Feature\",\n *   \"properties\": {},\n *   \"geometry\": {\n *     \"type\": \"Point\",\n *     \"coordinates\": [110, 40]\n *   }\n * }\n * var geom = turf.getGeom(point)\n * //={\"type\": \"Point\", \"coordinates\": [110, 40]}\n */\nfunction getGeom<G extends Geometry>(geojson: Feature<G> | G): G {\n  if (geojson.type === \"Feature\") {\n    return geojson.geometry;\n  }\n  return geojson;\n}\n\n/**\n * Get GeoJSON object's type, Geometry type is prioritize.\n *\n * @param {GeoJSON} geojson GeoJSON object\n * @param {string} [name=\"geojson\"] name of the variable to display in error message (unused)\n * @returns {string} GeoJSON type\n * @example\n * var point = {\n *   \"type\": \"Feature\",\n *   \"properties\": {},\n *   \"geometry\": {\n *     \"type\": \"Point\",\n *     \"coordinates\": [110, 40]\n *   }\n * }\n * var geom = turf.getType(point)\n * //=\"Point\"\n */\nfunction getType(\n  geojson: Feature<any> | FeatureCollection<any> | Geometry,\n  _name?: string\n): string {\n  if (geojson.type === \"FeatureCollection\") {\n    return \"FeatureCollection\";\n  }\n  if (geojson.type === \"GeometryCollection\") {\n    return \"GeometryCollection\";\n  }\n  if (geojson.type === \"Feature\" && geojson.geometry !== null) {\n    return geojson.geometry.type;\n  }\n  return geojson.type;\n}\n\nexport {\n  getCoord,\n  getCoords,\n  containsNumber,\n  geojsonType,\n  featureOf,\n  collectionOf,\n  getGeom,\n  getType,\n};\n// No default export!\n","import { Position } from \"geojson\";\nimport { feature } from \"@turf/helpers\";\nimport { getCoords, getType } from \"@turf/invariant\";\n\n// To-Do => Improve Typescript GeoJSON handling\n\n/**\n * Removes redundant coordinates from any GeoJSON Geometry.\n *\n * @function\n * @param {Geometry|Feature} geojson Feature or Geometry\n * @param {Object} [options={}] Optional parameters\n * @param {boolean} [options.mutate=false] allows GeoJSON input to be mutated\n * @returns {Geometry|Feature} the cleaned input Feature/Geometry\n * @example\n * var line = turf.lineString([[0, 0], [0, 2], [0, 5], [0, 8], [0, 8], [0, 10]]);\n * var multiPoint = turf.multiPoint([[0, 0], [0, 0], [2, 2]]);\n *\n * turf.cleanCoords(line).geometry.coordinates;\n * //= [[0, 0], [0, 10]]\n *\n * turf.cleanCoords(multiPoint).geometry.coordinates;\n * //= [[0, 0], [2, 2]]\n */\nfunction cleanCoords(\n  geojson: any,\n  options: {\n    mutate?: boolean;\n  } = {}\n) {\n  // Backwards compatible with v4.0\n  var mutate = typeof options === \"object\" ? options.mutate : options;\n  if (!geojson) throw new Error(\"geojson is required\");\n  var type = getType(geojson);\n\n  // Store new \"clean\" points in this Array\n  var newCoords = [];\n\n  switch (type) {\n    case \"LineString\":\n      newCoords = cleanLine(geojson, type);\n      break;\n    case \"MultiLineString\":\n    case \"Polygon\":\n      getCoords(geojson).forEach(function (line) {\n        newCoords.push(cleanLine(line, type));\n      });\n      break;\n    case \"MultiPolygon\":\n      getCoords(geojson).forEach(function (polygons: any) {\n        var polyPoints: Position[] = [];\n        polygons.forEach(function (ring: Position[]) {\n          polyPoints.push(cleanLine(ring, type));\n        });\n        newCoords.push(polyPoints);\n      });\n      break;\n    case \"Point\":\n      return geojson;\n    case \"MultiPoint\":\n      var existing: Record<string, true> = {};\n      getCoords(geojson).forEach(function (coord: any) {\n        var key = coord.join(\"-\");\n        if (!Object.prototype.hasOwnProperty.call(existing, key)) {\n          newCoords.push(coord);\n          existing[key] = true;\n        }\n      });\n      break;\n    default:\n      throw new Error(type + \" geometry not supported\");\n  }\n\n  // Support input mutation\n  if (geojson.coordinates) {\n    if (mutate === true) {\n      geojson.coordinates = newCoords;\n      return geojson;\n    }\n    return { type: type, coordinates: newCoords };\n  } else {\n    if (mutate === true) {\n      geojson.geometry.coordinates = newCoords;\n      return geojson;\n    }\n    return feature({ type: type, coordinates: newCoords }, geojson.properties, {\n      bbox: geojson.bbox,\n      id: geojson.id,\n    });\n  }\n}\n\n/**\n * Clean Coords\n *\n * @private\n * @param {Array<number>|LineString} line Line\n * @param {string} type Type of geometry\n * @returns {Array<number>} Cleaned coordinates\n */\nfunction cleanLine(line: Position[], type: string) {\n  var points = getCoords(line);\n  // handle \"clean\" segment\n  if (points.length === 2 && !equals(points[0], points[1])) return points;\n\n  var newPoints = [];\n  var secondToLast = points.length - 1;\n  var newPointsLength = newPoints.length;\n\n  newPoints.push(points[0]);\n  for (var i = 1; i < secondToLast; i++) {\n    var prevAddedPoint = newPoints[newPoints.length - 1];\n    if (\n      points[i][0] === prevAddedPoint[0] &&\n      points[i][1] === prevAddedPoint[1]\n    )\n      continue;\n    else {\n      newPoints.push(points[i]);\n      newPointsLength = newPoints.length;\n      if (newPointsLength > 2) {\n        if (\n          isPointOnLineSegment(\n            newPoints[newPointsLength - 3],\n            newPoints[newPointsLength - 1],\n            newPoints[newPointsLength - 2]\n          )\n        )\n          newPoints.splice(newPoints.length - 2, 1);\n      }\n    }\n  }\n  newPoints.push(points[points.length - 1]);\n  newPointsLength = newPoints.length;\n\n  // (Multi)Polygons must have at least 4 points, but a closed LineString with only 3 points is acceptable\n  if (\n    (type === \"Polygon\" || type === \"MultiPolygon\") &&\n    equals(points[0], points[points.length - 1]) &&\n    newPointsLength < 4\n  ) {\n    throw new Error(\"invalid polygon\");\n  }\n\n  if (type === \"LineString\" && newPointsLength < 3) {\n    return newPoints;\n  }\n\n  if (\n    isPointOnLineSegment(\n      newPoints[newPointsLength - 3],\n      newPoints[newPointsLength - 1],\n      newPoints[newPointsLength - 2]\n    )\n  )\n    newPoints.splice(newPoints.length - 2, 1);\n\n  return newPoints;\n}\n\n/**\n * Compares two points and returns if they are equals\n *\n * @private\n * @param {Position} pt1 point\n * @param {Position} pt2 point\n * @returns {boolean} true if they are equals\n */\nfunction equals(pt1: Position, pt2: Position) {\n  return pt1[0] === pt2[0] && pt1[1] === pt2[1];\n}\n\n/**\n * Returns if `point` is on the segment between `start` and `end`.\n * Borrowed from `@turf/boolean-point-on-line` to speed up the evaluation (instead of using the module as dependency)\n *\n * @private\n * @param {Position} start coord pair of start of line\n * @param {Position} end coord pair of end of line\n * @param {Position} point coord pair of point to check\n * @returns {boolean} true/false\n */\nfunction isPointOnLineSegment(start: Position, end: Position, point: Position) {\n  var x = point[0],\n    y = point[1];\n  var startX = start[0],\n    startY = start[1];\n  var endX = end[0],\n    endY = end[1];\n\n  var dxc = x - startX;\n  var dyc = y - startY;\n  var dxl = endX - startX;\n  var dyl = endY - startY;\n  var cross = dxc * dyl - dyc * dxl;\n\n  if (cross !== 0) return false;\n  else if (Math.abs(dxl) >= Math.abs(dyl))\n    return dxl > 0 ? startX <= x && x <= endX : endX <= x && x <= startX;\n  else return dyl > 0 ? startY <= y && y <= endY : endY <= y && y <= startY;\n}\n\nexport { cleanCoords };\nexport default cleanCoords;\n","import { Feature, Geometry } from \"geojson\";\nimport { geojsonEquality } from \"geojson-equality-ts\";\nimport { cleanCoords } from \"@turf/clean-coords\";\nimport { getGeom } from \"@turf/invariant\";\n\n/**\n * Determine whether two geometries of the same type have identical X,Y coordinate values.\n * See http://edndoc.esri.com/arcsde/9.0/general_topics/understand_spatial_relations.htm\n *\n * @function\n * @param {Geometry|Feature} feature1 GeoJSON input\n * @param {Geometry|Feature} feature2 GeoJSON input\n * @param {Object} [options={}] Optional parameters\n * @param {number} [options.precision=6] decimal precision to use when comparing coordinates\n * @returns {boolean} true if the objects are equal, false otherwise\n * @example\n * var pt1 = turf.point([0, 0]);\n * var pt2 = turf.point([0, 0]);\n * var pt3 = turf.point([1, 1]);\n *\n * turf.booleanEqual(pt1, pt2);\n * //= true\n * turf.booleanEqual(pt2, pt3);\n * //= false\n */\nfunction booleanEqual(\n  feature1: Feature<any> | Geometry,\n  feature2: Feature<any> | Geometry,\n  options: {\n    precision?: number;\n  } = {}\n): boolean {\n  let precision = options.precision;\n\n  precision =\n    precision === undefined || precision === null || isNaN(precision)\n      ? 6\n      : precision;\n\n  if (typeof precision !== \"number\" || !(precision >= 0)) {\n    throw new Error(\"precision must be a positive number\");\n  }\n\n  const type1 = getGeom(feature1).type;\n  const type2 = getGeom(feature2).type;\n  if (type1 !== type2) return false;\n\n  return geojsonEquality(cleanCoords(feature1), cleanCoords(feature2), {\n    precision,\n  });\n}\n\nexport { booleanEqual };\nexport default booleanEqual;\n","export const GRAMMAR = String.raw`\nWAEL {\n\n/***************\n * WAEL syntax *\n ***************/\n\n// Top-level expressions\nTopLevel = ScopedExpressions TopLevelEnd\nTopLevelEnd = ExpressionDelimiter | end \n\n// Comments\ncomment = \"#\" commentSpace* commentText* commentSpace* commentEnd\ncommentText = ~commentEnd any\ncommentEnd = \"\\n\" | end\ncommentSpace = \" \"\n\n// Expression structure\nScopedExpressions = ListOf<GeneralExpression, ExpressionDelimiter> --list\n    | GeneralExpression\nGeneralExpression =  GeneralExpression comment --rightComment\n    | comment GeneralExpression --leftComment\n    | AssignmentExp\n    | AssignableExpression \n    | comment    \nExpressionDelimiter = expressionDelimiter\nexpressionDelimiter = \";\"\n\n// Imports\nImportExpression = AccessibleExp<ImportExpressionType>\nImportExpressionType = ImportUsingExpression | ImportAllExpression\nImportUsingExpression = ImportEitherExpression usingKeyword ImportUsingParameters\nImportUsingParameters = FunctionParameters | ImportUsingAllParams\nImportUsingAllParams = Paren<\"*\">\nImportAllExpression = ImportEitherExpression\nImportEitherExpression = ImportExternalExp | ImportFunctionExp\nImportExternalExp = importKeyword Paren<ImportExternalParamExp>\nImportExternalParamExp = stringLiteralExp | Identifier\nImportFunctionExp = importKeyword Paren<FunctionCallExp>\nimportKeyword = caseInsensitive<\"import\">\nusingKeyword = caseInsensitive<\"using\">\n\n// Exports\nexportKeyword = caseInsensitive<\"export\">\n\n// Variables\nletKeyword = caseInsensitive<\"let\">\nAssignmentExp = exportKeyword? letKeyword? Identifier assignmentOperator AssignableExpression \nAssignableExpression = \n    | ImportExpression\n    | NonArithmeticAssignableExpression\n    | ArithmeticAssignableExpression\nNonArithmeticAssignableExpression = \n    | OperationExp\n    | stringLiteralExp\nArithmeticAssignableExpression = Arithmetic<AssignableExpressionForArithmetic>\nAssignableExpressionForArithmetic = \n    | BooleanResultExp\n    | IfThenElseExp\n    | ComputedExp\n    | FunctionTextExp\n    | NumberExp\n    | AccessibleExp<GeometryExp>\n    | BooleanValue\n    | Paren<OperationExp> \nassignmentOperator = \"=\"\nComputedValue<Type> = Type | ComputedExp\nComputedExp = AccessibleExp<ComputedPrimitive>\nComputedPrimitive = FunctionCallExp | Identifier\n\nAccessibleExp<Type> = \n    | Type accessorOperator Identifier Invocation? --method\n    | Type\n\n// Additional operation expressions\nOperationExp =  PipeExp | GenerateExp | ConcatExp\nPipeExp = MappableValue anyPipeOperator Pipeable //Callable\nPipeable = FunctionCallExp | Callable\nGenerateExp = generateKeyword GenerateCountExpr ComputedValue<GenerateValue> \nGenerateCountExpr = ComputedValue<NumberExp> | FunctionTextExp\nConcatExp = MappableValue concatOperator MappableValue\nGenerateValue = GeometryExp | FunctionTextExp\ngenerateKeyword = caseInsensitive<\"Generate\">\nMappableValue = AssignableExpression \n\n// Helpers\nParen<type> = LeftParen type RightParen\nOptionallyParen<type> = LeftParen type RightParen --paren\n    | type --noParen\nOptionallyBraced<type> = LeftBrace type RightBrace --brace\n    | type\n    \n// Arithmetic expressions\nArithmetic<Type> = ArithmeticAdd<Type>\nArithmeticAdd<Type> = \n        | ArithmeticAdd<Type> plusOperator ArithmeticMul<Type>  -- plus\n        | ArithmeticAdd<Type> minusOperator ArithmeticMul<Type>  -- minus\n        | ArithmeticMul<Type>\nArithmeticMul<Type> = \n        | ArithmeticMul<Type> timesOperator ArithmeticExp<Type>  -- times\n        | ArithmeticMul<Type> divideOperator ArithmeticExp<Type>  -- divide\n        | ArithmeticMul<Type> modOperator ArithmeticExp<Type>  -- mod\n        | ArithmeticExp<Type>\nArithmeticExp<Type> = \n        | ArithmeticPri<Type> powerOperator ArithmeticExp<Type>  -- power\n        | ArithmeticPri<Type>\nArithmeticPri<Type> = \n        | Type\n        | leftParen Arithmetic<Type> rightParen  -- paren\n        \n// Operators\noperator = \n    | expressionDelimiter\n    | anyPipeOperator\n    | plusOperator\n    | minusOperator\n    | timesOperator\n    | divideOperator\n    | powerOperator\n    | modOperator\n    | accessorOperator\n    | conditionalOperator\n    | assignmentOperator\n    | notOperator\n\nanyPipeOperator = doublePipeOperator | coordinatesPipeOperator | filterOperator | reduceOperator | pipeOperator\n\npipeOperator = \"|\"\ncoordinatesPipeOperator = \"|*\"\ndoublePipeOperator = \"||\"\nfilterOperator = \"|~\"\nreduceOperator = \"|>\"\nconcatOperator = \"++\"\nplusOperator = \"+\"\nminusOperator = \"-\"\ntimesOperator = \"*\"\ndivideOperator = \"/\"\npowerOperator = \"^\"\nmodOperator = \"%\"\naccessorOperator = \":\"\n    \n// Function expressions\nFunctionTextExp = functionKeyword LeftParen FunctionExp RightParen --keyword\n\t| OptionallyParen<FunctionExp>\nFunctionExp = FunctionParameters \"=>\" OptionallyParen<FunctionBody>\nFunctionParameters = LeftParen ListOf<Identifier, Comma> RightParen --multipleParams\n    | Identifier --single\nFunctionBody =  OptionallyParen<ScopedExpressions> | AssignableExpression\nFunctionCallExp = FunctionCallExp Invocation | Callable Invocation\nInvocation = LeftParen ListOf<GeneralExpression, Comma> RightParen\nfunctionKeyword = caseInsensitive<\"Function\">\nCallable = \n    | FunctionTextExp\n    | FunctionCallExp\n    | AccessibleExp<Callable>\n    | Identifier\n\n// If-Then-Else expressions\nIfThenElseExp = ifKeyword Paren<BooleanResultExp> thenKeyword\n    Paren<ScopedExpressions> elseKeyword \n    Paren<ScopedExpressions>\nifKeyword = caseInsensitive<\"if\">\nthenKeyword = caseInsensitive<\"then\">\nelseKeyword = caseInsensitive<\"else\">\n\n// Conditional expressions\nBooleanResultExp = EqualityExp | CompareExp | NotExp | booleanValue\nEqualityExp = ComparePrimitive equalityOperatorPrimitive ComparePrimitive\nNotExp = notOperator ComparePrimitive\nConditionalValue = CompareExp | EqualityExp | BooleanValue | NumberExp\nCompareExp = ComparePrimitive compareOperatorPrimitive ComparePrimitive\nComparePrimitive = BooleanResultExp | ComputedValue<NumberExp> | AccessibleExp<GeometryExp> | geometryKeyword\nconditionalOperator = compareOperatorPrimitive | equalityOperatorPrimitive\ncompareOperatorPrimitive = \"<=\" | \">=\" | \"<\" | \">\"\nequalityOperatorPrimitive = \"==\" | \"!=\" | logicalOperator\nlogicalOperator = caseInsensitive<\"And\"> | caseInsensitive<\"Or\">\nnotOperator = \"!\"\n\n// Identifiers\nIdentifier =  basicIdentifier\nbasicIdentifier =  ~nonAllowedIdentifiers id\nid = firstIdCharacter idCharacter*\nfirstIdCharacter = simpleLatinLetter | \"$\" | \"_\"\nidCharacter = simpleLatinLetter | digit | \"_\" | \"?\" | \"'\"\nnonAllowedIdentifiers = keyword identifierEnd\nidentifierEnd = end | comma | leftParen | rightParen | operator | wktSpace\n\n/*************************************\n * OGC Well-Known Text (WKT) Grammar *\n *************************************/\n\n// Based on WKT Syntax: https://www.ogc.org/standard/sfa/\n\nGeometrySyntaxExp<GeometryTypeExp, geometryKeyword> = Arithmetic<GeometryArithmetic<GeometryTypeExp, geometryKeyword>>\nGeometryArithmetic<GeometryTypeExp, geometryKeyword> = GeometryPrimitive<GeometryTypeExp, geometryKeyword>\nGeometryPrimitive<GeometryTypeExp, geometryKeyword> = GeometryTaggedText<GeometryTypeExp, geometryKeyword>\nGeometryTaggedText<GeometryTypeExp, geometryKeyword> = geometryKeyword GeometryTypeExp\n\nGeometryCollectionExp = GeometrySyntaxExp<GeometryCollectionText, geometryCollectionKeyword>\nGeometryCollectionText = emptySet --empty\n    | LeftParen ListOf<GeometryExp, Comma> RightParen --present\ngeometryCollectionKeyword = caseInsensitive<\"GEOMETRYCOLLECTION\">\n\nGeometryExp =  \n    | PointExp\n    | MultiPointExp\n    | LineStringExp\n    | MultiLineStringExp\n    | PolygonExp\n    | MultiPolygonExp\n    | GeometryCollectionExp \n\n// TODO -- support POLYHEDRALSURFACE geometry\n//PolyhedralSurfaceExp = GeometrySyntaxExp<PolyhedralSurfaceText, polyhedralSurfaceKeyword>\n//PolyhedralSurfaceText = emptySet --empty\n//    | LeftParen NonemptyListOf<PolygonText, Comma> RightParen --present\n//polyhedralSurfaceKeyword = caseInsensitive<\"PolyhedralSurface\">\n\nMultiPolygonExp = GeometrySyntaxExp<MultiPolygonText, multiPolygonKeyword>\nMultiPolygonText = emptySet --empty\n    | LeftParen NonemptyListOf<PolygonText, Comma> RightParen --present\nmultiPolygonKeyword = caseInsensitive<\"MULTIPOLYGON\">\n\nPolygonExp = GeometrySyntaxExp<PolygonText, polygonKeyword>\nPolygonText = emptySet --empty\n    | LeftParen NonemptyListOf<LineStringText, Comma> RightParen --present\npolygonKeyword = caseInsensitive<\"POLYGON\">\n\nMultiLineStringExp = GeometrySyntaxExp<MultiLineStringText, multiLineStringKeyword>\nMultiLineStringText = emptySet --empty\n    | LeftParen NonemptyListOf<LineStringText, Comma> RightParen --present\nmultiLineStringKeyword = caseInsensitive<\"MULTILINESTRING\">\n\nLineStringExp = GeometrySyntaxExp<LineStringText, lineStringKeyword>\nLineStringText = emptySet --empty\n    | LeftParen PointList RightParen --present\nlineStringKeyword = caseInsensitive<\"LINESTRING\">\n\nMultiPointExp = GeometrySyntaxExp<MultiPointText, multiPointKeyword>\nMultiPointText = emptySet --empty\n    | LeftParen PointList RightParen --present\nmultiPointKeyword = caseInsensitive<\"MULTIPOINT\">\n\n// Base point type helpers\nPointList = NonemptyListOf<PointListArgument, Comma>\nPointListArgument = Point | ComputedValue<PointExp>\nPointExp = Arithmetic<PointArithmetic>\nPointArithmetic = PointPrimitive | ComputedExp\nPointPrimitive = PointTaggedText | PointText | Point\nPointTaggedText = pointKeyword PointText\nPointText = emptySet --empty\n    | LeftParen Point RightParen --present\nPoint = X Y\npointKeyword = caseInsensitive<\"POINT\">\n\n// Keywords\nkeyword = geometryKeyword\n    | functionKeyword\n    | generateKeyword\n    | booleanValue\n    | ifKeyword\n    | thenKeyword\n    | elseKeyword\n    | importKeyword\n    | exportKeyword\n    | letKeyword\ngeometryKeyword = pointKeyword\n    | multiPointKeyword\n    | lineStringKeyword\n    | multiLineStringKeyword\n    | polygonKeyword\n    | multiPolygonKeyword\n    | geometryCollectionKeyword\n\n// Coordinate values\nX = PointNumberValue \nY = PointNumberValue \nZ = PointNumberValue\nM = PointNumberValue\n\n// Numeric value\nPointNumberValue = signedNumericLiteral\n    | OptionallyParen<ComputedValue<NumberExp>> \n    | ComputedPrimitive\nNumberExp = Arithmetic<ComputedValue<signedNumericLiteral>>\n\n// Boolean value\nBooleanValue = ComputedValue<booleanValue>\nbooleanValue = caseInsensitive<\"true\"> | caseInsensitive<\"false\">\n\n// String literals\nstringLiteralExp =  stringLiteral<\"'\"> | stringLiteral<\"\\\"\"> \nstringLiteral<quoteChar> = quoteChar stringLiteralValue<quoteChar>* quoteChar\nstringLiteralValue<quoteChar> = ~quoteChar any    \n\n// OGC specification primitives\nquotedName = doubleQuote name doubleQuote\nname = letters\nletters = wktLetter+\nwktLetter = simpleLatinLetter | digit | special\nsimpleLatinLetter = simpleLatinUpperCaseLetter\n    | simpleLatinLowerCaseLetter\nsignedNumericLiteral = sign unsignedNumericLiteral --signPresent\n    | unsignedNumericLiteral --signMissing\nunsignedNumericLiteral = exactNumericLiteral | approximateNumericLiteral\napproximateNumericLiteral = mantissa \"E\" exponent   // TODO -- handle this notation at higher level expressions\nmantissa = exactNumericLiteral\nexponent = signedInteger\nexactNumericLiteral = unsignedInteger decimalPoint unsignedInteger --decimalWithWholeNumber\n    | decimalPoint unsignedInteger --decimalWithoutWholeNumber \n    | unsignedInteger --wholeNumber\nsignedInteger = sign unsignedInteger --signedInteger\n    | unsignedInteger --unsignedInteger\nunsignedInteger = digit+\nleftDelimiter = leftParen | leftBracket\nrightDelimiter = rightParen | rightBracket\nspecial = rightParen | leftParen | minusSign | underscore | period | quote | wktSpace\nsign = plusSign | minusSign\ndecimalPoint = period // comma // TODO -- comma causes parsing issues\nemptySet = \"EMPTY\"\nminusSign = \"-\"\nLeftParen = leftParen\nleftParen = \"(\"\nRightParen = rightParen\nrightParen = \")\"\nleftBracket = \"[\"\nrightBracket = \"]\"\nLeftBrace = leftBrace\nleftBrace = \"{\"\nRightBrace = rightBrace\nrightBrace = \"}\"\nperiod = \".\"\nplusSign = \"+\"\ndoubleQuote = \"\\\"\"\nquote = \"'\"\nComma = comma\ncomma = \",\"\nunderscore = \"_\" \n// digit = 0|1|2|3|4|5|6|7|8|9 // provided by default\nsimpleLatinLowerCaseLetter = lower // a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z\nsimpleLatinUpperCaseLetter = upper // A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z\nwktSpace = \" \" // unicode \"U+0020\" (space) // provided by default\n\n}\n`","export const STD_LIB =  String.raw`\n() => (\n    export Rotate = ((deg, origin) => (val => _Rotate(deg, origin, val)));\n    export Round = ((precision) => (val => _Round(precision, val)));\n    true\n)\n`"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,iBAAAA,UAAAC,SAAA;AAAA,IAAAA,QAAA;AAAA,MACE,MAAQ;AAAA,MACR,SAAW;AAAA,MACX,aAAe;AAAA,MACf,YAAc;AAAA,QACZ,MAAQ;AAAA,QACR,KAAO;AAAA,MACT;AAAA,MACA,OAAS;AAAA,QACP;AAAA,QACA;AAAA,MACF;AAAA,MACA,SAAW;AAAA,QACT,IAAM;AAAA,QACN,MAAQ;AAAA,QACR,IAAM;AAAA,MACR;AAAA,MACA,MAAQ;AAAA,MACR,MAAQ;AAAA,MACR,QAAU;AAAA,MACV,OAAS;AAAA,MACT,SAAW;AAAA,QACT,kBAAkB;AAAA,QAClB,KAAK;AAAA,UACH,QAAU;AAAA,YACR,OAAS;AAAA,YACT,SAAW;AAAA,UACb;AAAA,UACA,SAAW;AAAA,YACT,OAAS;AAAA,YACT,SAAW;AAAA,UACb;AAAA,QACF;AAAA,MACF;AAAA,MACA,SAAW;AAAA,QACT,OAAS;AAAA,QACT,aAAa;AAAA,QACb,gBAAgB;AAAA,QAChB,0BAA0B;AAAA,QAC1B,MAAQ;AAAA,QACR,eAAe;AAAA,MACjB;AAAA,MAC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AAO;AACH,sBAAgB,GAAG,KAAK,KAAK,CAAC;AAAA;AAC9B,YAAM,gBAAgB,aAAa,QAAQ,SAAS;AACpD,UAAI,iBAAiB,GAAG;AACpB,YAAI;AACA,cAAIA,UAAS,KAAK,SAAS,aAAa,UAAU,GAAG,aAAa,GAAG,OAAO;AAC5E,sBAAYA,OAAM;AAAA,QACtB,SAAS,KAAK;AACV,kBAAQ,MAAM,UAAU,GAAG,CAAC;AAAA,QAChC;AACA,eAAO;AACP,uBAAe;AAAA,MACnB;AAAA,IACJ;AAAA,EACJ,CAAC;AAED,KAAG,KAAK,SAAS,MAAM;AAAA,EAEtB,CAAC;AACN,OAAO;AACH,MAAI,cAAc;AACd,QAAI,OAAO,WAAW,aAAa;AAC/B,UAAI,OAAO,WAAW,UAAU;AAC5B,iBAAS,SAAS,MAAM;AAAA,MAC5B;AACA,cAAQ,IAAI,MAAM;AAAA,IACtB;AAAA,EACJ,OAAO;AACH,iBAAAF,QAAM,SAAS;AAAA,EACnB;AACJ;","names":["exports","module","turf","turf","GeometryType","_a","isType","isType","point","feature","geometry","_a","turf","_a","__name","options","options","point","feature2","options","BuiltInFunctions","point","Interpreter","grammar","syncFetch","e","result","_a","point","a","b","OutputFormat","_a","options","result","outputFormat","yargs","chalk","result"]}