@mappedin/mappedin-js 6.0.1-beta.5 → 6.0.1-beta.50
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/README.md +80 -6
- package/THIRD_PARTY_LICENSES.txt +9297 -21275
- package/lib/esm/GLTFExporter-NSCWM6JS.js +2 -0
- package/lib/esm/GLTFExporter-NSCWM6JS.js.map +7 -0
- package/lib/esm/GLTFLoader-P7OIN6GY.js +2 -0
- package/lib/esm/GLTFLoader-P7OIN6GY.js.map +7 -0
- package/lib/esm/browser-6V77MKQS.js +2 -0
- package/lib/esm/browser-6V77MKQS.js.map +7 -0
- package/lib/esm/chunk-3JJZGEB7.js +2229 -0
- package/lib/esm/chunk-3JJZGEB7.js.map +7 -0
- package/lib/esm/chunk-AHC6OWNT.js +2 -0
- package/lib/esm/chunk-AHC6OWNT.js.map +7 -0
- package/lib/esm/chunk-DSSOZXRM.js +2 -0
- package/lib/esm/chunk-DSSOZXRM.js.map +7 -0
- package/lib/esm/chunk-I5GOIM6Y.js +578 -0
- package/lib/esm/chunk-I5GOIM6Y.js.map +7 -0
- package/lib/esm/chunk-JEQGUEFF.js +2 -0
- package/lib/esm/chunk-JEQGUEFF.js.map +7 -0
- package/lib/esm/chunk-SPVBFPOK.js +3820 -0
- package/lib/esm/chunk-SPVBFPOK.js.map +7 -0
- package/lib/esm/chunk-YDKOKGLT.js +2 -0
- package/lib/esm/chunk-YDKOKGLT.js.map +7 -0
- package/lib/esm/fonts/roboto-regular.ttf +0 -0
- package/lib/esm/index.css +2 -1
- package/lib/esm/index.css.map +7 -0
- package/lib/esm/index.d.ts +11858 -4851
- package/lib/esm/index.js +2 -1
- package/lib/esm/index.js.map +7 -0
- package/lib/esm/inspector-GKTULNKY.js +483 -0
- package/lib/esm/inspector-GKTULNKY.js.map +7 -0
- package/lib/esm/inspector-S63NMDZZ.css +2 -0
- package/lib/esm/inspector-S63NMDZZ.css.map +7 -0
- package/lib/esm/internal-CE37LADZ.js +2 -0
- package/lib/esm/internal-CE37LADZ.js.map +7 -0
- package/lib/esm/internal-WH523TQS.css +2 -0
- package/lib/esm/internal-WH523TQS.css.map +7 -0
- package/lib/esm/outdoor-context-v4-OHJPVR4U.js +2 -0
- package/lib/esm/outdoor-context-v4-OHJPVR4U.js.map +7 -0
- package/lib/esm/roboto-regular-25PMWR2T.js +2 -0
- package/lib/esm/roboto-regular-25PMWR2T.js.map +7 -0
- package/lib/esm/text3d-QUUOTI5N.js +253 -0
- package/lib/esm/text3d-QUUOTI5N.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 +649 -0
- package/lib/index.css +2 -1
- package/package.json +17 -14
- package/lib/esm/GLTFExporter-7Y4D6ZCC.js +0 -1
- package/lib/esm/GLTFLoader-ZJM7FISZ.js +0 -1
- package/lib/esm/browser-B7ZG64S7.js +0 -1
- package/lib/esm/chunk-FO75RVA4.js +0 -1
- package/lib/esm/chunk-OPKWNXJZ.js +0 -1
- package/lib/esm/chunk-TQW6Y4JF.js +0 -1
- package/lib/esm/chunk-WIRGVYAE.js +0 -1
- package/lib/esm/chunk-WJRLWIOO.js +0 -1
- package/lib/esm/inspector-L7HL2664.js +0 -1
- package/lib/esm/inspector-OZDC5DPH.css +0 -1
- package/lib/esm/outdoor-context-v4-R6AN2YQ4.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", "../../../packages/common/index.ts", "../../../packages/common/assert.ts", "../../../packages/common/random-id.ts", "../../../packages/common/pubsub.ts", "../../../packages/common/storage.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/components/geometry-group-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 = '') {\n\tconst label = `${MI_ERROR_LABEL}${name ? `-${name}` : ''}`;\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}\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}\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\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", "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", "import Logger from './Mappedin.Logger';\n\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 };\n\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", "/**\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", "/**\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\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", "export function normalizeAngle(angle: number): number {\n\treturn ((angle % (2 * Math.PI)) + 2 * Math.PI) % (2 * Math.PI);\n}\n", "import type { Object3D, Camera as THREECamera } from 'three';\nimport { Matrix4, Vector3 } from 'three';\nimport { LngLat, LngLatBounds, MercatorCoordinate } from '../../../packages/outdoor-context-v4';\nimport type { CustomLayerInterface } from '../../../packages/outdoor-context-v4';\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 type { Camera } from '../camera';\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';\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) => {\n\tif (tree.children && tree.visible) {\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.type === 'geometry-group') {\n\t\t\t\t\tentities.add(child.userData.entityId);\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);\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\tcamera: Camera,\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\tlet currentElevation = camera.elevation;\n\n\treturn {\n\t\tid: MAPPEDIN_LAYER_ID,\n\t\ttype: 'custom',\n\t\trenderingMode: '3d',\n\t\trender: (_gl, matrix) => {\n\t\t\tmatrix1.fromArray(matrix);\n\t\t\t// only update elevation when it changed\n\t\t\tif (currentElevation !== camera.elevation) {\n\t\t\t\tconst elevatedCoordinate = MercatorCoordinate.fromLngLat(\n\t\t\t\t\tmodelAsMercatorCoordinate.toLngLat(),\n\t\t\t\t\tcamera.elevation,\n\t\t\t\t);\n\t\t\t\t// because we move maplibre's camera up, the matrix then needs to be moved down,\n\t\t\t\t// so the scene is rendered at the correct elevation\n\t\t\t\tmatrix2\n\t\t\t\t\t.makeTranslation(modelTransform.translateX, modelTransform.translateY, -elevatedCoordinate.z)\n\t\t\t\t\t.scale(scale);\n\t\t\t}\n\t\t\tviewCamera.projectionMatrix = matrix1.multiply(matrix2);\n\t\t\tcurrentElevation = camera.elevation;\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\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\nexport function interpolate(\n\tvalue: number,\n\tinputMin: number,\n\tinputMax: number,\n\toutputMin: number,\n\toutputMax: number,\n\teaseFunc = linearEase,\n): number {\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 = 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\nexport function interpolateMulti(\n\tvalue: number,\n\tinputRange: number[],\n\toutputRange: number[],\n\teaseFunc = quadEaseIn,\n): number {\n\t// Ensure inputRange and outputRange have the same number of values\n\tif (inputRange.length !== outputRange.length) {\n\t\tthrow new Error('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\tlet segment = 0;\n\twhile (segment < inputRange.length - 1 && value > inputRange[segment + 1]) {\n\t\tsegment++;\n\t}\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 = 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\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", "import { Object3D } from 'three';\nimport type { GeometryGroupState } from './geometry-group';\nimport { GeometryGroupObject3D } from './geometry-group';\nimport { Geometry2D, Geometry2DObject3D } from './geometry2d';\nimport type { StackComponent } from '../components/stack';\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\tStack,\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};\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: [StackComponent?, 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 { GeometryGroupStyleComponent } from '../components/geometry-group-style';\nimport type { MaterialSide } from '../components/styles';\n\nexport enum GeometryGroupComponents {\n\tGeometryGroupStyle,\n}\n\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/**\n\t * The opacity of the geometry group. This will affect all children of the geometry group and override their opacity.\n\t */\n\topacity: number;\n\t/**\n\t * The initial color of the geometry and its children. 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 and its children. Updating this will affect any children whose color was not updated after generation\n\t */\n\tcolor: string;\n\t/**\n\t * The initial top color of the geometry and its children. 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 top color of the geometry and its children. Updating this will affect any children whose top color was not updated after generation\n\t */\n\ttopColor?: string;\n\t/**\n\t * The shading of the geometry and its children. Updating this will affect all children of the geometry group.\n\t */\n\tshading?: Shading;\n\t/**\n\t * Whether the geometry and its children are outlined. This will affect all children of the geometry group and override their outline state.\n\t */\n\toutline?: boolean;\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 * altitude of the geometry group\n\t */\n\taltitude?: number;\n\t/**\n\t * height of the geometry group\n\t */\n\theight?: number;\n\t/**\n\t * Material side of the geometry group\n\t */\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: [GeometryGroupStyleComponent];\n\tuserData: {\n\t\tentityId: string | number;\n\t\tentities3D: Set<string | number>;\n\t\tmodelURL?: string;\n\t\topacity: number;\n\t\tdirty: boolean;\n\t\tshadingDirty: boolean;\n\t} = {\n\t\tentityId: '',\n\t\tentities3D: new Set(),\n\t\topacity: 1,\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\tgetOpacity() {\n\t\treturn this.userData.opacity;\n\t}\n\n\tsetOpacity(opacity: number) {\n\t\tthis.userData.opacity = opacity;\n\t}\n\n\tremoveEntity() {\n\t\tthis.dispatchEvent({ type: 'childremoved', child: this });\n\t}\n\n\tconstructor(id: string, style: GeometryGroupStyleComponent = new GeometryGroupStyleComponent()) {\n\t\tsuper();\n\t\tthis.components = [style];\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\n// const buildingOpacity = interpolate(cameraZoom, [17, 18, 1, 0]);\n// const indoorOpacity = interpolate(buildingOpacity, [0, 1, 1, 0]);\n\n// useEvent('click', ({ entities2D, entities3D, entityGroups }) => {});\n\n// html`\n// <EntityContainer id=\"Map 1\">\n// <EntityGroup id=\"Building Geometry\" geometry={geojson} style={{ ...style, opacity: buildingOpacity }}>\n// <Geometry2D components={[LabelComponent({text: 'Building 1'})]} />\n// </EntityGroup>\n// <EntityGroupStack id=\"Map 1 indoors\" expandedFactor={0} gapSize={10}>\n// <EntityContainer id=\"Floor 0\">\n// <EntityGroup id=\"Hallways\" geometry={geojson} style={{ ...hallWaysStyle, opacity: buildingOpacity }} styleChildrenById={{'123': { color: 'red' }}} components={[Interaction()]}>\n// {labels.map(label => (\n// <Geometry2D position={label.position} components={[LabelComponent({text: label.text}), Interaction()]}/>\n// )}\n// {markers.map(marker =>(\n// <Geometry2D position={marker.position} components={[MarkerComponent({html: <div></div> })]}/>\n// )}\n// </EntityGroup>\n// </EntityContainer>\n// <EntityContainer id=\"Floor 1\">\n// <EntityGroup id=\"Desks\" geometry={geojson} style={{ ...desksStyle, opacity: buildingOpacity }} components={[Interaction()]>\n// {labels.map(label => (\n// <Geometry2D components={[LabelComponent({text: label.text}), Interaction()]} />\n// )}\n// </EntityGroup>\n// </EntityContainer>\n// <EntityGroupStack />\n// </EntityContainer>\n// `;\n", "import type { Texture, BufferGeometry, Mesh, MeshLambertMaterial } from 'three';\nimport { BatchedMesh, Color, Vector3 } from 'three';\nimport type { BatchedStandardMaterial } from '../systems/mesh-creation-and-optimization/batched-material';\nimport type { EntityId, Position } 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 } 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};\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\tfocusMesh?: Mesh;\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\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\tfocusable = false;\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 type { LineStyle } 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};\n\nexport class StyleComponent implements Style {\n\tinitialColor = DEFAULT_COLOR;\n\tcolor = DEFAULT_COLOR;\n\tinitialTopColor?: string;\n\ttopColor?: string;\n\ttopTexture?: string;\n\ttexture?: string;\n\thoverColor?: string;\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\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}\n}\n", "import { type Shading } from '../types';\n\nconst DEFAULT_COLOR = '#ffffff';\ntype GeometryGroupStyle = {\n\tcolor: string;\n\ttopColor?: string;\n\topacity: number;\n\theight?: number;\n\tshading?: Shading;\n\toutline: boolean;\n\ttexture?: string;\n\ttopTexture?: string;\n};\n\nexport class GeometryGroupStyleComponent implements GeometryGroupStyle {\n\tcolor = DEFAULT_COLOR;\n\tinitialColor = DEFAULT_COLOR;\n\ttopColor?: string;\n\tinitialTopColor?: string;\n\topacity = 1;\n\theight?: number;\n\t#shading?: Required<Shading>;\n\toutline = true;\n\ttexture?: string;\n\ttopTexture?: string;\n\n\t/**\n\t * Ideally for handling all style component changes. However, it's only used for handling outline for now.\n\t * Color update is handled separately in each child. See: https://github.com/MappedIn/sdk/blob/v6.0.1-beta.1/sdks/geojson/src/entities/utils.ts#L70\n\t */\n\tdirty = true;\n\n\tget shading(): Required<Shading> | undefined {\n\t\treturn this.#shading;\n\t}\n\n\tset shading(value: Shading | undefined) {\n\t\tif (!value) {\n\t\t\tthis.#shading = undefined;\n\n\t\t\treturn;\n\t\t}\n\n\t\tthis.#shading = this.#shading ?? { start: 0, end: 0, intensity: 0 };\n\t\tObject.assign(this.#shading, value);\n\t}\n\n\tconstructor(style: Partial<GeometryGroupStyle> = {}) {\n\t\tthis.color = style?.color ?? this.color;\n\t\tthis.initialColor = this.color;\n\t\tthis.topColor = style?.topColor;\n\t\tthis.initialTopColor = this.topColor;\n\t\tthis.opacity = style?.opacity ?? this.opacity;\n\t\tthis.height = style?.height;\n\t\tthis.shading = style?.shading;\n\t\tthis.outline = style?.outline !== undefined ? Boolean(style.outline) : this.outline;\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';\n\nexport enum Geometry3DComponents {\n\tMesh,\n\tStyle,\n\tInteraction,\n\tOutline,\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> {\n\tid: string | number = randomId();\n\tcomponents: [M, S, I?, O?];\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", "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": "8PAAAA,IAEO,IAAMC,GAAiB,eAElBC,QACXA,IAAA,aACAA,IAAA,eACAA,IAAA,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GAAG,EACzB,aAAc,QACd,eAAgB,EAChB,aAAc,EACd,eAAgB,EAChB,eAAgB,EAChB,YAAa,EACb,cAAe,EACf,YAAa,EACb,SAAU,OACV,UAAW,OACX,YAAa,QACb,WAAY,MACb,CAAC,ECnFDI,ICAAC,IAoEO,IAAMC,GAAN,KAAyD,CAU/D,YAAYC,EAA4B,CATxCC,EAAA,aAAQ,IACRA,EAAA,eAAU,IACVA,EAAA,eAAU,GACVA,EAAA,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", "label", "define_process_default", "args", "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", "init_define_process", "debounce", "func", "wait", "immediate", "timeout", "called", "args", "later", "init_define_process", "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", "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", "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", "StyleComponent", "style", "__publicField", "DEFAULT_COLOR", "EntityBatchedMesh", "BatchedMesh", "__publicField", "_opacity", "_bbox", "MeshComponent", "feature", "Color", "Vector3", "__privateAdd", "visible", "value", "color", "topColor", "__privateGet", "imageMaterials", "material", "__privateSet", "texture", "getBoundingBoxFromFeature", "init_define_process", "DEFAULT_COLOR", "_shading", "GeometryGroupStyleComponent", "style", "__publicField", "__privateAdd", "__privateGet", "value", "__privateSet", "GeometryGroupObject3D", "Object3D", "id", "style", "GeometryGroupStyleComponent", "__publicField", "visible", "opacity", "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", "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", "child", "entityId", "Geometry3DObject3D", "populateGeometry2DIdsInScene", "Geometry2DObject3D", "mergeObjects", "obj1", "obj2", "key", "createCustomLayer", "modelAsMercatorCoordinate", "viewCamera", "camera", "onRender", "modelTransform", "matrix1", "Matrix4", "scale", "Vector3", "matrix2", "currentElevation", "MAPPEDIN_LAYER_ID", "_gl", "matrix", "elevatedCoordinate", "MercatorCoordinate", "fetchToken", "authURL", "getRequestHeaders", "token", "access_token", "cyrb53", "str", "seed", "h1", "h2", "ch", "linearEase", "t", "easeIn", "x", "interpolate", "value", "inputMin", "inputMax", "outputMin", "outputMax", "easeFunc", "linearEase", "t", "easedT", "getProjectionScaleFactor", "FOV", "canvasHeight", "zoom", "halfFOV", "PQ", "getBoundingBoxCenter", "bbox", "LngLatBounds", "LngLat", "shouldExpandZoomLevel", "minZoomFromCurrentPanBounds", "cameraZoomLevel", "getGroupContainerOpacity", "entity", "containerOpacity", "GroupContainerObject3D", "GeometryGroupObject3D", "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
|
+
}
|