@mappedin/mappedin-js 6.0.0-alpha.9 → 6.0.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +104 -0
- package/README.md +137 -157
- package/THIRD_PARTY_LICENSES.txt +14468 -0
- package/lib/esm/GLTFExporter-OD4NIP5J.js +2 -0
- package/lib/esm/GLTFExporter-OD4NIP5J.js.map +7 -0
- package/lib/esm/GLTFLoader-2KHURE2O.js +2 -0
- package/lib/esm/GLTFLoader-2KHURE2O.js.map +7 -0
- package/lib/esm/browser-MJVP6R3A.js +2 -0
- package/lib/esm/browser-MJVP6R3A.js.map +7 -0
- package/lib/esm/chunk-2RJ5UTHX.js +3 -0
- package/lib/esm/chunk-2RJ5UTHX.js.map +7 -0
- package/lib/esm/chunk-J66EV4D7.js +2 -0
- package/lib/esm/chunk-J66EV4D7.js.map +7 -0
- package/lib/esm/chunk-LLHXGTB2.js +2 -0
- package/lib/esm/chunk-LLHXGTB2.js.map +7 -0
- package/lib/esm/chunk-R6ACEBVD.js +747 -0
- package/lib/esm/chunk-R6ACEBVD.js.map +7 -0
- package/lib/esm/chunk-ROCNZJLL.js +2 -0
- package/lib/esm/chunk-ROCNZJLL.js.map +7 -0
- package/lib/esm/chunk-SWYBY4H7.js +2269 -0
- package/lib/esm/chunk-SWYBY4H7.js.map +7 -0
- package/lib/esm/chunk-TJG5BXTK.js +3820 -0
- package/lib/esm/chunk-TJG5BXTK.js.map +7 -0
- package/lib/esm/fonts/roboto-regular.ttf +0 -0
- package/lib/esm/index.css +2 -0
- package/lib/esm/index.css.map +7 -0
- package/lib/esm/index.d.ts +38908 -0
- package/lib/esm/index.js +2 -0
- package/lib/esm/index.js.map +7 -0
- package/lib/esm/inspector-KMBZXTF5.js +483 -0
- package/lib/esm/inspector-KMBZXTF5.js.map +7 -0
- package/lib/esm/inspector-T3HA7VGW.css +2 -0
- package/lib/esm/inspector-T3HA7VGW.css.map +7 -0
- package/lib/esm/internal-LZTQU5W2.js +2 -0
- package/lib/esm/internal-LZTQU5W2.js.map +7 -0
- package/lib/esm/internal-VKD5KMH3.css +2 -0
- package/lib/esm/internal-VKD5KMH3.css.map +7 -0
- package/lib/esm/outdoor-context-v5-DPTEYL6O.js +2 -0
- package/lib/esm/outdoor-context-v5-DPTEYL6O.js.map +7 -0
- package/lib/esm/roboto-regular-R5KXKW73.js +2 -0
- package/lib/esm/roboto-regular-R5KXKW73.js.map +7 -0
- package/lib/esm/text3d-AEQ2USTW.js +253 -0
- package/lib/esm/text3d-AEQ2USTW.js.map +7 -0
- package/lib/esm/workers/collision-worker.csp.js +1 -0
- package/lib/esm/workers/maplibre-worker.csp.js +2 -0
- package/lib/index-rn.js +4288 -0
- package/lib/index.css +2 -0
- package/package.json +34 -64
- package/lib/esm/get-venue/index.d.ts +0 -2466
- package/lib/esm/get-venue/index.js +0 -1
- package/lib/esm/navigator/index.d.ts +0 -243
- package/lib/esm/navigator/index.js +0 -1
- package/lib/esm/renderer/Arrival-JVXBAUFE.js +0 -1
- package/lib/esm/renderer/Chalet-7VKCGC5R.js +0 -1
- package/lib/esm/renderer/HelveticaNeue-M6HRIIGZ.js +0 -1
- package/lib/esm/renderer/Helvetiker-K2MS62IA.js +0 -1
- package/lib/esm/renderer/Lato-PKBWMAQE.js +0 -1
- package/lib/esm/renderer/MyriadPro-MKDHQECZ.js +0 -1
- package/lib/esm/renderer/ProximaNova-U6AQPIB5.js +0 -1
- package/lib/esm/renderer/SimonCircular-LDXYDCAN.js +0 -1
- package/lib/esm/renderer/browser-BW4IT6LG.js +0 -1
- package/lib/esm/renderer/chunk-GPLIHQI3.js +0 -1
- package/lib/esm/renderer/chunk-MWXS32IR.js +0 -1
- package/lib/esm/renderer/index.css +0 -1
- package/lib/esm/renderer/index.d.ts +0 -5261
- package/lib/esm/renderer/index.js +0 -1
- package/lib/mappedin.css +0 -1
- package/lib/mappedin.js +0 -1
- package/lib/node/index.js +0 -1
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../packages/common/Mappedin.Logger.ts", "../../../packages/common/utils.ts", "../../../../node_modules/.pnpm/jwt-decode@4.0.0/node_modules/jwt-decode/build/esm/index.js", "../../../packages/common/constants.ts", "../../../packages/common/async.ts", "../../../../node_modules/.pnpm/zod@3.25.51/node_modules/zod/dist/esm/v3/external.js", "../../../../node_modules/.pnpm/zod@3.25.51/node_modules/zod/dist/esm/v3/errors.js", "../../../../node_modules/.pnpm/zod@3.25.51/node_modules/zod/dist/esm/v3/locales/en.js", "../../../../node_modules/.pnpm/zod@3.25.51/node_modules/zod/dist/esm/v3/ZodError.js", "../../../../node_modules/.pnpm/zod@3.25.51/node_modules/zod/dist/esm/v3/helpers/util.js", "../../../../node_modules/.pnpm/zod@3.25.51/node_modules/zod/dist/esm/v3/helpers/parseUtil.js", "../../../../node_modules/.pnpm/zod@3.25.51/node_modules/zod/dist/esm/v3/helpers/typeAliases.js", "../../../../node_modules/.pnpm/zod@3.25.51/node_modules/zod/dist/esm/v3/types.js", "../../../../node_modules/.pnpm/zod@3.25.51/node_modules/zod/dist/esm/v3/helpers/errorUtil.js", "../../../../node_modules/.pnpm/zod@3.25.51/node_modules/zod/dist/esm/v3/index.js", "../../../../node_modules/.pnpm/zod@3.25.51/node_modules/zod/dist/esm/index.js", "../../../packages/common/index.ts", "../../../packages/common/errors.ts", "../../../packages/common/assert.ts", "../../../packages/common/random-id.ts", "../../../packages/common/pubsub.ts", "../../../packages/common/storage.ts", "../../../packages/common/color.ts", "../../../packages/common/interpolate.ts", "../../../packages/common/type-utils.ts", "../../../geojson/src/utils/math.ts", "../../../geojson/src/utils/index.ts", "../../../geojson/src/entities/group-container.ts", "../../../geojson/src/entities/geometry-group.ts", "../../../geojson/src/components/mesh.ts", "../../../geojson/src/components/utils.ts", "../../../../node_modules/.pnpm/@turf+bbox@6.5.0/node_modules/@turf/bbox/dist/es/index.js", "../../../../node_modules/.pnpm/@turf+meta@6.5.0/node_modules/@turf/meta/dist/es/index.js", "../../../../node_modules/.pnpm/@turf+helpers@6.5.0/node_modules/@turf/helpers/dist/es/index.js", "../../../geojson/src/components/styles/style.ts", "../../../geojson/src/entities/geometry2d.ts", "../../../geojson/src/entities/geometry3d.ts", "../../../geojson/src/utils/constants.ts", "../../../geojson/src/utils/bounding-box.ts", "../../../geojson/src/utils/ecs.ts", "../../../geojson/src/utils/get-pixel-ratio.ts", "../../../geojson/src/utils/async.ts", "../../../geojson/src/utils/browser.ts", "../../../geojson/src/utils/fp.ts", "../../../geojson/src/utils/tranform-request.ts", "../../../geojson/src/components/styles/text-style.ts", "../../../geojson/src/components/styles/index.ts", "../../../geojson/src/components/styles/model-style.ts", "../../../geojson/src/components/styles/constants.ts"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable no-console*/\nexport const MI_DEBUG_KEY = 'mi-debug';\nexport const MI_ERROR_LABEL = '[MappedinJS]';\n\nexport enum E_SDK_LOG_LEVEL {\n\tLOG,\n\tWARN,\n\tERROR,\n\tSILENT,\n}\n\nexport function createLogger(name = '', { prefix = MI_ERROR_LABEL } = {}) {\n\tconst label = `${prefix}${name ? `-${name}` : ''}`;\n\n\tconst rnDebug = (type: 'log' | 'warn' | 'error', args: any[]) => {\n\t\tif (typeof window !== 'undefined' && (window as any).rnDebug) {\n\t\t\tconst processed = args.map(arg => {\n\t\t\t\tif (arg instanceof Error && arg.stack) {\n\t\t\t\t\treturn `${arg.message}\\n${arg.stack}`;\n\t\t\t\t}\n\n\t\t\t\treturn arg;\n\t\t\t});\n\t\t\t(window as any).rnDebug(`${name} ${type}: ${processed.join(' ')}`);\n\t\t}\n\t};\n\n\treturn {\n\t\tlogState: process.env.NODE_ENV === 'test' ? E_SDK_LOG_LEVEL.SILENT : E_SDK_LOG_LEVEL.LOG,\n\n\t\tlog(...args: any[]) {\n\t\t\tif (this.logState <= E_SDK_LOG_LEVEL.LOG) {\n\t\t\t\tconsole.log(label, ...args);\n\t\t\t\trnDebug('log', args);\n\t\t\t}\n\t\t},\n\n\t\twarn(...args: any[]) {\n\t\t\tif (this.logState <= E_SDK_LOG_LEVEL.WARN) {\n\t\t\t\tconsole.warn(label, ...args);\n\t\t\t\trnDebug('warn', args);\n\t\t\t}\n\t\t},\n\n\t\terror(...args: any[]) {\n\t\t\tif (this.logState <= E_SDK_LOG_LEVEL.ERROR) {\n\t\t\t\tconsole.error(label, ...args);\n\n\t\t\t\trnDebug('error', args);\n\t\t\t}\n\t\t},\n\n\t\t// It's a bit tricky to prepend [MappedinJs] to assert and time because of how the output is structured in the console, so it is left out for simplicity\n\t\tassert(...args: any[]) {\n\t\t\tconsole.assert(...args);\n\t\t},\n\n\t\ttime(label: string) {\n\t\t\tconsole.time(label);\n\t\t},\n\n\t\ttimeEnd(label: string) {\n\t\t\tconsole.timeEnd(label);\n\t\t},\n\t\tsetLevel(level: E_SDK_LOG_LEVEL) {\n\t\t\tif (E_SDK_LOG_LEVEL.LOG <= level && level <= E_SDK_LOG_LEVEL.SILENT) {\n\t\t\t\tthis.logState = level;\n\t\t\t}\n\t\t},\n\t};\n}\n\nconst Logger = createLogger();\nexport function setLoggerLevel(level: E_SDK_LOG_LEVEL) {\n\tif (E_SDK_LOG_LEVEL.LOG <= level && level <= E_SDK_LOG_LEVEL.SILENT) {\n\t\tLogger.logState = level;\n\t}\n}\n\nexport default Logger;\n", "import type { JwtPayload } from 'jwt-decode';\nimport { jwtDecode } from 'jwt-decode';\nimport { EARTH_RADIUS_M } from './constants';\nimport { Box2 } from 'three';\nimport type { Box3 } from 'three';\nimport Logger from './Mappedin.Logger';\n\nexport function findMapWithElevationClosestToZero<T extends { elevation?: number }>(maps: T[]): T | undefined {\n\tif (maps.length === 0) return;\n\tlet closestMap: T | undefined;\n\tfor (let map of maps) {\n\t\tif (typeof map.elevation !== 'number') {\n\t\t\tcontinue;\n\t\t}\n\t\tif (!closestMap) {\n\t\t\tclosestMap = map;\n\t\t\tcontinue;\n\t\t}\n\t\tif (typeof closestMap.elevation !== 'number') {\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (Math.abs(map.elevation) === Math.abs(closestMap.elevation)) {\n\t\t\t// In case we have no 0 value, we want to favour positive values\n\t\t\tclosestMap = map.elevation > closestMap.elevation ? map : closestMap;\n\t\t} else {\n\t\t\tclosestMap = Math.abs(map.elevation) < Math.abs(closestMap.elevation) ? map : closestMap;\n\t\t}\n\t}\n\n\treturn closestMap;\n}\n\n/**\n * Omit properites from object\n */\nexport function omit<T extends Record<string, any>, K extends keyof T>(obj: T, keysToOmit: K[]): Omit<T, K> {\n\tconst result = {} as Omit<T, K>;\n\tconst toOmit = new Set(keysToOmit);\n\tlet key: string;\n\tfor (key in obj) {\n\t\tif (!toOmit.has(key as K)) {\n\t\t\tresult[key] = obj[key];\n\t\t}\n\t}\n\n\treturn result;\n}\n\nexport function decodeAccessToken(accessToken: string) {\n\tconst decoded: JwtPayload & { capabilities: Record<string, any> } = jwtDecode(accessToken);\n\n\tif (decoded.sub == null) {\n\t\tthrow new Error('Access token is missing sub claim.');\n\t}\n\n\treturn {\n\t\tsub: decoded.sub,\n\t\taud: typeof decoded.aud === 'string' ? [decoded.aud] : decoded.aud ?? [],\n\t\tcapabilities: decoded.capabilities ?? {},\n\t};\n}\n\nexport function toRadians(degrees: number): number {\n\treturn degrees * (Math.PI / 180);\n}\n\nexport function toDegrees(radians: number): number {\n\treturn radians * (180 / Math.PI);\n}\n\nexport function round(value: number, decimals: number): number {\n\tconst factor = Math.pow(10, decimals);\n\n\treturn (Math.sign(value) * Math.round(Math.abs(value) * factor)) / factor;\n}\n\nexport function euclideanModulo(value: number, modulus: number): number {\n\treturn ((value % modulus) + modulus) % modulus;\n}\n\n/**\n * Position from our SDKs may be tuple of longitude and latitude optionally followed by altitude.\n */\ntype Position = [number, number] | [number, number, number?] | number[];\n\n/**\n * Calculates the approximate distance between two geographic coordinates on Earth's surface.\n *\n * This function uses the equirectangular approximation method to compute the distance, which simplifies\n * the math and speeds up calculations, but is less accurate over long distances compared to other methods\n * like the haversine formula.\n *\n * @param point1 - The first point's longitude and latitude as [longitude, latitude].\n * @param point1 - The second point's longitude and latitude as [longitude, latitude].\n * @return The approximate distance between the two points in meters.\n */\nexport function haversineDistance([lon1, lat1]: Position, [lon2, lat2]: Position): number {\n\tconst dLat = toRadians(lat2 - lat1);\n\tconst dLon = toRadians(lon2 - lon1);\n\n\tconst startLat = toRadians(lat1);\n\tconst destLat = toRadians(lat2);\n\n\tconst a =\n\t\tMath.sin(dLat / 2) * Math.sin(dLat / 2) +\n\t\tMath.sin(dLon / 2) * Math.sin(dLon / 2) * Math.cos(startLat) * Math.cos(destLat);\n\tconst c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\n\n\treturn EARTH_RADIUS_M * c;\n}\n\n/**\n * Calculates the bearing clockwise from North between two geographic coordinates on Earth's surface.\n * 0 is North, 90 is East, 180 is South, 270 is West.\n *\n * @param point1 - The first point's longitude and latitude as [longitude, latitude].\n * @param point2 - The second point's longitude and latitude as [longitude, latitude].\n * @returns The forward bearing in degrees from point1 to point2, measured clockwise from true North.\n */\nexport function getForwardBearing([lon1, lat1]: Position, [lon2, lat2]: Position): number {\n\tconst startLat = toRadians(lat1);\n\tconst startLon = toRadians(lon1);\n\tconst destLat = toRadians(lat2);\n\tconst destLon = toRadians(lon2);\n\n\tconst dLon = destLon - startLon;\n\n\tconst y = Math.sin(dLon) * Math.cos(destLat);\n\tconst x = Math.cos(startLat) * Math.sin(destLat) - Math.sin(startLat) * Math.cos(destLat) * Math.cos(dLon);\n\n\t// normalize to 0-360\n\treturn toDegrees((Math.atan2(y, x) + Math.PI * 2) % (Math.PI * 2));\n}\n\n/**\n *\n * Normalizes the start and end rotations to the range 0 to 2 PI and ensures the shortest path for rotation.\n *\n * @param startRotation - The start rotation in radians\n * @param targetRotation - The target rotation in radians\n * @returns Start and end rotations for the tween.\n */\nexport function shortestTweenRotation(startRotation: number, targetRotation: number) {\n\tconst startRotationMod2Pi = euclideanModulo(startRotation, Math.PI * 2);\n\tconst targetRotationMod2Pi = euclideanModulo(targetRotation, Math.PI * 2);\n\tconst delta = targetRotationMod2Pi - startRotationMod2Pi;\n\n\t// If delta > Math.PI rotate 2*PI clockwise\n\t// If delta < -Math.PI rotate 2*PI counterclockwise\n\t// Otherwise delta is already the shortest path\n\tconst endRotation = targetRotationMod2Pi + (delta > Math.PI ? -Math.PI * 2 : delta < -Math.PI ? Math.PI * 2 : 0);\n\n\treturn { start: startRotationMod2Pi, end: endRotation };\n}\n\nexport function isFiniteBox(box: Box2 | Box3) {\n\tif (box instanceof Box2) {\n\t\treturn (\n\t\t\tNumber.isFinite(box.min.x) &&\n\t\t\tNumber.isFinite(box.min.y) &&\n\t\t\tNumber.isFinite(box.max.x) &&\n\t\t\tNumber.isFinite(box.max.y)\n\t\t);\n\t}\n\n\treturn (\n\t\tNumber.isFinite(box.min.x) &&\n\t\tNumber.isFinite(box.min.y) &&\n\t\tNumber.isFinite(box.max.x) &&\n\t\tNumber.isFinite(box.max.y) &&\n\t\tNumber.isFinite(box.min.z) &&\n\t\tNumber.isFinite(box.max.z)\n\t);\n}\n\nexport function clampWithWarning(x: number, lower: number, upper: number, warning: string) {\n\tif (x < lower || x > upper) {\n\t\tLogger.warn(warning);\n\t}\n\n\treturn Math.min(upper, Math.max(lower, x));\n}\n\nexport function arraysEqual(arr1: any[] | null | undefined, arr2: any[] | null | undefined) {\n\tif (arr1 == null || arr2 == null) {\n\t\treturn arr1 === arr2;\n\t}\n\n\tif (arr1.length !== arr2.length) {\n\t\treturn false;\n\t}\n\n\tfor (let i = 0; i < arr1.length; i++) {\n\t\tif (arr1[i] !== arr2[i]) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\treturn true;\n}\n\nexport function isBrowser(): boolean {\n\treturn typeof window !== 'undefined' && window !== null;\n}\n", "export class InvalidTokenError extends Error {\n}\nInvalidTokenError.prototype.name = \"InvalidTokenError\";\nfunction b64DecodeUnicode(str) {\n return decodeURIComponent(atob(str).replace(/(.)/g, (m, p) => {\n let code = p.charCodeAt(0).toString(16).toUpperCase();\n if (code.length < 2) {\n code = \"0\" + code;\n }\n return \"%\" + code;\n }));\n}\nfunction base64UrlDecode(str) {\n let output = str.replace(/-/g, \"+\").replace(/_/g, \"/\");\n switch (output.length % 4) {\n case 0:\n break;\n case 2:\n output += \"==\";\n break;\n case 3:\n output += \"=\";\n break;\n default:\n throw new Error(\"base64 string is not of the correct length\");\n }\n try {\n return b64DecodeUnicode(output);\n }\n catch (err) {\n return atob(output);\n }\n}\nexport function jwtDecode(token, options) {\n if (typeof token !== \"string\") {\n throw new InvalidTokenError(\"Invalid token specified: must be a string\");\n }\n options || (options = {});\n const pos = options.header === true ? 0 : 1;\n const part = token.split(\".\")[pos];\n if (typeof part !== \"string\") {\n throw new InvalidTokenError(`Invalid token specified: missing part #${pos + 1}`);\n }\n let decoded;\n try {\n decoded = base64UrlDecode(part);\n }\n catch (e) {\n throw new InvalidTokenError(`Invalid token specified: invalid base64 for part #${pos + 1} (${e.message})`);\n }\n try {\n return JSON.parse(decoded);\n }\n catch (e) {\n throw new InvalidTokenError(`Invalid token specified: invalid json for part #${pos + 1} (${e.message})`);\n }\n}\n", "export const EARTH_RADIUS_M = 6371008.8;\n", "export function debounce<T extends (...args: any[]) => void>(func: T, wait: number, immediate = false) {\n\tlet timeout: NodeJS.Timeout | null = null;\n\tlet called = 0; // called times between execution\n\n\treturn function (...args: Parameters<T>) {\n\t\tcalled++;\n\n\t\tif (called === 1 && immediate === true) {\n\t\t\tfunc(...args);\n\t\t}\n\n\t\tlet later = () => {\n\t\t\t// only execute if it's called more than once before timeout reset\n\t\t\tif (!immediate || called > 1) {\n\t\t\t\tfunc(...args);\n\t\t\t}\n\t\t\ttimeout = null;\n\t\t\tcalled = 0;\n\t\t};\n\n\t\tclearTimeout(timeout as NodeJS.Timeout);\n\t\ttimeout = setTimeout(later, wait);\n\t};\n}\n", "export * from \"./errors.js\";\nexport * from \"./helpers/parseUtil.js\";\nexport * from \"./helpers/typeAliases.js\";\nexport * from \"./helpers/util.js\";\nexport * from \"./types.js\";\nexport * from \"./ZodError.js\";\n", "import defaultErrorMap from \"./locales/en.js\";\nlet overrideErrorMap = defaultErrorMap;\nexport { defaultErrorMap };\nexport function setErrorMap(map) {\n overrideErrorMap = map;\n}\nexport function getErrorMap() {\n return overrideErrorMap;\n}\n", "import { ZodIssueCode } from \"../ZodError.js\";\nimport { util, ZodParsedType } from \"../helpers/util.js\";\nconst errorMap = (issue, _ctx) => {\n let message;\n switch (issue.code) {\n case ZodIssueCode.invalid_type:\n if (issue.received === ZodParsedType.undefined) {\n message = \"Required\";\n }\n else {\n message = `Expected ${issue.expected}, received ${issue.received}`;\n }\n break;\n case ZodIssueCode.invalid_literal:\n message = `Invalid literal value, expected ${JSON.stringify(issue.expected, util.jsonStringifyReplacer)}`;\n break;\n case ZodIssueCode.unrecognized_keys:\n message = `Unrecognized key(s) in object: ${util.joinValues(issue.keys, \", \")}`;\n break;\n case ZodIssueCode.invalid_union:\n message = `Invalid input`;\n break;\n case ZodIssueCode.invalid_union_discriminator:\n message = `Invalid discriminator value. Expected ${util.joinValues(issue.options)}`;\n break;\n case ZodIssueCode.invalid_enum_value:\n message = `Invalid enum value. Expected ${util.joinValues(issue.options)}, received '${issue.received}'`;\n break;\n case ZodIssueCode.invalid_arguments:\n message = `Invalid function arguments`;\n break;\n case ZodIssueCode.invalid_return_type:\n message = `Invalid function return type`;\n break;\n case ZodIssueCode.invalid_date:\n message = `Invalid date`;\n break;\n case ZodIssueCode.invalid_string:\n if (typeof issue.validation === \"object\") {\n if (\"includes\" in issue.validation) {\n message = `Invalid input: must include \"${issue.validation.includes}\"`;\n if (typeof issue.validation.position === \"number\") {\n message = `${message} at one or more positions greater than or equal to ${issue.validation.position}`;\n }\n }\n else if (\"startsWith\" in issue.validation) {\n message = `Invalid input: must start with \"${issue.validation.startsWith}\"`;\n }\n else if (\"endsWith\" in issue.validation) {\n message = `Invalid input: must end with \"${issue.validation.endsWith}\"`;\n }\n else {\n util.assertNever(issue.validation);\n }\n }\n else if (issue.validation !== \"regex\") {\n message = `Invalid ${issue.validation}`;\n }\n else {\n message = \"Invalid\";\n }\n break;\n case ZodIssueCode.too_small:\n if (issue.type === \"array\")\n message = `Array must contain ${issue.exact ? \"exactly\" : issue.inclusive ? `at least` : `more than`} ${issue.minimum} element(s)`;\n else if (issue.type === \"string\")\n message = `String must contain ${issue.exact ? \"exactly\" : issue.inclusive ? `at least` : `over`} ${issue.minimum} character(s)`;\n else if (issue.type === \"number\")\n message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;\n else if (issue.type === \"date\")\n message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(Number(issue.minimum))}`;\n else\n message = \"Invalid input\";\n break;\n case ZodIssueCode.too_big:\n if (issue.type === \"array\")\n message = `Array must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `less than`} ${issue.maximum} element(s)`;\n else if (issue.type === \"string\")\n message = `String must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `under`} ${issue.maximum} character(s)`;\n else if (issue.type === \"number\")\n message = `Number must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;\n else if (issue.type === \"bigint\")\n message = `BigInt must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;\n else if (issue.type === \"date\")\n message = `Date must be ${issue.exact ? `exactly` : issue.inclusive ? `smaller than or equal to` : `smaller than`} ${new Date(Number(issue.maximum))}`;\n else\n message = \"Invalid input\";\n break;\n case ZodIssueCode.custom:\n message = `Invalid input`;\n break;\n case ZodIssueCode.invalid_intersection_types:\n message = `Intersection results could not be merged`;\n break;\n case ZodIssueCode.not_multiple_of:\n message = `Number must be a multiple of ${issue.multipleOf}`;\n break;\n case ZodIssueCode.not_finite:\n message = \"Number must be finite\";\n break;\n default:\n message = _ctx.defaultError;\n util.assertNever(issue);\n }\n return { message };\n};\nexport default errorMap;\n", "import { util } from \"./helpers/util.js\";\nexport const ZodIssueCode = util.arrayToEnum([\n \"invalid_type\",\n \"invalid_literal\",\n \"custom\",\n \"invalid_union\",\n \"invalid_union_discriminator\",\n \"invalid_enum_value\",\n \"unrecognized_keys\",\n \"invalid_arguments\",\n \"invalid_return_type\",\n \"invalid_date\",\n \"invalid_string\",\n \"too_small\",\n \"too_big\",\n \"invalid_intersection_types\",\n \"not_multiple_of\",\n \"not_finite\",\n]);\nexport const quotelessJson = (obj) => {\n const json = JSON.stringify(obj, null, 2);\n return json.replace(/\"([^\"]+)\":/g, \"$1:\");\n};\nexport class ZodError extends Error {\n get errors() {\n return this.issues;\n }\n constructor(issues) {\n super();\n this.issues = [];\n this.addIssue = (sub) => {\n this.issues = [...this.issues, sub];\n };\n this.addIssues = (subs = []) => {\n this.issues = [...this.issues, ...subs];\n };\n const actualProto = new.target.prototype;\n if (Object.setPrototypeOf) {\n // eslint-disable-next-line ban/ban\n Object.setPrototypeOf(this, actualProto);\n }\n else {\n this.__proto__ = actualProto;\n }\n this.name = \"ZodError\";\n this.issues = issues;\n }\n format(_mapper) {\n const mapper = _mapper ||\n function (issue) {\n return issue.message;\n };\n const fieldErrors = { _errors: [] };\n const processError = (error) => {\n for (const issue of error.issues) {\n if (issue.code === \"invalid_union\") {\n issue.unionErrors.map(processError);\n }\n else if (issue.code === \"invalid_return_type\") {\n processError(issue.returnTypeError);\n }\n else if (issue.code === \"invalid_arguments\") {\n processError(issue.argumentsError);\n }\n else if (issue.path.length === 0) {\n fieldErrors._errors.push(mapper(issue));\n }\n else {\n let curr = fieldErrors;\n let i = 0;\n while (i < issue.path.length) {\n const el = issue.path[i];\n const terminal = i === issue.path.length - 1;\n if (!terminal) {\n curr[el] = curr[el] || { _errors: [] };\n // if (typeof el === \"string\") {\n // curr[el] = curr[el] || { _errors: [] };\n // } else if (typeof el === \"number\") {\n // const errorArray: any = [];\n // errorArray._errors = [];\n // curr[el] = curr[el] || errorArray;\n // }\n }\n else {\n curr[el] = curr[el] || { _errors: [] };\n curr[el]._errors.push(mapper(issue));\n }\n curr = curr[el];\n i++;\n }\n }\n }\n };\n processError(this);\n return fieldErrors;\n }\n static assert(value) {\n if (!(value instanceof ZodError)) {\n throw new Error(`Not a ZodError: ${value}`);\n }\n }\n toString() {\n return this.message;\n }\n get message() {\n return JSON.stringify(this.issues, util.jsonStringifyReplacer, 2);\n }\n get isEmpty() {\n return this.issues.length === 0;\n }\n flatten(mapper = (issue) => issue.message) {\n const fieldErrors = {};\n const formErrors = [];\n for (const sub of this.issues) {\n if (sub.path.length > 0) {\n fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];\n fieldErrors[sub.path[0]].push(mapper(sub));\n }\n else {\n formErrors.push(mapper(sub));\n }\n }\n return { formErrors, fieldErrors };\n }\n get formErrors() {\n return this.flatten();\n }\n}\nZodError.create = (issues) => {\n const error = new ZodError(issues);\n return error;\n};\n", "export var util;\n(function (util) {\n util.assertEqual = (_) => { };\n function assertIs(_arg) { }\n util.assertIs = assertIs;\n function assertNever(_x) {\n throw new Error();\n }\n util.assertNever = assertNever;\n util.arrayToEnum = (items) => {\n const obj = {};\n for (const item of items) {\n obj[item] = item;\n }\n return obj;\n };\n util.getValidEnumValues = (obj) => {\n const validKeys = util.objectKeys(obj).filter((k) => typeof obj[obj[k]] !== \"number\");\n const filtered = {};\n for (const k of validKeys) {\n filtered[k] = obj[k];\n }\n return util.objectValues(filtered);\n };\n util.objectValues = (obj) => {\n return util.objectKeys(obj).map(function (e) {\n return obj[e];\n });\n };\n util.objectKeys = typeof Object.keys === \"function\" // eslint-disable-line ban/ban\n ? (obj) => Object.keys(obj) // eslint-disable-line ban/ban\n : (object) => {\n const keys = [];\n for (const key in object) {\n if (Object.prototype.hasOwnProperty.call(object, key)) {\n keys.push(key);\n }\n }\n return keys;\n };\n util.find = (arr, checker) => {\n for (const item of arr) {\n if (checker(item))\n return item;\n }\n return undefined;\n };\n util.isInteger = typeof Number.isInteger === \"function\"\n ? (val) => Number.isInteger(val) // eslint-disable-line ban/ban\n : (val) => typeof val === \"number\" && Number.isFinite(val) && Math.floor(val) === val;\n function joinValues(array, separator = \" | \") {\n return array.map((val) => (typeof val === \"string\" ? `'${val}'` : val)).join(separator);\n }\n util.joinValues = joinValues;\n util.jsonStringifyReplacer = (_, value) => {\n if (typeof value === \"bigint\") {\n return value.toString();\n }\n return value;\n };\n})(util || (util = {}));\nexport var objectUtil;\n(function (objectUtil) {\n objectUtil.mergeShapes = (first, second) => {\n return {\n ...first,\n ...second, // second overwrites first\n };\n };\n})(objectUtil || (objectUtil = {}));\nexport const ZodParsedType = util.arrayToEnum([\n \"string\",\n \"nan\",\n \"number\",\n \"integer\",\n \"float\",\n \"boolean\",\n \"date\",\n \"bigint\",\n \"symbol\",\n \"function\",\n \"undefined\",\n \"null\",\n \"array\",\n \"object\",\n \"unknown\",\n \"promise\",\n \"void\",\n \"never\",\n \"map\",\n \"set\",\n]);\nexport const getParsedType = (data) => {\n const t = typeof data;\n switch (t) {\n case \"undefined\":\n return ZodParsedType.undefined;\n case \"string\":\n return ZodParsedType.string;\n case \"number\":\n return Number.isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;\n case \"boolean\":\n return ZodParsedType.boolean;\n case \"function\":\n return ZodParsedType.function;\n case \"bigint\":\n return ZodParsedType.bigint;\n case \"symbol\":\n return ZodParsedType.symbol;\n case \"object\":\n if (Array.isArray(data)) {\n return ZodParsedType.array;\n }\n if (data === null) {\n return ZodParsedType.null;\n }\n if (data.then && typeof data.then === \"function\" && data.catch && typeof data.catch === \"function\") {\n return ZodParsedType.promise;\n }\n if (typeof Map !== \"undefined\" && data instanceof Map) {\n return ZodParsedType.map;\n }\n if (typeof Set !== \"undefined\" && data instanceof Set) {\n return ZodParsedType.set;\n }\n if (typeof Date !== \"undefined\" && data instanceof Date) {\n return ZodParsedType.date;\n }\n return ZodParsedType.object;\n default:\n return ZodParsedType.unknown;\n }\n};\n", "import { getErrorMap } from \"../errors.js\";\nimport defaultErrorMap from \"../locales/en.js\";\nexport const makeIssue = (params) => {\n const { data, path, errorMaps, issueData } = params;\n const fullPath = [...path, ...(issueData.path || [])];\n const fullIssue = {\n ...issueData,\n path: fullPath,\n };\n if (issueData.message !== undefined) {\n return {\n ...issueData,\n path: fullPath,\n message: issueData.message,\n };\n }\n let errorMessage = \"\";\n const maps = errorMaps\n .filter((m) => !!m)\n .slice()\n .reverse();\n for (const map of maps) {\n errorMessage = map(fullIssue, { data, defaultError: errorMessage }).message;\n }\n return {\n ...issueData,\n path: fullPath,\n message: errorMessage,\n };\n};\nexport const EMPTY_PATH = [];\nexport function addIssueToContext(ctx, issueData) {\n const overrideMap = getErrorMap();\n const issue = makeIssue({\n issueData: issueData,\n data: ctx.data,\n path: ctx.path,\n errorMaps: [\n ctx.common.contextualErrorMap, // contextual error map is first priority\n ctx.schemaErrorMap, // then schema-bound map if available\n overrideMap, // then global override map\n overrideMap === defaultErrorMap ? undefined : defaultErrorMap, // then global default map\n ].filter((x) => !!x),\n });\n ctx.common.issues.push(issue);\n}\nexport class ParseStatus {\n constructor() {\n this.value = \"valid\";\n }\n dirty() {\n if (this.value === \"valid\")\n this.value = \"dirty\";\n }\n abort() {\n if (this.value !== \"aborted\")\n this.value = \"aborted\";\n }\n static mergeArray(status, results) {\n const arrayValue = [];\n for (const s of results) {\n if (s.status === \"aborted\")\n return INVALID;\n if (s.status === \"dirty\")\n status.dirty();\n arrayValue.push(s.value);\n }\n return { status: status.value, value: arrayValue };\n }\n static async mergeObjectAsync(status, pairs) {\n const syncPairs = [];\n for (const pair of pairs) {\n const key = await pair.key;\n const value = await pair.value;\n syncPairs.push({\n key,\n value,\n });\n }\n return ParseStatus.mergeObjectSync(status, syncPairs);\n }\n static mergeObjectSync(status, pairs) {\n const finalObject = {};\n for (const pair of pairs) {\n const { key, value } = pair;\n if (key.status === \"aborted\")\n return INVALID;\n if (value.status === \"aborted\")\n return INVALID;\n if (key.status === \"dirty\")\n status.dirty();\n if (value.status === \"dirty\")\n status.dirty();\n if (key.value !== \"__proto__\" && (typeof value.value !== \"undefined\" || pair.alwaysSet)) {\n finalObject[key.value] = value.value;\n }\n }\n return { status: status.value, value: finalObject };\n }\n}\nexport const INVALID = Object.freeze({\n status: \"aborted\",\n});\nexport const DIRTY = (value) => ({ status: \"dirty\", value });\nexport const OK = (value) => ({ status: \"valid\", value });\nexport const isAborted = (x) => x.status === \"aborted\";\nexport const isDirty = (x) => x.status === \"dirty\";\nexport const isValid = (x) => x.status === \"valid\";\nexport const isAsync = (x) => typeof Promise !== \"undefined\" && x instanceof Promise;\n", "export {};\n", "import { ZodError, ZodIssueCode, } from \"./ZodError.js\";\nimport { defaultErrorMap, getErrorMap } from \"./errors.js\";\nimport { errorUtil } from \"./helpers/errorUtil.js\";\nimport { DIRTY, INVALID, OK, ParseStatus, addIssueToContext, isAborted, isAsync, isDirty, isValid, makeIssue, } from \"./helpers/parseUtil.js\";\nimport { util, ZodParsedType, getParsedType } from \"./helpers/util.js\";\nclass ParseInputLazyPath {\n constructor(parent, value, path, key) {\n this._cachedPath = [];\n this.parent = parent;\n this.data = value;\n this._path = path;\n this._key = key;\n }\n get path() {\n if (!this._cachedPath.length) {\n if (Array.isArray(this._key)) {\n this._cachedPath.push(...this._path, ...this._key);\n }\n else {\n this._cachedPath.push(...this._path, this._key);\n }\n }\n return this._cachedPath;\n }\n}\nconst handleResult = (ctx, result) => {\n if (isValid(result)) {\n return { success: true, data: result.value };\n }\n else {\n if (!ctx.common.issues.length) {\n throw new Error(\"Validation failed but no issues detected.\");\n }\n return {\n success: false,\n get error() {\n if (this._error)\n return this._error;\n const error = new ZodError(ctx.common.issues);\n this._error = error;\n return this._error;\n },\n };\n }\n};\nfunction processCreateParams(params) {\n if (!params)\n return {};\n const { errorMap, invalid_type_error, required_error, description } = params;\n if (errorMap && (invalid_type_error || required_error)) {\n throw new Error(`Can't use \"invalid_type_error\" or \"required_error\" in conjunction with custom error map.`);\n }\n if (errorMap)\n return { errorMap: errorMap, description };\n const customMap = (iss, ctx) => {\n const { message } = params;\n if (iss.code === \"invalid_enum_value\") {\n return { message: message ?? ctx.defaultError };\n }\n if (typeof ctx.data === \"undefined\") {\n return { message: message ?? required_error ?? ctx.defaultError };\n }\n if (iss.code !== \"invalid_type\")\n return { message: ctx.defaultError };\n return { message: message ?? invalid_type_error ?? ctx.defaultError };\n };\n return { errorMap: customMap, description };\n}\nexport class ZodType {\n get description() {\n return this._def.description;\n }\n _getType(input) {\n return getParsedType(input.data);\n }\n _getOrReturnCtx(input, ctx) {\n return (ctx || {\n common: input.parent.common,\n data: input.data,\n parsedType: getParsedType(input.data),\n schemaErrorMap: this._def.errorMap,\n path: input.path,\n parent: input.parent,\n });\n }\n _processInputParams(input) {\n return {\n status: new ParseStatus(),\n ctx: {\n common: input.parent.common,\n data: input.data,\n parsedType: getParsedType(input.data),\n schemaErrorMap: this._def.errorMap,\n path: input.path,\n parent: input.parent,\n },\n };\n }\n _parseSync(input) {\n const result = this._parse(input);\n if (isAsync(result)) {\n throw new Error(\"Synchronous parse encountered promise.\");\n }\n return result;\n }\n _parseAsync(input) {\n const result = this._parse(input);\n return Promise.resolve(result);\n }\n parse(data, params) {\n const result = this.safeParse(data, params);\n if (result.success)\n return result.data;\n throw result.error;\n }\n safeParse(data, params) {\n const ctx = {\n common: {\n issues: [],\n async: params?.async ?? false,\n contextualErrorMap: params?.errorMap,\n },\n path: params?.path || [],\n schemaErrorMap: this._def.errorMap,\n parent: null,\n data,\n parsedType: getParsedType(data),\n };\n const result = this._parseSync({ data, path: ctx.path, parent: ctx });\n return handleResult(ctx, result);\n }\n \"~validate\"(data) {\n const ctx = {\n common: {\n issues: [],\n async: !!this[\"~standard\"].async,\n },\n path: [],\n schemaErrorMap: this._def.errorMap,\n parent: null,\n data,\n parsedType: getParsedType(data),\n };\n if (!this[\"~standard\"].async) {\n try {\n const result = this._parseSync({ data, path: [], parent: ctx });\n return isValid(result)\n ? {\n value: result.value,\n }\n : {\n issues: ctx.common.issues,\n };\n }\n catch (err) {\n if (err?.message?.toLowerCase()?.includes(\"encountered\")) {\n this[\"~standard\"].async = true;\n }\n ctx.common = {\n issues: [],\n async: true,\n };\n }\n }\n return this._parseAsync({ data, path: [], parent: ctx }).then((result) => isValid(result)\n ? {\n value: result.value,\n }\n : {\n issues: ctx.common.issues,\n });\n }\n async parseAsync(data, params) {\n const result = await this.safeParseAsync(data, params);\n if (result.success)\n return result.data;\n throw result.error;\n }\n async safeParseAsync(data, params) {\n const ctx = {\n common: {\n issues: [],\n contextualErrorMap: params?.errorMap,\n async: true,\n },\n path: params?.path || [],\n schemaErrorMap: this._def.errorMap,\n parent: null,\n data,\n parsedType: getParsedType(data),\n };\n const maybeAsyncResult = this._parse({ data, path: ctx.path, parent: ctx });\n const result = await (isAsync(maybeAsyncResult) ? maybeAsyncResult : Promise.resolve(maybeAsyncResult));\n return handleResult(ctx, result);\n }\n refine(check, message) {\n const getIssueProperties = (val) => {\n if (typeof message === \"string\" || typeof message === \"undefined\") {\n return { message };\n }\n else if (typeof message === \"function\") {\n return message(val);\n }\n else {\n return message;\n }\n };\n return this._refinement((val, ctx) => {\n const result = check(val);\n const setError = () => ctx.addIssue({\n code: ZodIssueCode.custom,\n ...getIssueProperties(val),\n });\n if (typeof Promise !== \"undefined\" && result instanceof Promise) {\n return result.then((data) => {\n if (!data) {\n setError();\n return false;\n }\n else {\n return true;\n }\n });\n }\n if (!result) {\n setError();\n return false;\n }\n else {\n return true;\n }\n });\n }\n refinement(check, refinementData) {\n return this._refinement((val, ctx) => {\n if (!check(val)) {\n ctx.addIssue(typeof refinementData === \"function\" ? refinementData(val, ctx) : refinementData);\n return false;\n }\n else {\n return true;\n }\n });\n }\n _refinement(refinement) {\n return new ZodEffects({\n schema: this,\n typeName: ZodFirstPartyTypeKind.ZodEffects,\n effect: { type: \"refinement\", refinement },\n });\n }\n superRefine(refinement) {\n return this._refinement(refinement);\n }\n constructor(def) {\n /** Alias of safeParseAsync */\n this.spa = this.safeParseAsync;\n this._def = def;\n this.parse = this.parse.bind(this);\n this.safeParse = this.safeParse.bind(this);\n this.parseAsync = this.parseAsync.bind(this);\n this.safeParseAsync = this.safeParseAsync.bind(this);\n this.spa = this.spa.bind(this);\n this.refine = this.refine.bind(this);\n this.refinement = this.refinement.bind(this);\n this.superRefine = this.superRefine.bind(this);\n this.optional = this.optional.bind(this);\n this.nullable = this.nullable.bind(this);\n this.nullish = this.nullish.bind(this);\n this.array = this.array.bind(this);\n this.promise = this.promise.bind(this);\n this.or = this.or.bind(this);\n this.and = this.and.bind(this);\n this.transform = this.transform.bind(this);\n this.brand = this.brand.bind(this);\n this.default = this.default.bind(this);\n this.catch = this.catch.bind(this);\n this.describe = this.describe.bind(this);\n this.pipe = this.pipe.bind(this);\n this.readonly = this.readonly.bind(this);\n this.isNullable = this.isNullable.bind(this);\n this.isOptional = this.isOptional.bind(this);\n this[\"~standard\"] = {\n version: 1,\n vendor: \"zod\",\n validate: (data) => this[\"~validate\"](data),\n };\n }\n optional() {\n return ZodOptional.create(this, this._def);\n }\n nullable() {\n return ZodNullable.create(this, this._def);\n }\n nullish() {\n return this.nullable().optional();\n }\n array() {\n return ZodArray.create(this);\n }\n promise() {\n return ZodPromise.create(this, this._def);\n }\n or(option) {\n return ZodUnion.create([this, option], this._def);\n }\n and(incoming) {\n return ZodIntersection.create(this, incoming, this._def);\n }\n transform(transform) {\n return new ZodEffects({\n ...processCreateParams(this._def),\n schema: this,\n typeName: ZodFirstPartyTypeKind.ZodEffects,\n effect: { type: \"transform\", transform },\n });\n }\n default(def) {\n const defaultValueFunc = typeof def === \"function\" ? def : () => def;\n return new ZodDefault({\n ...processCreateParams(this._def),\n innerType: this,\n defaultValue: defaultValueFunc,\n typeName: ZodFirstPartyTypeKind.ZodDefault,\n });\n }\n brand() {\n return new ZodBranded({\n typeName: ZodFirstPartyTypeKind.ZodBranded,\n type: this,\n ...processCreateParams(this._def),\n });\n }\n catch(def) {\n const catchValueFunc = typeof def === \"function\" ? def : () => def;\n return new ZodCatch({\n ...processCreateParams(this._def),\n innerType: this,\n catchValue: catchValueFunc,\n typeName: ZodFirstPartyTypeKind.ZodCatch,\n });\n }\n describe(description) {\n const This = this.constructor;\n return new This({\n ...this._def,\n description,\n });\n }\n pipe(target) {\n return ZodPipeline.create(this, target);\n }\n readonly() {\n return ZodReadonly.create(this);\n }\n isOptional() {\n return this.safeParse(undefined).success;\n }\n isNullable() {\n return this.safeParse(null).success;\n }\n}\nconst cuidRegex = /^c[^\\s-]{8,}$/i;\nconst cuid2Regex = /^[0-9a-z]+$/;\nconst ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/i;\n// const uuidRegex =\n// /^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i;\nconst uuidRegex = /^[0-9a-fA-F]{8}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{12}$/i;\nconst nanoidRegex = /^[a-z0-9_-]{21}$/i;\nconst jwtRegex = /^[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]*$/;\nconst durationRegex = /^[-+]?P(?!$)(?:(?:[-+]?\\d+Y)|(?:[-+]?\\d+[.,]\\d+Y$))?(?:(?:[-+]?\\d+M)|(?:[-+]?\\d+[.,]\\d+M$))?(?:(?:[-+]?\\d+W)|(?:[-+]?\\d+[.,]\\d+W$))?(?:(?:[-+]?\\d+D)|(?:[-+]?\\d+[.,]\\d+D$))?(?:T(?=[\\d+-])(?:(?:[-+]?\\d+H)|(?:[-+]?\\d+[.,]\\d+H$))?(?:(?:[-+]?\\d+M)|(?:[-+]?\\d+[.,]\\d+M$))?(?:[-+]?\\d+(?:[.,]\\d+)?S)?)??$/;\n// from https://stackoverflow.com/a/46181/1550155\n// old version: too slow, didn't support unicode\n// const emailRegex = /^((([a-z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+(\\.([a-z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+)*)|((\\x22)((((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(([\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f]|\\x21|[\\x23-\\x5b]|[\\x5d-\\x7e]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(\\\\([\\x01-\\x09\\x0b\\x0c\\x0d-\\x7f]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]))))*(((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(\\x22)))@((([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.)+(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))$/i;\n//old email regex\n// const emailRegex = /^(([^<>()[\\].,;:\\s@\"]+(\\.[^<>()[\\].,;:\\s@\"]+)*)|(\".+\"))@((?!-)([^<>()[\\].,;:\\s@\"]+\\.)+[^<>()[\\].,;:\\s@\"]{1,})[^-<>()[\\].,;:\\s@\"]$/i;\n// eslint-disable-next-line\n// const emailRegex =\n// /^(([^<>()[\\]\\\\.,;:\\s@\\\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\\\"]+)*)|(\\\".+\\\"))@((\\[(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\])|(\\[IPv6:(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))\\])|([A-Za-z0-9]([A-Za-z0-9-]*[A-Za-z0-9])*(\\.[A-Za-z]{2,})+))$/;\n// const emailRegex =\n// /^[a-zA-Z0-9\\.\\!\\#\\$\\%\\&\\'\\*\\+\\/\\=\\?\\^\\_\\`\\{\\|\\}\\~\\-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;\n// const emailRegex =\n// /^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])$/i;\nconst emailRegex = /^(?!\\.)(?!.*\\.\\.)([A-Z0-9_'+\\-\\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\\-]*\\.)+[A-Z]{2,}$/i;\n// const emailRegex =\n// /^[a-z0-9.!#$%&\u2019*+/=?^_`{|}~-]+@[a-z0-9-]+(?:\\.[a-z0-9\\-]+)*$/i;\n// from https://thekevinscott.com/emojis-in-javascript/#writing-a-regular-expression\nconst _emojiRegex = `^(\\\\p{Extended_Pictographic}|\\\\p{Emoji_Component})+$`;\nlet emojiRegex;\n// faster, simpler, safer\nconst ipv4Regex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;\nconst ipv4CidrRegex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\/(3[0-2]|[12]?[0-9])$/;\n// const ipv6Regex =\n// /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/;\nconst ipv6Regex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/;\nconst ipv6CidrRegex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;\n// https://stackoverflow.com/questions/7860392/determine-if-string-is-in-base64-using-javascript\nconst base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;\n// https://base64.guru/standards/base64url\nconst base64urlRegex = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;\n// simple\n// const dateRegexSource = `\\\\d{4}-\\\\d{2}-\\\\d{2}`;\n// no leap year validation\n// const dateRegexSource = `\\\\d{4}-((0[13578]|10|12)-31|(0[13-9]|1[0-2])-30|(0[1-9]|1[0-2])-(0[1-9]|1\\\\d|2\\\\d))`;\n// with leap year validation\nconst dateRegexSource = `((\\\\d\\\\d[2468][048]|\\\\d\\\\d[13579][26]|\\\\d\\\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\\\d|30)|(02)-(0[1-9]|1\\\\d|2[0-8])))`;\nconst dateRegex = new RegExp(`^${dateRegexSource}$`);\nfunction timeRegexSource(args) {\n let secondsRegexSource = `[0-5]\\\\d`;\n if (args.precision) {\n secondsRegexSource = `${secondsRegexSource}\\\\.\\\\d{${args.precision}}`;\n }\n else if (args.precision == null) {\n secondsRegexSource = `${secondsRegexSource}(\\\\.\\\\d+)?`;\n }\n const secondsQuantifier = args.precision ? \"+\" : \"?\"; // require seconds if precision is nonzero\n return `([01]\\\\d|2[0-3]):[0-5]\\\\d(:${secondsRegexSource})${secondsQuantifier}`;\n}\nfunction timeRegex(args) {\n return new RegExp(`^${timeRegexSource(args)}$`);\n}\n// Adapted from https://stackoverflow.com/a/3143231\nexport function datetimeRegex(args) {\n let regex = `${dateRegexSource}T${timeRegexSource(args)}`;\n const opts = [];\n opts.push(args.local ? `Z?` : `Z`);\n if (args.offset)\n opts.push(`([+-]\\\\d{2}:?\\\\d{2})`);\n regex = `${regex}(${opts.join(\"|\")})`;\n return new RegExp(`^${regex}$`);\n}\nfunction isValidIP(ip, version) {\n if ((version === \"v4\" || !version) && ipv4Regex.test(ip)) {\n return true;\n }\n if ((version === \"v6\" || !version) && ipv6Regex.test(ip)) {\n return true;\n }\n return false;\n}\nfunction isValidJWT(jwt, alg) {\n if (!jwtRegex.test(jwt))\n return false;\n try {\n const [header] = jwt.split(\".\");\n // Convert base64url to base64\n const base64 = header\n .replace(/-/g, \"+\")\n .replace(/_/g, \"/\")\n .padEnd(header.length + ((4 - (header.length % 4)) % 4), \"=\");\n const decoded = JSON.parse(atob(base64));\n if (typeof decoded !== \"object\" || decoded === null)\n return false;\n if (\"typ\" in decoded && decoded?.typ !== \"JWT\")\n return false;\n if (!decoded.alg)\n return false;\n if (alg && decoded.alg !== alg)\n return false;\n return true;\n }\n catch {\n return false;\n }\n}\nfunction isValidCidr(ip, version) {\n if ((version === \"v4\" || !version) && ipv4CidrRegex.test(ip)) {\n return true;\n }\n if ((version === \"v6\" || !version) && ipv6CidrRegex.test(ip)) {\n return true;\n }\n return false;\n}\nexport class ZodString extends ZodType {\n _parse(input) {\n if (this._def.coerce) {\n input.data = String(input.data);\n }\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.string) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.string,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n const status = new ParseStatus();\n let ctx = undefined;\n for (const check of this._def.checks) {\n if (check.kind === \"min\") {\n if (input.data.length < check.value) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n minimum: check.value,\n type: \"string\",\n inclusive: true,\n exact: false,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"max\") {\n if (input.data.length > check.value) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n maximum: check.value,\n type: \"string\",\n inclusive: true,\n exact: false,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"length\") {\n const tooBig = input.data.length > check.value;\n const tooSmall = input.data.length < check.value;\n if (tooBig || tooSmall) {\n ctx = this._getOrReturnCtx(input, ctx);\n if (tooBig) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n maximum: check.value,\n type: \"string\",\n inclusive: true,\n exact: true,\n message: check.message,\n });\n }\n else if (tooSmall) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n minimum: check.value,\n type: \"string\",\n inclusive: true,\n exact: true,\n message: check.message,\n });\n }\n status.dirty();\n }\n }\n else if (check.kind === \"email\") {\n if (!emailRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"email\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"emoji\") {\n if (!emojiRegex) {\n emojiRegex = new RegExp(_emojiRegex, \"u\");\n }\n if (!emojiRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"emoji\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"uuid\") {\n if (!uuidRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"uuid\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"nanoid\") {\n if (!nanoidRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"nanoid\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"cuid\") {\n if (!cuidRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"cuid\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"cuid2\") {\n if (!cuid2Regex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"cuid2\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"ulid\") {\n if (!ulidRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"ulid\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"url\") {\n try {\n new URL(input.data);\n }\n catch {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"url\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"regex\") {\n check.regex.lastIndex = 0;\n const testResult = check.regex.test(input.data);\n if (!testResult) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"regex\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"trim\") {\n input.data = input.data.trim();\n }\n else if (check.kind === \"includes\") {\n if (!input.data.includes(check.value, check.position)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_string,\n validation: { includes: check.value, position: check.position },\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"toLowerCase\") {\n input.data = input.data.toLowerCase();\n }\n else if (check.kind === \"toUpperCase\") {\n input.data = input.data.toUpperCase();\n }\n else if (check.kind === \"startsWith\") {\n if (!input.data.startsWith(check.value)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_string,\n validation: { startsWith: check.value },\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"endsWith\") {\n if (!input.data.endsWith(check.value)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_string,\n validation: { endsWith: check.value },\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"datetime\") {\n const regex = datetimeRegex(check);\n if (!regex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_string,\n validation: \"datetime\",\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"date\") {\n const regex = dateRegex;\n if (!regex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_string,\n validation: \"date\",\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"time\") {\n const regex = timeRegex(check);\n if (!regex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_string,\n validation: \"time\",\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"duration\") {\n if (!durationRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"duration\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"ip\") {\n if (!isValidIP(input.data, check.version)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"ip\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"jwt\") {\n if (!isValidJWT(input.data, check.alg)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"jwt\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"cidr\") {\n if (!isValidCidr(input.data, check.version)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"cidr\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"base64\") {\n if (!base64Regex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"base64\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"base64url\") {\n if (!base64urlRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"base64url\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else {\n util.assertNever(check);\n }\n }\n return { status: status.value, value: input.data };\n }\n _regex(regex, validation, message) {\n return this.refinement((data) => regex.test(data), {\n validation,\n code: ZodIssueCode.invalid_string,\n ...errorUtil.errToObj(message),\n });\n }\n _addCheck(check) {\n return new ZodString({\n ...this._def,\n checks: [...this._def.checks, check],\n });\n }\n email(message) {\n return this._addCheck({ kind: \"email\", ...errorUtil.errToObj(message) });\n }\n url(message) {\n return this._addCheck({ kind: \"url\", ...errorUtil.errToObj(message) });\n }\n emoji(message) {\n return this._addCheck({ kind: \"emoji\", ...errorUtil.errToObj(message) });\n }\n uuid(message) {\n return this._addCheck({ kind: \"uuid\", ...errorUtil.errToObj(message) });\n }\n nanoid(message) {\n return this._addCheck({ kind: \"nanoid\", ...errorUtil.errToObj(message) });\n }\n cuid(message) {\n return this._addCheck({ kind: \"cuid\", ...errorUtil.errToObj(message) });\n }\n cuid2(message) {\n return this._addCheck({ kind: \"cuid2\", ...errorUtil.errToObj(message) });\n }\n ulid(message) {\n return this._addCheck({ kind: \"ulid\", ...errorUtil.errToObj(message) });\n }\n base64(message) {\n return this._addCheck({ kind: \"base64\", ...errorUtil.errToObj(message) });\n }\n base64url(message) {\n // base64url encoding is a modification of base64 that can safely be used in URLs and filenames\n return this._addCheck({\n kind: \"base64url\",\n ...errorUtil.errToObj(message),\n });\n }\n jwt(options) {\n return this._addCheck({ kind: \"jwt\", ...errorUtil.errToObj(options) });\n }\n ip(options) {\n return this._addCheck({ kind: \"ip\", ...errorUtil.errToObj(options) });\n }\n cidr(options) {\n return this._addCheck({ kind: \"cidr\", ...errorUtil.errToObj(options) });\n }\n datetime(options) {\n if (typeof options === \"string\") {\n return this._addCheck({\n kind: \"datetime\",\n precision: null,\n offset: false,\n local: false,\n message: options,\n });\n }\n return this._addCheck({\n kind: \"datetime\",\n precision: typeof options?.precision === \"undefined\" ? null : options?.precision,\n offset: options?.offset ?? false,\n local: options?.local ?? false,\n ...errorUtil.errToObj(options?.message),\n });\n }\n date(message) {\n return this._addCheck({ kind: \"date\", message });\n }\n time(options) {\n if (typeof options === \"string\") {\n return this._addCheck({\n kind: \"time\",\n precision: null,\n message: options,\n });\n }\n return this._addCheck({\n kind: \"time\",\n precision: typeof options?.precision === \"undefined\" ? null : options?.precision,\n ...errorUtil.errToObj(options?.message),\n });\n }\n duration(message) {\n return this._addCheck({ kind: \"duration\", ...errorUtil.errToObj(message) });\n }\n regex(regex, message) {\n return this._addCheck({\n kind: \"regex\",\n regex: regex,\n ...errorUtil.errToObj(message),\n });\n }\n includes(value, options) {\n return this._addCheck({\n kind: \"includes\",\n value: value,\n position: options?.position,\n ...errorUtil.errToObj(options?.message),\n });\n }\n startsWith(value, message) {\n return this._addCheck({\n kind: \"startsWith\",\n value: value,\n ...errorUtil.errToObj(message),\n });\n }\n endsWith(value, message) {\n return this._addCheck({\n kind: \"endsWith\",\n value: value,\n ...errorUtil.errToObj(message),\n });\n }\n min(minLength, message) {\n return this._addCheck({\n kind: \"min\",\n value: minLength,\n ...errorUtil.errToObj(message),\n });\n }\n max(maxLength, message) {\n return this._addCheck({\n kind: \"max\",\n value: maxLength,\n ...errorUtil.errToObj(message),\n });\n }\n length(len, message) {\n return this._addCheck({\n kind: \"length\",\n value: len,\n ...errorUtil.errToObj(message),\n });\n }\n /**\n * Equivalent to `.min(1)`\n */\n nonempty(message) {\n return this.min(1, errorUtil.errToObj(message));\n }\n trim() {\n return new ZodString({\n ...this._def,\n checks: [...this._def.checks, { kind: \"trim\" }],\n });\n }\n toLowerCase() {\n return new ZodString({\n ...this._def,\n checks: [...this._def.checks, { kind: \"toLowerCase\" }],\n });\n }\n toUpperCase() {\n return new ZodString({\n ...this._def,\n checks: [...this._def.checks, { kind: \"toUpperCase\" }],\n });\n }\n get isDatetime() {\n return !!this._def.checks.find((ch) => ch.kind === \"datetime\");\n }\n get isDate() {\n return !!this._def.checks.find((ch) => ch.kind === \"date\");\n }\n get isTime() {\n return !!this._def.checks.find((ch) => ch.kind === \"time\");\n }\n get isDuration() {\n return !!this._def.checks.find((ch) => ch.kind === \"duration\");\n }\n get isEmail() {\n return !!this._def.checks.find((ch) => ch.kind === \"email\");\n }\n get isURL() {\n return !!this._def.checks.find((ch) => ch.kind === \"url\");\n }\n get isEmoji() {\n return !!this._def.checks.find((ch) => ch.kind === \"emoji\");\n }\n get isUUID() {\n return !!this._def.checks.find((ch) => ch.kind === \"uuid\");\n }\n get isNANOID() {\n return !!this._def.checks.find((ch) => ch.kind === \"nanoid\");\n }\n get isCUID() {\n return !!this._def.checks.find((ch) => ch.kind === \"cuid\");\n }\n get isCUID2() {\n return !!this._def.checks.find((ch) => ch.kind === \"cuid2\");\n }\n get isULID() {\n return !!this._def.checks.find((ch) => ch.kind === \"ulid\");\n }\n get isIP() {\n return !!this._def.checks.find((ch) => ch.kind === \"ip\");\n }\n get isCIDR() {\n return !!this._def.checks.find((ch) => ch.kind === \"cidr\");\n }\n get isBase64() {\n return !!this._def.checks.find((ch) => ch.kind === \"base64\");\n }\n get isBase64url() {\n // base64url encoding is a modification of base64 that can safely be used in URLs and filenames\n return !!this._def.checks.find((ch) => ch.kind === \"base64url\");\n }\n get minLength() {\n let min = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"min\") {\n if (min === null || ch.value > min)\n min = ch.value;\n }\n }\n return min;\n }\n get maxLength() {\n let max = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"max\") {\n if (max === null || ch.value < max)\n max = ch.value;\n }\n }\n return max;\n }\n}\nZodString.create = (params) => {\n return new ZodString({\n checks: [],\n typeName: ZodFirstPartyTypeKind.ZodString,\n coerce: params?.coerce ?? false,\n ...processCreateParams(params),\n });\n};\n// https://stackoverflow.com/questions/3966484/why-does-modulus-operator-return-fractional-number-in-javascript/31711034#31711034\nfunction floatSafeRemainder(val, step) {\n const valDecCount = (val.toString().split(\".\")[1] || \"\").length;\n const stepDecCount = (step.toString().split(\".\")[1] || \"\").length;\n const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;\n const valInt = Number.parseInt(val.toFixed(decCount).replace(\".\", \"\"));\n const stepInt = Number.parseInt(step.toFixed(decCount).replace(\".\", \"\"));\n return (valInt % stepInt) / 10 ** decCount;\n}\nexport class ZodNumber extends ZodType {\n constructor() {\n super(...arguments);\n this.min = this.gte;\n this.max = this.lte;\n this.step = this.multipleOf;\n }\n _parse(input) {\n if (this._def.coerce) {\n input.data = Number(input.data);\n }\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.number) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.number,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n let ctx = undefined;\n const status = new ParseStatus();\n for (const check of this._def.checks) {\n if (check.kind === \"int\") {\n if (!util.isInteger(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: \"integer\",\n received: \"float\",\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"min\") {\n const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;\n if (tooSmall) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n minimum: check.value,\n type: \"number\",\n inclusive: check.inclusive,\n exact: false,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"max\") {\n const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;\n if (tooBig) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n maximum: check.value,\n type: \"number\",\n inclusive: check.inclusive,\n exact: false,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"multipleOf\") {\n if (floatSafeRemainder(input.data, check.value) !== 0) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.not_multiple_of,\n multipleOf: check.value,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"finite\") {\n if (!Number.isFinite(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.not_finite,\n message: check.message,\n });\n status.dirty();\n }\n }\n else {\n util.assertNever(check);\n }\n }\n return { status: status.value, value: input.data };\n }\n gte(value, message) {\n return this.setLimit(\"min\", value, true, errorUtil.toString(message));\n }\n gt(value, message) {\n return this.setLimit(\"min\", value, false, errorUtil.toString(message));\n }\n lte(value, message) {\n return this.setLimit(\"max\", value, true, errorUtil.toString(message));\n }\n lt(value, message) {\n return this.setLimit(\"max\", value, false, errorUtil.toString(message));\n }\n setLimit(kind, value, inclusive, message) {\n return new ZodNumber({\n ...this._def,\n checks: [\n ...this._def.checks,\n {\n kind,\n value,\n inclusive,\n message: errorUtil.toString(message),\n },\n ],\n });\n }\n _addCheck(check) {\n return new ZodNumber({\n ...this._def,\n checks: [...this._def.checks, check],\n });\n }\n int(message) {\n return this._addCheck({\n kind: \"int\",\n message: errorUtil.toString(message),\n });\n }\n positive(message) {\n return this._addCheck({\n kind: \"min\",\n value: 0,\n inclusive: false,\n message: errorUtil.toString(message),\n });\n }\n negative(message) {\n return this._addCheck({\n kind: \"max\",\n value: 0,\n inclusive: false,\n message: errorUtil.toString(message),\n });\n }\n nonpositive(message) {\n return this._addCheck({\n kind: \"max\",\n value: 0,\n inclusive: true,\n message: errorUtil.toString(message),\n });\n }\n nonnegative(message) {\n return this._addCheck({\n kind: \"min\",\n value: 0,\n inclusive: true,\n message: errorUtil.toString(message),\n });\n }\n multipleOf(value, message) {\n return this._addCheck({\n kind: \"multipleOf\",\n value: value,\n message: errorUtil.toString(message),\n });\n }\n finite(message) {\n return this._addCheck({\n kind: \"finite\",\n message: errorUtil.toString(message),\n });\n }\n safe(message) {\n return this._addCheck({\n kind: \"min\",\n inclusive: true,\n value: Number.MIN_SAFE_INTEGER,\n message: errorUtil.toString(message),\n })._addCheck({\n kind: \"max\",\n inclusive: true,\n value: Number.MAX_SAFE_INTEGER,\n message: errorUtil.toString(message),\n });\n }\n get minValue() {\n let min = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"min\") {\n if (min === null || ch.value > min)\n min = ch.value;\n }\n }\n return min;\n }\n get maxValue() {\n let max = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"max\") {\n if (max === null || ch.value < max)\n max = ch.value;\n }\n }\n return max;\n }\n get isInt() {\n return !!this._def.checks.find((ch) => ch.kind === \"int\" || (ch.kind === \"multipleOf\" && util.isInteger(ch.value)));\n }\n get isFinite() {\n let max = null;\n let min = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"finite\" || ch.kind === \"int\" || ch.kind === \"multipleOf\") {\n return true;\n }\n else if (ch.kind === \"min\") {\n if (min === null || ch.value > min)\n min = ch.value;\n }\n else if (ch.kind === \"max\") {\n if (max === null || ch.value < max)\n max = ch.value;\n }\n }\n return Number.isFinite(min) && Number.isFinite(max);\n }\n}\nZodNumber.create = (params) => {\n return new ZodNumber({\n checks: [],\n typeName: ZodFirstPartyTypeKind.ZodNumber,\n coerce: params?.coerce || false,\n ...processCreateParams(params),\n });\n};\nexport class ZodBigInt extends ZodType {\n constructor() {\n super(...arguments);\n this.min = this.gte;\n this.max = this.lte;\n }\n _parse(input) {\n if (this._def.coerce) {\n try {\n input.data = BigInt(input.data);\n }\n catch {\n return this._getInvalidInput(input);\n }\n }\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.bigint) {\n return this._getInvalidInput(input);\n }\n let ctx = undefined;\n const status = new ParseStatus();\n for (const check of this._def.checks) {\n if (check.kind === \"min\") {\n const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;\n if (tooSmall) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n type: \"bigint\",\n minimum: check.value,\n inclusive: check.inclusive,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"max\") {\n const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;\n if (tooBig) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n type: \"bigint\",\n maximum: check.value,\n inclusive: check.inclusive,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"multipleOf\") {\n if (input.data % check.value !== BigInt(0)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.not_multiple_of,\n multipleOf: check.value,\n message: check.message,\n });\n status.dirty();\n }\n }\n else {\n util.assertNever(check);\n }\n }\n return { status: status.value, value: input.data };\n }\n _getInvalidInput(input) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.bigint,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n gte(value, message) {\n return this.setLimit(\"min\", value, true, errorUtil.toString(message));\n }\n gt(value, message) {\n return this.setLimit(\"min\", value, false, errorUtil.toString(message));\n }\n lte(value, message) {\n return this.setLimit(\"max\", value, true, errorUtil.toString(message));\n }\n lt(value, message) {\n return this.setLimit(\"max\", value, false, errorUtil.toString(message));\n }\n setLimit(kind, value, inclusive, message) {\n return new ZodBigInt({\n ...this._def,\n checks: [\n ...this._def.checks,\n {\n kind,\n value,\n inclusive,\n message: errorUtil.toString(message),\n },\n ],\n });\n }\n _addCheck(check) {\n return new ZodBigInt({\n ...this._def,\n checks: [...this._def.checks, check],\n });\n }\n positive(message) {\n return this._addCheck({\n kind: \"min\",\n value: BigInt(0),\n inclusive: false,\n message: errorUtil.toString(message),\n });\n }\n negative(message) {\n return this._addCheck({\n kind: \"max\",\n value: BigInt(0),\n inclusive: false,\n message: errorUtil.toString(message),\n });\n }\n nonpositive(message) {\n return this._addCheck({\n kind: \"max\",\n value: BigInt(0),\n inclusive: true,\n message: errorUtil.toString(message),\n });\n }\n nonnegative(message) {\n return this._addCheck({\n kind: \"min\",\n value: BigInt(0),\n inclusive: true,\n message: errorUtil.toString(message),\n });\n }\n multipleOf(value, message) {\n return this._addCheck({\n kind: \"multipleOf\",\n value,\n message: errorUtil.toString(message),\n });\n }\n get minValue() {\n let min = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"min\") {\n if (min === null || ch.value > min)\n min = ch.value;\n }\n }\n return min;\n }\n get maxValue() {\n let max = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"max\") {\n if (max === null || ch.value < max)\n max = ch.value;\n }\n }\n return max;\n }\n}\nZodBigInt.create = (params) => {\n return new ZodBigInt({\n checks: [],\n typeName: ZodFirstPartyTypeKind.ZodBigInt,\n coerce: params?.coerce ?? false,\n ...processCreateParams(params),\n });\n};\nexport class ZodBoolean extends ZodType {\n _parse(input) {\n if (this._def.coerce) {\n input.data = Boolean(input.data);\n }\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.boolean) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.boolean,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n return OK(input.data);\n }\n}\nZodBoolean.create = (params) => {\n return new ZodBoolean({\n typeName: ZodFirstPartyTypeKind.ZodBoolean,\n coerce: params?.coerce || false,\n ...processCreateParams(params),\n });\n};\nexport class ZodDate extends ZodType {\n _parse(input) {\n if (this._def.coerce) {\n input.data = new Date(input.data);\n }\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.date) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.date,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n if (Number.isNaN(input.data.getTime())) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_date,\n });\n return INVALID;\n }\n const status = new ParseStatus();\n let ctx = undefined;\n for (const check of this._def.checks) {\n if (check.kind === \"min\") {\n if (input.data.getTime() < check.value) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n message: check.message,\n inclusive: true,\n exact: false,\n minimum: check.value,\n type: \"date\",\n });\n status.dirty();\n }\n }\n else if (check.kind === \"max\") {\n if (input.data.getTime() > check.value) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n message: check.message,\n inclusive: true,\n exact: false,\n maximum: check.value,\n type: \"date\",\n });\n status.dirty();\n }\n }\n else {\n util.assertNever(check);\n }\n }\n return {\n status: status.value,\n value: new Date(input.data.getTime()),\n };\n }\n _addCheck(check) {\n return new ZodDate({\n ...this._def,\n checks: [...this._def.checks, check],\n });\n }\n min(minDate, message) {\n return this._addCheck({\n kind: \"min\",\n value: minDate.getTime(),\n message: errorUtil.toString(message),\n });\n }\n max(maxDate, message) {\n return this._addCheck({\n kind: \"max\",\n value: maxDate.getTime(),\n message: errorUtil.toString(message),\n });\n }\n get minDate() {\n let min = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"min\") {\n if (min === null || ch.value > min)\n min = ch.value;\n }\n }\n return min != null ? new Date(min) : null;\n }\n get maxDate() {\n let max = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"max\") {\n if (max === null || ch.value < max)\n max = ch.value;\n }\n }\n return max != null ? new Date(max) : null;\n }\n}\nZodDate.create = (params) => {\n return new ZodDate({\n checks: [],\n coerce: params?.coerce || false,\n typeName: ZodFirstPartyTypeKind.ZodDate,\n ...processCreateParams(params),\n });\n};\nexport class ZodSymbol extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.symbol) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.symbol,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n return OK(input.data);\n }\n}\nZodSymbol.create = (params) => {\n return new ZodSymbol({\n typeName: ZodFirstPartyTypeKind.ZodSymbol,\n ...processCreateParams(params),\n });\n};\nexport class ZodUndefined extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.undefined) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.undefined,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n return OK(input.data);\n }\n}\nZodUndefined.create = (params) => {\n return new ZodUndefined({\n typeName: ZodFirstPartyTypeKind.ZodUndefined,\n ...processCreateParams(params),\n });\n};\nexport class ZodNull extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.null) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.null,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n return OK(input.data);\n }\n}\nZodNull.create = (params) => {\n return new ZodNull({\n typeName: ZodFirstPartyTypeKind.ZodNull,\n ...processCreateParams(params),\n });\n};\nexport class ZodAny extends ZodType {\n constructor() {\n super(...arguments);\n // to prevent instances of other classes from extending ZodAny. this causes issues with catchall in ZodObject.\n this._any = true;\n }\n _parse(input) {\n return OK(input.data);\n }\n}\nZodAny.create = (params) => {\n return new ZodAny({\n typeName: ZodFirstPartyTypeKind.ZodAny,\n ...processCreateParams(params),\n });\n};\nexport class ZodUnknown extends ZodType {\n constructor() {\n super(...arguments);\n // required\n this._unknown = true;\n }\n _parse(input) {\n return OK(input.data);\n }\n}\nZodUnknown.create = (params) => {\n return new ZodUnknown({\n typeName: ZodFirstPartyTypeKind.ZodUnknown,\n ...processCreateParams(params),\n });\n};\nexport class ZodNever extends ZodType {\n _parse(input) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.never,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n}\nZodNever.create = (params) => {\n return new ZodNever({\n typeName: ZodFirstPartyTypeKind.ZodNever,\n ...processCreateParams(params),\n });\n};\nexport class ZodVoid extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.undefined) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.void,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n return OK(input.data);\n }\n}\nZodVoid.create = (params) => {\n return new ZodVoid({\n typeName: ZodFirstPartyTypeKind.ZodVoid,\n ...processCreateParams(params),\n });\n};\nexport class ZodArray extends ZodType {\n _parse(input) {\n const { ctx, status } = this._processInputParams(input);\n const def = this._def;\n if (ctx.parsedType !== ZodParsedType.array) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.array,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n if (def.exactLength !== null) {\n const tooBig = ctx.data.length > def.exactLength.value;\n const tooSmall = ctx.data.length < def.exactLength.value;\n if (tooBig || tooSmall) {\n addIssueToContext(ctx, {\n code: tooBig ? ZodIssueCode.too_big : ZodIssueCode.too_small,\n minimum: (tooSmall ? def.exactLength.value : undefined),\n maximum: (tooBig ? def.exactLength.value : undefined),\n type: \"array\",\n inclusive: true,\n exact: true,\n message: def.exactLength.message,\n });\n status.dirty();\n }\n }\n if (def.minLength !== null) {\n if (ctx.data.length < def.minLength.value) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n minimum: def.minLength.value,\n type: \"array\",\n inclusive: true,\n exact: false,\n message: def.minLength.message,\n });\n status.dirty();\n }\n }\n if (def.maxLength !== null) {\n if (ctx.data.length > def.maxLength.value) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n maximum: def.maxLength.value,\n type: \"array\",\n inclusive: true,\n exact: false,\n message: def.maxLength.message,\n });\n status.dirty();\n }\n }\n if (ctx.common.async) {\n return Promise.all([...ctx.data].map((item, i) => {\n return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i));\n })).then((result) => {\n return ParseStatus.mergeArray(status, result);\n });\n }\n const result = [...ctx.data].map((item, i) => {\n return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i));\n });\n return ParseStatus.mergeArray(status, result);\n }\n get element() {\n return this._def.type;\n }\n min(minLength, message) {\n return new ZodArray({\n ...this._def,\n minLength: { value: minLength, message: errorUtil.toString(message) },\n });\n }\n max(maxLength, message) {\n return new ZodArray({\n ...this._def,\n maxLength: { value: maxLength, message: errorUtil.toString(message) },\n });\n }\n length(len, message) {\n return new ZodArray({\n ...this._def,\n exactLength: { value: len, message: errorUtil.toString(message) },\n });\n }\n nonempty(message) {\n return this.min(1, message);\n }\n}\nZodArray.create = (schema, params) => {\n return new ZodArray({\n type: schema,\n minLength: null,\n maxLength: null,\n exactLength: null,\n typeName: ZodFirstPartyTypeKind.ZodArray,\n ...processCreateParams(params),\n });\n};\nfunction deepPartialify(schema) {\n if (schema instanceof ZodObject) {\n const newShape = {};\n for (const key in schema.shape) {\n const fieldSchema = schema.shape[key];\n newShape[key] = ZodOptional.create(deepPartialify(fieldSchema));\n }\n return new ZodObject({\n ...schema._def,\n shape: () => newShape,\n });\n }\n else if (schema instanceof ZodArray) {\n return new ZodArray({\n ...schema._def,\n type: deepPartialify(schema.element),\n });\n }\n else if (schema instanceof ZodOptional) {\n return ZodOptional.create(deepPartialify(schema.unwrap()));\n }\n else if (schema instanceof ZodNullable) {\n return ZodNullable.create(deepPartialify(schema.unwrap()));\n }\n else if (schema instanceof ZodTuple) {\n return ZodTuple.create(schema.items.map((item) => deepPartialify(item)));\n }\n else {\n return schema;\n }\n}\nexport class ZodObject extends ZodType {\n constructor() {\n super(...arguments);\n this._cached = null;\n /**\n * @deprecated In most cases, this is no longer needed - unknown properties are now silently stripped.\n * If you want to pass through unknown properties, use `.passthrough()` instead.\n */\n this.nonstrict = this.passthrough;\n // extend<\n // Augmentation extends ZodRawShape,\n // NewOutput extends util.flatten<{\n // [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation\n // ? Augmentation[k][\"_output\"]\n // : k extends keyof Output\n // ? Output[k]\n // : never;\n // }>,\n // NewInput extends util.flatten<{\n // [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation\n // ? Augmentation[k][\"_input\"]\n // : k extends keyof Input\n // ? Input[k]\n // : never;\n // }>\n // >(\n // augmentation: Augmentation\n // ): ZodObject<\n // extendShape<T, Augmentation>,\n // UnknownKeys,\n // Catchall,\n // NewOutput,\n // NewInput\n // > {\n // return new ZodObject({\n // ...this._def,\n // shape: () => ({\n // ...this._def.shape(),\n // ...augmentation,\n // }),\n // }) as any;\n // }\n /**\n * @deprecated Use `.extend` instead\n * */\n this.augment = this.extend;\n }\n _getCached() {\n if (this._cached !== null)\n return this._cached;\n const shape = this._def.shape();\n const keys = util.objectKeys(shape);\n this._cached = { shape, keys };\n return this._cached;\n }\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.object) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.object,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n const { status, ctx } = this._processInputParams(input);\n const { shape, keys: shapeKeys } = this._getCached();\n const extraKeys = [];\n if (!(this._def.catchall instanceof ZodNever && this._def.unknownKeys === \"strip\")) {\n for (const key in ctx.data) {\n if (!shapeKeys.includes(key)) {\n extraKeys.push(key);\n }\n }\n }\n const pairs = [];\n for (const key of shapeKeys) {\n const keyValidator = shape[key];\n const value = ctx.data[key];\n pairs.push({\n key: { status: \"valid\", value: key },\n value: keyValidator._parse(new ParseInputLazyPath(ctx, value, ctx.path, key)),\n alwaysSet: key in ctx.data,\n });\n }\n if (this._def.catchall instanceof ZodNever) {\n const unknownKeys = this._def.unknownKeys;\n if (unknownKeys === \"passthrough\") {\n for (const key of extraKeys) {\n pairs.push({\n key: { status: \"valid\", value: key },\n value: { status: \"valid\", value: ctx.data[key] },\n });\n }\n }\n else if (unknownKeys === \"strict\") {\n if (extraKeys.length > 0) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.unrecognized_keys,\n keys: extraKeys,\n });\n status.dirty();\n }\n }\n else if (unknownKeys === \"strip\") {\n }\n else {\n throw new Error(`Internal ZodObject error: invalid unknownKeys value.`);\n }\n }\n else {\n // run catchall validation\n const catchall = this._def.catchall;\n for (const key of extraKeys) {\n const value = ctx.data[key];\n pairs.push({\n key: { status: \"valid\", value: key },\n value: catchall._parse(new ParseInputLazyPath(ctx, value, ctx.path, key) //, ctx.child(key), value, getParsedType(value)\n ),\n alwaysSet: key in ctx.data,\n });\n }\n }\n if (ctx.common.async) {\n return Promise.resolve()\n .then(async () => {\n const syncPairs = [];\n for (const pair of pairs) {\n const key = await pair.key;\n const value = await pair.value;\n syncPairs.push({\n key,\n value,\n alwaysSet: pair.alwaysSet,\n });\n }\n return syncPairs;\n })\n .then((syncPairs) => {\n return ParseStatus.mergeObjectSync(status, syncPairs);\n });\n }\n else {\n return ParseStatus.mergeObjectSync(status, pairs);\n }\n }\n get shape() {\n return this._def.shape();\n }\n strict(message) {\n errorUtil.errToObj;\n return new ZodObject({\n ...this._def,\n unknownKeys: \"strict\",\n ...(message !== undefined\n ? {\n errorMap: (issue, ctx) => {\n const defaultError = this._def.errorMap?.(issue, ctx).message ?? ctx.defaultError;\n if (issue.code === \"unrecognized_keys\")\n return {\n message: errorUtil.errToObj(message).message ?? defaultError,\n };\n return {\n message: defaultError,\n };\n },\n }\n : {}),\n });\n }\n strip() {\n return new ZodObject({\n ...this._def,\n unknownKeys: \"strip\",\n });\n }\n passthrough() {\n return new ZodObject({\n ...this._def,\n unknownKeys: \"passthrough\",\n });\n }\n // const AugmentFactory =\n // <Def extends ZodObjectDef>(def: Def) =>\n // <Augmentation extends ZodRawShape>(\n // augmentation: Augmentation\n // ): ZodObject<\n // extendShape<ReturnType<Def[\"shape\"]>, Augmentation>,\n // Def[\"unknownKeys\"],\n // Def[\"catchall\"]\n // > => {\n // return new ZodObject({\n // ...def,\n // shape: () => ({\n // ...def.shape(),\n // ...augmentation,\n // }),\n // }) as any;\n // };\n extend(augmentation) {\n return new ZodObject({\n ...this._def,\n shape: () => ({\n ...this._def.shape(),\n ...augmentation,\n }),\n });\n }\n /**\n * Prior to zod@1.0.12 there was a bug in the\n * inferred type of merged objects. Please\n * upgrade if you are experiencing issues.\n */\n merge(merging) {\n const merged = new ZodObject({\n unknownKeys: merging._def.unknownKeys,\n catchall: merging._def.catchall,\n shape: () => ({\n ...this._def.shape(),\n ...merging._def.shape(),\n }),\n typeName: ZodFirstPartyTypeKind.ZodObject,\n });\n return merged;\n }\n // merge<\n // Incoming extends AnyZodObject,\n // Augmentation extends Incoming[\"shape\"],\n // NewOutput extends {\n // [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation\n // ? Augmentation[k][\"_output\"]\n // : k extends keyof Output\n // ? Output[k]\n // : never;\n // },\n // NewInput extends {\n // [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation\n // ? Augmentation[k][\"_input\"]\n // : k extends keyof Input\n // ? Input[k]\n // : never;\n // }\n // >(\n // merging: Incoming\n // ): ZodObject<\n // extendShape<T, ReturnType<Incoming[\"_def\"][\"shape\"]>>,\n // Incoming[\"_def\"][\"unknownKeys\"],\n // Incoming[\"_def\"][\"catchall\"],\n // NewOutput,\n // NewInput\n // > {\n // const merged: any = new ZodObject({\n // unknownKeys: merging._def.unknownKeys,\n // catchall: merging._def.catchall,\n // shape: () =>\n // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),\n // typeName: ZodFirstPartyTypeKind.ZodObject,\n // }) as any;\n // return merged;\n // }\n setKey(key, schema) {\n return this.augment({ [key]: schema });\n }\n // merge<Incoming extends AnyZodObject>(\n // merging: Incoming\n // ): //ZodObject<T & Incoming[\"_shape\"], UnknownKeys, Catchall> = (merging) => {\n // ZodObject<\n // extendShape<T, ReturnType<Incoming[\"_def\"][\"shape\"]>>,\n // Incoming[\"_def\"][\"unknownKeys\"],\n // Incoming[\"_def\"][\"catchall\"]\n // > {\n // // const mergedShape = objectUtil.mergeShapes(\n // // this._def.shape(),\n // // merging._def.shape()\n // // );\n // const merged: any = new ZodObject({\n // unknownKeys: merging._def.unknownKeys,\n // catchall: merging._def.catchall,\n // shape: () =>\n // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),\n // typeName: ZodFirstPartyTypeKind.ZodObject,\n // }) as any;\n // return merged;\n // }\n catchall(index) {\n return new ZodObject({\n ...this._def,\n catchall: index,\n });\n }\n pick(mask) {\n const shape = {};\n for (const key of util.objectKeys(mask)) {\n if (mask[key] && this.shape[key]) {\n shape[key] = this.shape[key];\n }\n }\n return new ZodObject({\n ...this._def,\n shape: () => shape,\n });\n }\n omit(mask) {\n const shape = {};\n for (const key of util.objectKeys(this.shape)) {\n if (!mask[key]) {\n shape[key] = this.shape[key];\n }\n }\n return new ZodObject({\n ...this._def,\n shape: () => shape,\n });\n }\n /**\n * @deprecated\n */\n deepPartial() {\n return deepPartialify(this);\n }\n partial(mask) {\n const newShape = {};\n for (const key of util.objectKeys(this.shape)) {\n const fieldSchema = this.shape[key];\n if (mask && !mask[key]) {\n newShape[key] = fieldSchema;\n }\n else {\n newShape[key] = fieldSchema.optional();\n }\n }\n return new ZodObject({\n ...this._def,\n shape: () => newShape,\n });\n }\n required(mask) {\n const newShape = {};\n for (const key of util.objectKeys(this.shape)) {\n if (mask && !mask[key]) {\n newShape[key] = this.shape[key];\n }\n else {\n const fieldSchema = this.shape[key];\n let newField = fieldSchema;\n while (newField instanceof ZodOptional) {\n newField = newField._def.innerType;\n }\n newShape[key] = newField;\n }\n }\n return new ZodObject({\n ...this._def,\n shape: () => newShape,\n });\n }\n keyof() {\n return createZodEnum(util.objectKeys(this.shape));\n }\n}\nZodObject.create = (shape, params) => {\n return new ZodObject({\n shape: () => shape,\n unknownKeys: \"strip\",\n catchall: ZodNever.create(),\n typeName: ZodFirstPartyTypeKind.ZodObject,\n ...processCreateParams(params),\n });\n};\nZodObject.strictCreate = (shape, params) => {\n return new ZodObject({\n shape: () => shape,\n unknownKeys: \"strict\",\n catchall: ZodNever.create(),\n typeName: ZodFirstPartyTypeKind.ZodObject,\n ...processCreateParams(params),\n });\n};\nZodObject.lazycreate = (shape, params) => {\n return new ZodObject({\n shape,\n unknownKeys: \"strip\",\n catchall: ZodNever.create(),\n typeName: ZodFirstPartyTypeKind.ZodObject,\n ...processCreateParams(params),\n });\n};\nexport class ZodUnion extends ZodType {\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n const options = this._def.options;\n function handleResults(results) {\n // return first issue-free validation if it exists\n for (const result of results) {\n if (result.result.status === \"valid\") {\n return result.result;\n }\n }\n for (const result of results) {\n if (result.result.status === \"dirty\") {\n // add issues from dirty option\n ctx.common.issues.push(...result.ctx.common.issues);\n return result.result;\n }\n }\n // return invalid\n const unionErrors = results.map((result) => new ZodError(result.ctx.common.issues));\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_union,\n unionErrors,\n });\n return INVALID;\n }\n if (ctx.common.async) {\n return Promise.all(options.map(async (option) => {\n const childCtx = {\n ...ctx,\n common: {\n ...ctx.common,\n issues: [],\n },\n parent: null,\n };\n return {\n result: await option._parseAsync({\n data: ctx.data,\n path: ctx.path,\n parent: childCtx,\n }),\n ctx: childCtx,\n };\n })).then(handleResults);\n }\n else {\n let dirty = undefined;\n const issues = [];\n for (const option of options) {\n const childCtx = {\n ...ctx,\n common: {\n ...ctx.common,\n issues: [],\n },\n parent: null,\n };\n const result = option._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: childCtx,\n });\n if (result.status === \"valid\") {\n return result;\n }\n else if (result.status === \"dirty\" && !dirty) {\n dirty = { result, ctx: childCtx };\n }\n if (childCtx.common.issues.length) {\n issues.push(childCtx.common.issues);\n }\n }\n if (dirty) {\n ctx.common.issues.push(...dirty.ctx.common.issues);\n return dirty.result;\n }\n const unionErrors = issues.map((issues) => new ZodError(issues));\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_union,\n unionErrors,\n });\n return INVALID;\n }\n }\n get options() {\n return this._def.options;\n }\n}\nZodUnion.create = (types, params) => {\n return new ZodUnion({\n options: types,\n typeName: ZodFirstPartyTypeKind.ZodUnion,\n ...processCreateParams(params),\n });\n};\n/////////////////////////////////////////////////////\n/////////////////////////////////////////////////////\n////////// //////////\n////////// ZodDiscriminatedUnion //////////\n////////// //////////\n/////////////////////////////////////////////////////\n/////////////////////////////////////////////////////\nconst getDiscriminator = (type) => {\n if (type instanceof ZodLazy) {\n return getDiscriminator(type.schema);\n }\n else if (type instanceof ZodEffects) {\n return getDiscriminator(type.innerType());\n }\n else if (type instanceof ZodLiteral) {\n return [type.value];\n }\n else if (type instanceof ZodEnum) {\n return type.options;\n }\n else if (type instanceof ZodNativeEnum) {\n // eslint-disable-next-line ban/ban\n return util.objectValues(type.enum);\n }\n else if (type instanceof ZodDefault) {\n return getDiscriminator(type._def.innerType);\n }\n else if (type instanceof ZodUndefined) {\n return [undefined];\n }\n else if (type instanceof ZodNull) {\n return [null];\n }\n else if (type instanceof ZodOptional) {\n return [undefined, ...getDiscriminator(type.unwrap())];\n }\n else if (type instanceof ZodNullable) {\n return [null, ...getDiscriminator(type.unwrap())];\n }\n else if (type instanceof ZodBranded) {\n return getDiscriminator(type.unwrap());\n }\n else if (type instanceof ZodReadonly) {\n return getDiscriminator(type.unwrap());\n }\n else if (type instanceof ZodCatch) {\n return getDiscriminator(type._def.innerType);\n }\n else {\n return [];\n }\n};\nexport class ZodDiscriminatedUnion extends ZodType {\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.object) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.object,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n const discriminator = this.discriminator;\n const discriminatorValue = ctx.data[discriminator];\n const option = this.optionsMap.get(discriminatorValue);\n if (!option) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_union_discriminator,\n options: Array.from(this.optionsMap.keys()),\n path: [discriminator],\n });\n return INVALID;\n }\n if (ctx.common.async) {\n return option._parseAsync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n });\n }\n else {\n return option._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n });\n }\n }\n get discriminator() {\n return this._def.discriminator;\n }\n get options() {\n return this._def.options;\n }\n get optionsMap() {\n return this._def.optionsMap;\n }\n /**\n * The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor.\n * However, it only allows a union of objects, all of which need to share a discriminator property. This property must\n * have a different value for each object in the union.\n * @param discriminator the name of the discriminator property\n * @param types an array of object schemas\n * @param params\n */\n static create(discriminator, options, params) {\n // Get all the valid discriminator values\n const optionsMap = new Map();\n // try {\n for (const type of options) {\n const discriminatorValues = getDiscriminator(type.shape[discriminator]);\n if (!discriminatorValues.length) {\n throw new Error(`A discriminator value for key \\`${discriminator}\\` could not be extracted from all schema options`);\n }\n for (const value of discriminatorValues) {\n if (optionsMap.has(value)) {\n throw new Error(`Discriminator property ${String(discriminator)} has duplicate value ${String(value)}`);\n }\n optionsMap.set(value, type);\n }\n }\n return new ZodDiscriminatedUnion({\n typeName: ZodFirstPartyTypeKind.ZodDiscriminatedUnion,\n discriminator,\n options,\n optionsMap,\n ...processCreateParams(params),\n });\n }\n}\nfunction mergeValues(a, b) {\n const aType = getParsedType(a);\n const bType = getParsedType(b);\n if (a === b) {\n return { valid: true, data: a };\n }\n else if (aType === ZodParsedType.object && bType === ZodParsedType.object) {\n const bKeys = util.objectKeys(b);\n const sharedKeys = util.objectKeys(a).filter((key) => bKeys.indexOf(key) !== -1);\n const newObj = { ...a, ...b };\n for (const key of sharedKeys) {\n const sharedValue = mergeValues(a[key], b[key]);\n if (!sharedValue.valid) {\n return { valid: false };\n }\n newObj[key] = sharedValue.data;\n }\n return { valid: true, data: newObj };\n }\n else if (aType === ZodParsedType.array && bType === ZodParsedType.array) {\n if (a.length !== b.length) {\n return { valid: false };\n }\n const newArray = [];\n for (let index = 0; index < a.length; index++) {\n const itemA = a[index];\n const itemB = b[index];\n const sharedValue = mergeValues(itemA, itemB);\n if (!sharedValue.valid) {\n return { valid: false };\n }\n newArray.push(sharedValue.data);\n }\n return { valid: true, data: newArray };\n }\n else if (aType === ZodParsedType.date && bType === ZodParsedType.date && +a === +b) {\n return { valid: true, data: a };\n }\n else {\n return { valid: false };\n }\n}\nexport class ZodIntersection extends ZodType {\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n const handleParsed = (parsedLeft, parsedRight) => {\n if (isAborted(parsedLeft) || isAborted(parsedRight)) {\n return INVALID;\n }\n const merged = mergeValues(parsedLeft.value, parsedRight.value);\n if (!merged.valid) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_intersection_types,\n });\n return INVALID;\n }\n if (isDirty(parsedLeft) || isDirty(parsedRight)) {\n status.dirty();\n }\n return { status: status.value, value: merged.data };\n };\n if (ctx.common.async) {\n return Promise.all([\n this._def.left._parseAsync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n }),\n this._def.right._parseAsync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n }),\n ]).then(([left, right]) => handleParsed(left, right));\n }\n else {\n return handleParsed(this._def.left._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n }), this._def.right._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n }));\n }\n }\n}\nZodIntersection.create = (left, right, params) => {\n return new ZodIntersection({\n left: left,\n right: right,\n typeName: ZodFirstPartyTypeKind.ZodIntersection,\n ...processCreateParams(params),\n });\n};\n// type ZodTupleItems = [ZodTypeAny, ...ZodTypeAny[]];\nexport class ZodTuple extends ZodType {\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.array) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.array,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n if (ctx.data.length < this._def.items.length) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n minimum: this._def.items.length,\n inclusive: true,\n exact: false,\n type: \"array\",\n });\n return INVALID;\n }\n const rest = this._def.rest;\n if (!rest && ctx.data.length > this._def.items.length) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n maximum: this._def.items.length,\n inclusive: true,\n exact: false,\n type: \"array\",\n });\n status.dirty();\n }\n const items = [...ctx.data]\n .map((item, itemIndex) => {\n const schema = this._def.items[itemIndex] || this._def.rest;\n if (!schema)\n return null;\n return schema._parse(new ParseInputLazyPath(ctx, item, ctx.path, itemIndex));\n })\n .filter((x) => !!x); // filter nulls\n if (ctx.common.async) {\n return Promise.all(items).then((results) => {\n return ParseStatus.mergeArray(status, results);\n });\n }\n else {\n return ParseStatus.mergeArray(status, items);\n }\n }\n get items() {\n return this._def.items;\n }\n rest(rest) {\n return new ZodTuple({\n ...this._def,\n rest,\n });\n }\n}\nZodTuple.create = (schemas, params) => {\n if (!Array.isArray(schemas)) {\n throw new Error(\"You must pass an array of schemas to z.tuple([ ... ])\");\n }\n return new ZodTuple({\n items: schemas,\n typeName: ZodFirstPartyTypeKind.ZodTuple,\n rest: null,\n ...processCreateParams(params),\n });\n};\nexport class ZodRecord extends ZodType {\n get keySchema() {\n return this._def.keyType;\n }\n get valueSchema() {\n return this._def.valueType;\n }\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.object) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.object,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n const pairs = [];\n const keyType = this._def.keyType;\n const valueType = this._def.valueType;\n for (const key in ctx.data) {\n pairs.push({\n key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, key)),\n value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key)),\n alwaysSet: key in ctx.data,\n });\n }\n if (ctx.common.async) {\n return ParseStatus.mergeObjectAsync(status, pairs);\n }\n else {\n return ParseStatus.mergeObjectSync(status, pairs);\n }\n }\n get element() {\n return this._def.valueType;\n }\n static create(first, second, third) {\n if (second instanceof ZodType) {\n return new ZodRecord({\n keyType: first,\n valueType: second,\n typeName: ZodFirstPartyTypeKind.ZodRecord,\n ...processCreateParams(third),\n });\n }\n return new ZodRecord({\n keyType: ZodString.create(),\n valueType: first,\n typeName: ZodFirstPartyTypeKind.ZodRecord,\n ...processCreateParams(second),\n });\n }\n}\nexport class ZodMap extends ZodType {\n get keySchema() {\n return this._def.keyType;\n }\n get valueSchema() {\n return this._def.valueType;\n }\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.map) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.map,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n const keyType = this._def.keyType;\n const valueType = this._def.valueType;\n const pairs = [...ctx.data.entries()].map(([key, value], index) => {\n return {\n key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, [index, \"key\"])),\n value: valueType._parse(new ParseInputLazyPath(ctx, value, ctx.path, [index, \"value\"])),\n };\n });\n if (ctx.common.async) {\n const finalMap = new Map();\n return Promise.resolve().then(async () => {\n for (const pair of pairs) {\n const key = await pair.key;\n const value = await pair.value;\n if (key.status === \"aborted\" || value.status === \"aborted\") {\n return INVALID;\n }\n if (key.status === \"dirty\" || value.status === \"dirty\") {\n status.dirty();\n }\n finalMap.set(key.value, value.value);\n }\n return { status: status.value, value: finalMap };\n });\n }\n else {\n const finalMap = new Map();\n for (const pair of pairs) {\n const key = pair.key;\n const value = pair.value;\n if (key.status === \"aborted\" || value.status === \"aborted\") {\n return INVALID;\n }\n if (key.status === \"dirty\" || value.status === \"dirty\") {\n status.dirty();\n }\n finalMap.set(key.value, value.value);\n }\n return { status: status.value, value: finalMap };\n }\n }\n}\nZodMap.create = (keyType, valueType, params) => {\n return new ZodMap({\n valueType,\n keyType,\n typeName: ZodFirstPartyTypeKind.ZodMap,\n ...processCreateParams(params),\n });\n};\nexport class ZodSet extends ZodType {\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.set) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.set,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n const def = this._def;\n if (def.minSize !== null) {\n if (ctx.data.size < def.minSize.value) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n minimum: def.minSize.value,\n type: \"set\",\n inclusive: true,\n exact: false,\n message: def.minSize.message,\n });\n status.dirty();\n }\n }\n if (def.maxSize !== null) {\n if (ctx.data.size > def.maxSize.value) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n maximum: def.maxSize.value,\n type: \"set\",\n inclusive: true,\n exact: false,\n message: def.maxSize.message,\n });\n status.dirty();\n }\n }\n const valueType = this._def.valueType;\n function finalizeSet(elements) {\n const parsedSet = new Set();\n for (const element of elements) {\n if (element.status === \"aborted\")\n return INVALID;\n if (element.status === \"dirty\")\n status.dirty();\n parsedSet.add(element.value);\n }\n return { status: status.value, value: parsedSet };\n }\n const elements = [...ctx.data.values()].map((item, i) => valueType._parse(new ParseInputLazyPath(ctx, item, ctx.path, i)));\n if (ctx.common.async) {\n return Promise.all(elements).then((elements) => finalizeSet(elements));\n }\n else {\n return finalizeSet(elements);\n }\n }\n min(minSize, message) {\n return new ZodSet({\n ...this._def,\n minSize: { value: minSize, message: errorUtil.toString(message) },\n });\n }\n max(maxSize, message) {\n return new ZodSet({\n ...this._def,\n maxSize: { value: maxSize, message: errorUtil.toString(message) },\n });\n }\n size(size, message) {\n return this.min(size, message).max(size, message);\n }\n nonempty(message) {\n return this.min(1, message);\n }\n}\nZodSet.create = (valueType, params) => {\n return new ZodSet({\n valueType,\n minSize: null,\n maxSize: null,\n typeName: ZodFirstPartyTypeKind.ZodSet,\n ...processCreateParams(params),\n });\n};\nexport class ZodFunction extends ZodType {\n constructor() {\n super(...arguments);\n this.validate = this.implement;\n }\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.function) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.function,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n function makeArgsIssue(args, error) {\n return makeIssue({\n data: args,\n path: ctx.path,\n errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), defaultErrorMap].filter((x) => !!x),\n issueData: {\n code: ZodIssueCode.invalid_arguments,\n argumentsError: error,\n },\n });\n }\n function makeReturnsIssue(returns, error) {\n return makeIssue({\n data: returns,\n path: ctx.path,\n errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), defaultErrorMap].filter((x) => !!x),\n issueData: {\n code: ZodIssueCode.invalid_return_type,\n returnTypeError: error,\n },\n });\n }\n const params = { errorMap: ctx.common.contextualErrorMap };\n const fn = ctx.data;\n if (this._def.returns instanceof ZodPromise) {\n // Would love a way to avoid disabling this rule, but we need\n // an alias (using an arrow function was what caused 2651).\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const me = this;\n return OK(async function (...args) {\n const error = new ZodError([]);\n const parsedArgs = await me._def.args.parseAsync(args, params).catch((e) => {\n error.addIssue(makeArgsIssue(args, e));\n throw error;\n });\n const result = await Reflect.apply(fn, this, parsedArgs);\n const parsedReturns = await me._def.returns._def.type\n .parseAsync(result, params)\n .catch((e) => {\n error.addIssue(makeReturnsIssue(result, e));\n throw error;\n });\n return parsedReturns;\n });\n }\n else {\n // Would love a way to avoid disabling this rule, but we need\n // an alias (using an arrow function was what caused 2651).\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const me = this;\n return OK(function (...args) {\n const parsedArgs = me._def.args.safeParse(args, params);\n if (!parsedArgs.success) {\n throw new ZodError([makeArgsIssue(args, parsedArgs.error)]);\n }\n const result = Reflect.apply(fn, this, parsedArgs.data);\n const parsedReturns = me._def.returns.safeParse(result, params);\n if (!parsedReturns.success) {\n throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]);\n }\n return parsedReturns.data;\n });\n }\n }\n parameters() {\n return this._def.args;\n }\n returnType() {\n return this._def.returns;\n }\n args(...items) {\n return new ZodFunction({\n ...this._def,\n args: ZodTuple.create(items).rest(ZodUnknown.create()),\n });\n }\n returns(returnType) {\n return new ZodFunction({\n ...this._def,\n returns: returnType,\n });\n }\n implement(func) {\n const validatedFunc = this.parse(func);\n return validatedFunc;\n }\n strictImplement(func) {\n const validatedFunc = this.parse(func);\n return validatedFunc;\n }\n static create(args, returns, params) {\n return new ZodFunction({\n args: (args ? args : ZodTuple.create([]).rest(ZodUnknown.create())),\n returns: returns || ZodUnknown.create(),\n typeName: ZodFirstPartyTypeKind.ZodFunction,\n ...processCreateParams(params),\n });\n }\n}\nexport class ZodLazy extends ZodType {\n get schema() {\n return this._def.getter();\n }\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n const lazySchema = this._def.getter();\n return lazySchema._parse({ data: ctx.data, path: ctx.path, parent: ctx });\n }\n}\nZodLazy.create = (getter, params) => {\n return new ZodLazy({\n getter: getter,\n typeName: ZodFirstPartyTypeKind.ZodLazy,\n ...processCreateParams(params),\n });\n};\nexport class ZodLiteral extends ZodType {\n _parse(input) {\n if (input.data !== this._def.value) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n received: ctx.data,\n code: ZodIssueCode.invalid_literal,\n expected: this._def.value,\n });\n return INVALID;\n }\n return { status: \"valid\", value: input.data };\n }\n get value() {\n return this._def.value;\n }\n}\nZodLiteral.create = (value, params) => {\n return new ZodLiteral({\n value: value,\n typeName: ZodFirstPartyTypeKind.ZodLiteral,\n ...processCreateParams(params),\n });\n};\nfunction createZodEnum(values, params) {\n return new ZodEnum({\n values,\n typeName: ZodFirstPartyTypeKind.ZodEnum,\n ...processCreateParams(params),\n });\n}\nexport class ZodEnum extends ZodType {\n _parse(input) {\n if (typeof input.data !== \"string\") {\n const ctx = this._getOrReturnCtx(input);\n const expectedValues = this._def.values;\n addIssueToContext(ctx, {\n expected: util.joinValues(expectedValues),\n received: ctx.parsedType,\n code: ZodIssueCode.invalid_type,\n });\n return INVALID;\n }\n if (!this._cache) {\n this._cache = new Set(this._def.values);\n }\n if (!this._cache.has(input.data)) {\n const ctx = this._getOrReturnCtx(input);\n const expectedValues = this._def.values;\n addIssueToContext(ctx, {\n received: ctx.data,\n code: ZodIssueCode.invalid_enum_value,\n options: expectedValues,\n });\n return INVALID;\n }\n return OK(input.data);\n }\n get options() {\n return this._def.values;\n }\n get enum() {\n const enumValues = {};\n for (const val of this._def.values) {\n enumValues[val] = val;\n }\n return enumValues;\n }\n get Values() {\n const enumValues = {};\n for (const val of this._def.values) {\n enumValues[val] = val;\n }\n return enumValues;\n }\n get Enum() {\n const enumValues = {};\n for (const val of this._def.values) {\n enumValues[val] = val;\n }\n return enumValues;\n }\n extract(values, newDef = this._def) {\n return ZodEnum.create(values, {\n ...this._def,\n ...newDef,\n });\n }\n exclude(values, newDef = this._def) {\n return ZodEnum.create(this.options.filter((opt) => !values.includes(opt)), {\n ...this._def,\n ...newDef,\n });\n }\n}\nZodEnum.create = createZodEnum;\nexport class ZodNativeEnum extends ZodType {\n _parse(input) {\n const nativeEnumValues = util.getValidEnumValues(this._def.values);\n const ctx = this._getOrReturnCtx(input);\n if (ctx.parsedType !== ZodParsedType.string && ctx.parsedType !== ZodParsedType.number) {\n const expectedValues = util.objectValues(nativeEnumValues);\n addIssueToContext(ctx, {\n expected: util.joinValues(expectedValues),\n received: ctx.parsedType,\n code: ZodIssueCode.invalid_type,\n });\n return INVALID;\n }\n if (!this._cache) {\n this._cache = new Set(util.getValidEnumValues(this._def.values));\n }\n if (!this._cache.has(input.data)) {\n const expectedValues = util.objectValues(nativeEnumValues);\n addIssueToContext(ctx, {\n received: ctx.data,\n code: ZodIssueCode.invalid_enum_value,\n options: expectedValues,\n });\n return INVALID;\n }\n return OK(input.data);\n }\n get enum() {\n return this._def.values;\n }\n}\nZodNativeEnum.create = (values, params) => {\n return new ZodNativeEnum({\n values: values,\n typeName: ZodFirstPartyTypeKind.ZodNativeEnum,\n ...processCreateParams(params),\n });\n};\nexport class ZodPromise extends ZodType {\n unwrap() {\n return this._def.type;\n }\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === false) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.promise,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n const promisified = ctx.parsedType === ZodParsedType.promise ? ctx.data : Promise.resolve(ctx.data);\n return OK(promisified.then((data) => {\n return this._def.type.parseAsync(data, {\n path: ctx.path,\n errorMap: ctx.common.contextualErrorMap,\n });\n }));\n }\n}\nZodPromise.create = (schema, params) => {\n return new ZodPromise({\n type: schema,\n typeName: ZodFirstPartyTypeKind.ZodPromise,\n ...processCreateParams(params),\n });\n};\nexport class ZodEffects extends ZodType {\n innerType() {\n return this._def.schema;\n }\n sourceType() {\n return this._def.schema._def.typeName === ZodFirstPartyTypeKind.ZodEffects\n ? this._def.schema.sourceType()\n : this._def.schema;\n }\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n const effect = this._def.effect || null;\n const checkCtx = {\n addIssue: (arg) => {\n addIssueToContext(ctx, arg);\n if (arg.fatal) {\n status.abort();\n }\n else {\n status.dirty();\n }\n },\n get path() {\n return ctx.path;\n },\n };\n checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx);\n if (effect.type === \"preprocess\") {\n const processed = effect.transform(ctx.data, checkCtx);\n if (ctx.common.async) {\n return Promise.resolve(processed).then(async (processed) => {\n if (status.value === \"aborted\")\n return INVALID;\n const result = await this._def.schema._parseAsync({\n data: processed,\n path: ctx.path,\n parent: ctx,\n });\n if (result.status === \"aborted\")\n return INVALID;\n if (result.status === \"dirty\")\n return DIRTY(result.value);\n if (status.value === \"dirty\")\n return DIRTY(result.value);\n return result;\n });\n }\n else {\n if (status.value === \"aborted\")\n return INVALID;\n const result = this._def.schema._parseSync({\n data: processed,\n path: ctx.path,\n parent: ctx,\n });\n if (result.status === \"aborted\")\n return INVALID;\n if (result.status === \"dirty\")\n return DIRTY(result.value);\n if (status.value === \"dirty\")\n return DIRTY(result.value);\n return result;\n }\n }\n if (effect.type === \"refinement\") {\n const executeRefinement = (acc) => {\n const result = effect.refinement(acc, checkCtx);\n if (ctx.common.async) {\n return Promise.resolve(result);\n }\n if (result instanceof Promise) {\n throw new Error(\"Async refinement encountered during synchronous parse operation. Use .parseAsync instead.\");\n }\n return acc;\n };\n if (ctx.common.async === false) {\n const inner = this._def.schema._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n });\n if (inner.status === \"aborted\")\n return INVALID;\n if (inner.status === \"dirty\")\n status.dirty();\n // return value is ignored\n executeRefinement(inner.value);\n return { status: status.value, value: inner.value };\n }\n else {\n return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((inner) => {\n if (inner.status === \"aborted\")\n return INVALID;\n if (inner.status === \"dirty\")\n status.dirty();\n return executeRefinement(inner.value).then(() => {\n return { status: status.value, value: inner.value };\n });\n });\n }\n }\n if (effect.type === \"transform\") {\n if (ctx.common.async === false) {\n const base = this._def.schema._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n });\n if (!isValid(base))\n return INVALID;\n const result = effect.transform(base.value, checkCtx);\n if (result instanceof Promise) {\n throw new Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);\n }\n return { status: status.value, value: result };\n }\n else {\n return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((base) => {\n if (!isValid(base))\n return INVALID;\n return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({\n status: status.value,\n value: result,\n }));\n });\n }\n }\n util.assertNever(effect);\n }\n}\nZodEffects.create = (schema, effect, params) => {\n return new ZodEffects({\n schema,\n typeName: ZodFirstPartyTypeKind.ZodEffects,\n effect,\n ...processCreateParams(params),\n });\n};\nZodEffects.createWithPreprocess = (preprocess, schema, params) => {\n return new ZodEffects({\n schema,\n effect: { type: \"preprocess\", transform: preprocess },\n typeName: ZodFirstPartyTypeKind.ZodEffects,\n ...processCreateParams(params),\n });\n};\nexport { ZodEffects as ZodTransformer };\nexport class ZodOptional extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType === ZodParsedType.undefined) {\n return OK(undefined);\n }\n return this._def.innerType._parse(input);\n }\n unwrap() {\n return this._def.innerType;\n }\n}\nZodOptional.create = (type, params) => {\n return new ZodOptional({\n innerType: type,\n typeName: ZodFirstPartyTypeKind.ZodOptional,\n ...processCreateParams(params),\n });\n};\nexport class ZodNullable extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType === ZodParsedType.null) {\n return OK(null);\n }\n return this._def.innerType._parse(input);\n }\n unwrap() {\n return this._def.innerType;\n }\n}\nZodNullable.create = (type, params) => {\n return new ZodNullable({\n innerType: type,\n typeName: ZodFirstPartyTypeKind.ZodNullable,\n ...processCreateParams(params),\n });\n};\nexport class ZodDefault extends ZodType {\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n let data = ctx.data;\n if (ctx.parsedType === ZodParsedType.undefined) {\n data = this._def.defaultValue();\n }\n return this._def.innerType._parse({\n data,\n path: ctx.path,\n parent: ctx,\n });\n }\n removeDefault() {\n return this._def.innerType;\n }\n}\nZodDefault.create = (type, params) => {\n return new ZodDefault({\n innerType: type,\n typeName: ZodFirstPartyTypeKind.ZodDefault,\n defaultValue: typeof params.default === \"function\" ? params.default : () => params.default,\n ...processCreateParams(params),\n });\n};\nexport class ZodCatch extends ZodType {\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n // newCtx is used to not collect issues from inner types in ctx\n const newCtx = {\n ...ctx,\n common: {\n ...ctx.common,\n issues: [],\n },\n };\n const result = this._def.innerType._parse({\n data: newCtx.data,\n path: newCtx.path,\n parent: {\n ...newCtx,\n },\n });\n if (isAsync(result)) {\n return result.then((result) => {\n return {\n status: \"valid\",\n value: result.status === \"valid\"\n ? result.value\n : this._def.catchValue({\n get error() {\n return new ZodError(newCtx.common.issues);\n },\n input: newCtx.data,\n }),\n };\n });\n }\n else {\n return {\n status: \"valid\",\n value: result.status === \"valid\"\n ? result.value\n : this._def.catchValue({\n get error() {\n return new ZodError(newCtx.common.issues);\n },\n input: newCtx.data,\n }),\n };\n }\n }\n removeCatch() {\n return this._def.innerType;\n }\n}\nZodCatch.create = (type, params) => {\n return new ZodCatch({\n innerType: type,\n typeName: ZodFirstPartyTypeKind.ZodCatch,\n catchValue: typeof params.catch === \"function\" ? params.catch : () => params.catch,\n ...processCreateParams(params),\n });\n};\nexport class ZodNaN extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.nan) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.nan,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n return { status: \"valid\", value: input.data };\n }\n}\nZodNaN.create = (params) => {\n return new ZodNaN({\n typeName: ZodFirstPartyTypeKind.ZodNaN,\n ...processCreateParams(params),\n });\n};\nexport const BRAND = Symbol(\"zod_brand\");\nexport class ZodBranded extends ZodType {\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n const data = ctx.data;\n return this._def.type._parse({\n data,\n path: ctx.path,\n parent: ctx,\n });\n }\n unwrap() {\n return this._def.type;\n }\n}\nexport class ZodPipeline extends ZodType {\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n if (ctx.common.async) {\n const handleAsync = async () => {\n const inResult = await this._def.in._parseAsync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n });\n if (inResult.status === \"aborted\")\n return INVALID;\n if (inResult.status === \"dirty\") {\n status.dirty();\n return DIRTY(inResult.value);\n }\n else {\n return this._def.out._parseAsync({\n data: inResult.value,\n path: ctx.path,\n parent: ctx,\n });\n }\n };\n return handleAsync();\n }\n else {\n const inResult = this._def.in._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n });\n if (inResult.status === \"aborted\")\n return INVALID;\n if (inResult.status === \"dirty\") {\n status.dirty();\n return {\n status: \"dirty\",\n value: inResult.value,\n };\n }\n else {\n return this._def.out._parseSync({\n data: inResult.value,\n path: ctx.path,\n parent: ctx,\n });\n }\n }\n }\n static create(a, b) {\n return new ZodPipeline({\n in: a,\n out: b,\n typeName: ZodFirstPartyTypeKind.ZodPipeline,\n });\n }\n}\nexport class ZodReadonly extends ZodType {\n _parse(input) {\n const result = this._def.innerType._parse(input);\n const freeze = (data) => {\n if (isValid(data)) {\n data.value = Object.freeze(data.value);\n }\n return data;\n };\n return isAsync(result) ? result.then((data) => freeze(data)) : freeze(result);\n }\n unwrap() {\n return this._def.innerType;\n }\n}\nZodReadonly.create = (type, params) => {\n return new ZodReadonly({\n innerType: type,\n typeName: ZodFirstPartyTypeKind.ZodReadonly,\n ...processCreateParams(params),\n });\n};\n////////////////////////////////////////\n////////////////////////////////////////\n////////// //////////\n////////// z.custom //////////\n////////// //////////\n////////////////////////////////////////\n////////////////////////////////////////\nfunction cleanParams(params, data) {\n const p = typeof params === \"function\" ? params(data) : typeof params === \"string\" ? { message: params } : params;\n const p2 = typeof p === \"string\" ? { message: p } : p;\n return p2;\n}\nexport function custom(check, _params = {}, \n/**\n * @deprecated\n *\n * Pass `fatal` into the params object instead:\n *\n * ```ts\n * z.string().custom((val) => val.length > 5, { fatal: false })\n * ```\n *\n */\nfatal) {\n if (check)\n return ZodAny.create().superRefine((data, ctx) => {\n const r = check(data);\n if (r instanceof Promise) {\n return r.then((r) => {\n if (!r) {\n const params = cleanParams(_params, data);\n const _fatal = params.fatal ?? fatal ?? true;\n ctx.addIssue({ code: \"custom\", ...params, fatal: _fatal });\n }\n });\n }\n if (!r) {\n const params = cleanParams(_params, data);\n const _fatal = params.fatal ?? fatal ?? true;\n ctx.addIssue({ code: \"custom\", ...params, fatal: _fatal });\n }\n return;\n });\n return ZodAny.create();\n}\nexport { ZodType as Schema, ZodType as ZodSchema };\nexport const late = {\n object: ZodObject.lazycreate,\n};\nexport var ZodFirstPartyTypeKind;\n(function (ZodFirstPartyTypeKind) {\n ZodFirstPartyTypeKind[\"ZodString\"] = \"ZodString\";\n ZodFirstPartyTypeKind[\"ZodNumber\"] = \"ZodNumber\";\n ZodFirstPartyTypeKind[\"ZodNaN\"] = \"ZodNaN\";\n ZodFirstPartyTypeKind[\"ZodBigInt\"] = \"ZodBigInt\";\n ZodFirstPartyTypeKind[\"ZodBoolean\"] = \"ZodBoolean\";\n ZodFirstPartyTypeKind[\"ZodDate\"] = \"ZodDate\";\n ZodFirstPartyTypeKind[\"ZodSymbol\"] = \"ZodSymbol\";\n ZodFirstPartyTypeKind[\"ZodUndefined\"] = \"ZodUndefined\";\n ZodFirstPartyTypeKind[\"ZodNull\"] = \"ZodNull\";\n ZodFirstPartyTypeKind[\"ZodAny\"] = \"ZodAny\";\n ZodFirstPartyTypeKind[\"ZodUnknown\"] = \"ZodUnknown\";\n ZodFirstPartyTypeKind[\"ZodNever\"] = \"ZodNever\";\n ZodFirstPartyTypeKind[\"ZodVoid\"] = \"ZodVoid\";\n ZodFirstPartyTypeKind[\"ZodArray\"] = \"ZodArray\";\n ZodFirstPartyTypeKind[\"ZodObject\"] = \"ZodObject\";\n ZodFirstPartyTypeKind[\"ZodUnion\"] = \"ZodUnion\";\n ZodFirstPartyTypeKind[\"ZodDiscriminatedUnion\"] = \"ZodDiscriminatedUnion\";\n ZodFirstPartyTypeKind[\"ZodIntersection\"] = \"ZodIntersection\";\n ZodFirstPartyTypeKind[\"ZodTuple\"] = \"ZodTuple\";\n ZodFirstPartyTypeKind[\"ZodRecord\"] = \"ZodRecord\";\n ZodFirstPartyTypeKind[\"ZodMap\"] = \"ZodMap\";\n ZodFirstPartyTypeKind[\"ZodSet\"] = \"ZodSet\";\n ZodFirstPartyTypeKind[\"ZodFunction\"] = \"ZodFunction\";\n ZodFirstPartyTypeKind[\"ZodLazy\"] = \"ZodLazy\";\n ZodFirstPartyTypeKind[\"ZodLiteral\"] = \"ZodLiteral\";\n ZodFirstPartyTypeKind[\"ZodEnum\"] = \"ZodEnum\";\n ZodFirstPartyTypeKind[\"ZodEffects\"] = \"ZodEffects\";\n ZodFirstPartyTypeKind[\"ZodNativeEnum\"] = \"ZodNativeEnum\";\n ZodFirstPartyTypeKind[\"ZodOptional\"] = \"ZodOptional\";\n ZodFirstPartyTypeKind[\"ZodNullable\"] = \"ZodNullable\";\n ZodFirstPartyTypeKind[\"ZodDefault\"] = \"ZodDefault\";\n ZodFirstPartyTypeKind[\"ZodCatch\"] = \"ZodCatch\";\n ZodFirstPartyTypeKind[\"ZodPromise\"] = \"ZodPromise\";\n ZodFirstPartyTypeKind[\"ZodBranded\"] = \"ZodBranded\";\n ZodFirstPartyTypeKind[\"ZodPipeline\"] = \"ZodPipeline\";\n ZodFirstPartyTypeKind[\"ZodReadonly\"] = \"ZodReadonly\";\n})(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));\n// requires TS 4.4+\nclass Class {\n constructor(..._) { }\n}\nconst instanceOfType = (\n// const instanceOfType = <T extends new (...args: any[]) => any>(\ncls, params = {\n message: `Input not instance of ${cls.name}`,\n}) => custom((data) => data instanceof cls, params);\nconst stringType = ZodString.create;\nconst numberType = ZodNumber.create;\nconst nanType = ZodNaN.create;\nconst bigIntType = ZodBigInt.create;\nconst booleanType = ZodBoolean.create;\nconst dateType = ZodDate.create;\nconst symbolType = ZodSymbol.create;\nconst undefinedType = ZodUndefined.create;\nconst nullType = ZodNull.create;\nconst anyType = ZodAny.create;\nconst unknownType = ZodUnknown.create;\nconst neverType = ZodNever.create;\nconst voidType = ZodVoid.create;\nconst arrayType = ZodArray.create;\nconst objectType = ZodObject.create;\nconst strictObjectType = ZodObject.strictCreate;\nconst unionType = ZodUnion.create;\nconst discriminatedUnionType = ZodDiscriminatedUnion.create;\nconst intersectionType = ZodIntersection.create;\nconst tupleType = ZodTuple.create;\nconst recordType = ZodRecord.create;\nconst mapType = ZodMap.create;\nconst setType = ZodSet.create;\nconst functionType = ZodFunction.create;\nconst lazyType = ZodLazy.create;\nconst literalType = ZodLiteral.create;\nconst enumType = ZodEnum.create;\nconst nativeEnumType = ZodNativeEnum.create;\nconst promiseType = ZodPromise.create;\nconst effectsType = ZodEffects.create;\nconst optionalType = ZodOptional.create;\nconst nullableType = ZodNullable.create;\nconst preprocessType = ZodEffects.createWithPreprocess;\nconst pipelineType = ZodPipeline.create;\nconst ostring = () => stringType().optional();\nconst onumber = () => numberType().optional();\nconst oboolean = () => booleanType().optional();\nexport const coerce = {\n string: ((arg) => ZodString.create({ ...arg, coerce: true })),\n number: ((arg) => ZodNumber.create({ ...arg, coerce: true })),\n boolean: ((arg) => ZodBoolean.create({\n ...arg,\n coerce: true,\n })),\n bigint: ((arg) => ZodBigInt.create({ ...arg, coerce: true })),\n date: ((arg) => ZodDate.create({ ...arg, coerce: true })),\n};\nexport { anyType as any, arrayType as array, bigIntType as bigint, booleanType as boolean, dateType as date, discriminatedUnionType as discriminatedUnion, effectsType as effect, enumType as enum, functionType as function, instanceOfType as instanceof, intersectionType as intersection, lazyType as lazy, literalType as literal, mapType as map, nanType as nan, nativeEnumType as nativeEnum, neverType as never, nullType as null, nullableType as nullable, numberType as number, objectType as object, oboolean, onumber, optionalType as optional, ostring, pipelineType as pipeline, preprocessType as preprocess, promiseType as promise, recordType as record, setType as set, strictObjectType as strictObject, stringType as string, symbolType as symbol, effectsType as transformer, tupleType as tuple, undefinedType as undefined, unionType as union, unknownType as unknown, voidType as void, };\nexport const NEVER = INVALID;\n", "export var errorUtil;\n(function (errorUtil) {\n errorUtil.errToObj = (message) => typeof message === \"string\" ? { message } : message || {};\n // biome-ignore lint:\n errorUtil.toString = (message) => typeof message === \"string\" ? message : message?.message;\n})(errorUtil || (errorUtil = {}));\n", "import * as z from \"./external.js\";\nexport * from \"./external.js\";\nexport { z };\nexport default z;\n", "import z3 from \"./v3/index.js\";\nexport * from \"./v3/index.js\";\nexport default z3;\n", "import Logger from './Mappedin.Logger';\n\nexport * from './errors';\nexport * from './utils';\nexport * from './async';\nexport * from './assert';\nexport * from './random-id';\nexport { PubSub } from './pubsub';\nexport { SafeStorage, SESSION_ID_KEY, DEVICE_ID_KEY } from './storage';\nexport { Logger };\nexport * from './color';\nexport * from './interpolate';\nexport * from './type-utils';\n// Do not import these test utils due to circular import errors, these should be imported directly in tests\n// export * from './mapData-test-utils';\n", "import { MI_ERROR_LABEL } from '../common/Mappedin.Logger';\n\nfunction formatMessage(message: string, label: string): string {\n\treturn `${label} ${message}`;\n}\n\n/**\n * @internal\n */\nexport class MappedinError extends Error {\n\tconstructor(message: string, label = MI_ERROR_LABEL) {\n\t\tsuper(formatMessage(message, label));\n\t\tthis.name = 'MappedinError';\n\t}\n}\n\n/**\n * @internal\n */\nexport class MappedinRenderError extends MappedinError {\n\tconstructor(message: string, label = MI_ERROR_LABEL) {\n\t\tsuper(message, label);\n\t\tthis.name = 'MappedinRenderError';\n\t}\n}\n", "/**\n * Options for assertExists function\n */\nexport interface AssertExistsOptions {\n\t/** Name of the value being checked (for better error messages) */\n\tvalueName?: string;\n\t/** Custom error message to use instead of the default */\n\tcustomMessage?: string;\n\t/** Error class to use (defaults to AssertionError) */\n\terrorClass?: new (message: string) => Error;\n\t/** Whether to capture and format the stack trace (defaults to true) */\n\tcaptureStackTrace?: boolean;\n}\n\n/**\n * Custom error class for assertions to make stack traces more identifiable\n */\nexport class AssertionError extends Error {\n\tname = 'AssertionError';\n\n\tconstructor(message: string) {\n\t\tsuper(message);\n\n\t\t// Maintains proper stack trace for where the error was thrown (only in V8)\n\t\tif (Error.captureStackTrace) {\n\t\t\tError.captureStackTrace(this, AssertionError);\n\t\t}\n\t}\n}\n\n/**\n * Asserts that a value is not null or undefined.\n * @param value The value to check\n * @param options Optional configuration for the assertion\n */\nexport function assertExists<T>(value: T, options?: AssertExistsOptions): asserts value is NonNullable<T> {\n\tif (value == null) {\n\t\t// Create a descriptive error message\n\t\tlet errorMessage: string;\n\t\tif (options?.customMessage) {\n\t\t\terrorMessage = options.customMessage;\n\t\t} else {\n\t\t\tconst nameInfo = options?.valueName ? `'${options.valueName}'` : 'value';\n\t\t\terrorMessage = `Expected ${nameInfo} to be defined, but received ${value}`;\n\t\t}\n\n\t\t// Create the error with the appropriate error class\n\t\tconst ErrorClass = options?.errorClass || AssertionError;\n\t\tconst error = new ErrorClass(errorMessage);\n\n\t\t// Capture stack trace to hide the assertExists call itself\n\t\tif (options?.captureStackTrace !== false && Error.captureStackTrace) {\n\t\t\tError.captureStackTrace(error, assertExists);\n\t\t}\n\n\t\tthrow error;\n\t}\n}\n\n/**\n * Asserts that an object is an instance of a specific class.\n * @param obj The object to check\n * @param className The class constructor to check against\n * @param errorMessage Optional custom error message\n */\nexport function assertInstanceOf<T>(\n\tobj: unknown,\n\tclassName: new (...args: any[]) => T,\n\terrorMessage?: string,\n): asserts obj is T {\n\tif (!(obj instanceof className)) {\n\t\tconst defaultMessage = `${obj} should be an instance of ${className.name} but it's a ${obj?.constructor.name}`;\n\t\tthrow new Error(errorMessage || defaultMessage);\n\t}\n}\n\n/**\n * Asserts that an object has a specific 'type' property value.\n * @param obj The object to check\n * @param expectedType The expected value of the 'type' property\n * @param errorMessage Optional custom error message\n */\nexport function assertType<T extends { type: string }, P extends T['type']>(\n\tobj: T | undefined,\n\texpectedType: P,\n\terrorMessage?: string,\n): asserts obj is Extract<T, { type: P }> {\n\tassertExists(obj);\n\tif (obj?.type !== expectedType) {\n\t\tconst defaultMessage = `Expected type ${expectedType} but got ${obj?.type}`;\n\t\tthrow new Error(errorMessage ?? defaultMessage);\n\t}\n}\n\n/**\n * Retrieves an entity from a map and asserts it is of a specific type.\n * @param map The map containing entities\n * @param entityId The ID of the entity to retrieve\n * @param expectedType The class constructor the entity should be an instance of\n * @returns The entity cast to the expected type\n */\nexport function getEntityAsType<T>(\n\tmap: Map<string | number, unknown>,\n\tentityId: string | number,\n\texpectedType: new (...args: any[]) => T,\n): T {\n\tconst entity = map.get(entityId);\n\tassertInstanceOf(entity, expectedType);\n\n\treturn entity;\n}\n", "const SLICE_POSITIONS = [0, 4, 6, 8, 10] as const;\n\n/**\n * Returns a UUIDv4-like ID without relying on a CSPRNG as we don't need it for these purposes.\n * @hidden\n */\nexport const randomId = () => {\n\tconst array: number[] = new Array(16).fill(0);\n\tlet seed = Math.random() * 0x100000000;\n\n\tfor (let i = 0; i < array.length; i++) {\n\t\tif (i > 0 && (i & 0x03) === 0) {\n\t\t\tseed = Math.random() * 0x100000000;\n\t\t}\n\t\tarray[i] = (seed >>> ((i & 0x03) << 3)) & 0xff;\n\t}\n\tconst hexArray = array.map(n => n.toString(16).padStart(2, '0'));\n\t// UUID's 3rd segment must start with a 4\n\n\thexArray[6] = '4' + hexArray[6][1];\n\t// UUID's 4th segment (for variant 1) must be an 8, 9, a or b\n\t// (due to needing the leading 2 bits in binary to be 10).\n\thexArray[8] = ['8', '9', 'a', 'b'].includes(hexArray[7][0]) ? hexArray[7] : 'a' + hexArray[7][1];\n\n\treturn SLICE_POSITIONS.map((v, i) =>\n\t\thexArray.slice(v, i === SLICE_POSITIONS.length - 1 ? undefined : SLICE_POSITIONS[i + 1]).join(''),\n\t).join('-');\n};\n\nexport function cyrb53(str: string, seed = 0): number {\n\tlet h1 = 0xdeadbeef ^ seed;\n\tlet h2 = 0x41c6ce57 ^ seed;\n\tfor (let i = 0, ch; i < str.length; i++) {\n\t\tch = str.charCodeAt(i);\n\t\th1 = Math.imul(h1 ^ ch, 2654435761);\n\t\th2 = Math.imul(h2 ^ ch, 1597334677);\n\t}\n\n\th1 = Math.imul(h1 ^ (h1 >>> 16), 2246822507) ^ Math.imul(h2 ^ (h2 >>> 13), 3266489909);\n\th2 = Math.imul(h2 ^ (h2 >>> 16), 2246822507) ^ Math.imul(h1 ^ (h1 >>> 13), 3266489909);\n\n\treturn 4294967296 * (2097151 & h2) + (h1 >>> 0);\n}\n", "/**\n * Generic PubSub class implementing the Publish-Subscribe pattern for event handling.\n *\n * @template EVENT_PAYLOAD - The type of the event payload.\n * @template EVENT - The type of the event.\n */\nexport class PubSub<EVENT_PAYLOAD, EVENT extends keyof EVENT_PAYLOAD = keyof EVENT_PAYLOAD> {\n\t/**\n\t * @private\n\t * @internal\n\t */\n\t_subscribers: any = {};\n\n\t/**\n\t * @private\n\t * @internal\n\t */\n\tpublish<EVENT_NAME extends EVENT>(eventName: EVENT_NAME, data?: EVENT_PAYLOAD[EVENT_NAME]) {\n\t\tif (!this._subscribers || !this._subscribers[eventName]) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._subscribers[eventName]!.forEach(function (fn) {\n\t\t\tif (typeof fn !== 'function') {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tfn(data);\n\t\t});\n\t}\n\n\t/**\n\t * Subscribe a function to an event.\n\t *\n\t * @param eventName An event name which, when fired, will call the provided\n\t * function.\n\t * @param fn A callback that gets called when the corresponding event is fired. The\n\t * callback will get passed an argument with a type that's one of event payloads.\n\t * @example\n\t * // Subscribe to the 'click' event\n\t * const handler = (event) => {\n\t * const { coordinate } = event;\n\t * const { latitude, longitude } = coordinate;\n\t * \tconsole.log(`Map was clicked at ${latitude}, ${longitude}`);\n\t * };\n\t * map.on('click', handler);\n\t */\n\ton<EVENT_NAME extends EVENT>(\n\t\teventName: EVENT_NAME,\n\t\tfn: (\n\t\t\tpayload: EVENT_PAYLOAD[EVENT_NAME] extends {\n\t\t\t\tdata: null;\n\t\t\t}\n\t\t\t\t? EVENT_PAYLOAD[EVENT_NAME]['data']\n\t\t\t\t: EVENT_PAYLOAD[EVENT_NAME],\n\t\t) => void,\n\t) {\n\t\tif (!this._subscribers) {\n\t\t\tthis._subscribers = {};\n\t\t}\n\t\tthis._subscribers[eventName] = this._subscribers[eventName] || [];\n\t\tthis._subscribers[eventName]!.push(fn);\n\t}\n\n\t/**\n\t * Unsubscribe a function previously subscribed with {@link on}\n\t *\n\t * @param eventName An event name to which the provided function was previously\n\t * subscribed.\n\t * @param fn A function that was previously passed to {@link on}. The function must\n\t * have the same reference as the function that was subscribed.\n\t * @example\n\t * // Unsubscribe from the 'click' event\n\t * const handler = (event) => {\n\t * \tconsole.log('Map was clicked', event);\n\t * };\n\t * map.off('click', handler);\n\t */\n\toff<EVENT_NAME extends EVENT>(\n\t\teventName: EVENT_NAME,\n\t\tfn: (\n\t\t\tpayload: EVENT_PAYLOAD[EVENT_NAME] extends {\n\t\t\t\tdata: null;\n\t\t\t}\n\t\t\t\t? EVENT_PAYLOAD[EVENT_NAME]['data']\n\t\t\t\t: EVENT_PAYLOAD[EVENT_NAME],\n\t\t) => void,\n\t) {\n\t\tif (!this._subscribers || this._subscribers[eventName] == null) {\n\t\t\treturn;\n\t\t}\n\t\tconst itemIdx = this._subscribers[eventName]!.indexOf(fn);\n\n\t\tif (itemIdx !== -1) {\n\t\t\tthis._subscribers[eventName]!.splice(itemIdx, 1);\n\t\t}\n\t}\n\t/**\n\t * @private\n\t * @internal\n\t */\n\tdestroy() {\n\t\tthis._subscribers = {};\n\t}\n}\n", "import { randomId } from './random-id';\n\nexport const SESSION_DATA_KEY = 'mi-session-data' as const;\nexport const LOCAL_DATA_KEY = 'mi-local-data' as const;\n\nexport const SESSION_ID_KEY = 'id' as const;\nexport const DEVICE_ID_KEY = 'deviceId' as const;\n\nexport type SessionData = {\n\t[SESSION_ID_KEY]: string;\n\t[prop: string]: unknown;\n};\n\nexport type LocalData = {\n\t[DEVICE_ID_KEY]: string;\n\t[prop: string]: unknown;\n};\n\nexport class SafeStorage {\n\t// Store these in objects so they exist even if storage doesn't\n\tstatic #instance?: SafeStorage;\n\t#sessionData: SessionData;\n\t#localData: LocalData;\n\n\tprivate constructor() {\n\t\t// Using new keys for session + user data to avoid collisions.\n\t\ttry {\n\t\t\tconst sessionData = sessionStorage.getItem(SESSION_DATA_KEY);\n\n\t\t\tif (sessionData) {\n\t\t\t\tthis.#sessionData = JSON.parse(sessionData);\n\t\t\t} else {\n\t\t\t\tthis.#sessionData = { [SESSION_ID_KEY]: randomId() };\n\t\t\t}\n\t\t} catch {\n\t\t\tthis.#sessionData = { [SESSION_ID_KEY]: randomId() };\n\t\t}\n\n\t\t// Using new keys for session + user data to avoid collisions.\n\t\ttry {\n\t\t\tconst localData = localStorage.getItem(LOCAL_DATA_KEY);\n\n\t\t\tif (localData) {\n\t\t\t\tthis.#localData = JSON.parse(localData);\n\t\t\t} else {\n\t\t\t\tthis.#localData = { [DEVICE_ID_KEY]: randomId() };\n\t\t\t}\n\t\t} catch {\n\t\t\tthis.#localData = { [DEVICE_ID_KEY]: randomId() };\n\t\t}\n\n\t\t// Just in case parsing either of these was successful, but for some\n\t\t// reason the parsed data does not contain an id/deviceId, we populate\n\t\t// with a random ID here.\n\t\tif (!this.#sessionData[SESSION_ID_KEY]) {\n\t\t\tthis.#sessionData[SESSION_ID_KEY] = randomId();\n\t\t}\n\t\tif (!this.#localData[DEVICE_ID_KEY]) {\n\t\t\tthis.#localData[DEVICE_ID_KEY] = randomId();\n\t\t}\n\t}\n\n\tstatic getInstance() {\n\t\tif (!this.#instance) {\n\t\t\tthis.#instance = new SafeStorage();\n\t\t}\n\n\t\treturn this.#instance;\n\t}\n\n\tstatic ___clearInstance() {\n\t\tthis.#instance = undefined;\n\t}\n\n\tsaveSessionData<T extends keyof SessionData>(key: T, data: SessionData[T]): boolean {\n\t\tthis.#sessionData[key] = data;\n\t\ttry {\n\t\t\tsessionStorage.setItem(SESSION_DATA_KEY, JSON.stringify(this.#sessionData));\n\n\t\t\treturn true;\n\t\t} catch {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tloadSessionData<T extends keyof SessionData>(\n\t\tkey: T,\n\t): SessionData[T] extends undefined ? SessionData[T] | undefined : SessionData[T] {\n\t\tconst itemData = this.#sessionData[key];\n\n\t\tif (itemData != null) {\n\t\t\treturn itemData;\n\t\t}\n\n\t\treturn undefined;\n\t}\n\n\tsaveLocalData<T extends keyof LocalData>(key: T, data: LocalData[T]): boolean {\n\t\tthis.#localData[key] = data;\n\t\ttry {\n\t\t\tlocalStorage.setItem(LOCAL_DATA_KEY, JSON.stringify(this.#localData));\n\n\t\t\treturn true;\n\t\t} catch {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tloadLocalData<T extends keyof LocalData>(\n\t\tkey: T,\n\t): LocalData[T] extends undefined ? LocalData[T] | undefined : LocalData[T] {\n\t\tconst itemData = this.#localData[key];\n\n\t\tif (itemData != null) {\n\t\t\treturn itemData;\n\t\t}\n\n\t\treturn undefined;\n\t}\n}\n", "import { Color } from 'three';\n\nexport const X11_COLOR_NAMES_SET = new Set(Object.keys(Color.NAMES));\n\nlet colorInstance: Color | undefined;\nfunction getColorInstance() {\n\tif (colorInstance == null) {\n\t\tcolorInstance = new Color();\n\t}\n\treturn colorInstance;\n}\n\n/**\n * Check if a string is a valid X11 color name, as defined in ThreeJS Color.NAMES\n * @param color - The color string to check.\n * @returns True if the color is a valid X11 color name, false otherwise.\n */\nexport const isX11Color = (color: string): boolean => {\n\treturn X11_COLOR_NAMES_SET.has(color.toLowerCase());\n};\n\n/**\n * Check if a string is a valid hex color.\n * @param color - The color string to check.\n * @returns True if the color is a valid hex color, false otherwise.\n */\nexport const isHexColor = (color: string): boolean => {\n\t/**\n\t * Check for valid hex colors using ThreeJS criteria\n\t * Adapted from https://github.com/mrdoob/three.js/blob/master/src/math/Color.js\n\t */\n\tif (!color.startsWith('#')) {\n\t\treturn false;\n\t}\n\n\tconst hex = color.slice(1);\n\n\t// Valid hex colors are 3 or 6 characters long\n\tif (hex.length !== 3 && hex.length !== 6) {\n\t\treturn false;\n\t}\n\n\t// Check if all characters are valid hex digits\n\tfor (let i = 0; i < hex.length; i++) {\n\t\tif (!((hex[i] >= '0' && hex[i] <= '9') || (hex[i] >= 'A' && hex[i] <= 'F') || (hex[i] >= 'a' && hex[i] <= 'f'))) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\treturn true;\n};\n\n/**\n * Check if a string is a valid RGB/RGBA color.\n * @param color - The color string to check.\n * @returns True if the color is a valid RGB/RGBA color, false otherwise.\n */\nexport const isRgbColor = (color: string): boolean => {\n\t/**\n\t * Check for valid RGB/RGBA colors using ThreeJS criteria\n\t * Adapted from https://github.com/mrdoob/three.js/blob/master/src/math/Color.js\n\t */\n\tif (!color.startsWith('rgb(') && !color.startsWith('rgba(')) {\n\t\treturn false;\n\t}\n\n\t// Extract components between parentheses\n\tconst openParen = color.indexOf('(');\n\tconst closeParen = color.lastIndexOf(')');\n\n\tif (openParen === -1 || closeParen === -1 || closeParen <= openParen || closeParen !== color.length - 1) {\n\t\treturn false;\n\t}\n\n\tconst components = color.slice(openParen + 1, closeParen).split(',');\n\n\t// RGB should have 3 components, RGBA should have 4\n\tif (components.length !== 3 && components.length !== 4) {\n\t\treturn false;\n\t}\n\n\t// Check if all components are valid\n\tfor (let i = 0; i < components.length; i++) {\n\t\tconst component = components[i].trim();\n\n\t\tif (i < 3) {\n\t\t\t// RGB components can be numbers (0-255) or percentages (0-100%)\n\t\t\tif (component.endsWith('%')) {\n\t\t\t\tconst value = parseFloat(component.slice(0, -1));\n\t\t\t\tif (isNaN(value) || value < 0 || value > 100) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst value = parseInt(component, 10);\n\t\t\t\tif (isNaN(value) || value < 0 || value > 255) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\t// Alpha component should be a decimal between 0 and 1\n\t\t\tconst value = parseFloat(component);\n\t\t\tif (isNaN(value) || value < 0 || value > 1) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn true;\n};\n\n/**\n * Check if a string is a valid HSL/HSLA color.\n * @param color - The color string to check.\n * @returns True if the color is a valid HSL/HSLA color, false otherwise.\n */\nexport const isHslColor = (color: string): boolean => {\n\t/**\n\t * Check for valid HSL/HSLA colors using ThreeJS criteria\n\t * Adapted from https://github.com/mrdoob/three.js/blob/master/src/math/Color.js\n\t */\n\tif (!color.startsWith('hsl(') && !color.startsWith('hsla(')) {\n\t\treturn false;\n\t}\n\n\t// Extract components between parentheses\n\tconst openParen = color.indexOf('(');\n\tconst closeParen = color.lastIndexOf(')');\n\n\tif (openParen === -1 || closeParen === -1 || closeParen <= openParen || closeParen !== color.length - 1) {\n\t\treturn false;\n\t}\n\n\tconst components = color.slice(openParen + 1, closeParen).split(',');\n\n\t// HSL should have 3 components, HSLA should have 4\n\tif (components.length !== 3 && components.length !== 4) {\n\t\treturn false;\n\t}\n\n\t// Check if all components are valid\n\tfor (let i = 0; i < components.length; i++) {\n\t\tconst component = components[i].trim();\n\n\t\tif (i === 0) {\n\t\t\t// Hue: any number (can be > 360, will wrap around)\n\t\t\tconst value = parseFloat(component);\n\t\t\tif (isNaN(value)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t} else if (i < 3) {\n\t\t\t// Saturation and Lightness: percentages (0-100%)\n\t\t\tif (!component.endsWith('%')) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tconst value = parseFloat(component.slice(0, -1));\n\t\t\tif (isNaN(value) || value < 0 || value > 100) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t} else {\n\t\t\t// Alpha component should be a decimal between 0 and 1\n\t\t\tconst value = parseFloat(component);\n\t\t\tif (isNaN(value) || value < 0 || value > 1) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn true;\n};\n\n/**\n * Check if a string is a valid ThreeJS color. Can be hex, rgb, rgba, hsl, hsla, or X11 color name.\n * @param color - The color string to check.\n * @returns True if the color is a valid ThreeJS color, false otherwise.\n */\nexport const isColor = (color: string): boolean => {\n\tif (color == null || typeof color !== 'string') {\n\t\treturn false;\n\t}\n\n\t/**\n\t * Check for valid hex colors\n\t */\n\tif (isHexColor(color)) {\n\t\treturn true;\n\t}\n\n\t/**\n\t * Check for valid RGB/RGBA colors\n\t */\n\tif (isRgbColor(color)) {\n\t\treturn true;\n\t}\n\n\t/**\n\t * Check for valid HSL/HSLA colors\n\t */\n\tif (isHslColor(color)) {\n\t\treturn true;\n\t}\n\n\t/**\n\t * Check for valid X11 color names\n\t */\n\tif (isX11Color(color)) {\n\t\treturn true;\n\t}\n\n\treturn false;\n};\n\n/**\n * Convert a color string to an array of RGB values.\n * @param color - The color string to convert.\n * @returns The array of RGB values.\n */\nexport const stringToRgbArray = (color: string): [number, number, number] => {\n\tconst instance = getColorInstance();\n\tinstance.set(color);\n\n\treturn [instance.r, instance.g, instance.b];\n};\n\n/**\n * Convert an array of RGB values to a hex string.\n * @param rgb - The array of RGB values to convert.\n * @returns The hex string representation of the RGB values.\n */\nexport const rgbArrayToString = (rgb: [number, number, number]): string => {\n\tconst instance = getColorInstance();\n\tinstance.set(rgb[0], rgb[1], rgb[2]);\n\n\treturn '#' + instance.getHexString();\n};\n", "import { MappedinError } from './errors';\nimport { z } from 'zod';\n\nexport const easingCurveSchema = z.enum(['ease-in', 'ease-out', 'ease-in-out', 'linear']);\nexport type EasingCurve = z.infer<typeof easingCurveSchema>;\n\nexport const linearEase = (t: number): number => t;\n\nexport const quadEaseIn = (t: number): number => t * t;\n\nexport const easeIn = (x: number) => 1 - Math.cos((x * Math.PI) / 2);\n\nexport const quadEaseOut = (t: number): number => 1 - (1 - t) * (1 - t);\n\nconst InterpolationEasingFns: { [key in EasingCurve]: (t: number) => number } = {\n\tlinear: linearEase,\n\t'ease-in': quadEaseIn,\n\t'ease-out': quadEaseOut,\n\t'ease-in-out': easeIn,\n};\n\nexport function interpolate(\n\tvalue: number,\n\tinputMin: number,\n\tinputMax: number,\n\toutputMin: number,\n\toutputMax: number,\n\teaseFunc: EasingCurve | ((t: number) => number) = linearEase,\n): number {\n\t// Handle zero range case\n\tif (inputMin === inputMax) {\n\t\treturn outputMax;\n\t}\n\n\t// Clamp x to the input range [a, b]\n\tvalue = Math.max(inputMin, Math.min(value, inputMax));\n\n\t// Normalize x to the range [0, 1]\n\tconst t = (value - Math.min(inputMin, inputMax)) / Math.abs(inputMax - inputMin);\n\n\t// Apply the easing function to t\n\tconst easedT = typeof easeFunc === 'function' ? easeFunc(t) : InterpolationEasingFns[easeFunc](t);\n\n\t// Interpolate the result y in the output range [c, d]\n\tconst y = outputMin + easedT * (outputMax - outputMin);\n\n\treturn y;\n}\n\n/**\n * Return the closest range within an ordered set of values that a given value falls within. If the given value is\n * exactly within a range, returns the index of the range. If the given value is less than the first value in the range,\n * returns 0. If the given value is greater than the last value in the range, returns the last range (lastIndex - 1).\n */\nexport function getInterpolationBreakpoint(value: number, range: number[]): number {\n\tlet breakpoint = 0;\n\tif (range.length < 2) {\n\t\treturn breakpoint;\n\t}\n\tconst increasing = range[0] < range[1];\n\tconst comparator = increasing ? (a, b) => a > b : (a, b) => a < b;\n\twhile (breakpoint < range.length - 1 && comparator(value, range[breakpoint + 1])) {\n\t\tbreakpoint++;\n\t}\n\n\t// Make sure to return a breakpoint within the ranges; there are only n-1 ranges in an n length array\n\treturn breakpoint > range.length - 2 ? Math.max(0, range.length - 2) : breakpoint;\n}\n\nexport function interpolateMulti(\n\tvalue: number,\n\tinputRange: number[],\n\toutputRange: number[],\n\teaseFunc: EasingCurve | ((t: number) => number) = 'ease-in',\n): number {\n\t// Ensure inputRange and outputRange have the same number of values\n\tif (inputRange.length !== outputRange.length) {\n\t\tthrow new MappedinError('Input and output ranges must have the same number of values.');\n\t}\n\n\t// Clamp x to the input range [a, b]\n\tvalue = Math.max(inputRange[0], Math.min(value, inputRange[inputRange.length - 1]));\n\n\t// Find the segment in which 'value' falls\n\tconst segment = getInterpolationBreakpoint(value, inputRange);\n\n\t// Normalize x within the segment\n\tconst t = (value - inputRange[segment]) / (inputRange[segment + 1] - inputRange[segment]);\n\n\t// Apply the easing function to t\n\tconst easedT = typeof easeFunc === 'function' ? easeFunc(t) : InterpolationEasingFns[easeFunc](t);\n\n\t// Interpolate the result y in the output range [c, d]\n\tconst y = outputRange[segment] + easedT * (outputRange[segment + 1] - outputRange[segment]);\n\n\treturn y;\n}\n", "import type { SetOptional } from 'type-fest';\n\ntype Primitive = string | number | boolean | null | undefined;\nexport type PartialExcept<T, K extends string> = {\n\t[P in keyof T as P extends K ? P : never]: T[P];\n} & {\n\t[P in keyof T as P extends K ? never : P]?: T[P] extends Primitive\n\t\t? T[P]\n\t\t: T[P] extends (infer U)[]\n\t\t? PartialExcept<U, K>[]\n\t\t: PartialExcept<T[P], K>;\n};\n\n/**\n * Utility type that extracts nested values matching a specific type with recursion depth limit\n * @example\n * type A = ExtractDeep<{ a: { b: string; c: number; }; d: string; e: number; }, number>;\n * // { a: { c: number; } e: number; }\n */\nexport type ExtractDeep<T, U, Depth extends readonly number[] = []> = Depth['length'] extends 3\n\t? any\n\t: {\n\t\t\t[K in keyof T as T[K] extends U\n\t\t\t\t? K\n\t\t\t\t: T[K] extends object | undefined\n\t\t\t\t? ExtractDeep<NonNullable<T[K]>, U, [...Depth, 0]> extends never\n\t\t\t\t\t? never\n\t\t\t\t\t: K\n\t\t\t\t: never]: T[K] extends object | undefined\n\t\t\t\t? undefined extends T[K]\n\t\t\t\t\t? ExtractDeep<NonNullable<T[K]>, U, [...Depth, 0]> | undefined\n\t\t\t\t\t: ExtractDeep<NonNullable<T[K]>, U, [...Depth, 0]>\n\t\t\t\t: T[K] extends U\n\t\t\t\t? T[K]\n\t\t\t\t: never;\n\t };\n\n/**\n * Utility type that makes all properties of a type required, but allows undefined values\n * to satisfy the required type.\n * https://medium.com/terria/typescript-transforming-optional-properties-to-required-properties-that-may-be-undefined-7482cb4e1585\n * @example\n * type A = Complete<{ a: string; b: number; c: undefined; }>;\n * // { a: string; b: number; c: undefined; }\n */\nexport type Complete<T> = {\n\t[P in keyof Required<T>]: Pick<T, P> extends Required<Pick<T, P>> ? T[P] : T[P] | undefined;\n};\n\n/**\n * Utility type that makes all properties required except for the ones specified in the second argument.\n * @example\n * type A = RequiredExcept<{ a: string; b: number; c: undefined; }, 'c'>;\n * // { a: string; b: number; c?: undefined; }\n */\nexport type RequiredExcept<T, K extends keyof T> = SetOptional<Required<T>, K>;\n", "export function normalizeAngle(angle: number): number {\n\treturn ((angle % (2 * Math.PI)) + 2 * Math.PI) % (2 * Math.PI);\n}\n", "import {\n\tLngLat,\n\tLngLatBounds,\n\ttype MercatorCoordinate,\n\ttype CustomLayerInterface,\n} from '../../../packages/outdoor-context-v5';\nimport type { BufferGeometry, Object3D, PerspectiveCamera, Camera as THREECamera } from 'three';\nimport { BoxGeometry, Matrix4, Mesh, MeshBasicMaterial, Vector2, Vector3, Box2 } from 'three';\nimport { GroupContainerObject3D } from '../entities/group-container';\nimport type { Geometry2D } from '../entities/geometry2d';\nimport { Geometry2DObject3D } from '../entities/geometry2d';\nimport type { Geometry3DTypes } from '../entities/geometry3d';\nimport { Geometry3DObject3D } from '../entities/geometry3d';\nimport type { Position, RendererState } from '../renderer';\nimport { MAPPEDIN_LAYER_ID } from './constants';\nimport { EARTH_RADIUS_M } from '@packages/internal/common/constants';\nimport { GeometryGroupObject3D } from '../entities/geometry-group';\nexport { isFiniteBox } from '@packages/internal/common';\nimport type { Position as GeoJSONPosition } from 'geojson';\n\nexport function cartesianToGeographic(centerLat: number, centerLon: number, x: number, y: number) {\n\t// Earth's radius in meters\n\n\t// Convert meters to radians\n\tconst latRadian = centerLat * (Math.PI / 180);\n\n\t// Calculate the new latitude\n\tconst latDelta = y / EARTH_RADIUS_M;\n\tconst newLat = centerLat + (latDelta * 180) / Math.PI;\n\n\t// Calculate the new longitude\n\tconst lonDelta = x / EARTH_RADIUS_M / Math.cos(latRadian);\n\tconst newLon = centerLon + (lonDelta * 180) / Math.PI;\n\n\treturn { lat: newLat, lon: newLon };\n}\n\nexport function geographicToCartesian(centerLat: number, centerLon: number, targetLat: number, targetLon: number) {\n\t// Convert degrees to radians\n\tconst latRadian = targetLat * (Math.PI / 180);\n\tconst lonRadian = targetLon * (Math.PI / 180);\n\tconst centerLatRadian = centerLat * (Math.PI / 180);\n\tconst centerLonRadian = centerLon * (Math.PI / 180);\n\n\t// Calculate the differences in latitude and longitude\n\tconst latDelta = latRadian - centerLatRadian;\n\tconst lonDelta = lonRadian - centerLonRadian;\n\n\t// Calculate the Cartesian coordinates\n\tconst x = EARTH_RADIUS_M * lonDelta * Math.cos(centerLatRadian);\n\tconst y = EARTH_RADIUS_M * latDelta;\n\n\treturn { x, y };\n}\n\nexport const populateGeometry3DIdsInScene = (\n\ttree: GroupContainerObject3D['children'][0] | Object3D,\n\tentities: RendererState['geometry3DIdsInScene'],\n\tloadGeometryGroupIds: RendererState['geometryGroupIdsToLoad'],\n) => {\n\tif (tree.children && (tree.visible || (tree instanceof GroupContainerObject3D && tree.userData.preloadGeometry))) {\n\t\tfor (const child of tree.children) {\n\t\t\tif (child.visible && child.type) {\n\t\t\t\tif ('entities3D' in child.userData && child.userData?.entities3D && child instanceof GeometryGroupObject3D) {\n\t\t\t\t\tentities.add(child.userData.entityId);\n\t\t\t\t\t// only add to loadGeometryGroupIds if the geometry group is dirty, meaning it needs to be loaded\n\t\t\t\t\tif (child.userData.dirty) {\n\t\t\t\t\t\tloadGeometryGroupIds.add(child.userData.entityId);\n\t\t\t\t\t}\n\t\t\t\t\tfor (const entityId of child.userData.entities3D.values()) {\n\t\t\t\t\t\tentities.add(entityId);\n\t\t\t\t\t}\n\t\t\t\t} else if (child.type === 'group-container') {\n\t\t\t\t\tentities.add(child.userData.entityId);\n\t\t\t\t} else if (child.type === 'custom-geometry') {\n\t\t\t\t\tentities.add(child.userData.entityId);\n\t\t\t\t} else if (child instanceof Geometry3DObject3D) {\n\t\t\t\t\tentities.add(child.userData.entityId);\n\t\t\t\t}\n\t\t\t}\n\t\t\tpopulateGeometry3DIdsInScene(child, entities, loadGeometryGroupIds);\n\t\t}\n\t}\n\n\treturn entities;\n};\n\nexport const populateGeometry2DIdsInScene = (tree: any, entities: Set<Geometry2D['id']>) => {\n\tif (tree.children && tree.visible && !tree.userData?.hidden) {\n\t\tfor (const child of tree.children) {\n\t\t\tif (child.visible && child instanceof Geometry2DObject3D) {\n\t\t\t\tentities.add(child.userData.entityId);\n\t\t\t}\n\t\t\tpopulateGeometry2DIdsInScene(child, entities);\n\t\t}\n\t}\n\n\treturn entities;\n};\n\nexport function convertMapLibreStylePaintProps(paint) {\n\tlet {\n\t\t'fill-extrusion-color': color,\n\t\t'fill-extrusion-height': height,\n\t\t'fill-extrusion-base': altitude,\n\t\t'fill-extrusion-opacity': opacity,\n\t\t'fill-extrusion-outline': outline,\n\t} = paint;\n\n\treturn { color, height, altitude, opacity, outline };\n}\n\nexport function convertMapLibreLineStylePaintProps(paint) {\n\tconst {\n\t\t'line-color': color,\n\t\t'line-join': join,\n\t\t'line-opacity': opacity,\n\t\t'line-width': width,\n\t\t'line-cap': cap,\n\t} = paint;\n\n\treturn { color, join, opacity, width, cap };\n}\n\nexport function mergeObjects<T extends Record<string, any>>(obj1: T, obj2: T): T {\n\tfor (const key in obj2) {\n\t\tif (obj2[key] == null) {\n\t\t\t// @ts-ignore\n\t\t\tobj1[key] = undefined;\n\n\t\t\tcontinue;\n\t\t}\n\t\tif (typeof obj2[key] === 'object') {\n\t\t\tmergeObjects(obj1[key], obj2[key]);\n\t\t} else {\n\t\t\tobj1[key] = obj2[key];\n\t\t}\n\t}\n\n\treturn obj1;\n}\n\nexport function createCustomLayer(\n\tmodelAsMercatorCoordinate: MercatorCoordinate,\n\tviewCamera: THREECamera,\n\tonRender: () => void,\n) {\n\t// transformation parameters to position, rotate and scale the 3D model onto the map\n\tconst modelTransform = {\n\t\ttranslateX: modelAsMercatorCoordinate.x,\n\t\ttranslateY: modelAsMercatorCoordinate.y,\n\t\ttranslateZ: modelAsMercatorCoordinate.z,\n\t\t/* Since our 3D model is in real world meters, a scale transform needs to be\n\t\t * applied since the CustomLayerInterface expects units in MercatorCoordinates.\n\t\t */\n\t\tscale: modelAsMercatorCoordinate.meterInMercatorCoordinateUnits(),\n\t};\n\n\tconst matrix1 = new Matrix4();\n\tconst scale = new Vector3(modelTransform.scale, -modelTransform.scale, modelTransform.scale);\n\tconst matrix2 = new Matrix4()\n\t\t.makeTranslation(modelTransform.translateX, modelTransform.translateY, modelTransform.translateZ)\n\t\t.scale(scale);\n\n\treturn {\n\t\tid: MAPPEDIN_LAYER_ID,\n\t\ttype: 'custom',\n\t\trenderingMode: '3d',\n\t\trender: (_gl, args) => {\n\t\t\tmatrix1.fromArray(args.defaultProjectionData.mainMatrix);\n\t\t\tviewCamera.projectionMatrix = matrix1.multiply(matrix2);\n\t\t\tonRender();\n\t\t},\n\t} as CustomLayerInterface;\n}\n\nfunction fetchToken(authURL: string) {\n\treturn fetch(authURL, {\n\t\tmethod: 'POST',\n\t\theaders: {\n\t\t\t'content-type': 'application/json',\n\t\t},\n\t\tbody: JSON.stringify({\n\t\t\tgrant_type: 'client_credentials',\n\t\t}),\n\t});\n}\n\nexport async function getRequestHeaders(authURL: string): Promise<{ 'x-mappedin-tiles-key': string }> {\n\tconst token = await fetchToken(authURL);\n\tconst { access_token } = await token.json();\n\n\treturn {\n\t\t'x-mappedin-tiles-key': access_token,\n\t};\n}\n\n// https://stackoverflow.com/questions/7616461/generate-a-hash-from-string-in-javascript\nexport function cyrb53(str: string, seed = 0): number {\n\tlet h1 = 0xdeadbeef ^ seed;\n\tlet h2 = 0x41c6ce57 ^ seed;\n\tfor (let i = 0, ch; i < str.length; i++) {\n\t\tch = str.charCodeAt(i);\n\t\th1 = Math.imul(h1 ^ ch, 2654435761);\n\t\th2 = Math.imul(h2 ^ ch, 1597334677);\n\t}\n\n\th1 = Math.imul(h1 ^ (h1 >>> 16), 2246822507) ^ Math.imul(h2 ^ (h2 >>> 13), 3266489909);\n\th2 = Math.imul(h2 ^ (h2 >>> 16), 2246822507) ^ Math.imul(h1 ^ (h1 >>> 13), 3266489909);\n\n\treturn 4294967296 * (2097151 & h2) + (h1 >>> 0);\n}\n\n/**\n/* getProjectionScaleFactor()\n/* finds the scale ratio between screen coordinates and 3D coordinates (in X-Z plane)\n/*\n\t * R\n\t * /|\n\t * C : Camera / |\n\t * PQ : Projection Plane / |\n\t * OR : Origin / |\n\t * F : FOV / |\n\t * Q / |\n\t * /| |\n\t * / | |\n\t * / | |\n\t * / | |\n\t * / | |\n\t * / F/2 | |\n\t * C ------------P------------ O\n\t *\n\t *\n\t * ProjectionScaleFactor = ( OR / PQ )\n\t * PQ = canvasHeight / 2\n\t * CQ = zoom\n\t *\n\t * OR / C0 = tan(F/2)\n\t * so OR = CO * tan(F/2)\n\t */\n\nexport function getProjectionScaleFactor(FOV: number, canvasHeight: number, zoom: number): number {\n\t// get halfFOV in radians\n\tconst halfFOV = (FOV * (Math.PI / 180)) / 2;\n\tconst PQ = canvasHeight / 2;\n\tconst CO = zoom;\n\tconst OR = CO * Math.tan(halfFOV);\n\tconst projectionScaleFactor = OR / PQ;\n\n\treturn projectionScaleFactor;\n}\n\nexport function getBoundingBoxCenter(bbox: Position[]): [number, number] {\n\treturn new LngLatBounds(new LngLat(bbox[0][0], bbox[0][1]), new LngLat(bbox[1][0], bbox[1][1])).getCenter().toArray();\n}\n\nexport { getCornersOfBoundingBox } from './bounding-box';\nexport { getGeometryByGeometryId } from './ecs';\nexport { getPixelRatio } from './get-pixel-ratio';\nexport { debounce } from './async';\nexport { shouldDisableOffscreenCanvas } from './browser';\nexport { noop, pick, isEmpty, type KeysOfUnion } from './fp';\nexport { transformRequest } from './tranform-request';\nexport { normalizeAngle } from './math';\n\n// NOTE: We should only expand minZoom and never shrink it. Except when it's the initial zoom.\nexport function shouldExpandZoomLevel(minZoomFromCurrentPanBounds: number, cameraZoomLevel: number) {\n\treturn minZoomFromCurrentPanBounds < cameraZoomLevel || cameraZoomLevel <= 12;\n}\n\nexport function getGroupContainerOpacity(entity: Geometry3DTypes | GeometryGroupObject3D) {\n\tlet containerOpacity = 1;\n\tif (entity.type === 'geometry-group' && entity.parent != null && entity.parent instanceof GroupContainerObject3D) {\n\t\tcontainerOpacity = entity.parent.userData.computedOpacity;\n\t} else if (\n\t\t(entity.type === 'geometry' || entity.type === 'custom-geometry' || entity.type === 'model') &&\n\t\tentity.parentObject3D != null &&\n\t\tentity.parentObject3D instanceof GeometryGroupObject3D &&\n\t\tentity.parentObject3D.parent != null &&\n\t\tentity.parentObject3D.parent instanceof GroupContainerObject3D\n\t) {\n\t\tcontainerOpacity = entity.parentObject3D.parent.userData.computedOpacity;\n\t}\n\n\treturn containerOpacity;\n}\n\n/**\n * Checks if two coordinate arrays are equal within a small tolerance to handle floating point precision issues.\n *\n * @param coord1 - First coordinate [longitude, latitude] or [longitude, latitude, altitude]\n * @param coord2 - Second coordinate [longitude, latitude] or [longitude, latitude, altitude]\n * @param tolerance - Tolerance for floating point comparison (default: 1e-10)\n * @returns True if coordinates are equal within tolerance\n */\nexport function coordinatesEqual(coord1: GeoJSONPosition, coord2: GeoJSONPosition, tolerance = 1e-10): boolean {\n\t// If one has altitude and the other doesn't, they're not equal\n\tif (coord1.length !== coord2.length) {\n\t\treturn false;\n\t}\n\n\tconst lonEqual = Math.abs(coord1[0] - coord2[0]) < tolerance;\n\tconst latEqual = Math.abs(coord1[1] - coord2[1]) < tolerance;\n\n\t// Check altitude if both coordinates have it\n\tif (coord1.length === 3 && coord2.length === 3) {\n\t\tconst altEqual = Math.abs(coord1[2] - coord2[2]) < tolerance;\n\n\t\treturn lonEqual && latEqual && altEqual;\n\t}\n\n\treturn lonEqual && latEqual;\n}\n\nexport const MAPLIBRE_FRUSTRUM_CULL_HACK_NAME = 'maplibre-frustum-culling-hack';\n/**\n * TODO: Find the actual root of the problem and fix it.\n * This is a hack to get around some geometry disappearing when we're added as a layer in maplibre.\n */\nexport function maplibreFrustrumCullHack() {\n\tconst geometry = new BoxGeometry(0.01, 0.01, 0.01);\n\tconst material = new MeshBasicMaterial({ opacity: 0, depthWrite: false, transparent: true });\n\tconst mesh = new Mesh(geometry, material);\n\tmesh.position.copy(new Vector3(0, 50, 0));\n\tmesh.frustumCulled = false;\n\tmesh.name = MAPLIBRE_FRUSTRUM_CULL_HACK_NAME;\n\treturn mesh;\n}\n\nconst tempVec = new Vector3();\nconst tempVec2 = new Vector2();\nexport function projectToBox2D(object: Object3D, camera: PerspectiveCamera, result = new Box2()): Box2 {\n\t// Traverse the object and project all vertices\n\tobject.traverse(child => {\n\t\tif (child instanceof Mesh) {\n\t\t\tconst geometry = child.geometry as BufferGeometry;\n\t\t\tconst position = geometry.attributes.position;\n\n\t\t\t// Skip if geometry is behind camera's near plane\n\t\t\tconst distance = camera.position.distanceTo(child.position);\n\t\t\tif (distance < camera.near) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tfor (let i = 0; i < position.count; i++) {\n\t\t\t\ttempVec.fromBufferAttribute(position, i);\n\t\t\t\ttempVec.applyMatrix4(child.matrixWorld); // need world coord for project\n\t\t\t\ttempVec.applyMatrix4(camera.matrixWorldInverse);\n\t\t\t\ttempVec.applyMatrix4(camera.projectionMatrix);\n\t\t\t\t// culling off things are too far to behind camera\n\t\t\t\tif (tempVec.z < 1 && tempVec.z > 0) {\n\t\t\t\t\ttempVec2.set(tempVec.x, tempVec.y);\n\t\t\t\t\tresult.expandByPoint(tempVec2);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n\n\treturn result;\n}\n\n// DEBUG\nfunction ndcToScreen(ndc: Vector2, container: HTMLElement): Vector2 {\n\tconst width = container.clientWidth;\n\tconst height = container.clientHeight;\n\n\treturn new Vector2(((ndc.x + 1) * width) / 2, ((1 - ndc.y) * height) / 2);\n}\n\nexport function drawProjectedBox(box: Box2, color: string, container: HTMLElement) {\n\tconst div = document.createElement('div');\n\tdiv.style.position = 'absolute';\n\tdiv.style.border = `2px solid ${color}`;\n\tdiv.style.pointerEvents = 'none';\n\n\t// Convert NDC coordinates to screen coordinates\n\tconst min = ndcToScreen(new Vector2(box.min.x, box.min.y), container);\n\tconst max = ndcToScreen(new Vector2(box.max.x, box.max.y), container);\n\n\t// Set position and size\n\tdiv.style.left = `${min.x}px`;\n\tdiv.style.top = `${max.y}px`;\n\tconst width = Math.abs(max.x - min.x);\n\tconst height = Math.abs(max.y - min.y);\n\tdiv.style.width = `${width}px`;\n\tdiv.style.height = `${height}px`;\n\n\tcontainer.appendChild(div);\n\n\treturn div;\n}\n\n/**\n * The render order of objects in the scene.\n * Geometries are rendered as 0 by default. Images should render later than spaces since we assume image should always show on top of spaces.\n * We can't rely on camera sortOrder to decide the order of rendering as it may consider larger space (floor space) to be closer to camera than a imageMesh even imageMesh has a slightly higher z offset. ie, altitude offset needs be over 10 meters to ensure it can beat a giant floor space in venue such as battersea.\n * Hence, we give it a renderOrder that's later than floor.\n */\nexport enum SCENE_RENDER_ORDER {\n\tGeometry,\n\tImageMesh,\n}\n", "import { Object3D } from 'three';\nimport type { GeometryGroupState } from './geometry-group';\nimport { GeometryGroupObject3D } from './geometry-group';\nimport { Geometry2D, Geometry2DObject3D } from './geometry2d';\nimport type { MarkerState } from '../components/marker';\nimport type { LabelState } from '../components/label';\nimport type { Geometry3DTypes } from './geometry3d';\nimport { Geometry3D } from './geometry3d';\nimport type { PathState } from '../components/path';\nimport type { InteractionComponent } from '../components/interaction';\nimport type { BatchedText } from '../services/text3d/text3d';\nimport type { EntityTypes } from '../renderer';\nimport type { Feature, MultiPolygon, Polygon } from 'geojson';\nimport type { FocusableComponent } from '../components/focusable';\n\nexport enum GroupContainerComponents {\n\tInteraction,\n\tFocusable,\n}\n\n/**\n * State representing a Group Container, which is a container for other Group Containers, Geometry Groups, Labels, Markers and Paths.\n */\nexport type GroupContainerState = {\n\treadonly id: string | number;\n\treadonly type: 'group-container';\n\t/**\n\t * The states of the children of the group container\n\t */\n\treadonly children: (PathState | MarkerState | LabelState | GroupContainerState | GeometryGroupState)[];\n\t/**\n\t * Whether the group container is visible\n\t */\n\tvisible: boolean;\n\t/**\n\t * The altitude of the group container above the ground in meters\n\t */\n\taltitude: number;\n\tinteractive: boolean;\n\t/**\n\t * The opacity of the group container, which sets the opacity of all its children\n\t */\n\topacity: number;\n\t/**\n\t * If true, the group container will preload geometry for its children even when invisible.\n\t */\n\treadonly preloadGeometry: boolean;\n\tfocusable: boolean;\n};\n\nexport class GroupContainerObject3D extends Object3D {\n\tchildrenIds: Set<string | number> = new Set();\n\t// TODO: outline\n\tchildren: (\n\t\t| GroupContainerObject3D\n\t\t| GeometryGroupObject3D\n\t\t| BatchedText\n\t\t| Geometry2D['object3d']\n\t\t| NonNullable<Geometry3D['object3d']>\n\t)[] = [];\n\treadonly type = 'group-container' as const;\n\tuserData: {\n\t\tentityId: string | number;\n\t\tentities2D: Set<string | number>;\n\t\tdirty: boolean;\n\t\toccluderDirty: boolean;\n\t\toccluderId?: number;\n\t\toccluderFeature?: Feature<Polygon | MultiPolygon, any>;\n\t\topacity: number;\n\t\t/** The effective opacity of the entity after all parent containers have been considered. */\n\t\tcomputedOpacity: number;\n\t\t/**\n\t\t * If true, the group container will preload geometry for its children even when invisible.\n\t\t */\n\t\tpreloadGeometry: boolean;\n\t} = {\n\t\tentityId: '',\n\t\tentities2D: new Set(),\n\t\tdirty: true,\n\t\toccluderDirty: false,\n\t\topacity: 1,\n\t\tcomputedOpacity: 1,\n\t\tpreloadGeometry: false,\n\t};\n\tcomponents: [InteractionComponent?, FocusableComponent?] = [];\n\tconstructor(id: string) {\n\t\tsuper();\n\t\tthis.userData.entityId = id;\n\t}\n\n\taddOccluderFeature(feature: Feature<Polygon | MultiPolygon, any>, occluderId: number) {\n\t\tthis.userData.occluderFeature = feature;\n\t\tthis.userData.occluderId = occluderId;\n\t\tthis.userData.occluderDirty = true;\n\t}\n\n\taddEntity(entityGroupOrContainer: GroupContainerObject3D | GeometryGroupObject3D | Geometry2D | Geometry3DTypes) {\n\t\tif (entityGroupOrContainer instanceof GroupContainerObject3D) {\n\t\t\tthis.childrenIds.add(entityGroupOrContainer.userData.entityId);\n\t\t\tthis.add(entityGroupOrContainer);\n\t\t} else if (entityGroupOrContainer instanceof Geometry2D) {\n\t\t\tthis.childrenIds.add(entityGroupOrContainer.id);\n\t\t\tthis.add(entityGroupOrContainer.object3d);\n\t\t\tthis.userData.entities2D.add(entityGroupOrContainer.id);\n\t\t\tentityGroupOrContainer.positionDirty = true;\n\t\t} else if (entityGroupOrContainer instanceof GeometryGroupObject3D) {\n\t\t\tthis.childrenIds.add(entityGroupOrContainer.userData.entityId);\n\t\t\tthis.add(entityGroupOrContainer);\n\t\t} else if (entityGroupOrContainer instanceof Geometry3D && entityGroupOrContainer.object3d) {\n\t\t\tthis.childrenIds.add(entityGroupOrContainer.id);\n\t\t\tthis.add(entityGroupOrContainer.object3d);\n\t\t}\n\t\tthis.dispatchEvent({ type: 'childadded', child: this });\n\t}\n\n\tremoveEntity(entityGroupOrContainer: EntityTypes) {\n\t\tif (entityGroupOrContainer instanceof GroupContainerObject3D) {\n\t\t\tthis.childrenIds.delete(entityGroupOrContainer.userData.entityId);\n\t\t\tthis.remove(entityGroupOrContainer);\n\t\t} else if (entityGroupOrContainer instanceof Geometry2D) {\n\t\t\tthis.childrenIds.delete(entityGroupOrContainer.id);\n\t\t\tthis.userData.entities2D.delete(entityGroupOrContainer.id);\n\t\t\tthis.remove(entityGroupOrContainer.object3d);\n\t\t} else if (entityGroupOrContainer instanceof GeometryGroupObject3D) {\n\t\t\tthis.childrenIds.delete(entityGroupOrContainer.userData.entityId);\n\t\t\tthis.remove(entityGroupOrContainer);\n\t\t} else if (entityGroupOrContainer instanceof Geometry3D && entityGroupOrContainer.object3d) {\n\t\t\tthis.childrenIds.delete(entityGroupOrContainer.id);\n\t\t\tthis.add(entityGroupOrContainer.object3d);\n\t\t}\n\t\tthis.dispatchEvent({ type: 'childremoved', child: this });\n\t}\n\n\tsetVisible(visible: boolean) {\n\t\tif (this.visible !== visible) {\n\t\t\tthis.visible = visible;\n\t\t\tthis.dispatchEvent({ type: 'childremoved', child: this });\n\t\t}\n\t}\n\n\tsetAltitude(altitude: number) {\n\t\tif (this.position.z !== altitude) {\n\t\t\tthis.position.z = altitude;\n\t\t\tthis.dispatchEvent({ type: 'childremoved', child: this });\n\t\t\tthis.set2DGeometryChildrenPositionDirty();\n\t\t}\n\t}\n\n\t// traverse the children and set the world position dirty for all 2d geometry children\n\t// to save on recalculating the world position for all 2d geometry children every frame\n\tset2DGeometryChildrenPositionDirty() {\n\t\tthis.children.forEach(child => {\n\t\t\tif (child instanceof Geometry2DObject3D) {\n\t\t\t\tchild.userData.worldPositionDirty = true;\n\t\t\t} else if (child instanceof GroupContainerObject3D) {\n\t\t\t\tchild.set2DGeometryChildrenPositionDirty();\n\t\t\t}\n\t\t});\n\t}\n\n\tget altitude() {\n\t\treturn this.position.z;\n\t}\n\n\tsetOpacity(opacity: number) {\n\t\tthis.userData.opacity = opacity;\n\t}\n\tget opacity() {\n\t\treturn this.userData.opacity;\n\t}\n}\n", "import type { LineStyle, PaintStyle, Shading } from '../types';\nimport { Object3D } from 'three';\nimport { EntityBatchedMesh, type GeometryState } from '../components/mesh';\nimport type { ModelState } from '../components/model';\nimport { MaterialSide } from '../components/styles';\n/**\n * State representing a Geometry Group, which is a container for Geometries and Models.\n */\nexport type GeometryGroupState = {\n\treadonly id: string | number;\n\treadonly type: 'geometry-group';\n\t/**\n\t * The states of the children of the geometry group\n\t */\n\treadonly children: (GeometryState | ModelState)[];\n\t/**\n\t * Whether the geometry group is visible\n\t */\n\tvisible: boolean;\n\t/**\n\t * Whether the geometry group is interactive, which means it can be hovered over and clicked on.\n\t * This will affect all children of the geometry group and override their interactive state.\n\t *\n\t * @example\n\t * ```javascript\n\t * \trenderer.on('click', ({ geometry }) => {});\n\t * ```\n\t */\n\tinteractive: boolean;\n\t// @TODO: remove these once we have removed the geometry group as an external entity\n\taltitude?: number;\n\topacity?: number;\n\tcolor?: string;\n\theight?: number;\n\ttexture?: string;\n\ttopColor?: string;\n\ttopTexture?: string;\n\toutline?: boolean;\n\tshading?: Shading;\n\tside?: MaterialSide;\n};\n\nexport type ChildUpdatable<T> = T extends LineStyle\n\t? Partial<Pick<LineStyle, 'color' | 'opacity' | 'visible'>>\n\t: Partial<Pick<PaintStyle, 'color' | 'opacity' | 'visible'>>;\n\nexport class GeometryGroupObject3D extends Object3D {\n\tvisible = true;\n\treadonly type = 'geometry-group' as const;\n\tcomponents = [];\n\tuserData: {\n\t\tentityId: string | number;\n\t\tentities3D: Set<string | number>;\n\t\tmodelURL?: string;\n\t\tdirty: boolean;\n\t\tshadingDirty: boolean;\n\t} = {\n\t\tentityId: '',\n\t\tentities3D: new Set(),\n\t\tdirty: true,\n\t\tshadingDirty: true,\n\t};\n\n\tsetVisible(visible: boolean) {\n\t\tif (this.visible !== visible) {\n\t\t\tthis.visible = visible;\n\t\t\tthis.dispatchEvent({ type: 'childremoved', child: this });\n\t\t}\n\t}\n\n\tremoveEntity() {\n\t\tthis.dispatchEvent({ type: 'childremoved', child: this });\n\t}\n\n\tconstructor(id: string) {\n\t\tsuper();\n\t\tthis.userData.entityId = id;\n\t}\n\t/**\n\t * Get first child entity of a group if it's a batched mesh\n\t * We use this logic a lot for getting the material of the group. since group does not have material and batched mesh does\n\t */\n\tgetfirstChildEntityId() {\n\t\tlet firstChild;\n\t\tfor (const child of this.children) {\n\t\t\tif (!child.userData.detached) {\n\t\t\t\tfirstChild = child;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (!(firstChild instanceof EntityBatchedMesh)) return;\n\t\tconst childrenEntitiesIds = Object.values(firstChild.userData.entities);\n\n\t\treturn childrenEntitiesIds[0];\n\t}\n\n\tsetAltitude(altitude: number) {\n\t\tif (this.position.z !== altitude) {\n\t\t\tthis.position.z = altitude;\n\t\t\tthis.dispatchEvent({ type: 'childremoved', child: this });\n\t\t}\n\t}\n\n\tget altitude() {\n\t\treturn this.position.z;\n\t}\n}\n", "import type { Texture, BufferGeometry, Mesh, MeshLambertMaterial, BatchedMeshGeometryRange } from 'three';\nimport { BatchedMesh, Color, Vector3 } from 'three';\nimport type { BatchedStandardMaterial } from '../systems/mesh-creation-and-optimization/batched-material';\nimport type { EntityId, Position, Shading } from '../types';\nimport type {\n\tFeature,\n\tLineString,\n\tMultiLineString,\n\tMultiPolygon,\n\tPolygon,\n\tPosition as GeoJsonPosition,\n\tBBox,\n} from 'geojson';\nimport { getBoundingBoxFromFeature } from './utils';\nimport { DEFAULT_HEIGHT, MaterialSide } from './styles/style';\nimport { type ImageProperties } from './image';\nimport { type BaseTextAreaProperties, type EnterpriseTexture } from '@mappedin/mvf-v2';\nimport type { Text } from 'troika-three-text';\nimport type { GeometryGroupState } from '../entities/geometry-group';\nexport class EntityBatchedMesh extends BatchedMesh {\n\ttype = 'entityBatchedMesh' as const;\n\tuserData: {\n\t\tentities: {\n\t\t\t[key: number]: string | number;\n\t\t};\n\t\tdetached?: boolean;\n\t} = {\n\t\tentities: {},\n\t};\n}\n\nexport type MeshComponentProperties = {\n\tid: string;\n\timage?: ImageProperties & {\n\t\tposition: GeoJsonPosition;\n\t\tpath: string;\n\t};\n\ttextArea?: BaseTextAreaProperties & {\n\t\tposition: GeoJsonPosition;\n\t};\n\ttextures?: EnterpriseTexture[];\n};\n\n/**\n * State representing a Geometry\n */\nexport type GeometryState = {\n\treadonly id: string | number;\n\treadonly type: 'geometry';\n\t/**\n\t * The position of the geometry in [lon, lat]\n\t */\n\treadonly position: Position;\n\t/**\n\t * The parent group of the geometry\n\t */\n\treadonly parent: EntityId<GeometryGroupState>;\n\t/**\n\t * Whether the geometry is visible. This is independent of the visibility of the children, but will affect the visibility of the children if set to false.\n\t */\n\tvisible: boolean;\n\t/**\n\t * The initial color of the geometry. This is used to reset the color of the geometry to its initial value.\n\t */\n\tinitialColor: string;\n\t/**\n\t * The color of the geometry\n\t */\n\tcolor: string;\n\t/**\n\t * The initial top color of the geometry. This is used to reset the top color of the geometry to its initial value.\n\t */\n\tinitialTopColor?: string;\n\t/**\n\t * The color of geometry faces that are facing up\n\t */\n\ttopColor?: string;\n\t/**\n\t * The color of the geometry when hovered over with a mouse\n\t */\n\thoverColor?: string;\n\t/**\n\t * Whether the geometry is interactive, which means it can be hovered over and clicked on.\n\t *\n\t * @example\n\t * ```javascript\n\t * \trenderer.on('click', ({ geometry }) => {});\n\t * ```\n\t */\n\tinteractive: boolean;\n\t/**\n\t * Whether the geometry is outlined with a 30% darkened color. This effect adds lines around the geometry to make it stand out.\n\t */\n\toutline: boolean;\n\t/**\n\t * Show geometry image if present\n\t */\n\tshowImage: boolean;\n\t/**\n\t * Attempt to keep the image facing the camera as much as possible\n\t */\n\tflipImageToFaceCamera: boolean;\n\t/**\n\t * Whether the geometry should emit an event when focused on by the center of the camera\n\t */\n\tfocusable: boolean;\n\t/**\n\t * The opacity of the geometry\n\t */\n\topacity: number;\n\t/**\n\t * The height of the geometry\n\t */\n\theight: number;\n\t/**\n\t * The texture URL of the geometry\n\t */\n\ttexture?: string;\n\t/**\n\t * The top texture URL of the geometry\n\t */\n\ttopTexture?: string;\n\t/**\n\t * Whether the geometry is currently in hover state or not\n\t */\n\thovered: boolean;\n\t/**\n\t * The render order of the geometry\n\t */\n\trenderOrder?: number;\n\t/**\n\t * The altitude of the geometry element in meters.\n\t */\n\taltitude: number;\n\t/**\n\t * The shading of the geometry\n\t */\n\tshading?: Shading;\n\t/**\n\t * The side of the geometry\n\t */\n\tside?: MaterialSide;\n};\n\nexport class MeshComponent {\n\t// Pointer to mesh for this component, which is either the mesh itself or a merged geometry mesh\n\t// if this component was optimized\n\tmesh?: EntityBatchedMesh;\n\n\timageMesh?: Mesh;\n\t/**\n\t * holds a pointer to space label text if the polygon has label active.\n\t */\n\ttextMesh?: Text;\n\t// stores the entity id of text3d. To avoid creating label the mesh more than once\n\ttextEntityId?: string;\n\n\treadonly type = 'geometry';\n\t// Whether the geometry is dirty and needs to be updated\n\tdirty = true;\n\n\tdetached = false;\n\n\tinstanceIndex = -1;\n\tgeometry?: BufferGeometry;\n\tbatchedProps?: {\n\t\trange: BatchedMeshGeometryRange;\n\t\tpositionCount: number;\n\t\tgeometryId: number;\n\t} = undefined;\n\tmaterial?: BatchedStandardMaterial;\n\tfeature: Feature<Polygon | LineString | MultiPolygon | MultiLineString, MeshComponentProperties>;\n\tcurrentHeight = DEFAULT_HEIGHT;\n\n\tconstructor(feature: Feature<Polygon | LineString | MultiPolygon | MultiLineString, MeshComponentProperties>) {\n\t\tthis.feature = feature;\n\t}\n\n\tget visible() {\n\t\treturn this.mesh && this.instanceIndex !== -1 ? this.mesh.getVisibleAt(this.instanceIndex) : false;\n\t}\n\n\tset visible(visible: boolean) {\n\t\tif (this.mesh && this.instanceIndex !== -1) {\n\t\t\tthis.mesh.setVisibleAt(this.instanceIndex, visible);\n\t\t}\n\t}\n\n\tget renderOrder() {\n\t\treturn this.mesh ? this.mesh.renderOrder : 0;\n\t}\n\n\tset renderOrder(value: number) {\n\t\tif (this.mesh) {\n\t\t\tthis.mesh.renderOrder = value;\n\t\t}\n\t}\n\n\tcolor: Color = new Color();\n\ttopColor: Color = new Color();\n\tsetColor(color: string, topColor: string) {\n\t\tthis.color.set(color);\n\t\tthis.topColor.set(topColor);\n\t\tif (this.material) {\n\t\t\tthis.material.setColor(this.instanceIndex, this.color, this.topColor);\n\t\t}\n\t}\n\n\tgetColor() {\n\t\treturn this.material?.getColor(this.instanceIndex);\n\t}\n\n\tposition = new Vector3();\n\n\taltitude = 0;\n\t#opacity = 1;\n\tget opacity() {\n\t\treturn this.#opacity;\n\t}\n\n\tset opacity(value) {\n\t\tif (this.material) {\n\t\t\tthis.material.opacity = value;\n\t\t\tthis.material.transparent = value < 1;\n\t\t\tthis.material.needsUpdate = true;\n\t\t}\n\t\tif (this.imageMesh) {\n\t\t\tconst imageMaterials = Array.isArray(this.imageMesh.material)\n\t\t\t\t? this.imageMesh.material\n\t\t\t\t: [this.imageMesh.material];\n\t\t\tfor (const material of imageMaterials as MeshLambertMaterial[]) {\n\t\t\t\tmaterial.opacity = value;\n\t\t\t\tmaterial.needsUpdate = true;\n\t\t\t}\n\t\t}\n\t\tthis.#opacity = value;\n\t}\n\n\tget texture(): string {\n\t\treturn this.material?.texture?.image.src;\n\t}\n\n\tset texture(texture: Texture) {\n\t\tif (this.material) {\n\t\t\tthis.material.texture = texture;\n\t\t}\n\t}\n\n\tget textureInstance(): Texture | undefined {\n\t\treturn this.material?.texture;\n\t}\n\n\tset topTexture(texture: Texture) {\n\t\tif (this.material) {\n\t\t\tthis.material.topTexture = texture;\n\t\t}\n\t}\n\n\tget topTexture(): string {\n\t\treturn this.material?.topTexture?.image.src;\n\t}\n\n\tget topTextureInstance(): Texture | undefined {\n\t\treturn this.material?.topTexture;\n\t}\n\n\tset blendTexture(value: boolean) {\n\t\tif (this.material) {\n\t\t\tthis.material.blendTexture = value;\n\t\t}\n\t}\n\n\t#bbox?: BBox;\n\tget featureBbox(): BBox {\n\t\tif (this.#bbox) return this.#bbox;\n\n\t\tthis.#bbox = getBoundingBoxFromFeature(this.feature);\n\n\t\treturn this.#bbox;\n\t}\n\n\ttexturesVisible = false;\n\n\tshowTextures() {\n\t\tif (this.material) {\n\t\t\tthis.material.showTextures(this.instanceIndex);\n\t\t\tthis.texturesVisible = true;\n\t\t}\n\t}\n\thideTextures() {\n\t\tif (this.material) {\n\t\t\tthis.material.hideTextures(this.instanceIndex);\n\t\t\tthis.texturesVisible = false;\n\t\t}\n\t}\n\tremoveSideTexture() {\n\t\tif (this.material) {\n\t\t\tthis.material.removeSideTexture(this.instanceIndex);\n\t\t}\n\t}\n\tremoveTopTexture() {\n\t\tif (this.material) {\n\t\t\tthis.material.removeTopTexture(this.instanceIndex);\n\t\t}\n\t}\n}\n", "import type { BBox, Feature, LineString, MultiLineString, MultiPolygon, Polygon } from 'geojson';\nimport bbox from '@turf/bbox';\n\nexport function getBoundingBoxFromFeature(\n\tfeature: Feature<Polygon | LineString | MultiPolygon | MultiLineString>,\n): BBox {\n\treturn bbox(feature);\n}\n", "import { coordEach } from \"@turf/meta\";\n/**\n * Takes a set of features, calculates the bbox of all input features, and returns a bounding box.\n *\n * @name bbox\n * @param {GeoJSON} geojson any GeoJSON object\n * @returns {BBox} bbox extent in [minX, minY, maxX, maxY] order\n * @example\n * var line = turf.lineString([[-74, 40], [-78, 42], [-82, 35]]);\n * var bbox = turf.bbox(line);\n * var bboxPolygon = turf.bboxPolygon(bbox);\n *\n * //addToMap\n * var addToMap = [line, bboxPolygon]\n */\nfunction bbox(geojson) {\n var result = [Infinity, Infinity, -Infinity, -Infinity];\n coordEach(geojson, function (coord) {\n if (result[0] > coord[0]) {\n result[0] = coord[0];\n }\n if (result[1] > coord[1]) {\n result[1] = coord[1];\n }\n if (result[2] < coord[0]) {\n result[2] = coord[0];\n }\n if (result[3] < coord[1]) {\n result[3] = coord[1];\n }\n });\n return result;\n}\nbbox[\"default\"] = bbox;\nexport default bbox;\n", "import { feature, lineString, isObject, point } from '@turf/helpers';\n\n/**\n * Callback for coordEach\n *\n * @callback coordEachCallback\n * @param {Array<number>} currentCoord The current coordinate being processed.\n * @param {number} coordIndex The current index of the coordinate being processed.\n * @param {number} featureIndex The current index of the Feature being processed.\n * @param {number} multiFeatureIndex The current index of the Multi-Feature being processed.\n * @param {number} geometryIndex The current index of the Geometry being processed.\n */\n\n/**\n * Iterate over coordinates in any GeoJSON object, similar to Array.forEach()\n *\n * @name coordEach\n * @param {FeatureCollection|Feature|Geometry} geojson any GeoJSON object\n * @param {Function} callback a method that takes (currentCoord, coordIndex, featureIndex, multiFeatureIndex)\n * @param {boolean} [excludeWrapCoord=false] whether or not to include the final coordinate of LinearRings that wraps the ring in its iteration.\n * @returns {void}\n * @example\n * var features = turf.featureCollection([\n * turf.point([26, 37], {\"foo\": \"bar\"}),\n * turf.point([36, 53], {\"hello\": \"world\"})\n * ]);\n *\n * turf.coordEach(features, function (currentCoord, coordIndex, featureIndex, multiFeatureIndex, geometryIndex) {\n * //=currentCoord\n * //=coordIndex\n * //=featureIndex\n * //=multiFeatureIndex\n * //=geometryIndex\n * });\n */\nfunction coordEach(geojson, callback, excludeWrapCoord) {\n // Handles null Geometry -- Skips this GeoJSON\n if (geojson === null) return;\n var j,\n k,\n l,\n geometry,\n stopG,\n coords,\n geometryMaybeCollection,\n wrapShrink = 0,\n coordIndex = 0,\n isGeometryCollection,\n type = geojson.type,\n isFeatureCollection = type === \"FeatureCollection\",\n isFeature = type === \"Feature\",\n stop = isFeatureCollection ? geojson.features.length : 1;\n\n // This logic may look a little weird. The reason why it is that way\n // is because it's trying to be fast. GeoJSON supports multiple kinds\n // of objects at its root: FeatureCollection, Features, Geometries.\n // This function has the responsibility of handling all of them, and that\n // means that some of the `for` loops you see below actually just don't apply\n // to certain inputs. For instance, if you give this just a\n // Point geometry, then both loops are short-circuited and all we do\n // is gradually rename the input until it's called 'geometry'.\n //\n // This also aims to allocate as few resources as possible: just a\n // few numbers and booleans, rather than any temporary arrays as would\n // be required with the normalization approach.\n for (var featureIndex = 0; featureIndex < stop; featureIndex++) {\n geometryMaybeCollection = isFeatureCollection\n ? geojson.features[featureIndex].geometry\n : isFeature\n ? geojson.geometry\n : geojson;\n isGeometryCollection = geometryMaybeCollection\n ? geometryMaybeCollection.type === \"GeometryCollection\"\n : false;\n stopG = isGeometryCollection\n ? geometryMaybeCollection.geometries.length\n : 1;\n\n for (var geomIndex = 0; geomIndex < stopG; geomIndex++) {\n var multiFeatureIndex = 0;\n var geometryIndex = 0;\n geometry = isGeometryCollection\n ? geometryMaybeCollection.geometries[geomIndex]\n : geometryMaybeCollection;\n\n // Handles null Geometry -- Skips this geometry\n if (geometry === null) continue;\n coords = geometry.coordinates;\n var geomType = geometry.type;\n\n wrapShrink =\n excludeWrapCoord &&\n (geomType === \"Polygon\" || geomType === \"MultiPolygon\")\n ? 1\n : 0;\n\n switch (geomType) {\n case null:\n break;\n case \"Point\":\n if (\n callback(\n coords,\n coordIndex,\n featureIndex,\n multiFeatureIndex,\n geometryIndex\n ) === false\n )\n return false;\n coordIndex++;\n multiFeatureIndex++;\n break;\n case \"LineString\":\n case \"MultiPoint\":\n for (j = 0; j < coords.length; j++) {\n if (\n callback(\n coords[j],\n coordIndex,\n featureIndex,\n multiFeatureIndex,\n geometryIndex\n ) === false\n )\n return false;\n coordIndex++;\n if (geomType === \"MultiPoint\") multiFeatureIndex++;\n }\n if (geomType === \"LineString\") multiFeatureIndex++;\n break;\n case \"Polygon\":\n case \"MultiLineString\":\n for (j = 0; j < coords.length; j++) {\n for (k = 0; k < coords[j].length - wrapShrink; k++) {\n if (\n callback(\n coords[j][k],\n coordIndex,\n featureIndex,\n multiFeatureIndex,\n geometryIndex\n ) === false\n )\n return false;\n coordIndex++;\n }\n if (geomType === \"MultiLineString\") multiFeatureIndex++;\n if (geomType === \"Polygon\") geometryIndex++;\n }\n if (geomType === \"Polygon\") multiFeatureIndex++;\n break;\n case \"MultiPolygon\":\n for (j = 0; j < coords.length; j++) {\n geometryIndex = 0;\n for (k = 0; k < coords[j].length; k++) {\n for (l = 0; l < coords[j][k].length - wrapShrink; l++) {\n if (\n callback(\n coords[j][k][l],\n coordIndex,\n featureIndex,\n multiFeatureIndex,\n geometryIndex\n ) === false\n )\n return false;\n coordIndex++;\n }\n geometryIndex++;\n }\n multiFeatureIndex++;\n }\n break;\n case \"GeometryCollection\":\n for (j = 0; j < geometry.geometries.length; j++)\n if (\n coordEach(geometry.geometries[j], callback, excludeWrapCoord) ===\n false\n )\n return false;\n break;\n default:\n throw new Error(\"Unknown Geometry Type\");\n }\n }\n }\n}\n\n/**\n * Callback for coordReduce\n *\n * The first time the callback function is called, the values provided as arguments depend\n * on whether the reduce method has an initialValue argument.\n *\n * If an initialValue is provided to the reduce method:\n * - The previousValue argument is initialValue.\n * - The currentValue argument is the value of the first element present in the array.\n *\n * If an initialValue is not provided:\n * - The previousValue argument is the value of the first element present in the array.\n * - The currentValue argument is the value of the second element present in the array.\n *\n * @callback coordReduceCallback\n * @param {*} previousValue The accumulated value previously returned in the last invocation\n * of the callback, or initialValue, if supplied.\n * @param {Array<number>} currentCoord The current coordinate being processed.\n * @param {number} coordIndex The current index of the coordinate being processed.\n * Starts at index 0, if an initialValue is provided, and at index 1 otherwise.\n * @param {number} featureIndex The current index of the Feature being processed.\n * @param {number} multiFeatureIndex The current index of the Multi-Feature being processed.\n * @param {number} geometryIndex The current index of the Geometry being processed.\n */\n\n/**\n * Reduce coordinates in any GeoJSON object, similar to Array.reduce()\n *\n * @name coordReduce\n * @param {FeatureCollection|Geometry|Feature} geojson any GeoJSON object\n * @param {Function} callback a method that takes (previousValue, currentCoord, coordIndex)\n * @param {*} [initialValue] Value to use as the first argument to the first call of the callback.\n * @param {boolean} [excludeWrapCoord=false] whether or not to include the final coordinate of LinearRings that wraps the ring in its iteration.\n * @returns {*} The value that results from the reduction.\n * @example\n * var features = turf.featureCollection([\n * turf.point([26, 37], {\"foo\": \"bar\"}),\n * turf.point([36, 53], {\"hello\": \"world\"})\n * ]);\n *\n * turf.coordReduce(features, function (previousValue, currentCoord, coordIndex, featureIndex, multiFeatureIndex, geometryIndex) {\n * //=previousValue\n * //=currentCoord\n * //=coordIndex\n * //=featureIndex\n * //=multiFeatureIndex\n * //=geometryIndex\n * return currentCoord;\n * });\n */\nfunction coordReduce(geojson, callback, initialValue, excludeWrapCoord) {\n var previousValue = initialValue;\n coordEach(\n geojson,\n function (\n currentCoord,\n coordIndex,\n featureIndex,\n multiFeatureIndex,\n geometryIndex\n ) {\n if (coordIndex === 0 && initialValue === undefined)\n previousValue = currentCoord;\n else\n previousValue = callback(\n previousValue,\n currentCoord,\n coordIndex,\n featureIndex,\n multiFeatureIndex,\n geometryIndex\n );\n },\n excludeWrapCoord\n );\n return previousValue;\n}\n\n/**\n * Callback for propEach\n *\n * @callback propEachCallback\n * @param {Object} currentProperties The current Properties being processed.\n * @param {number} featureIndex The current index of the Feature being processed.\n */\n\n/**\n * Iterate over properties in any GeoJSON object, similar to Array.forEach()\n *\n * @name propEach\n * @param {FeatureCollection|Feature} geojson any GeoJSON object\n * @param {Function} callback a method that takes (currentProperties, featureIndex)\n * @returns {void}\n * @example\n * var features = turf.featureCollection([\n * turf.point([26, 37], {foo: 'bar'}),\n * turf.point([36, 53], {hello: 'world'})\n * ]);\n *\n * turf.propEach(features, function (currentProperties, featureIndex) {\n * //=currentProperties\n * //=featureIndex\n * });\n */\nfunction propEach(geojson, callback) {\n var i;\n switch (geojson.type) {\n case \"FeatureCollection\":\n for (i = 0; i < geojson.features.length; i++) {\n if (callback(geojson.features[i].properties, i) === false) break;\n }\n break;\n case \"Feature\":\n callback(geojson.properties, 0);\n break;\n }\n}\n\n/**\n * Callback for propReduce\n *\n * The first time the callback function is called, the values provided as arguments depend\n * on whether the reduce method has an initialValue argument.\n *\n * If an initialValue is provided to the reduce method:\n * - The previousValue argument is initialValue.\n * - The currentValue argument is the value of the first element present in the array.\n *\n * If an initialValue is not provided:\n * - The previousValue argument is the value of the first element present in the array.\n * - The currentValue argument is the value of the second element present in the array.\n *\n * @callback propReduceCallback\n * @param {*} previousValue The accumulated value previously returned in the last invocation\n * of the callback, or initialValue, if supplied.\n * @param {*} currentProperties The current Properties being processed.\n * @param {number} featureIndex The current index of the Feature being processed.\n */\n\n/**\n * Reduce properties in any GeoJSON object into a single value,\n * similar to how Array.reduce works. However, in this case we lazily run\n * the reduction, so an array of all properties is unnecessary.\n *\n * @name propReduce\n * @param {FeatureCollection|Feature} geojson any GeoJSON object\n * @param {Function} callback a method that takes (previousValue, currentProperties, featureIndex)\n * @param {*} [initialValue] Value to use as the first argument to the first call of the callback.\n * @returns {*} The value that results from the reduction.\n * @example\n * var features = turf.featureCollection([\n * turf.point([26, 37], {foo: 'bar'}),\n * turf.point([36, 53], {hello: 'world'})\n * ]);\n *\n * turf.propReduce(features, function (previousValue, currentProperties, featureIndex) {\n * //=previousValue\n * //=currentProperties\n * //=featureIndex\n * return currentProperties\n * });\n */\nfunction propReduce(geojson, callback, initialValue) {\n var previousValue = initialValue;\n propEach(geojson, function (currentProperties, featureIndex) {\n if (featureIndex === 0 && initialValue === undefined)\n previousValue = currentProperties;\n else\n previousValue = callback(previousValue, currentProperties, featureIndex);\n });\n return previousValue;\n}\n\n/**\n * Callback for featureEach\n *\n * @callback featureEachCallback\n * @param {Feature<any>} currentFeature The current Feature being processed.\n * @param {number} featureIndex The current index of the Feature being processed.\n */\n\n/**\n * Iterate over features in any GeoJSON object, similar to\n * Array.forEach.\n *\n * @name featureEach\n * @param {FeatureCollection|Feature|Geometry} geojson any GeoJSON object\n * @param {Function} callback a method that takes (currentFeature, featureIndex)\n * @returns {void}\n * @example\n * var features = turf.featureCollection([\n * turf.point([26, 37], {foo: 'bar'}),\n * turf.point([36, 53], {hello: 'world'})\n * ]);\n *\n * turf.featureEach(features, function (currentFeature, featureIndex) {\n * //=currentFeature\n * //=featureIndex\n * });\n */\nfunction featureEach(geojson, callback) {\n if (geojson.type === \"Feature\") {\n callback(geojson, 0);\n } else if (geojson.type === \"FeatureCollection\") {\n for (var i = 0; i < geojson.features.length; i++) {\n if (callback(geojson.features[i], i) === false) break;\n }\n }\n}\n\n/**\n * Callback for featureReduce\n *\n * The first time the callback function is called, the values provided as arguments depend\n * on whether the reduce method has an initialValue argument.\n *\n * If an initialValue is provided to the reduce method:\n * - The previousValue argument is initialValue.\n * - The currentValue argument is the value of the first element present in the array.\n *\n * If an initialValue is not provided:\n * - The previousValue argument is the value of the first element present in the array.\n * - The currentValue argument is the value of the second element present in the array.\n *\n * @callback featureReduceCallback\n * @param {*} previousValue The accumulated value previously returned in the last invocation\n * of the callback, or initialValue, if supplied.\n * @param {Feature} currentFeature The current Feature being processed.\n * @param {number} featureIndex The current index of the Feature being processed.\n */\n\n/**\n * Reduce features in any GeoJSON object, similar to Array.reduce().\n *\n * @name featureReduce\n * @param {FeatureCollection|Feature|Geometry} geojson any GeoJSON object\n * @param {Function} callback a method that takes (previousValue, currentFeature, featureIndex)\n * @param {*} [initialValue] Value to use as the first argument to the first call of the callback.\n * @returns {*} The value that results from the reduction.\n * @example\n * var features = turf.featureCollection([\n * turf.point([26, 37], {\"foo\": \"bar\"}),\n * turf.point([36, 53], {\"hello\": \"world\"})\n * ]);\n *\n * turf.featureReduce(features, function (previousValue, currentFeature, featureIndex) {\n * //=previousValue\n * //=currentFeature\n * //=featureIndex\n * return currentFeature\n * });\n */\nfunction featureReduce(geojson, callback, initialValue) {\n var previousValue = initialValue;\n featureEach(geojson, function (currentFeature, featureIndex) {\n if (featureIndex === 0 && initialValue === undefined)\n previousValue = currentFeature;\n else previousValue = callback(previousValue, currentFeature, featureIndex);\n });\n return previousValue;\n}\n\n/**\n * Get all coordinates from any GeoJSON object.\n *\n * @name coordAll\n * @param {FeatureCollection|Feature|Geometry} geojson any GeoJSON object\n * @returns {Array<Array<number>>} coordinate position array\n * @example\n * var features = turf.featureCollection([\n * turf.point([26, 37], {foo: 'bar'}),\n * turf.point([36, 53], {hello: 'world'})\n * ]);\n *\n * var coords = turf.coordAll(features);\n * //= [[26, 37], [36, 53]]\n */\nfunction coordAll(geojson) {\n var coords = [];\n coordEach(geojson, function (coord) {\n coords.push(coord);\n });\n return coords;\n}\n\n/**\n * Callback for geomEach\n *\n * @callback geomEachCallback\n * @param {Geometry} currentGeometry The current Geometry being processed.\n * @param {number} featureIndex The current index of the Feature being processed.\n * @param {Object} featureProperties The current Feature Properties being processed.\n * @param {Array<number>} featureBBox The current Feature BBox being processed.\n * @param {number|string} featureId The current Feature Id being processed.\n */\n\n/**\n * Iterate over each geometry in any GeoJSON object, similar to Array.forEach()\n *\n * @name geomEach\n * @param {FeatureCollection|Feature|Geometry} geojson any GeoJSON object\n * @param {Function} callback a method that takes (currentGeometry, featureIndex, featureProperties, featureBBox, featureId)\n * @returns {void}\n * @example\n * var features = turf.featureCollection([\n * turf.point([26, 37], {foo: 'bar'}),\n * turf.point([36, 53], {hello: 'world'})\n * ]);\n *\n * turf.geomEach(features, function (currentGeometry, featureIndex, featureProperties, featureBBox, featureId) {\n * //=currentGeometry\n * //=featureIndex\n * //=featureProperties\n * //=featureBBox\n * //=featureId\n * });\n */\nfunction geomEach(geojson, callback) {\n var i,\n j,\n g,\n geometry,\n stopG,\n geometryMaybeCollection,\n isGeometryCollection,\n featureProperties,\n featureBBox,\n featureId,\n featureIndex = 0,\n isFeatureCollection = geojson.type === \"FeatureCollection\",\n isFeature = geojson.type === \"Feature\",\n stop = isFeatureCollection ? geojson.features.length : 1;\n\n // This logic may look a little weird. The reason why it is that way\n // is because it's trying to be fast. GeoJSON supports multiple kinds\n // of objects at its root: FeatureCollection, Features, Geometries.\n // This function has the responsibility of handling all of them, and that\n // means that some of the `for` loops you see below actually just don't apply\n // to certain inputs. For instance, if you give this just a\n // Point geometry, then both loops are short-circuited and all we do\n // is gradually rename the input until it's called 'geometry'.\n //\n // This also aims to allocate as few resources as possible: just a\n // few numbers and booleans, rather than any temporary arrays as would\n // be required with the normalization approach.\n for (i = 0; i < stop; i++) {\n geometryMaybeCollection = isFeatureCollection\n ? geojson.features[i].geometry\n : isFeature\n ? geojson.geometry\n : geojson;\n featureProperties = isFeatureCollection\n ? geojson.features[i].properties\n : isFeature\n ? geojson.properties\n : {};\n featureBBox = isFeatureCollection\n ? geojson.features[i].bbox\n : isFeature\n ? geojson.bbox\n : undefined;\n featureId = isFeatureCollection\n ? geojson.features[i].id\n : isFeature\n ? geojson.id\n : undefined;\n isGeometryCollection = geometryMaybeCollection\n ? geometryMaybeCollection.type === \"GeometryCollection\"\n : false;\n stopG = isGeometryCollection\n ? geometryMaybeCollection.geometries.length\n : 1;\n\n for (g = 0; g < stopG; g++) {\n geometry = isGeometryCollection\n ? geometryMaybeCollection.geometries[g]\n : geometryMaybeCollection;\n\n // Handle null Geometry\n if (geometry === null) {\n if (\n callback(\n null,\n featureIndex,\n featureProperties,\n featureBBox,\n featureId\n ) === false\n )\n return false;\n continue;\n }\n switch (geometry.type) {\n case \"Point\":\n case \"LineString\":\n case \"MultiPoint\":\n case \"Polygon\":\n case \"MultiLineString\":\n case \"MultiPolygon\": {\n if (\n callback(\n geometry,\n featureIndex,\n featureProperties,\n featureBBox,\n featureId\n ) === false\n )\n return false;\n break;\n }\n case \"GeometryCollection\": {\n for (j = 0; j < geometry.geometries.length; j++) {\n if (\n callback(\n geometry.geometries[j],\n featureIndex,\n featureProperties,\n featureBBox,\n featureId\n ) === false\n )\n return false;\n }\n break;\n }\n default:\n throw new Error(\"Unknown Geometry Type\");\n }\n }\n // Only increase `featureIndex` per each feature\n featureIndex++;\n }\n}\n\n/**\n * Callback for geomReduce\n *\n * The first time the callback function is called, the values provided as arguments depend\n * on whether the reduce method has an initialValue argument.\n *\n * If an initialValue is provided to the reduce method:\n * - The previousValue argument is initialValue.\n * - The currentValue argument is the value of the first element present in the array.\n *\n * If an initialValue is not provided:\n * - The previousValue argument is the value of the first element present in the array.\n * - The currentValue argument is the value of the second element present in the array.\n *\n * @callback geomReduceCallback\n * @param {*} previousValue The accumulated value previously returned in the last invocation\n * of the callback, or initialValue, if supplied.\n * @param {Geometry} currentGeometry The current Geometry being processed.\n * @param {number} featureIndex The current index of the Feature being processed.\n * @param {Object} featureProperties The current Feature Properties being processed.\n * @param {Array<number>} featureBBox The current Feature BBox being processed.\n * @param {number|string} featureId The current Feature Id being processed.\n */\n\n/**\n * Reduce geometry in any GeoJSON object, similar to Array.reduce().\n *\n * @name geomReduce\n * @param {FeatureCollection|Feature|Geometry} geojson any GeoJSON object\n * @param {Function} callback a method that takes (previousValue, currentGeometry, featureIndex, featureProperties, featureBBox, featureId)\n * @param {*} [initialValue] Value to use as the first argument to the first call of the callback.\n * @returns {*} The value that results from the reduction.\n * @example\n * var features = turf.featureCollection([\n * turf.point([26, 37], {foo: 'bar'}),\n * turf.point([36, 53], {hello: 'world'})\n * ]);\n *\n * turf.geomReduce(features, function (previousValue, currentGeometry, featureIndex, featureProperties, featureBBox, featureId) {\n * //=previousValue\n * //=currentGeometry\n * //=featureIndex\n * //=featureProperties\n * //=featureBBox\n * //=featureId\n * return currentGeometry\n * });\n */\nfunction geomReduce(geojson, callback, initialValue) {\n var previousValue = initialValue;\n geomEach(\n geojson,\n function (\n currentGeometry,\n featureIndex,\n featureProperties,\n featureBBox,\n featureId\n ) {\n if (featureIndex === 0 && initialValue === undefined)\n previousValue = currentGeometry;\n else\n previousValue = callback(\n previousValue,\n currentGeometry,\n featureIndex,\n featureProperties,\n featureBBox,\n featureId\n );\n }\n );\n return previousValue;\n}\n\n/**\n * Callback for flattenEach\n *\n * @callback flattenEachCallback\n * @param {Feature} currentFeature The current flattened feature being processed.\n * @param {number} featureIndex The current index of the Feature being processed.\n * @param {number} multiFeatureIndex The current index of the Multi-Feature being processed.\n */\n\n/**\n * Iterate over flattened features in any GeoJSON object, similar to\n * Array.forEach.\n *\n * @name flattenEach\n * @param {FeatureCollection|Feature|Geometry} geojson any GeoJSON object\n * @param {Function} callback a method that takes (currentFeature, featureIndex, multiFeatureIndex)\n * @example\n * var features = turf.featureCollection([\n * turf.point([26, 37], {foo: 'bar'}),\n * turf.multiPoint([[40, 30], [36, 53]], {hello: 'world'})\n * ]);\n *\n * turf.flattenEach(features, function (currentFeature, featureIndex, multiFeatureIndex) {\n * //=currentFeature\n * //=featureIndex\n * //=multiFeatureIndex\n * });\n */\nfunction flattenEach(geojson, callback) {\n geomEach(geojson, function (geometry, featureIndex, properties, bbox, id) {\n // Callback for single geometry\n var type = geometry === null ? null : geometry.type;\n switch (type) {\n case null:\n case \"Point\":\n case \"LineString\":\n case \"Polygon\":\n if (\n callback(\n feature(geometry, properties, { bbox: bbox, id: id }),\n featureIndex,\n 0\n ) === false\n )\n return false;\n return;\n }\n\n var geomType;\n\n // Callback for multi-geometry\n switch (type) {\n case \"MultiPoint\":\n geomType = \"Point\";\n break;\n case \"MultiLineString\":\n geomType = \"LineString\";\n break;\n case \"MultiPolygon\":\n geomType = \"Polygon\";\n break;\n }\n\n for (\n var multiFeatureIndex = 0;\n multiFeatureIndex < geometry.coordinates.length;\n multiFeatureIndex++\n ) {\n var coordinate = geometry.coordinates[multiFeatureIndex];\n var geom = {\n type: geomType,\n coordinates: coordinate,\n };\n if (\n callback(feature(geom, properties), featureIndex, multiFeatureIndex) ===\n false\n )\n return false;\n }\n });\n}\n\n/**\n * Callback for flattenReduce\n *\n * The first time the callback function is called, the values provided as arguments depend\n * on whether the reduce method has an initialValue argument.\n *\n * If an initialValue is provided to the reduce method:\n * - The previousValue argument is initialValue.\n * - The currentValue argument is the value of the first element present in the array.\n *\n * If an initialValue is not provided:\n * - The previousValue argument is the value of the first element present in the array.\n * - The currentValue argument is the value of the second element present in the array.\n *\n * @callback flattenReduceCallback\n * @param {*} previousValue The accumulated value previously returned in the last invocation\n * of the callback, or initialValue, if supplied.\n * @param {Feature} currentFeature The current Feature being processed.\n * @param {number} featureIndex The current index of the Feature being processed.\n * @param {number} multiFeatureIndex The current index of the Multi-Feature being processed.\n */\n\n/**\n * Reduce flattened features in any GeoJSON object, similar to Array.reduce().\n *\n * @name flattenReduce\n * @param {FeatureCollection|Feature|Geometry} geojson any GeoJSON object\n * @param {Function} callback a method that takes (previousValue, currentFeature, featureIndex, multiFeatureIndex)\n * @param {*} [initialValue] Value to use as the first argument to the first call of the callback.\n * @returns {*} The value that results from the reduction.\n * @example\n * var features = turf.featureCollection([\n * turf.point([26, 37], {foo: 'bar'}),\n * turf.multiPoint([[40, 30], [36, 53]], {hello: 'world'})\n * ]);\n *\n * turf.flattenReduce(features, function (previousValue, currentFeature, featureIndex, multiFeatureIndex) {\n * //=previousValue\n * //=currentFeature\n * //=featureIndex\n * //=multiFeatureIndex\n * return currentFeature\n * });\n */\nfunction flattenReduce(geojson, callback, initialValue) {\n var previousValue = initialValue;\n flattenEach(\n geojson,\n function (currentFeature, featureIndex, multiFeatureIndex) {\n if (\n featureIndex === 0 &&\n multiFeatureIndex === 0 &&\n initialValue === undefined\n )\n previousValue = currentFeature;\n else\n previousValue = callback(\n previousValue,\n currentFeature,\n featureIndex,\n multiFeatureIndex\n );\n }\n );\n return previousValue;\n}\n\n/**\n * Callback for segmentEach\n *\n * @callback segmentEachCallback\n * @param {Feature<LineString>} currentSegment The current Segment being processed.\n * @param {number} featureIndex The current index of the Feature being processed.\n * @param {number} multiFeatureIndex The current index of the Multi-Feature being processed.\n * @param {number} geometryIndex The current index of the Geometry being processed.\n * @param {number} segmentIndex The current index of the Segment being processed.\n * @returns {void}\n */\n\n/**\n * Iterate over 2-vertex line segment in any GeoJSON object, similar to Array.forEach()\n * (Multi)Point geometries do not contain segments therefore they are ignored during this operation.\n *\n * @param {FeatureCollection|Feature|Geometry} geojson any GeoJSON\n * @param {Function} callback a method that takes (currentSegment, featureIndex, multiFeatureIndex, geometryIndex, segmentIndex)\n * @returns {void}\n * @example\n * var polygon = turf.polygon([[[-50, 5], [-40, -10], [-50, -10], [-40, 5], [-50, 5]]]);\n *\n * // Iterate over GeoJSON by 2-vertex segments\n * turf.segmentEach(polygon, function (currentSegment, featureIndex, multiFeatureIndex, geometryIndex, segmentIndex) {\n * //=currentSegment\n * //=featureIndex\n * //=multiFeatureIndex\n * //=geometryIndex\n * //=segmentIndex\n * });\n *\n * // Calculate the total number of segments\n * var total = 0;\n * turf.segmentEach(polygon, function () {\n * total++;\n * });\n */\nfunction segmentEach(geojson, callback) {\n flattenEach(geojson, function (feature, featureIndex, multiFeatureIndex) {\n var segmentIndex = 0;\n\n // Exclude null Geometries\n if (!feature.geometry) return;\n // (Multi)Point geometries do not contain segments therefore they are ignored during this operation.\n var type = feature.geometry.type;\n if (type === \"Point\" || type === \"MultiPoint\") return;\n\n // Generate 2-vertex line segments\n var previousCoords;\n var previousFeatureIndex = 0;\n var previousMultiIndex = 0;\n var prevGeomIndex = 0;\n if (\n coordEach(\n feature,\n function (\n currentCoord,\n coordIndex,\n featureIndexCoord,\n multiPartIndexCoord,\n geometryIndex\n ) {\n // Simulating a meta.coordReduce() since `reduce` operations cannot be stopped by returning `false`\n if (\n previousCoords === undefined ||\n featureIndex > previousFeatureIndex ||\n multiPartIndexCoord > previousMultiIndex ||\n geometryIndex > prevGeomIndex\n ) {\n previousCoords = currentCoord;\n previousFeatureIndex = featureIndex;\n previousMultiIndex = multiPartIndexCoord;\n prevGeomIndex = geometryIndex;\n segmentIndex = 0;\n return;\n }\n var currentSegment = lineString(\n [previousCoords, currentCoord],\n feature.properties\n );\n if (\n callback(\n currentSegment,\n featureIndex,\n multiFeatureIndex,\n geometryIndex,\n segmentIndex\n ) === false\n )\n return false;\n segmentIndex++;\n previousCoords = currentCoord;\n }\n ) === false\n )\n return false;\n });\n}\n\n/**\n * Callback for segmentReduce\n *\n * The first time the callback function is called, the values provided as arguments depend\n * on whether the reduce method has an initialValue argument.\n *\n * If an initialValue is provided to the reduce method:\n * - The previousValue argument is initialValue.\n * - The currentValue argument is the value of the first element present in the array.\n *\n * If an initialValue is not provided:\n * - The previousValue argument is the value of the first element present in the array.\n * - The currentValue argument is the value of the second element present in the array.\n *\n * @callback segmentReduceCallback\n * @param {*} previousValue The accumulated value previously returned in the last invocation\n * of the callback, or initialValue, if supplied.\n * @param {Feature<LineString>} currentSegment The current Segment being processed.\n * @param {number} featureIndex The current index of the Feature being processed.\n * @param {number} multiFeatureIndex The current index of the Multi-Feature being processed.\n * @param {number} geometryIndex The current index of the Geometry being processed.\n * @param {number} segmentIndex The current index of the Segment being processed.\n */\n\n/**\n * Reduce 2-vertex line segment in any GeoJSON object, similar to Array.reduce()\n * (Multi)Point geometries do not contain segments therefore they are ignored during this operation.\n *\n * @param {FeatureCollection|Feature|Geometry} geojson any GeoJSON\n * @param {Function} callback a method that takes (previousValue, currentSegment, currentIndex)\n * @param {*} [initialValue] Value to use as the first argument to the first call of the callback.\n * @returns {void}\n * @example\n * var polygon = turf.polygon([[[-50, 5], [-40, -10], [-50, -10], [-40, 5], [-50, 5]]]);\n *\n * // Iterate over GeoJSON by 2-vertex segments\n * turf.segmentReduce(polygon, function (previousSegment, currentSegment, featureIndex, multiFeatureIndex, geometryIndex, segmentIndex) {\n * //= previousSegment\n * //= currentSegment\n * //= featureIndex\n * //= multiFeatureIndex\n * //= geometryIndex\n * //= segmentIndex\n * return currentSegment\n * });\n *\n * // Calculate the total number of segments\n * var initialValue = 0\n * var total = turf.segmentReduce(polygon, function (previousValue) {\n * previousValue++;\n * return previousValue;\n * }, initialValue);\n */\nfunction segmentReduce(geojson, callback, initialValue) {\n var previousValue = initialValue;\n var started = false;\n segmentEach(\n geojson,\n function (\n currentSegment,\n featureIndex,\n multiFeatureIndex,\n geometryIndex,\n segmentIndex\n ) {\n if (started === false && initialValue === undefined)\n previousValue = currentSegment;\n else\n previousValue = callback(\n previousValue,\n currentSegment,\n featureIndex,\n multiFeatureIndex,\n geometryIndex,\n segmentIndex\n );\n started = true;\n }\n );\n return previousValue;\n}\n\n/**\n * Callback for lineEach\n *\n * @callback lineEachCallback\n * @param {Feature<LineString>} currentLine The current LineString|LinearRing being processed\n * @param {number} featureIndex The current index of the Feature being processed\n * @param {number} multiFeatureIndex The current index of the Multi-Feature being processed\n * @param {number} geometryIndex The current index of the Geometry being processed\n */\n\n/**\n * Iterate over line or ring coordinates in LineString, Polygon, MultiLineString, MultiPolygon Features or Geometries,\n * similar to Array.forEach.\n *\n * @name lineEach\n * @param {Geometry|Feature<LineString|Polygon|MultiLineString|MultiPolygon>} geojson object\n * @param {Function} callback a method that takes (currentLine, featureIndex, multiFeatureIndex, geometryIndex)\n * @example\n * var multiLine = turf.multiLineString([\n * [[26, 37], [35, 45]],\n * [[36, 53], [38, 50], [41, 55]]\n * ]);\n *\n * turf.lineEach(multiLine, function (currentLine, featureIndex, multiFeatureIndex, geometryIndex) {\n * //=currentLine\n * //=featureIndex\n * //=multiFeatureIndex\n * //=geometryIndex\n * });\n */\nfunction lineEach(geojson, callback) {\n // validation\n if (!geojson) throw new Error(\"geojson is required\");\n\n flattenEach(geojson, function (feature, featureIndex, multiFeatureIndex) {\n if (feature.geometry === null) return;\n var type = feature.geometry.type;\n var coords = feature.geometry.coordinates;\n switch (type) {\n case \"LineString\":\n if (callback(feature, featureIndex, multiFeatureIndex, 0, 0) === false)\n return false;\n break;\n case \"Polygon\":\n for (\n var geometryIndex = 0;\n geometryIndex < coords.length;\n geometryIndex++\n ) {\n if (\n callback(\n lineString(coords[geometryIndex], feature.properties),\n featureIndex,\n multiFeatureIndex,\n geometryIndex\n ) === false\n )\n return false;\n }\n break;\n }\n });\n}\n\n/**\n * Callback for lineReduce\n *\n * The first time the callback function is called, the values provided as arguments depend\n * on whether the reduce method has an initialValue argument.\n *\n * If an initialValue is provided to the reduce method:\n * - The previousValue argument is initialValue.\n * - The currentValue argument is the value of the first element present in the array.\n *\n * If an initialValue is not provided:\n * - The previousValue argument is the value of the first element present in the array.\n * - The currentValue argument is the value of the second element present in the array.\n *\n * @callback lineReduceCallback\n * @param {*} previousValue The accumulated value previously returned in the last invocation\n * of the callback, or initialValue, if supplied.\n * @param {Feature<LineString>} currentLine The current LineString|LinearRing being processed.\n * @param {number} featureIndex The current index of the Feature being processed\n * @param {number} multiFeatureIndex The current index of the Multi-Feature being processed\n * @param {number} geometryIndex The current index of the Geometry being processed\n */\n\n/**\n * Reduce features in any GeoJSON object, similar to Array.reduce().\n *\n * @name lineReduce\n * @param {Geometry|Feature<LineString|Polygon|MultiLineString|MultiPolygon>} geojson object\n * @param {Function} callback a method that takes (previousValue, currentLine, featureIndex, multiFeatureIndex, geometryIndex)\n * @param {*} [initialValue] Value to use as the first argument to the first call of the callback.\n * @returns {*} The value that results from the reduction.\n * @example\n * var multiPoly = turf.multiPolygon([\n * turf.polygon([[[12,48],[2,41],[24,38],[12,48]], [[9,44],[13,41],[13,45],[9,44]]]),\n * turf.polygon([[[5, 5], [0, 0], [2, 2], [4, 4], [5, 5]]])\n * ]);\n *\n * turf.lineReduce(multiPoly, function (previousValue, currentLine, featureIndex, multiFeatureIndex, geometryIndex) {\n * //=previousValue\n * //=currentLine\n * //=featureIndex\n * //=multiFeatureIndex\n * //=geometryIndex\n * return currentLine\n * });\n */\nfunction lineReduce(geojson, callback, initialValue) {\n var previousValue = initialValue;\n lineEach(\n geojson,\n function (currentLine, featureIndex, multiFeatureIndex, geometryIndex) {\n if (featureIndex === 0 && initialValue === undefined)\n previousValue = currentLine;\n else\n previousValue = callback(\n previousValue,\n currentLine,\n featureIndex,\n multiFeatureIndex,\n geometryIndex\n );\n }\n );\n return previousValue;\n}\n\n/**\n * Finds a particular 2-vertex LineString Segment from a GeoJSON using `@turf/meta` indexes.\n *\n * Negative indexes are permitted.\n * Point & MultiPoint will always return null.\n *\n * @param {FeatureCollection|Feature|Geometry} geojson Any GeoJSON Feature or Geometry\n * @param {Object} [options={}] Optional parameters\n * @param {number} [options.featureIndex=0] Feature Index\n * @param {number} [options.multiFeatureIndex=0] Multi-Feature Index\n * @param {number} [options.geometryIndex=0] Geometry Index\n * @param {number} [options.segmentIndex=0] Segment Index\n * @param {Object} [options.properties={}] Translate Properties to output LineString\n * @param {BBox} [options.bbox={}] Translate BBox to output LineString\n * @param {number|string} [options.id={}] Translate Id to output LineString\n * @returns {Feature<LineString>} 2-vertex GeoJSON Feature LineString\n * @example\n * var multiLine = turf.multiLineString([\n * [[10, 10], [50, 30], [30, 40]],\n * [[-10, -10], [-50, -30], [-30, -40]]\n * ]);\n *\n * // First Segment (defaults are 0)\n * turf.findSegment(multiLine);\n * // => Feature<LineString<[[10, 10], [50, 30]]>>\n *\n * // First Segment of 2nd Multi Feature\n * turf.findSegment(multiLine, {multiFeatureIndex: 1});\n * // => Feature<LineString<[[-10, -10], [-50, -30]]>>\n *\n * // Last Segment of Last Multi Feature\n * turf.findSegment(multiLine, {multiFeatureIndex: -1, segmentIndex: -1});\n * // => Feature<LineString<[[-50, -30], [-30, -40]]>>\n */\nfunction findSegment(geojson, options) {\n // Optional Parameters\n options = options || {};\n if (!isObject(options)) throw new Error(\"options is invalid\");\n var featureIndex = options.featureIndex || 0;\n var multiFeatureIndex = options.multiFeatureIndex || 0;\n var geometryIndex = options.geometryIndex || 0;\n var segmentIndex = options.segmentIndex || 0;\n\n // Find FeatureIndex\n var properties = options.properties;\n var geometry;\n\n switch (geojson.type) {\n case \"FeatureCollection\":\n if (featureIndex < 0)\n featureIndex = geojson.features.length + featureIndex;\n properties = properties || geojson.features[featureIndex].properties;\n geometry = geojson.features[featureIndex].geometry;\n break;\n case \"Feature\":\n properties = properties || geojson.properties;\n geometry = geojson.geometry;\n break;\n case \"Point\":\n case \"MultiPoint\":\n return null;\n case \"LineString\":\n case \"Polygon\":\n case \"MultiLineString\":\n case \"MultiPolygon\":\n geometry = geojson;\n break;\n default:\n throw new Error(\"geojson is invalid\");\n }\n\n // Find SegmentIndex\n if (geometry === null) return null;\n var coords = geometry.coordinates;\n switch (geometry.type) {\n case \"Point\":\n case \"MultiPoint\":\n return null;\n case \"LineString\":\n if (segmentIndex < 0) segmentIndex = coords.length + segmentIndex - 1;\n return lineString(\n [coords[segmentIndex], coords[segmentIndex + 1]],\n properties,\n options\n );\n case \"Polygon\":\n if (geometryIndex < 0) geometryIndex = coords.length + geometryIndex;\n if (segmentIndex < 0)\n segmentIndex = coords[geometryIndex].length + segmentIndex - 1;\n return lineString(\n [\n coords[geometryIndex][segmentIndex],\n coords[geometryIndex][segmentIndex + 1],\n ],\n properties,\n options\n );\n case \"MultiLineString\":\n if (multiFeatureIndex < 0)\n multiFeatureIndex = coords.length + multiFeatureIndex;\n if (segmentIndex < 0)\n segmentIndex = coords[multiFeatureIndex].length + segmentIndex - 1;\n return lineString(\n [\n coords[multiFeatureIndex][segmentIndex],\n coords[multiFeatureIndex][segmentIndex + 1],\n ],\n properties,\n options\n );\n case \"MultiPolygon\":\n if (multiFeatureIndex < 0)\n multiFeatureIndex = coords.length + multiFeatureIndex;\n if (geometryIndex < 0)\n geometryIndex = coords[multiFeatureIndex].length + geometryIndex;\n if (segmentIndex < 0)\n segmentIndex =\n coords[multiFeatureIndex][geometryIndex].length - segmentIndex - 1;\n return lineString(\n [\n coords[multiFeatureIndex][geometryIndex][segmentIndex],\n coords[multiFeatureIndex][geometryIndex][segmentIndex + 1],\n ],\n properties,\n options\n );\n }\n throw new Error(\"geojson is invalid\");\n}\n\n/**\n * Finds a particular Point from a GeoJSON using `@turf/meta` indexes.\n *\n * Negative indexes are permitted.\n *\n * @param {FeatureCollection|Feature|Geometry} geojson Any GeoJSON Feature or Geometry\n * @param {Object} [options={}] Optional parameters\n * @param {number} [options.featureIndex=0] Feature Index\n * @param {number} [options.multiFeatureIndex=0] Multi-Feature Index\n * @param {number} [options.geometryIndex=0] Geometry Index\n * @param {number} [options.coordIndex=0] Coord Index\n * @param {Object} [options.properties={}] Translate Properties to output Point\n * @param {BBox} [options.bbox={}] Translate BBox to output Point\n * @param {number|string} [options.id={}] Translate Id to output Point\n * @returns {Feature<Point>} 2-vertex GeoJSON Feature Point\n * @example\n * var multiLine = turf.multiLineString([\n * [[10, 10], [50, 30], [30, 40]],\n * [[-10, -10], [-50, -30], [-30, -40]]\n * ]);\n *\n * // First Segment (defaults are 0)\n * turf.findPoint(multiLine);\n * // => Feature<Point<[10, 10]>>\n *\n * // First Segment of the 2nd Multi-Feature\n * turf.findPoint(multiLine, {multiFeatureIndex: 1});\n * // => Feature<Point<[-10, -10]>>\n *\n * // Last Segment of last Multi-Feature\n * turf.findPoint(multiLine, {multiFeatureIndex: -1, coordIndex: -1});\n * // => Feature<Point<[-30, -40]>>\n */\nfunction findPoint(geojson, options) {\n // Optional Parameters\n options = options || {};\n if (!isObject(options)) throw new Error(\"options is invalid\");\n var featureIndex = options.featureIndex || 0;\n var multiFeatureIndex = options.multiFeatureIndex || 0;\n var geometryIndex = options.geometryIndex || 0;\n var coordIndex = options.coordIndex || 0;\n\n // Find FeatureIndex\n var properties = options.properties;\n var geometry;\n\n switch (geojson.type) {\n case \"FeatureCollection\":\n if (featureIndex < 0)\n featureIndex = geojson.features.length + featureIndex;\n properties = properties || geojson.features[featureIndex].properties;\n geometry = geojson.features[featureIndex].geometry;\n break;\n case \"Feature\":\n properties = properties || geojson.properties;\n geometry = geojson.geometry;\n break;\n case \"Point\":\n case \"MultiPoint\":\n return null;\n case \"LineString\":\n case \"Polygon\":\n case \"MultiLineString\":\n case \"MultiPolygon\":\n geometry = geojson;\n break;\n default:\n throw new Error(\"geojson is invalid\");\n }\n\n // Find Coord Index\n if (geometry === null) return null;\n var coords = geometry.coordinates;\n switch (geometry.type) {\n case \"Point\":\n return point(coords, properties, options);\n case \"MultiPoint\":\n if (multiFeatureIndex < 0)\n multiFeatureIndex = coords.length + multiFeatureIndex;\n return point(coords[multiFeatureIndex], properties, options);\n case \"LineString\":\n if (coordIndex < 0) coordIndex = coords.length + coordIndex;\n return point(coords[coordIndex], properties, options);\n case \"Polygon\":\n if (geometryIndex < 0) geometryIndex = coords.length + geometryIndex;\n if (coordIndex < 0)\n coordIndex = coords[geometryIndex].length + coordIndex;\n return point(coords[geometryIndex][coordIndex], properties, options);\n case \"MultiLineString\":\n if (multiFeatureIndex < 0)\n multiFeatureIndex = coords.length + multiFeatureIndex;\n if (coordIndex < 0)\n coordIndex = coords[multiFeatureIndex].length + coordIndex;\n return point(coords[multiFeatureIndex][coordIndex], properties, options);\n case \"MultiPolygon\":\n if (multiFeatureIndex < 0)\n multiFeatureIndex = coords.length + multiFeatureIndex;\n if (geometryIndex < 0)\n geometryIndex = coords[multiFeatureIndex].length + geometryIndex;\n if (coordIndex < 0)\n coordIndex =\n coords[multiFeatureIndex][geometryIndex].length - coordIndex;\n return point(\n coords[multiFeatureIndex][geometryIndex][coordIndex],\n properties,\n options\n );\n }\n throw new Error(\"geojson is invalid\");\n}\n\nexport { coordAll, coordEach, coordReduce, featureEach, featureReduce, findPoint, findSegment, flattenEach, flattenReduce, geomEach, geomReduce, lineEach, lineReduce, propEach, propReduce, segmentEach, segmentReduce };\n", "/**\n * @module helpers\n */\n/**\n * Earth Radius used with the Harvesine formula and approximates using a spherical (non-ellipsoid) Earth.\n *\n * @memberof helpers\n * @type {number}\n */\nexport var earthRadius = 6371008.8;\n/**\n * Unit of measurement factors using a spherical (non-ellipsoid) earth radius.\n *\n * @memberof helpers\n * @type {Object}\n */\nexport var factors = {\n centimeters: earthRadius * 100,\n centimetres: earthRadius * 100,\n degrees: earthRadius / 111325,\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 * Units of measurement factors based on 1 meter.\n *\n * @memberof helpers\n * @type {Object}\n */\nexport var unitsFactors = {\n centimeters: 100,\n centimetres: 100,\n degrees: 1 / 111325,\n feet: 3.28084,\n inches: 39.37,\n kilometers: 1 / 1000,\n kilometres: 1 / 1000,\n meters: 1,\n metres: 1,\n miles: 1 / 1609.344,\n millimeters: 1000,\n millimetres: 1000,\n nauticalmiles: 1 / 1852,\n radians: 1 / earthRadius,\n yards: 1.0936133,\n};\n/**\n * Area of measurement factors based on 1 square meter.\n *\n * @memberof helpers\n * @type {Object}\n */\nexport var areaFactors = {\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 millimeters: 1000000,\n millimetres: 1000000,\n yards: 1.195990046,\n};\n/**\n * Wraps a GeoJSON {@link Geometry} in a GeoJSON {@link Feature}.\n *\n * @name feature\n * @param {Geometry} geometry input geometry\n * @param {Object} [properties={}] an Object of key-value pairs to add as properties\n * @param {Object} [options={}] Optional Parameters\n * @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature\n * @param {string|number} [options.id] Identifier associated with the Feature\n * @returns {Feature} 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(geom, properties, options) {\n if (options === void 0) { options = {}; }\n var feat = { 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 * Creates a GeoJSON {@link Geometry} from a Geometry string type & coordinates.\n * For GeometryCollection type use `helpers.geometryCollection`\n *\n * @name geometry\n * @param {string} 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(type, coordinates, _options) {\n if (_options === void 0) { _options = {}; }\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 * Creates a {@link Point} {@link Feature} from a Position.\n *\n * @name point\n * @param {Array<number>} coordinates longitude, latitude position (each in decimal degrees)\n * @param {Object} [properties={}] an Object of key-value pairs to add as properties\n * @param {Object} [options={}] Optional Parameters\n * @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature\n * @param {string|number} [options.id] Identifier associated with the Feature\n * @returns {Feature<Point>} a Point feature\n * @example\n * var point = turf.point([-75.343, 39.984]);\n *\n * //=point\n */\nexport function point(coordinates, properties, options) {\n if (options === void 0) { options = {}; }\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 var geom = {\n type: \"Point\",\n coordinates: coordinates,\n };\n return feature(geom, properties, options);\n}\n/**\n * Creates a {@link Point} {@link FeatureCollection} from an Array of Point coordinates.\n *\n * @name points\n * @param {Array<Array<number>>} coordinates an array of Points\n * @param {Object} [properties={}] Translate these properties to each Feature\n * @param {Object} [options={}] Optional Parameters\n * @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north]\n * associated with the FeatureCollection\n * @param {string|number} [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(coordinates, properties, options) {\n if (options === void 0) { options = {}; }\n return featureCollection(coordinates.map(function (coords) {\n return point(coords, properties);\n }), options);\n}\n/**\n * Creates a {@link Polygon} {@link Feature} from an Array of LinearRings.\n *\n * @name polygon\n * @param {Array<Array<Array<number>>>} coordinates an array of LinearRings\n * @param {Object} [properties={}] an Object of key-value pairs to add as properties\n * @param {Object} [options={}] Optional Parameters\n * @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature\n * @param {string|number} [options.id] Identifier associated with the Feature\n * @returns {Feature<Polygon>} 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(coordinates, properties, options) {\n if (options === void 0) { options = {}; }\n for (var _i = 0, coordinates_1 = coordinates; _i < coordinates_1.length; _i++) {\n var ring = coordinates_1[_i];\n if (ring.length < 4) {\n throw new Error(\"Each LinearRing of a Polygon must have 4 or more Positions.\");\n }\n for (var 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 var geom = {\n type: \"Polygon\",\n coordinates: coordinates,\n };\n return feature(geom, properties, options);\n}\n/**\n * Creates a {@link Polygon} {@link FeatureCollection} from an Array of Polygon coordinates.\n *\n * @name polygons\n * @param {Array<Array<Array<Array<number>>>>} coordinates an array of Polygon coordinates\n * @param {Object} [properties={}] an Object of key-value pairs to add as properties\n * @param {Object} [options={}] Optional Parameters\n * @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature\n * @param {string|number} [options.id] Identifier associated with the FeatureCollection\n * @returns {FeatureCollection<Polygon>} 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(coordinates, properties, options) {\n if (options === void 0) { options = {}; }\n return featureCollection(coordinates.map(function (coords) {\n return polygon(coords, properties);\n }), options);\n}\n/**\n * Creates a {@link LineString} {@link Feature} from an Array of Positions.\n *\n * @name lineString\n * @param {Array<Array<number>>} coordinates an array of Positions\n * @param {Object} [properties={}] an Object of key-value pairs to add as properties\n * @param {Object} [options={}] Optional Parameters\n * @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature\n * @param {string|number} [options.id] Identifier associated with the Feature\n * @returns {Feature<LineString>} 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(coordinates, properties, options) {\n if (options === void 0) { options = {}; }\n if (coordinates.length < 2) {\n throw new Error(\"coordinates must be an array of two or more positions\");\n }\n var geom = {\n type: \"LineString\",\n coordinates: coordinates,\n };\n return feature(geom, properties, options);\n}\n/**\n * Creates a {@link LineString} {@link FeatureCollection} from an Array of LineString coordinates.\n *\n * @name lineStrings\n * @param {Array<Array<Array<number>>>} coordinates an array of LinearRings\n * @param {Object} [properties={}] an Object of key-value pairs to add as properties\n * @param {Object} [options={}] Optional Parameters\n * @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north]\n * associated with the FeatureCollection\n * @param {string|number} [options.id] Identifier associated with the FeatureCollection\n * @returns {FeatureCollection<LineString>} 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(coordinates, properties, options) {\n if (options === void 0) { options = {}; }\n return featureCollection(coordinates.map(function (coords) {\n return lineString(coords, properties);\n }), options);\n}\n/**\n * Takes one or more {@link Feature|Features} and creates a {@link FeatureCollection}.\n *\n * @name featureCollection\n * @param {Feature[]} features input features\n * @param {Object} [options={}] Optional Parameters\n * @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature\n * @param {string|number} [options.id] Identifier associated with the Feature\n * @returns {FeatureCollection} 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(features, options) {\n if (options === void 0) { options = {}; }\n var fc = { 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 * Creates a {@link Feature<MultiLineString>} based on a\n * coordinate array. Properties can be added optionally.\n *\n * @name multiLineString\n * @param {Array<Array<Array<number>>>} coordinates an array of LineStrings\n * @param {Object} [properties={}] an Object of key-value pairs to add as properties\n * @param {Object} [options={}] Optional Parameters\n * @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature\n * @param {string|number} [options.id] Identifier associated with the Feature\n * @returns {Feature<MultiLineString>} 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(coordinates, properties, options) {\n if (options === void 0) { options = {}; }\n var geom = {\n type: \"MultiLineString\",\n coordinates: coordinates,\n };\n return feature(geom, properties, options);\n}\n/**\n * Creates a {@link Feature<MultiPoint>} based on a\n * coordinate array. Properties can be added optionally.\n *\n * @name multiPoint\n * @param {Array<Array<number>>} coordinates an array of Positions\n * @param {Object} [properties={}] an Object of key-value pairs to add as properties\n * @param {Object} [options={}] Optional Parameters\n * @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature\n * @param {string|number} [options.id] Identifier associated with the Feature\n * @returns {Feature<MultiPoint>} 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(coordinates, properties, options) {\n if (options === void 0) { options = {}; }\n var geom = {\n type: \"MultiPoint\",\n coordinates: coordinates,\n };\n return feature(geom, properties, options);\n}\n/**\n * Creates a {@link Feature<MultiPolygon>} based on a\n * coordinate array. Properties can be added optionally.\n *\n * @name multiPolygon\n * @param {Array<Array<Array<Array<number>>>>} coordinates an array of Polygons\n * @param {Object} [properties={}] an Object of key-value pairs to add as properties\n * @param {Object} [options={}] Optional Parameters\n * @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature\n * @param {string|number} [options.id] Identifier associated with the Feature\n * @returns {Feature<MultiPolygon>} 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(coordinates, properties, options) {\n if (options === void 0) { options = {}; }\n var geom = {\n type: \"MultiPolygon\",\n coordinates: coordinates,\n };\n return feature(geom, properties, options);\n}\n/**\n * Creates a {@link Feature<GeometryCollection>} based on a\n * coordinate array. Properties can be added optionally.\n *\n * @name geometryCollection\n * @param {Array<Geometry>} geometries an array of GeoJSON Geometries\n * @param {Object} [properties={}] an Object of key-value pairs to add as properties\n * @param {Object} [options={}] Optional Parameters\n * @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature\n * @param {string|number} [options.id] Identifier associated with the Feature\n * @returns {Feature<GeometryCollection>} 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(geometries, properties, options) {\n if (options === void 0) { options = {}; }\n var geom = {\n type: \"GeometryCollection\",\n geometries: geometries,\n };\n return feature(geom, properties, options);\n}\n/**\n * Round number to precision\n *\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, precision) {\n if (precision === void 0) { precision = 0; }\n if (precision && !(precision >= 0)) {\n throw new Error(\"precision must be a positive number\");\n }\n var multiplier = Math.pow(10, precision || 0);\n return Math.round(num * multiplier) / multiplier;\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 * @name radiansToLength\n * @param {number} radians in radians across the sphere\n * @param {string} [units=\"kilometers\"] can be degrees, radians, miles, inches, yards, metres,\n * meters, kilometres, kilometers.\n * @returns {number} distance\n */\nexport function radiansToLength(radians, units) {\n if (units === void 0) { units = \"kilometers\"; }\n var factor = factors[units];\n if (!factor) {\n throw new Error(units + \" units is invalid\");\n }\n return radians * factor;\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 * @name lengthToRadians\n * @param {number} distance in real units\n * @param {string} [units=\"kilometers\"] can be degrees, radians, miles, inches, yards, metres,\n * meters, kilometres, kilometers.\n * @returns {number} radians\n */\nexport function lengthToRadians(distance, units) {\n if (units === void 0) { units = \"kilometers\"; }\n var factor = factors[units];\n if (!factor) {\n throw new Error(units + \" units is invalid\");\n }\n return distance / factor;\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 * @name lengthToDegrees\n * @param {number} distance in real units\n * @param {string} [units=\"kilometers\"] can be degrees, radians, miles, inches, yards, metres,\n * meters, kilometres, kilometers.\n * @returns {number} degrees\n */\nexport function lengthToDegrees(distance, units) {\n return radiansToDegrees(lengthToRadians(distance, units));\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 * @name bearingToAzimuth\n * @param {number} bearing angle, between -180 and +180 degrees\n * @returns {number} angle between 0 and 360 degrees\n */\nexport function bearingToAzimuth(bearing) {\n var angle = bearing % 360;\n if (angle < 0) {\n angle += 360;\n }\n return angle;\n}\n/**\n * Converts an angle in radians to degrees\n *\n * @name radiansToDegrees\n * @param {number} radians angle in radians\n * @returns {number} degrees between 0 and 360 degrees\n */\nexport function radiansToDegrees(radians) {\n var degrees = radians % (2 * Math.PI);\n return (degrees * 180) / Math.PI;\n}\n/**\n * Converts an angle in degrees to radians\n *\n * @name degreesToRadians\n * @param {number} degrees angle between 0 and 360 degrees\n * @returns {number} angle in radians\n */\nexport function degreesToRadians(degrees) {\n var radians = degrees % 360;\n return (radians * Math.PI) / 180;\n}\n/**\n * Converts a length to the requested unit.\n * Valid units: miles, nauticalmiles, inches, yards, meters, metres, kilometers, centimeters, feet\n *\n * @param {number} length to be converted\n * @param {Units} [originalUnit=\"kilometers\"] of the length\n * @param {Units} [finalUnit=\"kilometers\"] returned unit\n * @returns {number} the converted length\n */\nexport function convertLength(length, originalUnit, finalUnit) {\n if (originalUnit === void 0) { originalUnit = \"kilometers\"; }\n if (finalUnit === void 0) { finalUnit = \"kilometers\"; }\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 * Converts a area to the requested unit.\n * Valid units: kilometers, kilometres, meters, metres, centimetres, millimeters, acres, miles, yards, feet, inches, hectares\n * @param {number} area to be converted\n * @param {Units} [originalUnit=\"meters\"] of the distance\n * @param {Units} [finalUnit=\"kilometers\"] returned unit\n * @returns {number} the converted area\n */\nexport function convertArea(area, originalUnit, finalUnit) {\n if (originalUnit === void 0) { originalUnit = \"meters\"; }\n if (finalUnit === void 0) { finalUnit = \"kilometers\"; }\n if (!(area >= 0)) {\n throw new Error(\"area must be a positive number\");\n }\n var startFactor = areaFactors[originalUnit];\n if (!startFactor) {\n throw new Error(\"invalid original units\");\n }\n var finalFactor = areaFactors[finalUnit];\n if (!finalFactor) {\n throw new Error(\"invalid final units\");\n }\n return (area / startFactor) * finalFactor;\n}\n/**\n * isNumber\n *\n * @param {*} 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) {\n return !isNaN(num) && num !== null && !Array.isArray(num);\n}\n/**\n * isObject\n *\n * @param {*} input variable to validate\n * @returns {boolean} true/false\n * @example\n * turf.isObject({elevation: 10})\n * //=true\n * turf.isObject('foo')\n * //=false\n */\nexport function isObject(input) {\n return !!input && input.constructor === Object;\n}\n/**\n * Validate BBox\n *\n * @private\n * @param {Array<number>} 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) {\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(function (num) {\n if (!isNumber(num)) {\n throw new Error(\"bbox must only contain numbers\");\n }\n });\n}\n/**\n * Validate Id\n *\n * @private\n * @param {string|number} 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) {\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 { isColor, Logger } from '@packages/internal/common';\nimport type { LineStyle, Shading } from '../../renderer';\n\nexport const DEFAULT_COLOR = '#ffffff';\nconst DEFAULT_WALL_WIDTH = 0.1;\nexport const DEFAULT_HEIGHT = 0.1;\n\n/**\n * Determines how a material is rendered, back face, front face or both (default)\n */\nexport type MaterialSide = 'back' | 'front' | 'double';\n\ntype Style = {\n\tcolor: string;\n\twidth: number;\n\topacity: number;\n\tvisible: boolean;\n\theight: number;\n\taltitude: number;\n\tjoin: LineStyle['join'];\n\tcap: LineStyle['cap'];\n\ttopColor?: string;\n\ttexture?: string;\n\ttopTexture?: string;\n\tshowImage: boolean;\n\tflipImageToFaceCamera: boolean;\n\turl?: string;\n\tside?: MaterialSide;\n\trenderOrder?: number;\n\tshading?: Shading;\n};\n\nexport class StyleComponent implements Style {\n\tinitialColor = DEFAULT_COLOR;\n\t#color = DEFAULT_COLOR;\n\tset color(color: string) {\n\t\tif (isColor(color)) {\n\t\t\tthis.#color = color;\n\t\t} else {\n\t\t\tLogger.warn(`Failed to update color. Invalid color \"${color}\".`);\n\t\t}\n\t}\n\tget color(): string {\n\t\treturn this.#color;\n\t}\n\tinitialTopColor?: string;\n\t#topColor?: string;\n\tset topColor(color: string | undefined) {\n\t\t// topColor may be undefined to unset it\n\t\tif (color === undefined || isColor(color)) {\n\t\t\tthis.#topColor = color;\n\t\t} else {\n\t\t\tLogger.warn(`Failed to update top color. Invalid color \"${color}\".`);\n\t\t}\n\t}\n\tget topColor(): string | undefined {\n\t\treturn this.#topColor;\n\t}\n\ttopTexture?: string;\n\ttexture?: string;\n\t#hoverColor?: string;\n\tset hoverColor(color: string) {\n\t\tif (isColor(color)) {\n\t\t\tthis.#hoverColor = color;\n\t\t} else {\n\t\t\tLogger.warn(`Failed to update hover color. Invalid color \"${color}\".`);\n\t\t}\n\t}\n\tget hoverColor(): string | undefined {\n\t\treturn this.#hoverColor;\n\t}\n\tdirty = true;\n\tvisible = true;\n\topacity = 1;\n\twidth = DEFAULT_WALL_WIDTH;\n\theight = DEFAULT_HEIGHT;\n\tinitialHeight = DEFAULT_HEIGHT;\n\taltitude = 0;\n\tjoin: LineStyle['join'] = 'round';\n\tcap: LineStyle['cap'] = 'round';\n\tshowImage = true;\n\tflipImageToFaceCamera = true;\n\turl?: string;\n\tside: MaterialSide = 'double';\n\trenderOrder = 0;\n\tshading?: Shading;\n\tconstructor(style: Partial<Style> = {}) {\n\t\tthis.color = style?.color !== undefined ? style.color : this.color;\n\t\tthis.initialColor = this.color;\n\t\tthis.width = style?.width !== undefined ? style.width : this.width;\n\t\tthis.opacity = style?.opacity !== undefined ? style.opacity : this.opacity;\n\t\tthis.visible = style?.visible !== undefined ? style.visible : this.visible;\n\t\tthis.height = style?.height !== undefined ? style.height : this.height;\n\t\tthis.initialHeight = this.height;\n\t\tthis.altitude = style?.altitude !== undefined ? style.altitude : this.altitude;\n\t\tthis.join = style?.join !== undefined ? style.join : this.join;\n\t\tthis.cap = style?.cap !== undefined ? style.cap : this.cap;\n\t\tthis.topColor = style?.topColor;\n\t\tthis.initialTopColor = this.topColor;\n\t\tthis.texture = style?.texture;\n\t\tthis.topTexture = style?.topTexture;\n\t\tthis.showImage = style?.showImage !== undefined ? style.showImage : this.showImage;\n\t\tthis.flipImageToFaceCamera =\n\t\t\tstyle?.flipImageToFaceCamera !== undefined ? style.flipImageToFaceCamera : this.flipImageToFaceCamera;\n\t\tthis.url = style?.url;\n\t\tthis.side = style?.side !== undefined ? style.side : this.side;\n\t\tthis.renderOrder = style?.renderOrder !== undefined ? style.renderOrder : this.renderOrder;\n\t\tthis.shading = style?.shading;\n\t}\n}\n", "import { Object3D, Vector3 } from 'three';\nimport { randomId } from '../../../packages/common/random-id';\nimport type { MarkerComponent } from '../components/marker';\nimport type LabelComponent from '../components/label';\nimport type { GroupContainerObject3D } from './group-container';\nimport type { InteractionComponent } from '../components/interaction';\nimport { type GeometryGroupObject3D } from './geometry-group';\n\nexport enum Geometry2DComponents {\n\tUI,\n\tInteraction,\n}\n\nexport class Geometry2DObject3D extends Object3D {}\n\nexport class Geometry2D {\n\tid: string | number;\n\n\tget type(): 'label' | 'marker' {\n\t\treturn this.components[Geometry2DComponents.UI].type;\n\t}\n\t// scene-graph parent\n\tget parentObject3D(): GroupContainerObject3D | GeometryGroupObject3D | null {\n\t\treturn this.object3d.parent as GroupContainerObject3D | GeometryGroupObject3D | null;\n\t}\n\n\t/** The geometry3D that this 2D entity is attached to */\n\tget attachedTo(): string | number | undefined {\n\t\treturn this.object3d.userData.attachedEntityId;\n\t}\n\n\tverticalOffset: number;\n\toccluderId?: number;\n\t// And object 3D here ensures that the label's position is tied to it's parent, making our life so much easier\n\tobject3d = new Geometry2DObject3D();\n\tcomponents: [MarkerComponent | LabelComponent, InteractionComponent?];\n\tdisposed = false;\n\tconstructor(ui: MarkerComponent | LabelComponent, position: Vector3, verticalOffset = 0) {\n\t\tthis.id = ui.id || randomId();\n\t\tthis.components = [ui];\n\t\tthis.verticalOffset = verticalOffset;\n\t\tthis.object3d = new Geometry2DObject3D();\n\t\tthis.object3d.position.set(position.x, position.y, position.z + verticalOffset);\n\t\tthis.object3d.userData.entityId = this.id;\n\t\tthis.object3d.userData.type = this.type;\n\t\tthis.positionDirty = true;\n\t}\n\n\tprivate worldPosition = new Vector3();\n\n\tget position(): Vector3 {\n\t\t// cache world position as it's expensive to compute every frame for every entity\n\t\t// for now, group containers can only move up and down, so when they do, we need to recompute the world position\n\t\tif (this.positionDirty) {\n\t\t\tthis.object3d.matrixAutoUpdate = true;\n\t\t\tthis.object3d.getWorldPosition(this.worldPosition);\n\t\t\tthis.positionDirty = false;\n\t\t\tthis.object3d.matrixAutoUpdate = false;\n\t\t}\n\n\t\treturn this.worldPosition;\n\t}\n\n\t/**\n\t * When the position of the entity changes, this should be set to true, so that systems like pan bounds can update\n\t */\n\tget positionDirty() {\n\t\treturn this.object3d.userData.worldPositionDirty;\n\t}\n\n\tset positionDirty(value: boolean) {\n\t\tthis.object3d.userData.worldPositionDirty = value;\n\t}\n\n\tupdatePosition(position: Vector3) {\n\t\tthis.object3d.position.copy(position);\n\t\tthis.positionDirty = true;\n\t}\n\n\tsetAltitude(z: number) {\n\t\tthis.object3d.position.z = z;\n\t\tthis.positionDirty = true;\n\t}\n}\n", "import { Object3D } from 'three';\nimport type { Mesh, Object3DEventMap, ShaderMaterial, Texture, TubeGeometry, Color, Vector2, Raycaster } from 'three';\nimport { randomId } from '../../../packages/common/random-id';\nimport type { InteractionComponent } from '../components/interaction';\nimport type { MeshComponent } from '../components/mesh';\nimport type { ModelComponent } from '../components/model';\nimport type { PathComponent } from '../components/path';\nimport type { StyleComponent } from '../components/styles/style';\nimport type { ImageComponent } from '../components/image';\nimport type { CustomGeometryComponent } from '../components/custom';\nimport type { GroupContainerObject3D } from './group-container';\nimport type { Geometry2D } from './geometry2d';\nimport { GeometryGroupObject3D } from './geometry-group';\nimport type { Text3DComponent } from '../components/text3d';\nimport type { ModelStyleComponnet, Text3DStyleComponent } from '../components/styles';\nimport type { OutlineComponent } from '../components/outline';\nimport type { FocusableComponent } from '../components/focusable';\n\nexport enum Geometry3DComponents {\n\tMesh,\n\tStyle,\n\tInteraction,\n\tOutline,\n\tFocusable,\n}\n\ntype Geometry3DObjectTypes = 'geometry' | 'path' | 'model' | 'custom-geometry' | 'image' | 'text3d';\nexport class Geometry3DObject3D extends Object3D {\n\ttype: Geometry3DObjectTypes = 'geometry';\n\tuserData: {\n\t\tentityId: string;\n\t\t/**\n\t\t * TODO: remove this when proper instancing is handled\n\t\t */\n\t\tisSingleModel?: boolean;\n\t\ttype: Geometry3DObjectTypes;\n\t} = {\n\t\tentityId: '',\n\t\ttype: 'geometry',\n\t};\n\t/**\n\t * Custom raycast implementation for model objects only.\n\t * This selectively enables recursive raycasting just for models, which have complex hierarchies,\n\t * while avoiding the performance cost of recursive raycasting for other object types.\n\t */\n\traycast(raycaster: Raycaster, intersects: any[]) {\n\t\tif (this.userData.type === 'model' && this.children[0]) {\n\t\t\traycaster.intersectObject(this.children[0], true).forEach(result => {\n\t\t\t\tintersects.push(result);\n\t\t\t});\n\t\t}\n\t}\n}\n\nexport type PathMaterial = ShaderMaterial & {\n\tuniforms: PathUniforms;\n};\nexport type PathMesh = Mesh<TubeGeometry, PathMaterial, Object3DEventMap>;\nexport declare class PatMeshContainer extends Geometry3DObject3D {\n\tchildren: [PathMesh, PathMesh];\n}\n\nexport type MeshComponentTypes =\n\t| MeshComponent\n\t| PathComponent\n\t| ModelComponent\n\t| CustomGeometryComponent\n\t| Text3DComponent\n\t| ImageComponent;\n\ntype MappedComponentType<M> = M extends MeshComponent\n\t? 'geometry'\n\t: M extends PathComponent\n\t? 'path'\n\t: M extends ModelComponent\n\t? 'model'\n\t: M extends CustomGeometryComponent\n\t? 'custom-geometry'\n\t: M extends ImageComponent\n\t? 'image'\n\t: M extends Text3DComponent\n\t? 'text3d'\n\t: never;\n\nexport class Geometry3D<\n\tM extends MeshComponentTypes = MeshComponent,\n\tS extends StyleComponent | Text3DStyleComponent | ModelStyleComponnet = StyleComponent,\n\tI extends InteractionComponent = InteractionComponent,\n\tT extends MappedComponentType<M> = MappedComponentType<M>,\n\tO extends OutlineComponent | undefined = OutlineComponent | undefined,\n\tF extends FocusableComponent | undefined = FocusableComponent | undefined,\n> {\n\tid: string | number = randomId();\n\tcomponents: [M, S, I?, O?, F?];\n\tget object3d() {\n\t\treturn this.components[Geometry3DComponents.Mesh].mesh as M['mesh'];\n\t}\n\t// scene-graph parent\n\tget parentObject3D(): GroupContainerObject3D | GeometryGroupObject3D | null {\n\t\treturn this.components[Geometry3DComponents.Mesh].mesh?.parent as\n\t\t\t| GroupContainerObject3D\n\t\t\t| GeometryGroupObject3D\n\t\t\t| null;\n\t}\n\tget type(): T {\n\t\treturn this.components[Geometry3DComponents.Mesh].type as T;\n\t}\n\n\tentities2D: Map<string | number, Geometry2D> = new Map();\n\n\tconstructor(meshComponent: M, styleComponent: S) {\n\t\tthis.components = [meshComponent, styleComponent];\n\t}\n\n\t/** Attaching a 2D entity to the 3D entity so it will follow the style changes */\n\tattach(entity: Geometry2D) {\n\t\tif (this.parentObject3D instanceof GeometryGroupObject3D) {\n\t\t\tentity.object3d.userData.attachedEntityId = this.id;\n\t\t} else {\n\t\t\tthis.entities2D.set(entity.id, entity);\n\t\t}\n\t}\n\n\tdetach(entity: Geometry2D) {\n\t\tif (this.parentObject3D instanceof GeometryGroupObject3D) {\n\t\t\tentity.object3d.userData.parentEntityId = undefined;\n\t\t}\n\t\tthis.entities2D.delete(entity.id);\n\t}\n\n\tremoveAllEntities() {\n\t\tfor (const entity of this.entities2D.values()) {\n\t\t\tthis.detach(entity);\n\t\t}\n\t}\n\n\t// toJSON() {\n\t// \treturn {\n\t// \t\tid: this.id,\n\t// \t\ttype: 'ThreeDEntity',\n\t// \t\tobject: this.components[Geometry3DComponents.Mesh].mesh?.id,\n\t// \t};\n\t// }\n}\n\nexport type TextGeometry3D = Geometry3D<Text3DComponent, Text3DStyleComponent, InteractionComponent, 'text3d'>;\nexport type CustomGeometry3D = Geometry3D<\n\tCustomGeometryComponent,\n\tStyleComponent,\n\tInteractionComponent,\n\t'custom-geometry'\n>;\nexport type ModelGeometry3D = Geometry3D<ModelComponent, ModelStyleComponnet, InteractionComponent, 'model'>;\nexport type PathGeometry3D = Geometry3D<PathComponent, StyleComponent, InteractionComponent, 'path'>;\nexport type ImageGeometry3D = Geometry3D<ImageComponent, StyleComponent, InteractionComponent, 'image'>;\nexport type MeshGeometry3D = Geometry3D<MeshComponent, StyleComponent, InteractionComponent, 'geometry'>;\nexport type Geometry3DTypes =\n\t| TextGeometry3D\n\t| CustomGeometry3D\n\t| PathGeometry3D\n\t| ImageGeometry3D\n\t| MeshGeometry3D\n\t| ModelGeometry3D;\n\nexport interface PathUniforms {\n\tvertexes: {\n\t\ttype: 'f';\n\t\tvalue: number;\n\t};\n\tresolution: {\n\t\ttype: 'v2';\n\t\tvalue: Vector2;\n\t};\n\tcameraParameters: {\n\t\ttype: 'v2';\n\t\tvalue: Vector2;\n\t};\n\tcomplete: {\n\t\ttype: 'f';\n\t\tvalue: number;\n\t};\n\tcolor: {\n\t\ttype: 'c';\n\t\tvalue: Color;\n\t};\n\tpathLength: {\n\t\ttype: 'f';\n\t\tvalue: number;\n\t};\n\tnearRadius: {\n\t\ttype: 'f';\n\t\tvalue: number;\n\t};\n\tfarRadius: {\n\t\ttype: 'f';\n\t\tvalue: number;\n\t};\n\tnearZoom: {\n\t\ttype: 'f';\n\t\tvalue: number;\n\t};\n\tfarZoom: {\n\t\ttype: 'f';\n\t\tvalue: number;\n\t};\n\tpulseColor: {\n\t\ttype: 'c';\n\t\tvalue: Color;\n\t};\n\tpulse: {\n\t\ttype: 'f';\n\t\tvalue: number;\n\t};\n\tpulseLength: {\n\t\ttype: 'f';\n\t\tvalue: number;\n\t};\n\tpathIsVertical: {\n\t\ttype: 'b';\n\t\tvalue: boolean;\n\t};\n\tarrowAnimationTimer: {\n\t\ttype: 'f';\n\t\tvalue: number;\n\t};\n\tarrowTexture: {\n\t\ttype: 't';\n\t\tvalue: Texture;\n\t};\n\tdisplayArrowsOnPath: {\n\t\ttype: 'b';\n\t\tvalue: boolean;\n\t};\n\tshowPulse: {\n\t\ttype: 'b';\n\t\tvalue: boolean;\n\t};\n\topacityMultiplier: {\n\t\ttype: 'f';\n\t\tvalue: number;\n\t};\n\tdashed: {\n\t\ttype: 'b';\n\t\tvalue: boolean;\n\t};\n}\n", "import type { InsetPadding } from '../types';\n\nexport const DEFAULT_INSET_PADDING: InsetPadding = {\n\ttop: 0,\n\tbottom: 0,\n\tleft: 0,\n\tright: 0,\n\ttype: 'pixel',\n};\n\nexport const MAPPEDIN_LAYER_ID = 'mappedin';\n// layers for raycasting\nexport enum RAYCAST_LAYERS {\n\tDEFAULT,\n\tOUTLINES, // outlines have their own layer to filter them from raycasting\n}\n\n// layers for rendering\nexport const RENDER_LAYERS = {\n\tALWAYS_ON_TOP: 10,\n};\n\n/**\n * Duration of zoom in/out animation when double tapping with one finger or single tapping with two fingers.\n */\nexport const TAP_ZOOM_DURATION = 250;\n\nexport const COLLISION_WORKER_PATH = 'collision-worker.csp.js';\nexport const MAPLIBRE_WORKER_PATH = 'maplibre-worker.csp.js';\n", "import { type Box3, Vector3 } from 'three';\n\nexport function getCornersOfBoundingBox(boundingBox: Box3) {\n\tconst low = boundingBox.min;\n\tconst high = boundingBox.max;\n\n\tconst corner1 = new Vector3(low.x, low.y, low.z);\n\tconst corner2 = new Vector3(high.x, low.y, low.z);\n\tconst corner3 = new Vector3(low.x, high.y, low.z);\n\tconst corner5 = new Vector3(high.x, high.y, low.z);\n\n\treturn [corner1, corner2, corner3, corner5];\n}\n", "import type { Geometry2D, Geometry3D, Geometry3DTypes } from '../entities';\nimport type { GroupContainerObject3D } from '../entities/group-container';\nimport type { GeometryGroupObject3D } from '../entities/geometry-group';\nimport type { EntityId, EntityState, RendererState } from '../renderer';\nimport { Box3, Vector3 } from 'three';\nimport type RendererCore from '../renderer';\n\nexport function getGeometryByGeometryId(\n\tstate: RendererState,\n\tgeometryOrGeometryId?: string | number | Record<string, any>,\n) {\n\tlet geometry: Geometry2D | Geometry3DTypes | GroupContainerObject3D | GeometryGroupObject3D | undefined;\n\tif (typeof geometryOrGeometryId === 'string' || typeof geometryOrGeometryId === 'number') {\n\t\tgeometry = state.geometry2DMap.get(geometryOrGeometryId);\n\t\tif (geometry == null) {\n\t\t\tgeometry = state.geometry3DMap.get(geometryOrGeometryId);\n\t\t}\n\t} else if (typeof geometryOrGeometryId?.id === 'string' || typeof geometryOrGeometryId?.id === 'number') {\n\t\tgeometry = state.geometry2DMap.get(geometryOrGeometryId.id);\n\t\tif (geometry == null) {\n\t\t\tgeometry = state.geometry3DMap.get(geometryOrGeometryId.id);\n\t\t}\n\t} else {\n\t\tgeometry = geometryOrGeometryId as Geometry2D | Geometry3D | GroupContainerObject3D | GeometryGroupObject3D;\n\t}\n\n\treturn geometry;\n}\n\nexport function getVerticesOfEntity(\n\tcore: RendererCore,\n\tgeometryOrGeometryId?: string | number | EntityId<EntityState>,\n\tvertices: Vector3[] = [],\n\tbounds: Box3 = new Box3(),\n\tzOffset?: number,\n): Vector3[] {\n\tif (core.getSystems().renderSystem.threeDdirty || core.getSystems().renderSystem.twoDdirty) {\n\t\tcore.renderSync();\n\t}\n\tconst geometryEntity = getGeometryByGeometryId(core.getInternalState(), geometryOrGeometryId);\n\n\ttraverse(geometryEntity, vertices, bounds, zOffset);\n\n\treturn vertices;\n}\n\nconst vertex = new Vector3();\nfunction traverse(obj: any, vertices: Vector3[] = [], bounds: Box3 = new Box3(), zOffset?: number): void {\n\tif (!obj.visible) return;\n\n\tif (obj.isMesh || obj.isLine || obj.isPoints) {\n\t\tconst geometry = obj.geometry;\n\n\t\tif (geometry.isBufferGeometry) {\n\t\t\tconst position = geometry.attributes.position;\n\n\t\t\tfor (let i = 0; i < position.count; i++) {\n\t\t\t\tvertex.fromBufferAttribute(position, i);\n\t\t\t\tif (zOffset !== undefined) {\n\t\t\t\t\t// since the vertices are relative to their parent, we need to add the zOffset to the vertex\n\t\t\t\t\tvertex.z = zOffset;\n\t\t\t\t}\n\t\t\t\tvertices.push(vertex.clone());\n\t\t\t\tbounds.expandByPoint(vertex);\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (const child of obj.children) {\n\t\ttraverse(child, vertices, bounds, zOffset);\n\t}\n}\n", "export function getPixelRatio(): number {\n\treturn typeof window === 'undefined' ? 1 : Math.min(window.devicePixelRatio, 2);\n}\n", "// lodash throttle function\nexport function throttle<T>(func: () => void, wait: number, options?: any): () => void {\n\tlet context: T | null;\n\tlet args;\n\tlet result: any;\n\tlet timeout: NodeJS.Timeout | null = null;\n\tlet previous = 0;\n\n\tif (!options) options = {};\n\n\tlet later = function () {\n\t\tprevious = options.leading === false ? 0 : Date.now();\n\t\ttimeout = null;\n\t\tresult = func.apply(context, args);\n\t\tif (!timeout) context = args = null;\n\t};\n\n\treturn function (this: T, ...args: any) {\n\t\tlet now = Date.now();\n\n\t\tif (!previous && options.leading === false) previous = now;\n\n\t\tlet remaining = wait - (now - previous);\n\n\t\tif (remaining <= 0 || remaining > wait) {\n\t\t\tif (timeout) {\n\t\t\t\tclearTimeout(timeout);\n\t\t\t\ttimeout = null;\n\t\t\t}\n\n\t\t\tprevious = now;\n\t\t\tresult = func.apply(this, args);\n\n\t\t\tif (!timeout) context = args = null;\n\t\t} else if (!timeout && options.trailing !== false) {\n\t\t\ttimeout = setTimeout(later, remaining);\n\t\t}\n\n\t\treturn result;\n\t};\n}\n\nexport function debounce<T extends (...args: any[]) => void>(func: T, wait: number, immediate = false) {\n\tlet timeout: NodeJS.Timeout | null = null;\n\tlet called = 0; // called times between execution\n\n\treturn function (...args: Parameters<T>) {\n\t\tcalled++;\n\n\t\tif (called === 1 && immediate === true) {\n\t\t\tfunc(...args);\n\t\t}\n\n\t\tlet later = () => {\n\t\t\t// only execute if it's called more than once before timeout reset\n\t\t\tif (!immediate || called > 1) {\n\t\t\t\tfunc(...args);\n\t\t\t}\n\t\t\ttimeout = null;\n\t\t\tcalled = 0;\n\t\t};\n\n\t\tclearTimeout(timeout as NodeJS.Timeout);\n\t\ttimeout = setTimeout(later, wait);\n\t};\n}\n", "type DeviceType = {\n\tisIpad: boolean;\n\tisMobile: boolean;\n\tisSafari12: boolean;\n\tisFirefox: boolean;\n\tisWindows: boolean;\n};\n\n/**\n * Get device OS info\n * export for testing purpose\n * @returns DeviceType\n */\nexport const _deviceTypeControl = (() => {\n\tlet result: DeviceType | undefined;\n\n\treturn {\n\t\tgetDeviceType() {\n\t\t\tif (result) return result;\n\t\t\tconst { userAgent, platform, maxTouchPoints } = window.navigator;\n\n\t\t\tconst isIOS = /(iphone|ipod|ipad)/i.test(userAgent);\n\n\t\t\t// Workaround for ipadOS, force detection as tablet\n\t\t\t// SEE: https://github.com/lancedikson/bowser/issues/329\n\t\t\t// SEE: https://stackoverflow.com/questions/58019463/how-to-detect-device-name-in-safari-on-ios-13-while-it-doesnt-show-the-correct\n\t\t\tconst isIpad =\n\t\t\t\tplatform === 'iPad' ||\n\t\t\t\t// @ts-expect-error window.MSStream is non standard\n\t\t\t\t(platform.indexOf('Mac') === 0 && maxTouchPoints > 0 && !window.MSStream);\n\n\t\t\tconst isAndroid = /android/i.test(userAgent);\n\n\t\t\tresult = {\n\t\t\t\tisIpad,\n\t\t\t\tisMobile: isAndroid || isIOS || isIpad,\n\t\t\t\tisSafari12: /Version\\/12.+Safari/.test(userAgent),\n\t\t\t\tisFirefox: /Firefox/.test(userAgent),\n\t\t\t\tisWindows: /windows/i.test(userAgent),\n\t\t\t};\n\n\t\t\treturn result;\n\t\t},\n\t\t_reset() {\n\t\t\tresult = undefined;\n\t\t},\n\t};\n})();\n\nexport const getDeviceType = _deviceTypeControl.getDeviceType;\n\n/**\n * Creates a closure encapsulating the logic of getting device GPU info.\n * inspired by https://github.com/pmndrs/detect-gpu\n * export for testing\n */\nexport const _gpuInfoControl = (() => {\n\tlet canvas: HTMLCanvasElement | undefined;\n\tlet result: string | undefined;\n\tlet shouldDisableOfflineCanvasResult: boolean | undefined;\n\n\tfunction getInfo() {\n\t\tif (result !== undefined) return result;\n\t\tif (!canvas) canvas = document.createElement('canvas');\n\t\tconst gl = (canvas.getContext('webgl') || canvas.getContext('experimental-webgl')) as WebGLRenderingContext | null;\n\n\t\tif (!gl) {\n\t\t\treturn result;\n\t\t}\n\n\t\ttry {\n\t\t\tconst debugRendererInfo = getDeviceType().isFirefox ? null : gl.getExtension('WEBGL_debug_renderer_info');\n\t\t\tresult = debugRendererInfo\n\t\t\t\t? gl.getParameter(debugRendererInfo.UNMASKED_RENDERER_WEBGL)\n\t\t\t\t: gl.getParameter(gl.RENDERER);\n\n\t\t\treturn result;\n\t\t} catch (e) {\n\t\t\tconst error = new Error('Failed getting device info');\n\t\t\terror.name = 'FailedGettingDeviceInfo';\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\tfunction shouldDisableOffscreenCanvas() {\n\t\tif (!getDeviceType().isWindows) return false; // never need to disable for non-windows OS since the issue only resides to windows chrome Angle backend\n\t\tif (shouldDisableOfflineCanvasResult !== undefined) return shouldDisableOfflineCanvasResult;\n\t\tconst gpuInfo = getGPUInfo()?.toLowerCase() ?? '';\n\t\tshouldDisableOfflineCanvasResult =\n\t\t\tgpuInfo.includes('intel') && (gpuInfo.includes('uhd') || gpuInfo.includes('iris'));\n\n\t\treturn shouldDisableOfflineCanvasResult;\n\t}\n\n\treturn {\n\t\tgetInfo,\n\t\tshouldDisableOffscreenCanvas,\n\t\t// reset for for testing\n\t\t_setCanvas(c: HTMLCanvasElement) {\n\t\t\tcanvas = c;\n\t\t\tresult = undefined;\n\t\t\tshouldDisableOfflineCanvasResult = undefined;\n\t\t},\n\t};\n})();\n\nexport const getGPUInfo = _gpuInfoControl.getInfo;\n\n/**\n * Check if device is certain intel integrated GPU.\n * This is for implementing workaround - https://issues.chromium.org/issues/40251953\n * The reason we want to disable OffscreenCanvas at all is due to `willReadFrequently` flag only works in FF.\n * In order to ensure the integrated intel GPU render text correctly\n */\nexport const shouldDisableOffscreenCanvas = _gpuInfoControl.shouldDisableOffscreenCanvas;\n", "export function noop() {}\n\nexport type KeysOfUnion<T> = T extends T ? keyof T : never;\n/**\n * Given an object and a number of properties as strings, return version\n * of that object with only those properties.\n *\n * @param src - the object\n * @param properties - an array of property names chosen\n * to appear on the resulting object.\n * @returns object with limited properties.\n * @example\n * ```ts\n * let foo = { name: 'Charlie', age: 10 };\n * let justName = pick(foo, ['name']); // justName = { name: 'Charlie' }\n * ```\n */\nexport function pick<T extends object>(src: T, properties: KeysOfUnion<T>[]): Partial<T> {\n\tconst result: Partial<T> = {};\n\tfor (let i = 0; i < properties.length; i++) {\n\t\tconst k = properties[i];\n\t\tif (k in src) {\n\t\t\tresult[k] = src[k];\n\t\t}\n\t}\n\n\treturn result;\n}\n\nexport function isEmpty(obj: Record<string, any>) {\n\t// native Object.keys is the fastest approach actually\n\treturn Object.keys(obj).length === 0;\n}\n", "export const transformRequest = (headers: { 'x-mappedin-tiles-key': string }) => (url: string) => {\n\t// filter out mappedin headers from the outdoor view in order to avoid CORS issues\n\tif (!url.includes('mappedin')) {\n\t\tconst newHeaders = {};\n\t\tfor (const key in headers) {\n\t\t\tconst value = headers[key];\n\n\t\t\tif (!url.includes('mappedin')) {\n\t\t\t\theaders[key] = value;\n\t\t\t}\n\t\t}\n\n\t\treturn { url, headers: newHeaders };\n\t}\n\n\treturn { url, headers };\n};\n", "/**\n * avoid storying default values on the text style to save space\n */\nexport class Text3DStyleComponent implements Partial<Text3DStyle> {\n\tvisible?: boolean;\n\taltitude?: number;\n\t// TODO: handle width height\n\t// width?: number;\n\t// height?: number;\n\tcolor?: string;\n\tdirty = true;\n\tmaxWidth?: number;\n\tmaxHeight?: number;\n\thoverByPolygon?: boolean;\n\tflipToFaceCamera? = DEFAULT_TEXT_STYLE.flipToFaceCamera;\n\tfont?: string;\n\tfillOpacity?: number;\n\tfontSize?: number;\n\tmargin?: number;\n\toutlineWidth?: number;\n\toutlineBlur?: number | string;\n\toutlineOffsetX?: number;\n\tstrokeColor?: string;\n\tstrokeOpacity?: number;\n\tstrokeWidth?: number;\n\thoverColor?: string | undefined;\n\toutlineOffsetY?: number;\n\toutlineColor?: string;\n\toutlineOpacity?: number;\n\tconstructor(initialState?: Partial<Text3DStyle>) {\n\t\tif (initialState) {\n\t\t\tObject.assign(this, initialState);\n\t\t}\n\t}\n\t/**\n\t * Put together a json ignore all the undefined fields.\n\t * This is helpful when we Object.assign(instance, json) to update the instance.\n\t */\n\tgetState(includeDirty = false): Partial<Text3DStyle> {\n\t\tconst json: { [key: string]: any } = {};\n\t\tfor (let key in this) {\n\t\t\tif (!includeDirty && key === 'dirty') {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (this[key] !== undefined) {\n\t\t\t\tjson[key] = this[key];\n\t\t\t}\n\t\t}\n\n\t\treturn json;\n\t}\n}\n\n/**\n * Not directly storing default values on the text style to save space\n * TODO: lookign at text style spec from maplibre. we can also support:\n * letterSpacing?: number;\n * lineHeight: number;\n * anchor: number; => .anchorX & .anchorY\n * justify: nubmer; => .textAlign\n * tarnsform: string;\n * offset: number;\n */\nexport const DEFAULT_TEXT_STYLE: Readonly<Text3DStyle> = Object.freeze({\n\tvisible: true,\n\tcolor: 'black',\n\tflipToFaceCamera: true,\n\tfillOpacity: 1,\n\tfont: undefined,\n\tfontSize: 2,\n\tmargin: [0.2, 1, 0.2, 1.5] as [number, number, number, number],\n\toutlineColor: 'black',\n\toutlineOpacity: 1,\n\toutlineWidth: 0,\n\toutlineOffsetX: 0,\n\toutlineOffsetY: 0,\n\toutlineBlur: 0,\n\tstrokeOpacity: 1,\n\tstrokeWidth: 0,\n\tmaxWidth: undefined,\n\tmaxHeight: undefined,\n\tstrokeColor: 'black',\n\thoverColor: undefined,\n});\n\nexport type Text3DStyle = {\n\t/**\n\t * Controls the visibility of the text element.\n\t * @default true\n\t */\n\tvisible: boolean;\n\n\t/**\n\t * The color of the text. Will change to hoverColor when the associated polygon is hovered.\n\t * Accepts any CSS color string.\n\t * @default 'black'\n\t */\n\tcolor: string;\n\n\t/**\n\t * When true, the text will flip to face the camera while maintaining its position.\n\t * @default true\n\t */\n\tflipToFaceCamera: boolean;\n\n\t/**\n\t * URL to a custom font file (.ttf, .otf, .woff).\n\t * Falls back to Roboto if undefined.\n\t */\n\tfont: string | undefined;\n\n\t/**\n\t * The size of the text in meters. Will be automatically adjusted if it exceeds\n\t * the text area bounds.\n\t */\n\tfontSize: number;\n\n\t/**\n\t * Padding between the text and its bounding box, in meters.\n\t * Can be specified as either:\n\t * - A single number for uniform padding on all sides\n\t * - An array of 4 numbers [top, right, bottom, left] for individual side padding\n\t * @default [0.2, 1, 0.2, 1.5]\n\t */\n\tmargin: number | [number, number, number, number];\n\n\t/**\n\t * Color of the text outline.\n\t * Accepts any CSS color string.\n\t * @default 'black'\n\t */\n\toutlineColor: string;\n\n\t/**\n\t * Opacity of the text outline.\n\t * Accepts values between 0 and 1.\n\t * @default 1\n\t */\n\toutlineOpacity: number;\n\n\t/**\n\t * Blur radius for the text outline.\n\t * Can be a number in pixels or a string with units.\n\t */\n\toutlineBlur: number | string;\n\n\t/**\n\t * Width of the text outline effect in pixels.\n\t */\n\toutlineWidth: number;\n\n\t/**\n\t * Horizontal offset of the outline effect from the text, in pixels.\n\t */\n\toutlineOffsetX: number;\n\n\t/**\n\t * Vertical offset of the outline effect from the text, in pixels.\n\t */\n\toutlineOffsetY: number;\n\n\t/**\n\t * Width of the inner stroke of each text glyph.\n\t * @default 0\n\t */\n\tstrokeWidth: number;\n\n\t/**\n\t * Maximum width constraint for the text area in meters.\n\t * Overrides default text field constraints when set.\n\t */\n\tmaxWidth: number | undefined;\n\n\t/**\n\t * Maximum height constraint for the text area in meters.\n\t * Overrides default text field constraints when set.\n\t */\n\tmaxHeight: number | undefined;\n\n\t/**\n\t * Opacity of the text stroke when strokeWidth > 0.\n\t * @default 1\n\t */\n\tstrokeOpacity: number;\n\n\t/**\n\t * Color of the text stroke when strokeWidth > 0.\n\t * Accepts any CSS color string.\n\t * @default 'black'\n\t */\n\tstrokeColor: string;\n\n\t/**\n\t * Opacity of the text fill, independent of stroke and outline opacity.\n\t * Set to 0 to show only stroke/outline.\n\t * Accepts values between 0 and 1.\n\t */\n\tfillOpacity: number;\n\n\t/**\n\t * Color to display when text is hovered.\n\t * Falls back to global hover color if undefined.\n\t */\n\thoverColor: string | undefined;\n};\n", "export { StyleComponent, DEFAULT_COLOR, type MaterialSide } from './style';\nexport { Text3DStyleComponent, type Text3DStyle, DEFAULT_TEXT_STYLE } from './text-style';\nexport { ModelStyleComponnet, type ModelStyle } from './model-style';\nexport { DEFAULT_ROTATION, DEFAULT_SCALE } from './constants';\n", "type MaterialStyle = {\n\tcolor: string;\n};\n\nexport type ModelStyle = {\n\t/**\n\t * Model's URL. Can be based64 inlined url.\n\t */\n\turl: string;\n\t/**\n\t * Visiiblity of the model group\n\t */\n\tvisible: boolean;\n\t/**\n\t * Opacity of the model group.\n\t */\n\topacity: number;\n\t/**\n\t * Change material state by name\n\t * @example\n\t * ```ts\n\t * mapView.Models.add(\n\t * { target: new Coordinate(45, -75) },\n\t * {\n\t * url: 'bed.glb',\n\t * materials: {\n\t * Default: {\n\t * color: MAPPEDIN_COLOR.orange,\n\t * },\n\t * },\n\t * },\n\t * );\n\t * ```\n\t */\n\tmaterial: {\n\t\t[name: string]: MaterialStyle;\n\t};\n\t/**\n\t * vertical offset of the model in meters off the floor\n\t */\n\tverticalOffset: number;\n\n\t/**\n\t * Color property designed for use with @mappedin/3d-assets.\n\t * Updates the accent color of 3d assets by applying the color to materials named\n\t * ['Default', 'Fabric', 'Mpdn_Logo', 'Fabric_Logo'].\n\t * For custom colors on non-Mappedin models, use the {@link ModelStyle.material | material} property.\n\t * If both the `material` and `color` properties are provided, `material` property updates will take higher precedence than `color` property updates.\n\t */\n\tcolor: string;\n\n\t/**\n\t * The rotation of the model in degrees [x, y, z].\n\t * - x: Rotation around x-axis (pitch)\n\t * - y: Rotation around y-axis (yaw)\n\t * - z: Rotation around z-axis (roll), where z points up\n\t *\n\t * Rotations are applied in order: x, then y, then z.\n\t * 0 degrees means the model faces north (or the parent group's forward direction).\n\t * Positive rotations follow the right-hand rule.\n\t */\n\trotation: [number, number, number];\n\t/**\n\t * The scale of the model in [x, y, z]\n\t */\n\tscale: [number, number, number];\n};\n\nexport class ModelStyleComponnet implements Partial<ModelStyle> {\n\tdirty = true;\n\tvisible = true;\n\topacity = 1;\n\tverticalOffset = 0;\n\tinteractive = false;\n\tcolor?: string;\n\tmaterial?: ModelStyle['material'];\n\trotation?: [number, number, number];\n\tscale?: [number, number, number];\n\tconstructor(init?: Partial<ModelStyle>) {\n\t\tif (init) {\n\t\t\tObject.assign(this, init);\n\t\t}\n\t}\n}\n", "export const DEFAULT_SCALE = [1, 1, 1];\nexport const DEFAULT_ROTATION = [0, 0, 0];\n"],
|
|
5
|
+
"mappings": "gSAAAA,IAEO,IAAMC,GAAiB,eAElBC,QACXA,IAAA,aACAA,IAAA,eACAA,IAAA,iBACAA,IAAA,mBAJWA,QAAA,IAOL,SAASC,GAAaC,EAAO,GAAI,CAAE,OAAAC,EAASJ,EAAe,EAAI,CAAC,EAAG,CACzE,IAAMK,EAAQ,GAAGD,CAAM,GAAGD,EAAO,IAAIA,CAAI,GAAK,EAAE,GAE1CG,EAAU,CAACC,EAAgCC,IAAgB,CAChE,GAAI,OAAO,OAAW,KAAgB,OAAe,QAAS,CAC7D,IAAMC,EAAYD,EAAK,IAAIE,GACtBA,aAAe,OAASA,EAAI,MACxB,GAAGA,EAAI,OAAO;AAAA,EAAKA,EAAI,KAAK,GAG7BA,CACP,EACA,OAAe,QAAQ,GAAGP,CAAI,IAAII,CAAI,KAAKE,EAAU,KAAK,GAAG,CAAC,EAAE,CAClE,CACD,EAEA,MAAO,CACN,SAAUE,EAAQ,IAAI,WAAa,OAAS,EAAyB,EAErE,OAAOH,EAAa,CACf,KAAK,UAAY,IACpB,QAAQ,IAAIH,EAAO,GAAGG,CAAI,EAC1BF,EAAQ,MAAOE,CAAI,EAErB,EAEA,QAAQA,EAAa,CAChB,KAAK,UAAY,IACpB,QAAQ,KAAKH,EAAO,GAAGG,CAAI,EAC3BF,EAAQ,OAAQE,CAAI,EAEtB,EAEA,SAASA,EAAa,CACjB,KAAK,UAAY,IACpB,QAAQ,MAAMH,EAAO,GAAGG,CAAI,EAE5BF,EAAQ,QAASE,CAAI,EAEvB,EAGA,UAAUA,EAAa,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,sBAAiB,GACjBA,EAAA,mBAAc,IACdA,EAAA,cACAA,EAAA,iBACAA,EAAA,iBACAA,EAAA,cAEKD,GACH,OAAO,OAAO,KAAMA,CAAI,CAE1B,CACD,ECnFAE,IAAO,IAAMC,GAAgB,CAAC,EAAG,EAAG,CAAC,EACxBC,GAAmB,CAAC,EAAG,EAAG,CAAC",
|
|
6
|
+
"names": ["init_define_process", "MI_ERROR_LABEL", "E_SDK_LOG_LEVEL", "createLogger", "name", "prefix", "label", "rnDebug", "type", "args", "processed", "arg", "define_process_default", "level", "Logger", "setLoggerLevel", "Mappedin_Logger_default", "init_define_process", "init_define_process", "InvalidTokenError", "b64DecodeUnicode", "str", "m", "p", "code", "base64UrlDecode", "output", "jwtDecode", "token", "options", "pos", "part", "decoded", "e", "init_define_process", "EARTH_RADIUS_M", "decodeAccessToken", "accessToken", "decoded", "jwtDecode", "toRadians", "degrees", "toDegrees", "radians", "round", "value", "decimals", "factor", "euclideanModulo", "modulus", "haversineDistance", "lon1", "lat1", "lon2", "lat2", "dLat", "dLon", "startLat", "destLat", "a", "c", "EARTH_RADIUS_M", "getForwardBearing", "startLon", "y", "x", "shortestTweenRotation", "startRotation", "targetRotation", "startRotationMod2Pi", "targetRotationMod2Pi", "delta", "endRotation", "isFiniteBox", "box", "Box2", "clampWithWarning", "lower", "upper", "warning", "Mappedin_Logger_default", "arraysEqual", "arr1", "arr2", "i", "isBrowser", "init_define_process", "debounce", "func", "wait", "immediate", "timeout", "called", "args", "later", "external_exports", "__export", "BRAND", "DIRTY", "EMPTY_PATH", "INVALID", "NEVER", "OK", "ParseStatus", "ZodType", "ZodAny", "ZodArray", "ZodBigInt", "ZodBoolean", "ZodBranded", "ZodCatch", "ZodDate", "ZodDefault", "ZodDiscriminatedUnion", "ZodEffects", "ZodEnum", "ZodError", "ZodFirstPartyTypeKind", "ZodFunction", "ZodIntersection", "ZodIssueCode", "ZodLazy", "ZodLiteral", "ZodMap", "ZodNaN", "ZodNativeEnum", "ZodNever", "ZodNull", "ZodNullable", "ZodNumber", "ZodObject", "ZodOptional", "ZodParsedType", "ZodPipeline", "ZodPromise", "ZodReadonly", "ZodRecord", "ZodSet", "ZodString", "ZodSymbol", "ZodTuple", "ZodUndefined", "ZodUnion", "ZodUnknown", "ZodVoid", "addIssueToContext", "anyType", "arrayType", "bigIntType", "booleanType", "coerce", "custom", "dateType", "datetimeRegex", "en_default", "discriminatedUnionType", "effectsType", "enumType", "functionType", "getErrorMap", "getParsedType", "instanceOfType", "intersectionType", "isAborted", "isAsync", "isDirty", "isValid", "late", "lazyType", "literalType", "makeIssue", "mapType", "nanType", "nativeEnumType", "neverType", "nullType", "nullableType", "numberType", "objectType", "objectUtil", "oboolean", "onumber", "optionalType", "ostring", "pipelineType", "preprocessType", "promiseType", "quotelessJson", "recordType", "setType", "setErrorMap", "strictObjectType", "stringType", "symbolType", "tupleType", "undefinedType", "unionType", "unknownType", "util", "voidType", "init_define_process", "init_define_process", "init_define_process", "init_define_process", "init_define_process", "util", "_", "assertIs", "_arg", "assertNever", "_x", "items", "obj", "item", "validKeys", "k", "filtered", "e", "object", "keys", "key", "arr", "checker", "val", "joinValues", "array", "separator", "value", "objectUtil", "first", "second", "ZodParsedType", "getParsedType", "data", "ZodIssueCode", "util", "quotelessJson", "obj", "ZodError", "_ZodError", "issues", "sub", "subs", "actualProto", "_mapper", "mapper", "issue", "fieldErrors", "processError", "error", "curr", "i", "el", "value", "formErrors", "errorMap", "issue", "_ctx", "message", "ZodIssueCode", "ZodParsedType", "util", "en_default", "overrideErrorMap", "en_default", "setErrorMap", "map", "overrideErrorMap", "getErrorMap", "init_define_process", "makeIssue", "params", "data", "path", "errorMaps", "issueData", "fullPath", "fullIssue", "errorMessage", "maps", "m", "map", "EMPTY_PATH", "addIssueToContext", "ctx", "overrideMap", "getErrorMap", "issue", "en_default", "x", "ParseStatus", "_ParseStatus", "status", "results", "arrayValue", "INVALID", "pairs", "syncPairs", "pair", "key", "value", "finalObject", "DIRTY", "OK", "isAborted", "isDirty", "isValid", "isAsync", "init_define_process", "init_define_process", "init_define_process", "errorUtil", "message", "ParseInputLazyPath", "parent", "value", "path", "key", "handleResult", "ctx", "result", "isValid", "error", "ZodError", "processCreateParams", "params", "errorMap", "invalid_type_error", "required_error", "description", "iss", "message", "ZodType", "input", "getParsedType", "ParseStatus", "isAsync", "data", "err", "maybeAsyncResult", "check", "getIssueProperties", "val", "setError", "ZodIssueCode", "refinementData", "refinement", "ZodEffects", "ZodFirstPartyTypeKind", "def", "ZodOptional", "ZodNullable", "ZodArray", "ZodPromise", "option", "ZodUnion", "incoming", "ZodIntersection", "transform", "defaultValueFunc", "ZodDefault", "ZodBranded", "catchValueFunc", "ZodCatch", "This", "target", "ZodPipeline", "ZodReadonly", "cuidRegex", "cuid2Regex", "ulidRegex", "uuidRegex", "nanoidRegex", "jwtRegex", "durationRegex", "emailRegex", "_emojiRegex", "emojiRegex", "ipv4Regex", "ipv4CidrRegex", "ipv6Regex", "ipv6CidrRegex", "base64Regex", "base64urlRegex", "dateRegexSource", "dateRegex", "timeRegexSource", "args", "secondsRegexSource", "secondsQuantifier", "timeRegex", "datetimeRegex", "regex", "opts", "isValidIP", "ip", "version", "isValidJWT", "jwt", "alg", "header", "base64", "decoded", "isValidCidr", "ZodString", "_ZodString", "ZodParsedType", "addIssueToContext", "INVALID", "status", "tooBig", "tooSmall", "util", "validation", "errorUtil", "options", "minLength", "maxLength", "len", "ch", "min", "max", "floatSafeRemainder", "step", "valDecCount", "stepDecCount", "decCount", "valInt", "stepInt", "ZodNumber", "_ZodNumber", "kind", "inclusive", "ZodBigInt", "_ZodBigInt", "ZodBoolean", "OK", "ZodDate", "_ZodDate", "minDate", "maxDate", "ZodSymbol", "ZodUndefined", "ZodNull", "ZodAny", "ZodUnknown", "ZodNever", "ZodVoid", "_ZodArray", "item", "i", "schema", "deepPartialify", "ZodObject", "newShape", "fieldSchema", "ZodTuple", "_ZodObject", "shape", "keys", "shapeKeys", "extraKeys", "pairs", "keyValidator", "unknownKeys", "catchall", "syncPairs", "pair", "issue", "defaultError", "augmentation", "merging", "index", "mask", "newField", "createZodEnum", "handleResults", "results", "unionErrors", "childCtx", "dirty", "issues", "types", "getDiscriminator", "type", "ZodLazy", "ZodLiteral", "ZodEnum", "ZodNativeEnum", "ZodDiscriminatedUnion", "_ZodDiscriminatedUnion", "discriminator", "discriminatorValue", "optionsMap", "discriminatorValues", "mergeValues", "a", "b", "aType", "bType", "bKeys", "sharedKeys", "newObj", "sharedValue", "newArray", "itemA", "itemB", "handleParsed", "parsedLeft", "parsedRight", "isAborted", "merged", "isDirty", "left", "right", "_ZodTuple", "items", "itemIndex", "x", "rest", "schemas", "ZodRecord", "_ZodRecord", "keyType", "valueType", "first", "second", "third", "ZodMap", "finalMap", "ZodSet", "_ZodSet", "finalizeSet", "elements", "parsedSet", "element", "minSize", "maxSize", "size", "ZodFunction", "_ZodFunction", "makeArgsIssue", "makeIssue", "getErrorMap", "en_default", "makeReturnsIssue", "returns", "fn", "me", "parsedArgs", "e", "parsedReturns", "returnType", "func", "getter", "values", "_ZodEnum", "expectedValues", "enumValues", "newDef", "opt", "nativeEnumValues", "promisified", "effect", "checkCtx", "arg", "processed", "DIRTY", "executeRefinement", "acc", "inner", "base", "preprocess", "ZodOptional", "ZodType", "input", "ZodParsedType", "OK", "type", "params", "ZodFirstPartyTypeKind", "processCreateParams", "ZodNullable", "ZodDefault", "ctx", "data", "ZodCatch", "newCtx", "result", "isAsync", "ZodError", "ZodNaN", "addIssueToContext", "ZodIssueCode", "INVALID", "BRAND", "ZodBranded", "ZodPipeline", "_ZodPipeline", "status", "inResult", "DIRTY", "a", "b", "ZodReadonly", "freeze", "isValid", "cleanParams", "p", "custom", "check", "_params", "fatal", "ZodAny", "r", "_fatal", "late", "ZodObject", "ZodFirstPartyTypeKind", "instanceOfType", "cls", "params", "custom", "data", "stringType", "ZodString", "numberType", "ZodNumber", "nanType", "ZodNaN", "bigIntType", "ZodBigInt", "booleanType", "ZodBoolean", "dateType", "ZodDate", "symbolType", "ZodSymbol", "undefinedType", "ZodUndefined", "nullType", "ZodNull", "anyType", "ZodAny", "unknownType", "ZodUnknown", "neverType", "ZodNever", "voidType", "ZodVoid", "arrayType", "ZodArray", "objectType", "ZodObject", "strictObjectType", "unionType", "ZodUnion", "discriminatedUnionType", "ZodDiscriminatedUnion", "intersectionType", "ZodIntersection", "tupleType", "ZodTuple", "recordType", "ZodRecord", "mapType", "ZodMap", "setType", "ZodSet", "functionType", "ZodFunction", "lazyType", "ZodLazy", "literalType", "ZodLiteral", "enumType", "ZodEnum", "nativeEnumType", "ZodNativeEnum", "promiseType", "ZodPromise", "effectsType", "ZodEffects", "optionalType", "ZodOptional", "nullableType", "ZodNullable", "preprocessType", "pipelineType", "ZodPipeline", "ostring", "onumber", "oboolean", "coerce", "arg", "NEVER", "INVALID", "init_define_process", "v3_default", "external_exports", "init_define_process", "esm_default", "v3_default", "init_define_process", "init_define_process", "formatMessage", "message", "label", "MappedinError", "MI_ERROR_LABEL", "MappedinRenderError", "init_define_process", "AssertionError", "_AssertionError", "message", "__publicField", "assertExists", "value", "options", "errorMessage", "ErrorClass", "error", "assertType", "obj", "expectedType", "errorMessage", "assertExists", "defaultMessage", "init_define_process", "SLICE_POSITIONS", "randomId", "array", "seed", "i", "hexArray", "v", "cyrb53", "str", "h1", "h2", "ch", "init_define_process", "PubSub", "__publicField", "eventName", "data", "fn", "itemIdx", "init_define_process", "SESSION_DATA_KEY", "LOCAL_DATA_KEY", "SESSION_ID_KEY", "DEVICE_ID_KEY", "_instance", "_sessionData", "_localData", "_SafeStorage", "__privateAdd", "sessionData", "__privateSet", "randomId", "localData", "__privateGet", "key", "data", "itemData", "SafeStorage", "init_define_process", "X11_COLOR_NAMES_SET", "Color", "colorInstance", "getColorInstance", "isX11Color", "color", "isHexColor", "hex", "i", "isRgbColor", "openParen", "closeParen", "components", "component", "value", "isHslColor", "isColor", "stringToRgbArray", "instance", "rgbArrayToString", "rgb", "init_define_process", "easingCurveSchema", "external_exports", "linearEase", "t", "quadEaseIn", "easeIn", "x", "quadEaseOut", "InterpolationEasingFns", "interpolate", "value", "inputMin", "inputMax", "outputMin", "outputMax", "easeFunc", "easedT", "getInterpolationBreakpoint", "range", "breakpoint", "comparator", "a", "b", "interpolateMulti", "inputRange", "outputRange", "MappedinError", "segment", "init_define_process", "init_define_process", "normalizeAngle", "angle", "init_define_process", "init_define_process", "init_define_process", "init_define_process", "init_define_process", "init_define_process", "init_define_process", "init_define_process", "earthRadius", "factors", "unitsFactors", "feature", "geom", "properties", "options", "feat", "point", "coordinates", "properties", "options", "isNumber", "geom", "feature", "polygon", "coordinates", "properties", "options", "_i", "coordinates_1", "ring", "j", "geom", "feature", "lineString", "coordinates", "properties", "options", "geom", "feature", "featureCollection", "features", "options", "fc", "multiLineString", "coordinates", "properties", "geom", "feature", "multiPoint", "multiPolygon", "radiansToLength", "radians", "units", "factor", "factors", "lengthToRadians", "distance", "radiansToDegrees", "radians", "degrees", "degreesToRadians", "isNumber", "num", "coordEach", "geojson", "callback", "excludeWrapCoord", "j", "k", "l", "geometry", "stopG", "coords", "geometryMaybeCollection", "wrapShrink", "coordIndex", "isGeometryCollection", "type", "isFeatureCollection", "isFeature", "stop", "featureIndex", "geomIndex", "multiFeatureIndex", "geometryIndex", "geomType", "coordReduce", "initialValue", "previousValue", "currentCoord", "featureEach", "geojson", "callback", "i", "geomEach", "geojson", "callback", "i", "j", "g", "geometry", "stopG", "geometryMaybeCollection", "isGeometryCollection", "featureProperties", "featureBBox", "featureId", "featureIndex", "isFeatureCollection", "isFeature", "stop", "flattenEach", "geojson", "callback", "geomEach", "geometry", "featureIndex", "properties", "bbox", "id", "type", "feature", "geomType", "multiFeatureIndex", "coordinate", "geom", "segmentEach", "geojson", "callback", "flattenEach", "feature", "featureIndex", "multiFeatureIndex", "segmentIndex", "type", "previousCoords", "previousFeatureIndex", "previousMultiIndex", "prevGeomIndex", "coordEach", "currentCoord", "coordIndex", "featureIndexCoord", "multiPartIndexCoord", "geometryIndex", "currentSegment", "lineString", "segmentReduce", "initialValue", "previousValue", "started", "bbox", "geojson", "result", "coordEach", "coord", "es_default", "getBoundingBoxFromFeature", "feature", "es_default", "init_define_process", "DEFAULT_COLOR", "DEFAULT_WALL_WIDTH", "DEFAULT_HEIGHT", "_color", "_topColor", "_hoverColor", "StyleComponent", "style", "__publicField", "__privateAdd", "color", "isColor", "__privateSet", "Mappedin_Logger_default", "__privateGet", "EntityBatchedMesh", "BatchedMesh", "__publicField", "_opacity", "_bbox", "MeshComponent", "feature", "DEFAULT_HEIGHT", "Color", "Vector3", "__privateAdd", "visible", "value", "color", "topColor", "__privateGet", "imageMaterials", "material", "__privateSet", "texture", "getBoundingBoxFromFeature", "GeometryGroupObject3D", "Object3D", "id", "__publicField", "visible", "firstChild", "child", "EntityBatchedMesh", "altitude", "init_define_process", "Geometry2DObject3D", "Object3D", "Geometry2D", "ui", "position", "verticalOffset", "__publicField", "Vector3", "randomId", "value", "z", "init_define_process", "Geometry3DObject3D", "Object3D", "__publicField", "raycaster", "intersects", "result", "Geometry3D", "meshComponent", "styleComponent", "randomId", "entity", "GeometryGroupObject3D", "GroupContainerObject3D", "_GroupContainerObject3D", "Object3D", "id", "__publicField", "feature", "occluderId", "entityGroupOrContainer", "Geometry2D", "GeometryGroupObject3D", "Geometry3D", "visible", "altitude", "child", "Geometry2DObject3D", "opacity", "init_define_process", "DEFAULT_INSET_PADDING", "MAPPEDIN_LAYER_ID", "RENDER_LAYERS", "TAP_ZOOM_DURATION", "COLLISION_WORKER_PATH", "MAPLIBRE_WORKER_PATH", "init_define_process", "getCornersOfBoundingBox", "boundingBox", "low", "high", "corner1", "Vector3", "corner2", "corner3", "corner5", "init_define_process", "getGeometryByGeometryId", "state", "geometryOrGeometryId", "geometry", "getVerticesOfEntity", "core", "vertices", "bounds", "Box3", "zOffset", "geometryEntity", "traverse", "vertex", "Vector3", "obj", "position", "i", "child", "init_define_process", "getPixelRatio", "init_define_process", "debounce", "func", "wait", "immediate", "timeout", "called", "args", "later", "init_define_process", "_deviceTypeControl", "result", "userAgent", "platform", "maxTouchPoints", "isIOS", "isIpad", "isAndroid", "getDeviceType", "_gpuInfoControl", "canvas", "shouldDisableOfflineCanvasResult", "getInfo", "gl", "debugRendererInfo", "error", "shouldDisableOffscreenCanvas", "gpuInfo", "getGPUInfo", "c", "init_define_process", "pick", "src", "properties", "result", "i", "k", "isEmpty", "obj", "init_define_process", "transformRequest", "headers", "url", "newHeaders", "key", "value", "cartesianToGeographic", "centerLat", "centerLon", "x", "y", "latRadian", "latDelta", "EARTH_RADIUS_M", "newLat", "lonDelta", "newLon", "geographicToCartesian", "targetLat", "targetLon", "lonRadian", "centerLatRadian", "centerLonRadian", "populateGeometry3DIdsInScene", "tree", "entities", "loadGeometryGroupIds", "GroupContainerObject3D", "child", "GeometryGroupObject3D", "entityId", "Geometry3DObject3D", "populateGeometry2DIdsInScene", "Geometry2DObject3D", "mergeObjects", "obj1", "obj2", "key", "createCustomLayer", "modelAsMercatorCoordinate", "viewCamera", "onRender", "modelTransform", "matrix1", "Matrix4", "scale", "Vector3", "matrix2", "MAPPEDIN_LAYER_ID", "_gl", "args", "fetchToken", "authURL", "getRequestHeaders", "token", "access_token", "cyrb53", "str", "seed", "h1", "h2", "i", "ch", "getProjectionScaleFactor", "FOV", "canvasHeight", "zoom", "halfFOV", "PQ", "getBoundingBoxCenter", "bbox", "LngLatBounds", "LngLat", "shouldExpandZoomLevel", "minZoomFromCurrentPanBounds", "cameraZoomLevel", "getGroupContainerOpacity", "entity", "containerOpacity", "GroupContainerObject3D", "GeometryGroupObject3D", "coordinatesEqual", "coord1", "coord2", "tolerance", "lonEqual", "latEqual", "altEqual", "MAPLIBRE_FRUSTRUM_CULL_HACK_NAME", "maplibreFrustrumCullHack", "geometry", "BoxGeometry", "material", "MeshBasicMaterial", "mesh", "Mesh", "tempVec", "tempVec2", "Vector2", "projectToBox2D", "object", "camera", "result", "Box2", "child", "position", "ndcToScreen", "ndc", "container", "width", "height", "drawProjectedBox", "box", "color", "div", "min", "max", "init_define_process", "Text3DStyleComponent", "initialState", "__publicField", "DEFAULT_TEXT_STYLE", "includeDirty", "json", "key", "init_define_process", "init_define_process", "ModelStyleComponnet", "init", "__publicField", "init_define_process", "DEFAULT_SCALE", "DEFAULT_ROTATION"]
|
|
7
|
+
}
|