From 93d774b4188310e7464ca519c356cf6e9f6ca000 Mon Sep 17 00:00:00 2001 From: Kieran Farr Date: Tue, 16 Jul 2024 21:20:44 -0700 Subject: [PATCH] update library after fixing build errors --- lib/three-loader-3dtiles.js | 9026 +++++++++++++++++------------------ 1 file changed, 4349 insertions(+), 4677 deletions(-) diff --git a/lib/three-loader-3dtiles.js b/lib/three-loader-3dtiles.js index 9f5fce2f..96c9fb2f 100644 --- a/lib/three-loader-3dtiles.js +++ b/lib/three-loader-3dtiles.js @@ -1,88 +1,90 @@ -import { CanvasTexture as Kc, LinearFilter as zc, RepeatWrapping as kr, Frustum as Wc, Matrix4 as tt, Group as En, PlaneGeometry as Xc, Vector3 as rt, MeshBasicMaterial as Hs, DoubleSide as jo, Mesh as Js, ArrowHelper as Qc, Color as w, BoxGeometry as qc, EdgesGeometry as Yc, LineSegments as $c, LineBasicMaterial as Zc, Vector2 as ko, ShaderMaterial as lr, NormalBlending as hr, WebGLRenderTarget as tu, NearestFilter as Kr, RGBAFormat as eu, FloatType as nu, Scene as su, WebGLRenderer as ru, Euler as rs, BufferGeometry as Ko, Float32BufferAttribute as Sn, BufferAttribute as zo, PerspectiveCamera as Wo, OrthographicCamera as iu, Quaternion as ou, Uint8BufferAttribute as zr, Points as au } from 'three'; -import { GLTFLoader as cu } from 'three/examples/jsm/loaders/GLTFLoader.js'; -import { DRACOLoader as uu } from 'three/examples/jsm/loaders/DRACOLoader.js'; -import { KTX2Loader as lu } from 'three/examples/jsm/loaders/KTX2Loader.js'; -const jc = Object.defineProperty; -const kc = (e, t, n) => t in e ? jc(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n; -const p = (e, t, n) => (kc(e, typeof t !== 'symbol' ? t + '' : t, n), n); -async function Ke (e, t, n, s) { +var jc = Object.defineProperty; +var kc = (e, t, n) => t in e ? jc(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n; +var p = (e, t, n) => (kc(e, typeof t != "symbol" ? t + "" : t, n), n); +import { CanvasTexture as Kc, LinearFilter as zc, RepeatWrapping as kr, Frustum as Wc, Matrix4 as tt, Group as En, PlaneGeometry as Xc, Vector3 as rt, MeshBasicMaterial as Hs, DoubleSide as jo, Mesh as Js, ArrowHelper as Qc, Color as w, BoxGeometry as qc, EdgesGeometry as Yc, LineSegments as $c, LineBasicMaterial as Zc, Vector2 as ko, ShaderMaterial as lr, NormalBlending as hr, WebGLRenderTarget as tu, NearestFilter as Kr, RGBAFormat as eu, FloatType as nu, Scene as su, WebGLRenderer as ru, Euler as rs, BufferGeometry as Ko, Float32BufferAttribute as Sn, BufferAttribute as zo, PerspectiveCamera as Wo, OrthographicCamera as iu, Quaternion as ou, Uint8BufferAttribute as zr, Points as au } from "three"; +import { GLTFLoader as cu } from "three/examples/jsm/loaders/GLTFLoader.js"; +import { DRACOLoader as uu } from "three/examples/jsm/loaders/DRACOLoader.js"; +import { KTX2Loader as lu } from "three/examples/jsm/loaders/KTX2Loader.js"; +async function Ke(e, t, n, s) { return s._parse(e, t, n, s); } -function z (e, t) { - if (!e) { throw new Error(t || 'loader assertion failed.'); } +function z(e, t) { + if (!e) + throw new Error(t || "loader assertion failed."); } -const kn = !!(typeof process !== 'object' || String(process) !== '[object process]' || process.browser); const Wr = typeof process < 'u' && process.version && /v([0-9]*)/.exec(process.version); +const kn = !!(typeof process != "object" || String(process) !== "[object process]" || process.browser), Wr = typeof process < "u" && process.version && /v([0-9]*)/.exec(process.version); Wr && parseFloat(Wr[1]); -function hu (e, t) { +function hu(e, t) { return Xo(e || {}, t); } -function Xo (e, t) { - const n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0; - if (n > 3) { return t; } +function Xo(e, t) { + let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0; + if (n > 3) + return t; const s = { ...e }; - for (const [r, i] of Object.entries(t)) { i && typeof i === 'object' && !Array.isArray(i) ? s[r] = Xo(s[r] || {}, t[r], n + 1) : s[r] = t[r]; } + for (const [r, i] of Object.entries(t)) + i && typeof i == "object" && !Array.isArray(i) ? s[r] = Xo(s[r] || {}, t[r], n + 1) : s[r] = t[r]; return s; } -const fu = 'latest'; -function du () { - let e; - return (e = globalThis._loadersgl_) !== null && e !== void 0 && e.version || (globalThis._loadersgl_ = globalThis._loadersgl_ || {}, globalThis._loadersgl_.version = '4.1.1'), globalThis._loadersgl_.version; +const fu = "latest"; +function du() { + var e; + return (e = globalThis._loadersgl_) !== null && e !== void 0 && e.version || (globalThis._loadersgl_ = globalThis._loadersgl_ || {}, globalThis._loadersgl_.version = "4.1.1"), globalThis._loadersgl_.version; } const Qo = du(); -function Jt (e, t) { - if (!e) { throw new Error(t || 'loaders.gl assertion failed.'); } +function Jt(e, t) { + if (!e) + throw new Error(t || "loaders.gl assertion failed."); } -const bt = typeof process !== 'object' || String(process) !== '[object process]' || process.browser; const fr = typeof importScripts === 'function'; const mu = typeof window < 'u' && typeof window.orientation < 'u'; const Xr = typeof process < 'u' && process.version && /v([0-9]*)/.exec(process.version); +const bt = typeof process != "object" || String(process) !== "[object process]" || process.browser, fr = typeof importScripts == "function", mu = typeof window < "u" && typeof window.orientation < "u", Xr = typeof process < "u" && process.version && /v([0-9]*)/.exec(process.version); Xr && parseFloat(Xr[1]); class gu { - constructor (t, n) { + constructor(t, n) { this.name = void 0, this.workerThread = void 0, this.isRunning = !0, this.result = void 0, this._resolve = () => { }, this._reject = () => { }, this.name = t, this.workerThread = n, this.result = new Promise((s, r) => { this._resolve = s, this._reject = r; }); } - - postMessage (t, n) { + postMessage(t, n) { this.workerThread.postMessage({ - source: 'loaders.gl', + source: "loaders.gl", type: t, payload: n }); } - - done (t) { + done(t) { Jt(this.isRunning), this.isRunning = !1, this._resolve(t); } - - error (t) { + error(t) { Jt(this.isRunning), this.isRunning = !1, this._reject(t); } } class is { - terminate () { + terminate() { } } const os = /* @__PURE__ */ new Map(); -function Au (e) { +function Au(e) { Jt(e.source && !e.url || !e.source && e.url); let t = os.get(e.source || e.url); return t || (e.url && (t = pu(e.url), os.set(e.url, t)), e.source && (t = qo(e.source), os.set(e.source, t))), Jt(t), t; } -function pu (e) { - if (!e.startsWith('http')) { return e; } +function pu(e) { + if (!e.startsWith("http")) + return e; const t = yu(e); return qo(t); } -function qo (e) { +function qo(e) { const t = new Blob([e], { - type: 'application/javascript' + type: "application/javascript" }); return URL.createObjectURL(t); } -function yu (e) { +function yu(e) { return `try { importScripts('${e}'); } catch (error) { @@ -90,30 +92,33 @@ function yu (e) { throw error; }`; } -function Yo (e) { - const t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0; const n = arguments.length > 2 ? arguments[2] : void 0; +function Yo(e) { + let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0, n = arguments.length > 2 ? arguments[2] : void 0; const s = n || /* @__PURE__ */ new Set(); if (e) { - if (Qr(e)) { s.add(e); } else if (Qr(e.buffer)) { s.add(e.buffer); } else if (!ArrayBuffer.isView(e)) { - if (t && typeof e === 'object') { - for (const r in e) { Yo(e[r], t, s); } - } + if (Qr(e)) + s.add(e); + else if (Qr(e.buffer)) + s.add(e.buffer); + else if (!ArrayBuffer.isView(e)) { + if (t && typeof e == "object") + for (const r in e) + Yo(e[r], t, s); } } return n === void 0 ? Array.from(s) : []; } -function Qr (e) { - return e ? e instanceof ArrayBuffer || typeof MessagePort < 'u' && e instanceof MessagePort || typeof ImageBitmap < 'u' && e instanceof ImageBitmap || typeof OffscreenCanvas < 'u' && e instanceof OffscreenCanvas : !1; +function Qr(e) { + return e ? e instanceof ArrayBuffer || typeof MessagePort < "u" && e instanceof MessagePort || typeof ImageBitmap < "u" && e instanceof ImageBitmap || typeof OffscreenCanvas < "u" && e instanceof OffscreenCanvas : !1; } const as = () => { }; class Vs { - static isSupported () { - return typeof Worker < 'u' && bt || typeof is < 'u' && !bt; + static isSupported() { + return typeof Worker < "u" && bt || typeof is < "u" && !bt; } - - constructor (t) { - this.name = void 0, this.source = void 0, this.url = void 0, this.terminated = !1, this.worker = void 0, this.onMessage = void 0, this.onError = void 0, this._loadableURL = ''; + constructor(t) { + this.name = void 0, this.source = void 0, this.url = void 0, this.terminated = !1, this.worker = void 0, this.onMessage = void 0, this.onError = void 0, this._loadableURL = ""; const { name: n, source: s, @@ -121,25 +126,20 @@ class Vs { } = t; Jt(s || r), this.name = n, this.source = s, this.url = r, this.onMessage = as, this.onError = (i) => console.log(i), this.worker = bt ? this._createBrowserWorker() : this._createNodeWorker(); } - - destroy () { + destroy() { this.onMessage = as, this.onError = as, this.worker.terminate(), this.terminated = !0; } - - get isRunning () { + get isRunning() { return !!this.onMessage; } - - postMessage (t, n) { + postMessage(t, n) { n = n || Yo(t), this.worker.postMessage(t, n); } - - _getErrorFromErrorEvent (t) { - let n = 'Failed to load '; + _getErrorFromErrorEvent(t) { + let n = "Failed to load "; return n += `worker ${this.name} from ${this.url}. `, t.message && (n += `${t.message} in `), t.lineno && (n += `:${t.lineno}:${t.colno}`), new Error(n); } - - _createBrowserWorker () { + _createBrowserWorker() { this._loadableURL = Au({ source: this.source, url: this.url @@ -148,55 +148,51 @@ class Vs { name: this.name }); return t.onmessage = (n) => { - n.data ? this.onMessage(n.data) : this.onError(new Error('No data received')); + n.data ? this.onMessage(n.data) : this.onError(new Error("No data received")); }, t.onerror = (n) => { this.onError(this._getErrorFromErrorEvent(n)), this.terminated = !0; }, t.onmessageerror = (n) => console.error(n), t; } - - _createNodeWorker () { + _createNodeWorker() { let t; if (this.url) { - const s = this.url.includes(':/') || this.url.startsWith('/') ? this.url : `./${this.url}`; + const s = this.url.includes(":/") || this.url.startsWith("/") ? this.url : `./${this.url}`; t = new is(s, { eval: !1 }); - } else if (this.source) { + } else if (this.source) t = new is(this.source, { eval: !0 }); - } else { throw new Error('no worker'); } - return t.on('message', (n) => { + else + throw new Error("no worker"); + return t.on("message", (n) => { this.onMessage(n); - }), t.on('error', (n) => { + }), t.on("error", (n) => { this.onError(n); - }), t.on('exit', (n) => { + }), t.on("exit", (n) => { }), t; } } class Bu { - static isSupported () { + static isSupported() { return Vs.isSupported(); } - - constructor (t) { - this.name = 'unnamed', this.source = void 0, this.url = void 0, this.maxConcurrency = 1, this.maxMobileConcurrency = 1, this.onDebug = () => { + constructor(t) { + this.name = "unnamed", this.source = void 0, this.url = void 0, this.maxConcurrency = 1, this.maxMobileConcurrency = 1, this.onDebug = () => { }, this.reuseWorkers = !0, this.props = {}, this.jobQueue = [], this.idleQueue = [], this.count = 0, this.isDestroyed = !1, this.source = t.source, this.url = t.url, this.setProps(t); } - - destroy () { + destroy() { this.idleQueue.forEach((t) => t.destroy()), this.isDestroyed = !0; } - - setProps (t) { + setProps(t) { this.props = { ...this.props, ...t }, t.name !== void 0 && (this.name = t.name), t.maxConcurrency !== void 0 && (this.maxConcurrency = t.maxConcurrency), t.maxMobileConcurrency !== void 0 && (this.maxMobileConcurrency = t.maxMobileConcurrency), t.reuseWorkers !== void 0 && (this.reuseWorkers = t.reuseWorkers), t.onDebug !== void 0 && (this.onDebug = t.onDebug); } - - async startJob (t) { - const n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : (i, o, a) => i.done(a); const s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : (i, o) => i.error(o); + async startJob(t) { + let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : (i, o, a) => i.done(a), s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : (i, o) => i.error(o); const r = new Promise((i) => (this.jobQueue.push({ name: t, onMessage: n, @@ -205,15 +201,16 @@ class Bu { }), this)); return this._startQueuedJob(), await r; } - - async _startQueuedJob () { - if (!this.jobQueue.length) { return; } + async _startQueuedJob() { + if (!this.jobQueue.length) + return; const t = this._getAvailableWorker(); - if (!t) { return; } + if (!t) + return; const n = this.jobQueue.shift(); if (n) { this.onDebug({ - message: 'Starting job', + message: "Starting job", name: n.name, workerThread: t, backlog: this.jobQueue.length @@ -229,13 +226,12 @@ class Bu { } } } - - returnWorkerToQueue (t) { + returnWorkerToQueue(t) { !bt || this.isDestroyed || !this.reuseWorkers || this.count > this._getMaxConcurrency() ? (t.destroy(), this.count--) : this.idleQueue.push(t), this.isDestroyed || this._startQueuedJob(); } - - _getAvailableWorker () { - if (this.idleQueue.length > 0) { return this.idleQueue.shift() || null; } + _getAvailableWorker() { + if (this.idleQueue.length > 0) + return this.idleQueue.shift() || null; if (this.count < this._getMaxConcurrency()) { this.count++; const t = `${this.name.toLowerCase()} (#${this.count} of ${this.maxConcurrency})`; @@ -247,8 +243,7 @@ class Bu { } return null; } - - _getMaxConcurrency () { + _getMaxConcurrency() { return mu ? this.maxMobileConcurrency : this.maxConcurrency; } } @@ -260,35 +255,32 @@ const Cu = { } }; class Nt { - static isSupported () { + static isSupported() { return Vs.isSupported(); } - - static getWorkerFarm () { - const t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; + static getWorkerFarm() { + let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; return Nt._workerFarm = Nt._workerFarm || new Nt({}), Nt._workerFarm.setProps(t), Nt._workerFarm; } - - constructor (t) { + constructor(t) { this.props = void 0, this.workerPools = /* @__PURE__ */ new Map(), this.props = { ...Cu }, this.setProps(t), this.workerPools = /* @__PURE__ */ new Map(); } - - destroy () { - for (const t of this.workerPools.values()) { t.destroy(); } + destroy() { + for (const t of this.workerPools.values()) + t.destroy(); this.workerPools = /* @__PURE__ */ new Map(); } - - setProps (t) { + setProps(t) { this.props = { ...this.props, ...t }; - for (const n of this.workerPools.values()) { n.setProps(this._getWorkerPoolProps()); } + for (const n of this.workerPools.values()) + n.setProps(this._getWorkerPoolProps()); } - - getWorkerPool (t) { + getWorkerPool(t) { const { name: n, source: s, @@ -301,8 +293,7 @@ class Nt { url: r }), i.setProps(this._getWorkerPoolProps()), this.workerPools.set(n, i)), i; } - - _getWorkerPoolProps () { + _getWorkerPoolProps() { return { maxConcurrency: this.props.maxConcurrency, maxMobileConcurrency: this.props.maxMobileConcurrency, @@ -312,56 +303,60 @@ class Nt { } } Nt._workerFarm = void 0; -function Eu (e) { - const t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; - const n = t[e.id] || {}; const s = bt ? `${e.id}-worker.js` : `${e.id}-worker-node.js`; +function Eu(e) { + let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; + const n = t[e.id] || {}, s = bt ? `${e.id}-worker.js` : `${e.id}-worker-node.js`; let r = n.workerUrl; - if (!r && e.id === 'compression' && (r = t.workerUrl), t._workerType === 'test' && (bt ? r = `modules/${e.module}/dist/${s}` : r = `modules/${e.module}/src/workers/${e.id}-worker-node.ts`), !r) { + if (!r && e.id === "compression" && (r = t.workerUrl), t._workerType === "test" && (bt ? r = `modules/${e.module}/dist/${s}` : r = `modules/${e.module}/src/workers/${e.id}-worker-node.ts`), !r) { let i = e.version; - i === 'latest' && (i = fu); - const o = i ? `@${i}` : ''; + i === "latest" && (i = fu); + const o = i ? `@${i}` : ""; r = `https://unpkg.com/@loaders.gl/${e.module}${o}/dist/${s}`; } return Jt(r), r; } -function Tu (e) { - const t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : Qo; - Jt(e, 'no worker provided'); +function Tu(e) { + let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : Qo; + Jt(e, "no worker provided"); const n = e.version; return !(!t || !n); } -const bu = {}; const _u = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ +const bu = {}, _u = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, default: bu -}, Symbol.toStringTag, { value: 'Module' })); const cs = {}; -async function Zt (e) { - const t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null; const n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}; const s = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : null; +}, Symbol.toStringTag, { value: "Module" })), cs = {}; +async function Zt(e) { + let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null, n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, s = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : null; return t && (e = wu(e, t, n, s)), cs[e] = cs[e] || Ru(e), await cs[e]; } -function wu (e, t) { - const n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}; let s = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : null; - if (!n.useLocalLibraries && e.startsWith('http')) { return e; } +function wu(e, t) { + let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, s = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : null; + if (!n.useLocalLibraries && e.startsWith("http")) + return e; s = s || e; const r = n.modules || {}; - return r[s] ? r[s] : bt ? n.CDN ? (Jt(n.CDN.startsWith('http')), `${n.CDN}/${t}@${Qo}/dist/libs/${s}`) : fr ? `../src/libs/${s}` : `modules/${t}/src/libs/${s}` : `modules/${t}/dist/libs/${s}`; + return r[s] ? r[s] : bt ? n.CDN ? (Jt(n.CDN.startsWith("http")), `${n.CDN}/${t}@${Qo}/dist/libs/${s}`) : fr ? `../src/libs/${s}` : `modules/${t}/src/libs/${s}` : `modules/${t}/dist/libs/${s}`; } -async function Ru (e) { - if (e.endsWith('wasm')) { return await Su(e); } - if (!bt) { +async function Ru(e) { + if (e.endsWith("wasm")) + return await Su(e); + if (!bt) try { return _u && void 0; } catch (n) { return console.error(n), null; } - } - if (fr) { return importScripts(e); } + if (fr) + return importScripts(e); const t = await Iu(e); return Mu(t, e); } -function Mu (e, t) { - if (!bt) { return; } - if (fr) { return eval.call(globalThis, e), null; } - const n = document.createElement('script'); +function Mu(e, t) { + if (!bt) + return; + if (fr) + return eval.call(globalThis, e), null; + const n = document.createElement("script"); n.id = t; try { n.appendChild(document.createTextNode(e)); @@ -370,37 +365,37 @@ function Mu (e, t) { } return document.body.appendChild(n), null; } -async function Su (e) { +async function Su(e) { return await (await fetch(e)).arrayBuffer(); } -async function Iu (e) { +async function Iu(e) { return await (await fetch(e)).text(); } -function xu (e, t) { +function xu(e, t) { return !Nt.isSupported() || !bt && !(t != null && t._nodeWorkers) ? !1 : e.worker && (t == null ? void 0 : t.worker); } -async function vu (e, t, n, s, r) { - const i = e.id; const o = Eu(e, n); const c = Nt.getWorkerFarm(n).getWorkerPool({ +async function vu(e, t, n, s, r) { + const i = e.id, o = Eu(e, n), c = Nt.getWorkerFarm(n).getWorkerPool({ name: i, url: o }); n = JSON.parse(JSON.stringify(n)), s = JSON.parse(JSON.stringify(s || {})); - const u = await c.startJob('process-on-worker', Ou.bind(null, r)); - return u.postMessage('process', { + const u = await c.startJob("process-on-worker", Ou.bind(null, r)); + return u.postMessage("process", { input: t, options: n, context: s }), await (await u.result).result; } -async function Ou (e, t, n, s) { +async function Ou(e, t, n, s) { switch (n) { - case 'done': + case "done": t.done(s); break; - case 'error': + case "error": t.error(new Error(s.error)); break; - case 'process': + case "process": const { id: r, input: i, @@ -408,13 +403,13 @@ async function Ou (e, t, n, s) { } = s; try { const a = await e(i, o); - t.postMessage('done', { + t.postMessage("done", { id: r, result: a }); } catch (a) { - const c = a instanceof Error ? a.message : 'unknown error'; - t.postMessage('error', { + const c = a instanceof Error ? a.message : "unknown error"; + t.postMessage("error", { id: r, error: c }); @@ -424,166 +419,158 @@ async function Ou (e, t, n, s) { console.warn(`parse-with-worker unknown message ${n}`); } } -function Fu (e) { - const t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 5; - return typeof e === 'string' ? e.slice(0, t) : ArrayBuffer.isView(e) ? qr(e.buffer, e.byteOffset, t) : e instanceof ArrayBuffer ? qr(e, 0, t) : ''; +function Fu(e) { + let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 5; + return typeof e == "string" ? e.slice(0, t) : ArrayBuffer.isView(e) ? qr(e.buffer, e.byteOffset, t) : e instanceof ArrayBuffer ? qr(e, 0, t) : ""; } -function qr (e, t, n) { - if (e.byteLength <= t + n) { return ''; } +function qr(e, t, n) { + if (e.byteLength <= t + n) + return ""; const s = new DataView(e); - let r = ''; - for (let i = 0; i < n; i++) { r += String.fromCharCode(s.getUint8(t + i)); } + let r = ""; + for (let i = 0; i < n; i++) + r += String.fromCharCode(s.getUint8(t + i)); return r; } -function Du (e) { +function Du(e) { try { return JSON.parse(e); } catch { throw new Error(`Failed to parse JSON from data starting with "${Fu(e)}"`); } } -function Lu (e, t, n) { - if (n = n || e.byteLength, e.byteLength < n || t.byteLength < n) { return !1; } - const s = new Uint8Array(e); const r = new Uint8Array(t); - for (let i = 0; i < s.length; ++i) { - if (s[i] !== r[i]) { return !1; } - } +function Lu(e, t, n) { + if (n = n || e.byteLength, e.byteLength < n || t.byteLength < n) + return !1; + const s = new Uint8Array(e), r = new Uint8Array(t); + for (let i = 0; i < s.length; ++i) + if (s[i] !== r[i]) + return !1; return !0; } -function Pu () { - for (var e = arguments.length, t = new Array(e), n = 0; n < e; n++) { t[n] = arguments[n]; } +function Pu() { + for (var e = arguments.length, t = new Array(e), n = 0; n < e; n++) + t[n] = arguments[n]; return Gu(t); } -function Gu (e) { - const t = e.map((i) => i instanceof ArrayBuffer ? new Uint8Array(i) : i); const n = t.reduce((i, o) => i + o.byteLength, 0); const s = new Uint8Array(n); +function Gu(e) { + const t = e.map((i) => i instanceof ArrayBuffer ? new Uint8Array(i) : i), n = t.reduce((i, o) => i + o.byteLength, 0), s = new Uint8Array(n); let r = 0; - for (const i of t) { s.set(i, r), r += i.byteLength; } + for (const i of t) + s.set(i, r), r += i.byteLength; return s.buffer; } -function dr (e, t, n) { +function dr(e, t, n) { const s = n !== void 0 ? new Uint8Array(e).subarray(t, t + n) : new Uint8Array(e).subarray(t); return new Uint8Array(s).buffer; } -function ze (e, t) { +function ze(e, t) { return z(e >= 0), z(t > 0), e + (t - 1) & ~(t - 1); } -function Nu (e, t, n) { +function Nu(e, t, n) { let s; - if (e instanceof ArrayBuffer) { s = new Uint8Array(e); } else { - const r = e.byteOffset; const i = e.byteLength; + if (e instanceof ArrayBuffer) + s = new Uint8Array(e); + else { + const r = e.byteOffset, i = e.byteLength; s = new Uint8Array(e.buffer || e.arrayBuffer, r, i); } return t.set(s, n), n + ze(s.byteLength, 4); } -async function Uu (e) { +async function Uu(e) { const t = []; - for await (const n of e) { t.push(n); } + for await (const n of e) + t.push(n); return Pu(...t); } -function Yr () { +function Yr() { let e; - if (typeof window < 'u' && window.performance) { e = window.performance.now(); } else if (typeof process < 'u' && process.hrtime) { + if (typeof window < "u" && window.performance) + e = window.performance.now(); + else if (typeof process < "u" && process.hrtime) { const t = process.hrtime(); e = t[0] * 1e3 + t[1] / 1e6; - } else { e = Date.now(); } + } else + e = Date.now(); return e; } class $r { - constructor (t, n) { + constructor(t, n) { this.name = void 0, this.type = void 0, this.sampleSize = 1, this.time = 0, this.count = 0, this.samples = 0, this.lastTiming = 0, this.lastSampleTime = 0, this.lastSampleCount = 0, this._count = 0, this._time = 0, this._samples = 0, this._startTime = 0, this._timerPending = !1, this.name = t, this.type = n, this.reset(); } - - reset () { + reset() { return this.time = 0, this.count = 0, this.samples = 0, this.lastTiming = 0, this.lastSampleTime = 0, this.lastSampleCount = 0, this._count = 0, this._time = 0, this._samples = 0, this._startTime = 0, this._timerPending = !1, this; } - - setSampleSize (t) { + setSampleSize(t) { return this.sampleSize = t, this; } - - incrementCount () { + incrementCount() { return this.addCount(1), this; } - - decrementCount () { + decrementCount() { return this.subtractCount(1), this; } - - addCount (t) { + addCount(t) { return this._count += t, this._samples++, this._checkSampling(), this; } - - subtractCount (t) { + subtractCount(t) { return this._count -= t, this._samples++, this._checkSampling(), this; } - - addTime (t) { + addTime(t) { return this._time += t, this.lastTiming = t, this._samples++, this._checkSampling(), this; } - - timeStart () { + timeStart() { return this._startTime = Yr(), this._timerPending = !0, this; } - - timeEnd () { + timeEnd() { return this._timerPending ? (this.addTime(Yr() - this._startTime), this._timerPending = !1, this._checkSampling(), this) : this; } - - getSampleAverageCount () { + getSampleAverageCount() { return this.sampleSize > 0 ? this.lastSampleCount / this.sampleSize : 0; } - - getSampleAverageTime () { + getSampleAverageTime() { return this.sampleSize > 0 ? this.lastSampleTime / this.sampleSize : 0; } - - getSampleHz () { + getSampleHz() { return this.lastSampleTime > 0 ? this.sampleSize / (this.lastSampleTime / 1e3) : 0; } - - getAverageCount () { + getAverageCount() { return this.samples > 0 ? this.count / this.samples : 0; } - - getAverageTime () { + getAverageTime() { return this.samples > 0 ? this.time / this.samples : 0; } - - getHz () { + getHz() { return this.time > 0 ? this.samples / (this.time / 1e3) : 0; } - - _checkSampling () { + _checkSampling() { this._samples === this.sampleSize && (this.lastSampleTime = this._time, this.lastSampleCount = this._count, this.count += this._count, this.time += this._time, this.samples += this._samples, this._time = 0, this._count = 0, this._samples = 0); } } class $o { - constructor (t) { + constructor(t) { this.id = void 0, this.stats = {}, this.id = t.id, this.stats = {}, this._initializeStats(t.stats), Object.seal(this); } - - get (t) { - const n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 'count'; + get(t) { + let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "count"; return this._getOrCreate({ name: t, type: n }); } - - get size () { + get size() { return Object.keys(this.stats).length; } - - reset () { - for (const t of Object.values(this.stats)) { t.reset(); } + reset() { + for (const t of Object.values(this.stats)) + t.reset(); return this; } - - forEach (t) { - for (const n of Object.values(this.stats)) { t(n); } + forEach(t) { + for (const n of Object.values(this.stats)) + t(n); } - - getTable () { + getTable() { const t = {}; return this.forEach((n) => { t[n.name] = { @@ -594,12 +581,10 @@ class $o { }; }), t; } - - _initializeStats () { + _initializeStats() { (arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : []).forEach((n) => this._getOrCreate(n)); } - - _getOrCreate (t) { + _getOrCreate(t) { const { name: n, type: s @@ -608,65 +593,73 @@ class $o { return r || (t instanceof $r ? r = t : r = new $r(n, s), this.stats[n] = r), r; } } -const Hu = ''; +let Hu = ""; const Zr = {}; -function Ju (e) { - for (const t in Zr) { +function Ju(e) { + for (const t in Zr) if (e.startsWith(t)) { const n = Zr[t]; e = e.replace(t, n); } - } - return !e.startsWith('http://') && !e.startsWith('https://') && (e = `${Hu}${e}`), e; + return !e.startsWith("http://") && !e.startsWith("https://") && (e = `${Hu}${e}`), e; } -function Vu (e) { - return e && typeof e === 'object' && e.isBuffer; +function Vu(e) { + return e && typeof e == "object" && e.isBuffer; } -function Zo (e) { - if (Vu(e)) { return e; } - if (e instanceof ArrayBuffer) { return e; } - if (ArrayBuffer.isView(e)) { return e.byteOffset === 0 && e.byteLength === e.buffer.byteLength ? e.buffer : e.buffer.slice(e.byteOffset, e.byteOffset + e.byteLength); } - if (typeof e === 'string') { +function Zo(e) { + if (Vu(e)) + return e; + if (e instanceof ArrayBuffer) + return e; + if (ArrayBuffer.isView(e)) + return e.byteOffset === 0 && e.byteLength === e.buffer.byteLength ? e.buffer : e.buffer.slice(e.byteOffset, e.byteOffset + e.byteLength); + if (typeof e == "string") { const t = e; return new TextEncoder().encode(t).buffer; } - if (e && typeof e === 'object' && e._toArrayBuffer) { return e._toArrayBuffer(); } - throw new Error('toArrayBuffer'); + if (e && typeof e == "object" && e._toArrayBuffer) + return e._toArrayBuffer(); + throw new Error("toArrayBuffer"); } -function ju () { - let e; - if (typeof process < 'u' && typeof process.cwd < 'u') { return process.cwd(); } +function ju() { + var e; + if (typeof process < "u" && typeof process.cwd < "u") + return process.cwd(); const t = (e = window.location) === null || e === void 0 ? void 0 : e.pathname; - return (t == null ? void 0 : t.slice(0, t.lastIndexOf('/') + 1)) || ''; + return (t == null ? void 0 : t.slice(0, t.lastIndexOf("/") + 1)) || ""; } -function ta (e) { - const t = e ? e.lastIndexOf('/') : -1; - return t >= 0 ? e.substr(t + 1) : ''; +function ta(e) { + const t = e ? e.lastIndexOf("/") : -1; + return t >= 0 ? e.substr(t + 1) : ""; } -function ea (e) { - const t = e ? e.lastIndexOf('/') : -1; - return t >= 0 ? e.substr(0, t) : ''; +function ea(e) { + const t = e ? e.lastIndexOf("/") : -1; + return t >= 0 ? e.substr(0, t) : ""; } -function ku () { +function ku() { const e = []; - for (let r = 0; r < arguments.length; r++) { e[r] = r < 0 || arguments.length <= r ? void 0 : arguments[r]; } - let t = ''; let n = !1; let s; + for (let r = 0; r < arguments.length; r++) + e[r] = r < 0 || arguments.length <= r ? void 0 : arguments[r]; + let t = "", n = !1, s; for (let r = e.length - 1; r >= -1 && !n; r--) { let i; r >= 0 ? i = e[r] : (s === void 0 && (s = ju()), i = s), i.length !== 0 && (t = `${i}/${t}`, n = i.charCodeAt(0) === Ie); } - return t = Ku(t, !n), n ? `/${t}` : t.length > 0 ? t : '.'; + return t = Ku(t, !n), n ? `/${t}` : t.length > 0 ? t : "."; } -const Ie = 47; const us = 46; -function Ku (e, t) { - let n = ''; let s = -1; let r = 0; let i; let o = !1; +const Ie = 47, us = 46; +function Ku(e, t) { + let n = "", s = -1, r = 0, i, o = !1; for (let a = 0; a <= e.length; ++a) { - if (a < e.length) { i = e.charCodeAt(a); } else { - if (i === Ie) { break; } + if (a < e.length) + i = e.charCodeAt(a); + else { + if (i === Ie) + break; i = Ie; } if (i === Ie) { - if (!(s === a - 1 || r === 1)) { + if (!(s === a - 1 || r === 1)) if (s !== a - 1 && r === 2) { if (n.length < 2 || !o || n.charCodeAt(n.length - 1) !== us || n.charCodeAt(n.length - 2) !== us) { if (n.length > 2) { @@ -675,94 +668,96 @@ function Ku (e, t) { for (; u >= 0 && n.charCodeAt(u) !== Ie; --u) ; if (u !== c) { - n = u === -1 ? '' : n.slice(0, u), s = a, r = 0, o = !1; + n = u === -1 ? "" : n.slice(0, u), s = a, r = 0, o = !1; continue; } } else if (n.length === 2 || n.length === 1) { - n = '', s = a, r = 0, o = !1; + n = "", s = a, r = 0, o = !1; continue; } } - t && (n.length > 0 ? n += '/..' : n = '..', o = !0); + t && (n.length > 0 ? n += "/.." : n = "..", o = !0); } else { const c = e.slice(s + 1, a); n.length > 0 ? n += `/${c}` : n = c, o = !1; } - } s = a, r = 0; - } else { i === us && r !== -1 ? ++r : r = -1; } + } else + i === us && r !== -1 ? ++r : r = -1; } return n; } -const zu = (e) => typeof e === 'boolean'; const ve = (e) => typeof e === 'function'; const We = (e) => e !== null && typeof e === 'object'; const ti = (e) => We(e) && e.constructor === {}.constructor; const Wu = (e) => !!e && typeof e[Symbol.iterator] === 'function'; const Xu = (e) => e && typeof e[Symbol.asyncIterator] === 'function'; const se = (e) => typeof Response < 'u' && e instanceof Response || e && e.arrayBuffer && e.text && e.json; const re = (e) => typeof Blob < 'u' && e instanceof Blob; const Qu = (e) => e && typeof e === 'object' && e.isBuffer; const qu = (e) => typeof ReadableStream < 'u' && e instanceof ReadableStream || We(e) && ve(e.tee) && ve(e.cancel) && ve(e.getReader); const Yu = (e) => We(e) && ve(e.read) && ve(e.pipe) && zu(e.readable); const na = (e) => qu(e) || Yu(e); const $u = /^data:([-\w.]+\/[-\w.+]+)(;|,)/; const Zu = /^([-\w.]+\/[-\w.+]+)/; -function tl (e) { +const zu = (e) => typeof e == "boolean", ve = (e) => typeof e == "function", We = (e) => e !== null && typeof e == "object", ti = (e) => We(e) && e.constructor === {}.constructor, Wu = (e) => !!e && typeof e[Symbol.iterator] == "function", Xu = (e) => e && typeof e[Symbol.asyncIterator] == "function", se = (e) => typeof Response < "u" && e instanceof Response || e && e.arrayBuffer && e.text && e.json, re = (e) => typeof Blob < "u" && e instanceof Blob, Qu = (e) => e && typeof e == "object" && e.isBuffer, qu = (e) => typeof ReadableStream < "u" && e instanceof ReadableStream || We(e) && ve(e.tee) && ve(e.cancel) && ve(e.getReader), Yu = (e) => We(e) && ve(e.read) && ve(e.pipe) && zu(e.readable), na = (e) => qu(e) || Yu(e), $u = /^data:([-\w.]+\/[-\w.+]+)(;|,)/, Zu = /^([-\w.]+\/[-\w.+]+)/; +function tl(e) { const t = Zu.exec(e); return t ? t[1] : e; } -function ei (e) { +function ei(e) { const t = $u.exec(e); - return t ? t[1] : ''; + return t ? t[1] : ""; } const sa = /\?.*/; -function el (e) { +function el(e) { const t = e.match(sa); return t && t[0]; } -function mr (e) { - return e.replace(sa, ''); +function mr(e) { + return e.replace(sa, ""); } -function Kn (e) { - return se(e) ? e.url : re(e) ? e.name || '' : typeof e === 'string' ? e : ''; +function Kn(e) { + return se(e) ? e.url : re(e) ? e.name || "" : typeof e == "string" ? e : ""; } -function gr (e) { +function gr(e) { if (se(e)) { - const t = e; const n = t.headers.get('content-type') || ''; const s = mr(t.url); + const t = e, n = t.headers.get("content-type") || "", s = mr(t.url); return tl(n) || ei(s); } - return re(e) ? e.type || '' : typeof e === 'string' ? ei(e) : ''; + return re(e) ? e.type || "" : typeof e == "string" ? ei(e) : ""; } -function nl (e) { - return se(e) ? e.headers['content-length'] || -1 : re(e) ? e.size : typeof e === 'string' ? e.length : e instanceof ArrayBuffer || ArrayBuffer.isView(e) ? e.byteLength : -1; +function nl(e) { + return se(e) ? e.headers["content-length"] || -1 : re(e) ? e.size : typeof e == "string" ? e.length : e instanceof ArrayBuffer || ArrayBuffer.isView(e) ? e.byteLength : -1; } -async function ra (e) { - if (se(e)) { return e; } - const t = {}; const n = nl(e); - n >= 0 && (t['content-length'] = String(n)); - const s = Kn(e); const r = gr(e); - r && (t['content-type'] = r); +async function ra(e) { + if (se(e)) + return e; + const t = {}, n = nl(e); + n >= 0 && (t["content-length"] = String(n)); + const s = Kn(e), r = gr(e); + r && (t["content-type"] = r); const i = await il(e); - i && (t['x-first-bytes'] = i), typeof e === 'string' && (e = new TextEncoder().encode(e)); + i && (t["x-first-bytes"] = i), typeof e == "string" && (e = new TextEncoder().encode(e)); const o = new Response(e, { headers: t }); - return Object.defineProperty(o, 'url', { + return Object.defineProperty(o, "url", { value: s }), o; } -async function sl (e) { +async function sl(e) { if (!e.ok) { const t = await rl(e); throw new Error(t); } } -async function rl (e) { +async function rl(e) { let t = `Failed to fetch resource ${e.url} (${e.status}): `; try { - const n = e.headers.get('Content-Type'); + const n = e.headers.get("Content-Type"); let s = e.statusText; - n != null && n.includes('application/json') && (s += ` ${await e.text()}`), t += s, t = t.length > 60 ? `${t.slice(0, 60)}...` : t; + n != null && n.includes("application/json") && (s += ` ${await e.text()}`), t += s, t = t.length > 60 ? `${t.slice(0, 60)}...` : t; } catch { } return t; } -async function il (e) { - if (typeof e === 'string') { return `data:,${e.slice(0, 5)}`; } +async function il(e) { + if (typeof e == "string") + return `data:,${e.slice(0, 5)}`; if (e instanceof Blob) { const n = e.slice(0, 5); return await new Promise((s) => { const r = new FileReader(); r.onload = (i) => { - let o; + var o; return s(i == null || (o = i.target) === null || o === void 0 ? void 0 : o.result); }, r.readAsDataURL(n); }); @@ -773,28 +768,29 @@ async function il (e) { } return null; } -function ol (e) { - let t = ''; +function ol(e) { + let t = ""; const n = new Uint8Array(e); - for (let s = 0; s < n.byteLength; s++) { t += String.fromCharCode(n[s]); } + for (let s = 0; s < n.byteLength; s++) + t += String.fromCharCode(n[s]); return btoa(t); } -function al (e) { +function al(e) { return !cl(e) && !ul(e); } -function cl (e) { - return e.startsWith('http:') || e.startsWith('https:'); +function cl(e) { + return e.startsWith("http:") || e.startsWith("https:"); } -function ul (e) { - return e.startsWith('data:'); +function ul(e) { + return e.startsWith("data:"); } -async function Ge (e, t) { - if (typeof e === 'string') { +async function Ge(e, t) { + if (typeof e == "string") { const r = Ju(e); if (al(r)) { - let n; + var n; if ((n = globalThis.loaders) !== null && n !== void 0 && n.fetchNode) { - let s; + var s; return (s = globalThis.loaders) === null || s === void 0 ? void 0 : s.fetchNode(r, t); } } @@ -802,42 +798,40 @@ async function Ge (e, t) { } return await ra(e); } -function ll (e) { - if (typeof window < 'u' && typeof window.process === 'object' && window.process.type === 'renderer' || typeof process < 'u' && typeof process.versions === 'object' && process.versions.electron) { return !0; } - const t = typeof navigator === 'object' && typeof navigator.userAgent === 'string' && navigator.userAgent; const n = e || t; - return !!(n && n.indexOf('Electron') >= 0); +function ll(e) { + if (typeof window < "u" && typeof window.process == "object" && window.process.type === "renderer" || typeof process < "u" && typeof process.versions == "object" && process.versions.electron) + return !0; + const t = typeof navigator == "object" && typeof navigator.userAgent == "string" && navigator.userAgent, n = e || t; + return !!(n && n.indexOf("Electron") >= 0); } -function Xe () { - return !(typeof process === 'object' && String(process) === '[object process]' && !process.browser) || ll(); +function Xe() { + return !(typeof process == "object" && String(process) === "[object process]" && !process.browser) || ll(); } -const Ze = globalThis.window || globalThis.self || globalThis.global; const Ee = globalThis.process || {}; const ia = typeof __VERSION__ < 'u' ? __VERSION__ : 'untranspiled source'; +const Ze = globalThis.window || globalThis.self || globalThis.global, Ee = globalThis.process || {}, ia = typeof __VERSION__ < "u" ? __VERSION__ : "untranspiled source"; Xe(); -function hl (e) { +function hl(e) { try { - const t = window[e]; const n = '__storage_test__'; + const t = window[e], n = "__storage_test__"; return t.setItem(n, n), t.removeItem(n), t; } catch { return null; } } class fl { - constructor (t, n) { - const s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 'sessionStorage'; + constructor(t, n) { + let s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "sessionStorage"; this.storage = void 0, this.id = void 0, this.config = void 0, this.storage = hl(s), this.id = t, this.config = n, this._loadConfiguration(); } - - getConfiguration () { + getConfiguration() { return this.config; } - - setConfiguration (t) { + setConfiguration(t) { if (Object.assign(this.config, t), this.storage) { const n = JSON.stringify(this.config); this.storage.setItem(this.id, n); } } - - _loadConfiguration () { + _loadConfiguration() { let t = {}; if (this.storage) { const n = this.storage.getItem(this.id); @@ -846,64 +840,66 @@ class fl { return Object.assign(this.config, t), this; } } -function dl (e) { +function dl(e) { let t; - return e < 10 ? t = ''.concat(e.toFixed(2), 'ms') : e < 100 ? t = ''.concat(e.toFixed(1), 'ms') : e < 1e3 ? t = ''.concat(e.toFixed(0), 'ms') : t = ''.concat((e / 1e3).toFixed(2), 's'), t; + return e < 10 ? t = "".concat(e.toFixed(2), "ms") : e < 100 ? t = "".concat(e.toFixed(1), "ms") : e < 1e3 ? t = "".concat(e.toFixed(0), "ms") : t = "".concat((e / 1e3).toFixed(2), "s"), t; } -function ml (e) { - const t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 8; +function ml(e) { + let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 8; const n = Math.max(t - e.length, 0); - return ''.concat(' '.repeat(n)).concat(e); + return "".concat(" ".repeat(n)).concat(e); } -function ls (e, t, n) { - const s = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 600; - const r = e.src.replace(/\(/g, '%28').replace(/\)/g, '%29'); +function ls(e, t, n) { + let s = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 600; + const r = e.src.replace(/\(/g, "%28").replace(/\)/g, "%29"); e.width > s && (n = Math.min(n, s / e.width)); - const i = e.width * n; const o = e.height * n; const a = ['font-size:1px;', 'padding:'.concat(Math.floor(o / 2), 'px ').concat(Math.floor(i / 2), 'px;'), 'line-height:'.concat(o, 'px;'), 'background:url('.concat(r, ');'), 'background-size:'.concat(i, 'px ').concat(o, 'px;'), 'color:transparent;'].join(''); - return [''.concat(t, ' %c+'), a]; + const i = e.width * n, o = e.height * n, a = ["font-size:1px;", "padding:".concat(Math.floor(o / 2), "px ").concat(Math.floor(i / 2), "px;"), "line-height:".concat(o, "px;"), "background:url(".concat(r, ");"), "background-size:".concat(i, "px ").concat(o, "px;"), "color:transparent;"].join(""); + return ["".concat(t, " %c+"), a]; } let In; -(function (e) { - e[e.BLACK = 30] = 'BLACK', e[e.RED = 31] = 'RED', e[e.GREEN = 32] = 'GREEN', e[e.YELLOW = 33] = 'YELLOW', e[e.BLUE = 34] = 'BLUE', e[e.MAGENTA = 35] = 'MAGENTA', e[e.CYAN = 36] = 'CYAN', e[e.WHITE = 37] = 'WHITE', e[e.BRIGHT_BLACK = 90] = 'BRIGHT_BLACK', e[e.BRIGHT_RED = 91] = 'BRIGHT_RED', e[e.BRIGHT_GREEN = 92] = 'BRIGHT_GREEN', e[e.BRIGHT_YELLOW = 93] = 'BRIGHT_YELLOW', e[e.BRIGHT_BLUE = 94] = 'BRIGHT_BLUE', e[e.BRIGHT_MAGENTA = 95] = 'BRIGHT_MAGENTA', e[e.BRIGHT_CYAN = 96] = 'BRIGHT_CYAN', e[e.BRIGHT_WHITE = 97] = 'BRIGHT_WHITE'; +(function(e) { + e[e.BLACK = 30] = "BLACK", e[e.RED = 31] = "RED", e[e.GREEN = 32] = "GREEN", e[e.YELLOW = 33] = "YELLOW", e[e.BLUE = 34] = "BLUE", e[e.MAGENTA = 35] = "MAGENTA", e[e.CYAN = 36] = "CYAN", e[e.WHITE = 37] = "WHITE", e[e.BRIGHT_BLACK = 90] = "BRIGHT_BLACK", e[e.BRIGHT_RED = 91] = "BRIGHT_RED", e[e.BRIGHT_GREEN = 92] = "BRIGHT_GREEN", e[e.BRIGHT_YELLOW = 93] = "BRIGHT_YELLOW", e[e.BRIGHT_BLUE = 94] = "BRIGHT_BLUE", e[e.BRIGHT_MAGENTA = 95] = "BRIGHT_MAGENTA", e[e.BRIGHT_CYAN = 96] = "BRIGHT_CYAN", e[e.BRIGHT_WHITE = 97] = "BRIGHT_WHITE"; })(In || (In = {})); const gl = 10; -function ni (e) { - return typeof e !== 'string' ? e : (e = e.toUpperCase(), In[e] || In.WHITE); +function ni(e) { + return typeof e != "string" ? e : (e = e.toUpperCase(), In[e] || In.WHITE); } -function Al (e, t, n) { - if (!Xe && typeof e === 'string') { +function Al(e, t, n) { + if (!Xe && typeof e == "string") { if (t) { const s = ni(t); - e = '\x1B['.concat(s, 'm').concat(e, '\x1B[39m'); + e = "\x1B[".concat(s, "m").concat(e, "\x1B[39m"); } if (n) { const s = ni(n); - e = '\x1B['.concat(s + gl, 'm').concat(e, '\x1B[49m'); + e = "\x1B[".concat(s + gl, "m").concat(e, "\x1B[49m"); } } return e; } -function pl (e) { - const t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : ['constructor']; - const n = Object.getPrototypeOf(e); const s = Object.getOwnPropertyNames(n); const r = e; +function pl(e) { + let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : ["constructor"]; + const n = Object.getPrototypeOf(e), s = Object.getOwnPropertyNames(n), r = e; for (const i of s) { const o = r[i]; - typeof o === 'function' && (t.find((a) => i === a) || (r[i] = o.bind(e))); + typeof o == "function" && (t.find((a) => i === a) || (r[i] = o.bind(e))); } } -function xn (e, t) { - if (!e) { throw new Error(t || 'Assertion failed'); } +function xn(e, t) { + if (!e) + throw new Error(t || "Assertion failed"); } -function ae () { +function ae() { let e; if (Xe() && Ze.performance) { - let t, n; + var t, n; e = Ze == null || (t = Ze.performance) === null || t === void 0 || (n = t.now) === null || n === void 0 ? void 0 : n.call(t); - } else if ('hrtime' in Ee) { - let s; + } else if ("hrtime" in Ee) { + var s; const r = Ee == null || (s = Ee.hrtime) === null || s === void 0 ? void 0 : s.call(Ee); e = r[0] * 1e3 + r[1] / 1e6; - } else { e = Date.now(); } + } else + e = Date.now(); return e; } const ce = { @@ -912,196 +908,154 @@ const ce = { info: console.info, warn: console.warn, error: console.error -}; const yl = { +}, yl = { enabled: !0, level: 0 }; -function Ct () { +function Ct() { } -const si = {}; const ri = { +const si = {}, ri = { once: !0 }; class zn { - constructor () { - const { + constructor() { + let { id: t - } = arguments.length > 0 && arguments[0] !== void 0 - ? arguments[0] - : { - id: '' - }; - this.id = void 0, this.VERSION = ia, this._startTs = ae(), this._deltaTs = ae(), this._storage = void 0, this.userData = {}, this.LOG_THROTTLE_TIMEOUT = 0, this.id = t, this.userData = {}, this._storage = new fl('__probe-'.concat(this.id, '__'), yl), this.timeStamp(''.concat(this.id, ' started')), pl(this), Object.seal(this); + } = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : { + id: "" + }; + this.id = void 0, this.VERSION = ia, this._startTs = ae(), this._deltaTs = ae(), this._storage = void 0, this.userData = {}, this.LOG_THROTTLE_TIMEOUT = 0, this.id = t, this.userData = {}, this._storage = new fl("__probe-".concat(this.id, "__"), yl), this.timeStamp("".concat(this.id, " started")), pl(this), Object.seal(this); } - - set level (t) { + set level(t) { this.setLevel(t); } - - get level () { + get level() { return this.getLevel(); } - - isEnabled () { + isEnabled() { return this._storage.config.enabled; } - - getLevel () { + getLevel() { return this._storage.config.level; } - - getTotal () { + getTotal() { return Number((ae() - this._startTs).toPrecision(10)); } - - getDelta () { + getDelta() { return Number((ae() - this._deltaTs).toPrecision(10)); } - - set priority (t) { + set priority(t) { this.level = t; } - - get priority () { + get priority() { return this.level; } - - getPriority () { + getPriority() { return this.level; } - - enable () { - const t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !0; + enable() { + let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !0; return this._storage.setConfiguration({ enabled: t }), this; } - - setLevel (t) { + setLevel(t) { return this._storage.setConfiguration({ level: t }), this; } - - get (t) { + get(t) { return this._storage.config[t]; } - - set (t, n) { + set(t, n) { this._storage.setConfiguration({ [t]: n }); } - - settings () { + settings() { console.table ? console.table(this._storage.config) : console.log(this._storage.config); } - - assert (t, n) { + assert(t, n) { xn(t, n); } - - warn (t) { + warn(t) { return this._getLogFunction(0, t, ce.warn, arguments, ri); } - - error (t) { + error(t) { return this._getLogFunction(0, t, ce.error, arguments); } - - deprecated (t, n) { - return this.warn('`'.concat(t, '` is deprecated and will be removed in a later version. Use `').concat(n, '` instead')); + deprecated(t, n) { + return this.warn("`".concat(t, "` is deprecated and will be removed in a later version. Use `").concat(n, "` instead")); } - - removed (t, n) { - return this.error('`'.concat(t, '` has been removed. Use `').concat(n, '` instead')); + removed(t, n) { + return this.error("`".concat(t, "` has been removed. Use `").concat(n, "` instead")); } - - probe (t, n) { + probe(t, n) { return this._getLogFunction(t, n, ce.log, arguments, { time: !0, once: !0 }); } - - log (t, n) { + log(t, n) { return this._getLogFunction(t, n, ce.debug, arguments); } - - info (t, n) { + info(t, n) { return this._getLogFunction(t, n, console.info, arguments); } - - once (t, n) { + once(t, n) { return this._getLogFunction(t, n, ce.debug || ce.info, arguments, ri); } - - table (t, n, s) { - return n - ? this._getLogFunction(t, n, console.table || Ct, s && [s], { - tag: Tl(n) - }) - : Ct; + table(t, n, s) { + return n ? this._getLogFunction(t, n, console.table || Ct, s && [s], { + tag: Tl(n) + }) : Ct; } - - image (t) { - const { + image(t) { + let { logLevel: n, priority: s, image: r, - message: i = '', + message: i = "", scale: o = 1 } = t; - return this._shouldLog(n || s) - ? Xe() - ? El({ - image: r, - message: i, - scale: o - }) - : Cl() - : Ct; + return this._shouldLog(n || s) ? Xe() ? El({ + image: r, + message: i, + scale: o + }) : Cl() : Ct; } - - time (t, n) { + time(t, n) { return this._getLogFunction(t, n, console.time ? console.time : console.info); } - - timeEnd (t, n) { + timeEnd(t, n) { return this._getLogFunction(t, n, console.timeEnd ? console.timeEnd : console.info); } - - timeStamp (t, n) { + timeStamp(t, n) { return this._getLogFunction(t, n, console.timeStamp || Ct); } - - group (t, n) { - const s = arguments.length > 2 && arguments[2] !== void 0 - ? arguments[2] - : { - collapsed: !1 - }; + group(t, n) { + let s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : { + collapsed: !1 + }; const r = ii({ logLevel: t, message: n, opts: s - }); const { + }), { collapsed: i } = s; return r.method = (i ? console.groupCollapsed : console.group) || console.info, this._getLogFunction(r); } - - groupCollapsed (t, n) { - const s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}; + groupCollapsed(t, n) { + let s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}; return this.group(t, n, Object.assign({}, s, { collapsed: !0 })); } - - groupEnd (t) { - return this._getLogFunction(t, '', console.groupEnd || Ct); + groupEnd(t) { + return this._getLogFunction(t, "", console.groupEnd || Ct); } - - withGroup (t, n, s) { + withGroup(t, n, s) { this.group(t, n)(); try { s(); @@ -1109,16 +1063,13 @@ class zn { this.groupEnd(t)(); } } - - trace () { + trace() { console.trace && console.trace(); } - - _shouldLog (t) { + _shouldLog(t) { return this.isEnabled() && this.getLevel() >= oa(t); } - - _getLogFunction (t, n, s, r, i) { + _getLogFunction(t, n, s, r, i) { if (this._shouldLog(t)) { i = ii({ logLevel: t, @@ -1127,23 +1078,26 @@ class zn { opts: i }), s = s || i.method, xn(s), i.total = this.getTotal(), i.delta = this.getDelta(), this._deltaTs = ae(); const o = i.tag || i.message; - if (i.once && o) { - if (!si[o]) { si[o] = ae(); } else { return Ct; } - } + if (i.once && o) + if (!si[o]) + si[o] = ae(); + else + return Ct; return n = Bl(this.id, i.message, i), s.bind(console, n, ...i.args); } return Ct; } } zn.VERSION = ia; -function oa (e) { - if (!e) { return 0; } +function oa(e) { + if (!e) + return 0; let t; switch (typeof e) { - case 'number': + case "number": t = e; break; - case 'object': + case "object": t = e.logLevel || e.priority || 0; break; default: @@ -1151,115 +1105,113 @@ function oa (e) { } return xn(Number.isFinite(t) && t >= 0), t; } -function ii (e) { +function ii(e) { const { logLevel: t, message: n } = e; e.logLevel = oa(t); const s = e.args ? Array.from(e.args) : []; - for (; s.length && s.shift() !== n;) + for (; s.length && s.shift() !== n; ) ; switch (typeof t) { - case 'string': - case 'function': + case "string": + case "function": n !== void 0 && s.unshift(n), e.message = t; break; - case 'object': + case "object": Object.assign(e, t); break; } - typeof e.message === 'function' && (e.message = e.message()); + typeof e.message == "function" && (e.message = e.message()); const r = typeof e.message; - return xn(r === 'string' || r === 'object'), Object.assign(e, { + return xn(r === "string" || r === "object"), Object.assign(e, { args: s }, e.opts); } -function Bl (e, t, n) { - if (typeof t === 'string') { - const s = n.time ? ml(dl(n.total)) : ''; - t = n.time ? ''.concat(e, ': ').concat(s, ' ').concat(t) : ''.concat(e, ': ').concat(t), t = Al(t, n.color, n.background); +function Bl(e, t, n) { + if (typeof t == "string") { + const s = n.time ? ml(dl(n.total)) : ""; + t = n.time ? "".concat(e, ": ").concat(s, " ").concat(t) : "".concat(e, ": ").concat(t), t = Al(t, n.color, n.background); } return t; } -function Cl (e) { - return console.warn('removed'), Ct; +function Cl(e) { + return console.warn("removed"), Ct; } -function El (e) { - const { +function El(e) { + let { image: t, - message: n = '', + message: n = "", scale: s = 1 } = e; - if (typeof t === 'string') { + if (typeof t == "string") { const i = new Image(); return i.onload = () => { const o = ls(i, n, s); console.log(...o); }, i.src = t, Ct; } - const r = t.nodeName || ''; - if (r.toLowerCase() === 'img') { return console.log(...ls(t, n, s)), Ct; } - if (r.toLowerCase() === 'canvas') { + const r = t.nodeName || ""; + if (r.toLowerCase() === "img") + return console.log(...ls(t, n, s)), Ct; + if (r.toLowerCase() === "canvas") { const i = new Image(); return i.onload = () => console.log(...ls(i, n, s)), i.src = t.toDataURL(), Ct; } return Ct; } -function Tl (e) { - for (const t in e) { - for (const n in e[t]) { return n || 'untitled'; } - } - return 'empty'; +function Tl(e) { + for (const t in e) + for (const n in e[t]) + return n || "untitled"; + return "empty"; } const aa = new zn({ - id: '@probe.gl/log' -}); const oi = new zn({ - id: 'loaders.gl' + id: "@probe.gl/log" +}), oi = new zn({ + id: "loaders.gl" }); class bl { - log () { + log() { return () => { }; } - - info () { + info() { return () => { }; } - - warn () { + warn() { return () => { }; } - - error () { + error() { return () => { }; } } class _l { - constructor () { + constructor() { this.console = void 0, this.console = console; } - - log () { - for (var t = arguments.length, n = new Array(t), s = 0; s < t; s++) { n[s] = arguments[s]; } + log() { + for (var t = arguments.length, n = new Array(t), s = 0; s < t; s++) + n[s] = arguments[s]; return this.console.log.bind(this.console, ...n); } - - info () { - for (var t = arguments.length, n = new Array(t), s = 0; s < t; s++) { n[s] = arguments[s]; } + info() { + for (var t = arguments.length, n = new Array(t), s = 0; s < t; s++) + n[s] = arguments[s]; return this.console.info.bind(this.console, ...n); } - - warn () { - for (var t = arguments.length, n = new Array(t), s = 0; s < t; s++) { n[s] = arguments[s]; } + warn() { + for (var t = arguments.length, n = new Array(t), s = 0; s < t; s++) + n[s] = arguments[s]; return this.console.warn.bind(this.console, ...n); } - - error () { - for (var t = arguments.length, n = new Array(t), s = 0; s < t; s++) { n[s] = arguments[s]; } + error() { + for (var t = arguments.length, n = new Array(t), s = 0; s < t; s++) + n[s] = arguments[s]; return this.console.error.bind(this.console, ...n); } } @@ -1269,112 +1221,111 @@ const ca = { nothrow: !1, log: new _l(), useLocalLibraries: !1, - CDN: 'https://unpkg.com/@loaders.gl', + CDN: "https://unpkg.com/@loaders.gl", worker: !0, maxConcurrency: 3, maxMobileConcurrency: 1, reuseWorkers: kn, _nodeWorkers: !1, - _workerType: '', + _workerType: "", limit: 0, _limitMB: 0, - batchSize: 'auto', + batchSize: "auto", batchDebounceMs: 0, metadata: !1, transforms: [] -}; const wl = { - throws: 'nothrow', - dataType: '(no longer used)', - uri: 'baseUri', - method: 'fetch.method', - headers: 'fetch.headers', - body: 'fetch.body', - mode: 'fetch.mode', - credentials: 'fetch.credentials', - cache: 'fetch.cache', - redirect: 'fetch.redirect', - referrer: 'fetch.referrer', - referrerPolicy: 'fetch.referrerPolicy', - integrity: 'fetch.integrity', - keepalive: 'fetch.keepalive', - signal: 'fetch.signal' +}, wl = { + throws: "nothrow", + dataType: "(no longer used)", + uri: "baseUri", + method: "fetch.method", + headers: "fetch.headers", + body: "fetch.body", + mode: "fetch.mode", + credentials: "fetch.credentials", + cache: "fetch.cache", + redirect: "fetch.redirect", + referrer: "fetch.referrer", + referrerPolicy: "fetch.referrerPolicy", + integrity: "fetch.integrity", + keepalive: "fetch.keepalive", + signal: "fetch.signal" }; -function ua () { +function ua() { globalThis.loaders = globalThis.loaders || {}; const { loaders: e } = globalThis; return e._state = e._state || {}, e._state; } -function la () { +function la() { const e = ua(); return e.globalOptions = e.globalOptions || { ...ca }, e.globalOptions; } -function Rl (e, t, n, s) { +function Rl(e, t, n, s) { return n = n || [], n = Array.isArray(n) ? n : [n], Ml(e, n), Il(t, e, s); } -function Ml (e, t) { +function Ml(e, t) { ai(e, null, ca, wl, t); for (const n of t) { - const s = e && e[n.id] || {}; const r = n.options && n.options[n.id] || {}; const i = n.deprecatedOptions && n.deprecatedOptions[n.id] || {}; + const s = e && e[n.id] || {}, r = n.options && n.options[n.id] || {}, i = n.deprecatedOptions && n.deprecatedOptions[n.id] || {}; ai(s, n.id, r, i, t); } } -function ai (e, t, n, s, r) { - const i = t || 'Top level'; const o = t ? `${t}.` : ''; +function ai(e, t, n, s, r) { + const i = t || "Top level", o = t ? `${t}.` : ""; for (const a in e) { - const c = !t && We(e[a]); const u = a === 'baseUri' && !t; const l = a === 'workerUrl' && t; + const c = !t && We(e[a]), u = a === "baseUri" && !t, l = a === "workerUrl" && t; if (!(a in n) && !u && !l) { - if (a in s) { oi.warn(`${i} loader option '${o}${a}' no longer supported, use '${s[a]}'`)(); } else if (!c) { + if (a in s) + oi.warn(`${i} loader option '${o}${a}' no longer supported, use '${s[a]}'`)(); + else if (!c) { const h = Sl(a, r); oi.warn(`${i} loader option '${o}${a}' not recognized. ${h}`)(); } } } } -function Sl (e, t) { +function Sl(e, t) { const n = e.toLowerCase(); - let s = ''; - for (const r of t) { + let s = ""; + for (const r of t) for (const i in r.options) { - if (e === i) { return `Did you mean '${r.id}.${i}'?`; } + if (e === i) + return `Did you mean '${r.id}.${i}'?`; const o = i.toLowerCase(); (n.startsWith(o) || o.startsWith(n)) && (s = s || `Did you mean '${r.id}.${i}'?`); } - } return s; } -function Il (e, t, n) { +function Il(e, t, n) { const r = { ...e.options || {} }; return xl(r, n), r.log === null && (r.log = new bl()), ci(r, la()), ci(r, t), r; } -function ci (e, t) { - for (const n in t) { +function ci(e, t) { + for (const n in t) if (n in t) { const s = t[n]; - ti(s) && ti(e[n]) - ? e[n] = { - ...e[n], - ...t[n] - } - : e[n] = t[n]; + ti(s) && ti(e[n]) ? e[n] = { + ...e[n], + ...t[n] + } : e[n] = t[n]; } - } } -function xl (e, t) { - t && !('baseUri' in e) && (e.baseUri = t); +function xl(e, t) { + t && !("baseUri" in e) && (e.baseUri = t); } -function Ar (e) { - let t; +function Ar(e) { + var t; return e ? (Array.isArray(e) && (e = e[0]), Array.isArray((t = e) === null || t === void 0 ? void 0 : t.extensions)) : !1; } -function ha (e) { - let t, n; - z(e, 'null loader'), z(Ar(e), 'invalid loader'); +function ha(e) { + var t, n; + z(e, "null loader"), z(Ar(e), "invalid loader"); let s; return Array.isArray(e) && (s = e[1], e = e[0], e = { ...e, @@ -1388,210 +1339,234 @@ const vl = () => { const e = ua(); return e.loaderRegistry = e.loaderRegistry || [], e.loaderRegistry; }; -function Ol () { +function Ol() { return vl(); } const Fl = new zn({ - id: 'loaders.gl' -}); const Dl = /\.([^.]+)$/; -async function Ll (e) { - const t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : []; const n = arguments.length > 2 ? arguments[2] : void 0; const s = arguments.length > 3 ? arguments[3] : void 0; - if (!fa(e)) { return null; } + id: "loaders.gl" +}), Dl = /\.([^.]+)$/; +async function Ll(e) { + let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [], n = arguments.length > 2 ? arguments[2] : void 0, s = arguments.length > 3 ? arguments[3] : void 0; + if (!fa(e)) + return null; let r = ui(e, t, { ...n, nothrow: !0 }, s); - if (r) { return r; } - if (re(e) && (e = await e.slice(0, 10).arrayBuffer(), r = ui(e, t, n, s)), !r && !(n != null && n.nothrow)) { throw new Error(da(e)); } + if (r) + return r; + if (re(e) && (e = await e.slice(0, 10).arrayBuffer(), r = ui(e, t, n, s)), !r && !(n != null && n.nothrow)) + throw new Error(da(e)); return r; } -function ui (e) { - const t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : []; const n = arguments.length > 2 ? arguments[2] : void 0; const s = arguments.length > 3 ? arguments[3] : void 0; - if (!fa(e)) { return null; } - if (t && !Array.isArray(t)) { return ha(t); } +function ui(e) { + let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [], n = arguments.length > 2 ? arguments[2] : void 0, s = arguments.length > 3 ? arguments[3] : void 0; + if (!fa(e)) + return null; + if (t && !Array.isArray(t)) + return ha(t); let r = []; t && (r = r.concat(t)), n != null && n.ignoreRegisteredLoaders || r.push(...Ol()), Gl(r); const i = Pl(e, r, n, s); - if (!i && !(n != null && n.nothrow)) { throw new Error(da(e)); } + if (!i && !(n != null && n.nothrow)) + throw new Error(da(e)); return i; } -function Pl (e, t, n, s) { - const r = Kn(e); const i = gr(e); const o = mr(r) || (s == null ? void 0 : s.url); - let a = null; let c = ''; - if (n != null && n.mimeType && (a = hs(t, n == null ? void 0 : n.mimeType), c = `match forced by supplied MIME type ${n == null ? void 0 : n.mimeType}`), a = a || Nl(t, o), c = c || (a ? `matched url ${o}` : ''), a = a || hs(t, i), c = c || (a ? `matched MIME type ${i}` : ''), a = a || Hl(t, e), c = c || (a ? `matched initial data ${ma(e)}` : ''), n != null && n.fallbackMimeType && (a = a || hs(t, n == null ? void 0 : n.fallbackMimeType), c = c || (a ? `matched fallback MIME type ${i}` : '')), c) { - let u; +function Pl(e, t, n, s) { + const r = Kn(e), i = gr(e), o = mr(r) || (s == null ? void 0 : s.url); + let a = null, c = ""; + if (n != null && n.mimeType && (a = hs(t, n == null ? void 0 : n.mimeType), c = `match forced by supplied MIME type ${n == null ? void 0 : n.mimeType}`), a = a || Nl(t, o), c = c || (a ? `matched url ${o}` : ""), a = a || hs(t, i), c = c || (a ? `matched MIME type ${i}` : ""), a = a || Hl(t, e), c = c || (a ? `matched initial data ${ma(e)}` : ""), n != null && n.fallbackMimeType && (a = a || hs(t, n == null ? void 0 : n.fallbackMimeType), c = c || (a ? `matched fallback MIME type ${i}` : "")), c) { + var u; Fl.log(1, `selectLoader selected ${(u = a) === null || u === void 0 ? void 0 : u.name}: ${c}.`); } return a; } -function fa (e) { +function fa(e) { return !(e instanceof Response && e.status === 204); } -function da (e) { - const t = Kn(e); const n = gr(e); - let s = 'No valid loader found ('; - s += t ? `${ta(t)}, ` : 'no url provided, ', s += `MIME type: ${n ? `"${n}"` : 'not provided'}, `; - const r = e ? ma(e) : ''; - return s += r ? ` first bytes: "${r}"` : 'first bytes: not available', s += ')', s; +function da(e) { + const t = Kn(e), n = gr(e); + let s = "No valid loader found ("; + s += t ? `${ta(t)}, ` : "no url provided, ", s += `MIME type: ${n ? `"${n}"` : "not provided"}, `; + const r = e ? ma(e) : ""; + return s += r ? ` first bytes: "${r}"` : "first bytes: not available", s += ")", s; } -function Gl (e) { - for (const t of e) { ha(t); } +function Gl(e) { + for (const t of e) + ha(t); } -function Nl (e, t) { - const n = t && Dl.exec(t); const s = n && n[1]; +function Nl(e, t) { + const n = t && Dl.exec(t), s = n && n[1]; return s ? Ul(e, s) : null; } -function Ul (e, t) { +function Ul(e, t) { t = t.toLowerCase(); - for (const n of e) { - for (const s of n.extensions) { - if (s.toLowerCase() === t) { return n; } - } - } + for (const n of e) + for (const s of n.extensions) + if (s.toLowerCase() === t) + return n; return null; } -function hs (e, t) { - for (const n of e) { - if (n.mimeTypes && n.mimeTypes.includes(t) || t === `application/x.${n.id}`) { return n; } - } +function hs(e, t) { + for (const n of e) + if (n.mimeTypes && n.mimeTypes.includes(t) || t === `application/x.${n.id}`) + return n; return null; } -function Hl (e, t) { - if (!t) { return null; } - for (const n of e) { - if (typeof t === 'string') { - if (Jl(t, n)) { return n; } +function Hl(e, t) { + if (!t) + return null; + for (const n of e) + if (typeof t == "string") { + if (Jl(t, n)) + return n; } else if (ArrayBuffer.isView(t)) { - if (li(t.buffer, t.byteOffset, n)) { return n; } - } else if (t instanceof ArrayBuffer && li(t, 0, n)) { return n; } - } + if (li(t.buffer, t.byteOffset, n)) + return n; + } else if (t instanceof ArrayBuffer && li(t, 0, n)) + return n; return null; } -function Jl (e, t) { +function Jl(e, t) { return t.testText ? t.testText(e) : (Array.isArray(t.tests) ? t.tests : [t.tests]).some((s) => e.startsWith(s)); } -function li (e, t, n) { +function li(e, t, n) { return (Array.isArray(n.tests) ? n.tests : [n.tests]).some((r) => Vl(e, t, n, r)); } -function Vl (e, t, n, s) { - if (s instanceof ArrayBuffer) { return Lu(s, e, s.byteLength); } +function Vl(e, t, n, s) { + if (s instanceof ArrayBuffer) + return Lu(s, e, s.byteLength); switch (typeof s) { - case 'function': + case "function": return s(e); - case 'string': + case "string": const r = js(e, t, s.length); return s === r; default: return !1; } } -function ma (e) { - const t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 5; - return typeof e === 'string' ? e.slice(0, t) : ArrayBuffer.isView(e) ? js(e.buffer, e.byteOffset, t) : e instanceof ArrayBuffer ? js(e, 0, t) : ''; +function ma(e) { + let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 5; + return typeof e == "string" ? e.slice(0, t) : ArrayBuffer.isView(e) ? js(e.buffer, e.byteOffset, t) : e instanceof ArrayBuffer ? js(e, 0, t) : ""; } -function js (e, t, n) { - if (e.byteLength < t + n) { return ''; } +function js(e, t, n) { + if (e.byteLength < t + n) + return ""; const s = new DataView(e); - let r = ''; - for (let i = 0; i < n; i++) { r += String.fromCharCode(s.getUint8(t + i)); } + let r = ""; + for (let i = 0; i < n; i++) + r += String.fromCharCode(s.getUint8(t + i)); return r; } const jl = 256 * 1024; -function * kl (e, t) { +function* kl(e, t) { const n = (t == null ? void 0 : t.chunkSize) || jl; let s = 0; const r = new TextEncoder(); - for (; s < e.length;) { - const i = Math.min(e.length - s, n); const o = e.slice(s, s + i); + for (; s < e.length; ) { + const i = Math.min(e.length - s, n), o = e.slice(s, s + i); s += i, yield r.encode(o); } } const Kl = 256 * 1024; -function zl (e) { - const t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; - return (function * () { +function zl(e) { + let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; + return function* () { const { chunkSize: n = Kl } = t; let s = 0; - for (; s < e.byteLength;) { - const r = Math.min(e.byteLength - s, n); const i = new ArrayBuffer(r); const o = new Uint8Array(e, s, r); + for (; s < e.byteLength; ) { + const r = Math.min(e.byteLength - s, n), i = new ArrayBuffer(r), o = new Uint8Array(e, s, r); new Uint8Array(i).set(o), s += r, yield i; } - }()); + }(); } const Wl = 1024 * 1024; -async function * Xl (e, t) { +async function* Xl(e, t) { const n = (t == null ? void 0 : t.chunkSize) || Wl; let s = 0; - for (; s < e.size;) { - const r = s + n; const i = await e.slice(s, r).arrayBuffer(); + for (; s < e.size; ) { + const r = s + n, i = await e.slice(s, r).arrayBuffer(); s = r, yield i; } } -function hi (e, t) { +function hi(e, t) { return kn ? Ql(e, t) : ql(e); } -async function * Ql (e, t) { +async function* Ql(e, t) { const n = e.getReader(); let s; try { - for (; ;) { + for (; ; ) { const r = s || n.read(); t != null && t._streamReadAhead && (s = n.read()); const { done: i, value: o } = await r; - if (i) { return; } + if (i) + return; yield Zo(o); } } catch { n.releaseLock(); } } -async function * ql (e, t) { - for await (const n of e) { yield Zo(n); } -} -function Yl (e, t) { - if (typeof e === 'string') { return kl(e, t); } - if (e instanceof ArrayBuffer) { return zl(e, t); } - if (re(e)) { return Xl(e, t); } - if (na(e)) { return hi(e, t); } - if (se(e)) { return hi(e.body, t); } - throw new Error('makeIterator'); -} -const ga = 'Cannot convert supplied data type'; -function $l (e, t, n) { - if (t.text && typeof e === 'string') { return e; } +async function* ql(e, t) { + for await (const n of e) + yield Zo(n); +} +function Yl(e, t) { + if (typeof e == "string") + return kl(e, t); + if (e instanceof ArrayBuffer) + return zl(e, t); + if (re(e)) + return Xl(e, t); + if (na(e)) + return hi(e, t); + if (se(e)) + return hi(e.body, t); + throw new Error("makeIterator"); +} +const ga = "Cannot convert supplied data type"; +function $l(e, t, n) { + if (t.text && typeof e == "string") + return e; if (Qu(e) && (e = e.buffer), e instanceof ArrayBuffer) { const s = e; - return t.text && !t.binary ? new TextDecoder('utf8').decode(s) : s; + return t.text && !t.binary ? new TextDecoder("utf8").decode(s) : s; } if (ArrayBuffer.isView(e)) { - if (t.text && !t.binary) { return new TextDecoder('utf8').decode(e); } + if (t.text && !t.binary) + return new TextDecoder("utf8").decode(e); let s = e.buffer; const r = e.byteLength || e.length; return (e.byteOffset !== 0 || r !== s.byteLength) && (s = s.slice(e.byteOffset, e.byteOffset + r)), s; } throw new Error(ga); } -async function Zl (e, t, n) { +async function Zl(e, t, n) { const s = e instanceof ArrayBuffer || ArrayBuffer.isView(e); - if (typeof e === 'string' || s) { return $l(e, t); } + if (typeof e == "string" || s) + return $l(e, t); if (re(e) && (e = await ra(e)), se(e)) { const r = e; return await sl(r), t.binary ? await r.arrayBuffer() : await r.text(); } - if (na(e) && (e = Yl(e, n)), Wu(e) || Xu(e)) { return Uu(e); } + if (na(e) && (e = Yl(e, n)), Wu(e) || Xu(e)) + return Uu(e); throw new Error(ga); } -function Aa (e, t) { - const n = la(); const s = e || n; - return typeof s.fetch === 'function' ? s.fetch : We(s.fetch) ? (r) => Ge(r, s.fetch) : t != null && t.fetch ? t == null ? void 0 : t.fetch : Ge; +function Aa(e, t) { + const n = la(), s = e || n; + return typeof s.fetch == "function" ? s.fetch : We(s.fetch) ? (r) => Ge(r, s.fetch) : t != null && t.fetch ? t == null ? void 0 : t.fetch : Ge; } -function th (e, t, n) { - if (n) { return n; } +function th(e, t, n) { + if (n) + return n; const s = { fetch: Aa(t, e), ...e @@ -1602,8 +1577,9 @@ function th (e, t, n) { } return Array.isArray(s.loaders) || (s.loaders = null), s; } -function eh (e, t) { - if (e && !Array.isArray(e)) { return e; } +function eh(e, t) { + if (e && !Array.isArray(e)) + return e; let n; if (e && (n = Array.isArray(e) ? e : [e]), t && t.loaders) { const s = Array.isArray(t.loaders) ? t.loaders : [t.loaders]; @@ -1611,27 +1587,25 @@ function eh (e, t) { } return n && n.length ? n : void 0; } -async function vn (e, t, n, s) { +async function vn(e, t, n, s) { t && !Array.isArray(t) && !Ar(t) && (s = void 0, n = t, t = void 0), e = await e, n = n || {}; - const r = Kn(e); const o = eh(t, s); const a = await Ll(e, o, n); - return a - ? (n = Rl(n, a, o, r), s = th({ - url: r, - _parse: vn, - loaders: o - }, n, s || null), await nh(a, e, n, s)) - : null; -} -async function nh (e, t, n, s) { + const r = Kn(e), o = eh(t, s), a = await Ll(e, o, n); + return a ? (n = Rl(n, a, o, r), s = th({ + url: r, + _parse: vn, + loaders: o + }, n, s || null), await nh(a, e, n, s)) : null; +} +async function nh(e, t, n, s) { if (Tu(e), n = hu(e.options, n), se(t)) { - const i = t; const { + const i = t, { ok: o, redirected: a, status: c, statusText: u, type: l, url: h - } = i; const f = Object.fromEntries(i.headers.entries()); + } = i, f = Object.fromEntries(i.headers.entries()); s.response = { headers: f, ok: o, @@ -1644,53 +1618,57 @@ async function nh (e, t, n, s) { } t = await Zl(t, e, n); const r = e; - if (r.parseTextSync && typeof t === 'string') { return r.parseTextSync(t, n, s); } - if (xu(e, n)) { return await vu(e, t, n, s, vn); } - if (r.parseText && typeof t === 'string') { return await r.parseText(t, n, s); } - if (r.parse) { return await r.parse(t, n, s); } + if (r.parseTextSync && typeof t == "string") + return r.parseTextSync(t, n, s); + if (xu(e, n)) + return await vu(e, t, n, s, vn); + if (r.parseText && typeof t == "string") + return await r.parseText(t, n, s); + if (r.parse) + return await r.parse(t, n, s); throw Jt(!r.parseSync), new Error(`${e.id} loader - no parser found and worker is disabled`); } -function sh (e) { +function sh(e) { switch (e.constructor) { case Int8Array: - return 'int8'; + return "int8"; case Uint8Array: case Uint8ClampedArray: - return 'uint8'; + return "uint8"; case Int16Array: - return 'int16'; + return "int16"; case Uint16Array: - return 'uint16'; + return "uint16"; case Int32Array: - return 'int32'; + return "int32"; case Uint32Array: - return 'uint32'; + return "uint32"; case Float32Array: - return 'float32'; + return "float32"; case Float64Array: - return 'float64'; + return "float64"; default: - return 'null'; + return "null"; } } -function rh (e) { - let t = 1 / 0; let n = 1 / 0; let s = 1 / 0; let r = -1 / 0; let i = -1 / 0; let o = -1 / 0; - const a = e.POSITION ? e.POSITION.value : []; const c = a && a.length; +function rh(e) { + let t = 1 / 0, n = 1 / 0, s = 1 / 0, r = -1 / 0, i = -1 / 0, o = -1 / 0; + const a = e.POSITION ? e.POSITION.value : [], c = a && a.length; for (let u = 0; u < c; u += 3) { - const l = a[u]; const h = a[u + 1]; const f = a[u + 2]; + const l = a[u], h = a[u + 1], f = a[u + 2]; t = l < t ? l : t, n = h < n ? h : n, s = f < s ? f : s, r = l > r ? l : r, i = h > i ? h : i, o = f > o ? f : o; } return [[t, n, s], [r, i, o]]; } -function ih (e, t, n) { - const s = sh(t.value); const r = n || oh(t); +function ih(e, t, n) { + const s = sh(t.value), r = n || oh(t); return { name: e, type: { - type: 'fixed-size-list', + type: "fixed-size-list", listSize: t.size, children: [{ - name: 'value', + name: "value", type: s }] }, @@ -1698,18 +1676,18 @@ function ih (e, t, n) { metadata: r }; } -function oh (e) { +function oh(e) { const t = {}; - return 'byteOffset' in e && (t.byteOffset = e.byteOffset.toString(10)), 'byteStride' in e && (t.byteStride = e.byteStride.toString(10)), 'normalized' in e && (t.normalized = e.normalized.toString()), t; + return "byteOffset" in e && (t.byteOffset = e.byteOffset.toString(10)), "byteStride" in e && (t.byteStride = e.byteStride.toString(10)), "normalized" in e && (t.normalized = e.normalized.toString()), t; } -async function Ae (e, t, n, s) { +async function Ae(e, t, n, s) { let r, i; !Array.isArray(t) && !Ar(t) ? (r = [], i = t) : (r = t, i = n); const o = Aa(i); let a = e; - return typeof e === 'string' && (a = await o(e)), re(e) && (a = await o(e)), Array.isArray(r) ? await vn(a, r, i) : await vn(a, r, i); + return typeof e == "string" && (a = await o(e)), re(e) && (a = await o(e)), Array.isArray(r) ? await vn(a, r, i) : await vn(a, r, i); } -const ah = 1 / Math.PI * 180; const ch = 1 / 180 * Math.PI; const uh = { +const ah = 1 / Math.PI * 180, ch = 1 / 180 * Math.PI, uh = { EPSILON: 1e-12, debug: !1, precision: 4, @@ -1724,67 +1702,69 @@ globalThis.mathgl = globalThis.mathgl || { } }; const et = globalThis.mathgl.config; -function lh (e, { +function lh(e, { precision: t = et.precision } = {}) { - return e = gh(e), ''.concat(parseFloat(e.toPrecision(t))); + return e = gh(e), "".concat(parseFloat(e.toPrecision(t))); } -function ee (e) { +function ee(e) { return Array.isArray(e) || ArrayBuffer.isView(e) && !(e instanceof DataView); } -function hh (e) { +function hh(e) { return dh(e); } -function fh (e) { +function fh(e) { return Rt(e); } -function dh (e, t) { +function dh(e, t) { return pr(e, (n) => n * ch, t); } -function Rt (e, t) { +function Rt(e, t) { return pr(e, (n) => n * ah, t); } -function mh (e, t, n) { +function mh(e, t, n) { return pr(e, (s) => Math.max(t, Math.min(n, s))); } -function Kt (e, t, n) { +function Kt(e, t, n) { const s = et.EPSILON; n && (et.EPSILON = n); try { - if (e === t) { return !0; } + if (e === t) + return !0; if (ee(e) && ee(t)) { - if (e.length !== t.length) { return !1; } - for (let r = 0; r < e.length; ++r) { - if (!Kt(e[r], t[r])) { return !1; } - } + if (e.length !== t.length) + return !1; + for (let r = 0; r < e.length; ++r) + if (!Kt(e[r], t[r])) + return !1; return !0; } - return e && e.equals ? e.equals(t) : t && t.equals ? t.equals(e) : typeof e === 'number' && typeof t === 'number' ? Math.abs(e - t) <= et.EPSILON * Math.max(1, Math.abs(e), Math.abs(t)) : !1; + return e && e.equals ? e.equals(t) : t && t.equals ? t.equals(e) : typeof e == "number" && typeof t == "number" ? Math.abs(e - t) <= et.EPSILON * Math.max(1, Math.abs(e), Math.abs(t)) : !1; } finally { et.EPSILON = s; } } -function gh (e) { +function gh(e) { return Math.round(e / et.EPSILON) * et.EPSILON; } -function Ah (e) { +function Ah(e) { return e.clone ? e.clone() : new Array(e.length); } -function pr (e, t, n) { +function pr(e, t, n) { if (ee(e)) { const s = e; n = n || Ah(s); for (let r = 0; r < n.length && r < s.length; ++r) { - const i = typeof e === 'number' ? e : e[r]; + const i = typeof e == "number" ? e : e[r]; n[r] = t(i, r, n); } return n; } return t(e); } -function ph (e) { - function t () { - const n = Reflect.construct(e, Array.from(arguments)); +function ph(e) { + function t() { + var n = Reflect.construct(e, Array.from(arguments)); return Object.setPrototypeOf(n, Object.getPrototypeOf(this)), n; } return t.prototype = Object.create(e.prototype, { @@ -1797,228 +1777,212 @@ function ph (e) { }), Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e, t; } class yr extends ph(Array) { - clone () { + clone() { return new this.constructor().copy(this); } - - fromArray (t, n = 0) { - for (let s = 0; s < this.ELEMENTS; ++s) { this[s] = t[s + n]; } + fromArray(t, n = 0) { + for (let s = 0; s < this.ELEMENTS; ++s) + this[s] = t[s + n]; return this.check(); } - - toArray (t = [], n = 0) { - for (let s = 0; s < this.ELEMENTS; ++s) { t[n + s] = this[s]; } + toArray(t = [], n = 0) { + for (let s = 0; s < this.ELEMENTS; ++s) + t[n + s] = this[s]; return t; } - - toObject (t) { + toObject(t) { return t; } - - from (t) { + from(t) { return Array.isArray(t) ? this.copy(t) : this.fromObject(t); } - - to (t) { + to(t) { return t === this ? this : ee(t) ? this.toArray(t) : this.toObject(t); } - - toTarget (t) { + toTarget(t) { return t ? this.to(t) : this; } - - toFloat32Array () { + toFloat32Array() { return new Float32Array(this); } - - toString () { + toString() { return this.formatString(et); } - - formatString (t) { - let n = ''; - for (let s = 0; s < this.ELEMENTS; ++s) { n += (s > 0 ? ', ' : '') + lh(this[s], t); } - return ''.concat(t.printTypes ? this.constructor.name : '', '[').concat(n, ']'); + formatString(t) { + let n = ""; + for (let s = 0; s < this.ELEMENTS; ++s) + n += (s > 0 ? ", " : "") + lh(this[s], t); + return "".concat(t.printTypes ? this.constructor.name : "", "[").concat(n, "]"); } - - equals (t) { - if (!t || this.length !== t.length) { return !1; } - for (let n = 0; n < this.ELEMENTS; ++n) { - if (!Kt(this[n], t[n])) { return !1; } - } + equals(t) { + if (!t || this.length !== t.length) + return !1; + for (let n = 0; n < this.ELEMENTS; ++n) + if (!Kt(this[n], t[n])) + return !1; return !0; } - - exactEquals (t) { - if (!t || this.length !== t.length) { return !1; } - for (let n = 0; n < this.ELEMENTS; ++n) { - if (this[n] !== t[n]) { return !1; } - } + exactEquals(t) { + if (!t || this.length !== t.length) + return !1; + for (let n = 0; n < this.ELEMENTS; ++n) + if (this[n] !== t[n]) + return !1; return !0; } - - negate () { - for (let t = 0; t < this.ELEMENTS; ++t) { this[t] = -this[t]; } + negate() { + for (let t = 0; t < this.ELEMENTS; ++t) + this[t] = -this[t]; return this.check(); } - - lerp (t, n, s) { - if (s === void 0) { return this.lerp(this, t, n); } + lerp(t, n, s) { + if (s === void 0) + return this.lerp(this, t, n); for (let r = 0; r < this.ELEMENTS; ++r) { - const i = t[r]; const o = typeof n === 'number' ? n : n[r]; + const i = t[r], o = typeof n == "number" ? n : n[r]; this[r] = i + s * (o - i); } return this.check(); } - - min (t) { - for (let n = 0; n < this.ELEMENTS; ++n) { this[n] = Math.min(t[n], this[n]); } + min(t) { + for (let n = 0; n < this.ELEMENTS; ++n) + this[n] = Math.min(t[n], this[n]); return this.check(); } - - max (t) { - for (let n = 0; n < this.ELEMENTS; ++n) { this[n] = Math.max(t[n], this[n]); } + max(t) { + for (let n = 0; n < this.ELEMENTS; ++n) + this[n] = Math.max(t[n], this[n]); return this.check(); } - - clamp (t, n) { - for (let s = 0; s < this.ELEMENTS; ++s) { this[s] = Math.min(Math.max(this[s], t[s]), n[s]); } + clamp(t, n) { + for (let s = 0; s < this.ELEMENTS; ++s) + this[s] = Math.min(Math.max(this[s], t[s]), n[s]); return this.check(); } - - add (...t) { - for (const n of t) { - for (let s = 0; s < this.ELEMENTS; ++s) { this[s] += n[s]; } - } + add(...t) { + for (const n of t) + for (let s = 0; s < this.ELEMENTS; ++s) + this[s] += n[s]; return this.check(); } - - subtract (...t) { - for (const n of t) { - for (let s = 0; s < this.ELEMENTS; ++s) { this[s] -= n[s]; } - } + subtract(...t) { + for (const n of t) + for (let s = 0; s < this.ELEMENTS; ++s) + this[s] -= n[s]; return this.check(); } - - scale (t) { - if (typeof t === 'number') { - for (let n = 0; n < this.ELEMENTS; ++n) { this[n] *= t; } - } else { - for (let n = 0; n < this.ELEMENTS && n < t.length; ++n) { this[n] *= t[n]; } - } + scale(t) { + if (typeof t == "number") + for (let n = 0; n < this.ELEMENTS; ++n) + this[n] *= t; + else + for (let n = 0; n < this.ELEMENTS && n < t.length; ++n) + this[n] *= t[n]; return this.check(); } - - multiplyByScalar (t) { - for (let n = 0; n < this.ELEMENTS; ++n) { this[n] *= t; } + multiplyByScalar(t) { + for (let n = 0; n < this.ELEMENTS; ++n) + this[n] *= t; return this.check(); } - - check () { - if (et.debug && !this.validate()) { throw new Error('math.gl: '.concat(this.constructor.name, " some fields set to invalid numbers'")); } + check() { + if (et.debug && !this.validate()) + throw new Error("math.gl: ".concat(this.constructor.name, " some fields set to invalid numbers'")); return this; } - - validate () { + validate() { let t = this.length === this.ELEMENTS; - for (let n = 0; n < this.ELEMENTS; ++n) { t = t && Number.isFinite(this[n]); } + for (let n = 0; n < this.ELEMENTS; ++n) + t = t && Number.isFinite(this[n]); return t; } - - sub (t) { + sub(t) { return this.subtract(t); } - - setScalar (t) { - for (let n = 0; n < this.ELEMENTS; ++n) { this[n] = t; } + setScalar(t) { + for (let n = 0; n < this.ELEMENTS; ++n) + this[n] = t; return this.check(); } - - addScalar (t) { - for (let n = 0; n < this.ELEMENTS; ++n) { this[n] += t; } + addScalar(t) { + for (let n = 0; n < this.ELEMENTS; ++n) + this[n] += t; return this.check(); } - - subScalar (t) { + subScalar(t) { return this.addScalar(-t); } - - multiplyScalar (t) { - for (let n = 0; n < this.ELEMENTS; ++n) { this[n] *= t; } + multiplyScalar(t) { + for (let n = 0; n < this.ELEMENTS; ++n) + this[n] *= t; return this.check(); } - - divideScalar (t) { + divideScalar(t) { return this.multiplyByScalar(1 / t); } - - clampScalar (t, n) { - for (let s = 0; s < this.ELEMENTS; ++s) { this[s] = Math.min(Math.max(this[s], t), n); } + clampScalar(t, n) { + for (let s = 0; s < this.ELEMENTS; ++s) + this[s] = Math.min(Math.max(this[s], t), n); return this.check(); } - - get elements () { + get elements() { return this; } } -function yh (e, t) { - if (e.length !== t) { return !1; } - for (let n = 0; n < e.length; ++n) { - if (!Number.isFinite(e[n])) { return !1; } - } +function yh(e, t) { + if (e.length !== t) + return !1; + for (let n = 0; n < e.length; ++n) + if (!Number.isFinite(e[n])) + return !1; return !0; } -function U (e) { - if (!Number.isFinite(e)) { throw new Error('Invalid number '.concat(JSON.stringify(e))); } +function U(e) { + if (!Number.isFinite(e)) + throw new Error("Invalid number ".concat(JSON.stringify(e))); return e; } -function Oe (e, t, n = '') { - if (et.debug && !yh(e, t)) { throw new Error('math.gl: '.concat(n, " some fields set to invalid numbers'")); } +function Oe(e, t, n = "") { + if (et.debug && !yh(e, t)) + throw new Error("math.gl: ".concat(n, " some fields set to invalid numbers'")); return e; } -function j (e, t) { - if (!e) { throw new Error('math.gl assertion '.concat(t)); } +function j(e, t) { + if (!e) + throw new Error("math.gl assertion ".concat(t)); } class Br extends yr { - get x () { + get x() { return this[0]; } - - set x (t) { + set x(t) { this[0] = U(t); } - - get y () { + get y() { return this[1]; } - - set y (t) { + set y(t) { this[1] = U(t); } - - len () { + len() { return Math.sqrt(this.lengthSquared()); } - - magnitude () { + magnitude() { return this.len(); } - - lengthSquared () { + lengthSquared() { let t = 0; - for (let n = 0; n < this.ELEMENTS; ++n) { t += this[n] * this[n]; } + for (let n = 0; n < this.ELEMENTS; ++n) + t += this[n] * this[n]; return t; } - - magnitudeSquared () { + magnitudeSquared() { return this.lengthSquared(); } - - distance (t) { + distance(t) { return Math.sqrt(this.distanceSquared(t)); } - - distanceSquared (t) { + distanceSquared(t) { let n = 0; for (let s = 0; s < this.ELEMENTS; ++s) { const r = this[s] - t[s]; @@ -2026,566 +1990,488 @@ class Br extends yr { } return U(n); } - - dot (t) { + dot(t) { let n = 0; - for (let s = 0; s < this.ELEMENTS; ++s) { n += this[s] * t[s]; } + for (let s = 0; s < this.ELEMENTS; ++s) + n += this[s] * t[s]; return U(n); } - - normalize () { + normalize() { const t = this.magnitude(); - if (t !== 0) { - for (let n = 0; n < this.ELEMENTS; ++n) { this[n] /= t; } - } + if (t !== 0) + for (let n = 0; n < this.ELEMENTS; ++n) + this[n] /= t; return this.check(); } - - multiply (...t) { - for (const n of t) { - for (let s = 0; s < this.ELEMENTS; ++s) { this[s] *= n[s]; } - } + multiply(...t) { + for (const n of t) + for (let s = 0; s < this.ELEMENTS; ++s) + this[s] *= n[s]; return this.check(); } - - divide (...t) { - for (const n of t) { - for (let s = 0; s < this.ELEMENTS; ++s) { this[s] /= n[s]; } - } + divide(...t) { + for (const n of t) + for (let s = 0; s < this.ELEMENTS; ++s) + this[s] /= n[s]; return this.check(); } - - lengthSq () { + lengthSq() { return this.lengthSquared(); } - - distanceTo (t) { + distanceTo(t) { return this.distance(t); } - - distanceToSquared (t) { + distanceToSquared(t) { return this.distanceSquared(t); } - - getComponent (t) { - return j(t >= 0 && t < this.ELEMENTS, 'index is out of range'), U(this[t]); + getComponent(t) { + return j(t >= 0 && t < this.ELEMENTS, "index is out of range"), U(this[t]); } - - setComponent (t, n) { - return j(t >= 0 && t < this.ELEMENTS, 'index is out of range'), this[t] = n, this.check(); + setComponent(t, n) { + return j(t >= 0 && t < this.ELEMENTS, "index is out of range"), this[t] = n, this.check(); } - - addVectors (t, n) { + addVectors(t, n) { return this.copy(t).add(n); } - - subVectors (t, n) { + subVectors(t, n) { return this.copy(t).subtract(n); } - - multiplyVectors (t, n) { + multiplyVectors(t, n) { return this.copy(t).multiply(n); } - - addScaledVector (t, n) { + addScaledVector(t, n) { return this.add(new this.constructor(t).multiplyScalar(n)); } } const Fe = 1e-6; -const It = typeof Float32Array < 'u' ? Float32Array : Array; -function Bh () { +let It = typeof Float32Array < "u" ? Float32Array : Array; +function Bh() { const e = new It(2); return It != Float32Array && (e[0] = 0, e[1] = 0), e; } -function Ch (e, t, n) { - const s = t[0]; const r = t[1]; +function Ch(e, t, n) { + const s = t[0], r = t[1]; return e[0] = n[0] * s + n[2] * r, e[1] = n[1] * s + n[3] * r, e; } -function Eh (e, t, n) { - const s = t[0]; const r = t[1]; +function Eh(e, t, n) { + const s = t[0], r = t[1]; return e[0] = n[0] * s + n[2] * r + n[4], e[1] = n[1] * s + n[3] * r + n[5], e; } -function pa (e, t, n) { - const s = t[0]; const r = t[1]; +function pa(e, t, n) { + const s = t[0], r = t[1]; return e[0] = n[0] * s + n[3] * r + n[6], e[1] = n[1] * s + n[4] * r + n[7], e; } -function ya (e, t, n) { - const s = t[0]; const r = t[1]; +function ya(e, t, n) { + const s = t[0], r = t[1]; return e[0] = n[0] * s + n[4] * r + n[12], e[1] = n[1] * s + n[5] * r + n[13], e; } -(function () { +(function() { const e = Bh(); - return function (t, n, s, r, i, o) { + return function(t, n, s, r, i, o) { let a, c; - for (n || (n = 2), s || (s = 0), r ? c = Math.min(r * n + s, t.length) : c = t.length, a = s; a < c; a += n) { e[0] = t[a], e[1] = t[a + 1], i(e, e, o), t[a] = e[0], t[a + 1] = e[1]; } + for (n || (n = 2), s || (s = 0), r ? c = Math.min(r * n + s, t.length) : c = t.length, a = s; a < c; a += n) + e[0] = t[a], e[1] = t[a + 1], i(e, e, o), t[a] = e[0], t[a + 1] = e[1]; return t; }; })(); -function Ba (e, t, n) { - const s = t[0]; const r = t[1]; const i = n[3] * s + n[7] * r || 1; +function Ba(e, t, n) { + const s = t[0], r = t[1], i = n[3] * s + n[7] * r || 1; return e[0] = (n[0] * s + n[4] * r) / i, e[1] = (n[1] * s + n[5] * r) / i, e; } -function Ca (e, t, n) { - const s = t[0]; const r = t[1]; const i = t[2]; const o = n[3] * s + n[7] * r + n[11] * i || 1; +function Ca(e, t, n) { + const s = t[0], r = t[1], i = t[2], o = n[3] * s + n[7] * r + n[11] * i || 1; return e[0] = (n[0] * s + n[4] * r + n[8] * i) / o, e[1] = (n[1] * s + n[5] * r + n[9] * i) / o, e[2] = (n[2] * s + n[6] * r + n[10] * i) / o, e; } -function Th (e, t, n) { - const s = t[0]; const r = t[1]; +function Th(e, t, n) { + const s = t[0], r = t[1]; return e[0] = n[0] * s + n[2] * r, e[1] = n[1] * s + n[3] * r, e[2] = t[2], e; } -function bh (e, t, n) { - const s = t[0]; const r = t[1]; +function bh(e, t, n) { + const s = t[0], r = t[1]; return e[0] = n[0] * s + n[2] * r, e[1] = n[1] * s + n[3] * r, e[2] = t[2], e[3] = t[3], e; } -function Ea (e, t, n) { - const s = t[0]; const r = t[1]; const i = t[2]; +function Ea(e, t, n) { + const s = t[0], r = t[1], i = t[2]; return e[0] = n[0] * s + n[3] * r + n[6] * i, e[1] = n[1] * s + n[4] * r + n[7] * i, e[2] = n[2] * s + n[5] * r + n[8] * i, e[3] = t[3], e; } class Wn extends Br { - constructor (t = 0, n = 0) { + constructor(t = 0, n = 0) { super(2), ee(t) && arguments.length === 1 ? this.copy(t) : (et.debug && (U(t), U(n)), this[0] = t, this[1] = n); } - - set (t, n) { + set(t, n) { return this[0] = t, this[1] = n, this.check(); } - - copy (t) { + copy(t) { return this[0] = t[0], this[1] = t[1], this.check(); } - - fromObject (t) { + fromObject(t) { return et.debug && (U(t.x), U(t.y)), this[0] = t.x, this[1] = t.y, this.check(); } - - toObject (t) { + toObject(t) { return t.x = this[0], t.y = this[1], t; } - - get ELEMENTS () { + get ELEMENTS() { return 2; } - - horizontalAngle () { + horizontalAngle() { return Math.atan2(this.y, this.x); } - - verticalAngle () { + verticalAngle() { return Math.atan2(this.x, this.y); } - - transform (t) { + transform(t) { return this.transformAsPoint(t); } - - transformAsPoint (t) { + transformAsPoint(t) { return ya(this, this, t), this.check(); } - - transformAsVector (t) { + transformAsVector(t) { return Ba(this, this, t), this.check(); } - - transformByMatrix3 (t) { + transformByMatrix3(t) { return pa(this, this, t), this.check(); } - - transformByMatrix2x3 (t) { + transformByMatrix2x3(t) { return Eh(this, this, t), this.check(); } - - transformByMatrix2 (t) { + transformByMatrix2(t) { return Ch(this, this, t), this.check(); } } -function Ta () { +function Ta() { const e = new It(3); return It != Float32Array && (e[0] = 0, e[1] = 0, e[2] = 0), e; } -function ba (e) { - const t = e[0]; const n = e[1]; const s = e[2]; +function ba(e) { + const t = e[0], n = e[1], s = e[2]; return Math.sqrt(t * t + n * n + s * s); } -function fi (e, t, n) { +function fi(e, t, n) { const s = new It(3); return s[0] = e, s[1] = t, s[2] = n, s; } -function _h (e, t) { - const n = t[0]; const s = t[1]; const r = t[2]; +function _h(e, t) { + const n = t[0], s = t[1], r = t[2]; let i = n * n + s * s + r * r; return i > 0 && (i = 1 / Math.sqrt(i)), e[0] = t[0] * i, e[1] = t[1] * i, e[2] = t[2] * i, e; } -function Cr (e, t) { +function Cr(e, t) { return e[0] * t[0] + e[1] * t[1] + e[2] * t[2]; } -function Tn (e, t, n) { - const s = t[0]; const r = t[1]; const i = t[2]; const o = n[0]; const a = n[1]; const c = n[2]; +function Tn(e, t, n) { + const s = t[0], r = t[1], i = t[2], o = n[0], a = n[1], c = n[2]; return e[0] = r * c - i * a, e[1] = i * o - s * c, e[2] = s * a - r * o, e; } -function Er (e, t, n) { - const s = t[0]; const r = t[1]; const i = t[2]; +function Er(e, t, n) { + const s = t[0], r = t[1], i = t[2]; let o = n[3] * s + n[7] * r + n[11] * i + n[15]; return o = o || 1, e[0] = (n[0] * s + n[4] * r + n[8] * i + n[12]) / o, e[1] = (n[1] * s + n[5] * r + n[9] * i + n[13]) / o, e[2] = (n[2] * s + n[6] * r + n[10] * i + n[14]) / o, e; } -function _a (e, t, n) { - const s = t[0]; const r = t[1]; const i = t[2]; +function _a(e, t, n) { + const s = t[0], r = t[1], i = t[2]; return e[0] = s * n[0] + r * n[3] + i * n[6], e[1] = s * n[1] + r * n[4] + i * n[7], e[2] = s * n[2] + r * n[5] + i * n[8], e; } -function wa (e, t, n) { - const s = n[0]; const r = n[1]; const i = n[2]; const o = n[3]; const a = t[0]; const c = t[1]; const u = t[2]; - let l = r * u - i * c; let h = i * a - s * u; let f = s * c - r * a; let d = r * f - i * h; let m = i * l - s * f; let g = s * h - r * l; +function wa(e, t, n) { + const s = n[0], r = n[1], i = n[2], o = n[3], a = t[0], c = t[1], u = t[2]; + let l = r * u - i * c, h = i * a - s * u, f = s * c - r * a, d = r * f - i * h, m = i * l - s * f, g = s * h - r * l; const y = o * 2; return l *= y, h *= y, f *= y, d *= 2, m *= 2, g *= 2, e[0] = a + l + d, e[1] = c + h + m, e[2] = u + f + g, e; } -function wh (e, t, n, s) { - const r = []; const i = []; +function wh(e, t, n, s) { + const r = [], i = []; return r[0] = t[0] - n[0], r[1] = t[1] - n[1], r[2] = t[2] - n[2], i[0] = r[0], i[1] = r[1] * Math.cos(s) - r[2] * Math.sin(s), i[2] = r[1] * Math.sin(s) + r[2] * Math.cos(s), e[0] = i[0] + n[0], e[1] = i[1] + n[1], e[2] = i[2] + n[2], e; } -function Rh (e, t, n, s) { - const r = []; const i = []; +function Rh(e, t, n, s) { + const r = [], i = []; return r[0] = t[0] - n[0], r[1] = t[1] - n[1], r[2] = t[2] - n[2], i[0] = r[2] * Math.sin(s) + r[0] * Math.cos(s), i[1] = r[1], i[2] = r[2] * Math.cos(s) - r[0] * Math.sin(s), e[0] = i[0] + n[0], e[1] = i[1] + n[1], e[2] = i[2] + n[2], e; } -function Mh (e, t, n, s) { - const r = []; const i = []; +function Mh(e, t, n, s) { + const r = [], i = []; return r[0] = t[0] - n[0], r[1] = t[1] - n[1], r[2] = t[2] - n[2], i[0] = r[0] * Math.cos(s) - r[1] * Math.sin(s), i[1] = r[0] * Math.sin(s) + r[1] * Math.cos(s), i[2] = r[2], e[0] = i[0] + n[0], e[1] = i[1] + n[1], e[2] = i[2] + n[2], e; } -function Sh (e, t) { - const n = e[0]; const s = e[1]; const r = e[2]; const i = t[0]; const o = t[1]; const a = t[2]; const c = Math.sqrt((n * n + s * s + r * r) * (i * i + o * o + a * a)); const u = c && Cr(e, t) / c; +function Sh(e, t) { + const n = e[0], s = e[1], r = e[2], i = t[0], o = t[1], a = t[2], c = Math.sqrt((n * n + s * s + r * r) * (i * i + o * o + a * a)), u = c && Cr(e, t) / c; return Math.acos(Math.min(Math.max(u, -1), 1)); } const Ih = ba; -(function () { +(function() { const e = Ta(); - return function (t, n, s, r, i, o) { + return function(t, n, s, r, i, o) { let a, c; - for (n || (n = 3), s || (s = 0), r ? c = Math.min(r * n + s, t.length) : c = t.length, a = s; a < c; a += n) { e[0] = t[a], e[1] = t[a + 1], e[2] = t[a + 2], i(e, e, o), t[a] = e[0], t[a + 1] = e[1], t[a + 2] = e[2]; } + for (n || (n = 3), s || (s = 0), r ? c = Math.min(r * n + s, t.length) : c = t.length, a = s; a < c; a += n) + e[0] = t[a], e[1] = t[a + 1], e[2] = t[a + 2], i(e, e, o), t[a] = e[0], t[a + 1] = e[1], t[a + 2] = e[2]; return t; }; })(); const fs = [0, 0, 0]; let tn; class A extends Br { - static get ZERO () { + static get ZERO() { return tn || (tn = new A(0, 0, 0), Object.freeze(tn)), tn; } - - constructor (t = 0, n = 0, s = 0) { + constructor(t = 0, n = 0, s = 0) { super(-0, -0, -0), arguments.length === 1 && ee(t) ? this.copy(t) : (et.debug && (U(t), U(n), U(s)), this[0] = t, this[1] = n, this[2] = s); } - - set (t, n, s) { + set(t, n, s) { return this[0] = t, this[1] = n, this[2] = s, this.check(); } - - copy (t) { + copy(t) { return this[0] = t[0], this[1] = t[1], this[2] = t[2], this.check(); } - - fromObject (t) { + fromObject(t) { return et.debug && (U(t.x), U(t.y), U(t.z)), this[0] = t.x, this[1] = t.y, this[2] = t.z, this.check(); } - - toObject (t) { + toObject(t) { return t.x = this[0], t.y = this[1], t.z = this[2], t; } - - get ELEMENTS () { + get ELEMENTS() { return 3; } - - get z () { + get z() { return this[2]; } - - set z (t) { + set z(t) { this[2] = U(t); } - - angle (t) { + angle(t) { return Sh(this, t); } - - cross (t) { + cross(t) { return Tn(this, this, t), this.check(); } - - rotateX ({ + rotateX({ radians: t, origin: n = fs }) { return wh(this, this, n, t), this.check(); } - - rotateY ({ + rotateY({ radians: t, origin: n = fs }) { return Rh(this, this, n, t), this.check(); } - - rotateZ ({ + rotateZ({ radians: t, origin: n = fs }) { return Mh(this, this, n, t), this.check(); } - - transform (t) { + transform(t) { return this.transformAsPoint(t); } - - transformAsPoint (t) { + transformAsPoint(t) { return Er(this, this, t), this.check(); } - - transformAsVector (t) { + transformAsVector(t) { return Ca(this, this, t), this.check(); } - - transformByMatrix3 (t) { + transformByMatrix3(t) { return _a(this, this, t), this.check(); } - - transformByMatrix2 (t) { + transformByMatrix2(t) { return Th(this, this, t), this.check(); } - - transformByQuaternion (t) { + transformByQuaternion(t) { return wa(this, this, t), this.check(); } } let en; class Tr extends Br { - static get ZERO () { + static get ZERO() { return en || (en = new Tr(0, 0, 0, 0), Object.freeze(en)), en; } - - constructor (t = 0, n = 0, s = 0, r = 0) { + constructor(t = 0, n = 0, s = 0, r = 0) { super(-0, -0, -0, -0), ee(t) && arguments.length === 1 ? this.copy(t) : (et.debug && (U(t), U(n), U(s), U(r)), this[0] = t, this[1] = n, this[2] = s, this[3] = r); } - - set (t, n, s, r) { + set(t, n, s, r) { return this[0] = t, this[1] = n, this[2] = s, this[3] = r, this.check(); } - - copy (t) { + copy(t) { return this[0] = t[0], this[1] = t[1], this[2] = t[2], this[3] = t[3], this.check(); } - - fromObject (t) { + fromObject(t) { return et.debug && (U(t.x), U(t.y), U(t.z), U(t.w)), this[0] = t.x, this[1] = t.y, this[2] = t.z, this[3] = t.w, this; } - - toObject (t) { + toObject(t) { return t.x = this[0], t.y = this[1], t.z = this[2], t.w = this[3], t; } - - get ELEMENTS () { + get ELEMENTS() { return 4; } - - get z () { + get z() { return this[2]; } - - set z (t) { + set z(t) { this[2] = U(t); } - - get w () { + get w() { return this[3]; } - - set w (t) { + set w(t) { this[3] = U(t); } - - transform (t) { + transform(t) { return Er(this, this, t), this.check(); } - - transformByMatrix3 (t) { + transformByMatrix3(t) { return Ea(this, this, t), this.check(); } - - transformByMatrix2 (t) { + transformByMatrix2(t) { return bh(this, this, t), this.check(); } - - transformByQuaternion (t) { + transformByQuaternion(t) { return wa(this, this, t), this.check(); } - - applyMatrix4 (t) { + applyMatrix4(t) { return t.transform(this, this), this; } } class Ra extends yr { - toString () { - let t = '['; + toString() { + let t = "["; if (et.printRowMajor) { - t += 'row-major:'; - for (let n = 0; n < this.RANK; ++n) { - for (let s = 0; s < this.RANK; ++s) { t += ' '.concat(this[s * this.RANK + n]); } - } + t += "row-major:"; + for (let n = 0; n < this.RANK; ++n) + for (let s = 0; s < this.RANK; ++s) + t += " ".concat(this[s * this.RANK + n]); } else { - t += 'column-major:'; - for (let n = 0; n < this.ELEMENTS; ++n) { t += ' '.concat(this[n]); } + t += "column-major:"; + for (let n = 0; n < this.ELEMENTS; ++n) + t += " ".concat(this[n]); } - return t += ']', t; + return t += "]", t; } - - getElementIndex (t, n) { + getElementIndex(t, n) { return n * this.RANK + t; } - - getElement (t, n) { + getElement(t, n) { return this[n * this.RANK + t]; } - - setElement (t, n, s) { + setElement(t, n, s) { return this[n * this.RANK + t] = U(s), this; } - - getColumn (t, n = new Array(this.RANK).fill(-0)) { + getColumn(t, n = new Array(this.RANK).fill(-0)) { const s = t * this.RANK; - for (let r = 0; r < this.RANK; ++r) { n[r] = this[s + r]; } + for (let r = 0; r < this.RANK; ++r) + n[r] = this[s + r]; return n; } - - setColumn (t, n) { + setColumn(t, n) { const s = t * this.RANK; - for (let r = 0; r < this.RANK; ++r) { this[s + r] = n[r]; } + for (let r = 0; r < this.RANK; ++r) + this[s + r] = n[r]; return this; } } -function xh () { +function xh() { const e = new It(9); return It != Float32Array && (e[1] = 0, e[2] = 0, e[3] = 0, e[5] = 0, e[6] = 0, e[7] = 0), e[0] = 1, e[4] = 1, e[8] = 1, e; } -function vh (e, t) { +function vh(e, t) { if (e === t) { - const n = t[1]; const s = t[2]; const r = t[5]; + const n = t[1], s = t[2], r = t[5]; e[1] = t[3], e[2] = t[6], e[3] = n, e[5] = t[7], e[6] = s, e[7] = r; - } else { e[0] = t[0], e[1] = t[3], e[2] = t[6], e[3] = t[1], e[4] = t[4], e[5] = t[7], e[6] = t[2], e[7] = t[5], e[8] = t[8]; } + } else + e[0] = t[0], e[1] = t[3], e[2] = t[6], e[3] = t[1], e[4] = t[4], e[5] = t[7], e[6] = t[2], e[7] = t[5], e[8] = t[8]; return e; } -function Oh (e, t) { - const n = t[0]; const s = t[1]; const r = t[2]; const i = t[3]; const o = t[4]; const a = t[5]; const c = t[6]; const u = t[7]; const l = t[8]; const h = l * o - a * u; const f = -l * i + a * c; const d = u * i - o * c; +function Oh(e, t) { + const n = t[0], s = t[1], r = t[2], i = t[3], o = t[4], a = t[5], c = t[6], u = t[7], l = t[8], h = l * o - a * u, f = -l * i + a * c, d = u * i - o * c; let m = n * h + s * f + r * d; return m ? (m = 1 / m, e[0] = h * m, e[1] = (-l * s + r * u) * m, e[2] = (a * s - r * o) * m, e[3] = f * m, e[4] = (l * n - r * c) * m, e[5] = (-a * n + r * i) * m, e[6] = d * m, e[7] = (-u * n + s * c) * m, e[8] = (o * n - s * i) * m, e) : null; } -function Fh (e) { - const t = e[0]; const n = e[1]; const s = e[2]; const r = e[3]; const i = e[4]; const o = e[5]; const a = e[6]; const c = e[7]; const u = e[8]; +function Fh(e) { + const t = e[0], n = e[1], s = e[2], r = e[3], i = e[4], o = e[5], a = e[6], c = e[7], u = e[8]; return t * (u * i - o * c) + n * (-u * r + o * a) + s * (c * r - i * a); } -function di (e, t, n) { - const s = t[0]; const r = t[1]; const i = t[2]; const o = t[3]; const a = t[4]; const c = t[5]; const u = t[6]; const l = t[7]; const h = t[8]; const f = n[0]; const d = n[1]; const m = n[2]; const g = n[3]; const y = n[4]; const E = n[5]; const R = n[6]; const B = n[7]; const C = n[8]; +function di(e, t, n) { + const s = t[0], r = t[1], i = t[2], o = t[3], a = t[4], c = t[5], u = t[6], l = t[7], h = t[8], f = n[0], d = n[1], m = n[2], g = n[3], y = n[4], E = n[5], R = n[6], B = n[7], C = n[8]; return e[0] = f * s + d * o + m * u, e[1] = f * r + d * a + m * l, e[2] = f * i + d * c + m * h, e[3] = g * s + y * o + E * u, e[4] = g * r + y * a + E * l, e[5] = g * i + y * c + E * h, e[6] = R * s + B * o + C * u, e[7] = R * r + B * a + C * l, e[8] = R * i + B * c + C * h, e; } -function Dh (e, t, n) { - const s = t[0]; const r = t[1]; const i = t[2]; const o = t[3]; const a = t[4]; const c = t[5]; const u = t[6]; const l = t[7]; const h = t[8]; const f = n[0]; const d = n[1]; +function Dh(e, t, n) { + const s = t[0], r = t[1], i = t[2], o = t[3], a = t[4], c = t[5], u = t[6], l = t[7], h = t[8], f = n[0], d = n[1]; return e[0] = s, e[1] = r, e[2] = i, e[3] = o, e[4] = a, e[5] = c, e[6] = f * s + d * o + u, e[7] = f * r + d * a + l, e[8] = f * i + d * c + h, e; } -function Lh (e, t, n) { - const s = t[0]; const r = t[1]; const i = t[2]; const o = t[3]; const a = t[4]; const c = t[5]; const u = t[6]; const l = t[7]; const h = t[8]; const f = Math.sin(n); const d = Math.cos(n); +function Lh(e, t, n) { + const s = t[0], r = t[1], i = t[2], o = t[3], a = t[4], c = t[5], u = t[6], l = t[7], h = t[8], f = Math.sin(n), d = Math.cos(n); return e[0] = d * s + f * o, e[1] = d * r + f * a, e[2] = d * i + f * c, e[3] = d * o - f * s, e[4] = d * a - f * r, e[5] = d * c - f * i, e[6] = u, e[7] = l, e[8] = h, e; } -function mi (e, t, n) { - const s = n[0]; const r = n[1]; +function mi(e, t, n) { + const s = n[0], r = n[1]; return e[0] = s * t[0], e[1] = s * t[1], e[2] = s * t[2], e[3] = r * t[3], e[4] = r * t[4], e[5] = r * t[5], e[6] = t[6], e[7] = t[7], e[8] = t[8], e; } -function Ph (e, t) { - const n = t[0]; const s = t[1]; const r = t[2]; const i = t[3]; const o = n + n; const a = s + s; const c = r + r; const u = n * o; const l = s * o; const h = s * a; const f = r * o; const d = r * a; const m = r * c; const g = i * o; const y = i * a; const E = i * c; +function Ph(e, t) { + const n = t[0], s = t[1], r = t[2], i = t[3], o = n + n, a = s + s, c = r + r, u = n * o, l = s * o, h = s * a, f = r * o, d = r * a, m = r * c, g = i * o, y = i * a, E = i * c; return e[0] = 1 - h - m, e[3] = l - E, e[6] = f + y, e[1] = l + E, e[4] = 1 - u - m, e[7] = d - g, e[2] = f - y, e[5] = d + g, e[8] = 1 - u - h, e; } -let ks; -(function (e) { - e[e.COL0ROW0 = 0] = 'COL0ROW0', e[e.COL0ROW1 = 1] = 'COL0ROW1', e[e.COL0ROW2 = 2] = 'COL0ROW2', e[e.COL1ROW0 = 3] = 'COL1ROW0', e[e.COL1ROW1 = 4] = 'COL1ROW1', e[e.COL1ROW2 = 5] = 'COL1ROW2', e[e.COL2ROW0 = 6] = 'COL2ROW0', e[e.COL2ROW1 = 7] = 'COL2ROW1', e[e.COL2ROW2 = 8] = 'COL2ROW2'; +var ks; +(function(e) { + e[e.COL0ROW0 = 0] = "COL0ROW0", e[e.COL0ROW1 = 1] = "COL0ROW1", e[e.COL0ROW2 = 2] = "COL0ROW2", e[e.COL1ROW0 = 3] = "COL1ROW0", e[e.COL1ROW1 = 4] = "COL1ROW1", e[e.COL1ROW2 = 5] = "COL1ROW2", e[e.COL2ROW0 = 6] = "COL2ROW0", e[e.COL2ROW1 = 7] = "COL2ROW1", e[e.COL2ROW2 = 8] = "COL2ROW2"; })(ks || (ks = {})); const Gh = Object.freeze([1, 0, 0, 0, 1, 0, 0, 0, 1]); class X extends Ra { - static get IDENTITY () { + static get IDENTITY() { return Uh(); } - - static get ZERO () { + static get ZERO() { return Nh(); } - - get ELEMENTS () { + get ELEMENTS() { return 9; } - - get RANK () { + get RANK() { return 3; } - - get INDICES () { + get INDICES() { return ks; } - - constructor (t, ...n) { + constructor(t, ...n) { super(-0, -0, -0, -0, -0, -0, -0, -0, -0), arguments.length === 1 && Array.isArray(t) ? this.copy(t) : n.length > 0 ? this.copy([t, ...n]) : this.identity(); } - - copy (t) { + copy(t) { return this[0] = t[0], this[1] = t[1], this[2] = t[2], this[3] = t[3], this[4] = t[4], this[5] = t[5], this[6] = t[6], this[7] = t[7], this[8] = t[8], this.check(); } - - identity () { + identity() { return this.copy(Gh); } - - fromObject (t) { + fromObject(t) { return this.check(); } - - fromQuaternion (t) { + fromQuaternion(t) { return Ph(this, t), this.check(); } - - set (t, n, s, r, i, o, a, c, u) { + set(t, n, s, r, i, o, a, c, u) { return this[0] = t, this[1] = n, this[2] = s, this[3] = r, this[4] = i, this[5] = o, this[6] = a, this[7] = c, this[8] = u, this.check(); } - - setRowMajor (t, n, s, r, i, o, a, c, u) { + setRowMajor(t, n, s, r, i, o, a, c, u) { return this[0] = t, this[1] = r, this[2] = a, this[3] = n, this[4] = i, this[5] = c, this[6] = s, this[7] = o, this[8] = u, this.check(); } - - determinant () { + determinant() { return Fh(this); } - - transpose () { + transpose() { return vh(this, this), this.check(); } - - invert () { + invert() { return Oh(this, this), this.check(); } - - multiplyLeft (t) { + multiplyLeft(t) { return di(this, t, this), this.check(); } - - multiplyRight (t) { + multiplyRight(t) { return di(this, this, t), this.check(); } - - rotate (t) { + rotate(t) { return Lh(this, this, t), this.check(); } - - scale (t) { + scale(t) { return Array.isArray(t) ? mi(this, this, t) : mi(this, this, [t, t]), this.check(); } - - translate (t) { + translate(t) { return Dh(this, this, t), this.check(); } - - transform (t, n) { + transform(t, n) { let s; switch (t.length) { case 2: @@ -2598,215 +2484,202 @@ class X extends Ra { s = Ea(n || [-0, -0, -0, -0], t, this); break; default: - throw new Error('Illegal vector'); + throw new Error("Illegal vector"); } return Oe(s, t.length), s; } - - transformVector (t, n) { + transformVector(t, n) { return this.transform(t, n); } - - transformVector2 (t, n) { + transformVector2(t, n) { return this.transform(t, n); } - - transformVector3 (t, n) { + transformVector3(t, n) { return this.transform(t, n); } } -let nn; let sn = null; -function Nh () { +let nn, sn = null; +function Nh() { return nn || (nn = new X([0, 0, 0, 0, 0, 0, 0, 0, 0]), Object.freeze(nn)), nn; } -function Uh () { +function Uh() { return sn || (sn = new X(), Object.freeze(sn)), sn; } -function Hh (e) { +function Hh(e) { return e[0] = 1, e[1] = 0, e[2] = 0, e[3] = 0, e[4] = 0, e[5] = 1, e[6] = 0, e[7] = 0, e[8] = 0, e[9] = 0, e[10] = 1, e[11] = 0, e[12] = 0, e[13] = 0, e[14] = 0, e[15] = 1, e; } -function Jh (e, t) { +function Jh(e, t) { if (e === t) { - const n = t[1]; const s = t[2]; const r = t[3]; const i = t[6]; const o = t[7]; const a = t[11]; + const n = t[1], s = t[2], r = t[3], i = t[6], o = t[7], a = t[11]; e[1] = t[4], e[2] = t[8], e[3] = t[12], e[4] = n, e[6] = t[9], e[7] = t[13], e[8] = s, e[9] = i, e[11] = t[14], e[12] = r, e[13] = o, e[14] = a; - } else { e[0] = t[0], e[1] = t[4], e[2] = t[8], e[3] = t[12], e[4] = t[1], e[5] = t[5], e[6] = t[9], e[7] = t[13], e[8] = t[2], e[9] = t[6], e[10] = t[10], e[11] = t[14], e[12] = t[3], e[13] = t[7], e[14] = t[11], e[15] = t[15]; } + } else + e[0] = t[0], e[1] = t[4], e[2] = t[8], e[3] = t[12], e[4] = t[1], e[5] = t[5], e[6] = t[9], e[7] = t[13], e[8] = t[2], e[9] = t[6], e[10] = t[10], e[11] = t[14], e[12] = t[3], e[13] = t[7], e[14] = t[11], e[15] = t[15]; return e; } -function Vh (e, t) { - const n = t[0]; const s = t[1]; const r = t[2]; const i = t[3]; const o = t[4]; const a = t[5]; const c = t[6]; const u = t[7]; const l = t[8]; const h = t[9]; const f = t[10]; const d = t[11]; const m = t[12]; const g = t[13]; const y = t[14]; const E = t[15]; const R = n * a - s * o; const B = n * c - r * o; const C = n * u - i * o; const M = s * c - r * a; const b = s * u - i * a; const O = r * u - i * c; const F = l * g - h * m; const v = l * y - f * m; const L = l * E - d * m; const k = h * y - f * g; const q = h * E - d * g; const Y = f * E - d * y; +function Vh(e, t) { + const n = t[0], s = t[1], r = t[2], i = t[3], o = t[4], a = t[5], c = t[6], u = t[7], l = t[8], h = t[9], f = t[10], d = t[11], m = t[12], g = t[13], y = t[14], E = t[15], R = n * a - s * o, B = n * c - r * o, C = n * u - i * o, M = s * c - r * a, b = s * u - i * a, O = r * u - i * c, F = l * g - h * m, v = l * y - f * m, L = l * E - d * m, k = h * y - f * g, q = h * E - d * g, Y = f * E - d * y; let P = R * Y - B * q + C * k + M * L - b * v + O * F; return P ? (P = 1 / P, e[0] = (a * Y - c * q + u * k) * P, e[1] = (r * q - s * Y - i * k) * P, e[2] = (g * O - y * b + E * M) * P, e[3] = (f * b - h * O - d * M) * P, e[4] = (c * L - o * Y - u * v) * P, e[5] = (n * Y - r * L + i * v) * P, e[6] = (y * C - m * O - E * B) * P, e[7] = (l * O - f * C + d * B) * P, e[8] = (o * q - a * L + u * F) * P, e[9] = (s * L - n * q - i * F) * P, e[10] = (m * b - g * C + E * R) * P, e[11] = (h * C - l * b - d * R) * P, e[12] = (a * v - o * k - c * F) * P, e[13] = (n * k - s * v + r * F) * P, e[14] = (g * B - m * M - y * R) * P, e[15] = (l * M - h * B + f * R) * P, e) : null; } -function jh (e) { - const t = e[0]; const n = e[1]; const s = e[2]; const r = e[3]; const i = e[4]; const o = e[5]; const a = e[6]; const c = e[7]; const u = e[8]; const l = e[9]; const h = e[10]; const f = e[11]; const d = e[12]; const m = e[13]; const g = e[14]; const y = e[15]; const E = t * o - n * i; const R = t * a - s * i; const B = n * a - s * o; const C = u * m - l * d; const M = u * g - h * d; const b = l * g - h * m; const O = t * b - n * M + s * C; const F = i * b - o * M + a * C; const v = u * B - l * R + h * E; const L = d * B - m * R + g * E; +function jh(e) { + const t = e[0], n = e[1], s = e[2], r = e[3], i = e[4], o = e[5], a = e[6], c = e[7], u = e[8], l = e[9], h = e[10], f = e[11], d = e[12], m = e[13], g = e[14], y = e[15], E = t * o - n * i, R = t * a - s * i, B = n * a - s * o, C = u * m - l * d, M = u * g - h * d, b = l * g - h * m, O = t * b - n * M + s * C, F = i * b - o * M + a * C, v = u * B - l * R + h * E, L = d * B - m * R + g * E; return c * O - r * F + y * v - f * L; } -function gi (e, t, n) { - const s = t[0]; const r = t[1]; const i = t[2]; const o = t[3]; const a = t[4]; const c = t[5]; const u = t[6]; const l = t[7]; const h = t[8]; const f = t[9]; const d = t[10]; const m = t[11]; const g = t[12]; const y = t[13]; const E = t[14]; const R = t[15]; - let B = n[0]; let C = n[1]; let M = n[2]; let b = n[3]; +function gi(e, t, n) { + const s = t[0], r = t[1], i = t[2], o = t[3], a = t[4], c = t[5], u = t[6], l = t[7], h = t[8], f = t[9], d = t[10], m = t[11], g = t[12], y = t[13], E = t[14], R = t[15]; + let B = n[0], C = n[1], M = n[2], b = n[3]; return e[0] = B * s + C * a + M * h + b * g, e[1] = B * r + C * c + M * f + b * y, e[2] = B * i + C * u + M * d + b * E, e[3] = B * o + C * l + M * m + b * R, B = n[4], C = n[5], M = n[6], b = n[7], e[4] = B * s + C * a + M * h + b * g, e[5] = B * r + C * c + M * f + b * y, e[6] = B * i + C * u + M * d + b * E, e[7] = B * o + C * l + M * m + b * R, B = n[8], C = n[9], M = n[10], b = n[11], e[8] = B * s + C * a + M * h + b * g, e[9] = B * r + C * c + M * f + b * y, e[10] = B * i + C * u + M * d + b * E, e[11] = B * o + C * l + M * m + b * R, B = n[12], C = n[13], M = n[14], b = n[15], e[12] = B * s + C * a + M * h + b * g, e[13] = B * r + C * c + M * f + b * y, e[14] = B * i + C * u + M * d + b * E, e[15] = B * o + C * l + M * m + b * R, e; } -function kh (e, t, n) { - const s = n[0]; const r = n[1]; const i = n[2]; +function kh(e, t, n) { + const s = n[0], r = n[1], i = n[2]; let o, a, c, u, l, h, f, d, m, g, y, E; return t === e ? (e[12] = t[0] * s + t[4] * r + t[8] * i + t[12], e[13] = t[1] * s + t[5] * r + t[9] * i + t[13], e[14] = t[2] * s + t[6] * r + t[10] * i + t[14], e[15] = t[3] * s + t[7] * r + t[11] * i + t[15]) : (o = t[0], a = t[1], c = t[2], u = t[3], l = t[4], h = t[5], f = t[6], d = t[7], m = t[8], g = t[9], y = t[10], E = t[11], e[0] = o, e[1] = a, e[2] = c, e[3] = u, e[4] = l, e[5] = h, e[6] = f, e[7] = d, e[8] = m, e[9] = g, e[10] = y, e[11] = E, e[12] = o * s + l * r + m * i + t[12], e[13] = a * s + h * r + g * i + t[13], e[14] = c * s + f * r + y * i + t[14], e[15] = u * s + d * r + E * i + t[15]), e; } -function Kh (e, t, n) { - const s = n[0]; const r = n[1]; const i = n[2]; +function Kh(e, t, n) { + const s = n[0], r = n[1], i = n[2]; return e[0] = t[0] * s, e[1] = t[1] * s, e[2] = t[2] * s, e[3] = t[3] * s, e[4] = t[4] * r, e[5] = t[5] * r, e[6] = t[6] * r, e[7] = t[7] * r, e[8] = t[8] * i, e[9] = t[9] * i, e[10] = t[10] * i, e[11] = t[11] * i, e[12] = t[12], e[13] = t[13], e[14] = t[14], e[15] = t[15], e; } -function zh (e, t, n, s) { - let r = s[0]; let i = s[1]; let o = s[2]; let a = Math.sqrt(r * r + i * i + o * o); let c; let u; let l; let h; let f; let d; let m; let g; let y; let E; let R; let B; let C; let M; let b; let O; let F; let v; let L; let k; let q; let Y; let P; let ct; +function zh(e, t, n, s) { + let r = s[0], i = s[1], o = s[2], a = Math.sqrt(r * r + i * i + o * o), c, u, l, h, f, d, m, g, y, E, R, B, C, M, b, O, F, v, L, k, q, Y, P, ct; return a < Fe ? null : (a = 1 / a, r *= a, i *= a, o *= a, u = Math.sin(n), c = Math.cos(n), l = 1 - c, h = t[0], f = t[1], d = t[2], m = t[3], g = t[4], y = t[5], E = t[6], R = t[7], B = t[8], C = t[9], M = t[10], b = t[11], O = r * r * l + c, F = i * r * l + o * u, v = o * r * l - i * u, L = r * i * l - o * u, k = i * i * l + c, q = o * i * l + r * u, Y = r * o * l + i * u, P = i * o * l - r * u, ct = o * o * l + c, e[0] = h * O + g * F + B * v, e[1] = f * O + y * F + C * v, e[2] = d * O + E * F + M * v, e[3] = m * O + R * F + b * v, e[4] = h * L + g * k + B * q, e[5] = f * L + y * k + C * q, e[6] = d * L + E * k + M * q, e[7] = m * L + R * k + b * q, e[8] = h * Y + g * P + B * ct, e[9] = f * Y + y * P + C * ct, e[10] = d * Y + E * P + M * ct, e[11] = m * Y + R * P + b * ct, t !== e && (e[12] = t[12], e[13] = t[13], e[14] = t[14], e[15] = t[15]), e); } -function Wh (e, t, n) { - const s = Math.sin(n); const r = Math.cos(n); const i = t[4]; const o = t[5]; const a = t[6]; const c = t[7]; const u = t[8]; const l = t[9]; const h = t[10]; const f = t[11]; +function Wh(e, t, n) { + const s = Math.sin(n), r = Math.cos(n), i = t[4], o = t[5], a = t[6], c = t[7], u = t[8], l = t[9], h = t[10], f = t[11]; return t !== e && (e[0] = t[0], e[1] = t[1], e[2] = t[2], e[3] = t[3], e[12] = t[12], e[13] = t[13], e[14] = t[14], e[15] = t[15]), e[4] = i * r + u * s, e[5] = o * r + l * s, e[6] = a * r + h * s, e[7] = c * r + f * s, e[8] = u * r - i * s, e[9] = l * r - o * s, e[10] = h * r - a * s, e[11] = f * r - c * s, e; } -function Xh (e, t, n) { - const s = Math.sin(n); const r = Math.cos(n); const i = t[0]; const o = t[1]; const a = t[2]; const c = t[3]; const u = t[8]; const l = t[9]; const h = t[10]; const f = t[11]; +function Xh(e, t, n) { + const s = Math.sin(n), r = Math.cos(n), i = t[0], o = t[1], a = t[2], c = t[3], u = t[8], l = t[9], h = t[10], f = t[11]; return t !== e && (e[4] = t[4], e[5] = t[5], e[6] = t[6], e[7] = t[7], e[12] = t[12], e[13] = t[13], e[14] = t[14], e[15] = t[15]), e[0] = i * r - u * s, e[1] = o * r - l * s, e[2] = a * r - h * s, e[3] = c * r - f * s, e[8] = i * s + u * r, e[9] = o * s + l * r, e[10] = a * s + h * r, e[11] = c * s + f * r, e; } -function Qh (e, t, n) { - const s = Math.sin(n); const r = Math.cos(n); const i = t[0]; const o = t[1]; const a = t[2]; const c = t[3]; const u = t[4]; const l = t[5]; const h = t[6]; const f = t[7]; +function Qh(e, t, n) { + const s = Math.sin(n), r = Math.cos(n), i = t[0], o = t[1], a = t[2], c = t[3], u = t[4], l = t[5], h = t[6], f = t[7]; return t !== e && (e[8] = t[8], e[9] = t[9], e[10] = t[10], e[11] = t[11], e[12] = t[12], e[13] = t[13], e[14] = t[14], e[15] = t[15]), e[0] = i * r + u * s, e[1] = o * r + l * s, e[2] = a * r + h * s, e[3] = c * r + f * s, e[4] = u * r - i * s, e[5] = l * r - o * s, e[6] = h * r - a * s, e[7] = f * r - c * s, e; } -function qh (e, t) { - const n = t[0]; const s = t[1]; const r = t[2]; const i = t[4]; const o = t[5]; const a = t[6]; const c = t[8]; const u = t[9]; const l = t[10]; +function qh(e, t) { + const n = t[0], s = t[1], r = t[2], i = t[4], o = t[5], a = t[6], c = t[8], u = t[9], l = t[10]; return e[0] = Math.sqrt(n * n + s * s + r * r), e[1] = Math.sqrt(i * i + o * o + a * a), e[2] = Math.sqrt(c * c + u * u + l * l), e; } -function Yh (e, t) { - const n = t[0]; const s = t[1]; const r = t[2]; const i = t[3]; const o = n + n; const a = s + s; const c = r + r; const u = n * o; const l = s * o; const h = s * a; const f = r * o; const d = r * a; const m = r * c; const g = i * o; const y = i * a; const E = i * c; +function Yh(e, t) { + const n = t[0], s = t[1], r = t[2], i = t[3], o = n + n, a = s + s, c = r + r, u = n * o, l = s * o, h = s * a, f = r * o, d = r * a, m = r * c, g = i * o, y = i * a, E = i * c; return e[0] = 1 - h - m, e[1] = l + E, e[2] = f - y, e[3] = 0, e[4] = l - E, e[5] = 1 - u - m, e[6] = d + g, e[7] = 0, e[8] = f + y, e[9] = d - g, e[10] = 1 - u - h, e[11] = 0, e[12] = 0, e[13] = 0, e[14] = 0, e[15] = 1, e; } -function $h (e, t, n, s, r, i, o) { - const a = 1 / (n - t); const c = 1 / (r - s); const u = 1 / (i - o); +function $h(e, t, n, s, r, i, o) { + const a = 1 / (n - t), c = 1 / (r - s), u = 1 / (i - o); return e[0] = i * 2 * a, e[1] = 0, e[2] = 0, e[3] = 0, e[4] = 0, e[5] = i * 2 * c, e[6] = 0, e[7] = 0, e[8] = (n + t) * a, e[9] = (r + s) * c, e[10] = (o + i) * u, e[11] = -1, e[12] = 0, e[13] = 0, e[14] = o * i * 2 * u, e[15] = 0, e; } -function Zh (e, t, n, s, r) { +function Zh(e, t, n, s, r) { const i = 1 / Math.tan(t / 2); if (e[0] = i / n, e[1] = 0, e[2] = 0, e[3] = 0, e[4] = 0, e[5] = i, e[6] = 0, e[7] = 0, e[8] = 0, e[9] = 0, e[11] = -1, e[12] = 0, e[13] = 0, e[15] = 0, r != null && r !== 1 / 0) { const o = 1 / (s - r); e[10] = (r + s) * o, e[14] = 2 * r * s * o; - } else { e[10] = -1, e[14] = -2 * s; } + } else + e[10] = -1, e[14] = -2 * s; return e; } const tf = Zh; -function ef (e, t, n, s, r, i, o) { - const a = 1 / (t - n); const c = 1 / (s - r); const u = 1 / (i - o); +function ef(e, t, n, s, r, i, o) { + const a = 1 / (t - n), c = 1 / (s - r), u = 1 / (i - o); return e[0] = -2 * a, e[1] = 0, e[2] = 0, e[3] = 0, e[4] = 0, e[5] = -2 * c, e[6] = 0, e[7] = 0, e[8] = 0, e[9] = 0, e[10] = 2 * u, e[11] = 0, e[12] = (t + n) * a, e[13] = (r + s) * c, e[14] = (o + i) * u, e[15] = 1, e; } const nf = ef; -function sf (e, t, n, s) { +function sf(e, t, n, s) { let r, i, o, a, c, u, l, h, f, d; - const m = t[0]; const g = t[1]; const y = t[2]; const E = s[0]; const R = s[1]; const B = s[2]; const C = n[0]; const M = n[1]; const b = n[2]; + const m = t[0], g = t[1], y = t[2], E = s[0], R = s[1], B = s[2], C = n[0], M = n[1], b = n[2]; return Math.abs(m - C) < Fe && Math.abs(g - M) < Fe && Math.abs(y - b) < Fe ? Hh(e) : (h = m - C, f = g - M, d = y - b, r = 1 / Math.sqrt(h * h + f * f + d * d), h *= r, f *= r, d *= r, i = R * d - B * f, o = B * h - E * d, a = E * f - R * h, r = Math.sqrt(i * i + o * o + a * a), r ? (r = 1 / r, i *= r, o *= r, a *= r) : (i = 0, o = 0, a = 0), c = f * a - d * o, u = d * i - h * a, l = h * o - f * i, r = Math.sqrt(c * c + u * u + l * l), r ? (r = 1 / r, c *= r, u *= r, l *= r) : (c = 0, u = 0, l = 0), e[0] = i, e[1] = c, e[2] = h, e[3] = 0, e[4] = o, e[5] = u, e[6] = f, e[7] = 0, e[8] = a, e[9] = l, e[10] = d, e[11] = 0, e[12] = -(i * m + o * g + a * y), e[13] = -(c * m + u * g + l * y), e[14] = -(h * m + f * g + d * y), e[15] = 1, e); } -function rf () { +function rf() { const e = new It(4); return It != Float32Array && (e[0] = 0, e[1] = 0, e[2] = 0, e[3] = 0), e; } -function of (e, t, n) { +function of(e, t, n) { return e[0] = t[0] + n[0], e[1] = t[1] + n[1], e[2] = t[2] + n[2], e[3] = t[3] + n[3], e; } -function af (e, t, n) { +function af(e, t, n) { return e[0] = t[0] * n, e[1] = t[1] * n, e[2] = t[2] * n, e[3] = t[3] * n, e; } -function cf (e) { - const t = e[0]; const n = e[1]; const s = e[2]; const r = e[3]; +function cf(e) { + const t = e[0], n = e[1], s = e[2], r = e[3]; return Math.sqrt(t * t + n * n + s * s + r * r); } -function uf (e) { - const t = e[0]; const n = e[1]; const s = e[2]; const r = e[3]; +function uf(e) { + const t = e[0], n = e[1], s = e[2], r = e[3]; return t * t + n * n + s * s + r * r; } -function lf (e, t) { - const n = t[0]; const s = t[1]; const r = t[2]; const i = t[3]; +function lf(e, t) { + const n = t[0], s = t[1], r = t[2], i = t[3]; let o = n * n + s * s + r * r + i * i; return o > 0 && (o = 1 / Math.sqrt(o)), e[0] = n * o, e[1] = s * o, e[2] = r * o, e[3] = i * o, e; } -function hf (e, t) { +function hf(e, t) { return e[0] * t[0] + e[1] * t[1] + e[2] * t[2] + e[3] * t[3]; } -function ff (e, t, n, s) { - const r = t[0]; const i = t[1]; const o = t[2]; const a = t[3]; +function ff(e, t, n, s) { + const r = t[0], i = t[1], o = t[2], a = t[3]; return e[0] = r + s * (n[0] - r), e[1] = i + s * (n[1] - i), e[2] = o + s * (n[2] - o), e[3] = a + s * (n[3] - a), e; } -function df (e, t, n) { - const s = t[0]; const r = t[1]; const i = t[2]; const o = t[3]; +function df(e, t, n) { + const s = t[0], r = t[1], i = t[2], o = t[3]; return e[0] = n[0] * s + n[4] * r + n[8] * i + n[12] * o, e[1] = n[1] * s + n[5] * r + n[9] * i + n[13] * o, e[2] = n[2] * s + n[6] * r + n[10] * i + n[14] * o, e[3] = n[3] * s + n[7] * r + n[11] * i + n[15] * o, e; } -function mf (e, t, n) { - const s = t[0]; const r = t[1]; const i = t[2]; const o = n[0]; const a = n[1]; const c = n[2]; const u = n[3]; const l = u * s + a * i - c * r; const h = u * r + c * s - o * i; const f = u * i + o * r - a * s; const d = -o * s - a * r - c * i; +function mf(e, t, n) { + const s = t[0], r = t[1], i = t[2], o = n[0], a = n[1], c = n[2], u = n[3], l = u * s + a * i - c * r, h = u * r + c * s - o * i, f = u * i + o * r - a * s, d = -o * s - a * r - c * i; return e[0] = l * u + d * -o + h * -c - f * -a, e[1] = h * u + d * -a + f * -o - l * -c, e[2] = f * u + d * -c + l * -a - h * -o, e[3] = t[3], e; } -(function () { +(function() { const e = rf(); - return function (t, n, s, r, i, o) { + return function(t, n, s, r, i, o) { let a, c; - for (n || (n = 4), s || (s = 0), r ? c = Math.min(r * n + s, t.length) : c = t.length, a = s; a < c; a += n) { e[0] = t[a], e[1] = t[a + 1], e[2] = t[a + 2], e[3] = t[a + 3], i(e, e, o), t[a] = e[0], t[a + 1] = e[1], t[a + 2] = e[2], t[a + 3] = e[3]; } + for (n || (n = 4), s || (s = 0), r ? c = Math.min(r * n + s, t.length) : c = t.length, a = s; a < c; a += n) + e[0] = t[a], e[1] = t[a + 1], e[2] = t[a + 2], e[3] = t[a + 3], i(e, e, o), t[a] = e[0], t[a + 1] = e[1], t[a + 2] = e[2], t[a + 3] = e[3]; return t; }; })(); -let Ks; -(function (e) { - e[e.COL0ROW0 = 0] = 'COL0ROW0', e[e.COL0ROW1 = 1] = 'COL0ROW1', e[e.COL0ROW2 = 2] = 'COL0ROW2', e[e.COL0ROW3 = 3] = 'COL0ROW3', e[e.COL1ROW0 = 4] = 'COL1ROW0', e[e.COL1ROW1 = 5] = 'COL1ROW1', e[e.COL1ROW2 = 6] = 'COL1ROW2', e[e.COL1ROW3 = 7] = 'COL1ROW3', e[e.COL2ROW0 = 8] = 'COL2ROW0', e[e.COL2ROW1 = 9] = 'COL2ROW1', e[e.COL2ROW2 = 10] = 'COL2ROW2', e[e.COL2ROW3 = 11] = 'COL2ROW3', e[e.COL3ROW0 = 12] = 'COL3ROW0', e[e.COL3ROW1 = 13] = 'COL3ROW1', e[e.COL3ROW2 = 14] = 'COL3ROW2', e[e.COL3ROW3 = 15] = 'COL3ROW3'; +var Ks; +(function(e) { + e[e.COL0ROW0 = 0] = "COL0ROW0", e[e.COL0ROW1 = 1] = "COL0ROW1", e[e.COL0ROW2 = 2] = "COL0ROW2", e[e.COL0ROW3 = 3] = "COL0ROW3", e[e.COL1ROW0 = 4] = "COL1ROW0", e[e.COL1ROW1 = 5] = "COL1ROW1", e[e.COL1ROW2 = 6] = "COL1ROW2", e[e.COL1ROW3 = 7] = "COL1ROW3", e[e.COL2ROW0 = 8] = "COL2ROW0", e[e.COL2ROW1 = 9] = "COL2ROW1", e[e.COL2ROW2 = 10] = "COL2ROW2", e[e.COL2ROW3 = 11] = "COL2ROW3", e[e.COL3ROW0 = 12] = "COL3ROW0", e[e.COL3ROW1 = 13] = "COL3ROW1", e[e.COL3ROW2 = 14] = "COL3ROW2", e[e.COL3ROW3 = 15] = "COL3ROW3"; })(Ks || (Ks = {})); -const gf = 45 * Math.PI / 180; const Af = 1; const ds = 0.1; const ms = 500; const pf = Object.freeze([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]); +const gf = 45 * Math.PI / 180, Af = 1, ds = 0.1, ms = 500, pf = Object.freeze([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]); class V extends Ra { - static get IDENTITY () { + static get IDENTITY() { return Bf(); } - - static get ZERO () { + static get ZERO() { return yf(); } - - get ELEMENTS () { + get ELEMENTS() { return 16; } - - get RANK () { + get RANK() { return 4; } - - get INDICES () { + get INDICES() { return Ks; } - - constructor (t) { + constructor(t) { super(-0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0), arguments.length === 1 && Array.isArray(t) ? this.copy(t) : this.identity(); } - - copy (t) { + copy(t) { return this[0] = t[0], this[1] = t[1], this[2] = t[2], this[3] = t[3], this[4] = t[4], this[5] = t[5], this[6] = t[6], this[7] = t[7], this[8] = t[8], this[9] = t[9], this[10] = t[10], this[11] = t[11], this[12] = t[12], this[13] = t[13], this[14] = t[14], this[15] = t[15], this.check(); } - - set (t, n, s, r, i, o, a, c, u, l, h, f, d, m, g, y) { + set(t, n, s, r, i, o, a, c, u, l, h, f, d, m, g, y) { return this[0] = t, this[1] = n, this[2] = s, this[3] = r, this[4] = i, this[5] = o, this[6] = a, this[7] = c, this[8] = u, this[9] = l, this[10] = h, this[11] = f, this[12] = d, this[13] = m, this[14] = g, this[15] = y, this.check(); } - - setRowMajor (t, n, s, r, i, o, a, c, u, l, h, f, d, m, g, y) { + setRowMajor(t, n, s, r, i, o, a, c, u, l, h, f, d, m, g, y) { return this[0] = t, this[1] = i, this[2] = u, this[3] = d, this[4] = n, this[5] = o, this[6] = l, this[7] = m, this[8] = s, this[9] = a, this[10] = h, this[11] = g, this[12] = r, this[13] = c, this[14] = f, this[15] = y, this.check(); } - - toRowMajor (t) { + toRowMajor(t) { return t[0] = this[0], t[1] = this[4], t[2] = this[8], t[3] = this[12], t[4] = this[1], t[5] = this[5], t[6] = this[9], t[7] = this[13], t[8] = this[2], t[9] = this[6], t[10] = this[10], t[11] = this[14], t[12] = this[3], t[13] = this[7], t[14] = this[11], t[15] = this[15], t; } - - identity () { + identity() { return this.copy(pf); } - - fromObject (t) { + fromObject(t) { return this.check(); } - - fromQuaternion (t) { + fromQuaternion(t) { return Yh(this, t), this.check(); } - - frustum (t) { + frustum(t) { const { left: n, right: s, @@ -2817,8 +2690,7 @@ class V extends Ra { } = t; return a === 1 / 0 ? Cf(this, n, s, r, i, o) : $h(this, n, s, r, i, o, a), this.check(); } - - lookAt (t) { + lookAt(t) { const { eye: n, center: s = [0, 0, 0], @@ -2826,8 +2698,7 @@ class V extends Ra { } = t; return sf(this, n, s, r), this.check(); } - - ortho (t) { + ortho(t) { const { left: n, right: s, @@ -2838,8 +2709,7 @@ class V extends Ra { } = t; return nf(this, n, s, r, i, o, a), this.check(); } - - orthographic (t) { + orthographic(t) { const { fovy: n = gf, aspect: s = Af, @@ -2848,7 +2718,7 @@ class V extends Ra { far: o = ms } = t; Ai(n); - const a = n / 2; const c = r * Math.tan(a); const u = c * s; + const a = n / 2, c = r * Math.tan(a), u = c * s; return this.ortho({ left: -u, right: u, @@ -2858,8 +2728,7 @@ class V extends Ra { far: o }); } - - perspective (t) { + perspective(t) { const { fovy: n = 45 * Math.PI / 180, aspect: s = 1, @@ -2868,80 +2737,62 @@ class V extends Ra { } = t; return Ai(n), tf(this, n, s, r, i), this.check(); } - - determinant () { + determinant() { return jh(this); } - - getScale (t = [-0, -0, -0]) { + getScale(t = [-0, -0, -0]) { return t[0] = Math.sqrt(this[0] * this[0] + this[1] * this[1] + this[2] * this[2]), t[1] = Math.sqrt(this[4] * this[4] + this[5] * this[5] + this[6] * this[6]), t[2] = Math.sqrt(this[8] * this[8] + this[9] * this[9] + this[10] * this[10]), t; } - - getTranslation (t = [-0, -0, -0]) { + getTranslation(t = [-0, -0, -0]) { return t[0] = this[12], t[1] = this[13], t[2] = this[14], t; } - - getRotation (t, n) { + getRotation(t, n) { t = t || [-0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0], n = n || [-0, -0, -0]; - const s = this.getScale(n); const r = 1 / s[0]; const i = 1 / s[1]; const o = 1 / s[2]; + const s = this.getScale(n), r = 1 / s[0], i = 1 / s[1], o = 1 / s[2]; return t[0] = this[0] * r, t[1] = this[1] * i, t[2] = this[2] * o, t[3] = 0, t[4] = this[4] * r, t[5] = this[5] * i, t[6] = this[6] * o, t[7] = 0, t[8] = this[8] * r, t[9] = this[9] * i, t[10] = this[10] * o, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, t; } - - getRotationMatrix3 (t, n) { + getRotationMatrix3(t, n) { t = t || [-0, -0, -0, -0, -0, -0, -0, -0, -0], n = n || [-0, -0, -0]; - const s = this.getScale(n); const r = 1 / s[0]; const i = 1 / s[1]; const o = 1 / s[2]; + const s = this.getScale(n), r = 1 / s[0], i = 1 / s[1], o = 1 / s[2]; return t[0] = this[0] * r, t[1] = this[1] * i, t[2] = this[2] * o, t[3] = this[4] * r, t[4] = this[5] * i, t[5] = this[6] * o, t[6] = this[8] * r, t[7] = this[9] * i, t[8] = this[10] * o, t; } - - transpose () { + transpose() { return Jh(this, this), this.check(); } - - invert () { + invert() { return Vh(this, this), this.check(); } - - multiplyLeft (t) { + multiplyLeft(t) { return gi(this, t, this), this.check(); } - - multiplyRight (t) { + multiplyRight(t) { return gi(this, this, t), this.check(); } - - rotateX (t) { + rotateX(t) { return Wh(this, this, t), this.check(); } - - rotateY (t) { + rotateY(t) { return Xh(this, this, t), this.check(); } - - rotateZ (t) { + rotateZ(t) { return Qh(this, this, t), this.check(); } - - rotateXYZ (t) { + rotateXYZ(t) { return this.rotateX(t[0]).rotateY(t[1]).rotateZ(t[2]); } - - rotateAxis (t, n) { + rotateAxis(t, n) { return zh(this, this, t, n), this.check(); } - - scale (t) { + scale(t) { return Kh(this, this, Array.isArray(t) ? t : [t, t, t]), this.check(); } - - translate (t) { + translate(t) { return kh(this, this, t), this.check(); } - - transform (t, n) { + transform(t, n) { return t.length === 4 ? (n = df(n || [-0, -0, -0, -0], t, this), Oe(n, 4), n) : this.transformAsPoint(t, n); } - - transformAsPoint (t, n) { + transformAsPoint(t, n) { const { length: s } = t; @@ -2954,12 +2805,11 @@ class V extends Ra { r = Er(n || [-0, -0, -0], t, this); break; default: - throw new Error('Illegal vector'); + throw new Error("Illegal vector"); } return Oe(r, t.length), r; } - - transformAsVector (t, n) { + transformAsVector(t, n) { let s; switch (t.length) { case 2: @@ -2969,258 +2819,223 @@ class V extends Ra { s = Ca(n || [-0, -0, -0], t, this); break; default: - throw new Error('Illegal vector'); + throw new Error("Illegal vector"); } return Oe(s, t.length), s; } - - transformPoint (t, n) { + transformPoint(t, n) { return this.transformAsPoint(t, n); } - - transformVector (t, n) { + transformVector(t, n) { return this.transformAsPoint(t, n); } - - transformDirection (t, n) { + transformDirection(t, n) { return this.transformAsVector(t, n); } - - makeRotationX (t) { + makeRotationX(t) { return this.identity().rotateX(t); } - - makeTranslation (t, n, s) { + makeTranslation(t, n, s) { return this.identity().translate([t, n, s]); } } let rn, on; -function yf () { +function yf() { return rn || (rn = new V([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), Object.freeze(rn)), rn; } -function Bf () { +function Bf() { return on || (on = new V(), Object.freeze(on)), on; } -function Ai (e) { - if (e > Math.PI * 2) { throw Error('expected radians'); } +function Ai(e) { + if (e > Math.PI * 2) + throw Error("expected radians"); } -function Cf (e, t, n, s, r, i) { - const o = 2 * i / (n - t); const a = 2 * i / (r - s); const c = (n + t) / (n - t); const u = (r + s) / (r - s); const l = -1; const h = -1; const f = -2 * i; +function Cf(e, t, n, s, r, i) { + const o = 2 * i / (n - t), a = 2 * i / (r - s), c = (n + t) / (n - t), u = (r + s) / (r - s), l = -1, h = -1, f = -2 * i; return e[0] = o, e[1] = 0, e[2] = 0, e[3] = 0, e[4] = 0, e[5] = a, e[6] = 0, e[7] = 0, e[8] = c, e[9] = u, e[10] = l, e[11] = h, e[12] = 0, e[13] = 0, e[14] = f, e[15] = 0, e; } -function pi () { +function pi() { const e = new It(4); return It != Float32Array && (e[0] = 0, e[1] = 0, e[2] = 0), e[3] = 1, e; } -function Ef (e) { +function Ef(e) { return e[0] = 0, e[1] = 0, e[2] = 0, e[3] = 1, e; } -function Ma (e, t, n) { +function Ma(e, t, n) { n = n * 0.5; const s = Math.sin(n); return e[0] = s * t[0], e[1] = s * t[1], e[2] = s * t[2], e[3] = Math.cos(n), e; } -function yi (e, t, n) { - const s = t[0]; const r = t[1]; const i = t[2]; const o = t[3]; const a = n[0]; const c = n[1]; const u = n[2]; const l = n[3]; +function yi(e, t, n) { + const s = t[0], r = t[1], i = t[2], o = t[3], a = n[0], c = n[1], u = n[2], l = n[3]; return e[0] = s * l + o * a + r * u - i * c, e[1] = r * l + o * c + i * a - s * u, e[2] = i * l + o * u + s * c - r * a, e[3] = o * l - s * a - r * c - i * u, e; } -function Tf (e, t, n) { +function Tf(e, t, n) { n *= 0.5; - const s = t[0]; const r = t[1]; const i = t[2]; const o = t[3]; const a = Math.sin(n); const c = Math.cos(n); + const s = t[0], r = t[1], i = t[2], o = t[3], a = Math.sin(n), c = Math.cos(n); return e[0] = s * c + o * a, e[1] = r * c + i * a, e[2] = i * c - r * a, e[3] = o * c - s * a, e; } -function bf (e, t, n) { +function bf(e, t, n) { n *= 0.5; - const s = t[0]; const r = t[1]; const i = t[2]; const o = t[3]; const a = Math.sin(n); const c = Math.cos(n); + const s = t[0], r = t[1], i = t[2], o = t[3], a = Math.sin(n), c = Math.cos(n); return e[0] = s * c - i * a, e[1] = r * c + o * a, e[2] = i * c + s * a, e[3] = o * c - r * a, e; } -function _f (e, t, n) { +function _f(e, t, n) { n *= 0.5; - const s = t[0]; const r = t[1]; const i = t[2]; const o = t[3]; const a = Math.sin(n); const c = Math.cos(n); + const s = t[0], r = t[1], i = t[2], o = t[3], a = Math.sin(n), c = Math.cos(n); return e[0] = s * c + r * a, e[1] = r * c - s * a, e[2] = i * c + o * a, e[3] = o * c - i * a, e; } -function wf (e, t) { - const n = t[0]; const s = t[1]; const r = t[2]; +function wf(e, t) { + const n = t[0], s = t[1], r = t[2]; return e[0] = n, e[1] = s, e[2] = r, e[3] = Math.sqrt(Math.abs(1 - n * n - s * s - r * r)), e; } -function bn (e, t, n, s) { - const r = t[0]; const i = t[1]; const o = t[2]; const a = t[3]; - let c = n[0]; let u = n[1]; let l = n[2]; let h = n[3]; let f; let d; let m; let g; let y; +function bn(e, t, n, s) { + const r = t[0], i = t[1], o = t[2], a = t[3]; + let c = n[0], u = n[1], l = n[2], h = n[3], f, d, m, g, y; return f = r * c + i * u + o * l + a * h, f < 0 && (f = -f, c = -c, u = -u, l = -l, h = -h), 1 - f > Fe ? (d = Math.acos(f), y = Math.sin(d), m = Math.sin((1 - s) * d) / y, g = Math.sin(s * d) / y) : (m = 1 - s, g = s), e[0] = m * r + g * c, e[1] = m * i + g * u, e[2] = m * o + g * l, e[3] = m * a + g * h, e; } -function Rf (e, t) { - const n = t[0]; const s = t[1]; const r = t[2]; const i = t[3]; const o = n * n + s * s + r * r + i * i; const a = o ? 1 / o : 0; +function Rf(e, t) { + const n = t[0], s = t[1], r = t[2], i = t[3], o = n * n + s * s + r * r + i * i, a = o ? 1 / o : 0; return e[0] = -n * a, e[1] = -s * a, e[2] = -r * a, e[3] = i * a, e; } -function Mf (e, t) { +function Mf(e, t) { return e[0] = -t[0], e[1] = -t[1], e[2] = -t[2], e[3] = t[3], e; } -function Sa (e, t) { +function Sa(e, t) { const n = t[0] + t[4] + t[8]; let s; - if (n > 0) { s = Math.sqrt(n + 1), e[3] = 0.5 * s, s = 0.5 / s, e[0] = (t[5] - t[7]) * s, e[1] = (t[6] - t[2]) * s, e[2] = (t[1] - t[3]) * s; } else { + if (n > 0) + s = Math.sqrt(n + 1), e[3] = 0.5 * s, s = 0.5 / s, e[0] = (t[5] - t[7]) * s, e[1] = (t[6] - t[2]) * s, e[2] = (t[1] - t[3]) * s; + else { let r = 0; t[4] > t[0] && (r = 1), t[8] > t[r * 3 + r] && (r = 2); - const i = (r + 1) % 3; const o = (r + 2) % 3; + const i = (r + 1) % 3, o = (r + 2) % 3; s = Math.sqrt(t[r * 3 + r] - t[i * 3 + i] - t[o * 3 + o] + 1), e[r] = 0.5 * s, s = 0.5 / s, e[3] = (t[i * 3 + o] - t[o * 3 + i]) * s, e[i] = (t[i * 3 + r] + t[r * 3 + i]) * s, e[o] = (t[o * 3 + r] + t[r * 3 + o]) * s; } return e; } -const Sf = of; const If = af; const xf = hf; const vf = ff; const Of = cf; const Ff = uf; const Ia = lf; const Df = (function () { - const e = Ta(); const t = fi(1, 0, 0); const n = fi(0, 1, 0); - return function (s, r, i) { +const Sf = of, If = af, xf = hf, vf = ff, Of = cf, Ff = uf, Ia = lf, Df = function() { + const e = Ta(), t = fi(1, 0, 0), n = fi(0, 1, 0); + return function(s, r, i) { const o = Cr(r, i); return o < -0.999999 ? (Tn(e, t, r), Ih(e) < 1e-6 && Tn(e, n, r), _h(e, e), Ma(s, e, Math.PI), s) : o > 0.999999 ? (s[0] = 0, s[1] = 0, s[2] = 0, s[3] = 1, s) : (Tn(e, r, i), s[0] = e[0], s[1] = e[1], s[2] = e[2], s[3] = 1 + o, Ia(s, s)); }; -}()); -(function () { - const e = pi(); const t = pi(); - return function (n, s, r, i, o, a) { +}(); +(function() { + const e = pi(), t = pi(); + return function(n, s, r, i, o, a) { return bn(e, s, o, a), bn(t, r, i, a), bn(n, e, t, 2 * a * (1 - a)), n; }; })(); -(function () { +(function() { const e = xh(); - return function (t, n, s, r) { + return function(t, n, s, r) { return e[0] = s[0], e[3] = s[1], e[6] = s[2], e[1] = r[0], e[4] = r[1], e[7] = r[2], e[2] = -n[0], e[5] = -n[1], e[8] = -n[2], Ia(t, Sa(t, e)); }; })(); const Lf = [0, 0, 0, 1]; class On extends yr { - constructor (t = 0, n = 0, s = 0, r = 1) { + constructor(t = 0, n = 0, s = 0, r = 1) { super(-0, -0, -0, -0), Array.isArray(t) && arguments.length === 1 ? this.copy(t) : this.set(t, n, s, r); } - - copy (t) { + copy(t) { return this[0] = t[0], this[1] = t[1], this[2] = t[2], this[3] = t[3], this.check(); } - - set (t, n, s, r) { + set(t, n, s, r) { return this[0] = t, this[1] = n, this[2] = s, this[3] = r, this.check(); } - - fromObject (t) { + fromObject(t) { return this[0] = t.x, this[1] = t.y, this[2] = t.z, this[3] = t.w, this.check(); } - - fromMatrix3 (t) { + fromMatrix3(t) { return Sa(this, t), this.check(); } - - fromAxisRotation (t, n) { + fromAxisRotation(t, n) { return Ma(this, t, n), this.check(); } - - identity () { + identity() { return Ef(this), this.check(); } - - setAxisAngle (t, n) { + setAxisAngle(t, n) { return this.fromAxisRotation(t, n); } - - get ELEMENTS () { + get ELEMENTS() { return 4; } - - get x () { + get x() { return this[0]; } - - set x (t) { + set x(t) { this[0] = U(t); } - - get y () { + get y() { return this[1]; } - - set y (t) { + set y(t) { this[1] = U(t); } - - get z () { + get z() { return this[2]; } - - set z (t) { + set z(t) { this[2] = U(t); } - - get w () { + get w() { return this[3]; } - - set w (t) { + set w(t) { this[3] = U(t); } - - len () { + len() { return Of(this); } - - lengthSquared () { + lengthSquared() { return Ff(this); } - - dot (t) { + dot(t) { return xf(this, t); } - - rotationTo (t, n) { + rotationTo(t, n) { return Df(this, t, n), this.check(); } - - add (t) { + add(t) { return Sf(this, this, t), this.check(); } - - calculateW () { + calculateW() { return wf(this, this), this.check(); } - - conjugate () { + conjugate() { return Mf(this, this), this.check(); } - - invert () { + invert() { return Rf(this, this), this.check(); } - - lerp (t, n, s) { + lerp(t, n, s) { return s === void 0 ? this.lerp(this, t, n) : (vf(this, t, n, s), this.check()); } - - multiplyRight (t) { + multiplyRight(t) { return yi(this, this, t), this.check(); } - - multiplyLeft (t) { + multiplyLeft(t) { return yi(this, t, this), this.check(); } - - normalize () { - const t = this.len(); const n = t > 0 ? 1 / t : 0; + normalize() { + const t = this.len(), n = t > 0 ? 1 / t : 0; return this[0] = this[0] * n, this[1] = this[1] * n, this[2] = this[2] * n, this[3] = this[3] * n, t === 0 && (this[3] = 1), this.check(); } - - rotateX (t) { + rotateX(t) { return Tf(this, this, t), this.check(); } - - rotateY (t) { + rotateY(t) { return bf(this, this, t), this.check(); } - - rotateZ (t) { + rotateZ(t) { return _f(this, this, t), this.check(); } - - scale (t) { + scale(t) { return If(this, this, t), this.check(); } - - slerp (t, n, s) { + slerp(t, n, s) { let r, i, o; switch (arguments.length) { case 1: @@ -3238,138 +3053,131 @@ class On extends yr { } return bn(this, r, i, o), this.check(); } - - transformVector4 (t, n = new Tr()) { + transformVector4(t, n = new Tr()) { return mf(n, t, this), Oe(n, 4); } - - lengthSq () { + lengthSq() { return this.lengthSquared(); } - - setFromAxisAngle (t, n) { + setFromAxisAngle(t, n) { return this.setAxisAngle(t, n); } - - premultiply (t) { + premultiply(t) { return this.multiplyLeft(t); } - - multiply (t) { + multiply(t) { return this.multiplyRight(t); } } -function Ne (e) { - '@babel/helpers - typeof'; - return Ne = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' - ? function (t) { - return typeof t; - } - : function (t) { - return t && typeof Symbol === 'function' && t.constructor === Symbol && t !== Symbol.prototype ? 'symbol' : typeof t; - }, Ne(e); +function Ne(e) { + "@babel/helpers - typeof"; + return Ne = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(t) { + return typeof t; + } : function(t) { + return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t; + }, Ne(e); } -function Pf (e, t) { - if (Ne(e) != 'object' || !e) { return e; } - const n = e[Symbol.toPrimitive]; +function Pf(e, t) { + if (Ne(e) != "object" || !e) + return e; + var n = e[Symbol.toPrimitive]; if (n !== void 0) { - const s = n.call(e, t || 'default'); - if (Ne(s) != 'object') { return s; } - throw new TypeError('@@toPrimitive must return a primitive value.'); - } - return (t === 'string' ? String : Number)(e); -} -function Gf (e) { - const t = Pf(e, 'string'); - return Ne(t) == 'symbol' ? t : String(t); -} -function x (e, t, n) { - return t = Gf(t), t in e - ? Object.defineProperty(e, t, { - value: n, - enumerable: !0, - configurable: !0, - writable: !0 - }) - : e[t] = n, e; -} -const Nf = 0.1; const Uf = 1e-12; const xa = 1e-15; const Hf = 1e-20; const Jf = 6378137; const Vf = 6378137; const jf = 6356752314245179e-9; -function Xn (e) { + var s = n.call(e, t || "default"); + if (Ne(s) != "object") + return s; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return (t === "string" ? String : Number)(e); +} +function Gf(e) { + var t = Pf(e, "string"); + return Ne(t) == "symbol" ? t : String(t); +} +function x(e, t, n) { + return t = Gf(t), t in e ? Object.defineProperty(e, t, { + value: n, + enumerable: !0, + configurable: !0, + writable: !0 + }) : e[t] = n, e; +} +const Nf = 0.1, Uf = 1e-12, xa = 1e-15, Hf = 1e-20, Jf = 6378137, Vf = 6378137, jf = 6356752314245179e-9; +function Xn(e) { return e; } new A(); -function kf (e, t = [], n = Xn) { - return 'longitude' in e ? (t[0] = n(e.longitude), t[1] = n(e.latitude), t[2] = e.height) : 'x' in e ? (t[0] = n(e.x), t[1] = n(e.y), t[2] = e.z) : (t[0] = n(e[0]), t[1] = n(e[1]), t[2] = e[2]), t; +function kf(e, t = [], n = Xn) { + return "longitude" in e ? (t[0] = n(e.longitude), t[1] = n(e.latitude), t[2] = e.height) : "x" in e ? (t[0] = n(e.x), t[1] = n(e.y), t[2] = e.z) : (t[0] = n(e[0]), t[1] = n(e[1]), t[2] = e[2]), t; } -function Kf (e, t = []) { +function Kf(e, t = []) { return kf(e, t, et._cartographicRadians ? Xn : hh); } -function zf (e, t, n = Xn) { - return 'longitude' in t ? (t.longitude = n(e[0]), t.latitude = n(e[1]), t.height = e[2]) : 'x' in t ? (t.x = n(e[0]), t.y = n(e[1]), t.z = e[2]) : (t[0] = n(e[0]), t[1] = n(e[1]), t[2] = e[2]), t; +function zf(e, t, n = Xn) { + return "longitude" in t ? (t.longitude = n(e[0]), t.latitude = n(e[1]), t.height = e[2]) : "x" in t ? (t.x = n(e[0]), t.y = n(e[1]), t.z = e[2]) : (t[0] = n(e[0]), t[1] = n(e[1]), t[2] = e[2]), t; } -function Wf (e, t) { +function Wf(e, t) { return zf(e, t, et._cartographicRadians ? Xn : fh); } -const Bi = 1e-14; const Xf = new A(); const Ci = { +const Bi = 1e-14, Xf = new A(), Ci = { up: { - south: 'east', - north: 'west', - west: 'south', - east: 'north' + south: "east", + north: "west", + west: "south", + east: "north" }, down: { - south: 'west', - north: 'east', - west: 'north', - east: 'south' + south: "west", + north: "east", + west: "north", + east: "south" }, south: { - up: 'west', - down: 'east', - west: 'down', - east: 'up' + up: "west", + down: "east", + west: "down", + east: "up" }, north: { - up: 'east', - down: 'west', - west: 'up', - east: 'down' + up: "east", + down: "west", + west: "up", + east: "down" }, west: { - up: 'north', - down: 'south', - north: 'down', - south: 'up' + up: "north", + down: "south", + north: "down", + south: "up" }, east: { - up: 'south', - down: 'north', - north: 'up', - south: 'down' + up: "south", + down: "north", + north: "up", + south: "down" } -}; const gs = { +}, gs = { north: [-1, 0, 0], east: [0, 1, 0], up: [0, 0, 1], south: [1, 0, 0], west: [0, -1, 0], down: [0, 0, -1] -}; const Te = { +}, Te = { east: new A(), north: new A(), up: new A(), west: new A(), south: new A(), down: new A() -}; const Qf = new A(); const qf = new A(); const Yf = new A(); -function Ei (e, t, n, s, r, i) { +}, Qf = new A(), qf = new A(), Yf = new A(); +function Ei(e, t, n, s, r, i) { const o = Ci[t] && Ci[t][n]; j(o && (!s || s === o)); let a, c, u; const l = Xf.copy(r); if (Kt(l.x, 0, Bi) && Kt(l.y, 0, Bi)) { const f = Math.sign(l.z); - a = Qf.fromArray(gs[t]), t !== 'east' && t !== 'west' && a.scale(f), c = qf.fromArray(gs[n]), n !== 'east' && n !== 'west' && c.scale(f), u = Yf.fromArray(gs[s]), s !== 'east' && s !== 'west' && u.scale(f); + a = Qf.fromArray(gs[t]), t !== "east" && t !== "west" && a.scale(f), c = qf.fromArray(gs[n]), n !== "east" && n !== "west" && c.scale(f), u = Yf.fromArray(gs[s]), s !== "east" && s !== "west" && u.scale(f); } else { const { up: f, @@ -3386,107 +3194,97 @@ function Ei (e, t, n, s, r, i) { } return i[0] = a.x, i[1] = a.y, i[2] = a.z, i[3] = 0, i[4] = c.x, i[5] = c.y, i[6] = c.z, i[7] = 0, i[8] = u.x, i[9] = u.y, i[10] = u.z, i[11] = 0, i[12] = l.x, i[13] = l.y, i[14] = l.z, i[15] = 1, i; } -const ue = new A(); const $f = new A(); const Zf = new A(); -function td (e, t, n = []) { +const ue = new A(), $f = new A(), Zf = new A(); +function td(e, t, n = []) { const { oneOverRadii: s, oneOverRadiiSquared: r, centerToleranceSquared: i } = t; ue.from(e); - const o = ue.x; const a = ue.y; const c = ue.z; const u = s.x; const l = s.y; const h = s.z; const f = o * o * u * u; const d = a * a * l * l; const m = c * c * h * h; const g = f + d + m; const y = Math.sqrt(1 / g); - if (!Number.isFinite(y)) { return; } + const o = ue.x, a = ue.y, c = ue.z, u = s.x, l = s.y, h = s.z, f = o * o * u * u, d = a * a * l * l, m = c * c * h * h, g = f + d + m, y = Math.sqrt(1 / g); + if (!Number.isFinite(y)) + return; const E = $f; - if (E.copy(e).scale(y), g < i) { return E.to(n); } - const R = r.x; const B = r.y; const C = r.z; const M = Zf; + if (E.copy(e).scale(y), g < i) + return E.to(n); + const R = r.x, B = r.y, C = r.z, M = Zf; M.set(E.x * R * 2, E.y * B * 2, E.z * C * 2); - let b = (1 - y) * ue.len() / (0.5 * M.len()); let O = 0; let F; let v; let L; let k; + let b = (1 - y) * ue.len() / (0.5 * M.len()), O = 0, F, v, L, k; do { b -= O, F = 1 / (1 + b * R), v = 1 / (1 + b * B), L = 1 / (1 + b * C); - const q = F * F; const Y = v * v; const P = L * L; const ct = q * F; const Wt = Y * v; const oe = P * L; + const q = F * F, Y = v * v, P = L * L, ct = q * F, Wt = Y * v, oe = P * L; k = f * q + d * Y + m * P - 1; const vt = -2 * (f * ct * R + d * Wt * B + m * oe * C); O = k / vt; } while (Math.abs(k) > Uf); return ue.scale([F, v, L]).to(n); } -const an = new A(); const Ti = new A(); const ed = new A(); const wt = new A(); const nd = new A(); const cn = new A(); +const an = new A(), Ti = new A(), ed = new A(), wt = new A(), nd = new A(), cn = new A(); class J { - constructor (t = 0, n = 0, s = 0) { - x(this, 'radii', void 0), x(this, 'radiiSquared', void 0), x(this, 'radiiToTheFourth', void 0), x(this, 'oneOverRadii', void 0), x(this, 'oneOverRadiiSquared', void 0), x(this, 'minimumRadius', void 0), x(this, 'maximumRadius', void 0), x(this, 'centerToleranceSquared', Nf), x(this, 'squaredXOverSquaredZ', void 0), j(t >= 0), j(n >= 0), j(s >= 0), this.radii = new A(t, n, s), this.radiiSquared = new A(t * t, n * n, s * s), this.radiiToTheFourth = new A(t * t * t * t, n * n * n * n, s * s * s * s), this.oneOverRadii = new A(t === 0 ? 0 : 1 / t, n === 0 ? 0 : 1 / n, s === 0 ? 0 : 1 / s), this.oneOverRadiiSquared = new A(t === 0 ? 0 : 1 / (t * t), n === 0 ? 0 : 1 / (n * n), s === 0 ? 0 : 1 / (s * s)), this.minimumRadius = Math.min(t, n, s), this.maximumRadius = Math.max(t, n, s), this.radiiSquared.z !== 0 && (this.squaredXOverSquaredZ = this.radiiSquared.x / this.radiiSquared.z), Object.freeze(this); + constructor(t = 0, n = 0, s = 0) { + x(this, "radii", void 0), x(this, "radiiSquared", void 0), x(this, "radiiToTheFourth", void 0), x(this, "oneOverRadii", void 0), x(this, "oneOverRadiiSquared", void 0), x(this, "minimumRadius", void 0), x(this, "maximumRadius", void 0), x(this, "centerToleranceSquared", Nf), x(this, "squaredXOverSquaredZ", void 0), j(t >= 0), j(n >= 0), j(s >= 0), this.radii = new A(t, n, s), this.radiiSquared = new A(t * t, n * n, s * s), this.radiiToTheFourth = new A(t * t * t * t, n * n * n * n, s * s * s * s), this.oneOverRadii = new A(t === 0 ? 0 : 1 / t, n === 0 ? 0 : 1 / n, s === 0 ? 0 : 1 / s), this.oneOverRadiiSquared = new A(t === 0 ? 0 : 1 / (t * t), n === 0 ? 0 : 1 / (n * n), s === 0 ? 0 : 1 / (s * s)), this.minimumRadius = Math.min(t, n, s), this.maximumRadius = Math.max(t, n, s), this.radiiSquared.z !== 0 && (this.squaredXOverSquaredZ = this.radiiSquared.x / this.radiiSquared.z), Object.freeze(this); } - - equals (t) { + equals(t) { return this === t || !!(t && this.radii.equals(t.radii)); } - - toString () { + toString() { return this.radii.toString(); } - - cartographicToCartesian (t, n = [0, 0, 0]) { - const s = Ti; const r = ed; const [, , i] = t; + cartographicToCartesian(t, n = [0, 0, 0]) { + const s = Ti, r = ed, [, , i] = t; this.geodeticSurfaceNormalCartographic(t, s), r.copy(this.radiiSquared).scale(s); const o = Math.sqrt(s.dot(r)); return r.scale(1 / o), s.scale(i), r.add(s), r.to(n); } - - cartesianToCartographic (t, n = [0, 0, 0]) { + cartesianToCartographic(t, n = [0, 0, 0]) { cn.from(t); const s = this.scaleToGeodeticSurface(cn, wt); - if (!s) { return; } - const r = this.geodeticSurfaceNormal(s, Ti); const i = nd; + if (!s) + return; + const r = this.geodeticSurfaceNormal(s, Ti), i = nd; i.copy(cn).subtract(s); - const o = Math.atan2(r.y, r.x); const a = Math.asin(r.z); const c = Math.sign(Cr(i, cn)) * ba(i); + const o = Math.atan2(r.y, r.x), a = Math.asin(r.z), c = Math.sign(Cr(i, cn)) * ba(i); return Wf([o, a, c], n); } - - eastNorthUpToFixedFrame (t, n = new V()) { - return Ei(this, 'east', 'north', 'up', t, n); + eastNorthUpToFixedFrame(t, n = new V()) { + return Ei(this, "east", "north", "up", t, n); } - - localFrameToFixedFrame (t, n, s, r, i = new V()) { + localFrameToFixedFrame(t, n, s, r, i = new V()) { return Ei(this, t, n, s, r, i); } - - geocentricSurfaceNormal (t, n = [0, 0, 0]) { + geocentricSurfaceNormal(t, n = [0, 0, 0]) { return an.from(t).normalize().to(n); } - - geodeticSurfaceNormalCartographic (t, n = [0, 0, 0]) { - const s = Kf(t); const r = s[0]; const i = s[1]; const o = Math.cos(i); + geodeticSurfaceNormalCartographic(t, n = [0, 0, 0]) { + const s = Kf(t), r = s[0], i = s[1], o = Math.cos(i); return an.set(o * Math.cos(r), o * Math.sin(r), Math.sin(i)).normalize(), an.to(n); } - - geodeticSurfaceNormal (t, n = [0, 0, 0]) { + geodeticSurfaceNormal(t, n = [0, 0, 0]) { return an.from(t).scale(this.oneOverRadiiSquared).normalize().to(n); } - - scaleToGeodeticSurface (t, n) { + scaleToGeodeticSurface(t, n) { return td(t, this, n); } - - scaleToGeocentricSurface (t, n = [0, 0, 0]) { + scaleToGeocentricSurface(t, n = [0, 0, 0]) { wt.from(t); - const s = wt.x; const r = wt.y; const i = wt.z; const o = this.oneOverRadiiSquared; const a = 1 / Math.sqrt(s * s * o.x + r * r * o.y + i * i * o.z); + const s = wt.x, r = wt.y, i = wt.z, o = this.oneOverRadiiSquared, a = 1 / Math.sqrt(s * s * o.x + r * r * o.y + i * i * o.z); return wt.multiplyScalar(a).to(n); } - - transformPositionToScaledSpace (t, n = [0, 0, 0]) { + transformPositionToScaledSpace(t, n = [0, 0, 0]) { return wt.from(t).scale(this.oneOverRadii).to(n); } - - transformPositionFromScaledSpace (t, n = [0, 0, 0]) { + transformPositionFromScaledSpace(t, n = [0, 0, 0]) { return wt.from(t).scale(this.radii).to(n); } - - getSurfaceNormalIntersectionWithZAxis (t, n = 0, s = [0, 0, 0]) { + getSurfaceNormalIntersectionWithZAxis(t, n = 0, s = [0, 0, 0]) { j(Kt(this.radii.x, this.radii.y, xa)), j(this.radii.z > 0), wt.from(t); const r = wt.z * (1 - this.squaredXOverSquaredZ); - if (!(Math.abs(r) >= this.radii.z - n)) { return wt.set(0, 0, r).to(s); } + if (!(Math.abs(r) >= this.radii.z - n)) + return wt.set(0, 0, r).to(s); } } -x(J, 'WGS84', new J(Jf, Vf, jf)); +x(J, "WGS84", new J(Jf, Vf, jf)); const pt = { OUTSIDE: -1, INTERSECTING: 0, @@ -3494,63 +3292,55 @@ const pt = { }; new A(); new A(); -const be = new A(); const bi = new A(); +const be = new A(), bi = new A(); class Qe { - constructor (t = [0, 0, 0], n = 0) { - x(this, 'center', void 0), x(this, 'radius', void 0), this.radius = -0, this.center = new A(), this.fromCenterRadius(t, n); + constructor(t = [0, 0, 0], n = 0) { + x(this, "center", void 0), x(this, "radius", void 0), this.radius = -0, this.center = new A(), this.fromCenterRadius(t, n); } - - fromCenterRadius (t, n) { + fromCenterRadius(t, n) { return this.center.from(t), this.radius = n, this; } - - fromCornerPoints (t, n) { + fromCornerPoints(t, n) { return n = be.from(n), this.center = new A().from(t).add(n).scale(0.5), this.radius = this.center.distance(n), this; } - - equals (t) { + equals(t) { return this === t || !!t && this.center.equals(t.center) && this.radius === t.radius; } - - clone () { + clone() { return new Qe(this.center, this.radius); } - - union (t) { - const n = this.center; const s = this.radius; const r = t.center; const i = t.radius; const o = be.copy(r).subtract(n); const a = o.magnitude(); - if (s >= a + i) { return this.clone(); } - if (i >= a + s) { return t.clone(); } + union(t) { + const n = this.center, s = this.radius, r = t.center, i = t.radius, o = be.copy(r).subtract(n), a = o.magnitude(); + if (s >= a + i) + return this.clone(); + if (i >= a + s) + return t.clone(); const c = (s + a + i) * 0.5; return bi.copy(o).scale((-s + c) / a).add(n), this.center.copy(bi), this.radius = c, this; } - - expand (t) { + expand(t) { const s = be.from(t).subtract(this.center).magnitude(); return s > this.radius && (this.radius = s), this; } - - transform (t) { + transform(t) { this.center.transform(t); const n = qh(be, t); return this.radius = Math.max(n[0], Math.max(n[1], n[2])) * this.radius, this; } - - distanceSquaredTo (t) { + distanceSquaredTo(t) { const n = this.distanceTo(t); return n * n; } - - distanceTo (t) { + distanceTo(t) { const s = be.from(t).subtract(this.center); return Math.max(0, s.len() - this.radius); } - - intersectPlane (t) { - const n = this.center; const s = this.radius; const i = t.normal.dot(n) + t.distance; + intersectPlane(t) { + const n = this.center, s = this.radius, i = t.normal.dot(n) + t.distance; return i < -s ? pt.OUTSIDE : i < s ? pt.INTERSECTING : pt.INSIDE; } } -const sd = new A(); const rd = new A(); const un = new A(); const ln = new A(); const hn = new A(); const id = new A(); const od = new A(); const Gt = { +const sd = new A(), rd = new A(), un = new A(), ln = new A(), hn = new A(), id = new A(), od = new A(), Gt = { COLUMN0ROW0: 0, COLUMN0ROW1: 1, COLUMN0ROW2: 2, @@ -3562,62 +3352,51 @@ const sd = new A(); const rd = new A(); const un = new A(); const ln = new A(); COLUMN2ROW2: 8 }; class qe { - constructor (t = [0, 0, 0], n = [0, 0, 0, 0, 0, 0, 0, 0, 0]) { - x(this, 'center', void 0), x(this, 'halfAxes', void 0), this.center = new A().from(t), this.halfAxes = new X(n); + constructor(t = [0, 0, 0], n = [0, 0, 0, 0, 0, 0, 0, 0, 0]) { + x(this, "center", void 0), x(this, "halfAxes", void 0), this.center = new A().from(t), this.halfAxes = new X(n); } - - get halfSize () { - const t = this.halfAxes.getColumn(0); const n = this.halfAxes.getColumn(1); const s = this.halfAxes.getColumn(2); + get halfSize() { + const t = this.halfAxes.getColumn(0), n = this.halfAxes.getColumn(1), s = this.halfAxes.getColumn(2); return [new A(t).len(), new A(n).len(), new A(s).len()]; } - - get quaternion () { - const t = this.halfAxes.getColumn(0); const n = this.halfAxes.getColumn(1); const s = this.halfAxes.getColumn(2); const r = new A(t).normalize(); const i = new A(n).normalize(); const o = new A(s).normalize(); + get quaternion() { + const t = this.halfAxes.getColumn(0), n = this.halfAxes.getColumn(1), s = this.halfAxes.getColumn(2), r = new A(t).normalize(), i = new A(n).normalize(), o = new A(s).normalize(); return new On().fromMatrix3(new X([...r, ...i, ...o])); } - - fromCenterHalfSizeQuaternion (t, n, s) { - const r = new On(s); const i = new X().fromQuaternion(r); + fromCenterHalfSizeQuaternion(t, n, s) { + const r = new On(s), i = new X().fromQuaternion(r); return i[0] = i[0] * n[0], i[1] = i[1] * n[0], i[2] = i[2] * n[0], i[3] = i[3] * n[1], i[4] = i[4] * n[1], i[5] = i[5] * n[1], i[6] = i[6] * n[2], i[7] = i[7] * n[2], i[8] = i[8] * n[2], this.center = new A().from(t), this.halfAxes = i, this; } - - clone () { + clone() { return new qe(this.center, this.halfAxes); } - - equals (t) { + equals(t) { return this === t || !!t && this.center.equals(t.center) && this.halfAxes.equals(t.halfAxes); } - - getBoundingSphere (t = new Qe()) { - const n = this.halfAxes; const s = n.getColumn(0, un); const r = n.getColumn(1, ln); const i = n.getColumn(2, hn); const o = sd.copy(s).add(r).add(i); + getBoundingSphere(t = new Qe()) { + const n = this.halfAxes, s = n.getColumn(0, un), r = n.getColumn(1, ln), i = n.getColumn(2, hn), o = sd.copy(s).add(r).add(i); return t.center.copy(this.center), t.radius = o.magnitude(), t; } - - intersectPlane (t) { - const n = this.center; const s = t.normal; const r = this.halfAxes; const i = s.x; const o = s.y; const a = s.z; const c = Math.abs(i * r[Gt.COLUMN0ROW0] + o * r[Gt.COLUMN0ROW1] + a * r[Gt.COLUMN0ROW2]) + Math.abs(i * r[Gt.COLUMN1ROW0] + o * r[Gt.COLUMN1ROW1] + a * r[Gt.COLUMN1ROW2]) + Math.abs(i * r[Gt.COLUMN2ROW0] + o * r[Gt.COLUMN2ROW1] + a * r[Gt.COLUMN2ROW2]); const u = s.dot(n) + t.distance; + intersectPlane(t) { + const n = this.center, s = t.normal, r = this.halfAxes, i = s.x, o = s.y, a = s.z, c = Math.abs(i * r[Gt.COLUMN0ROW0] + o * r[Gt.COLUMN0ROW1] + a * r[Gt.COLUMN0ROW2]) + Math.abs(i * r[Gt.COLUMN1ROW0] + o * r[Gt.COLUMN1ROW1] + a * r[Gt.COLUMN1ROW2]) + Math.abs(i * r[Gt.COLUMN2ROW0] + o * r[Gt.COLUMN2ROW1] + a * r[Gt.COLUMN2ROW2]), u = s.dot(n) + t.distance; return u <= -c ? pt.OUTSIDE : u >= c ? pt.INSIDE : pt.INTERSECTING; } - - distanceTo (t) { + distanceTo(t) { return Math.sqrt(this.distanceSquaredTo(t)); } - - distanceSquaredTo (t) { - const n = rd.from(t).subtract(this.center); const s = this.halfAxes; const r = s.getColumn(0, un); const i = s.getColumn(1, ln); const o = s.getColumn(2, hn); const a = r.magnitude(); const c = i.magnitude(); const u = o.magnitude(); + distanceSquaredTo(t) { + const n = rd.from(t).subtract(this.center), s = this.halfAxes, r = s.getColumn(0, un), i = s.getColumn(1, ln), o = s.getColumn(2, hn), a = r.magnitude(), c = i.magnitude(), u = o.magnitude(); r.normalize(), i.normalize(), o.normalize(); - let l = 0; let h; + let l = 0, h; return h = Math.abs(n.dot(r)) - a, h > 0 && (l += h * h), h = Math.abs(n.dot(i)) - c, h > 0 && (l += h * h), h = Math.abs(n.dot(o)) - u, h > 0 && (l += h * h), l; } - - computePlaneDistances (t, n, s = [-0, -0]) { - let r = Number.POSITIVE_INFINITY; let i = Number.NEGATIVE_INFINITY; - const o = this.center; const a = this.halfAxes; const c = a.getColumn(0, un); const u = a.getColumn(1, ln); const l = a.getColumn(2, hn); const h = id.copy(c).add(u).add(l).add(o); const f = od.copy(h).subtract(t); + computePlaneDistances(t, n, s = [-0, -0]) { + let r = Number.POSITIVE_INFINITY, i = Number.NEGATIVE_INFINITY; + const o = this.center, a = this.halfAxes, c = a.getColumn(0, un), u = a.getColumn(1, ln), l = a.getColumn(2, hn), h = id.copy(c).add(u).add(l).add(o), f = od.copy(h).subtract(t); let d = n.dot(f); return r = Math.min(d, r), i = Math.max(d, i), h.copy(o).add(c).add(u).subtract(l), f.copy(h).subtract(t), d = n.dot(f), r = Math.min(d, r), i = Math.max(d, i), h.copy(o).add(c).subtract(u).add(l), f.copy(h).subtract(t), d = n.dot(f), r = Math.min(d, r), i = Math.max(d, i), h.copy(o).add(c).subtract(u).subtract(l), f.copy(h).subtract(t), d = n.dot(f), r = Math.min(d, r), i = Math.max(d, i), o.copy(h).subtract(c).add(u).add(l), f.copy(h).subtract(t), d = n.dot(f), r = Math.min(d, r), i = Math.max(d, i), o.copy(h).subtract(c).add(u).subtract(l), f.copy(h).subtract(t), d = n.dot(f), r = Math.min(d, r), i = Math.max(d, i), o.copy(h).subtract(c).subtract(u).add(l), f.copy(h).subtract(t), d = n.dot(f), r = Math.min(d, r), i = Math.max(d, i), o.copy(h).subtract(c).subtract(u).subtract(l), f.copy(h).subtract(t), d = n.dot(f), r = Math.min(d, r), i = Math.max(d, i), s[0] = r, s[1] = i, s; } - - transform (t) { + transform(t) { this.center.transformAsPoint(t); const n = this.halfAxes.getColumn(0, un); n.transformAsPoint(t); @@ -3626,77 +3405,66 @@ class qe { const r = this.halfAxes.getColumn(2, hn); return r.transformAsPoint(t), this.halfAxes = new X([...n, ...s, ...r]), this; } - - getTransform () { - throw new Error('not implemented'); + getTransform() { + throw new Error("not implemented"); } } -const _i = new A(); const wi = new A(); +const _i = new A(), wi = new A(); class nt { - constructor (t = [0, 0, 1], n = 0) { - x(this, 'normal', void 0), x(this, 'distance', void 0), this.normal = new A(), this.distance = -0, this.fromNormalDistance(t, n); + constructor(t = [0, 0, 1], n = 0) { + x(this, "normal", void 0), x(this, "distance", void 0), this.normal = new A(), this.distance = -0, this.fromNormalDistance(t, n); } - - fromNormalDistance (t, n) { + fromNormalDistance(t, n) { return j(Number.isFinite(n)), this.normal.from(t).normalize(), this.distance = n, this; } - - fromPointNormal (t, n) { + fromPointNormal(t, n) { t = _i.from(t), this.normal.from(n).normalize(); const s = -this.normal.dot(t); return this.distance = s, this; } - - fromCoefficients (t, n, s, r) { + fromCoefficients(t, n, s, r) { return this.normal.set(t, n, s), j(Kt(this.normal.len(), 1)), this.distance = r, this; } - - clone () { + clone() { return new nt(this.normal, this.distance); } - - equals (t) { + equals(t) { return Kt(this.distance, t.distance) && Kt(this.normal, t.normal); } - - getPointDistance (t) { + getPointDistance(t) { return this.normal.dot(t) + this.distance; } - - transform (t) { - const n = wi.copy(this.normal).transformAsVector(t).normalize(); const s = this.normal.scale(-this.distance).transform(t); + transform(t) { + const n = wi.copy(this.normal).transformAsVector(t).normalize(), s = this.normal.scale(-this.distance).transform(t); return this.fromPointNormal(s, n); } - - projectPointOntoPlane (t, n = [0, 0, 0]) { - const s = _i.from(t); const r = this.getPointDistance(s); const i = wi.copy(this.normal).scale(r); + projectPointOntoPlane(t, n = [0, 0, 0]) { + const s = _i.from(t), r = this.getPointDistance(s), i = wi.copy(this.normal).scale(r); return s.subtract(i).to(n); } } -const Ri = [new A([1, 0, 0]), new A([0, 1, 0]), new A([0, 0, 1])]; const Mi = new A(); const ad = new A(); +const Ri = [new A([1, 0, 0]), new A([0, 1, 0]), new A([0, 0, 1])], Mi = new A(), ad = new A(); class dt { - constructor (t = []) { - x(this, 'planes', void 0), this.planes = t; + constructor(t = []) { + x(this, "planes", void 0), this.planes = t; } - - fromBoundingSphere (t) { + fromBoundingSphere(t) { this.planes.length = 2 * Ri.length; - const n = t.center; const s = t.radius; + const n = t.center, s = t.radius; let r = 0; for (const i of Ri) { - let o = this.planes[r]; let a = this.planes[r + 1]; + let o = this.planes[r], a = this.planes[r + 1]; o || (o = this.planes[r] = new nt()), a || (a = this.planes[r + 1] = new nt()); const c = Mi.copy(i).scale(-s).add(n); o.fromPointNormal(c, i); - const u = Mi.copy(i).scale(s).add(n); const l = ad.copy(i).negate(); + const u = Mi.copy(i).scale(s).add(n), l = ad.copy(i).negate(); a.fromPointNormal(u, l), r += 2; } return this; } - - computeVisibility (t) { + computeVisibility(t) { let n = pt.INSIDE; - for (const s of this.planes) { + for (const s of this.planes) switch (t.intersectPlane(s)) { case pt.OUTSIDE: return pt.OUTSIDE; @@ -3704,39 +3472,39 @@ class dt { n = pt.INTERSECTING; break; } - } return n; } - - computeVisibilityWithPlaneMask (t, n) { - if (j(Number.isFinite(n), 'parentPlaneMask is required.'), n === dt.MASK_OUTSIDE || n === dt.MASK_INSIDE) { return n; } + computeVisibilityWithPlaneMask(t, n) { + if (j(Number.isFinite(n), "parentPlaneMask is required."), n === dt.MASK_OUTSIDE || n === dt.MASK_INSIDE) + return n; let s = dt.MASK_INSIDE; const r = this.planes; for (let i = 0; i < this.planes.length; ++i) { const o = i < 31 ? 1 << i : 0; - if (i < 31 && !(n & o)) { continue; } - const a = r[i]; const c = t.intersectPlane(a); - if (c === pt.OUTSIDE) { return dt.MASK_OUTSIDE; } + if (i < 31 && !(n & o)) + continue; + const a = r[i], c = t.intersectPlane(a); + if (c === pt.OUTSIDE) + return dt.MASK_OUTSIDE; c === pt.INTERSECTING && (s |= o); } return s; } } -x(dt, 'MASK_OUTSIDE', 4294967295); -x(dt, 'MASK_INSIDE', 0); -x(dt, 'MASK_INDETERMINATE', 2147483647); -const cd = new A(); const ud = new A(); const ld = new A(); const hd = new A(); const fd = new A(); +x(dt, "MASK_OUTSIDE", 4294967295); +x(dt, "MASK_INSIDE", 0); +x(dt, "MASK_INDETERMINATE", 2147483647); +const cd = new A(), ud = new A(), ld = new A(), hd = new A(), fd = new A(); class Fn { - constructor (t = {}) { - x(this, 'left', void 0), x(this, '_left', void 0), x(this, 'right', void 0), x(this, '_right', void 0), x(this, 'top', void 0), x(this, '_top', void 0), x(this, 'bottom', void 0), x(this, '_bottom', void 0), x(this, 'near', void 0), x(this, '_near', void 0), x(this, 'far', void 0), x(this, '_far', void 0), x(this, '_cullingVolume', new dt([new nt(), new nt(), new nt(), new nt(), new nt(), new nt()])), x(this, '_perspectiveMatrix', new V()), x(this, '_infinitePerspective', new V()); + constructor(t = {}) { + x(this, "left", void 0), x(this, "_left", void 0), x(this, "right", void 0), x(this, "_right", void 0), x(this, "top", void 0), x(this, "_top", void 0), x(this, "bottom", void 0), x(this, "_bottom", void 0), x(this, "near", void 0), x(this, "_near", void 0), x(this, "far", void 0), x(this, "_far", void 0), x(this, "_cullingVolume", new dt([new nt(), new nt(), new nt(), new nt(), new nt(), new nt()])), x(this, "_perspectiveMatrix", new V()), x(this, "_infinitePerspective", new V()); const { near: n = 1, far: s = 5e8 } = t; this.left = t.left, this._left = void 0, this.right = t.right, this._right = void 0, this.top = t.top, this._top = void 0, this.bottom = t.bottom, this._bottom = void 0, this.near = n, this._near = n, this.far = s, this._far = s; } - - clone () { + clone() { return new Fn({ right: this.right, left: this.left, @@ -3746,29 +3514,24 @@ class Fn { far: this.far }); } - - equals (t) { + equals(t) { return t && t instanceof Fn && this.right === t.right && this.left === t.left && this.top === t.top && this.bottom === t.bottom && this.near === t.near && this.far === t.far; } - - get projectionMatrix () { + get projectionMatrix() { return this._update(), this._perspectiveMatrix; } - - get infiniteProjectionMatrix () { + get infiniteProjectionMatrix() { return this._update(), this._infinitePerspective; } - - computeCullingVolume (t, n, s) { - j(t, 'position is required.'), j(n, 'direction is required.'), j(s, 'up is required.'); + computeCullingVolume(t, n, s) { + j(t, "position is required."), j(n, "direction is required."), j(s, "up is required."); const r = this._cullingVolume.planes; s = cd.copy(s).normalize(); - const i = ud.copy(n).cross(s).normalize(); const o = ld.copy(n).multiplyByScalar(this.near).add(t); const a = hd.copy(n).multiplyByScalar(this.far).add(t); + const i = ud.copy(n).cross(s).normalize(), o = ld.copy(n).multiplyByScalar(this.near).add(t), a = hd.copy(n).multiplyByScalar(this.far).add(t); let c = fd; return c.copy(i).multiplyByScalar(this.left).add(o).subtract(t).cross(s), r[0].fromPointNormal(t, c), c.copy(i).multiplyByScalar(this.right).add(o).subtract(t).cross(s).negate(), r[1].fromPointNormal(t, c), c.copy(s).multiplyByScalar(this.bottom).add(o).subtract(t).cross(i).negate(), r[2].fromPointNormal(t, c), c.copy(s).multiplyByScalar(this.top).add(o).subtract(t).cross(i), r[3].fromPointNormal(t, c), c = new A().copy(n), r[4].fromPointNormal(o, c), c.negate(), r[5].fromPointNormal(a, c), this._cullingVolume; } - - getPixelDimensions (t, n, s, r) { + getPixelDimensions(t, n, s, r) { this._update(), j(Number.isFinite(t) && Number.isFinite(n)), j(t > 0), j(n > 0), j(s > 0), j(r); const i = 1 / this.near; let o = this.top * i; @@ -3777,8 +3540,7 @@ class Fn { const c = 2 * s * o / t; return r.x = c, r.y = a, r; } - - _update () { + _update() { j(Number.isFinite(this.right) && Number.isFinite(this.left) && Number.isFinite(this.top) && Number.isFinite(this.bottom) && Number.isFinite(this.near) && Number.isFinite(this.far)); const { top: t, @@ -3788,7 +3550,7 @@ class Fn { near: i, far: o } = this; - (t !== this._top || n !== this._bottom || r !== this._left || s !== this._right || i !== this._near || o !== this._far) && (j(this.near > 0 && this.near < this.far, 'near must be greater than zero and less than far.'), this._left = r, this._right = s, this._top = t, this._bottom = n, this._near = i, this._far = o, this._perspectiveMatrix = new V().frustum({ + (t !== this._top || n !== this._bottom || r !== this._left || s !== this._right || i !== this._near || o !== this._far) && (j(this.near > 0 && this.near < this.far, "near must be greater than zero and less than far."), this._left = r, this._right = s, this._top = t, this._bottom = n, this._near = i, this._far = o, this._perspectiveMatrix = new V().frustum({ left: r, right: s, bottom: n, @@ -3805,10 +3567,10 @@ class Fn { })); } } -const dd = (e) => e !== null && typeof e < 'u'; +const dd = (e) => e !== null && typeof e < "u"; class Dn { - constructor (t = {}) { - x(this, '_offCenterFrustum', new Fn()), x(this, 'fov', void 0), x(this, '_fov', void 0), x(this, '_fovy', void 0), x(this, '_sseDenominator', void 0), x(this, 'aspectRatio', void 0), x(this, '_aspectRatio', void 0), x(this, 'near', void 0), x(this, '_near', void 0), x(this, 'far', void 0), x(this, '_far', void 0), x(this, 'xOffset', void 0), x(this, '_xOffset', void 0), x(this, 'yOffset', void 0), x(this, '_yOffset', void 0); + constructor(t = {}) { + x(this, "_offCenterFrustum", new Fn()), x(this, "fov", void 0), x(this, "_fov", void 0), x(this, "_fovy", void 0), x(this, "_sseDenominator", void 0), x(this, "aspectRatio", void 0), x(this, "_aspectRatio", void 0), x(this, "near", void 0), x(this, "_near", void 0), x(this, "far", void 0), x(this, "_far", void 0), x(this, "xOffset", void 0), x(this, "_xOffset", void 0), x(this, "yOffset", void 0), x(this, "_yOffset", void 0); const { fov: n, aspectRatio: s, @@ -3819,8 +3581,7 @@ class Dn { } = t; this.fov = n, this.aspectRatio = s, this.near = r, this.far = i, this.xOffset = o, this.yOffset = a; } - - clone () { + clone() { return new Dn({ aspectRatio: this.aspectRatio, fov: this.fov, @@ -3828,36 +3589,28 @@ class Dn { far: this.far }); } - - equals (t) { + equals(t) { return !dd(t) || !(t instanceof Dn) ? !1 : (this._update(), t._update(), this.fov === t.fov && this.aspectRatio === t.aspectRatio && this.near === t.near && this.far === t.far && this._offCenterFrustum.equals(t._offCenterFrustum)); } - - get projectionMatrix () { + get projectionMatrix() { return this._update(), this._offCenterFrustum.projectionMatrix; } - - get infiniteProjectionMatrix () { + get infiniteProjectionMatrix() { return this._update(), this._offCenterFrustum.infiniteProjectionMatrix; } - - get fovy () { + get fovy() { return this._update(), this._fovy; } - - get sseDenominator () { + get sseDenominator() { return this._update(), this._sseDenominator; } - - computeCullingVolume (t, n, s) { + computeCullingVolume(t, n, s) { return this._update(), this._offCenterFrustum.computeCullingVolume(t, n, s); } - - getPixelDimensions (t, n, s, r) { + getPixelDimensions(t, n, s, r) { return this._update(), this._offCenterFrustum.getPixelDimensions(t, n, s, r || new Wn()); } - - _update () { + _update() { j(Number.isFinite(this.fov) && Number.isFinite(this.aspectRatio) && Number.isFinite(this.near) && Number.isFinite(this.far)); const t = this._offCenterFrustum; (this.fov !== this._fov || this.aspectRatio !== this._aspectRatio || this.near !== this._near || this.far !== this._far || this.xOffset !== this._xOffset || this.yOffset !== this._yOffset) && (j(this.fov >= 0 && this.fov < Math.PI), j(this.aspectRatio > 0), j(this.near >= 0 && this.near < this.far), this._aspectRatio = this.aspectRatio, this._fov = this.fov, this._fovy = this.aspectRatio <= 1 ? this.fov : Math.atan(Math.tan(this.fov * 0.5) / this.aspectRatio) * 2, this._near = this.near, this._far = this.far, this._sseDenominator = 2 * Math.tan(0.5 * this._fovy), this._xOffset = this.xOffset, this._yOffset = this.yOffset, t.top = this.near * Math.tan(0.5 * this._fovy), t.bottom = -t.top, t.right = this.aspectRatio * t.top, t.left = -t.right, t.near = this.near, t.far = this.far, t.right += this.xOffset, t.left += this.xOffset, t.top += this.yOffset, t.bottom += this.yOffset); @@ -3875,17 +3628,18 @@ new A(); new A(); new A(); new A(); -const Ot = new X(); const md = new X(); const gd = new X(); const fn = new X(); const Si = new X(); -function Ad (e, t = {}) { - const n = Hf; const s = 10; - let r = 0; let i = 0; - const o = md; const a = gd; +const Ot = new X(), md = new X(), gd = new X(), fn = new X(), Si = new X(); +function Ad(e, t = {}) { + const n = Hf, s = 10; + let r = 0, i = 0; + const o = md, a = gd; o.identity(), a.copy(e); const c = n * pd(a); - for (; i < s && yd(a) > c;) { Bd(a, fn), Si.copy(fn).transpose(), a.multiplyRight(fn), a.multiplyLeft(Si), o.multiplyRight(fn), ++r > 2 && (++i, r = 0); } + for (; i < s && yd(a) > c; ) + Bd(a, fn), Si.copy(fn).transpose(), a.multiplyRight(fn), a.multiplyLeft(Si), o.multiplyRight(fn), ++r > 2 && (++i, r = 0); return t.unitary = o.toTarget(t.unitary), t.diagonal = a.toTarget(t.diagonal), t; } -function pd (e) { +function pd(e) { let t = 0; for (let n = 0; n < 9; ++n) { const s = e[n]; @@ -3893,8 +3647,8 @@ function pd (e) { } return Math.sqrt(t); } -const zs = [1, 0, 0]; const Ws = [2, 2, 1]; -function yd (e) { +const zs = [1, 0, 0], Ws = [2, 2, 1]; +function yd(e) { let t = 0; for (let n = 0; n < 3; ++n) { const s = e[Ot.getElementIndex(Ws[n], zs[n])]; @@ -3902,33 +3656,35 @@ function yd (e) { } return Math.sqrt(t); } -function Bd (e, t) { +function Bd(e, t) { const n = xa; - let s = 0; let r = 1; + let s = 0, r = 1; for (let u = 0; u < 3; ++u) { const l = Math.abs(e[Ot.getElementIndex(Ws[u], zs[u])]); l > s && (r = u, s = l); } - const i = zs[r]; const o = Ws[r]; - let a = 1; let c = 0; + const i = zs[r], o = Ws[r]; + let a = 1, c = 0; if (Math.abs(e[Ot.getElementIndex(o, i)]) > n) { - const u = e[Ot.getElementIndex(o, o)]; const l = e[Ot.getElementIndex(i, i)]; const h = e[Ot.getElementIndex(o, i)]; const f = (u - l) / 2 / h; + const u = e[Ot.getElementIndex(o, o)], l = e[Ot.getElementIndex(i, i)], h = e[Ot.getElementIndex(o, i)], f = (u - l) / 2 / h; let d; f < 0 ? d = -1 / (-f + Math.sqrt(1 + f * f)) : d = 1 / (f + Math.sqrt(1 + f * f)), a = 1 / Math.sqrt(1 + d * d), c = d * a; } return X.IDENTITY.to(t), t[Ot.getElementIndex(i, i)] = t[Ot.getElementIndex(o, o)] = a, t[Ot.getElementIndex(o, i)] = c, t[Ot.getElementIndex(i, o)] = -c, t; } -const Vt = new A(); const Cd = new A(); const Ed = new A(); const Td = new A(); const bd = new A(); const _d = new X(); const wd = { +const Vt = new A(), Cd = new A(), Ed = new A(), Td = new A(), bd = new A(), _d = new X(), wd = { diagonal: new X(), unitary: new X() }; -function Rd (e, t = new qe()) { - if (!e || e.length === 0) { return t.halfAxes = new X([0, 0, 0, 0, 0, 0, 0, 0, 0]), t.center = new A(), t; } - const n = e.length; const s = new A(0, 0, 0); - for (const v of e) { s.add(v); } +function Rd(e, t = new qe()) { + if (!e || e.length === 0) + return t.halfAxes = new X([0, 0, 0, 0, 0, 0, 0, 0, 0]), t.center = new A(), t; + const n = e.length, s = new A(0, 0, 0); + for (const v of e) + s.add(v); const r = 1 / n; s.multiplyByScalar(r); - let i = 0; let o = 0; let a = 0; let c = 0; let u = 0; let l = 0; + let i = 0, o = 0, a = 0, c = 0, u = 0, l = 0; for (const v of e) { const L = Vt.copy(v).subtract(s); i += L.x * L.x, o += L.x * L.y, a += L.x * L.z, c += L.y * L.y, u += L.y * L.z, l += L.z * L.z; @@ -3938,68 +3694,69 @@ function Rd (e, t = new qe()) { h[0] = i, h[1] = o, h[2] = a, h[3] = o, h[4] = c, h[5] = u, h[6] = a, h[7] = u, h[8] = l; const { unitary: f - } = Ad(h, wd); const d = t.halfAxes.copy(f); - let m = d.getColumn(0, Ed); let g = d.getColumn(1, Td); let y = d.getColumn(2, bd); let E = -Number.MAX_VALUE; let R = -Number.MAX_VALUE; let B = -Number.MAX_VALUE; let C = Number.MAX_VALUE; let M = Number.MAX_VALUE; let b = Number.MAX_VALUE; - for (const v of e) { Vt.copy(v), E = Math.max(Vt.dot(m), E), R = Math.max(Vt.dot(g), R), B = Math.max(Vt.dot(y), B), C = Math.min(Vt.dot(m), C), M = Math.min(Vt.dot(g), M), b = Math.min(Vt.dot(y), b); } + } = Ad(h, wd), d = t.halfAxes.copy(f); + let m = d.getColumn(0, Ed), g = d.getColumn(1, Td), y = d.getColumn(2, bd), E = -Number.MAX_VALUE, R = -Number.MAX_VALUE, B = -Number.MAX_VALUE, C = Number.MAX_VALUE, M = Number.MAX_VALUE, b = Number.MAX_VALUE; + for (const v of e) + Vt.copy(v), E = Math.max(Vt.dot(m), E), R = Math.max(Vt.dot(g), R), B = Math.max(Vt.dot(y), B), C = Math.min(Vt.dot(m), C), M = Math.min(Vt.dot(g), M), b = Math.min(Vt.dot(y), b); m = m.multiplyByScalar(0.5 * (C + E)), g = g.multiplyByScalar(0.5 * (M + R)), y = y.multiplyByScalar(0.5 * (b + B)), t.center.copy(m).add(g).add(y); - const O = Cd.set(E - C, R - M, B - b).multiplyByScalar(0.5); const F = new X([O[0], 0, 0, 0, O[1], 0, 0, 0, O[2]]); + const O = Cd.set(E - C, R - M, B - b).multiplyByScalar(0.5), F = new X([O[0], 0, 0, 0, O[1], 0, 0, 0, O[2]]); return t.halfAxes.multiplyRight(F), t; } -const Ii = (function (e) { - return e[e.ADD = 1] = 'ADD', e[e.REPLACE = 2] = 'REPLACE', e; -}({})); const dn = (function (e) { - return e.EMPTY = 'empty', e.SCENEGRAPH = 'scenegraph', e.POINTCLOUD = 'pointcloud', e.MESH = 'mesh', e; -}({})); const Md = (function (e) { - return e.I3S = 'I3S', e.TILES3D = 'TILES3D', e; -}({})); const Qn = (function (e) { - return e.GEOMETRIC_ERROR = 'geometricError', e.MAX_SCREEN_THRESHOLD = 'maxScreenThreshold', e; -}({})); -const va = '4.1.1'; const _e = { - COMPOSITE: 'cmpt', - POINT_CLOUD: 'pnts', - BATCHED_3D_MODEL: 'b3dm', - INSTANCED_3D_MODEL: 'i3dm', - GEOMETRY: 'geom', - VECTOR: 'vect', - GLTF: 'glTF' +let Ii = function(e) { + return e[e.ADD = 1] = "ADD", e[e.REPLACE = 2] = "REPLACE", e; +}({}), dn = function(e) { + return e.EMPTY = "empty", e.SCENEGRAPH = "scenegraph", e.POINTCLOUD = "pointcloud", e.MESH = "mesh", e; +}({}), Md = function(e) { + return e.I3S = "I3S", e.TILES3D = "TILES3D", e; +}({}), Qn = function(e) { + return e.GEOMETRIC_ERROR = "geometricError", e.MAX_SCREEN_THRESHOLD = "maxScreenThreshold", e; +}({}); +const va = "4.1.1", _e = { + COMPOSITE: "cmpt", + POINT_CLOUD: "pnts", + BATCHED_3D_MODEL: "b3dm", + INSTANCED_3D_MODEL: "i3dm", + GEOMETRY: "geom", + VECTOR: "vect", + GLTF: "glTF" }; -function Oa (e, t, n) { +function Oa(e, t, n) { z(e instanceof ArrayBuffer); - const s = new TextDecoder('utf8'); const r = new Uint8Array(e, t, n); + const s = new TextDecoder("utf8"), r = new Uint8Array(e, t, n); return s.decode(r); } -function Sd (e) { - const t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0; +function Sd(e) { + let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0; const n = new DataView(e); return `${String.fromCharCode(n.getUint8(t + 0))}${String.fromCharCode(n.getUint8(t + 1))}${String.fromCharCode(n.getUint8(t + 2))}${String.fromCharCode(n.getUint8(t + 3))}`; } -const Id = '4.1.1'; const xd = { - name: 'Draco', - id: 'draco', - module: 'draco', +const Id = "4.1.1", xd = { + name: "Draco", + id: "draco", + module: "draco", version: Id, worker: !0, - extensions: ['drc'], - mimeTypes: ['application/octet-stream'], + extensions: ["drc"], + mimeTypes: ["application/octet-stream"], binary: !0, - tests: ['DRACO'], + tests: ["DRACO"], options: { draco: { - decoderType: typeof WebAssembly === 'object' ? 'wasm' : 'js', - libraryPath: 'libs/', + decoderType: typeof WebAssembly == "object" ? "wasm" : "js", + libraryPath: "libs/", extraAttributes: {}, attributeNameEntry: void 0 } } }; -function vd (e, t, n) { - const s = Fa(t.metadata); const r = []; const i = Od(t.attributes); +function vd(e, t, n) { + const s = Fa(t.metadata), r = [], i = Od(t.attributes); for (const o in e) { - const a = e[o]; const c = xi(o, a, i[o]); + const a = e[o], c = xi(o, a, i[o]); r.push(c); } if (n) { - const o = xi('indices', n); + const o = xi("indices", n); r.push(o); } return { @@ -4007,30 +3764,31 @@ function vd (e, t, n) { metadata: s }; } -function Od (e) { +function Od(e) { const t = {}; for (const n in e) { const s = e[n]; - t[s.name || 'undefined'] = s; + t[s.name || "undefined"] = s; } return t; } -function xi (e, t, n) { +function xi(e, t, n) { const s = n ? Fa(n.metadata) : void 0; return ih(e, t, s); } -function Fa (e) { +function Fa(e) { Object.entries(e); const t = {}; - for (const n in e) { t[`${n}.string`] = JSON.stringify(e[n]); } + for (const n in e) + t[`${n}.string`] = JSON.stringify(e[n]); return t; } const vi = { - POSITION: 'POSITION', - NORMAL: 'NORMAL', - COLOR: 'COLOR_0', - TEX_COORD: 'TEXCOORD_0' -}; const Fd = { + POSITION: "POSITION", + NORMAL: "NORMAL", + COLOR: "COLOR_0", + TEX_COORD: "TEXCOORD_0" +}, Fd = { 1: Int8Array, 2: Uint8Array, 3: Int16Array, @@ -4038,21 +3796,19 @@ const vi = { 5: Int32Array, 6: Uint32Array, 9: Float32Array -}; const Dd = 4; +}, Dd = 4; class Ld { - constructor (t) { + constructor(t) { this.draco = void 0, this.decoder = void 0, this.metadataQuerier = void 0, this.draco = t, this.decoder = new this.draco.Decoder(), this.metadataQuerier = new this.draco.MetadataQuerier(); } - - destroy () { + destroy() { this.draco.destroy(this.decoder), this.draco.destroy(this.metadataQuerier); } - - parseSync (t) { - const n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; + parseSync(t) { + let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; const s = new this.draco.DecoderBuffer(); s.Init(new Int8Array(t), t.byteLength), this._disableAttributeTransforms(n); - const r = this.decoder.GetEncodedGeometryType(s); const i = r === this.draco.TRIANGULAR_MESH ? new this.draco.Mesh() : new this.draco.PointCloud(); + const r = this.decoder.GetEncodedGeometryType(s), i = r === this.draco.TRIANGULAR_MESH ? new this.draco.Mesh() : new this.draco.PointCloud(); try { let o; switch (r) { @@ -4063,15 +3819,15 @@ class Ld { o = this.decoder.DecodeBufferToPointCloud(s, i); break; default: - throw new Error('DRACO: Unknown geometry type.'); + throw new Error("DRACO: Unknown geometry type."); } if (!o.ok() || !i.ptr) { const f = `DRACO decompression failed: ${o.error_msg()}`; throw new Error(f); } - const a = this._getDracoLoaderData(i, r, n); const c = this._getMeshData(i, a, n); const u = rh(c.attributes); const l = vd(c.attributes, a, c.indices); + const a = this._getDracoLoaderData(i, r, n), c = this._getMeshData(i, a, n), u = rh(c.attributes), l = vd(c.attributes, a, c.indices); return { - loader: 'draco', + loader: "draco", loaderData: a, header: { vertexCount: i.num_points(), @@ -4084,9 +3840,8 @@ class Ld { this.draco.destroy(s), i && this.draco.destroy(i); } } - - _getDracoLoaderData (t, n, s) { - const r = this._getTopLevelMetadata(t); const i = this._getDracoAttributes(t, s); + _getDracoLoaderData(t, n, s) { + const r = this._getTopLevelMetadata(t), i = this._getDracoAttributes(t, s); return { geometry_type: n, num_attributes: t.num_attributes(), @@ -4096,11 +3851,10 @@ class Ld { attributes: i }; } - - _getDracoAttributes (t, n) { + _getDracoAttributes(t, n) { const s = {}; for (let r = 0; r < t.num_attributes(); r++) { - const i = this.decoder.GetAttribute(t, r); const o = this._getAttributeMetadata(t, r); + const i = this.decoder.GetAttribute(t, r), o = this._getAttributeMetadata(t, r); s[i.unique_id()] = { unique_id: i.unique_id(), attribute_type: i.attribute_type(), @@ -4119,15 +3873,15 @@ class Ld { } return s; } - - _getMeshData (t, n, s) { + _getMeshData(t, n, s) { const r = this._getMeshAttributes(n, t, s); - if (!r.POSITION) { throw new Error('DRACO: No position attribute found.'); } - if (t instanceof this.draco.Mesh) { + if (!r.POSITION) + throw new Error("DRACO: No position attribute found."); + if (t instanceof this.draco.Mesh) switch (s.topology) { - case 'triangle-strip': + case "triangle-strip": return { - topology: 'triangle-strip', + topology: "triangle-strip", mode: 4, attributes: r, indices: { @@ -4135,10 +3889,10 @@ class Ld { size: 1 } }; - case 'triangle-list': + case "triangle-list": default: return { - topology: 'triangle-list', + topology: "triangle-list", mode: 5, attributes: r, indices: { @@ -4147,15 +3901,13 @@ class Ld { } }; } - } return { - topology: 'point-list', + topology: "point-list", mode: 0, attributes: r }; } - - _getMeshAttributes (t, n, s) { + _getMeshAttributes(t, n, s) { const r = {}; for (const i of Object.values(t.attributes)) { const o = this._deduceAttributeName(i, s); @@ -4174,17 +3926,15 @@ class Ld { } return r; } - - _getTriangleListIndices (t) { - const s = t.num_faces() * 3; const r = s * Dd; const i = this.draco._malloc(r); + _getTriangleListIndices(t) { + const s = t.num_faces() * 3, r = s * Dd, i = this.draco._malloc(r); try { return this.decoder.GetTrianglesUInt32Array(t, r, i), new Uint32Array(this.draco.HEAPF32.buffer, i, s).slice(); } finally { this.draco._free(i); } } - - _getTriangleStripIndices (t) { + _getTriangleStripIndices(t) { const n = new this.draco.DracoInt32Array(); try { return this.decoder.GetTriangleStripsFromMesh(t, n), Nd(n); @@ -4192,9 +3942,8 @@ class Ld { this.draco.destroy(n); } } - - _getAttributeValues (t, n) { - const s = Fd[n.data_type]; const r = n.num_components; const o = t.num_points() * r; const a = o * s.BYTES_PER_ELEMENT; const c = Pd(this.draco, s); + _getAttributeValues(t, n) { + const s = Fd[n.data_type], r = n.num_components, o = t.num_points() * r, a = o * s.BYTES_PER_ELEMENT, c = Pd(this.draco, s); let u; const l = this.draco._malloc(a); try { @@ -4208,41 +3957,37 @@ class Ld { size: r }; } - - _deduceAttributeName (t, n) { + _deduceAttributeName(t, n) { const s = t.unique_id; - for (const [o, a] of Object.entries(n.extraAttributes || {})) { - if (a === s) { return o; } - } + for (const [o, a] of Object.entries(n.extraAttributes || {})) + if (a === s) + return o; const r = t.attribute_type; - for (const o in vi) { - if (this.draco[o] === r) { return vi[o]; } - } - const i = n.attributeNameEntry || 'name'; + for (const o in vi) + if (this.draco[o] === r) + return vi[o]; + const i = n.attributeNameEntry || "name"; return t.metadata[i] ? t.metadata[i].string : `CUSTOM_ATTRIBUTE_${s}`; } - - _getTopLevelMetadata (t) { + _getTopLevelMetadata(t) { const n = this.decoder.GetMetadata(t); return this._getDracoMetadata(n); } - - _getAttributeMetadata (t, n) { + _getAttributeMetadata(t, n) { const s = this.decoder.GetAttributeMetadata(t, n); return this._getDracoMetadata(s); } - - _getDracoMetadata (t) { - if (!t || !t.ptr) { return {}; } - const n = {}; const s = this.metadataQuerier.NumEntries(t); + _getDracoMetadata(t) { + if (!t || !t.ptr) + return {}; + const n = {}, s = this.metadataQuerier.NumEntries(t); for (let r = 0; r < s; r++) { const i = this.metadataQuerier.GetEntryName(t, r); n[i] = this._getDracoMetadataField(t, i); } return n; } - - _getDracoMetadataField (t, n) { + _getDracoMetadataField(t, n) { const s = new this.draco.DracoInt32Array(); try { this.metadataQuerier.GetIntEntryArray(t, n, s); @@ -4257,48 +4002,44 @@ class Ld { this.draco.destroy(s); } } - - _disableAttributeTransforms (t) { + _disableAttributeTransforms(t) { const { quantizedAttributes: n = [], octahedronAttributes: s = [] - } = t; const r = [...n, ...s]; - for (const i of r) { this.decoder.SkipAttributeTransform(this.draco[i]); } + } = t, r = [...n, ...s]; + for (const i of r) + this.decoder.SkipAttributeTransform(this.draco[i]); } - - _getQuantizationTransform (t, n) { + _getQuantizationTransform(t, n) { const { quantizedAttributes: s = [] - } = n; const r = t.attribute_type(); + } = n, r = t.attribute_type(); if (s.map((o) => this.decoder[o]).includes(r)) { const o = new this.draco.AttributeQuantizationTransform(); try { - if (o.InitFromAttribute(t)) { + if (o.InitFromAttribute(t)) return { quantization_bits: o.quantization_bits(), range: o.range(), min_values: new Float32Array([1, 2, 3]).map((a) => o.min_value(a)) }; - } } finally { this.draco.destroy(o); } } return null; } - - _getOctahedronTransform (t, n) { + _getOctahedronTransform(t, n) { const { octahedronAttributes: s = [] - } = n; const r = t.attribute_type(); + } = n, r = t.attribute_type(); if (s.map((o) => this.decoder[o]).includes(r)) { const o = new this.draco.AttributeQuantizationTransform(); try { - if (o.InitFromAttribute(t)) { + if (o.InitFromAttribute(t)) return { quantization_bits: o.quantization_bits() }; - } } finally { this.draco.destroy(o); } @@ -4306,7 +4047,7 @@ class Ld { return null; } } -function Pd (e, t) { +function Pd(e, t) { switch (t) { case Float32Array: return e.DT_FLOAT32; @@ -4326,49 +4067,49 @@ function Pd (e, t) { return e.DT_INVALID; } } -function Gd (e) { - const t = e.size(); const n = new Int32Array(t); - for (let s = 0; s < t; s++) { n[s] = e.GetValue(s); } +function Gd(e) { + const t = e.size(), n = new Int32Array(t); + for (let s = 0; s < t; s++) + n[s] = e.GetValue(s); return n; } -function Nd (e) { - const t = e.size(); const n = new Int32Array(t); - for (let s = 0; s < t; s++) { n[s] = e.GetValue(s); } +function Nd(e) { + const t = e.size(), n = new Int32Array(t); + for (let s = 0; s < t; s++) + n[s] = e.GetValue(s); return n; } -const Ud = '1.5.6'; const Hd = '1.4.1'; const As = `https://www.gstatic.com/draco/versioned/decoders/${Ud}`; const ft = { - DECODER: 'draco_wasm_wrapper.js', - DECODER_WASM: 'draco_decoder.wasm', - FALLBACK_DECODER: 'draco_decoder.js', - ENCODER: 'draco_encoder.js' -}; const ps = { +const Ud = "1.5.6", Hd = "1.4.1", As = `https://www.gstatic.com/draco/versioned/decoders/${Ud}`, ft = { + DECODER: "draco_wasm_wrapper.js", + DECODER_WASM: "draco_decoder.wasm", + FALLBACK_DECODER: "draco_decoder.js", + ENCODER: "draco_encoder.js" +}, ps = { [ft.DECODER]: `${As}/${ft.DECODER}`, [ft.DECODER_WASM]: `${As}/${ft.DECODER_WASM}`, [ft.FALLBACK_DECODER]: `${As}/${ft.FALLBACK_DECODER}`, [ft.ENCODER]: `https://raw.githubusercontent.com/google/draco/${Hd}/javascript/${ft.ENCODER}` }; let we; -async function Jd (e) { +async function Jd(e) { const t = e.modules || {}; - return t.draco3d - ? we = we || t.draco3d.createDecoderModule({}).then((n) => ({ - draco: n - })) - : we = we || Vd(e), await we; + return t.draco3d ? we = we || t.draco3d.createDecoderModule({}).then((n) => ({ + draco: n + })) : we = we || Vd(e), await we; } -async function Vd (e) { +async function Vd(e) { let t, n; switch (e.draco && e.draco.decoderType) { - case 'js': - t = await Zt(ps[ft.FALLBACK_DECODER], 'draco', e, ft.FALLBACK_DECODER); + case "js": + t = await Zt(ps[ft.FALLBACK_DECODER], "draco", e, ft.FALLBACK_DECODER); break; - case 'wasm': + case "wasm": default: - [t, n] = await Promise.all([await Zt(ps[ft.DECODER], 'draco', e, ft.DECODER), await Zt(ps[ft.DECODER_WASM], 'draco', e, ft.DECODER_WASM)]); + [t, n] = await Promise.all([await Zt(ps[ft.DECODER], "draco", e, ft.DECODER), await Zt(ps[ft.DECODER_WASM], "draco", e, ft.DECODER_WASM)]); } return t = t || globalThis.DracoDecoderModule, await jd(t, n); } -function jd (e, t) { +function jd(e, t) { const n = {}; return t && (n.wasmBinary = t), new Promise((s) => { e({ @@ -4383,10 +4124,10 @@ const Da = { ...xd, parse: kd }; -async function kd (e, t) { +async function kd(e, t) { const { draco: n - } = await Jd(t); const s = new Ld(n); + } = await Jd(t), s = new Ld(n); try { return s.parseSync(e, t == null ? void 0 : t.draco); } finally { @@ -4401,7 +4142,7 @@ const Kd = { TRIANGLES: 4, TRIANGLE_STRIP: 5, TRIANGLE_FAN: 6 -}; const $ = { +}, $ = { BYTE: 5120, UNSIGNED_BYTE: 5121, SHORT: 5122, @@ -4410,10 +4151,10 @@ const Kd = { UNSIGNED_INT: 5125, FLOAT: 5126, DOUBLE: 5130 -}; const G = { +}, G = { ...Kd, ...$ -}; const ys = { +}, ys = { [$.DOUBLE]: Float64Array, [$.FLOAT]: Float32Array, [$.UNSIGNED_SHORT]: Uint16Array, @@ -4422,7 +4163,7 @@ const Kd = { [$.BYTE]: Int8Array, [$.SHORT]: Int16Array, [$.INT]: Int32Array -}; const zd = { +}, zd = { DOUBLE: $.DOUBLE, FLOAT: $.FLOAT, UNSIGNED_SHORT: $.UNSIGNED_SHORT, @@ -4431,23 +4172,22 @@ const Kd = { BYTE: $.BYTE, SHORT: $.SHORT, INT: $.INT -}; const Bs = 'Failed to convert GL type'; +}, Bs = "Failed to convert GL type"; class Lt { - static fromTypedArray (t) { + static fromTypedArray(t) { t = ArrayBuffer.isView(t) ? t.constructor : t; - for (const n in ys) { - if (ys[n] === t) { return n; } - } + for (const n in ys) + if (ys[n] === t) + return n; throw new Error(Bs); } - - static fromName (t) { + static fromName(t) { const n = zd[t]; - if (!n) { throw new Error(Bs); } + if (!n) + throw new Error(Bs); return n; } - - static getArrayType (t) { + static getArrayType(t) { switch (t) { case $.UNSIGNED_SHORT_5_6_5: case $.UNSIGNED_SHORT_4_4_4_4: @@ -4455,96 +4195,92 @@ class Lt { return Uint16Array; default: const n = ys[t]; - if (!n) { throw new Error(Bs); } + if (!n) + throw new Error(Bs); return n; } } - - static getByteSize (t) { + static getByteSize(t) { return Lt.getArrayType(t).BYTES_PER_ELEMENT; } - - static validate (t) { + static validate(t) { return !!Lt.getArrayType(t); } - - static createTypedArray (t, n) { - const s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0; let r = arguments.length > 3 ? arguments[3] : void 0; + static createTypedArray(t, n) { + let s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0, r = arguments.length > 3 ? arguments[3] : void 0; r === void 0 && (r = (n.byteLength - s) / Lt.getByteSize(t)); const i = Lt.getArrayType(t); return new i(n, s, r); } } -function Wd (e, t) { - if (!e) { throw new Error(`math.gl assertion failed. ${t}`); } +function Wd(e, t) { + if (!e) + throw new Error(`math.gl assertion failed. ${t}`); } -function Xd (e) { - const t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [0, 0, 0]; - const n = e >> 11 & 31; const s = e >> 5 & 63; const r = e & 31; +function Xd(e) { + let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [0, 0, 0]; + const n = e >> 11 & 31, s = e >> 5 & 63, r = e & 31; return t[0] = n << 3, t[1] = s << 2, t[2] = r << 3, t; } new Wn(); new A(); new Wn(); new Wn(); -function Oi (e) { - const t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 255; +function Oi(e) { + let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 255; return mh(e, 0, t) / t * 2 - 1; } -function Fi (e) { +function Fi(e) { return e < 0 ? -1 : 1; } -function Qd (e, t, n, s) { - if (Wd(s), e < 0 || e > n || t < 0 || t > n) { throw new Error(`x and y must be unsigned normalized integers between 0 and ${n}`); } +function Qd(e, t, n, s) { + if (Wd(s), e < 0 || e > n || t < 0 || t > n) + throw new Error(`x and y must be unsigned normalized integers between 0 and ${n}`); if (s.x = Oi(e, n), s.y = Oi(t, n), s.z = 1 - (Math.abs(s.x) + Math.abs(s.y)), s.z < 0) { const r = s.x; s.x = (1 - Math.abs(s.y)) * Fi(r), s.y = (1 - Math.abs(r)) * Fi(s.y); } return s.normalize(); } -function qd (e, t, n) { +function qd(e, t, n) { return Qd(e, t, 255, n); } class br { - constructor (t, n) { + constructor(t, n) { this.json = void 0, this.buffer = void 0, this.featuresLength = 0, this._cachedTypedArrays = {}, this.json = t, this.buffer = n; } - - getExtension (t) { + getExtension(t) { return this.json.extensions && this.json.extensions[t]; } - - hasProperty (t) { + hasProperty(t) { return !!this.json[t]; } - - getGlobalProperty (t) { - const n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : G.UNSIGNED_INT; const s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 1; + getGlobalProperty(t) { + let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : G.UNSIGNED_INT, s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 1; const r = this.json[t]; return r && Number.isFinite(r.byteOffset) ? this._getTypedArrayFromBinary(t, n, s, 1, r.byteOffset) : r; } - - getPropertyArray (t, n, s) { + getPropertyArray(t, n, s) { const r = this.json[t]; - return r && Number.isFinite(r.byteOffset) ? ('componentType' in r && (n = Lt.fromName(r.componentType)), this._getTypedArrayFromBinary(t, n, s, this.featuresLength, r.byteOffset)) : this._getTypedArrayFromArray(t, n, r); + return r && Number.isFinite(r.byteOffset) ? ("componentType" in r && (n = Lt.fromName(r.componentType)), this._getTypedArrayFromBinary(t, n, s, this.featuresLength, r.byteOffset)) : this._getTypedArrayFromArray(t, n, r); } - - getProperty (t, n, s, r, i) { + getProperty(t, n, s, r, i) { const o = this.json[t]; - if (!o) { return o; } + if (!o) + return o; const a = this.getPropertyArray(t, n, s); - if (s === 1) { return a[r]; } - for (let c = 0; c < s; ++c) { i[c] = a[s * r + c]; } + if (s === 1) + return a[r]; + for (let c = 0; c < s; ++c) + i[c] = a[s * r + c]; return i; } - - _getTypedArrayFromBinary (t, n, s, r, i) { + _getTypedArrayFromBinary(t, n, s, r, i) { const o = this._cachedTypedArrays; let a = o[t]; return a || (a = Lt.createTypedArray(n, this.buffer.buffer, this.buffer.byteOffset + i, r * s), o[t] = a), a; } - - _getTypedArrayFromArray (t, n, s) { + _getTypedArrayFromArray(t, n, s) { const r = this._cachedTypedArrays; let i = r[t]; return i || (i = Lt.createTypedArray(n, s), r[t] = i), i; @@ -4558,7 +4294,7 @@ const Yd = { MAT2: 4, MAT3: 9, MAT4: 16 -}; const $d = { +}, $d = { SCALAR: (e, t) => e[t], VEC2: (e, t) => [e[2 * t + 0], e[2 * t + 1]], VEC3: (e, t) => [e[3 * t + 0], e[3 * t + 1], e[3 * t + 2]], @@ -4566,7 +4302,7 @@ const Yd = { MAT2: (e, t) => [e[4 * t + 0], e[4 * t + 1], e[4 * t + 2], e[4 * t + 3]], MAT3: (e, t) => [e[9 * t + 0], e[9 * t + 1], e[9 * t + 2], e[9 * t + 3], e[9 * t + 4], e[9 * t + 5], e[9 * t + 6], e[9 * t + 7], e[9 * t + 8]], MAT4: (e, t) => [e[16 * t + 0], e[16 * t + 1], e[16 * t + 2], e[16 * t + 3], e[16 * t + 4], e[16 * t + 5], e[16 * t + 6], e[16 * t + 7], e[16 * t + 8], e[16 * t + 9], e[16 * t + 10], e[16 * t + 11], e[16 * t + 12], e[16 * t + 13], e[16 * t + 14], e[16 * t + 15]] -}; const Zd = { +}, Zd = { SCALAR: (e, t, n) => { t[n] = e; }, @@ -4589,12 +4325,12 @@ const Yd = { t[16 * n + 0] = e[0], t[16 * n + 1] = e[1], t[16 * n + 2] = e[2], t[16 * n + 3] = e[3], t[16 * n + 4] = e[4], t[16 * n + 5] = e[5], t[16 * n + 6] = e[6], t[16 * n + 7] = e[7], t[16 * n + 8] = e[8], t[16 * n + 9] = e[9], t[16 * n + 10] = e[10], t[16 * n + 11] = e[11], t[16 * n + 12] = e[12], t[16 * n + 13] = e[13], t[16 * n + 14] = e[14], t[16 * n + 15] = e[15]; } }; -function tm (e, t, n, s) { +function tm(e, t, n, s) { const { componentType: r } = e; z(e.componentType); - const i = typeof r === 'string' ? Lt.fromName(r) : r; const o = Yd[e.type]; const a = $d[e.type]; const c = Zd[e.type]; + const i = typeof r == "string" ? Lt.fromName(r) : r, o = Yd[e.type], a = $d[e.type], c = Zd[e.type]; return n += e.byteOffset, { values: Lt.createTypedArray(i, t, n, o * s), type: i, @@ -4604,29 +4340,31 @@ function tm (e, t, n, s) { }; } const Ft = (e) => e !== void 0; -function em (e, t, n) { - if (!t) { return null; } - let s = e.getExtension('3DTILES_batch_table_hierarchy'); +function em(e, t, n) { + if (!t) + return null; + let s = e.getExtension("3DTILES_batch_table_hierarchy"); const r = t.HIERARCHY; - return r && (console.warn('3D Tile Parser: HIERARCHY is deprecated. Use 3DTILES_batch_table_hierarchy.'), t.extensions = t.extensions || {}, t.extensions['3DTILES_batch_table_hierarchy'] = r, s = r), s ? nm(s, n) : null; + return r && (console.warn("3D Tile Parser: HIERARCHY is deprecated. Use 3DTILES_batch_table_hierarchy."), t.extensions = t.extensions || {}, t.extensions["3DTILES_batch_table_hierarchy"] = r, s = r), s ? nm(s, n) : null; } -function nm (e, t) { +function nm(e, t) { let n, s, r; - const i = e.instancesLength; const o = e.classes; - let a = e.classIds; let c = e.parentCounts; let u = e.parentIds; let l = i; + const i = e.instancesLength, o = e.classes; + let a = e.classIds, c = e.parentCounts, u = e.parentIds, l = i; Ft(a.byteOffset) && (a.componentType = defaultValue(a.componentType, GL.UNSIGNED_SHORT), a.type = AttributeType.SCALAR, r = getBinaryAccessor(a), a = r.createArrayBufferView(t.buffer, t.byteOffset + a.byteOffset, i)); let h; - if (Ft(c)) { - for (Ft(c.byteOffset) && (c.componentType = defaultValue(c.componentType, GL.UNSIGNED_SHORT), c.type = AttributeType.SCALAR, r = getBinaryAccessor(c), c = r.createArrayBufferView(t.buffer, t.byteOffset + c.byteOffset, i)), h = new Uint16Array(i), l = 0, n = 0; n < i; ++n) { h[n] = l, l += c[n]; } - } + if (Ft(c)) + for (Ft(c.byteOffset) && (c.componentType = defaultValue(c.componentType, GL.UNSIGNED_SHORT), c.type = AttributeType.SCALAR, r = getBinaryAccessor(c), c = r.createArrayBufferView(t.buffer, t.byteOffset + c.byteOffset, i)), h = new Uint16Array(i), l = 0, n = 0; n < i; ++n) + h[n] = l, l += c[n]; Ft(u) && Ft(u.byteOffset) && (u.componentType = defaultValue(u.componentType, GL.UNSIGNED_SHORT), u.type = AttributeType.SCALAR, r = getBinaryAccessor(u), u = r.createArrayBufferView(t.buffer, t.byteOffset + u.byteOffset, l)); const f = o.length; for (n = 0; n < f; ++n) { - const y = o[n].length; const E = o[n].instances; const R = getBinaryProperties(y, E, t); + const y = o[n].length, E = o[n].instances, R = getBinaryProperties(y, E, t); o[n].instances = combine(R, E); } - const d = new Array(f).fill(0); const m = new Uint16Array(i); - for (n = 0; n < i; ++n) { s = a[n], m[n] = d[s], ++d[s]; } + const d = new Array(f).fill(0), m = new Uint16Array(i); + for (n = 0; n < i; ++n) + s = a[n], m[n] = d[s], ++d[s]; const g = { classes: o, classIds: a, @@ -4637,21 +4375,24 @@ function nm (e, t) { }; return im(g), g; } -function Re (e, t, n) { - if (!e) { return; } +function Re(e, t, n) { + if (!e) + return; const s = e.parentCounts; return e.parentIds ? n(e, t) : s > 0 ? sm(e, t, n) : rm(e, t, n); } -function sm (e, t, n) { - const s = e.classIds; const r = e.parentCounts; const i = e.parentIds; const o = e.parentIndexes; const a = s.length; const c = scratchVisited; +function sm(e, t, n) { + const s = e.classIds, r = e.parentCounts, i = e.parentIds, o = e.parentIndexes, a = s.length, c = scratchVisited; c.length = Math.max(c.length, a); - const u = ++marker; const l = scratchStack; - for (l.length = 0, l.push(t); l.length > 0;) { - if (t = l.pop(), c[t] === u) { continue; } + const u = ++marker, l = scratchStack; + for (l.length = 0, l.push(t); l.length > 0; ) { + if (t = l.pop(), c[t] === u) + continue; c[t] = u; const h = n(e, t); - if (Ft(h)) { return h; } - const f = r[t]; const d = o[t]; + if (Ft(h)) + return h; + const f = r[t], d = o[t]; for (let m = 0; m < f; ++m) { const g = i[d + m]; g !== t && l.push(g); @@ -4659,58 +4400,59 @@ function sm (e, t, n) { } return null; } -function rm (e, t, n) { +function rm(e, t, n) { let s = !0; - for (; s;) { + for (; s; ) { const r = n(e, t); - if (Ft(r)) { return r; } + if (Ft(r)) + return r; const i = e.parentIds[t]; s = i !== t, t = i; } - throw new Error('traverseHierarchySingleParent'); + throw new Error("traverseHierarchySingleParent"); } -function im (e) { +function im(e) { const n = e.classIds.length; - for (let s = 0; s < n; ++s) { La(e, s, stack); } + for (let s = 0; s < n; ++s) + La(e, s, stack); } -function La (e, t, n) { - const s = e.parentCounts; const r = e.parentIds; const i = e.parentIndexes; const a = e.classIds.length; - if (!Ft(r)) { return; } - assert(t < a, `Parent index ${t} exceeds the total number of instances: ${a}`), assert(n.indexOf(t) === -1, 'Circular dependency detected in the batch table hierarchy.'), n.push(t); - const c = Ft(s) ? s[t] : 1; const u = Ft(s) ? i[t] : t; +function La(e, t, n) { + const s = e.parentCounts, r = e.parentIds, i = e.parentIndexes, a = e.classIds.length; + if (!Ft(r)) + return; + assert(t < a, `Parent index ${t} exceeds the total number of instances: ${a}`), assert(n.indexOf(t) === -1, "Circular dependency detected in the batch table hierarchy."), n.push(t); + const c = Ft(s) ? s[t] : 1, u = Ft(s) ? i[t] : t; for (let l = 0; l < c; ++l) { const h = r[u + l]; h !== t && La(e, h, n); } n.pop(t); } -function ut (e) { +function ut(e) { return e != null; } -const mn = (e, t) => e; const om = { +const mn = (e, t) => e, om = { HIERARCHY: !0, extensions: !0, extras: !0 }; class Pa { - constructor (t, n, s) { - let r; - const i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {}; + constructor(t, n, s) { + var r; + let i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {}; this.json = void 0, this.binary = void 0, this.featureCount = void 0, this._extensions = void 0, this._properties = void 0, this._binaryProperties = void 0, this._hierarchy = void 0, z(s >= 0), this.json = t || {}, this.binary = n, this.featureCount = s, this._extensions = ((r = this.json) === null || r === void 0 ? void 0 : r.extensions) || {}, this._properties = {}; - for (const o in this.json) { om[o] || (this._properties[o] = this.json[o]); } - this._binaryProperties = this._initializeBinaryProperties(), i['3DTILES_batch_table_hierarchy'] && (this._hierarchy = em(this, this.json, this.binary)); + for (const o in this.json) + om[o] || (this._properties[o] = this.json[o]); + this._binaryProperties = this._initializeBinaryProperties(), i["3DTILES_batch_table_hierarchy"] && (this._hierarchy = em(this, this.json, this.binary)); } - - getExtension (t) { + getExtension(t) { return this.json && this.json.extensions && this.json.extensions[t]; } - - memorySizeInBytes () { + memorySizeInBytes() { return 0; } - - isClass (t, n) { - if (this._checkBatchId(t), z(typeof n === 'string', n), this._hierarchy) { + isClass(t, n) { + if (this._checkBatchId(t), z(typeof n == "string", n), this._hierarchy) { const s = Re(this._hierarchy, t, (r, i) => { const o = r.classIds[i]; return r.classes[o].name === n; @@ -4719,78 +4461,72 @@ class Pa { } return !1; } - - isExactClass (t, n) { - return z(typeof n === 'string', n), this.getExactClassName(t) === n; + isExactClass(t, n) { + return z(typeof n == "string", n), this.getExactClassName(t) === n; } - - getExactClassName (t) { + getExactClassName(t) { if (this._checkBatchId(t), this._hierarchy) { const n = this._hierarchy.classIds[t]; return this._hierarchy.classes[n].name; } } - - hasProperty (t, n) { - return this._checkBatchId(t), z(typeof n === 'string', n), ut(this._properties[n]) || this._hasPropertyInHierarchy(t, n); + hasProperty(t, n) { + return this._checkBatchId(t), z(typeof n == "string", n), ut(this._properties[n]) || this._hasPropertyInHierarchy(t, n); } - - getPropertyNames (t, n) { + getPropertyNames(t, n) { this._checkBatchId(t), n = ut(n) ? n : [], n.length = 0; const s = Object.keys(this._properties); return n.push(...s), this._hierarchy && this._getPropertyNamesInHierarchy(t, n), n; } - - getProperty (t, n) { - if (this._checkBatchId(t), z(typeof n === 'string', n), this._binaryProperties) { + getProperty(t, n) { + if (this._checkBatchId(t), z(typeof n == "string", n), this._binaryProperties) { const r = this._binaryProperties[n]; - if (ut(r)) { return this._getBinaryProperty(r, t); } + if (ut(r)) + return this._getBinaryProperty(r, t); } const s = this._properties[n]; - if (ut(s)) { return mn(s[t]); } + if (ut(s)) + return mn(s[t]); if (this._hierarchy) { const r = this._getHierarchyProperty(t, n); - if (ut(r)) { return r; } + if (ut(r)) + return r; } } - - setProperty (t, n, s) { + setProperty(t, n, s) { const r = this.featureCount; - if (this._checkBatchId(t), z(typeof n === 'string', n), this._binaryProperties) { + if (this._checkBatchId(t), z(typeof n == "string", n), this._binaryProperties) { const o = this._binaryProperties[n]; if (o) { this._setBinaryProperty(o, t, s); return; } } - if (this._hierarchy && this._setHierarchyProperty(this, t, n, s)) { return; } + if (this._hierarchy && this._setHierarchyProperty(this, t, n, s)) + return; let i = this._properties[n]; ut(i) || (this._properties[n] = new Array(r), i = this._properties[n]), i[t] = mn(s); } - - _checkBatchId (t) { - if (!(t >= 0 && t < this.featureCount)) { throw new Error('batchId not in range [0, featureCount - 1].'); } + _checkBatchId(t) { + if (!(t >= 0 && t < this.featureCount)) + throw new Error("batchId not in range [0, featureCount - 1]."); } - - _getBinaryProperty (t, n) { + _getBinaryProperty(t, n) { return t.unpack(t.typedArray, n); } - - _setBinaryProperty (t, n, s) { + _setBinaryProperty(t, n, s) { t.pack(s, t.typedArray, n); } - - _initializeBinaryProperties () { + _initializeBinaryProperties() { let t = null; for (const n in this._properties) { - const s = this._properties[n]; const r = this._initializeBinaryProperty(n, s); + const s = this._properties[n], r = this._initializeBinaryProperty(n, s); r && (t = t || {}, t[n] = r); } return t; } - - _initializeBinaryProperty (t, n) { - if ('byteOffset' in n) { + _initializeBinaryProperty(t, n) { + if ("byteOffset" in n) { const s = n; z(this.binary, `Property ${t} requires a batch table binary.`), z(s.type, `Property ${t} requires a type.`); const r = tm(s, this.binary.buffer, this.binary.byteOffset | 0, this.featureCount); @@ -4803,47 +4539,46 @@ class Pa { } return null; } - - _hasPropertyInHierarchy (t, n) { - if (!this._hierarchy) { return !1; } + _hasPropertyInHierarchy(t, n) { + if (!this._hierarchy) + return !1; const s = Re(this._hierarchy, t, (r, i) => { - const o = r.classIds[i]; const a = r.classes[o].instances; + const o = r.classIds[i], a = r.classes[o].instances; return ut(a[n]); }); return ut(s); } - - _getPropertyNamesInHierarchy (t, n) { + _getPropertyNamesInHierarchy(t, n) { Re(this._hierarchy, t, (s, r) => { - const i = s.classIds[r]; const o = s.classes[i].instances; - for (const a in o) { o.hasOwnProperty(a) && n.indexOf(a) === -1 && n.push(a); } + const i = s.classIds[r], o = s.classes[i].instances; + for (const a in o) + o.hasOwnProperty(a) && n.indexOf(a) === -1 && n.push(a); }); } - - _getHierarchyProperty (t, n) { + _getHierarchyProperty(t, n) { return Re(this._hierarchy, t, (s, r) => { - const i = s.classIds[r]; const o = s.classes[i]; const a = s.classIndexes[r]; const c = o.instances[n]; + const i = s.classIds[r], o = s.classes[i], a = s.classIndexes[r], c = o.instances[n]; return ut(c) ? ut(c.typedArray) ? this._getBinaryProperty(c, a) : mn(c[a]) : null; }); } - - _setHierarchyProperty (t, n, s, r) { + _setHierarchyProperty(t, n, s, r) { const i = Re(this._hierarchy, n, (o, a) => { - const c = o.classIds[a]; const u = o.classes[c]; const l = o.classIndexes[a]; const h = u.instances[s]; + const c = o.classIds[a], u = o.classes[c], l = o.classIndexes[a], h = u.instances[s]; return ut(h) ? (z(a === n, `Inherited property "${s}" is read-only.`), ut(h.typedArray) ? this._setBinaryProperty(h, l, r) : h[l] = mn(r), !0) : !1; }); return ut(i); } } const Cs = 4; -function qn (e, t) { +function qn(e, t) { let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0; const s = new DataView(t); - if (e.magic = s.getUint32(n, !0), n += Cs, e.version = s.getUint32(n, !0), n += Cs, e.byteLength = s.getUint32(n, !0), n += Cs, e.version !== 1) { throw new Error(`3D Tile Version ${e.version} not supported`); } + if (e.magic = s.getUint32(n, !0), n += Cs, e.version = s.getUint32(n, !0), n += Cs, e.byteLength = s.getUint32(n, !0), n += Cs, e.version !== 1) + throw new Error(`3D Tile Version ${e.version} not supported`); return n; } -const le = 4; const Di = 'b3dm tile in legacy format.'; -function _r (e, t, n) { +const le = 4, Di = "b3dm tile in legacy format."; +function _r(e, t, n) { const s = new DataView(t); let r; e.header = e.header || {}; @@ -4856,10 +4591,10 @@ function _r (e, t, n) { let c = s.getUint32(n, !0); return n += le, a >= 570425344 ? (n -= le * 2, r = i, a = o, c = 0, i = 0, o = 0, console.warn(Di)) : c >= 570425344 && (n -= le, r = a, a = i, c = o, i = 0, o = 0, console.warn(Di)), e.header.featureTableJsonByteLength = i, e.header.featureTableBinaryByteLength = o, e.header.batchTableJsonByteLength = a, e.header.batchTableBinaryByteLength = c, e.header.batchLength = r, n; } -function wr (e, t, n, s) { +function wr(e, t, n, s) { return n = am(e, t, n), n = cm(e, t, n), n; } -function am (e, t, n, s) { +function am(e, t, n, s) { const { featureTableJsonByteLength: r, featureTableBinaryByteLength: i, @@ -4873,7 +4608,7 @@ function am (e, t, n, s) { } return n += r || 0, e.featureTableBinary = new Uint8Array(t, n, i), n += i || 0, n; } -function cm (e, t, n, s) { +function cm(e, t, n, s) { const { batchTableJsonByteLength: r, batchTableBinaryByteLength: i @@ -4884,8 +4619,9 @@ function cm (e, t, n, s) { } return n; } -function Ga (e, t, n) { - if (!t && (!e || !e.batchIds || !n)) { return null; } +function Ga(e, t, n) { + if (!t && (!e || !e.batchIds || !n)) + return null; const { batchIds: s, isRGB565: r, @@ -4894,7 +4630,7 @@ function Ga (e, t, n) { if (s && n) { const o = new Uint8ClampedArray(i * 3); for (let a = 0; a < i; a++) { - const c = s[a]; const l = n.getProperty(c, 'dimensions').map((h) => h * 255); + const c = s[a], l = n.getProperty(c, "dimensions").map((h) => h * 255); o[a * 3] = l[0], o[a * 3 + 1] = l[1], o[a * 3 + 2] = l[2]; } return { @@ -4916,27 +4652,27 @@ function Ga (e, t, n) { size: 3, normalized: !0 }; - } - return t && t.length === i * 3 - ? { - type: G.UNSIGNED_BYTE, - value: t, - size: 3, - normalized: !0 - } - : { - type: G.UNSIGNED_BYTE, - value: t || new Uint8ClampedArray(), - size: 4, - normalized: !0 - }; + } + return t && t.length === i * 3 ? { + type: G.UNSIGNED_BYTE, + value: t, + size: 3, + normalized: !0 + } : { + type: G.UNSIGNED_BYTE, + value: t || new Uint8ClampedArray(), + size: 4, + normalized: !0 + }; } const Li = new A(); -function um (e, t) { - if (!t) { return null; } +function um(e, t) { + if (!t) + return null; if (e.isOctEncoded16P) { const n = new Float32Array((e.pointsLength || 0) * 3); - for (let s = 0; s < (e.pointsLength || 0); s++) { qd(t[s * 2], t[s * 2 + 1], Li), Li.toArray(n, s * 3); } + for (let s = 0; s < (e.pointsLength || 0); s++) + qd(t[s * 2], t[s * 2 + 1], Li), Li.toArray(n, s * 3); return { type: G.FLOAT, size: 2, @@ -4949,24 +4685,21 @@ function um (e, t) { value: t }; } -function lm (e, t, n) { - return e.isQuantized - ? n['3d-tiles'] && n['3d-tiles'].decodeQuantizedPositions - ? (e.isQuantized = !1, hm(e, t)) - : { - type: G.UNSIGNED_SHORT, - value: t, - size: 3, - normalized: !0 - } - : t; -} -function hm (e, t) { - const n = new A(); const s = new Float32Array(e.pointCount * 3); - for (let r = 0; r < e.pointCount; r++) { n.set(t[r * 3], t[r * 3 + 1], t[r * 3 + 2]).scale(1 / e.quantizedRange).multiply(e.quantizedVolumeScale).add(e.quantizedVolumeOffset).toArray(s, r * 3); } +function lm(e, t, n) { + return e.isQuantized ? n["3d-tiles"] && n["3d-tiles"].decodeQuantizedPositions ? (e.isQuantized = !1, hm(e, t)) : { + type: G.UNSIGNED_SHORT, + value: t, + size: 3, + normalized: !0 + } : t; +} +function hm(e, t) { + const n = new A(), s = new Float32Array(e.pointCount * 3); + for (let r = 0; r < e.pointCount; r++) + n.set(t[r * 3], t[r * 3 + 1], t[r * 3 + 2]).scale(1 / e.quantizedRange).multiply(e.quantizedVolumeScale).add(e.quantizedVolumeOffset).toArray(s, r * 3); return s; } -async function fm (e, t, n, s, r) { +async function fm(e, t, n, s, r) { n = qn(e, t, n), n = _r(e, t, n), n = wr(e, t, n), dm(e); const { featureTable: i, @@ -4974,7 +4707,7 @@ async function fm (e, t, n, s, r) { } = mm(e); return await Bm(e, i, o, s, r), gm(e, i, s), Am(e, i, o), pm(e, i), n; } -function dm (e) { +function dm(e) { e.attributes = { positions: null, colors: null, @@ -4982,33 +4715,39 @@ function dm (e) { batchIds: null }, e.isQuantized = !1, e.isTranslucent = !1, e.isRGB565 = !1, e.isOctEncoded16P = !1; } -function mm (e) { - const t = new br(e.featureTableJson, e.featureTableBinary); const n = t.getGlobalProperty('POINTS_LENGTH'); - if (!Number.isFinite(n)) { throw new Error('POINTS_LENGTH must be defined'); } - t.featuresLength = n, e.featuresLength = n, e.pointsLength = n, e.pointCount = n, e.rtcCenter = t.getGlobalProperty('RTC_CENTER', G.FLOAT, 3); +function mm(e) { + const t = new br(e.featureTableJson, e.featureTableBinary), n = t.getGlobalProperty("POINTS_LENGTH"); + if (!Number.isFinite(n)) + throw new Error("POINTS_LENGTH must be defined"); + t.featuresLength = n, e.featuresLength = n, e.pointsLength = n, e.pointCount = n, e.rtcCenter = t.getGlobalProperty("RTC_CENTER", G.FLOAT, 3); const s = ym(e, t); return { featureTable: t, batchTable: s }; } -function gm (e, t, n) { +function gm(e, t, n) { if (e.attributes = e.attributes || { positions: null, colors: null, normals: null, batchIds: null }, !e.attributes.positions) { - if (t.hasProperty('POSITION')) { e.attributes.positions = t.getPropertyArray('POSITION', G.FLOAT, 3); } else if (t.hasProperty('POSITION_QUANTIZED')) { - const s = t.getPropertyArray('POSITION_QUANTIZED', G.UNSIGNED_SHORT, 3); - if (e.isQuantized = !0, e.quantizedRange = 65535, e.quantizedVolumeScale = t.getGlobalProperty('QUANTIZED_VOLUME_SCALE', G.FLOAT, 3), !e.quantizedVolumeScale) { throw new Error('QUANTIZED_VOLUME_SCALE must be defined for quantized positions.'); } - if (e.quantizedVolumeOffset = t.getGlobalProperty('QUANTIZED_VOLUME_OFFSET', G.FLOAT, 3), !e.quantizedVolumeOffset) { throw new Error('QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.'); } + if (t.hasProperty("POSITION")) + e.attributes.positions = t.getPropertyArray("POSITION", G.FLOAT, 3); + else if (t.hasProperty("POSITION_QUANTIZED")) { + const s = t.getPropertyArray("POSITION_QUANTIZED", G.UNSIGNED_SHORT, 3); + if (e.isQuantized = !0, e.quantizedRange = 65535, e.quantizedVolumeScale = t.getGlobalProperty("QUANTIZED_VOLUME_SCALE", G.FLOAT, 3), !e.quantizedVolumeScale) + throw new Error("QUANTIZED_VOLUME_SCALE must be defined for quantized positions."); + if (e.quantizedVolumeOffset = t.getGlobalProperty("QUANTIZED_VOLUME_OFFSET", G.FLOAT, 3), !e.quantizedVolumeOffset) + throw new Error("QUANTIZED_VOLUME_OFFSET must be defined for quantized positions."); e.attributes.positions = lm(e, s, n); } } - if (!e.attributes.positions) { throw new Error('Either POSITION or POSITION_QUANTIZED must be defined.'); } + if (!e.attributes.positions) + throw new Error("Either POSITION or POSITION_QUANTIZED must be defined."); } -function Am (e, t, n) { +function Am(e, t, n) { if (e.attributes = e.attributes || { positions: null, colors: null, @@ -5016,11 +4755,11 @@ function Am (e, t, n) { batchIds: null }, !e.attributes.colors) { let s = null; - t.hasProperty('RGBA') ? (s = t.getPropertyArray('RGBA', G.UNSIGNED_BYTE, 4), e.isTranslucent = !0) : t.hasProperty('RGB') ? s = t.getPropertyArray('RGB', G.UNSIGNED_BYTE, 3) : t.hasProperty('RGB565') && (s = t.getPropertyArray('RGB565', G.UNSIGNED_SHORT, 1), e.isRGB565 = !0), e.attributes.colors = Ga(e, s, n); + t.hasProperty("RGBA") ? (s = t.getPropertyArray("RGBA", G.UNSIGNED_BYTE, 4), e.isTranslucent = !0) : t.hasProperty("RGB") ? s = t.getPropertyArray("RGB", G.UNSIGNED_BYTE, 3) : t.hasProperty("RGB565") && (s = t.getPropertyArray("RGB565", G.UNSIGNED_SHORT, 1), e.isRGB565 = !0), e.attributes.colors = Ga(e, s, n); } - t.hasProperty('CONSTANT_RGBA') && (e.constantRGBA = t.getGlobalProperty('CONSTANT_RGBA', G.UNSIGNED_BYTE, 4)); + t.hasProperty("CONSTANT_RGBA") && (e.constantRGBA = t.getGlobalProperty("CONSTANT_RGBA", G.UNSIGNED_BYTE, 4)); } -function pm (e, t) { +function pm(e, t) { if (e.attributes = e.attributes || { positions: null, colors: null, @@ -5028,14 +4767,15 @@ function pm (e, t) { batchIds: null }, !e.attributes.normals) { let n = null; - t.hasProperty('NORMAL') ? n = t.getPropertyArray('NORMAL', G.FLOAT, 3) : t.hasProperty('NORMAL_OCT16P') && (n = t.getPropertyArray('NORMAL_OCT16P', G.UNSIGNED_BYTE, 2), e.isOctEncoded16P = !0), e.attributes.normals = um(e, n); + t.hasProperty("NORMAL") ? n = t.getPropertyArray("NORMAL", G.FLOAT, 3) : t.hasProperty("NORMAL_OCT16P") && (n = t.getPropertyArray("NORMAL_OCT16P", G.UNSIGNED_BYTE, 2), e.isOctEncoded16P = !0), e.attributes.normals = um(e, n); } } -function ym (e, t) { +function ym(e, t) { let n = null; - if (!e.batchIds && t.hasProperty('BATCH_ID') && (e.batchIds = t.getPropertyArray('BATCH_ID', G.UNSIGNED_SHORT, 1), e.batchIds)) { - const s = t.getGlobalProperty('BATCH_LENGTH'); - if (!s) { throw new Error('Global property: BATCH_LENGTH must be defined when BATCH_ID is defined.'); } + if (!e.batchIds && t.hasProperty("BATCH_ID") && (e.batchIds = t.getPropertyArray("BATCH_ID", G.UNSIGNED_SHORT, 1), e.batchIds)) { + const s = t.getGlobalProperty("BATCH_LENGTH"); + if (!s) + throw new Error("Global property: BATCH_LENGTH must be defined when BATCH_ID is defined."); const { batchTableJson: r, batchTableBinary: i @@ -5044,18 +4784,20 @@ function ym (e, t) { } return n; } -async function Bm (e, t, n, s, r) { +async function Bm(e, t, n, s, r) { let i, o, a; - const c = e.batchTableJson && e.batchTableJson.extensions && e.batchTableJson.extensions['3DTILES_draco_point_compression']; + const c = e.batchTableJson && e.batchTableJson.extensions && e.batchTableJson.extensions["3DTILES_draco_point_compression"]; c && (a = c.properties); - const u = t.getExtension('3DTILES_draco_point_compression'); + const u = t.getExtension("3DTILES_draco_point_compression"); if (u) { o = u.properties; - const h = u.byteOffset; const f = u.byteLength; - if (!o || !Number.isFinite(h) || !f) { throw new Error('Draco properties, byteOffset, and byteLength must be defined'); } + const h = u.byteOffset, f = u.byteLength; + if (!o || !Number.isFinite(h) || !f) + throw new Error("Draco properties, byteOffset, and byteLength must be defined"); i = (e.featureTableBinary || []).slice(h, h + f), e.hasPositions = Number.isFinite(o.POSITION), e.hasColors = Number.isFinite(o.RGB) || Number.isFinite(o.RGBA), e.hasNormals = Number.isFinite(o.NORMAL), e.hasBatchIds = Number.isFinite(o.BATCH_ID), e.isTranslucent = Number.isFinite(o.RGBA); } - if (!i) { return !0; } + if (!i) + return !0; const l = { buffer: i, properties: { @@ -5068,8 +4810,9 @@ async function Bm (e, t, n, s, r) { }; return await Cm(e, l, s, r); } -async function Cm (e, t, n, s) { - if (!s) { return; } +async function Cm(e, t, n, s) { + if (!s) + return; const r = { ...n, draco: { @@ -5077,17 +4820,17 @@ async function Cm (e, t, n, s) { extraAttributes: t.batchTableProperties || {} } }; - delete r['3d-tiles']; - const i = await Ke(t.buffer, Da, r, s); const o = i.attributes.POSITION && i.attributes.POSITION.value; const a = i.attributes.COLOR_0 && i.attributes.COLOR_0.value; const c = i.attributes.NORMAL && i.attributes.NORMAL.value; const u = i.attributes.BATCH_ID && i.attributes.BATCH_ID.value; const l = o && i.attributes.POSITION.value.quantization; const h = c && i.attributes.NORMAL.value.quantization; + delete r["3d-tiles"]; + const i = await Ke(t.buffer, Da, r, s), o = i.attributes.POSITION && i.attributes.POSITION.value, a = i.attributes.COLOR_0 && i.attributes.COLOR_0.value, c = i.attributes.NORMAL && i.attributes.NORMAL.value, u = i.attributes.BATCH_ID && i.attributes.BATCH_ID.value, l = o && i.attributes.POSITION.value.quantization, h = c && i.attributes.NORMAL.value.quantization; if (l) { - const d = i.POSITION.data.quantization; const m = d.range; + const d = i.POSITION.data.quantization, m = d.range; e.quantizedVolumeScale = new A(m, m, m), e.quantizedVolumeOffset = new A(d.minValues), e.quantizedRange = (1 << d.quantizationBits) - 1, e.isQuantizedDraco = !0; } h && (e.octEncodedRange = (1 << i.NORMAL.data.quantization.quantizationBits) - 1, e.isOctEncodedDraco = !0); const f = {}; - if (t.batchTableProperties) { - for (const d of Object.keys(t.batchTableProperties)) { i.attributes[d] && i.attributes[d].value && (f[d.toLowerCase()] = i.attributes[d].value); } - } + if (t.batchTableProperties) + for (const d of Object.keys(t.batchTableProperties)) + i.attributes[d] && i.attributes[d].value && (f[d.toLowerCase()] = i.attributes[d].value); e.attributes = { positions: o, colors: Ga(e, a, void 0), @@ -5096,59 +4839,64 @@ async function Cm (e, t, n, s) { ...f }; } -const Em = '4.1.1'; -let Es; -const Tm = (Es = globalThis.loaders) === null || Es === void 0 ? void 0 : Es.parseImageNode; const Xs = typeof Image < 'u'; const Qs = typeof ImageBitmap < 'u'; const bm = !!Tm; const qs = kn ? !0 : bm; -function _m (e) { +const Em = "4.1.1"; +var Es; +const Tm = (Es = globalThis.loaders) === null || Es === void 0 ? void 0 : Es.parseImageNode, Xs = typeof Image < "u", Qs = typeof ImageBitmap < "u", bm = !!Tm, qs = kn ? !0 : bm; +function _m(e) { switch (e) { - case 'auto': + case "auto": return Qs || Xs || qs; - case 'imagebitmap': + case "imagebitmap": return Qs; - case 'image': + case "image": return Xs; - case 'data': + case "data": return qs; default: throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`); } } -function wm () { - if (Qs) { return 'imagebitmap'; } - if (Xs) { return 'image'; } - if (qs) { return 'data'; } +function wm() { + if (Qs) + return "imagebitmap"; + if (Xs) + return "image"; + if (qs) + return "data"; throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js"); } -function Rm (e) { +function Rm(e) { const t = Mm(e); - if (!t) { throw new Error('Not an image'); } + if (!t) + throw new Error("Not an image"); return t; } -function Na (e) { +function Na(e) { switch (Rm(e)) { - case 'data': + case "data": return e; - case 'image': - case 'imagebitmap': - const t = document.createElement('canvas'); const n = t.getContext('2d'); - if (!n) { throw new Error('getImageData'); } + case "image": + case "imagebitmap": + const t = document.createElement("canvas"), n = t.getContext("2d"); + if (!n) + throw new Error("getImageData"); return t.width = e.width, t.height = e.height, n.drawImage(e, 0, 0), n.getImageData(0, 0, e.width, e.height); default: - throw new Error('getImageData'); + throw new Error("getImageData"); } } -function Mm (e) { - return typeof ImageBitmap < 'u' && e instanceof ImageBitmap ? 'imagebitmap' : typeof Image < 'u' && e instanceof Image ? 'image' : e && typeof e === 'object' && e.data && e.width && e.height ? 'data' : null; +function Mm(e) { + return typeof ImageBitmap < "u" && e instanceof ImageBitmap ? "imagebitmap" : typeof Image < "u" && e instanceof Image ? "image" : e && typeof e == "object" && e.data && e.width && e.height ? "data" : null; } -const Sm = /^data:image\/svg\+xml/; const Im = /\.svg((\?|#).*)?$/; -function Rr (e) { +const Sm = /^data:image\/svg\+xml/, Im = /\.svg((\?|#).*)?$/; +function Rr(e) { return e && (Sm.test(e) || Im.test(e)); } -function xm (e, t) { +function xm(e, t) { if (Rr(t)) { let s = new TextDecoder().decode(e); try { - typeof unescape === 'function' && typeof encodeURIComponent === 'function' && (s = unescape(encodeURIComponent(s))); + typeof unescape == "function" && typeof encodeURIComponent == "function" && (s = unescape(encodeURIComponent(s))); } catch (i) { throw new Error(i.message); } @@ -5156,249 +4904,246 @@ function xm (e, t) { } return Ua(e, t); } -function Ua (e, t) { - if (Rr(t)) { throw new Error('SVG cannot be parsed directly to imagebitmap'); } +function Ua(e, t) { + if (Rr(t)) + throw new Error("SVG cannot be parsed directly to imagebitmap"); return new Blob([new Uint8Array(e)]); } -async function Ha (e, t, n) { - const s = xm(e, n); const r = self.URL || self.webkitURL; const i = typeof s !== 'string' && r.createObjectURL(s); +async function Ha(e, t, n) { + const s = xm(e, n), r = self.URL || self.webkitURL, i = typeof s != "string" && r.createObjectURL(s); try { return await vm(i || s, t); } finally { i && r.revokeObjectURL(i); } } -async function vm (e, t) { +async function vm(e, t) { const n = new Image(); - return n.src = e, t.image && t.image.decode && n.decode - ? (await n.decode(), n) - : await new Promise((s, r) => { - try { - n.onload = () => s(n), n.onerror = (i) => { - const o = i instanceof Error ? i.message : 'error'; - r(new Error(o)); - }; - } catch (i) { - r(i); - } - }); + return n.src = e, t.image && t.image.decode && n.decode ? (await n.decode(), n) : await new Promise((s, r) => { + try { + n.onload = () => s(n), n.onerror = (i) => { + const o = i instanceof Error ? i.message : "error"; + r(new Error(o)); + }; + } catch (i) { + r(i); + } + }); } const Om = {}; let Pi = !0; -async function Fm (e, t, n) { +async function Fm(e, t, n) { let s; Rr(n) ? s = await Ha(e, t, n) : s = Ua(e, n); const r = t && t.imagebitmap; return await Dm(s, r); } -async function Dm (e) { +async function Dm(e) { let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null; - if ((Lm(t) || !Pi) && (t = null), t) { + if ((Lm(t) || !Pi) && (t = null), t) try { return await createImageBitmap(e, t); } catch (n) { console.warn(n), Pi = !1; } - } return await createImageBitmap(e); } -function Lm (e) { - for (const t in e || Om) { return !1; } +function Lm(e) { + for (const t in e || Om) + return !1; return !0; } -function Pm (e) { - return !Hm(e, 'ftyp', 4) || !(e[8] & 96) ? null : Gm(e); +function Pm(e) { + return !Hm(e, "ftyp", 4) || !(e[8] & 96) ? null : Gm(e); } -function Gm (e) { - switch (Nm(e, 8, 12).replace('\0', ' ').trim()) { - case 'avif': - case 'avis': +function Gm(e) { + switch (Nm(e, 8, 12).replace("\0", " ").trim()) { + case "avif": + case "avis": return { - extension: 'avif', - mimeType: 'image/avif' + extension: "avif", + mimeType: "image/avif" }; default: return null; } } -function Nm (e, t, n) { +function Nm(e, t, n) { return String.fromCharCode(...e.slice(t, n)); } -function Um (e) { +function Um(e) { return [...e].map((t) => t.charCodeAt(0)); } -function Hm (e, t) { - const n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0; +function Hm(e, t) { + let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0; const s = Um(t); - for (let r = 0; r < s.length; ++r) { - if (s[r] !== e[r + n]) { return !1; } - } + for (let r = 0; r < s.length; ++r) + if (s[r] !== e[r + n]) + return !1; return !0; } -const Dt = !1; const De = !0; -function Mr (e) { +const Dt = !1, De = !0; +function Mr(e) { const t = Ye(e); return Vm(t) || Km(t) || jm(t) || km(t) || Jm(t); } -function Jm (e) { - const t = new Uint8Array(e instanceof DataView ? e.buffer : e); const n = Pm(t); - return n - ? { - mimeType: n.mimeType, - width: 0, - height: 0 - } - : null; +function Jm(e) { + const t = new Uint8Array(e instanceof DataView ? e.buffer : e), n = Pm(t); + return n ? { + mimeType: n.mimeType, + width: 0, + height: 0 + } : null; } -function Vm (e) { +function Vm(e) { const t = Ye(e); - return t.byteLength >= 24 && t.getUint32(0, Dt) === 2303741511 - ? { - mimeType: 'image/png', - width: t.getUint32(16, Dt), - height: t.getUint32(20, Dt) - } - : null; + return t.byteLength >= 24 && t.getUint32(0, Dt) === 2303741511 ? { + mimeType: "image/png", + width: t.getUint32(16, Dt), + height: t.getUint32(20, Dt) + } : null; } -function jm (e) { +function jm(e) { const t = Ye(e); - return t.byteLength >= 10 && t.getUint32(0, Dt) === 1195984440 - ? { - mimeType: 'image/gif', - width: t.getUint16(6, De), - height: t.getUint16(8, De) - } - : null; + return t.byteLength >= 10 && t.getUint32(0, Dt) === 1195984440 ? { + mimeType: "image/gif", + width: t.getUint16(6, De), + height: t.getUint16(8, De) + } : null; } -function km (e) { +function km(e) { const t = Ye(e); - return t.byteLength >= 14 && t.getUint16(0, Dt) === 16973 && t.getUint32(2, De) === t.byteLength - ? { - mimeType: 'image/bmp', - width: t.getUint32(18, De), - height: t.getUint32(22, De) - } - : null; + return t.byteLength >= 14 && t.getUint16(0, Dt) === 16973 && t.getUint32(2, De) === t.byteLength ? { + mimeType: "image/bmp", + width: t.getUint32(18, De), + height: t.getUint32(22, De) + } : null; } -function Km (e) { +function Km(e) { const t = Ye(e); - if (!(t.byteLength >= 3 && t.getUint16(0, Dt) === 65496 && t.getUint8(2) === 255)) { return null; } + if (!(t.byteLength >= 3 && t.getUint16(0, Dt) === 65496 && t.getUint8(2) === 255)) + return null; const { tableMarkers: s, sofMarkers: r } = zm(); let i = 2; - for (; i + 9 < t.byteLength;) { + for (; i + 9 < t.byteLength; ) { const o = t.getUint16(i, Dt); - if (r.has(o)) { + if (r.has(o)) return { - mimeType: 'image/jpeg', + mimeType: "image/jpeg", height: t.getUint16(i + 5, Dt), width: t.getUint16(i + 7, Dt) }; - } - if (!s.has(o)) { return null; } + if (!s.has(o)) + return null; i += 2, i += t.getUint16(i, Dt); } return null; } -function zm () { +function zm() { const e = /* @__PURE__ */ new Set([65499, 65476, 65484, 65501, 65534]); - for (let n = 65504; n < 65520; ++n) { e.add(n); } + for (let n = 65504; n < 65520; ++n) + e.add(n); return { tableMarkers: e, sofMarkers: /* @__PURE__ */ new Set([65472, 65473, 65474, 65475, 65477, 65478, 65479, 65481, 65482, 65483, 65485, 65486, 65487, 65502]) }; } -function Ye (e) { - if (e instanceof DataView) { return e; } - if (ArrayBuffer.isView(e)) { return new DataView(e.buffer); } - if (e instanceof ArrayBuffer) { return new DataView(e); } - throw new Error('toDataView'); -} -async function Wm (e, t) { - let n; +function Ye(e) { + if (e instanceof DataView) + return e; + if (ArrayBuffer.isView(e)) + return new DataView(e.buffer); + if (e instanceof ArrayBuffer) + return new DataView(e); + throw new Error("toDataView"); +} +async function Wm(e, t) { + var n; const { mimeType: s - } = Mr(e) || {}; const r = (n = globalThis.loaders) === null || n === void 0 ? void 0 : n.parseImageNode; + } = Mr(e) || {}, r = (n = globalThis.loaders) === null || n === void 0 ? void 0 : n.parseImageNode; return z(r), await r(e, s); } -async function Xm (e, t, n) { +async function Xm(e, t, n) { t = t || {}; - const r = (t.image || {}).type || 'auto'; const { + const r = (t.image || {}).type || "auto", { url: i - } = n || {}; const o = Qm(r); + } = n || {}, o = Qm(r); let a; switch (o) { - case 'imagebitmap': + case "imagebitmap": a = await Fm(e, t, i); break; - case 'image': + case "image": a = await Ha(e, t, i); break; - case 'data': + case "data": a = await Wm(e); break; default: z(!1); } - return r === 'data' && (a = Na(a)), a; + return r === "data" && (a = Na(a)), a; } -function Qm (e) { +function Qm(e) { switch (e) { - case 'auto': - case 'data': + case "auto": + case "data": return wm(); default: return _m(e), e; } } -const qm = ['png', 'jpg', 'jpeg', 'gif', 'webp', 'bmp', 'ico', 'svg', 'avif']; const Ym = ['image/png', 'image/jpeg', 'image/gif', 'image/webp', 'image/avif', 'image/bmp', 'image/vnd.microsoft.icon', 'image/svg+xml']; const $m = { +const qm = ["png", "jpg", "jpeg", "gif", "webp", "bmp", "ico", "svg", "avif"], Ym = ["image/png", "image/jpeg", "image/gif", "image/webp", "image/avif", "image/bmp", "image/vnd.microsoft.icon", "image/svg+xml"], $m = { image: { - type: 'auto', + type: "auto", decode: !0 } -}; const Zm = { - id: 'image', - module: 'images', - name: 'Images', +}, Zm = { + id: "image", + module: "images", + name: "Images", version: Em, mimeTypes: Ym, extensions: qm, parse: Xm, tests: [(e) => !!Mr(new DataView(e))], options: $m -}; const Ts = {}; -function tg (e) { +}, Ts = {}; +function tg(e) { if (Ts[e] === void 0) { const t = kn ? ng(e) : eg(e); Ts[e] = t; } return Ts[e]; } -function eg (e) { - let t, n; - const s = ['image/png', 'image/jpeg', 'image/gif']; const r = ((t = globalThis.loaders) === null || t === void 0 ? void 0 : t.imageFormatsNode) || s; +function eg(e) { + var t, n; + const s = ["image/png", "image/jpeg", "image/gif"], r = ((t = globalThis.loaders) === null || t === void 0 ? void 0 : t.imageFormatsNode) || s; return !!((n = globalThis.loaders) === null || n === void 0 ? void 0 : n.parseImageNode) && r.includes(e); } -function ng (e) { +function ng(e) { switch (e) { - case 'image/avif': - case 'image/webp': + case "image/avif": + case "image/webp": return sg(e); default: return !0; } } -function sg (e) { +function sg(e) { try { - return document.createElement('canvas').toDataURL(e).indexOf(`data:${e}`) === 0; + return document.createElement("canvas").toDataURL(e).indexOf(`data:${e}`) === 0; } catch { return !1; } } -function yt (e, t) { - if (!e) { throw new Error(t || 'assert failed: gltf'); } +function yt(e, t) { + if (!e) + throw new Error(t || "assert failed: gltf"); } const Ja = { SCALAR: 1, @@ -5408,14 +5153,14 @@ const Ja = { MAT2: 4, MAT3: 9, MAT4: 16 -}; const Va = { +}, Va = { 5120: 1, 5121: 1, 5122: 2, 5123: 2, 5125: 4, 5126: 4 -}; const rg = 1.33; const Gi = ['SCALAR', 'VEC2', 'VEC3', 'VEC4']; const ig = [[Int8Array, 5120], [Uint8Array, 5121], [Int16Array, 5122], [Uint16Array, 5123], [Uint32Array, 5125], [Float32Array, 5126], [Float64Array, 5130]]; const og = new Map(ig); const ag = { +}, rg = 1.33, Gi = ["SCALAR", "VEC2", "VEC3", "VEC4"], ig = [[Int8Array, 5120], [Uint8Array, 5121], [Int16Array, 5122], [Uint16Array, 5123], [Uint32Array, 5125], [Float32Array, 5126], [Float64Array, 5130]], og = new Map(ig), ag = { SCALAR: 1, VEC2: 2, VEC3: 3, @@ -5423,14 +5168,14 @@ const Ja = { MAT2: 4, MAT3: 9, MAT4: 16 -}; const cg = { +}, cg = { 5120: 1, 5121: 1, 5122: 2, 5123: 2, 5125: 4, 5126: 4 -}; const ug = { +}, ug = { 5120: Int8Array, 5121: Uint8Array, 5122: Int16Array, @@ -5438,18 +5183,19 @@ const Ja = { 5125: Uint32Array, 5126: Float32Array }; -function ja (e) { +function ja(e) { return Gi[e - 1] || Gi[0]; } -function Sr (e) { +function Sr(e) { const t = og.get(e.constructor); - if (!t) { throw new Error('Illegal typed array'); } + if (!t) + throw new Error("Illegal typed array"); return t; } -function Ir (e, t) { - const n = ug[e.componentType]; const s = ag[e.type]; const r = cg[e.componentType]; const i = e.count * s; const o = e.count * s * r; +function Ir(e, t) { + const n = ug[e.componentType], s = ag[e.type], r = cg[e.componentType], i = e.count * s, o = e.count * s * r; yt(o >= 0 && o <= t.byteLength); - const a = Va[e.componentType]; const c = Ja[e.type]; + const a = Va[e.componentType], c = Ja[e.type]; return { ArrayType: n, length: i, @@ -5458,7 +5204,7 @@ function Ir (e, t) { numberOfComponentsInElement: c }; } -function ka (e) { +function ka(e) { let { images: t, bufferViews: n @@ -5466,7 +5212,7 @@ function ka (e) { t = t || [], n = n || []; const s = t.map((o) => o.bufferView); n = n.filter((o) => !s.includes(o)); - const r = n.reduce((o, a) => o + a.byteLength, 0); const i = t.reduce((o, a) => { + const r = n.reduce((o, a) => o + a.byteLength, 0), i = t.reduce((o, a) => { const { width: c, height: u @@ -5475,30 +5221,33 @@ function ka (e) { }, 0); return r + Math.ceil(4 * i * rg); } -function lg (e, t, n) { +function lg(e, t, n) { const s = e.bufferViews[n]; yt(s); - const r = s.buffer; const i = t[r]; + const r = s.buffer, i = t[r]; yt(i); const o = (s.byteOffset || 0) + i.byteOffset; return new Uint8Array(i.arrayBuffer, o, s.byteLength); } -function hg (e, t, n) { - let s, r; - const i = typeof n === 'number' ? (s = e.accessors) === null || s === void 0 ? void 0 : s[n] : n; - if (!i) { throw new Error(`No gltf accessor ${JSON.stringify(n)}`); } +function hg(e, t, n) { + var s, r; + const i = typeof n == "number" ? (s = e.accessors) === null || s === void 0 ? void 0 : s[n] : n; + if (!i) + throw new Error(`No gltf accessor ${JSON.stringify(n)}`); const o = (r = e.bufferViews) === null || r === void 0 ? void 0 : r[i.bufferView || 0]; - if (!o) { throw new Error(`No gltf buffer view for accessor ${o}`); } + if (!o) + throw new Error(`No gltf buffer view for accessor ${o}`); const { arrayBuffer: a, byteOffset: c - } = t[o.buffer]; const u = (c || 0) + (i.byteOffset || 0) + (o.byteOffset || 0); const { + } = t[o.buffer], u = (c || 0) + (i.byteOffset || 0) + (o.byteOffset || 0), { ArrayType: l, length: h, componentByteSize: f, numberOfComponentsInElement: d - } = Ir(i, o); const m = f * d; const g = o.byteStride || m; - if (typeof o.byteStride > 'u' || o.byteStride === m) { return new l(a, u, h); } + } = Ir(i, o), m = f * d, g = o.byteStride || m; + if (typeof o.byteStride > "u" || o.byteStride === m) + return new l(a, u, h); const y = new l(h); for (let E = 0; E < i.count; E++) { const R = new l(a, u + E * g, d); @@ -5506,11 +5255,11 @@ function hg (e, t, n) { } return y; } -function fg () { +function fg() { return { asset: { - version: '2.0', - generator: 'loaders.gl' + version: "2.0", + generator: "loaders.gl" }, buffers: [], extensions: {}, @@ -5519,144 +5268,116 @@ function fg () { }; } class ot { - constructor (t) { + constructor(t) { this.gltf = void 0, this.sourceBuffers = void 0, this.byteLength = void 0, this.gltf = { json: (t == null ? void 0 : t.json) || fg(), buffers: (t == null ? void 0 : t.buffers) || [], images: (t == null ? void 0 : t.images) || [] }, this.sourceBuffers = [], this.byteLength = 0, this.gltf.buffers && this.gltf.buffers[0] && (this.byteLength = this.gltf.buffers[0].byteLength, this.sourceBuffers = [this.gltf.buffers[0]]); } - - get json () { + get json() { return this.gltf.json; } - - getApplicationData (t) { + getApplicationData(t) { return this.json[t]; } - - getExtraData (t) { + getExtraData(t) { return (this.json.extras || {})[t]; } - - hasExtension (t) { - const n = this.getUsedExtensions().find((r) => r === t); const s = this.getRequiredExtensions().find((r) => r === t); - return typeof n === 'string' || typeof s === 'string'; + hasExtension(t) { + const n = this.getUsedExtensions().find((r) => r === t), s = this.getRequiredExtensions().find((r) => r === t); + return typeof n == "string" || typeof s == "string"; } - - getExtension (t) { - const n = this.getUsedExtensions().find((r) => r === t); const s = this.json.extensions || {}; + getExtension(t) { + const n = this.getUsedExtensions().find((r) => r === t), s = this.json.extensions || {}; return n ? s[t] : null; } - - getRequiredExtension (t) { + getRequiredExtension(t) { return this.getRequiredExtensions().find((s) => s === t) ? this.getExtension(t) : null; } - - getRequiredExtensions () { + getRequiredExtensions() { return this.json.extensionsRequired || []; } - - getUsedExtensions () { + getUsedExtensions() { return this.json.extensionsUsed || []; } - - getRemovedExtensions () { + getRemovedExtensions() { return this.json.extensionsRemoved || []; } - - getObjectExtension (t, n) { + getObjectExtension(t, n) { return (t.extensions || {})[n]; } - - getScene (t) { - return this.getObject('scenes', t); + getScene(t) { + return this.getObject("scenes", t); } - - getNode (t) { - return this.getObject('nodes', t); + getNode(t) { + return this.getObject("nodes", t); } - - getSkin (t) { - return this.getObject('skins', t); + getSkin(t) { + return this.getObject("skins", t); } - - getMesh (t) { - return this.getObject('meshes', t); + getMesh(t) { + return this.getObject("meshes", t); } - - getMaterial (t) { - return this.getObject('materials', t); + getMaterial(t) { + return this.getObject("materials", t); } - - getAccessor (t) { - return this.getObject('accessors', t); + getAccessor(t) { + return this.getObject("accessors", t); } - - getTexture (t) { - return this.getObject('textures', t); + getTexture(t) { + return this.getObject("textures", t); } - - getSampler (t) { - return this.getObject('samplers', t); + getSampler(t) { + return this.getObject("samplers", t); } - - getImage (t) { - return this.getObject('images', t); + getImage(t) { + return this.getObject("images", t); } - - getBufferView (t) { - return this.getObject('bufferViews', t); + getBufferView(t) { + return this.getObject("bufferViews", t); } - - getBuffer (t) { - return this.getObject('buffers', t); + getBuffer(t) { + return this.getObject("buffers", t); } - - getObject (t, n) { - if (typeof n === 'object') { return n; } + getObject(t, n) { + if (typeof n == "object") + return n; const s = this.json[t] && this.json[t][n]; - if (!s) { throw new Error(`glTF file error: Could not find ${t}[${n}]`); } + if (!s) + throw new Error(`glTF file error: Could not find ${t}[${n}]`); return s; } - - getTypedArrayForBufferView (t) { + getTypedArrayForBufferView(t) { t = this.getBufferView(t); - const n = t.buffer; const s = this.gltf.buffers[n]; + const n = t.buffer, s = this.gltf.buffers[n]; yt(s); const r = (t.byteOffset || 0) + s.byteOffset; return new Uint8Array(s.arrayBuffer, r, t.byteLength); } - - getTypedArrayForAccessor (t) { + getTypedArrayForAccessor(t) { const n = this.getAccessor(t); return hg(this.gltf.json, this.gltf.buffers, n); } - - getTypedArrayForImageData (t) { + getTypedArrayForImageData(t) { t = this.getAccessor(t); - const n = this.getBufferView(t.bufferView); const r = this.getBuffer(n.buffer).data; const i = n.byteOffset || 0; + const n = this.getBufferView(t.bufferView), r = this.getBuffer(n.buffer).data, i = n.byteOffset || 0; return new Uint8Array(r, i, n.byteLength); } - - addApplicationData (t, n) { + addApplicationData(t, n) { return this.json[t] = n, this; } - - addExtraData (t, n) { + addExtraData(t, n) { return this.json.extras = this.json.extras || {}, this.json.extras[t] = n, this; } - - addObjectExtension (t, n, s) { + addObjectExtension(t, n, s) { return t.extensions = t.extensions || {}, t.extensions[n] = s, this.registerUsedExtension(n), this; } - - setObjectExtension (t, n, s) { + setObjectExtension(t, n, s) { const r = t.extensions || {}; r[n] = s; } - - removeObjectExtension (t, n) { + removeObjectExtension(t, n) { const s = (t == null ? void 0 : t.extensions) || {}; if (s[n]) { this.json.extensionsRemoved = this.json.extensionsRemoved || []; @@ -5665,27 +5386,22 @@ class ot { } delete s[n]; } - - addExtension (t) { - const n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; + addExtension(t) { + let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; return yt(n), this.json.extensions = this.json.extensions || {}, this.json.extensions[t] = n, this.registerUsedExtension(t), n; } - - addRequiredExtension (t) { - const n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; + addRequiredExtension(t) { + let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; return yt(n), this.addExtension(t, n), this.registerRequiredExtension(t), n; } - - registerUsedExtension (t) { + registerUsedExtension(t) { this.json.extensionsUsed = this.json.extensionsUsed || [], this.json.extensionsUsed.find((n) => n === t) || this.json.extensionsUsed.push(t); } - - registerRequiredExtension (t) { + registerRequiredExtension(t) { this.registerUsedExtension(t), this.json.extensionsRequired = this.json.extensionsRequired || [], this.json.extensionsRequired.find((n) => n === t) || this.json.extensionsRequired.push(t); } - - removeExtension (t) { - let n; + removeExtension(t) { + var n; if ((n = this.json.extensions) !== null && n !== void 0 && n[t]) { this.json.extensionsRemoved = this.json.extensionsRemoved || []; const s = this.json.extensionsRemoved; @@ -5693,12 +5409,10 @@ class ot { } this.json.extensions && delete this.json.extensions[t], this.json.extensionsRequired && this._removeStringFromArray(this.json.extensionsRequired, t), this.json.extensionsUsed && this._removeStringFromArray(this.json.extensionsUsed, t); } - - setDefaultScene (t) { + setDefaultScene(t) { this.json.scene = t; } - - addScene (t) { + addScene(t) { const { nodeIndices: n } = t; @@ -5706,8 +5420,7 @@ class ot { nodes: n }), this.json.scenes.length - 1; } - - addNode (t) { + addNode(t) { const { meshIndex: n, matrix: s @@ -5718,14 +5431,13 @@ class ot { }; return s && (r.matrix = s), this.json.nodes.push(r), this.json.nodes.length - 1; } - - addMesh (t) { + addMesh(t) { const { attributes: n, indices: s, material: r, mode: i = 4 - } = t; const a = { + } = t, a = { primitives: [{ attributes: this._addAttributes(n), mode: i @@ -5737,8 +5449,7 @@ class ot { } return Number.isFinite(r) && (a.primitives[0].material = r), this.json.meshes = this.json.meshes || [], this.json.meshes.push(a), this.json.meshes.length - 1; } - - addPointCloud (t) { + addPointCloud(t) { const s = { primitives: [{ attributes: this._addAttributes(t), @@ -5747,17 +5458,15 @@ class ot { }; return this.json.meshes = this.json.meshes || [], this.json.meshes.push(s), this.json.meshes.length - 1; } - - addImage (t, n) { - const s = Mr(t); const r = n || (s == null ? void 0 : s.mimeType); const o = { + addImage(t, n) { + const s = Mr(t), r = n || (s == null ? void 0 : s.mimeType), o = { bufferView: this.addBufferView(t), mimeType: r }; return this.json.images = this.json.images || [], this.json.images.push(o), this.json.images.length - 1; } - - addBufferView (t) { - const n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0; const s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : this.byteLength; + addBufferView(t) { + let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0, s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : this.byteLength; const r = t.byteLength; yt(Number.isFinite(r)), this.sourceBuffers = this.sourceBuffers || [], this.sourceBuffers.push(t); const i = { @@ -5767,8 +5476,7 @@ class ot { }; return this.byteLength += ze(r, 4), this.json.bufferViews = this.json.bufferViews || [], this.json.bufferViews.push(i), this.json.bufferViews.length - 1; } - - addAccessor (t, n) { + addAccessor(t, n) { const s = { bufferView: t, type: ja(n.size), @@ -5779,13 +5487,10 @@ class ot { }; return this.json.accessors = this.json.accessors || [], this.json.accessors.push(s), this.json.accessors.length - 1; } - - addBinaryBuffer (t) { - const n = arguments.length > 1 && arguments[1] !== void 0 - ? arguments[1] - : { - size: 3 - }; + addBinaryBuffer(t) { + let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : { + size: 3 + }; const s = this.addBufferView(t); let r = { min: n.min, @@ -5801,93 +5506,86 @@ class ot { }; return this.addAccessor(s, Object.assign(i, n)); } - - addTexture (t) { + addTexture(t) { const { imageIndex: n - } = t; const s = { + } = t, s = { source: n }; return this.json.textures = this.json.textures || [], this.json.textures.push(s), this.json.textures.length - 1; } - - addMaterial (t) { + addMaterial(t) { return this.json.materials = this.json.materials || [], this.json.materials.push(t), this.json.materials.length - 1; } - - createBinaryChunk () { - let t, n; + createBinaryChunk() { + var t, n; this.gltf.buffers = []; - const s = this.byteLength; const r = new ArrayBuffer(s); const i = new Uint8Array(r); + const s = this.byteLength, r = new ArrayBuffer(s), i = new Uint8Array(r); let o = 0; - for (const a of this.sourceBuffers || []) { o = Nu(a, i, o); } - (t = this.json) !== null && t !== void 0 && (n = t.buffers) !== null && n !== void 0 && n[0] - ? this.json.buffers[0].byteLength = s - : this.json.buffers = [{ - byteLength: s - }], this.gltf.binary = r, this.sourceBuffers = [r]; + for (const a of this.sourceBuffers || []) + o = Nu(a, i, o); + (t = this.json) !== null && t !== void 0 && (n = t.buffers) !== null && n !== void 0 && n[0] ? this.json.buffers[0].byteLength = s : this.json.buffers = [{ + byteLength: s + }], this.gltf.binary = r, this.sourceBuffers = [r]; } - - _removeStringFromArray (t, n) { + _removeStringFromArray(t, n) { let s = !0; - for (; s;) { + for (; s; ) { const r = t.indexOf(n); r > -1 ? t.splice(r, 1) : s = !1; } } - - _addAttributes () { - const t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; + _addAttributes() { + let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; const n = {}; for (const s in t) { - const r = t[s]; const i = this._getGltfAttributeName(s); const o = this.addBinaryBuffer(r.value, r); + const r = t[s], i = this._getGltfAttributeName(s), o = this.addBinaryBuffer(r.value, r); n[i] = o; } return n; } - - _addIndices (t) { + _addIndices(t) { return this.addBinaryBuffer(t, { size: 1 }); } - - _getGltfAttributeName (t) { + _getGltfAttributeName(t) { switch (t.toLowerCase()) { - case 'position': - case 'positions': - case 'vertices': - return 'POSITION'; - case 'normal': - case 'normals': - return 'NORMAL'; - case 'color': - case 'colors': - return 'COLOR_0'; - case 'texcoord': - case 'texcoords': - return 'TEXCOORD_0'; + case "position": + case "positions": + case "vertices": + return "POSITION"; + case "normal": + case "normals": + return "NORMAL"; + case "color": + case "colors": + return "COLOR_0"; + case "texcoord": + case "texcoords": + return "TEXCOORD_0"; default: return t; } } - - _getAccessorMinMax (t, n) { + _getAccessorMinMax(t, n) { const s = { min: null, max: null }; - if (t.length < n) { return s; } + if (t.length < n) + return s; s.min = [], s.max = []; const r = t.subarray(0, n); - for (const i of r) { s.min.push(i), s.max.push(i); } - for (let i = n; i < t.length; i += n) { - for (let o = 0; o < n; o++) { s.min[0 + o] = Math.min(s.min[0 + o], t[i + o]), s.max[0 + o] = Math.max(s.max[0 + o], t[i + o]); } - } + for (const i of r) + s.min.push(i), s.max.push(i); + for (let i = n; i < t.length; i += n) + for (let o = 0; o < n; o++) + s.min[0 + o] = Math.min(s.min[0 + o], t[i + o]), s.max[0 + o] = Math.max(s.max[0 + o], t[i + o]); return s; } } -function Ni (e) { +function Ni(e) { return (e % 1 + 1) % 1; } const Ka = { @@ -5901,7 +5599,7 @@ const Ka = { BOOLEAN: 1, STRING: 1, ENUM: 1 -}; const dg = { +}, dg = { INT8: Int8Array, UINT8: Uint8Array, INT16: Int16Array, @@ -5912,7 +5610,7 @@ const Ka = { UINT64: BigUint64Array, FLOAT32: Float32Array, FLOAT64: Float64Array -}; const za = { +}, za = { INT8: 1, UINT8: 1, INT16: 2, @@ -5924,27 +5622,28 @@ const Ka = { FLOAT32: 4, FLOAT64: 8 }; -function xr (e, t) { +function xr(e, t) { return za[t] * Ka[e]; } -function Yn (e, t, n, s) { - if (n !== 'UINT8' && n !== 'UINT16' && n !== 'UINT32' && n !== 'UINT64') { return null; } - const r = e.getTypedArrayForBufferView(t); const i = $n(r, 'SCALAR', n, s + 1); +function Yn(e, t, n, s) { + if (n !== "UINT8" && n !== "UINT16" && n !== "UINT32" && n !== "UINT64") + return null; + const r = e.getTypedArrayForBufferView(t), i = $n(r, "SCALAR", n, s + 1); return i instanceof BigInt64Array || i instanceof BigUint64Array ? null : i; } -function $n (e, t, n) { - const s = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 1; - const r = Ka[t]; const i = dg[n]; const o = za[n]; const a = s * r; const c = a * o; - let u = e.buffer; let l = e.byteOffset; +function $n(e, t, n) { + let s = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 1; + const r = Ka[t], i = dg[n], o = za[n], a = s * r, c = a * o; + let u = e.buffer, l = e.byteOffset; return l % o !== 0 && (u = new Uint8Array(u).slice(l, l + c).buffer, l = 0), new i(u, l, a); } -function vr (e, t, n) { - let s, r; - const i = `TEXCOORD_${t.texCoord || 0}`; const o = n.attributes[i]; const a = e.getTypedArrayForAccessor(o); const c = e.gltf.json; const u = t.index; const l = (s = c.textures) === null || s === void 0 || (r = s[u]) === null || r === void 0 ? void 0 : r.source; - if (typeof l < 'u') { - let h, f, d; - const m = (h = c.images) === null || h === void 0 || (f = h[l]) === null || f === void 0 ? void 0 : f.mimeType; const g = (d = e.gltf.images) === null || d === void 0 ? void 0 : d[l]; - if (g && typeof g.width < 'u') { +function vr(e, t, n) { + var s, r; + const i = `TEXCOORD_${t.texCoord || 0}`, o = n.attributes[i], a = e.getTypedArrayForAccessor(o), c = e.gltf.json, u = t.index, l = (s = c.textures) === null || s === void 0 || (r = s[u]) === null || r === void 0 ? void 0 : r.source; + if (typeof l < "u") { + var h, f, d; + const m = (h = c.images) === null || h === void 0 || (f = h[l]) === null || f === void 0 ? void 0 : f.mimeType, g = (d = e.gltf.images) === null || d === void 0 ? void 0 : d[l]; + if (g && typeof g.width < "u") { const y = []; for (let E = 0; E < a.length; E += 2) { const R = mg(g, m, a, E, t.channels); @@ -5955,26 +5654,27 @@ function vr (e, t, n) { } return []; } -function Wa (e, t, n, s, r) { - if (!(n != null && n.length)) { return; } +function Wa(e, t, n, s, r) { + if (!(n != null && n.length)) + return; const i = []; for (const l of n) { let h = s.findIndex((f) => f === l); h === -1 && (h = s.push(l) - 1), i.push(h); } - const o = new Uint32Array(i); const a = e.gltf.buffers.push({ + const o = new Uint32Array(i), a = e.gltf.buffers.push({ arrayBuffer: o.buffer, byteOffset: o.byteOffset, byteLength: o.byteLength - }) - 1; const c = e.addBufferView(o, a, 0); const u = e.addAccessor(c, { + }) - 1, c = e.addBufferView(o, a, 0), u = e.addAccessor(c, { size: 1, componentType: Sr(o), count: o.length }); r.attributes[t] = u; } -function mg (e, t, n, s) { - const r = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : [0]; +function mg(e, t, n, s) { + let r = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : [0]; const i = { r: { offset: 0, @@ -5992,35 +5692,37 @@ function mg (e, t, n, s) { offset: 3, shift: 24 } - }; const o = n[s]; const a = n[s + 1]; + }, o = n[s], a = n[s + 1]; let c = 1; - t && (t.indexOf('image/jpeg') !== -1 || t.indexOf('image/png') !== -1) && (c = 4); + t && (t.indexOf("image/jpeg") !== -1 || t.indexOf("image/png") !== -1) && (c = 4); const u = gg(o, a, e, c); let l = 0; for (const h of r) { - const f = typeof h === 'number' ? Object.values(i)[h] : i[h]; const d = u + f.offset; const m = Na(e); - if (m.data.length <= d) { throw new Error(`${m.data.length} <= ${d}`); } + const f = typeof h == "number" ? Object.values(i)[h] : i[h], d = u + f.offset, m = Na(e); + if (m.data.length <= d) + throw new Error(`${m.data.length} <= ${d}`); const g = m.data[d]; l |= g << f.shift; } return l; } -function gg (e, t, n) { - const s = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 1; - const r = n.width; const i = Ni(e) * (r - 1); const o = Math.round(i); const a = n.height; const c = Ni(t) * (a - 1); const u = Math.round(c); const l = n.components ? n.components : s; +function gg(e, t, n) { + let s = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 1; + const r = n.width, i = Ni(e) * (r - 1), o = Math.round(i), a = n.height, c = Ni(t) * (a - 1), u = Math.round(c), l = n.components ? n.components : s; return (u * r + o) * l; } -function Xa (e, t, n, s, r) { +function Xa(e, t, n, s, r) { const i = []; for (let o = 0; o < t; o++) { - const a = n[o]; const c = n[o + 1] - n[o]; - if (c + a > s) { break; } - const u = a / r; const l = c / r; + const a = n[o], c = n[o + 1] - n[o]; + if (c + a > s) + break; + const u = a / r, l = c / r; i.push(e.slice(u, u + l)); } return i; } -function Qa (e, t, n) { +function Qa(e, t, n) { const s = []; for (let r = 0; r < t; r++) { const i = r * n; @@ -6028,15 +5730,16 @@ function Qa (e, t, n) { } return s; } -function qa (e, t, n, s) { - if (n) { throw new Error('Not implemented - arrayOffsets for strings is specified'); } +function qa(e, t, n, s) { + if (n) + throw new Error("Not implemented - arrayOffsets for strings is specified"); if (s) { - const r = []; const i = new TextDecoder('utf8'); + const r = [], i = new TextDecoder("utf8"); let o = 0; for (let a = 0; a < e; a++) { const c = s[a + 1] - s[a]; if (c + o <= t.length) { - const u = t.subarray(o, c + o); const l = i.decode(u); + const u = t.subarray(o, c + o), l = i.decode(u); r.push(l), o += c; } } @@ -6044,134 +5747,137 @@ function qa (e, t, n, s) { } return []; } -const Ya = 'EXT_mesh_features'; const Ag = Ya; -async function pg (e, t) { +const Ya = "EXT_mesh_features", Ag = Ya; +async function pg(e, t) { const n = new ot(e); yg(n, t); } -function yg (e, t) { +function yg(e, t) { const n = e.gltf.json; - if (n.meshes) { - for (const s of n.meshes) { - for (const r of s.primitives) { Bg(e, r, t); } - } - } -} -function Bg (e, t, n) { - let s, r; - if (!(n != null && (s = n.gltf) !== null && s !== void 0 && s.loadBuffers)) { return; } - const i = (r = t.extensions) === null || r === void 0 ? void 0 : r[Ya]; const o = i == null ? void 0 : i.featureIds; - if (o) { + if (n.meshes) + for (const s of n.meshes) + for (const r of s.primitives) + Bg(e, r, t); +} +function Bg(e, t, n) { + var s, r; + if (!(n != null && (s = n.gltf) !== null && s !== void 0 && s.loadBuffers)) + return; + const i = (r = t.extensions) === null || r === void 0 ? void 0 : r[Ya], o = i == null ? void 0 : i.featureIds; + if (o) for (const c of o) { var a; let u; - if (typeof c.attribute < 'u') { - const l = `_FEATURE_ID_${c.attribute}`; const h = t.attributes[l]; + if (typeof c.attribute < "u") { + const l = `_FEATURE_ID_${c.attribute}`, h = t.attributes[l]; u = e.getTypedArrayForAccessor(h); - } else { typeof c.texture < 'u' && n !== null && n !== void 0 && (a = n.gltf) !== null && a !== void 0 && a.loadImages ? u = vr(e, c.texture, t) : u = []; } + } else + typeof c.texture < "u" && n !== null && n !== void 0 && (a = n.gltf) !== null && a !== void 0 && a.loadImages ? u = vr(e, c.texture, t) : u = []; c.data = u; } - } } const Cg = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, decode: pg, name: Ag -}, Symbol.toStringTag, { value: 'Module' })); const Or = 'EXT_structural_metadata'; const Eg = Or; -async function Tg (e, t) { +}, Symbol.toStringTag, { value: "Module" })), Or = "EXT_structural_metadata", Eg = Or; +async function Tg(e, t) { const n = new ot(e); bg(n, t); } -function bg (e, t) { - let n, s; - if (!((n = t.gltf) !== null && n !== void 0 && n.loadBuffers)) { return; } +function bg(e, t) { + var n, s; + if (!((n = t.gltf) !== null && n !== void 0 && n.loadBuffers)) + return; const r = e.getExtension(Or); r && ((s = t.gltf) !== null && s !== void 0 && s.loadImages && _g(e, r), wg(e, r)); } -function _g (e, t) { - const n = t.propertyTextures; const s = e.gltf.json; - if (n && s.meshes) { - for (const r of s.meshes) { - for (const i of r.primitives) { Mg(e, n, i, t); } - } - } +function _g(e, t) { + const n = t.propertyTextures, s = e.gltf.json; + if (n && s.meshes) + for (const r of s.meshes) + for (const i of r.primitives) + Mg(e, n, i, t); } -function wg (e, t) { +function wg(e, t) { const n = t.schema; - if (!n) { return; } - const s = n.classes; const r = t.propertyTables; - if (s && r) { + if (!n) + return; + const s = n.classes, r = t.propertyTables; + if (s && r) for (const i in s) { const o = Rg(r, i); o && Ig(e, n, o); } - } } -function Rg (e, t) { - for (const n of e) { - if (n.class === t) { return n; } - } +function Rg(e, t) { + for (const n of e) + if (n.class === t) + return n; return null; } -function Mg (e, t, n, s) { - let r; - if (!t) { return; } - const i = (r = n.extensions) === null || r === void 0 ? void 0 : r[Or]; const o = i == null ? void 0 : i.propertyTextures; - if (o) { +function Mg(e, t, n, s) { + var r; + if (!t) + return; + const i = (r = n.extensions) === null || r === void 0 ? void 0 : r[Or], o = i == null ? void 0 : i.propertyTextures; + if (o) for (const a of o) { const c = t[a]; Sg(e, c, n, s); } - } } -function Sg (e, t, n, s) { - if (!t.properties) { return; } +function Sg(e, t, n, s) { + if (!t.properties) + return; s.dataAttributeNames || (s.dataAttributeNames = []); const r = t.class; for (const o in t.properties) { var i; - const a = `${r}_${o}`; const c = (i = t.properties) === null || i === void 0 ? void 0 : i[o]; - if (!c) { continue; } + const a = `${r}_${o}`, c = (i = t.properties) === null || i === void 0 ? void 0 : i[o]; + if (!c) + continue; c.data || (c.data = []); - const u = c.data; const l = vr(e, c, n); + const u = c.data, l = vr(e, c, n); l !== null && (Wa(e, a, l, u, n), c.data = u, s.dataAttributeNames.push(a)); } } -function Ig (e, t, n) { - let s; +function Ig(e, t, n) { + var s; const r = (s = t.classes) === null || s === void 0 ? void 0 : s[n.class]; - if (!r) { throw new Error(`Incorrect data in the EXT_structural_metadata extension: no schema class with name ${n.class}`); } + if (!r) + throw new Error(`Incorrect data in the EXT_structural_metadata extension: no schema class with name ${n.class}`); const i = n.count; for (const a in r.properties) { var o; - const c = r.properties[a]; const u = (o = n.properties) === null || o === void 0 ? void 0 : o[a]; + const c = r.properties[a], u = (o = n.properties) === null || o === void 0 ? void 0 : o[a]; if (u) { const l = xg(e, t, c, i, u); u.data = l; } } } -function xg (e, t, n, s, r) { +function xg(e, t, n, s, r) { let i = []; - const o = r.values; const a = e.getTypedArrayForBufferView(o); const c = vg(e, n, r, s); const u = Og(e, r, s); + const o = r.values, a = e.getTypedArrayForBufferView(o), c = vg(e, n, r, s), u = Og(e, r, s); switch (n.type) { - case 'SCALAR': - case 'VEC2': - case 'VEC3': - case 'VEC4': - case 'MAT2': - case 'MAT3': - case 'MAT4': { + case "SCALAR": + case "VEC2": + case "VEC3": + case "VEC4": + case "MAT2": + case "MAT3": + case "MAT4": { i = Fg(n, s, a, c); break; } - case 'BOOLEAN': + case "BOOLEAN": throw new Error(`Not implemented - classProperty.type=${n.type}`); - case 'STRING': { + case "STRING": { i = qa(s, a, c, u); break; } - case 'ENUM': { + case "ENUM": { i = Dg(t, n, s, a, c); break; } @@ -6180,27 +5886,29 @@ function xg (e, t, n, s, r) { } return i; } -function vg (e, t, n, s) { - return t.array && typeof t.count > 'u' && typeof n.arrayOffsets < 'u' ? Yn(e, n.arrayOffsets, n.arrayOffsetType || 'UINT32', s) : null; +function vg(e, t, n, s) { + return t.array && typeof t.count > "u" && typeof n.arrayOffsets < "u" ? Yn(e, n.arrayOffsets, n.arrayOffsetType || "UINT32", s) : null; } -function Og (e, t, n) { - return typeof t.stringOffsets < 'u' ? Yn(e, t.stringOffsets, t.stringOffsetType || 'UINT32', n) : null; +function Og(e, t, n) { + return typeof t.stringOffsets < "u" ? Yn(e, t.stringOffsets, t.stringOffsetType || "UINT32", n) : null; } -function Fg (e, t, n, s) { - const r = e.array; const i = e.count; const o = xr(e.type, e.componentType); const a = n.byteLength / o; +function Fg(e, t, n, s) { + const r = e.array, i = e.count, o = xr(e.type, e.componentType), a = n.byteLength / o; let c; return e.componentType ? c = $n(n, e.type, e.componentType, a) : c = n, r ? s ? Xa(c, t, s, n.length, o) : i ? Qa(c, t, i) : [] : c; } -function Dg (e, t, n, s, r) { - let i; +function Dg(e, t, n, s, r) { + var i; const o = t.enumType; - if (!o) { throw new Error('Incorrect data in the EXT_structural_metadata extension: classProperty.enumType is not set for type ENUM'); } + if (!o) + throw new Error("Incorrect data in the EXT_structural_metadata extension: classProperty.enumType is not set for type ENUM"); const a = (i = e.enums) === null || i === void 0 ? void 0 : i[o]; - if (!a) { throw new Error(`Incorrect data in the EXT_structural_metadata extension: schema.enums does't contain ${o}`); } - const c = a.valueType || 'UINT16'; const u = xr(t.type, c); const l = s.byteLength / u; + if (!a) + throw new Error(`Incorrect data in the EXT_structural_metadata extension: schema.enums does't contain ${o}`); + const c = a.valueType || "UINT16", u = xr(t.type, c), l = s.byteLength / u; let h = $n(s, t.type, c, l); if (h || (h = s), t.array) { - if (r) { + if (r) return Lg({ valuesData: h, numberOfElements: n, @@ -6209,13 +5917,12 @@ function Dg (e, t, n, s, r) { elementSize: u, enumEntry: a }); - } const f = t.count; return f ? Pg(h, n, f, a) : []; } return Fr(h, 0, n, a); } -function Lg (e) { +function Lg(e) { const { valuesData: t, numberOfElements: n, @@ -6223,108 +5930,115 @@ function Lg (e) { valuesDataBytesLength: r, elementSize: i, enumEntry: o - } = e; const a = []; + } = e, a = []; for (let c = 0; c < n; c++) { - const u = s[c]; const l = s[c + 1] - s[c]; - if (l + u > r) { break; } - const h = u / i; const f = l / i; const d = Fr(t, h, f, o); + const u = s[c], l = s[c + 1] - s[c]; + if (l + u > r) + break; + const h = u / i, f = l / i, d = Fr(t, h, f, o); a.push(d); } return a; } -function Pg (e, t, n, s) { +function Pg(e, t, n, s) { const r = []; for (let i = 0; i < t; i++) { - const o = n * i; const a = Fr(e, o, n, s); + const o = n * i, a = Fr(e, o, n, s); r.push(a); } return r; } -function Fr (e, t, n, s) { +function Fr(e, t, n, s) { const r = []; - for (let i = 0; i < n; i++) { - if (e instanceof BigInt64Array || e instanceof BigUint64Array) { r.push(''); } else { - const o = e[t + i]; const a = Gg(s, o); - a ? r.push(a.name) : r.push(''); + for (let i = 0; i < n; i++) + if (e instanceof BigInt64Array || e instanceof BigUint64Array) + r.push(""); + else { + const o = e[t + i], a = Gg(s, o); + a ? r.push(a.name) : r.push(""); } - } return r; } -function Gg (e, t) { - for (const n of e.values) { - if (n.value === t) { return n; } - } +function Gg(e, t) { + for (const n of e.values) + if (n.value === t) + return n; return null; } const Ng = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, decode: Tg, name: Eg -}, Symbol.toStringTag, { value: 'Module' })); const $a = 'EXT_feature_metadata'; const Ug = $a; -async function Hg (e, t) { +}, Symbol.toStringTag, { value: "Module" })), $a = "EXT_feature_metadata", Ug = $a; +async function Hg(e, t) { const n = new ot(e); Jg(n, t); } -function Jg (e, t) { - let n, s; - if (!((n = t.gltf) !== null && n !== void 0 && n.loadBuffers)) { return; } +function Jg(e, t) { + var n, s; + if (!((n = t.gltf) !== null && n !== void 0 && n.loadBuffers)) + return; const r = e.getExtension($a); r && ((s = t.gltf) !== null && s !== void 0 && s.loadImages && Vg(e, r), jg(e, r)); } -function Vg (e, t) { +function Vg(e, t) { const n = t.schema; - if (!n) { return; } - const s = n.classes; const { + if (!n) + return; + const s = n.classes, { featureTextures: r } = t; - if (s && r) { + if (s && r) for (const i in s) { - const o = s[i]; const a = Kg(r, i); + const o = s[i], a = Kg(r, i); a && Wg(e, a, o); } - } } -function jg (e, t) { +function jg(e, t) { const n = t.schema; - if (!n) { return; } - const s = n.classes; const r = t.featureTables; - if (s && r) { + if (!n) + return; + const s = n.classes, r = t.featureTables; + if (s && r) for (const i in s) { const o = kg(r, i); o && zg(e, n, o); } - } } -function kg (e, t) { +function kg(e, t) { for (const n in e) { const s = e[n]; - if (s.class === t) { return s; } + if (s.class === t) + return s; } return null; } -function Kg (e, t) { +function Kg(e, t) { for (const n in e) { const s = e[n]; - if (s.class === t) { return s; } + if (s.class === t) + return s; } return null; } -function zg (e, t, n) { - let s; - if (!n.class) { return; } +function zg(e, t, n) { + var s; + if (!n.class) + return; const r = (s = t.classes) === null || s === void 0 ? void 0 : s[n.class]; - if (!r) { throw new Error(`Incorrect data in the EXT_structural_metadata extension: no schema class with name ${n.class}`); } + if (!r) + throw new Error(`Incorrect data in the EXT_structural_metadata extension: no schema class with name ${n.class}`); const i = n.count; for (const a in r.properties) { var o; - const c = r.properties[a]; const u = (o = n.properties) === null || o === void 0 ? void 0 : o[a]; + const c = r.properties[a], u = (o = n.properties) === null || o === void 0 ? void 0 : o[a]; if (u) { const l = Xg(e, t, c, i, u); u.data = l; } } } -function Wg (e, t, n) { +function Wg(e, t, n) { const s = t.class; for (const i in n.properties) { var r; @@ -6335,61 +6049,62 @@ function Wg (e, t, n) { } } } -function Xg (e, t, n, s, r) { +function Xg(e, t, n, s, r) { let i = []; - const o = r.bufferView; const a = e.getTypedArrayForBufferView(o); const c = Qg(e, n, r, s); const u = qg(e, n, r, s); - return n.type === 'STRING' || n.componentType === 'STRING' ? i = qa(s, a, c, u) : Yg(n) && (i = $g(n, s, a, c)), i; + const o = r.bufferView, a = e.getTypedArrayForBufferView(o), c = Qg(e, n, r, s), u = qg(e, n, r, s); + return n.type === "STRING" || n.componentType === "STRING" ? i = qa(s, a, c, u) : Yg(n) && (i = $g(n, s, a, c)), i; } -function Qg (e, t, n, s) { - return t.type === 'ARRAY' && typeof t.componentCount > 'u' && typeof n.arrayOffsetBufferView < 'u' ? Yn(e, n.arrayOffsetBufferView, n.offsetType || 'UINT32', s) : null; +function Qg(e, t, n, s) { + return t.type === "ARRAY" && typeof t.componentCount > "u" && typeof n.arrayOffsetBufferView < "u" ? Yn(e, n.arrayOffsetBufferView, n.offsetType || "UINT32", s) : null; } -function qg (e, t, n, s) { - return typeof n.stringOffsetBufferView < 'u' ? Yn(e, n.stringOffsetBufferView, n.offsetType || 'UINT32', s) : null; +function qg(e, t, n, s) { + return typeof n.stringOffsetBufferView < "u" ? Yn(e, n.stringOffsetBufferView, n.offsetType || "UINT32", s) : null; } -function Yg (e) { - const t = ['UINT8', 'INT16', 'UINT16', 'INT32', 'UINT32', 'INT64', 'UINT64', 'FLOAT32', 'FLOAT64']; - return t.includes(e.type) || typeof e.componentType < 'u' && t.includes(e.componentType); +function Yg(e) { + const t = ["UINT8", "INT16", "UINT16", "INT32", "UINT32", "INT64", "UINT64", "FLOAT32", "FLOAT64"]; + return t.includes(e.type) || typeof e.componentType < "u" && t.includes(e.componentType); } -function $g (e, t, n, s) { - const r = e.type === 'ARRAY'; const i = e.componentCount; const o = 'SCALAR'; const a = e.componentType || e.type; const c = xr(o, a); const u = n.byteLength / c; const l = $n(n, o, a, u); +function $g(e, t, n, s) { + const r = e.type === "ARRAY", i = e.componentCount, o = "SCALAR", a = e.componentType || e.type, c = xr(o, a), u = n.byteLength / c, l = $n(n, o, a, u); return r ? s ? Xa(l, t, s, n.length, c) : i ? Qa(l, t, i) : [] : l; } -function Zg (e, t, n) { +function Zg(e, t, n) { const s = e.gltf.json; - if (!s.meshes) { return []; } + if (!s.meshes) + return []; const r = []; - for (const i of s.meshes) { - for (const o of i.primitives) { t0(e, n, t, r, o); } - } + for (const i of s.meshes) + for (const o of i.primitives) + t0(e, n, t, r, o); return r; } -function t0 (e, t, n, s, r) { +function t0(e, t, n, s, r) { const i = { channels: n.channels, ...n.texture - }; const o = vr(e, i, r); + }, o = vr(e, i, r); o && Wa(e, t, o, s, r); } const e0 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, decode: Hg, name: Ug -}, Symbol.toStringTag, { value: 'Module' })); const n0 = '4.1.1'; const s0 = '4.1.1'; const Ln = { - TRANSCODER: 'basis_transcoder.js', - TRANSCODER_WASM: 'basis_transcoder.wasm', - ENCODER: 'basis_encoder.js', - ENCODER_WASM: 'basis_encoder.wasm' +}, Symbol.toStringTag, { value: "Module" })), n0 = "4.1.1", s0 = "4.1.1", Ln = { + TRANSCODER: "basis_transcoder.js", + TRANSCODER_WASM: "basis_transcoder.wasm", + ENCODER: "basis_encoder.js", + ENCODER_WASM: "basis_encoder.wasm" }; let bs; -async function Ui (e) { +async function Ui(e) { const t = e.modules || {}; return t.basis ? t.basis : (bs = bs || r0(e), await bs); } -async function r0 (e) { - let t = null; let n = null; - return [t, n] = await Promise.all([await Zt(Ln.TRANSCODER, 'textures', e), await Zt(Ln.TRANSCODER_WASM, 'textures', e)]), t = t || globalThis.BASIS, await i0(t, n); +async function r0(e) { + let t = null, n = null; + return [t, n] = await Promise.all([await Zt(Ln.TRANSCODER, "textures", e), await Zt(Ln.TRANSCODER_WASM, "textures", e)]), t = t || globalThis.BASIS, await i0(t, n); } -function i0 (e, t) { +function i0(e, t) { const n = {}; return t && (n.wasmBinary = t), new Promise((s) => { e(n).then((r) => { @@ -6404,15 +6119,15 @@ function i0 (e, t) { }); } let _s; -async function Hi (e) { +async function Hi(e) { const t = e.modules || {}; return t.basisEncoder ? t.basisEncoder : (_s = _s || o0(e), await _s); } -async function o0 (e) { - let t = null; let n = null; - return [t, n] = await Promise.all([await Zt(Ln.ENCODER, 'textures', e), await Zt(Ln.ENCODER_WASM, 'textures', e)]), t = t || globalThis.BASIS, await a0(t, n); +async function o0(e) { + let t = null, n = null; + return [t, n] = await Promise.all([await Zt(Ln.ENCODER, "textures", e), await Zt(Ln.ENCODER_WASM, "textures", e)]), t = t || globalThis.BASIS, await a0(t, n); } -function a0 (e, t) { +function a0(e, t) { const n = {}; return t && (n.wasmBinary = t), new Promise((s) => { e(n).then((r) => { @@ -6489,58 +6204,56 @@ const he = { COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: 35917, COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: 35918, COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: 35919 -}; const c0 = ['', 'WEBKIT_', 'MOZ_']; const Ji = { - WEBGL_compressed_texture_s3tc: 'dxt', - WEBGL_compressed_texture_s3tc_srgb: 'dxt-srgb', - WEBGL_compressed_texture_etc1: 'etc1', - WEBGL_compressed_texture_etc: 'etc2', - WEBGL_compressed_texture_pvrtc: 'pvrtc', - WEBGL_compressed_texture_atc: 'atc', - WEBGL_compressed_texture_astc: 'astc', - EXT_texture_compression_rgtc: 'rgtc' +}, c0 = ["", "WEBKIT_", "MOZ_"], Ji = { + WEBGL_compressed_texture_s3tc: "dxt", + WEBGL_compressed_texture_s3tc_srgb: "dxt-srgb", + WEBGL_compressed_texture_etc1: "etc1", + WEBGL_compressed_texture_etc: "etc2", + WEBGL_compressed_texture_pvrtc: "pvrtc", + WEBGL_compressed_texture_atc: "atc", + WEBGL_compressed_texture_astc: "astc", + EXT_texture_compression_rgtc: "rgtc" }; let gn = null; -function u0 (e) { +function u0(e) { if (!gn) { e = e || l0() || void 0, gn = /* @__PURE__ */ new Set(); - for (const t of c0) { - for (const n in Ji) { + for (const t of c0) + for (const n in Ji) if (e && e.getExtension(`${t}${n}`)) { const s = Ji[n]; gn.add(s); } - } - } } return gn; } -function l0 () { +function l0() { try { - return document.createElement('canvas').getContext('webgl'); + return document.createElement("canvas").getContext("webgl"); } catch { return null; } } -let Vi, ji, ki, Ki, zi, Wi, Xi, Qi; -(function (e) { - e[e.NONE = 0] = 'NONE', e[e.BASISLZ = 1] = 'BASISLZ', e[e.ZSTD = 2] = 'ZSTD', e[e.ZLIB = 3] = 'ZLIB'; -})(Vi || (Vi = {})), (function (e) { - e[e.BASICFORMAT = 0] = 'BASICFORMAT'; -}(ji || (ji = {}))), (function (e) { - e[e.UNSPECIFIED = 0] = 'UNSPECIFIED', e[e.ETC1S = 163] = 'ETC1S', e[e.UASTC = 166] = 'UASTC'; -}(ki || (ki = {}))), (function (e) { - e[e.UNSPECIFIED = 0] = 'UNSPECIFIED', e[e.SRGB = 1] = 'SRGB'; -}(Ki || (Ki = {}))), (function (e) { - e[e.UNSPECIFIED = 0] = 'UNSPECIFIED', e[e.LINEAR = 1] = 'LINEAR', e[e.SRGB = 2] = 'SRGB', e[e.ITU = 3] = 'ITU', e[e.NTSC = 4] = 'NTSC', e[e.SLOG = 5] = 'SLOG', e[e.SLOG2 = 6] = 'SLOG2'; -}(zi || (zi = {}))), (function (e) { - e[e.ALPHA_STRAIGHT = 0] = 'ALPHA_STRAIGHT', e[e.ALPHA_PREMULTIPLIED = 1] = 'ALPHA_PREMULTIPLIED'; -}(Wi || (Wi = {}))), (function (e) { - e[e.RGB = 0] = 'RGB', e[e.RRR = 3] = 'RRR', e[e.GGG = 4] = 'GGG', e[e.AAA = 15] = 'AAA'; -}(Xi || (Xi = {}))), (function (e) { - e[e.RGB = 0] = 'RGB', e[e.RGBA = 3] = 'RGBA', e[e.RRR = 4] = 'RRR', e[e.RRRG = 5] = 'RRRG'; -}(Qi || (Qi = {}))); +var Vi, ji, ki, Ki, zi, Wi, Xi, Qi; +(function(e) { + e[e.NONE = 0] = "NONE", e[e.BASISLZ = 1] = "BASISLZ", e[e.ZSTD = 2] = "ZSTD", e[e.ZLIB = 3] = "ZLIB"; +})(Vi || (Vi = {})), function(e) { + e[e.BASICFORMAT = 0] = "BASICFORMAT"; +}(ji || (ji = {})), function(e) { + e[e.UNSPECIFIED = 0] = "UNSPECIFIED", e[e.ETC1S = 163] = "ETC1S", e[e.UASTC = 166] = "UASTC"; +}(ki || (ki = {})), function(e) { + e[e.UNSPECIFIED = 0] = "UNSPECIFIED", e[e.SRGB = 1] = "SRGB"; +}(Ki || (Ki = {})), function(e) { + e[e.UNSPECIFIED = 0] = "UNSPECIFIED", e[e.LINEAR = 1] = "LINEAR", e[e.SRGB = 2] = "SRGB", e[e.ITU = 3] = "ITU", e[e.NTSC = 4] = "NTSC", e[e.SLOG = 5] = "SLOG", e[e.SLOG2 = 6] = "SLOG2"; +}(zi || (zi = {})), function(e) { + e[e.ALPHA_STRAIGHT = 0] = "ALPHA_STRAIGHT", e[e.ALPHA_PREMULTIPLIED = 1] = "ALPHA_PREMULTIPLIED"; +}(Wi || (Wi = {})), function(e) { + e[e.RGB = 0] = "RGB", e[e.RRR = 3] = "RRR", e[e.GGG = 4] = "GGG", e[e.AAA = 15] = "AAA"; +}(Xi || (Xi = {})), function(e) { + e[e.RGB = 0] = "RGB", e[e.RGBA = 3] = "RGBA", e[e.RRR = 4] = "RRR", e[e.RRRG = 5] = "RRRG"; +}(Qi || (Qi = {})); const gt = [171, 75, 84, 88, 32, 50, 48, 187, 13, 10, 26, 10]; -function h0 (e) { +function h0(e) { const t = new Uint8Array(e); return !(t.byteLength < gt.length || t[0] !== gt[0] || t[1] !== gt[1] || t[2] !== gt[2] || t[3] !== gt[3] || t[4] !== gt[4] || t[5] !== gt[5] || t[6] !== gt[6] || t[7] !== gt[7] || t[8] !== gt[8] || t[9] !== gt[9] || t[10] !== gt[10] || t[11] !== gt[11]); } @@ -6572,34 +6285,34 @@ const f0 = { basisFormat: 5, compressed: !0 }, - 'bc7-m6-opaque-only': { + "bc7-m6-opaque-only": { basisFormat: 6, compressed: !0 }, - 'bc7-m5': { + "bc7-m5": { basisFormat: 7, compressed: !0 }, - 'pvrtc1-4-rgb': { + "pvrtc1-4-rgb": { basisFormat: 8, compressed: !0, format: he.COMPRESSED_RGB_PVRTC_4BPPV1_IMG }, - 'pvrtc1-4-rgba': { + "pvrtc1-4-rgba": { basisFormat: 9, compressed: !0, format: he.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG }, - 'astc-4x4': { + "astc-4x4": { basisFormat: 10, compressed: !0, format: he.COMPRESSED_RGBA_ASTC_4X4_KHR }, - 'atc-rgb': { + "atc-rgb": { basisFormat: 11, compressed: !0 }, - 'atc-rgba-interpolated-alpha': { + "atc-rgba-interpolated-alpha": { basisFormat: 12, compressed: !0 }, @@ -6620,8 +6333,8 @@ const f0 = { compressed: !1 } }; -async function d0 (e, t) { - if (t.basis.containerFormat === 'auto') { +async function d0(e, t) { + if (t.basis.containerFormat === "auto") { if (h0(e)) { const s = await Hi(t); return qi(s.KTX2File, e, t); @@ -6632,16 +6345,16 @@ async function d0 (e, t) { return ws(n, e, t); } switch (t.basis.module) { - case 'encoder': + case "encoder": const n = await Hi(t); switch (t.basis.containerFormat) { - case 'ktx2': + case "ktx2": return qi(n.KTX2File, e, t); - case 'basis': + case "basis": default: return ws(n.BasisFile, e, t); } - case 'transcoder': + case "transcoder": default: const { BasisFile: s @@ -6649,14 +6362,16 @@ async function d0 (e, t) { return ws(s, e, t); } } -function ws (e, t, n) { +function ws(e, t, n) { const s = new e(new Uint8Array(t)); try { - if (!s.startTranscoding()) { throw new Error('Failed to start basis transcoding'); } - const r = s.getNumImages(); const i = []; + if (!s.startTranscoding()) + throw new Error("Failed to start basis transcoding"); + const r = s.getNumImages(), i = []; for (let o = 0; o < r; o++) { - const a = s.getNumLevels(o); const c = []; - for (let u = 0; u < a; u++) { c.push(m0(s, o, u, n)); } + const a = s.getNumLevels(o), c = []; + for (let u = 0; u < a; u++) + c.push(m0(s, o, u, n)); i.push(c); } return i; @@ -6664,13 +6379,14 @@ function ws (e, t, n) { s.close(), s.delete(); } } -function m0 (e, t, n, s) { - const r = e.getImageWidth(t, n); const i = e.getImageHeight(t, n); const o = e.getHasAlpha(); const { +function m0(e, t, n, s) { + const r = e.getImageWidth(t, n), i = e.getImageHeight(t, n), o = e.getHasAlpha(), { compressed: a, format: c, basisFormat: u - } = Za(s, o); const l = e.getImageTranscodedSizeInBytes(t, n, u); const h = new Uint8Array(l); - if (!e.transcodeImage(h, t, n, u, 0, 0)) { throw new Error('failed to start Basis transcoding'); } + } = Za(s, o), l = e.getImageTranscodedSizeInBytes(t, n, u), h = new Uint8Array(l); + if (!e.transcodeImage(h, t, n, u, 0, 0)) + throw new Error("failed to start Basis transcoding"); return { width: r, height: i, @@ -6680,11 +6396,12 @@ function m0 (e, t, n, s) { hasAlpha: o }; } -function qi (e, t, n) { +function qi(e, t, n) { const s = new e(new Uint8Array(t)); try { - if (!s.startTranscoding()) { throw new Error('failed to start KTX2 transcoding'); } - const r = s.getLevels(); const i = []; + if (!s.startTranscoding()) + throw new Error("failed to start KTX2 transcoding"); + const r = s.getLevels(), i = []; for (let o = 0; o < r; o++) { i.push(g0(s, o, n)); break; @@ -6694,17 +6411,18 @@ function qi (e, t, n) { s.close(), s.delete(); } } -function g0 (e, t, n) { +function g0(e, t, n) { const { alphaFlag: s, height: r, width: i - } = e.getImageLevelInfo(t, 0, 0); const { + } = e.getImageLevelInfo(t, 0, 0), { compressed: o, format: a, basisFormat: c - } = Za(n, s); const u = e.getImageTranscodedSizeInBytes(t, 0, 0, c); const l = new Uint8Array(u); - if (!e.transcodeImage(l, t, 0, 0, c, 0, -1, -1)) { throw new Error('Failed to transcode KTX2 image'); } + } = Za(n, s), u = e.getImageTranscodedSizeInBytes(t, 0, 0, c), l = new Uint8Array(u); + if (!e.transcodeImage(l, t, 0, 0, c, 0, -1, -1)) + throw new Error("Failed to transcode KTX2 image"); return { width: i, height: r, @@ -6715,62 +6433,56 @@ function g0 (e, t, n) { format: a }; } -function Za (e, t) { +function Za(e, t) { let n = e && e.basis && e.basis.format; - return n === 'auto' && (n = tc()), typeof n === 'object' && (n = t ? n.alpha : n.noAlpha), n = n.toLowerCase(), f0[n]; + return n === "auto" && (n = tc()), typeof n == "object" && (n = t ? n.alpha : n.noAlpha), n = n.toLowerCase(), f0[n]; } -function tc () { +function tc() { const e = u0(); - return e.has('astc') - ? 'astc-4x4' - : e.has('dxt') - ? { - alpha: 'bc3', - noAlpha: 'bc1' - } - : e.has('pvrtc') - ? { - alpha: 'pvrtc1-4-rgba', - noAlpha: 'pvrtc1-4-rgb' - } - : e.has('etc1') ? 'etc1' : e.has('etc2') ? 'etc2' : 'rgb565'; + return e.has("astc") ? "astc-4x4" : e.has("dxt") ? { + alpha: "bc3", + noAlpha: "bc1" + } : e.has("pvrtc") ? { + alpha: "pvrtc1-4-rgba", + noAlpha: "pvrtc1-4-rgb" + } : e.has("etc1") ? "etc1" : e.has("etc2") ? "etc2" : "rgb565"; } const A0 = { - name: 'Basis', - id: 'basis', - module: 'textures', + name: "Basis", + id: "basis", + module: "textures", version: s0, worker: !0, - extensions: ['basis', 'ktx2'], - mimeTypes: ['application/octet-stream', 'image/ktx2'], - tests: ['sB'], + extensions: ["basis", "ktx2"], + mimeTypes: ["application/octet-stream", "image/ktx2"], + tests: ["sB"], binary: !0, options: { basis: { - format: 'auto', - libraryPath: 'libs/', - containerFormat: 'auto', - module: 'transcoder' + format: "auto", + libraryPath: "libs/", + containerFormat: "auto", + module: "transcoder" } } -}; const p0 = { +}, p0 = { ...A0, parse: d0 -}; const pe = !0; const Yi = 1735152710; const Dr = 12; const Pn = 8; const y0 = 1313821514; const B0 = 5130562; const C0 = 0; const E0 = 0; const T0 = 1; -function b0 (e) { - const t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0; +}, pe = !0, Yi = 1735152710, Dr = 12, Pn = 8, y0 = 1313821514, B0 = 5130562, C0 = 0, E0 = 0, T0 = 1; +function b0(e) { + let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0; return `${String.fromCharCode(e.getUint8(t + 0))}${String.fromCharCode(e.getUint8(t + 1))}${String.fromCharCode(e.getUint8(t + 2))}${String.fromCharCode(e.getUint8(t + 3))}`; } -function _0 (e) { - const t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0; const n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}; - const s = new DataView(e); const { +function _0(e) { + let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0, n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}; + const s = new DataView(e), { magic: r = Yi - } = n; const i = s.getUint32(t, !1); + } = n, i = s.getUint32(t, !1); return i === r || i === Yi; } -function w0 (e, t) { +function w0(e, t) { let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0; - const s = new DataView(t); const r = b0(s, n + 0); const i = s.getUint32(n + 4, pe); const o = s.getUint32(n + 8, pe); + const s = new DataView(t), r = b0(s, n + 0), i = s.getUint32(n + 4, pe), o = s.getUint32(n + 8, pe); switch (Object.assign(e, { header: { byteOffset: n, @@ -6790,17 +6502,17 @@ function w0 (e, t) { throw new Error(`Invalid GLB version ${e.version}. Only supports version 1 and 2.`); } } -function R0 (e, t, n) { +function R0(e, t, n) { z(e.header.byteLength > Dr + Pn); - const s = t.getUint32(n + 0, pe); const r = t.getUint32(n + 4, pe); + const s = t.getUint32(n + 0, pe), r = t.getUint32(n + 4, pe); return n += Pn, z(r === C0), Ys(e, t, n, s), n += s, n += $s(e, t, n, e.header.byteLength), n; } -function M0 (e, t, n, s) { +function M0(e, t, n, s) { return z(e.header.byteLength > Dr + Pn), S0(e, t, n, s), n + e.header.byteLength; } -function S0 (e, t, n, s) { - for (; n + 8 <= e.header.byteLength;) { - const r = t.getUint32(n + 0, pe); const i = t.getUint32(n + 4, pe); +function S0(e, t, n, s) { + for (; n + 8 <= e.header.byteLength; ) { + const r = t.getUint32(n + 0, pe), i = t.getUint32(n + 4, pe); switch (n += Pn, i) { case y0: Ys(e, t, n, r); @@ -6819,81 +6531,87 @@ function S0 (e, t, n, s) { } return n; } -function Ys (e, t, n, s) { - const r = new Uint8Array(t.buffer, n, s); const o = new TextDecoder('utf8').decode(r); +function Ys(e, t, n, s) { + const r = new Uint8Array(t.buffer, n, s), o = new TextDecoder("utf8").decode(r); return e.json = JSON.parse(o), ze(s, 4); } -function $s (e, t, n, s) { +function $s(e, t, n, s) { return e.header.hasBinChunk = !0, e.binChunks.push({ byteOffset: n, byteLength: s, arrayBuffer: t.buffer }), ze(s, 4); } -function ec (e, t) { - if (e.startsWith('data:') || e.startsWith('http:') || e.startsWith('https:')) { return e; } +function ec(e, t) { + if (e.startsWith("data:") || e.startsWith("http:") || e.startsWith("https:")) + return e; const s = t.baseUri || t.uri; - if (!s) { throw new Error(`'baseUri' must be provided to resolve relative url ${e}`); } - return s.substr(0, s.lastIndexOf('/') + 1) + e; -} -const I0 = 'B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBEn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBIi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBKI9z9iqlBOc+x8ycGBM/qQFTa8jUUUUBCU/EBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAGTkUUUBRNCUoBAG9uC/wgBZHKCUGAKCUG9JyRVAECFJRICBRcGXEXAcAF9PQFAVAFAclAcAVJAF9JyRMGXGXAG9FQBAMCbJHKC9wZRSAKCIrCEJCGrRQANCUGJRfCBRbAIRTEXGXAOATlAQ9PQBCBRISEMATAQJRIGXAS9FQBCBRtCBREEXGXAOAIlCi9PQBCBRISLMANCU/CBJAEJRKGXGXGXGXGXATAECKrJ2BBAtCKZrCEZfIBFGEBMAKhB83EBAKCNJhB83EBSEMAKAI2BIAI2BBHmCKrHYAYCE6HYy86BBAKCFJAICIJAYJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCGJAYAPJHY2BBAmCGrCEZHPA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CaREABAGlCggEJCTrXBCa6QFMAFREMAEMMMFBCUNMIT9tBB'; const v0 = new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 3, 2, 0, 0, 5, 3, 1, 0, 1, 12, 1, 0, 10, 22, 2, 12, 0, 65, 0, 65, 0, 65, 0, 252, 10, 0, 0, 11, 7, 0, 65, 0, 253, 15, 26, 11]); const O0 = new Uint8Array([32, 0, 65, 253, 3, 1, 2, 34, 4, 106, 6, 5, 11, 8, 7, 20, 13, 33, 12, 16, 128, 9, 116, 64, 19, 113, 127, 15, 10, 21, 22, 14, 255, 66, 24, 54, 136, 107, 18, 23, 192, 26, 114, 118, 132, 17, 77, 101, 130, 144, 27, 87, 131, 44, 45, 74, 156, 154, 70, 167]); const F0 = { - 0: '', - 1: 'meshopt_decodeFilterOct', - 2: 'meshopt_decodeFilterQuat', - 3: 'meshopt_decodeFilterExp', - NONE: '', - OCTAHEDRAL: 'meshopt_decodeFilterOct', - QUATERNION: 'meshopt_decodeFilterQuat', - EXPONENTIAL: 'meshopt_decodeFilterExp' -}; const D0 = { - 0: 'meshopt_decodeVertexBuffer', - 1: 'meshopt_decodeIndexBuffer', - 2: 'meshopt_decodeIndexSequence', - ATTRIBUTES: 'meshopt_decodeVertexBuffer', - TRIANGLES: 'meshopt_decodeIndexBuffer', - INDICES: 'meshopt_decodeIndexSequence' + if (!s) + throw new Error(`'baseUri' must be provided to resolve relative url ${e}`); + return s.substr(0, s.lastIndexOf("/") + 1) + e; +} +const I0 = "B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9w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kFD/lFCBDtD+4FD/jF9DB/+g6DYHND/mF9DBBX9LDYHID/kFCggEDtHcD9OAVAND/mFAID/kFCTD+rFD9QHVAOAND/mFAID/kFCTD+rFAKAND/mFAID/kFAcD9OD9QHNDQBFTtGEmYILPdKOenHID8dBAGDBIBDyB+t+J83EBABCNJAID8dFAGDBIBDyF+t+J83EBALAVANDQNVi8ZcMpySQ8c8dfb8e8fHND8dBAGDBIBDyG+t+J83EBABCiJAND8dFAGDBIBDyE+t+J83EBABCAJRBAECIJHEAF9JQBMMM/3FGEaF978jUUUUBCoBlREGXAGCGrAF9sHIC98ZHL9FQBCBRGABRFEXAFAFDBBBHKCND+rFCND+sFD/6FAKCiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMBBAFCTJRFAGCIJHGAL9JQBMMGXALAI9PQBAEAICEZHGCGWHFqCBCoBAFl/8MBAEABALCGWJHLAF/8cBBGXAG9FQBAEAEDBIBHKCND+rFCND+sFD/6FAKCiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMIBMALAEAF/8cBBMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEMMMFBCUNMIT9tBB", v0 = new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 3, 2, 0, 0, 5, 3, 1, 0, 1, 12, 1, 0, 10, 22, 2, 12, 0, 65, 0, 65, 0, 65, 0, 252, 10, 0, 0, 11, 7, 0, 65, 0, 253, 15, 26, 11]), O0 = new Uint8Array([32, 0, 65, 253, 3, 1, 2, 34, 4, 106, 6, 5, 11, 8, 7, 20, 13, 33, 12, 16, 128, 9, 116, 64, 19, 113, 127, 15, 10, 21, 22, 14, 255, 66, 24, 54, 136, 107, 18, 23, 192, 26, 114, 118, 132, 17, 77, 101, 130, 144, 27, 87, 131, 44, 45, 74, 156, 154, 70, 167]), F0 = { + 0: "", + 1: "meshopt_decodeFilterOct", + 2: "meshopt_decodeFilterQuat", + 3: "meshopt_decodeFilterExp", + NONE: "", + OCTAHEDRAL: "meshopt_decodeFilterOct", + QUATERNION: "meshopt_decodeFilterQuat", + EXPONENTIAL: "meshopt_decodeFilterExp" +}, D0 = { + 0: "meshopt_decodeVertexBuffer", + 1: "meshopt_decodeIndexBuffer", + 2: "meshopt_decodeIndexSequence", + ATTRIBUTES: "meshopt_decodeVertexBuffer", + TRIANGLES: "meshopt_decodeIndexBuffer", + INDICES: "meshopt_decodeIndexSequence" }; -async function L0 (e, t, n, s, r) { - const i = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : 'NONE'; +async function L0(e, t, n, s, r) { + let i = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : "NONE"; const o = await P0(); - U0(o, o.exports[D0[r]], e, t, n, s, o.exports[F0[i || 'NONE']]); + U0(o, o.exports[D0[r]], e, t, n, s, o.exports[F0[i || "NONE"]]); } let Rs; -async function P0 () { +async function P0() { return Rs || (Rs = G0()), Rs; } -async function G0 () { +async function G0() { let e = I0; - WebAssembly.validate(v0) && (e = x0, console.log('Warning: meshopt_decoder is using experimental SIMD support')); + WebAssembly.validate(v0) && (e = x0, console.log("Warning: meshopt_decoder is using experimental SIMD support")); const t = await WebAssembly.instantiate(N0(e), {}); return await t.instance.exports.__wasm_call_ctors(), t.instance; } -function N0 (e) { +function N0(e) { const t = new Uint8Array(e.length); for (let s = 0; s < e.length; ++s) { const r = e.charCodeAt(s); t[s] = r > 96 ? r - 71 : r > 64 ? r - 65 : r > 47 ? r + 4 : r > 46 ? 63 : 62; } let n = 0; - for (let s = 0; s < e.length; ++s) { t[n++] = t[s] < 60 ? O0[t[s]] : (t[s] - 60) * 64 + t[++s]; } + for (let s = 0; s < e.length; ++s) + t[n++] = t[s] < 60 ? O0[t[s]] : (t[s] - 60) * 64 + t[++s]; return t.buffer.slice(0, n); } -function U0 (e, t, n, s, r, i, o) { - const a = e.exports.sbrk; const c = s + 3 & -4; const u = a(c * r); const l = a(i.length); const h = new Uint8Array(e.exports.memory.buffer); +function U0(e, t, n, s, r, i, o) { + const a = e.exports.sbrk, c = s + 3 & -4, u = a(c * r), l = a(i.length), h = new Uint8Array(e.exports.memory.buffer); h.set(i, l); const f = t(u, s, r, l, i.length); - if (f === 0 && o && o(u, c, r), n.set(h.subarray(u, u + s * r)), a(u - a(0)), f !== 0) { throw new Error(`Malformed buffer data: ${f}`); } + if (f === 0 && o && o(u, c, r), n.set(h.subarray(u, u + s * r)), a(u - a(0)), f !== 0) + throw new Error(`Malformed buffer data: ${f}`); } -const Gn = 'EXT_meshopt_compression'; const H0 = Gn; -async function J0 (e, t) { - let n, s; +const Gn = "EXT_meshopt_compression", H0 = Gn; +async function J0(e, t) { + var n, s; const r = new ot(e); - if (!(t != null && (n = t.gltf) !== null && n !== void 0 && n.decompressMeshes) || !((s = t.gltf) !== null && s !== void 0 && s.loadBuffers)) { return; } + if (!(t != null && (n = t.gltf) !== null && n !== void 0 && n.decompressMeshes) || !((s = t.gltf) !== null && s !== void 0 && s.loadBuffers)) + return; const i = []; - for (const o of e.json.bufferViews || []) { i.push(V0(r, o)); } + for (const o of e.json.bufferViews || []) + i.push(V0(r, o)); await Promise.all(i), r.removeExtension(Gn); } -async function V0 (e, t) { +async function V0(e, t) { const n = e.getObjectExtension(t, Gn); if (n) { const { @@ -6902,9 +6620,9 @@ async function V0 (e, t) { byteStride: i, count: o, mode: a, - filter: c = 'NONE', + filter: c = "NONE", buffer: u - } = n; const l = e.gltf.buffers[u]; const h = new Uint8Array(l.arrayBuffer, l.byteOffset + s, r); const f = new Uint8Array(e.gltf.buffers[t.buffer].arrayBuffer, t.byteOffset, t.byteLength); + } = n, l = e.gltf.buffers[u], h = new Uint8Array(l.arrayBuffer, l.byteOffset + s, r), f = new Uint8Array(e.gltf.buffers[t.buffer].arrayBuffer, t.byteOffset, t.byteLength); await L0(f, o, i, h, a, c), e.removeObjectExtension(t, Gn); } } @@ -6912,11 +6630,12 @@ const j0 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, decode: J0, name: H0 -}, Symbol.toStringTag, { value: 'Module' })); const fe = 'EXT_texture_webp'; const k0 = fe; -function K0 (e, t) { +}, Symbol.toStringTag, { value: "Module" })), fe = "EXT_texture_webp", k0 = fe; +function K0(e, t) { const n = new ot(e); - if (!tg('image/webp')) { - if (n.getRequiredExtensions().includes(fe)) { throw new Error(`gltf: Required extension ${fe} not supported by browser`); } + if (!tg("image/webp")) { + if (n.getRequiredExtensions().includes(fe)) + throw new Error(`gltf: Required extension ${fe} not supported by browser`); return; } const { @@ -6932,9 +6651,9 @@ const z0 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, name: k0, preprocess: K0 -}, Symbol.toStringTag, { value: 'Module' })); const _n = 'KHR_texture_basisu'; const W0 = _n; -function X0 (e, t) { - const n = new ot(e); const { +}, Symbol.toStringTag, { value: "Module" })), _n = "KHR_texture_basisu", W0 = _n; +function X0(e, t) { + const n = new ot(e), { json: s } = n; for (const r of s.textures || []) { @@ -6947,19 +6666,19 @@ const Q0 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, name: W0, preprocess: X0 -}, Symbol.toStringTag, { value: 'Module' })); -function q0 (e) { +}, Symbol.toStringTag, { value: "Module" })); +function q0(e) { const t = {}; for (const n in e) { const s = e[n]; - if (n !== 'indices') { + if (n !== "indices") { const r = nc(s); t[n] = r; } } return t; } -function nc (e) { +function nc(e) { const { buffer: t, size: n, @@ -6974,62 +6693,65 @@ function nc (e) { componentType: Sr(t) }; } -function Y0 (e) { - let t = e; let n = 1; let s = 0; +function Y0(e) { + let t = e, n = 1, s = 0; return e && e.value && (t = e.value, n = e.size || 1), t && (ArrayBuffer.isView(t) || (t = $0(t, Float32Array)), s = t.length / n), { buffer: t, size: n, count: s }; } -function $0 (e, t) { - const n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1; +function $0(e, t) { + let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1; return e ? Array.isArray(e) ? new t(e) : n && !(e instanceof t) ? new t(e) : e : null; } -const zt = 'KHR_draco_mesh_compression'; const Z0 = zt; -function tA (e, t, n) { +const zt = "KHR_draco_mesh_compression", Z0 = zt; +function tA(e, t, n) { const s = new ot(e); - for (const r of sc(s)) { s.getObjectExtension(r, zt); } + for (const r of sc(s)) + s.getObjectExtension(r, zt); } -async function eA (e, t, n) { - let s; - if (!(t != null && (s = t.gltf) !== null && s !== void 0 && s.decompressMeshes)) { return; } - const r = new ot(e); const i = []; - for (const o of sc(r)) { r.getObjectExtension(o, zt) && i.push(sA(r, o, t, n)); } +async function eA(e, t, n) { + var s; + if (!(t != null && (s = t.gltf) !== null && s !== void 0 && s.decompressMeshes)) + return; + const r = new ot(e), i = []; + for (const o of sc(r)) + r.getObjectExtension(o, zt) && i.push(sA(r, o, t, n)); await Promise.all(i), r.removeExtension(zt); } -function nA (e) { - const t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; +function nA(e) { + let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; const n = new ot(e); - for (const s of n.json.meshes || []) { rA(s, t), n.addRequiredExtension(zt); } + for (const s of n.json.meshes || []) + rA(s, t), n.addRequiredExtension(zt); } -async function sA (e, t, n, s) { +async function sA(e, t, n, s) { const r = e.getObjectExtension(t, zt); - if (!r) { return; } - const i = e.getTypedArrayForBufferView(r.bufferView); const o = dr(i.buffer, i.byteOffset); const a = { + if (!r) + return; + const i = e.getTypedArrayForBufferView(r.bufferView), o = dr(i.buffer, i.byteOffset), a = { ...n }; - delete a['3d-tiles']; - const c = await Ke(o, Da, a, s); const u = q0(c.attributes); - for (const [l, h] of Object.entries(u)) { + delete a["3d-tiles"]; + const c = await Ke(o, Da, a, s), u = q0(c.attributes); + for (const [l, h] of Object.entries(u)) if (l in t.attributes) { - const f = t.attributes[l]; const d = e.getAccessor(f); + const f = t.attributes[l], d = e.getAccessor(f); d != null && d.min && d !== null && d !== void 0 && d.max && (h.min = d.min, h.max = d.max); } - } t.attributes = u, c.indices && (t.indices = nc(c.indices)), e.removeObjectExtension(t, zt), iA(t); } -function rA (e, t) { - let n; - const s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 4; const r = arguments.length > 3 ? arguments[3] : void 0; const i = arguments.length > 4 ? arguments[4] : void 0; - if (!r.DracoWriter) { throw new Error('options.gltf.DracoWriter not provided'); } +function rA(e, t) { + var n; + let s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 4, r = arguments.length > 3 ? arguments[3] : void 0, i = arguments.length > 4 ? arguments[4] : void 0; + if (!r.DracoWriter) + throw new Error("options.gltf.DracoWriter not provided"); const o = r.DracoWriter.encodeSync({ attributes: e - }); const a = i == null || (n = i.parseSync) === null || n === void 0 - ? void 0 - : n.call(i, { - attributes: e - }); const c = r._addFauxAttributes(a.attributes); const u = r.addBufferView(o); + }), a = i == null || (n = i.parseSync) === null || n === void 0 ? void 0 : n.call(i, { + attributes: e + }), c = r._addFauxAttributes(a.attributes), u = r.addBufferView(o); return { primitives: [{ attributes: c, @@ -7043,13 +6765,14 @@ function rA (e, t) { }] }; } -function iA (e) { - if (!e.attributes && Object.keys(e.attributes).length > 0) { throw new Error('glTF: Empty primitive detected: Draco decompression failure?'); } +function iA(e) { + if (!e.attributes && Object.keys(e.attributes).length > 0) + throw new Error("glTF: Empty primitive detected: Draco decompression failure?"); } -function * sc (e) { - for (const t of e.json.meshes || []) { - for (const n of t.primitives) { yield n; } - } +function* sc(e) { + for (const t of e.json.meshes || []) + for (const n of t.primitives) + yield n; } const oA = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, @@ -7057,16 +6780,18 @@ const oA = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ encode: nA, name: Z0, preprocess: tA -}, Symbol.toStringTag, { value: 'Module' })); const Lr = 'KHR_texture_transform'; const aA = Lr; const An = new A(); const cA = new X(); const uA = new X(); -async function lA (e, t) { - let n; - if (!new ot(e).hasExtension(Lr) || !((n = t.gltf) !== null && n !== void 0 && n.loadBuffers)) { return; } +}, Symbol.toStringTag, { value: "Module" })), Lr = "KHR_texture_transform", aA = Lr, An = new A(), cA = new X(), uA = new X(); +async function lA(e, t) { + var n; + if (!new ot(e).hasExtension(Lr) || !((n = t.gltf) !== null && n !== void 0 && n.loadBuffers)) + return; const i = e.json.materials || []; - for (let o = 0; o < i.length; o++) { hA(o, e); } + for (let o = 0; o < i.length; o++) + hA(o, e); } -function hA (e, t) { - let n, s, r; - const i = []; const o = (n = t.json.materials) === null || n === void 0 ? void 0 : n[e]; const a = o == null || (s = o.pbrMetallicRoughness) === null || s === void 0 ? void 0 : s.baseColorTexture; +function hA(e, t) { + var n, s, r; + const i = [], o = (n = t.json.materials) === null || n === void 0 ? void 0 : n[e], a = o == null || (s = o.pbrMetallicRoughness) === null || s === void 0 ? void 0 : s.baseColorTexture; a && Me(t, e, a, i); const c = o == null ? void 0 : o.emissiveTexture; c && Me(t, e, c, i); @@ -7077,26 +6802,26 @@ function hA (e, t) { const h = o == null || (r = o.pbrMetallicRoughness) === null || r === void 0 ? void 0 : r.metallicRoughnessTexture; h && Me(t, e, h, i); } -function Me (e, t, n, s) { +function Me(e, t, n, s) { const r = fA(n, s); - if (!r) { return; } + if (!r) + return; const i = e.json.meshes || []; - for (const o of i) { + for (const o of i) for (const a of o.primitives) { const c = a.material; Number.isFinite(c) && t === c && dA(e, a, r); } - } } -function fA (e, t) { - let n; - const s = (n = e.extensions) === null || n === void 0 ? void 0 : n[Lr]; const { +function fA(e, t) { + var n; + const s = (n = e.extensions) === null || n === void 0 ? void 0 : n[Lr], { texCoord: r = 0 - } = e; const { + } = e, { texCoord: i = r } = s; if (!(t.findIndex((a) => { - const [c, u] = a; + let [c, u] = a; return c === r && u === i; }) !== -1)) { const a = AA(s); @@ -7108,26 +6833,26 @@ function fA (e, t) { } return null; } -function dA (e, t, n) { +function dA(e, t, n) { const { originalTexCoord: s, texCoord: r, matrix: i - } = n; const o = t.attributes[`TEXCOORD_${s}`]; + } = n, o = t.attributes[`TEXCOORD_${s}`]; if (Number.isFinite(o)) { - let a; + var a; const u = (a = e.json.accessors) === null || a === void 0 ? void 0 : a[o]; if (u && u.bufferView) { - let c; + var c; const l = (c = e.json.bufferViews) === null || c === void 0 ? void 0 : c[u.bufferView]; if (l) { const { arrayBuffer: h, byteOffset: f - } = e.buffers[l.buffer]; const d = (f || 0) + (u.byteOffset || 0) + (l.byteOffset || 0); const { + } = e.buffers[l.buffer], d = (f || 0) + (u.byteOffset || 0) + (l.byteOffset || 0), { ArrayType: m, length: g - } = Ir(u, l); const y = Va[u.componentType]; const E = Ja[u.type]; const R = l.byteStride || y * E; const B = new Float32Array(g); + } = Ir(u, l), y = Va[u.componentType], E = Ja[u.type], R = l.byteStride || y * E, B = new Float32Array(g); for (let C = 0; C < u.count; C++) { const M = new m(h, d + C * R, 2); An.set(M[0], M[1], 1), An.transformByMatrix3(i), B.set([An[0], An[1]], C * E); @@ -7137,21 +6862,22 @@ function dA (e, t, n) { } } } -function mA (e, t, n, s) { +function mA(e, t, n, s) { e.componentType = 5126, n.push({ arrayBuffer: s.buffer, byteOffset: 0, byteLength: s.buffer.byteLength }), t.buffer = n.length - 1, t.byteLength = s.buffer.byteLength, t.byteOffset = 0, delete t.byteStride; } -function gA (e, t, n, s, r) { +function gA(e, t, n, s, r) { s.buffers.push({ arrayBuffer: r.buffer, byteOffset: 0, byteLength: r.buffer.byteLength }); const i = s.json.bufferViews; - if (!i) { return; } + if (!i) + return; i.push({ buffer: s.buffers.length - 1, byteLength: r.buffer.byteLength, @@ -7163,34 +6889,34 @@ function gA (e, t, n, s, r) { byteOffset: 0, componentType: 5126, count: t.count, - type: 'VEC2' + type: "VEC2" }), n.attributes[`TEXCOORD_${e}`] = o.length - 1); } -function AA (e) { +function AA(e) { const { offset: t = [0, 0], rotation: n = 0, scale: s = [1, 1] - } = e; const r = new X().set(1, 0, 0, 0, 1, 0, t[0], t[1], 1); const i = cA.set(Math.cos(n), Math.sin(n), 0, -Math.sin(n), Math.cos(n), 0, 0, 0, 1); const o = uA.set(s[0], 0, 0, 0, s[1], 0, 0, 0, 1); + } = e, r = new X().set(1, 0, 0, 0, 1, 0, t[0], t[1], 1), i = cA.set(Math.cos(n), Math.sin(n), 0, -Math.sin(n), Math.cos(n), 0, 0, 0, 1), o = uA.set(s[0], 0, 0, 0, s[1], 0, 0, 0, 1); return r.multiplyRight(i).multiplyRight(o); } const pA = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, decode: lA, name: aA -}, Symbol.toStringTag, { value: 'Module' })); const Yt = 'KHR_lights_punctual'; const yA = Yt; -async function BA (e) { - const t = new ot(e); const { +}, Symbol.toStringTag, { value: "Module" })), Yt = "KHR_lights_punctual", yA = Yt; +async function BA(e) { + const t = new ot(e), { json: n - } = t; const s = t.getExtension(Yt); + } = t, s = t.getExtension(Yt); s && (t.json.lights = s.lights, t.removeExtension(Yt)); for (const r of n.nodes || []) { const i = t.getObjectExtension(r, Yt); i && (r.light = i.light), t.removeObjectExtension(r, Yt); } } -async function CA (e) { - const t = new ot(e); const { +async function CA(e) { + const t = new ot(e), { json: n } = t; if (n.lights) { @@ -7210,32 +6936,33 @@ const EA = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ decode: BA, encode: CA, name: yA -}, Symbol.toStringTag, { value: 'Module' })); const Ue = 'KHR_materials_unlit'; const TA = Ue; -async function bA (e) { - const t = new ot(e); const { +}, Symbol.toStringTag, { value: "Module" })), Ue = "KHR_materials_unlit", TA = Ue; +async function bA(e) { + const t = new ot(e), { json: n } = t; - for (const s of n.materials || []) { s.extensions && s.extensions.KHR_materials_unlit && (s.unlit = !0), t.removeObjectExtension(s, Ue); } + for (const s of n.materials || []) + s.extensions && s.extensions.KHR_materials_unlit && (s.unlit = !0), t.removeObjectExtension(s, Ue); t.removeExtension(Ue); } -function _A (e) { - const t = new ot(e); const { +function _A(e) { + const t = new ot(e), { json: n } = t; - if (t.materials) { - for (const s of n.materials || []) { s.unlit && (delete s.unlit, t.addObjectExtension(s, Ue, {}), t.addExtension(Ue)); } - } + if (t.materials) + for (const s of n.materials || []) + s.unlit && (delete s.unlit, t.addObjectExtension(s, Ue, {}), t.addExtension(Ue)); } const wA = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, decode: bA, encode: _A, name: TA -}, Symbol.toStringTag, { value: 'Module' })); const xe = 'KHR_techniques_webgl'; const RA = xe; -async function MA (e) { - const t = new ot(e); const { +}, Symbol.toStringTag, { value: "Module" })), xe = "KHR_techniques_webgl", RA = xe; +async function MA(e) { + const t = new ot(e), { json: n - } = t; const s = t.getExtension(xe); + } = t, s = t.getExtension(xe); if (s) { const r = IA(s, t); for (const i of n.materials || []) { @@ -7245,28 +6972,31 @@ async function MA (e) { t.removeExtension(xe); } } -async function SA (e, t) { +async function SA(e, t) { } -function IA (e, t) { +function IA(e, t) { const { programs: n = [], shaders: s = [], techniques: r = [] - } = e; const i = new TextDecoder(); + } = e, i = new TextDecoder(); return s.forEach((o) => { - if (Number.isFinite(o.bufferView)) { o.code = i.decode(t.getTypedArrayForBufferView(o.bufferView)); } else { throw new Error('KHR_techniques_webgl: no shader code'); } + if (Number.isFinite(o.bufferView)) + o.code = i.decode(t.getTypedArrayForBufferView(o.bufferView)); + else + throw new Error("KHR_techniques_webgl: no shader code"); }), n.forEach((o) => { o.fragmentShader = s[o.fragmentShader], o.vertexShader = s[o.vertexShader]; }), r.forEach((o) => { o.program = n[o.program]; }), r; } -function xA (e, t) { +function xA(e, t) { const n = Object.assign({}, e.values); return Object.keys(e.uniforms || {}).forEach((s) => { e.uniforms[s].value && !(s in n) && (n[s] = e.uniforms[s].value); }), Object.keys(n).forEach((s) => { - typeof n[s] === 'object' && n[s].index !== void 0 && (n[s].texture = t.getTexture(n[s].index)); + typeof n[s] == "object" && n[s].index !== void 0 && (n[s].texture = t.getTexture(n[s].index)); }), n; } const vA = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ @@ -7274,31 +7004,31 @@ const vA = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ decode: MA, encode: SA, name: RA -}, Symbol.toStringTag, { value: 'Module' })); const rc = [Ng, Cg, j0, z0, Q0, oA, EA, wA, vA, pA, e0]; -function OA (e) { - const t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; const n = arguments.length > 2 ? arguments[2] : void 0; +}, Symbol.toStringTag, { value: "Module" })), rc = [Ng, Cg, j0, z0, Q0, oA, EA, wA, vA, pA, e0]; +function OA(e) { + let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, n = arguments.length > 2 ? arguments[2] : void 0; const s = rc.filter((i) => ic(i.name, t)); for (const i of s) { var r; (r = i.preprocess) === null || r === void 0 || r.call(i, e, t, n); } } -async function FA (e) { - const t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; const n = arguments.length > 2 ? arguments[2] : void 0; +async function FA(e) { + let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, n = arguments.length > 2 ? arguments[2] : void 0; const s = rc.filter((i) => ic(i.name, t)); for (const i of s) { var r; await ((r = i.decode) === null || r === void 0 ? void 0 : r.call(i, e, t, n)); } } -function ic (e, t) { - let n; +function ic(e, t) { + var n; const s = (t == null || (n = t.gltf) === null || n === void 0 ? void 0 : n.excludeExtensions) || {}; return !(e in s && !s[e]); } -const Ms = 'KHR_binary_glTF'; -function DA (e) { - const t = new ot(e); const { +const Ms = "KHR_binary_glTF"; +function DA(e) { + const t = new ot(e), { json: n } = t; for (const s of n.images || []) { @@ -7308,34 +7038,34 @@ function DA (e) { n.buffers && n.buffers[0] && delete n.buffers[0].uri, t.removeExtension(Ms); } const $i = { - accessors: 'accessor', - animations: 'animation', - buffers: 'buffer', - bufferViews: 'bufferView', - images: 'image', - materials: 'material', - meshes: 'mesh', - nodes: 'node', - samplers: 'sampler', - scenes: 'scene', - skins: 'skin', - textures: 'texture' -}; const LA = { - accessor: 'accessors', - animations: 'animation', - buffer: 'buffers', - bufferView: 'bufferViews', - image: 'images', - material: 'materials', - mesh: 'meshes', - node: 'nodes', - sampler: 'samplers', - scene: 'scenes', - skin: 'skins', - texture: 'textures' + accessors: "accessor", + animations: "animation", + buffers: "buffer", + bufferViews: "bufferView", + images: "image", + materials: "material", + meshes: "mesh", + nodes: "node", + samplers: "sampler", + scenes: "scene", + skins: "skin", + textures: "texture" +}, LA = { + accessor: "accessors", + animations: "animation", + buffer: "buffers", + bufferView: "bufferViews", + image: "images", + material: "materials", + mesh: "meshes", + node: "nodes", + sampler: "samplers", + scene: "scenes", + skin: "skins", + texture: "textures" }; class PA { - constructor () { + constructor() { this.idToIndexMap = { animations: {}, accessors: {}, @@ -7351,33 +7081,31 @@ class PA { textures: {} }, this.json = void 0; } - - normalize (t, n) { + normalize(t, n) { this.json = t.json; const s = t.json; switch (s.asset && s.asset.version) { - case '2.0': + case "2.0": return; case void 0: - case '1.0': + case "1.0": break; default: console.warn(`glTF: Unknown version ${s.asset.version}`); return; } - if (!n.normalize) { throw new Error('glTF v1 is not supported.'); } - console.warn('Converting glTF v1 to glTF v2 format. This is experimental and may fail.'), this._addAsset(s), this._convertTopLevelObjectsToArrays(s), DA(t), this._convertObjectIdsToArrayIndices(s), this._updateObjects(s), this._updateMaterial(s); + if (!n.normalize) + throw new Error("glTF v1 is not supported."); + console.warn("Converting glTF v1 to glTF v2 format. This is experimental and may fail."), this._addAsset(s), this._convertTopLevelObjectsToArrays(s), DA(t), this._convertObjectIdsToArrayIndices(s), this._updateObjects(s), this._updateMaterial(s); } - - _addAsset (t) { - t.asset = t.asset || {}, t.asset.version = '2.0', t.asset.generator = t.asset.generator || 'Normalized to glTF 2.0 by loaders.gl'; + _addAsset(t) { + t.asset = t.asset || {}, t.asset.version = "2.0", t.asset.generator = t.asset.generator || "Normalized to glTF 2.0 by loaders.gl"; } - - _convertTopLevelObjectsToArrays (t) { - for (const n in $i) { this._convertTopLevelObjectToArray(t, n); } + _convertTopLevelObjectsToArrays(t) { + for (const n in $i) + this._convertTopLevelObjectToArray(t, n); } - - _convertTopLevelObjectToArray (t, n) { + _convertTopLevelObjectToArray(t, n) { const s = t[n]; if (!(!s || Array.isArray(s))) { t[n] = []; @@ -7389,65 +7117,63 @@ class PA { } } } - - _convertObjectIdsToArrayIndices (t) { - for (const n in $i) { this._convertIdsToIndices(t, n); } - 'scene' in t && (t.scene = this._convertIdToIndex(t.scene, 'scene')); - for (const n of t.textures) { this._convertTextureIds(n); } - for (const n of t.meshes) { this._convertMeshIds(n); } - for (const n of t.nodes) { this._convertNodeIds(n); } - for (const n of t.scenes) { this._convertSceneIds(n); } + _convertObjectIdsToArrayIndices(t) { + for (const n in $i) + this._convertIdsToIndices(t, n); + "scene" in t && (t.scene = this._convertIdToIndex(t.scene, "scene")); + for (const n of t.textures) + this._convertTextureIds(n); + for (const n of t.meshes) + this._convertMeshIds(n); + for (const n of t.nodes) + this._convertNodeIds(n); + for (const n of t.scenes) + this._convertSceneIds(n); } - - _convertTextureIds (t) { - t.source && (t.source = this._convertIdToIndex(t.source, 'image')); + _convertTextureIds(t) { + t.source && (t.source = this._convertIdToIndex(t.source, "image")); } - - _convertMeshIds (t) { + _convertMeshIds(t) { for (const n of t.primitives) { const { attributes: s, indices: r, material: i } = n; - for (const o in s) { s[o] = this._convertIdToIndex(s[o], 'accessor'); } - r && (n.indices = this._convertIdToIndex(r, 'accessor')), i && (n.material = this._convertIdToIndex(i, 'material')); + for (const o in s) + s[o] = this._convertIdToIndex(s[o], "accessor"); + r && (n.indices = this._convertIdToIndex(r, "accessor")), i && (n.material = this._convertIdToIndex(i, "material")); } } - - _convertNodeIds (t) { - t.children && (t.children = t.children.map((n) => this._convertIdToIndex(n, 'node'))), t.meshes && (t.meshes = t.meshes.map((n) => this._convertIdToIndex(n, 'mesh'))); + _convertNodeIds(t) { + t.children && (t.children = t.children.map((n) => this._convertIdToIndex(n, "node"))), t.meshes && (t.meshes = t.meshes.map((n) => this._convertIdToIndex(n, "mesh"))); } - - _convertSceneIds (t) { - t.nodes && (t.nodes = t.nodes.map((n) => this._convertIdToIndex(n, 'node'))); + _convertSceneIds(t) { + t.nodes && (t.nodes = t.nodes.map((n) => this._convertIdToIndex(n, "node"))); } - - _convertIdsToIndices (t, n) { + _convertIdsToIndices(t, n) { t[n] || (console.warn(`gltf v1: json doesn't contain attribute ${n}`), t[n] = []); - for (const s of t[n]) { + for (const s of t[n]) for (const r in s) { - const i = s[r]; const o = this._convertIdToIndex(i, r); + const i = s[r], o = this._convertIdToIndex(i, r); s[r] = o; } - } } - - _convertIdToIndex (t, n) { + _convertIdToIndex(t, n) { const s = LA[n]; if (s in this.idToIndexMap) { const r = this.idToIndexMap[s][t]; - if (!Number.isFinite(r)) { throw new Error(`gltf v1: failed to resolve ${n} with id ${t}`); } + if (!Number.isFinite(r)) + throw new Error(`gltf v1: failed to resolve ${n} with id ${t}`); return r; } return t; } - - _updateObjects (t) { - for (const n of this.json.buffers) { delete n.type; } + _updateObjects(t) { + for (const n of this.json.buffers) + delete n.type; } - - _updateMaterial (t) { + _updateMaterial(t) { for (const i of t.materials) { var n, s, r; i.pbrMetallicRoughness = { @@ -7455,29 +7181,32 @@ class PA { metallicFactor: 1, roughnessFactor: 1 }; - const o = ((n = i.values) === null || n === void 0 ? void 0 : n.tex) || ((s = i.values) === null || s === void 0 ? void 0 : s.texture2d_0) || ((r = i.values) === null || r === void 0 ? void 0 : r.diffuseTex); const a = t.textures.findIndex((c) => c.id === o); + const o = ((n = i.values) === null || n === void 0 ? void 0 : n.tex) || ((s = i.values) === null || s === void 0 ? void 0 : s.texture2d_0) || ((r = i.values) === null || r === void 0 ? void 0 : r.diffuseTex), a = t.textures.findIndex((c) => c.id === o); a !== -1 && (i.pbrMetallicRoughness.baseColorTexture = { index: a }); } } } -function GA (e) { - const t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; +function GA(e) { + let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; return new PA().normalize(e, t); } -async function NA (e, t) { - let n, s, r; - const i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0; const o = arguments.length > 3 ? arguments[3] : void 0; const a = arguments.length > 4 ? arguments[4] : void 0; +async function NA(e, t) { + var n, s, r; + let i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0, o = arguments.length > 3 ? arguments[3] : void 0, a = arguments.length > 4 ? arguments[4] : void 0; return UA(e, t, i, o), GA(e, { normalize: o == null || (n = o.gltf) === null || n === void 0 ? void 0 : n.normalize }), OA(e, o, a), o != null && (s = o.gltf) !== null && s !== void 0 && s.loadBuffers && e.json.buffers && await HA(e, o, a), o != null && (r = o.gltf) !== null && r !== void 0 && r.loadImages && await JA(e, o, a), await FA(e, o, a), e; } -function UA (e, t, n, s) { - if (s.uri && (e.baseUri = s.uri), t instanceof ArrayBuffer && !_0(t, n, s) && (t = new TextDecoder().decode(t)), typeof t === 'string') { e.json = Du(t); } else if (t instanceof ArrayBuffer) { +function UA(e, t, n, s) { + if (s.uri && (e.baseUri = s.uri), t instanceof ArrayBuffer && !_0(t, n, s) && (t = new TextDecoder().decode(t)), typeof t == "string") + e.json = Du(t); + else if (t instanceof ArrayBuffer) { const o = {}; - n = w0(o, t, n, s.glb), yt(o.type === 'glTF', `Invalid GLB magic string ${o.type}`), e._glb = o, e.json = o.json; - } else { yt(!1, 'GLTF: must be ArrayBuffer or string'); } + n = w0(o, t, n, s.glb), yt(o.type === "glTF", `Invalid GLB magic string ${o.type}`), e._glb = o, e.json = o.json; + } else + yt(!1, "GLTF: must be ArrayBuffer or string"); const r = e.json.buffers || []; if (e.buffers = new Array(r.length).fill(null), e._glb && e._glb.header.hasBinChunk) { const { @@ -7492,7 +7221,7 @@ function UA (e, t, n, s) { const i = e.json.images || []; e.images = new Array(i.length).fill({}); } -async function HA (e, t, n) { +async function HA(e, t, n) { const s = e.json.buffers || []; for (let o = 0; o < s.length; ++o) { const a = s[o]; @@ -7502,35 +7231,36 @@ async function HA (e, t, n) { fetch: c } = n; yt(c); - const u = ec(a.uri, t); const l = await (n == null || (r = n.fetch) === null || r === void 0 ? void 0 : r.call(n, u)); const h = await (l == null || (i = l.arrayBuffer) === null || i === void 0 ? void 0 : i.call(l)); + const u = ec(a.uri, t), l = await (n == null || (r = n.fetch) === null || r === void 0 ? void 0 : r.call(n, u)), h = await (l == null || (i = l.arrayBuffer) === null || i === void 0 ? void 0 : i.call(l)); e.buffers[o] = { arrayBuffer: h, byteOffset: 0, byteLength: h.byteLength }, delete a.uri; - } else { + } else e.buffers[o] === null && (e.buffers[o] = { arrayBuffer: new ArrayBuffer(a.byteLength), byteOffset: 0, byteLength: a.byteLength }); - } } } -async function JA (e, t, n) { - const s = VA(e); const r = e.json.images || []; const i = []; - for (const o of s) { i.push(jA(e, r[o], o, t, n)); } +async function JA(e, t, n) { + const s = VA(e), r = e.json.images || [], i = []; + for (const o of s) + i.push(jA(e, r[o], o, t, n)); return await Promise.all(i); } -function VA (e) { - const t = /* @__PURE__ */ new Set(); const n = e.json.textures || []; - for (const s of n) { s.source !== void 0 && t.add(s.source); } +function VA(e) { + const t = /* @__PURE__ */ new Set(), n = e.json.textures || []; + for (const s of n) + s.source !== void 0 && t.add(s.source); return Array.from(t).sort(); } -async function jA (e, t, n, s, r) { +async function jA(e, t, n, s, r) { let i; - if (t.uri && !t.hasOwnProperty('bufferView')) { - const a = ec(t.uri, s); const { + if (t.uri && !t.hasOwnProperty("bufferView")) { + const a = ec(t.uri, s), { fetch: c } = r; i = await (await c(a)).arrayBuffer(), t.bufferView = { @@ -7541,7 +7271,7 @@ async function jA (e, t, n, s, r) { const a = lg(e.json, e.buffers, t.bufferView); i = dr(a.buffer, a.byteOffset, a.byteLength); } - yt(i, 'glTF image has no data'); + yt(i, "glTF image has no data"); let o = await Ke(i, [Zm, p0], { ...s, mimeType: t.mimeType, @@ -7558,15 +7288,15 @@ async function jA (e, t, n, s, r) { }), e.images = e.images || [], e.images[n] = o; } const Nn = { - name: 'glTF', - id: 'gltf', - module: 'gltf', + name: "glTF", + id: "gltf", + module: "gltf", version: n0, - extensions: ['gltf', 'glb'], - mimeTypes: ['model/gltf+json', 'model/gltf-binary'], + extensions: ["gltf", "glb"], + mimeTypes: ["model/gltf+json", "model/gltf-binary"], text: !0, binary: !0, - tests: ['glTF'], + tests: ["glTF"], parse: kA, options: { gltf: { @@ -7578,8 +7308,8 @@ const Nn = { log: console } }; -async function kA (e) { - let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; const n = arguments.length > 2 ? arguments[2] : void 0; +async function kA(e) { + let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, n = arguments.length > 2 ? arguments[2] : void 0; t = { ...Nn.options, ...t @@ -7600,14 +7330,14 @@ const KA = { MAT2: 4, MAT3: 9, MAT4: 16 -}; const zA = { +}, zA = { 5120: 1, 5121: 1, 5122: 2, 5123: 2, 5125: 4, 5126: 4 -}; const Bt = { +}, Bt = { TEXTURE_MAG_FILTER: 10240, TEXTURE_MIN_FILTER: 10241, TEXTURE_WRAP_S: 10242, @@ -7615,116 +7345,100 @@ const KA = { REPEAT: 10497, LINEAR: 9729, NEAREST_MIPMAP_LINEAR: 9986 -}; const WA = { +}, WA = { magFilter: Bt.TEXTURE_MAG_FILTER, minFilter: Bt.TEXTURE_MIN_FILTER, wrapS: Bt.TEXTURE_WRAP_S, wrapT: Bt.TEXTURE_WRAP_T -}; const XA = { +}, XA = { [Bt.TEXTURE_MAG_FILTER]: Bt.LINEAR, [Bt.TEXTURE_MIN_FILTER]: Bt.NEAREST_MIPMAP_LINEAR, [Bt.TEXTURE_WRAP_S]: Bt.REPEAT, [Bt.TEXTURE_WRAP_T]: Bt.REPEAT }; -function QA () { +function QA() { return { - id: 'default-sampler', + id: "default-sampler", parameters: XA }; } -function qA (e) { +function qA(e) { return zA[e]; } -function YA (e) { +function YA(e) { return KA[e]; } class $A { - constructor () { - this.baseUri = '', this.jsonUnprocessed = void 0, this.json = void 0, this.buffers = [], this.images = []; + constructor() { + this.baseUri = "", this.jsonUnprocessed = void 0, this.json = void 0, this.buffers = [], this.images = []; } - - postProcess (t) { - const n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; + postProcess(t) { + let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; const { json: s, buffers: r = [], images: i = [] - } = t; const { - baseUri: o = '' + } = t, { + baseUri: o = "" } = t; return yt(s), this.baseUri = o, this.buffers = r, this.images = i, this.jsonUnprocessed = s, this.json = this._resolveTree(t.json, n), this.json; } - - _resolveTree (t) { + _resolveTree(t) { const n = { ...t }; - return this.json = n, t.bufferViews && (n.bufferViews = t.bufferViews.map((s, r) => this._resolveBufferView(s, r))), t.images && (n.images = t.images.map((s, r) => this._resolveImage(s, r))), t.samplers && (n.samplers = t.samplers.map((s, r) => this._resolveSampler(s, r))), t.textures && (n.textures = t.textures.map((s, r) => this._resolveTexture(s, r))), t.accessors && (n.accessors = t.accessors.map((s, r) => this._resolveAccessor(s, r))), t.materials && (n.materials = t.materials.map((s, r) => this._resolveMaterial(s, r))), t.meshes && (n.meshes = t.meshes.map((s, r) => this._resolveMesh(s, r))), t.nodes && (n.nodes = t.nodes.map((s, r) => this._resolveNode(s, r)), n.nodes = n.nodes.map((s, r) => this._resolveNodeChildren(s))), t.skins && (n.skins = t.skins.map((s, r) => this._resolveSkin(s, r))), t.scenes && (n.scenes = t.scenes.map((s, r) => this._resolveScene(s, r))), typeof this.json.scene === 'number' && n.scenes && (n.scene = n.scenes[this.json.scene]), n; + return this.json = n, t.bufferViews && (n.bufferViews = t.bufferViews.map((s, r) => this._resolveBufferView(s, r))), t.images && (n.images = t.images.map((s, r) => this._resolveImage(s, r))), t.samplers && (n.samplers = t.samplers.map((s, r) => this._resolveSampler(s, r))), t.textures && (n.textures = t.textures.map((s, r) => this._resolveTexture(s, r))), t.accessors && (n.accessors = t.accessors.map((s, r) => this._resolveAccessor(s, r))), t.materials && (n.materials = t.materials.map((s, r) => this._resolveMaterial(s, r))), t.meshes && (n.meshes = t.meshes.map((s, r) => this._resolveMesh(s, r))), t.nodes && (n.nodes = t.nodes.map((s, r) => this._resolveNode(s, r)), n.nodes = n.nodes.map((s, r) => this._resolveNodeChildren(s))), t.skins && (n.skins = t.skins.map((s, r) => this._resolveSkin(s, r))), t.scenes && (n.scenes = t.scenes.map((s, r) => this._resolveScene(s, r))), typeof this.json.scene == "number" && n.scenes && (n.scene = n.scenes[this.json.scene]), n; } - - getScene (t) { + getScene(t) { return this._get(this.json.scenes, t); } - - getNode (t) { + getNode(t) { return this._get(this.json.nodes, t); } - - getSkin (t) { + getSkin(t) { return this._get(this.json.skins, t); } - - getMesh (t) { + getMesh(t) { return this._get(this.json.meshes, t); } - - getMaterial (t) { + getMaterial(t) { return this._get(this.json.materials, t); } - - getAccessor (t) { + getAccessor(t) { return this._get(this.json.accessors, t); } - - getCamera (t) { + getCamera(t) { return this._get(this.json.cameras, t); } - - getTexture (t) { + getTexture(t) { return this._get(this.json.textures, t); } - - getSampler (t) { + getSampler(t) { return this._get(this.json.samplers, t); } - - getImage (t) { + getImage(t) { return this._get(this.json.images, t); } - - getBufferView (t) { + getBufferView(t) { return this._get(this.json.bufferViews, t); } - - getBuffer (t) { + getBuffer(t) { return this._get(this.json.buffers, t); } - - _get (t, n) { - if (typeof n === 'object') { return n; } + _get(t, n) { + if (typeof n == "object") + return n; const s = t && t[n]; return s || console.warn(`glTF file error: Could not find ${t}[${n}]`), s; } - - _resolveScene (t, n) { + _resolveScene(t, n) { return { ...t, id: t.id || `scene-${n}`, nodes: (t.nodes || []).map((s) => this.getNode(s)) }; } - - _resolveNode (t, n) { + _resolveNode(t, n) { const s = { ...t, id: (t == null ? void 0 : t.id) || `node-${n}` @@ -7736,21 +7450,18 @@ class $A { primitives: [] })), s; } - - _resolveNodeChildren (t) { + _resolveNodeChildren(t) { return t.children && (t.children = t.children.map((n) => this.getNode(n))), t; } - - _resolveSkin (t, n) { - const s = typeof t.inverseBindMatrices === 'number' ? this.getAccessor(t.inverseBindMatrices) : void 0; + _resolveSkin(t, n) { + const s = typeof t.inverseBindMatrices == "number" ? this.getAccessor(t.inverseBindMatrices) : void 0; return { ...t, id: t.id || `skin-${n}`, inverseBindMatrices: s }; } - - _resolveMesh (t, n) { + _resolveMesh(t, n) { const s = { ...t, id: t.id || `mesh-${n}`, @@ -7762,13 +7473,13 @@ class $A { attributes: {}, indices: void 0, material: void 0 - }; const o = r.attributes; - for (const a in o) { i.attributes[a] = this.getAccessor(o[a]); } + }, o = r.attributes; + for (const a in o) + i.attributes[a] = this.getAccessor(o[a]); return r.indices !== void 0 && (i.indices = this.getAccessor(r.indices)), r.material !== void 0 && (i.material = this.getMaterial(r.material)), i; })), s; } - - _resolveMaterial (t, n) { + _resolveMaterial(t, n) { const s = { ...t, id: t.id || `material-${n}` @@ -7792,9 +7503,8 @@ class $A { } return s; } - - _resolveAccessor (t, n) { - const s = qA(t.componentType); const r = YA(t.type); const i = s * r; const o = { + _resolveAccessor(t, n) { + const s = qA(t.componentType), r = YA(t.type), i = s * r, o = { ...t, id: t.id || `accessor-${n}`, bytesPerComponent: s, @@ -7805,17 +7515,16 @@ class $A { sparse: void 0 }; if (t.bufferView !== void 0 && (o.bufferView = this.getBufferView(t.bufferView)), o.bufferView) { - const a = o.bufferView.buffer; const { + const a = o.bufferView.buffer, { ArrayType: c, byteLength: u - } = Ir(o, o.bufferView); const l = (o.bufferView.byteOffset || 0) + (o.byteOffset || 0) + a.byteOffset; + } = Ir(o, o.bufferView), l = (o.bufferView.byteOffset || 0) + (o.byteOffset || 0) + a.byteOffset; let h = a.arrayBuffer.slice(l, l + u); o.bufferView.byteStride && (h = this._getValueFromInterleavedBuffer(a, l, o.bufferView.byteStride, o.bytesPerElement, o.count)), o.value = new c(h); } return o; } - - _getValueFromInterleavedBuffer (t, n, s, r, i) { + _getValueFromInterleavedBuffer(t, n, s, r, i) { const o = new Uint8Array(i * r); for (let a = 0; a < i; a++) { const c = n + a * s; @@ -7823,17 +7532,15 @@ class $A { } return o.buffer; } - - _resolveTexture (t, n) { + _resolveTexture(t, n) { return { ...t, id: t.id || `texture-${n}`, - sampler: typeof t.sampler === 'number' ? this.getSampler(t.sampler) : QA(), - source: typeof t.source === 'number' ? this.getImage(t.source) : void 0 + sampler: typeof t.sampler == "number" ? this.getSampler(t.sampler) : QA(), + source: typeof t.source == "number" ? this.getImage(t.source) : void 0 }; } - - _resolveSampler (t, n) { + _resolveSampler(t, n) { const s = { id: t.id || `sampler-${n}`, ...t, @@ -7845,23 +7552,20 @@ class $A { } return s; } - - _enumSamplerParameter (t) { + _enumSamplerParameter(t) { return WA[t]; } - - _resolveImage (t, n) { + _resolveImage(t, n) { const s = { ...t, id: t.id || `image-${n}`, image: null, bufferView: t.bufferView !== void 0 ? this.getBufferView(t.bufferView) : void 0 - }; const r = this.images[n]; + }, r = this.images[n]; return r && (s.image = r), s; } - - _resolveBufferView (t, n) { - const s = t.buffer; const r = this.buffers[s].arrayBuffer; + _resolveBufferView(t, n) { + const s = t.buffer, r = this.buffers[s].arrayBuffer; let i = this.buffers[s].byteOffset || 0; return t.byteOffset && (i += t.byteOffset), { id: `bufferView-${n}`, @@ -7870,8 +7574,7 @@ class $A { data: new Uint8Array(r, i, t.byteLength) }; } - - _resolveCamera (t, n) { + _resolveCamera(t, n) { const s = { ...t, id: t.id || `camera-${n}` @@ -7879,27 +7582,29 @@ class $A { return s.perspective, s.orthographic, s; } } -function oc (e, t) { +function oc(e, t) { return new $A().postProcess(e, t); } const Zs = { URI: 0, EMBEDDED: 1 }; -function ac (e, t, n, s) { +function ac(e, t, n, s) { e.rotateYtoZ = !0; const r = (e.byteOffset || 0) + (e.byteLength || 0) - n; - if (r === 0) { throw new Error('glTF byte length must be greater than 0.'); } - return e.gltfUpAxis = s != null && s['3d-tiles'] && s['3d-tiles'].assetGltfUpAxis ? s['3d-tiles'].assetGltfUpAxis : 'Y', e.gltfArrayBuffer = dr(t, n, r), e.gltfByteOffset = 0, e.gltfByteLength = r, n % 4 === 0 || console.warn(`${e.type}: embedded glb is not aligned to a 4-byte boundary.`), (e.byteOffset || 0) + (e.byteLength || 0); + if (r === 0) + throw new Error("glTF byte length must be greater than 0."); + return e.gltfUpAxis = s != null && s["3d-tiles"] && s["3d-tiles"].assetGltfUpAxis ? s["3d-tiles"].assetGltfUpAxis : "Y", e.gltfArrayBuffer = dr(t, n, r), e.gltfByteOffset = 0, e.gltfByteLength = r, n % 4 === 0 || console.warn(`${e.type}: embedded glb is not aligned to a 4-byte boundary.`), (e.byteOffset || 0) + (e.byteLength || 0); } -async function cc (e, t, n, s) { - const r = (n == null ? void 0 : n['3d-tiles']) || {}; +async function cc(e, t, n, s) { + const r = (n == null ? void 0 : n["3d-tiles"]) || {}; if (ZA(e, t), r.loadGLTF) { - if (!s) { return; } + if (!s) + return; if (e.gltfUrl) { const { fetch: i - } = s; const o = await i(e.gltfUrl, n); + } = s, o = await i(e.gltfUrl, n); e.gltfArrayBuffer = await o.arrayBuffer(), e.gltfByteOffset = 0; } if (e.gltfArrayBuffer) { @@ -7908,76 +7613,87 @@ async function cc (e, t, n, s) { } } } -function ZA (e, t, n) { +function ZA(e, t, n) { switch (t) { case Zs.URI: if (e.gltfArrayBuffer) { - const s = new Uint8Array(e.gltfArrayBuffer, e.gltfByteOffset); const i = new TextDecoder().decode(s); - e.gltfUrl = i.replace(/[\s\0]+$/, ''); + const s = new Uint8Array(e.gltfArrayBuffer, e.gltfByteOffset), i = new TextDecoder().decode(s); + e.gltfUrl = i.replace(/[\s\0]+$/, ""); } delete e.gltfArrayBuffer, delete e.gltfByteOffset, delete e.gltfByteLength; break; case Zs.EMBEDDED: break; default: - throw new Error('b3dm: Illegal glTF format field'); + throw new Error("b3dm: Illegal glTF format field"); } } -async function tp (e, t, n, s, r) { - let i; +async function tp(e, t, n, s, r) { + var i; n = ep(e, t, n, s), await cc(e, Zs.EMBEDDED, s, r); const o = e == null || (i = e.gltf) === null || i === void 0 ? void 0 : i.extensions; return o && o.CESIUM_RTC && (e.rtcCenter = o.CESIUM_RTC.center), n; } -function ep (e, t, n, s, r) { +function ep(e, t, n, s, r) { n = qn(e, t, n), n = _r(e, t, n), n = wr(e, t, n), n = ac(e, t, n, s); const i = new br(e.featureTableJson, e.featureTableBinary); - return e.rtcCenter = i.getGlobalProperty('RTC_CENTER', G.FLOAT, 3), n; + return e.rtcCenter = i.getGlobalProperty("RTC_CENTER", G.FLOAT, 3), n; } -async function np (e, t, n, s, r) { +async function np(e, t, n, s, r) { return n = sp(e, t, n, s), await cc(e, e.gltfFormat || 0, s, r), n; } -function sp (e, t, n, s, r) { - let i; - if (n = qn(e, t, n), e.version !== 1) { throw new Error(`Instanced 3D Model version ${e.version} is not supported`); } +function sp(e, t, n, s, r) { + var i; + if (n = qn(e, t, n), e.version !== 1) + throw new Error(`Instanced 3D Model version ${e.version} is not supported`); n = _r(e, t, n); const o = new DataView(t); - if (e.gltfFormat = o.getUint32(n, !0), n += 4, n = wr(e, t, n), n = ac(e, t, n, s), !(e != null && (i = e.header) !== null && i !== void 0 && i.featureTableJsonByteLength) || e.header.featureTableJsonByteLength === 0) { throw new Error('i3dm parser: featureTableJsonByteLength is zero.'); } - const a = new br(e.featureTableJson, e.featureTableBinary); const c = a.getGlobalProperty('INSTANCES_LENGTH'); - if (a.featuresLength = c, !Number.isFinite(c)) { throw new Error('i3dm parser: INSTANCES_LENGTH must be defined'); } - e.eastNorthUp = a.getGlobalProperty('EAST_NORTH_UP'), e.rtcCenter = a.getGlobalProperty('RTC_CENTER', G.FLOAT, 3); + if (e.gltfFormat = o.getUint32(n, !0), n += 4, n = wr(e, t, n), n = ac(e, t, n, s), !(e != null && (i = e.header) !== null && i !== void 0 && i.featureTableJsonByteLength) || e.header.featureTableJsonByteLength === 0) + throw new Error("i3dm parser: featureTableJsonByteLength is zero."); + const a = new br(e.featureTableJson, e.featureTableBinary), c = a.getGlobalProperty("INSTANCES_LENGTH"); + if (a.featuresLength = c, !Number.isFinite(c)) + throw new Error("i3dm parser: INSTANCES_LENGTH must be defined"); + e.eastNorthUp = a.getGlobalProperty("EAST_NORTH_UP"), e.rtcCenter = a.getGlobalProperty("RTC_CENTER", G.FLOAT, 3); const u = new Pa(e.batchTableJson, e.batchTableBinary, c); return rp(e, a, u, c), n; } -function rp (e, t, n, s) { - const r = new Array(s); const i = new A(); +function rp(e, t, n, s) { + const r = new Array(s), i = new A(); new A(), new A(), new A(); - const o = new X(); const a = new On(); const c = new A(); const u = {}; const l = new V(); const h = []; const f = []; const d = []; const m = []; + const o = new X(), a = new On(), c = new A(), u = {}, l = new V(), h = [], f = [], d = [], m = []; for (let g = 0; g < s; g++) { let y; - if (t.hasProperty('POSITION')) { y = t.getProperty('POSITION', G.FLOAT, 3, g, i); } else if (t.hasProperty('POSITION_QUANTIZED')) { - y = t.getProperty('POSITION_QUANTIZED', G.UNSIGNED_SHORT, 3, g, i); - const b = t.getGlobalProperty('QUANTIZED_VOLUME_OFFSET', G.FLOAT, 3); - if (!b) { throw new Error('i3dm parser: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.'); } - const O = t.getGlobalProperty('QUANTIZED_VOLUME_SCALE', G.FLOAT, 3); - if (!O) { throw new Error('i3dm parser: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.'); } + if (t.hasProperty("POSITION")) + y = t.getProperty("POSITION", G.FLOAT, 3, g, i); + else if (t.hasProperty("POSITION_QUANTIZED")) { + y = t.getProperty("POSITION_QUANTIZED", G.UNSIGNED_SHORT, 3, g, i); + const b = t.getGlobalProperty("QUANTIZED_VOLUME_OFFSET", G.FLOAT, 3); + if (!b) + throw new Error("i3dm parser: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions."); + const O = t.getGlobalProperty("QUANTIZED_VOLUME_SCALE", G.FLOAT, 3); + if (!O) + throw new Error("i3dm parser: QUANTIZED_VOLUME_SCALE must be defined for quantized positions."); const F = 65535; - for (let v = 0; v < 3; v++) { y[v] = y[v] / F * O[v] + b[v]; } - } - if (!y) { throw new Error('i3dm: POSITION or POSITION_QUANTIZED must be defined for each instance.'); } - if (i.copy(y), u.translation = i, e.normalUp = t.getProperty('NORMAL_UP', G.FLOAT, 3, g, h), e.normalRight = t.getProperty('NORMAL_RIGHT', G.FLOAT, 3, g, f), e.normalUp) { - if (!e.normalRight) { throw new Error('i3dm: Custom orientation requires both NORMAL_UP and NORMAL_RIGHT.'); } + for (let v = 0; v < 3; v++) + y[v] = y[v] / F * O[v] + b[v]; + } + if (!y) + throw new Error("i3dm: POSITION or POSITION_QUANTIZED must be defined for each instance."); + if (i.copy(y), u.translation = i, e.normalUp = t.getProperty("NORMAL_UP", G.FLOAT, 3, g, h), e.normalRight = t.getProperty("NORMAL_RIGHT", G.FLOAT, 3, g, f), e.normalUp) { + if (!e.normalRight) + throw new Error("i3dm: Custom orientation requires both NORMAL_UP and NORMAL_RIGHT."); e.hasCustomOrientation = !0; } else { - if (e.octNormalUp = t.getProperty('NORMAL_UP_OCT32P', G.UNSIGNED_SHORT, 2, g, h), e.octNormalRight = t.getProperty('NORMAL_RIGHT_OCT32P', G.UNSIGNED_SHORT, 2, g, f), e.octNormalUp) { throw e.octNormalRight ? new Error('i3dm: oct-encoded orientation not implemented') : new Error('i3dm: oct-encoded orientation requires NORMAL_UP_OCT32P and NORMAL_RIGHT_OCT32P'); } + if (e.octNormalUp = t.getProperty("NORMAL_UP_OCT32P", G.UNSIGNED_SHORT, 2, g, h), e.octNormalRight = t.getProperty("NORMAL_RIGHT_OCT32P", G.UNSIGNED_SHORT, 2, g, f), e.octNormalUp) + throw e.octNormalRight ? new Error("i3dm: oct-encoded orientation not implemented") : new Error("i3dm: oct-encoded orientation requires NORMAL_UP_OCT32P and NORMAL_RIGHT_OCT32P"); e.eastNorthUp ? (J.WGS84.eastNorthUpToFixedFrame(i, l), l.getRotationMatrix3(o)) : o.identity(); } a.fromMatrix3(o), u.rotation = a, c.set(1, 1, 1); - const E = t.getProperty('SCALE', G.FLOAT, 1, g, d); + const E = t.getProperty("SCALE", G.FLOAT, 1, g, d); Number.isFinite(E) && c.multiplyByScalar(E); - const R = t.getProperty('SCALE_NON_UNIFORM', G.FLOAT, 3, g, h); + const R = t.getProperty("SCALE_NON_UNIFORM", G.FLOAT, 3, g, h); R && c.scale(R), u.scale = c; - let B = t.getProperty('BATCH_ID', G.UNSIGNED_SHORT, 1, g, m); + let B = t.getProperty("BATCH_ID", G.UNSIGNED_SHORT, 1, g, m); B === void 0 && (B = g); const C = new V().fromQuaternion(u.rotation); l.identity(), l.translate(u.translation), l.multiplyRight(C), l.scale(u.scale); @@ -7989,32 +7705,32 @@ function rp (e, t, n, s) { } e.instances = r; } -async function ip (e, t, n, s, r, i) { +async function ip(e, t, n, s, r, i) { n = qn(e, t, n); const o = new DataView(t); - for (e.tilesLength = o.getUint32(n, !0), n += 4, e.tiles = []; e.tiles.length < e.tilesLength && (e.byteLength || 0) - n > 12;) { + for (e.tilesLength = o.getUint32(n, !0), n += 4, e.tiles = []; e.tiles.length < e.tilesLength && (e.byteLength || 0) - n > 12; ) { const a = { - shape: 'tile3d' + shape: "tile3d" }; e.tiles.push(a), n = await i(t, n, s, r, a); } return n; } -async function op (e, t, n, s) { - let r, i; - if (e.rotateYtoZ = !0, e.gltfUpAxis = n != null && (r = n['3d-tiles']) !== null && r !== void 0 && r.assetGltfUpAxis ? n['3d-tiles'].assetGltfUpAxis : 'Y', n != null && (i = n['3d-tiles']) !== null && i !== void 0 && i.loadGLTF) { - if (!s) { return t.byteLength; } +async function op(e, t, n, s) { + var r, i; + if (e.rotateYtoZ = !0, e.gltfUpAxis = n != null && (r = n["3d-tiles"]) !== null && r !== void 0 && r.assetGltfUpAxis ? n["3d-tiles"].assetGltfUpAxis : "Y", n != null && (i = n["3d-tiles"]) !== null && i !== void 0 && i.loadGLTF) { + if (!s) + return t.byteLength; const o = await Ke(t, Nn, n, s); e.gltf = oc(o), e.gpuMemoryUsageInBytes = ka(e.gltf); - } else { e.gltfArrayBuffer = t; } + } else + e.gltfArrayBuffer = t; return t.byteLength; } -async function uc (e) { - const t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0; const n = arguments.length > 2 ? arguments[2] : void 0; const s = arguments.length > 3 ? arguments[3] : void 0; const r = arguments.length > 4 && arguments[4] !== void 0 - ? arguments[4] - : { - shape: 'tile3d' - }; +async function uc(e) { + let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0, n = arguments.length > 2 ? arguments[2] : void 0, s = arguments.length > 3 ? arguments[3] : void 0, r = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : { + shape: "tile3d" + }; switch (r.byteOffset = t, r.type = Sd(e, t), r.type) { case _e.COMPOSITE: return await ip(r, e, t, n, s, uc); @@ -8030,43 +7746,50 @@ async function uc (e) { throw new Error(`3DTileLoader: unknown type ${r.type}`); } } -const ap = 1952609651; const cp = 1; -async function up (e, t, n) { - if (new Uint32Array(e.slice(0, 4))[0] !== ap) { throw new Error('Wrong subtree file magic number'); } - if (new Uint32Array(e.slice(4, 8))[0] !== cp) { throw new Error('Wrong subtree file verson, must be 1'); } - const i = Zi(e.slice(8, 16)); const o = new Uint8Array(e, 24, i); const c = new TextDecoder('utf8').decode(o); const u = JSON.parse(c); const l = Zi(e.slice(16, 24)); +const ap = 1952609651, cp = 1; +async function up(e, t, n) { + if (new Uint32Array(e.slice(0, 4))[0] !== ap) + throw new Error("Wrong subtree file magic number"); + if (new Uint32Array(e.slice(4, 8))[0] !== cp) + throw new Error("Wrong subtree file verson, must be 1"); + const i = Zi(e.slice(8, 16)), o = new Uint8Array(e, 24, i), c = new TextDecoder("utf8").decode(o), u = JSON.parse(c), l = Zi(e.slice(16, 24)); let h = new ArrayBuffer(0); - if (l && (h = e.slice(24 + i)), await pn(u, u.tileAvailability, h, n), Array.isArray(u.contentAvailability)) { - for (const f of u.contentAvailability) { await pn(u, f, h, n); } - } else { await pn(u, u.contentAvailability, h, n); } + if (l && (h = e.slice(24 + i)), await pn(u, u.tileAvailability, h, n), Array.isArray(u.contentAvailability)) + for (const f of u.contentAvailability) + await pn(u, f, h, n); + else + await pn(u, u.contentAvailability, h, n); return await pn(u, u.childSubtreeAvailability, h, n), u; } -async function pn (e, t, n, s) { +async function pn(e, t, n, s) { const r = Number.isFinite(t.bitstream) ? t.bitstream : t.bufferView; - if (typeof r !== 'number') { return; } - const i = e.bufferViews[r]; const o = e.buffers[i.buffer]; - if (!(s != null && s.baseUrl)) { throw new Error('Url is not provided'); } - if (!s.fetch) { throw new Error('fetch is not provided'); } + if (typeof r != "number") + return; + const i = e.bufferViews[r], o = e.buffers[i.buffer]; + if (!(s != null && s.baseUrl)) + throw new Error("Url is not provided"); + if (!s.fetch) + throw new Error("fetch is not provided"); if (o.uri) { - const c = `${(s == null ? void 0 : s.baseUrl) || ''}/${o.uri}`; const l = await (await s.fetch(c)).arrayBuffer(); + const c = `${(s == null ? void 0 : s.baseUrl) || ""}/${o.uri}`, l = await (await s.fetch(c)).arrayBuffer(); t.explicitBitstream = new Uint8Array(l, i.byteOffset, i.byteLength); return; } const a = e.buffers.slice(0, i.buffer).reduce((c, u) => c + u.byteLength, 0); t.explicitBitstream = new Uint8Array(n.slice(a, a + o.byteLength), i.byteOffset, i.byteLength); } -function Zi (e) { - const t = new DataView(e); const n = t.getUint32(0, !0); const s = t.getUint32(4, !0); +function Zi(e) { + const t = new DataView(e), n = t.getUint32(0, !0), s = t.getUint32(4, !0); return n + 2 ** 32 * s; } const lc = { - id: '3d-tiles-subtree', - name: '3D Tiles Subtree', - module: '3d-tiles', + id: "3d-tiles-subtree", + name: "3D Tiles Subtree", + module: "3d-tiles", version: va, - extensions: ['subtree'], - mimeTypes: ['application/octet-stream'], - tests: ['subtree'], + extensions: ["subtree"], + mimeTypes: ["application/octet-stream"], + tests: ["subtree"], parse: up, options: {} }; @@ -8089,7 +7812,7 @@ const lc = { * * SPDX-License-Identifier: Apache-2.0 */ -let Et = null; +var Et = null; try { Et = new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([ 0, @@ -8381,72 +8104,83 @@ try { ])), {}).exports; } catch { } -function H (e, t, n) { +function H(e, t, n) { this.low = e | 0, this.high = t | 0, this.unsigned = !!n; } H.prototype.__isLong__; -Object.defineProperty(H.prototype, '__isLong__', { value: !0 }); -function at (e) { +Object.defineProperty(H.prototype, "__isLong__", { value: !0 }); +function at(e) { return (e && e.__isLong__) === !0; } -function to (e) { - const t = Math.clz32(e & -e); +function to(e) { + var t = Math.clz32(e & -e); return e ? 31 - t : t; } H.isLong = at; -const eo = {}; const no = {}; -function ie (e, t) { - let n, s, r; - return t ? (e >>>= 0, (r = e >= 0 && e < 256) && (s = no[e], s) ? s : (n = N(e, 0, !0), r && (no[e] = n), n)) : (e |= 0, (r = e >= -128 && e < 128) && (s = eo[e], s) ? s : (n = N(e, e < 0 ? -1 : 0, !1), r && (eo[e] = n), n)); +var eo = {}, no = {}; +function ie(e, t) { + var n, s, r; + return t ? (e >>>= 0, (r = 0 <= e && e < 256) && (s = no[e], s) ? s : (n = N(e, 0, !0), r && (no[e] = n), n)) : (e |= 0, (r = -128 <= e && e < 128) && (s = eo[e], s) ? s : (n = N(e, e < 0 ? -1 : 0, !1), r && (eo[e] = n), n)); } H.fromInt = ie; -function Tt (e, t) { - if (isNaN(e)) { return t ? Ut : St; } +function Tt(e, t) { + if (isNaN(e)) + return t ? Ut : St; if (t) { - if (e < 0) { return Ut; } - if (e >= hc) { return mc; } + if (e < 0) + return Ut; + if (e >= hc) + return mc; } else { - if (e <= -ro) { return mt; } - if (e + 1 >= ro) { return dc; } + if (e <= -ro) + return mt; + if (e + 1 >= ro) + return dc; } return e < 0 ? Tt(-e, t).neg() : N(e % ye | 0, e / ye | 0, t); } H.fromNumber = Tt; -function N (e, t, n) { +function N(e, t, n) { return new H(e, t, n); } H.fromBits = N; -const Un = Math.pow; -function Pr (e, t, n) { - if (e.length === 0) { throw Error('empty string'); } - if (typeof t === 'number' ? (n = t, t = !1) : t = !!t, e === 'NaN' || e === 'Infinity' || e === '+Infinity' || e === '-Infinity') { return t ? Ut : St; } - if (n = n || 10, n < 2 || n > 36) { throw RangeError('radix'); } - let s; - if ((s = e.indexOf('-')) > 0) { throw Error('interior hyphen'); } - if (s === 0) { return Pr(e.substring(1), t, n).neg(); } +var Un = Math.pow; +function Pr(e, t, n) { + if (e.length === 0) + throw Error("empty string"); + if (typeof t == "number" ? (n = t, t = !1) : t = !!t, e === "NaN" || e === "Infinity" || e === "+Infinity" || e === "-Infinity") + return t ? Ut : St; + if (n = n || 10, n < 2 || 36 < n) + throw RangeError("radix"); + var s; + if ((s = e.indexOf("-")) > 0) + throw Error("interior hyphen"); + if (s === 0) + return Pr(e.substring(1), t, n).neg(); for (var r = Tt(Un(n, 8)), i = St, o = 0; o < e.length; o += 8) { - const a = Math.min(8, e.length - o); const c = parseInt(e.substring(o, o + a), n); + var a = Math.min(8, e.length - o), c = parseInt(e.substring(o, o + a), n); if (a < 8) { - const u = Tt(Un(n, a)); + var u = Tt(Un(n, a)); i = i.mul(u).add(Tt(c)); - } else { i = i.mul(r), i = i.add(Tt(c)); } + } else + i = i.mul(r), i = i.add(Tt(c)); } return i.unsigned = t, i; } H.fromString = Pr; -function xt (e, t) { - return typeof e === 'number' ? Tt(e, t) : typeof e === 'string' ? Pr(e, t) : N(e.low, e.high, typeof t === 'boolean' ? t : e.unsigned); +function xt(e, t) { + return typeof e == "number" ? Tt(e, t) : typeof e == "string" ? Pr(e, t) : N(e.low, e.high, typeof t == "boolean" ? t : e.unsigned); } H.fromValue = xt; -const so = 65536; const lp = 1 << 24; var ye = so * so; var hc = ye * ye; var ro = hc / 2; const io = ie(lp); var St = ie(0); +var so = 65536, lp = 1 << 24, ye = so * so, hc = ye * ye, ro = hc / 2, io = ie(lp), St = ie(0); H.ZERO = St; var Ut = ie(0, !0); H.UZERO = Ut; -const de = ie(1); +var de = ie(1); H.ONE = de; -const fc = ie(1, !0); +var fc = ie(1, !0); H.UONE = fc; -const tr = ie(-1); +var tr = ie(-1); H.NEG_ONE = tr; var dc = N(-1, 2147483647, !1); H.MAX_VALUE = dc; @@ -8454,68 +8188,73 @@ var mc = N(-1, -1, !0); H.MAX_UNSIGNED_VALUE = mc; var mt = N(0, -2147483648, !1); H.MIN_VALUE = mt; -const _ = H.prototype; -_.toInt = function () { +var _ = H.prototype; +_.toInt = function() { return this.unsigned ? this.low >>> 0 : this.low; }; -_.toNumber = function () { +_.toNumber = function() { return this.unsigned ? (this.high >>> 0) * ye + (this.low >>> 0) : this.high * ye + (this.low >>> 0); }; -_.toString = function (t) { - if (t = t || 10, t < 2 || t > 36) { throw RangeError('radix'); } - if (this.isZero()) { return '0'; } - if (this.isNegative()) { +_.toString = function(t) { + if (t = t || 10, t < 2 || 36 < t) + throw RangeError("radix"); + if (this.isZero()) + return "0"; + if (this.isNegative()) if (this.eq(mt)) { - const n = Tt(t); const s = this.div(n); const r = s.mul(n).sub(this); + var n = Tt(t), s = this.div(n), r = s.mul(n).sub(this); return s.toString(t) + r.toInt().toString(t); - } else { return '-' + this.neg().toString(t); } - } - for (let i = Tt(Un(t, 6), this.unsigned), o = this, a = ''; ;) { - const c = o.div(i); const u = o.sub(c.mul(i)).toInt() >>> 0; let l = u.toString(t); - if (o = c, o.isZero()) { return l + a; } - for (; l.length < 6;) { l = '0' + l; } - a = '' + l + a; + } else + return "-" + this.neg().toString(t); + for (var i = Tt(Un(t, 6), this.unsigned), o = this, a = ""; ; ) { + var c = o.div(i), u = o.sub(c.mul(i)).toInt() >>> 0, l = u.toString(t); + if (o = c, o.isZero()) + return l + a; + for (; l.length < 6; ) + l = "0" + l; + a = "" + l + a; } }; -_.getHighBits = function () { +_.getHighBits = function() { return this.high; }; -_.getHighBitsUnsigned = function () { +_.getHighBitsUnsigned = function() { return this.high >>> 0; }; -_.getLowBits = function () { +_.getLowBits = function() { return this.low; }; -_.getLowBitsUnsigned = function () { +_.getLowBitsUnsigned = function() { return this.low >>> 0; }; -_.getNumBitsAbs = function () { - if (this.isNegative()) { return this.eq(mt) ? 64 : this.neg().getNumBitsAbs(); } +_.getNumBitsAbs = function() { + if (this.isNegative()) + return this.eq(mt) ? 64 : this.neg().getNumBitsAbs(); for (var t = this.high != 0 ? this.high : this.low, n = 31; n > 0 && !(t & 1 << n); n--) ; return this.high != 0 ? n + 33 : n + 1; }; -_.isZero = function () { +_.isZero = function() { return this.high === 0 && this.low === 0; }; _.eqz = _.isZero; -_.isNegative = function () { +_.isNegative = function() { return !this.unsigned && this.high < 0; }; -_.isPositive = function () { +_.isPositive = function() { return this.unsigned || this.high >= 0; }; -_.isOdd = function () { +_.isOdd = function() { return (this.low & 1) === 1; }; -_.isEven = function () { +_.isEven = function() { return (this.low & 1) === 0; }; -_.equals = function (t) { +_.equals = function(t) { return at(t) || (t = xt(t)), this.unsigned !== t.unsigned && this.high >>> 31 === 1 && t.high >>> 31 === 1 ? !1 : this.high === t.high && this.low === t.low; }; _.eq = _.equals; -_.notEquals = function (t) { +_.notEquals = function(t) { return !this.eq( /* validates */ t @@ -8523,14 +8262,14 @@ _.notEquals = function (t) { }; _.neq = _.notEquals; _.ne = _.notEquals; -_.lessThan = function (t) { +_.lessThan = function(t) { return this.comp( /* validates */ t ) < 0; }; _.lt = _.lessThan; -_.lessThanOrEqual = function (t) { +_.lessThanOrEqual = function(t) { return this.comp( /* validates */ t @@ -8538,14 +8277,14 @@ _.lessThanOrEqual = function (t) { }; _.lte = _.lessThanOrEqual; _.le = _.lessThanOrEqual; -_.greaterThan = function (t) { +_.greaterThan = function(t) { return this.comp( /* validates */ t ) > 0; }; _.gt = _.greaterThan; -_.greaterThanOrEqual = function (t) { +_.greaterThanOrEqual = function(t) { return this.comp( /* validates */ t @@ -8553,29 +8292,31 @@ _.greaterThanOrEqual = function (t) { }; _.gte = _.greaterThanOrEqual; _.ge = _.greaterThanOrEqual; -_.compare = function (t) { - if (at(t) || (t = xt(t)), this.eq(t)) { return 0; } - const n = this.isNegative(); const s = t.isNegative(); +_.compare = function(t) { + if (at(t) || (t = xt(t)), this.eq(t)) + return 0; + var n = this.isNegative(), s = t.isNegative(); return n && !s ? -1 : !n && s ? 1 : this.unsigned ? t.high >>> 0 > this.high >>> 0 || t.high === this.high && t.low >>> 0 > this.low >>> 0 ? -1 : 1 : this.sub(t).isNegative() ? -1 : 1; }; _.comp = _.compare; -_.negate = function () { +_.negate = function() { return !this.unsigned && this.eq(mt) ? mt : this.not().add(de); }; _.neg = _.negate; -_.add = function (t) { +_.add = function(t) { at(t) || (t = xt(t)); - const n = this.high >>> 16; const s = this.high & 65535; const r = this.low >>> 16; const i = this.low & 65535; const o = t.high >>> 16; const a = t.high & 65535; const c = t.low >>> 16; const u = t.low & 65535; let l = 0; let h = 0; let f = 0; let d = 0; + var n = this.high >>> 16, s = this.high & 65535, r = this.low >>> 16, i = this.low & 65535, o = t.high >>> 16, a = t.high & 65535, c = t.low >>> 16, u = t.low & 65535, l = 0, h = 0, f = 0, d = 0; return d += i + u, f += d >>> 16, d &= 65535, f += r + c, h += f >>> 16, f &= 65535, h += s + a, l += h >>> 16, h &= 65535, l += n + o, l &= 65535, N(f << 16 | d, l << 16 | h, this.unsigned); }; -_.subtract = function (t) { +_.subtract = function(t) { return at(t) || (t = xt(t)), this.add(t.neg()); }; _.sub = _.subtract; -_.multiply = function (t) { - if (this.isZero()) { return this; } +_.multiply = function(t) { + if (this.isZero()) + return this; if (at(t) || (t = xt(t)), Et) { - const n = Et.mul( + var n = Et.mul( this.low, this.high, t.low, @@ -8583,21 +8324,29 @@ _.multiply = function (t) { ); return N(n, Et.get_high(), this.unsigned); } - if (t.isZero()) { return this.unsigned ? Ut : St; } - if (this.eq(mt)) { return t.isOdd() ? mt : St; } - if (t.eq(mt)) { return this.isOdd() ? mt : St; } - if (this.isNegative()) { return t.isNegative() ? this.neg().mul(t.neg()) : this.neg().mul(t).neg(); } - if (t.isNegative()) { return this.mul(t.neg()).neg(); } - if (this.lt(io) && t.lt(io)) { return Tt(this.toNumber() * t.toNumber(), this.unsigned); } - const s = this.high >>> 16; const r = this.high & 65535; const i = this.low >>> 16; const o = this.low & 65535; const a = t.high >>> 16; const c = t.high & 65535; const u = t.low >>> 16; const l = t.low & 65535; let h = 0; let f = 0; let d = 0; let m = 0; + if (t.isZero()) + return this.unsigned ? Ut : St; + if (this.eq(mt)) + return t.isOdd() ? mt : St; + if (t.eq(mt)) + return this.isOdd() ? mt : St; + if (this.isNegative()) + return t.isNegative() ? this.neg().mul(t.neg()) : this.neg().mul(t).neg(); + if (t.isNegative()) + return this.mul(t.neg()).neg(); + if (this.lt(io) && t.lt(io)) + return Tt(this.toNumber() * t.toNumber(), this.unsigned); + var s = this.high >>> 16, r = this.high & 65535, i = this.low >>> 16, o = this.low & 65535, a = t.high >>> 16, c = t.high & 65535, u = t.low >>> 16, l = t.low & 65535, h = 0, f = 0, d = 0, m = 0; return m += o * l, d += m >>> 16, m &= 65535, d += i * l, f += d >>> 16, d &= 65535, d += o * u, f += d >>> 16, d &= 65535, f += r * l, h += f >>> 16, f &= 65535, f += i * u, h += f >>> 16, f &= 65535, f += o * c, h += f >>> 16, f &= 65535, h += s * l + r * u + i * c + o * a, h &= 65535, N(d << 16 | m, h << 16 | f, this.unsigned); }; _.mul = _.multiply; -_.divide = function (t) { - if (at(t) || (t = xt(t)), t.isZero()) { throw Error('division by zero'); } +_.divide = function(t) { + if (at(t) || (t = xt(t)), t.isZero()) + throw Error("division by zero"); if (Et) { - if (!this.unsigned && this.high === -2147483648 && t.low === -1 && t.high === -1) { return this; } - const n = (this.unsigned ? Et.div_u : Et.div_s)( + if (!this.unsigned && this.high === -2147483648 && t.low === -1 && t.high === -1) + return this; + var n = (this.unsigned ? Et.div_u : Et.div_s)( this.low, this.high, t.low, @@ -8605,34 +8354,43 @@ _.divide = function (t) { ); return N(n, Et.get_high(), this.unsigned); } - if (this.isZero()) { return this.unsigned ? Ut : St; } - let s, r, i; + if (this.isZero()) + return this.unsigned ? Ut : St; + var s, r, i; if (this.unsigned) { - if (t.unsigned || (t = t.toUnsigned()), t.gt(this)) { return Ut; } - if (t.gt(this.shru(1))) { return fc; } + if (t.unsigned || (t = t.toUnsigned()), t.gt(this)) + return Ut; + if (t.gt(this.shru(1))) + return fc; i = Ut; } else { if (this.eq(mt)) { - if (t.eq(de) || t.eq(tr)) { return mt; } - if (t.eq(mt)) { return de; } - const o = this.shr(1); + if (t.eq(de) || t.eq(tr)) + return mt; + if (t.eq(mt)) + return de; + var o = this.shr(1); return s = o.div(t).shl(1), s.eq(St) ? t.isNegative() ? de : tr : (r = this.sub(t.mul(s)), i = s.add(r.div(t)), i); - } else if (t.eq(mt)) { return this.unsigned ? Ut : St; } - if (this.isNegative()) { return t.isNegative() ? this.neg().div(t.neg()) : this.neg().div(t).neg(); } - if (t.isNegative()) { return this.div(t.neg()).neg(); } + } else if (t.eq(mt)) + return this.unsigned ? Ut : St; + if (this.isNegative()) + return t.isNegative() ? this.neg().div(t.neg()) : this.neg().div(t).neg(); + if (t.isNegative()) + return this.div(t.neg()).neg(); i = St; } - for (r = this; r.gte(t);) { + for (r = this; r.gte(t); ) { s = Math.max(1, Math.floor(r.toNumber() / t.toNumber())); - for (var a = Math.ceil(Math.log(s) / Math.LN2), c = a <= 48 ? 1 : Un(2, a - 48), u = Tt(s), l = u.mul(t); l.isNegative() || l.gt(r);) { s -= c, u = Tt(s, this.unsigned), l = u.mul(t); } + for (var a = Math.ceil(Math.log(s) / Math.LN2), c = a <= 48 ? 1 : Un(2, a - 48), u = Tt(s), l = u.mul(t); l.isNegative() || l.gt(r); ) + s -= c, u = Tt(s, this.unsigned), l = u.mul(t); u.isZero() && (u = de), i = i.add(u), r = r.sub(l); } return i; }; _.div = _.divide; -_.modulo = function (t) { +_.modulo = function(t) { if (at(t) || (t = xt(t)), Et) { - const n = (this.unsigned ? Et.rem_u : Et.rem_s)( + var n = (this.unsigned ? Et.rem_u : Et.rem_s)( this.low, this.high, t.low, @@ -8644,60 +8402,60 @@ _.modulo = function (t) { }; _.mod = _.modulo; _.rem = _.modulo; -_.not = function () { +_.not = function() { return N(~this.low, ~this.high, this.unsigned); }; -_.countLeadingZeros = function () { +_.countLeadingZeros = function() { return this.high ? Math.clz32(this.high) : Math.clz32(this.low) + 32; }; _.clz = _.countLeadingZeros; -_.countTrailingZeros = function () { +_.countTrailingZeros = function() { return this.low ? to(this.low) : to(this.high) + 32; }; _.ctz = _.countTrailingZeros; -_.and = function (t) { +_.and = function(t) { return at(t) || (t = xt(t)), N(this.low & t.low, this.high & t.high, this.unsigned); }; -_.or = function (t) { +_.or = function(t) { return at(t) || (t = xt(t)), N(this.low | t.low, this.high | t.high, this.unsigned); }; -_.xor = function (t) { +_.xor = function(t) { return at(t) || (t = xt(t)), N(this.low ^ t.low, this.high ^ t.high, this.unsigned); }; -_.shiftLeft = function (t) { +_.shiftLeft = function(t) { return at(t) && (t = t.toInt()), (t &= 63) === 0 ? this : t < 32 ? N(this.low << t, this.high << t | this.low >>> 32 - t, this.unsigned) : N(0, this.low << t - 32, this.unsigned); }; _.shl = _.shiftLeft; -_.shiftRight = function (t) { +_.shiftRight = function(t) { return at(t) && (t = t.toInt()), (t &= 63) === 0 ? this : t < 32 ? N(this.low >>> t | this.high << 32 - t, this.high >> t, this.unsigned) : N(this.high >> t - 32, this.high >= 0 ? 0 : -1, this.unsigned); }; _.shr = _.shiftRight; -_.shiftRightUnsigned = function (t) { +_.shiftRightUnsigned = function(t) { return at(t) && (t = t.toInt()), (t &= 63) === 0 ? this : t < 32 ? N(this.low >>> t | this.high << 32 - t, this.high >>> t, this.unsigned) : t === 32 ? N(this.high, 0, this.unsigned) : N(this.high >>> t - 32, 0, this.unsigned); }; _.shru = _.shiftRightUnsigned; _.shr_u = _.shiftRightUnsigned; -_.rotateLeft = function (t) { - let n; +_.rotateLeft = function(t) { + var n; return at(t) && (t = t.toInt()), (t &= 63) === 0 ? this : t === 32 ? N(this.high, this.low, this.unsigned) : t < 32 ? (n = 32 - t, N(this.low << t | this.high >>> n, this.high << t | this.low >>> n, this.unsigned)) : (t -= 32, n = 32 - t, N(this.high << t | this.low >>> n, this.low << t | this.high >>> n, this.unsigned)); }; _.rotl = _.rotateLeft; -_.rotateRight = function (t) { - let n; +_.rotateRight = function(t) { + var n; return at(t) && (t = t.toInt()), (t &= 63) === 0 ? this : t === 32 ? N(this.high, this.low, this.unsigned) : t < 32 ? (n = 32 - t, N(this.high << n | this.low >>> t, this.low << n | this.high >>> t, this.unsigned)) : (t -= 32, n = 32 - t, N(this.low << n | this.high >>> t, this.high << n | this.low >>> t, this.unsigned)); }; _.rotr = _.rotateRight; -_.toSigned = function () { +_.toSigned = function() { return this.unsigned ? N(this.low, this.high, !1) : this; }; -_.toUnsigned = function () { +_.toUnsigned = function() { return this.unsigned ? this : N(this.low, this.high, !0); }; -_.toBytes = function (t) { +_.toBytes = function(t) { return t ? this.toBytesLE() : this.toBytesBE(); }; -_.toBytesLE = function () { - const t = this.high; const n = this.low; +_.toBytesLE = function() { + var t = this.high, n = this.low; return [ n & 255, n >>> 8 & 255, @@ -8709,8 +8467,8 @@ _.toBytesLE = function () { t >>> 24 ]; }; -_.toBytesBE = function () { - const t = this.high; const n = this.low; +_.toBytesBE = function() { + var t = this.high, n = this.low; return [ t >>> 24, t >>> 16 & 255, @@ -8722,17 +8480,17 @@ _.toBytesBE = function () { n & 255 ]; }; -H.fromBytes = function (t, n, s) { +H.fromBytes = function(t, n, s) { return s ? H.fromBytesLE(t, n) : H.fromBytesBE(t, n); }; -H.fromBytesLE = function (t, n) { +H.fromBytesLE = function(t, n) { return new H( t[0] | t[1] << 8 | t[2] << 16 | t[3] << 24, t[4] | t[5] << 8 | t[6] << 16 | t[7] << 24, n ); }; -H.fromBytesBE = function (t, n) { +H.fromBytesBE = function(t, n) { return new H( t[4] << 24 | t[5] << 16 | t[6] << 8 | t[7], t[0] << 24 | t[1] << 16 | t[2] << 8 | t[3], @@ -8740,39 +8498,41 @@ H.fromBytesBE = function (t, n) { ); }; const hp = 16; -function gc (e) { - e === 'X' && (e = ''); - const t = e.padEnd(hp, '0'); +function gc(e) { + e === "X" && (e = ""); + const t = e.padEnd(hp, "0"); return H.fromString(t, !0, 16); } -function fp (e) { - if (e.isZero()) { return 'X'; } +function fp(e) { + if (e.isZero()) + return "X"; let t = e.countTrailingZeros(); const n = t % 4; t = (t - n) / 4; const s = t; t *= 4; - const i = e.shiftRightUnsigned(t).toString(16).replace(/0+$/, ''); - return Array(17 - s - i.length).join('0') + i; + const i = e.shiftRightUnsigned(t).toString(16).replace(/0+$/, ""); + return Array(17 - s - i.length).join("0") + i; } -function dp (e, t) { +function dp(e, t) { const n = mp(e).shiftRightUnsigned(2); return e.add(H.fromNumber(2 * t + 1 - 4).multiply(n)); } -function mp (e) { +function mp(e) { return e.and(e.not().add(1)); } -const gp = 3; const Ap = 30; const pp = 2 * Ap + 1; const oo = 180 / Math.PI; -function yp (e) { - if (e.length === 0) { throw new Error(`Invalid Hilbert quad key ${e}`); } - const t = e.split('/'); const n = parseInt(t[0], 10); const s = t[1]; const r = s.length; +const gp = 3, Ap = 30, pp = 2 * Ap + 1, oo = 180 / Math.PI; +function yp(e) { + if (e.length === 0) + throw new Error(`Invalid Hilbert quad key ${e}`); + const t = e.split("/"), n = parseInt(t[0], 10), s = t[1], r = s.length; let i = 0; const o = [0, 0]; for (let a = r - 1; a >= 0; a--) { i = r - a; const c = s[a]; - let u = 0; let l = 0; - c === '1' ? l = 1 : c === '2' ? (u = 1, l = 1) : c === '3' && (u = 1); + let u = 0, l = 0; + c === "1" ? l = 1 : c === "2" ? (u = 1, l = 1) : c === "3" && (u = 1); const h = Math.pow(2, i - 1); Cp(h, o, u, l), o[0] += h * u, o[1] += h * l; } @@ -8786,29 +8546,31 @@ function yp (e) { level: i }; } -function Bp (e) { - if (e.isZero()) { return ''; } +function Bp(e) { + if (e.isZero()) + return ""; let t = e.toString(2); - for (; t.length < gp + pp;) { t = '0' + t; } - const n = t.lastIndexOf('1'); const s = t.substring(0, 3); const r = t.substring(3, n); const i = r.length / 2; const o = H.fromString(s, !0, 2).toString(10); - let a = ''; - if (i !== 0) { - for (a = H.fromString(r, !0, 2).toString(4); a.length < i;) { a = '0' + a; } - } + for (; t.length < gp + pp; ) + t = "0" + t; + const n = t.lastIndexOf("1"), s = t.substring(0, 3), r = t.substring(3, n), i = r.length / 2, o = H.fromString(s, !0, 2).toString(10); + let a = ""; + if (i !== 0) + for (a = H.fromString(r, !0, 2).toString(4); a.length < i; ) + a = "0" + a; return `${o}/${a}`; } -function Ac (e, t, n) { +function Ac(e, t, n) { const s = 1 << t; return [(e[0] + n[0]) / s, (e[1] + n[1]) / s]; } -function ao (e) { +function ao(e) { return e >= 0.5 ? 1 / 3 * (4 * e * e - 1) : 1 / 3 * (1 - 4 * (1 - e) * (1 - e)); } -function pc (e) { +function pc(e) { return [ao(e[0]), ao(e[1])]; } -function yc (e, t) { - const [n, s] = t; +function yc(e, t) { + let [n, s] = t; switch (e) { case 0: return [1, n, s]; @@ -8823,38 +8585,38 @@ function yc (e, t) { case 5: return [s, n, -1]; default: - throw new Error('Invalid face'); + throw new Error("Invalid face"); } } -function Bc (e) { - const [t, n, s] = e; +function Bc(e) { + let [t, n, s] = e; const r = Math.atan2(s, Math.sqrt(t * t + n * n)); return [Math.atan2(n, t) * oo, r * oo]; } -function Cp (e, t, n, s) { +function Cp(e, t, n, s) { if (s === 0) { n === 1 && (t[0] = e - 1 - t[0], t[1] = e - 1 - t[1]); const r = t[0]; t[0] = t[1], t[1] = r; } } -function Ep (e) { - const t = Ac(e.ij, e.level, [0.5, 0.5]); const n = pc(t); const s = yc(e.face, n); +function Ep(e) { + const t = Ac(e.ij, e.level, [0.5, 0.5]), n = pc(t), s = yc(e.face, n); return Bc(s); } const Tp = 100; -function co (e) { +function co(e) { const { face: t, ij: n, level: s - } = e; const r = [[0, 0], [0, 1], [1, 1], [1, 0], [0, 0]]; const i = Math.max(1, Math.ceil(Tp * Math.pow(2, -s))); const o = new Float64Array(4 * i * 2 + 2); - let a = 0; let c = 0; + } = e, r = [[0, 0], [0, 1], [1, 1], [1, 0], [0, 0]], i = Math.max(1, Math.ceil(Tp * Math.pow(2, -s))), o = new Float64Array(4 * i * 2 + 2); + let a = 0, c = 0; for (let u = 0; u < 4; u++) { - const l = r[u].slice(0); const h = r[u + 1]; const f = (h[0] - l[0]) / i; const d = (h[1] - l[1]) / i; + const l = r[u].slice(0), h = r[u + 1], f = (h[0] - l[0]) / i, d = (h[1] - l[1]) / i; for (let m = 0; m < i; m++) { l[0] += f, l[1] += d; - const g = Ac(n, s, l); const y = pc(g); const E = yc(t, y); const R = Bc(E); + const g = Ac(n, s, l), y = pc(g), E = yc(t, y), R = Bc(E); Math.abs(R[1]) > 89.999 && (R[0] = c); const B = R[0] - c; R[0] += B > 180 ? -360 : B < -180 ? 360 : 0, o[a++] = R[0], o[a++] = R[1], c = R[0]; @@ -8862,26 +8624,27 @@ function co (e) { } return o[a++] = o[0], o[a++] = o[1], o; } -function Gr (e) { +function Gr(e) { const t = bp(e); return yp(t); } -function bp (e) { - if (e.indexOf('/') > 0) { return e; } +function bp(e) { + if (e.indexOf("/") > 0) + return e; const t = gc(e); return Bp(t); } -function _p (e) { +function _p(e) { const t = Gr(e); return Ep(t); } -function wp (e) { +function wp(e) { let t; if (e.face === 2 || e.face === 5) { - let n = null; let s = 0; + let n = null, s = 0; for (let r = 0; r < 4; r++) { - const i = `${e.face}/${r}`; const o = Gr(i); const a = co(o); - (typeof n > 'u' || n === null) && (n = new Float64Array(4 * a.length)), n.set(a, s), s += a.length; + const i = `${e.face}/${r}`, o = Gr(i), a = co(o); + (typeof n > "u" || n === null) && (n = new Float64Array(4 * a.length)), n.set(a, s), s += a.length; } t = uo(n); } else { @@ -8890,10 +8653,12 @@ function wp (e) { } return t; } -function uo (e) { - if (e.length % 2 !== 0) { throw new Error('Invalid corners'); } - const t = []; const n = []; - for (let s = 0; s < e.length; s += 2) { t.push(e[s]), n.push(e[s + 1]); } +function uo(e) { + if (e.length % 2 !== 0) + throw new Error("Invalid corners"); + const t = [], n = []; + for (let s = 0; s < e.length; s += 2) + t.push(e[s]), n.push(e[s + 1]); return t.sort((s, r) => s - r), n.sort((s, r) => s - r), { west: t[0], east: t[t.length - 1], @@ -8901,31 +8666,31 @@ function uo (e) { south: n[0] }; } -function Rp (e, t) { - const n = (t == null ? void 0 : t.minimumHeight) || 0; const s = (t == null ? void 0 : t.maximumHeight) || 0; const r = Gr(e); const i = wp(r); const o = i.west; const a = i.south; const c = i.east; const u = i.north; const l = []; +function Rp(e, t) { + const n = (t == null ? void 0 : t.minimumHeight) || 0, s = (t == null ? void 0 : t.maximumHeight) || 0, r = Gr(e), i = wp(r), o = i.west, a = i.south, c = i.east, u = i.north, l = []; return l.push(new A(o, u, n)), l.push(new A(c, u, n)), l.push(new A(c, a, n)), l.push(new A(o, a, n)), l.push(new A(o, u, s)), l.push(new A(c, u, s)), l.push(new A(c, a, s)), l.push(new A(o, a, s)), l; } -function Cc (e) { - const t = e.token; const n = { +function Cc(e) { + const t = e.token, n = { minimumHeight: e.minimumHeight, maximumHeight: e.maximumHeight - }; const s = Rp(t, n); const r = _p(t); const i = r[0]; const o = r[1]; const a = J.WGS84.cartographicToCartesian([i, o, n.maximumHeight]); const c = new A(a[0], a[1], a[2]); + }, s = Rp(t, n), r = _p(t), i = r[0], o = r[1], a = J.WGS84.cartographicToCartesian([i, o, n.maximumHeight]), c = new A(a[0], a[1], a[2]); s.push(c); const u = Rd(s); return [...u.center, ...u.halfAxes]; } -const Mp = 4; const Sp = 8; const Ip = { +const Mp = 4, Sp = 8, Ip = { QUADTREE: Mp, OCTREE: Sp }; -function xp (e, t, n) { +function xp(e, t, n) { if (e != null && e.box) { - const s = gc(e.s2VolumeInfo.token); const r = dp(s, t); const i = fp(r); const o = { + const s = gc(e.s2VolumeInfo.token), r = dp(s, t), i = fp(r), o = { ...e.s2VolumeInfo }; switch (o.token = i, n) { - case 'OCTREE': - const u = e.s2VolumeInfo; const l = u.maximumHeight - u.minimumHeight; const h = l / 2; const f = u.minimumHeight + l / 2; + case "OCTREE": + const u = e.s2VolumeInfo, l = u.maximumHeight - u.minimumHeight, h = l / 2, f = u.minimumHeight + l / 2; u.minimumHeight = f - h, u.maximumHeight = f + h; break; } @@ -8935,7 +8700,7 @@ function xp (e, t, n) { }; } } -async function Ec (e) { +async function Ec(e) { const { implicitOptions: t, parentData: n = { @@ -8966,20 +8731,22 @@ async function Ec (e) { contentUrlTemplate: f, subtreesUriTemplate: d, basePath: m - } = t; const g = { + } = t, g = { children: [], lodMetricValue: 0, - contentUrl: '' + contentUrl: "" }; - if (!h) { return aa.once(`Missing 'maximumLevel' or 'availableLevels' property. The subtree ${f} won't be loaded...`), g; } + if (!h) + return aa.once(`Missing 'maximumLevel' or 'availableLevels' property. The subtree ${f} won't be loaded...`), g; const y = a + c.level; - if (y > h) { return g; } - const E = Ip[u]; const R = Math.log2(E); const B = s & 1; const C = s >> 1 & 1; const M = s >> 2 & 1; const b = (E ** a - 1) / (E - 1); - let O = Qt(n.mortonIndex, s, R); let F = b + O; let v = Qt(n.x, B, 1); let L = Qt(n.y, C, 1); let k = Qt(n.z, M, 1); let q = !1; + if (y > h) + return g; + const E = Ip[u], R = Math.log2(E), B = s & 1, C = s >> 1 & 1, M = s >> 2 & 1, b = (E ** a - 1) / (E - 1); + let O = Qt(n.mortonIndex, s, R), F = b + O, v = Qt(n.x, B, 1), L = Qt(n.y, C, 1), k = Qt(n.z, M, 1), q = !1; a >= l && (q = Ss(o.childSubtreeAvailability, O)); - const Y = Qt(c.x, v, a); const P = Qt(c.y, L, a); const ct = Qt(c.z, k, a); + const Y = Qt(c.x, v, a), P = Qt(c.y, L, a), ct = Qt(c.z, k, a); if (q) { - const st = `${m}/${d}`; const Pt = er(st, y, Y, P, ct); + const st = `${m}/${d}`, Pt = er(st, y, Y, P, ct); o = await Ae(Pt, lc, i), c = { mortonIndex: O, x: v, @@ -8988,16 +8755,17 @@ async function Ec (e) { level: a }, O = 0, F = 0, v = 0, L = 0, k = 0, a = 0; } - if (!Ss(o.tileAvailability, F)) { return g; } + if (!Ss(o.tileAvailability, F)) + return g; Ss(o.contentAvailability, F) && (g.contentUrl = er(f, y, Y, P, ct)); - const Be = a + 1; const vt = { + const Be = a + 1, vt = { mortonIndex: O, x: v, y: L, z: k }; for (let st = 0; st < E; st++) { - const Pt = xp(r, st, u); const Xt = await Ec({ + const Pt = xp(r, st, u), Xt = await Ec({ subtree: o, implicitOptions: t, loaderOptions: i, @@ -9010,7 +8778,7 @@ async function Ec (e) { s2VolumeBox: Pt }); if (Xt.contentUrl || Xt.children.length) { - const Ce = y + 1; const es = vp(Xt, Ce, { + const Ce = y + 1, es = vp(Xt, Ce, { childTileX: v, childTileY: L, childTileZ: k @@ -9020,11 +8788,11 @@ async function Ec (e) { } return g; } -function Ss (e, t) { +function Ss(e, t) { let n; - return Array.isArray(e) ? (n = e[0], e.length > 1 && aa.once('Not supported extension "3DTILES_multiple_contents" has been detected')) : n = e, 'constant' in n ? !!n.constant : n.explicitBitstream ? Dp(t, n.explicitBitstream) : !1; + return Array.isArray(e) ? (n = e[0], e.length > 1 && aa.once('Not supported extension "3DTILES_multiple_contents" has been detected')) : n = e, "constant" in n ? !!n.constant : n.explicitBitstream ? Dp(t, n.explicitBitstream) : !1; } -function vp (e, t, n, s, r) { +function vp(e, t, n, s, r) { const { basePath: i, refine: o, @@ -9033,11 +8801,9 @@ function vp (e, t, n, s, r) { getTileType: u, rootLodMetricValue: l, rootBoundingVolume: h - } = s; const f = e.contentUrl && e.contentUrl.replace(`${i}/`, ''); const d = l / 2 ** t; const m = r != null && r.box - ? { - box: r.box - } - : h; const g = Op(t, m, n); + } = s, f = e.contentUrl && e.contentUrl.replace(`${i}/`, ""), d = l / 2 ** t, m = r != null && r.box ? { + box: r.box + } : h, g = Op(t, m, n); return { children: e.children, contentUrl: e.contentUrl, @@ -9054,24 +8820,25 @@ function vp (e, t, n, s, r) { boundingVolume: g }; } -function Op (e, t, n) { +function Op(e, t, n) { if (t.region) { const { childTileX: s, childTileY: r, childTileZ: i - } = n; const [o, a, c, u, l, h] = t.region; const f = 2 ** e; const d = (c - o) / f; const m = (u - a) / f; const g = (h - l) / f; const [y, E] = [o + d * s, o + d * (s + 1)]; const [R, B] = [a + m * r, a + m * (r + 1)]; const [C, M] = [l + g * i, l + g * (i + 1)]; + } = n, [o, a, c, u, l, h] = t.region, f = 2 ** e, d = (c - o) / f, m = (u - a) / f, g = (h - l) / f, [y, E] = [o + d * s, o + d * (s + 1)], [R, B] = [a + m * r, a + m * (r + 1)], [C, M] = [l + g * i, l + g * (i + 1)]; return { region: [y, R, E, B, C, M] }; } - if (t.box) { return t; } + if (t.box) + return t; throw new Error(`Unsupported bounding volume type ${t}`); } -function Qt (e, t, n) { +function Qt(e, t, n) { return (e << n) + t; } -function er (e, t, n, s, r) { +function er(e, t, n, s, r) { const i = Fp({ level: t, x: n, @@ -9080,57 +8847,61 @@ function er (e, t, n, s, r) { }); return e.replace(/{level}|{x}|{y}|{z}/gi, (o) => i[o]); } -function Fp (e) { +function Fp(e) { const t = {}; - for (const n in e) { t[`{${n}}`] = e[n]; } + for (const n in e) + t[`{${n}}`] = e[n]; return t; } -function Dp (e, t) { - const n = Math.floor(e / 8); const s = e % 8; +function Dp(e, t) { + const n = Math.floor(e / 8), s = e % 8; return (t[n] >> s & 1) === 1; } -function Nr (e) { - const t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : ''; - if (!t) { return dn.EMPTY; } - const s = t.split('?')[0].split('.').pop(); +function Nr(e) { + let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : ""; + if (!t) + return dn.EMPTY; + const s = t.split("?")[0].split(".").pop(); switch (s) { - case 'pnts': + case "pnts": return dn.POINTCLOUD; - case 'i3dm': - case 'b3dm': - case 'glb': - case 'gltf': + case "i3dm": + case "b3dm": + case "glb": + case "gltf": return dn.SCENEGRAPH; default: return s || dn.EMPTY; } } -function Ur (e) { +function Ur(e) { switch (e) { - case 'REPLACE': - case 'replace': + case "REPLACE": + case "replace": return Ii.REPLACE; - case 'ADD': - case 'add': + case "ADD": + case "add": return Ii.ADD; default: return e; } } -function nr (e, t) { +function nr(e, t) { if (/^[a-z][0-9a-z+.-]*:/i.test(t)) { const s = new URL(e, `${t}/`); return decodeURI(s.toString()); - } else if (e.startsWith('/')) { return e; } + } else if (e.startsWith("/")) + return e; return ku(t, e); } -function lo (e, t) { - if (!e) { return null; } +function lo(e, t) { + if (!e) + return null; let n; if (e.content) { - let s; + var s; const i = e.content.uri || ((s = e.content) === null || s === void 0 ? void 0 : s.url); - typeof i < 'u' && (n = nr(i, t)); + typeof i < "u" && (n = nr(i, t)); } return { ...e, @@ -9143,13 +8914,13 @@ function lo (e, t) { refine: Ur(e.refine) }; } -async function Lp (e, t, n) { +async function Lp(e, t, n) { let s = null; const r = fo(e.root); r && e.root ? s = await ho(e.root, e, t, r, n) : s = lo(e.root, t); const i = []; - for (i.push(s); i.length > 0;) { - const o = i.pop() || {}; const a = o.children || []; const c = []; + for (i.push(s); i.length > 0; ) { + const o = i.pop() || {}, a = o.children || [], c = []; for (const u of a) { const l = fo(u); let h; @@ -9159,8 +8930,8 @@ async function Lp (e, t, n) { } return s; } -async function ho (e, t, n, s, r) { - let i, o, a; +async function ho(e, t, n, s, r) { + var i, o, a; const { subdivisionScheme: c, maximumLevel: u, @@ -9169,7 +8940,7 @@ async function ho (e, t, n, s, r) { subtrees: { uri: f } - } = s; const d = er(f, 0, 0, 0, 0); const m = nr(d, n); const g = await Ae(m, lc, r); const y = (i = e.content) === null || i === void 0 ? void 0 : i.uri; const E = y ? nr(y, n) : ''; const R = t == null || (o = t.root) === null || o === void 0 ? void 0 : o.refine; const B = e.geometricError; const C = (a = e.boundingVolume.extensions) === null || a === void 0 ? void 0 : a['3DTILES_bounding_volume_S2']; + } = s, d = er(f, 0, 0, 0, 0), m = nr(d, n), g = await Ae(m, lc, r), y = (i = e.content) === null || i === void 0 ? void 0 : i.uri, E = y ? nr(y, n) : "", R = t == null || (o = t.root) === null || o === void 0 ? void 0 : o.refine, B = e.geometricError, C = (a = e.boundingVolume.extensions) === null || a === void 0 ? void 0 : a["3DTILES_bounding_volume_S2"]; if (C) { const F = { box: Cc(C), @@ -9177,7 +8948,7 @@ async function ho (e, t, n, s, r) { }; e.boundingVolume = F; } - const M = e.boundingVolume; const b = { + const M = e.boundingVolume, b = { contentUrlTemplate: E, subtreesUriTemplate: f, subdivisionScheme: c, @@ -9193,8 +8964,9 @@ async function ho (e, t, n, s, r) { }; return await Pp(e, n, g, b, r); } -async function Pp (e, t, n, s, r) { - if (!e) { return null; } +async function Pp(e, t, n, s, r) { + if (!e) + return null; const { children: i, contentUrl: o @@ -9203,9 +8975,9 @@ async function Pp (e, t, n, s, r) { implicitOptions: s, loaderOptions: r }); - let a; let c = null; + let a, c = null; return o && (a = o, c = { - uri: o.replace(`${t}/`, '') + uri: o.replace(`${t}/`, "") }), { ...e, id: a, @@ -9219,43 +8991,43 @@ async function Pp (e, t, n, s, r) { children: i }; } -function fo (e) { - let t; - return (e == null || (t = e.extensions) === null || t === void 0 ? void 0 : t['3DTILES_implicit_tiling']) || (e == null ? void 0 : e.implicitTiling); +function fo(e) { + var t; + return (e == null || (t = e.extensions) === null || t === void 0 ? void 0 : t["3DTILES_implicit_tiling"]) || (e == null ? void 0 : e.implicitTiling); } const Le = { - id: '3d-tiles', - name: '3D Tiles', - module: '3d-tiles', + id: "3d-tiles", + name: "3D Tiles", + module: "3d-tiles", version: va, - extensions: ['cmpt', 'pnts', 'b3dm', 'i3dm'], - mimeTypes: ['application/octet-stream'], - tests: ['cmpt', 'pnts', 'b3dm', 'i3dm'], + extensions: ["cmpt", "pnts", "b3dm", "i3dm"], + mimeTypes: ["application/octet-stream"], + tests: ["cmpt", "pnts", "b3dm", "i3dm"], parse: Gp, options: { - '3d-tiles': { + "3d-tiles": { loadGLTF: !0, decodeQuantizedPositions: !1, - isTileset: 'auto', + isTileset: "auto", assetGltfUpAxis: null } } }; -async function Gp (e) { - const t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; const n = arguments.length > 2 ? arguments[2] : void 0; - const s = t['3d-tiles'] || {}; +async function Gp(e) { + let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, n = arguments.length > 2 ? arguments[2] : void 0; + const s = t["3d-tiles"] || {}; let r; - return s.isTileset === 'auto' ? r = (n == null ? void 0 : n.url) && n.url.indexOf('.json') !== -1 : r = s.isTileset, r ? Np(e, t, n) : Up(e, t, n); + return s.isTileset === "auto" ? r = (n == null ? void 0 : n.url) && n.url.indexOf(".json") !== -1 : r = s.isTileset, r ? Np(e, t, n) : Up(e, t, n); } -async function Np (e, t, n) { - let s; - const r = JSON.parse(new TextDecoder().decode(e)); const i = (n == null ? void 0 : n.url) || ''; const o = Hp(i); const a = await Lp(r, o, t || {}); +async function Np(e, t, n) { + var s; + const r = JSON.parse(new TextDecoder().decode(e)), i = (n == null ? void 0 : n.url) || "", o = Hp(i), a = await Lp(r, o, t || {}); return { ...r, - shape: 'tileset3d', + shape: "tileset3d", loader: Le, url: i, - queryString: (n == null ? void 0 : n.queryString) || '', + queryString: (n == null ? void 0 : n.queryString) || "", basePath: o, root: a || r.root, type: Md.TILES3D, @@ -9263,64 +9035,68 @@ async function Np (e, t, n) { lodMetricValue: ((s = r.root) === null || s === void 0 ? void 0 : s.geometricError) || 0 }; } -async function Up (e, t, n) { +async function Up(e, t, n) { const s = { content: { - shape: 'tile3d', + shape: "tile3d", featureIds: null } }; return await uc(e, 0, t, n, s.content), s.content; } -function Hp (e) { +function Hp(e) { return ea(e); } -const Tc = 'https://api.cesium.com/v1/assets'; -async function Jp (e, t) { +const Tc = "https://api.cesium.com/v1/assets"; +async function Jp(e, t) { if (!t) { const i = await Vp(e); - for (const o of i.items) { o.type === '3DTILES' && (t = o.id); } + for (const o of i.items) + o.type === "3DTILES" && (t = o.id); } - const n = await jp(e, t); const { + const n = await jp(e, t), { type: s, url: r } = n; - return z(s === '3DTILES' && r), n.headers = { + return z(s === "3DTILES" && r), n.headers = { Authorization: `Bearer ${n.accessToken}` }, n; } -async function Vp (e) { +async function Vp(e) { z(e); - const t = Tc; const n = { + const t = Tc, n = { Authorization: `Bearer ${e}` - }; const s = await Ge(t, { + }, s = await Ge(t, { headers: n }); - if (!s.ok) { throw new Error(s.statusText); } + if (!s.ok) + throw new Error(s.statusText); return await s.json(); } -async function jp (e, t) { +async function jp(e, t) { z(e, t); const n = { Authorization: `Bearer ${e}` - }; const s = `${Tc}/${t}`; + }, s = `${Tc}/${t}`; let r = await Ge(`${s}`, { headers: n }); - if (!r.ok) { throw new Error(r.statusText); } + if (!r.ok) + throw new Error(r.statusText); let i = await r.json(); if (r = await Ge(`${s}/endpoint`, { headers: n - }), !r.ok) { throw new Error(r.statusText); } + }), !r.ok) + throw new Error(r.statusText); const o = await r.json(); return i = { ...i, ...o }, i; } -async function kp (e) { +async function kp(e) { let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; - t = t['cesium-ion'] || {}; + t = t["cesium-ion"] || {}; const { accessToken: n } = t; @@ -9333,76 +9109,74 @@ async function kp (e) { } const bc = { ...Le, - id: 'cesium-ion', - name: 'Cesium Ion', + id: "cesium-ion", + name: "Cesium Ion", preload: kp, parse: async (e, t, n) => (t = { ...t - }, t['3d-tiles'] = t['cesium-ion'], t.loader = bc, Le.parse(e, t, n)), + }, t["3d-tiles"] = t["cesium-ion"], t.loader = bc, Le.parse(e, t, n)), options: { - 'cesium-ion': { - ...Le.options['3d-tiles'], + "cesium-ion": { + ...Le.options["3d-tiles"], accessToken: null } } -}; const mo = 100; +}, mo = 100; class Kp { - constructor (t, n) { + constructor(t, n) { if (this.schema = void 0, this.options = void 0, this.shape = void 0, this.length = 0, this.rows = null, this.cursor = 0, this._headers = [], this.options = n, this.schema = t, !Array.isArray(t)) { this._headers = []; - for (const s in t) { this._headers[t[s].index] = t[s].name; } + for (const s in t) + this._headers[t[s].index] = t[s].name; } } - - rowCount () { + rowCount() { return this.length; } - - addArrayRow (t, n) { - Number.isFinite(n) && (this.cursor = n), this.shape = 'array-row-table', this.rows = this.rows || new Array(mo), this.rows[this.length] = t, this.length++; + addArrayRow(t, n) { + Number.isFinite(n) && (this.cursor = n), this.shape = "array-row-table", this.rows = this.rows || new Array(mo), this.rows[this.length] = t, this.length++; } - - addObjectRow (t, n) { - Number.isFinite(n) && (this.cursor = n), this.shape = 'object-row-table', this.rows = this.rows || new Array(mo), this.rows[this.length] = t, this.length++; + addObjectRow(t, n) { + Number.isFinite(n) && (this.cursor = n), this.shape = "object-row-table", this.rows = this.rows || new Array(mo), this.rows[this.length] = t, this.length++; } - - getBatch () { + getBatch() { let t = this.rows; - return t - ? (t = t.slice(0, this.length), this.rows = null, { - shape: this.shape || 'array-row-table', - batchType: 'data', - data: t, - length: this.length, - schema: this.schema, - cursor: this.cursor - }) - : null; - } -} -function zp (e, t) { - if (!e) { throw new Error('null row'); } + return t ? (t = t.slice(0, this.length), this.rows = null, { + shape: this.shape || "array-row-table", + batchType: "data", + data: t, + length: this.length, + schema: this.schema, + cursor: this.cursor + }) : null; + } +} +function zp(e, t) { + if (!e) + throw new Error("null row"); const n = {}; - if (t) { - for (let s = 0; s < t.length; s++) { n[t[s]] = e[s]; } - } else { + if (t) + for (let s = 0; s < t.length; s++) + n[t[s]] = e[s]; + else for (let s = 0; s < e.length; s++) { const r = `column-${s}`; n[r] = e[s]; } - } return n; } -function Wp (e, t) { - if (!e) { throw new Error('null row'); } +function Wp(e, t) { + if (!e) + throw new Error("null row"); if (t) { const n = new Array(t.length); - for (let s = 0; s < t.length; s++) { n[s] = e[t[s]]; } + for (let s = 0; s < t.length; s++) + n[s] = e[t[s]]; return n; } return Object.values(e); } -function Xp (e) { +function Xp(e) { const t = []; for (let n = 0; n < e.length; n++) { const s = `column-${n}`; @@ -9410,198 +9184,184 @@ function Xp (e) { } return t; } -function Qp (e) { +function Qp(e) { return Object.keys(e); } const go = 100; class qp { - constructor (t, n) { + constructor(t, n) { if (this.schema = void 0, this.options = void 0, this.length = 0, this.objectRows = null, this.arrayRows = null, this.cursor = 0, this._headers = null, this.options = n, this.schema = t, t) { this._headers = []; - for (const s in t) { this._headers[t[s].index] = t[s].name; } + for (const s in t) + this._headers[t[s].index] = t[s].name; } } - - rowCount () { + rowCount() { return this.length; } - - addArrayRow (t, n) { + addArrayRow(t, n) { switch (Number.isFinite(n) && (this.cursor = n), this._headers || (this._headers = Xp(t)), this.options.shape) { - case 'object-row-table': + case "object-row-table": const s = zp(t, this._headers); this.addObjectRow(s, n); break; - case 'array-row-table': + case "array-row-table": this.arrayRows = this.arrayRows || new Array(go), this.arrayRows[this.length] = t, this.length++; break; } } - - addObjectRow (t, n) { + addObjectRow(t, n) { switch (Number.isFinite(n) && (this.cursor = n), this._headers || (this._headers = Qp(t)), this.options.shape) { - case 'array-row-table': + case "array-row-table": const s = Wp(t, this._headers); this.addArrayRow(s, n); break; - case 'object-row-table': + case "object-row-table": this.objectRows = this.objectRows || new Array(go), this.objectRows[this.length] = t, this.length++; break; } } - - getBatch () { + getBatch() { let t = this.arrayRows || this.objectRows; - return t - ? (t = t.slice(0, this.length), this.arrayRows = null, this.objectRows = null, { - shape: this.options.shape, - batchType: 'data', - data: t, - length: this.length, - schema: this.schema, - cursor: this.cursor - }) - : null; + return t ? (t = t.slice(0, this.length), this.arrayRows = null, this.objectRows = null, { + shape: this.options.shape, + batchType: "data", + data: t, + length: this.length, + schema: this.schema, + cursor: this.cursor + }) : null; } } const Yp = 100; class $p { - constructor (t, n) { + constructor(t, n) { this.schema = void 0, this.length = 0, this.allocated = 0, this.columns = {}, this.schema = t, this._reallocateColumns(); } - - rowCount () { + rowCount() { return this.length; } - - addArrayRow (t) { + addArrayRow(t) { this._reallocateColumns(); let n = 0; - for (const s in this.columns) { this.columns[s][this.length] = t[n++]; } + for (const s in this.columns) + this.columns[s][this.length] = t[n++]; this.length++; } - - addObjectRow (t) { + addObjectRow(t) { this._reallocateColumns(); - for (const n in t) { this.columns[n][this.length] = t[n]; } + for (const n in t) + this.columns[n][this.length] = t[n]; this.length++; } - - getBatch () { + getBatch() { this._pruneColumns(); const t = Array.isArray(this.schema) ? this.columns : {}; - if (!Array.isArray(this.schema)) { + if (!Array.isArray(this.schema)) for (const s in this.schema) { const r = this.schema[s]; t[r.name] = this.columns[r.index]; } - } return this.columns = {}, { - shape: 'columnar-table', - batchType: 'data', + shape: "columnar-table", + batchType: "data", data: t, schema: this.schema, length: this.length }; } - - _reallocateColumns () { + _reallocateColumns() { if (!(this.length < this.allocated)) { this.allocated = this.allocated > 0 ? this.allocated *= 2 : Yp, this.columns = {}; for (const t in this.schema) { - const n = this.schema[t]; const s = n.type || Float32Array; const r = this.columns[n.index]; + const n = this.schema[t], s = n.type || Float32Array, r = this.columns[n.index]; if (r && ArrayBuffer.isView(r)) { const i = new s(this.allocated); i.set(r), this.columns[n.index] = i; - } else { r ? (r.length = this.allocated, this.columns[n.index] = r) : this.columns[n.index] = new s(this.allocated); } + } else + r ? (r.length = this.allocated, this.columns[n.index] = r) : this.columns[n.index] = new s(this.allocated); } } } - - _pruneColumns () { - for (const [t, n] of Object.entries(this.columns)) { this.columns[t] = n.slice(0, this.length); } + _pruneColumns() { + for (const [t, n] of Object.entries(this.columns)) + this.columns[t] = n.slice(0, this.length); } } const Zp = { shape: void 0, - batchSize: 'auto', + batchSize: "auto", batchDebounceMs: 0, limit: 0, _limitMB: 0 -}; const ty = 'TableBatchBuilder'; +}, ty = "TableBatchBuilder"; class He { - constructor (t, n) { + constructor(t, n) { this.schema = void 0, this.options = void 0, this.aggregator = null, this.batchCount = 0, this.bytesUsed = 0, this.isChunkComplete = !1, this.lastBatchEmittedMs = Date.now(), this.totalLength = 0, this.totalBytes = 0, this.rowBytes = 0, this.schema = t, this.options = { ...Zp, ...n }; } - - limitReached () { - let t, n; + limitReached() { + var t, n; return !!(!((t = this.options) === null || t === void 0) && t.limit && this.totalLength >= this.options.limit || !((n = this.options) === null || n === void 0) && n._limitMB && this.totalBytes / 1e6 >= this.options._limitMB); } - - addRow (t) { + addRow(t) { this.limitReached() || (this.totalLength++, this.rowBytes = this.rowBytes || this._estimateRowMB(t), this.totalBytes += this.rowBytes, Array.isArray(t) ? this.addArrayRow(t) : this.addObjectRow(t)); } - - addArrayRow (t) { + addArrayRow(t) { if (!this.aggregator) { const n = this._getTableBatchType(); this.aggregator = new n(this.schema, this.options); } this.aggregator.addArrayRow(t); } - - addObjectRow (t) { + addObjectRow(t) { if (!this.aggregator) { const n = this._getTableBatchType(); this.aggregator = new n(this.schema, this.options); } this.aggregator.addObjectRow(t); } - - chunkComplete (t) { - t instanceof ArrayBuffer && (this.bytesUsed += t.byteLength), typeof t === 'string' && (this.bytesUsed += t.length), this.isChunkComplete = !0; + chunkComplete(t) { + t instanceof ArrayBuffer && (this.bytesUsed += t.byteLength), typeof t == "string" && (this.bytesUsed += t.length), this.isChunkComplete = !0; } - - getFullBatch (t) { + getFullBatch(t) { return this._isFull() ? this._getBatch(t) : null; } - - getFinalBatch (t) { + getFinalBatch(t) { return this._getBatch(t); } - - _estimateRowMB (t) { + _estimateRowMB(t) { return Array.isArray(t) ? t.length * 8 : Object.keys(t).length * 8; } - - _isFull () { - if (!this.aggregator || this.aggregator.rowCount() === 0) { return !1; } - if (this.options.batchSize === 'auto') { - if (!this.isChunkComplete) { return !1; } - } else if (this.options.batchSize > this.aggregator.rowCount()) { return !1; } + _isFull() { + if (!this.aggregator || this.aggregator.rowCount() === 0) + return !1; + if (this.options.batchSize === "auto") { + if (!this.isChunkComplete) + return !1; + } else if (this.options.batchSize > this.aggregator.rowCount()) + return !1; return this.options.batchDebounceMs > Date.now() - this.lastBatchEmittedMs ? !1 : (this.isChunkComplete = !1, this.lastBatchEmittedMs = Date.now(), !0); } - - _getBatch (t) { - if (!this.aggregator) { return null; } + _getBatch(t) { + if (!this.aggregator) + return null; t != null && t.bytesUsed && (this.bytesUsed = t.bytesUsed); const n = this.aggregator.getBatch(); return n.count = this.batchCount, n.bytesUsed = this.bytesUsed, Object.assign(n, t), this.batchCount++, this.aggregator = null, n; } - - _getTableBatchType () { + _getTableBatchType() { switch (this.options.shape) { - case 'array-row-table': - case 'object-row-table': + case "array-row-table": + case "object-row-table": return qp; - case 'columnar-table': + case "columnar-table": return $p; - case 'arrow-table': - if (!He.ArrowBatch) { throw new Error(ty); } + case "arrow-table": + if (!He.ArrowBatch) + throw new Error(ty); return He.ArrowBatch; default: return Kp; @@ -9609,27 +9369,24 @@ class He { } } He.ArrowBatch = void 0; -function ey (e) { +function ey(e) { try { - const t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; - return (async function * () { + let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; + return async function* () { const n = new TextDecoder(void 0, t); - for await (const s of e) { - yield typeof s === 'string' - ? s - : n.decode(s, { - stream: !0 - }); - } - }()); + for await (const s of e) + yield typeof s == "string" ? s : n.decode(s, { + stream: !0 + }); + }(); } catch (t) { return Promise.reject(t); } } const sr = Number.MAX_SAFE_INTEGER; -var S = (function (e) { - return e[e.BEGIN = 0] = 'BEGIN', e[e.VALUE = 1] = 'VALUE', e[e.OPEN_OBJECT = 2] = 'OPEN_OBJECT', e[e.CLOSE_OBJECT = 3] = 'CLOSE_OBJECT', e[e.OPEN_ARRAY = 4] = 'OPEN_ARRAY', e[e.CLOSE_ARRAY = 5] = 'CLOSE_ARRAY', e[e.TEXT_ESCAPE = 6] = 'TEXT_ESCAPE', e[e.STRING = 7] = 'STRING', e[e.BACKSLASH = 8] = 'BACKSLASH', e[e.END = 9] = 'END', e[e.OPEN_KEY = 10] = 'OPEN_KEY', e[e.CLOSE_KEY = 11] = 'CLOSE_KEY', e[e.TRUE = 12] = 'TRUE', e[e.TRUE2 = 13] = 'TRUE2', e[e.TRUE3 = 14] = 'TRUE3', e[e.FALSE = 15] = 'FALSE', e[e.FALSE2 = 16] = 'FALSE2', e[e.FALSE3 = 17] = 'FALSE3', e[e.FALSE4 = 18] = 'FALSE4', e[e.NULL = 19] = 'NULL', e[e.NULL2 = 20] = 'NULL2', e[e.NULL3 = 21] = 'NULL3', e[e.NUMBER_DECIMAL_POINT = 22] = 'NUMBER_DECIMAL_POINT', e[e.NUMBER_DIGIT = 23] = 'NUMBER_DIGIT', e; -}(S || {})); +var S = function(e) { + return e[e.BEGIN = 0] = "BEGIN", e[e.VALUE = 1] = "VALUE", e[e.OPEN_OBJECT = 2] = "OPEN_OBJECT", e[e.CLOSE_OBJECT = 3] = "CLOSE_OBJECT", e[e.OPEN_ARRAY = 4] = "OPEN_ARRAY", e[e.CLOSE_ARRAY = 5] = "CLOSE_ARRAY", e[e.TEXT_ESCAPE = 6] = "TEXT_ESCAPE", e[e.STRING = 7] = "STRING", e[e.BACKSLASH = 8] = "BACKSLASH", e[e.END = 9] = "END", e[e.OPEN_KEY = 10] = "OPEN_KEY", e[e.CLOSE_KEY = 11] = "CLOSE_KEY", e[e.TRUE = 12] = "TRUE", e[e.TRUE2 = 13] = "TRUE2", e[e.TRUE3 = 14] = "TRUE3", e[e.FALSE = 15] = "FALSE", e[e.FALSE2 = 16] = "FALSE2", e[e.FALSE3 = 17] = "FALSE3", e[e.FALSE4 = 18] = "FALSE4", e[e.NULL = 19] = "NULL", e[e.NULL2 = 20] = "NULL2", e[e.NULL3 = 21] = "NULL3", e[e.NUMBER_DECIMAL_POINT = 22] = "NUMBER_DECIMAL_POINT", e[e.NUMBER_DIGIT = 23] = "NUMBER_DIGIT", e; +}(S || {}); const I = { tab: 9, lineFeed: 10, @@ -9659,7 +9416,7 @@ const I = { u: 117, openBrace: 123, closeBrace: 125 -}; const Ao = /[\\"\n]/g; const po = { +}, Ao = /[\\"\n]/g, po = { onready: () => { }, onopenobject: () => { @@ -9682,107 +9439,115 @@ const I = { } }; class ny { - constructor () { - const t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; - this.options = po, this.bufferCheckPosition = sr, this.q = '', this.c = '', this.p = '', this.closed = !1, this.closedRoot = !1, this.sawRoot = !1, this.error = null, this.state = S.BEGIN, this.stack = [], this.position = 0, this.column = 0, this.line = 1, this.slashed = !1, this.unicodeI = 0, this.unicodeS = null, this.depth = 0, this.textNode = void 0, this.numberNode = void 0, this.options = { + constructor() { + let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; + this.options = po, this.bufferCheckPosition = sr, this.q = "", this.c = "", this.p = "", this.closed = !1, this.closedRoot = !1, this.sawRoot = !1, this.error = null, this.state = S.BEGIN, this.stack = [], this.position = 0, this.column = 0, this.line = 1, this.slashed = !1, this.unicodeI = 0, this.unicodeS = null, this.depth = 0, this.textNode = void 0, this.numberNode = void 0, this.options = { ...po, ...t - }, this.textNode = void 0, this.numberNode = '', this.emit('onready'); + }, this.textNode = void 0, this.numberNode = "", this.emit("onready"); } - - end () { - return (this.state !== S.VALUE || this.depth !== 0) && this._error('Unexpected end'), this._closeValue(), this.c = '', this.closed = !0, this.emit('onend'), this; + end() { + return (this.state !== S.VALUE || this.depth !== 0) && this._error("Unexpected end"), this._closeValue(), this.c = "", this.closed = !0, this.emit("onend"), this; } - - resume () { + resume() { return this.error = null, this; } - - close () { + close() { return this.write(null); } - - emit (t, n) { - let s, r; + emit(t, n) { + var s, r; (s = (r = this.options)[t]) === null || s === void 0 || s.call(r, n, this); } - - emitNode (t, n) { + emitNode(t, n) { this._closeValue(), this.emit(t, n); } - - write (t) { - if (this.error) { throw this.error; } - if (this.closed) { return this._error('Cannot write after close. Assign an onready handler.'); } - if (t === null) { return this.end(); } - let n = 0; let s = t.charCodeAt(0); let r = this.p; - for (; s && (r = s, this.c = s = t.charCodeAt(n++), r !== s ? this.p = r : r = this.p, !!s);) { + write(t) { + if (this.error) + throw this.error; + if (this.closed) + return this._error("Cannot write after close. Assign an onready handler."); + if (t === null) + return this.end(); + let n = 0, s = t.charCodeAt(0), r = this.p; + for (; s && (r = s, this.c = s = t.charCodeAt(n++), r !== s ? this.p = r : r = this.p, !!s); ) switch (this.position++, s === I.lineFeed ? (this.line++, this.column = 0) : this.column++, this.state) { case S.BEGIN: - s === I.openBrace ? this.state = S.OPEN_OBJECT : s === I.openBracket ? this.state = S.OPEN_ARRAY : Se(s) || this._error('Non-whitespace before {[.'); + s === I.openBrace ? this.state = S.OPEN_OBJECT : s === I.openBracket ? this.state = S.OPEN_ARRAY : Se(s) || this._error("Non-whitespace before {[."); continue; case S.OPEN_KEY: case S.OPEN_OBJECT: - if (Se(s)) { continue; } - if (this.state === S.OPEN_KEY) { this.stack.push(S.CLOSE_KEY); } else if (s === I.closeBrace) { - this.emit('onopenobject'), this.depth++, this.emit('oncloseobject'), this.depth--, this.state = this.stack.pop() || S.VALUE; + if (Se(s)) + continue; + if (this.state === S.OPEN_KEY) + this.stack.push(S.CLOSE_KEY); + else if (s === I.closeBrace) { + this.emit("onopenobject"), this.depth++, this.emit("oncloseobject"), this.depth--, this.state = this.stack.pop() || S.VALUE; continue; - } else { this.stack.push(S.CLOSE_OBJECT); } + } else + this.stack.push(S.CLOSE_OBJECT); s === I.doubleQuote ? this.state = S.STRING : this._error('Malformed object key should start with "'); continue; case S.CLOSE_KEY: case S.CLOSE_OBJECT: - if (Se(s)) { continue; } - s === I.colon ? (this.state === S.CLOSE_OBJECT ? (this.stack.push(S.CLOSE_OBJECT), this._closeValue('onopenobject'), this.depth++) : this._closeValue('onkey'), this.state = S.VALUE) : s === I.closeBrace ? (this.emitNode('oncloseobject'), this.depth--, this.state = this.stack.pop() || S.VALUE) : s === I.comma ? (this.state === S.CLOSE_OBJECT && this.stack.push(S.CLOSE_OBJECT), this._closeValue(), this.state = S.OPEN_KEY) : this._error('Bad object'); + if (Se(s)) + continue; + s === I.colon ? (this.state === S.CLOSE_OBJECT ? (this.stack.push(S.CLOSE_OBJECT), this._closeValue("onopenobject"), this.depth++) : this._closeValue("onkey"), this.state = S.VALUE) : s === I.closeBrace ? (this.emitNode("oncloseobject"), this.depth--, this.state = this.stack.pop() || S.VALUE) : s === I.comma ? (this.state === S.CLOSE_OBJECT && this.stack.push(S.CLOSE_OBJECT), this._closeValue(), this.state = S.OPEN_KEY) : this._error("Bad object"); continue; case S.OPEN_ARRAY: case S.VALUE: - if (Se(s)) { continue; } - if (this.state === S.OPEN_ARRAY) { - if (this.emit('onopenarray'), this.depth++, this.state = S.VALUE, s === I.closeBracket) { - this.emit('onclosearray'), this.depth--, this.state = this.stack.pop() || S.VALUE; + if (Se(s)) + continue; + if (this.state === S.OPEN_ARRAY) + if (this.emit("onopenarray"), this.depth++, this.state = S.VALUE, s === I.closeBracket) { + this.emit("onclosearray"), this.depth--, this.state = this.stack.pop() || S.VALUE; continue; - } else { this.stack.push(S.CLOSE_ARRAY); } - } - s === I.doubleQuote ? this.state = S.STRING : s === I.openBrace ? this.state = S.OPEN_OBJECT : s === I.openBracket ? this.state = S.OPEN_ARRAY : s === I.t ? this.state = S.TRUE : s === I.f ? this.state = S.FALSE : s === I.n ? this.state = S.NULL : s === I.minus ? this.numberNode += '-' : I._0 <= s && s <= I._9 ? (this.numberNode += String.fromCharCode(s), this.state = S.NUMBER_DIGIT) : this._error('Bad value'); + } else + this.stack.push(S.CLOSE_ARRAY); + s === I.doubleQuote ? this.state = S.STRING : s === I.openBrace ? this.state = S.OPEN_OBJECT : s === I.openBracket ? this.state = S.OPEN_ARRAY : s === I.t ? this.state = S.TRUE : s === I.f ? this.state = S.FALSE : s === I.n ? this.state = S.NULL : s === I.minus ? this.numberNode += "-" : I._0 <= s && s <= I._9 ? (this.numberNode += String.fromCharCode(s), this.state = S.NUMBER_DIGIT) : this._error("Bad value"); continue; case S.CLOSE_ARRAY: - if (s === I.comma) { this.stack.push(S.CLOSE_ARRAY), this._closeValue('onvalue'), this.state = S.VALUE; } else if (s === I.closeBracket) { this.emitNode('onclosearray'), this.depth--, this.state = this.stack.pop() || S.VALUE; } else { - if (Se(s)) { continue; } - this._error('Bad array'); + if (s === I.comma) + this.stack.push(S.CLOSE_ARRAY), this._closeValue("onvalue"), this.state = S.VALUE; + else if (s === I.closeBracket) + this.emitNode("onclosearray"), this.depth--, this.state = this.stack.pop() || S.VALUE; + else { + if (Se(s)) + continue; + this._error("Bad array"); } continue; case S.STRING: - this.textNode === void 0 && (this.textNode = ''); - let i = n - 1; let o = this.slashed; let a = this.unicodeI; + this.textNode === void 0 && (this.textNode = ""); + let i = n - 1, o = this.slashed, a = this.unicodeI; t: - for (; ;) { - for (; a > 0;) { - if (this.unicodeS += String.fromCharCode(s), s = t.charCodeAt(n++), this.position++, a === 4 ? (this.textNode += String.fromCharCode(parseInt(this.unicodeS, 16)), a = 0, i = n - 1) : a++, !s) { break t; } - } - if (s === I.doubleQuote && !o) { - this.state = this.stack.pop() || S.VALUE, this.textNode += t.substring(i, n - 1), this.position += n - 1 - i; - break; - } - if (s === I.backslash && !o && (o = !0, this.textNode += t.substring(i, n - 1), this.position += n - 1 - i, s = t.charCodeAt(n++), this.position++, !s)) { break; } - if (o) { - if (o = !1, s === I.n - ? this.textNode += ` -` - : s === I.r ? this.textNode += '\r' : s === I.t ? this.textNode += ' ' : s === I.f ? this.textNode += '\f' : s === I.b ? this.textNode += '\b' : s === I.u ? (a = 1, this.unicodeS = '') : this.textNode += String.fromCharCode(s), s = t.charCodeAt(n++), this.position++, i = n - 1, s) { continue; } - break; - } - Ao.lastIndex = n; - const c = Ao.exec(t); - if (c === null) { - n = t.length + 1, this.textNode += t.substring(i, n - 1), this.position += n - 1 - i; - break; - } - if (n = c.index + 1, s = t.charCodeAt(c.index), !s) { - this.textNode += t.substring(i, n - 1), this.position += n - 1 - i; - break; + for (; ; ) { + for (; a > 0; ) + if (this.unicodeS += String.fromCharCode(s), s = t.charCodeAt(n++), this.position++, a === 4 ? (this.textNode += String.fromCharCode(parseInt(this.unicodeS, 16)), a = 0, i = n - 1) : a++, !s) + break t; + if (s === I.doubleQuote && !o) { + this.state = this.stack.pop() || S.VALUE, this.textNode += t.substring(i, n - 1), this.position += n - 1 - i; + break; + } + if (s === I.backslash && !o && (o = !0, this.textNode += t.substring(i, n - 1), this.position += n - 1 - i, s = t.charCodeAt(n++), this.position++, !s)) + break; + if (o) { + if (o = !1, s === I.n ? this.textNode += ` +` : s === I.r ? this.textNode += "\r" : s === I.t ? this.textNode += " " : s === I.f ? this.textNode += "\f" : s === I.b ? this.textNode += "\b" : s === I.u ? (a = 1, this.unicodeS = "") : this.textNode += String.fromCharCode(s), s = t.charCodeAt(n++), this.position++, i = n - 1, s) + continue; + break; + } + Ao.lastIndex = n; + const c = Ao.exec(t); + if (c === null) { + n = t.length + 1, this.textNode += t.substring(i, n - 1), this.position += n - 1 - i; + break; + } + if (n = c.index + 1, s = t.charCodeAt(c.index), !s) { + this.textNode += t.substring(i, n - 1), this.position += n - 1 - i; + break; + } } - } this.slashed = o, this.unicodeI = a; continue; case S.TRUE: @@ -9792,7 +9557,7 @@ class ny { s === I.u ? this.state = S.TRUE3 : this._error(`Invalid true started with tr${s}`); continue; case S.TRUE3: - s === I.e ? (this.emit('onvalue', !0), this.state = this.stack.pop() || S.VALUE) : this._error(`Invalid true started with tru${s}`); + s === I.e ? (this.emit("onvalue", !0), this.state = this.stack.pop() || S.VALUE) : this._error(`Invalid true started with tru${s}`); continue; case S.FALSE: s === I.a ? this.state = S.FALSE2 : this._error(`Invalid false started with f${s}`); @@ -9804,7 +9569,7 @@ class ny { s === I.s ? this.state = S.FALSE4 : this._error(`Invalid false started with fal${s}`); continue; case S.FALSE4: - s === I.e ? (this.emit('onvalue', !1), this.state = this.stack.pop() || S.VALUE) : this._error(`Invalid false started with fals${s}`); + s === I.e ? (this.emit("onvalue", !1), this.state = this.stack.pop() || S.VALUE) : this._error(`Invalid false started with fals${s}`); continue; case S.NULL: s === I.u ? this.state = S.NULL2 : this._error(`Invalid null started with n${s}`); @@ -9813,64 +9578,59 @@ class ny { s === I.l ? this.state = S.NULL3 : this._error(`Invalid null started with nu${s}`); continue; case S.NULL3: - s === I.l ? (this.emit('onvalue', null), this.state = this.stack.pop() || S.VALUE) : this._error(`Invalid null started with nul${s}`); + s === I.l ? (this.emit("onvalue", null), this.state = this.stack.pop() || S.VALUE) : this._error(`Invalid null started with nul${s}`); continue; case S.NUMBER_DECIMAL_POINT: - s === I.period ? (this.numberNode += '.', this.state = S.NUMBER_DIGIT) : this._error('Leading zero not followed by .'); + s === I.period ? (this.numberNode += ".", this.state = S.NUMBER_DIGIT) : this._error("Leading zero not followed by ."); continue; case S.NUMBER_DIGIT: - I._0 <= s && s <= I._9 ? this.numberNode += String.fromCharCode(s) : s === I.period ? (this.numberNode.indexOf('.') !== -1 && this._error('Invalid number has two dots'), this.numberNode += '.') : s === I.e || s === I.E ? ((this.numberNode.indexOf('e') !== -1 || this.numberNode.indexOf('E') !== -1) && this._error('Invalid number has two exponential'), this.numberNode += 'e') : s === I.plus || s === I.minus ? (r === I.e || r === I.E || this._error('Invalid symbol in number'), this.numberNode += String.fromCharCode(s)) : (this._closeNumber(), n--, this.state = this.stack.pop() || S.VALUE); + I._0 <= s && s <= I._9 ? this.numberNode += String.fromCharCode(s) : s === I.period ? (this.numberNode.indexOf(".") !== -1 && this._error("Invalid number has two dots"), this.numberNode += ".") : s === I.e || s === I.E ? ((this.numberNode.indexOf("e") !== -1 || this.numberNode.indexOf("E") !== -1) && this._error("Invalid number has two exponential"), this.numberNode += "e") : s === I.plus || s === I.minus ? (r === I.e || r === I.E || this._error("Invalid symbol in number"), this.numberNode += String.fromCharCode(s)) : (this._closeNumber(), n--, this.state = this.stack.pop() || S.VALUE); continue; default: this._error(`Unknown state: ${this.state}`); } - } - return this.position >= this.bufferCheckPosition && sy(this), this.emit('onchunkparsed'), this; + return this.position >= this.bufferCheckPosition && sy(this), this.emit("onchunkparsed"), this; } - - _closeValue () { - const t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 'onvalue'; + _closeValue() { + let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "onvalue"; this.textNode !== void 0 && this.emit(t, this.textNode), this.textNode = void 0; } - - _closeNumber () { - this.numberNode && this.emit('onvalue', parseFloat(this.numberNode)), this.numberNode = ''; + _closeNumber() { + this.numberNode && this.emit("onvalue", parseFloat(this.numberNode)), this.numberNode = ""; } - - _error () { - let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : ''; + _error() { + let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : ""; this._closeValue(), t += ` Line: ${this.line} Column: ${this.column} Char: ${this.c}`; const n = new Error(t); - this.error = n, this.emit('onerror', n); + this.error = n, this.emit("onerror", n); } } -function Se (e) { +function Se(e) { return e === I.carriageReturn || e === I.lineFeed || e === I.space || e === I.tab; } -function sy (e) { +function sy(e) { const t = Math.max(sr, 10); let n = 0; - for (const s of ['textNode', 'numberNode']) { + for (const s of ["textNode", "numberNode"]) { const r = e[s] === void 0 ? 0 : e[s].length; - if (r > t) { + if (r > t) switch (s) { - case 'text': + case "text": break; default: e._error(`Max buffer length exceeded: ${s}`); } - } n = Math.max(n, r); } e.bufferCheckPosition = sr - n + e.position; } class te { - constructor () { - const t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : null; - if (this.path = void 0, this.path = ['$'], t instanceof te) { + constructor() { + let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : null; + if (this.path = void 0, this.path = ["$"], t instanceof te) { this.path = [...t.path]; return; } @@ -9878,55 +9638,51 @@ class te { this.path.push(...t); return; } - if (typeof t === 'string' && (this.path = t.split('.'), this.path[0] !== '$')) { throw new Error('JSONPaths must start with $'); } + if (typeof t == "string" && (this.path = t.split("."), this.path[0] !== "$")) + throw new Error("JSONPaths must start with $"); } - - clone () { + clone() { return new te(this); } - - toString () { - return this.path.join('.'); + toString() { + return this.path.join("."); } - - push (t) { + push(t) { this.path.push(t); } - - pop () { + pop() { return this.path.pop(); } - - set (t) { + set(t) { this.path[this.path.length - 1] = t; } - - equals (t) { - if (!this || !t || this.path.length !== t.path.length) { return !1; } - for (let n = 0; n < this.path.length; ++n) { - if (this.path[n] !== t.path[n]) { return !1; } - } + equals(t) { + if (!this || !t || this.path.length !== t.path.length) + return !1; + for (let n = 0; n < this.path.length; ++n) + if (this.path[n] !== t.path[n]) + return !1; return !0; } - - setFieldAtPath (t, n) { + setFieldAtPath(t, n) { const s = [...this.path]; s.shift(); const r = s.pop(); - for (const i of s) { t = t[i]; } + for (const i of s) + t = t[i]; t[r] = n; } - - getFieldAtPath (t) { + getFieldAtPath(t) { const n = [...this.path]; n.shift(); const s = n.pop(); - for (const r of n) { t = t[r]; } + for (const r of n) + t = t[r]; return t[s]; } } class ry { - constructor (t) { + constructor(t) { this.parser = void 0, this.result = void 0, this.previousStates = [], this.currentState = Object.freeze({ container: [], key: null @@ -9935,7 +9691,7 @@ class ry { this.jsonpath = new te(), this.previousStates.length = 0, this.currentState.container.length = 0; }, onopenobject: (n) => { - this._openObject({}), typeof n < 'u' && this.parser.emit('onkey', n); + this._openObject({}), typeof n < "u" && this.parser.emit("onkey", n); }, onkey: (n) => { this.jsonpath.set(n), this.currentState.key = n; @@ -9961,59 +9717,51 @@ class ry { ...t }); } - - reset () { + reset() { this.result = void 0, this.previousStates = [], this.currentState = Object.freeze({ container: [], key: null }), this.jsonpath = new te(); } - - write (t) { + write(t) { this.parser.write(t); } - - close () { + close() { this.parser.close(); } - - _pushOrSet (t) { + _pushOrSet(t) { const { container: n, key: s } = this.currentState; s !== null ? (n[s] = t, this.currentState.key = null) : n.push(t); } - - _openArray () { - const t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : []; + _openArray() { + let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : []; this.jsonpath.push(null), this._pushOrSet(t), this.previousStates.push(this.currentState), this.currentState = { container: t, isArray: !0, key: null }; } - - _closeArray () { + _closeArray() { this.jsonpath.pop(), this.currentState = this.previousStates.pop(); } - - _openObject () { - const t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; + _openObject() { + let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; this.jsonpath.push(null), this._pushOrSet(t), this.previousStates.push(this.currentState), this.currentState = { container: t, isArray: !1, key: null }; } - - _closeObject () { + _closeObject() { this.jsonpath.pop(), this.currentState = this.previousStates.pop(); } } class iy extends ry { - constructor () { - const t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; + constructor() { + let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; super({ onopenarray: () => { if (!this.streamingArray && this._matchJSONPath()) { @@ -10023,62 +9771,57 @@ class iy extends ry { this._openArray(); }, onopenobject: (s) => { - this.topLevelObject ? this._openObject({}) : (this.topLevelObject = {}, this._openObject(this.topLevelObject)), typeof s < 'u' && this.parser.emit('onkey', s); + this.topLevelObject ? this._openObject({}) : (this.topLevelObject = {}, this._openObject(this.topLevelObject)), typeof s < "u" && this.parser.emit("onkey", s); } }), this.jsonPaths = void 0, this.streamingJsonPath = null, this.streamingArray = null, this.topLevelObject = null; const n = t.jsonpaths || []; this.jsonPaths = n.map((s) => new te(s)); } - - write (t) { + write(t) { super.write(t); let n = []; return this.streamingArray && (n = [...this.streamingArray], this.streamingArray.length = 0), n; } - - getPartialResult () { + getPartialResult() { return this.topLevelObject; } - - getStreamingJsonPath () { + getStreamingJsonPath() { return this.streamingJsonPath; } - - getStreamingJsonPathAsString () { + getStreamingJsonPathAsString() { return this.streamingJsonPath && this.streamingJsonPath.toString(); } - - getJsonPath () { + getJsonPath() { return this.jsonpath; } - - _matchJSONPath () { + _matchJSONPath() { const t = this.getJsonPath(); - if (this.jsonPaths.length === 0) { return !0; } - for (const n of this.jsonPaths) { - if (n.equals(t)) { return !0; } - } + if (this.jsonPaths.length === 0) + return !0; + for (const n of this.jsonPaths) + if (n.equals(t)) + return !0; return !1; } } -async function * oy (e, t) { - const n = ey(e); const { +async function* oy(e, t) { + const n = ey(e), { metadata: s - } = t; const { + } = t, { jsonpaths: r } = t.json || {}; let i = !0; - const o = null; const a = new He(o, t); const c = new iy({ + const o = null, a = new He(o, t), c = new iy({ jsonpaths: r }); for await (const f of n) { - const d = c.write(f); const m = d.length > 0 && c.getStreamingJsonPathAsString(); + const d = c.write(f), m = d.length > 0 && c.getStreamingJsonPathAsString(); if (d.length > 0 && i) { if (s) { var u; yield { - shape: (t == null || (u = t.json) === null || u === void 0 ? void 0 : u.shape) || 'array-row-table', - batchType: 'partial-result', + shape: (t == null || (u = t.json) === null || u === void 0 ? void 0 : u.shape) || "array-row-table", + batchType: "partial-result", data: [], length: 0, bytesUsed: 0, @@ -10101,12 +9844,12 @@ async function * oy (e, t) { }); g && (yield g); } - const l = c.getStreamingJsonPathAsString(); const h = a.getFinalBatch({ + const l = c.getStreamingJsonPathAsString(), h = a.getFinalBatch({ jsonpath: l }); h && (yield h), s && (yield { - shape: 'json', - batchType: 'final-result', + shape: "json", + batchType: "final-result", container: c.getPartialResult(), jsonpath: c.getStreamingJsonPathAsString(), data: [], @@ -10118,55 +9861,62 @@ const Hn = { y: 1, z: 2 }; -function _c (e, t = {}) { - const { start: n = 0, end: s = e.length, plane: r = 'xy' } = t; const i = t.size || 2; +function _c(e, t = {}) { + const { start: n = 0, end: s = e.length, plane: r = "xy" } = t, i = t.size || 2; let o = 0; - const a = Hn[r[0]]; const c = Hn[r[1]]; - for (let u = n, l = s - i; u < s; u += i) { o += (e[u + a] - e[l + a]) * (e[u + c] + e[l + c]), l = u; } + const a = Hn[r[0]], c = Hn[r[1]]; + for (let u = n, l = s - i; u < s; u += i) + o += (e[u + a] - e[l + a]) * (e[u + c] + e[l + c]), l = u; return o / 2; } -function ay (e, t, n = 2, s, r = 'xy') { - const i = t && t.length; const o = i ? t[0] * n : e.length; +function ay(e, t, n = 2, s, r = "xy") { + const i = t && t.length, o = i ? t[0] * n : e.length; let a = wc(e, 0, o, n, !0, s && s[0], r); const c = []; - if (!a || a.next === a.prev) { return c; } + if (!a || a.next === a.prev) + return c; let u, l, h, f, d, m, g; if (i && (a = fy(e, t, a, n, s, r)), e.length > 80 * n) { f = l = e[0], d = h = e[1]; - for (let y = n; y < o; y += n) { m = e[y], g = e[y + 1], m < f && (f = m), g < d && (d = g), m > l && (l = m), g > h && (h = g); } + for (let y = n; y < o; y += n) + m = e[y], g = e[y + 1], m < f && (f = m), g < d && (d = g), m > l && (l = m), g > h && (h = g); u = Math.max(l - f, h - d), u = u !== 0 ? 32767 / u : 0; } return Je(a, c, n, f, d, u, 0), c; } -function wc (e, t, n, s, r, i, o) { +function wc(e, t, n, s, r, i, o) { let a, c; i === void 0 && (i = _c(e, { start: t, end: n, size: s, plane: o })); - const u = Hn[o[0]]; const l = Hn[o[1]]; - if (r === i < 0) { - for (a = t; a < n; a += s) { c = yo(a, e[a + u], e[a + l], c); } - } else { - for (a = n - s; a >= t; a -= s) { c = yo(a, e[a + u], e[a + l], c); } - } + let u = Hn[o[0]], l = Hn[o[1]]; + if (r === i < 0) + for (a = t; a < n; a += s) + c = yo(a, e[a + u], e[a + l], c); + else + for (a = n - s; a >= t; a -= s) + c = yo(a, e[a + u], e[a + l], c); return c && Zn(c, c.next) && (je(c), c = c.next), c; } -function ne (e, t) { - if (!e) { return e; } +function ne(e, t) { + if (!e) + return e; t || (t = e); - let n = e; let s; - do { + let n = e, s; + do if (s = !1, !n.steiner && (Zn(n, n.next) || W(n.prev, n, n.next) === 0)) { - if (je(n), n = t = n.prev, n === n.next) { break; } + if (je(n), n = t = n.prev, n === n.next) + break; s = !0; - } else { n = n.next; } - } + } else + n = n.next; while (s || n !== t); return t; } -function Je (e, t, n, s, r, i, o) { - if (!e) { return; } +function Je(e, t, n, s, r, i, o) { + if (!e) + return; !o && i && py(e, s, r, i); - let a = e; let c; let u; - for (; e.prev !== e.next;) { + let a = e, c, u; + for (; e.prev !== e.next; ) { if (c = e.prev, u = e.next, i ? uy(e, s, r, i) : cy(e)) { t.push(c.i / n | 0), t.push(e.i / n | 0), t.push(u.i / n | 0), je(e), e = u.next, a = u.next; continue; @@ -10177,49 +9927,55 @@ function Je (e, t, n, s, r, i, o) { } } } -function cy (e) { - const t = e.prev; const n = e; const s = e.next; - if (W(t, n, s) >= 0) { return !1; } - const r = t.x; const i = n.x; const o = s.x; const a = t.y; const c = n.y; const u = s.y; const l = r < i ? r < o ? r : o : i < o ? i : o; const h = a < c ? a < u ? a : u : c < u ? c : u; const f = r > i ? r > o ? r : o : i > o ? i : o; const d = a > c ? a > u ? a : u : c > u ? c : u; +function cy(e) { + const t = e.prev, n = e, s = e.next; + if (W(t, n, s) >= 0) + return !1; + const r = t.x, i = n.x, o = s.x, a = t.y, c = n.y, u = s.y, l = r < i ? r < o ? r : o : i < o ? i : o, h = a < c ? a < u ? a : u : c < u ? c : u, f = r > i ? r > o ? r : o : i > o ? i : o, d = a > c ? a > u ? a : u : c > u ? c : u; let m = s.next; - for (; m !== t;) { - if (m.x >= l && m.x <= f && m.y >= h && m.y <= d && me(r, a, i, c, o, u, m.x, m.y) && W(m.prev, m, m.next) >= 0) { return !1; } + for (; m !== t; ) { + if (m.x >= l && m.x <= f && m.y >= h && m.y <= d && me(r, a, i, c, o, u, m.x, m.y) && W(m.prev, m, m.next) >= 0) + return !1; m = m.next; } return !0; } -function uy (e, t, n, s) { - const r = e.prev; const i = e; const o = e.next; - if (W(r, i, o) >= 0) { return !1; } - const a = r.x; const c = i.x; const u = o.x; const l = r.y; const h = i.y; const f = o.y; const d = a < c ? a < u ? a : u : c < u ? c : u; const m = l < h ? l < f ? l : f : h < f ? h : f; const g = a > c ? a > u ? a : u : c > u ? c : u; const y = l > h ? l > f ? l : f : h > f ? h : f; const E = rr(d, m, t, n, s); const R = rr(g, y, t, n, s); - let B = e.prevZ; let C = e.nextZ; - for (; B && B.z >= E && C && C.z <= R;) { - if (B.x >= d && B.x <= g && B.y >= m && B.y <= y && B !== r && B !== o && me(a, l, c, h, u, f, B.x, B.y) && W(B.prev, B, B.next) >= 0 || (B = B.prevZ, C.x >= d && C.x <= g && C.y >= m && C.y <= y && C !== r && C !== o && me(a, l, c, h, u, f, C.x, C.y) && W(C.prev, C, C.next) >= 0)) { return !1; } +function uy(e, t, n, s) { + const r = e.prev, i = e, o = e.next; + if (W(r, i, o) >= 0) + return !1; + const a = r.x, c = i.x, u = o.x, l = r.y, h = i.y, f = o.y, d = a < c ? a < u ? a : u : c < u ? c : u, m = l < h ? l < f ? l : f : h < f ? h : f, g = a > c ? a > u ? a : u : c > u ? c : u, y = l > h ? l > f ? l : f : h > f ? h : f, E = rr(d, m, t, n, s), R = rr(g, y, t, n, s); + let B = e.prevZ, C = e.nextZ; + for (; B && B.z >= E && C && C.z <= R; ) { + if (B.x >= d && B.x <= g && B.y >= m && B.y <= y && B !== r && B !== o && me(a, l, c, h, u, f, B.x, B.y) && W(B.prev, B, B.next) >= 0 || (B = B.prevZ, C.x >= d && C.x <= g && C.y >= m && C.y <= y && C !== r && C !== o && me(a, l, c, h, u, f, C.x, C.y) && W(C.prev, C, C.next) >= 0)) + return !1; C = C.nextZ; } - for (; B && B.z >= E;) { - if (B.x >= d && B.x <= g && B.y >= m && B.y <= y && B !== r && B !== o && me(a, l, c, h, u, f, B.x, B.y) && W(B.prev, B, B.next) >= 0) { return !1; } + for (; B && B.z >= E; ) { + if (B.x >= d && B.x <= g && B.y >= m && B.y <= y && B !== r && B !== o && me(a, l, c, h, u, f, B.x, B.y) && W(B.prev, B, B.next) >= 0) + return !1; B = B.prevZ; } - for (; C && C.z <= R;) { - if (C.x >= d && C.x <= g && C.y >= m && C.y <= y && C !== r && C !== o && me(a, l, c, h, u, f, C.x, C.y) && W(C.prev, C, C.next) >= 0) { return !1; } + for (; C && C.z <= R; ) { + if (C.x >= d && C.x <= g && C.y >= m && C.y <= y && C !== r && C !== o && me(a, l, c, h, u, f, C.x, C.y) && W(C.prev, C, C.next) >= 0) + return !1; C = C.nextZ; } return !0; } -function ly (e, t, n) { +function ly(e, t, n) { let s = e; do { - const r = s.prev; const i = s.next.next; + const r = s.prev, i = s.next.next; !Zn(r, i) && Rc(r, s, s.next, i) && Ve(r, i) && Ve(i, r) && (t.push(r.i / n | 0), t.push(s.i / n | 0), t.push(i.i / n | 0), je(s), je(s.next), s = e = i), s = s.next; } while (s !== e); return ne(s); } -function hy (e, t, n, s, r, i) { +function hy(e, t, n, s, r, i) { let o = e; do { let a = o.next.next; - for (; a !== o.prev;) { + for (; a !== o.prev; ) { if (o.i !== a.i && Cy(o, a)) { let c = Mc(o, a); o = ne(o, o.next), c = ne(c, c.next), Je(o, t, n, s, r, i, 0), Je(c, t, n, s, r, i, 0); @@ -10230,133 +9986,144 @@ function hy (e, t, n, s, r, i) { o = o.next; } while (o !== e); } -function fy (e, t, n, s, r, i) { +function fy(e, t, n, s, r, i) { const o = []; let a, c, u, l, h; - for (a = 0, c = t.length; a < c; a++) { u = t[a] * s, l = a < c - 1 ? t[a + 1] * s : e.length, h = wc(e, u, l, s, !1, r && r[a + 1], i), h === h.next && (h.steiner = !0), o.push(By(h)); } - for (o.sort(dy), a = 0; a < o.length; a++) { n = my(o[a], n); } + for (a = 0, c = t.length; a < c; a++) + u = t[a] * s, l = a < c - 1 ? t[a + 1] * s : e.length, h = wc(e, u, l, s, !1, r && r[a + 1], i), h === h.next && (h.steiner = !0), o.push(By(h)); + for (o.sort(dy), a = 0; a < o.length; a++) + n = my(o[a], n); return n; } -function dy (e, t) { +function dy(e, t) { return e.x - t.x; } -function my (e, t) { +function my(e, t) { const n = gy(e, t); - if (!n) { return t; } + if (!n) + return t; const s = Mc(n, e); return ne(s, s.next), ne(n, n.next); } -function gy (e, t) { +function gy(e, t) { let n = t; - const s = e.x; const r = e.y; - let i = -1 / 0; let o; + const s = e.x, r = e.y; + let i = -1 / 0, o; do { if (r <= n.y && r >= n.next.y && n.next.y !== n.y) { const f = n.x + (r - n.y) * (n.next.x - n.x) / (n.next.y - n.y); - if (f <= s && f > i && (i = f, o = n.x < n.next.x ? n : n.next, f === s)) { return o; } + if (f <= s && f > i && (i = f, o = n.x < n.next.x ? n : n.next, f === s)) + return o; } n = n.next; } while (n !== t); - if (!o) { return null; } - const a = o; const c = o.x; const u = o.y; - let l = 1 / 0; let h; + if (!o) + return null; + const a = o, c = o.x, u = o.y; + let l = 1 / 0, h; n = o; - do { s >= n.x && n.x >= c && s !== n.x && me(r < u ? s : i, r, c, u, r < u ? i : s, r, n.x, n.y) && (h = Math.abs(r - n.y) / (s - n.x), Ve(n, e) && (h < l || h === l && (n.x > o.x || n.x === o.x && Ay(o, n))) && (o = n, l = h)), n = n.next; } + do + s >= n.x && n.x >= c && s !== n.x && me(r < u ? s : i, r, c, u, r < u ? i : s, r, n.x, n.y) && (h = Math.abs(r - n.y) / (s - n.x), Ve(n, e) && (h < l || h === l && (n.x > o.x || n.x === o.x && Ay(o, n))) && (o = n, l = h)), n = n.next; while (n !== a); return o; } -function Ay (e, t) { +function Ay(e, t) { return W(e.prev, e, t.prev) < 0 && W(t.next, e, e.next) < 0; } -function py (e, t, n, s) { +function py(e, t, n, s) { let r = e; - do { r.z === 0 && (r.z = rr(r.x, r.y, t, n, s)), r.prevZ = r.prev, r.nextZ = r.next, r = r.next; } + do + r.z === 0 && (r.z = rr(r.x, r.y, t, n, s)), r.prevZ = r.prev, r.nextZ = r.next, r = r.next; while (r !== e); r.prevZ.nextZ = null, r.prevZ = null, yy(r); } -function yy (e) { - let t; let n; let s = 1; let r; let i; let o; let a; let c; let u; +function yy(e) { + let t, n, s = 1, r, i, o, a, c, u; do { - for (i = e, e = null, u = null, r = 0; i;) { + for (i = e, e = null, u = null, r = 0; i; ) { for (r++, a = i, o = 0, n = 0; n < s && (o++, a = a.nextZ, !!a); n++) ; - for (c = s; o > 0 || c > 0 && a;) { o !== 0 && (c === 0 || !a || i.z <= a.z) ? (t = i, i = i.nextZ, o--) : (t = a, a = a.nextZ, c--), u ? u.nextZ = t : e = t, t.prevZ = u, u = t; } + for (c = s; o > 0 || c > 0 && a; ) + o !== 0 && (c === 0 || !a || i.z <= a.z) ? (t = i, i = i.nextZ, o--) : (t = a, a = a.nextZ, c--), u ? u.nextZ = t : e = t, t.prevZ = u, u = t; i = a; } u.nextZ = null, s *= 2; } while (r > 1); return e; } -function rr (e, t, n, s, r) { +function rr(e, t, n, s, r) { return e = (e - n) * r | 0, t = (t - s) * r | 0, e = (e | e << 8) & 16711935, e = (e | e << 4) & 252645135, e = (e | e << 2) & 858993459, e = (e | e << 1) & 1431655765, t = (t | t << 8) & 16711935, t = (t | t << 4) & 252645135, t = (t | t << 2) & 858993459, t = (t | t << 1) & 1431655765, e | t << 1; } -function By (e) { - let t = e; let n = e; - do { (t.x < n.x || t.x === n.x && t.y < n.y) && (n = t), t = t.next; } +function By(e) { + let t = e, n = e; + do + (t.x < n.x || t.x === n.x && t.y < n.y) && (n = t), t = t.next; while (t !== e); return n; } -function me (e, t, n, s, r, i, o, a) { +function me(e, t, n, s, r, i, o, a) { return (r - o) * (t - a) >= (e - o) * (i - a) && (e - o) * (s - a) >= (n - o) * (t - a) && (n - o) * (i - a) >= (r - o) * (s - a); } -function Cy (e, t) { +function Cy(e, t) { return e.next.i !== t.i && e.prev.i !== t.i && !Ey(e, t) && // dones't intersect other edges (Ve(e, t) && Ve(t, e) && Ty(e, t) && // locally visible (W(e.prev, e, t.prev) || W(e, t.prev, t)) || // does not create opposite-facing sectors Zn(e, t) && W(e.prev, e, e.next) > 0 && W(t.prev, t, t.next) > 0); } -function W (e, t, n) { +function W(e, t, n) { return (t.y - e.y) * (n.x - t.x) - (t.x - e.x) * (n.y - t.y); } -function Zn (e, t) { +function Zn(e, t) { return e.x === t.x && e.y === t.y; } -function Rc (e, t, n, s) { - const r = Bn(W(e, t, n)); const i = Bn(W(e, t, s)); const o = Bn(W(n, s, e)); const a = Bn(W(n, s, t)); +function Rc(e, t, n, s) { + const r = Bn(W(e, t, n)), i = Bn(W(e, t, s)), o = Bn(W(n, s, e)), a = Bn(W(n, s, t)); return !!(r !== i && o !== a || r === 0 && yn(e, n, t) || i === 0 && yn(e, s, t) || o === 0 && yn(n, e, s) || a === 0 && yn(n, t, s)); } -function yn (e, t, n) { +function yn(e, t, n) { return t.x <= Math.max(e.x, n.x) && t.x >= Math.min(e.x, n.x) && t.y <= Math.max(e.y, n.y) && t.y >= Math.min(e.y, n.y); } -function Bn (e) { +function Bn(e) { return e > 0 ? 1 : e < 0 ? -1 : 0; } -function Ey (e, t) { +function Ey(e, t) { let n = e; do { - if (n.i !== e.i && n.next.i !== e.i && n.i !== t.i && n.next.i !== t.i && Rc(n, n.next, e, t)) { return !0; } + if (n.i !== e.i && n.next.i !== e.i && n.i !== t.i && n.next.i !== t.i && Rc(n, n.next, e, t)) + return !0; n = n.next; } while (n !== e); return !1; } -function Ve (e, t) { +function Ve(e, t) { return W(e.prev, e, e.next) < 0 ? W(e, t, e.next) >= 0 && W(e, e.prev, t) >= 0 : W(e, t, e.prev) < 0 || W(e, e.next, t) < 0; } -function Ty (e, t) { - let n = e; let s = !1; - const r = (e.x + t.x) / 2; const i = (e.y + t.y) / 2; - do { n.y > i != n.next.y > i && n.next.y !== n.y && r < (n.next.x - n.x) * (i - n.y) / (n.next.y - n.y) + n.x && (s = !s), n = n.next; } +function Ty(e, t) { + let n = e, s = !1; + const r = (e.x + t.x) / 2, i = (e.y + t.y) / 2; + do + n.y > i != n.next.y > i && n.next.y !== n.y && r < (n.next.x - n.x) * (i - n.y) / (n.next.y - n.y) + n.x && (s = !s), n = n.next; while (n !== e); return s; } -function Mc (e, t) { - const n = new ir(e.i, e.x, e.y); const s = new ir(t.i, t.x, t.y); const r = e.next; const i = t.prev; +function Mc(e, t) { + const n = new ir(e.i, e.x, e.y), s = new ir(t.i, t.x, t.y), r = e.next, i = t.prev; return e.next = t, t.prev = e, n.next = r, r.prev = n, s.next = n, n.prev = s, i.next = s, s.prev = i, s; } -function yo (e, t, n, s) { +function yo(e, t, n, s) { const r = new ir(e, t, n); return s ? (r.next = s.next, r.prev = s, s.next.prev = r, s.next = r) : (r.prev = r, r.next = r), r; } -function je (e) { +function je(e) { e.next.prev = e.prev, e.prev.next = e.next, e.prevZ && (e.prevZ.nextZ = e.nextZ), e.nextZ && (e.nextZ.prevZ = e.prevZ); } class ir { - constructor (t, n, s) { + constructor(t, n, s) { this.prev = null, this.next = null, this.z = 0, this.prevZ = null, this.nextZ = null, this.steiner = !1, this.i = t, this.x = n, this.y = s; } } -function by (e, t, n) { - const s = _y(e); const r = Object.keys(s).filter((i) => s[i] !== Array); +function by(e, t, n) { + const s = _y(e), r = Object.keys(s).filter((i) => s[i] !== Array); return wy(e, { propArrayTypes: s, ...t @@ -10366,19 +10133,17 @@ function by (e, t, n) { triangulate: n ? n.triangulate : !0 }); } -function _y (e) { +function _y(e) { const t = {}; - for (const n of e) { - if (n.properties) { + for (const n of e) + if (n.properties) for (const s in n.properties) { const r = n.properties[s]; t[s] = vy(r, t[s]); } - } - } return t; } -function wy (e, t, n) { +function wy(e, t, n) { const { pointPositionsCount: s, pointFeaturesCount: r, @@ -10391,20 +10156,20 @@ function wy (e, t, n) { polygonFeaturesCount: h, propArrayTypes: f, coordLength: d - } = t; const { + } = t, { numericPropKeys: m = [], PositionDataType: g = Float32Array, triangulate: y = !0 - } = n; const E = e[0] && 'id' in e[0]; const R = e.length > 65535 ? Uint32Array : Uint16Array; const B = { - type: 'Point', + } = n, E = e[0] && "id" in e[0], R = e.length > 65535 ? Uint32Array : Uint16Array, B = { + type: "Point", positions: new g(s * d), globalFeatureIds: new R(s), featureIds: r > 65535 ? new Uint32Array(s) : new Uint16Array(s), numericProps: {}, properties: [], fields: [] - }; const C = { - type: 'LineString', + }, C = { + type: "LineString", pathIndices: i > 65535 ? new Uint32Array(o + 1) : new Uint16Array(o + 1), positions: new g(i * d), globalFeatureIds: new R(i), @@ -10412,8 +10177,8 @@ function wy (e, t, n) { numericProps: {}, properties: [], fields: [] - }; const M = { - type: 'Polygon', + }, M = { + type: "Polygon", polygonIndices: c > 65535 ? new Uint32Array(u + 1) : new Uint16Array(u + 1), primitivePolygonIndices: c > 65535 ? new Uint32Array(l + 1) : new Uint16Array(l + 1), positions: new g(c * d), @@ -10424,12 +10189,11 @@ function wy (e, t, n) { fields: [] }; y && (M.triangles = []); - for (const O of [B, C, M]) { + for (const O of [B, C, M]) for (const F of m) { const v = f[F]; O.numericProps[F] = new v(O.positions.length / d); } - } C.pathIndices[o] = i, M.polygonIndices[u] = c, M.primitivePolygonIndices[l] = c; const b = { pointPosition: 0, @@ -10444,54 +10208,54 @@ function wy (e, t, n) { feature: 0 }; for (const O of e) { - const F = O.geometry; const v = O.properties || {}; + const F = O.geometry, v = O.properties || {}; switch (F.type) { - case 'Point': + case "Point": Ry(F, B, b, d, v), B.properties.push(xs(v, m)), E && B.fields.push({ id: O.id }), b.pointFeature++; break; - case 'LineString': + case "LineString": My(F, C, b, d, v), C.properties.push(xs(v, m)), E && C.fields.push({ id: O.id }), b.lineFeature++; break; - case 'Polygon': + case "Polygon": Sy(F, M, b, d, v), M.properties.push(xs(v, m)), E && M.fields.push({ id: O.id }), b.polygonFeature++; break; default: - throw new Error('Invalid geometry type'); + throw new Error("Invalid geometry type"); } b.feature++; } return xy(B, C, M, d); } -function Ry (e, t, n, s, r) { +function Ry(e, t, n, s, r) { t.positions.set(e.data, n.pointPosition * s); const i = e.data.length / s; Hr(t, r, n.pointPosition, i), t.globalFeatureIds.fill(n.feature, n.pointPosition, n.pointPosition + i), t.featureIds.fill(n.pointFeature, n.pointPosition, n.pointPosition + i), n.pointPosition += i; } -function My (e, t, n, s, r) { +function My(e, t, n, s, r) { t.positions.set(e.data, n.linePosition * s); const i = e.data.length / s; Hr(t, r, n.linePosition, i), t.globalFeatureIds.fill(n.feature, n.linePosition, n.linePosition + i), t.featureIds.fill(n.lineFeature, n.linePosition, n.linePosition + i); for (let o = 0, a = e.indices.length; o < a; ++o) { - const c = e.indices[o]; const u = o === a - 1 ? e.data.length : e.indices[o + 1]; + const c = e.indices[o], u = o === a - 1 ? e.data.length : e.indices[o + 1]; t.pathIndices[n.linePath++] = n.linePosition, n.linePosition += (u - c) / s; } } -function Sy (e, t, n, s, r) { +function Sy(e, t, n, s, r) { t.positions.set(e.data, n.polygonPosition * s); const i = e.data.length / s; Hr(t, r, n.polygonPosition, i), t.globalFeatureIds.fill(n.feature, n.polygonPosition, n.polygonPosition + i), t.featureIds.fill(n.polygonFeature, n.polygonPosition, n.polygonPosition + i); for (let o = 0, a = e.indices.length; o < a; ++o) { const c = n.polygonPosition; t.polygonIndices[n.polygonObject++] = c; - const u = e.areas[o]; const l = e.indices[o]; const h = e.indices[o + 1]; + const u = e.areas[o], l = e.indices[o], h = e.indices[o + 1]; for (let d = 0, m = l.length; d < m; ++d) { - const g = l[d]; const y = d === m - 1 ? h === void 0 ? e.data.length : h[0] : l[d + 1]; + const g = l[d], y = d === m - 1 ? h === void 0 ? e.data.length : h[0] : l[d + 1]; t.primitivePolygonIndices[n.polygonRing++] = n.polygonPosition, n.polygonPosition += (y - g) / s; } const f = n.polygonPosition; @@ -10502,29 +10266,30 @@ function Sy (e, t, n, s, r) { }); } } -function Iy (e, t, n, s) { - const { +function Iy(e, t, n, s) { + let { startPosition: r, endPosition: i, coordLength: o } = s; - if (!e.triangles) { return; } - const a = r * o; const c = i * o; const u = e.positions.subarray(a, c); const l = n[0]; const h = n.slice(1).map((d) => (d - l) / o); const f = ay(u, h, o, t); - for (let d = 0, m = f.length; d < m; ++d) { e.triangles.push(r + f[d]); } + if (!e.triangles) + return; + const a = r * o, c = i * o, u = e.positions.subarray(a, c), l = n[0], h = n.slice(1).map((d) => (d - l) / o), f = ay(u, h, o, t); + for (let d = 0, m = f.length; d < m; ++d) + e.triangles.push(r + f[d]); } -function Is (e, t) { +function Is(e, t) { const n = {}; - for (const s in e) { + for (const s in e) n[s] = { value: e[s], size: t }; - } return n; } -function xy (e, t, n, s) { +function xy(e, t, n, s) { const r = { - shape: 'binary-feature-collection', + shape: "binary-feature-collection", points: { ...e, positions: { @@ -10591,59 +10356,64 @@ function xy (e, t, n, s) { size: 1 }), r; } -function Hr (e, t, n, s) { - for (const r in e.numericProps) { +function Hr(e, t, n, s) { + for (const r in e.numericProps) if (r in t) { const i = t[r]; e.numericProps[r].fill(i, n, n + s); } - } } -function xs (e, t) { +function xs(e, t) { const n = {}; - for (const s in e) { t.includes(s) || (n[s] = e[s]); } + for (const s in e) + t.includes(s) || (n[s] = e[s]); return n; } -function vy (e, t) { +function vy(e, t) { return t === Array || !Number.isFinite(e) ? Array : t === Float64Array || Math.fround(e) !== e ? Float64Array : Float32Array; } -function Oy (e) { - let t = 0; let n = 0; let s = 0; let r = 0; let i = 0; let o = 0; let a = 0; let c = 0; let u = 0; +function Oy(e) { + let t = 0, n = 0, s = 0, r = 0, i = 0, o = 0, a = 0, c = 0, u = 0; const l = /* @__PURE__ */ new Set(); for (const h of e) { const f = h.geometry; switch (f.type) { - case 'Point': + case "Point": n++, t++, l.add(f.coordinates.length); break; - case 'MultiPoint': + case "MultiPoint": n++, t += f.coordinates.length; - for (const m of f.coordinates) { l.add(m.length); } + for (const m of f.coordinates) + l.add(m.length); break; - case 'LineString': + case "LineString": i++, s += f.coordinates.length, r++; - for (const m of f.coordinates) { l.add(m.length); } + for (const m of f.coordinates) + l.add(m.length); break; - case 'MultiLineString': + case "MultiLineString": i++; for (const m of f.coordinates) { s += m.length, r++; - for (const g of m) { l.add(g.length); } + for (const g of m) + l.add(g.length); } break; - case 'Polygon': + case "Polygon": u++, a++, c += f.coordinates.length; const d = f.coordinates.flat(); o += d.length; - for (const m of d) { l.add(m.length); } + for (const m of d) + l.add(m.length); break; - case 'MultiPolygon': + case "MultiPolygon": u++; for (const m of f.coordinates) { a++, c += m.length; const g = m.flat(); o += g.length; - for (const y of g) { l.add(y.length); } + for (const y of g) + l.add(y.length); } break; default: @@ -10663,29 +10433,29 @@ function Oy (e) { polygonFeaturesCount: u }; } -function Fy (e) { - const t = arguments.length > 1 && arguments[1] !== void 0 - ? arguments[1] - : { - coordLength: 2, - fixRingWinding: !0 - }; +function Fy(e) { + let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : { + coordLength: 2, + fixRingWinding: !0 + }; return e.map((n) => Dy(n, t)); } -function Bo (e, t, n, s) { +function Bo(e, t, n, s) { n.push(t.length), t.push(...e); - for (let r = e.length; r < s.coordLength; r++) { t.push(0); } + for (let r = e.length; r < s.coordLength; r++) + t.push(0); } -function or (e, t, n, s) { +function or(e, t, n, s) { n.push(t.length); for (const r of e) { t.push(...r); - for (let i = r.length; i < s.coordLength; i++) { t.push(0); } + for (let i = r.length; i < s.coordLength; i++) + t.push(0); } } -function Co (e, t, n, s, r) { +function Co(e, t, n, s, r) { let i = 0; - const o = []; const a = []; + const o = [], a = []; for (const c of e) { const u = c.map((f) => f.slice(0, 2)); let l = _c(u.flat()); @@ -10694,31 +10464,32 @@ function Co (e, t, n, s, r) { } i > 0 && (s.push(o), n.push(a)); } -function Dy (e, t) { +function Dy(e, t) { const { geometry: n } = e; - if (n.type === 'GeometryCollection') { throw new Error('GeometryCollection type not supported'); } - const s = []; const r = []; + if (n.type === "GeometryCollection") + throw new Error("GeometryCollection type not supported"); + const s = [], r = []; let i, o; switch (n.type) { - case 'Point': - o = 'Point', Bo(n.coordinates, s, r, t); + case "Point": + o = "Point", Bo(n.coordinates, s, r, t); break; - case 'MultiPoint': - o = 'Point', n.coordinates.map((a) => Bo(a, s, r, t)); + case "MultiPoint": + o = "Point", n.coordinates.map((a) => Bo(a, s, r, t)); break; - case 'LineString': - o = 'LineString', or(n.coordinates, s, r, t); + case "LineString": + o = "LineString", or(n.coordinates, s, r, t); break; - case 'MultiLineString': - o = 'LineString', n.coordinates.map((a) => or(a, s, r, t)); + case "MultiLineString": + o = "LineString", n.coordinates.map((a) => or(a, s, r, t)); break; - case 'Polygon': - o = 'Polygon', i = [], Co(n.coordinates, s, r, i, t); + case "Polygon": + o = "Polygon", i = [], Co(n.coordinates, s, r, i, t); break; - case 'MultiPolygon': - o = 'Polygon', i = [], n.coordinates.map((a) => Co(a, s, r, i, t)); + case "MultiPolygon": + o = "Polygon", i = [], n.coordinates.map((a) => Co(a, s, r, i, t)); break; default: throw new Error(`Unknown type: ${o}`); @@ -10733,16 +10504,14 @@ function Dy (e, t) { } }; } -function Sc (e) { - const t = arguments.length > 1 && arguments[1] !== void 0 - ? arguments[1] - : { - fixRingWinding: !0, - triangulate: !0 - }; - const n = Oy(e); const s = n.coordLength; const { +function Sc(e) { + let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : { + fixRingWinding: !0, + triangulate: !0 + }; + const n = Oy(e), s = n.coordLength, { fixRingWinding: r - } = t; const i = Fy(e, { + } = t, i = Fy(e, { coordLength: s, fixRingWinding: r }); @@ -10752,39 +10521,39 @@ function Sc (e) { triangulate: t.triangulate }); } -const Ly = '4.1.4'; const Py = { - name: 'GeoJSON', - id: 'geojson', - module: 'geojson', +const Ly = "4.1.4", Py = { + name: "GeoJSON", + id: "geojson", + module: "geojson", version: Ly, worker: !0, - extensions: ['geojson'], - mimeTypes: ['application/geo+json'], - category: 'geometry', + extensions: ["geojson"], + mimeTypes: ["application/geo+json"], + category: "geometry", text: !0, options: { geojson: { - shape: 'object-row-table' + shape: "object-row-table" }, json: { - shape: 'object-row-table', - jsonpaths: ['$', '$.features'] + shape: "object-row-table", + jsonpaths: ["$", "$.features"] }, gis: { - format: 'geojson' + format: "geojson" } } -}; const ke = { +}, ke = { ...Py, parse: Gy, parseTextSync: Ic, parseInBatches: Ny }; -async function Gy (e, t) { +async function Gy(e, t) { return Ic(new TextDecoder().decode(e), t); } -function Ic (e, t) { - let n; +function Ic(e, t) { + var n; t = { ...ke.options, ...t @@ -10799,18 +10568,18 @@ function Ic (e, t) { s = {}; } const r = { - shape: 'geojson-table', - type: 'FeatureCollection', + shape: "geojson-table", + type: "FeatureCollection", features: ((n = s) === null || n === void 0 ? void 0 : n.features) || [] }; switch (t.gis.format) { - case 'binary': + case "binary": return Sc(r.features); default: return r; } } -function Ny (e, t) { +function Ny(e, t) { t = { ...ke.options, ...t @@ -10820,20 +10589,22 @@ function Ny (e, t) { }; const n = oy(e, t); switch (t.gis.format) { - case 'binary': + case "binary": return Uy(n); default: return n; } } -async function * Uy (e) { - for await (const t of e) { t.data = Sc(t.data), yield t; } +async function* Uy(e) { + for await (const t of e) + t.data = Sc(t.data), yield t; } -function $t (e, t) { - if (!e) { throw new Error(t || 'loader assertion failed.'); } +function $t(e, t) { + if (!e) + throw new Error(t || "loader assertion failed."); } -const Hy = 'Queued Requests'; const Jy = 'Active Requests'; const Vy = 'Cancelled Requests'; const jy = 'Queued Requests Ever'; const ky = 'Active Requests Ever'; const Ky = { - id: 'request-scheduler', +const Hy = "Queued Requests", Jy = "Active Requests", Vy = "Cancelled Requests", jy = "Queued Requests Ever", ky = "Active Requests Ever", Ky = { + id: "request-scheduler", /** Specifies if the request scheduler should throttle incoming requests, mainly for comparative testing. */ throttleRequests: !0, /** The maximum number of simultaneous active requests. Un-throttled requests do not observe this limit. */ @@ -10845,17 +10616,16 @@ const Hy = 'Queued Requests'; const Jy = 'Active Requests'; const Vy = 'Cancelle debounceTime: 0 }; class zy { - constructor (t = {}) { - p(this, 'props'); - p(this, 'stats'); - p(this, 'activeRequestCount', 0); + constructor(t = {}) { + p(this, "props"); + p(this, "stats"); + p(this, "activeRequestCount", 0); /** Tracks the number of active requests and prioritizes/cancels queued requests. */ - p(this, 'requestQueue', []); - p(this, 'requestMap', /* @__PURE__ */ new Map()); - p(this, 'updateTimer', null); + p(this, "requestQueue", []); + p(this, "requestMap", /* @__PURE__ */ new Map()); + p(this, "updateTimer", null); this.props = { ...Ky, ...t }, this.stats = new $o({ id: this.props.id }), this.stats.get(Hy), this.stats.get(Jy), this.stats.get(Vy), this.stats.get(jy), this.stats.get(ky); } - /** * Called by an application that wants to issue a request, without having it deeply queued by the browser * @@ -10872,20 +10642,17 @@ class zy { * - resolves to `null` if the request has been cancelled (by the callback return < 0). * In this case the application should not issue the request */ - scheduleRequest (t, n = () => 0) { - if (!this.props.throttleRequests) { - return Promise.resolve({ - done: () => { - } - }); - } - if (this.requestMap.has(t)) { return this.requestMap.get(t); } - const s = { handle: t, priority: 0, getPriority: n }; const r = new Promise((i) => (s.resolve = i, s)); + scheduleRequest(t, n = () => 0) { + if (!this.props.throttleRequests) + return Promise.resolve({ done: () => { + } }); + if (this.requestMap.has(t)) + return this.requestMap.get(t); + const s = { handle: t, priority: 0, getPriority: n }, r = new Promise((i) => (s.resolve = i, s)); return this.requestQueue.push(s), this.requestMap.set(t, r), this._issueNewRequests(), r; } - // PRIVATE - _issueRequest (t) { + _issueRequest(t) { const { handle: n, resolve: s } = t; let r = !1; const i = () => { @@ -10893,14 +10660,12 @@ class zy { }; return this.activeRequestCount++, s ? s({ done: i }) : Promise.resolve({ done: i }); } - /** We check requests asynchronously, to prevent multiple updates */ - _issueNewRequests () { + _issueNewRequests() { this.updateTimer !== null && clearTimeout(this.updateTimer), this.updateTimer = setTimeout(() => this._issueNewRequestsAsync(), this.props.debounceTime); } - /** Refresh all requests */ - _issueNewRequestsAsync () { + _issueNewRequestsAsync() { this.updateTimer !== null && clearTimeout(this.updateTimer), this.updateTimer = null; const t = Math.max(this.props.maxRequests - this.activeRequestCount, 0); if (t !== 0) { @@ -10911,9 +10676,8 @@ class zy { } } } - /** Ensure all requests have updated priorities, and that no longer valid requests are cancelled */ - _updateAllRequests () { + _updateAllRequests() { const t = this.requestQueue; for (let n = 0; n < t.length; ++n) { const s = t[n]; @@ -10921,120 +10685,108 @@ class zy { } t.sort((n, s) => n.priority - s.priority); } - /** Update a single request by calling the callback */ - _updateRequest (t) { + _updateRequest(t) { return t.priority = t.getPriority(t.handle), t.priority < 0 ? (t.resolve(null), !1) : !0; } } -function Wy (e) { - const t = e ? e.lastIndexOf('/') : -1; - return t >= 0 ? e.substr(0, t) : ''; +function Wy(e) { + const t = e ? e.lastIndexOf("/") : -1; + return t >= 0 ? e.substr(0, t) : ""; } class Xy { - constructor (t, n, s) { - p(this, 'item'); - p(this, 'previous'); - p(this, 'next'); + constructor(t, n, s) { + p(this, "item"); + p(this, "previous"); + p(this, "next"); this.item = t, this.previous = n, this.next = s; } } class Qy { - constructor () { - p(this, 'head', null); - p(this, 'tail', null); - p(this, '_length', 0); + constructor() { + p(this, "head", null); + p(this, "tail", null); + p(this, "_length", 0); } - - get length () { + get length() { return this._length; } - /** * Adds the item to the end of the list * @param {*} [item] * @return {DoublyLinkedListNode} */ - add (t) { + add(t) { const n = new Xy(t, this.tail, null); return this.tail ? (this.tail.next = n, this.tail = n) : (this.head = n, this.tail = n), ++this._length, n; } - /** * Removes the given node from the list * @param {DoublyLinkedListNode} node */ - remove (t) { + remove(t) { t && (t.previous && t.next ? (t.previous.next = t.next, t.next.previous = t.previous) : t.previous ? (t.previous.next = null, this.tail = t.previous) : t.next ? (t.next.previous = null, this.head = t.next) : (this.head = null, this.tail = null), t.next = null, t.previous = null, --this._length); } - /** * Moves nextNode after node * @param {DoublyLinkedListNode} node * @param {DoublyLinkedListNode} nextNode */ - splice (t, n) { + splice(t, n) { t !== n && (this.remove(n), this._insert(t, n)); } - - _insert (t, n) { + _insert(t, n) { const s = t.next; t.next = n, this.tail === t ? this.tail = n : s.previous = n, n.next = s, n.previous = t, ++this._length; } } class qy { - constructor () { - p(this, '_list'); - p(this, '_sentinel'); - p(this, '_trimTiles'); - this._list = new Qy(), this._sentinel = this._list.add('sentinel'), this._trimTiles = !1; + constructor() { + p(this, "_list"); + p(this, "_sentinel"); + p(this, "_trimTiles"); + this._list = new Qy(), this._sentinel = this._list.add("sentinel"), this._trimTiles = !1; } - - reset () { + reset() { this._list.splice(this._list.tail, this._sentinel); } - - touch (t) { + touch(t) { const n = t._cacheNode; n && this._list.splice(this._sentinel, n); } - - add (t, n, s) { + add(t, n, s) { n._cacheNode || (n._cacheNode = this._list.add(n), s && s(t, n)); } - - unloadTile (t, n, s) { + unloadTile(t, n, s) { const r = n._cacheNode; r && (this._list.remove(r), n._cacheNode = null, s && s(t, n)); } - - unloadTiles (t, n) { + unloadTiles(t, n) { const s = this._trimTiles; this._trimTiles = !1; - const r = this._list; const i = t.maximumMemoryUsage * 1024 * 1024; const o = this._sentinel; + const r = this._list, i = t.maximumMemoryUsage * 1024 * 1024, o = this._sentinel; let a = r.head; - for (; a !== o && (t.gpuMemoryUsageInBytes > i || s);) { + for (; a !== o && (t.gpuMemoryUsageInBytes > i || s); ) { const c = a.item; a = a.next, this.unloadTile(t, c, n); } } - - trim () { + trim() { this._trimTiles = !0; } } -function Yy (e, t) { +function Yy(e, t) { $t(e), $t(t); - const { rtcCenter: n, gltfUpAxis: s } = t; const { computedTransform: r, boundingVolume: { center: i } } = e; + const { rtcCenter: n, gltfUpAxis: s } = t, { computedTransform: r, boundingVolume: { center: i } } = e; let o = new V(r); switch (n && o.translate(n), s) { - case 'Z': + case "Z": break; - case 'Y': + case "Y": const h = new V().rotateX(Math.PI / 2); o = o.multiplyRight(h); break; - case 'X': + case "X": const f = new V().rotateY(-Math.PI / 2); o = o.multiplyRight(f); break; @@ -11042,10 +10794,10 @@ function Yy (e, t) { t.isQuantized && o.translate(t.quantizedVolumeOffset).scale(t.quantizedVolumeScale); const a = new A(i); t.cartesianModelMatrix = o, t.cartesianOrigin = a; - const c = J.WGS84.cartesianToCartographic(a, new A()); const l = J.WGS84.eastNorthUpToFixedFrame(a).invert(); + const c = J.WGS84.cartesianToCartographic(a, new A()), l = J.WGS84.eastNorthUpToFixedFrame(a).invert(); t.cartographicModelMatrix = l.multiplyRight(o), t.cartographicOrigin = c, t.coordinateSystem || (t.modelMatrix = t.cartographicModelMatrix); } -const Eo = new A(); const vs = new A(); const ar = new dt([ +const Eo = new A(), vs = new A(), ar = new dt([ new nt(), new nt(), new nt(), @@ -11053,16 +10805,16 @@ const Eo = new A(); const vs = new A(); const ar = new dt([ new nt(), new nt() ]); -function $y (e, t) { - const { cameraDirection: n, cameraUp: s, height: r } = e; const { metersPerUnit: i } = e.distanceScales; const o = wn(e, e.center); const a = J.WGS84.eastNorthUpToFixedFrame(o); const c = e.unprojectPosition(e.cameraPosition); const u = J.WGS84.cartographicToCartesian(c, new A()); const l = new A( +function $y(e, t) { + const { cameraDirection: n, cameraUp: s, height: r } = e, { metersPerUnit: i } = e.distanceScales, o = wn(e, e.center), a = J.WGS84.eastNorthUpToFixedFrame(o), c = e.unprojectPosition(e.cameraPosition), u = J.WGS84.cartographicToCartesian(c, new A()), l = new A( // @ts-ignore a.transformAsVector(new A(n).scale(i)) - ).normalize(); const h = new A( + ).normalize(), h = new A( // @ts-ignore a.transformAsVector(new A(s).scale(i)) ).normalize(); tB(e); - const f = e.constructor; const { longitude: d, latitude: m, width: g, bearing: y, zoom: E } = e; const R = new f({ + const f = e.constructor, { longitude: d, latitude: m, width: g, bearing: y, zoom: E } = e, R = new f({ longitude: d, latitude: m, height: r, @@ -11087,26 +10839,30 @@ function $y (e, t) { // Assumes fovy = 60 degrees }; } -function Zy (e, t, n) { - if (n === 0 || e.length <= n) { return [e, []]; } - const s = []; const { longitude: r, latitude: i } = t.viewport; +function Zy(e, t, n) { + if (n === 0 || e.length <= n) + return [e, []]; + const s = [], { longitude: r, latitude: i } = t.viewport; for (const [u, l] of e.entries()) { - const [h, f] = l.header.mbs; const d = Math.abs(r - h); const m = Math.abs(i - f); const g = Math.sqrt(m * m + d * d); + const [h, f] = l.header.mbs, d = Math.abs(r - h), m = Math.abs(i - f), g = Math.sqrt(m * m + d * d); s.push([u, g]); } - const o = s.sort((u, l) => u[1] - l[1]); const a = []; - for (let u = 0; u < n; u++) { a.push(e[o[u][0]]); } + const o = s.sort((u, l) => u[1] - l[1]), a = []; + for (let u = 0; u < n; u++) + a.push(e[o[u][0]]); const c = []; - for (let u = n; u < o.length; u++) { c.push(e[o[u][0]]); } + for (let u = n; u < o.length; u++) + c.push(e[o[u][0]]); return [a, c]; } -function tB (e) { - const t = e.getFrustumPlanes(); const n = To(t.near, e.cameraPosition); const s = wn(e, n); const r = wn(e, e.cameraPosition, vs); +function tB(e) { + const t = e.getFrustumPlanes(), n = To(t.near, e.cameraPosition), s = wn(e, n), r = wn(e, e.cameraPosition, vs); let i = 0; ar.planes[i++].fromPointNormal(s, Eo.copy(s).subtract(r)); for (const o in t) { - if (o === 'near') { continue; } - const a = t[o]; const c = To(a, n, vs); const u = wn(e, c, vs); + if (o === "near") + continue; + const a = t[o], c = To(a, n, vs), u = wn(e, c, vs); ar.planes[i++].fromPointNormal( u, // Want the normal to point into the frustum since that's what culling expects @@ -11114,40 +10870,40 @@ function tB (e) { ); } } -function To (e, t, n = new A()) { +function To(e, t, n = new A()) { const s = e.normal.dot(t); return n.copy(e.normal).scale(e.distance - s).add(t), n; } -function wn (e, t, n = new A()) { +function wn(e, t, n = new A()) { const s = e.unprojectPosition(t); return J.WGS84.cartographicToCartesian(s, n); } -const eB = 6378137; const nB = 6378137; const cr = 6356752314245179e-9; const ge = new A(); -function sB (e, t) { +const eB = 6378137, nB = 6378137, cr = 6356752314245179e-9, ge = new A(); +function sB(e, t) { if (e instanceof qe) { - const { halfAxes: n } = e; const s = iB(n); + const { halfAxes: n } = e, s = iB(n); return Math.log2(cr / (s + t[2])); } else if (e instanceof Qe) { const { radius: n } = e; return Math.log2(cr / (n + t[2])); } else if (e.width && e.height) { - const { width: n, height: s } = e; const r = Math.log2(eB / n); const i = Math.log2(nB / s); + const { width: n, height: s } = e, r = Math.log2(eB / n), i = Math.log2(nB / s); return (r + i) / 2; } return 1; } -function xc (e, t, n) { +function xc(e, t, n) { J.WGS84.cartographicToCartesian([e.xmax, e.ymax, e.zmax], ge); const s = Math.sqrt(Math.pow(ge[0] - n[0], 2) + Math.pow(ge[1] - n[1], 2) + Math.pow(ge[2] - n[2], 2)); return Math.log2(cr / (s + t[2])); } -function rB (e, t, n) { +function rB(e, t, n) { const [s, r, i, o] = e; return xc({ xmin: s, xmax: i, ymin: r, ymax: o, zmin: 0, zmax: 0 }, t, n); } -function iB (e) { +function iB(e) { e.getColumn(0, ge); - const t = e.getColumn(1); const n = e.getColumn(2); + const t = e.getColumn(1), n = e.getColumn(2); return ge.add(t).add(n).len(); } const lt = { @@ -11164,39 +10920,43 @@ const lt = { FAILED: 5 // Request failed. }; -let Ht; -(function (e) { - e[e.ADD = 1] = 'ADD', e[e.REPLACE = 2] = 'REPLACE'; +var Ht; +(function(e) { + e[e.ADD = 1] = "ADD", e[e.REPLACE = 2] = "REPLACE"; })(Ht || (Ht = {})); -let Pe; -(function (e) { - e.EMPTY = 'empty', e.SCENEGRAPH = 'scenegraph', e.POINTCLOUD = 'pointcloud', e.MESH = 'mesh'; +var Pe; +(function(e) { + e.EMPTY = "empty", e.SCENEGRAPH = "scenegraph", e.POINTCLOUD = "pointcloud", e.MESH = "mesh"; })(Pe || (Pe = {})); -let At; -(function (e) { - e.I3S = 'I3S', e.TILES3D = 'TILES3D'; +var At; +(function(e) { + e.I3S = "I3S", e.TILES3D = "TILES3D"; })(At || (At = {})); -let bo; -(function (e) { - e.GEOMETRIC_ERROR = 'geometricError', e.MAX_SCREEN_THRESHOLD = 'maxScreenThreshold'; +var bo; +(function(e) { + e.GEOMETRIC_ERROR = "geometricError", e.MAX_SCREEN_THRESHOLD = "maxScreenThreshold"; })(bo || (bo = {})); const oB = { NOT_COMPUTED: -1, USE_OPTIMIZATION: 1, SKIP_OPTIMIZATION: 0 }; -function vc (e) { +function vc(e) { return e != null; } -const it = new A(); const Rn = new A(); const aB = new A(); const cB = new A(); const qt = new A(); const _o = new A(); const wo = new A(); const Ro = new A(); -function Os (e, t, n) { - if ($t(e, '3D Tile: boundingVolume must be defined'), e.box) { return Oc(e.box, t, n); } - if (e.region) { return hB(e.region); } - if (e.sphere) { return lB(e.sphere, t, n); } - throw new Error('3D Tile: boundingVolume must contain a sphere, region, or box'); -} -function uB (e, t) { - if (e.box) { return fB(t); } +const it = new A(), Rn = new A(), aB = new A(), cB = new A(), qt = new A(), _o = new A(), wo = new A(), Ro = new A(); +function Os(e, t, n) { + if ($t(e, "3D Tile: boundingVolume must be defined"), e.box) + return Oc(e.box, t, n); + if (e.region) + return hB(e.region); + if (e.sphere) + return lB(e.sphere, t, n); + throw new Error("3D Tile: boundingVolume must contain a sphere, region, or box"); +} +function uB(e, t) { + if (e.box) + return fB(t); if (e.region) { const [n, s, r, i, o, a] = e.region; return [ @@ -11204,20 +10964,22 @@ function uB (e, t) { [Rt(r), Rt(i), a] ]; } - if (e.sphere) { return dB(t); } - throw new Error('Unkown boundingVolume type'); + if (e.sphere) + return dB(t); + throw new Error("Unkown boundingVolume type"); } -function Oc (e, t, n) { +function Oc(e, t, n) { const s = new A(e[0], e[1], e[2]); t.transform(s, s); let r = []; if (e.length === 10) { - const u = e.slice(3, 6); const l = new On(); + const u = e.slice(3, 6), l = new On(); l.fromArray(e, 6); - const h = new A([1, 0, 0]); const f = new A([0, 1, 0]); const d = new A([0, 0, 1]); + const h = new A([1, 0, 0]), f = new A([0, 1, 0]), d = new A([0, 0, 1]); h.transformByQuaternion(l), h.scale(u[0]), f.transformByQuaternion(l), f.scale(u[1]), d.transformByQuaternion(l), d.scale(u[2]), r = [...h.toArray(), ...f.toArray(), ...d.toArray()]; - } else { r = [...e.slice(3, 6), ...e.slice(6, 9), ...e.slice(9, 12)]; } - const i = t.transformAsVector(r.slice(0, 3)); const o = t.transformAsVector(r.slice(3, 6)); const a = t.transformAsVector(r.slice(6, 9)); const c = new X([ + } else + r = [...e.slice(3, 6), ...e.slice(6, 9), ...e.slice(9, 12)]; + const i = t.transformAsVector(r.slice(0, 3)), o = t.transformAsVector(r.slice(3, 6)), a = t.transformAsVector(r.slice(6, 9)), c = new X([ i[0], i[1], i[2], @@ -11230,14 +10992,14 @@ function Oc (e, t, n) { ]); return vc(n) ? (n.center = s, n.halfAxes = c, n) : new qe(s, c); } -function lB (e, t, n) { +function lB(e, t, n) { const s = new A(e[0], e[1], e[2]); t.transform(s, s); - const r = t.getScale(Rn); const i = Math.max(Math.max(r[0], r[1]), r[2]); const o = e[3] * i; + const r = t.getScale(Rn), i = Math.max(Math.max(r[0], r[1]), r[2]), o = e[3] * i; return vc(n) ? (n.center = s, n.radius = o, n) : new Qe(s, o); } -function hB (e) { - const [t, n, s, r, i, o] = e; const a = J.WGS84.cartographicToCartesian([Rt(t), Rt(r), i], aB); const c = J.WGS84.cartographicToCartesian([Rt(s), Rt(n), o], cB); const u = new A().addVectors(a, c).multiplyByScalar(0.5); +function hB(e) { + const [t, n, s, r, i, o] = e, a = J.WGS84.cartographicToCartesian([Rt(t), Rt(r), i], aB), c = J.WGS84.cartographicToCartesian([Rt(s), Rt(n), o], cB), u = new A().addVectors(a, c).multiplyByScalar(0.5); return J.WGS84.cartesianToCartographic(u, qt), J.WGS84.cartographicToCartesian([Rt(s), qt[1], qt[2]], _o), J.WGS84.cartographicToCartesian([qt[0], Rt(r), qt[2]], wo), J.WGS84.cartographicToCartesian([qt[0], qt[1], o], Ro), Oc([ ...u, ..._o.subtract(u), @@ -11245,19 +11007,20 @@ function hB (e) { ...Ro.subtract(u) ], new V()); } -function fB (e) { - const t = Fc(); const { halfAxes: n } = e; const s = new A(n.getColumn(0)); const r = new A(n.getColumn(1)); const i = new A(n.getColumn(2)); +function fB(e) { + const t = Fc(), { halfAxes: n } = e, s = new A(n.getColumn(0)), r = new A(n.getColumn(1)), i = new A(n.getColumn(2)); for (let o = 0; o < 2; o++) { for (let a = 0; a < 2; a++) { - for (let c = 0; c < 2; c++) { it.copy(e.center), it.add(s), it.add(r), it.add(i), Dc(t, it), i.negate(); } + for (let c = 0; c < 2; c++) + it.copy(e.center), it.add(s), it.add(r), it.add(i), Dc(t, it), i.negate(); r.negate(); } s.negate(); } return t; } -function dB (e) { - const t = Fc(); const { center: n, radius: s } = e; const r = J.WGS84.scaleToGeodeticSurface(n, it); +function dB(e) { + const t = Fc(), { center: n, radius: s } = e, r = J.WGS84.scaleToGeodeticSurface(n, it); let i; r ? i = J.WGS84.geodeticSurfaceNormal(r) : i = new A(0, 0, 1); let o = new A(i[2], -i[1], 0); @@ -11265,17 +11028,18 @@ function dB (e) { const a = o.clone().cross(i); for (const c of [o, a, i]) { Rn.copy(c).scale(s); - for (let u = 0; u < 2; u++) { it.copy(n), it.add(Rn), Dc(t, it), Rn.negate(); } + for (let u = 0; u < 2; u++) + it.copy(n), it.add(Rn), Dc(t, it), Rn.negate(); } return t; } -function Fc () { +function Fc() { return [ [1 / 0, 1 / 0, 1 / 0], [-1 / 0, -1 / 0, -1 / 0] ]; } -function Dc (e, t) { +function Dc(e, t) { J.WGS84.cartesianToCartographic(t, it), e[0][0] = Math.min(e[0][0], it[0]), e[0][1] = Math.min(e[0][1], it[1]), e[0][2] = Math.min(e[0][2], it[2]), e[1][0] = Math.max(e[1][0], it[0]), e[1][1] = Math.max(e[1][1], it[1]), e[1][2] = Math.max(e[1][2], it[2]); } new A(); @@ -11284,51 +11048,52 @@ new V(); new A(); new A(); new A(); -function mB (e, t) { +function mB(e, t) { const n = e * t; return 1 - Math.exp(-(n * n)); } -function gB (e, t) { +function gB(e, t) { if (e.dynamicScreenSpaceError && e.dynamicScreenSpaceErrorComputedDensity) { - const n = e.dynamicScreenSpaceErrorComputedDensity; const s = e.dynamicScreenSpaceErrorFactor; + const n = e.dynamicScreenSpaceErrorComputedDensity, s = e.dynamicScreenSpaceErrorFactor; return mB(t, n) * s; } return 0; } -function AB (e, t, n) { - const s = e.tileset; const r = e.parent && e.parent.lodMetricValue || e.lodMetricValue; const i = n ? r : e.lodMetricValue; - if (i === 0) { return 0; } - const o = Math.max(e._distanceToCamera, 1e-7); const { height: a, sseDenominator: c } = t; const { viewDistanceScale: u } = s.options; +function AB(e, t, n) { + const s = e.tileset, r = e.parent && e.parent.lodMetricValue || e.lodMetricValue, i = n ? r : e.lodMetricValue; + if (i === 0) + return 0; + const o = Math.max(e._distanceToCamera, 1e-7), { height: a, sseDenominator: c } = t, { viewDistanceScale: u } = s.options; let l = i * a * (u || 1) / (o * c); return l -= gB(s, o), l; } -const Fs = new A(); const Mo = new A(); const jt = new A(); const So = new A(); const pB = new A(); const Ds = new V(); const Io = new V(); -function yB (e, t) { - if (e.lodMetricValue === 0 || isNaN(e.lodMetricValue)) { return 'DIG'; } +const Fs = new A(), Mo = new A(), jt = new A(), So = new A(), pB = new A(), Ds = new V(), Io = new V(); +function yB(e, t) { + if (e.lodMetricValue === 0 || isNaN(e.lodMetricValue)) + return "DIG"; const n = 2 * Lc(e, t); - return n < 2 ? 'OUT' : !e.header.children || n <= e.lodMetricValue ? 'DRAW' : e.header.children ? 'DIG' : 'OUT'; + return n < 2 ? "OUT" : !e.header.children || n <= e.lodMetricValue ? "DRAW" : e.header.children ? "DIG" : "OUT"; } -function Lc (e, t) { - const { topDownViewport: n } = t; const s = e.header.mbs[1]; const r = e.header.mbs[0]; const i = e.header.mbs[2]; const o = e.header.mbs[3]; const a = [...e.boundingVolume.center]; const c = n.unprojectPosition(n.cameraPosition); +function Lc(e, t) { + const { topDownViewport: n } = t, s = e.header.mbs[1], r = e.header.mbs[0], i = e.header.mbs[2], o = e.header.mbs[3], a = [...e.boundingVolume.center], c = n.unprojectPosition(n.cameraPosition); J.WGS84.cartographicToCartesian(c, Fs), Mo.copy(Fs).subtract(a).normalize(), J.WGS84.eastNorthUpToFixedFrame(a, Ds), Io.copy(Ds).invert(), jt.copy(Fs).transform(Io); - const u = Math.sqrt(jt[0] * jt[0] + jt[1] * jt[1]); const l = u * u / jt[2]; + const u = Math.sqrt(jt[0] * jt[0] + jt[1] * jt[1]), l = u * u / jt[2]; So.copy([jt[0], jt[1], l]); - const f = So.transform(Ds).subtract(a).normalize(); const m = Mo.cross(f).normalize().scale(o).add(a); const g = J.WGS84.cartesianToCartographic(m); const y = n.project([r, s, i]); const E = n.project(g); + const f = So.transform(Ds).subtract(a).normalize(), m = Mo.cross(f).normalize().scale(o).add(a), g = J.WGS84.cartesianToCartographic(m), y = n.project([r, s, i]), E = n.project(g); return pB.copy(y).subtract(E).magnitude(); } -function BB (e) { +function BB(e) { return { - assetGltfUpAxis: e.asset && e.asset.gltfUpAxis || 'Y' + assetGltfUpAxis: e.asset && e.asset.gltfUpAxis || "Y" }; } class xo { - constructor (t = 0) { - p(this, '_map', /* @__PURE__ */ new Map()); - p(this, '_array'); - p(this, '_length'); + constructor(t = 0) { + p(this, "_map", /* @__PURE__ */ new Map()); + p(this, "_array"); + p(this, "_length"); this._array = new Array(t), this._length = t; } - /** * Gets or sets the length of the array. * If the set length is greater than the length of the internal array, the internal array is resized. @@ -11336,14 +11101,12 @@ class xo { * @memberof ManagedArray.prototype * @type Number */ - get length () { + get length() { return this._length; } - - set length (t) { + set length(t) { this._length = t, t > this._array.length && (this._array.length = t); } - /** * Gets the internal array. * @@ -11351,97 +11114,86 @@ class xo { * @type Array * @readonly */ - get values () { + get values() { return this._array; } - /** * Gets the element at an index. * * @param {Number} index The index to get. */ - get (t) { + get(t) { return $t(t < this._array.length), this._array[t]; } - /** * Sets the element at an index. Resizes the array if index is greater than the length of the array. * * @param {Number} index The index to set. * @param {*} element The element to set at index. */ - set (t, n) { + set(t, n) { $t(t >= 0), t >= this.length && (this.length = t + 1), this._map.has(this._array[t]) && this._map.delete(this._array[t]), this._array[t] = n, this._map.set(n, t); } - - delete (t) { + delete(t) { const n = this._map.get(t); n >= 0 && (this._array.splice(n, 1), this._map.delete(t), this.length--); } - /** * Returns the last element in the array without modifying the array. * * @returns {*} The last element in the array. */ - peek () { + peek() { return this._array[this._length - 1]; } - /** * Push an element into the array. * * @param {*} element The element to push. */ - push (t) { + push(t) { if (!this._map.has(t)) { const n = this.length++; this._array[n] = t, this._map.set(t, n); } } - /** * Pop an element from the array. * * @returns {*} The last element in the array. */ - pop () { + pop() { const t = this._array[--this.length]; return this._map.delete(t), t; } - /** * Resize the internal array if length > _array.length. * * @param {Number} length The length. */ - reserve (t) { + reserve(t) { $t(t >= 0), t > this._array.length && (this._array.length = t); } - /** * Resize the array. * * @param {Number} length The length. */ - resize (t) { + resize(t) { $t(t >= 0), this.length = t; } - /** * Trim the internal array to the specified length. Defaults to the current length. * * @param {Number} [length] The length. */ - trim (t) { + trim(t) { t == null && (t = this.length), this._array.length = t; } - - reset () { + reset() { this._array = [], this._map = /* @__PURE__ */ new Map(), this._length = 0; } - - find (t) { + find(t) { return this._map.has(t); } } @@ -11452,44 +11204,40 @@ const CB = { onTraversalEnd: () => { }, viewportTraversersMap: {}, - basePath: '' + basePath: "" }; class ts { // TODO nested props - constructor (t) { - p(this, 'options'); + constructor(t) { + p(this, "options"); // fulfill in traverse call - p(this, 'root', null); + p(this, "root", null); // tiles should be rendered - p(this, 'selectedTiles', {}); + p(this, "selectedTiles", {}); // tiles should be loaded from server - p(this, 'requestedTiles', {}); + p(this, "requestedTiles", {}); // tiles does not have render content - p(this, 'emptyTiles', {}); - p(this, 'lastUpdate', (/* @__PURE__ */ new Date()).getTime()); - p(this, 'updateDebounceTime', 1e3); + p(this, "emptyTiles", {}); + p(this, "lastUpdate", (/* @__PURE__ */ new Date()).getTime()); + p(this, "updateDebounceTime", 1e3); /** temporary storage to hold the traversed tiles during a traversal */ - p(this, '_traversalStack', new xo()); - p(this, '_emptyTraversalStack', new xo()); + p(this, "_traversalStack", new xo()); + p(this, "_emptyTraversalStack", new xo()); /** set in every traverse cycle */ - p(this, '_frameNumber', null); + p(this, "_frameNumber", null); this.options = { ...CB, ...t }; } - // RESULT - traversalFinished (t) { + traversalFinished(t) { return !0; } - // tiles should be visible - traverse (t, n, s) { + traverse(t, n, s) { this.root = t, this.options = { ...this.options, ...s }, this.reset(), this.updateTile(t, n), this._frameNumber = n.frameNumber, this.executeTraversal(t, n); } - - reset () { + reset() { this.requestedTiles = {}, this.selectedTiles = {}, this.emptyTiles = {}, this._traversalStack.reset(), this._emptyTraversalStack.reset(); } - /** * Execute traverse * Depth-first traversal that traverses all visible tiles and marks tiles for selection. @@ -11500,116 +11248,107 @@ class ts { * and rendering children and parent tiles simultaneously. */ /* eslint-disable-next-line complexity, max-statements */ - executeTraversal (t, n) { + executeTraversal(t, n) { const s = this._traversalStack; - for (t._selectionDepth = 1, s.push(t); s.length > 0;) { + for (t._selectionDepth = 1, s.push(t); s.length > 0; ) { const i = s.pop(); let o = !1; this.canTraverse(i, n) && (this.updateChildTiles(i, n), o = this.updateAndPushChildren(i, n, s, i.hasRenderContent ? i._selectionDepth + 1 : i._selectionDepth)); - const a = i.parent; const c = !!(!a || a._shouldRefine); const u = !o; + const a = i.parent, c = !!(!a || a._shouldRefine), u = !o; i.hasRenderContent ? i.refine === Ht.ADD ? (this.loadTile(i, n), this.selectTile(i, n)) : i.refine === Ht.REPLACE && (this.loadTile(i, n), u && this.selectTile(i, n)) : (this.emptyTiles[i.id] = i, this.loadTile(i, n), u && this.selectTile(i, n)), this.touchTile(i, n), i._shouldRefine = o && c; } const r = (/* @__PURE__ */ new Date()).getTime(); (this.traversalFinished(n) || r - this.lastUpdate > this.updateDebounceTime) && (this.lastUpdate = r, this.options.onTraversalEnd(n)); } - - updateChildTiles (t, n) { + updateChildTiles(t, n) { const s = t.children; - for (const r of s) { this.updateTile(r, n); } + for (const r of s) + this.updateTile(r, n); } - /* eslint-disable complexity, max-statements */ - updateAndPushChildren (t, n, s, r) { - const { loadSiblings: i, skipLevelOfDetail: o } = this.options; const a = t.children; + updateAndPushChildren(t, n, s, r) { + const { loadSiblings: i, skipLevelOfDetail: o } = this.options, a = t.children; a.sort(this.compareDistanceToCamera.bind(this)); const c = t.refine === Ht.REPLACE && t.hasRenderContent && !o; - let u = !1; let l = !0; - for (const h of a) { + let u = !1, l = !0; + for (const h of a) if (h._selectionDepth = r, h.isVisibleAndInRequestVolume ? (s.find(h) && s.delete(h), s.push(h), u = !0) : (c || i) && (this.loadTile(h, n), this.touchTile(h, n)), c) { let f; - if (h._inRequestVolume ? h.hasRenderContent ? f = h.contentAvailable : f = this.executeEmptyTraversal(h, n) : f = !1, l = l && f, !l) { return !1; } + if (h._inRequestVolume ? h.hasRenderContent ? f = h.contentAvailable : f = this.executeEmptyTraversal(h, n) : f = !1, l = l && f, !l) + return !1; } - } return u || (l = !1), l; } - /* eslint-enable complexity, max-statements */ - updateTile (t, n) { + updateTile(t, n) { this.updateTileVisibility(t, n); } - // tile to render in the browser - selectTile (t, n) { + selectTile(t, n) { this.shouldSelectTile(t) && (t._selectedFrame = n.frameNumber, this.selectedTiles[t.id] = t); } - // tile to load from server - loadTile (t, n) { + loadTile(t, n) { this.shouldLoadTile(t) && (t._requestedFrame = n.frameNumber, t._priority = t._getPriority(), this.requestedTiles[t.id] = t); } - // cache tile - touchTile (t, n) { + touchTile(t, n) { t.tileset._cache.touch(t), t._touchedFrame = n.frameNumber; } - // tile should be visible // tile should have children // tile LoD (level of detail) is not sufficient under current viewport - canTraverse (t, n) { + canTraverse(t, n) { return t.hasChildren ? t.hasTilesetContent ? !t.contentExpired : this.shouldRefine(t, n) : !1; } - - shouldLoadTile (t) { + shouldLoadTile(t) { return t.hasUnloadedContent || t.contentExpired; } - - shouldSelectTile (t) { + shouldSelectTile(t) { return t.contentAvailable && !this.options.skipLevelOfDetail; } - /** Decide if tile LoD (level of detail) is not sufficient under current viewport */ - shouldRefine (t, n, s = !1) { + shouldRefine(t, n, s = !1) { let r = t._screenSpaceError; return s && (r = t.getScreenSpaceError(n, !0)), r > t.tileset.memoryAdjustedScreenSpaceError; } - - updateTileVisibility (t, n) { + updateTileVisibility(t, n) { const s = []; - if (this.options.viewportTraversersMap) { - for (const r in this.options.viewportTraversersMap) { this.options.viewportTraversersMap[r] === n.viewport.id && s.push(r); } - } else { s.push(n.viewport.id); } + if (this.options.viewportTraversersMap) + for (const r in this.options.viewportTraversersMap) + this.options.viewportTraversersMap[r] === n.viewport.id && s.push(r); + else + s.push(n.viewport.id); t.updateVisibility(n, s); } - // UTILITIES - compareDistanceToCamera (t, n) { + compareDistanceToCamera(t, n) { return t._distanceToCamera - n._distanceToCamera; } - - anyChildrenVisible (t, n) { + anyChildrenVisible(t, n) { let s = !1; - for (const r of t.children) { r.updateVisibility(n), s = s || r.isVisibleAndInRequestVolume; } + for (const r of t.children) + r.updateVisibility(n), s = s || r.isVisibleAndInRequestVolume; return s; } - // Depth-first traversal that checks if all nearest descendants with content are loaded. // Ignores visibility. - executeEmptyTraversal (t, n) { + executeEmptyTraversal(t, n) { let s = !0; const r = this._emptyTraversalStack; - for (r.push(t); r.length > 0;) { - const i = r.pop(); const o = !i.hasRenderContent && this.canTraverse(i, n); const a = !i.hasRenderContent && i.children.length === 0; + for (r.push(t); r.length > 0; ) { + const i = r.pop(), o = !i.hasRenderContent && this.canTraverse(i, n), a = !i.hasRenderContent && i.children.length === 0; if (!o && !i.contentAvailable && !a && (s = !1), this.updateTile(i, n), i.isVisibleAndInRequestVolume || (this.loadTile(i, n), this.touchTile(i, n)), o) { const c = i.children; - for (const u of c) { r.push(u); } + for (const u of c) + r.push(u); } } return s; } } const vo = new A(); -function EB (e) { +function EB(e) { return e != null; } class ur { @@ -11624,225 +11363,208 @@ class ur { * const extendedId = `${tile.id}-${frameState.viewport.id}`; */ // eslint-disable-next-line max-statements - constructor (t, n, s, r = '') { - p(this, 'tileset'); - p(this, 'header'); - p(this, 'id'); - p(this, 'url'); - p(this, 'parent'); + constructor(t, n, s, r = "") { + p(this, "tileset"); + p(this, "header"); + p(this, "id"); + p(this, "url"); + p(this, "parent"); /* Specifies the type of refine that is used when traversing this tile for rendering. */ - p(this, 'refine'); - p(this, 'type'); - p(this, 'contentUrl'); + p(this, "refine"); + p(this, "type"); + p(this, "contentUrl"); /** Different refinement algorithms used by I3S and 3D tiles */ - p(this, 'lodMetricType', 'geometricError'); + p(this, "lodMetricType", "geometricError"); /** The error, in meters, introduced if this tile is rendered and its children are not. */ - p(this, 'lodMetricValue', 0); + p(this, "lodMetricValue", 0); /** @todo math.gl is not exporting BoundingVolume base type? */ - p(this, 'boundingVolume', null); + p(this, "boundingVolume", null); /** * The tile's content. This represents the actual tile's payload, * not the content's metadata in the tileset JSON file. */ - p(this, 'content', null); - p(this, 'contentState', lt.UNLOADED); - p(this, 'gpuMemoryUsageInBytes', 0); + p(this, "content", null); + p(this, "contentState", lt.UNLOADED); + p(this, "gpuMemoryUsageInBytes", 0); /** The tile's children - an array of Tile3D objects. */ - p(this, 'children', []); - p(this, 'depth', 0); - p(this, 'viewportIds', []); - p(this, 'transform', new V()); - p(this, 'extensions', null); + p(this, "children", []); + p(this, "depth", 0); + p(this, "viewportIds", []); + p(this, "transform", new V()); + p(this, "extensions", null); /** TODO Cesium 3d tiles specific */ - p(this, 'implicitTiling', null); + p(this, "implicitTiling", null); /** Container to store application specific data */ - p(this, 'userData', {}); - p(this, 'computedTransform'); - p(this, 'hasEmptyContent', !1); - p(this, 'hasTilesetContent', !1); - p(this, 'traverser', new ts({})); + p(this, "userData", {}); + p(this, "computedTransform"); + p(this, "hasEmptyContent", !1); + p(this, "hasTilesetContent", !1); + p(this, "traverser", new ts({})); /** Used by TilesetCache */ - p(this, '_cacheNode', null); - p(this, '_frameNumber', null); + p(this, "_cacheNode", null); + p(this, "_frameNumber", null); // TODO Cesium 3d tiles specific - p(this, '_expireDate', null); - p(this, '_expiredContent', null); - p(this, '_boundingBox'); + p(this, "_expireDate", null); + p(this, "_expiredContent", null); + p(this, "_boundingBox"); /** updated every frame for tree traversal and rendering optimizations: */ - p(this, '_distanceToCamera', 0); - p(this, '_screenSpaceError', 0); - p(this, '_visibilityPlaneMask'); - p(this, '_visible'); - p(this, '_contentBoundingVolume'); - p(this, '_viewerRequestVolume'); - p(this, '_initialTransform', new V()); + p(this, "_distanceToCamera", 0); + p(this, "_screenSpaceError", 0); + p(this, "_visibilityPlaneMask"); + p(this, "_visible"); + p(this, "_contentBoundingVolume"); + p(this, "_viewerRequestVolume"); + p(this, "_initialTransform", new V()); // Used by traverser, cannot be marked private - p(this, '_priority', 0); - p(this, '_selectedFrame', 0); - p(this, '_requestedFrame', 0); - p(this, '_selectionDepth', 0); - p(this, '_touchedFrame', 0); - p(this, '_centerZDepth', 0); - p(this, '_shouldRefine', !1); - p(this, '_stackLength', 0); - p(this, '_visitedFrame', 0); - p(this, '_inRequestVolume', !1); - p(this, '_lodJudge', null); + p(this, "_priority", 0); + p(this, "_selectedFrame", 0); + p(this, "_requestedFrame", 0); + p(this, "_selectionDepth", 0); + p(this, "_touchedFrame", 0); + p(this, "_centerZDepth", 0); + p(this, "_shouldRefine", !1); + p(this, "_stackLength", 0); + p(this, "_visitedFrame", 0); + p(this, "_inRequestVolume", !1); + p(this, "_lodJudge", null); this.header = n, this.tileset = t, this.id = r || n.id, this.url = n.url, this.parent = s, this.refine = this._getRefine(n.refine), this.type = n.type, this.contentUrl = n.contentUrl, this._initializeLodMetric(n), this._initializeTransforms(n), this._initializeBoundingVolumes(n), this._initializeContent(n), this._initializeRenderingState(n), Object.seal(this); } - - destroy () { + destroy() { this.header = null; } - - isDestroyed () { + isDestroyed() { return this.header === null; } - - get selected () { + get selected() { return this._selectedFrame === this.tileset._frameNumber; } - - get isVisible () { + get isVisible() { return this._visible; } - - get isVisibleAndInRequestVolume () { + get isVisibleAndInRequestVolume() { return this._visible && this._inRequestVolume; } - /** Returns true if tile is not an empty tile and not an external tileset */ - get hasRenderContent () { + get hasRenderContent() { return !this.hasEmptyContent && !this.hasTilesetContent; } - /** Returns true if tile has children */ - get hasChildren () { + get hasChildren() { return this.children.length > 0 || this.header.children && this.header.children.length > 0; } - /** * Determines if the tile's content is ready. This is automatically `true` for * tiles with empty content. */ - get contentReady () { + get contentReady() { return this.contentState === lt.READY || this.hasEmptyContent; } - /** * Determines if the tile has available content to render. `true` if the tile's * content is ready or if it has expired content this renders while new content loads; otherwise, */ - get contentAvailable () { + get contentAvailable() { return !!(this.contentReady && this.hasRenderContent || this._expiredContent && !this.contentFailed); } - /** Returns true if tile has renderable content but it's unloaded */ - get hasUnloadedContent () { + get hasUnloadedContent() { return this.hasRenderContent && this.contentUnloaded; } - /** * Determines if the tile's content has not be requested. `true` if tile's * content has not be requested; otherwise, `false`. */ - get contentUnloaded () { + get contentUnloaded() { return this.contentState === lt.UNLOADED; } - /** * Determines if the tile's content is expired. `true` if tile's * content is expired; otherwise, `false`. */ - get contentExpired () { + get contentExpired() { return this.contentState === lt.EXPIRED; } - // Determines if the tile's content failed to load. `true` if the tile's // content failed to load; otherwise, `false`. - get contentFailed () { + get contentFailed() { return this.contentState === lt.FAILED; } - /** * Distance from the tile's bounding volume center to the camera */ - get distanceToCamera () { + get distanceToCamera() { return this._distanceToCamera; } - /** * Screen space error for LOD selection */ - get screenSpaceError () { + get screenSpaceError() { return this._screenSpaceError; } - /** * Get bounding box in cartographic coordinates * @returns [min, max] each in [longitude, latitude, altitude] */ - get boundingBox () { + get boundingBox() { return this._boundingBox || (this._boundingBox = uB(this.header.boundingVolume, this.boundingVolume)), this._boundingBox; } - /** Get the tile's screen space error. */ - getScreenSpaceError (t, n) { + getScreenSpaceError(t, n) { switch (this.tileset.type) { case At.I3S: return Lc(this, t); case At.TILES3D: return AB(this, t, n); default: - throw new Error('Unsupported tileset type'); + throw new Error("Unsupported tileset type"); } } - /** * Make tile unselected than means it won't be shown * but it can be still loaded in memory */ - unselect () { + unselect() { this._selectedFrame = 0; } - /** * Memory usage of tile on GPU */ - _getGpuMemoryUsageInBytes () { + _getGpuMemoryUsageInBytes() { return this.content.gpuMemoryUsageInBytes || this.content.byteLength || 0; } - /* * If skipLevelOfDetail is off try to load child tiles as soon as possible so that their parent can refine sooner. * Tiles are prioritized by screen space error. */ // eslint-disable-next-line complexity - _getPriority () { - const t = this.tileset._traverser; const { skipLevelOfDetail: n } = t.options; const s = this.refine === Ht.ADD || n; - if (s && !this.isVisible && this._visible !== void 0 || this.tileset._frameNumber - this._touchedFrame >= 1 || this.contentState === lt.UNLOADED) { return -1; } - const r = this.parent; const o = r && (!s || this._screenSpaceError === 0 || r.hasTilesetContent) ? r._screenSpaceError : this._screenSpaceError; const a = t.root ? t.root._screenSpaceError : 0; + _getPriority() { + const t = this.tileset._traverser, { skipLevelOfDetail: n } = t.options, s = this.refine === Ht.ADD || n; + if (s && !this.isVisible && this._visible !== void 0 || this.tileset._frameNumber - this._touchedFrame >= 1 || this.contentState === lt.UNLOADED) + return -1; + const r = this.parent, o = r && (!s || this._screenSpaceError === 0 || r.hasTilesetContent) ? r._screenSpaceError : this._screenSpaceError, a = t.root ? t.root._screenSpaceError : 0; return Math.max(a - o, 0); } - /** * Requests the tile's content. * The request may not be made if the Request Scheduler can't prioritize it. */ // eslint-disable-next-line max-statements, complexity - async loadContent () { - if (this.hasEmptyContent) { return !1; } - if (this.content) { return !0; } + async loadContent() { + if (this.hasEmptyContent) + return !1; + if (this.content) + return !0; this.contentExpired && (this._expireDate = null), this.contentState = lt.LOADING; const n = await this.tileset._requestScheduler.scheduleRequest(this.id, this._getPriority.bind(this)); - if (!n) { return this.contentState = lt.UNLOADED, !1; } + if (!n) + return this.contentState = lt.UNLOADED, !1; try { - const s = this.tileset.getTileUrl(this.contentUrl); const r = this.tileset.loader; const i = { + const s = this.tileset.getTileUrl(this.contentUrl), r = this.tileset.loader, i = { ...this.tileset.loadOptions, [r.id]: { // @ts-expect-error ...this.tileset.loadOptions[r.id], - isTileset: this.type === 'json', + isTileset: this.type === "json", ...this._getLoaderSpecificOptions(r.id) } }; @@ -11853,148 +11575,129 @@ class ur { n.done(); } } - // Unloads the tile's content. - unloadContent () { + unloadContent() { return this.content && this.content.destroy && this.content.destroy(), this.content = null, this.header.content && this.header.content.destroy && this.header.content.destroy(), this.header.content = null, this.contentState = lt.UNLOADED, !0; } - /** * Update the tile's visibility * @param {Object} frameState - frame state for tile culling * @param {string[]} viewportIds - a list of viewport ids that show this tile * @return {void} */ - updateVisibility (t, n) { - if (this._frameNumber === t.frameNumber) { return; } - const s = this.parent; const r = s ? s._visibilityPlaneMask : dt.MASK_INDETERMINATE; + updateVisibility(t, n) { + if (this._frameNumber === t.frameNumber) + return; + const s = this.parent, r = s ? s._visibilityPlaneMask : dt.MASK_INDETERMINATE; if (this.tileset._traverser.options.updateTransforms) { const i = s ? s.computedTransform : this.tileset.modelMatrix; this._updateTransform(i); } this._distanceToCamera = this.distanceToTile(t), this._screenSpaceError = this.getScreenSpaceError(t, !1), this._visibilityPlaneMask = this.visibility(t, r), this._visible = this._visibilityPlaneMask !== dt.MASK_OUTSIDE, this._inRequestVolume = this.insideViewerRequestVolume(t), this._frameNumber = t.frameNumber, this.viewportIds = n; } - // Determines whether the tile's bounding volume intersects the culling volume. // @param {FrameState} frameState The frame state. // @param {Number} parentVisibilityPlaneMask The parent's plane mask to speed up the visibility check. // @returns {Number} A plane mask as described above in {@link CullingVolume#computeVisibilityWithPlaneMask}. - visibility (t, n) { - const { cullingVolume: s } = t; const { boundingVolume: r } = this; + visibility(t, n) { + const { cullingVolume: s } = t, { boundingVolume: r } = this; return s.computeVisibilityWithPlaneMask(r, n); } - // Assuming the tile's bounding volume intersects the culling volume, determines // whether the tile's content's bounding volume intersects the culling volume. // @param {FrameState} frameState The frame state. // @returns {Intersect} The result of the intersection: the tile's content is completely outside, completely inside, or intersecting the culling volume. - contentVisibility () { + contentVisibility() { return !0; } - /** * Computes the (potentially approximate) distance from the closest point of the tile's bounding volume to the camera. * @param frameState The frame state. * @returns {Number} The distance, in meters, or zero if the camera is inside the bounding volume. */ - distanceToTile (t) { + distanceToTile(t) { const n = this.boundingVolume; return Math.sqrt(Math.max(n.distanceSquaredTo(t.camera.position), 0)); } - /** * Computes the tile's camera-space z-depth. * @param frameState The frame state. * @returns The distance, in meters. */ - cameraSpaceZDepth ({ camera: t }) { + cameraSpaceZDepth({ camera: t }) { const n = this.boundingVolume; return vo.subVectors(n.center, t.position), t.direction.dot(vo); } - /** * Checks if the camera is inside the viewer request volume. * @param {FrameState} frameState The frame state. * @returns {Boolean} Whether the camera is inside the volume. */ - insideViewerRequestVolume (t) { + insideViewerRequestVolume(t) { const n = this._viewerRequestVolume; return !n || n.distanceSquaredTo(t.camera.position) <= 0; } - // TODO Cesium specific // Update whether the tile has expired. - updateExpiration () { + updateExpiration() { if (EB(this._expireDate) && this.contentReady && !this.hasEmptyContent) { const t = Date.now(); Date.lessThan(this._expireDate, t) && (this.contentState = lt.EXPIRED, this._expiredContent = this.content); } } - - get extras () { + get extras() { return this.header.extras; } - // INTERNAL METHODS - _initializeLodMetric (t) { - 'lodMetricType' in t ? this.lodMetricType = t.lodMetricType : (this.lodMetricType = this.parent && this.parent.lodMetricType || this.tileset.lodMetricType, console.warn('3D Tile: Required prop lodMetricType is undefined. Using parent lodMetricType')), 'lodMetricValue' in t ? this.lodMetricValue = t.lodMetricValue : (this.lodMetricValue = this.parent && this.parent.lodMetricValue || this.tileset.lodMetricValue, console.warn('3D Tile: Required prop lodMetricValue is undefined. Using parent lodMetricValue')); + _initializeLodMetric(t) { + "lodMetricType" in t ? this.lodMetricType = t.lodMetricType : (this.lodMetricType = this.parent && this.parent.lodMetricType || this.tileset.lodMetricType, console.warn("3D Tile: Required prop lodMetricType is undefined. Using parent lodMetricType")), "lodMetricValue" in t ? this.lodMetricValue = t.lodMetricValue : (this.lodMetricValue = this.parent && this.parent.lodMetricValue || this.tileset.lodMetricValue, console.warn("3D Tile: Required prop lodMetricValue is undefined. Using parent lodMetricValue")); } - - _initializeTransforms (t) { + _initializeTransforms(t) { this.transform = t.transform ? new V(t.transform) : new V(); - const n = this.parent; const s = this.tileset; const r = n && n.computedTransform ? n.computedTransform.clone() : s.modelMatrix.clone(); + const n = this.parent, s = this.tileset, r = n && n.computedTransform ? n.computedTransform.clone() : s.modelMatrix.clone(); this.computedTransform = new V(r).multiplyRight(this.transform); const i = n && n._initialTransform ? n._initialTransform.clone() : new V(); this._initialTransform = new V(i).multiplyRight(this.transform); } - - _initializeBoundingVolumes (t) { + _initializeBoundingVolumes(t) { this._contentBoundingVolume = null, this._viewerRequestVolume = null, this._updateBoundingVolume(t); } - - _initializeContent (t) { + _initializeContent(t) { this.content = { _tileset: this.tileset, _tile: this }, this.hasEmptyContent = !0, this.contentState = lt.UNLOADED, this.hasTilesetContent = !1, t.contentUrl && (this.content = null, this.hasEmptyContent = !1); } - // TODO - remove anything not related to basic visibility detection - _initializeRenderingState (t) { + _initializeRenderingState(t) { this.depth = t.level || (this.parent ? this.parent.depth + 1 : 0), this._shouldRefine = !1, this._distanceToCamera = 0, this._centerZDepth = 0, this._screenSpaceError = 0, this._visibilityPlaneMask = dt.MASK_INDETERMINATE, this._visible = void 0, this._inRequestVolume = !1, this._stackLength = 0, this._selectionDepth = 0, this._frameNumber = 0, this._touchedFrame = 0, this._visitedFrame = 0, this._selectedFrame = 0, this._requestedFrame = 0, this._priority = 0; } - - _getRefine (t) { + _getRefine(t) { return t || this.parent && this.parent.refine || Ht.REPLACE; } - - _isTileset () { - return this.contentUrl.indexOf('.json') !== -1; + _isTileset() { + return this.contentUrl.indexOf(".json") !== -1; } - - _onContentLoaded () { + _onContentLoaded() { switch (this.content && this.content.type) { - case 'vctr': - case 'geom': + case "vctr": + case "geom": this.tileset._traverser.disableSkipLevelOfDetail = !0; break; } this._isTileset() ? this.hasTilesetContent = !0 : this.gpuMemoryUsageInBytes = this._getGpuMemoryUsageInBytes(); } - - _updateBoundingVolume (t) { + _updateBoundingVolume(t) { this.boundingVolume = Os(t.boundingVolume, this.computedTransform, this.boundingVolume); const n = t.content; n && (n.boundingVolume && (this._contentBoundingVolume = Os(n.boundingVolume, this.computedTransform, this._contentBoundingVolume)), t.viewerRequestVolume && (this._viewerRequestVolume = Os(t.viewerRequestVolume, this.computedTransform, this._viewerRequestVolume))); } - // Update the tile's transform. The transform is applied to the tile's bounding volumes. - _updateTransform (t = new V()) { + _updateTransform(t = new V()) { const n = t.clone().multiplyRight(this.transform); n.equals(this.computedTransform) || (this.computedTransform = n, this._updateBoundingVolume(this.header)); } - // Get options which are applicable only for the particular loader - _getLoaderSpecificOptions (t) { + _getLoaderSpecificOptions(t) { switch (t) { - case 'i3s': + case "i3s": return { ...this.tileset.options.i3s, _tileOptions: { @@ -12013,20 +11716,20 @@ class ur { }, isTileHeader: !1 }; - case '3d-tiles': - case 'cesium-ion': + case "3d-tiles": + case "cesium-ion": default: return BB(this.tileset.tileset); } } } class TB extends ts { - compareDistanceToCamera (t, n) { + compareDistanceToCamera(t, n) { return n._distanceToCamera === 0 && t._distanceToCamera === 0 ? n._centerZDepth - t._centerZDepth : n._distanceToCamera - t._distanceToCamera; } - - updateTileVisibility (t, n) { - if (super.updateTileVisibility(t, n), !t.isVisibleAndInRequestVolume) { return; } + updateTileVisibility(t, n) { + if (super.updateTileVisibility(t, n), !t.isVisibleAndInRequestVolume) + return; const s = t.children.length > 0; if (t.hasTilesetContent && s) { const o = t.children[0]; @@ -12037,67 +11740,64 @@ class TB extends ts { t._visible = !1; return; } - const r = t.refine === Ht.REPLACE; const i = t._optimChildrenWithinParent === oB.USE_OPTIMIZATION; + const r = t.refine === Ht.REPLACE, i = t._optimChildrenWithinParent === oB.USE_OPTIMIZATION; if (r && i && s && !this.anyChildrenVisible(t, n)) { t._visible = !1; + return; } } - - meetsScreenSpaceErrorEarly (t, n) { + meetsScreenSpaceErrorEarly(t, n) { const { parent: s } = t; return !s || s.hasTilesetContent || s.refine !== Ht.ADD ? !1 : !this.shouldRefine(t, n, !0); } } class bB { - constructor () { - p(this, 'frameNumberMap', /* @__PURE__ */ new Map()); + constructor() { + p(this, "frameNumberMap", /* @__PURE__ */ new Map()); } - /** * Register a new pending tile header for the particular frameNumber * @param viewportId * @param frameNumber */ - register (t, n) { - const s = this.frameNumberMap.get(t) || /* @__PURE__ */ new Map(); const r = s.get(n) || 0; + register(t, n) { + const s = this.frameNumberMap.get(t) || /* @__PURE__ */ new Map(), r = s.get(n) || 0; s.set(n, r + 1), this.frameNumberMap.set(t, s); } - /** * Deregister a pending tile header for the particular frameNumber * @param viewportId * @param frameNumber */ - deregister (t, n) { + deregister(t, n) { const s = this.frameNumberMap.get(t); - if (!s) { return; } + if (!s) + return; const r = s.get(n) || 1; s.set(n, r - 1); } - /** * Check is there are no pending tile headers registered for the particular frameNumber * @param viewportId * @param frameNumber * @returns */ - isZero (t, n) { - let r; + isZero(t, n) { + var r; return (((r = this.frameNumberMap.get(t)) == null ? void 0 : r.get(n)) || 0) === 0; } } const Ls = { - REQUESTED: 'REQUESTED', - COMPLETED: 'COMPLETED', - ERROR: 'ERROR' + REQUESTED: "REQUESTED", + COMPLETED: "COMPLETED", + ERROR: "ERROR" }; class _B { - constructor () { - p(this, '_statusMap'); - p(this, 'pendingTilesRegister', new bB()); + constructor() { + p(this, "_statusMap"); + p(this, "pendingTilesRegister", new bB()); this._statusMap = {}; } - /** * Add request to map * @param request - node metadata request @@ -12105,7 +11805,7 @@ class _B { * @param callback - callback after request completed * @param frameState - frameState data */ - add (t, n, s, r) { + add(t, n, s, r) { if (!this._statusMap[n]) { const { frameNumber: i, viewport: { id: o } } = r; this._statusMap[n] = { request: t, callback: s, key: n, frameState: r, status: Ls.REQUESTED }, this.pendingTilesRegister.register(o, i), t().then((a) => { @@ -12119,13 +11819,12 @@ class _B { }); } } - /** * Update request if it is still actual for the new frameState * @param key - unique key * @param frameState - frameState data */ - update (t, n) { + update(t, n) { if (this._statusMap[t]) { const { frameNumber: s, viewport: { id: r } } = this._statusMap[t].frameState; this.pendingTilesRegister.deregister(r, s); @@ -12133,60 +11832,56 @@ class _B { this.pendingTilesRegister.register(o, i), this._statusMap[t].frameState = n; } } - /** * Find request in the map * @param key - unique key * @returns */ - find (t) { + find(t) { return this._statusMap[t]; } - /** * Check it there are pending tile headers for the particular frameNumber * @param viewportId * @param frameNumber * @returns */ - hasPendingTiles (t, n) { + hasPendingTiles(t, n) { return !this.pendingTilesRegister.isZero(t, n); } } class wB extends ts { - constructor (n) { + constructor(n) { super(n); - p(this, '_tileManager'); + p(this, "_tileManager"); this._tileManager = new _B(); } - /** * Check if there are no penging tile header requests, * that means the traversal is finished and we can call * following-up callbacks. */ - traversalFinished (n) { + traversalFinished(n) { return !this._tileManager.hasPendingTiles(n.viewport.id, this._frameNumber || 0); } - - shouldRefine (n, s) { - return n._lodJudge = yB(n, s), n._lodJudge === 'DIG'; + shouldRefine(n, s) { + return n._lodJudge = yB(n, s), n._lodJudge === "DIG"; } - - updateChildTiles (n, s) { - const r = n.header.children || []; const i = n.children; const o = n.tileset; + updateChildTiles(n, s) { + const r = n.header.children || [], i = n.children, o = n.tileset; for (const a of r) { - const c = `${a.id}-${s.viewport.id}`; const u = i && i.find((l) => l.id === c); - if (u) { u && this.updateTile(u, s); } else { + const c = `${a.id}-${s.viewport.id}`, u = i && i.find((l) => l.id === c); + if (u) + u && this.updateTile(u, s); + else { let l = () => this._loadTile(a.id, o); this._tileManager.find(c) ? this._tileManager.update(c, s) : (o.tileset.nodePages && (l = () => o.tileset.nodePagesTile.formTileFromNodePages(a.id)), this._tileManager.add(l, c, (f) => this._onTileLoad(f, n, c), s)); } } return !1; } - - async _loadTile (n, s) { - const { loader: r } = s; const i = s.getTileUrl(`${s.url}/nodes/${n}`); const o = { + async _loadTile(n, s) { + const { loader: r } = s, i = s.getTileUrl(`${s.url}/nodes/${n}`), o = { ...s.loadOptions, i3s: { ...s.loadOptions.i3s, @@ -12195,7 +11890,6 @@ class wB extends ts { }; return await Ae(i, r, o); } - /** * The callback to init Tile3D instance after loading the tile JSON * @param {Object} header - the tile JSON from a dataset @@ -12204,7 +11898,7 @@ class wB extends ts { * const extendedId = `${tile.id}-${frameState.viewport.id}`; * @return {void} */ - _onTileLoad (n, s, r) { + _onTileLoad(n, s, r) { const i = new ur(s.tileset, n, s, r); s.children.push(i); const o = this._tileManager.find(i.id).frameState; @@ -12212,7 +11906,7 @@ class wB extends ts { } } const RB = { - description: '', + description: "", ellipsoid: J.WGS84, modelMatrix: new V(), throttleRequests: !0, @@ -12238,9 +11932,9 @@ const RB = { viewportTraversersMap: null, loadOptions: { fetch: {} }, attributions: [], - basePath: '', + basePath: "", i3s: {} -}; const Cn = 'Tiles In Tileset(s)'; const Ps = 'Tiles In Memory'; const Oo = 'Tiles In View'; const Fo = 'Tiles To Render'; const Do = 'Tiles Loaded'; const Gs = 'Tiles Loading'; const Lo = 'Tiles Unloaded'; const Po = 'Failed Tile Loads'; const Go = 'Points/Vertices'; const Ns = 'Tile Memory Use'; const No = 'Maximum Screen Space Error'; +}, Cn = "Tiles In Tileset(s)", Ps = "Tiles In Memory", Oo = "Tiles In View", Fo = "Tiles To Render", Do = "Tiles Loaded", Gs = "Tiles Loading", Lo = "Tiles Unloaded", Po = "Failed Tile Loads", Go = "Points/Vertices", Ns = "Tile Memory Use", No = "Maximum Screen Space Error"; class MB { /** * Create a new Tileset3D @@ -12248,111 +11942,104 @@ class MB { * @param props */ // eslint-disable-next-line max-statements - constructor (t, n) { + constructor(t, n) { // props: Tileset3DProps; - p(this, 'options'); - p(this, 'loadOptions'); - p(this, 'type'); - p(this, 'tileset'); - p(this, 'loader'); - p(this, 'url'); - p(this, 'basePath'); - p(this, 'modelMatrix'); - p(this, 'ellipsoid'); - p(this, 'lodMetricType'); - p(this, 'lodMetricValue'); - p(this, 'refine'); - p(this, 'root', null); - p(this, 'roots', {}); + p(this, "options"); + p(this, "loadOptions"); + p(this, "type"); + p(this, "tileset"); + p(this, "loader"); + p(this, "url"); + p(this, "basePath"); + p(this, "modelMatrix"); + p(this, "ellipsoid"); + p(this, "lodMetricType"); + p(this, "lodMetricValue"); + p(this, "refine"); + p(this, "root", null); + p(this, "roots", {}); /** @todo any->unknown */ - p(this, 'asset', {}); + p(this, "asset", {}); // Metadata for the entire tileset - p(this, 'description', ''); - p(this, 'properties'); - p(this, 'extras', null); - p(this, 'attributions', {}); - p(this, 'credits', {}); - p(this, 'stats'); + p(this, "description", ""); + p(this, "properties"); + p(this, "extras", null); + p(this, "attributions", {}); + p(this, "credits", {}); + p(this, "stats"); /** flags that contain information about data types in nested tiles */ - p(this, 'contentFormats', { draco: !1, meshopt: !1, dds: !1, ktx2: !1 }); + p(this, "contentFormats", { draco: !1, meshopt: !1, dds: !1, ktx2: !1 }); // view props - p(this, 'cartographicCenter', null); - p(this, 'cartesianCenter', null); - p(this, 'zoom', 1); - p(this, 'boundingVolume', null); + p(this, "cartographicCenter", null); + p(this, "cartesianCenter", null); + p(this, "zoom", 1); + p(this, "boundingVolume", null); /** Updated based on the camera position and direction */ - p(this, 'dynamicScreenSpaceErrorComputedDensity', 0); + p(this, "dynamicScreenSpaceErrorComputedDensity", 0); // METRICS /** * The maximum amount of GPU memory (in MB) that may be used to cache tiles * Tiles not in view are unloaded to enforce private */ - p(this, 'maximumMemoryUsage', 32); + p(this, "maximumMemoryUsage", 32); /** The total amount of GPU memory in bytes used by the tileset. */ - p(this, 'gpuMemoryUsageInBytes', 0); + p(this, "gpuMemoryUsageInBytes", 0); /** * If loading the level of detail required by maximumScreenSpaceError * results in the memory usage exceeding maximumMemoryUsage (GPU), level of detail refinement * will instead use this (larger) adjusted screen space error to achieve the * best possible visual quality within the available memory. */ - p(this, 'memoryAdjustedScreenSpaceError', 0); - p(this, '_cacheBytes', 0); - p(this, '_cacheOverflowBytes', 0); + p(this, "memoryAdjustedScreenSpaceError", 0); + p(this, "_cacheBytes", 0); + p(this, "_cacheOverflowBytes", 0); /** Update tracker. increase in each update cycle. */ - p(this, '_frameNumber', 0); - p(this, '_queryParams', {}); - p(this, '_extensionsUsed', []); - p(this, '_tiles', {}); + p(this, "_frameNumber", 0); + p(this, "_queryParams", {}); + p(this, "_extensionsUsed", []); + p(this, "_tiles", {}); /** counter for tracking tiles requests */ - p(this, '_pendingCount', 0); + p(this, "_pendingCount", 0); /** Hold traversal results */ - p(this, 'selectedTiles', []); + p(this, "selectedTiles", []); // TRAVERSAL - p(this, 'traverseCounter', 0); - p(this, 'geometricError', 0); - p(this, 'lastUpdatedVieports', null); - p(this, '_requestedTiles', []); - p(this, '_emptyTiles', []); - p(this, 'frameStateData', {}); - p(this, '_traverser'); - p(this, '_cache', new qy()); - p(this, '_requestScheduler'); + p(this, "traverseCounter", 0); + p(this, "geometricError", 0); + p(this, "lastUpdatedVieports", null); + p(this, "_requestedTiles", []); + p(this, "_emptyTiles", []); + p(this, "frameStateData", {}); + p(this, "_traverser"); + p(this, "_cache", new qy()); + p(this, "_requestScheduler"); // Promise tracking - p(this, 'updatePromise', null); - p(this, 'tilesetInitializationPromise'); + p(this, "updatePromise", null); + p(this, "tilesetInitializationPromise"); this.options = { ...RB, ...n }, this.tileset = t, this.loader = t.loader, this.type = t.type, this.url = t.url, this.basePath = t.basePath || Wy(this.url), this.modelMatrix = this.options.modelMatrix, this.ellipsoid = this.options.ellipsoid, this.lodMetricType = t.lodMetricType, this.lodMetricValue = t.lodMetricValue, this.refine = t.root.refine, this.loadOptions = this.options.loadOptions || {}, this._traverser = this._initializeTraverser(), this._requestScheduler = new zy({ throttleRequests: this.options.throttleRequests, maxRequests: this.options.maxRequests }), this.memoryAdjustedScreenSpaceError = this.options.maximumScreenSpaceError, this._cacheBytes = this.options.maximumMemoryUsage * 1024 * 1024, this._cacheOverflowBytes = this.options.memoryCacheOverflow * 1024 * 1024, this.stats = new $o({ id: this.url }), this._initializeStats(), this.tilesetInitializationPromise = this._initializeTileSet(t); } - /** Release resources */ - destroy () { + destroy() { this._destroy(); } - /** Is the tileset loaded (update needs to have been called at least once) */ - isLoaded () { + isLoaded() { return this._pendingCount === 0 && this._frameNumber !== 0 && this._requestedTiles.length === 0; } - - get tiles () { + get tiles() { return Object.values(this._tiles); } - - get frameNumber () { + get frameNumber() { return this._frameNumber; } - - get queryParams () { + get queryParams() { return new URLSearchParams(this._queryParams).toString(); } - - setProps (t) { + setProps(t) { this.options = { ...this.options, ...t }; } - /** @deprecated */ // setOptions(options: Tileset3DProps): void { // this.options = {...this.options, ...options}; @@ -12361,53 +12048,50 @@ class MB { * Return a loadable tile url for a specific tile subpath * @param tilePath a tile subpath */ - getTileUrl (t) { - if (t.startsWith('data:')) { return t; } + getTileUrl(t) { + if (t.startsWith("data:")) + return t; let s = t; - return this.queryParams.length && (s = `${t}${t.includes('?') ? '&' : '?'}${this.queryParams}`), s; + return this.queryParams.length && (s = `${t}${t.includes("?") ? "&" : "?"}${this.queryParams}`), s; } - // TODO CESIUM specific - hasExtension (t) { + hasExtension(t) { return this._extensionsUsed.indexOf(t) > -1; } - /** * Update visible tiles relying on a list of viewports * @param viewports - list of viewports * @deprecated */ - update (t = null) { + update(t = null) { this.tilesetInitializationPromise.then(() => { !t && this.lastUpdatedVieports ? t = this.lastUpdatedVieports : this.lastUpdatedVieports = t, t && this.doUpdate(t); }); } - /** * Update visible tiles relying on a list of viewports. * Do it with debounce delay to prevent update spam * @param viewports viewports * @returns Promise of new frameNumber */ - async selectTiles (t = null) { + async selectTiles(t = null) { return await this.tilesetInitializationPromise, t && (this.lastUpdatedVieports = t), this.updatePromise || (this.updatePromise = new Promise((n) => { setTimeout(() => { this.lastUpdatedVieports && this.doUpdate(this.lastUpdatedVieports), n(this._frameNumber), this.updatePromise = null; }, this.options.debounceTime); })), this.updatePromise; } - - adjustScreenSpaceError () { + adjustScreenSpaceError() { this.gpuMemoryUsageInBytes < this._cacheBytes ? this.memoryAdjustedScreenSpaceError = Math.max(this.memoryAdjustedScreenSpaceError / 1.02, this.options.maximumScreenSpaceError) : this.gpuMemoryUsageInBytes > this._cacheBytes + this._cacheOverflowBytes && (this.memoryAdjustedScreenSpaceError *= 1.02); } - /** * Update visible tiles relying on a list of viewports * @param viewports viewports */ // eslint-disable-next-line max-statements, complexity - doUpdate (t) { - if ('loadTiles' in this.options && !this.options.loadTiles || this.traverseCounter > 0) { return; } + doUpdate(t) { + if ("loadTiles" in this.options && !this.options.loadTiles || this.traverseCounter > 0) + return; const n = t instanceof Array ? t : [t]; this._cache.reset(), this._frameNumber++, this.traverseCounter = n.length; const s = []; @@ -12417,82 +12101,79 @@ class MB { } for (const r of n) { const i = r.id; - if (this.roots[i] || (this.roots[i] = this._initializeTileHeaders(this.tileset, null)), !s.includes(i)) { continue; } + if (this.roots[i] || (this.roots[i] = this._initializeTileHeaders(this.tileset, null)), !s.includes(i)) + continue; const o = $y(r, this._frameNumber); this._traverser.traverse(this.roots[i], o, this.options); } } - /** * Check if traversal is needed for particular viewport * @param {string} viewportId - id of a viewport * @return {boolean} */ - _needTraverse (t) { + _needTraverse(t) { let n = t; return this.options.viewportTraversersMap && (n = this.options.viewportTraversersMap[t]), n === t; } - /** * The callback to post-process tiles after traversal procedure * @param frameState - frame state for tile culling */ - _onTraversalEnd (t) { + _onTraversalEnd(t) { const n = t.viewport.id; this.frameStateData[n] || (this.frameStateData[n] = { selectedTiles: [], _requestedTiles: [], _emptyTiles: [] }); - const s = this.frameStateData[n]; const r = Object.values(this._traverser.selectedTiles); const [i, o] = Zy(r, t, this.options.maximumTilesSelected); + const s = this.frameStateData[n], r = Object.values(this._traverser.selectedTiles), [i, o] = Zy(r, t, this.options.maximumTilesSelected); s.selectedTiles = i; - for (const a of o) { a.unselect(); } + for (const a of o) + a.unselect(); s._requestedTiles = Object.values(this._traverser.requestedTiles), s._emptyTiles = Object.values(this._traverser.emptyTiles), this.traverseCounter--, !(this.traverseCounter > 0) && this._updateTiles(); } - /** * Update tiles relying on data from all traversers */ - _updateTiles () { + _updateTiles() { this.selectedTiles = [], this._requestedTiles = [], this._emptyTiles = []; for (const t in this.frameStateData) { const n = this.frameStateData[t]; this.selectedTiles = this.selectedTiles.concat(n.selectedTiles), this._requestedTiles = this._requestedTiles.concat(n._requestedTiles), this._emptyTiles = this._emptyTiles.concat(n._emptyTiles); } this.selectedTiles = this.options.onTraversalComplete(this.selectedTiles); - for (const t of this.selectedTiles) { this._tiles[t.id] = t; } + for (const t of this.selectedTiles) + this._tiles[t.id] = t; this._loadTiles(), this._unloadTiles(), this._updateStats(); } - - _tilesChanged (t, n) { - if (t.length !== n.length) { return !0; } - const s = new Set(t.map((o) => o.id)); const r = new Set(n.map((o) => o.id)); + _tilesChanged(t, n) { + if (t.length !== n.length) + return !0; + const s = new Set(t.map((o) => o.id)), r = new Set(n.map((o) => o.id)); let i = t.filter((o) => !r.has(o.id)).length > 0; return i = i || n.filter((o) => !s.has(o.id)).length > 0, i; } - - _loadTiles () { - for (const t of this._requestedTiles) { t.contentUnloaded && this._loadTile(t); } + _loadTiles() { + for (const t of this._requestedTiles) + t.contentUnloaded && this._loadTile(t); } - - _unloadTiles () { + _unloadTiles() { this._cache.unloadTiles(this, (t, n) => t._unloadTile(n)); } - - _updateStats () { - let t = 0; let n = 0; - for (const s of this.selectedTiles) { s.contentAvailable && s.content && (t++, s.content.pointCount ? n += s.content.pointCount : n += s.content.vertexCount); } + _updateStats() { + let t = 0, n = 0; + for (const s of this.selectedTiles) + s.contentAvailable && s.content && (t++, s.content.pointCount ? n += s.content.pointCount : n += s.content.vertexCount); this.stats.get(Oo).count = this.selectedTiles.length, this.stats.get(Fo).count = t, this.stats.get(Go).count = n, this.stats.get(No).count = this.memoryAdjustedScreenSpaceError; } - - async _initializeTileSet (t) { + async _initializeTileSet(t) { this.type === At.I3S && (this.calculateViewPropsI3S(), t.root = await t.root), this.root = this._initializeTileHeaders(t, null), this.type === At.TILES3D && (this._initializeTiles3DTileset(t), this.calculateViewPropsTiles3D()), this.type === At.I3S && this._initializeI3STileset(); } - /** * Called during initialize Tileset to initialize the tileset's cartographic center (longitude, latitude) and zoom. * These metrics help apps center view on tileset * For I3S there is extent (<1.8 version) or fullExtent (>=1.8 version) to calculate view props * @returns */ - calculateViewPropsI3S () { - let s; + calculateViewPropsI3S() { + var s; const t = this.tileset.fullExtent; if (t) { const { xmin: r, xmax: i, ymin: o, ymax: a, zmin: c, zmax: u } = t; @@ -12505,43 +12186,40 @@ class MB { this.cartographicCenter = new A(r + (o - r) / 2, i + (a - i) / 2, 0), this.cartesianCenter = new A(), J.WGS84.cartographicToCartesian(this.cartographicCenter, this.cartesianCenter), this.zoom = rB(n, this.cartographicCenter, this.cartesianCenter); return; } - console.warn('Extent is not defined in the tileset header'), this.cartographicCenter = new A(), this.zoom = 1; + console.warn("Extent is not defined in the tileset header"), this.cartographicCenter = new A(), this.zoom = 1; } - /** * Called during initialize Tileset to initialize the tileset's cartographic center (longitude, latitude) and zoom. * These metrics help apps center view on tileset. * For 3DTiles the root tile data is used to calculate view props. * @returns */ - calculateViewPropsTiles3D () { - const t = this.root; const { center: n } = t.boundingVolume; + calculateViewPropsTiles3D() { + const t = this.root, { center: n } = t.boundingVolume; if (!n) { - console.warn('center was not pre-calculated for the root tile'), this.cartographicCenter = new A(), this.zoom = 1; + console.warn("center was not pre-calculated for the root tile"), this.cartographicCenter = new A(), this.zoom = 1; return; } n[0] !== 0 || n[1] !== 0 || n[2] !== 0 ? (this.cartographicCenter = new A(), J.WGS84.cartesianToCartographic(n, this.cartographicCenter)) : this.cartographicCenter = new A(0, 0, -J.WGS84.radii[0]), this.cartesianCenter = n, this.zoom = sB(t.boundingVolume, this.cartographicCenter); } - - _initializeStats () { - this.stats.get(Cn), this.stats.get(Gs), this.stats.get(Ps), this.stats.get(Oo), this.stats.get(Fo), this.stats.get(Do), this.stats.get(Lo), this.stats.get(Po), this.stats.get(Go), this.stats.get(Ns, 'memory'), this.stats.get(No); + _initializeStats() { + this.stats.get(Cn), this.stats.get(Gs), this.stats.get(Ps), this.stats.get(Oo), this.stats.get(Fo), this.stats.get(Do), this.stats.get(Lo), this.stats.get(Po), this.stats.get(Go), this.stats.get(Ns, "memory"), this.stats.get(No); } - // Installs the main tileset JSON file or a tileset JSON file referenced from a tile. // eslint-disable-next-line max-statements - _initializeTileHeaders (t, n) { - let r; + _initializeTileHeaders(t, n) { + var r; const s = new ur(this, t.root, n); if (n && (n.children.push(s), s.depth = n.depth + 1), this.type === At.TILES3D) { const i = []; - for (i.push(s); i.length > 0;) { + for (i.push(s); i.length > 0; ) { const o = i.pop(); this.stats.get(Cn).incrementCount(); const a = o.header.children || []; for (const c of a) { const u = new ur(this, c, o); - if ((r = u.contentUrl) != null && r.includes('?session=')) { - const h = new URL(u.contentUrl).searchParams.get('session'); + if ((r = u.contentUrl) != null && r.includes("?session=")) { + const h = new URL(u.contentUrl).searchParams.get("session"); h && (this._queryParams.session = h); } o.children.push(u), u.depth = o.depth + 1, i.push(u); @@ -12550,8 +12228,7 @@ class MB { } return s; } - - _initializeTraverser () { + _initializeTraverser() { let t; switch (this.type) { case At.TILES3D: @@ -12568,30 +12245,26 @@ class MB { onTraversalEnd: this._onTraversalEnd.bind(this) }); } - - _destroyTileHeaders (t) { + _destroyTileHeaders(t) { this._destroySubtree(t); } - - async _loadTile (t) { + async _loadTile(t) { let n; try { this._onStartTileLoading(), n = await t.loadContent(); } catch (s) { - this._onTileLoadError(t, s instanceof Error ? s : new Error('load failed')); + this._onTileLoadError(t, s instanceof Error ? s : new Error("load failed")); } finally { this._onEndTileLoading(), this._onTileLoad(t, n); } } - - _onTileLoadError (t, n) { + _onTileLoadError(t, n) { this.stats.get(Po).incrementCount(); - const s = n.message || n.toString(); const r = t.url; + const s = n.message || n.toString(), r = t.url; console.error(`A 3D tile failed to load: ${t.url} ${s}`), this.options.onTileError(t, s, r); } - - _onTileLoad (t, n) { - let s, r; + _onTileLoad(t, n) { + var s, r; if (n) { if (this.type === At.I3S) { const i = ((r = (s = this.tileset) == null ? void 0 : s.nodePagesTile) == null ? void 0 : r.nodesInNodePages) || 0; @@ -12600,91 +12273,84 @@ class MB { t && t.content && Yy(t, t.content), this.updateContentTypes(t), this._addTileToCache(t), this.options.onTileLoad(t); } } - /** * Update information about data types in nested tiles * @param tile instance of a nested Tile3D */ - updateContentTypes (t) { - let n; - if (this.type === At.I3S) { + updateContentTypes(t) { + var n; + if (this.type === At.I3S) switch (t.header.isDracoGeometry && (this.contentFormats.draco = !0), t.header.textureFormat) { - case 'dds': + case "dds": this.contentFormats.dds = !0; break; - case 'ktx2': + case "ktx2": this.contentFormats.ktx2 = !0; break; } - } else if (this.type === At.TILES3D) { + else if (this.type === At.TILES3D) { const { extensionsRemoved: s = [] } = ((n = t.content) == null ? void 0 : n.gltf) || {}; - s.includes('KHR_draco_mesh_compression') && (this.contentFormats.draco = !0), s.includes('EXT_meshopt_compression') && (this.contentFormats.meshopt = !0), s.includes('KHR_texture_basisu') && (this.contentFormats.ktx2 = !0); + s.includes("KHR_draco_mesh_compression") && (this.contentFormats.draco = !0), s.includes("EXT_meshopt_compression") && (this.contentFormats.meshopt = !0), s.includes("KHR_texture_basisu") && (this.contentFormats.ktx2 = !0); } } - - _onStartTileLoading () { + _onStartTileLoading() { this._pendingCount++, this.stats.get(Gs).incrementCount(); } - - _onEndTileLoading () { + _onEndTileLoading() { this._pendingCount--, this.stats.get(Gs).decrementCount(); } - - _addTileToCache (t) { + _addTileToCache(t) { this._cache.add(this, t, (n) => n._updateCacheStats(t)); } - - _updateCacheStats (t) { + _updateCacheStats(t) { this.stats.get(Do).incrementCount(), this.stats.get(Ps).incrementCount(), this.gpuMemoryUsageInBytes += t.gpuMemoryUsageInBytes || 0, this.stats.get(Ns).count = this.gpuMemoryUsageInBytes, this.options.memoryAdjustedScreenSpaceError && this.adjustScreenSpaceError(); } - - _unloadTile (t) { + _unloadTile(t) { this.gpuMemoryUsageInBytes -= t.gpuMemoryUsageInBytes || 0, this.stats.get(Ps).decrementCount(), this.stats.get(Lo).incrementCount(), this.stats.get(Ns).count = this.gpuMemoryUsageInBytes, this.options.onTileUnload(t), t.unloadContent(); } - // Traverse the tree and destroy all tiles - _destroy () { + _destroy() { const t = []; - for (this.root && t.push(this.root); t.length > 0;) { + for (this.root && t.push(this.root); t.length > 0; ) { const n = t.pop(); - for (const s of n.children) { t.push(s); } + for (const s of n.children) + t.push(s); this._destroyTile(n); } this.root = null; } - // Traverse the tree and destroy all sub tiles - _destroySubtree (t) { - const n = t; const s = []; - for (s.push(n); s.length > 0;) { + _destroySubtree(t) { + const n = t, s = []; + for (s.push(n); s.length > 0; ) { t = s.pop(); - for (const r of t.children) { s.push(r); } + for (const r of t.children) + s.push(r); t !== n && this._destroyTile(t); } n.children = []; } - - _destroyTile (t) { + _destroyTile(t) { this._cache.unloadTile(this, t), this._unloadTile(t), t.destroy(); } - - _initializeTiles3DTileset (t) { + _initializeTiles3DTileset(t) { if (t.queryString) { - const n = new URLSearchParams(t.queryString); const s = Object.fromEntries(n.entries()); + const n = new URLSearchParams(t.queryString), s = Object.fromEntries(n.entries()); this._queryParams = { ...this._queryParams, ...s }; } - if (this.asset = t.asset, !this.asset) { throw new Error('Tileset must have an asset property.'); } - if (this.asset.version !== '0.0' && this.asset.version !== '1.0' && this.asset.version !== '1.1') { throw new Error('The tileset must be 3D Tiles version either 0.0 or 1.0 or 1.1.'); } - 'tilesetVersion' in this.asset && (this._queryParams.v = this.asset.tilesetVersion), this.credits = { + if (this.asset = t.asset, !this.asset) + throw new Error("Tileset must have an asset property."); + if (this.asset.version !== "0.0" && this.asset.version !== "1.0" && this.asset.version !== "1.1") + throw new Error("The tileset must be 3D Tiles version either 0.0 or 1.0 or 1.1."); + "tilesetVersion" in this.asset && (this._queryParams.v = this.asset.tilesetVersion), this.credits = { attributions: this.options.attributions || [] - }, this.description = this.options.description || '', this.properties = t.properties, this.geometricError = t.geometricError, this._extensionsUsed = t.extensionsUsed || [], this.extras = t.extras; + }, this.description = this.options.description || "", this.properties = t.properties, this.geometricError = t.geometricError, this._extensionsUsed = t.extensionsUsed || [], this.extras = t.extras; } - - _initializeI3STileset () { - this.loadOptions.i3s && 'token' in this.loadOptions.i3s && (this._queryParams.token = this.loadOptions.i3s.token); + _initializeI3STileset() { + this.loadOptions.i3s && "token" in this.loadOptions.i3s && (this._queryParams.token = this.loadOptions.i3s.token); } } -function SB (e) { +function SB(e) { let t = 0; for (const s in e.attributes) { const r = e.getAttribute(s); @@ -12693,41 +12359,41 @@ function SB (e) { const n = e.getIndex(); return t += n ? n.count * n.itemSize * n.array.BYTES_PER_ELEMENT : 0, t; } -function Pc (e) { - const n = document.createElement('canvas'); +function Pc(e) { + const n = document.createElement("canvas"); n.width = 64, n.height = 64; - const s = n.getContext('2d'); + const s = n.getContext("2d"); s.rect(0, 0, 64, 64); const r = s.createLinearGradient(0, 0, 64, 64); for (let o = 0; o < e.length; o++) { const a = e[o]; - r.addColorStop(a[0], '#' + a[1].getHexString()); + r.addColorStop(a[0], "#" + a[1].getHexString()); } s.fillStyle = r, s.fill(); const i = new Kc(n); return i.needsUpdate = !0, i.minFilter = zc, i.wrapS = kr, i.wrapT = kr, i.repeat.set(2, 2), i; } -function Uo (e) { +function Uo(e) { e.updateMatrix(), e.updateMatrixWorld(), e.matrixWorldInverse.copy(e.matrixWorld).invert(); const t = new Wc(); return t.setFromProjectionMatrix(new tt().multiplyMatrices(e.projectionMatrix, e.matrixWorldInverse)), t; } -function IB (e) { - const t = new En(); const n = new Xc(10, 5); const s = new rt(...e.projectPointOntoPlane([0, 0, 0])); const r = new rt(e.normal.x, e.normal.y, e.normal.z); const i = new rt().copy(s).add(r); +function IB(e) { + const t = new En(), n = new Xc(10, 5), s = new rt(...e.projectPointOntoPlane([0, 0, 0])), r = new rt(e.normal.x, e.normal.y, e.normal.z), i = new rt().copy(s).add(r); n.lookAt(i), n.translate(s.x, s.y, s.z); - const o = new Hs({ color: 65535, side: jo }); const a = new Js(n, o); const c = new Qc(r, s, 5, 16776960); + const o = new Hs({ color: 65535, side: jo }), a = new Js(n, o), c = new Qc(r, s, 5, 16776960); return t.add(c), t.add(a), t; } -function Ho (e) { +function Ho(e) { const { boundingVolume: t } = e; let n = 0; e.content && (n = Math.min(e.content.byteLength / 5e5, 1)); - const s = new w(n, 1, 0); const r = new qc(1, 1, 1); const i = new tt(); + const s = new w(n, 1, 0), r = new qc(1, 1, 1), i = new tt(); t.halfAxes ? i.copy(Gc(t.halfAxes)) : t.radius && r.scale(t.radius * 2, t.radius * 2, t.radius * 2), r.applyMatrix4(i); - const o = new Yc(r); const a = new $c(o, new Zc({ color: s })); + const o = new Yc(r), a = new $c(o, new Zc({ color: s })); return a.position.copy(new rt(...t.center)), a; } -function Gc (e) { +function Gc(e) { const t = e; return new tt().fromArray([ t[0] * 2, @@ -12748,27 +12414,30 @@ function Gc (e) { 1 ]); } -function xB (e, t) { - const r = 2 * Math.PI * 6378137 / 2; const i = t * r / 180; +function xB(e, t) { + const r = 2 * Math.PI * 6378137 / 2, i = t * r / 180; let o = Math.log(Math.tan((90 + e) * Math.PI / 360)) / (Math.PI / 180); return o = o * r / 180, new ko(i, o); } -function vB (e) { +function vB(e) { let t = 0; - if ((e == null ? void 0 : e.userData.mimeType) == 'image/ktx2' && e.mipmaps) { - for (let n = 0; n < e.mipmaps.length; n++) { t += e.mipmaps[n].data.byteLength; } + if ((e == null ? void 0 : e.userData.mimeType) == "image/ktx2" && e.mipmaps) { + for (let n = 0; n < e.mipmaps.length; n++) + t += e.mipmaps[n].data.byteLength; return t; } else if (e.image) { - const { image: n } = e; const s = 4; - const r = [n.width, n.height]; - for (; r[0] > 1 || r[1] > 1;) { t += r[0] * r[1] * s, r[0] = Math.max(Math.floor(r[0] / 2), 1), r[1] = Math.max(Math.floor(r[1] / 2), 1); } + const { image: n } = e, s = 4; + let r = [n.width, n.height]; + for (; r[0] > 1 || r[1] > 1; ) + t += r[0] * r[1] * s, r[0] = Math.max(Math.floor(r[0] / 2), 1), r[1] = Math.max(Math.floor(r[1] / 2), 1); return t += 1 * 1 * s, t; - } else {} + } else + return; } -function Nc (e) { +function Nc(e) { return SB(e); } -let ht = null; let Mt = null; let Jn = null; let Mn = null; +let ht = null, Mt = null, Jn = null, Mn = null; const Jo = { minHeight: 0, maxHeight: 300, @@ -12777,21 +12446,21 @@ const Jo = { opacity: 0.5, blendingType: hr }; -function OB (e, t, n, s = Jo) { +function OB(e, t, n, s = Jo) { ht && ht.dispose(), Mt || (Mt = n); const r = { ...Jo, ...s }; ht = new tu(e.width * e.devicePixelRatio, e.height * e.devicePixelRatio), ht.texture.minFilter = Kr, ht.texture.magFilter = Kr, ht.stencilBuffer = !1, ht.texture.format = eu, ht.texture.type = nu, Mt.setPixelRatio(devicePixelRatio), Mt.setSize(e.width, e.height), Mt.setRenderTarget(ht), Jn = new su(), Jn.overrideMaterial = LB, Mn = t, kt.uniforms.tPosition.value = ht.texture, kt.uniforms.minHeight.value = r.minHeight, kt.uniforms.maxHeight.value = r.maxHeight, kt.uniforms.samples.value = r.samples, kt.uniforms.sampleStep.value = r.sampleStep, kt.uniforms.opacity.value = r.opacity, kt.blending = r.blendingType; } -function FB (e) { +function FB(e) { ht.setSize(e.width * e.devicePixelRatio, e.height * e.devicePixelRatio), Mt.setPixelRatio(devicePixelRatio), Mt.setSize(e.width, e.height); } -function DB (e) { +function DB(e) { if (Mt) { const t = Mn.parent; Jn.add(Mn), Mt.setRenderTarget(ht), Mt.render(Jn, e), t && t.add(Mn), Mt.setRenderTarget(null); } } -const Vn = (e) => e.toString(); const LB = new lr({ +const Vn = (e) => e.toString(), LB = new lr({ vertexShader: Vn` varying vec3 vPosition; void main() { @@ -12806,7 +12475,7 @@ const Vn = (e) => e.toString(); const LB = new lr({ } `, side: jo -}); const PB = Vn` +}), PB = Vn` #include varying vec2 vUv; @@ -12879,14 +12548,14 @@ const Vn = (e) => e.toString(); const LB = new lr({ vec4 finalPosition = projectionMatrix * viewMatrix * outputVertex; gl_Position = finalPosition; } -`; const GB = Vn` +`, GB = Vn` varying vec3 vColor; uniform float opacity; void main() { gl_FragColor = vec4(vColor, opacity); } -`; const kt = new lr({ +`, kt = new lr({ vertexShader: PB, fragmentShader: GB, uniforms: { @@ -12901,7 +12570,7 @@ const Vn = (e) => e.toString(); const LB = new lr({ transparent: !0, depthTest: !1, blending: hr -}); const Uc = { +}), Uc = { // From chroma spectral http://gka.github.io/chroma.js/ SPECTRAL: [ [0, new w(0.3686, 0.3098, 0.6353)], @@ -13008,7 +12677,7 @@ const Vn = (e) => e.toString(); const LB = new lr({ [0.04, new w(1, 1, 1)], [1, new w(1, 1, 1)] ] -}; const NB = ` +}, NB = ` varying vec3 vColor; uniform float alpha; @@ -13019,7 +12688,7 @@ const Vn = (e) => e.toString(); const LB = new lr({ gl_FragColor = vec4( vColor, alpha); } } -`; const UB = ` +`, UB = ` varying vec3 vColor; uniform sampler2D gradient; uniform sampler2D grayscale; @@ -13095,8 +12764,8 @@ const Vn = (e) => e.toString(); const LB = new lr({ gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); } `; -var Hc = /* @__PURE__ */ ((e) => (e[e.Intensity = 1] = 'Intensity', e[e.Classification = 2] = 'Classification', e[e.Elevation = 3] = 'Elevation', e[e.RGB = 4] = 'RGB', e[e.White = 5] = 'White', e))(Hc || {}); var jn = /* @__PURE__ */ ((e) => (e[e.FlatTexture = 1] = 'FlatTexture', e[e.ShadedTexture = 2] = 'ShadedTexture', e[e.ShadedNoTexture = 3] = 'ShadedNoTexture', e))(jn || {}); -const HB = Uc.RAINBOW; const JB = typeof document < 'u' ? Pc(HB) : null; const VB = Uc.GRAYSCALE; const jB = typeof document < 'u' ? Pc(VB) : null; const kB = { +var Hc = /* @__PURE__ */ ((e) => (e[e.Intensity = 1] = "Intensity", e[e.Classification = 2] = "Classification", e[e.Elevation = 3] = "Elevation", e[e.RGB = 4] = "RGB", e[e.White = 5] = "White", e))(Hc || {}), jn = /* @__PURE__ */ ((e) => (e[e.FlatTexture = 1] = "FlatTexture", e[e.ShadedTexture = 2] = "ShadedTexture", e[e.ShadedNoTexture = 3] = "ShadedNoTexture", e))(jn || {}); +const HB = Uc.RAINBOW, JB = typeof document < "u" ? Pc(HB) : null, VB = Uc.GRAYSCALE, jB = typeof document < "u" ? Pc(VB) : null, kB = { throttleRequests: !0, maxRequests: 64, updateInterval: 0.1, @@ -13133,35 +12802,35 @@ class t1 { * @returns An object containing the 3D Model to be added to the scene * and a runtime engine to be updated every frame. */ - static async load (t) { - const n = { ...kB, ...t.options }; const { url: s } = t; + static async load(t) { + const n = { ...kB, ...t.options }, { url: s } = t; let { viewport: r, renderer: i } = t; - const o = n.updateInterval; const a = 5; const c = {}; + const o = n.updateInterval, a = 5, c = {}; if (n.cesiumIONToken) { - c['cesium-ion'] = { + c["cesium-ion"] = { accessToken: n.cesiumIONToken }; const T = await bc.preload(s, c); c.fetch = { headers: T.headers }; } - n.googleApiKey && (c.fetch = { headers: { 'X-GOOG-API-KEY': n.googleApiKey } }, t.options.hasOwnProperty('collectAttributions') || (n.collectAttributions = !0)), t.loadingManager && t.loadingManager.itemStart(s); + n.googleApiKey && (c.fetch = { headers: { "X-GOOG-API-KEY": n.googleApiKey } }, t.options.hasOwnProperty("collectAttributions") || (n.collectAttributions = !0)), t.loadingManager && t.loadingManager.itemStart(s); const u = await Ae(s, Le, { ...c - }); const l = {}; const h = {}; const f = []; const d = new En(); const m = new En(); + }), l = {}, h = {}, f = [], d = new En(), m = new En(); n.debug || (m.visible = !1); const g = { - pointSize: { type: 'f', value: n.pointSize }, - gradient: { type: 't', value: JB }, - grayscale: { type: 't', value: jB }, - rootCenter: { type: 'vec3', value: new rt() }, - rootNormal: { type: 'vec3', value: new rt() }, - coloring: { type: 'i', value: n.pointCloudColoring }, - hideGround: { type: 'b', value: !0 }, - elevationRange: { type: 'vec2', value: new ko(0, 400) }, - maxIntensity: { type: 'f', value: 1 }, - intensityContrast: { type: 'f', value: 1 }, - alpha: { type: 'f', value: 1 } - }; const y = new lr({ + pointSize: { type: "f", value: n.pointSize }, + gradient: { type: "t", value: JB }, + grayscale: { type: "t", value: jB }, + rootCenter: { type: "vec3", value: new rt() }, + rootNormal: { type: "vec3", value: new rt() }, + coloring: { type: "i", value: n.pointCloudColoring }, + hideGround: { type: "b", value: !0 }, + elevationRange: { type: "vec2", value: new ko(0, 400) }, + maxIntensity: { type: "f", value: 1 }, + intensityContrast: { type: "f", value: 1 }, + alpha: { type: "f", value: 1 } + }, y = new lr({ uniforms: g, vertexShader: UB, fragmentShader: NB, @@ -13169,8 +12838,8 @@ class t1 { vertexColors: !0 }); let E, R, B; - n.gltfLoader ? E = n.gltfLoader : (E = new cu(), n.basisTranscoderPath && (R = new lu(), R.detectSupport(i ?? new ru()), R.setTranscoderPath(n.basisTranscoderPath + '/'), R.setWorkerLimit(1), E.setKTX2Loader(R)), n.dracoDecoderPath && (B = new uu(), B.setDecoderPath(n.dracoDecoderPath + '/'), B.setWorkerLimit(n.maxConcurrency), E.setDRACOLoader(B))); - const C = new Hs({ transparent: n.transparent }); const M = { + n.gltfLoader ? E = n.gltfLoader : (E = new cu(), n.basisTranscoderPath && (R = new lu(), R.detectSupport(i ?? new ru()), R.setTranscoderPath(n.basisTranscoderPath + "/"), R.setWorkerLimit(1), E.setKTX2Loader(R)), n.dracoDecoderPath && (B = new uu(), B.setDecoderPath(n.dracoDecoderPath + "/"), B.setWorkerLimit(n.maxConcurrency), E.setDRACOLoader(B))); + const C = new Hs({ transparent: n.transparent }), M = { maximumMemoryUsage: n.maximumMemoryUsage, maximumScreenSpaceError: n.maximumScreenSpaceError, memoryAdjustedScreenSpaceError: n.memoryAdjustedScreenSpaceError, @@ -13205,12 +12874,12 @@ class t1 { f.push(T); }, onTileError: (T, D) => { - console.warn('Tile error', T.id, D); + console.warn("Tile error", T.id, D); }, - onTraversalComplete (T) { + onTraversalComplete(T) { return n.collectAttributions && (k = XB(T)), T; } - }; const b = new MB(u, { + }, b = new MB(u, { ...M, loadOptions: { ...c, @@ -13219,33 +12888,32 @@ class t1 { gltf: { loadImages: !1 }, - '3d-tiles': { + "3d-tiles": { loadGLTF: !1 } } - }); const O = new tt(); const F = new tt(); const v = new rt(); - let L = !1; let k = ''; - if (b.root.boundingVolume - ? (b.root.header.boundingVolume.region && console.warn('Cannot apply a model matrix to bounding volumes of type region. Tileset stays in original geo-coordinates.'), F.setPosition( - b.root.boundingVolume.center[0], - b.root.boundingVolume.center[1], - b.root.boundingVolume.center[2] - )) - : console.warn('Bounding volume not found, no transformations applied'), n.debug) { + }), O = new tt(), F = new tt(), v = new rt(); + let L = !1, k = ""; + if (b.root.boundingVolume ? (b.root.header.boundingVolume.region && console.warn("Cannot apply a model matrix to bounding volumes of type region. Tileset stays in original geo-coordinates."), F.setPosition( + b.root.boundingVolume.center[0], + b.root.boundingVolume.center[1], + b.root.boundingVolume.center[2] + )) : console.warn("Bounding volume not found, no transformations applied"), n.debug) { const T = Ho(b.root); m.add(T), h[b.root.id] = T; } - let q = !1; let Y = !1; - g.rootCenter.value.copy(v), g.rootNormal.value.copy(new rt(0, 0, 1).normalize()), b.stats.get('Loader concurrency').count = n.maxConcurrency, b.stats.get('Maximum mem usage').count = n.maximumMemoryUsage; - let P = 0; let ct = null; let Wt = !0; let oe = null; + let q = !1, Y = !1; + g.rootCenter.value.copy(v), g.rootNormal.value.copy(new rt(0, 0, 1).normalize()), b.stats.get("Loader concurrency").count = n.maxConcurrency, b.stats.get("Maximum mem usage").count = n.maximumMemoryUsage; + let P = 0, ct = null, Wt = !0, oe = null; const Be = new rt(1 / 0, 1 / 0, 1 / 0); let vt = null; d.updateMatrixWorld(!0); - const st = new tt().copy(d.matrixWorld); const Pt = new tt().copy(st).invert(); + const st = new tt().copy(d.matrixWorld), Pt = new tt().copy(st).invert(); n.resetTransform && Xt(b.root), n.debug && (h[b.root.id].applyMatrix4(O), m.matrixWorld.copy(d.matrixWorld)); - function Xt (T) { - if (!T.boundingVolume.halfAxes) { return; } - const D = T.boundingVolume.halfAxes; const Z = new tt().extractRotation(Gc(D)).premultiply(new tt().extractRotation(Pt)); + function Xt(T) { + if (!T.boundingVolume.halfAxes) + return; + const D = T.boundingVolume.halfAxes, Z = new tt().extractRotation(Gc(D)).premultiply(new tt().extractRotation(Pt)); if (!new rs().setFromRotationMatrix(Z).equals(new rs())) { L = !0; const _t = new rt( @@ -13257,26 +12925,27 @@ class t1 { } Ce(); } - function Ce () { + function Ce() { O.copy(st), n.resetTransform && O.multiply(new tt().copy(F).invert()), b.modelMatrix = new V(O.toArray()); } - function $e (T, D, Z, Q) { - if (q || !Q) { return; } + function $e(T, D, Z, Q) { + if (q || !Q) + return; if (!vt) { - if (Q instanceof Wo) { + if (Q instanceof Wo) vt = new Dn({ fov: Q.fov / 180 * Math.PI, aspectRatio: Q.aspect, near: Q.near, far: Q.far }).sseDenominator; - } else if (Q instanceof iu) { - const K = Q.right - Q.left; const jr = Q.top - Q.bottom; const Vc = K / jr; + else if (Q instanceof iu) { + const K = Q.right - Q.left, jr = Q.top - Q.bottom, Vc = K / jr; vt = Math.max(jr / Z.height, K / (Z.height * Vc)); } - n.debug && console.log('Updated sse denonimator:', vt); + n.debug && console.log("Updated sse denonimator:", vt); } - const ns = Uo(Q).planes.map((K) => new nt(K.normal.toArray(), K.constant)); const Jc = new dt(ns); const Jr = { + const ns = Uo(Q).planes.map((K) => new nt(K.normal.toArray(), K.constant)), Jc = new dt(ns), Jr = { camera: { position: Be.toArray() }, @@ -13289,19 +12958,20 @@ class t1 { } }; T._cache.reset(), T._traverser.traverse(T.root, Jr, T.options); - for (const K of T.tiles) { K.selected ? D[K.id] ? D[K.id].visible = !0 : console.error('TILE SELECTED BUT NOT LOADED!!', K.id) : D[K.id] && (D[K.id].visible = !1); } - for (; f.length > 0;) { + for (const K of T.tiles) + K.selected ? D[K.id] ? D[K.id].visible = !0 : console.error("TILE SELECTED BUT NOT LOADED!!", K.id) : D[K.id] && (D[K.id].visible = !1); + for (; f.length > 0; ) { const K = f.pop(); D[K.id] && K.contentState == lt.UNLOADED && (d.remove(D[K.id]), Us(D[K.id]), delete D[K.id]), h[K.id] && (Us(h[K.id]), m.remove(h[K.id]), delete h[K.id]); } - const ss = T.stats.get('Tiles Loaded').count; const Vr = T.stats.get('Tiles Loading').count; + const ss = T.stats.get("Tiles Loaded").count, Vr = T.stats.get("Tiles Loading").count; return t.onProgress && t.onProgress( ss, ss + Vr ), t.loadingManager && !Y && Vr == 0 && (n.preloadTilesCount == null || ss >= n.preloadTilesCount) && (Y = !0, t.loadingManager.itemEnd(t.url)), Jr; } - function es (T) { - const D = new rt(); const Z = new ou(); const Q = new rt(); + function es(T) { + const D = new rt(), Z = new ou(), Q = new rt(); T.decompose(D, Z, Q), d.position.copy(D), d.quaternion.copy(Z), d.scale.copy(Q), d.updateMatrix(), d.updateMatrixWorld(!0), st.copy(d.matrixWorld), Pt.copy(st).invert(), Ce(); } return { @@ -13368,19 +13038,21 @@ class t1 { return new rt(...D).applyMatrix4(O); }, orientToGeocoord: (T) => { - const D = [T.long, T.lat, T.height]; const Z = b.ellipsoid.cartographicToCartesian(D); const Q = new tt().fromArray(b.ellipsoid.eastNorthUpToFixedFrame(Z)); const _t = new tt().makeRotationFromEuler( + const D = [T.long, T.lat, T.height], Z = b.ellipsoid.cartographicToCartesian(D), Q = new tt().fromArray(b.ellipsoid.eastNorthUpToFixedFrame(Z)), _t = new tt().makeRotationFromEuler( new rs(Math.PI / 2, Math.PI / 2, 0) - ); const ns = new tt().copy(Q).multiply(_t).invert(); + ), ns = new tt().copy(Q).multiply(_t).invert(); es(ns); }, getWebMercatorCoord: (T) => xB(T.lat, T.long), getCameraFrustum: (T) => { - const Z = Uo(T).planes.map((_t) => new nt(_t.normal.toArray(), _t.constant)).map((_t) => IB(_t)); const Q = new En(); - for (const _t of Z) { Q.add(_t); } + const Z = Uo(T).planes.map((_t) => new nt(_t.normal.toArray(), _t.constant)).map((_t) => IB(_t)), Q = new En(); + for (const _t of Z) + Q.add(_t); return Q; }, overlayGeoJSON: (T, D) => { - if (T.applyMatrix4(O), T.updateMatrixWorld(), !i) { throw new Error('GeoJSON draping requires a renderer reference via LoaderProps'); } + if (T.applyMatrix4(O), T.updateMatrixWorld(), !i) + throw new Error("GeoJSON draping requires a renderer reference via LoaderProps"); return OB(r, d, i, D), T.material.dispose(), T.material = kt, T; }, setViewport: (T) => { @@ -13389,7 +13061,7 @@ class t1 { setRenderer: (T) => { i = T; }, - update: function (T, D) { + update: function(T, D) { if (oe = D, P += T, ht && DB(D), b && P >= o) { if (!st.equals(d.matrixWorld)) { P = 0, st.copy(d.matrixWorld), n.updateTransforms && Ce(); @@ -13399,12 +13071,12 @@ class t1 { ct == null ? ct = new tt().copy(D.matrixWorld) : (Wt || WB(D, ct)) && (P = 0, Wt = !1, b._frameNumber++, D.getWorldPosition(Be), ct.copy(D.matrixWorld), $e(b, l, r, D)); } }, - dispose: function () { - for (q = !0, b._destroy(); d.children.length > 0;) { + dispose: function() { + for (q = !0, b._destroy(); d.children.length > 0; ) { const T = d.children[0]; Us(T), d.remove(T); } - for (; m.children.length > 0;) { + for (; m.children.length > 0; ) { const T = m.children[0]; m.remove(T), T.geometry.dispose(), T.material.dispose(); } @@ -13413,7 +13085,6 @@ class t1 { } }; } - /** * Loads a tileset of 3D Tiles according to the given {@link GeoJSONLoaderProps} * Could be overlayed on geograpical 3D Tiles using {@link Runtime.overlayGeoJSON} @@ -13422,17 +13093,17 @@ class t1 { * @param props - Properties for this load call {@link GeoJSONLoaderProps}. * @returns An object containing the 3D Model to be added to the scene */ - static async loadGeoJSON (t) { + static async loadGeoJSON(t) { const { url: n, height: s, featureToColor: r } = t; - return Ae(n, ke, { worker: !1, gis: { format: 'binary' } }).then((i) => { - const o = i; const a = new Ko(); const c = o.polygons.positions.value.reduce((h, f, d, m) => { + return Ae(n, ke, { worker: !1, gis: { format: "binary" } }).then((i) => { + const o = i, a = new Ko(), c = o.polygons.positions.value.reduce((h, f, d, m) => { if (d % 2 == 0) { - const g = [f, m[d + 1], s ?? 0]; const y = J.WGS84.cartographicToCartesian(g); + const g = [f, m[d + 1], s ?? 0], y = J.WGS84.cartographicToCartesian(g); h.push(...y); } return h; }, []); - if (a.setAttribute('position', new Sn( + if (a.setAttribute("position", new Sn( c, 3 )), r) { @@ -13440,7 +13111,7 @@ class t1 { const y = r.colorMap(d); return f[m * 3] = y.r, f[m * 3 + 1] = y.g, f[m * 3 + 2] = y.b, f; }, []); - a.setAttribute('color', new Sn( + a.setAttribute("color", new Sn( h, 3 )); @@ -13458,25 +13129,25 @@ class t1 { }); } } -async function KB (e, t, n, s, r) { +async function KB(e, t, n, s, r) { return new Promise((i, o) => { - const a = new tt().makeRotationAxis(new rt(1, 0, 0), Math.PI / 2); const c = t.content.gltfUpAxis !== 'Z'; const u = new tt().fromArray(t.computedTransform).premultiply(r); + const a = new tt().makeRotationAxis(new rt(1, 0, 0), Math.PI / 2), c = t.content.gltfUpAxis !== "Z", u = new tt().fromArray(t.computedTransform).premultiply(r); c && u.multiply(a), t.content.byteLength || (t.content.byteLength = t.content.gltfArrayBuffer.byteLength), e.parse( t.content.gltfArrayBuffer, - t.contentUrl ? t.contentUrl.substr(0, t.contentUrl.lastIndexOf('/') + 1) : null, + t.contentUrl ? t.contentUrl.substr(0, t.contentUrl.lastIndexOf("/") + 1) : null, (l) => { t.userData.asset = l.asset; const h = l.scenes[0]; h.applyMatrix4(u), t.content.texturesByteLength = 0, t.content.geometriesByteLength = 0, h.traverse((f) => { - if (f.type == 'Mesh') { + if (f.type == "Mesh") { const d = f; t.content.geometriesByteLength += Nc(d.geometry); - const m = d.material; const g = m.map; + const m = d.material, g = m.map; if (g) { const y = vB(g); y && (t.content.texturesByteLength += y); } - s.material ? (d.material = s.material.clone(), m.dispose()) : s.shading == jn.FlatTexture && d.material.type !== 'MeshBasicMaterial' && (d.material = n.clone(), m.dispose()), s.shading != jn.ShadedNoTexture ? d.material.type == 'ShaderMaterial' ? d.material.uniforms.map = { value: g } : d.material.map = g : (g && g.dispose(), d.material.map = null), d.material.wireframe = s.wireframe, s.contentPostProcess && s.contentPostProcess(d); + s.material ? (d.material = s.material.clone(), m.dispose()) : s.shading == jn.FlatTexture && d.material.type !== "MeshBasicMaterial" && (d.material = n.clone(), m.dispose()), s.shading != jn.ShadedNoTexture ? d.material.type == "ShaderMaterial" ? d.material.uniforms.map = { value: g } : d.material.map = g : (g && g.dispose(), d.material.map = null), d.material.wireframe = s.wireframe, s.contentPostProcess && s.contentPostProcess(d); } }), t.content.gpuMemoryUsageInBytes = t.content.texturesByteLength + t.content.geometriesByteLength, i(h); }, @@ -13486,7 +13157,7 @@ async function KB (e, t, n, s, r) { ); }); } -function zB (e, t, n, s) { +function zB(e, t, n, s) { const r = { rtc_center: e.content.rtcCenter, // eslint-disable-line camelcase @@ -13495,16 +13166,16 @@ function zB (e, t, n, s) { classifications: e.content.attributes.classification, rgb: null, rgba: null - }; const { colors: i } = e.content.attributes; + }, { colors: i } = e.content.attributes; i && i.size === 3 && (r.rgb = i.value), i && i.size === 4 && (r.rgba = i.value); const o = new Ko(); - o.setAttribute('position', new Sn(r.points, 3)); + o.setAttribute("position", new Sn(r.points, 3)); const a = new tt().fromArray(e.computedTransform).premultiply(s); - r.rgba ? o.setAttribute('color', new Sn(r.rgba, 4)) : r.rgb && o.setAttribute('color', new zr(r.rgb, 3, !0)), r.intensities && o.setAttribute( - 'intensity', + r.rgba ? o.setAttribute("color", new Sn(r.rgba, 4)) : r.rgb && o.setAttribute("color", new zr(r.rgb, 3, !0)), r.intensities && o.setAttribute( + "intensity", // Handles both 16bit or 8bit intensity values new zo(r.intensities, 1, !0) - ), r.classifications && o.setAttribute('classification', new zr(r.classifications, 1, !1)), e.content.geometriesByteLength = Nc(o), e.content.gpuMemoryUsageInBytes = e.content.geometriesByteLength; + ), r.classifications && o.setAttribute("classification", new zr(r.classifications, 1, !1)), e.content.geometriesByteLength = Nc(o), e.content.gpuMemoryUsageInBytes = e.content.geometriesByteLength; const c = new au(o, n.material || t); if (r.rtc_center) { const u = r.rtc_center; @@ -13512,36 +13183,37 @@ function zB (e, t, n, s) { } return c.applyMatrix4(a), n.contentPostProcess && n.contentPostProcess(c), c; } -function Vo (e) { - let t, n, s, r; +function Vo(e) { + var t, n, s, r; (t = e == null ? void 0 : e.uniforms) != null && t.map ? (s = (n = e == null ? void 0 : e.uniforms) == null ? void 0 : n.map.value) == null || s.dispose() : e.map && ((r = e.map) == null || r.dispose()), e.dispose(); } -function Us (e) { +function Us(e) { e.traverse((t) => { - if (t.isMesh) { - if (t.geometry.dispose(), t.material.isMaterial) { Vo(t.material); } else { - for (const n of t.material) { Vo(n); } - } - } + if (t.isMesh) + if (t.geometry.dispose(), t.material.isMaterial) + Vo(t.material); + else + for (const n of t.material) + Vo(n); }); for (let t = e.children.length - 1; t >= 0; t--) { const n = e.children[t]; e.remove(n); } } -function WB (e, t, n) { +function WB(e, t, n) { const s = !e.matrixWorld.equals(t); return e instanceof Wo ? s || e.aspect !== n : s; } -function XB (e) { +function XB(e) { const t = /* @__PURE__ */ new Map(); return e.forEach((r) => { - let o, a; + var o, a; const i = (a = (o = r == null ? void 0 : r.userData) == null ? void 0 : o.asset) == null ? void 0 : a.copyright; i && i.split(/;/g).map((u) => u.trim()).forEach((u) => { u && t.set(u, (t.get(u) || 0) + 1); }); - }), Array.from(t).sort((r, i) => i[1] - r[1]).map(([r]) => r).join('; '); + }), Array.from(t).sort((r, i) => i[1] - r[1]).map(([r]) => r).join("; "); } export { t1 as Loader3DTiles,