import * as e from "three/webgpu"; import { Box3 as t, Box3Helper as n, BufferAttribute as r, BufferGeometry as i, DynamicDrawUsage as a, Euler as o, Float32BufferAttribute as s, Matrix4 as c, MeshStandardNodeMaterial as l, QuadraticBezierCurve3 as u, Raycaster as d, Shape as f, ShapeUtils as p, StaticDrawUsage as m, Uint16BufferAttribute as h, Uint32BufferAttribute as g, Vector2 as _, Vector3 as v, error as y } from "three/webgpu"; import { SelectionBox as b } from "three/examples/jsm/interactive/SelectionBox.js"; import { SelectionHelper as x } from "three/examples/jsm/interactive/SelectionHelper.js"; import { FBXLoader as S } from "three/examples/jsm/loaders/FBXLoader.js"; import { GLTFLoader as C } from "three/examples/jsm/loaders/GLTFLoader.js"; import { DRACOLoader as w } from "three/examples/jsm/loaders/DRACOLoader.js"; import { KTX2Loader as T } from "three/examples/jsm/loaders/KTX2Loader.js"; import { MeshoptDecoder as E } from "three/examples/jsm/libs/meshopt_decoder.module.js"; import { BackSide as D, BatchedMesh as O, Box3 as k, BoxGeometry as A, BufferAttribute as j, BufferGeometry as M, CylinderGeometry as N, DoubleSide as P, FrontSide as F, Group as I, Line as L, Line3 as R, LineBasicMaterial as z, LineLoop as ee, LineSegments as B, Matrix3 as V, Matrix4 as H, Mesh as U, MeshBasicMaterial as te, Object3D as ne, Plane as re, Points as ie, REVISION as ae, Ray as oe, RingGeometry as se, SphereGeometry as ce, TorusGeometry as le, Triangle as ue, Vector2 as de, Vector3 as W, Vector4 as fe } from "three"; import { TransformControls as pe } from "three/addons/controls/TransformControls.js"; import { Break as me, Discard as he, Fn as ge, If as _e, Loop as ve, cameraPosition as ye, clamp as be, color as xe, float as Se, instancedBufferAttribute as Ce, max as we, min as Te, modelWorldMatrix as Ee, modelWorldMatrixInverse as De, mrt as Oe, oscSine as ke, output as Ae, pass as je, positionGeometry as Me, screenUV as Ne, shapeCircle as Pe, smoothstep as Fe, texture as Ie, texture3D as Le, time as Re, uniform as ze, uv as Be, varying as Ve, vec2 as He, vec3 as Ue, vec4 as We } from "three/tsl"; import { outline as Ge } from "three/addons/tsl/display/OutlineNode.js"; import { bloom as Ke } from "three/addons/tsl/display/BloomNode.js"; import { CSS2DObject as qe, CSS2DRenderer as Je } from "three/examples/jsm/renderers/CSS2DRenderer.js"; import { CSS3DObject as Ye, CSS3DRenderer as Xe, CSS3DSprite as Ze } from "three/examples/jsm/renderers/CSS3DRenderer.js"; import { FontLoader as Qe } from "three/addons/loaders/FontLoader.js"; import { Inspector as $e } from "three/examples/jsm/inspector/Inspector"; //#region \0rolldown/runtime.js var et = Object.create, tt = Object.defineProperty, nt = Object.getOwnPropertyDescriptor, rt = Object.getOwnPropertyNames, it = Object.getPrototypeOf, at = Object.prototype.hasOwnProperty, ot = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), st = (e, t, n, r) => { if (t && typeof t == "object" || typeof t == "function") for (var i = rt(t), a = 0, o = i.length, s; a < o; a++) s = i[a], !at.call(e, s) && s !== n && tt(e, s, { get: ((e) => t[e]).bind(null, s), enumerable: !(r = nt(t, s)) || r.enumerable }); return e; }, ct = (e, t, n) => (n = e == null ? {} : et(it(e)), st(t || !e || !e.__esModule ? tt(n, "default", { value: e, enumerable: !0 }) : n, e)), lt = /* @__PURE__ */ new WeakMap(), ut = /* @__PURE__ */ new WeakMap(), dt = /* @__PURE__ */ new WeakMap(), ft = /* @__PURE__ */ new WeakMap(), pt = Symbol("anyProducer"), mt = Promise.resolve(), ht = Symbol("listenerAdded"), gt = Symbol("listenerRemoved"), _t = /* @__PURE__ */ new WeakMap(), vt = /* @__PURE__ */ new WeakMap(), yt = Symbol("suppressAllEnqueue"), bt = /* @__PURE__ */ new WeakMap(), xt = !1, St = (e) => typeof e == "string" || typeof e == "symbol" || typeof e == "number"; function Ct(e) { return e[Symbol.dispose] = e, e; } function wt(e, t, { swallowErrors: n = !1 } = {}) { if (!e) return () => {}; let r = () => { if (n) { try { t(); } catch {} return; } t(); }; return e.aborted ? (r(), () => {}) : (e.addEventListener("abort", r, { once: !0 }), () => { e.removeEventListener("abort", r); }); } function Tt(e) { if (!St(e)) throw TypeError("`eventName` must be a string, symbol, or number"); } function Et(e) { if (typeof e != "function") throw TypeError("listener must be a function"); } function Dt(e, t) { let n = ut.get(e); if (n.has(t)) return n.get(t); } function Ot(e, t) { let n = St(t) ? t : pt, r = dt.get(e); if (r.has(n)) return r.get(n); } function kt(e, t, n, r) { if (Pt(e, t)) return; let i = dt.get(e); if (!i.has(t) && !i.get(pt)?.size) return; let a = Promise.resolve(n), o = async () => Wt(t, await a, r); if (i.has(t)) for (let e of i.get(t)) e.enqueue(o()); if (i.has(pt)) for (let e of i.get(pt)) e.enqueue(o()); } function At(e, t, { signal: n } = {}) { t = Array.isArray(t) ? t : [t]; let r = !1, i = () => {}, a = [], o = () => {}, s = { enqueue(e) { a.push(e), i(); }, finish() { r = !0, o(), i(); } }; for (let n of t) { let t = St(n) ? n : pt, r = Ot(e, n); r || (r = /* @__PURE__ */ new Set(), dt.get(e).set(t, r)), r.add(s); } let c = () => { for (let n of t) { let t = St(n) ? n : pt, r = Ot(e, n); r && (r.delete(s), r.size === 0 && dt.get(e).delete(t)); } }, l = () => { a && (a = void 0, o(), c(), i()); }; return o = wt(n, l), { async next() { if (!a) return { done: !0 }; if (a.length === 0) { if (r) return l(), this.next(); let { promise: e, resolve: t } = Promise.withResolvers(); return i = t, await e, this.next(); } return { done: !1, value: await a.shift() }; }, async return(e) { return l(), arguments.length > 0 ? { done: !0, value: await e } : { done: !0 }; }, [Symbol.asyncIterator]() { return this; }, async [Symbol.asyncDispose]() { await this.return(); } }; } function jt(e) { if (e === void 0) return qt; if (!Array.isArray(e)) throw TypeError("`methodNames` must be an array of strings"); for (let t of e) if (!qt.includes(t)) throw typeof t == "string" ? Error(`${t} is not Emittery method`) : TypeError("`methodNames` element must be a string"); return e; } var Mt = (e) => e === ht || e === gt; function Nt(e, t, n) { let r = t.some((e) => !St(e)) ? [yt] : t, i = bt.get(e); i || (i = /* @__PURE__ */ new Set(), bt.set(e, i)); let a = []; for (let e of r) i.has(e) || (i.add(e), a.push(e)); try { return n(); } finally { for (let e of a) i.delete(e); i.size === 0 && bt.delete(e); } } function Pt(e, t) { let n = bt.get(e); return n ? n.has(yt) || n.has(t) : !1; } function Ft(e, t, n, { eventName: r, set: i }) { try { let e = t.initFn(); typeof e == "function" && (t.deinitFn = e); } catch (t) { throw i.delete(n), i.size === 0 && ut.get(e).delete(r), t; } } function It(e) { let t = e?.deinitFn; t && (e.deinitFn = void 0, t()); } var Lt = "subscribe", Rt = "unsubscribe"; function zt(e, { eventName: t, listener: n, action: r, swallowLifecycleError: i = !1, removeResubscribedListener: a = !1 }) { if (r === Lt) { let r = Dt(e, t); r || (r = /* @__PURE__ */ new Set(), ut.get(e).set(t, r)); let i = r.size === 0, a = r.has(n); if (r.add(n), !Mt(t) && i && !Pt(e, t)) { let i = ft.get(e).get(t); i && Ft(e, i, n, { eventName: t, set: r }); } return { hasSet: !0, changed: !a }; } let o = Dt(e, t); if (!o) return { hasSet: !1, changed: !1 }; let s = o.delete(n); if (o.size === 0) { ut.get(e).delete(t); let r = ft.get(e).get(t); if (i) try { It(r); } catch {} else It(r); if (a) { let r = Dt(e, t); r?.delete(n), r?.size === 0 && ut.get(e).delete(t); } } return { hasSet: !0, changed: s }; } function Bt(e, { eventName: t, listener: n, action: r, swallowErrors: i = !1 }) { let a = r === Lt, o = a ? "subscribe" : "unsubscribe", s = a ? ht : gt; if (i) { try { e.logIfDebugEnabled(o, t, void 0); } catch {} if (!Mt(t)) try { Gt(e, s, { eventName: t, listener: n }); } catch {} return; } e.logIfDebugEnabled(o, t, void 0), Mt(t) || Gt(e, s, { eventName: t, listener: n }); } function Vt(e, t, n) { Nt(e, t, () => { for (let r of t) { let { hasSet: t } = zt(e, { eventName: r, listener: n, action: Rt, swallowLifecycleError: !0, removeResubscribedListener: !0 }); t && Bt(e, { eventName: r, listener: n, action: Rt, swallowErrors: !0 }); } }); } function Ht(e, t) { let n = Ot(e, t); if (n) { for (let e of n) e.finish(); n.clear(); } } function Ut(e) { let t = dt.get(e); for (let [e, n] of t.entries()) { for (let e of n) e.finish(); n.clear(), t.delete(e); } } var Wt = (e, t, n) => n ? { name: e, data: t } : { name: e }; function Gt(e, t, n) { _t.set(e, (_t.get(e) ?? 0) + 1), vt.set(e, (vt.get(e) ?? 0) + 1); try { Kt.prototype.emit.call(e, t, n); } finally { _t.set(e, (_t.get(e) ?? 0) - 1); } } var Kt = class e { static mixin(t, n) { return n = jt(n), (r, i) => { if (typeof r != "function") throw TypeError("`target` must be function"); for (let e of n) if (r.prototype[e] !== void 0) throw Error(`The property \`${e}\` already exists on \`target\``); function a() { return Object.defineProperty(this, t, { enumerable: !1, value: new e() }), this[t]; } Object.defineProperty(r.prototype, t, { enumerable: !1, get: a }); let o = (e) => function(...n) { return this[t][e](...n); }; for (let e of n) Object.defineProperty(r.prototype, e, { enumerable: !1, value: o(e) }); return r; }; } static get isDebugEnabled() { if (typeof globalThis.process?.env != "object") return xt; let { env: e } = globalThis.process ?? { env: {} }; return e.DEBUG === "emittery" || e.DEBUG === "*" || xt; } static set isDebugEnabled(e) { xt = e; } constructor(e = {}) { lt.set(this, /* @__PURE__ */ new Set()), ut.set(this, /* @__PURE__ */ new Map()), dt.set(this, /* @__PURE__ */ new Map()), ft.set(this, /* @__PURE__ */ new Map()), dt.get(this).set(pt, /* @__PURE__ */ new Set()); for (let e of qt) Object.defineProperty(this, e, { value: this[e].bind(this), writable: !0, enumerable: !1, configurable: !0 }); this.debug = e.debug ?? {}, this.debug.enabled === void 0 && (this.debug.enabled = !1), this.debug.logger ||= (e, t, n, r) => { try { r = JSON.stringify(r); } catch { r = `Object with the following keys failed to stringify: ${Object.keys(r).join(",")}`; } (typeof n == "symbol" || typeof n == "number") && (n = n.toString()); let i = /* @__PURE__ */ new Date(), a = `${i.getHours()}:${i.getMinutes()}:${i.getSeconds()}.${i.getMilliseconds()}`; console.log(`[${a}][emittery:${e}][${t}] Event Name: ${n}\n\tdata: ${r}`); }; } logIfDebugEnabled(t, n, r) { (e.isDebugEnabled || this.debug.enabled) && this.debug.logger(t, this.debug.name, n, r); } on(e, t, { signal: n } = {}) { Et(t), e = Array.isArray(e) ? e : [e]; let r = []; try { for (let n of e) { Tt(n); let { changed: e } = zt(this, { eventName: n, listener: t, action: Lt }); e && r.push(n), Bt(this, { eventName: n, listener: t, action: Lt }); } } catch (e) { throw Vt(this, r, t), e; } let i = () => {}, a = Symbol("no-error"), o = () => { i(); let n = a; for (let r of e) try { this.off(r, t); } catch (e) { n = n === a ? e : n; } if (n !== a) throw n; }; return i = wt(n, o, { swallowErrors: !0 }), Ct(o); } off(e, t) { Et(t), e = Array.isArray(e) ? e : [e]; for (let n of e) Tt(n), zt(this, { eventName: n, listener: t, action: Rt }), Bt(this, { eventName: n, listener: t, action: Rt }); } once(e, t) { let { promise: n, resolve: r, reject: i } = Promise.withResolvers(), a = () => {}, o, s = !1, c = () => {}; e = Array.isArray(e) ? [...e] : [e]; try { let l; if (typeof t == "function") l = t; else if (typeof t == "object" && t) l = t.predicate, o = t.signal; else if (t !== void 0) throw TypeError("predicate must be a function"); if (l !== void 0 && typeof l != "function") throw TypeError("predicate must be a function"); if (o?.aborted) throw o.reason; let u = () => {}, d = () => { c(); let t = Symbol("no-error"), n = t; for (let r of e) try { this.off(r, u); } catch (e) { n = n === t ? e : n; } if (n !== t) throw n; }, f = () => { d(), s = !0; }; u = (e) => { if (!(l && !l(e)) && !s) { try { f(); } catch (e) { i(e); return; } r(e); } }, this.on(e, u), a = d, c = wt(o, () => { if (!s) { try { f(); } catch {} s = !0, i(o.reason); } }), n.off = () => { s || f(); }; } catch (e) { i(e); } return n.off === void 0 && (n.off = a), n; } events(e, { signal: t } = {}) { e = Array.isArray(e) ? e : [e]; for (let t of e) Tt(t); return At(this, e, { signal: t }); } async emit(e, t) { if (Tt(e), Mt(e)) { let e = vt.get(this) ?? 0; if ((_t.get(this) ?? 0) === 0 || e === 0) throw TypeError("`eventName` cannot be meta event `listenerAdded` or `listenerRemoved`"); vt.set(this, e - 1); } Mt(e) || this.logIfDebugEnabled("emit", e, t); let n = arguments.length > 1; kt(this, e, t, n); let r = Dt(this, e) ?? /* @__PURE__ */ new Set(), i = lt.get(this), a = [...r], o = Mt(e) ? [] : [...i]; await mt; let s = (await Promise.allSettled([...a.map(async (i) => { if (r.has(i)) return i(Wt(e, t, n)); }), ...o.map(async (r) => { if (i.has(r)) return r(Wt(e, t, n)); })])).values().filter((e) => e.status === "rejected").map((e) => e.reason).toArray(); if (s.length > 0) throw AggregateError(s, "One or more listeners threw an error"); } async emitSerial(e, t) { if (Tt(e), Mt(e)) { let e = vt.get(this) ?? 0; if ((_t.get(this) ?? 0) === 0 || e === 0) throw TypeError("`eventName` cannot be meta event `listenerAdded` or `listenerRemoved`"); vt.set(this, e - 1); } Mt(e) || this.logIfDebugEnabled("emitSerial", e, t); let n = arguments.length > 1; kt(this, e, t, n); let r = Dt(this, e) ?? /* @__PURE__ */ new Set(), i = lt.get(this), a = [...r], o = Mt(e) ? [] : [...i]; await mt; for (let i of a) r.has(i) && await i(Wt(e, t, n)); for (let r of o) i.has(r) && await r(Wt(e, t, n)); } onAny(e, { signal: t } = {}) { Et(e), this.logIfDebugEnabled("subscribeAny", void 0, void 0), lt.get(this).add(e), Gt(this, ht, { listener: e }); let n = () => {}, r = () => { n(), this.offAny(e); }; return n = wt(t, r, { swallowErrors: !0 }), Ct(r); } anyEvent({ signal: e } = {}) { return At(this, void 0, { signal: e }); } offAny(e) { Et(e), this.logIfDebugEnabled("unsubscribeAny", void 0, void 0), Gt(this, gt, { listener: e }), lt.get(this).delete(e); } clearListeners(e) { e = Array.isArray(e) ? e : [e]; let t = e.some((e) => !St(e)); Nt(this, e, () => { let n = Symbol("no-error"), r = n; try { for (let t of e) { try { this.logIfDebugEnabled("clear", t, void 0); } catch (e) { r = r === n ? e : r; } if (St(t)) { let e = Dt(this, t), i = e?.size > 0; e?.clear(), Ht(this, t); let a = i ? ft.get(this).get(t) : void 0; try { It(a); } catch (e) { r = r === n ? e : r; } } else { lt.get(this).clear(), Ut(this); for (let [e, t] of ut.get(this).entries()) { let i = t.size > 0; t.clear(); let a = i ? ft.get(this).get(e) : void 0; try { It(a); } catch (e) { r = r === n ? e : r; } t.clear(), ut.get(this).delete(e); } lt.get(this).clear(), Ut(this); } } } finally { if (t) { lt.get(this).clear(); for (let e of ut.get(this).values()) e.clear(); ut.get(this).clear(), Ut(this); } else for (let t of e) St(t) && (Dt(this, t)?.clear(), ut.get(this).delete(t), Ht(this, t)); } if (r !== n) throw r; }); } init(e, t) { if (Tt(e), Mt(e)) throw TypeError("`eventName` cannot be a meta event"); if (typeof t != "function") throw TypeError("`initFn` must be a function"); let n = ft.get(this); if (n.has(e)) throw Error("`eventName` already has an init function registered"); let r = { initFn: t, deinitFn: void 0 }; if (n.set(e, r), Dt(this, e)?.size > 0) try { let e = t(); typeof e == "function" && (r.deinitFn = e); } catch (t) { throw n.delete(e), t; } return Ct(() => { try { It(r); } finally { n.get(e) === r && n.delete(e); } }); } listenerCount(e) { e = Array.isArray(e) ? e : [e]; let t = 0; for (let n of e) { if (St(n)) { t += lt.get(this).size + (Dt(this, n)?.size ?? 0) + (Ot(this, n)?.size ?? 0) + (Ot(this)?.size ?? 0); continue; } n !== void 0 && Tt(n), t += lt.get(this).size; for (let e of ut.get(this).values()) t += e.size; for (let e of dt.get(this).values()) t += e.size; } return t; } bindMethods(e, t) { if (!e || typeof e != "object") throw TypeError("`target` must be an object"); t = jt(t); for (let n of t) { if (e[n] !== void 0) throw Error(`The property \`${n}\` already exists on \`target\``); Object.defineProperty(e, n, { enumerable: !1, value: this[n].bind(this) }); } } }, qt = Object.getOwnPropertyNames(Kt.prototype).filter((e) => e !== "constructor"); Object.defineProperty(Kt, "listenerAdded", { value: ht, writable: !1, enumerable: !0, configurable: !1 }), Object.defineProperty(Kt, "listenerRemoved", { value: gt, writable: !1, enumerable: !0, configurable: !1 }); //#endregion //#region src/enums/EventManagerEvents.ts var Jt = /* @__PURE__ */ function(e) { return e.RAYCAST_PICK = "raycastPick", e.RAYCAST_PICK_ALL = "raycastPickAll", e.BOX_SELECTION_MOVE = "boxSelectionMove", e.BOX_SELECTION_COMPLETE = "boxSelectionComplete", e; }({}), Yt = /* @__PURE__ */ function(e) { return e.INIT = "init", e.BEFORE_RENDER = "BEFORE_RENDER", e.AFTER_RENDER = "AFTER_RENDER", e.CAMERA_TYPE_CHANGED = "CAMERA_TYPE_CHANGED", e; }({}), Xt = typeof global == "object" && global && global.Object === Object && global, Zt = typeof self == "object" && self && self.Object === Object && self, Qt = Xt || Zt || Function("return this")(), $t = Qt.Symbol, en = Object.prototype, tn = en.hasOwnProperty, nn = en.toString, rn = $t ? $t.toStringTag : void 0; function an(e) { var t = tn.call(e, rn), n = e[rn]; try { e[rn] = void 0; var r = !0; } catch {} var i = nn.call(e); return r && (t ? e[rn] = n : delete e[rn]), i; } //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_objectToString.js var on = Object.prototype.toString; function sn(e) { return on.call(e); } //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseGetTag.js var cn = "[object Null]", ln = "[object Undefined]", un = $t ? $t.toStringTag : void 0; function dn(e) { return e == null ? e === void 0 ? ln : cn : un && un in Object(e) ? an(e) : sn(e); } //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isObjectLike.js function fn(e) { return typeof e == "object" && !!e; } //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isSymbol.js var pn = "[object Symbol]"; function mn(e) { return typeof e == "symbol" || fn(e) && dn(e) == pn; } //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_arrayMap.js function hn(e, t) { for (var n = -1, r = e == null ? 0 : e.length, i = Array(r); ++n < r;) i[n] = t(e[n], n, e); return i; } //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isArray.js var gn = Array.isArray, _n = Infinity, vn = $t ? $t.prototype : void 0, yn = vn ? vn.toString : void 0; function bn(e) { if (typeof e == "string") return e; if (gn(e)) return hn(e, bn) + ""; if (mn(e)) return yn ? yn.call(e) : ""; var t = e + ""; return t == "0" && 1 / e == -_n ? "-0" : t; } //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isObject.js function xn(e) { var t = typeof e; return e != null && (t == "object" || t == "function"); } //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isFunction.js var Sn = "[object AsyncFunction]", Cn = "[object Function]", wn = "[object GeneratorFunction]", Tn = "[object Proxy]"; function En(e) { if (!xn(e)) return !1; var t = dn(e); return t == Cn || t == wn || t == Sn || t == Tn; } //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_coreJsData.js var Dn = Qt["__core-js_shared__"], On = function() { var e = /[^.]+$/.exec(Dn && Dn.keys && Dn.keys.IE_PROTO || ""); return e ? "Symbol(src)_1." + e : ""; }(); function kn(e) { return !!On && On in e; } //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_toSource.js var An = Function.prototype.toString; function jn(e) { if (e != null) { try { return An.call(e); } catch {} try { return e + ""; } catch {} } return ""; } //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseIsNative.js var Mn = /[\\^$.*+?()[\]{}|]/g, Nn = /^\[object .+?Constructor\]$/, Pn = Function.prototype, Fn = Object.prototype, In = Pn.toString, Ln = Fn.hasOwnProperty, Rn = RegExp("^" + In.call(Ln).replace(Mn, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"); function zn(e) { return !xn(e) || kn(e) ? !1 : (En(e) ? Rn : Nn).test(jn(e)); } //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getValue.js function Bn(e, t) { return e?.[t]; } //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getNative.js function Vn(e, t) { var n = Bn(e, t); return zn(n) ? n : void 0; } //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/eq.js function Hn(e, t) { return e === t || e !== e && t !== t; } //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_isKey.js var Un = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, Wn = /^\w*$/; function Gn(e, t) { if (gn(e)) return !1; var n = typeof e; return n == "number" || n == "symbol" || n == "boolean" || e == null || mn(e) ? !0 : Wn.test(e) || !Un.test(e) || t != null && e in Object(t); } //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_nativeCreate.js var Kn = Vn(Object, "create"); //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_hashClear.js function qn() { this.__data__ = Kn ? Kn(null) : {}, this.size = 0; } //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_hashDelete.js function Jn(e) { var t = this.has(e) && delete this.__data__[e]; return this.size -= t ? 1 : 0, t; } //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_hashGet.js var Yn = "__lodash_hash_undefined__", Xn = Object.prototype.hasOwnProperty; function Zn(e) { var t = this.__data__; if (Kn) { var n = t[e]; return n === Yn ? void 0 : n; } return Xn.call(t, e) ? t[e] : void 0; } //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_hashHas.js var Qn = Object.prototype.hasOwnProperty; function $n(e) { var t = this.__data__; return Kn ? t[e] !== void 0 : Qn.call(t, e); } //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_hashSet.js var er = "__lodash_hash_undefined__"; function tr(e, t) { var n = this.__data__; return this.size += this.has(e) ? 0 : 1, n[e] = Kn && t === void 0 ? er : t, this; } //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_Hash.js function nr(e) { var t = -1, n = e == null ? 0 : e.length; for (this.clear(); ++t < n;) { var r = e[t]; this.set(r[0], r[1]); } } nr.prototype.clear = qn, nr.prototype.delete = Jn, nr.prototype.get = Zn, nr.prototype.has = $n, nr.prototype.set = tr; //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_listCacheClear.js function rr() { this.__data__ = [], this.size = 0; } //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_assocIndexOf.js function G(e, t) { for (var n = e.length; n--;) if (Hn(e[n][0], t)) return n; return -1; } //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_listCacheDelete.js var ir = Array.prototype.splice; function ar(e) { var t = this.__data__, n = G(t, e); return n < 0 ? !1 : (n == t.length - 1 ? t.pop() : ir.call(t, n, 1), --this.size, !0); } //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_listCacheGet.js function or(e) { var t = this.__data__, n = G(t, e); return n < 0 ? void 0 : t[n][1]; } //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_listCacheHas.js function sr(e) { return G(this.__data__, e) > -1; } //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_listCacheSet.js function cr(e, t) { var n = this.__data__, r = G(n, e); return r < 0 ? (++this.size, n.push([e, t])) : n[r][1] = t, this; } //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_ListCache.js function lr(e) { var t = -1, n = e == null ? 0 : e.length; for (this.clear(); ++t < n;) { var r = e[t]; this.set(r[0], r[1]); } } lr.prototype.clear = rr, lr.prototype.delete = ar, lr.prototype.get = or, lr.prototype.has = sr, lr.prototype.set = cr; //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_Map.js var ur = Vn(Qt, "Map"); //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheClear.js function dr() { this.size = 0, this.__data__ = { hash: new nr(), map: new (ur || lr)(), string: new nr() }; } //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_isKeyable.js function fr(e) { var t = typeof e; return t == "string" || t == "number" || t == "symbol" || t == "boolean" ? e !== "__proto__" : e === null; } //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getMapData.js function pr(e, t) { var n = e.__data__; return fr(t) ? n[typeof t == "string" ? "string" : "hash"] : n.map; } //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheDelete.js function mr(e) { var t = pr(this, e).delete(e); return this.size -= t ? 1 : 0, t; } //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheGet.js function hr(e) { return pr(this, e).get(e); } //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheHas.js function gr(e) { return pr(this, e).has(e); } //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheSet.js function _r(e, t) { var n = pr(this, e), r = n.size; return n.set(e, t), this.size += n.size == r ? 0 : 1, this; } //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_MapCache.js function vr(e) { var t = -1, n = e == null ? 0 : e.length; for (this.clear(); ++t < n;) { var r = e[t]; this.set(r[0], r[1]); } } vr.prototype.clear = dr, vr.prototype.delete = mr, vr.prototype.get = hr, vr.prototype.has = gr, vr.prototype.set = _r; //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/memoize.js var yr = "Expected a function"; function br(e, t) { if (typeof e != "function" || t != null && typeof t != "function") throw TypeError(yr); var n = function() { var r = arguments, i = t ? t.apply(this, r) : r[0], a = n.cache; if (a.has(i)) return a.get(i); var o = e.apply(this, r); return n.cache = a.set(i, o) || a, o; }; return n.cache = new (br.Cache || vr)(), n; } br.Cache = vr; //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_memoizeCapped.js var xr = 500; function Sr(e) { var t = br(e, function(e) { return n.size === xr && n.clear(), e; }), n = t.cache; return t; } //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_stringToPath.js var Cr = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, wr = /\\(\\)?/g, Tr = Sr(function(e) { var t = []; return e.charCodeAt(0) === 46 && t.push(""), e.replace(Cr, function(e, n, r, i) { t.push(r ? i.replace(wr, "$1") : n || e); }), t; }); //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/toString.js function Er(e) { return e == null ? "" : bn(e); } //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_castPath.js function Dr(e, t) { return gn(e) ? e : Gn(e, t) ? [e] : Tr(Er(e)); } //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_toKey.js var Or = Infinity; function kr(e) { if (typeof e == "string" || mn(e)) return e; var t = e + ""; return t == "0" && 1 / e == -Or ? "-0" : t; } //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseGet.js function Ar(e, t) { t = Dr(t, e); for (var n = 0, r = t.length; e != null && n < r;) e = e[kr(t[n++])]; return n && n == r ? e : void 0; } //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/get.js function jr(e, t, n) { var r = e == null ? void 0 : Ar(e, t); return r === void 0 ? n : r; } //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isString.js var Mr = "[object String]"; function Nr(e) { return typeof e == "string" || !gn(e) && fn(e) && dn(e) == Mr; } //#endregion //#region ../three-is/src/lights/isLight.ts var Pr = (e) => jr(e, "isLight") === !0, Fr = (e) => jr(e, "isSprite") === !0, Ir = (e) => jr(e, "isClippingGroup") === !0, Lr = (e) => jr(e, "isScene") === !0, Rr = /* @__PURE__ */ function(e) { return e.SELECTION = "selection", e.SCENE_TREE_EXCLUDE = "sceneTreeExclude", e; }({}), zr = class t { static originalTransparentMap = /* @__PURE__ */ new WeakMap(); static clamp(e, t, n) { return e < t ? t : e > n ? n : e; } static getObjectMaterials(e) { let t = e; return t.material ? Array.isArray(t.material) ? t.material : [t.material] : []; } static defineMaterialOpacityMapping(e, n = "mappedOpacity", r = .3, i = 1) { if (!e || !n || r >= i) return; Reflect.set(e, "openMappedOpacity", !0), Reflect.set(e, n, !0); let a = i - r; Object.defineProperty(e, n, { configurable: !0, enumerable: !1, get: () => { let n = t.getObjectMaterials(e); if (n.length === 0) return 1; let i = n[0].opacity; if (i <= 0) return 0; let o = (i - r) / a; return t.clamp(o, 0, 1); }, set: (n) => { let i = t.clamp(n, 0, 1), o = i === 0 ? 0 : r + i * a; t.getObjectMaterials(e).forEach((e) => { e.opacity = o, console.log(e.opacity), e.transparent = o < 1, e.visible = o > 0, e.needsUpdate = !0; }); } }); } static removeMaterialOpacityMapping(e, t = "opacity", n = !0) { !e || !t || Object.getOwnPropertyDescriptor(e, t) && (delete e[t], n && Object.defineProperty(e, t, { configurable: !0, enumerable: !1, get: () => { let t = this.getObjectMaterials(e); return t.length === 0 ? 1 : this.clamp(t[0].opacity, 0, 1); }, set: (t) => { let n = this.clamp(t, 0, 1); this.getObjectMaterials(e).forEach((e) => { e.opacity = n, e.transparent = n < 1, e.visible = n > 0, e.needsUpdate = !0; }); } })); } static computeBoundingBox(t) { if (!t) return null; let n = new e.Box3(), r = !1; return t.traverse((t) => { if ((t instanceof e.Mesh || t instanceof e.Line || t instanceof e.Points) && t.geometry) { let i = new e.Box3().setFromBufferAttribute(t.geometry.attributes.position); i.applyMatrix4(t.matrixWorld), n.union(i), r = !0; } }), r ? n : null; } static getBoundingBoxSize(t) { let n = this.computeBoundingBox(t); if (!n) return null; let r = new e.Vector3(); return n.getSize(r), r; } static getBoundingBoxCenter(t) { let n = this.computeBoundingBox(t); if (!n) return null; let r = new e.Vector3(); return n.getCenter(r), r; } static getBoundingBoxFaceCenters(t) { let n = this.computeBoundingBox(t); if (!n) return null; let r = new e.Vector3(); n.getCenter(r); let i = new e.Vector3(); return n.getSize(i), { YF: new e.Vector3(r.x, r.y, r.z + i.z / 2), YB: new e.Vector3(r.x, r.y, r.z - i.z / 2), ZU: new e.Vector3(r.x, r.y + i.y / 2, r.z), ZD: new e.Vector3(r.x, r.y - i.y / 2, r.z), XL: new e.Vector3(r.x - i.x / 2, r.y, r.z), XR: new e.Vector3(r.x + i.x / 2, r.y, r.z) }; } static queryObjectsByName(e, t, n = !1) { let r = []; return e.traverse((e) => { e.name && (n ? e.name === t && r.push(e) : e.name.includes(t) && r.push(e)); }), r; } static setUserDataProperty(e, t, n) { e && (e.userData ||= {}, e.userData[t] = n); } static removeUserDataProperty(e, t) { !e || !e.userData || delete e.userData[t]; } static setSelectionExclude(e, t = !0) { this.setUserDataProperty(e, Rr.SELECTION, t); } static setSceneTreeExclude(e, t = !0) { this.setUserDataProperty(e, Rr.SCENE_TREE_EXCLUDE, t); } static setExcludeAll(e, t = !0) { this.setSelectionExclude(e, t), this.setSceneTreeExclude(e, t); } static setHiddenAndUnselectable(e) { this.setSceneTreeExclude(e, !0), this.setSelectionExclude(e, !1); } static handleMaterialOpacity(e, t, n) { if (Reflect.get(e, "customOpacity")) { t.opacity = n; return; } if (Reflect.get(e, "openMappedOpacity")) { Reflect.set(e, "mappedOpacity", n); return; } n < 1 ? (t.opacity === 1 && this.originalTransparentMap.set(t, t.transparent), t.opacity = n, t.transparent = !0, t.needsUpdate = !0) : n === 1 && (t.opacity === 1 && t.transparent && this.originalTransparentMap.set(t, t.transparent), t.opacity = 1, this.originalTransparentMap.has(t) ? (t.transparent = this.originalTransparentMap.get(t), this.originalTransparentMap.delete(t)) : t.transparent = !1, t.needsUpdate = !0), n === 0 ? t.visible = !1 : t.visible = !0; } static setOpacity(t, n) { t && t.traverse((r) => { (r instanceof e.Mesh || Fr(r)) && r.material && (Array.isArray(r.material) ? r.material.forEach((e) => { this.handleMaterialOpacity(t, e, n); }) : this.handleMaterialOpacity(t, r.material, n)); }); } static getOpacity(e, t = 0) { return !e || !e.material ? 1 : Array.isArray(e.material) && e.material.length >= t ? e.material[t].opacity : Array.isArray(e.material) ? 1 : e.material.opacity; } static getPoints(t) { return t.map((t) => t instanceof e.Vector3 ? t : t && typeof t == "object" && "x" in t && "y" in t && "z" in t ? new e.Vector3(t.x, t.y, t.z) : new e.Vector3(0, 0, 0)); } static setRenderOrder(t, n, r) { t && (t.traverse((t) => { t instanceof e.Mesh && (t.renderOrder = n); }), r && r.length > 0 && r.forEach(({ name: n, renderOrder: r }) => { this.queryObjectsByName(t, n, !0).forEach((t) => { t instanceof e.Mesh && (t.renderOrder = r); }); })); } }, Br = class extends Kt { raycaster = new d(); mouse = new _(); camera = null; scene = null; filterList = []; onDownPosition = new _(); onUpPosition = new _(); selectionBox = null; selectionHelper = null; boxSelectionEnabled = !1; viewer; #e = !1; constructor(e) { super(), this.viewer = e, this.scene = e.scene, this.camera = e.camera, this.#e = e.options?.raycastEnabled ?? !0, this.viewer.emitter.once(Yt.INIT).then(() => { this.enableClick = this.#e; }); } get enableClick() { return this.#e; } set enableClick(e) { this.#e = e; let t = this.viewer.renderer; t && t.domElement && (e ? t.domElement.addEventListener("mousedown", this.onMouseDown) : (t.domElement.removeEventListener("mousedown", this.onMouseDown), document.removeEventListener("mouseup", this.onMouseUp))); } disableRaycast() { let e = this.viewer.renderer; e && e.domElement && (e.domElement.removeEventListener("mousedown", this.onMouseDown), document.removeEventListener("mouseup", this.onMouseUp)), this.enableClick = !1; } addToFilterList(e) { this.filterList.indexOf(e) === -1 && this.filterList.push(e); } removeFromFilterList(e) { let t = this.filterList.indexOf(e); t > -1 && this.filterList.splice(t, 1); } clearFilterList() { this.filterList = []; } getMousePosition(e, t, n) { let r = e.getBoundingClientRect(); return [(t - r.left) / r.width, (n - r.top) / r.height]; } handleClick() { if (!(!this.enableClick || !this.camera || !this.scene) && this.onDownPosition.distanceTo(this.onUpPosition) === 0) { this.mouse.x = this.onUpPosition.x * 2 - 1, this.mouse.y = -(this.onUpPosition.y * 2) + 1, this.raycaster.setFromCamera(this.mouse, this.camera); let e = []; this.scene.traverse((t) => { e.push(t); }); let t = this.raycaster.intersectObjects(e, !1); this.emit(Jt.RAYCAST_PICK_ALL, { intersects: t, object: t.length > 0 ? t[0]?.object : null, point: t.length > 0 ? t[0]?.point : null, face: t.length > 0 ? t[0]?.face : null, distance: t.length > 0 ? t[0]?.distance : null }); let n = t.filter((e) => { let t = e.object; if (this.filterList.indexOf(t) !== -1 || !t.visible || t.userData && t.userData[Rr.SELECTION] !== void 0 && !t.userData[Rr.SELECTION]) return !1; let n = t.parent; for (; n;) { if (n.userData && n.userData[Rr.SELECTION] !== void 0 && !n.userData[Rr.SELECTION]) return !1; n = n.parent; } return !0; }); this.emit(Jt.RAYCAST_PICK, { intersects: n, object: n.length > 0 ? n[0]?.object : null, point: n.length > 0 ? n[0]?.point : null, face: n.length > 0 ? n[0]?.face : null, distance: n.length > 0 ? n[0]?.distance : null }); } } onMouseDown = (e) => { let t = this.viewer.renderer; if (!t || e.target !== t.domElement) return; let [n, r] = this.getMousePosition(t.domElement, e.clientX, e.clientY); this.onDownPosition.set(n, r), document.addEventListener("mouseup", this.onMouseUp); }; onMouseUp = (e) => { let t = this.viewer.renderer; if (!t) return; let [n, r] = this.getMousePosition(t.domElement, e.clientX, e.clientY); this.onUpPosition.set(n, r), this.handleClick(), document.removeEventListener("mouseup", this.onMouseUp); }; enableBoxSelection() { let e = this.camera, t = this.scene, n = this.viewer.renderer; !e || !t || !n || (this.boxSelectionEnabled = !0, this.viewer.cameraControls && (this.viewer.cameraControls.enabled = !1), this.selectionBox = new b(e, t), this.selectionHelper = new x(n, "selectBox"), n.domElement && (n.domElement.addEventListener("pointerdown", this.onBoxSelectionStart), n.domElement.addEventListener("pointermove", this.onBoxSelectionMove), n.domElement.addEventListener("pointerup", this.onBoxSelectionEnd))); } disableBoxSelection() { this.boxSelectionEnabled = !1; let e = this.viewer.renderer; e && e.domElement && (e.domElement.removeEventListener("pointerdown", this.onBoxSelectionStart), e.domElement.removeEventListener("pointermove", this.onBoxSelectionMove), e.domElement.removeEventListener("pointerup", this.onBoxSelectionEnd)), this.viewer.cameraControls && (this.viewer.cameraControls.enabled = !0), this.selectionBox = null, this.selectionHelper = null; } onBoxSelectionStart = (e) => { !this.boxSelectionEnabled || !this.selectionBox || !this.selectionHelper || this.selectionBox.startPoint.set(e.clientX / window.innerWidth * 2 - 1, -(e.clientY / window.innerHeight) * 2 + 1, .5); }; onBoxSelectionMove = (e) => { if (!(!this.boxSelectionEnabled || !this.selectionBox || !this.selectionHelper) && this.selectionHelper.isDown) { this.selectionBox.endPoint.set(e.clientX / window.innerWidth * 2 - 1, -(e.clientY / window.innerHeight) * 2 + 1, .5); let t = this.selectionBox.select(); this.emit(Jt.BOX_SELECTION_MOVE, { data: { objects: t, collection: this.selectionBox.collection } }); } }; onBoxSelectionEnd = (e) => { if (!this.boxSelectionEnabled || !this.selectionBox) return; this.selectionBox.endPoint.set(e.clientX / window.innerWidth * 2 - 1, -(e.clientY / window.innerHeight) * 2 + 1, .5); let t = this.selectionBox.select(); this.emit(Jt.BOX_SELECTION_COMPLETE, { type: Jt.BOX_SELECTION_COMPLETE, data: { objects: t } }); }; }, Vr = /* @__PURE__ */ function(e) { return e.TEXTURE = "texture", e.MATERIAL = "material", e.GEOMETRY = "geometry", e.MODEL = "model", e.RAW_DATA = "raw_data", e; }({}), Hr = class { cache; textureLoader; fbxLoader; gltfLoader; fileLoader; loadingManager; constructor() { this.cache = /* @__PURE__ */ new Map(), this.loadingManager = new e.LoadingManager(), this.textureLoader = new e.TextureLoader(this.loadingManager), this.fbxLoader = new S(this.loadingManager), this.gltfLoader = this.createGLTFLoader(this.loadingManager), this.fileLoader = new e.FileLoader(this.loadingManager); } createGLTFLoader(e) { let t = new w(); t.setDecoderPath("/libs/draco/gltf/"); let n = new T(); n.setTranscoderPath("/libs/basis/"); let r = new C(e); return r.setDRACOLoader(t), r.setKTX2Loader(n), r.setMeshoptDecoder(E), r; } async loadTexture(e, t) { let n = `${Vr.TEXTURE}:${e}`; return this.cache.has(n) ? this.cache.get(n) : new Promise((r, i) => { this.textureLoader.load(e, (e) => { this.cache.set(n, e), r(e); }, (e) => { t && e.lengthComputable && t({ loaded: e.loaded, total: e.total, progress: e.loaded / e.total * 100 }); }, (e) => { i(e); }); }); } async loadFBX(e, t) { let n = `${Vr.MODEL}:${e}`; return this.cache.has(n) ? this.cache.get(n) : new Promise((r, i) => { this.fbxLoader.load(e, (e) => { this.cache.set(n, e), r(e); }, (e) => { t && e.lengthComputable && t({ loaded: e.loaded, total: e.total, progress: e.loaded / e.total * 100 }); }, (e) => { i(e); }); }); } async loadGLTF(e, t) { let n = `${Vr.MODEL}:${e}`; return this.cache.has(n) ? this.cache.get(n) : new Promise((r, i) => { this.gltfLoader.load(e, (e) => { this.cache.set(n, e.scene), r(e.scene); }, (e) => { t && e.lengthComputable && t({ loaded: e.loaded, total: e.total, progress: e.loaded / e.total * 100 }); }, (e) => { i(e); }); }); } async loadRawData(e, t) { let n = `${Vr.RAW_DATA}:${e}`; return this.cache.has(n) ? this.cache.get(n) : new Promise((r, i) => { this.fileLoader.setResponseType("arraybuffer"), this.fileLoader.load(e, (e) => { let t = e; this.cache.set(n, t), r(t); }, (e) => { t && e.lengthComputable && t({ loaded: e.loaded, total: e.total, progress: e.loaded / e.total * 100 }); }, (t) => { i(/* @__PURE__ */ Error(`Failed to load raw data from ${e}: ${t}`)); }); }); } get(e, t) { let n = `${e}:${t}`; return this.cache.get(n); } has(e, t) { let n = `${e}:${t}`; return this.cache.has(n); } remove(e, t) { let n = `${e}:${t}`; return this.cache.delete(n); } clear() { this.cache.clear(); } getCacheSize() { return this.cache.size; } dispose() { this.cache.clear(); } }, Ur = 1.25, Wr = 65535; Wr << 16; var Gr = 2 ** -24, Kr = Symbol("SKIP_GENERATION"), qr = { strategy: 0, maxDepth: 40, maxLeafSize: 10, useSharedArrayBuffer: !1, setBoundingBox: !0, onProgress: null, indirect: !1, verbose: !0, range: null, [Kr]: !1 }; //#endregion //#region ../../node_modules/.pnpm/three-mesh-bvh@0.9.9_three@0.184.0/node_modules/three-mesh-bvh/src/utils/ArrayBoxUtilities.js function Jr(e, t, n) { return n.min.x = t[e], n.min.y = t[e + 1], n.min.z = t[e + 2], n.max.x = t[e + 3], n.max.y = t[e + 4], n.max.z = t[e + 5], n; } function Yr(e) { let t = -1, n = -Infinity; for (let r = 0; r < 3; r++) { let i = e[r + 3] - e[r]; i > n && (n = i, t = r); } return t; } function Xr(e, t) { t.set(e); } function Zr(e, t, n) { let r, i; for (let a = 0; a < 3; a++) { let o = a + 3; r = e[a], i = t[a], n[a] = r < i ? r : i, r = e[o], i = t[o], n[o] = r > i ? r : i; } } function Qr(e, t, n) { for (let r = 0; r < 3; r++) { let i = t[e + 2 * r], a = t[e + 2 * r + 1], o = i - a, s = i + a; o < n[r] && (n[r] = o), s > n[r + 3] && (n[r + 3] = s); } } function $r(e) { let t = e[3] - e[0], n = e[4] - e[1], r = e[5] - e[2]; return 2 * (t * n + n * r + r * t); } //#endregion //#region ../../node_modules/.pnpm/three-mesh-bvh@0.9.9_three@0.184.0/node_modules/three-mesh-bvh/src/core/utils/nodeBufferUtils.js function ei(e, t) { return t[e + 15] === Wr; } function ti(e, t) { return t[e + 6]; } function ni(e, t) { return t[e + 14]; } function ri(e) { return e + 8; } function ii(e, t) { return e + t[e + 6] * 8; } function ai(e, t) { return t[e + 7]; } function oi(e) { return e; } //#endregion //#region ../../node_modules/.pnpm/three-mesh-bvh@0.9.9_three@0.184.0/node_modules/three-mesh-bvh/src/core/build/computeBoundsUtils.js function si(e, t, n, r, i) { let a = Infinity, o = Infinity, s = Infinity, c = -Infinity, l = -Infinity, u = -Infinity, d = Infinity, f = Infinity, p = Infinity, m = -Infinity, h = -Infinity, g = -Infinity, _ = e.offset || 0; for (let r = (t - _) * 6, i = (t + n - _) * 6; r < i; r += 6) { let t = e[r + 0], n = e[r + 1], i = t - n, _ = t + n; i < a && (a = i), _ > c && (c = _), t < d && (d = t), t > m && (m = t); let v = e[r + 2], y = e[r + 3], b = v - y, x = v + y; b < o && (o = b), x > l && (l = x), v < f && (f = v), v > h && (h = v); let S = e[r + 4], C = e[r + 5], w = S - C, T = S + C; w < s && (s = w), T > u && (u = T), S < p && (p = S), S > g && (g = S); } r[0] = a, r[1] = o, r[2] = s, r[3] = c, r[4] = l, r[5] = u, i[0] = d, i[1] = f, i[2] = p, i[3] = m, i[4] = h, i[5] = g; } //#endregion //#region ../../node_modules/.pnpm/three-mesh-bvh@0.9.9_three@0.184.0/node_modules/three-mesh-bvh/src/core/build/splitUtils.js var ci = 32, li = (e, t) => e.candidate - t.candidate, ui = /* @__PURE__ */ Array(ci).fill().map(() => ({ count: 0, bounds: new Float32Array(6), rightCacheBounds: new Float32Array(6), leftCacheBounds: new Float32Array(6), candidate: 0 })), di = /* @__PURE__ */ new Float32Array(6); function fi(e, t, n, r, i, a) { let o = -1, s = 0; if (a === 0) o = Yr(t), o !== -1 && (s = (t[o] + t[o + 3]) / 2); else if (a === 1) o = Yr(e), o !== -1 && (s = pi(n, r, i, o)); else if (a === 2) { let a = $r(e), c = Ur * i, l = n.offset || 0, u = (r - l) * 6, d = (r + i - l) * 6; for (let e = 0; e < 3; e++) { let r = t[e], l = (t[e + 3] - r) / ci; if (i < ci / 4) { let t = [...ui]; t.length = i; let r = 0; for (let i = u; i < d; i += 6, r++) { let a = t[r]; a.candidate = n[i + 2 * e], a.count = 0; let { bounds: o, leftCacheBounds: s, rightCacheBounds: c } = a; for (let e = 0; e < 3; e++) c[e] = Infinity, c[e + 3] = -Infinity, s[e] = Infinity, s[e + 3] = -Infinity, o[e] = Infinity, o[e + 3] = -Infinity; Qr(i, n, o); } t.sort(li); let l = i; for (let e = 0; e < l; e++) { let n = t[e]; for (; e + 1 < l && t[e + 1].candidate === n.candidate;) t.splice(e + 1, 1), l--; } for (let r = u; r < d; r += 6) { let i = n[r + 2 * e]; for (let e = 0; e < l; e++) { let a = t[e]; i >= a.candidate ? Qr(r, n, a.rightCacheBounds) : (Qr(r, n, a.leftCacheBounds), a.count++); } } for (let n = 0; n < l; n++) { let r = t[n], l = r.count, u = i - r.count, d = r.leftCacheBounds, f = r.rightCacheBounds, p = 0; l !== 0 && (p = $r(d) / a); let m = 0; u !== 0 && (m = $r(f) / a); let h = 1 + Ur * (p * l + m * u); h < c && (o = e, c = h, s = r.candidate); } } else { for (let e = 0; e < ci; e++) { let t = ui[e]; t.count = 0, t.candidate = r + l + e * l; let n = t.bounds; for (let e = 0; e < 3; e++) n[e] = Infinity, n[e + 3] = -Infinity; } for (let t = u; t < d; t += 6) { let i = ~~((n[t + 2 * e] - r) / l); i >= ci && (i = ci - 1); let a = ui[i]; a.count++, Qr(t, n, a.bounds); } let t = ui[ci - 1]; Xr(t.bounds, t.rightCacheBounds); for (let e = ci - 2; e >= 0; e--) { let t = ui[e], n = ui[e + 1]; Zr(t.bounds, n.rightCacheBounds, t.rightCacheBounds); } let f = 0; for (let t = 0; t < ci - 1; t++) { let n = ui[t], r = n.count, l = n.bounds, u = ui[t + 1].rightCacheBounds; r !== 0 && (f === 0 ? Xr(l, di) : Zr(l, di, di)), f += r; let d = 0, p = 0; f !== 0 && (d = $r(di) / a); let m = i - f; m !== 0 && (p = $r(u) / a); let h = 1 + Ur * (d * f + p * m); h < c && (o = e, c = h, s = n.candidate); } } } } else console.warn(`BVH: Invalid build strategy value ${a} used.`); return { axis: o, pos: s }; } function pi(e, t, n, r) { let i = 0, a = e.offset; for (let o = t, s = t + n; o < s; o++) i += e[(o - a) * 6 + r * 2]; return i / n; } //#endregion //#region ../../node_modules/.pnpm/three-mesh-bvh@0.9.9_three@0.184.0/node_modules/three-mesh-bvh/src/core/BVHNode.js var mi = class { constructor() { this.boundingData = new Float32Array(6); } }; //#endregion //#region ../../node_modules/.pnpm/three-mesh-bvh@0.9.9_three@0.184.0/node_modules/three-mesh-bvh/src/core/build/sortUtils.js function hi(e, t, n, r, i, a) { let o = r, s = r + i - 1, c = a.pos, l = a.axis * 2, u = n.offset || 0; for (;;) { for (; o <= s && n[(o - u) * 6 + l] < c;) o++; for (; o <= s && n[(s - u) * 6 + l] >= c;) s--; if (o < s) { for (let n = 0; n < t; n++) { let r = e[o * t + n]; e[o * t + n] = e[s * t + n], e[s * t + n] = r; } for (let e = 0; e < 6; e++) { let t = o - u, r = s - u, i = n[t * 6 + e]; n[t * 6 + e] = n[r * 6 + e], n[r * 6 + e] = i; } o++, s--; } else return o; } } //#endregion //#region ../../node_modules/.pnpm/three-mesh-bvh@0.9.9_three@0.184.0/node_modules/three-mesh-bvh/src/core/build/buildUtils.js var gi, _i, vi, yi, bi = 2 ** 32; function xi(e) { return "count" in e ? 1 : 1 + xi(e.left) + xi(e.right); } function Si(e, t, n) { return gi = new Float32Array(n), _i = new Uint32Array(n), vi = new Uint16Array(n), yi = new Uint8Array(n), Ci(e, t); } function Ci(e, t) { let n = e / 4, r = e / 2, i = "count" in t, a = t.boundingData; for (let e = 0; e < 6; e++) gi[n + e] = a[e]; if (i) return t.buffer ? (yi.set(new Uint8Array(t.buffer), e), e + t.buffer.byteLength) : (_i[n + 6] = t.offset, vi[r + 14] = t.count, vi[r + 15] = Wr, e + 32); { let { left: r, right: i, splitAxis: a } = t, o = Ci(e + 32, r), s = e / 32, c = o / 32 - s; if (c > bi) throw Error("MeshBVH: Cannot store relative child node offset greater than 32 bits."); return _i[n + 6] = c, _i[n + 7] = a, Ci(o, i); } } //#endregion //#region ../../node_modules/.pnpm/three-mesh-bvh@0.9.9_three@0.184.0/node_modules/three-mesh-bvh/src/core/build/buildTree.js function wi(e, t, n, r, i, a) { let { maxDepth: o, verbose: s, maxLeafSize: c, strategy: l, onProgress: u } = i, d = e.primitiveBuffer, f = e.primitiveBufferStride, p = new Float32Array(6), m = !1, h = new mi(); return si(t, n, r, h.boundingData, p), _(h, n, r, p), h; function g(e) { u && u((e - a.offset) / a.count); } function _(e, n, r, i = null, a = 0) { if (!m && a >= o && (m = !0, s && console.warn(`BVH: Max depth of ${o} reached when generating BVH. Consider increasing maxDepth.`)), r <= c || a >= o) return g(n + r), e.offset = n, e.count = r, e; let u = fi(e.boundingData, i, t, n, r, l); if (u.axis === -1) return g(n + r), e.offset = n, e.count = r, e; let h = hi(d, f, t, n, r, u); if (h === n || h === n + r) g(n + r), e.offset = n, e.count = r; else { e.splitAxis = u.axis; let i = new mi(), o = n, s = h - n; e.left = i, si(t, o, s, i.boundingData, p), _(i, o, s, p, a + 1); let c = new mi(), l = h, d = r - s; e.right = c, si(t, l, d, c.boundingData, p), _(c, l, d, p, a + 1); } return e; } } function Ti(e, t) { let n = t.useSharedArrayBuffer ? SharedArrayBuffer : ArrayBuffer, r = e.getRootRanges(t.range), i = r[0], a = r[r.length - 1], o = { offset: i.offset, count: a.offset + a.count - i.offset }, s = new Float32Array(6 * o.count); s.offset = o.offset, e.computePrimitiveBounds(o.offset, o.count, s), e._roots = r.map((r) => { let i = wi(e, s, r.offset, r.count, t, o), a = new n(32 * xi(i)); return Si(0, i, a), a; }); } //#endregion //#region ../../node_modules/.pnpm/three-mesh-bvh@0.9.9_three@0.184.0/node_modules/three-mesh-bvh/src/utils/PrimitivePool.js var Ei = class { constructor(e) { this._getNewPrimitive = e, this._primitives = []; } getPrimitive() { let e = this._primitives; return e.length === 0 ? this._getNewPrimitive() : e.pop(); } releasePrimitive(e) { this._primitives.push(e); } }, Di = /* @__PURE__ */ new class { constructor() { this.float32Array = null, this.uint16Array = null, this.uint32Array = null; let e = [], t = null; this.setBuffer = (n) => { t && e.push(t), t = n, this.float32Array = new Float32Array(n), this.uint16Array = new Uint16Array(n), this.uint32Array = new Uint32Array(n); }, this.clearBuffer = () => { t = null, this.float32Array = null, this.uint16Array = null, this.uint32Array = null, e.length !== 0 && this.setBuffer(e.pop()); }; } }(), Oi, ki, Ai = [], ji = /* @__PURE__ */ new Ei(() => new k()); function Mi(e, t, n, r, i, a) { Oi = ji.getPrimitive(), ki = ji.getPrimitive(), Ai.push(Oi, ki), Di.setBuffer(e._roots[t]); let o = Ni(0, e.geometry, n, r, i, a); Di.clearBuffer(), ji.releasePrimitive(Oi), ji.releasePrimitive(ki), Ai.pop(), Ai.pop(); let s = Ai.length; return s > 0 && (ki = Ai[s - 1], Oi = Ai[s - 2]), o; } function Ni(e, t, n, r, i = null, a = 0, o = 0) { let { float32Array: s, uint16Array: c, uint32Array: l } = Di, u = e * 2; if (ei(u, c)) { let t = ti(e, l), n = ni(u, c); return Jr(oi(e), s, Oi), r(t, n, !1, o, a + e / 8, Oi); } else { let u = ri(e), d = ii(e, l), f = u, p = d, m, h, g, _; if (i && (g = Oi, _ = ki, Jr(oi(f), s, g), Jr(oi(p), s, _), m = i(g), h = i(_), h < m)) { f = d, p = u; let e = m; m = h, h = e, g = _; } g || (g = Oi, Jr(oi(f), s, g)); let v = ei(f * 2, c), y = n(g, v, m, o + 1, a + f / 8), b; if (y === 2) { let e = w(f); b = r(e, T(f) - e, !0, o + 1, a + f / 8, g); } else b = y && Ni(f, t, n, r, i, a, o + 1); if (b) return !0; _ = ki, Jr(oi(p), s, _); let x = ei(p * 2, c), S = n(_, x, h, o + 1, a + p / 8), C; if (S === 2) { let e = w(p); C = r(e, T(p) - e, !0, o + 1, a + p / 8, _); } else C = S && Ni(p, t, n, r, i, a, o + 1); if (C) return !0; return !1; function w(e) { let { uint16Array: t, uint32Array: n } = Di, r = e * 2; for (; !ei(r, t);) e = ri(e), r = e * 2; return ti(e, n); } function T(e) { let { uint16Array: t, uint32Array: n } = Di, r = e * 2; for (; !ei(r, t);) e = ii(e, n), r = e * 2; return ti(e, n) + ni(r, t); } } } //#endregion //#region ../../node_modules/.pnpm/three-mesh-bvh@0.9.9_three@0.184.0/node_modules/three-mesh-bvh/src/core/cast/bvhcast.js var Pi = /* @__PURE__ */ new Di.constructor(), Fi = /* @__PURE__ */ new Di.constructor(), Ii = /* @__PURE__ */ new Ei(() => new k()), Li = /* @__PURE__ */ new k(), Ri = /* @__PURE__ */ new k(), zi = /* @__PURE__ */ new k(), Bi = /* @__PURE__ */ new k(), Vi = !1; function Hi(e, t, n, r) { if (Vi) throw Error("MeshBVH: Recursive calls to bvhcast not supported."); Vi = !0; let i = e._roots, a = t._roots, o, s = 0, c = 0, l = new H().copy(n).invert(); for (let e = 0, t = i.length; e < t; e++) { Pi.setBuffer(i[e]), c = 0; let t = Ii.getPrimitive(); Jr(oi(0), Pi.float32Array, t), t.applyMatrix4(l); for (let e = 0, i = a.length; e < i && (Fi.setBuffer(a[e]), o = Ui(0, 0, n, l, r, s, c, 0, 0, t), Fi.clearBuffer(), c += a[e].byteLength / 32, !o); e++); if (Ii.releasePrimitive(t), Pi.clearBuffer(), s += i[e].byteLength / 32, o) break; } return Vi = !1, o; } function Ui(e, t, n, r, i, a = 0, o = 0, s = 0, c = 0, l = null, u = !1) { let d, f; u ? (d = Fi, f = Pi) : (d = Pi, f = Fi); let p = d.float32Array, m = d.uint32Array, h = d.uint16Array, g = f.float32Array, _ = f.uint32Array, v = f.uint16Array, y = e * 2, b = t * 2, x = ei(y, h), S = ei(b, v), C = !1; if (S && x) C = u ? i(ti(t, _), ni(t * 2, v), ti(e, m), ni(e * 2, h), c, o + t / 8, s, a + e / 8) : i(ti(e, m), ni(e * 2, h), ti(t, _), ni(t * 2, v), s, a + e / 8, c, o + t / 8); else if (S) { let l = Ii.getPrimitive(); Jr(oi(t), g, l), l.applyMatrix4(n); let d = ri(e), f = ii(e, m); Jr(oi(d), p, Li), Jr(oi(f), p, Ri); let h = l.intersectsBox(Li), _ = l.intersectsBox(Ri); C = h && Ui(t, d, r, n, i, o, a, c, s + 1, l, !u) || _ && Ui(t, f, r, n, i, o, a, c, s + 1, l, !u), Ii.releasePrimitive(l); } else { let d = ri(t), f = ii(t, _); Jr(oi(d), g, zi), Jr(oi(f), g, Bi); let h = l.intersectsBox(zi), v = l.intersectsBox(Bi); if (h && v) C = Ui(e, d, n, r, i, a, o, s, c + 1, l, u) || Ui(e, f, n, r, i, a, o, s, c + 1, l, u); else if (h) if (x) C = Ui(e, d, n, r, i, a, o, s, c + 1, l, u); else { let t = Ii.getPrimitive(); t.copy(zi).applyMatrix4(n); let l = ri(e), f = ii(e, m); Jr(oi(l), p, Li), Jr(oi(f), p, Ri); let h = t.intersectsBox(Li), g = t.intersectsBox(Ri); C = h && Ui(d, l, r, n, i, o, a, c, s + 1, t, !u) || g && Ui(d, f, r, n, i, o, a, c, s + 1, t, !u), Ii.releasePrimitive(t); } else if (v) if (x) C = Ui(e, f, n, r, i, a, o, s, c + 1, l, u); else { let t = Ii.getPrimitive(); t.copy(Bi).applyMatrix4(n); let l = ri(e), d = ii(e, m); Jr(oi(l), p, Li), Jr(oi(d), p, Ri); let h = t.intersectsBox(Li), g = t.intersectsBox(Ri); C = h && Ui(f, l, r, n, i, o, a, c, s + 1, t, !u) || g && Ui(f, d, r, n, i, o, a, c, s + 1, t, !u), Ii.releasePrimitive(t); } } return C; } //#endregion //#region ../../node_modules/.pnpm/three-mesh-bvh@0.9.9_three@0.184.0/node_modules/three-mesh-bvh/src/core/BVH.js var Wi = /* @__PURE__ */ new k(), Gi = /* @__PURE__ */ new Float32Array(6), Ki = class { constructor() { this._roots = null, this.primitiveBuffer = null, this.primitiveBufferStride = null; } init(e) { e = { ...qr, ...e }, Ti(this, e); } getRootRanges() { throw Error("BVH: getRootRanges() not implemented"); } writePrimitiveBounds() { throw Error("BVH: writePrimitiveBounds() not implemented"); } writePrimitiveRangeBounds(e, t, n, r) { let i = Infinity, a = Infinity, o = Infinity, s = -Infinity, c = -Infinity, l = -Infinity; for (let n = e, r = e + t; n < r; n++) { this.writePrimitiveBounds(n, Gi, 0); let [e, t, r, u, d, f] = Gi; e < i && (i = e), u > s && (s = u), t < a && (a = t), d > c && (c = d), r < o && (o = r), f > l && (l = f); } return n[r + 0] = i, n[r + 1] = a, n[r + 2] = o, n[r + 3] = s, n[r + 4] = c, n[r + 5] = l, n; } computePrimitiveBounds(e, t, n) { let r = n.offset || 0; for (let i = e, a = e + t; i < a; i++) { this.writePrimitiveBounds(i, Gi, 0); let [e, t, a, o, s, c] = Gi, l = (e + o) / 2, u = (t + s) / 2, d = (a + c) / 2, f = (o - e) / 2, p = (s - t) / 2, m = (c - a) / 2, h = (i - r) * 6; n[h + 0] = l, n[h + 1] = f + (Math.abs(l) + f) * Gr, n[h + 2] = u, n[h + 3] = p + (Math.abs(u) + p) * Gr, n[h + 4] = d, n[h + 5] = m + (Math.abs(d) + m) * Gr; } return n; } shiftPrimitiveOffsets(e) { let t = this._indirectBuffer; if (t) for (let n = 0, r = t.length; n < r; n++) t[n] += e; else { let t = this._roots; for (let n = 0; n < t.length; n++) { let r = t[n], i = new Uint32Array(r), a = new Uint16Array(r), o = r.byteLength / 32; for (let t = 0; t < o; t++) { let n = 8 * t; ei(2 * n, a) && (i[n + 6] += e); } } } } traverse(e, t = 0) { let n = this._roots[t], r = new Uint32Array(n), i = new Uint16Array(n); a(0); function a(t, o = 0) { let s = t * 2, c = ei(s, i); if (c) { let a = r[t + 6], l = i[s + 14]; e(o, c, new Float32Array(n, t * 4, 6), a, l); } else { let i = ri(t), s = ii(t, r), l = ai(t, r); e(o, c, new Float32Array(n, t * 4, 6), l) || (a(i, o + 1), a(s, o + 1)); } } } refit() { let e = this._roots; for (let t = 0, n = e.length; t < n; t++) { let n = e[t], r = new Uint32Array(n), i = new Uint16Array(n), a = new Float32Array(n), o = n.byteLength / 32; for (let e = o - 1; e >= 0; e--) { let t = e * 8, n = t * 2; if (ei(n, i)) { let e = ti(t, r), o = ni(n, i); this.writePrimitiveRangeBounds(e, o, Gi, 0), a.set(Gi, t); } else { let e = ri(t), n = ii(t, r); for (let r = 0; r < 3; r++) { let i = a[e + r], o = a[e + r + 3], s = a[n + r], c = a[n + r + 3]; a[t + r] = i < s ? i : s, a[t + r + 3] = o > c ? o : c; } } } } } getBoundingBox(e) { return e.makeEmpty(), this._roots.forEach((t) => { Jr(0, new Float32Array(t), Wi), e.union(Wi); }), e; } shapecast(e) { let { boundsTraverseOrder: t, intersectsBounds: n, intersectsRange: r, intersectsPrimitive: i, scratchPrimitive: a, iterate: o } = e; if (r && i) { let e = r; r = (t, n, r, s, c) => e(t, n, r, s, c) ? !0 : o(t, n, this, i, r, s, a); } else r ||= i ? (e, t, n, r) => o(e, t, this, i, n, r, a) : (e, t, n) => n; let s = !1, c = 0, l = this._roots; for (let e = 0, i = l.length; e < i; e++) { let i = l[e]; if (s = Mi(this, e, n, r, t, c), s) break; c += i.byteLength / 32; } return s; } bvhcast(e, t, n) { let { intersectsRanges: r } = n; return Hi(this, e, t, r); } }; //#endregion //#region ../../node_modules/.pnpm/three-mesh-bvh@0.9.9_three@0.184.0/node_modules/three-mesh-bvh/src/utils/BufferUtils.js function qi() { return typeof SharedArrayBuffer < "u"; } //#endregion //#region ../../node_modules/.pnpm/three-mesh-bvh@0.9.9_three@0.184.0/node_modules/three-mesh-bvh/src/core/build/geometryUtils.js function Ji(e) { return e.index ? e.index.count : e.attributes.position.count; } function Yi(e) { return Ji(e) / 3; } function Xi(e, t = ArrayBuffer) { return e > 65535 ? new Uint32Array(new t(4 * e)) : new Uint16Array(new t(2 * e)); } function Zi(e, t) { if (!e.index) { let n = e.attributes.position.count, r = Xi(n, t.useSharedArrayBuffer ? SharedArrayBuffer : ArrayBuffer); e.setIndex(new j(r, 1)); for (let e = 0; e < n; e++) r[e] = e; } } function Qi(e, t, n) { let r = Ji(e) / n, i = t || e.drawRange, a = i.start / n, o = (i.start + i.count) / n, s = Math.max(0, a), c = Math.min(r, o) - s; return { offset: Math.floor(s), count: Math.floor(c) }; } function $i(e, t) { return e.groups.map((e) => ({ offset: e.start / t, count: e.count / t })); } function ea(e, t, n) { let r = Qi(e, t, n), i = $i(e, n); if (!i.length) return [r]; let a = [], o = r.offset, s = r.offset + r.count, c = Ji(e) / n, l = []; for (let e of i) { let { offset: t, count: n } = e, r = t, i = t + (isFinite(n) ? n : c - t); r < s && i > o && (l.push({ pos: Math.max(o, r), isStart: !0 }), l.push({ pos: Math.min(s, i), isStart: !1 })); } l.sort((e, t) => e.pos === t.pos ? e.type === "end" ? -1 : 1 : e.pos - t.pos); let u = 0, d = null; for (let e of l) { let t = e.pos; u !== 0 && t !== d && a.push({ offset: d, count: t - d }), u += e.isStart ? 1 : -1, d = t; } return a; } //#endregion //#region ../../node_modules/.pnpm/three-mesh-bvh@0.9.9_three@0.184.0/node_modules/three-mesh-bvh/src/core/GeometryBVH.js function ta(e, t) { let n = e[e.length - 1], r = n.offset + n.count > 2 ** 16, i = e.reduce((e, t) => e + t.count, 0), a = r ? 4 : 2, o = t ? new SharedArrayBuffer(i * a) : new ArrayBuffer(i * a), s = r ? new Uint32Array(o) : new Uint16Array(o), c = 0; for (let t = 0; t < e.length; t++) { let { offset: n, count: r } = e[t]; for (let e = 0; e < r; e++) s[c + e] = n + e; c += r; } return s; } var na = class extends Ki { get indirect() { return !!this._indirectBuffer; } get primitiveStride() { return null; } get primitiveBufferStride() { return this.indirect ? 1 : this.primitiveStride; } set primitiveBufferStride(e) {} get primitiveBuffer() { return this.indirect ? this._indirectBuffer : this.geometry.index.array; } set primitiveBuffer(e) {} constructor(e, t = {}) { if (!e.isBufferGeometry) throw Error("BVH: Only BufferGeometries are supported."); if (e.index && e.index.isInterleavedBufferAttribute) throw Error("BVH: InterleavedBufferAttribute is not supported for the index attribute."); if (t.useSharedArrayBuffer && !qi()) throw Error("BVH: SharedArrayBuffer is not available."); super(), this.geometry = e, this.resolvePrimitiveIndex = t.indirect ? (e) => this._indirectBuffer[e] : (e) => e, this.primitiveBuffer = null, this.primitiveBufferStride = null, this._indirectBuffer = null, t = { ...qr, ...t }, t[Kr] || this.init(t); } init(e) { let { geometry: t, primitiveStride: n } = this; e.indirect ? this._indirectBuffer = ta(ea(t, e.range, n), e.useSharedArrayBuffer) : Zi(t, e), super.init(e), !t.boundingBox && e.setBoundingBox && (t.boundingBox = this.getBoundingBox(new k())); } getRootRanges(e) { return this.indirect ? [{ offset: 0, count: this._indirectBuffer.length }] : ea(this.geometry, e, this.primitiveStride); } raycastObject3D() { throw Error("BVH: raycastObject3D() not implemented"); } }, ra = class { constructor() { this.min = Infinity, this.max = -Infinity; } setFromPointsField(e, t) { let n = Infinity, r = -Infinity; for (let i = 0, a = e.length; i < a; i++) { let a = e[i][t]; n = a < n ? a : n, r = a > r ? a : r; } this.min = n, this.max = r; } setFromPoints(e, t) { let n = Infinity, r = -Infinity; for (let i = 0, a = t.length; i < a; i++) { let a = t[i], o = e.dot(a); n = o < n ? o : n, r = o > r ? o : r; } this.min = n, this.max = r; } isSeparated(e) { return this.min > e.max || e.min > this.max; } }; ra.prototype.setFromBox = (function() { let e = /* @__PURE__ */ new W(); return function(t, n) { let r = n.min, i = n.max, a = Infinity, o = -Infinity; for (let n = 0; n <= 1; n++) for (let s = 0; s <= 1; s++) for (let c = 0; c <= 1; c++) { e.x = r.x * n + i.x * (1 - n), e.y = r.y * s + i.y * (1 - s), e.z = r.z * c + i.z * (1 - c); let l = t.dot(e); a = Math.min(l, a), o = Math.max(l, o); } this.min = a, this.max = o; }; })(), (function() { let e = /* @__PURE__ */ new ra(); return function(t, n) { let r = t.points, i = t.satAxes, a = t.satBounds, o = n.points, s = n.satAxes, c = n.satBounds; for (let t = 0; t < 3; t++) { let n = a[t], r = i[t]; if (e.setFromPoints(r, o), n.isSeparated(e)) return !1; } for (let t = 0; t < 3; t++) { let n = c[t], i = s[t]; if (e.setFromPoints(i, r), n.isSeparated(e)) return !1; } }; })(); //#endregion //#region ../../node_modules/.pnpm/three-mesh-bvh@0.9.9_three@0.184.0/node_modules/three-mesh-bvh/src/math/MathUtilities.js var ia = (function() { let e = /* @__PURE__ */ new W(), t = /* @__PURE__ */ new W(), n = /* @__PURE__ */ new W(); return function(r, i, a) { let o = r.start, s = e, c = i.start, l = t; n.subVectors(o, c), e.subVectors(r.end, r.start), t.subVectors(i.end, i.start); let u = n.dot(l), d = l.dot(s), f = l.dot(l), p = n.dot(s), m = s.dot(s) * f - d * d, h, g; h = m === 0 ? 0 : (u * d - p * f) / m, g = (u + h * d) / f, a.x = h, a.y = g; }; })(), aa = (function() { let e = /* @__PURE__ */ new de(), t = /* @__PURE__ */ new W(), n = /* @__PURE__ */ new W(); return function(r, i, a, o) { ia(r, i, e); let s = e.x, c = e.y; if (s >= 0 && s <= 1 && c >= 0 && c <= 1) { r.at(s, a), i.at(c, o); return; } else if (s >= 0 && s <= 1) { c < 0 ? i.at(0, o) : i.at(1, o), r.closestPointToPoint(o, !0, a); return; } else if (c >= 0 && c <= 1) { s < 0 ? r.at(0, a) : r.at(1, a), i.closestPointToPoint(a, !0, o); return; } else { let e; e = s < 0 ? r.start : r.end; let l; l = c < 0 ? i.start : i.end; let u = t, d = n; if (r.closestPointToPoint(l, !0, t), i.closestPointToPoint(e, !0, n), u.distanceToSquared(l) <= d.distanceToSquared(e)) { a.copy(u), o.copy(l); return; } else { a.copy(e), o.copy(d); return; } } }; })(), oa = (function() { let e = /* @__PURE__ */ new W(), t = /* @__PURE__ */ new W(), n = /* @__PURE__ */ new re(), r = /* @__PURE__ */ new R(); return function(i, a) { let { radius: o, center: s } = i, { a: c, b: l, c: u } = a; if (r.start = c, r.end = l, r.closestPointToPoint(s, !0, e).distanceTo(s) <= o || (r.start = c, r.end = u, r.closestPointToPoint(s, !0, e).distanceTo(s) <= o) || (r.start = l, r.end = u, r.closestPointToPoint(s, !0, e).distanceTo(s) <= o)) return !0; let d = a.getPlane(n); if (Math.abs(d.distanceToPoint(s)) <= o) { let e = d.projectPoint(s, t); if (a.containsPoint(e)) return !0; } return !1; }; })(), sa = [ "x", "y", "z" ], ca = 1e-15, la = ca * ca; function ua(e) { return Math.abs(e) < ca; } var da = class extends ue { constructor(...e) { super(...e), this.isExtendedTriangle = !0, this.satAxes = [ , , , , ].fill().map(() => new W()), this.satBounds = [ , , , , ].fill().map(() => new ra()), this.points = [ this.a, this.b, this.c ], this.plane = new re(), this.isDegenerateIntoSegment = !1, this.isDegenerateIntoPoint = !1, this.degenerateSegment = new R(), this.needsUpdate = !0; } intersectsSphere(e) { return oa(e, this); } update() { let e = this.a, t = this.b, n = this.c, r = this.points, i = this.satAxes, a = this.satBounds, o = i[0], s = a[0]; this.getNormal(o), s.setFromPoints(o, r); let c = i[1], l = a[1]; c.subVectors(e, t), l.setFromPoints(c, r); let u = i[2], d = a[2]; u.subVectors(t, n), d.setFromPoints(u, r); let f = i[3], p = a[3]; f.subVectors(n, e), p.setFromPoints(f, r); let m = c.length(), h = u.length(), g = f.length(); this.isDegenerateIntoPoint = !1, this.isDegenerateIntoSegment = !1, m < ca ? h < ca || g < ca ? this.isDegenerateIntoPoint = !0 : (this.isDegenerateIntoSegment = !0, this.degenerateSegment.start.copy(e), this.degenerateSegment.end.copy(n)) : h < ca ? g < ca ? this.isDegenerateIntoPoint = !0 : (this.isDegenerateIntoSegment = !0, this.degenerateSegment.start.copy(t), this.degenerateSegment.end.copy(e)) : g < ca && (this.isDegenerateIntoSegment = !0, this.degenerateSegment.start.copy(n), this.degenerateSegment.end.copy(t)), this.plane.setFromNormalAndCoplanarPoint(o, e), this.needsUpdate = !1; } }; da.prototype.closestPointToSegment = (function() { let e = /* @__PURE__ */ new W(), t = /* @__PURE__ */ new W(), n = /* @__PURE__ */ new R(); return function(r, i = null, a = null) { let { start: o, end: s } = r, c = this.points, l, u = Infinity; for (let o = 0; o < 3; o++) { let s = (o + 1) % 3; n.start.copy(c[o]), n.end.copy(c[s]), aa(n, r, e, t), l = e.distanceToSquared(t), l < u && (u = l, i && i.copy(e), a && a.copy(t)); } return this.closestPointToPoint(o, e), l = o.distanceToSquared(e), l < u && (u = l, i && i.copy(e), a && a.copy(o)), this.closestPointToPoint(s, e), l = s.distanceToSquared(e), l < u && (u = l, i && i.copy(e), a && a.copy(s)), Math.sqrt(u); }; })(), da.prototype.intersectsTriangle = (function() { let e = /* @__PURE__ */ new da(), t = /* @__PURE__ */ new ra(), n = /* @__PURE__ */ new ra(), r = /* @__PURE__ */ new W(), i = /* @__PURE__ */ new W(), a = /* @__PURE__ */ new W(), o = /* @__PURE__ */ new W(), s = /* @__PURE__ */ new R(), c = /* @__PURE__ */ new R(), l = /* @__PURE__ */ new W(), u = /* @__PURE__ */ new de(), d = /* @__PURE__ */ new de(); function f(e, i, a, s) { let c = r; !e.isDegenerateIntoPoint && !e.isDegenerateIntoSegment ? c.copy(e.plane.normal) : c.copy(i.plane.normal); let l = e.satBounds, u = e.satAxes; for (let r = 1; r < 4; r++) { let a = l[r], s = u[r]; if (t.setFromPoints(s, i.points), a.isSeparated(t) || (o.copy(c).cross(s), t.setFromPoints(o, e.points), n.setFromPoints(o, i.points), t.isSeparated(n))) return !1; } let d = i.satBounds, f = i.satAxes; for (let r = 1; r < 4; r++) { let a = d[r], s = f[r]; if (t.setFromPoints(s, e.points), a.isSeparated(t) || (o.crossVectors(c, s), t.setFromPoints(o, e.points), n.setFromPoints(o, i.points), t.isSeparated(n))) return !1; } return a && (s || console.warn("ExtendedTriangle.intersectsTriangle: Triangles are coplanar which does not support an output edge. Setting edge to 0, 0, 0."), a.start.set(0, 0, 0), a.end.set(0, 0, 0)), !0; } function p(e, t, n, r, i, a, o, s, c, l, u) { let d = o / (o - s); l.x = r + (i - r) * d, u.start.subVectors(t, e).multiplyScalar(d).add(e), d = o / (o - c), l.y = r + (a - r) * d, u.end.subVectors(n, e).multiplyScalar(d).add(e); } function m(e, t, n, r, i, a, o, s, c, l, u) { if (i > 0) p(e.c, e.a, e.b, r, t, n, c, o, s, l, u); else if (a > 0) p(e.b, e.a, e.c, n, t, r, s, o, c, l, u); else if (s * c > 0 || o != 0) p(e.a, e.b, e.c, t, n, r, o, s, c, l, u); else if (s != 0) p(e.b, e.a, e.c, n, t, r, s, o, c, l, u); else if (c != 0) p(e.c, e.a, e.b, r, t, n, c, o, s, l, u); else return !0; return !1; } function h(e, t, n, i) { let a = t.degenerateSegment, o = e.plane.distanceToPoint(a.start), s = e.plane.distanceToPoint(a.end); return ua(o) ? ua(s) ? f(e, t, n, i) : (n && (n.start.copy(a.start), n.end.copy(a.start)), e.containsPoint(a.start)) : ua(s) ? (n && (n.start.copy(a.end), n.end.copy(a.end)), e.containsPoint(a.end)) : e.plane.intersectLine(a, r) == null ? !1 : (n && (n.start.copy(r), n.end.copy(r)), e.containsPoint(r)); } function g(e, t, n) { let r = t.a; return ua(e.plane.distanceToPoint(r)) && e.containsPoint(r) ? (n && (n.start.copy(r), n.end.copy(r)), !0) : !1; } function _(e, t, n) { let i = e.degenerateSegment, a = t.a; return i.closestPointToPoint(a, !0, r), a.distanceToSquared(r) < la ? (n && (n.start.copy(a), n.end.copy(a)), !0) : !1; } function v(e, t, n, o) { if (e.isDegenerateIntoSegment) if (t.isDegenerateIntoSegment) { let o = e.degenerateSegment, s = t.degenerateSegment, c = i, l = a; o.delta(c), s.delta(l); let u = r.subVectors(s.start, o.start), d = c.x * l.y - c.y * l.x; if (ua(d)) return !1; let f = (u.x * l.y - u.y * l.x) / d, p = -(c.x * u.y - c.y * u.x) / d; return f < 0 || f > 1 || p < 0 || p > 1 ? !1 : ua(o.start.z + c.z * f - (s.start.z + l.z * p)) ? (n && (n.start.copy(o.start).addScaledVector(c, f), n.end.copy(o.start).addScaledVector(c, f)), !0) : !1; } else if (t.isDegenerateIntoPoint) return _(e, t, n); else return h(t, e, n, o); else if (e.isDegenerateIntoPoint) return t.isDegenerateIntoPoint ? t.a.distanceToSquared(e.a) < la ? (n && (n.start.copy(e.a), n.end.copy(e.a)), !0) : !1 : t.isDegenerateIntoSegment ? _(t, e, n) : g(t, e, n); else if (t.isDegenerateIntoPoint) return g(e, t, n); else if (t.isDegenerateIntoSegment) return h(e, t, n, o); } return function(t, n = null, r = !1) { this.needsUpdate && this.update(), t.isExtendedTriangle ? t.needsUpdate && t.update() : (e.copy(t), e.update(), t = e); let o = v(this, t, n, r); if (o !== void 0) return o; let p = this.plane, h = t.plane, g = h.distanceToPoint(this.a), _ = h.distanceToPoint(this.b), y = h.distanceToPoint(this.c); ua(g) && (g = 0), ua(_) && (_ = 0), ua(y) && (y = 0); let b = g * _, x = g * y; if (b > 0 && x > 0) return !1; let S = p.distanceToPoint(t.a), C = p.distanceToPoint(t.b), w = p.distanceToPoint(t.c); ua(S) && (S = 0), ua(C) && (C = 0), ua(w) && (w = 0); let T = S * C, E = S * w; if (T > 0 && E > 0) return !1; i.copy(p.normal), a.copy(h.normal); let D = i.cross(a), O = 0, k = Math.abs(D.x), A = Math.abs(D.y); A > k && (k = A, O = 1), Math.abs(D.z) > k && (O = 2); let j = sa[O], M = this.a[j], N = this.b[j], P = this.c[j], F = t.a[j], I = t.b[j], L = t.c[j]; if (m(this, M, N, P, b, x, g, _, y, u, s) || m(t, F, I, L, T, E, S, C, w, d, c)) return f(this, t, n, r); if (u.y < u.x) { let e = u.y; u.y = u.x, u.x = e, l.copy(s.start), s.start.copy(s.end), s.end.copy(l); } if (d.y < d.x) { let e = d.y; d.y = d.x, d.x = e, l.copy(c.start), c.start.copy(c.end), c.end.copy(l); } return u.y < d.x || d.y < u.x ? !1 : (n && (d.x > u.x ? n.start.copy(c.start) : n.start.copy(s.start), d.y < u.y ? n.end.copy(c.end) : n.end.copy(s.end)), !0); }; })(), da.prototype.distanceToPoint = (function() { let e = /* @__PURE__ */ new W(); return function(t) { return this.closestPointToPoint(t, e), t.distanceTo(e); }; })(), da.prototype.distanceToTriangle = (function() { let e = /* @__PURE__ */ new W(), t = /* @__PURE__ */ new W(), n = [ "a", "b", "c" ], r = /* @__PURE__ */ new R(), i = /* @__PURE__ */ new R(); return function(a, o = null, s = null) { let c = o || s ? r : null; if (this.intersectsTriangle(a, c)) return (o || s) && (o && c.getCenter(o), s && c.getCenter(s)), 0; let l = Infinity; for (let t = 0; t < 3; t++) { let r, i = n[t], c = a[i]; this.closestPointToPoint(c, e), r = c.distanceToSquared(e), r < l && (l = r, o && o.copy(e), s && s.copy(c)); let u = this[i]; a.closestPointToPoint(u, e), r = u.distanceToSquared(e), r < l && (l = r, o && o.copy(u), s && s.copy(e)); } for (let c = 0; c < 3; c++) { let u = n[c], d = n[(c + 1) % 3]; r.set(this[u], this[d]); for (let c = 0; c < 3; c++) { let u = n[c], d = n[(c + 1) % 3]; i.set(a[u], a[d]), aa(r, i, e, t); let f = e.distanceToSquared(t); f < l && (l = f, o && o.copy(e), s && s.copy(t)); } } return Math.sqrt(l); }; })(); //#endregion //#region ../../node_modules/.pnpm/three-mesh-bvh@0.9.9_three@0.184.0/node_modules/three-mesh-bvh/src/math/OrientedBox.js var fa = class { constructor(e, t, n) { this.isOrientedBox = !0, this.min = new W(), this.max = new W(), this.matrix = new H(), this.invMatrix = new H(), this.points = Array(8).fill().map(() => new W()), this.satAxes = [ , , , ].fill().map(() => new W()), this.satBounds = [ , , , ].fill().map(() => new ra()), this.alignedSatBounds = [ , , , ].fill().map(() => new ra()), this.needsUpdate = !1, e && this.min.copy(e), t && this.max.copy(t), n && this.matrix.copy(n); } set(e, t, n) { this.min.copy(e), this.max.copy(t), this.matrix.copy(n), this.needsUpdate = !0; } copy(e) { this.min.copy(e.min), this.max.copy(e.max), this.matrix.copy(e.matrix), this.needsUpdate = !0; } }; fa.prototype.update = (function() { return function() { let e = this.matrix, t = this.min, n = this.max, r = this.points; for (let i = 0; i <= 1; i++) for (let a = 0; a <= 1; a++) for (let o = 0; o <= 1; o++) { let s = r[1 * i | 2 * a | 4 * o]; s.x = i ? n.x : t.x, s.y = a ? n.y : t.y, s.z = o ? n.z : t.z, s.applyMatrix4(e); } let i = this.satBounds, a = this.satAxes, o = r[0]; for (let e = 0; e < 3; e++) { let t = a[e], n = i[e], s = r[1 << e]; t.subVectors(o, s), n.setFromPoints(t, r); } let s = this.alignedSatBounds; s[0].setFromPointsField(r, "x"), s[1].setFromPointsField(r, "y"), s[2].setFromPointsField(r, "z"), this.invMatrix.copy(this.matrix).invert(), this.needsUpdate = !1; }; })(), fa.prototype.intersectsBox = (function() { let e = /* @__PURE__ */ new ra(); return function(t) { this.needsUpdate && this.update(); let n = t.min, r = t.max, i = this.satBounds, a = this.satAxes, o = this.alignedSatBounds; if (e.min = n.x, e.max = r.x, o[0].isSeparated(e) || (e.min = n.y, e.max = r.y, o[1].isSeparated(e)) || (e.min = n.z, e.max = r.z, o[2].isSeparated(e))) return !1; for (let n = 0; n < 3; n++) { let r = a[n], o = i[n]; if (e.setFromBox(r, t), o.isSeparated(e)) return !1; } return !0; }; })(), fa.prototype.intersectsTriangle = (function() { let e = /* @__PURE__ */ new da(), t = [ , , , ], n = /* @__PURE__ */ new ra(), r = /* @__PURE__ */ new ra(), i = /* @__PURE__ */ new W(); return function(a) { this.needsUpdate && this.update(), a.isExtendedTriangle ? a.needsUpdate && a.update() : (e.copy(a), e.update(), a = e); let o = this.satBounds, s = this.satAxes; t[0] = a.a, t[1] = a.b, t[2] = a.c; for (let e = 0; e < 3; e++) { let r = o[e], i = s[e]; if (n.setFromPoints(i, t), r.isSeparated(n)) return !1; } let c = a.satBounds, l = a.satAxes, u = this.points; for (let e = 0; e < 3; e++) { let t = c[e], r = l[e]; if (n.setFromPoints(r, u), t.isSeparated(n)) return !1; } for (let e = 0; e < 3; e++) { let a = s[e]; for (let e = 0; e < 4; e++) { let o = l[e]; if (i.crossVectors(a, o), n.setFromPoints(i, t), r.setFromPoints(i, u), n.isSeparated(r)) return !1; } } return !0; }; })(), fa.prototype.closestPointToPoint = (function() { return function(e, t) { return this.needsUpdate && this.update(), t.copy(e).applyMatrix4(this.invMatrix).clamp(this.min, this.max).applyMatrix4(this.matrix), t; }; })(), fa.prototype.distanceToPoint = (function() { let e = new W(); return function(t) { return this.closestPointToPoint(t, e), t.distanceTo(e); }; })(), fa.prototype.distanceToBox = (function() { let e = [ "x", "y", "z" ], t = /* @__PURE__ */ Array(12).fill().map(() => new R()), n = /* @__PURE__ */ Array(12).fill().map(() => new R()), r = /* @__PURE__ */ new W(), i = /* @__PURE__ */ new W(); return function(a, o = 0, s = null, c = null) { if (this.needsUpdate && this.update(), this.intersectsBox(a)) return (s || c) && (a.getCenter(i), this.closestPointToPoint(i, r), a.closestPointToPoint(r, i), s && s.copy(r), c && c.copy(i)), 0; let l = o * o, u = a.min, d = a.max, f = this.points, p = Infinity; for (let e = 0; e < 8; e++) { let t = f[e]; i.copy(t).clamp(u, d); let n = t.distanceToSquared(i); if (n < p && (p = n, s && s.copy(t), c && c.copy(i), n < l)) return Math.sqrt(n); } let m = 0; for (let r = 0; r < 3; r++) for (let i = 0; i <= 1; i++) for (let a = 0; a <= 1; a++) { let o = (r + 1) % 3, s = (r + 2) % 3, c = i << o | a << s, l = 1 << r | i << o | a << s, p = f[c], h = f[l]; t[m].set(p, h); let g = e[r], _ = e[o], v = e[s], y = n[m], b = y.start, x = y.end; b[g] = u[g], b[_] = i ? u[_] : d[_], b[v] = a ? u[v] : d[_], x[g] = d[g], x[_] = i ? u[_] : d[_], x[v] = a ? u[v] : d[_], m++; } for (let e = 0; e <= 1; e++) for (let t = 0; t <= 1; t++) for (let n = 0; n <= 1; n++) { i.x = e ? d.x : u.x, i.y = t ? d.y : u.y, i.z = n ? d.z : u.z, this.closestPointToPoint(i, r); let a = i.distanceToSquared(r); if (a < p && (p = a, s && s.copy(r), c && c.copy(i), a < l)) return Math.sqrt(a); } for (let e = 0; e < 12; e++) { let a = t[e]; for (let e = 0; e < 12; e++) { let t = n[e]; aa(a, t, r, i); let o = r.distanceToSquared(i); if (o < p && (p = o, s && s.copy(r), c && c.copy(i), o < l)) return Math.sqrt(o); } } return Math.sqrt(p); }; })(); var pa = /* @__PURE__ */ new class extends Ei { constructor() { super(() => new da()); } }(), ma = /* @__PURE__ */ new W(), ha = /* @__PURE__ */ new W(); function ga(e, t, n = {}, r = 0, i = Infinity) { let a = r * r, o = i * i, s = Infinity, c = null; if (e.shapecast({ boundsTraverseOrder: (e) => (ma.copy(t).clamp(e.min, e.max), ma.distanceToSquared(t)), intersectsBounds: (e, t, n) => n < s && n < o, intersectsTriangle: (e, n) => { e.closestPointToPoint(t, ma); let r = t.distanceToSquared(ma); return r < s && (ha.copy(ma), s = r, c = n), r < a; } }), s === Infinity) return null; let l = Math.sqrt(s); return n.point ? n.point.copy(ha) : n.point = ha.clone(), n.distance = l, n.faceIndex = c, n; } //#endregion //#region ../../node_modules/.pnpm/three-mesh-bvh@0.9.9_three@0.184.0/node_modules/three-mesh-bvh/src/utils/ThreeRayIntersectUtilities.js var _a = parseInt(ae) >= 169, va = parseInt(ae) <= 161, ya = /* @__PURE__ */ new W(), ba = /* @__PURE__ */ new W(), xa = /* @__PURE__ */ new W(), Sa = /* @__PURE__ */ new de(), Ca = /* @__PURE__ */ new de(), wa = /* @__PURE__ */ new de(), Ta = /* @__PURE__ */ new W(), Ea = /* @__PURE__ */ new W(), Da = /* @__PURE__ */ new W(), Oa = /* @__PURE__ */ new W(); function ka(e, t, n, r, i, a, o, s) { let c; if (c = a === D ? e.intersectTriangle(r, n, t, !0, i) : e.intersectTriangle(t, n, r, a !== P, i), c === null) return null; let l = e.origin.distanceTo(i); return l < o || l > s ? null : { distance: l, point: i.clone() }; } function Aa(e, t, n, r, i, a, o, s, c, l, u) { ya.fromBufferAttribute(t, a), ba.fromBufferAttribute(t, o), xa.fromBufferAttribute(t, s); let d = ka(e, ya, ba, xa, Oa, c, l, u); if (d) { if (r) { Sa.fromBufferAttribute(r, a), Ca.fromBufferAttribute(r, o), wa.fromBufferAttribute(r, s), d.uv = new de(); let e = ue.getInterpolation(Oa, ya, ba, xa, Sa, Ca, wa, d.uv); _a || (d.uv = e); } if (i) { Sa.fromBufferAttribute(i, a), Ca.fromBufferAttribute(i, o), wa.fromBufferAttribute(i, s), d.uv1 = new de(); let e = ue.getInterpolation(Oa, ya, ba, xa, Sa, Ca, wa, d.uv1); _a || (d.uv1 = e), va && (d.uv2 = d.uv1); } if (n) { Ta.fromBufferAttribute(n, a), Ea.fromBufferAttribute(n, o), Da.fromBufferAttribute(n, s), d.normal = new W(); let t = ue.getInterpolation(Oa, ya, ba, xa, Ta, Ea, Da, d.normal); d.normal.dot(e.direction) > 0 && d.normal.multiplyScalar(-1), _a || (d.normal = t); } let t = { a, b: o, c: s, normal: new W(), materialIndex: 0 }; if (ue.getNormal(ya, ba, xa, t.normal), d.face = t, d.faceIndex = a, _a) { let e = new W(); ue.getBarycoord(Oa, ya, ba, xa, e), d.barycoord = e; } } return d; } function K(e) { return e && e.isMaterial ? e.side : e; } function ja(e, t, n, r, i, a, o) { let s = r * 3, c = s + 0, l = s + 1, u = s + 2, { index: d, groups: f } = e; e.index && (c = d.getX(c), l = d.getX(l), u = d.getX(u)); let { position: p, normal: m, uv: h, uv1: g } = e.attributes; if (Array.isArray(t)) { let e = r * 3; for (let s = 0, d = f.length; s < d; s++) { let { start: d, count: _, materialIndex: v } = f[s]; if (e >= d && e < d + _) { let e = K(t[v]), s = Aa(n, p, m, h, g, c, l, u, e, a, o); if (s) if (s.faceIndex = r, s.face.materialIndex = v, i) i.push(s); else return s; } } } else { let e = K(t), s = Aa(n, p, m, h, g, c, l, u, e, a, o); if (s) if (s.faceIndex = r, s.face.materialIndex = 0, i) i.push(s); else return s; } return null; } //#endregion //#region ../../node_modules/.pnpm/three-mesh-bvh@0.9.9_three@0.184.0/node_modules/three-mesh-bvh/src/utils/TriangleUtilities.js function Ma(e, t, n, r) { let i = e.a, a = e.b, o = e.c, s = t, c = t + 1, l = t + 2; n && (s = n.getX(s), c = n.getX(c), l = n.getX(l)), i.x = r.getX(s), i.y = r.getY(s), i.z = r.getZ(s), a.x = r.getX(c), a.y = r.getY(c), a.z = r.getZ(c), o.x = r.getX(l), o.y = r.getY(l), o.z = r.getZ(l); } //#endregion //#region ../../node_modules/.pnpm/three-mesh-bvh@0.9.9_three@0.184.0/node_modules/three-mesh-bvh/src/core/utils/iterationUtils.generated.js function Na(e, t, n, r, i, a, o, s) { let { geometry: c, _indirectBuffer: l } = e; for (let e = r, l = r + i; e < l; e++) ja(c, t, n, e, a, o, s); } function Pa(e, t, n, r, i, a, o) { let { geometry: s, _indirectBuffer: c } = e, l = Infinity, u = null; for (let e = r, c = r + i; e < c; e++) { let r; r = ja(s, t, n, e, null, a, o), r && r.distance < l && (u = r, l = r.distance); } return u; } function Fa(e, t, n, r, i, a, o) { let { geometry: s } = n, { index: c } = s, l = s.attributes.position; for (let n = e, s = t + e; n < s; n++) { let e; if (e = n, Ma(o, e * 3, c, l), o.needsUpdate = !0, r(o, e, i, a)) return !0; } return !1; } //#endregion //#region ../../node_modules/.pnpm/three-mesh-bvh@0.9.9_three@0.184.0/node_modules/three-mesh-bvh/src/core/cast/refit.generated.js function Ia(e, t = null) { t && Array.isArray(t) && (t = new Set(t)); let n = e.geometry, r = n.index ? n.index.array : null, i = n.attributes.position, a, o, s, c, l = 0, u = e._roots; for (let e = 0, t = u.length; e < t; e++) a = u[e], o = new Uint32Array(a), s = new Uint16Array(a), c = new Float32Array(a), d(0, l), l += a.byteLength; function d(e, n, a = !1) { let l = e * 2; if (ei(l, s)) { let t = ti(e, o), n = ni(l, s), a = Infinity, u = Infinity, d = Infinity, f = -Infinity, p = -Infinity, m = -Infinity; for (let e = 3 * t, o = 3 * (t + n); e < o; e++) { let t = r[e], n = i.getX(t), o = i.getY(t), s = i.getZ(t); n < a && (a = n), n > f && (f = n), o < u && (u = o), o > p && (p = o), s < d && (d = s), s > m && (m = s); } return c[e + 0] !== a || c[e + 1] !== u || c[e + 2] !== d || c[e + 3] !== f || c[e + 4] !== p || c[e + 5] !== m ? (c[e + 0] = a, c[e + 1] = u, c[e + 2] = d, c[e + 3] = f, c[e + 4] = p, c[e + 5] = m, !0) : !1; } else { let r = ri(e), i = ii(e, o), s = a, l = !1, u = !1; if (t) { if (!s) { let e = r / 8 + n / 32, a = i / 8 + n / 32; l = t.has(e), u = t.has(a), s = !l && !u; } } else l = !0, u = !0; let f = s || l, p = s || u, m = !1; f && (m = d(r, n, s)); let h = !1; p && (h = d(i, n, s)); let g = m || h; if (g) for (let t = 0; t < 3; t++) { let n = r + t, a = i + t, o = c[n], s = c[n + 3], l = c[a], u = c[a + 3]; c[e + t] = o < l ? o : l, c[e + t + 3] = s > u ? s : u; } return g; } } } //#endregion //#region ../../node_modules/.pnpm/three-mesh-bvh@0.9.9_three@0.184.0/node_modules/three-mesh-bvh/src/core/utils/intersectUtils.js function La(e, t, n, r, i) { let a, o, s, c, l, u, d = 1 / n.direction.x, f = 1 / n.direction.y, p = 1 / n.direction.z, m = n.origin.x, h = n.origin.y, g = n.origin.z, _ = t[e], v = t[e + 3], y = t[e + 1], b = t[e + 3 + 1], x = t[e + 2], S = t[e + 3 + 2]; return d >= 0 ? (a = (_ - m) * d, o = (v - m) * d) : (a = (v - m) * d, o = (_ - m) * d), f >= 0 ? (s = (y - h) * f, c = (b - h) * f) : (s = (b - h) * f, c = (y - h) * f), a > c || s > o || ((s > a || isNaN(a)) && (a = s), (c < o || isNaN(o)) && (o = c), p >= 0 ? (l = (x - g) * p, u = (S - g) * p) : (l = (S - g) * p, u = (x - g) * p), a > u || l > o) ? !1 : ((l > a || a !== a) && (a = l), (u < o || o !== o) && (o = u), a <= i && o >= r); } //#endregion //#region ../../node_modules/.pnpm/three-mesh-bvh@0.9.9_three@0.184.0/node_modules/three-mesh-bvh/src/core/utils/iterationUtils_indirect.generated.js function Ra(e, t, n, r, i, a, o, s) { let { geometry: c, _indirectBuffer: l } = e; for (let e = r, u = r + i; e < u; e++) ja(c, t, n, l ? l[e] : e, a, o, s); } function za(e, t, n, r, i, a, o) { let { geometry: s, _indirectBuffer: c } = e, l = Infinity, u = null; for (let e = r, d = r + i; e < d; e++) { let r; r = ja(s, t, n, c ? c[e] : e, null, a, o), r && r.distance < l && (u = r, l = r.distance); } return u; } function Ba(e, t, n, r, i, a, o) { let { geometry: s } = n, { index: c } = s, l = s.attributes.position; for (let s = e, u = t + e; s < u; s++) { let e; if (e = n.resolveTriangleIndex(s), Ma(o, e * 3, c, l), o.needsUpdate = !0, r(o, e, i, a)) return !0; } return !1; } //#endregion //#region ../../node_modules/.pnpm/three-mesh-bvh@0.9.9_three@0.184.0/node_modules/three-mesh-bvh/src/core/cast/raycast.generated.js function Va(e, t, n, r, i, a, o) { Di.setBuffer(e._roots[t]), Ha(0, e, n, r, i, a, o), Di.clearBuffer(); } function Ha(e, t, n, r, i, a, o) { let { float32Array: s, uint16Array: c, uint32Array: l } = Di, u = e * 2; if (ei(u, c)) Na(t, n, r, ti(e, l), ni(u, c), i, a, o); else { let c = ri(e); La(c, s, r, a, o) && Ha(c, t, n, r, i, a, o); let u = ii(e, l); La(u, s, r, a, o) && Ha(u, t, n, r, i, a, o); } } //#endregion //#region ../../node_modules/.pnpm/three-mesh-bvh@0.9.9_three@0.184.0/node_modules/three-mesh-bvh/src/core/cast/raycastFirst.generated.js var Ua = [ "x", "y", "z" ]; function Wa(e, t, n, r, i, a) { Di.setBuffer(e._roots[t]); let o = Ga(0, e, n, r, i, a); return Di.clearBuffer(), o; } function Ga(e, t, n, r, i, a) { let { float32Array: o, uint16Array: s, uint32Array: c } = Di, l = e * 2; if (ei(l, s)) return Pa(t, n, r, ti(e, c), ni(l, s), i, a); { let s = ai(e, c), l = Ua[s], u = r.direction[l] >= 0, d, f; u ? (d = ri(e), f = ii(e, c)) : (d = ii(e, c), f = ri(e)); let p = La(d, o, r, i, a) ? Ga(d, t, n, r, i, a) : null; if (p) { let e = p.point[l]; if (u ? e <= o[f + s] : e >= o[f + s + 3]) return p; } let m = La(f, o, r, i, a) ? Ga(f, t, n, r, i, a) : null; return p && m ? p.distance <= m.distance ? p : m : p || m || null; } } //#endregion //#region ../../node_modules/.pnpm/three-mesh-bvh@0.9.9_three@0.184.0/node_modules/three-mesh-bvh/src/core/cast/intersectsGeometry.generated.js var Ka = /* @__PURE__ */ new k(), qa = /* @__PURE__ */ new da(), Ja = /* @__PURE__ */ new da(), Ya = /* @__PURE__ */ new H(), Xa = /* @__PURE__ */ new fa(), Za = /* @__PURE__ */ new fa(); function Qa(e, t, n, r) { Di.setBuffer(e._roots[t]); let i = $a(0, e, n, r); return Di.clearBuffer(), i; } function $a(e, t, n, r, i = null) { let { float32Array: a, uint16Array: o, uint32Array: s } = Di, c = e * 2; if (i === null && (n.boundingBox || n.computeBoundingBox(), Xa.set(n.boundingBox.min, n.boundingBox.max, r), i = Xa), ei(c, o)) { let i = t.geometry, l = i.index, u = i.attributes.position, d = n.index, f = n.attributes.position, p = ti(e, s), m = ni(c, o); if (Ya.copy(r).invert(), n.boundsTree) return Jr(oi(e), a, Za), Za.matrix.copy(Ya), Za.needsUpdate = !0, n.boundsTree.shapecast({ intersectsBounds: (e) => Za.intersectsBox(e), intersectsTriangle: (e) => { e.a.applyMatrix4(r), e.b.applyMatrix4(r), e.c.applyMatrix4(r), e.needsUpdate = !0; for (let t = p * 3, n = (m + p) * 3; t < n; t += 3) if (Ma(Ja, t, l, u), Ja.needsUpdate = !0, e.intersectsTriangle(Ja)) return !0; return !1; } }); { let e = Yi(n); for (let t = p * 3, n = (m + p) * 3; t < n; t += 3) { Ma(qa, t, l, u), qa.a.applyMatrix4(Ya), qa.b.applyMatrix4(Ya), qa.c.applyMatrix4(Ya), qa.needsUpdate = !0; for (let t = 0, n = e * 3; t < n; t += 3) if (Ma(Ja, t, d, f), Ja.needsUpdate = !0, qa.intersectsTriangle(Ja)) return !0; } } } else { let o = ri(e), c = ii(e, s); return Jr(oi(o), a, Ka), !!(i.intersectsBox(Ka) && $a(o, t, n, r, i) || (Jr(oi(c), a, Ka), i.intersectsBox(Ka) && $a(c, t, n, r, i))); } } //#endregion //#region ../../node_modules/.pnpm/three-mesh-bvh@0.9.9_three@0.184.0/node_modules/three-mesh-bvh/src/core/cast/closestPointToGeometry.generated.js var eo = /* @__PURE__ */ new H(), to = /* @__PURE__ */ new fa(), no = /* @__PURE__ */ new fa(), ro = /* @__PURE__ */ new W(), io = /* @__PURE__ */ new W(), ao = /* @__PURE__ */ new W(), oo = /* @__PURE__ */ new W(); function so(e, t, n, r = {}, i = {}, a = 0, o = Infinity) { t.boundingBox || t.computeBoundingBox(), to.set(t.boundingBox.min, t.boundingBox.max, n), to.needsUpdate = !0; let s = e.geometry, c = s.attributes.position, l = s.index, u = t.attributes.position, d = t.index, f = pa.getPrimitive(), p = pa.getPrimitive(), m = ro, h = io, g = null, _ = null; i && (g = ao, _ = oo); let v = Infinity, y = null, b = null; return eo.copy(n).invert(), no.matrix.copy(eo), e.shapecast({ boundsTraverseOrder: (e) => to.distanceToBox(e), intersectsBounds: (e, t, n) => n < v && n < o ? (t && (no.min.copy(e.min), no.max.copy(e.max), no.needsUpdate = !0), !0) : !1, intersectsRange: (e, r) => { if (t.boundsTree) return t.boundsTree.shapecast({ boundsTraverseOrder: (e) => no.distanceToBox(e), intersectsBounds: (e, t, n) => n < v && n < o, intersectsRange: (t, i) => { for (let o = t, s = t + i; o < s; o++) { Ma(p, 3 * o, d, u), p.a.applyMatrix4(n), p.b.applyMatrix4(n), p.c.applyMatrix4(n), p.needsUpdate = !0; for (let t = e, n = e + r; t < n; t++) { Ma(f, 3 * t, l, c), f.needsUpdate = !0; let e = f.distanceToTriangle(p, m, g); if (e < v && (h.copy(m), _ && _.copy(g), v = e, y = t, b = o), e < a) return !0; } } } }); { let i = Yi(t); for (let t = 0, o = i; t < o; t++) { Ma(p, 3 * t, d, u), p.a.applyMatrix4(n), p.b.applyMatrix4(n), p.c.applyMatrix4(n), p.needsUpdate = !0; for (let n = e, i = e + r; n < i; n++) { Ma(f, 3 * n, l, c), f.needsUpdate = !0; let e = f.distanceToTriangle(p, m, g); if (e < v && (h.copy(m), _ && _.copy(g), v = e, y = n, b = t), e < a) return !0; } } } } }), pa.releasePrimitive(f), pa.releasePrimitive(p), v === Infinity ? null : (r.point ? r.point.copy(h) : r.point = h.clone(), r.distance = v, r.faceIndex = y, i && (i.point ? i.point.copy(_) : i.point = _.clone(), i.point.applyMatrix4(eo), h.applyMatrix4(eo), i.distance = h.sub(i.point).length(), i.faceIndex = b), r); } //#endregion //#region ../../node_modules/.pnpm/three-mesh-bvh@0.9.9_three@0.184.0/node_modules/three-mesh-bvh/src/core/cast/refit_indirect.generated.js function co(e, t = null) { t && Array.isArray(t) && (t = new Set(t)); let n = e.geometry, r = n.index ? n.index.array : null, i = n.attributes.position, a, o, s, c, l = 0, u = e._roots; for (let e = 0, t = u.length; e < t; e++) a = u[e], o = new Uint32Array(a), s = new Uint16Array(a), c = new Float32Array(a), d(0, l), l += a.byteLength; function d(n, a, l = !1) { let u = n * 2; if (ei(u, s)) { let t = ti(n, o), a = ni(u, s), l = Infinity, d = Infinity, f = Infinity, p = -Infinity, m = -Infinity, h = -Infinity; for (let n = t, o = t + a; n < o; n++) { let t = 3 * e.resolveTriangleIndex(n); for (let e = 0; e < 3; e++) { let n = t + e; n = r ? r[n] : n; let a = i.getX(n), o = i.getY(n), s = i.getZ(n); a < l && (l = a), a > p && (p = a), o < d && (d = o), o > m && (m = o), s < f && (f = s), s > h && (h = s); } } return c[n + 0] !== l || c[n + 1] !== d || c[n + 2] !== f || c[n + 3] !== p || c[n + 4] !== m || c[n + 5] !== h ? (c[n + 0] = l, c[n + 1] = d, c[n + 2] = f, c[n + 3] = p, c[n + 4] = m, c[n + 5] = h, !0) : !1; } else { let e = ri(n), r = ii(n, o), i = l, s = !1, u = !1; if (t) { if (!i) { let n = e / 8 + a / 32, o = r / 8 + a / 32; s = t.has(n), u = t.has(o), i = !s && !u; } } else s = !0, u = !0; let f = i || s, p = i || u, m = !1; f && (m = d(e, a, i)); let h = !1; p && (h = d(r, a, i)); let g = m || h; if (g) for (let t = 0; t < 3; t++) { let i = e + t, a = r + t, o = c[i], s = c[i + 3], l = c[a], u = c[a + 3]; c[n + t] = o < l ? o : l, c[n + t + 3] = s > u ? s : u; } return g; } } } //#endregion //#region ../../node_modules/.pnpm/three-mesh-bvh@0.9.9_three@0.184.0/node_modules/three-mesh-bvh/src/core/cast/raycast_indirect.generated.js function lo(e, t, n, r, i, a, o) { Di.setBuffer(e._roots[t]), uo(0, e, n, r, i, a, o), Di.clearBuffer(); } function uo(e, t, n, r, i, a, o) { let { float32Array: s, uint16Array: c, uint32Array: l } = Di, u = e * 2; if (ei(u, c)) Ra(t, n, r, ti(e, l), ni(u, c), i, a, o); else { let c = ri(e); La(c, s, r, a, o) && uo(c, t, n, r, i, a, o); let u = ii(e, l); La(u, s, r, a, o) && uo(u, t, n, r, i, a, o); } } //#endregion //#region ../../node_modules/.pnpm/three-mesh-bvh@0.9.9_three@0.184.0/node_modules/three-mesh-bvh/src/core/cast/raycastFirst_indirect.generated.js var fo = [ "x", "y", "z" ]; function po(e, t, n, r, i, a) { Di.setBuffer(e._roots[t]); let o = mo(0, e, n, r, i, a); return Di.clearBuffer(), o; } function mo(e, t, n, r, i, a) { let { float32Array: o, uint16Array: s, uint32Array: c } = Di, l = e * 2; if (ei(l, s)) return za(t, n, r, ti(e, c), ni(l, s), i, a); { let s = ai(e, c), l = fo[s], u = r.direction[l] >= 0, d, f; u ? (d = ri(e), f = ii(e, c)) : (d = ii(e, c), f = ri(e)); let p = La(d, o, r, i, a) ? mo(d, t, n, r, i, a) : null; if (p) { let e = p.point[l]; if (u ? e <= o[f + s] : e >= o[f + s + 3]) return p; } let m = La(f, o, r, i, a) ? mo(f, t, n, r, i, a) : null; return p && m ? p.distance <= m.distance ? p : m : p || m || null; } } //#endregion //#region ../../node_modules/.pnpm/three-mesh-bvh@0.9.9_three@0.184.0/node_modules/three-mesh-bvh/src/core/cast/intersectsGeometry_indirect.generated.js var ho = /* @__PURE__ */ new k(), go = /* @__PURE__ */ new da(), _o = /* @__PURE__ */ new da(), vo = /* @__PURE__ */ new H(), yo = /* @__PURE__ */ new fa(), bo = /* @__PURE__ */ new fa(); function xo(e, t, n, r) { Di.setBuffer(e._roots[t]); let i = So(0, e, n, r); return Di.clearBuffer(), i; } function So(e, t, n, r, i = null) { let { float32Array: a, uint16Array: o, uint32Array: s } = Di, c = e * 2; if (i === null && (n.boundingBox || n.computeBoundingBox(), yo.set(n.boundingBox.min, n.boundingBox.max, r), i = yo), ei(c, o)) { let i = t.geometry, l = i.index, u = i.attributes.position, d = n.index, f = n.attributes.position, p = ti(e, s), m = ni(c, o); if (vo.copy(r).invert(), n.boundsTree) return Jr(oi(e), a, bo), bo.matrix.copy(vo), bo.needsUpdate = !0, n.boundsTree.shapecast({ intersectsBounds: (e) => bo.intersectsBox(e), intersectsTriangle: (e) => { e.a.applyMatrix4(r), e.b.applyMatrix4(r), e.c.applyMatrix4(r), e.needsUpdate = !0; for (let n = p, r = m + p; n < r; n++) if (Ma(_o, 3 * t.resolveTriangleIndex(n), l, u), _o.needsUpdate = !0, e.intersectsTriangle(_o)) return !0; return !1; } }); { let e = Yi(n); for (let n = p, r = m + p; n < r; n++) { Ma(go, 3 * t.resolveTriangleIndex(n), l, u), go.a.applyMatrix4(vo), go.b.applyMatrix4(vo), go.c.applyMatrix4(vo), go.needsUpdate = !0; for (let t = 0, n = e * 3; t < n; t += 3) if (Ma(_o, t, d, f), _o.needsUpdate = !0, go.intersectsTriangle(_o)) return !0; } } } else { let o = ri(e), c = ii(e, s); return Jr(oi(o), a, ho), !!(i.intersectsBox(ho) && So(o, t, n, r, i) || (Jr(oi(c), a, ho), i.intersectsBox(ho) && So(c, t, n, r, i))); } } //#endregion //#region ../../node_modules/.pnpm/three-mesh-bvh@0.9.9_three@0.184.0/node_modules/three-mesh-bvh/src/core/cast/closestPointToGeometry_indirect.generated.js var Co = /* @__PURE__ */ new H(), wo = /* @__PURE__ */ new fa(), To = /* @__PURE__ */ new fa(), Eo = /* @__PURE__ */ new W(), Do = /* @__PURE__ */ new W(), Oo = /* @__PURE__ */ new W(), ko = /* @__PURE__ */ new W(); function Ao(e, t, n, r = {}, i = {}, a = 0, o = Infinity) { t.boundingBox || t.computeBoundingBox(), wo.set(t.boundingBox.min, t.boundingBox.max, n), wo.needsUpdate = !0; let s = e.geometry, c = s.attributes.position, l = s.index, u = t.attributes.position, d = t.index, f = pa.getPrimitive(), p = pa.getPrimitive(), m = Eo, h = Do, g = null, _ = null; i && (g = Oo, _ = ko); let v = Infinity, y = null, b = null; return Co.copy(n).invert(), To.matrix.copy(Co), e.shapecast({ boundsTraverseOrder: (e) => wo.distanceToBox(e), intersectsBounds: (e, t, n) => n < v && n < o ? (t && (To.min.copy(e.min), To.max.copy(e.max), To.needsUpdate = !0), !0) : !1, intersectsRange: (r, i) => { if (t.boundsTree) { let s = t.boundsTree; return s.shapecast({ boundsTraverseOrder: (e) => To.distanceToBox(e), intersectsBounds: (e, t, n) => n < v && n < o, intersectsRange: (t, o) => { for (let x = t, S = t + o; x < S; x++) { Ma(p, 3 * s.resolveTriangleIndex(x), d, u), p.a.applyMatrix4(n), p.b.applyMatrix4(n), p.c.applyMatrix4(n), p.needsUpdate = !0; for (let t = r, n = r + i; t < n; t++) { Ma(f, 3 * e.resolveTriangleIndex(t), l, c), f.needsUpdate = !0; let n = f.distanceToTriangle(p, m, g); if (n < v && (h.copy(m), _ && _.copy(g), v = n, y = t, b = x), n < a) return !0; } } } }); } else { let o = Yi(t); for (let t = 0, s = o; t < s; t++) { Ma(p, 3 * t, d, u), p.a.applyMatrix4(n), p.b.applyMatrix4(n), p.c.applyMatrix4(n), p.needsUpdate = !0; for (let n = r, o = r + i; n < o; n++) { Ma(f, 3 * e.resolveTriangleIndex(n), l, c), f.needsUpdate = !0; let r = f.distanceToTriangle(p, m, g); if (r < v && (h.copy(m), _ && _.copy(g), v = r, y = n, b = t), r < a) return !0; } } } } }), pa.releasePrimitive(f), pa.releasePrimitive(p), v === Infinity ? null : (r.point ? r.point.copy(h) : r.point = h.clone(), r.distance = v, r.faceIndex = y, i && (i.point ? i.point.copy(_) : i.point = _.clone(), i.point.applyMatrix4(Co), h.applyMatrix4(Co), i.distance = h.sub(i.point).length(), i.faceIndex = b), r); } //#endregion //#region ../../node_modules/.pnpm/three-mesh-bvh@0.9.9_three@0.184.0/node_modules/three-mesh-bvh/src/utils/GeometryRayIntersectUtilities.js function jo(e, t, n) { return e === null ? null : (e.point.applyMatrix4(t.matrixWorld), e.distance = e.point.distanceTo(n.ray.origin), e.object = t, e); } //#endregion //#region ../../node_modules/.pnpm/three-mesh-bvh@0.9.9_three@0.184.0/node_modules/three-mesh-bvh/src/core/MeshBVH.js var Mo = /* @__PURE__ */ new fa(), No = /* @__PURE__ */ new oe(), Po = /* @__PURE__ */ new W(), Fo = /* @__PURE__ */ new H(), Io = /* @__PURE__ */ new W(), Lo = [ "getX", "getY", "getZ" ], Ro = class e extends na { static serialize(e, t = {}) { t = { cloneBuffers: !0, ...t }; let n = e.geometry, r = e._roots, i = e._indirectBuffer, a = n.getIndex(), o = { version: 1, roots: null, index: null, indirectBuffer: null }; return t.cloneBuffers ? (o.roots = r.map((e) => e.slice()), o.index = a ? a.array.slice() : null, o.indirectBuffer = i ? i.slice() : null) : (o.roots = r, o.index = a ? a.array : null, o.indirectBuffer = i), o; } static deserialize(t, n, r = {}) { r = { setIndex: !0, indirect: !!t.indirectBuffer, ...r }; let { index: i, roots: a, indirectBuffer: o } = t; t.version || (console.warn("MeshBVH.deserialize: Serialization format has been changed and will be fixed up. It is recommended to regenerate any stored serialized data."), c(a)); let s = new e(n, { ...r, [Kr]: !0 }); if (s._roots = a, s._indirectBuffer = o || null, r.setIndex) { let e = n.getIndex(); if (e === null) { let e = new j(t.index, 1, !1); n.setIndex(e); } else e.array !== i && (e.array.set(i), e.needsUpdate = !0); } return s; function c(e) { for (let t = 0; t < e.length; t++) { let n = e[t], r = new Uint32Array(n), i = new Uint16Array(n); for (let e = 0, t = n.byteLength / 32; e < t; e++) { let t = 8 * e; ei(2 * t, i) || (r[t + 6] = r[t + 6] / 8 - e); } } } } get primitiveStride() { return 3; } get resolveTriangleIndex() { return this.resolvePrimitiveIndex; } constructor(e, t = {}) { t.maxLeafTris && (console.warn("MeshBVH: \"maxLeafTris\" option has been deprecated. Use maxLeafSize, instead."), t = { ...t, maxLeafSize: t.maxLeafTris }), super(e, t); } shiftTriangleOffsets(e) { return super.shiftPrimitiveOffsets(e); } writePrimitiveBounds(e, t, n) { let r = this.geometry, i = this._indirectBuffer, a = r.attributes.position, o = r.index ? r.index.array : null, s = (i ? i[e] : e) * 3, c = s + 0, l = s + 1, u = s + 2; o && (c = o[c], l = o[l], u = o[u]); for (let e = 0; e < 3; e++) { let r = a[Lo[e]](c), i = a[Lo[e]](l), o = a[Lo[e]](u), s = r; i < s && (s = i), o < s && (s = o); let d = r; i > d && (d = i), o > d && (d = o), t[n + e] = s, t[n + e + 3] = d; } return t; } computePrimitiveBounds(e, t, n) { let r = this.geometry, i = this._indirectBuffer, a = r.attributes.position, o = r.index ? r.index.array : null, s = a.normalized; if (e < 0 || t + e - n.offset > n.length / 6) throw Error("MeshBVH: compute triangle bounds range is invalid."); let c = a.array, l = a.offset || 0, u = 3; a.isInterleavedBufferAttribute && (u = a.data.stride); let d = [ "getX", "getY", "getZ" ], f = n.offset; for (let r = e, p = e + t; r < p; r++) { let e = (i ? i[r] : r) * 3, t = (r - f) * 6, p = e + 0, m = e + 1, h = e + 2; o && (p = o[p], m = o[m], h = o[h]), s || (p = p * u + l, m = m * u + l, h = h * u + l); for (let e = 0; e < 3; e++) { let r, i, o; s ? (r = a[d[e]](p), i = a[d[e]](m), o = a[d[e]](h)) : (r = c[p + e], i = c[m + e], o = c[h + e]); let l = r; i < l && (l = i), o < l && (l = o); let u = r; i > u && (u = i), o > u && (u = o); let f = (u - l) / 2, g = e * 2; n[t + g + 0] = l + f, n[t + g + 1] = f + (Math.abs(l) + f) * Gr; } } return n; } raycastObject3D(e, t, n = []) { let { material: r } = e; if (r === void 0) return; Fo.copy(e.matrixWorld).invert(), No.copy(t.ray).applyMatrix4(Fo), Io.setFromMatrixScale(e.matrixWorld), Po.copy(No.direction).multiply(Io); let i = Po.length(), a = t.near / i, o = t.far / i; if (t.firstHitOnly === !0) { let i = this.raycastFirst(No, r, a, o); i = jo(i, e, t), i && n.push(i); } else { let i = this.raycast(No, r, a, o); for (let r = 0, a = i.length; r < a; r++) { let a = jo(i[r], e, t); a && n.push(a); } } return n; } refit(e = null) { return (this.indirect ? co : Ia)(this, e); } raycast(e, t = F, n = 0, r = Infinity) { let i = this._roots, a = [], o = this.indirect ? lo : Va; for (let s = 0, c = i.length; s < c; s++) o(this, s, t, e, a, n, r); return a; } raycastFirst(e, t = F, n = 0, r = Infinity) { let i = this._roots, a = null, o = this.indirect ? po : Wa; for (let s = 0, c = i.length; s < c; s++) { let i = o(this, s, t, e, n, r); i != null && (a == null || i.distance < a.distance) && (a = i); } return a; } intersectsGeometry(e, t) { let n = !1, r = this._roots, i = this.indirect ? xo : Qa; for (let a = 0, o = r.length; a < o && (n = i(this, a, e, t), !n); a++); return n; } shapecast(e) { let t = pa.getPrimitive(), n = super.shapecast({ ...e, intersectsPrimitive: e.intersectsTriangle, scratchPrimitive: t, iterate: this.indirect ? Ba : Fa }); return pa.releasePrimitive(t), n; } bvhcast(t, n, r) { let { intersectsRanges: i, intersectsTriangles: a } = r, o = pa.getPrimitive(), s = this.geometry.index, c = this.geometry.attributes.position, l = this.indirect ? (e) => { Ma(o, this.resolveTriangleIndex(e) * 3, s, c); } : (e) => { Ma(o, e * 3, s, c); }, u = pa.getPrimitive(), d = t.geometry.index, f = t.geometry.attributes.position, p = t.indirect ? (e) => { Ma(u, t.resolveTriangleIndex(e) * 3, d, f); } : (e) => { Ma(u, e * 3, d, f); }; if (a) { if (!(t instanceof e)) throw Error("MeshBVH: \"intersectsTriangles\" callback can only be used with another MeshBVH."); let r = (e, t, r, i, s, c, d, f) => { for (let m = r, h = r + i; m < h; m++) { p(m), u.a.applyMatrix4(n), u.b.applyMatrix4(n), u.c.applyMatrix4(n), u.needsUpdate = !0; for (let n = e, r = e + t; n < r; n++) if (l(n), o.needsUpdate = !0, a(o, u, n, m, s, c, d, f)) return !0; } return !1; }; if (i) { let e = i; i = function(t, n, i, a, o, s, c, l) { return e(t, n, i, a, o, s, c, l) ? !0 : r(t, n, i, a, o, s, c, l); }; } else i = r; } return super.bvhcast(t, n, { intersectsRanges: i }); } intersectsBox(e, t) { return Mo.set(e.min, e.max, t), Mo.needsUpdate = !0, this.shapecast({ intersectsBounds: (e) => Mo.intersectsBox(e), intersectsTriangle: (e) => Mo.intersectsTriangle(e) }); } intersectsSphere(e) { return this.shapecast({ intersectsBounds: (t) => e.intersectsBox(t), intersectsTriangle: (t) => t.intersectsSphere(e) }); } closestPointToGeometry(e, t, n = {}, r = {}, i = 0, a = Infinity) { return (this.indirect ? Ao : so)(this, e, t, n, r, i, a); } closestPointToPoint(e, t = {}, n = 0, r = Infinity) { return ga(this, e, t, n, r); } }, zo = /* @__PURE__ */ new k(), Bo = /* @__PURE__ */ new H(), Vo = /* @__PURE__ */ new W(), Ho = class extends ne { get isMesh() { return !this.displayEdges; } get isLineSegments() { return this.displayEdges; } get isLine() { return this.displayEdges; } getVertexPosition(...e) { return U.prototype.getVertexPosition.call(this, ...e); } constructor(e, t, n = 10, r = 0) { super(), this.material = t, this.geometry = new M(), this.name = "BVHRootHelper", this.depth = n, this.displayParents = !1, this.bvh = e, this.displayEdges = !0, this._group = r; } raycast() {} update() { let e = this.bvh; this.geometry.dispose(), this.visible = !1, e && (this.geometry = this.getGeometry(e), this.visible = !0); } getGeometry(e) { let t = this._group, n = null; if (t !== -1) n = this.getBVHBoundPositions(e, t); else { let t = e._roots.map((t, n) => this.getBVHBoundPositions(e, n)), r = t.reduce((e, t) => e + t.length, 0); n = new Float32Array(r); let i = 0; t.forEach((e) => { n.set(e, i), i += e.length; }); } let r = this.getBVHBoundIndices(n), i = new M(); return i.setIndex(new j(r, 1, !1)), i.setAttribute("position", new j(n, 3, !1)), i; } getBVHBoundIndices(e) { let t = e.length / 24, n, r; r = this.displayEdges ? new Uint8Array([ 0, 4, 1, 5, 2, 6, 3, 7, 0, 2, 1, 3, 4, 6, 5, 7, 0, 1, 2, 3, 4, 5, 6, 7 ]) : new Uint8Array([ 0, 1, 2, 2, 1, 3, 4, 6, 5, 6, 7, 5, 1, 4, 5, 0, 4, 1, 2, 3, 6, 3, 7, 6, 0, 2, 4, 2, 6, 4, 1, 5, 3, 3, 5, 7 ]), n = e.length > 65535 ? new Uint32Array(r.length * t) : new Uint16Array(r.length * t); let i = r.length; for (let e = 0; e < t; e++) { let t = e * 8, a = e * i; for (let e = 0; e < i; e++) n[a + e] = t + r[e]; } return n; } getBVHBoundPositions(e, t = 0, n = null) { let r = this.depth - 1, i = this.displayParents, a = 0; e.traverse((e, t) => { if (e >= r || t) return a++, !0; i && a++; }, t); let o = 0, s = new Float32Array(24 * a); return e.traverse((e, t, a) => { let c = e >= r || t; if (c || i) { Jr(0, a, zo); let { min: e, max: t } = zo; for (let r = -1; r <= 1; r += 2) { let i = r < 0 ? e.x : t.x; for (let r = -1; r <= 1; r += 2) { let a = r < 0 ? e.y : t.y; for (let r = -1; r <= 1; r += 2) { let c = r < 0 ? e.z : t.z; Vo.set(i, a, c), n && Vo.applyMatrix4(n), Vo.toArray(s, o), o += 3; } } } return c; } }, t), s; } }, Uo = class e extends I { get color() { return this.edgeMaterial.color; } get opacity() { return this.edgeMaterial.opacity; } set opacity(e) { this.edgeMaterial.opacity = e, this.meshMaterial.opacity = e; } get objectIndex() { return console.warn("BVHHelper: \"objectIndex\" has been renamed \"instanceId\"."), this.instanceId; } set objectIndex(e) { console.warn("BVHHelper: \"objectIndex\" has been renamed \"instanceId\"."), this.instanceId = e; } constructor(e = null, t = null, n = 10) { e instanceof Ro && (n = t || 10, t = e, e = null), typeof t == "number" && (n = t, t = null), super(), this.name = "BVHHelper", this.depth = n, this.mesh = e, this.bvh = t, this.displayParents = !1, this.displayEdges = !0, this.instanceId = 0, this._roots = []; let r = new z({ color: 65416, transparent: !0, opacity: .3, depthWrite: !1 }), i = new te({ color: 65416, transparent: !0, opacity: .3, depthWrite: !1 }); i.color = r.color, this.edgeMaterial = r, this.meshMaterial = i, this.update(); } update() { let e = this.mesh, t = this.instanceId, n = this.bvh || e.boundsTree || e.geometry && e.geometry.boundsTree || null; if (e && e.isBatchedMesh && e.boundsTrees && !n && t >= 0) { let r = e._drawInfo[t]; r && (n = e.boundsTrees[r.geometryIndex] || n); } let r = n ? n._roots.length : 0; for (; this._roots.length > r;) { let e = this._roots.pop(); e.geometry.dispose(), this.remove(e); } for (let e = 0; e < r; e++) { let { depth: t, edgeMaterial: r, meshMaterial: i, displayParents: a, displayEdges: o } = this; if (e >= this._roots.length) { let i = new Ho(n, r, t, e); this.add(i), this._roots.push(i); } let s = this._roots[e]; s.bvh = n, s.depth = t, s.displayParents = a, s.displayEdges = o, s.material = o ? r : i, s.update(); } } updateMatrixWorld(...e) { let t = this.mesh, n = this.parent, r = this.instanceId; t !== null && (t.updateWorldMatrix(!0, !1), n ? this.matrix.copy(n.matrixWorld).invert().multiply(t.matrixWorld) : this.matrix.copy(t.matrixWorld), (t.isInstancedMesh || t.isBatchedMesh) && r >= 0 && (t.getMatrixAt(r, Bo), this.matrix.multiply(Bo)), this.matrix.decompose(this.position, this.quaternion, this.scale)), super.updateMatrixWorld(...e); } copy(e) { this.depth = e.depth, this.mesh = e.mesh, this.bvh = e.bvh, this.opacity = e.opacity, this.color.copy(e.color); } clone() { return new e().copy(this); } dispose() { this.edgeMaterial.dispose(), this.meshMaterial.dispose(); let e = this.children; for (let t = 0, n = e.length; t < n; t++) e[t].geometry.dispose(); } }; U.prototype.raycast, L.prototype.raycast, B.prototype.raycast, ee.prototype.raycast, ie.prototype.raycast, O.prototype.raycast; function Wo(e = {}) { let { type: t = Ro } = e; return this.boundsTree = new t(this, e), this.boundsTree; } function Go() { this.boundsTree = null; } e.BufferGeometry.prototype.computeBoundsTree = Wo, e.BufferGeometry.prototype.disposeBoundsTree = Go; var Ko = class t { meshBVHMap = /* @__PURE__ */ new WeakMap(); static computeBoundsTree(e) { e.boundsTree || e.computeBoundsTree(); } static disposeBoundsTree(e) { e.boundsTree && e.disposeBoundsTree(); } static hasBoundsTree(e) { return !!e.boundsTree; } static ensureBoundsTree(e) { t.hasBoundsTree(e) || t.computeBoundsTree(e); } buildBVH(e) { e.geometry && (e.geometry.boundsTree && e.geometry.disposeBoundsTree?.(), e.geometry.computeBoundsTree?.(), this.meshBVHMap.set(e, e.geometry.boundsTree)); } checkIntersection(t, n) { t.geometry.boundsTree || this.buildBVH(t), n.geometry.boundsTree || this.buildBVH(n), t.updateMatrixWorld(!0), n.updateMatrixWorld(!0); let r = new e.Box3().setFromObject(n), i = new e.Matrix4().copy(t.matrixWorld).invert().multiply(n.matrixWorld); return t.geometry.boundsTree.intersectsBox(r, i); } getIntersectionVolume(t, n) { let r = new e.Box3().setFromObject(t), i = new e.Box3().setFromObject(n); if (!r.intersectsBox(i)) return null; let a = r.clone(); return a.intersect(i), a; } disposeBVH(e) { e.geometry && e.geometry.boundsTree && (e.geometry.disposeBoundsTree?.(), this.meshBVHMap.delete(e)); } disposeAll() { this.meshBVHMap = /* @__PURE__ */ new WeakMap(); } }, qo = 1e-6, Jo = qo * .5, Yo = 10 ** -Math.log10(qo), Xo = Jo * Yo; function Zo(e) { return ~~(e * Yo + Xo); } function Qo(e) { return `${Zo(e.x)},${Zo(e.y)}`; } function $o(e) { return `${Zo(e.x)},${Zo(e.y)},${Zo(e.z)}`; } function es(e) { return `${Zo(e.x)},${Zo(e.y)},${Zo(e.z)},${Zo(e.w)}`; } function ts(e, t, n) { n.direction.subVectors(t, e).normalize(); let r = e.dot(n.direction); return n.origin.copy(e).addScaledVector(n.direction, -r), n; } //#endregion //#region ../../node_modules/.pnpm/three-bvh-csg@0.0.18_three-_c2556f8e287a399f9745e40882493d3a/node_modules/three-bvh-csg/src/core/utils/geometryUtils.js function ns() { return typeof SharedArrayBuffer < "u"; } function rs(e) { if (e.buffer instanceof SharedArrayBuffer) return e; let t = e.constructor, n = e.buffer, r = new SharedArrayBuffer(n.byteLength), i = new Uint8Array(n); return new Uint8Array(r).set(i, 0), new t(r); } function is(e) { return e.index ? e.index.count : e.attributes.position.count; } function as(e) { return is(e) / 3; } //#endregion //#region ../../node_modules/.pnpm/three-bvh-csg@0.0.18_three-_c2556f8e287a399f9745e40882493d3a/node_modules/three-bvh-csg/src/core/utils/halfEdgeUtils.js var os = 1e-8, ss = new W(); function cs(e) { return ~~(e / 3); } function ls(e) { return e % 3; } function us(e, t) { return e.start - t.start; } function ds(e, t) { return ss.subVectors(t, e.origin).dot(e.direction); } function fs(e, t, n, r = os) { e.sort(us), t.sort(us); for (let r = 0; r < e.length; r++) { let i = e[r]; for (let s = 0; s < t.length; s++) { let c = t[s]; if (!(c.start > i.end)) { if (i.end < c.start || c.end < i.start) continue; if (i.start <= c.start && i.end >= c.end) a(c.end, i.end) || e.splice(r + 1, 0, { start: c.end, end: i.end, index: i.index }), i.end = c.start, c.start = 0, c.end = 0; else if (i.start >= c.start && i.end <= c.end) a(i.end, c.end) || t.splice(s + 1, 0, { start: i.end, end: c.end, index: c.index }), c.end = i.start, i.start = 0, i.end = 0; else if (i.start <= c.start && i.end <= c.end) { let e = i.end; i.end = c.start, c.start = e; } else if (i.start >= c.start && i.end >= c.end) { let e = c.end; c.end = i.start, i.start = e; } else throw Error(); } if (n.has(i.index) || n.set(i.index, []), n.has(c.index) || n.set(c.index, []), n.get(i.index).push(c.index), n.get(c.index).push(i.index), o(c) && (t.splice(s, 1), s--), o(i)) { e.splice(r, 1), r--; break; } } } i(e), i(t); function i(e) { for (let t = 0; t < e.length; t++) o(e[t]) && (e.splice(t, 1), t--); } function a(e, t) { return Math.abs(t - e) < r; } function o(e) { return Math.abs(e.end - e.start) < r; } } //#endregion //#region ../../node_modules/.pnpm/three-bvh-csg@0.0.18_three-_c2556f8e287a399f9745e40882493d3a/node_modules/three-bvh-csg/src/core/utils/RaySet.js var ps = 1e-5, ms = 1e-4, hs = class { constructor() { this._rays = []; } addRay(e) { this._rays.push(e); } findClosestRay(e) { let t = this._rays, n = e.clone(); n.direction.multiplyScalar(-1); let r = Infinity, i = null; for (let s = 0, c = t.length; s < c; s++) { let c = t[s]; if (a(c, e) && a(c, n)) continue; let l = o(c, e), u = o(c, n), d = Math.min(l, u); d < r && (r = d, i = c); } return i; function a(e, t) { let n = e.origin.distanceTo(t.origin) > ps; return e.direction.angleTo(t.direction) > ms || n; } function o(e, t) { let n = e.origin.distanceTo(t.origin), r = e.direction.angleTo(t.direction); return n / ps + r / ms; } } }, gs = new W(), _s = new W(), vs = new oe(); function ys(e, t, n) { let r = e.attributes, i = e.index, a = r.position, o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), c = Array.from(t), l = new hs(); for (let e = 0, t = c.length; e < t; e++) { let t = c[e], n = cs(t), r = ls(t), o = 3 * n + r, u = 3 * n + (r + 1) % 3; i && (o = i.getX(o), u = i.getX(u)), gs.fromBufferAttribute(a, o), _s.fromBufferAttribute(a, u), ts(gs, _s, vs); let d, f = l.findClosestRay(vs); f === null && (f = vs.clone(), l.addRay(f)), s.has(f) || s.set(f, { forward: [], reverse: [], ray: f }), d = s.get(f); let p = ds(f, gs), m = ds(f, _s); p > m && ([p, m] = [m, p]), vs.direction.dot(f.direction) < 0 ? d.reverse.push({ start: p, end: m, index: t }) : d.forward.push({ start: p, end: m, index: t }); } return s.forEach(({ forward: e, reverse: t }, r) => { fs(e, t, o, n), e.length === 0 && t.length === 0 && s.delete(r); }), { disjointConnectivityMap: o, fragmentMap: s }; } //#endregion //#region ../../node_modules/.pnpm/three-bvh-csg@0.0.18_three-_c2556f8e287a399f9745e40882493d3a/node_modules/three-bvh-csg/src/core/HalfEdgeMap.js var bs = new de(), xs = new W(), Ss = new fe(), Cs = [ "", "", "" ], ws = class { constructor() { this.data = null, this.disjointConnections = null, this.unmatchedDisjointEdges = null, this.unmatchedEdges = -1, this.matchedEdges = -1, this.useDrawRange = !0, this.useAllAttributes = !1, this.matchDisjointEdges = !1, this.degenerateEpsilon = 1e-8; } getSiblingTriangleIndex(e, t) { let n = this.data[e * 3 + t]; return n === -1 ? -1 : ~~(n / 3); } getSiblingEdgeIndex(e, t) { let n = this.data[e * 3 + t]; return n === -1 ? -1 : n % 3; } getDisjointSiblingTriangleIndices(e, t) { let n = e * 3 + t, r = this.disjointConnections.get(n); return r ? r.map((e) => ~~(e / 3)) : []; } getDisjointSiblingEdgeIndices(e, t) { let n = e * 3 + t, r = this.disjointConnections.get(n); return r ? r.map((e) => e % 3) : []; } isFullyConnected() { return this.unmatchedEdges === 0; } updateFrom(e) { let { useAllAttributes: t, useDrawRange: n, matchDisjointEdges: r, degenerateEpsilon: i } = this, a = t ? v : _, o = /* @__PURE__ */ new Map(), { attributes: s } = e, c = t ? Object.keys(s) : null, l = e.index, u = s.position, d = as(e), f = d, p = 0; n && (p = e.drawRange.start, e.drawRange.count !== Infinity && (d = ~~(e.drawRange.count / 3))); let m = this.data; (!m || m.length < 3 * f) && (m = new Int32Array(3 * f)), m.fill(-1); let h = 0, g = /* @__PURE__ */ new Set(); for (let e = p, t = d * 3 + p; e < t; e += 3) { let t = e; for (let e = 0; e < 3; e++) { let n = t + e; l && (n = l.getX(n)), Cs[e] = a(n); } for (let e = 0; e < 3; e++) { let n = (e + 1) % 3, r = Cs[e], i = Cs[n], a = `${i}_${r}`; if (o.has(a)) { let n = t + e, r = o.get(a); m[n] = r, m[r] = n, o.delete(a), h += 2, g.delete(r); } else { let n = `${r}_${i}`, a = t + e; o.set(n, a), g.add(a); } } } if (r) { let { fragmentMap: t, disjointConnectivityMap: n } = ys(e, g, i); g.clear(), t.forEach(({ forward: e, reverse: t }) => { e.forEach(({ index: e }) => g.add(e)), t.forEach(({ index: e }) => g.add(e)); }), this.unmatchedDisjointEdges = t, this.disjointConnections = n, h = d * 3 - g.size; } this.matchedEdges = h, this.unmatchedEdges = g.size, this.data = m; function _(e) { return xs.fromBufferAttribute(u, e), $o(xs); } function v(e) { let t = ""; for (let n = 0, r = c.length; n < r; n++) { let r = s[c[n]], i; switch (r.itemSize) { case 1: i = Zo(r.getX(e)); break; case 2: i = Qo(bs.fromBufferAttribute(r, e)); break; case 3: i = $o(xs.fromBufferAttribute(r, e)); break; case 4: i = es(Ss.fromBufferAttribute(r, e)); break; } t !== "" && (t += "|"), t += i; } return t; } } }, Ts = class extends U { constructor(...e) { super(...e), this.isBrush = !0, this._previousMatrix = new H(), this._previousMatrix.elements.fill(0), this._halfEdges = null, this._boundsTree = null, this._groupIndices = null, this._hash = null; } markUpdated() { this._previousMatrix.copy(this.matrix); } isDirty() { let { matrix: e, _previousMatrix: t } = this, n = e.elements, r = t.elements; for (let e = 0; e < 16; e++) if (n[e] !== r[e]) return !0; return !1; } prepareGeometry() { let e = this.geometry, t = e.attributes, n = ns(), r = e.index, i = e.attributes.position, a = r ? `${r.uuid}_${r.count}_${r.version}` : "-1_-1_-1", o = `${i.uuid}_${i.count}_${i.version}`, s = `${e.uuid}_${a}_${o}`; if (this._hash === s) return; if (this._hash = s, n) for (let e in t) { let n = t[e]; if (n.isInterleavedBufferAttribute) throw Error("Brush: InterleavedBufferAttributes are not supported."); n.array = rs(n.array); } e.boundsTree = new Ro(e, { maxLeafSize: 3, indirect: !0, useSharedArrayBuffer: n }), e.halfEdges ||= new ws(), e.halfEdges.updateFrom(e); let c = as(e); (!e.groupIndices || e.groupIndices.length !== c) && (e.groupIndices = new Uint16Array(c)); let l = e.groupIndices, u = e.groups; for (let e = 0, t = u.length; e < t; e++) { let { start: t, count: n } = u[e]; for (let r = t / 3, i = (t + n) / 3; r < i; r++) l[r] = e; } } disposeCacheData() { let { geometry: e } = this; e.halfEdges = null, e.boundsTree = null, e.groupIndices = null; } }, Es = Object.getOwnPropertyNames, Ds = (e, t) => function() { return t || (0, e[Es(e)[0]])((t = { exports: {} }).exports, t), t.exports; }, Os = Ds({ "node_modules/binary-search-bounds/search-bounds.js"(e, t) { function n(e, t, n, r, i) { for (var a = i + 1; r <= i;) { var o = r + i >>> 1, s = e[o]; (n === void 0 ? s - t : n(s, t)) >= 0 ? (a = o, i = o - 1) : r = o + 1; } return a; } function r(e, t, n, r, i) { for (var a = i + 1; r <= i;) { var o = r + i >>> 1, s = e[o]; (n === void 0 ? s - t : n(s, t)) > 0 ? (a = o, i = o - 1) : r = o + 1; } return a; } function i(e, t, n, r, i) { for (var a = r - 1; r <= i;) { var o = r + i >>> 1, s = e[o]; (n === void 0 ? s - t : n(s, t)) < 0 ? (a = o, r = o + 1) : i = o - 1; } return a; } function a(e, t, n, r, i) { for (var a = r - 1; r <= i;) { var o = r + i >>> 1, s = e[o]; (n === void 0 ? s - t : n(s, t)) <= 0 ? (a = o, r = o + 1) : i = o - 1; } return a; } function o(e, t, n, r, i) { for (; r <= i;) { var a = r + i >>> 1, o = e[a], s = n === void 0 ? o - t : n(o, t); if (s === 0) return a; s <= 0 ? r = a + 1 : i = a - 1; } return -1; } function s(e, t, n, r, i, a) { return typeof n == "function" ? a(e, t, n, r === void 0 ? 0 : r | 0, i === void 0 ? e.length - 1 : i | 0) : a(e, t, void 0, n === void 0 ? 0 : n | 0, r === void 0 ? e.length - 1 : r | 0); } t.exports = { ge: function(e, t, r, i, a) { return s(e, t, r, i, a, n); }, gt: function(e, t, n, i, a) { return s(e, t, n, i, a, r); }, lt: function(e, t, n, r, a) { return s(e, t, n, r, a, i); }, le: function(e, t, n, r, i) { return s(e, t, n, r, i, a); }, eq: function(e, t, n, r, i) { return s(e, t, n, r, i, o); } }; } }), ks = Ds({ "node_modules/two-product/two-product.js"(e, t) { t.exports = r; var n = +(2 ** 27 + 1); function r(e, t, r) { var i = e * t, a = n * e, o = a - (a - e), s = e - o, c = n * t, l = c - (c - t), u = t - l, d = i - o * l - s * l - o * u, f = s * u - d; return r ? (r[0] = f, r[1] = i, r) : [f, i]; } } }), As = Ds({ "node_modules/robust-sum/robust-sum.js"(e, t) { t.exports = r; function n(e, t) { var n = e + t, r = n - e, i = n - r, a = t - r, o = e - i + a; return o ? [o, n] : [n]; } function r(e, t) { var r = e.length | 0, i = t.length | 0; if (r === 1 && i === 1) return n(e[0], t[0]); var a = r + i, o = Array(a), s = 0, c = 0, l = 0, u = Math.abs, d = e[c], f = u(d), p = t[l], m = u(p), h, g; f < m ? (g = d, c += 1, c < r && (d = e[c], f = u(d))) : (g = p, l += 1, l < i && (p = t[l], m = u(p))), c < r && f < m || l >= i ? (h = d, c += 1, c < r && (d = e[c], f = u(d))) : (h = p, l += 1, l < i && (p = t[l], m = u(p))); for (var _ = h + g, v = _ - h, y = g - v, b = y, x = _, S, C, w, T, E; c < r && l < i;) f < m ? (h = d, c += 1, c < r && (d = e[c], f = u(d))) : (h = p, l += 1, l < i && (p = t[l], m = u(p))), g = b, _ = h + g, v = _ - h, y = g - v, y && (o[s++] = y), S = x + _, C = S - x, w = S - C, T = _ - C, E = x - w, b = E + T, x = S; for (; c < r;) h = d, g = b, _ = h + g, v = _ - h, y = g - v, y && (o[s++] = y), S = x + _, C = S - x, w = S - C, T = _ - C, E = x - w, b = E + T, x = S, c += 1, c < r && (d = e[c]); for (; l < i;) h = p, g = b, _ = h + g, v = _ - h, y = g - v, y && (o[s++] = y), S = x + _, C = S - x, w = S - C, T = _ - C, E = x - w, b = E + T, x = S, l += 1, l < i && (p = t[l]); return b && (o[s++] = b), x && (o[s++] = x), s || (o[s++] = 0), o.length = s, o; } } }), js = Ds({ "node_modules/two-sum/two-sum.js"(e, t) { t.exports = n; function n(e, t, n) { var r = e + t, i = r - e, a = r - i, o = t - i, s = e - a; return n ? (n[0] = s + o, n[1] = r, n) : [s + o, r]; } } }), Ms = Ds({ "node_modules/robust-scale/robust-scale.js"(e, t) { var n = ks(), r = js(); t.exports = i; function i(e, t) { var i = e.length; if (i === 1) { var a = n(e[0], t); return a[0] ? a : [a[1]]; } var o = Array(2 * i), s = [.1, .1], c = [.1, .1], l = 0; n(e[0], t, s), s[0] && (o[l++] = s[0]); for (var u = 1; u < i; ++u) { n(e[u], t, c); var d = s[1]; r(d, c[0], s), s[0] && (o[l++] = s[0]); var f = c[1], p = s[1], m = f + p, h = p - (m - f); s[1] = m, h && (o[l++] = h); } return s[1] && (o[l++] = s[1]), l === 0 && (o[l++] = 0), o.length = l, o; } } }), Ns = Ds({ "node_modules/robust-subtract/robust-diff.js"(e, t) { t.exports = r; function n(e, t) { var n = e + t, r = n - e, i = n - r, a = t - r, o = e - i + a; return o ? [o, n] : [n]; } function r(e, t) { var r = e.length | 0, i = t.length | 0; if (r === 1 && i === 1) return n(e[0], -t[0]); var a = r + i, o = Array(a), s = 0, c = 0, l = 0, u = Math.abs, d = e[c], f = u(d), p = -t[l], m = u(p), h, g; f < m ? (g = d, c += 1, c < r && (d = e[c], f = u(d))) : (g = p, l += 1, l < i && (p = -t[l], m = u(p))), c < r && f < m || l >= i ? (h = d, c += 1, c < r && (d = e[c], f = u(d))) : (h = p, l += 1, l < i && (p = -t[l], m = u(p))); for (var _ = h + g, v = _ - h, y = g - v, b = y, x = _, S, C, w, T, E; c < r && l < i;) f < m ? (h = d, c += 1, c < r && (d = e[c], f = u(d))) : (h = p, l += 1, l < i && (p = -t[l], m = u(p))), g = b, _ = h + g, v = _ - h, y = g - v, y && (o[s++] = y), S = x + _, C = S - x, w = S - C, T = _ - C, E = x - w, b = E + T, x = S; for (; c < r;) h = d, g = b, _ = h + g, v = _ - h, y = g - v, y && (o[s++] = y), S = x + _, C = S - x, w = S - C, T = _ - C, E = x - w, b = E + T, x = S, c += 1, c < r && (d = e[c]); for (; l < i;) h = p, g = b, _ = h + g, v = _ - h, y = g - v, y && (o[s++] = y), S = x + _, C = S - x, w = S - C, T = _ - C, E = x - w, b = E + T, x = S, l += 1, l < i && (p = -t[l]); return b && (o[s++] = b), x && (o[s++] = x), s || (o[s++] = 0), o.length = s, o; } } }), Ps = Ds({ "node_modules/robust-orientation/orientation.js"(e, t) { var n = ks(), r = As(), i = Ms(), a = Ns(), o = 5, s = 11102230246251565e-32, c = (3 + 16 * s) * s, l = (7 + 56 * s) * s; function u(e, t, n, r) { return function(n, i, a) { var o = r(e(e(t(i[1], a[0]), t(-a[1], i[0])), e(t(n[1], i[0]), t(-i[1], n[0]))), e(t(n[1], a[0]), t(-a[1], n[0]))); return o[o.length - 1]; }; } function d(e, t, n, r) { return function(i, a, o, s) { var c = r(e(e(n(e(t(o[1], s[0]), t(-s[1], o[0])), a[2]), e(n(e(t(a[1], s[0]), t(-s[1], a[0])), -o[2]), n(e(t(a[1], o[0]), t(-o[1], a[0])), s[2]))), e(n(e(t(a[1], s[0]), t(-s[1], a[0])), i[2]), e(n(e(t(i[1], s[0]), t(-s[1], i[0])), -a[2]), n(e(t(i[1], a[0]), t(-a[1], i[0])), s[2])))), e(e(n(e(t(o[1], s[0]), t(-s[1], o[0])), i[2]), e(n(e(t(i[1], s[0]), t(-s[1], i[0])), -o[2]), n(e(t(i[1], o[0]), t(-o[1], i[0])), s[2]))), e(n(e(t(a[1], o[0]), t(-o[1], a[0])), i[2]), e(n(e(t(i[1], o[0]), t(-o[1], i[0])), -a[2]), n(e(t(i[1], a[0]), t(-a[1], i[0])), o[2]))))); return c[c.length - 1]; }; } function f(e, t, n, r) { return function(i, a, o, s, c) { var l = r(e(e(e(n(e(n(e(t(s[1], c[0]), t(-c[1], s[0])), o[2]), e(n(e(t(o[1], c[0]), t(-c[1], o[0])), -s[2]), n(e(t(o[1], s[0]), t(-s[1], o[0])), c[2]))), a[3]), e(n(e(n(e(t(s[1], c[0]), t(-c[1], s[0])), a[2]), e(n(e(t(a[1], c[0]), t(-c[1], a[0])), -s[2]), n(e(t(a[1], s[0]), t(-s[1], a[0])), c[2]))), -o[3]), n(e(n(e(t(o[1], c[0]), t(-c[1], o[0])), a[2]), e(n(e(t(a[1], c[0]), t(-c[1], a[0])), -o[2]), n(e(t(a[1], o[0]), t(-o[1], a[0])), c[2]))), s[3]))), e(n(e(n(e(t(o[1], s[0]), t(-s[1], o[0])), a[2]), e(n(e(t(a[1], s[0]), t(-s[1], a[0])), -o[2]), n(e(t(a[1], o[0]), t(-o[1], a[0])), s[2]))), -c[3]), e(n(e(n(e(t(s[1], c[0]), t(-c[1], s[0])), a[2]), e(n(e(t(a[1], c[0]), t(-c[1], a[0])), -s[2]), n(e(t(a[1], s[0]), t(-s[1], a[0])), c[2]))), i[3]), n(e(n(e(t(s[1], c[0]), t(-c[1], s[0])), i[2]), e(n(e(t(i[1], c[0]), t(-c[1], i[0])), -s[2]), n(e(t(i[1], s[0]), t(-s[1], i[0])), c[2]))), -a[3])))), e(e(n(e(n(e(t(a[1], c[0]), t(-c[1], a[0])), i[2]), e(n(e(t(i[1], c[0]), t(-c[1], i[0])), -a[2]), n(e(t(i[1], a[0]), t(-a[1], i[0])), c[2]))), s[3]), e(n(e(n(e(t(a[1], s[0]), t(-s[1], a[0])), i[2]), e(n(e(t(i[1], s[0]), t(-s[1], i[0])), -a[2]), n(e(t(i[1], a[0]), t(-a[1], i[0])), s[2]))), -c[3]), n(e(n(e(t(o[1], s[0]), t(-s[1], o[0])), a[2]), e(n(e(t(a[1], s[0]), t(-s[1], a[0])), -o[2]), n(e(t(a[1], o[0]), t(-o[1], a[0])), s[2]))), i[3]))), e(n(e(n(e(t(o[1], s[0]), t(-s[1], o[0])), i[2]), e(n(e(t(i[1], s[0]), t(-s[1], i[0])), -o[2]), n(e(t(i[1], o[0]), t(-o[1], i[0])), s[2]))), -a[3]), e(n(e(n(e(t(a[1], s[0]), t(-s[1], a[0])), i[2]), e(n(e(t(i[1], s[0]), t(-s[1], i[0])), -a[2]), n(e(t(i[1], a[0]), t(-a[1], i[0])), s[2]))), o[3]), n(e(n(e(t(a[1], o[0]), t(-o[1], a[0])), i[2]), e(n(e(t(i[1], o[0]), t(-o[1], i[0])), -a[2]), n(e(t(i[1], a[0]), t(-a[1], i[0])), o[2]))), -s[3]))))), e(e(e(n(e(n(e(t(s[1], c[0]), t(-c[1], s[0])), o[2]), e(n(e(t(o[1], c[0]), t(-c[1], o[0])), -s[2]), n(e(t(o[1], s[0]), t(-s[1], o[0])), c[2]))), i[3]), n(e(n(e(t(s[1], c[0]), t(-c[1], s[0])), i[2]), e(n(e(t(i[1], c[0]), t(-c[1], i[0])), -s[2]), n(e(t(i[1], s[0]), t(-s[1], i[0])), c[2]))), -o[3])), e(n(e(n(e(t(o[1], c[0]), t(-c[1], o[0])), i[2]), e(n(e(t(i[1], c[0]), t(-c[1], i[0])), -o[2]), n(e(t(i[1], o[0]), t(-o[1], i[0])), c[2]))), s[3]), n(e(n(e(t(o[1], s[0]), t(-s[1], o[0])), i[2]), e(n(e(t(i[1], s[0]), t(-s[1], i[0])), -o[2]), n(e(t(i[1], o[0]), t(-o[1], i[0])), s[2]))), -c[3]))), e(e(n(e(n(e(t(o[1], c[0]), t(-c[1], o[0])), a[2]), e(n(e(t(a[1], c[0]), t(-c[1], a[0])), -o[2]), n(e(t(a[1], o[0]), t(-o[1], a[0])), c[2]))), i[3]), n(e(n(e(t(o[1], c[0]), t(-c[1], o[0])), i[2]), e(n(e(t(i[1], c[0]), t(-c[1], i[0])), -o[2]), n(e(t(i[1], o[0]), t(-o[1], i[0])), c[2]))), -a[3])), e(n(e(n(e(t(a[1], c[0]), t(-c[1], a[0])), i[2]), e(n(e(t(i[1], c[0]), t(-c[1], i[0])), -a[2]), n(e(t(i[1], a[0]), t(-a[1], i[0])), c[2]))), o[3]), n(e(n(e(t(a[1], o[0]), t(-o[1], a[0])), i[2]), e(n(e(t(i[1], o[0]), t(-o[1], i[0])), -a[2]), n(e(t(i[1], a[0]), t(-a[1], i[0])), o[2]))), -c[3]))))); return l[l.length - 1]; }; } function p(e) { return (e === 3 ? u : e === 4 ? d : f)(r, n, i, a); } var m = p(3), h = p(4), g = [ function() { return 0; }, function() { return 0; }, function(e, t) { return t[0] - e[0]; }, function(e, t, n) { var r = (e[1] - n[1]) * (t[0] - n[0]), i = (e[0] - n[0]) * (t[1] - n[1]), a = r - i, o; if (r > 0) { if (i <= 0) return a; o = r + i; } else if (r < 0) { if (i >= 0) return a; o = -(r + i); } else return a; var s = c * o; return a >= s || a <= -s ? a : m(e, t, n); }, function(e, t, n, r) { var i = e[0] - r[0], a = t[0] - r[0], o = n[0] - r[0], s = e[1] - r[1], c = t[1] - r[1], u = n[1] - r[1], d = e[2] - r[2], f = t[2] - r[2], p = n[2] - r[2], m = a * u, g = o * c, _ = o * s, v = i * u, y = i * c, b = a * s, x = d * (m - g) + f * (_ - v) + p * (y - b), S = l * ((Math.abs(m) + Math.abs(g)) * Math.abs(d) + (Math.abs(_) + Math.abs(v)) * Math.abs(f) + (Math.abs(y) + Math.abs(b)) * Math.abs(p)); return x > S || -x > S ? x : h(e, t, n, r); } ]; function _(e) { var t = g[e.length]; return t ||= g[e.length] = p(e.length), t.apply(void 0, e); } function v(e, t, n, r, i, a, o) { return function(t, n, s, c, l) { switch (arguments.length) { case 0: case 1: return 0; case 2: return r(t, n); case 3: return i(t, n, s); case 4: return a(t, n, s, c); case 5: return o(t, n, s, c, l); } for (var u = Array(arguments.length), d = 0; d < arguments.length; ++d) u[d] = arguments[d]; return e(u); }; } function y() { for (; g.length <= o;) g.push(p(g.length)); t.exports = v.apply(void 0, [_].concat(g)); for (var e = 0; e <= o; ++e) t.exports[e] = g[e]; } y(); } }), Fs = Ds({ "node_modules/cdt2d/lib/monotone.js"(e, t) { var n = Os(), r = Ps()[3], i = 0, a = 1, o = 2; t.exports = h; function s(e, t, n, r, i) { this.a = e, this.b = t, this.idx = n, this.lowerIds = r, this.upperIds = i; } function c(e, t, n, r) { this.a = e, this.b = t, this.type = n, this.idx = r; } function l(e, t) { var n = e.a[0] - t.a[0] || e.a[1] - t.a[1] || e.type - t.type; return n || e.type !== i && (n = r(e.a, e.b, t.b), n) ? n : e.idx - t.idx; } function u(e, t) { return r(e.a, e.b, t); } function d(e, t, i, a, o) { for (var s = n.lt(t, a, u), c = n.gt(t, a, u), l = s; l < c; ++l) { for (var d = t[l], f = d.lowerIds, p = f.length; p > 1 && r(i[f[p - 2]], i[f[p - 1]], a) > 0;) e.push([ f[p - 1], f[p - 2], o ]), --p; f.length = p, f.push(o); for (var m = d.upperIds, p = m.length; p > 1 && r(i[m[p - 2]], i[m[p - 1]], a) < 0;) e.push([ m[p - 2], m[p - 1], o ]), --p; m.length = p, m.push(o); } } function f(e, t) { var n = e.a[0] < t.a[0] ? r(e.a, e.b, t.a) : r(t.b, t.a, e.a); return n || (n = t.b[0] < e.b[0] ? r(e.a, e.b, t.b) : r(t.b, t.a, e.b), n || e.idx - t.idx); } function p(e, t, r) { var i = n.le(e, r, f), a = e[i], o = a.upperIds, c = o[o.length - 1]; a.upperIds = [c], e.splice(i + 1, 0, new s(r.a, r.b, r.idx, [c], o)); } function m(e, t, r) { var i = r.a; r.a = r.b, r.b = i; var a = n.eq(e, r, f), o = e[a], s = e[a - 1]; s.upperIds = o.upperIds, e.splice(a, 1); } function h(e, t) { for (var n = e.length, r = t.length, u = [], f = 0; f < n; ++f) u.push(new c(e[f], null, i, f)); for (var f = 0; f < r; ++f) { var h = t[f], g = e[h[0]], _ = e[h[1]]; g[0] < _[0] ? u.push(new c(g, _, o, f), new c(_, g, a, f)) : g[0] > _[0] && u.push(new c(_, g, o, f), new c(g, _, a, f)); } u.sort(l); for (var v = u[0].a[0] - (1 + Math.abs(u[0].a[0])) * 2 ** -52, y = [new s([v, 1], [v, 0], -1, [], [], [], [])], b = [], f = 0, x = u.length; f < x; ++f) { var S = u[f], C = S.type; C === i ? d(b, y, e, S.a, S.idx) : C === o ? p(y, e, S) : m(y, e, S); } return b; } } }), Is = Ds({ "node_modules/cdt2d/lib/triangulation.js"(e, t) { var n = Os(); t.exports = o; function r(e, t) { this.stars = e, this.edges = t; } var i = r.prototype; function a(e, t, n) { for (var r = 1, i = e.length; r < i; r += 2) if (e[r - 1] === t && e[r] === n) { e[r - 1] = e[i - 2], e[r] = e[i - 1], e.length = i - 2; return; } } i.isConstraint = /* @__PURE__ */ (function() { var e = [0, 0]; function t(e, t) { return e[0] - t[0] || e[1] - t[1]; } return function(r, i) { return e[0] = Math.min(r, i), e[1] = Math.max(r, i), n.eq(this.edges, e, t) >= 0; }; })(), i.removeTriangle = function(e, t, n) { var r = this.stars; a(r[e], t, n), a(r[t], n, e), a(r[n], e, t); }, i.addTriangle = function(e, t, n) { var r = this.stars; r[e].push(t, n), r[t].push(n, e), r[n].push(e, t); }, i.opposite = function(e, t) { for (var n = this.stars[t], r = 1, i = n.length; r < i; r += 2) if (n[r] === e) return n[r - 1]; return -1; }, i.flip = function(e, t) { var n = this.opposite(e, t), r = this.opposite(t, e); this.removeTriangle(e, t, n), this.removeTriangle(t, e, r), this.addTriangle(e, r, n), this.addTriangle(t, n, r); }, i.edges = function() { for (var e = this.stars, t = [], n = 0, r = e.length; n < r; ++n) for (var i = e[n], a = 0, o = i.length; a < o; a += 2) t.push([i[a], i[a + 1]]); return t; }, i.cells = function() { for (var e = this.stars, t = [], n = 0, r = e.length; n < r; ++n) for (var i = e[n], a = 0, o = i.length; a < o; a += 2) { var s = i[a], c = i[a + 1]; n < Math.min(s, c) && t.push([ n, s, c ]); } return t; }; function o(e, t) { for (var n = Array(e), i = 0; i < e; ++i) n[i] = []; return new r(n, t); } } }), Ls = Ds({ "node_modules/robust-in-sphere/in-sphere.js"(e, t) { var n = ks(), r = As(), i = Ns(), a = Ms(), o = 6; function s(e) { return (e === 3 ? d : e === 4 ? f : e === 5 ? p : m)(r, i, n, a); } function c() { return 0; } function l() { return 0; } function u() { return 0; } function d(e, t, n, r) { function i(i, a, o) { var s = n(i[0], i[0]), c = r(s, a[0]), l = r(s, o[0]), u = n(a[0], a[0]), d = r(u, i[0]), f = r(u, o[0]), p = n(o[0], o[0]), m = r(p, i[0]), h = t(e(t(r(p, a[0]), f), t(d, c)), t(m, l)); return h[h.length - 1]; } return i; } function f(e, t, n, r) { function i(i, a, o, s) { var c = e(n(i[0], i[0]), n(i[1], i[1])), l = r(c, a[0]), u = r(c, o[0]), d = r(c, s[0]), f = e(n(a[0], a[0]), n(a[1], a[1])), p = r(f, i[0]), m = r(f, o[0]), h = r(f, s[0]), g = e(n(o[0], o[0]), n(o[1], o[1])), _ = r(g, i[0]), v = r(g, a[0]), y = r(g, s[0]), b = e(n(s[0], s[0]), n(s[1], s[1])), x = r(b, i[0]), S = r(b, a[0]), C = r(b, o[0]), w = t(e(e(r(t(C, y), a[1]), e(r(t(S, h), -o[1]), r(t(v, m), s[1]))), e(r(t(S, h), i[1]), e(r(t(x, d), -a[1]), r(t(p, l), s[1])))), e(e(r(t(C, y), i[1]), e(r(t(x, d), -o[1]), r(t(_, u), s[1]))), e(r(t(v, m), i[1]), e(r(t(_, u), -a[1]), r(t(p, l), o[1]))))); return w[w.length - 1]; } return i; } function p(e, t, n, r) { function i(i, a, o, s, c) { var l = e(n(i[0], i[0]), e(n(i[1], i[1]), n(i[2], i[2]))), u = r(l, a[0]), d = r(l, o[0]), f = r(l, s[0]), p = r(l, c[0]), m = e(n(a[0], a[0]), e(n(a[1], a[1]), n(a[2], a[2]))), h = r(m, i[0]), g = r(m, o[0]), _ = r(m, s[0]), v = r(m, c[0]), y = e(n(o[0], o[0]), e(n(o[1], o[1]), n(o[2], o[2]))), b = r(y, i[0]), x = r(y, a[0]), S = r(y, s[0]), C = r(y, c[0]), w = e(n(s[0], s[0]), e(n(s[1], s[1]), n(s[2], s[2]))), T = r(w, i[0]), E = r(w, a[0]), D = r(w, o[0]), O = r(w, c[0]), k = e(n(c[0], c[0]), e(n(c[1], c[1]), n(c[2], c[2]))), A = r(k, i[0]), j = r(k, a[0]), M = r(k, o[0]), N = r(k, s[0]), P = t(e(e(e(r(e(r(t(N, O), o[1]), e(r(t(M, C), -s[1]), r(t(D, S), c[1]))), a[2]), e(r(e(r(t(N, O), a[1]), e(r(t(j, v), -s[1]), r(t(E, _), c[1]))), -o[2]), r(e(r(t(M, C), a[1]), e(r(t(j, v), -o[1]), r(t(x, g), c[1]))), s[2]))), e(r(e(r(t(D, S), a[1]), e(r(t(E, _), -o[1]), r(t(x, g), s[1]))), -c[2]), e(r(e(r(t(N, O), a[1]), e(r(t(j, v), -s[1]), r(t(E, _), c[1]))), i[2]), r(e(r(t(N, O), i[1]), e(r(t(A, p), -s[1]), r(t(T, f), c[1]))), -a[2])))), e(e(r(e(r(t(j, v), i[1]), e(r(t(A, p), -a[1]), r(t(h, u), c[1]))), s[2]), e(r(e(r(t(E, _), i[1]), e(r(t(T, f), -a[1]), r(t(h, u), s[1]))), -c[2]), r(e(r(t(D, S), a[1]), e(r(t(E, _), -o[1]), r(t(x, g), s[1]))), i[2]))), e(r(e(r(t(D, S), i[1]), e(r(t(T, f), -o[1]), r(t(b, d), s[1]))), -a[2]), e(r(e(r(t(E, _), i[1]), e(r(t(T, f), -a[1]), r(t(h, u), s[1]))), o[2]), r(e(r(t(x, g), i[1]), e(r(t(b, d), -a[1]), r(t(h, u), o[1]))), -s[2]))))), e(e(e(r(e(r(t(N, O), o[1]), e(r(t(M, C), -s[1]), r(t(D, S), c[1]))), i[2]), r(e(r(t(N, O), i[1]), e(r(t(A, p), -s[1]), r(t(T, f), c[1]))), -o[2])), e(r(e(r(t(M, C), i[1]), e(r(t(A, p), -o[1]), r(t(b, d), c[1]))), s[2]), r(e(r(t(D, S), i[1]), e(r(t(T, f), -o[1]), r(t(b, d), s[1]))), -c[2]))), e(e(r(e(r(t(M, C), a[1]), e(r(t(j, v), -o[1]), r(t(x, g), c[1]))), i[2]), r(e(r(t(M, C), i[1]), e(r(t(A, p), -o[1]), r(t(b, d), c[1]))), -a[2])), e(r(e(r(t(j, v), i[1]), e(r(t(A, p), -a[1]), r(t(h, u), c[1]))), o[2]), r(e(r(t(x, g), i[1]), e(r(t(b, d), -a[1]), r(t(h, u), o[1]))), -c[2]))))); return P[P.length - 1]; } return i; } function m(e, t, n, r) { function i(i, a, o, s, c, l) { var u = e(e(n(i[0], i[0]), n(i[1], i[1])), e(n(i[2], i[2]), n(i[3], i[3]))), d = r(u, a[0]), f = r(u, o[0]), p = r(u, s[0]), m = r(u, c[0]), h = r(u, l[0]), g = e(e(n(a[0], a[0]), n(a[1], a[1])), e(n(a[2], a[2]), n(a[3], a[3]))), _ = r(g, i[0]), v = r(g, o[0]), y = r(g, s[0]), b = r(g, c[0]), x = r(g, l[0]), S = e(e(n(o[0], o[0]), n(o[1], o[1])), e(n(o[2], o[2]), n(o[3], o[3]))), C = r(S, i[0]), w = r(S, a[0]), T = r(S, s[0]), E = r(S, c[0]), D = r(S, l[0]), O = e(e(n(s[0], s[0]), n(s[1], s[1])), e(n(s[2], s[2]), n(s[3], s[3]))), k = r(O, i[0]), A = r(O, a[0]), j = r(O, o[0]), M = r(O, c[0]), N = r(O, l[0]), P = e(e(n(c[0], c[0]), n(c[1], c[1])), e(n(c[2], c[2]), n(c[3], c[3]))), F = r(P, i[0]), I = r(P, a[0]), L = r(P, o[0]), R = r(P, s[0]), z = r(P, l[0]), ee = e(e(n(l[0], l[0]), n(l[1], l[1])), e(n(l[2], l[2]), n(l[3], l[3]))), B = r(ee, i[0]), V = r(ee, a[0]), H = r(ee, o[0]), U = r(ee, s[0]), te = r(ee, c[0]), ne = t(e(e(e(r(e(e(r(e(r(t(te, z), s[1]), e(r(t(U, N), -c[1]), r(t(R, M), l[1]))), o[2]), r(e(r(t(te, z), o[1]), e(r(t(H, D), -c[1]), r(t(L, E), l[1]))), -s[2])), e(r(e(r(t(U, N), o[1]), e(r(t(H, D), -s[1]), r(t(j, T), l[1]))), c[2]), r(e(r(t(R, M), o[1]), e(r(t(L, E), -s[1]), r(t(j, T), c[1]))), -l[2]))), a[3]), e(r(e(e(r(e(r(t(te, z), s[1]), e(r(t(U, N), -c[1]), r(t(R, M), l[1]))), a[2]), r(e(r(t(te, z), a[1]), e(r(t(V, x), -c[1]), r(t(I, b), l[1]))), -s[2])), e(r(e(r(t(U, N), a[1]), e(r(t(V, x), -s[1]), r(t(A, y), l[1]))), c[2]), r(e(r(t(R, M), a[1]), e(r(t(I, b), -s[1]), r(t(A, y), c[1]))), -l[2]))), -o[3]), r(e(e(r(e(r(t(te, z), o[1]), e(r(t(H, D), -c[1]), r(t(L, E), l[1]))), a[2]), r(e(r(t(te, z), a[1]), e(r(t(V, x), -c[1]), r(t(I, b), l[1]))), -o[2])), e(r(e(r(t(H, D), a[1]), e(r(t(V, x), -o[1]), r(t(w, v), l[1]))), c[2]), r(e(r(t(L, E), a[1]), e(r(t(I, b), -o[1]), r(t(w, v), c[1]))), -l[2]))), s[3]))), e(e(r(e(e(r(e(r(t(U, N), o[1]), e(r(t(H, D), -s[1]), r(t(j, T), l[1]))), a[2]), r(e(r(t(U, N), a[1]), e(r(t(V, x), -s[1]), r(t(A, y), l[1]))), -o[2])), e(r(e(r(t(H, D), a[1]), e(r(t(V, x), -o[1]), r(t(w, v), l[1]))), s[2]), r(e(r(t(j, T), a[1]), e(r(t(A, y), -o[1]), r(t(w, v), s[1]))), -l[2]))), -c[3]), r(e(e(r(e(r(t(R, M), o[1]), e(r(t(L, E), -s[1]), r(t(j, T), c[1]))), a[2]), r(e(r(t(R, M), a[1]), e(r(t(I, b), -s[1]), r(t(A, y), c[1]))), -o[2])), e(r(e(r(t(L, E), a[1]), e(r(t(I, b), -o[1]), r(t(w, v), c[1]))), s[2]), r(e(r(t(j, T), a[1]), e(r(t(A, y), -o[1]), r(t(w, v), s[1]))), -c[2]))), l[3])), e(r(e(e(r(e(r(t(te, z), s[1]), e(r(t(U, N), -c[1]), r(t(R, M), l[1]))), a[2]), r(e(r(t(te, z), a[1]), e(r(t(V, x), -c[1]), r(t(I, b), l[1]))), -s[2])), e(r(e(r(t(U, N), a[1]), e(r(t(V, x), -s[1]), r(t(A, y), l[1]))), c[2]), r(e(r(t(R, M), a[1]), e(r(t(I, b), -s[1]), r(t(A, y), c[1]))), -l[2]))), i[3]), r(e(e(r(e(r(t(te, z), s[1]), e(r(t(U, N), -c[1]), r(t(R, M), l[1]))), i[2]), r(e(r(t(te, z), i[1]), e(r(t(B, h), -c[1]), r(t(F, m), l[1]))), -s[2])), e(r(e(r(t(U, N), i[1]), e(r(t(B, h), -s[1]), r(t(k, p), l[1]))), c[2]), r(e(r(t(R, M), i[1]), e(r(t(F, m), -s[1]), r(t(k, p), c[1]))), -l[2]))), -a[3])))), e(e(e(r(e(e(r(e(r(t(te, z), a[1]), e(r(t(V, x), -c[1]), r(t(I, b), l[1]))), i[2]), r(e(r(t(te, z), i[1]), e(r(t(B, h), -c[1]), r(t(F, m), l[1]))), -a[2])), e(r(e(r(t(V, x), i[1]), e(r(t(B, h), -a[1]), r(t(_, d), l[1]))), c[2]), r(e(r(t(I, b), i[1]), e(r(t(F, m), -a[1]), r(t(_, d), c[1]))), -l[2]))), s[3]), r(e(e(r(e(r(t(U, N), a[1]), e(r(t(V, x), -s[1]), r(t(A, y), l[1]))), i[2]), r(e(r(t(U, N), i[1]), e(r(t(B, h), -s[1]), r(t(k, p), l[1]))), -a[2])), e(r(e(r(t(V, x), i[1]), e(r(t(B, h), -a[1]), r(t(_, d), l[1]))), s[2]), r(e(r(t(A, y), i[1]), e(r(t(k, p), -a[1]), r(t(_, d), s[1]))), -l[2]))), -c[3])), e(r(e(e(r(e(r(t(R, M), a[1]), e(r(t(I, b), -s[1]), r(t(A, y), c[1]))), i[2]), r(e(r(t(R, M), i[1]), e(r(t(F, m), -s[1]), r(t(k, p), c[1]))), -a[2])), e(r(e(r(t(I, b), i[1]), e(r(t(F, m), -a[1]), r(t(_, d), c[1]))), s[2]), r(e(r(t(A, y), i[1]), e(r(t(k, p), -a[1]), r(t(_, d), s[1]))), -c[2]))), l[3]), r(e(e(r(e(r(t(U, N), o[1]), e(r(t(H, D), -s[1]), r(t(j, T), l[1]))), a[2]), r(e(r(t(U, N), a[1]), e(r(t(V, x), -s[1]), r(t(A, y), l[1]))), -o[2])), e(r(e(r(t(H, D), a[1]), e(r(t(V, x), -o[1]), r(t(w, v), l[1]))), s[2]), r(e(r(t(j, T), a[1]), e(r(t(A, y), -o[1]), r(t(w, v), s[1]))), -l[2]))), i[3]))), e(e(r(e(e(r(e(r(t(U, N), o[1]), e(r(t(H, D), -s[1]), r(t(j, T), l[1]))), i[2]), r(e(r(t(U, N), i[1]), e(r(t(B, h), -s[1]), r(t(k, p), l[1]))), -o[2])), e(r(e(r(t(H, D), i[1]), e(r(t(B, h), -o[1]), r(t(C, f), l[1]))), s[2]), r(e(r(t(j, T), i[1]), e(r(t(k, p), -o[1]), r(t(C, f), s[1]))), -l[2]))), -a[3]), r(e(e(r(e(r(t(U, N), a[1]), e(r(t(V, x), -s[1]), r(t(A, y), l[1]))), i[2]), r(e(r(t(U, N), i[1]), e(r(t(B, h), -s[1]), r(t(k, p), l[1]))), -a[2])), e(r(e(r(t(V, x), i[1]), e(r(t(B, h), -a[1]), r(t(_, d), l[1]))), s[2]), r(e(r(t(A, y), i[1]), e(r(t(k, p), -a[1]), r(t(_, d), s[1]))), -l[2]))), o[3])), e(r(e(e(r(e(r(t(H, D), a[1]), e(r(t(V, x), -o[1]), r(t(w, v), l[1]))), i[2]), r(e(r(t(H, D), i[1]), e(r(t(B, h), -o[1]), r(t(C, f), l[1]))), -a[2])), e(r(e(r(t(V, x), i[1]), e(r(t(B, h), -a[1]), r(t(_, d), l[1]))), o[2]), r(e(r(t(w, v), i[1]), e(r(t(C, f), -a[1]), r(t(_, d), o[1]))), -l[2]))), -s[3]), r(e(e(r(e(r(t(j, T), a[1]), e(r(t(A, y), -o[1]), r(t(w, v), s[1]))), i[2]), r(e(r(t(j, T), i[1]), e(r(t(k, p), -o[1]), r(t(C, f), s[1]))), -a[2])), e(r(e(r(t(A, y), i[1]), e(r(t(k, p), -a[1]), r(t(_, d), s[1]))), o[2]), r(e(r(t(w, v), i[1]), e(r(t(C, f), -a[1]), r(t(_, d), o[1]))), -s[2]))), l[3]))))), e(e(e(r(e(e(r(e(r(t(te, z), s[1]), e(r(t(U, N), -c[1]), r(t(R, M), l[1]))), o[2]), r(e(r(t(te, z), o[1]), e(r(t(H, D), -c[1]), r(t(L, E), l[1]))), -s[2])), e(r(e(r(t(U, N), o[1]), e(r(t(H, D), -s[1]), r(t(j, T), l[1]))), c[2]), r(e(r(t(R, M), o[1]), e(r(t(L, E), -s[1]), r(t(j, T), c[1]))), -l[2]))), i[3]), e(r(e(e(r(e(r(t(te, z), s[1]), e(r(t(U, N), -c[1]), r(t(R, M), l[1]))), i[2]), r(e(r(t(te, z), i[1]), e(r(t(B, h), -c[1]), r(t(F, m), l[1]))), -s[2])), e(r(e(r(t(U, N), i[1]), e(r(t(B, h), -s[1]), r(t(k, p), l[1]))), c[2]), r(e(r(t(R, M), i[1]), e(r(t(F, m), -s[1]), r(t(k, p), c[1]))), -l[2]))), -o[3]), r(e(e(r(e(r(t(te, z), o[1]), e(r(t(H, D), -c[1]), r(t(L, E), l[1]))), i[2]), r(e(r(t(te, z), i[1]), e(r(t(B, h), -c[1]), r(t(F, m), l[1]))), -o[2])), e(r(e(r(t(H, D), i[1]), e(r(t(B, h), -o[1]), r(t(C, f), l[1]))), c[2]), r(e(r(t(L, E), i[1]), e(r(t(F, m), -o[1]), r(t(C, f), c[1]))), -l[2]))), s[3]))), e(e(r(e(e(r(e(r(t(U, N), o[1]), e(r(t(H, D), -s[1]), r(t(j, T), l[1]))), i[2]), r(e(r(t(U, N), i[1]), e(r(t(B, h), -s[1]), r(t(k, p), l[1]))), -o[2])), e(r(e(r(t(H, D), i[1]), e(r(t(B, h), -o[1]), r(t(C, f), l[1]))), s[2]), r(e(r(t(j, T), i[1]), e(r(t(k, p), -o[1]), r(t(C, f), s[1]))), -l[2]))), -c[3]), r(e(e(r(e(r(t(R, M), o[1]), e(r(t(L, E), -s[1]), r(t(j, T), c[1]))), i[2]), r(e(r(t(R, M), i[1]), e(r(t(F, m), -s[1]), r(t(k, p), c[1]))), -o[2])), e(r(e(r(t(L, E), i[1]), e(r(t(F, m), -o[1]), r(t(C, f), c[1]))), s[2]), r(e(r(t(j, T), i[1]), e(r(t(k, p), -o[1]), r(t(C, f), s[1]))), -c[2]))), l[3])), e(r(e(e(r(e(r(t(te, z), o[1]), e(r(t(H, D), -c[1]), r(t(L, E), l[1]))), a[2]), r(e(r(t(te, z), a[1]), e(r(t(V, x), -c[1]), r(t(I, b), l[1]))), -o[2])), e(r(e(r(t(H, D), a[1]), e(r(t(V, x), -o[1]), r(t(w, v), l[1]))), c[2]), r(e(r(t(L, E), a[1]), e(r(t(I, b), -o[1]), r(t(w, v), c[1]))), -l[2]))), i[3]), r(e(e(r(e(r(t(te, z), o[1]), e(r(t(H, D), -c[1]), r(t(L, E), l[1]))), i[2]), r(e(r(t(te, z), i[1]), e(r(t(B, h), -c[1]), r(t(F, m), l[1]))), -o[2])), e(r(e(r(t(H, D), i[1]), e(r(t(B, h), -o[1]), r(t(C, f), l[1]))), c[2]), r(e(r(t(L, E), i[1]), e(r(t(F, m), -o[1]), r(t(C, f), c[1]))), -l[2]))), -a[3])))), e(e(e(r(e(e(r(e(r(t(te, z), a[1]), e(r(t(V, x), -c[1]), r(t(I, b), l[1]))), i[2]), r(e(r(t(te, z), i[1]), e(r(t(B, h), -c[1]), r(t(F, m), l[1]))), -a[2])), e(r(e(r(t(V, x), i[1]), e(r(t(B, h), -a[1]), r(t(_, d), l[1]))), c[2]), r(e(r(t(I, b), i[1]), e(r(t(F, m), -a[1]), r(t(_, d), c[1]))), -l[2]))), o[3]), r(e(e(r(e(r(t(H, D), a[1]), e(r(t(V, x), -o[1]), r(t(w, v), l[1]))), i[2]), r(e(r(t(H, D), i[1]), e(r(t(B, h), -o[1]), r(t(C, f), l[1]))), -a[2])), e(r(e(r(t(V, x), i[1]), e(r(t(B, h), -a[1]), r(t(_, d), l[1]))), o[2]), r(e(r(t(w, v), i[1]), e(r(t(C, f), -a[1]), r(t(_, d), o[1]))), -l[2]))), -c[3])), e(r(e(e(r(e(r(t(L, E), a[1]), e(r(t(I, b), -o[1]), r(t(w, v), c[1]))), i[2]), r(e(r(t(L, E), i[1]), e(r(t(F, m), -o[1]), r(t(C, f), c[1]))), -a[2])), e(r(e(r(t(I, b), i[1]), e(r(t(F, m), -a[1]), r(t(_, d), c[1]))), o[2]), r(e(r(t(w, v), i[1]), e(r(t(C, f), -a[1]), r(t(_, d), o[1]))), -c[2]))), l[3]), r(e(e(r(e(r(t(R, M), o[1]), e(r(t(L, E), -s[1]), r(t(j, T), c[1]))), a[2]), r(e(r(t(R, M), a[1]), e(r(t(I, b), -s[1]), r(t(A, y), c[1]))), -o[2])), e(r(e(r(t(L, E), a[1]), e(r(t(I, b), -o[1]), r(t(w, v), c[1]))), s[2]), r(e(r(t(j, T), a[1]), e(r(t(A, y), -o[1]), r(t(w, v), s[1]))), -c[2]))), i[3]))), e(e(r(e(e(r(e(r(t(R, M), o[1]), e(r(t(L, E), -s[1]), r(t(j, T), c[1]))), i[2]), r(e(r(t(R, M), i[1]), e(r(t(F, m), -s[1]), r(t(k, p), c[1]))), -o[2])), e(r(e(r(t(L, E), i[1]), e(r(t(F, m), -o[1]), r(t(C, f), c[1]))), s[2]), r(e(r(t(j, T), i[1]), e(r(t(k, p), -o[1]), r(t(C, f), s[1]))), -c[2]))), -a[3]), r(e(e(r(e(r(t(R, M), a[1]), e(r(t(I, b), -s[1]), r(t(A, y), c[1]))), i[2]), r(e(r(t(R, M), i[1]), e(r(t(F, m), -s[1]), r(t(k, p), c[1]))), -a[2])), e(r(e(r(t(I, b), i[1]), e(r(t(F, m), -a[1]), r(t(_, d), c[1]))), s[2]), r(e(r(t(A, y), i[1]), e(r(t(k, p), -a[1]), r(t(_, d), s[1]))), -c[2]))), o[3])), e(r(e(e(r(e(r(t(L, E), a[1]), e(r(t(I, b), -o[1]), r(t(w, v), c[1]))), i[2]), r(e(r(t(L, E), i[1]), e(r(t(F, m), -o[1]), r(t(C, f), c[1]))), -a[2])), e(r(e(r(t(I, b), i[1]), e(r(t(F, m), -a[1]), r(t(_, d), c[1]))), o[2]), r(e(r(t(w, v), i[1]), e(r(t(C, f), -a[1]), r(t(_, d), o[1]))), -c[2]))), -s[3]), r(e(e(r(e(r(t(j, T), a[1]), e(r(t(A, y), -o[1]), r(t(w, v), s[1]))), i[2]), r(e(r(t(j, T), i[1]), e(r(t(k, p), -o[1]), r(t(C, f), s[1]))), -a[2])), e(r(e(r(t(A, y), i[1]), e(r(t(k, p), -a[1]), r(t(_, d), s[1]))), o[2]), r(e(r(t(w, v), i[1]), e(r(t(C, f), -a[1]), r(t(_, d), o[1]))), -s[2]))), c[3])))))); return ne[ne.length - 1]; } return i; } var h = [ c, l, u ]; function g(e) { var t = h[e.length]; return t ||= h[e.length] = s(e.length), t.apply(void 0, e); } function _(e, t, n, r, i, a, o, s) { function c(t, n, c, l, u, d) { switch (arguments.length) { case 0: case 1: return 0; case 2: return r(t, n); case 3: return i(t, n, c); case 4: return a(t, n, c, l); case 5: return o(t, n, c, l, u); case 6: return s(t, n, c, l, u, d); } for (var f = Array(arguments.length), p = 0; p < arguments.length; ++p) f[p] = arguments[p]; return e(f); } return c; } function v() { for (; h.length <= o;) h.push(s(h.length)); t.exports = _.apply(void 0, [g].concat(h)); for (var e = 0; e <= o; ++e) t.exports[e] = h[e]; } v(); } }), Rs = Ds({ "node_modules/cdt2d/lib/delaunay.js"(e, t) { var n = Ls()[4]; Os(), t.exports = i; function r(e, t, r, i, a, o) { var s = t.opposite(i, a); if (!(s < 0)) { if (a < i) { var c = i; i = a, a = c, c = o, o = s, s = c; } t.isConstraint(i, a) || n(e[i], e[a], e[o], e[s]) < 0 && r.push(i, a); } } function i(e, t) { for (var i = [], a = e.length, o = t.stars, s = 0; s < a; ++s) for (var c = o[s], l = 1; l < c.length; l += 2) { var u = c[l]; if (!(u < s) && !t.isConstraint(s, u)) { for (var d = c[l - 1], f = -1, p = 1; p < c.length; p += 2) if (c[p - 1] === u) { f = c[p]; break; } f < 0 || n(e[s], e[u], e[d], e[f]) < 0 && i.push(s, u); } } for (; i.length > 0;) { for (var u = i.pop(), s = i.pop(), d = -1, f = -1, c = o[s], m = 1; m < c.length; m += 2) { var h = c[m - 1], g = c[m]; h === u ? f = g : g === u && (d = h); } d < 0 || f < 0 || n(e[s], e[u], e[d], e[f]) >= 0 || (t.flip(s, u), r(e, t, i, d, s, f), r(e, t, i, s, f, d), r(e, t, i, f, u, d), r(e, t, i, u, d, f)); } } } }), zs = Ds({ "node_modules/cdt2d/lib/filter.js"(e, t) { var n = Os(); t.exports = c; function r(e, t, n, r, i, a, o) { this.cells = e, this.neighbor = t, this.flags = r, this.constraint = n, this.active = i, this.next = a, this.boundary = o; } var i = r.prototype; function a(e, t) { return e[0] - t[0] || e[1] - t[1] || e[2] - t[2]; } i.locate = /* @__PURE__ */ (function() { var e = [ 0, 0, 0 ]; return function(t, r, i) { var o = t, s = r, c = i; return r < i ? r < t && (o = r, s = i, c = t) : i < t && (o = i, s = t, c = r), o < 0 ? -1 : (e[0] = o, e[1] = s, e[2] = c, n.eq(this.cells, e, a)); }; })(); function o(e, t) { for (var n = e.cells(), i = n.length, o = 0; o < i; ++o) { var s = n[o], c = s[0], l = s[1], u = s[2]; l < u ? l < c && (s[0] = l, s[1] = u, s[2] = c) : u < c && (s[0] = u, s[1] = c, s[2] = l); } n.sort(a); for (var d = Array(i), o = 0; o < d.length; ++o) d[o] = 0; var f = [], p = [], m = Array(3 * i), h = Array(3 * i), g = null; t && (g = []); for (var _ = new r(n, m, h, d, f, p, g), o = 0; o < i; ++o) for (var s = n[o], v = 0; v < 3; ++v) { var c = s[v], l = s[(v + 1) % 3], y = m[3 * o + v] = _.locate(l, c, e.opposite(l, c)), b = h[3 * o + v] = e.isConstraint(c, l); y < 0 && (b ? p.push(o) : (f.push(o), d[o] = 1), t && g.push([ l, c, -1 ])); } return _; } function s(e, t, n) { for (var r = 0, i = 0; i < e.length; ++i) t[i] === n && (e[r++] = e[i]); return e.length = r, e; } function c(e, t, n) { var r = o(e, n); if (t === 0) return n ? r.cells.concat(r.boundary) : r.cells; for (var i = 1, a = r.active, c = r.next, l = r.flags, u = r.cells, d = r.constraint, f = r.neighbor; a.length > 0 || c.length > 0;) { for (; a.length > 0;) { var p = a.pop(); if (l[p] !== -i) { l[p] = i, u[p]; for (var m = 0; m < 3; ++m) { var h = f[3 * p + m]; h >= 0 && l[h] === 0 && (d[3 * p + m] ? c.push(h) : (a.push(h), l[h] = i)); } } } var g = c; c = a, a = g, c.length = 0, i = -i; } var _ = s(u, l, t); return n ? _.concat(r.boundary) : _; } } }), Bs = Ds({ "node_modules/cdt2d/cdt2d.js"(e, t) { var n = Fs(), r = Is(), i = Rs(), a = zs(); t.exports = u; function o(e) { return [Math.min(e[0], e[1]), Math.max(e[0], e[1])]; } function s(e, t) { return e[0] - t[0] || e[1] - t[1]; } function c(e) { return e.map(o).sort(s); } function l(e, t, n) { return t in e ? e[t] : n; } function u(e, t, o) { Array.isArray(t) ? (o ||= {}, t ||= []) : (o = t || {}, t = []); var s = !!l(o, "delaunay", !0), u = !!l(o, "interior", !0), d = !!l(o, "exterior", !0), f = !!l(o, "infinity", !1); if (!u && !d || e.length === 0) return []; var p = n(e, t); if (s || u !== d || f) { for (var m = r(e.length, c(t)), h = 0; h < p.length; ++h) { var g = p[h]; m.addTriangle(g[0], g[1], g[2]); } return s && i(e, m), d ? u ? f ? a(m, 0, f) : m.cells() : a(m, 1, f) : a(m, -1); } else return p; } } })(), Vs = class { constructor(e) { this.createFn = e, this._pool = [], this._index = 0; } getInstance() { return this._index >= this._pool.length && this._pool.push(this.createFn()), this._pool[this._index++]; } clear() { this._index = 0; } reset() { this._pool.length = 0, this._index = 0; } }, Hs = 1e-16, Us = 1e-16, Ws = new W(), Gs = new W(), Ks = new Vs(() => ({ param: 0, index: 0 })), qs = new Vs(() => new W()); function Js(e, t, n, r) { Ks.clear(), t.length = 0, n.length = 0; for (let t = 0, n = e.length; t < n; t++) { let n = e[t]; c(n.start), c(n.end); } for (let t = 0, n = e.length; t < n; t++) { let i = e[t]; for (let a = t + 1; a < n; a++) { let t = e[a]; i.distanceSqToLine3(t, Ws, Gs) < Hs * r && c(Gs); } } let i = []; for (let a = 0, o = e.length; a < o; a++) { i.length = 0; let o = e[a]; for (let e = 0, n = t.length; e < n; e++) { let n = t[e], a = o.closestPointToPointParameter(n, !0); if (o.at(a, Ws), n.distanceToSquared(Ws) < Hs * r) { let t = Ks.getInstance(); t.param = a, t.index = e, i.push(t); } } i.sort(s); for (let e = 0, t = i.length - 1; e < t; e++) { let t = i[e].index, r = i[e + 1].index; t !== r && n.push([t, r]); } } let a = /* @__PURE__ */ new Set(), o = 0; for (let e = 0, t = n.length; e < t; e++) { let t = n[e], r = Math.min(t[0], t[1]), i = Math.max(t[0], t[1]), s = r + "," + i; a.has(s) || (a.add(s), n[o++] = t); } n.length = o; function s(e, t) { return e.param - t.param; } function c(e) { for (let n = 0; n < t.length; n++) { let i = t[n]; if (e === i || e.distanceToSquared(i) < Us * r) return n; } return t.push(qs.getInstance().copy(e)), t.length - 1; } } var Ys = class { constructor() { this.trianglePool = new Vs(() => new da()), this.linePool = new Vs(() => new R()), this.triangles = [], this.triangleIndices = [], this.constrainedEdges = [], this.triangleConnectivity = [], this.normal = new W(), this.projOrigin = new W(), this.projU = new W(), this.projV = new W(), this.baseTri = new da(), this.baseIndices = [ , , , ]; } initialize(e, t = null, n = null, r = null) { this.reset(); let { normal: i, baseTri: a, projU: o, projV: s, projOrigin: c, constrainedEdges: l, linePool: u, baseIndices: d } = this; e.getNormal(i), a.copy(e), a.update(), d[0] = t, d[1] = n, d[2] = r, l.length = 0; let f = u.getInstance(); f.start.copy(a.a), f.end.copy(a.b); let p = u.getInstance(); p.start.copy(a.b), p.end.copy(a.c); let m = u.getInstance(); m.start.copy(a.c), m.end.copy(a.a), l.push(f, p, m), c.copy(a.a), o.subVectors(a.b, a.a).normalize(), s.crossVectors(i, o).normalize(); } addConstraintEdge(e) { let { constrainedEdges: t, linePool: n } = this, r = n.getInstance().copy(e); t.push(r); } _to2D(e, t) { let { projOrigin: n, projU: r, projV: i } = this; return Ws.subVectors(e, n), t.set(Ws.dot(r), Ws.dot(i), 0); } _from2D(e, t, n) { let { projOrigin: r, projU: i, projV: a } = this; return n.copy(r).addScaledVector(i, e).addScaledVector(a, t), n; } triangulate() { let { triangles: e, trianglePool: t, triangleConnectivity: n, triangleIndices: r, linePool: i, baseTri: a, constrainedEdges: o, baseIndices: s } = this; e.length = 0, t.clear(); let c = []; for (let e = 0, t = o.length; e < t; e++) { let t = o[e], n = i.getInstance(); this._to2D(t.start, n.start), this._to2D(t.end, n.end), c.push(n); } let l = 0; for (let e = 0; e < 3; e++) { let t = this._to2D(a.points[e], Ws); l = Math.max(l, Math.abs(t.x), Math.abs(t.y)); } let u = [], d = []; Js(c, u, d, l); let f = []; for (let e = 0, t = u.length; e < t; e++) { let t = u[e]; f.push([t.x, t.y]); } let p = Bs(f, d, { exterior: !1 }), m = /* @__PURE__ */ new Map(); for (let e = 0, t = d.length; e < t; e++) { let t = d[e]; m.set(`${t[0]}_${t[1]}`, -1), m.set(`${t[1]}_${t[0]}`, -1); } let h = `${s[0]}_${s[1]}_${s[2]}_`; for (let i = 0, a = p.length; i < a; i++) { let a = p[i], [o, c, l] = a, u = t.getInstance(); this._from2D(f[o][0], f[o][1], u.a), this._from2D(f[c][0], f[c][1], u.b), this._from2D(f[l][0], f[l][1], u.c), e.push(u); let d = []; n.push(d); let g = []; r.push(g); for (let e = 0; e < 3; e++) { let t = a[e]; g.push(t < 3 ? s[t] : h + t); let r = a[(e + 1) % 3], o = `${t}_${r}`; if (m.has(o)) { let e = m.get(o); e !== -1 && (d.push(e), n[e].push(i)); } else { let e = `${r}_${t}`; m.set(e, i); } } } } reset() { this.trianglePool.clear(), this.linePool.clear(), this.triangles.length = 0, this.triangleIndices.length = 0, this.triangleConnectivity.length = 0, this.constrainedEdges.length = 0; } }, Xs = 1e-14, Zs = new W(), Qs = new W(), $s = new W(); function ec(e, t = Xs) { Zs.subVectors(e.b, e.a), Qs.subVectors(e.c, e.a), $s.subVectors(e.b, e.c); let n = Zs.angleTo(Qs), r = Zs.angleTo($s), i = Math.PI - n - r; return Math.abs(n) < t || Math.abs(r) < t || Math.abs(i) < t || e.a.distanceToSquared(e.b) < t || e.a.distanceToSquared(e.c) < t || e.b.distanceToSquared(e.c) < t; } //#endregion //#region ../../node_modules/.pnpm/three-bvh-csg@0.0.18_three-_c2556f8e287a399f9745e40882493d3a/node_modules/three-bvh-csg/src/core/LegacyTriangleSplitter.js var tc = 1e-10, nc = 1e-10, rc = new R(), ic = new R(), ac = new W(), oc = new W(), sc = new W(), cc = new re(), lc = new da(), uc = class { constructor() { this.trianglePool = new Vs(() => new ue()), this.triangles = [], this.normal = new W(); } initialize(e) { this.reset(); let { triangles: t, trianglePool: n, normal: r } = this; if (Array.isArray(e)) for (let i = 0, a = e.length; i < a; i++) { let a = e[i]; if (i === 0) a.getNormal(r); else if (Math.abs(1 - a.getNormal(ac).dot(r)) > tc) throw Error("Triangle Splitter: Cannot initialize with triangles that have different normals."); let o = n.getInstance(); o.copy(a), t.push(o); } else { e.getNormal(r); let i = n.getInstance(); i.copy(e), t.push(i); } } splitByTriangle(e, t) { let { triangles: n } = this; if (t) { for (let e = 0, t = n.length; e < t; e++) { let t = n[e]; t.coplanarCount = 0; } let t = [ e.a, e.b, e.c ]; for (let n = 0; n < 3; n++) { let r = (n + 1) % 3, i = t[n], a = t[r]; e.getNormal(oc).normalize(), ac.subVectors(a, i).normalize(), sc.crossVectors(oc, ac), cc.setFromNormalAndCoplanarPoint(sc, i), this.splitByPlane(cc, e); } } else e.getPlane(cc), this.splitByPlane(cc, e); } splitByPlane(e, t) { let { triangles: n, trianglePool: r } = this; lc.copy(t), lc.needsUpdate = !0; for (let t = 0, i = n.length; t < i; t++) { let a = n[t]; if (!lc.intersectsTriangle(a, rc, !0)) continue; let { a: o, b: s, c } = a, l = 0, u = -1, d = !1, f = [], p = [], m = [ o, s, c ]; for (let t = 0; t < 3; t++) { let n = (t + 1) % 3; rc.start.copy(m[t]), rc.end.copy(m[n]); let r = e.distanceToPoint(rc.start), i = e.distanceToPoint(rc.end); if (Math.abs(r) < nc && Math.abs(i) < nc) { d = !0; break; } if (r > 0 ? f.push(t) : p.push(t), Math.abs(r) < nc) continue; let a = !!e.intersectLine(rc, ac); !a && Math.abs(i) < nc && (ac.copy(rc.end), a = !0), a && !(ac.distanceTo(rc.start) < tc) && (ac.distanceTo(rc.end) < tc && (u = t), l === 0 ? ic.start.copy(ac) : ic.end.copy(ac), l++); } if (!d && l === 2 && ic.distance() > nc) if (u !== -1) { u = (u + 1) % 3; let e = 0; e === u && (e = (e + 1) % 3); let o = e + 1; o === u && (o = (o + 1) % 3); let s = r.getInstance(); s.a.copy(m[o]), s.b.copy(ic.end), s.c.copy(ic.start), ec(s) || n.push(s), a.a.copy(m[e]), a.b.copy(ic.start), a.c.copy(ic.end), ec(a) && (n.splice(t, 1), t--, i--); } else { let e = f.length >= 2 ? p[0] : f[0]; if (e === 0) { let e = ic.start; ic.start = ic.end, ic.end = e; } let o = (e + 1) % 3, s = (e + 2) % 3, c = r.getInstance(), l = r.getInstance(); m[o].distanceToSquared(ic.start) < m[s].distanceToSquared(ic.end) ? (c.a.copy(m[o]), c.b.copy(ic.start), c.c.copy(ic.end), l.a.copy(m[o]), l.b.copy(m[s]), l.c.copy(ic.start)) : (c.a.copy(m[s]), c.b.copy(ic.start), c.c.copy(ic.end), l.a.copy(m[o]), l.b.copy(m[s]), l.c.copy(ic.end)), a.a.copy(m[e]), a.b.copy(ic.end), a.c.copy(ic.start), ec(c) || n.push(c), ec(l) || n.push(l), ec(a) && (n.splice(t, 1), t--, i--); } else l === 3 && console.warn("TriangleClipper: Coplanar clip not handled"); } } reset() { this.triangles.length = 0, this.trianglePool.clear(); } }, dc = class { constructor() { this.coplanarSet = /* @__PURE__ */ new Map(), this.intersectionSet = /* @__PURE__ */ new Map(), this.edgeSet = /* @__PURE__ */ new Map(), this.ids = []; } add(e, t, n = !1) { let { intersectionSet: r, coplanarSet: i, ids: a } = this; r.has(e) || (r.set(e, []), a.push(e)), r.get(e).push(t), n && (i.has(e) || i.set(e, /* @__PURE__ */ new Set()), i.get(e).add(t)); } addIntersectionEdge(e, t) { let { edgeSet: n } = this; n.has(e) || n.set(e, /* @__PURE__ */ new Set()), n.get(e).add(t); } getIntersectionEdges(e) { return this.edgeSet.get(e) || null; } }, fc = 1e-10, pc = 1e-15, mc = 1e-10, hc = 1e-10, gc = new R(), _c = new R(), vc = new W(), yc = new W(), bc = new W(), xc = new re(), Sc = new W(), Cc = new W(); function wc(e, t) { e.getNormal(Sc), t.getNormal(Cc); let n = Sc.dot(Cc); if (Math.abs(1 - Math.abs(n)) >= mc) return !1; let r = Sc.dot(e.a), i = Sc.dot(t.a); return Math.abs(r - i) < hc; } function Tc(e, t, n, r) { let i = 0, a = 1; e.delta(vc); let o = [ t.a, t.b, t.c ]; for (let t = 0; t < 3; t++) { let r = o[t], s = o[(t + 1) % 3]; yc.subVectors(s, r), bc.crossVectors(n, yc), xc.setFromNormalAndCoplanarPoint(bc, r); let c = xc.distanceToPoint(e.start), l = xc.normal.dot(vc); if (Math.abs(l) < pc) { if (c < -fc) return null; continue; } let u = -c / l; if (l > 0 ? i = Math.max(i, u) : a = Math.min(a, u), i > a + fc) return null; } return a - i < fc ? null : (e.at(i, r.start), e.at(a, r.end), r); } function Ec(e, t, n) { let r = 0; e.getNormal(Sc), t.getNormal(Cc); let i = [ t.a, t.b, t.c ]; for (let t = 0; t < 3; t++) { _c.start.copy(i[t]), _c.end.copy(i[(t + 1) % 3]); let a = Tc(_c, e, Sc, gc); a !== null && (r >= n.length && n.push(new R()), n[r].copy(a), r++); } let a = [ e.a, e.b, e.c ]; for (let e = 0; e < 3; e++) { _c.start.copy(a[e]), _c.end.copy(a[(e + 1) % 3]); let i = Tc(_c, t, Cc, gc); i !== null && (r >= n.length && n.push(new R()), n[r].copy(i), r++); } return r; } //#endregion //#region ../../node_modules/.pnpm/three-bvh-csg@0.0.18_three-_c2556f8e287a399f9745e40882493d3a/node_modules/three-bvh-csg/src/core/operations/operationsUtils.js var Dc = new oe(), Oc = new H(), kc = new R(), Ac = [], jc = new Vs(() => new R()), Mc = null; function Nc(e) { Mc = e; } function q(e, t, n = null) { e.getMidpoint(Dc.origin), e.getNormal(Dc.direction), n && (Dc.origin.applyMatrix4(n), Dc.direction.transformDirection(n)); let r = t.raycastFirst(Dc, P); return r && Dc.direction.dot(r.face.normal) > 0 ? -1 : 1; } function Pc(e, t) { let n = new dc(), r = new dc(); return jc.clear(), Oc.copy(e.matrixWorld).invert().multiply(t.matrixWorld), e.geometry.boundsTree.bvhcast(t.geometry.boundsTree, Oc, { intersectsTriangles(i, a, o, s) { if (!ec(i) && !ec(a)) { let c = (wc(i, a) ? Ec(i, a, Ac) : 0) > 2; if (c || i.intersectsTriangle(a, kc, !0)) { let l = e.geometry.boundsTree.resolveTriangleIndex(o), u = t.geometry.boundsTree.resolveTriangleIndex(s); if (n.add(l, u, c), r.add(u, l, c), c) { let e = Ec(i, a, Ac); for (let t = 0; t < e; t++) { let e = jc.getInstance().copy(Ac[t]); n.addIntersectionEdge(l, e), r.addIntersectionEdge(u, e); } } else { let e = jc.getInstance().copy(kc), t = jc.getInstance().copy(kc); n.addIntersectionEdge(l, e), r.addIntersectionEdge(u, t); } Mc && (Mc.addEdge(kc), Mc.addIntersectingTriangles(o, i, s, a)); } } return !1; } }), { aIntersections: n, bIntersections: r }; } function Fc(e, t, n = !1) { switch (e) { case 0: if (t === 1 || t === 2 && !n) return 1; break; case 1: if (n) { if (t === -1) return 0; } else if (t === 1 || t === -2) return 1; break; case 2: if (n) { if (t === 1 || t === -2) return 1; } else if (t === -1) return 0; break; case 4: if (t === -1) return 0; if (t === 1) return 1; break; case 3: if (t === -1 || t === 2 && !n) return 1; break; case 5: if (!n && (t === 1 || t === -2)) return 1; break; case 6: if (!n && (t === -1 || t === 2)) return 1; break; default: throw Error(`Unrecognized CSG operation enum "${e}".`); } return 2; } //#endregion //#region ../../node_modules/.pnpm/three-bvh-csg@0.0.18_three-_c2556f8e287a399f9745e40882493d3a/node_modules/three-bvh-csg/src/core/debug/OperationDebugData.js var Ic = class { constructor(e) { this.triangle = new ue().copy(e), this.intersects = {}; } addTriangle(e, t) { this.intersects[e] = new ue().copy(t); } getIntersectArray() { let e = [], { intersects: t } = this; for (let n in t) e.push(t[n]); return e; } }, Lc = class { constructor() { this.data = {}; } addTriangleIntersection(e, t, n, r) { let { data: i } = this; i[e] || (i[e] = new Ic(t)), i[e].addTriangle(n, r); } getTrianglesAsArray(e = null) { let { data: t } = this, n = []; if (e !== null) e in t && n.push(t[e].triangle); else for (let e in t) n.push(t[e].triangle); return n; } getTriangleIndices() { return Object.keys(this.data).map((e) => parseInt(e)); } getIntersectionIndices(e) { let { data: t } = this; return t[e] ? Object.keys(t[e].intersects).map((e) => parseInt(e)) : []; } getIntersectionsAsArray(e = null, t = null) { let { data: n } = this, r = /* @__PURE__ */ new Set(), i = [], a = (e) => { if (n[e]) if (t !== null) n[e].intersects[t] && i.push(n[e].intersects[t]); else { let t = n[e].intersects; for (let e in t) r.has(e) || (r.add(e), i.push(t[e])); } }; if (e !== null) a(e); else for (let e in n) a(e); return i; } reset() { this.data = {}; } }, J = class { constructor() { this.enabled = !1, this.triangleIntersectsA = new Lc(), this.triangleIntersectsB = new Lc(), this.intersectionEdges = []; } addIntersectingTriangles(e, t, n, r) { let { triangleIntersectsA: i, triangleIntersectsB: a } = this; i.addTriangleIntersection(e, t, n, r), a.addTriangleIntersection(n, r, e, t); } addEdge(e) { this.intersectionEdges.push(e.clone()); } reset() { this.triangleIntersectsA.reset(), this.triangleIntersectsB.reset(), this.intersectionEdges = []; } init() { this.enabled && (this.reset(), Nc(this)); } complete() { this.enabled && Nc(null); } }, Y = new H(), Rc = new H(), zc = new H(), Bc = new V(), Vc = new ue(), Hc = new ue(), Uc = new ue(), Wc = new ue(), Gc = [], Kc = [], qc = /* @__PURE__ */ new Set(), Jc = new W(), Yc = new W(), Xc = new Vs(() => new ue()), Zc = new W(), Qc = []; function $c(e, t, n, r, i, a = {}) { let { useGroups: o = !0 } = a, { aIntersections: s, bIntersections: c } = Pc(e, t), l = [], u; return u = o ? 0 : -1, tl(e, t, s, n, !1, i, u), el(e, t, s, n, !1, r, i, u), n.findIndex((e) => e !== 6 && e !== 5) !== -1 && (i.forEach((e) => e.clearIndexMap()), u = o ? e.geometry.groups.length || 1 : -1, tl(t, e, c, n, !0, i, u), el(t, e, c, n, !0, r, i, u)), i.forEach((e) => e.clearIndexMap()), Gc.length = 0, { groups: l, materials: null }; } function el(e, t, n, r, i, a, o, s = 0) { Y.copy(t.matrixWorld).invert().multiply(e.matrixWorld), Rc.copy(Y).invert(), i ? zc.copy(Y) : zc.identity(); let c = zc.determinant() < 0; Bc.getNormalMatrix(zc).multiplyScalar(c ? -1 : 1); let l = e.geometry.groupIndices, u = e.geometry.index, d = e.geometry.attributes.position, f = t.geometry.boundsTree, p = t.geometry.index, m = t.geometry.attributes.position, h = n.ids; for (let t = 0, g = h.length; t < g; t++) { let g = h[t], _ = s === -1 ? 0 : l[g] + s, v = 3 * g, y = v + 0, b = v + 1, x = v + 2; u && (y = u.getX(y), b = u.getX(b), x = u.getX(x)), Vc.a.fromBufferAttribute(d, y), Vc.b.fromBufferAttribute(d, b), Vc.c.fromBufferAttribute(d, x), i && (Vc.a.applyMatrix4(Y), Vc.b.applyMatrix4(Y), Vc.c.applyMatrix4(Y)), a.reset(), a.initialize(Vc, y, b, x), Qc.length = 0, Xc.clear(), Vc.getNormal(Yc); let S = n.coplanarSet.get(g); if (S) for (let e of S) { let t = 3 * e, n = t + 0, r = t + 1, a = t + 2; p && (n = p.getX(n), r = p.getX(r), a = p.getX(a)); let o = Xc.getInstance(); o.a.fromBufferAttribute(m, n), o.b.fromBufferAttribute(m, r), o.c.fromBufferAttribute(m, a), i || (o.a.applyMatrix4(Rc), o.b.applyMatrix4(Rc), o.c.applyMatrix4(Rc)), Qc.push(o); } if (a.addConstraintEdge) { let e = n.getIntersectionEdges(g); if (e) for (let t of e) a.addConstraintEdge(t); a.triangulate(); } else { let e = n.intersectionSet.get(g); for (let t = 0, n = e.length; t < n; t++) { let n = e[t], r = S && S.has(n), o = 3 * n, s = o + 0, c = o + 1, l = o + 2; p && (s = p.getX(s), c = p.getX(c), l = p.getX(l)), Hc.a.fromBufferAttribute(m, s), Hc.b.fromBufferAttribute(m, c), Hc.c.fromBufferAttribute(m, l), i || (Hc.a.applyMatrix4(Rc), Hc.b.applyMatrix4(Rc), Hc.c.applyMatrix4(Rc)), a.splitByTriangle(Hc, r); } } let { triangles: C, triangleIndices: w = [], triangleConnectivity: T = [] } = a; for (let t = 0, n = o.length; t < n; t++) o[t].initInterpolatedAttributeData(e.geometry, zc, Bc, y, b, x); qc.clear(); for (let e = 0, t = C.length; e < t; e++) { if (qc.has(e)) continue; let t = C[e], n = i ? null : Y, a = null; t.getMidpoint(Jc); for (let e = 0, t = Qc.length; e < t; e++) { let t = Qc[e]; if (t.containsPoint(Jc)) { t.getNormal(Zc), a = Yc.dot(Zc) > 0 ? 2 : -2; break; } } a === null && (a = q(t, f, n)), Gc.length = 0, Kc.length = 0; for (let e = 0, t = r.length; e < t; e++) { let t = Fc(r[e], a, i); t !== 2 && (Gc.push(t), Kc.push(o[e])); } if (Kc.length !== 0) { let t = [e]; for (; t.length > 0;) { let e = t.pop(); if (qc.has(e)) continue; qc.add(e); let n = w[e], r = null, i = null, a = null; n && (r = n[0], i = n[1], a = n[2]); let o = C[e]; Vc.getBarycoord(o.a, Wc.a), Vc.getBarycoord(o.b, Wc.b), Vc.getBarycoord(o.c, Wc.c); for (let e = 0, t = Kc.length; e < t; e++) { let t = Kc[e], n = c !== (Gc[e] === 0); t.appendInterpolatedAttributeData(_, Wc.a, r, n), n ? (t.appendInterpolatedAttributeData(_, Wc.c, a, n), t.appendInterpolatedAttributeData(_, Wc.b, i, n)) : (t.appendInterpolatedAttributeData(_, Wc.b, i, n), t.appendInterpolatedAttributeData(_, Wc.c, a, n)); } } } } } return h.length; } function tl(e, t, n, r, i, a, o = 0) { Y.copy(t.matrixWorld).invert().multiply(e.matrixWorld), i ? zc.copy(Y) : zc.identity(); let s = zc.determinant() < 0; Bc.getNormalMatrix(zc).multiplyScalar(s ? -1 : 1); let c = t.geometry.boundsTree, l = e.geometry.groupIndices, u = e.geometry.index, d = e.geometry.attributes.position, f = [], p = e.geometry.halfEdges, m = new Set(n.ids), h = as(e.geometry); for (let t = 0; t < h && m.size !== h; t++) { if (m.has(t)) continue; m.add(t), f.push(t); let n = 3 * t, h = n + 0, g = n + 1, _ = n + 2; u && (h = u.getX(h), g = u.getX(g), _ = u.getX(_)), Uc.a.fromBufferAttribute(d, h), Uc.b.fromBufferAttribute(d, g), Uc.c.fromBufferAttribute(d, _), i && (Uc.a.applyMatrix4(Y), Uc.b.applyMatrix4(Y), Uc.c.applyMatrix4(Y)); let v = q(Uc, c, i ? null : Y); Gc.length = 0, Kc.length = 0; for (let e = 0, t = r.length; e < t; e++) { let t = Fc(r[e], v, i); t !== 2 && (Gc.push(t), Kc.push(a[e])); } for (; f.length > 0;) { let t = f.pop(); for (let e = 0; e < 3; e++) { let n = p.getSiblingTriangleIndex(t, e); n !== -1 && !m.has(n) && (f.push(n), m.add(n)); } if (Kc.length !== 0) { let n = 3 * t, r = n + 0, i = n + 1, a = n + 2; u && (r = u.getX(r), i = u.getX(i), a = u.getX(a)); let c = o === -1 ? 0 : l[t] + o; if (Uc.a.fromBufferAttribute(d, r), Uc.b.fromBufferAttribute(d, i), Uc.c.fromBufferAttribute(d, a), !ec(Uc)) for (let t = 0, n = Kc.length; t < n; t++) { let n = Kc[t], o = Gc[t] === 0 !== s; n.appendIndexFromGeometry(e.geometry, zc, Bc, c, r, o), o ? (n.appendIndexFromGeometry(e.geometry, zc, Bc, c, a, o), n.appendIndexFromGeometry(e.geometry, zc, Bc, c, i, o)) : (n.appendIndexFromGeometry(e.geometry, zc, Bc, c, i, o), n.appendIndexFromGeometry(e.geometry, zc, Bc, c, a, o)); } } } } } //#endregion //#region ../../node_modules/.pnpm/three-bvh-csg@0.0.18_three-_c2556f8e287a399f9745e40882493d3a/node_modules/three-bvh-csg/src/core/TypeBackedArray.js function nl(e) { return e = ~~e, e + 4 - e % 4; } var rl = class { constructor(e, t = 500) { this.expansionFactor = 1.5, this.type = e, this.length = 0, this.array = null, this.setSize(t); } setType(e) { if (e === this.type) return; if (this.length !== 0) throw Error("TypeBackedArray: Cannot change the type while there is used data in the buffer."); let t = this.array.buffer; this.array = new e(t), this.type = e; } setSize(e) { if (this.array && e === this.array.length) return; let t = this.type, n = new t(new (ns() ? SharedArrayBuffer : ArrayBuffer)(nl(e * t.BYTES_PER_ELEMENT))); this.array && n.set(this.array, 0), this.array = n; } expand() { let { array: e, expansionFactor: t } = this; this.setSize(e.length * t); } push(...e) { let { array: t, length: n } = this; n + e.length > t.length && (this.expand(), t = this.array); for (let r = 0, i = e.length; r < i; r++) t[n + r] = e[r]; this.length += e.length; } clear() { this.length = 0; } }, il = new W(), al = new W(), ol = new W(), sl = new W(), cl = new fe(), ll = new fe(), ul = new fe(), dl = new fe(); function fl(e, t, n, r, i, a = !1, o = !1) { return i.set(0, 0, 0, 0).addScaledVector(e, r.x).addScaledVector(t, r.y).addScaledVector(n, r.z), a && i.normalize(), o && i.multiplyScalar(-1), i; } function pl(e, t, n) { switch (t) { case 1: n.push(e.x); break; case 2: n.push(e.x, e.y); break; case 3: n.push(e.x, e.y, e.z); break; case 4: n.push(e.x, e.y, e.z, e.w); break; } } var ml = class extends rl { get count() { return this.length / this.itemSize; } constructor(...e) { super(...e), this.itemSize = 1, this.normalized = !1; } }, hl = class { constructor() { this.attributeData = {}, this.groupIndices = [], this.forwardIndexMap = /* @__PURE__ */ new Map(), this.invertedIndexMap = /* @__PURE__ */ new Map(), this.interpolatedFields = {}; } initFromGeometry(e, t) { this.clear(); let { attributeData: n } = this, r = e.attributes; for (let e = 0, i = t.length; e < i; e++) { let i = t[e], a = r[i], o = a.array.constructor; n[i] || (n[i] = new ml(o)), n[i].setType(o), n[i].itemSize = a.itemSize, n[i].normalized = a.normalized; } for (let e in n.attributes) t.includes(e) || n.delete(e); } initInterpolatedAttributeData(e, t, n, r, i, a) { let { attributeData: o, interpolatedFields: s } = this, { attributes: c } = e; for (let e in o) { let o = c[e]; if (!o) throw Error(`CSG Operations: Attribute ${e} not available on geometry.`); let l, u, d; if (e === "position" ? (l = al.fromBufferAttribute(o, r).applyMatrix4(t), u = ol.fromBufferAttribute(o, i).applyMatrix4(t), d = sl.fromBufferAttribute(o, a).applyMatrix4(t)) : e === "normal" ? (l = al.fromBufferAttribute(o, r).applyNormalMatrix(n), u = ol.fromBufferAttribute(o, i).applyNormalMatrix(n), d = sl.fromBufferAttribute(o, a).applyNormalMatrix(n)) : e === "tangent" ? (l = al.fromBufferAttribute(o, r).transformDirection(t), u = ol.fromBufferAttribute(o, i).transformDirection(t), d = sl.fromBufferAttribute(o, a).transformDirection(t)) : (l = ll.fromBufferAttribute(o, r), u = ul.fromBufferAttribute(o, i), d = dl.fromBufferAttribute(o, a)), !s[e]) s[e] = [ l.clone(), u.clone(), d.clone() ]; else { let t = s[e]; t[0].copy(l), t[1].copy(u), t[2].copy(d); } } } appendInterpolatedAttributeData(e, t, n = null, r = !1) { let { groupIndices: i, attributeData: a, interpolatedFields: o, forwardIndexMap: s, invertedIndexMap: c } = this; for (; i.length <= e;) i.push(new ml(Uint32Array)); let l = r ? c : s, u = i[e]; if (n !== null && l.has(n)) u.push(l.get(n)); else { l.set(n, a.position.count), u.push(a.position.count); for (let e in o) { let n = a[e], i = e === "normal" || e === "tangent", s = r && i, c = n.itemSize, [l, u, d] = o[e]; fl(l, u, d, t, cl, i, s), pl(cl, c, n); } } } appendIndexFromGeometry(e, t, n, r, i, a = !1) { let { groupIndices: o, attributeData: s, forwardIndexMap: c, invertedIndexMap: l } = this; for (; o.length <= r;) o.push(new ml(Uint32Array)); let u = a ? l : c, d = o[r]; if (i !== null && u.has(i)) d.push(u.get(i)); else { u.set(i, s.position.count), d.push(s.position.count); let { attributes: r } = e; for (let e in s) { let o = s[e], c = r[e]; if (!c) throw Error(`CSG Operations: Attribute ${e} not available on geometry.`); let l = c.itemSize; e === "position" ? (il.fromBufferAttribute(c, i).applyMatrix4(t), o.push(il.x, il.y, il.z)) : e === "normal" ? (il.fromBufferAttribute(c, i).applyNormalMatrix(n), a && il.multiplyScalar(-1), o.push(il.x, il.y, il.z)) : e === "tangent" ? (il.fromBufferAttribute(c, i).transformDirection(t), a && il.multiplyScalar(-1), o.push(il.x, il.y, il.z)) : (cl.fromBufferAttribute(c, i), pl(cl, l, o)); } } } buildGeometry(e, t) { let n = !1, { groupIndices: r, attributeData: i } = this, { attributes: a, index: o } = e; for (let t in i) { let r = i[t], { type: o, itemSize: s, normalized: c, length: l, count: u } = r, d = r.array.buffer, f = a[t]; (!f || f.count < u || f.array.type !== o) && (f = new j(new o(l), s, c), e.setAttribute(t, f), n = !0), f.array.set(new o(d, 0, l), 0), f.needsUpdate = !0; } let s = r.reduce((e, t) => t.count + e, 0); (!e.index || o.count < s || o.array.type !== Uint32Array) && (e.setIndex(new j(new Uint32Array(s), 1)), n = !0), e.clearGroups(); let c = 0; for (let n = 0, i = Math.min(t.length, r.length); n < i; n++) { let { index: i, materialIndex: a } = t[n], { count: o } = r[i], s = r[i].array.buffer; o !== 0 && (e.index.array.set(new Uint32Array(s, 0, o), c), e.addGroup(c, o, a), c += o); } e.setDrawRange(0, c), e.boundsTree = null, e.boundingBox = null, e.boundingSphere = null, n && e.dispose(); } clearIndexMap() { this.forwardIndexMap.clear(), this.invertedIndexMap.clear(); } clear() { let { groupIndices: e, attributeData: t } = this; this.interpolatedFields = {}; for (let e in t) t[e].clear(); e.forEach((e) => { e.clear(); }), this.clearIndexMap(); } }; //#endregion //#region ../../node_modules/.pnpm/three-bvh-csg@0.0.18_three-_c2556f8e287a399f9745e40882493d3a/node_modules/three-bvh-csg/src/core/operations/GeometryUtils.js function gl(e, t) { for (let n in e.attributes) t.includes(n) || (e.deleteAttribute(n), e.dispose()); return e; } function _l(e, t) { let n = []; for (let r = 0, i = e.length; r < i; r++) { let i = e[r], a = t[i.materialIndex]; n.push({ ...i, materialIndex: t.indexOf(a) }); } return n; } function vl(e, t) { let n = [], r = /* @__PURE__ */ new Map(); for (let i = 0, a = e.length; i < a; i++) { let a = e[i]; r.has(a.materialIndex) || (r.set(a.materialIndex, n.length), n.push(t[a.materialIndex])), a.materialIndex = r.get(a.materialIndex); } return n; } function yl(e) { for (let t = 0; t < e.length - 1; t++) { let n = e[t], r = e[t + 1]; if (n.materialIndex === r.materialIndex) { let i = n.start, a = r.start + r.count; r.start = i, r.count = a - i, e.splice(t, 1), t--; } } } function bl(e, t) { let n = t; return Array.isArray(t) || (n = [], e.forEach((e) => { n[e.materialIndex] = t; })), n; } //#endregion //#region ../../node_modules/.pnpm/three-bvh-csg@0.0.18_three-_c2556f8e287a399f9745e40882493d3a/node_modules/three-bvh-csg/src/core/Evaluator.js var xl = class { get useCDTClipping() { return this.triangleSplitter instanceof Ys; } set useCDTClipping(e) { e !== this.useCDTClipping && (this.triangleSplitter = e ? new Ys() : new uc()); } constructor() { this.triangleSplitter = new uc(), this.geometryBuilders = [], this.attributes = [ "position", "uv", "normal" ], this.useGroups = !0, this.consolidateGroups = !0, this.removeUnusedMaterials = !0, this.debug = new J(); } getGroupRanges(e) { return !this.useGroups || e.groups.length === 0 ? [{ start: 0, count: Infinity, materialIndex: 0 }] : e.groups.map((e) => ({ ...e })); } evaluate(e, t, n, r = new Ts()) { let i = !0; if (Array.isArray(n) || (n = [n]), Array.isArray(r) || (r = [r], i = !1), r.length !== n.length) throw Error("Evaluator: operations and target array passed as different sizes."); e.prepareGeometry(), t.prepareGeometry(); let { triangleSplitter: a, geometryBuilders: o, attributes: s, useGroups: c, consolidateGroups: l, removeUnusedMaterials: u, debug: d } = this; for (; o.length < r.length;) o.push(new hl()); r.forEach((t, n) => { o[n].initFromGeometry(e.geometry, s), gl(t.geometry, s); }), d.init(), $c(e, t, n, a, o, { useGroups: c }), d.complete(); let f = this.getGroupRanges(e.geometry), p = bl(f, e.material), m = this.getGroupRanges(t.geometry), h = bl(m, t.material); m.forEach((e) => e.materialIndex += p.length); let g = [...p, ...h], _ = [...f, ...m].map((e, t) => ({ ...e, index: t })); return c ? c && l && (_ = _l(_, g), _.sort((e, t) => e.materialIndex - t.materialIndex)) : _ = [{ start: 0, count: Infinity, index: 0, materialIndex: 0 }], r.forEach((t, n) => { let r = t.geometry; o[n].buildGeometry(r, _), e.matrixWorld.decompose(t.position, t.quaternion, t.scale), t.updateMatrix(), t.matrixWorld.copy(e.matrixWorld), c ? (t.material = g, l && yl(r.groups), u && (t.material = vl(r.groups, g))) : t.material = g[0]; }), i ? r : r[0]; } evaluateHierarchy(e, t = new Ts()) { e.updateMatrixWorld(!0); let n = (e, t) => { let r = e.children; for (let e = 0, i = r.length; e < i; e++) { let i = r[e]; i.isOperationGroup ? n(i, t) : t(i); } }, r = (e) => { let t = e.children, i = !1; for (let e = 0, n = t.length; e < n; e++) { let n = t[e]; i = r(n) || i; } let a = e.isDirty(); if (a && e.markUpdated(), i && !e.isOperationGroup) { let t; return n(e, (n) => { t = t ? this.evaluate(t, n, n.operation) : this.evaluate(e, n, n.operation); }), e._cachedGeometry = t.geometry, e._cachedMaterials = t.material, !0; } else return i || a; }; return r(e), t.geometry = e._cachedGeometry, t.material = e._cachedMaterials, t; } reset() { this.triangleSplitter.reset(); } }, Sl = new class { viewers = /* @__PURE__ */ new Set(); defaultViewer = null; register(e, t = !1) { this.viewers.add(e), (t || !this.defaultViewer) && (this.defaultViewer = e); } unregister(e) { this.viewers.delete(e), this.defaultViewer === e && (this.defaultViewer = this.viewers.values().next().value ?? null); } getDefault() { if (!this.defaultViewer) throw Error("No default viewer"); return this.defaultViewer; } setDefault(e) { if (!this.viewers.has(e)) throw Error("Viewer not registered"); this.defaultViewer = e; } getAll() { return [...this.viewers]; } }(), Cl = { ADDITION: 0, SUBTRACTION: 1, REVERSE_SUBTRACTION: 2, INTERSECTION: 3, DIFFERENCE: 4, HOLLOW_SUBTRACTION: 5, HOLLOW_INTERSECTION: 6 }, wl = class { evaluator; brushCache = /* @__PURE__ */ new WeakMap(); _tempWorldPosition = new e.Vector3(); _tempWorldQuaternion = new e.Quaternion(); _tempWorldScale = new e.Vector3(); helperGroup = new e.Group(); constructor() { this.evaluator = new xl(), this.evaluator.attributes = [ "position", "normal", "uv" ], this.evaluator.useGroups = !1; } _debugMode = !1; get debugMode() { return this._debugMode; } set debugMode(e) { if (this._debugMode = e, e) { this.helperGroup.parent || Sl.defaultViewer?.scene.add(this.helperGroup); return; } this.helperGroup.clear(), this.helperGroup.parent && this.helperGroup.parent.remove(this.helperGroup); } clearBrushCache(e) { e ? this.brushCache.delete(e) : this.brushCache = /* @__PURE__ */ new WeakMap(); } union(e, t) { return this.evaluate(e, t, 0); } subtract(e, t) { return this.evaluate(e, t, 1); } reverseSubtract(e, t) { return this.evaluate(e, t, 2); } intersection(e, t) { return this.evaluate(e, t, 3); } difference(e, t) { return this.evaluate(e, t, 4); } hollowSubtract(e, t) { return this.evaluate(e, t, 5); } hollowIntersection(e, t) { return this.evaluate(e, t, 6); } operate(e, t, n) { return this.evaluate(e, t, n); } subtractMultiple(t, n) { let r = t.geometry; for (let i of n) { let n = new e.Mesh(r, t.material); n.position.copy(t.position), n.rotation.copy(t.rotation), n.scale.copy(t.scale); let a = this.subtract(n, i); r !== t.geometry && r.dispose(), r = a; } return r; } setAttributes(e) { this.evaluator.attributes = e; } setUseGroups(e) { this.evaluator.useGroups = e; } meshToBrush(e) { let t = this.brushCache.get(e); if (t ? t.geometry !== e.geometry && (t.geometry = e.geometry) : (t = new Ts(e.geometry, e.material), this.brushCache.set(e, t)), e.updateMatrixWorld(!0), e.getWorldPosition(this._tempWorldPosition), e.getWorldQuaternion(this._tempWorldQuaternion), e.getWorldScale(this._tempWorldScale), t.position.copy(this._tempWorldPosition), t.quaternion.copy(this._tempWorldQuaternion), t.scale.copy(this._tempWorldScale), t.updateMatrixWorld(!0), this.debugMode && t.geometry.boundsTree) { let e = new Uo(t, 10); e.displayEdges = !0, e.displayParents = !0, this.helperGroup.add(e); } return t; } evaluate(e, t, n) { let r = this.meshToBrush(e), i = this.meshToBrush(t); return this.debugMode, this.evaluator.evaluate(r, i, n).geometry.clone(); } }, Tl = class extends e.Line { plane; width; height; topRotateHandle = null; rightRotateHandle = null; textureBasePath = "/"; constructor(t, n = 1, r = 1, i = 16776960) { let a = i, o = n / 2, s = r / 2, c = [ o, -s, 0, -o, s, 0, -o, -s, 0, o, s, 0, -o, s, 0, -o, -s, 0, o, -s, 0, o, s, 0 ], l = new e.BufferGeometry(); l.setAttribute("position", new e.Float32BufferAttribute(c, 3)), l.computeBoundingSphere(), super(l, new e.LineBasicMaterial({ color: a, toneMapped: !1 })), this.type = "ClippingHelper", this.plane = t, this.width = n, this.height = r; let u = [ o, s, 0, -o, s, 0, -o, -s, 0, o, s, 0, -o, -s, 0, o, -s, 0 ], d = new e.BufferGeometry(); d.setAttribute("position", new e.Float32BufferAttribute(u, 3)), d.computeBoundingSphere(); let f = new e.Mesh(d, new e.MeshBasicMaterial({ color: a, opacity: .2, transparent: !0, depthWrite: !1, toneMapped: !1 })); this.add(f); } showRotateHandles(e) { if (e) { if (!this.topRotateHandle) { this.topRotateHandle = this.createHandleSprite("texture/clipping/rotate_top.svg"); let e = this.height / 2 + this.height * .1, t = Math.min(this.width, this.height) * .15; this.topRotateHandle.position.set(0, e, 0), this.topRotateHandle.scale.setScalar(t), this.topRotateHandle.userData.rotateAxis = "x", this.add(this.topRotateHandle); } if (!this.rightRotateHandle) { this.rightRotateHandle = this.createHandleSprite("texture/clipping/rotate_right.svg"); let e = this.width / 2 + this.width * .1, t = Math.min(this.width, this.height) * .15; this.rightRotateHandle.position.set(e, 0, 0), this.rightRotateHandle.scale.setScalar(t), this.rightRotateHandle.userData.rotateAxis = "y", this.add(this.rightRotateHandle); } this.topRotateHandle.visible = !0, this.rightRotateHandle.visible = !0; } else this.topRotateHandle && (this.topRotateHandle.visible = !1), this.rightRotateHandle && (this.rightRotateHandle.visible = !1); } createHandleSprite(t) { let n = new e.TextureLoader(), r = this.textureBasePath.replace(/\/$/, "") + "/" + t, i = n.load(r), a = new e.SpriteMaterial({ map: i, depthTest: !1, depthWrite: !1 }), o = new e.Sprite(a); return o.renderOrder = 10, o; } dispose() { if (this.geometry.dispose(), this.material.dispose(), this.children[0]) { let e = this.children[0]; e.geometry.dispose(), e.material.dispose(); } for (let e of [this.topRotateHandle, this.rightRotateHandle]) if (e) { let t = e.material; t.map?.dispose(), t.dispose(); } this.topRotateHandle = null, this.rightRotateHandle = null; } }, El = class { plane; helper; transformControl; emitter = new Kt(); viewer; options; lockedTranslateAxis; rotateHandlesEnabled = !1; activeRotateHandle = null; dragStartScreenPos = { x: 0, y: 0 }; raycaster = new e.Raycaster(); pointer = new e.Vector2(); onPointerDownBound; onPointerMoveBound; onPointerUpBound; constructor(t, n) { this.viewer = t, this.options = n, this.lockedTranslateAxis = this.resolveLockedTranslateAxis(n.normal), this.plane = new e.Plane(n.normal.clone().normalize(), n.constant ?? 0), this.onPointerDownBound = this.onHandlePointerDown.bind(this), this.onPointerMoveBound = this.onHandlePointerMove.bind(this), this.onPointerUpBound = this.onHandlePointerUp.bind(this), n.enableTransformControls !== !1 && this.initTransformControl(); } updatePlaneFromHelper() { if (!this.helper) return; this.helper.updateMatrixWorld(!0); let t = new e.Vector3(0, 0, 1).transformDirection(this.helper.matrixWorld).normalize(); this.plane.normal.copy(t); let n = new e.Vector3(); this.helper.getWorldPosition(n), this.plane.constant = -n.dot(t); } createHelper(t, n, r) { this.helper && (this.helper.parent && this.helper.parent.remove(this.helper), this.helper.dispose()); let i = this.options.color ?? new e.Color(16755200), a = new Tl(this.plane, n, n, i); a.textureBasePath = "/", a.position.copy(t); let o = this.plane.normal.clone().normalize(), s = new e.Quaternion().setFromUnitVectors(new e.Vector3(0, 0, 1), o); a.quaternion.copy(s), r.add(a), this.helper = a, this.rotateHandlesEnabled && this.helper.showRotateHandles(!0), this.transformControl && (this.transformControl.attach(a), this.applyTranslateAxisConstraint(this.transformControl)); } detach() { this.transformControl && this.transformControl.detach(), this.helper = void 0; } setTransformMode(e) { this.transformControl && (this.transformControl.setMode(e), this.applyTranslateAxisConstraint(this.transformControl)); } setTransformSpace(e) { this.transformControl && (this.transformControl.setSpace(e), this.applyTranslateAxisConstraint(this.transformControl)); } createDebugPanel(t = "Clipping Plane") { let n = this.viewer.inspector.createParameters(t), r = { transformMode: this.options.transformMode ?? "translate", x: 0, y: 0, z: 0, rotX: 0, rotY: 0, rotZ: 0 }, i = () => { this.helper && (r.x = this.helper.position.x, r.y = this.helper.position.y, r.z = this.helper.position.z, r.rotX = e.MathUtils.radToDeg(this.helper.rotation.x), r.rotY = e.MathUtils.radToDeg(this.helper.rotation.y), r.rotZ = e.MathUtils.radToDeg(this.helper.rotation.z)); }, a = () => { if (!this.helper) return; this.helper.position.set(r.x, r.y, r.z), this.helper.rotation.set(e.MathUtils.degToRad(r.rotX), e.MathUtils.degToRad(r.rotY), e.MathUtils.degToRad(r.rotZ)), this.updatePlaneFromHelper(); let t = new e.Vector3(); this.helper.getWorldPosition(t), this.emitter.emit("move", { position: t, constant: this.plane.constant, normal: this.plane.normal.clone() }); }; this.transformControl && this.transformControl.addEventListener("objectChange", i), n.add(r, "transformMode", { 移动: "translate", 旋转: "rotate" }).name("操作模式").onChange((e) => { this.setTransformMode(e); }); let o = n.addFolder("平移"); o.add(r, "x", -20, 20, .01).name("X").onChange(a), o.add(r, "y", -20, 20, .01).name("Y").onChange(a), o.add(r, "z", -20, 20, .01).name("Z").onChange(a); let s = n.addFolder("旋转 (°)"); s.add(r, "rotX", -180, 180, .1).name("X").onChange(a), s.add(r, "rotY", -180, 180, .1).name("Y").onChange(a), s.add(r, "rotZ", -180, 180, .1).name("Z").onChange(a), i(); } showRotateHandles(e) { this.rotateHandlesEnabled = e, this.helper && this.helper.showRotateHandles(e); let t = this.viewer.renderer?.domElement; t && (e ? t.addEventListener("pointerdown", this.onPointerDownBound) : (t.removeEventListener("pointerdown", this.onPointerDownBound), t.removeEventListener("pointermove", this.onPointerMoveBound), t.removeEventListener("pointerup", this.onPointerUpBound), this.activeRotateHandle = null)); } dispose() { this.showRotateHandles(!1), this.detach(), this.helper &&= (this.helper.parent && this.helper.parent.remove(this.helper), this.helper.dispose(), void 0), this.transformControl &&= (this.viewer.sceneHelpers.remove(this.transformControl.getHelper()), this.transformControl.dispose(), void 0), this.emitter.clearListeners(); } initTransformControl() { let t = this.viewer.renderer?.domElement; if (!t) return; let n = new pe(this.viewer.camera, t); n.setMode(this.options.transformMode ?? "translate"), n.setSpace("world"), this.applyTranslateAxisConstraint(n), n.addEventListener("objectChange", () => { if (this.helper) { this.updatePlaneFromHelper(); let t = new e.Vector3(); this.helper.getWorldPosition(t), this.emitter.emit("move", { position: t, constant: this.plane.constant, normal: this.plane.normal.clone() }); } }), n.addEventListener("mouseDown", () => { this.viewer.cameraControls && (this.viewer.cameraControls.enabled = !1); }), n.addEventListener("mouseUp", () => { this.viewer.cameraControls && (this.viewer.cameraControls.enabled = !0); }), this.viewer.sceneHelpers.add(n.getHelper()), this.transformControl = n; } resolveLockedTranslateAxis(e) { let t = Math.abs(e.x), n = Math.abs(e.y), r = Math.abs(e.z); return t >= n && t >= r ? "x" : n >= t && n >= r ? "y" : "z"; } applyTranslateAxisConstraint(e) { if (e.mode !== "translate") { e.showX = !0, e.showY = !0, e.showZ = !0; return; } if (e.space === "local") { e.showX = !0, e.showY = !0, e.showZ = !0; return; } e.showX = this.lockedTranslateAxis === "x", e.showY = this.lockedTranslateAxis === "y", e.showZ = this.lockedTranslateAxis === "z"; } toNDC(e) { let t = this.viewer.renderer?.domElement; if (!t) return; let n = t.getBoundingClientRect(); this.pointer.x = (e.clientX - n.left) / n.width * 2 - 1, this.pointer.y = -((e.clientY - n.top) / n.height) * 2 + 1; } getVisibleHandles() { if (!this.helper) return []; let e = []; return this.helper.topRotateHandle?.visible && e.push(this.helper.topRotateHandle), this.helper.rightRotateHandle?.visible && e.push(this.helper.rightRotateHandle), e; } onHandlePointerDown(e) { if (!this.helper) return; this.toNDC(e), this.raycaster.setFromCamera(this.pointer, this.viewer.camera); let t = this.getVisibleHandles(), n = this.raycaster.intersectObjects(t, !1); if (n.length === 0) return; this.activeRotateHandle = n[0].object, this.dragStartScreenPos = { x: e.clientX, y: e.clientY }, this.viewer.cameraControls && (this.viewer.cameraControls.enabled = !1), this.transformControl && (this.transformControl.enabled = !1); let r = this.viewer.renderer?.domElement; r && (r.addEventListener("pointermove", this.onPointerMoveBound), r.addEventListener("pointerup", this.onPointerUpBound)), e.stopPropagation(); } onHandlePointerMove(t) { if (!this.activeRotateHandle || !this.helper) return; let n = t.clientX - this.dragStartScreenPos.x, r = t.clientY - this.dragStartScreenPos.y; this.dragStartScreenPos = { x: t.clientX, y: t.clientY }; let i = this.activeRotateHandle.userData.rotateAxis === "x" ? new e.Vector3(1, 0, 0) : new e.Vector3(0, 1, 0), a = i.clone().transformDirection(this.helper.matrixWorld).normalize().clone().transformDirection(this.viewer.camera.matrixWorldInverse).normalize(), o = new e.Vector3(); this.helper.getWorldPosition(o); let s = new e.Vector3(); this.activeRotateHandle.getWorldPosition(s); let c = new e.Vector3().subVectors(s, o).normalize().clone().transformDirection(this.viewer.camera.matrixWorldInverse).normalize(), l = n, u = -r, d = l * a.y - u * a.x, f = -l * c.y + u * c.x, p = Math.abs(a.z), m = Math.sqrt(1 - p * p), h = a.z >= 0 ? 1 : -1, g = (d * m + f * p * h) * .005; this.rotateHelperLocal(i, g), this.updatePlaneFromHelper(); let _ = new e.Vector3(); this.helper.getWorldPosition(_), this.emitter.emit("move", { position: _, constant: this.plane.constant, normal: this.plane.normal.clone() }); } rotateHelperLocal(t, n) { if (!this.helper) return; let r = t.clone().transformDirection(this.helper.matrixWorld).normalize(), i = new e.Quaternion().setFromAxisAngle(r, n); this.helper.quaternion.premultiply(i); } onHandlePointerUp(e) { this.activeRotateHandle = null, this.viewer.cameraControls.enabled = !0, this.transformControl && (this.transformControl.enabled = !0); let t = this.viewer.renderer?.domElement; t && (t.removeEventListener("pointermove", this.onPointerMoveBound), t.removeEventListener("pointerup", this.onPointerUpBound)); } }, Dl = class t { static panelCounter = 0; emitter = new Kt(); isClipping = !1; clippingPlanes = []; clippingPlaneHelpers = []; clippingGroup = new e.ClippingGroup(); scene; viewer; planeHelperGroup = new e.Group(); planes = /* @__PURE__ */ new Map(); constructor(e) { this.scene = e.scene, this.viewer = e, this.clippingGroup.clippingPlanes = this.clippingPlanes, this.clippingGroup.name = "globalClippingGroup", zr.setSceneTreeExclude(this.clippingGroup), this.scene.add(this.clippingGroup), zr.setExcludeAll(this.planeHelperGroup); } addDefaultPlanes() { return [ this.addPlane("x", { normal: new e.Vector3(1, 0, 0), color: new e.Color(16711680) }), this.addPlane("y", { normal: new e.Vector3(0, 1, 0), color: new e.Color(65280) }), this.addPlane("z", { normal: new e.Vector3(0, 0, 1), color: new e.Color(255) }) ]; } addPlane(e, t) { this.planes.has(e) && this.removePlane(e); let n = new El(this.viewer, t); return this.planes.set(e, n), this.clippingPlanes.push(n.plane), this.clippingGroup.clippingPlanes = this.clippingPlanes, n; } removePlane(e) { let t = this.planes.get(e); if (!t) return; let n = this.clippingPlanes.indexOf(t.plane); n !== -1 && this.clippingPlanes.splice(n, 1), this.clippingGroup.clippingPlanes = this.clippingPlanes, t.dispose(), this.planes.delete(e); } getPlane(e) { return this.planes.get(e); } autoPlanePosition(t = 2) { if (this.planes.size === 0) throw Error("[ClippingManager] autoPlanePosition: 没有剖切面,请先调用 addDefaultPlanes()"); let n = this.computeBoundingBox(); n.isEmpty() && n.setFromCenterAndSize(new e.Vector3(0, 0, 0), new e.Vector3(4, 4, 4)); let r = new e.Vector3(); n.getCenter(r); let i = new e.Vector3(); n.getSize(i); let a = Math.max(i.x, i.y, i.z, 5); this.planeHelperGroup.parent && this.planeHelperGroup.parent.remove(this.planeHelperGroup), this.planeHelperGroup.clear(); let o = { x: new e.Vector3(n.min.x - t, r.y, r.z), y: new e.Vector3(r.x, n.min.y - t, r.z), z: new e.Vector3(r.x, r.y, n.min.z - t) }; this.planes.forEach((e, t) => { let n = o[t], r; n ? (r = n.clone(), e.plane.constant = -r.dot(e.plane.normal.clone().normalize())) : r = e.plane.normal.clone().normalize().multiplyScalar(-e.plane.constant), e.createHelper(r, a, this.planeHelperGroup), e.emitter.emit("move", { position: r, constant: e.plane.constant, normal: e.plane.normal.clone() }); }), this.scene.add(this.planeHelperGroup); } addClippingObjectsByUuid(e) { if (!e || e.length === 0) return; let t = []; this.scene.traverse((n) => { e.includes(n.uuid) && (n.parent && n.parent.name === "localClippingGroup" ? t.includes(n.parent) || t.push(n.parent) : Reflect.get(n, "customOpacity") || t.push(n)); }), this.addClippingObjects(t); } addClippingObjects(e) { !e || e.length === 0 || e.forEach((e) => { Reflect.get(e, "customOpacity") || this.addClippingToObject(e); }); } addClippingToObject(t) { if (t.parent === this.clippingGroup) return; let n = new e.Vector3(), r = new e.Quaternion(), i = new e.Vector3(); t.matrixWorld.decompose(n, r, i), Reflect.set(t, "__position", t.position.clone()), Reflect.set(t, "__quaternion", t.quaternion.clone()), Reflect.set(t, "__scale", t.scale.clone()); let a = t.parent; a && (a.remove(t), Reflect.set(t, "__parent", a)), this.clippingGroup.add(t), t.position.copy(n), t.quaternion.copy(r), t.scale.copy(i); } removeClippingObjectsByUuid(e) { if (!(!e || e.length === 0)) for (let t = this.clippingGroup.children.length - 1; t >= 0; t--) { let n = this.clippingGroup.children[t]; if (!n || !e.includes(n.uuid)) continue; this.clippingGroup.remove(n); let r = Reflect.get(n, "__parent"); r && (n.position.copy(Reflect.get(n, "__position")), n.quaternion.copy(Reflect.get(n, "__quaternion")), n.scale.copy(Reflect.get(n, "__scale")), r.add(n), Reflect.set(n, "__parent", null)); } } clearClippingGroups() { for (let e = this.clippingGroup.children.length - 1; e >= 0; e--) { let t = this.clippingGroup.children[e]; this.clippingGroup.remove(t); let n = Reflect.get(t, "__parent"); n && (t.position.copy(Reflect.get(t, "__position")), t.quaternion.copy(Reflect.get(t, "__quaternion")), t.scale.copy(Reflect.get(t, "__scale")), n.add(t), Reflect.set(t, "__parent", null)); } this.planeHelperGroup.parent && this.planeHelperGroup.parent.remove(this.planeHelperGroup), this.planeHelperGroup.clear(), this.planes.forEach((e) => e.detach()); } clearClippingPlanes() { this.clippingPlanes = []; } hideClippingPlanes() { this.clippingPlaneHelpers.forEach((e) => { e.parent && e.parent.remove(e); }), this.clippingPlaneHelpers = []; } computeBoundingBox() { let t = new e.Box3(); return this.clippingGroup.updateMatrixWorld(!0), this.clippingGroup.traverse((n) => { n instanceof e.Mesh && n.geometry && (n.geometry.boundingBox || n.geometry.computeBoundingBox(), t.expandByObject(n)); }), t; } createDebugPanel(e = []) { let n = ++t.panelCounter, r = this.viewer.inspector.createParameters(`Clipping ${n}`), i = { started: !1, offset: 2 }, a = () => { i.started && (e.length > 0 && this.addClippingObjects(e), this.autoPlanePosition(i.offset)); }; r.add(i, "started").name("开始剖切").onChange((e) => { e ? a() : (this.planeHelperGroup.parent && this.planeHelperGroup.parent.remove(this.planeHelperGroup), this.planeHelperGroup.clear(), this.planes.forEach((e) => e.detach())); }), r.add(i, "offset", -10, 10, .01).name("剖切偏移").onChange((e) => { i.offset = e, a(); }), this.planes.forEach((e, t) => { r.add({ transformMode: "translate" }, "transformMode", { 移动: "translate", 旋转: "rotate" }).name(`${t} 操作模式`).onChange((t) => { e.setTransformMode(t); }); }); } startClipping() { this.isClipping = !0, this.emitter.emit("clippingStart"); } stopClipping() { this.isClipping = !1, this.emitter.emit("clippingEnd"); } dispose() { this.clearClippingGroups(), this.clearClippingPlanes(), this.hideClippingPlanes(), this.planes.forEach((e) => e.dispose()), this.planes.clear(); } }, Ol = class { scene; camera; outlinePass = null; selectedObjects = []; edgeStrength = ze(5); edgeGlow = ze(0); edgeThickness = ze(3); pulsePeriod = ze(0); visibleEdgeColor = ze(new e.Color(16777215)); hiddenEdgeColor = ze(new e.Color(5125686)); constructor(e, t) { this.scene = e, this.camera = t, this.init(); } init() { this.outlinePass = Ge(this.scene, this.camera, { selectedObjects: this.selectedObjects, edgeGlow: this.edgeGlow, edgeThickness: this.edgeThickness }); } updateCamera(e) { this.camera = e, this.init(); } getOutputNode(e) { if (!this.outlinePass) return e; let { visibleEdge: t, hiddenEdge: n } = this.outlinePass, r = ke(Re.div(this.pulsePeriod).mul(2)).mul(.5).add(.5), i = t.mul(this.visibleEdgeColor).add(n.mul(this.hiddenEdgeColor)).mul(this.edgeStrength); return this.pulsePeriod.greaterThan(0).select(i.mul(r), i).add(e); } addSelectedObject(e) { this.selectedObjects.includes(e) || (this.selectedObjects.push(e), this.updateSelectedObjects()); } removeSelectedObject(e) { let t = this.selectedObjects.indexOf(e); t > -1 && (this.selectedObjects.splice(t, 1), this.updateSelectedObjects()); } clearSelectedObjects() { this.selectedObjects = [], this.updateSelectedObjects(); } updateSelectedObjects() { this.outlinePass && (this.outlinePass.selectedObjects = this.selectedObjects); } setEdgeStrength(e) { this.edgeStrength.value = e; } setEdgeGlow(e) { this.edgeGlow.value = e; } setEdgeThickness(e) { this.edgeThickness.value = e; } setPulsePeriod(e) { this.pulsePeriod.value = e; } setVisibleEdgeColor(e) { this.visibleEdgeColor.value = e; } setHiddenEdgeColor(e) { this.hiddenEdgeColor.value = e; } getSelectedObjects() { return this.selectedObjects; } }, kl = class { bloomPass = null; highlightedObjects = /* @__PURE__ */ new Map(); constructor() { this.init(); } init() {} getOutputNode(e) { return this.bloomPass ||= Ke(e).toInspector("Bloom"), this.bloomPass; } setThreshold(e) { this.bloomPass && (this.bloomPass.threshold.value = e); } setStrength(e) { this.bloomPass && (this.bloomPass.strength.value = e); } setRadius(e) { this.bloomPass && (this.bloomPass.radius.value = e); } addHighlightedObject(t, n = new e.Color(0, 1, 0)) { if (!this.highlightedObjects.has(t) && "material" in t) { let e = t.material; if (e) if (Array.isArray(e)) { let r = []; e.forEach((e) => { e && e.emissive && (r.push(e.emissive.clone()), e.emissive.copy(n), e.emissiveIntensity = 1); }), this.highlightedObjects.set(t, r); } else e.emissive && (e.emissive.copy(n), e.emissiveIntensity = 1, this.highlightedObjects.set(t, e.emissive.clone()), e.emissive.copy(n)); } } removeHighlightedObject(e) { if (this.highlightedObjects.has(e) && "material" in e) { let t = e.material; if (t) { let n = this.highlightedObjects.get(e); n && (Array.isArray(t) && Array.isArray(n) ? t.forEach((e, t) => { e && e.emissive && n[t] && e.emissive.copy(n[t]); }) : !Array.isArray(t) && t.emissive && !Array.isArray(n) && t.emissive.copy(n)); } this.highlightedObjects.delete(e); } } clearHighlightedObjects() { this.highlightedObjects.forEach((e, t) => { if ("material" in t) { let n = t.material; n && (Array.isArray(n) && Array.isArray(e) ? n.forEach((t, n) => { t && t.emissive && e[n] && t.emissive.copy(e[n]); }) : !Array.isArray(n) && n.emissive && !Array.isArray(e) && n.emissive.copy(e)); } }), this.highlightedObjects.clear(); } getHighlightedObjects() { return Array.from(this.highlightedObjects.keys()); } isObjectHighlighted(e) { return this.highlightedObjects.has(e); } }, Al = /* @__PURE__ */ function(e) { return e.OBJECT_SELECTED = "objectSelected", e.OBJECT_UNSELECTED = "objectUnselected", e; }({}), jl = class { renderer; scene; sceneHelpers; outlinePass; bloomPass; enableOutline = !1; enableBloom = !1; perspectiveRenderPipeline = null; orthographicRenderPipeline = null; viewer; constructor(e) { this.viewer = e, this.renderer = e.renderer, this.scene = e.scene, this.sceneHelpers = e.sceneHelpers, this.outlinePass = new Ol(e.scene, e.camera), this.bloomPass = new kl(), this.init(), e.emitter.on(Yt.CAMERA_TYPE_CHANGED, () => { this.updateCamera(); }); } get renderPipeline() { return this.viewer.currentCameraType === "perspective" ? this.perspectiveRenderPipeline : this.orthographicRenderPipeline; } init() { this.updateRenderPipeline(); } updateCamera() {} updateRenderPipeline() { this.perspectiveRenderPipeline = this.createRenderPipeline(this.viewer.perspectiveCamera), this.orthographicRenderPipeline = this.createRenderPipeline(this.viewer.orthographicCamera); } render() { this.renderPipeline && this.renderPipeline.render(); } addSelectedObject(e) { this.outlinePass.addSelectedObject(e); } removeSelectedObject(e) { this.outlinePass.removeSelectedObject(e); } clearSelectedObjects() { this.outlinePass.clearSelectedObjects(); } setEdgeStrength(e) { this.outlinePass.setEdgeStrength(e); } setEdgeGlow(e) { this.outlinePass.setEdgeGlow(e); } setEdgeThickness(e) { this.outlinePass.setEdgeThickness(e); } setPulsePeriod(e) { this.outlinePass.setPulsePeriod(e); } setVisibleEdgeColor(e) { this.outlinePass.setVisibleEdgeColor(e); } setHiddenEdgeColor(e) { this.outlinePass.setHiddenEdgeColor(e); } setBloomThreshold(e) { this.bloomPass.setThreshold(e); } setBloomStrength(e) { this.bloomPass.setStrength(e); } setBloomRadius(e) { this.bloomPass.setRadius(e); } setOutlineEnabled(e) { this.enableOutline = e, this.updateRenderPipeline(); } setBloomEnabled(e) { this.enableBloom = e, this.updateRenderPipeline(); } getSelectedObjects() { return this.outlinePass.getSelectedObjects(); } isObjectInOutlineList(e) { return this.outlinePass.getSelectedObjects().includes(e); } addHighlightedObject(t, n = new e.Color(0, 1, 0)) { this.bloomPass.addHighlightedObject(t, n); } removeHighlightedObject(e) { this.bloomPass.removeHighlightedObject(e); } clearHighlightedObjects() { this.bloomPass.clearHighlightedObjects(); } isObjectInBloomList(e) { return this.bloomPass.isObjectHighlighted(e); } getOutlinePass() { return this.outlinePass; } getBloomPass() { return this.bloomPass; } dispose() { this.renderPipeline &&= null; } createRenderPipeline(t) { let n = je(this.scene, t); n.setMRT(Oe({ output: Ae })); let r = n.getTextureNode("output").toInspector("color"); this.enableBloom, this.enableOutline; let i = je(this.sceneHelpers, t).getTextureNode("output").toInspector("sceneHelpersColor"); r = We(r.rgb.add(i.rgb), r.a.add(i.a)); let a = new e.RenderPipeline(this.renderer); return a.outputNode = r, a; } }, Ml = class extends Kt { selectedObject = null; scene; eventManager; viewer; selectionBox; box = new t(); camera; sceneHelpers; transformControls; objectPositionOnDown = new v(); objectRotationOnDown = new o(); objectScaleOnDown = new v(); #e = !1; constructor(e) { super(), this.viewer = e, this.scene = this.viewer.scene, this.eventManager = this.viewer.events, this.camera = this.viewer.camera, this.sceneHelpers = this.viewer.sceneHelpers, this.selectionBox = new n(this.box), this.init(); } get isControl() { return this.#e; } set isControl(e) { this.#e = e, e ? this.startControl() : this.endControl(); } init() { this.eventManager && this.eventManager.on(Jt.RAYCAST_PICK_ALL, ({ data: e }) => { if (e?.intersects && e.intersects.length > 0) { let t = e.intersects[0].object; this.setSelectedObject(t); } else this.setSelectedObject(null); }), this.initSelectionBox(), this.initTransformControls(); } initSelectionBox() { gn(this.selectionBox.material) || (this.selectionBox.material.depthTest = !1, this.selectionBox.material.transparent = !0), this.selectionBox.visible = !1, this.sceneHelpers.add(this.selectionBox); } initTransformControls() { this.transformControls = new pe(this.camera, this.viewer?.renderer.domElement), this.transformControls.addEventListener("axis-changed", () => {}), this.transformControls.addEventListener("objectChange", (e) => { this.transformControls.object && this.box.setFromObject(this.transformControls.object); }), this.transformControls.addEventListener("mouseDown", () => { let e = this.transformControls.object; e && (this.objectPositionOnDown = e.position.clone(), this.objectRotationOnDown = e.rotation.clone(), this.objectScaleOnDown = e.scale.clone()), this.viewer.cameraControls.enabled = !1; }), this.transformControls.addEventListener("mouseUp", () => { let e = this.transformControls.object; if (e !== void 0) { switch (this.transformControls.getMode()) { case "translate": this.objectPositionOnDown.equals(e.position); break; case "rotate": this.objectRotationOnDown.equals(e.rotation); break; case "scale": this.objectScaleOnDown.equals(e.scale); break; } this.box.setFromObject(e); } this.viewer.cameraControls.enabled = !0; }); let e = this.transformControls.getHelper(); this.sceneHelpers.add(e); } startControl() { this.selectedObject && (this.transformControls.attach(this.selectedObject), this.box.setFromObject(this.selectedObject), this.selectionBox.visible = !0, this.selectionBox && (this.selectionBox.visible = !0)); } endControl() { this.transformControls.detach(), this.selectionBox.visible = !1; } setSelectedObject(e) { if (e === this.selectedObject) return; let t = this.selectedObject; this.transformControls && this.transformControls.detach(), this.selectionBox && (this.selectionBox.visible = !1), this.selectedObject = e || null, this.selectedObject && this.isControl && this.startControl(), this.selectedObject === null && this.isControl && this.endControl(), this.selectedObject ? this.emit(Al.OBJECT_SELECTED, this.selectedObject) : this.emit(Al.OBJECT_UNSELECTED, t); } clearSelection() { this.setSelectedObject(null); } selectObjectByUuid(e) { if (!this.scene) return; let t = this.scene.getObjectByProperty("uuid", e); this.setSelectedObject(t); } getSelectedObject() { return this.selectedObject; } setTransformMode(e) { this.transformControls && this.transformControls.setMode(e); } getControlledObject() { return this.selectedObject; } connect(e) { this.transformControls && this.transformControls.connect(e); } setSpace(e) { this.transformControls && this.transformControls.setSpace(e); } setTranslationSnap(e) { this.transformControls && this.transformControls.setTranslationSnap(e); } dispose() {} }, Nl = class { renderer; viewer; objects = /* @__PURE__ */ new Map(); constructor(e) { this.viewer = e, this.renderer = new Je(), this.init(); } init() { let e = this.viewer.container; if (!e) throw Error("Viewer container not initialized"); let { width: t, height: n } = this.viewer.getSize(); this.renderer.setSize(t, n), this.renderer.domElement.style.position = "absolute", this.renderer.domElement.style.top = "0px", this.renderer.domElement.style.pointerEvents = "none", e.appendChild(this.renderer.domElement), window.addEventListener("resize", this.handleResize.bind(this)); } handleResize() { let { width: e, height: t } = this.viewer.getSize(); this.renderer.setSize(e, t); } createObject(t, n) { let r = new qe(t); r.position.copy(n); let i = e.MathUtils.generateUUID(); return this.objects.set(i, r), r; } addObject(e, t = this.viewer.scene) { t.add(e); } removeObject(e) { e.parent && e.parent.remove(e); for (let [t, n] of this.objects.entries()) if (n === e) { this.objects.delete(t); break; } } render() { this.viewer.isReady() && this.renderer.render(this.viewer.scene, this.viewer.camera); } dispose() { window.removeEventListener("resize", this.handleResize.bind(this)); for (let e of this.objects.values()) this.removeObject(e); let e = this.viewer.container; e && this.renderer.domElement.parentNode === e && e.removeChild(this.renderer.domElement); } getRenderer() { return this.renderer; } getObjects() { return Array.from(this.objects.values()); } }, Pl = class { renderer; viewer; objects = /* @__PURE__ */ new Map(); constructor(e) { this.viewer = e, this.renderer = new Xe(), this.init(); } init() { let e = this.viewer.container; if (!e) throw Error("Viewer container not initialized"); let { width: t, height: n } = this.viewer.getSize(); this.renderer.setSize(t, n), this.renderer.domElement.style.position = "absolute", this.renderer.domElement.style.top = "0px", this.renderer.domElement.style.pointerEvents = "none", e.appendChild(this.renderer.domElement); let r = document.createElement("style"); r.textContent = "\n.html-panel {\n pointer-events: none !important;\n}\n.html-panel [style] {\n will-change: transform, opacity;\n}\n", document.head.appendChild(r), window.addEventListener("resize", this.handleResize.bind(this)); } handleResize() { let { width: e, height: t } = this.viewer.getSize(); this.renderer.setSize(e, t); } createObject(t, n) { let r = new Ye(t); r.position.copy(n); let i = e.MathUtils.generateUUID(); return this.objects.set(i, r), r; } createSprite(t, n) { let r = new Ze(t); r.position.copy(n); let i = e.MathUtils.generateUUID(); return this.objects.set(i, r), r; } addObject(e, t = this.viewer.scene) { t.add(e); } removeObject(e) { e.parent && e.parent.remove(e); for (let [t, n] of this.objects.entries()) if (n === e) { this.objects.delete(t); break; } } render() { this.viewer.isReady() && this.renderer.render(this.viewer.scene, this.viewer.camera); } dispose() { window.removeEventListener("resize", this.handleResize.bind(this)); for (let e of this.objects.values()) this.removeObject(e); let e = this.viewer.container; e && this.renderer.domElement.parentNode === e && e.removeChild(this.renderer.domElement); } getRenderer() { return this.renderer; } getObjects() { return Array.from(this.objects.values()); } }, Fl = class extends U { options; constructor(e = {}) { let t = { radius: e.radius ?? 1, widthSegments: e.widthSegments ?? 32, heightSegments: e.heightSegments ?? 16, phiStart: e.phiStart ?? 0, phiLength: e.phiLength ?? Math.PI * 2, thetaStart: e.thetaStart ?? 0, thetaLength: e.thetaLength ?? Math.PI, material: e.material ?? new l({ color: 2200782, metalness: .3, roughness: .4 }) }, n = new ce(t.radius, t.widthSegments, t.heightSegments, t.phiStart, t.phiLength, t.thetaStart, t.thetaLength); super(n, t.material), this.options = t, this.name = "ParametricSphere", this.userData.sphereOptions = { radius: this.options.radius, widthSegments: this.options.widthSegments, heightSegments: this.options.heightSegments, phiStart: this.options.phiStart, phiLength: this.options.phiLength, thetaStart: this.options.thetaStart, thetaLength: this.options.thetaLength }; } createGeometry() { return new ce(this.options.radius, this.options.widthSegments, this.options.heightSegments, this.options.phiStart, this.options.phiLength, this.options.thetaStart, this.options.thetaLength); } updateParameters(e) { e.radius !== void 0 && (this.options.radius = e.radius), e.widthSegments !== void 0 && (this.options.widthSegments = e.widthSegments), e.heightSegments !== void 0 && (this.options.heightSegments = e.heightSegments), e.phiStart !== void 0 && (this.options.phiStart = e.phiStart), e.phiLength !== void 0 && (this.options.phiLength = e.phiLength), e.thetaStart !== void 0 && (this.options.thetaStart = e.thetaStart), e.thetaLength !== void 0 && (this.options.thetaLength = e.thetaLength), this.updateGeometry(); } updateGeometry() { this.geometry.dispose(), this.geometry = this.createGeometry(); } getParameters() { return { radius: this.options.radius, widthSegments: this.options.widthSegments, heightSegments: this.options.heightSegments, phiStart: this.options.phiStart, phiLength: this.options.phiLength, thetaStart: this.options.thetaStart, thetaLength: this.options.thetaLength }; } dispose() { this.geometry.dispose(), this.material.dispose(); } }, Il = class e extends U { options; constructor(e = {}) { let t = { radiusTop: e.radiusTop ?? 1, radiusBottom: e.radiusBottom ?? 1, height: e.height ?? 2, radialSegments: e.radialSegments ?? 64, heightSegments: e.heightSegments ?? 1, openEnded: e.openEnded ?? !1, thetaStart: e.thetaStart ?? 0, thetaLength: e.thetaLength ?? Math.PI * 2, material: e.material ?? new l({ color: 2200782, metalness: .3, roughness: .4 }) }, n = new N(t.radiusTop, t.radiusBottom, t.height, t.radialSegments, t.heightSegments, t.openEnded, t.thetaStart, t.thetaLength); super(n, t.material), this.options = t, this.name = "ParametricCylinder"; } static createCone(t = 1, n = 2, r = 64) { return new e({ radiusTop: 0, radiusBottom: t, height: n, radialSegments: r }); } createGeometry() { return new N(this.options.radiusTop, this.options.radiusBottom, this.options.height, this.options.radialSegments, this.options.heightSegments, this.options.openEnded, this.options.thetaStart, this.options.thetaLength); } updateParameters(e) { e.radiusTop !== void 0 && (this.options.radiusTop = e.radiusTop), e.radiusBottom !== void 0 && (this.options.radiusBottom = e.radiusBottom), e.height !== void 0 && (this.options.height = e.height), e.radialSegments !== void 0 && (this.options.radialSegments = e.radialSegments), e.heightSegments !== void 0 && (this.options.heightSegments = e.heightSegments), e.openEnded !== void 0 && (this.options.openEnded = e.openEnded), e.thetaStart !== void 0 && (this.options.thetaStart = e.thetaStart), e.thetaLength !== void 0 && (this.options.thetaLength = e.thetaLength), this.updateGeometry(); } updateGeometry() { this.geometry.dispose(), this.geometry = this.createGeometry(); } dispose() { this.geometry.dispose(), this.material.dispose(); } }, Ll = class extends U { options; clippingPlanes; bvhHelper = null; constructor(e = {}) { let t = { width: e.width ?? 1, height: e.height ?? 1, depth: e.depth ?? 1, widthSegments: e.widthSegments ?? 1, heightSegments: e.heightSegments ?? 1, depthSegments: e.depthSegments ?? 1, material: e.material ?? new l({ color: 2200782, metalness: .3, roughness: .4 }) }, n = new A(t.width, t.height, t.depth, t.widthSegments, t.heightSegments, t.depthSegments); super(n, t.material), this.options = t, this.name = "ParametricBox", this.clippingPlanes = this.createClippingPlanes(), this.geometry.computeBoundsTree(); } createGeometry() { return new A(this.options.width, this.options.height, this.options.depth, this.options.widthSegments, this.options.heightSegments, this.options.depthSegments); } updateParameters(e) { e.width !== void 0 && (this.options.width = e.width), e.height !== void 0 && (this.options.height = e.height), e.depth !== void 0 && (this.options.depth = e.depth), e.widthSegments !== void 0 && (this.options.widthSegments = e.widthSegments), e.heightSegments !== void 0 && (this.options.heightSegments = e.heightSegments), e.depthSegments !== void 0 && (this.options.depthSegments = e.depthSegments), this.updateGeometry(); } updateGeometry() { this.geometry.dispose(), this.geometry = this.createGeometry(), this.updateClippingPlanes(); } getBVHBoundingBox() { return this.geometry.computeBoundsTree?.(), this.geometry.boundsTree?.getBoundingBox(new k()); } createClippingPlanes() { let e = this.options.width / 2, t = this.options.height / 2, n = this.options.depth / 2; return [ new re(new W(1, 0, 0), e), new re(new W(-1, 0, 0), e), new re(new W(0, 1, 0), t), new re(new W(0, -1, 0), t), new re(new W(0, 0, 1), n), new re(new W(0, 0, -1), n) ]; } updateClippingPlanes() { let e = this.options.width / 2, t = this.options.height / 2, n = this.options.depth / 2; this.clippingPlanes[0]?.set(new W(1, 0, 0), e), this.clippingPlanes[1]?.set(new W(-1, 0, 0), e), this.clippingPlanes[2]?.set(new W(0, 1, 0), t), this.clippingPlanes[3]?.set(new W(0, -1, 0), t), this.clippingPlanes[4]?.set(new W(0, 0, 1), n), this.clippingPlanes[5]?.set(new W(0, 0, -1), n); } dispose() { this.bvhHelper &&= (this.bvhHelper.parent && this.bvhHelper.parent.remove(this.bvhHelper), null), this.geometry.dispose(), this.material.dispose(); } createDebugPanel(e) { let t = e.inspector.createParameters(`Box: ${this.name}`); t.add(this.options, "width", .1, 10, .1).name("宽度").onChange(() => this.updateGeometry()), t.add(this.options, "height", .1, 10, .1).name("高度").onChange(() => this.updateGeometry()), t.add(this.options, "depth", .1, 10, .1).name("深度").onChange(() => this.updateGeometry()), t.add(this.options, "widthSegments", 1, 20, 1).name("宽度分段").onChange(() => this.updateGeometry()), t.add(this.options, "heightSegments", 1, 20, 1).name("高度分段").onChange(() => this.updateGeometry()), t.add(this.options, "depthSegments", 1, 20, 1).name("深度分段").onChange(() => this.updateGeometry()), t.add(this.position, "x", -10, 10, .1).name("位置 X"), t.add(this.position, "y", -10, 10, .1).name("位置 Y"), t.add(this.position, "z", -10, 10, .1).name("位置 Z"), t.add(this, "visible").name("可见性"), t.add({ showBVH: !1 }, "showBVH").name("显示 BVH").onChange((t) => { t ? (this.bvhHelper ||= new Uo(this, 10), e.scene.add(this.bvhHelper)) : this.bvhHelper && e.scene.remove(this.bvhHelper); }); } }, Rl = class { pos; dir; right; up; dist; widthScale; sharp; constructor() { this.pos = new v(), this.dir = new v(), this.right = new v(), this.up = new v(), this.dist = 0, this.widthScale = 1, this.sharp = !1; } lerpPathPoints(e, t, n) { this.pos.lerpVectors(e.pos, t.pos, n), this.dir.lerpVectors(e.dir, t.dir, n), this.up.lerpVectors(e.up, t.up, n), this.right.lerpVectors(e.right, t.right, n), this.dist = (t.dist - e.dist) * n + e.dist, this.widthScale = (t.widthScale - e.widthScale) * n + e.widthScale; } copy(e) { this.pos.copy(e.pos), this.dir.copy(e.dir), this.up.copy(e.up), this.right.copy(e.right), this.dist = e.dist, this.widthScale = e.widthScale; } }, zl = class { array; count; constructor() { this.array = [], this.count = 0; } set(e, t = .1, n = 10, r = null, i = !1) { if (e = e.slice(0), e.length < 2) { console.warn("PathPointList: 点的数量少于 2 个。"), this.count = 0; return; } i && !e[0].equals(e[e.length - 1]) && e.push(new v().copy(e[0])); for (let a = 0, o = e.length; a < o; a++) if (a === 0) this._start(e[a], e[a + 1], r); else if (a === o - 1) if (i) { this._corner(e[a], e[1], t, n, r); let i = this.array[0].dist; this.array[0].copy(this.array[this.count - 1]), this.array[0].dist = i; } else this._end(e[a]); else this._corner(e[a], e[a + 1], t, n, r); } distance() { return this.count > 0 ? this.array[this.count - 1].dist : 0; } _getByIndex(e) { return this.array[e] || (this.array[e] = new Rl()), this.array[e]; } _start(e, t, n) { this.count = 0; let r = this._getByIndex(this.count); if (r.pos.copy(e), r.dir.subVectors(t, e), n) r.up.copy(n); else { let e = Number.MAX_VALUE, t = Math.abs(r.dir.x), n = Math.abs(r.dir.y), i = Math.abs(r.dir.z); t < e && (e = t, r.up.set(1, 0, 0)), n < e && (e = n, r.up.set(0, 1, 0)), i < e && r.up.set(0, 0, 1); } r.right.crossVectors(r.dir, r.up).normalize(), r.up.crossVectors(r.right, r.dir).normalize(), r.dist = 0, r.widthScale = 1, r.sharp = !1, r.dir.normalize(), this.count++; } _end(e) { let t = this.array[this.count - 1], n = this._getByIndex(this.count); n.pos.copy(e), n.dir.subVectors(e, t.pos); let r = n.dir.length(); n.dir.normalize(), n.up.copy(t.up); let i = Bl.crossVectors(t.dir, n.dir); if (i.length() > 2 ** -52) { i.normalize(); let e = Math.acos(Math.min(Math.max(t.dir.dot(n.dir), -1), 1)); n.up.applyMatrix4(Ul.makeRotationAxis(i, e)); } n.right.crossVectors(n.dir, n.up).normalize(), n.dist = t.dist + r, n.widthScale = 1, n.sharp = !1, this.count++; } _corner(e, t, n, r, i) { if (n > 0 && r > 0) { let a = this.array[this.count - 1], o = Gl(a.pos, e, t, n, this.count - 1 == 0, Wl).getPoints(r); for (let e = 0; e < r; e++) this._sharpCorner(o[e], o[e + 1], i, e === 0 ? 1 : 0); o[r].equals(t) || this._sharpCorner(o[r], t, i, 2); } else this._sharpCorner(e, t, i, 0, !0); } _sharpCorner(e, t, n, r = 0, i = !1) { let a = this.array[this.count - 1], o = this._getByIndex(this.count), s = Bl.subVectors(e, a.pos), c = Vl.subVectors(t, e), l = s.length(); if (s.normalize(), c.normalize(), o.pos.copy(e), r === 1 ? o.dir.copy(s) : r === 2 ? o.dir.copy(c) : (o.dir.addVectors(s, c), o.dir.normalize()), n) o.dir.dot(n) === 1 ? o.right.crossVectors(c, n).normalize() : o.right.crossVectors(o.dir, n).normalize(), o.up.crossVectors(o.right, o.dir).normalize(); else { o.up.copy(a.up); let e = Hl.crossVectors(a.dir, o.dir); if (e.length() > 2 ** -52) { e.normalize(); let t = Math.acos(Math.min(Math.max(a.dir.dot(o.dir), -1), 1)); o.up.applyMatrix4(Ul.makeRotationAxis(e, t)); } o.right.crossVectors(o.dir, o.up).normalize(); } o.dist = a.dist + l; let u = s.dot(c); o.widthScale = Math.min(1 / Math.sqrt((1 + u) / 2), 1.415) || 1, o.sharp = Math.abs(u - 1) > .05 && i, this.count++; } }, Bl = new v(), Vl = new v(), Hl = new v(), Ul = new c(), Wl = new u(); function Gl(e, t, n, r, i, a) { let o = Bl.subVectors(t, e), s = Vl.subVectors(n, t), c = o.length(), l = s.length(); o.normalize(), s.normalize(); let u = Math.min((i ? c / 2 : c) * .999999, r); a.v0.copy(t).sub(o.multiplyScalar(u)), a.v1.copy(t); let d = Math.min(l / 2 * .999999, r); return a.v2.copy(t).add(s.multiplyScalar(d)), a; } //#endregion //#region ../../third/three.path/src/PathGeometry.ts var Kl = class extends i { constructor(e = 3e3, t = !1) { super(), typeof e == "number" ? this._initByMaxVertex(e, t) : this._initByData(e.pathPointList, e.options, e.usage, t); } _initByMaxVertex(e, t, n = a) { this.setAttribute("position", new r(new Float32Array(e * 3), 3).setUsage(n)), this.setAttribute("normal", new r(new Float32Array(e * 3), 3).setUsage(n)), this.setAttribute("uv", new r(new Float32Array(e * 2), 2).setUsage(n)), t && this.setAttribute("uv2", new r(new Float32Array(e * 2), 2).setUsage(n)), this.drawRange.start = 0, this.drawRange.count = 0; let i = e > 65536 ? new g(e * 3, 1) : new h(e * 3, 1); i.setUsage(n), this.setIndex(i); } _initByData(e, t = {}, n, i) { let a = ql(e, t, i); a && a.count !== 0 ? (this.setAttribute("position", new r(new Float32Array(a.position), 3).setUsage(n || m)), this.setAttribute("normal", new r(new Float32Array(a.normal), 3).setUsage(n || m)), this.setAttribute("uv", new r(new Float32Array(a.uv), 2).setUsage(n || m)), i && this.setAttribute("uv2", new r(new Float32Array(a.uv2), 2).setUsage(n || m)), this.setIndex(a.position.length / 3 > 65536 ? new g(a.indices, 1) : new h(a.indices, 1))) : this._initByMaxVertex(2, i || !1); } update(e, t = {}) { let n = !!this.getAttribute("uv2"), r = ql(e, t, n); r ? (this._updateAttributes(r.position, r.normal, r.uv, n ? r.uv2 : null, r.indices), this.drawRange.count = r.count) : this.drawRange.count = 0; } _resizeAttribute(e, t) { let n = this.getAttribute(e); for (; n.array.length < t;) { let t = n.array.length, i = new r(new Float32Array(t * 2), n.itemSize, n.normalized); i.name = n.name, i.usage = n.usage, this.setAttribute(e, i), n = i; } } _resizeIndex(e) { let t = this.getIndex(); for (; t.array.length < e;) { let e = t.array.length, n = new r(e * 2 > 65535 ? new Uint32Array(e * 2) : new Uint16Array(e * 2), 1); n.name = t.name, n.usage = t.usage, this.setIndex(n), t = n; } } _updateAttributes(e, t, n, r, i) { this._resizeAttribute("position", e.length); let a = this.getAttribute("position"); a.array.set(e, 0), a.addUpdateRange ? (a.clearUpdateRanges(), a.addUpdateRange(0, e.length)) : a.updateRange.count = e.length, a.needsUpdate = !0, this._resizeAttribute("normal", t.length); let o = this.getAttribute("normal"); o.array.set(t, 0), o.addUpdateRange ? (o.clearUpdateRanges(), o.addUpdateRange(0, t.length)) : o.updateRange.count = t.length, o.needsUpdate = !0, this._resizeAttribute("uv", n.length); let s = this.getAttribute("uv"); if (s.array.set(n, 0), s.addUpdateRange ? (s.clearUpdateRanges(), s.addUpdateRange(0, n.length)) : s.updateRange.count = n.length, s.needsUpdate = !0, r) { this._resizeAttribute("uv2", r.length); let e = this.getAttribute("uv2"); e.array.set(r, 0), e.addUpdateRange ? (e.clearUpdateRanges(), e.addUpdateRange(0, r.length)) : e.updateRange.count = r.length, e.needsUpdate = !0; } this._resizeIndex(i.length); let c = this.getIndex(); c.set(i, 0), c.addUpdateRange ? (c.clearUpdateRanges(), c.addUpdateRange(0, i.length)) : c.updateRange.count = i.length, c.needsUpdate = !0; } }; function ql(e, t, n = !1) { let r = t.width || .1, i = t.progress === void 0 ? 1 : t.progress, a = t.arrow === void 0 ? !0 : t.arrow, o = t.side === void 0 ? "both" : t.side, s = r / 2, c = o === "both" ? r : r / 2, l = e.distance(), u = i * l; if (l == 0) return null; let d = s / c, f = s / l, p = 0, m = [], h = [], g = [], _ = [], y = [], b = 0, x = new v(), S = new v(), C = new v(), w = new v(), T = new v(), E = new v(); function D(e) { let t = m.length === 0, r = e.sharp && !t, i = e.dist / c, a = e.dist / l, u = e.dir, v = e.up, D = e.right; if (o === "left" ? x.set(0, 0, 0) : x.copy(D).multiplyScalar(s * e.widthScale), o === "right" ? S.set(0, 0, 0) : S.copy(D).multiplyScalar(-s * e.widthScale), x.add(e.pos), S.add(e.pos), r) { C.fromArray(m, m.length - 6).sub(S), w.fromArray(m, m.length - 3).sub(x); let e = C.length() - w.length(), t, r; e > 0 ? (t = C, r = S) : (t = w, r = x), T.copy(t).setLength(Math.abs(e)).add(r); let o = E.copy(r).sub(T).normalize().dot(u) * E.copy(r).sub(T).length() * 2; E.copy(u).setLength(o).add(T), e > 0 ? (m.push(T.x, T.y, T.z, x.x, x.y, x.z, S.x, S.y, S.z, x.x, x.y, x.z, E.x, E.y, E.z, x.x, x.y, x.z), b += 6, y.push(b - 6, b - 8, b - 7, b - 6, b - 7, b - 5, b - 4, b - 6, b - 5, b - 2, b - 4, b - 1), p += 12) : (m.push(S.x, S.y, S.z, T.x, T.y, T.z, S.x, S.y, S.z, x.x, x.y, x.z, S.x, S.y, S.z, E.x, E.y, E.z), b += 6, y.push(b - 6, b - 8, b - 7, b - 6, b - 7, b - 5, b - 6, b - 5, b - 3, b - 2, b - 3, b - 1), p += 12), h.push(v.x, v.y, v.z, v.x, v.y, v.z, v.x, v.y, v.z, v.x, v.y, v.z, v.x, v.y, v.z, v.x, v.y, v.z), g.push(i - d, 0, i - d, 1, i, 0, i, 1, i + d, 0, i + d, 1), n && _.push(a - f, 0, a - f, 1, a, 0, a, 1, a + f, 0, a + f, 1); } else m.push(S.x, S.y, S.z, x.x, x.y, x.z), h.push(v.x, v.y, v.z, v.x, v.y, v.z), g.push(i, 0, i, 1), n && _.push(a, 0, a, 1), b += 2, t || (y.push(b - 2, b - 4, b - 3, b - 2, b - 3, b - 1), p += 6); } let O = new v(); function k(e) { let t = e.dir, i = e.up, a = e.right, u = e.dist / c, d = e.dist / l; o === "left" ? x.set(0, 0, 0) : x.copy(a).multiplyScalar(s * 2), o === "right" ? S.set(0, 0, 0) : S.copy(a).multiplyScalar(-s * 2), O.copy(t).setLength(s * 3), x.add(e.pos), S.add(e.pos), O.add(e.pos), m.push(S.x, S.y, S.z, x.x, x.y, x.z, O.x, O.y, O.z), h.push(i.x, i.y, i.z, i.x, i.y, i.z, i.x, i.y, i.z), g.push(u, o === "both" ? -.5 : o === "right" ? 0 : -2, u, o === "both" ? 1.5 : o === "left" ? 0 : 2, u + 1.5, o === "both" ? .5 : 0), n && _.push(d, o === "both" ? -.5 : o === "right" ? 0 : -2, d, o === "both" ? 1.5 : o === "left" ? 0 : 2, d + 1.5 * r / l, o === "both" ? .5 : 0), b += 3, y.push(b - 1, b - 3, b - 2), p += 3; } let A; if (u > 0) for (let t = 0; t < e.count; t++) { let n = e.array[t]; if (n.dist > u) { let r = e.array[t - 1]; A = new Rl(); let i = (u - r.dist) / (n.dist - r.dist); A.lerpPathPoints(r, n, i), D(A); break; } else D(n); } else A = e.array[0]; return a && (A ||= e.array[e.count - 1], k(A)), { position: m, normal: h, uv: g, uv2: _, indices: y, count: p }; } //#endregion //#region ../../third/three.path/src/PathTubeGeometry.ts var Jl = class extends Kl { constructor(e = 1e3, t = !1) { super(e, t); } _initByData(e, t = {}, n, r) { let i = r || !1, a = Yl(e, t, i), o = Yl(e, { ...t, progress: 1 }, i), s = n || m, c = o?.position.length ? Math.max(2, o.position.length / 3) : 2; this._initByMaxVertex(c, i, s), a && a.count !== 0 && (this._updateAttributes(a.position, a.normal, a.uv, i ? a.uv2 : null, a.indices), this.drawRange.count = a.count); } update(e, t = {}) { let n = !!this.getAttribute("uv2"), r = Yl(e, t, n); r ? (this._updateAttributes(r.position, r.normal, r.uv, n ? r.uv2 : null, r.indices), this.drawRange.count = r.count) : this.drawRange.count = 0; } }; function Yl(e, t, n = !1) { let r = t.radius || .1, i = t.progress === void 0 ? 1 : t.progress, a = Math.max(2, t.radialSegments || 8), o = t.startRad || 0, s = r * 2 * Math.PI, c = e.distance(), l = i * c; if (l == 0) return null; let u = 0, d = [], f = [], p = [], m = [], h = [], g = 0, _ = new v(); function y(e, t, r) { let i = d.length === 0, a = e.dist / s, l = e.dist / c; for (let i = 0; i <= r; i++) { let s = i; s == r && (s = 0), _.copy(e.up).applyAxisAngle(e.dir, o + Math.PI * 2 * s / r).normalize(), d.push(e.pos.x + _.x * t * e.widthScale, e.pos.y + _.y * t * e.widthScale, e.pos.z + _.z * t * e.widthScale), f.push(_.x, _.y, _.z), p.push(a, i / r), n && m.push(l, i / r), g++; } if (!i) { let e = g - (r + 1) * 2, t = g - (r + 1); for (let n = 0; n < r; n++) h.push(t + n, e + n, e + n + 1, t + n, e + n + 1, t + n + 1), u += 6; } } if (l > 0) for (let t = 0; t < e.count; t++) { let n = e.array[t]; if (n.dist > l) { let i = e.array[t - 1], o = new Rl(), s = (l - i.dist) / (n.dist - i.dist); o.lerpPathPoints(i, n, s), y(o, r, a); break; } else y(n, r, a); } return { position: d, normal: f, uv: p, uv2: m, indices: h, count: u }; } //#endregion //#region ../../third/three.path/src/PathArchGeometry.ts var Xl = class extends Kl { constructor(e = 1e3, t = !1) { super(e, t); } _initByData(e, t = {}, n, i) { let a = Zl(e, t, i); a && a.count !== 0 ? (this.setAttribute("position", new r(new Float32Array(a.position), 3).setUsage(n || m)), this.setAttribute("normal", new r(new Float32Array(a.normal), 3).setUsage(n || m)), this.setAttribute("uv", new r(new Float32Array(a.uv), 2).setUsage(n || m)), i && this.setAttribute("uv2", new r(new Float32Array(a.uv2), 2).setUsage(n || m)), this.setIndex(a.position.length / 3 > 65536 ? new g(a.indices, 1) : new h(a.indices, 1))) : this._initByMaxVertex(2, i || !1); } update(e, t = {}) { let n = !!this.getAttribute("uv2"), r = Zl(e, t, n); r ? (this._updateAttributes(r.position, r.normal, r.uv, n ? r.uv2 : null, r.indices), this.drawRange.count = r.count) : this.drawRange.count = 0; } }; function Zl(e, t, n = !1) { let r = t.width || 2, i = t.height || 2, a = t.progress === void 0 ? 1 : t.progress, o = Math.max(3, t.radialSegments || 16), s = t.bottomEnabled === void 0 ? !1 : t.bottomEnabled, c = t.topEnabled === void 0 ? !1 : t.topEnabled, l = a * e.distance(); if (l == 0) return null; let u = r * .5, d = i * .5, f = [], p = Math.max(2, Math.round(o * i / (Math.PI * u) * 2)); f.push({ x: -u, y: -d }), f.push({ x: u, y: -d }); for (let e = 1; e <= p; e++) { let t = e / p; f.push({ x: u, y: -d + t * i }); } for (let e = 1; e < o; e++) { let t = e / o * Math.PI; f.push({ x: Math.cos(t) * u, y: d + Math.sin(t) * u }); } for (let e = p - 1; e >= 0; e--) { let t = e / p; f.push({ x: -u, y: -d + t * i }); } let m = [0], h = 0; for (let e = 1; e < f.length; e++) { let t = f[e].x - f[e - 1].x, n = f[e].y - f[e - 1].y, r = Math.sqrt(t * t + n * n); h += r, m.push(h); } let g = 0, _ = [], y = [], b = [], x = [], S = [], C = 0, w = new v(), T = new v(), E = new v(0, 1, 0), D = new v(); function O(e, t, r, i) { let a = t.length, o = C; D.crossVectors(E, e.dir).normalize(), D.length() < .001 && D.set(1, 0, 0); for (let i = 0; i < a; i++) { let a = t[i]; w.set(e.pos.x + a.x * D.x + a.y * E.x, e.pos.y + a.x * D.y + a.y * E.y, e.pos.z + a.x * D.z + a.y * E.z), _.push(w.x, w.y, w.z); let o = i > 0 ? a.x - t[i - 1].x : t[i + 1].x - a.x, s = i > 0 ? a.y - t[i - 1].y : t[i + 1].y - a.y; T.set(-s * D.x, -s * E.y, -s * D.z).add(new v(o * D.x, o * E.y, o * D.z)).normalize(), r || T.multiplyScalar(-1), y.push(T.x, T.y, T.z); let c = e.dist, l = m[i]; b.push(c, l), n && x.push(c, l), C++; } if (!i) { let e = o - a; for (let t = 0; t < a; t++) { let n = (t + 1) % a, i = e + t, s = e + n, c = o + n, l = o + t; r ? (S.push(i, s, l), S.push(s, c, l)) : (S.push(i, l, s), S.push(s, l, c)), g += 6; } } } let k = null, A = null; if (l > 0) { let t = !0; for (let n = 0; n < e.count; n++) { let r = e.array[n]; if (r.dist > l) { let i = e.array[n - 1], a = new Rl(), o = (l - i.dist) / (r.dist - i.dist); a.lerpPathPoints(i, r, o), t && (k = a), A = a, O(a, f, !0, t); break; } else t && (k = r), A = r, O(r, f, !0, t), t = !1; } } s && k && j(k, f, !1), c && A && j(A, f, !0); function j(e, t, a) { let o = t.length, s = C; D.crossVectors(E, e.dir).normalize(), D.length() < .001 && D.set(1, 0, 0); for (let s = 0; s < o; s++) { let o = t[s]; w.set(e.pos.x + o.x * D.x + o.y * E.x, e.pos.y + o.x * D.y + o.y * E.y, e.pos.z + o.x * D.z + o.y * E.z), _.push(w.x, w.y, w.z); let c = a ? 1 : -1; y.push(e.dir.x * c, e.dir.y * c, e.dir.z * c), b.push(o.x / r + .5, o.y / (i + u) + .5), n && x.push(o.x / r + .5, o.y / (i + u) + .5), C++; } let c = s; for (let e = 1; e < o - 1; e++) a ? S.push(c, s + e, s + e + 1) : S.push(c, s + e + 1, s + e), g += 3; } return { position: _, normal: y, uv: b, uv2: x, indices: S, count: g }; } //#endregion //#region src/parametric/ParametricGeometryBase.ts var Ql = class extends e.Mesh { collisionDetector; csgOperator; collisionTargets = []; collisionCountMap = /* @__PURE__ */ new WeakMap(); constructor() { super(new e.BufferGeometry(), new e.MeshBasicMaterial()), this.collisionDetector = new Ko(), this.csgOperator = new wl(); } addCollisionTarget(e, t, n) { let r = { mesh: e, operationType: t ?? 5, maxCollisionCount: n ?? 1 }; this.collisionTargets.find((t) => t.mesh === e) || (this.collisionTargets.push(r), this.collisionCountMap.set(e, 0), this.collisionDetector.buildBVH(e)); } removeCollisionTarget(e) { let t = this.collisionTargets.findIndex((t) => t.mesh === e); t > -1 && (this.collisionCountMap.delete(e), this.collisionTargets.splice(t, 1), this.collisionDetector.disposeBVH(e)); } clearCollisionTargets() { this.collisionTargets.forEach((e) => { this.collisionDetector.disposeBVH(e.mesh), this.collisionCountMap.delete(e.mesh); }), this.collisionTargets = []; } getCollisionTargets() { return this.collisionTargets.map((e) => e.mesh); } resetProcessedTargets() { this.collisionCountMap = /* @__PURE__ */ new WeakMap(), this.collisionTargets.forEach((e) => { this.collisionCountMap.set(e.mesh, 0); }); } getCSGMesh() { return this; } checkCollisionsAndApplyCSG() { let e = this.getCSGMesh(); if (!(this.collisionTargets.length === 0 || !e)) { this.collisionDetector.buildBVH(e); for (let t of this.collisionTargets) { let n = t.mesh, r = this.collisionCountMap.get(n) ?? 0; if (!(t.maxCollisionCount !== -1 && r >= t.maxCollisionCount) && this.collisionDetector.checkIntersection(e, n)) try { let i = this.csgOperator.operate(n, e, t.operationType), a = n.geometry; n.geometry = i, n.geometry.computeBoundingBox(), n.geometry.computeBoundingSphere(), a.dispose(), this.collisionCountMap.set(n, r + 1); } catch (e) { console.error("CSG操作失败:", e); } } } } disposeCollisionResources() { this.collisionDetector.disposeAll(); } }, $l = /* @__PURE__ */ ct((/* @__PURE__ */ ot(((e, t) => { (function(n, r) { typeof e == "object" && t !== void 0 ? t.exports = r() : typeof define == "function" && define.amd ? define(r) : (n = typeof globalThis < "u" ? globalThis : n || self, n.html2canvas = r()); })(e, (function() { var e = function(t, n) { return e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, t) { e.__proto__ = t; } || function(e, t) { for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n]); }, e(t, n); }; function t(t, n) { if (typeof n != "function" && n !== null) throw TypeError("Class extends value " + String(n) + " is not a constructor or null"); e(t, n); function r() { this.constructor = t; } t.prototype = n === null ? Object.create(n) : (r.prototype = n.prototype, new r()); } var n = function() { return n = Object.assign || function(e) { for (var t, n = 1, r = arguments.length; n < r; n++) for (var i in t = arguments[n], t) Object.prototype.hasOwnProperty.call(t, i) && (e[i] = t[i]); return e; }, n.apply(this, arguments); }; function r(e, t, n, r) { function i(e) { return e instanceof n ? e : new n(function(t) { t(e); }); } return new (n ||= Promise)(function(n, a) { function o(e) { try { c(r.next(e)); } catch (e) { a(e); } } function s(e) { try { c(r.throw(e)); } catch (e) { a(e); } } function c(e) { e.done ? n(e.value) : i(e.value).then(o, s); } c((r = r.apply(e, t || [])).next()); }); } function i(e, t) { var n = { label: 0, sent: function() { if (a[0] & 1) throw a[1]; return a[1]; }, trys: [], ops: [] }, r, i, a, o; return o = { next: s(0), throw: s(1), return: s(2) }, typeof Symbol == "function" && (o[Symbol.iterator] = function() { return this; }), o; function s(e) { return function(t) { return c([e, t]); }; } function c(o) { if (r) throw TypeError("Generator is already executing."); for (; n;) try { if (r = 1, i && (a = o[0] & 2 ? i.return : o[0] ? i.throw || ((a = i.return) && a.call(i), 0) : i.next) && !(a = a.call(i, o[1])).done) return a; switch (i = 0, a && (o = [o[0] & 2, a.value]), o[0]) { case 0: case 1: a = o; break; case 4: return n.label++, { value: o[1], done: !1 }; case 5: n.label++, i = o[1], o = [0]; continue; case 7: o = n.ops.pop(), n.trys.pop(); continue; default: if ((a = n.trys, !(a = a.length > 0 && a[a.length - 1])) && (o[0] === 6 || o[0] === 2)) { n = 0; continue; } if (o[0] === 3 && (!a || o[1] > a[0] && o[1] < a[3])) { n.label = o[1]; break; } if (o[0] === 6 && n.label < a[1]) { n.label = a[1], a = o; break; } if (a && n.label < a[2]) { n.label = a[2], n.ops.push(o); break; } a[2] && n.ops.pop(), n.trys.pop(); continue; } o = t.call(e, n); } catch (e) { o = [6, e], i = 0; } finally { r = a = 0; } if (o[0] & 5) throw o[1]; return { value: o[0] ? o[1] : void 0, done: !0 }; } } function a(e, t, n) { if (n || arguments.length === 2) for (var r = 0, i = t.length, a; r < i; r++) (a || !(r in t)) && (a ||= Array.prototype.slice.call(t, 0, r), a[r] = t[r]); return e.concat(a || t); } for (var o = function() { function e(e, t, n, r) { this.left = e, this.top = t, this.width = n, this.height = r; } return e.prototype.add = function(t, n, r, i) { return new e(this.left + t, this.top + n, this.width + r, this.height + i); }, e.fromClientRect = function(t, n) { return new e(n.left + t.windowBounds.left, n.top + t.windowBounds.top, n.width, n.height); }, e.fromDOMRectList = function(t, n) { var r = Array.from(n).find(function(e) { return e.width !== 0; }); return r ? new e(r.left + t.windowBounds.left, r.top + t.windowBounds.top, r.width, r.height) : e.EMPTY; }, e.EMPTY = new e(0, 0, 0, 0), e; }(), s = function(e, t) { return o.fromClientRect(e, t.getBoundingClientRect()); }, c = function(e) { var t = e.body, n = e.documentElement; if (!t || !n) throw Error("Unable to get document size"); return new o(0, 0, Math.max(Math.max(t.scrollWidth, n.scrollWidth), Math.max(t.offsetWidth, n.offsetWidth), Math.max(t.clientWidth, n.clientWidth)), Math.max(Math.max(t.scrollHeight, n.scrollHeight), Math.max(t.offsetHeight, n.offsetHeight), Math.max(t.clientHeight, n.clientHeight))); }, l = function(e) { for (var t = [], n = 0, r = e.length; n < r;) { var i = e.charCodeAt(n++); if (i >= 55296 && i <= 56319 && n < r) { var a = e.charCodeAt(n++); (a & 64512) == 56320 ? t.push(((i & 1023) << 10) + (a & 1023) + 65536) : (t.push(i), n--); } else t.push(i); } return t; }, u = function() { var e = [...arguments]; if (String.fromCodePoint) return String.fromCodePoint.apply(String, e); var t = e.length; if (!t) return ""; for (var n = [], r = -1, i = ""; ++r < t;) { var a = e[r]; a <= 65535 ? n.push(a) : (a -= 65536, n.push((a >> 10) + 55296, a % 1024 + 56320)), (r + 1 === t || n.length > 16384) && (i += String.fromCharCode.apply(String, n), n.length = 0); } return i; }, d = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", f = typeof Uint8Array > "u" ? [] : new Uint8Array(256), p = 0; p < d.length; p++) f[d.charCodeAt(p)] = p; for (var m = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", h = typeof Uint8Array > "u" ? [] : new Uint8Array(256), g = 0; g < m.length; g++) h[m.charCodeAt(g)] = g; for (var _ = function(e) { var t = e.length * .75, n = e.length, r, i = 0, a, o, s, c; e[e.length - 1] === "=" && (t--, e[e.length - 2] === "=" && t--); var l = typeof ArrayBuffer < "u" && typeof Uint8Array < "u" && Uint8Array.prototype.slice !== void 0 ? new ArrayBuffer(t) : Array(t), u = Array.isArray(l) ? l : new Uint8Array(l); for (r = 0; r < n; r += 4) a = h[e.charCodeAt(r)], o = h[e.charCodeAt(r + 1)], s = h[e.charCodeAt(r + 2)], c = h[e.charCodeAt(r + 3)], u[i++] = a << 2 | o >> 4, u[i++] = (o & 15) << 4 | s >> 2, u[i++] = (s & 3) << 6 | c & 63; return l; }, v = function(e) { for (var t = e.length, n = [], r = 0; r < t; r += 2) n.push(e[r + 1] << 8 | e[r]); return n; }, y = function(e) { for (var t = e.length, n = [], r = 0; r < t; r += 4) n.push(e[r + 3] << 24 | e[r + 2] << 16 | e[r + 1] << 8 | e[r]); return n; }, b = 5, x = 11, S = 2, C = x - b, w = 65536 >> b, T = (1 << b) - 1, E = w + (1024 >> b) + 32, D = 65536 >> x, O = (1 << C) - 1, k = function(e, t, n) { return e.slice ? e.slice(t, n) : new Uint16Array(Array.prototype.slice.call(e, t, n)); }, A = function(e, t, n) { return e.slice ? e.slice(t, n) : new Uint32Array(Array.prototype.slice.call(e, t, n)); }, j = function(e, t) { var n = _(e), r = Array.isArray(n) ? y(n) : new Uint32Array(n), i = Array.isArray(n) ? v(n) : new Uint16Array(n), a = 24, o = k(i, a / 2, r[4] / 2), s = r[5] === 2 ? k(i, (a + r[4]) / 2) : A(r, Math.ceil((a + r[4]) / 4)); return new M(r[0], r[1], r[2], r[3], o, s); }, M = function() { function e(e, t, n, r, i, a) { this.initialValue = e, this.errorValue = t, this.highStart = n, this.highValueIndex = r, this.index = i, this.data = a; } return e.prototype.get = function(e) { var t; if (e >= 0) { if (e < 55296 || e > 56319 && e <= 65535) return t = this.index[e >> b], t = (t << S) + (e & T), this.data[t]; if (e <= 65535) return t = this.index[w + (e - 55296 >> b)], t = (t << S) + (e & T), this.data[t]; if (e < this.highStart) return t = E - D + (e >> x), t = this.index[t], t += e >> b & O, t = this.index[t], t = (t << S) + (e & T), this.data[t]; if (e <= 1114111) return this.data[this.highValueIndex]; } return this.errorValue; }, e; }(), N = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", P = typeof Uint8Array > "u" ? [] : new Uint8Array(256), F = 0; F < N.length; F++) P[N.charCodeAt(F)] = F; var I = "KwAAAAAAAAAACA4AUD0AADAgAAACAAAAAAAIABAAGABAAEgAUABYAGAAaABgAGgAYgBqAF8AZwBgAGgAcQB5AHUAfQCFAI0AlQCdAKIAqgCyALoAYABoAGAAaABgAGgAwgDKAGAAaADGAM4A0wDbAOEA6QDxAPkAAQEJAQ8BFwF1AH0AHAEkASwBNAE6AUIBQQFJAVEBWQFhAWgBcAF4ATAAgAGGAY4BlQGXAZ8BpwGvAbUBvQHFAc0B0wHbAeMB6wHxAfkBAQIJAvEBEQIZAiECKQIxAjgCQAJGAk4CVgJeAmQCbAJ0AnwCgQKJApECmQKgAqgCsAK4ArwCxAIwAMwC0wLbAjAA4wLrAvMC+AIAAwcDDwMwABcDHQMlAy0DNQN1AD0DQQNJA0kDSQNRA1EDVwNZA1kDdQB1AGEDdQBpA20DdQN1AHsDdQCBA4kDkQN1AHUAmQOhA3UAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AKYDrgN1AHUAtgO+A8YDzgPWAxcD3gPjA+sD8wN1AHUA+wMDBAkEdQANBBUEHQQlBCoEFwMyBDgEYABABBcDSARQBFgEYARoBDAAcAQzAXgEgASIBJAEdQCXBHUAnwSnBK4EtgS6BMIEyAR1AHUAdQB1AHUAdQCVANAEYABgAGAAYABgAGAAYABgANgEYADcBOQEYADsBPQE/AQEBQwFFAUcBSQFLAU0BWQEPAVEBUsFUwVbBWAAYgVgAGoFcgV6BYIFigWRBWAAmQWfBaYFYABgAGAAYABgAKoFYACxBbAFuQW6BcEFwQXHBcEFwQXPBdMF2wXjBeoF8gX6BQIGCgYSBhoGIgYqBjIGOgZgAD4GRgZMBmAAUwZaBmAAYABgAGAAYABgAGAAYABgAGAAYABgAGIGYABpBnAGYABgAGAAYABgAGAAYABgAGAAYAB4Bn8GhQZgAGAAYAB1AHcDFQSLBmAAYABgAJMGdQA9A3UAmwajBqsGqwaVALMGuwbDBjAAywbSBtIG1QbSBtIG0gbSBtIG0gbdBuMG6wbzBvsGAwcLBxMHAwcbByMHJwcsBywHMQcsB9IGOAdAB0gHTgfSBkgHVgfSBtIG0gbSBtIG0gbSBtIG0gbSBiwHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAdgAGAALAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAdbB2MHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsB2kH0gZwB64EdQB1AHUAdQB1AHUAdQB1AHUHfQdgAIUHjQd1AHUAlQedB2AAYAClB6sHYACzB7YHvgfGB3UAzgfWBzMB3gfmB1EB7gf1B/0HlQENAQUIDQh1ABUIHQglCBcDLQg1CD0IRQhNCEEDUwh1AHUAdQBbCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIcAh3CHoIMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIgggwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAALAcsBywHLAcsBywHLAcsBywHLAcsB4oILAcsB44I0gaWCJ4Ipgh1AHUAqgiyCHUAdQB1AHUAdQB1AHUAdQB1AHUAtwh8AXUAvwh1AMUIyQjRCNkI4AjoCHUAdQB1AO4I9gj+CAYJDgkTCS0HGwkjCYIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiAAIAAAAFAAYABgAGIAXwBgAHEAdQBFAJUAogCyAKAAYABgAEIA4ABGANMA4QDxAMEBDwE1AFwBLAE6AQEBUQF4QkhCmEKoQrhCgAHIQsAB0MLAAcABwAHAAeDC6ABoAHDCwMMAAcABwAHAAdDDGMMAAcAB6MM4wwjDWMNow3jDaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAEjDqABWw6bDqABpg6gAaABoAHcDvwOPA+gAaABfA/8DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DpcPAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcAB9cPKwkyCToJMAB1AHUAdQBCCUoJTQl1AFUJXAljCWcJawkwADAAMAAwAHMJdQB2CX4JdQCECYoJjgmWCXUAngkwAGAAYABxAHUApgn3A64JtAl1ALkJdQDACTAAMAAwADAAdQB1AHUAdQB1AHUAdQB1AHUAowYNBMUIMAAwADAAMADICcsJ0wnZCRUE4QkwAOkJ8An4CTAAMAB1AAAKvwh1AAgKDwoXCh8KdQAwACcKLgp1ADYKqAmICT4KRgowADAAdQB1AE4KMAB1AFYKdQBeCnUAZQowADAAMAAwADAAMAAwADAAMAAVBHUAbQowADAAdQC5CXUKMAAwAHwBxAijBogEMgF9CoQKiASMCpQKmgqIBKIKqgquCogEDQG2Cr4KxgrLCjAAMADTCtsKCgHjCusK8Qr5CgELMAAwADAAMAB1AIsECQsRC3UANAEZCzAAMAAwADAAMAB1ACELKQswAHUANAExCzkLdQBBC0kLMABRC1kLMAAwADAAMAAwADAAdQBhCzAAMAAwAGAAYABpC3ELdwt/CzAAMACHC4sLkwubC58Lpwt1AK4Ltgt1APsDMAAwADAAMAAwADAAMAAwAL4LwwvLC9IL1wvdCzAAMADlC+kL8Qv5C/8LSQswADAAMAAwADAAMAAwADAAMAAHDDAAMAAwADAAMAAODBYMHgx1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1ACYMMAAwADAAdQB1AHUALgx1AHUAdQB1AHUAdQA2DDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AD4MdQBGDHUAdQB1AHUAdQB1AEkMdQB1AHUAdQB1AFAMMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQBYDHUAdQB1AF8MMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUA+wMVBGcMMAAwAHwBbwx1AHcMfwyHDI8MMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAYABgAJcMMAAwADAAdQB1AJ8MlQClDDAAMACtDCwHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsB7UMLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AA0EMAC9DDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAsBywHLAcsBywHLAcsBywHLQcwAMEMyAwsBywHLAcsBywHLAcsBywHLAcsBywHzAwwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1ANQM2QzhDDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMABgAGAAYABgAGAAYABgAOkMYADxDGAA+AwADQYNYABhCWAAYAAODTAAMAAwADAAFg1gAGAAHg37AzAAMAAwADAAYABgACYNYAAsDTQNPA1gAEMNPg1LDWAAYABgAGAAYABgAGAAYABgAGAAUg1aDYsGVglhDV0NcQBnDW0NdQ15DWAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAlQCBDZUAiA2PDZcNMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAnw2nDTAAMAAwADAAMAAwAHUArw23DTAAMAAwADAAMAAwADAAMAAwADAAMAB1AL8NMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAB1AHUAdQB1AHUAdQDHDTAAYABgAM8NMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAA1w11ANwNMAAwAD0B5A0wADAAMAAwADAAMADsDfQN/A0EDgwOFA4wABsOMAAwADAAMAAwADAAMAAwANIG0gbSBtIG0gbSBtIG0gYjDigOwQUuDsEFMw7SBjoO0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGQg5KDlIOVg7SBtIGXg5lDm0OdQ7SBtIGfQ6EDooOjQ6UDtIGmg6hDtIG0gaoDqwO0ga0DrwO0gZgAGAAYADEDmAAYAAkBtIGzA5gANIOYADaDokO0gbSBt8O5w7SBu8O0gb1DvwO0gZgAGAAxA7SBtIG0gbSBtIGYABgAGAAYAAED2AAsAUMD9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGFA8sBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAccD9IGLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHJA8sBywHLAcsBywHLAccDywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywPLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAc0D9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAccD9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGFA8sBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHPA/SBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gYUD0QPlQCVAJUAMAAwADAAMACVAJUAlQCVAJUAlQCVAEwPMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAA//8EAAQABAAEAAQABAAEAAQABAANAAMAAQABAAIABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQACgATABcAHgAbABoAHgAXABYAEgAeABsAGAAPABgAHABLAEsASwBLAEsASwBLAEsASwBLABgAGAAeAB4AHgATAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABYAGwASAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAWAA0AEQAeAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAFAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAJABYAGgAbABsAGwAeAB0AHQAeAE8AFwAeAA0AHgAeABoAGwBPAE8ADgBQAB0AHQAdAE8ATwAXAE8ATwBPABYAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAFAATwBAAE8ATwBPAEAATwBQAFAATwBQAB4AHgAeAB4AHgAeAB0AHQAdAB0AHgAdAB4ADgBQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgBQAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAJAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAkACQAJAAkACQAJAAkABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAFAAHgAeAB4AKwArAFAAUABQAFAAGABQACsAKwArACsAHgAeAFAAHgBQAFAAUAArAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUAAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAYAA0AKwArAB4AHgAbACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQADQAEAB4ABAAEAB4ABAAEABMABAArACsAKwArACsAKwArACsAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAKwArACsAKwBWAFYAVgBWAB4AHgArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AGgAaABoAGAAYAB4AHgAEAAQABAAEAAQABAAEAAQABAAEAAQAEwAEACsAEwATAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABLAEsASwBLAEsASwBLAEsASwBLABoAGQAZAB4AUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABMAUAAEAAQABAAEAAQABAAEAB4AHgAEAAQABAAEAAQABABQAFAABAAEAB4ABAAEAAQABABQAFAASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUAAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAFAABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQAUABQAB4AHgAYABMAUAArACsABAAbABsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAFAABAAEAAQABAAEAFAABAAEAAQAUAAEAAQABAAEAAQAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAArACsAHgArAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAUAAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAABAAEAA0ADQBLAEsASwBLAEsASwBLAEsASwBLAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUAArACsAKwBQAFAAUABQACsAKwAEAFAABAAEAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABABQACsAKwArACsAKwArACsAKwAEACsAKwArACsAUABQACsAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUAAaABoAUABQAFAAUABQAEwAHgAbAFAAHgAEACsAKwAEAAQABAArAFAAUABQAFAAUABQACsAKwArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQACsAUABQACsAKwAEACsABAAEAAQABAAEACsAKwArACsABAAEACsAKwAEAAQABAArACsAKwAEACsAKwArACsAKwArACsAUABQAFAAUAArAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLAAQABABQAFAAUAAEAB4AKwArACsAKwArACsAKwArACsAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQACsAKwAEAFAABAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAArACsAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAB4AGwArACsAKwArACsAKwArAFAABAAEAAQABAAEAAQAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABAArACsAKwArACsAKwArAAQABAAEACsAKwArACsAUABQACsAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAB4AUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAAQAUAArAFAAUABQAFAAUABQACsAKwArAFAAUABQACsAUABQAFAAUAArACsAKwBQAFAAKwBQACsAUABQACsAKwArAFAAUAArACsAKwBQAFAAUAArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArAAQABAAEAAQABAArACsAKwAEAAQABAArAAQABAAEAAQAKwArAFAAKwArACsAKwArACsABAArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAHgAeAB4AHgAeAB4AGwAeACsAKwArACsAKwAEAAQABAAEAAQAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAUAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAAEACsAKwArACsAKwArACsABAAEACsAUABQAFAAKwArACsAKwArAFAAUAAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKwAOAFAAUABQAFAAUABQAFAAHgBQAAQABAAEAA4AUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAKwArAAQAUAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAAEACsAKwArACsAKwArACsABAAEACsAKwArACsAKwArACsAUAArAFAAUAAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwBQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAFAABAAEAAQABAAEAAQABAArAAQABAAEACsABAAEAAQABABQAB4AKwArACsAKwBQAFAAUAAEAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQABoAUABQAFAAUABQAFAAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQACsAUAArACsAUABQAFAAUABQAFAAUAArACsAKwAEACsAKwArACsABAAEAAQABAAEAAQAKwAEACsABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArAAQABAAeACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAXAAqACoAKgAqACoAKgAqACsAKwArACsAGwBcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAeAEsASwBLAEsASwBLAEsASwBLAEsADQANACsAKwArACsAKwBcAFwAKwBcACsAXABcAFwAXABcACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAXAArAFwAXABcAFwAXABcAFwAXABcAFwAKgBcAFwAKgAqACoAKgAqACoAKgAqACoAXAArACsAXABcAFwAXABcACsAXAArACoAKgAqACoAKgAqACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwBcAFwAXABcAFAADgAOAA4ADgAeAA4ADgAJAA4ADgANAAkAEwATABMAEwATAAkAHgATAB4AHgAeAAQABAAeAB4AHgAeAB4AHgBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQAFAADQAEAB4ABAAeAAQAFgARABYAEQAEAAQAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQADQAEAAQABAAEAAQADQAEAAQAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAA0ADQAeAB4AHgAeAB4AHgAEAB4AHgAeAB4AHgAeACsAHgAeAA4ADgANAA4AHgAeAB4AHgAeAAkACQArACsAKwArACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgBcAEsASwBLAEsASwBLAEsASwBLAEsADQANAB4AHgAeAB4AXABcAFwAXABcAFwAKgAqACoAKgBcAFwAXABcACoAKgAqAFwAKgAqACoAXABcACoAKgAqACoAKgAqACoAXABcAFwAKgAqACoAKgBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKgAqAFwAKgBLAEsASwBLAEsASwBLAEsASwBLACoAKgAqACoAKgAqAFAAUABQAFAAUABQACsAUAArACsAKwArACsAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgBQAFAAUABQAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAKwBQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsABAAEAAQAHgANAB4AHgAeAB4AHgAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUAArACsADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAWABEAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAA0ADQANAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAANAA0AKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUAArAAQABAArACsAKwArACsAKwArACsAKwArACsAKwBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqAA0ADQAVAFwADQAeAA0AGwBcACoAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwAeAB4AEwATAA0ADQAOAB4AEwATAB4ABAAEAAQACQArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUAAEAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAHgArACsAKwATABMASwBLAEsASwBLAEsASwBLAEsASwBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAArACsAXABcAFwAXABcACsAKwArACsAKwArACsAKwArACsAKwBcAFwAXABcAFwAXABcAFwAXABcAFwAXAArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAXAArACsAKwAqACoAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAArACsAHgAeAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKwAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKwArAAQASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArACoAKgAqACoAKgAqACoAXAAqACoAKgAqACoAKgArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABABQAFAAUABQAFAAUABQACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwANAA0AHgANAA0ADQANAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQAHgAeAB4AHgAeAB4AHgAeAB4AKwArACsABAAEAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwAeAB4AHgAeAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArAA0ADQANAA0ADQBLAEsASwBLAEsASwBLAEsASwBLACsAKwArAFAAUABQAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAA0ADQBQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUAAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArAAQABAAEAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAAQAUABQAFAAUABQAFAABABQAFAABAAEAAQAUAArACsAKwArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAKwBQACsAUAArAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAFAAUABQACsAHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQACsAKwAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQACsAHgAeAB4AHgAeAB4AHgAOAB4AKwANAA0ADQANAA0ADQANAAkADQANAA0ACAAEAAsABAAEAA0ACQANAA0ADAAdAB0AHgAXABcAFgAXABcAFwAWABcAHQAdAB4AHgAUABQAFAANAAEAAQAEAAQABAAEAAQACQAaABoAGgAaABoAGgAaABoAHgAXABcAHQAVABUAHgAeAB4AHgAeAB4AGAAWABEAFQAVABUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ADQAeAA0ADQANAA0AHgANAA0ADQAHAB4AHgAeAB4AKwAEAAQABAAEAAQABAAEAAQABAAEAFAAUAArACsATwBQAFAAUABQAFAAHgAeAB4AFgARAE8AUABPAE8ATwBPAFAAUABQAFAAUAAeAB4AHgAWABEAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArABsAGwAbABsAGwAbABsAGgAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGgAbABsAGwAbABoAGwAbABoAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAHgAeAFAAGgAeAB0AHgBQAB4AGgAeAB4AHgAeAB4AHgAeAB4AHgBPAB4AUAAbAB4AHgBQAFAAUABQAFAAHgAeAB4AHQAdAB4AUAAeAFAAHgBQAB4AUABPAFAAUAAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAHgBQAFAAUABQAE8ATwBQAFAAUABQAFAATwBQAFAATwBQAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAFAAUABQAFAATwBPAE8ATwBPAE8ATwBPAE8ATwBQAFAAUABQAFAAUABQAFAAUAAeAB4AUABQAFAAUABPAB4AHgArACsAKwArAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHQAdAB4AHgAeAB0AHQAeAB4AHQAeAB4AHgAdAB4AHQAbABsAHgAdAB4AHgAeAB4AHQAeAB4AHQAdAB0AHQAeAB4AHQAeAB0AHgAdAB0AHQAdAB0AHQAeAB0AHgAeAB4AHgAeAB0AHQAdAB0AHgAeAB4AHgAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHgAeAB0AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAeAB0AHQAdAB0AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAeAB4AHgAdAB4AHgAeAB4AHgAeAB4AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABYAEQAWABEAHgAeAB4AHgAeAB4AHQAeAB4AHgAeAB4AHgAeACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAWABEAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAFAAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAeAB4AHQAdAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHQAdAB4AHgAeAB4AHQAdAB0AHgAeAB0AHgAeAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlAB4AHQAdAB4AHgAdAB4AHgAeAB4AHQAdAB4AHgAeAB4AJQAlAB0AHQAlAB4AJQAlACUAIAAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAeAB4AHgAeAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAdAB0AHQAeAB0AJQAdAB0AHgAdAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAdAB0AHQAdACUAHgAlACUAJQAdACUAJQAdAB0AHQAlACUAHQAdACUAHQAdACUAJQAlAB4AHQAeAB4AHgAeAB0AHQAlAB0AHQAdAB0AHQAdACUAJQAlACUAJQAdACUAJQAgACUAHQAdACUAJQAlACUAJQAlACUAJQAeAB4AHgAlACUAIAAgACAAIAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AFwAXABcAFwAXABcAHgATABMAJQAeAB4AHgAWABEAFgARABYAEQAWABEAFgARABYAEQAWABEATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAWABEAFgARABYAEQAWABEAFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFgARABYAEQAWABEAFgARABYAEQAWABEAFgARABYAEQAWABEAFgARABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAWABEAFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAEAAQABAAeAB4AKwArACsAKwArABMADQANAA0AUAATAA0AUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUAANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAA0ADQANAA0ADQANAA0ADQAeAA0AFgANAB4AHgAXABcAHgAeABcAFwAWABEAFgARABYAEQAWABEADQANAA0ADQATAFAADQANAB4ADQANAB4AHgAeAB4AHgAMAAwADQANAA0AHgANAA0AFgANAA0ADQANAA0ADQANAA0AHgANAB4ADQANAB4AHgAeACsAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArAA0AEQARACUAJQBHAFcAVwAWABEAFgARABYAEQAWABEAFgARACUAJQAWABEAFgARABYAEQAWABEAFQAWABEAEQAlAFcAVwBXAFcAVwBXAFcAVwBXAAQABAAEAAQABAAEACUAVwBXAFcAVwA2ACUAJQBXAFcAVwBHAEcAJQAlACUAKwBRAFcAUQBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFEAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBRAFcAUQBXAFEAVwBXAFcAVwBXAFcAUQBXAFcAVwBXAFcAVwBRAFEAKwArAAQABAAVABUARwBHAFcAFQBRAFcAUQBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBRAFcAVwBXAFcAVwBXAFEAUQBXAFcAVwBXABUAUQBHAEcAVwArACsAKwArACsAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwAlACUAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACsAKwArACsAKwArACsAKwArACsAKwArAFEAUQBRAFEAUQBRAFEAUQBRAFEAUQBRAFEAUQBRAFEAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBPAE8ATwBPAE8ATwBPAE8AJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADQATAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABLAEsASwBLAEsASwBLAEsASwBLAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAABAAEAAQABAAeAAQABAAEAAQABAAEAAQABAAEAAQAHgBQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUABQAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAeAA0ADQANAA0ADQArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAB4AHgAeAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAAQAUABQAFAABABQAFAAUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAeAB4AHgAeAAQAKwArACsAUABQAFAAUABQAFAAHgAeABoAHgArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADgAOABMAEwArACsAKwArACsAKwArACsABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwANAA0ASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUAAeAB4AHgBQAA4AUABQAAQAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAA0ADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArAB4AWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYACsAKwArAAQAHgAeAB4AHgAeAB4ADQANAA0AHgAeAB4AHgArAFAASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArAB4AHgBcAFwAXABcAFwAKgBcAFwAXABcAFwAXABcAFwAXABcAEsASwBLAEsASwBLAEsASwBLAEsAXABcAFwAXABcACsAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArAFAAUABQAAQAUABQAFAAUABQAFAAUABQAAQABAArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAHgANAA0ADQBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAXAAqACoAKgBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAKgAqACoAXABcACoAKgBcAFwAXABcAFwAKgAqAFwAKgBcACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcACoAKgBQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAA0ADQBQAFAAUAAEAAQAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQADQAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAVABVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBUAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVACsAKwArACsAKwArACsAKwArACsAKwArAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAKwArACsAKwBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAKwArACsAKwAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAKwArACsAKwArAFYABABWAFYAVgBWAFYAVgBWAFYAVgBWAB4AVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgArAFYAVgBWAFYAVgArAFYAKwBWAFYAKwBWAFYAKwBWAFYAVgBWAFYAVgBWAFYAVgBWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAEQAWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAaAB4AKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAGAARABEAGAAYABMAEwAWABEAFAArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACUAJQAlACUAJQAWABEAFgARABYAEQAWABEAFgARABYAEQAlACUAFgARACUAJQAlACUAJQAlACUAEQAlABEAKwAVABUAEwATACUAFgARABYAEQAWABEAJQAlACUAJQAlACUAJQAlACsAJQAbABoAJQArACsAKwArAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAcAKwATACUAJQAbABoAJQAlABYAEQAlACUAEQAlABEAJQBXAFcAVwBXAFcAVwBXAFcAVwBXABUAFQAlACUAJQATACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXABYAJQARACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAWACUAEQAlABYAEQARABYAEQARABUAVwBRAFEAUQBRAFEAUQBRAFEAUQBRAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcARwArACsAVwBXAFcAVwBXAFcAKwArAFcAVwBXAFcAVwBXACsAKwBXAFcAVwBXAFcAVwArACsAVwBXAFcAKwArACsAGgAbACUAJQAlABsAGwArAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwAEAAQABAAQAB0AKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsADQANAA0AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAAQAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAA0AUABQAFAAUAArACsAKwArAFAAUABQAFAAUABQAFAAUAANAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAKwArAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUAArACsAKwBQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAUABQAFAAUABQAAQABAAEACsABAAEACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAKwBQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEACsAKwArACsABABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAA0ADQANAA0ADQANAA0ADQAeACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAArACsAKwArAFAAUABQAFAAUAANAA0ADQANAA0ADQAUACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsADQANAA0ADQANAA0ADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAAQABAAEAAQAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArAAQABAANACsAKwBQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAB4AHgAeAB4AHgArACsAKwArACsAKwAEAAQABAAEAAQABAAEAA0ADQAeAB4AHgAeAB4AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwAeACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsASwBLAEsASwBLAEsASwBLAEsASwANAA0ADQANAFAABAAEAFAAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAeAA4AUAArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAADQANAB4ADQAEAAQABAAEAB4ABAAEAEsASwBLAEsASwBLAEsASwBLAEsAUAAOAFAADQANAA0AKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAANAA0AHgANAA0AHgAEACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAA0AKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsABAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQACsABAAEAFAABAAEAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABAArACsAUAArACsAKwArACsAKwAEACsAKwArACsAKwBQAFAAUABQAFAABAAEACsAKwAEAAQABAAEAAQABAAEACsAKwArAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAAQABABQAFAAUABQAA0ADQANAA0AHgBLAEsASwBLAEsASwBLAEsASwBLAA0ADQArAB4ABABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAFAAUAAeAFAAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAArACsABAAEAAQABAAEAAQABAAEAAQADgANAA0AEwATAB4AHgAeAA0ADQANAA0ADQANAA0ADQANAA0ADQANAA0ADQANAFAAUABQAFAABAAEACsAKwAEAA0ADQAeAFAAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKwArACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBcAFwADQANAA0AKgBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAKwArAFAAKwArAFAAUABQAFAAUABQAFAAUAArAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQAKwAEAAQAKwArAAQABAAEAAQAUAAEAFAABAAEAA0ADQANACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAArACsABAAEAAQABAAEAAQABABQAA4AUAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAFAABAAEAAQABAAOAB4ADQANAA0ADQAOAB4ABAArACsAKwArACsAKwArACsAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAA0ADQANAFAADgAOAA4ADQANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAAQABAAEAFAADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwAOABMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAArACsAKwAEACsABAAEACsABAAEAAQABAAEAAQABABQAAQAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAKwBQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQAKwAEAAQAKwAEAAQABAAEAAQAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAaABoAGgAaAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABIAEgAQwBDAEMAUABQAFAAUABDAFAAUABQAEgAQwBIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABDAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwAJAAkACQAJAAkACQAJABYAEQArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwANAA0AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAANACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAA0ADQANAB4AHgAeAB4AHgAeAFAAUABQAFAADQAeACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAANAA0AHgAeACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwAEAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAARwBHABUARwAJACsAKwArACsAKwArACsAKwArACsAKwAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACsAKwArACsAKwArACsAKwBXAFcAVwBXAFcAVwBXAFcAVwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUQBRAFEAKwArACsAKwArACsAKwArACsAKwArACsAKwBRAFEAUQBRACsAKwArACsAKwArACsAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArACsAHgAEAAQADQAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAAQABAAEAAQABAAeAB4AHgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4AHgAEAAQABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQAHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwBQAFAAKwArAFAAKwArAFAAUAArACsAUABQAFAAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAUAArAFAAUABQAFAAUABQAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAHgAeAFAAUABQAFAAUAArAFAAKwArACsAUABQAFAAUABQAFAAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeACsAKwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4ABAAeAB4AHgAeAB4AHgAeAB4AHgAeAAQAHgAeAA0ADQANAA0AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAAQAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArAAQABAAEAAQABAAEAAQAKwAEAAQAKwAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwBQAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArABsAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArAB4AHgAeAB4ABAAEAAQABAAEAAQABABQACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArABYAFgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAGgBQAFAAUAAaAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAKwBQACsAKwBQACsAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwBQACsAUAArACsAKwArACsAKwBQACsAKwArACsAUAArAFAAKwBQACsAUABQAFAAKwBQAFAAKwBQACsAKwBQACsAUAArAFAAKwBQACsAUAArAFAAUAArAFAAKwArAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUAArAFAAUABQAFAAKwBQACsAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAKwBQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8AJQAlACUAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB4AHgAeACUAJQAlAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAlACUAJQAlACUAHgAlACUAJQAlACUAIAAgACAAJQAlACAAJQAlACAAIAAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACEAIQAhACEAIQAlACUAIAAgACUAJQAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAIAAlACUAJQAlACAAIAAgACUAIAAgACAAJQAlACUAJQAlACUAJQAgACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAlAB4AJQAeACUAJQAlACUAJQAgACUAJQAlACUAHgAlAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACAAIAAgACUAJQAlACAAIAAgACAAIAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABcAFwAXABUAFQAVAB4AHgAeAB4AJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAgACUAJQAgACUAJQAlACUAJQAlACUAJQAgACAAIAAgACAAIAAgACAAJQAlACUAJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAgACAAIAAgACAAIAAgACAAIAAgACUAJQAgACAAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAlACAAIAAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAgACAAIAAlACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACUAVwBXACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAA==", L = 50, R = 1, z = 2, ee = 3, B = 4, V = 5, H = 7, U = 8, te = 9, ne = 10, re = 11, ie = 12, ae = 13, oe = 14, se = 15, ce = 16, le = 17, ue = 18, de = 19, W = 20, fe = 21, pe = 22, me = 23, he = 24, ge = 25, _e = 26, ve = 27, ye = 28, be = 29, xe = 30, Se = 31, Ce = 32, we = 33, Te = 34, Ee = 35, De = 36, Oe = 37, ke = 38, Ae = 39, je = 40, Me = 41, Ne = 42, Pe = 43, Fe = [9001, 65288], Ie = "!", Le = "×", Re = "÷", ze = j(I), Be = [xe, De], Ve = [ R, z, ee, V ], He = [ne, U], Ue = [ve, _e], We = Ve.concat(He), Ge = [ ke, Ae, je, Te, Ee ], Ke = [se, ae], qe = function(e, t) { t === void 0 && (t = "strict"); var n = [], r = [], i = []; return e.forEach(function(e, a) { var o = ze.get(e); if (o > L ? (i.push(!0), o -= L) : i.push(!1), [ "normal", "auto", "loose" ].indexOf(t) !== -1 && [ 8208, 8211, 12316, 12448 ].indexOf(e) !== -1) return r.push(a), n.push(ce); if (o === B || o === re) { if (a === 0) return r.push(a), n.push(xe); var s = n[a - 1]; return We.indexOf(s) === -1 ? (r.push(r[a - 1]), n.push(s)) : (r.push(a), n.push(xe)); } if (r.push(a), o === Se) return n.push(t === "strict" ? fe : Oe); if (o === Ne || o === be) return n.push(xe); if (o === Pe) return e >= 131072 && e <= 196605 || e >= 196608 && e <= 262141 ? n.push(Oe) : n.push(xe); n.push(o); }), [ r, n, i ]; }, Je = function(e, t, n, r) { var i = r[n]; if (Array.isArray(e) ? e.indexOf(i) !== -1 : e === i) for (var a = n; a <= r.length;) { a++; var o = r[a]; if (o === t) return !0; if (o !== ne) break; } if (i === ne) for (var a = n; a > 0;) { a--; var s = r[a]; if (Array.isArray(e) ? e.indexOf(s) !== -1 : e === s) for (var c = n; c <= r.length;) { c++; var o = r[c]; if (o === t) return !0; if (o !== ne) break; } if (s !== ne) break; } return !1; }, Ye = function(e, t) { for (var n = e; n >= 0;) { var r = t[n]; if (r === ne) n--; else return r; } return 0; }, Xe = function(e, t, n, r, i) { if (n[r] === 0) return Le; var a = r - 1; if (Array.isArray(i) && i[a] === !0) return Le; var o = a - 1, s = a + 1, c = t[a], l = o >= 0 ? t[o] : 0, u = t[s]; if (c === z && u === ee) return Le; if (Ve.indexOf(c) !== -1) return Ie; if (Ve.indexOf(u) !== -1 || He.indexOf(u) !== -1) return Le; if (Ye(a, t) === U) return Re; if (ze.get(e[a]) === re || (c === Ce || c === we) && ze.get(e[s]) === re || c === H || u === H || c === te || [ ne, ae, se ].indexOf(c) === -1 && u === te || [ le, ue, de, he, ye ].indexOf(u) !== -1 || Ye(a, t) === pe || Je(me, pe, a, t) || Je([le, ue], fe, a, t) || Je(ie, ie, a, t)) return Le; if (c === ne) return Re; if (c === me || u === me) return Le; if (u === ce || c === ce) return Re; if ([ ae, se, fe ].indexOf(u) !== -1 || c === oe || l === De && Ke.indexOf(c) !== -1 || c === ye && u === De || u === W || Be.indexOf(u) !== -1 && c === ge || Be.indexOf(c) !== -1 && u === ge || c === ve && [ Oe, Ce, we ].indexOf(u) !== -1 || [ Oe, Ce, we ].indexOf(c) !== -1 && u === _e || Be.indexOf(c) !== -1 && Ue.indexOf(u) !== -1 || Ue.indexOf(c) !== -1 && Be.indexOf(u) !== -1 || [ve, _e].indexOf(c) !== -1 && (u === ge || [pe, se].indexOf(u) !== -1 && t[s + 1] === ge) || [pe, se].indexOf(c) !== -1 && u === ge || c === ge && [ ge, ye, he ].indexOf(u) !== -1) return Le; if ([ ge, ye, he, le, ue ].indexOf(u) !== -1) for (var d = a; d >= 0;) { var f = t[d]; if (f === ge) return Le; if ([ye, he].indexOf(f) !== -1) d--; else break; } if ([ve, _e].indexOf(u) !== -1) for (var d = [le, ue].indexOf(c) === -1 ? a : o; d >= 0;) { var f = t[d]; if (f === ge) return Le; if ([ye, he].indexOf(f) !== -1) d--; else break; } if (ke === c && [ ke, Ae, Te, Ee ].indexOf(u) !== -1 || [Ae, Te].indexOf(c) !== -1 && [Ae, je].indexOf(u) !== -1 || [je, Ee].indexOf(c) !== -1 && u === je || Ge.indexOf(c) !== -1 && [W, _e].indexOf(u) !== -1 || Ge.indexOf(u) !== -1 && c === ve || Be.indexOf(c) !== -1 && Be.indexOf(u) !== -1 || c === he && Be.indexOf(u) !== -1 || Be.concat(ge).indexOf(c) !== -1 && u === pe && Fe.indexOf(e[s]) === -1 || Be.concat(ge).indexOf(u) !== -1 && c === ue) return Le; if (c === Me && u === Me) { for (var p = n[a], m = 1; p > 0 && (p--, t[p] === Me);) m++; if (m % 2 != 0) return Le; } return c === Ce && u === we ? Le : Re; }, Ze = function(e, t) { t ||= { lineBreak: "normal", wordBreak: "normal" }; var n = qe(e, t.lineBreak), r = n[0], i = n[1], a = n[2]; (t.wordBreak === "break-all" || t.wordBreak === "break-word") && (i = i.map(function(e) { return [ ge, xe, Ne ].indexOf(e) === -1 ? e : Oe; })); var o = t.wordBreak === "keep-all" ? a.map(function(t, n) { return t && e[n] >= 19968 && e[n] <= 40959; }) : void 0; return [ r, i, o ]; }, Qe = function() { function e(e, t, n, r) { this.codePoints = e, this.required = t === Ie, this.start = n, this.end = r; } return e.prototype.slice = function() { return u.apply(void 0, this.codePoints.slice(this.start, this.end)); }, e; }(), $e = function(e, t) { var n = l(e), r = Ze(n, t), i = r[0], a = r[1], o = r[2], s = n.length, c = 0, u = 0; return { next: function() { if (u >= s) return { done: !0, value: null }; for (var e = Le; u < s && (e = Xe(n, a, i, ++u, o)) === Le;); if (e !== Le || u === s) { var t = new Qe(n, e, c, u); return c = u, { value: t, done: !1 }; } return { done: !0, value: null }; } }; }, et = 1, tt = 2, nt = 4, rt = 8, it = 10, at = 47, ot = 92, st = 9, ct = 32, lt = 34, ut = 61, dt = 35, ft = 36, pt = 37, mt = 39, ht = 40, gt = 41, _t = 95, vt = 45, yt = 33, bt = 60, xt = 62, St = 64, Ct = 91, wt = 93, Tt = 61, Et = 123, Dt = 63, Ot = 125, kt = 124, At = 126, jt = 128, Mt = 65533, Nt = 42, Pt = 43, Ft = 44, It = 58, Lt = 59, Rt = 46, zt = 0, Bt = 8, Vt = 11, Ht = 14, Ut = 31, Wt = 127, Gt = -1, Kt = 48, qt = 97, Jt = 101, Yt = 102, Xt = 117, Zt = 122, Qt = 65, $t = 69, en = 70, tn = 85, nn = 90, rn = function(e) { return e >= Kt && e <= 57; }, an = function(e) { return e >= 55296 && e <= 57343; }, on = function(e) { return rn(e) || e >= Qt && e <= en || e >= qt && e <= Yt; }, sn = function(e) { return e >= qt && e <= Zt; }, cn = function(e) { return e >= Qt && e <= nn; }, ln = function(e) { return sn(e) || cn(e); }, un = function(e) { return e >= jt; }, dn = function(e) { return e === it || e === st || e === ct; }, fn = function(e) { return ln(e) || un(e) || e === _t; }, pn = function(e) { return fn(e) || rn(e) || e === vt; }, mn = function(e) { return e >= zt && e <= Bt || e === Vt || e >= Ht && e <= Ut || e === Wt; }, hn = function(e, t) { return e === ot ? t !== it : !1; }, gn = function(e, t, n) { return e === vt ? fn(t) || hn(t, n) : fn(e) ? !0 : !!(e === ot && hn(e, t)); }, _n = function(e, t, n) { return e === Pt || e === vt ? rn(t) ? !0 : t === Rt && rn(n) : rn(e === Rt ? t : e); }, vn = function(e) { var t = 0, n = 1; (e[t] === Pt || e[t] === vt) && (e[t] === vt && (n = -1), t++); for (var r = []; rn(e[t]);) r.push(e[t++]); var i = r.length ? parseInt(u.apply(void 0, r), 10) : 0; e[t] === Rt && t++; for (var a = []; rn(e[t]);) a.push(e[t++]); var o = a.length, s = o ? parseInt(u.apply(void 0, a), 10) : 0; (e[t] === $t || e[t] === Jt) && t++; var c = 1; (e[t] === Pt || e[t] === vt) && (e[t] === vt && (c = -1), t++); for (var l = []; rn(e[t]);) l.push(e[t++]); var d = l.length ? parseInt(u.apply(void 0, l), 10) : 0; return n * (i + s * 10 ** -o) * 10 ** (c * d); }, yn = { type: 2 }, bn = { type: 3 }, xn = { type: 4 }, Sn = { type: 13 }, Cn = { type: 8 }, wn = { type: 21 }, Tn = { type: 9 }, En = { type: 10 }, Dn = { type: 11 }, On = { type: 12 }, kn = { type: 14 }, An = { type: 23 }, jn = { type: 1 }, Mn = { type: 25 }, Nn = { type: 24 }, Pn = { type: 26 }, Fn = { type: 27 }, In = { type: 28 }, Ln = { type: 29 }, Rn = { type: 31 }, zn = { type: 32 }, Bn = function() { function e() { this._value = []; } return e.prototype.write = function(e) { this._value = this._value.concat(l(e)); }, e.prototype.read = function() { for (var e = [], t = this.consumeToken(); t !== zn;) e.push(t), t = this.consumeToken(); return e; }, e.prototype.consumeToken = function() { var e = this.consumeCodePoint(); switch (e) { case lt: return this.consumeStringToken(lt); case dt: var t = this.peekCodePoint(0), n = this.peekCodePoint(1), r = this.peekCodePoint(2); if (pn(t) || hn(n, r)) { var i = gn(t, n, r) ? tt : et, a = this.consumeName(); return { type: 5, value: a, flags: i }; } break; case ft: if (this.peekCodePoint(0) === ut) return this.consumeCodePoint(), Sn; break; case mt: return this.consumeStringToken(mt); case ht: return yn; case gt: return bn; case Nt: if (this.peekCodePoint(0) === ut) return this.consumeCodePoint(), kn; break; case Pt: if (_n(e, this.peekCodePoint(0), this.peekCodePoint(1))) return this.reconsumeCodePoint(e), this.consumeNumericToken(); break; case Ft: return xn; case vt: var o = e, s = this.peekCodePoint(0), c = this.peekCodePoint(1); if (_n(o, s, c)) return this.reconsumeCodePoint(e), this.consumeNumericToken(); if (gn(o, s, c)) return this.reconsumeCodePoint(e), this.consumeIdentLikeToken(); if (s === vt && c === xt) return this.consumeCodePoint(), this.consumeCodePoint(), Nn; break; case Rt: if (_n(e, this.peekCodePoint(0), this.peekCodePoint(1))) return this.reconsumeCodePoint(e), this.consumeNumericToken(); break; case at: if (this.peekCodePoint(0) === Nt) for (this.consumeCodePoint();;) { var l = this.consumeCodePoint(); if (l === Nt && (l = this.consumeCodePoint(), l === at) || l === Gt) return this.consumeToken(); } break; case It: return Pn; case Lt: return Fn; case bt: if (this.peekCodePoint(0) === yt && this.peekCodePoint(1) === vt && this.peekCodePoint(2) === vt) return this.consumeCodePoint(), this.consumeCodePoint(), Mn; break; case St: if (gn(this.peekCodePoint(0), this.peekCodePoint(1), this.peekCodePoint(2))) { var a = this.consumeName(); return { type: 7, value: a }; } break; case Ct: return In; case ot: if (hn(e, this.peekCodePoint(0))) return this.reconsumeCodePoint(e), this.consumeIdentLikeToken(); break; case wt: return Ln; case Tt: if (this.peekCodePoint(0) === ut) return this.consumeCodePoint(), Cn; break; case Et: return Dn; case Ot: return On; case Xt: case tn: var d = this.peekCodePoint(0), f = this.peekCodePoint(1); return d === Pt && (on(f) || f === Dt) && (this.consumeCodePoint(), this.consumeUnicodeRangeToken()), this.reconsumeCodePoint(e), this.consumeIdentLikeToken(); case kt: if (this.peekCodePoint(0) === ut) return this.consumeCodePoint(), Tn; if (this.peekCodePoint(0) === kt) return this.consumeCodePoint(), wn; break; case At: if (this.peekCodePoint(0) === ut) return this.consumeCodePoint(), En; break; case Gt: return zn; } return dn(e) ? (this.consumeWhiteSpace(), Rn) : rn(e) ? (this.reconsumeCodePoint(e), this.consumeNumericToken()) : fn(e) ? (this.reconsumeCodePoint(e), this.consumeIdentLikeToken()) : { type: 6, value: u(e) }; }, e.prototype.consumeCodePoint = function() { var e = this._value.shift(); return e === void 0 ? -1 : e; }, e.prototype.reconsumeCodePoint = function(e) { this._value.unshift(e); }, e.prototype.peekCodePoint = function(e) { return e >= this._value.length ? -1 : this._value[e]; }, e.prototype.consumeUnicodeRangeToken = function() { for (var e = [], t = this.consumeCodePoint(); on(t) && e.length < 6;) e.push(t), t = this.consumeCodePoint(); for (var n = !1; t === Dt && e.length < 6;) e.push(t), t = this.consumeCodePoint(), n = !0; if (n) { var r = parseInt(u.apply(void 0, e.map(function(e) { return e === Dt ? Kt : e; })), 16), i = parseInt(u.apply(void 0, e.map(function(e) { return e === Dt ? en : e; })), 16); return { type: 30, start: r, end: i }; } var a = parseInt(u.apply(void 0, e), 16); if (this.peekCodePoint(0) === vt && on(this.peekCodePoint(1))) { this.consumeCodePoint(), t = this.consumeCodePoint(); for (var o = []; on(t) && o.length < 6;) o.push(t), t = this.consumeCodePoint(); var i = parseInt(u.apply(void 0, o), 16); return { type: 30, start: a, end: i }; } else return { type: 30, start: a, end: a }; }, e.prototype.consumeIdentLikeToken = function() { var e = this.consumeName(); return e.toLowerCase() === "url" && this.peekCodePoint(0) === ht ? (this.consumeCodePoint(), this.consumeUrlToken()) : this.peekCodePoint(0) === ht ? (this.consumeCodePoint(), { type: 19, value: e }) : { type: 20, value: e }; }, e.prototype.consumeUrlToken = function() { var e = []; if (this.consumeWhiteSpace(), this.peekCodePoint(0) === Gt) return { type: 22, value: "" }; var t = this.peekCodePoint(0); if (t === mt || t === lt) { var n = this.consumeStringToken(this.consumeCodePoint()); return n.type === 0 && (this.consumeWhiteSpace(), this.peekCodePoint(0) === Gt || this.peekCodePoint(0) === gt) ? (this.consumeCodePoint(), { type: 22, value: n.value }) : (this.consumeBadUrlRemnants(), An); } for (;;) { var r = this.consumeCodePoint(); if (r === Gt || r === gt) return { type: 22, value: u.apply(void 0, e) }; if (dn(r)) return this.consumeWhiteSpace(), this.peekCodePoint(0) === Gt || this.peekCodePoint(0) === gt ? (this.consumeCodePoint(), { type: 22, value: u.apply(void 0, e) }) : (this.consumeBadUrlRemnants(), An); if (r === lt || r === mt || r === ht || mn(r)) return this.consumeBadUrlRemnants(), An; if (r === ot) if (hn(r, this.peekCodePoint(0))) e.push(this.consumeEscapedCodePoint()); else return this.consumeBadUrlRemnants(), An; else e.push(r); } }, e.prototype.consumeWhiteSpace = function() { for (; dn(this.peekCodePoint(0));) this.consumeCodePoint(); }, e.prototype.consumeBadUrlRemnants = function() { for (;;) { var e = this.consumeCodePoint(); if (e === gt || e === Gt) return; hn(e, this.peekCodePoint(0)) && this.consumeEscapedCodePoint(); } }, e.prototype.consumeStringSlice = function(e) { for (var t = 5e4, n = ""; e > 0;) { var r = Math.min(t, e); n += u.apply(void 0, this._value.splice(0, r)), e -= r; } return this._value.shift(), n; }, e.prototype.consumeStringToken = function(e) { var t = "", n = 0; do { var r = this._value[n]; if (r === Gt || r === void 0 || r === e) return t += this.consumeStringSlice(n), { type: 0, value: t }; if (r === it) return this._value.splice(0, n), jn; if (r === ot) { var i = this._value[n + 1]; i !== Gt && i !== void 0 && (i === it ? (t += this.consumeStringSlice(n), n = -1, this._value.shift()) : hn(r, i) && (t += this.consumeStringSlice(n), t += u(this.consumeEscapedCodePoint()), n = -1)); } n++; } while (!0); }, e.prototype.consumeNumber = function() { var e = [], t = nt, n = this.peekCodePoint(0); for ((n === Pt || n === vt) && e.push(this.consumeCodePoint()); rn(this.peekCodePoint(0));) e.push(this.consumeCodePoint()); n = this.peekCodePoint(0); var r = this.peekCodePoint(1); if (n === Rt && rn(r)) for (e.push(this.consumeCodePoint(), this.consumeCodePoint()), t = rt; rn(this.peekCodePoint(0));) e.push(this.consumeCodePoint()); n = this.peekCodePoint(0), r = this.peekCodePoint(1); var i = this.peekCodePoint(2); if ((n === $t || n === Jt) && ((r === Pt || r === vt) && rn(i) || rn(r))) for (e.push(this.consumeCodePoint(), this.consumeCodePoint()), t = rt; rn(this.peekCodePoint(0));) e.push(this.consumeCodePoint()); return [vn(e), t]; }, e.prototype.consumeNumericToken = function() { var e = this.consumeNumber(), t = e[0], n = e[1], r = this.peekCodePoint(0); return gn(r, this.peekCodePoint(1), this.peekCodePoint(2)) ? { type: 15, number: t, flags: n, unit: this.consumeName() } : r === pt ? (this.consumeCodePoint(), { type: 16, number: t, flags: n }) : { type: 17, number: t, flags: n }; }, e.prototype.consumeEscapedCodePoint = function() { var e = this.consumeCodePoint(); if (on(e)) { for (var t = u(e); on(this.peekCodePoint(0)) && t.length < 6;) t += u(this.consumeCodePoint()); dn(this.peekCodePoint(0)) && this.consumeCodePoint(); var n = parseInt(t, 16); return n === 0 || an(n) || n > 1114111 ? Mt : n; } return e === Gt ? Mt : e; }, e.prototype.consumeName = function() { for (var e = "";;) { var t = this.consumeCodePoint(); if (pn(t)) e += u(t); else if (hn(t, this.peekCodePoint(0))) e += u(this.consumeEscapedCodePoint()); else return this.reconsumeCodePoint(t), e; } }, e; }(), Vn = function() { function e(e) { this._tokens = e; } return e.create = function(t) { var n = new Bn(); return n.write(t), new e(n.read()); }, e.parseValue = function(t) { return e.create(t).parseComponentValue(); }, e.parseValues = function(t) { return e.create(t).parseComponentValues(); }, e.prototype.parseComponentValue = function() { for (var e = this.consumeToken(); e.type === 31;) e = this.consumeToken(); if (e.type === 32) throw SyntaxError("Error parsing CSS component value, unexpected EOF"); this.reconsumeToken(e); var t = this.consumeComponentValue(); do e = this.consumeToken(); while (e.type === 31); if (e.type === 32) return t; throw SyntaxError("Error parsing CSS component value, multiple values found when expecting only one"); }, e.prototype.parseComponentValues = function() { for (var e = [];;) { var t = this.consumeComponentValue(); if (t.type === 32) return e; e.push(t), e.push(); } }, e.prototype.consumeComponentValue = function() { var e = this.consumeToken(); switch (e.type) { case 11: case 28: case 2: return this.consumeSimpleBlock(e.type); case 19: return this.consumeFunction(e); } return e; }, e.prototype.consumeSimpleBlock = function(e) { for (var t = { type: e, values: [] }, n = this.consumeToken();;) { if (n.type === 32 || Xn(n, e)) return t; this.reconsumeToken(n), t.values.push(this.consumeComponentValue()), n = this.consumeToken(); } }, e.prototype.consumeFunction = function(e) { for (var t = { name: e.value, values: [], type: 18 };;) { var n = this.consumeToken(); if (n.type === 32 || n.type === 3) return t; this.reconsumeToken(n), t.values.push(this.consumeComponentValue()); } }, e.prototype.consumeToken = function() { var e = this._tokens.shift(); return e === void 0 ? zn : e; }, e.prototype.reconsumeToken = function(e) { this._tokens.unshift(e); }, e; }(), Hn = function(e) { return e.type === 15; }, Un = function(e) { return e.type === 17; }, Wn = function(e) { return e.type === 20; }, Gn = function(e) { return e.type === 0; }, Kn = function(e, t) { return Wn(e) && e.value === t; }, qn = function(e) { return e.type !== 31; }, Jn = function(e) { return e.type !== 31 && e.type !== 4; }, Yn = function(e) { var t = [], n = []; return e.forEach(function(e) { if (e.type === 4) { if (n.length === 0) throw Error("Error parsing function args, zero tokens for arg"); t.push(n), n = []; return; } e.type !== 31 && n.push(e); }), n.length && t.push(n), t; }, Xn = function(e, t) { return t === 11 && e.type === 12 || t === 28 && e.type === 29 ? !0 : t === 2 && e.type === 3; }, Zn = function(e) { return e.type === 17 || e.type === 15; }, Qn = function(e) { return e.type === 16 || Zn(e); }, $n = function(e) { return e.length > 1 ? [e[0], e[1]] : [e[0]]; }, er = { type: 17, number: 0, flags: nt }, tr = { type: 16, number: 50, flags: nt }, nr = { type: 16, number: 100, flags: nt }, rr = function(e, t, n) { var r = e[0], i = e[1]; return [G(r, t), G(i === void 0 ? r : i, n)]; }, G = function(e, t) { if (e.type === 16) return e.number / 100 * t; if (Hn(e)) switch (e.unit) { case "rem": case "em": return 16 * e.number; default: return e.number; } return e.number; }, ir = "deg", ar = "grad", or = "rad", sr = "turn", cr = { name: "angle", parse: function(e, t) { if (t.type === 15) switch (t.unit) { case ir: return Math.PI * t.number / 180; case ar: return Math.PI / 200 * t.number; case or: return t.number; case sr: return Math.PI * 2 * t.number; } throw Error("Unsupported angle type"); } }, lr = function(e) { return e.type === 15 && (e.unit === ir || e.unit === ar || e.unit === or || e.unit === sr); }, ur = function(e) { switch (e.filter(Wn).map(function(e) { return e.value; }).join(" ")) { case "to bottom right": case "to right bottom": case "left top": case "top left": return [er, er]; case "to top": case "bottom": return dr(0); case "to bottom left": case "to left bottom": case "right top": case "top right": return [er, nr]; case "to right": case "left": return dr(90); case "to top left": case "to left top": case "right bottom": case "bottom right": return [nr, nr]; case "to bottom": case "top": return dr(180); case "to top right": case "to right top": case "left bottom": case "bottom left": return [nr, er]; case "to left": case "right": return dr(270); } return 0; }, dr = function(e) { return Math.PI * e / 180; }, fr = { name: "color", parse: function(e, t) { if (t.type === 18) { var n = br[t.name]; if (n === void 0) throw Error("Attempting to parse an unsupported color function \"" + t.name + "\""); return n(e, t.values); } if (t.type === 5) { if (t.value.length === 3) { var r = t.value.substring(0, 1), i = t.value.substring(1, 2), a = t.value.substring(2, 3); return hr(parseInt(r + r, 16), parseInt(i + i, 16), parseInt(a + a, 16), 1); } if (t.value.length === 4) { var r = t.value.substring(0, 1), i = t.value.substring(1, 2), a = t.value.substring(2, 3), o = t.value.substring(3, 4); return hr(parseInt(r + r, 16), parseInt(i + i, 16), parseInt(a + a, 16), parseInt(o + o, 16) / 255); } if (t.value.length === 6) { var r = t.value.substring(0, 2), i = t.value.substring(2, 4), a = t.value.substring(4, 6); return hr(parseInt(r, 16), parseInt(i, 16), parseInt(a, 16), 1); } if (t.value.length === 8) { var r = t.value.substring(0, 2), i = t.value.substring(2, 4), a = t.value.substring(4, 6), o = t.value.substring(6, 8); return hr(parseInt(r, 16), parseInt(i, 16), parseInt(a, 16), parseInt(o, 16) / 255); } } if (t.type === 20) { var s = Sr[t.value.toUpperCase()]; if (s !== void 0) return s; } return Sr.TRANSPARENT; } }, pr = function(e) { return (255 & e) == 0; }, mr = function(e) { var t = 255 & e, n = 255 & e >> 8, r = 255 & e >> 16, i = 255 & e >> 24; return t < 255 ? "rgba(" + i + "," + r + "," + n + "," + t / 255 + ")" : "rgb(" + i + "," + r + "," + n + ")"; }, hr = function(e, t, n, r) { return (e << 24 | t << 16 | n << 8 | Math.round(r * 255) << 0) >>> 0; }, gr = function(e, t) { if (e.type === 17) return e.number; if (e.type === 16) { var n = t === 3 ? 1 : 255; return t === 3 ? e.number / 100 * n : Math.round(e.number / 100 * n); } return 0; }, _r = function(e, t) { var n = t.filter(Jn); if (n.length === 3) { var r = n.map(gr), i = r[0], a = r[1], o = r[2]; return hr(i, a, o, 1); } if (n.length === 4) { var s = n.map(gr), i = s[0], a = s[1], o = s[2], c = s[3]; return hr(i, a, o, c); } return 0; }; function vr(e, t, n) { return n < 0 && (n += 1), n >= 1 && --n, n < 1 / 6 ? (t - e) * n * 6 + e : n < 1 / 2 ? t : n < 2 / 3 ? (t - e) * 6 * (2 / 3 - n) + e : e; } var yr = function(e, t) { var n = t.filter(Jn), r = n[0], i = n[1], a = n[2], o = n[3], s = (r.type === 17 ? dr(r.number) : cr.parse(e, r)) / (Math.PI * 2), c = Qn(i) ? i.number / 100 : 0, l = Qn(a) ? a.number / 100 : 0, u = o !== void 0 && Qn(o) ? G(o, 1) : 1; if (c === 0) return hr(l * 255, l * 255, l * 255, 1); var d = l <= .5 ? l * (c + 1) : l + c - l * c, f = l * 2 - d, p = vr(f, d, s + 1 / 3), m = vr(f, d, s), h = vr(f, d, s - 1 / 3); return hr(p * 255, m * 255, h * 255, u); }, br = { hsl: yr, hsla: yr, rgb: _r, rgba: _r }, xr = function(e, t) { return fr.parse(e, Vn.create(t).parseComponentValue()); }, Sr = { ALICEBLUE: 4042850303, ANTIQUEWHITE: 4209760255, AQUA: 16777215, AQUAMARINE: 2147472639, AZURE: 4043309055, BEIGE: 4126530815, BISQUE: 4293182719, BLACK: 255, BLANCHEDALMOND: 4293643775, BLUE: 65535, BLUEVIOLET: 2318131967, BROWN: 2771004159, BURLYWOOD: 3736635391, CADETBLUE: 1604231423, CHARTREUSE: 2147418367, CHOCOLATE: 3530104575, CORAL: 4286533887, CORNFLOWERBLUE: 1687547391, CORNSILK: 4294499583, CRIMSON: 3692313855, CYAN: 16777215, DARKBLUE: 35839, DARKCYAN: 9145343, DARKGOLDENROD: 3095837695, DARKGRAY: 2846468607, DARKGREEN: 6553855, DARKGREY: 2846468607, DARKKHAKI: 3182914559, DARKMAGENTA: 2332068863, DARKOLIVEGREEN: 1433087999, DARKORANGE: 4287365375, DARKORCHID: 2570243327, DARKRED: 2332033279, DARKSALMON: 3918953215, DARKSEAGREEN: 2411499519, DARKSLATEBLUE: 1211993087, DARKSLATEGRAY: 793726975, DARKSLATEGREY: 793726975, DARKTURQUOISE: 13554175, DARKVIOLET: 2483082239, DEEPPINK: 4279538687, DEEPSKYBLUE: 12582911, DIMGRAY: 1768516095, DIMGREY: 1768516095, DODGERBLUE: 512819199, FIREBRICK: 2988581631, FLORALWHITE: 4294635775, FORESTGREEN: 579543807, FUCHSIA: 4278255615, GAINSBORO: 3705462015, GHOSTWHITE: 4177068031, GOLD: 4292280575, GOLDENROD: 3668254975, GRAY: 2155905279, GREEN: 8388863, GREENYELLOW: 2919182335, GREY: 2155905279, HONEYDEW: 4043305215, HOTPINK: 4285117695, INDIANRED: 3445382399, INDIGO: 1258324735, IVORY: 4294963455, KHAKI: 4041641215, LAVENDER: 3873897215, LAVENDERBLUSH: 4293981695, LAWNGREEN: 2096890111, LEMONCHIFFON: 4294626815, LIGHTBLUE: 2916673279, LIGHTCORAL: 4034953471, LIGHTCYAN: 3774873599, LIGHTGOLDENRODYELLOW: 4210742015, LIGHTGRAY: 3553874943, LIGHTGREEN: 2431553791, LIGHTGREY: 3553874943, LIGHTPINK: 4290167295, LIGHTSALMON: 4288707327, LIGHTSEAGREEN: 548580095, LIGHTSKYBLUE: 2278488831, LIGHTSLATEGRAY: 2005441023, LIGHTSLATEGREY: 2005441023, LIGHTSTEELBLUE: 2965692159, LIGHTYELLOW: 4294959359, LIME: 16711935, LIMEGREEN: 852308735, LINEN: 4210091775, MAGENTA: 4278255615, MAROON: 2147483903, MEDIUMAQUAMARINE: 1724754687, MEDIUMBLUE: 52735, MEDIUMORCHID: 3126187007, MEDIUMPURPLE: 2473647103, MEDIUMSEAGREEN: 1018393087, MEDIUMSLATEBLUE: 2070474495, MEDIUMSPRINGGREEN: 16423679, MEDIUMTURQUOISE: 1221709055, MEDIUMVIOLETRED: 3340076543, MIDNIGHTBLUE: 421097727, MINTCREAM: 4127193855, MISTYROSE: 4293190143, MOCCASIN: 4293178879, NAVAJOWHITE: 4292783615, NAVY: 33023, OLDLACE: 4260751103, OLIVE: 2155872511, OLIVEDRAB: 1804477439, ORANGE: 4289003775, ORANGERED: 4282712319, ORCHID: 3664828159, PALEGOLDENROD: 4008225535, PALEGREEN: 2566625535, PALETURQUOISE: 2951671551, PALEVIOLETRED: 3681588223, PAPAYAWHIP: 4293907967, PEACHPUFF: 4292524543, PERU: 3448061951, PINK: 4290825215, PLUM: 3718307327, POWDERBLUE: 2967529215, PURPLE: 2147516671, REBECCAPURPLE: 1714657791, RED: 4278190335, ROSYBROWN: 3163525119, ROYALBLUE: 1097458175, SADDLEBROWN: 2336560127, SALMON: 4202722047, SANDYBROWN: 4104413439, SEAGREEN: 780883967, SEASHELL: 4294307583, SIENNA: 2689740287, SILVER: 3233857791, SKYBLUE: 2278484991, SLATEBLUE: 1784335871, SLATEGRAY: 1887473919, SLATEGREY: 1887473919, SNOW: 4294638335, SPRINGGREEN: 16744447, STEELBLUE: 1182971135, TAN: 3535047935, TEAL: 8421631, THISTLE: 3636451583, TOMATO: 4284696575, TRANSPARENT: 0, TURQUOISE: 1088475391, VIOLET: 4001558271, WHEAT: 4125012991, WHITE: 4294967295, WHITESMOKE: 4126537215, YELLOW: 4294902015, YELLOWGREEN: 2597139199 }, Cr = { name: "background-clip", initialValue: "border-box", prefix: !1, type: 1, parse: function(e, t) { return t.map(function(e) { if (Wn(e)) switch (e.value) { case "padding-box": return 1; case "content-box": return 2; } return 0; }); } }, wr = { name: "background-color", initialValue: "transparent", prefix: !1, type: 3, format: "color" }, Tr = function(e, t) { var n = fr.parse(e, t[0]), r = t[1]; return r && Qn(r) ? { color: n, stop: r } : { color: n, stop: null }; }, Er = function(e, t) { var n = e[0], r = e[e.length - 1]; n.stop === null && (n.stop = er), r.stop === null && (r.stop = nr); for (var i = [], a = 0, o = 0; o < e.length; o++) { var s = e[o].stop; if (s !== null) { var c = G(s, t); c > a ? i.push(c) : i.push(a), a = c; } else i.push(null); } for (var l = null, o = 0; o < i.length; o++) { var u = i[o]; if (u === null) l === null && (l = o); else if (l !== null) { for (var d = o - l, f = (u - i[l - 1]) / (d + 1), p = 1; p <= d; p++) i[l + p - 1] = f * p; l = null; } } return e.map(function(e, n) { return { color: e.color, stop: Math.max(Math.min(1, i[n] / t), 0) }; }); }, Dr = function(e, t, n) { var r = t / 2, i = n / 2, a = G(e[0], t) - r, o = i - G(e[1], n); return (Math.atan2(o, a) + Math.PI * 2) % (Math.PI * 2); }, Or = function(e, t, n) { var r = typeof e == "number" ? e : Dr(e, t, n), i = Math.abs(t * Math.sin(r)) + Math.abs(n * Math.cos(r)), a = t / 2, o = n / 2, s = i / 2, c = Math.sin(r - Math.PI / 2) * s, l = Math.cos(r - Math.PI / 2) * s; return [ i, a - l, a + l, o - c, o + c ]; }, kr = function(e, t) { return Math.sqrt(e * e + t * t); }, Ar = function(e, t, n, r, i) { return [ [0, 0], [0, t], [e, 0], [e, t] ].reduce(function(e, t) { var a = t[0], o = t[1], s = kr(n - a, r - o); return (i ? s < e.optimumDistance : s > e.optimumDistance) ? { optimumCorner: t, optimumDistance: s } : e; }, { optimumDistance: i ? Infinity : -Infinity, optimumCorner: null }).optimumCorner; }, jr = function(e, t, n, r, i) { var a = 0, o = 0; switch (e.size) { case 0: e.shape === 0 ? a = o = Math.min(Math.abs(t), Math.abs(t - r), Math.abs(n), Math.abs(n - i)) : e.shape === 1 && (a = Math.min(Math.abs(t), Math.abs(t - r)), o = Math.min(Math.abs(n), Math.abs(n - i))); break; case 2: if (e.shape === 0) a = o = Math.min(kr(t, n), kr(t, n - i), kr(t - r, n), kr(t - r, n - i)); else if (e.shape === 1) { var s = Math.min(Math.abs(n), Math.abs(n - i)) / Math.min(Math.abs(t), Math.abs(t - r)), c = Ar(r, i, t, n, !0), l = c[0], u = c[1]; a = kr(l - t, (u - n) / s), o = s * a; } break; case 1: e.shape === 0 ? a = o = Math.max(Math.abs(t), Math.abs(t - r), Math.abs(n), Math.abs(n - i)) : e.shape === 1 && (a = Math.max(Math.abs(t), Math.abs(t - r)), o = Math.max(Math.abs(n), Math.abs(n - i))); break; case 3: if (e.shape === 0) a = o = Math.max(kr(t, n), kr(t, n - i), kr(t - r, n), kr(t - r, n - i)); else if (e.shape === 1) { var s = Math.max(Math.abs(n), Math.abs(n - i)) / Math.max(Math.abs(t), Math.abs(t - r)), d = Ar(r, i, t, n, !1), l = d[0], u = d[1]; a = kr(l - t, (u - n) / s), o = s * a; } break; } return Array.isArray(e.size) && (a = G(e.size[0], r), o = e.size.length === 2 ? G(e.size[1], i) : a), [a, o]; }, Mr = function(e, t) { var n = dr(180), r = []; return Yn(t).forEach(function(t, i) { if (i === 0) { var a = t[0]; if (a.type === 20 && a.value === "to") { n = ur(t); return; } else if (lr(a)) { n = cr.parse(e, a); return; } } var o = Tr(e, t); r.push(o); }), { angle: n, stops: r, type: 1 }; }, Nr = function(e, t) { var n = dr(180), r = []; return Yn(t).forEach(function(t, i) { if (i === 0) { var a = t[0]; if (a.type === 20 && [ "top", "left", "right", "bottom" ].indexOf(a.value) !== -1) { n = ur(t); return; } else if (lr(a)) { n = (cr.parse(e, a) + dr(270)) % dr(360); return; } } var o = Tr(e, t); r.push(o); }), { angle: n, stops: r, type: 1 }; }, Pr = function(e, t) { var n = dr(180), r = [], i = 1; return Yn(t).forEach(function(t, n) { var a = t[0]; if (n === 0) { if (Wn(a) && a.value === "linear") { i = 1; return; } else if (Wn(a) && a.value === "radial") { i = 2; return; } } if (a.type === 18) { if (a.name === "from") { var o = fr.parse(e, a.values[0]); r.push({ stop: er, color: o }); } else if (a.name === "to") { var o = fr.parse(e, a.values[0]); r.push({ stop: nr, color: o }); } else if (a.name === "color-stop") { var s = a.values.filter(Jn); if (s.length === 2) { var o = fr.parse(e, s[1]), c = s[0]; Un(c) && r.push({ stop: { type: 16, number: c.number * 100, flags: c.flags }, color: o }); } } } }), i === 1 ? { angle: (n + dr(180)) % dr(360), stops: r, type: i } : { size: 3, shape: 0, stops: r, position: [], type: i }; }, Fr = "closest-side", Ir = "farthest-side", Lr = "closest-corner", Rr = "farthest-corner", zr = "circle", Br = "ellipse", Vr = "cover", Hr = "contain", Ur = function(e, t) { var n = 0, r = 3, i = [], a = []; return Yn(t).forEach(function(t, o) { var s = !0; if (o === 0) { var c = !1; s = t.reduce(function(e, t) { if (c) if (Wn(t)) switch (t.value) { case "center": return a.push(tr), e; case "top": case "left": return a.push(er), e; case "right": case "bottom": return a.push(nr), e; } else (Qn(t) || Zn(t)) && a.push(t); else if (Wn(t)) switch (t.value) { case zr: return n = 0, !1; case Br: return n = 1, !1; case "at": return c = !0, !1; case Fr: return r = 0, !1; case Vr: case Ir: return r = 1, !1; case Hr: case Lr: return r = 2, !1; case Rr: return r = 3, !1; } else if (Zn(t) || Qn(t)) return Array.isArray(r) || (r = []), r.push(t), !1; return e; }, s); } if (s) { var l = Tr(e, t); i.push(l); } }), { size: r, shape: n, stops: i, position: a, type: 2 }; }, Wr = function(e, t) { var n = 0, r = 3, i = [], a = []; return Yn(t).forEach(function(t, o) { var s = !0; if (o === 0 ? s = t.reduce(function(e, t) { if (Wn(t)) switch (t.value) { case "center": return a.push(tr), !1; case "top": case "left": return a.push(er), !1; case "right": case "bottom": return a.push(nr), !1; } else if (Qn(t) || Zn(t)) return a.push(t), !1; return e; }, s) : o === 1 && (s = t.reduce(function(e, t) { if (Wn(t)) switch (t.value) { case zr: return n = 0, !1; case Br: return n = 1, !1; case Hr: case Fr: return r = 0, !1; case Ir: return r = 1, !1; case Lr: return r = 2, !1; case Vr: case Rr: return r = 3, !1; } else if (Zn(t) || Qn(t)) return Array.isArray(r) || (r = []), r.push(t), !1; return e; }, s)), s) { var c = Tr(e, t); i.push(c); } }), { size: r, shape: n, stops: i, position: a, type: 2 }; }, Gr = function(e) { return e.type === 1; }, Kr = function(e) { return e.type === 2; }, qr = { name: "image", parse: function(e, t) { if (t.type === 22) { var n = { url: t.value, type: 0 }; return e.cache.addImage(t.value), n; } if (t.type === 18) { var r = Yr[t.name]; if (r === void 0) throw Error("Attempting to parse an unsupported image function \"" + t.name + "\""); return r(e, t.values); } throw Error("Unsupported image type " + t.type); } }; function Jr(e) { return !(e.type === 20 && e.value === "none") && (e.type !== 18 || !!Yr[e.name]); } var Yr = { "linear-gradient": Mr, "-moz-linear-gradient": Nr, "-ms-linear-gradient": Nr, "-o-linear-gradient": Nr, "-webkit-linear-gradient": Nr, "radial-gradient": Ur, "-moz-radial-gradient": Wr, "-ms-radial-gradient": Wr, "-o-radial-gradient": Wr, "-webkit-radial-gradient": Wr, "-webkit-gradient": Pr }, Xr = { name: "background-image", initialValue: "none", type: 1, prefix: !1, parse: function(e, t) { if (t.length === 0) return []; var n = t[0]; return n.type === 20 && n.value === "none" ? [] : t.filter(function(e) { return Jn(e) && Jr(e); }).map(function(t) { return qr.parse(e, t); }); } }, Zr = { name: "background-origin", initialValue: "border-box", prefix: !1, type: 1, parse: function(e, t) { return t.map(function(e) { if (Wn(e)) switch (e.value) { case "padding-box": return 1; case "content-box": return 2; } return 0; }); } }, Qr = { name: "background-position", initialValue: "0% 0%", type: 1, prefix: !1, parse: function(e, t) { return Yn(t).map(function(e) { return e.filter(Qn); }).map($n); } }, $r = { name: "background-repeat", initialValue: "repeat", prefix: !1, type: 1, parse: function(e, t) { return Yn(t).map(function(e) { return e.filter(Wn).map(function(e) { return e.value; }).join(" "); }).map(ei); } }, ei = function(e) { switch (e) { case "no-repeat": return 1; case "repeat-x": case "repeat no-repeat": return 2; case "repeat-y": case "no-repeat repeat": return 3; default: return 0; } }, ti; (function(e) { e.AUTO = "auto", e.CONTAIN = "contain", e.COVER = "cover"; })(ti ||= {}); var ni = { name: "background-size", initialValue: "0", prefix: !1, type: 1, parse: function(e, t) { return Yn(t).map(function(e) { return e.filter(ri); }); } }, ri = function(e) { return Wn(e) || Qn(e); }, ii = function(e) { return { name: "border-" + e + "-color", initialValue: "transparent", prefix: !1, type: 3, format: "color" }; }, ai = ii("top"), oi = ii("right"), si = ii("bottom"), ci = ii("left"), li = function(e) { return { name: "border-radius-" + e, initialValue: "0 0", prefix: !1, type: 1, parse: function(e, t) { return $n(t.filter(Qn)); } }; }, ui = li("top-left"), di = li("top-right"), fi = li("bottom-right"), pi = li("bottom-left"), mi = function(e) { return { name: "border-" + e + "-style", initialValue: "solid", prefix: !1, type: 2, parse: function(e, t) { switch (t) { case "none": return 0; case "dashed": return 2; case "dotted": return 3; case "double": return 4; } return 1; } }; }, hi = mi("top"), gi = mi("right"), _i = mi("bottom"), vi = mi("left"), yi = function(e) { return { name: "border-" + e + "-width", initialValue: "0", type: 0, prefix: !1, parse: function(e, t) { return Hn(t) ? t.number : 0; } }; }, bi = yi("top"), xi = yi("right"), Si = yi("bottom"), Ci = yi("left"), wi = { name: "color", initialValue: "transparent", prefix: !1, type: 3, format: "color" }, Ti = { name: "direction", initialValue: "ltr", prefix: !1, type: 2, parse: function(e, t) { switch (t) { case "rtl": return 1; default: return 0; } } }, Ei = { name: "display", initialValue: "inline-block", prefix: !1, type: 1, parse: function(e, t) { return t.filter(Wn).reduce(function(e, t) { return e | Di(t.value); }, 0); } }, Di = function(e) { switch (e) { case "block": case "-webkit-box": return 2; case "inline": return 4; case "run-in": return 8; case "flow": return 16; case "flow-root": return 32; case "table": return 64; case "flex": case "-webkit-flex": return 128; case "grid": case "-ms-grid": return 256; case "ruby": return 512; case "subgrid": return 1024; case "list-item": return 2048; case "table-row-group": return 4096; case "table-header-group": return 8192; case "table-footer-group": return 16384; case "table-row": return 32768; case "table-cell": return 65536; case "table-column-group": return 131072; case "table-column": return 262144; case "table-caption": return 524288; case "ruby-base": return 1048576; case "ruby-text": return 2097152; case "ruby-base-container": return 4194304; case "ruby-text-container": return 8388608; case "contents": return 16777216; case "inline-block": return 33554432; case "inline-list-item": return 67108864; case "inline-table": return 134217728; case "inline-flex": return 268435456; case "inline-grid": return 536870912; } return 0; }, Oi = { name: "float", initialValue: "none", prefix: !1, type: 2, parse: function(e, t) { switch (t) { case "left": return 1; case "right": return 2; case "inline-start": return 3; case "inline-end": return 4; } return 0; } }, ki = { name: "letter-spacing", initialValue: "0", prefix: !1, type: 0, parse: function(e, t) { return t.type === 20 && t.value === "normal" ? 0 : t.type === 17 || t.type === 15 ? t.number : 0; } }, Ai; (function(e) { e.NORMAL = "normal", e.STRICT = "strict"; })(Ai ||= {}); var ji = { name: "line-break", initialValue: "normal", prefix: !1, type: 2, parse: function(e, t) { switch (t) { case "strict": return Ai.STRICT; default: return Ai.NORMAL; } } }, Mi = { name: "line-height", initialValue: "normal", prefix: !1, type: 4 }, Ni = function(e, t) { return Wn(e) && e.value === "normal" ? 1.2 * t : e.type === 17 ? t * e.number : Qn(e) ? G(e, t) : t; }, Pi = { name: "list-style-image", initialValue: "none", type: 0, prefix: !1, parse: function(e, t) { return t.type === 20 && t.value === "none" ? null : qr.parse(e, t); } }, Fi = { name: "list-style-position", initialValue: "outside", prefix: !1, type: 2, parse: function(e, t) { switch (t) { case "inside": return 0; default: return 1; } } }, Ii = { name: "list-style-type", initialValue: "none", prefix: !1, type: 2, parse: function(e, t) { switch (t) { case "disc": return 0; case "circle": return 1; case "square": return 2; case "decimal": return 3; case "cjk-decimal": return 4; case "decimal-leading-zero": return 5; case "lower-roman": return 6; case "upper-roman": return 7; case "lower-greek": return 8; case "lower-alpha": return 9; case "upper-alpha": return 10; case "arabic-indic": return 11; case "armenian": return 12; case "bengali": return 13; case "cambodian": return 14; case "cjk-earthly-branch": return 15; case "cjk-heavenly-stem": return 16; case "cjk-ideographic": return 17; case "devanagari": return 18; case "ethiopic-numeric": return 19; case "georgian": return 20; case "gujarati": return 21; case "gurmukhi": return 22; case "hebrew": return 22; case "hiragana": return 23; case "hiragana-iroha": return 24; case "japanese-formal": return 25; case "japanese-informal": return 26; case "kannada": return 27; case "katakana": return 28; case "katakana-iroha": return 29; case "khmer": return 30; case "korean-hangul-formal": return 31; case "korean-hanja-formal": return 32; case "korean-hanja-informal": return 33; case "lao": return 34; case "lower-armenian": return 35; case "malayalam": return 36; case "mongolian": return 37; case "myanmar": return 38; case "oriya": return 39; case "persian": return 40; case "simp-chinese-formal": return 41; case "simp-chinese-informal": return 42; case "tamil": return 43; case "telugu": return 44; case "thai": return 45; case "tibetan": return 46; case "trad-chinese-formal": return 47; case "trad-chinese-informal": return 48; case "upper-armenian": return 49; case "disclosure-open": return 50; case "disclosure-closed": return 51; default: return -1; } } }, Li = function(e) { return { name: "margin-" + e, initialValue: "0", prefix: !1, type: 4 }; }, Ri = Li("top"), zi = Li("right"), Bi = Li("bottom"), Vi = Li("left"), Hi = { name: "overflow", initialValue: "visible", prefix: !1, type: 1, parse: function(e, t) { return t.filter(Wn).map(function(e) { switch (e.value) { case "hidden": return 1; case "scroll": return 2; case "clip": return 3; case "auto": return 4; default: return 0; } }); } }, Ui = { name: "overflow-wrap", initialValue: "normal", prefix: !1, type: 2, parse: function(e, t) { switch (t) { case "break-word": return "break-word"; default: return "normal"; } } }, Wi = function(e) { return { name: "padding-" + e, initialValue: "0", prefix: !1, type: 3, format: "length-percentage" }; }, Gi = Wi("top"), Ki = Wi("right"), qi = Wi("bottom"), Ji = Wi("left"), Yi = { name: "text-align", initialValue: "left", prefix: !1, type: 2, parse: function(e, t) { switch (t) { case "right": return 2; case "center": case "justify": return 1; default: return 0; } } }, Xi = { name: "position", initialValue: "static", prefix: !1, type: 2, parse: function(e, t) { switch (t) { case "relative": return 1; case "absolute": return 2; case "fixed": return 3; case "sticky": return 4; } return 0; } }, Zi = { name: "text-shadow", initialValue: "none", type: 1, prefix: !1, parse: function(e, t) { return t.length === 1 && Kn(t[0], "none") ? [] : Yn(t).map(function(t) { for (var n = { color: Sr.TRANSPARENT, offsetX: er, offsetY: er, blur: er }, r = 0, i = 0; i < t.length; i++) { var a = t[i]; Zn(a) ? (r === 0 ? n.offsetX = a : r === 1 ? n.offsetY = a : n.blur = a, r++) : n.color = fr.parse(e, a); } return n; }); } }, Qi = { name: "text-transform", initialValue: "none", prefix: !1, type: 2, parse: function(e, t) { switch (t) { case "uppercase": return 2; case "lowercase": return 1; case "capitalize": return 3; } return 0; } }, $i = { name: "transform", initialValue: "none", prefix: !0, type: 0, parse: function(e, t) { if (t.type === 20 && t.value === "none") return null; if (t.type === 18) { var n = ea[t.name]; if (n === void 0) throw Error("Attempting to parse an unsupported transform function \"" + t.name + "\""); return n(t.values); } return null; } }, ea = { matrix: function(e) { var t = e.filter(function(e) { return e.type === 17; }).map(function(e) { return e.number; }); return t.length === 6 ? t : null; }, matrix3d: function(e) { var t = e.filter(function(e) { return e.type === 17; }).map(function(e) { return e.number; }), n = t[0], r = t[1]; t[2], t[3]; var i = t[4], a = t[5]; t[6], t[7], t[8], t[9], t[10], t[11]; var o = t[12], s = t[13]; return t[14], t[15], t.length === 16 ? [ n, r, i, a, o, s ] : null; } }, ta = { type: 16, number: 50, flags: nt }, na = [ta, ta], ra = { name: "transform-origin", initialValue: "50% 50%", prefix: !0, type: 1, parse: function(e, t) { var n = t.filter(Qn); return n.length === 2 ? [n[0], n[1]] : na; } }, ia = { name: "visible", initialValue: "none", prefix: !1, type: 2, parse: function(e, t) { switch (t) { case "hidden": return 1; case "collapse": return 2; default: return 0; } } }, aa; (function(e) { e.NORMAL = "normal", e.BREAK_ALL = "break-all", e.KEEP_ALL = "keep-all"; })(aa ||= {}); for (var oa = { name: "word-break", initialValue: "normal", prefix: !1, type: 2, parse: function(e, t) { switch (t) { case "break-all": return aa.BREAK_ALL; case "keep-all": return aa.KEEP_ALL; default: return aa.NORMAL; } } }, sa = { name: "z-index", initialValue: "auto", prefix: !1, type: 0, parse: function(e, t) { if (t.type === 20) return { auto: !0, order: 0 }; if (Un(t)) return { auto: !1, order: t.number }; throw Error("Invalid z-index number parsed"); } }, ca = { name: "time", parse: function(e, t) { if (t.type === 15) switch (t.unit.toLowerCase()) { case "s": return 1e3 * t.number; case "ms": return t.number; } throw Error("Unsupported time type"); } }, la = { name: "opacity", initialValue: "1", type: 0, prefix: !1, parse: function(e, t) { return Un(t) ? t.number : 1; } }, ua = { name: "text-decoration-color", initialValue: "transparent", prefix: !1, type: 3, format: "color" }, da = { name: "text-decoration-line", initialValue: "none", prefix: !1, type: 1, parse: function(e, t) { return t.filter(Wn).map(function(e) { switch (e.value) { case "underline": return 1; case "overline": return 2; case "line-through": return 3; case "none": return 4; } return 0; }).filter(function(e) { return e !== 0; }); } }, fa = { name: "font-family", initialValue: "", prefix: !1, type: 1, parse: function(e, t) { var n = [], r = []; return t.forEach(function(e) { switch (e.type) { case 20: case 0: n.push(e.value); break; case 17: n.push(e.number.toString()); break; case 4: r.push(n.join(" ")), n.length = 0; break; } }), n.length && r.push(n.join(" ")), r.map(function(e) { return e.indexOf(" ") === -1 ? e : "'" + e + "'"; }); } }, pa = { name: "font-size", initialValue: "0", prefix: !1, type: 3, format: "length" }, ma = { name: "font-weight", initialValue: "normal", type: 0, prefix: !1, parse: function(e, t) { if (Un(t)) return t.number; if (Wn(t)) switch (t.value) { case "bold": return 700; default: return 400; } return 400; } }, ha = { name: "font-variant", initialValue: "none", type: 1, prefix: !1, parse: function(e, t) { return t.filter(Wn).map(function(e) { return e.value; }); } }, ga = { name: "font-style", initialValue: "normal", prefix: !1, type: 2, parse: function(e, t) { switch (t) { case "oblique": return "oblique"; case "italic": return "italic"; default: return "normal"; } } }, _a = function(e, t) { return (e & t) !== 0; }, va = { name: "content", initialValue: "none", type: 1, prefix: !1, parse: function(e, t) { if (t.length === 0) return []; var n = t[0]; return n.type === 20 && n.value === "none" ? [] : t; } }, ya = { name: "counter-increment", initialValue: "none", prefix: !0, type: 1, parse: function(e, t) { if (t.length === 0) return null; var n = t[0]; if (n.type === 20 && n.value === "none") return null; for (var r = [], i = t.filter(qn), a = 0; a < i.length; a++) { var o = i[a], s = i[a + 1]; if (o.type === 20) { var c = s && Un(s) ? s.number : 1; r.push({ counter: o.value, increment: c }); } } return r; } }, ba = { name: "counter-reset", initialValue: "none", prefix: !0, type: 1, parse: function(e, t) { if (t.length === 0) return []; for (var n = [], r = t.filter(qn), i = 0; i < r.length; i++) { var a = r[i], o = r[i + 1]; if (Wn(a) && a.value !== "none") { var s = o && Un(o) ? o.number : 0; n.push({ counter: a.value, reset: s }); } } return n; } }, xa = { name: "duration", initialValue: "0s", prefix: !1, type: 1, parse: function(e, t) { return t.filter(Hn).map(function(t) { return ca.parse(e, t); }); } }, Sa = { name: "quotes", initialValue: "none", prefix: !0, type: 1, parse: function(e, t) { if (t.length === 0) return null; var n = t[0]; if (n.type === 20 && n.value === "none") return null; var r = [], i = t.filter(Gn); if (i.length % 2 != 0) return null; for (var a = 0; a < i.length; a += 2) { var o = i[a].value, s = i[a + 1].value; r.push({ open: o, close: s }); } return r; } }, Ca = function(e, t, n) { if (!e) return ""; var r = e[Math.min(t, e.length - 1)]; return r ? n ? r.open : r.close : ""; }, wa = { name: "box-shadow", initialValue: "none", type: 1, prefix: !1, parse: function(e, t) { return t.length === 1 && Kn(t[0], "none") ? [] : Yn(t).map(function(t) { for (var n = { color: 255, offsetX: er, offsetY: er, blur: er, spread: er, inset: !1 }, r = 0, i = 0; i < t.length; i++) { var a = t[i]; Kn(a, "inset") ? n.inset = !0 : Zn(a) ? (r === 0 ? n.offsetX = a : r === 1 ? n.offsetY = a : r === 2 ? n.blur = a : n.spread = a, r++) : n.color = fr.parse(e, a); } return n; }); } }, Ta = { name: "paint-order", initialValue: "normal", prefix: !1, type: 1, parse: function(e, t) { var n = [ 0, 1, 2 ], r = []; return t.filter(Wn).forEach(function(e) { switch (e.value) { case "stroke": r.push(1); break; case "fill": r.push(0); break; case "markers": r.push(2); break; } }), n.forEach(function(e) { r.indexOf(e) === -1 && r.push(e); }), r; } }, Ea = { name: "-webkit-text-stroke-color", initialValue: "currentcolor", prefix: !1, type: 3, format: "color" }, Da = { name: "-webkit-text-stroke-width", initialValue: "0", type: 0, prefix: !1, parse: function(e, t) { return Hn(t) ? t.number : 0; } }, Oa = function() { function e(e, t) { this.animationDuration = K(e, xa, t.animationDuration), this.backgroundClip = K(e, Cr, t.backgroundClip), this.backgroundColor = K(e, wr, t.backgroundColor), this.backgroundImage = K(e, Xr, t.backgroundImage), this.backgroundOrigin = K(e, Zr, t.backgroundOrigin), this.backgroundPosition = K(e, Qr, t.backgroundPosition), this.backgroundRepeat = K(e, $r, t.backgroundRepeat), this.backgroundSize = K(e, ni, t.backgroundSize), this.borderTopColor = K(e, ai, t.borderTopColor), this.borderRightColor = K(e, oi, t.borderRightColor), this.borderBottomColor = K(e, si, t.borderBottomColor), this.borderLeftColor = K(e, ci, t.borderLeftColor), this.borderTopLeftRadius = K(e, ui, t.borderTopLeftRadius), this.borderTopRightRadius = K(e, di, t.borderTopRightRadius), this.borderBottomRightRadius = K(e, fi, t.borderBottomRightRadius), this.borderBottomLeftRadius = K(e, pi, t.borderBottomLeftRadius), this.borderTopStyle = K(e, hi, t.borderTopStyle), this.borderRightStyle = K(e, gi, t.borderRightStyle), this.borderBottomStyle = K(e, _i, t.borderBottomStyle), this.borderLeftStyle = K(e, vi, t.borderLeftStyle), this.borderTopWidth = K(e, bi, t.borderTopWidth), this.borderRightWidth = K(e, xi, t.borderRightWidth), this.borderBottomWidth = K(e, Si, t.borderBottomWidth), this.borderLeftWidth = K(e, Ci, t.borderLeftWidth), this.boxShadow = K(e, wa, t.boxShadow), this.color = K(e, wi, t.color), this.direction = K(e, Ti, t.direction), this.display = K(e, Ei, t.display), this.float = K(e, Oi, t.cssFloat), this.fontFamily = K(e, fa, t.fontFamily), this.fontSize = K(e, pa, t.fontSize), this.fontStyle = K(e, ga, t.fontStyle), this.fontVariant = K(e, ha, t.fontVariant), this.fontWeight = K(e, ma, t.fontWeight), this.letterSpacing = K(e, ki, t.letterSpacing), this.lineBreak = K(e, ji, t.lineBreak), this.lineHeight = K(e, Mi, t.lineHeight), this.listStyleImage = K(e, Pi, t.listStyleImage), this.listStylePosition = K(e, Fi, t.listStylePosition), this.listStyleType = K(e, Ii, t.listStyleType), this.marginTop = K(e, Ri, t.marginTop), this.marginRight = K(e, zi, t.marginRight), this.marginBottom = K(e, Bi, t.marginBottom), this.marginLeft = K(e, Vi, t.marginLeft), this.opacity = K(e, la, t.opacity); var n = K(e, Hi, t.overflow); this.overflowX = n[0], this.overflowY = n[n.length > 1 ? 1 : 0], this.overflowWrap = K(e, Ui, t.overflowWrap), this.paddingTop = K(e, Gi, t.paddingTop), this.paddingRight = K(e, Ki, t.paddingRight), this.paddingBottom = K(e, qi, t.paddingBottom), this.paddingLeft = K(e, Ji, t.paddingLeft), this.paintOrder = K(e, Ta, t.paintOrder), this.position = K(e, Xi, t.position), this.textAlign = K(e, Yi, t.textAlign), this.textDecorationColor = K(e, ua, t.textDecorationColor ?? t.color), this.textDecorationLine = K(e, da, t.textDecorationLine ?? t.textDecoration), this.textShadow = K(e, Zi, t.textShadow), this.textTransform = K(e, Qi, t.textTransform), this.transform = K(e, $i, t.transform), this.transformOrigin = K(e, ra, t.transformOrigin), this.visibility = K(e, ia, t.visibility), this.webkitTextStrokeColor = K(e, Ea, t.webkitTextStrokeColor), this.webkitTextStrokeWidth = K(e, Da, t.webkitTextStrokeWidth), this.wordBreak = K(e, oa, t.wordBreak), this.zIndex = K(e, sa, t.zIndex); } return e.prototype.isVisible = function() { return this.display > 0 && this.opacity > 0 && this.visibility === 0; }, e.prototype.isTransparent = function() { return pr(this.backgroundColor); }, e.prototype.isTransformed = function() { return this.transform !== null; }, e.prototype.isPositioned = function() { return this.position !== 0; }, e.prototype.isPositionedWithZIndex = function() { return this.isPositioned() && !this.zIndex.auto; }, e.prototype.isFloating = function() { return this.float !== 0; }, e.prototype.isInlineLevel = function() { return _a(this.display, 4) || _a(this.display, 33554432) || _a(this.display, 268435456) || _a(this.display, 536870912) || _a(this.display, 67108864) || _a(this.display, 134217728); }, e; }(), ka = function() { function e(e, t) { this.content = K(e, va, t.content), this.quotes = K(e, Sa, t.quotes); } return e; }(), Aa = function() { function e(e, t) { this.counterIncrement = K(e, ya, t.counterIncrement), this.counterReset = K(e, ba, t.counterReset); } return e; }(), K = function(e, t, n) { var r = new Bn(), i = n == null ? t.initialValue : n.toString(); r.write(i); var a = new Vn(r.read()); switch (t.type) { case 2: var o = a.parseComponentValue(); return t.parse(e, Wn(o) ? o.value : t.initialValue); case 0: return t.parse(e, a.parseComponentValue()); case 1: return t.parse(e, a.parseComponentValues()); case 4: return a.parseComponentValue(); case 3: switch (t.format) { case "angle": return cr.parse(e, a.parseComponentValue()); case "color": return fr.parse(e, a.parseComponentValue()); case "image": return qr.parse(e, a.parseComponentValue()); case "length": var s = a.parseComponentValue(); return Zn(s) ? s : er; case "length-percentage": var c = a.parseComponentValue(); return Qn(c) ? c : er; case "time": return ca.parse(e, a.parseComponentValue()); } break; } }, ja = "data-html2canvas-debug", Ma = function(e) { switch (e.getAttribute(ja)) { case "all": return 1; case "clone": return 2; case "parse": return 3; case "render": return 4; default: return 0; } }, Na = function(e, t) { var n = Ma(e); return n === 1 || t === n; }, Pa = function() { function e(e, t) { if (this.context = e, this.textNodes = [], this.elements = [], this.flags = 0, Na(t, 3)) debugger; this.styles = new Oa(e, window.getComputedStyle(t, null)), Ss(t) && (this.styles.animationDuration.some(function(e) { return e > 0; }) && (t.style.animationDuration = "0s"), this.styles.transform !== null && (t.style.transform = "none")), this.bounds = s(this.context, t), Na(t, 4) && (this.flags |= 16); } return e; }(), Fa = "AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=", Ia = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", La = typeof Uint8Array > "u" ? [] : new Uint8Array(256), Ra = 0; Ra < Ia.length; Ra++) La[Ia.charCodeAt(Ra)] = Ra; for (var za = function(e) { var t = e.length * .75, n = e.length, r, i = 0, a, o, s, c; e[e.length - 1] === "=" && (t--, e[e.length - 2] === "=" && t--); var l = typeof ArrayBuffer < "u" && typeof Uint8Array < "u" && Uint8Array.prototype.slice !== void 0 ? new ArrayBuffer(t) : Array(t), u = Array.isArray(l) ? l : new Uint8Array(l); for (r = 0; r < n; r += 4) a = La[e.charCodeAt(r)], o = La[e.charCodeAt(r + 1)], s = La[e.charCodeAt(r + 2)], c = La[e.charCodeAt(r + 3)], u[i++] = a << 2 | o >> 4, u[i++] = (o & 15) << 4 | s >> 2, u[i++] = (s & 3) << 6 | c & 63; return l; }, Ba = function(e) { for (var t = e.length, n = [], r = 0; r < t; r += 2) n.push(e[r + 1] << 8 | e[r]); return n; }, Va = function(e) { for (var t = e.length, n = [], r = 0; r < t; r += 4) n.push(e[r + 3] << 24 | e[r + 2] << 16 | e[r + 1] << 8 | e[r]); return n; }, Ha = 5, Ua = 11, Wa = 2, Ga = Ua - Ha, Ka = 65536 >> Ha, qa = (1 << Ha) - 1, Ja = Ka + (1024 >> Ha) + 32, Ya = 65536 >> Ua, Xa = (1 << Ga) - 1, Za = function(e, t, n) { return e.slice ? e.slice(t, n) : new Uint16Array(Array.prototype.slice.call(e, t, n)); }, Qa = function(e, t, n) { return e.slice ? e.slice(t, n) : new Uint32Array(Array.prototype.slice.call(e, t, n)); }, $a = function(e, t) { var n = za(e), r = Array.isArray(n) ? Va(n) : new Uint32Array(n), i = Array.isArray(n) ? Ba(n) : new Uint16Array(n), a = 24, o = Za(i, a / 2, r[4] / 2), s = r[5] === 2 ? Za(i, (a + r[4]) / 2) : Qa(r, Math.ceil((a + r[4]) / 4)); return new eo(r[0], r[1], r[2], r[3], o, s); }, eo = function() { function e(e, t, n, r, i, a) { this.initialValue = e, this.errorValue = t, this.highStart = n, this.highValueIndex = r, this.index = i, this.data = a; } return e.prototype.get = function(e) { var t; if (e >= 0) { if (e < 55296 || e > 56319 && e <= 65535) return t = this.index[e >> Ha], t = (t << Wa) + (e & qa), this.data[t]; if (e <= 65535) return t = this.index[Ka + (e - 55296 >> Ha)], t = (t << Wa) + (e & qa), this.data[t]; if (e < this.highStart) return t = Ja - Ya + (e >> Ua), t = this.index[t], t += e >> Ha & Xa, t = this.index[t], t = (t << Wa) + (e & qa), this.data[t]; if (e <= 1114111) return this.data[this.highValueIndex]; } return this.errorValue; }, e; }(), to = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", no = typeof Uint8Array > "u" ? [] : new Uint8Array(256), ro = 0; ro < to.length; ro++) no[to.charCodeAt(ro)] = ro; var io = 1, ao = 2, oo = 3, so = 4, co = 5, lo = 7, uo = 8, fo = 9, po = 10, mo = 11, ho = 12, go = 13, _o = 14, vo = 15, yo = function(e) { for (var t = [], n = 0, r = e.length; n < r;) { var i = e.charCodeAt(n++); if (i >= 55296 && i <= 56319 && n < r) { var a = e.charCodeAt(n++); (a & 64512) == 56320 ? t.push(((i & 1023) << 10) + (a & 1023) + 65536) : (t.push(i), n--); } else t.push(i); } return t; }, bo = function() { var e = [...arguments]; if (String.fromCodePoint) return String.fromCodePoint.apply(String, e); var t = e.length; if (!t) return ""; for (var n = [], r = -1, i = ""; ++r < t;) { var a = e[r]; a <= 65535 ? n.push(a) : (a -= 65536, n.push((a >> 10) + 55296, a % 1024 + 56320)), (r + 1 === t || n.length > 16384) && (i += String.fromCharCode.apply(String, n), n.length = 0); } return i; }, xo = $a(Fa), So = "×", Co = "÷", wo = function(e) { return xo.get(e); }, To = function(e, t, n) { var r = n - 2, i = t[r], a = t[n - 1], o = t[n]; if (a === ao && o === oo) return So; if (a === ao || a === oo || a === so || o === ao || o === oo || o === so) return Co; if (a === uo && [ uo, fo, mo, ho ].indexOf(o) !== -1 || (a === mo || a === fo) && (o === fo || o === po) || (a === ho || a === po) && o === po || o === go || o === co || o === lo || a === io) return So; if (a === go && o === _o) { for (; i === co;) i = t[--r]; if (i === _o) return So; } if (a === vo && o === vo) { for (var s = 0; i === vo;) s++, i = t[--r]; if (s % 2 == 0) return So; } return Co; }, Eo = function(e) { var t = yo(e), n = t.length, r = 0, i = 0, a = t.map(wo); return { next: function() { if (r >= n) return { done: !0, value: null }; for (var e = So; r < n && (e = To(t, a, ++r)) === So;); if (e !== So || r === n) { var o = bo.apply(null, t.slice(i, r)); return i = r, { value: o, done: !1 }; } return { done: !0, value: null }; } }; }, Do = function(e) { for (var t = Eo(e), n = [], r; !(r = t.next()).done;) r.value && n.push(r.value.slice()); return n; }, Oo = function(e) { var t = 123; if (e.createRange) { var n = e.createRange(); if (n.getBoundingClientRect) { var r = e.createElement("boundtest"); r.style.height = t + "px", r.style.display = "block", e.body.appendChild(r), n.selectNode(r); var i = n.getBoundingClientRect(), a = Math.round(i.height); if (e.body.removeChild(r), a === t) return !0; } } return !1; }, ko = function(e) { var t = e.createElement("boundtest"); t.style.width = "50px", t.style.display = "block", t.style.fontSize = "12px", t.style.letterSpacing = "0px", t.style.wordSpacing = "0px", e.body.appendChild(t); var n = e.createRange(); t.innerHTML = typeof "".repeat == "function" ? "👨".repeat(10) : ""; var r = t.firstChild, i = l(r.data).map(function(e) { return u(e); }), a = 0, o = {}, s = i.every(function(e, t) { n.setStart(r, a), n.setEnd(r, a + e.length); var i = n.getBoundingClientRect(); a += e.length; var s = i.x > o.x || i.y > o.y; return o = i, t === 0 ? !0 : s; }); return e.body.removeChild(t), s; }, Ao = function() { return new Image().crossOrigin !== void 0; }, jo = function() { return typeof new XMLHttpRequest().responseType == "string"; }, Mo = function(e) { var t = new Image(), n = e.createElement("canvas"), r = n.getContext("2d"); if (!r) return !1; t.src = "data:image/svg+xml,"; try { r.drawImage(t, 0, 0), n.toDataURL(); } catch { return !1; } return !0; }, No = function(e) { return e[0] === 0 && e[1] === 255 && e[2] === 0 && e[3] === 255; }, Po = function(e) { var t = e.createElement("canvas"), n = 100; t.width = n, t.height = n; var r = t.getContext("2d"); if (!r) return Promise.reject(!1); r.fillStyle = "rgb(0, 255, 0)", r.fillRect(0, 0, n, n); var i = new Image(), a = t.toDataURL(); i.src = a; var o = Fo(n, n, 0, 0, i); return r.fillStyle = "red", r.fillRect(0, 0, n, n), Io(o).then(function(t) { r.drawImage(t, 0, 0); var i = r.getImageData(0, 0, n, n).data; r.fillStyle = "red", r.fillRect(0, 0, n, n); var o = e.createElement("div"); return o.style.backgroundImage = "url(" + a + ")", o.style.height = n + "px", No(i) ? Io(Fo(n, n, 0, 0, o)) : Promise.reject(!1); }).then(function(e) { return r.drawImage(e, 0, 0), No(r.getImageData(0, 0, n, n).data); }).catch(function() { return !1; }); }, Fo = function(e, t, n, r, i) { var a = "http://www.w3.org/2000/svg", o = document.createElementNS(a, "svg"), s = document.createElementNS(a, "foreignObject"); return o.setAttributeNS(null, "width", e.toString()), o.setAttributeNS(null, "height", t.toString()), s.setAttributeNS(null, "width", "100%"), s.setAttributeNS(null, "height", "100%"), s.setAttributeNS(null, "x", n.toString()), s.setAttributeNS(null, "y", r.toString()), s.setAttributeNS(null, "externalResourcesRequired", "true"), o.appendChild(s), s.appendChild(i), o; }, Io = function(e) { return new Promise(function(t, n) { var r = new Image(); r.onload = function() { return t(r); }, r.onerror = n, r.src = "data:image/svg+xml;charset=utf-8," + encodeURIComponent(new XMLSerializer().serializeToString(e)); }); }, Lo = { get SUPPORT_RANGE_BOUNDS() { var e = Oo(document); return Object.defineProperty(Lo, "SUPPORT_RANGE_BOUNDS", { value: e }), e; }, get SUPPORT_WORD_BREAKING() { var e = Lo.SUPPORT_RANGE_BOUNDS && ko(document); return Object.defineProperty(Lo, "SUPPORT_WORD_BREAKING", { value: e }), e; }, get SUPPORT_SVG_DRAWING() { var e = Mo(document); return Object.defineProperty(Lo, "SUPPORT_SVG_DRAWING", { value: e }), e; }, get SUPPORT_FOREIGNOBJECT_DRAWING() { var e = typeof Array.from == "function" && typeof window.fetch == "function" ? Po(document) : Promise.resolve(!1); return Object.defineProperty(Lo, "SUPPORT_FOREIGNOBJECT_DRAWING", { value: e }), e; }, get SUPPORT_CORS_IMAGES() { var e = Ao(); return Object.defineProperty(Lo, "SUPPORT_CORS_IMAGES", { value: e }), e; }, get SUPPORT_RESPONSE_TYPE() { var e = jo(); return Object.defineProperty(Lo, "SUPPORT_RESPONSE_TYPE", { value: e }), e; }, get SUPPORT_CORS_XHR() { var e = "withCredentials" in new XMLHttpRequest(); return Object.defineProperty(Lo, "SUPPORT_CORS_XHR", { value: e }), e; }, get SUPPORT_NATIVE_TEXT_SEGMENTATION() { var e = !!(typeof Intl < "u" && Intl.Segmenter); return Object.defineProperty(Lo, "SUPPORT_NATIVE_TEXT_SEGMENTATION", { value: e }), e; } }, Ro = function() { function e(e, t) { this.text = e, this.bounds = t; } return e; }(), zo = function(e, t, n, r) { var i = Wo(t, n), a = [], s = 0; return i.forEach(function(t) { if (n.textDecorationLine.length || t.trim().length > 0) if (Lo.SUPPORT_RANGE_BOUNDS) { var i = Vo(r, s, t.length).getClientRects(); if (i.length > 1) { var c = Ho(t), l = 0; c.forEach(function(t) { a.push(new Ro(t, o.fromDOMRectList(e, Vo(r, l + s, t.length).getClientRects()))), l += t.length; }); } else a.push(new Ro(t, o.fromDOMRectList(e, i))); } else { var u = r.splitText(t.length); a.push(new Ro(t, Bo(e, r))), r = u; } else Lo.SUPPORT_RANGE_BOUNDS || (r = r.splitText(t.length)); s += t.length; }), a; }, Bo = function(e, t) { var n = t.ownerDocument; if (n) { var r = n.createElement("html2canvaswrapper"); r.appendChild(t.cloneNode(!0)); var i = t.parentNode; if (i) { i.replaceChild(r, t); var a = s(e, r); return r.firstChild && i.replaceChild(r.firstChild, r), a; } } return o.EMPTY; }, Vo = function(e, t, n) { var r = e.ownerDocument; if (!r) throw Error("Node has no owner document"); var i = r.createRange(); return i.setStart(e, t), i.setEnd(e, t + n), i; }, Ho = function(e) { if (Lo.SUPPORT_NATIVE_TEXT_SEGMENTATION) { var t = new Intl.Segmenter(void 0, { granularity: "grapheme" }); return Array.from(t.segment(e)).map(function(e) { return e.segment; }); } return Do(e); }, Uo = function(e, t) { if (Lo.SUPPORT_NATIVE_TEXT_SEGMENTATION) { var n = new Intl.Segmenter(void 0, { granularity: "word" }); return Array.from(n.segment(e)).map(function(e) { return e.segment; }); } return Ko(e, t); }, Wo = function(e, t) { return t.letterSpacing === 0 ? Uo(e, t) : Ho(e); }, Go = [ 32, 160, 4961, 65792, 65793, 4153, 4241 ], Ko = function(e, t) { for (var n = $e(e, { lineBreak: t.lineBreak, wordBreak: t.overflowWrap === "break-word" ? "break-word" : t.wordBreak }), r = [], i, a = function() { if (i.value) { var e = l(i.value.slice()), t = ""; e.forEach(function(e) { Go.indexOf(e) === -1 ? t += u(e) : (t.length && r.push(t), r.push(u(e)), t = ""); }), t.length && r.push(t); } }; !(i = n.next()).done;) a(); return r; }, qo = function() { function e(e, t, n) { this.text = Jo(t.data, n.textTransform), this.textBounds = zo(e, this.text, n, t); } return e; }(), Jo = function(e, t) { switch (t) { case 1: return e.toLowerCase(); case 3: return e.replace(Yo, Xo); case 2: return e.toUpperCase(); default: return e; } }, Yo = /(^|\s|:|-|\(|\))([a-z])/g, Xo = function(e, t, n) { return e.length > 0 ? t + n.toUpperCase() : e; }, Zo = function(e) { t(n, e); function n(t, n) { var r = e.call(this, t, n) || this; return r.src = n.currentSrc || n.src, r.intrinsicWidth = n.naturalWidth, r.intrinsicHeight = n.naturalHeight, r.context.cache.addImage(r.src), r; } return n; }(Pa), Qo = function(e) { t(n, e); function n(t, n) { var r = e.call(this, t, n) || this; return r.canvas = n, r.intrinsicWidth = n.width, r.intrinsicHeight = n.height, r; } return n; }(Pa), $o = function(e) { t(n, e); function n(t, n) { var r = e.call(this, t, n) || this, i = new XMLSerializer(), a = s(t, n); return n.setAttribute("width", a.width + "px"), n.setAttribute("height", a.height + "px"), r.svg = "data:image/svg+xml," + encodeURIComponent(i.serializeToString(n)), r.intrinsicWidth = n.width.baseVal.value, r.intrinsicHeight = n.height.baseVal.value, r.context.cache.addImage(r.svg), r; } return n; }(Pa), es = function(e) { t(n, e); function n(t, n) { var r = e.call(this, t, n) || this; return r.value = n.value, r; } return n; }(Pa), ts = function(e) { t(n, e); function n(t, n) { var r = e.call(this, t, n) || this; return r.start = n.start, r.reversed = typeof n.reversed == "boolean" && n.reversed === !0, r; } return n; }(Pa), ns = [{ type: 15, flags: 0, unit: "px", number: 3 }], rs = [{ type: 16, flags: 0, number: 50 }], is = function(e) { return e.width > e.height ? new o(e.left + (e.width - e.height) / 2, e.top, e.height, e.height) : e.width < e.height ? new o(e.left, e.top + (e.height - e.width) / 2, e.width, e.width) : e; }, as = function(e) { var t = e.type === cs ? Array(e.value.length + 1).join("•") : e.value; return t.length === 0 ? e.placeholder || "" : t; }, os = "checkbox", ss = "radio", cs = "password", ls = 707406591, us = function(e) { t(n, e); function n(t, n) { var r = e.call(this, t, n) || this; switch (r.type = n.type.toLowerCase(), r.checked = n.checked, r.value = as(n), (r.type === os || r.type === ss) && (r.styles.backgroundColor = 3739148031, r.styles.borderTopColor = r.styles.borderRightColor = r.styles.borderBottomColor = r.styles.borderLeftColor = 2779096575, r.styles.borderTopWidth = r.styles.borderRightWidth = r.styles.borderBottomWidth = r.styles.borderLeftWidth = 1, r.styles.borderTopStyle = r.styles.borderRightStyle = r.styles.borderBottomStyle = r.styles.borderLeftStyle = 1, r.styles.backgroundClip = [0], r.styles.backgroundOrigin = [0], r.bounds = is(r.bounds)), r.type) { case os: r.styles.borderTopRightRadius = r.styles.borderTopLeftRadius = r.styles.borderBottomRightRadius = r.styles.borderBottomLeftRadius = ns; break; case ss: r.styles.borderTopRightRadius = r.styles.borderTopLeftRadius = r.styles.borderBottomRightRadius = r.styles.borderBottomLeftRadius = rs; break; } return r; } return n; }(Pa), ds = function(e) { t(n, e); function n(t, n) { var r = e.call(this, t, n) || this, i = n.options[n.selectedIndex || 0]; return r.value = i && i.text || "", r; } return n; }(Pa), fs = function(e) { t(n, e); function n(t, n) { var r = e.call(this, t, n) || this; return r.value = n.value, r; } return n; }(Pa), ps = function(e) { t(n, e); function n(t, n) { var r = e.call(this, t, n) || this; r.src = n.src, r.width = parseInt(n.width, 10) || 0, r.height = parseInt(n.height, 10) || 0, r.backgroundColor = r.styles.backgroundColor; try { if (n.contentWindow && n.contentWindow.document && n.contentWindow.document.documentElement) { r.tree = _s(t, n.contentWindow.document.documentElement); var i = n.contentWindow.document.documentElement ? xr(t, getComputedStyle(n.contentWindow.document.documentElement).backgroundColor) : Sr.TRANSPARENT, a = n.contentWindow.document.body ? xr(t, getComputedStyle(n.contentWindow.document.body).backgroundColor) : Sr.TRANSPARENT; r.backgroundColor = pr(i) ? pr(a) ? r.styles.backgroundColor : a : i; } } catch {} return r; } return n; }(Pa), ms = [ "OL", "UL", "MENU" ], hs = function(e, t, n, r) { for (var i = t.firstChild, a = void 0; i; i = a) if (a = i.nextSibling, bs(i) && i.data.trim().length > 0) n.textNodes.push(new qo(e, i, n.styles)); else if (xs(i)) if (Rs(i) && i.assignedNodes) i.assignedNodes().forEach(function(t) { return hs(e, t, n, r); }); else { var o = gs(e, i); o.styles.isVisible() && (vs(i, o, r) ? o.flags |= 4 : ys(o.styles) && (o.flags |= 2), ms.indexOf(i.tagName) !== -1 && (o.flags |= 8), n.elements.push(o), i.slot, i.shadowRoot ? hs(e, i.shadowRoot, o, r) : !Is(i) && !Os(i) && !Ls(i) && hs(e, i, o, r)); } }, gs = function(e, t) { return Ms(t) ? new Zo(e, t) : As(t) ? new Qo(e, t) : Os(t) ? new $o(e, t) : ws(t) ? new es(e, t) : Ts(t) ? new ts(e, t) : Es(t) ? new us(e, t) : Ls(t) ? new ds(e, t) : Is(t) ? new fs(e, t) : Ns(t) ? new ps(e, t) : new Pa(e, t); }, _s = function(e, t) { var n = gs(e, t); return n.flags |= 4, hs(e, t, n, n), n; }, vs = function(e, t, n) { return t.styles.isPositionedWithZIndex() || t.styles.opacity < 1 || t.styles.isTransformed() || ks(e) && n.styles.isTransparent(); }, ys = function(e) { return e.isPositioned() || e.isFloating(); }, bs = function(e) { return e.nodeType === Node.TEXT_NODE; }, xs = function(e) { return e.nodeType === Node.ELEMENT_NODE; }, Ss = function(e) { return xs(e) && e.style !== void 0 && !Cs(e); }, Cs = function(e) { return typeof e.className == "object"; }, ws = function(e) { return e.tagName === "LI"; }, Ts = function(e) { return e.tagName === "OL"; }, Es = function(e) { return e.tagName === "INPUT"; }, Ds = function(e) { return e.tagName === "HTML"; }, Os = function(e) { return e.tagName === "svg"; }, ks = function(e) { return e.tagName === "BODY"; }, As = function(e) { return e.tagName === "CANVAS"; }, js = function(e) { return e.tagName === "VIDEO"; }, Ms = function(e) { return e.tagName === "IMG"; }, Ns = function(e) { return e.tagName === "IFRAME"; }, Ps = function(e) { return e.tagName === "STYLE"; }, Fs = function(e) { return e.tagName === "SCRIPT"; }, Is = function(e) { return e.tagName === "TEXTAREA"; }, Ls = function(e) { return e.tagName === "SELECT"; }, Rs = function(e) { return e.tagName === "SLOT"; }, zs = function(e) { return e.tagName.indexOf("-") > 0; }, Bs = function() { function e() { this.counters = {}; } return e.prototype.getCounterValue = function(e) { var t = this.counters[e]; return t && t.length ? t[t.length - 1] : 1; }, e.prototype.getCounterValues = function(e) { return this.counters[e] || []; }, e.prototype.pop = function(e) { var t = this; e.forEach(function(e) { return t.counters[e].pop(); }); }, e.prototype.parse = function(e) { var t = this, n = e.counterIncrement, r = e.counterReset, i = !0; n !== null && n.forEach(function(e) { var n = t.counters[e.counter]; n && e.increment !== 0 && (i = !1, n.length || n.push(1), n[Math.max(0, n.length - 1)] += e.increment); }); var a = []; return i && r.forEach(function(e) { var n = t.counters[e.counter]; a.push(e.counter), n ||= t.counters[e.counter] = [], n.push(e.reset); }), a; }, e; }(), Vs = { integers: [ 1e3, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1 ], values: [ "M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I" ] }, Hs = { integers: [ 9e3, 8e3, 7e3, 6e3, 5e3, 4e3, 3e3, 2e3, 1e3, 900, 800, 700, 600, 500, 400, 300, 200, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 ], values: /* @__PURE__ */ "Ք.Փ.Ւ.Ց.Ր.Տ.Վ.Ս.Ռ.Ջ.Պ.Չ.Ո.Շ.Ն.Յ.Մ.Ճ.Ղ.Ձ.Հ.Կ.Ծ.Խ.Լ.Ի.Ժ.Թ.Ը.Է.Զ.Ե.Դ.Գ.Բ.Ա".split(".") }, Us = { integers: [ 1e4, 9e3, 8e3, 7e3, 6e3, 5e3, 4e3, 3e3, 2e3, 1e3, 400, 300, 200, 100, 90, 80, 70, 60, 50, 40, 30, 20, 19, 18, 17, 16, 15, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 ], values: /* @__PURE__ */ "י׳.ט׳.ח׳.ז׳.ו׳.ה׳.ד׳.ג׳.ב׳.א׳.ת.ש.ר.ק.צ.פ.ע.ס.נ.מ.ל.כ.יט.יח.יז.טז.טו.י.ט.ח.ז.ו.ה.ד.ג.ב.א".split(".") }, Ws = { integers: [ 1e4, 9e3, 8e3, 7e3, 6e3, 5e3, 4e3, 3e3, 2e3, 1e3, 900, 800, 700, 600, 500, 400, 300, 200, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 ], values: /* @__PURE__ */ "ჵ.ჰ.ჯ.ჴ.ხ.ჭ.წ.ძ.ც.ჩ.შ.ყ.ღ.ქ.ფ.ჳ.ტ.ს.რ.ჟ.პ.ო.ჲ.ნ.მ.ლ.კ.ი.თ.ჱ.ზ.ვ.ე.დ.გ.ბ.ა".split(".") }, Gs = function(e, t, n, r, i, a) { return e < t || e > n ? ic(e, i, a.length > 0) : r.integers.reduce(function(t, n, i) { for (; e >= n;) e -= n, t += r.values[i]; return t; }, "") + a; }, Ks = function(e, t, n, r) { var i = ""; do n || e--, i = r(e) + i, e /= t; while (e * t >= t); return i; }, qs = function(e, t, n, r, i) { var a = n - t + 1; return (e < 0 ? "-" : "") + (Ks(Math.abs(e), a, r, function(e) { return u(Math.floor(e % a) + t); }) + i); }, Js = function(e, t, n) { n === void 0 && (n = ". "); var r = t.length; return Ks(Math.abs(e), r, !1, function(e) { return t[Math.floor(e % r)]; }) + n; }, Ys = 1, Xs = 2, Zs = 4, Qs = 8, $s = function(e, t, n, r, i, a) { if (e < -9999 || e > 9999) return ic(e, 4, i.length > 0); var o = Math.abs(e), s = i; if (o === 0) return t[0] + s; for (var c = 0; o > 0 && c <= 4; c++) { var l = o % 10; l === 0 && _a(a, Ys) && s !== "" ? s = t[l] + s : l > 1 || l === 1 && c === 0 || l === 1 && c === 1 && _a(a, Xs) || l === 1 && c === 1 && _a(a, Zs) && e > 100 || l === 1 && c > 1 && _a(a, Qs) ? s = t[l] + (c > 0 ? n[c - 1] : "") + s : l === 1 && c > 0 && (s = n[c - 1] + s), o = Math.floor(o / 10); } return (e < 0 ? r : "") + s; }, ec = "十百千萬", tc = "拾佰仟萬", nc = "マイナス", rc = "마이너스", ic = function(e, t, n) { var r = n ? ". " : "", i = n ? "、" : "", a = n ? ", " : "", o = n ? " " : ""; switch (t) { case 0: return "•" + o; case 1: return "◦" + o; case 2: return "◾" + o; case 5: var s = qs(e, 48, 57, !0, r); return s.length < 4 ? "0" + s : s; case 4: return Js(e, "〇一二三四五六七八九", i); case 6: return Gs(e, 1, 3999, Vs, 3, r).toLowerCase(); case 7: return Gs(e, 1, 3999, Vs, 3, r); case 8: return qs(e, 945, 969, !1, r); case 9: return qs(e, 97, 122, !1, r); case 10: return qs(e, 65, 90, !1, r); case 11: return qs(e, 1632, 1641, !0, r); case 12: case 49: return Gs(e, 1, 9999, Hs, 3, r); case 35: return Gs(e, 1, 9999, Hs, 3, r).toLowerCase(); case 13: return qs(e, 2534, 2543, !0, r); case 14: case 30: return qs(e, 6112, 6121, !0, r); case 15: return Js(e, "子丑寅卯辰巳午未申酉戌亥", i); case 16: return Js(e, "甲乙丙丁戊己庚辛壬癸", i); case 17: case 48: return $s(e, "零一二三四五六七八九", ec, "負", i, Xs | Zs | Qs); case 47: return $s(e, "零壹貳參肆伍陸柒捌玖", tc, "負", i, Ys | Xs | Zs | Qs); case 42: return $s(e, "零一二三四五六七八九", ec, "负", i, Xs | Zs | Qs); case 41: return $s(e, "零壹贰叁肆伍陆柒捌玖", tc, "负", i, Ys | Xs | Zs | Qs); case 26: return $s(e, "〇一二三四五六七八九", "十百千万", nc, i, 0); case 25: return $s(e, "零壱弐参四伍六七八九", "拾百千万", nc, i, Ys | Xs | Zs); case 31: return $s(e, "영일이삼사오육칠팔구", "십백천만", rc, a, Ys | Xs | Zs); case 33: return $s(e, "零一二三四五六七八九", "十百千萬", rc, a, 0); case 32: return $s(e, "零壹貳參四五六七八九", "拾百千", rc, a, Ys | Xs | Zs); case 18: return qs(e, 2406, 2415, !0, r); case 20: return Gs(e, 1, 19999, Ws, 3, r); case 21: return qs(e, 2790, 2799, !0, r); case 22: return qs(e, 2662, 2671, !0, r); case 22: return Gs(e, 1, 10999, Us, 3, r); case 23: return Js(e, "あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん"); case 24: return Js(e, "いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす"); case 27: return qs(e, 3302, 3311, !0, r); case 28: return Js(e, "アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン", i); case 29: return Js(e, "イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス", i); case 34: return qs(e, 3792, 3801, !0, r); case 37: return qs(e, 6160, 6169, !0, r); case 38: return qs(e, 4160, 4169, !0, r); case 39: return qs(e, 2918, 2927, !0, r); case 40: return qs(e, 1776, 1785, !0, r); case 43: return qs(e, 3046, 3055, !0, r); case 44: return qs(e, 3174, 3183, !0, r); case 45: return qs(e, 3664, 3673, !0, r); case 46: return qs(e, 3872, 3881, !0, r); default: return qs(e, 48, 57, !0, r); } }, ac = "data-html2canvas-ignore", oc = function() { function e(e, t, n) { if (this.context = e, this.options = n, this.scrolledElements = [], this.referenceElement = t, this.counters = new Bs(), this.quoteDepth = 0, !t.ownerDocument) throw Error("Cloned element does not have an owner document"); this.documentElement = this.cloneNode(t.ownerDocument.documentElement, !1); } return e.prototype.toIFrame = function(e, t) { var n = this, a = cc(e, t); if (!a.contentWindow) return Promise.reject("Unable to find iframe window"); var o = e.defaultView.pageXOffset, s = e.defaultView.pageYOffset, c = a.contentWindow, l = c.document, u = dc(a).then(function() { return r(n, void 0, void 0, function() { var e, n; return i(this, function(r) { switch (r.label) { case 0: return this.scrolledElements.forEach(gc), c && (c.scrollTo(t.left, t.top), /(iPad|iPhone|iPod)/g.test(navigator.userAgent) && (c.scrollY !== t.top || c.scrollX !== t.left) && (this.context.logger.warn("Unable to restore scroll position for cloned document"), this.context.windowBounds = this.context.windowBounds.add(c.scrollX - t.left, c.scrollY - t.top, 0, 0))), e = this.options.onclone, n = this.clonedReferenceElement, n === void 0 ? [2, Promise.reject("Error finding the " + this.referenceElement.nodeName + " in the cloned document")] : l.fonts && l.fonts.ready ? [4, l.fonts.ready] : [3, 2]; case 1: r.sent(), r.label = 2; case 2: return /(AppleWebKit)/g.test(navigator.userAgent) ? [4, uc(l)] : [3, 4]; case 3: r.sent(), r.label = 4; case 4: return typeof e == "function" ? [2, Promise.resolve().then(function() { return e(l, n); }).then(function() { return a; })] : [2, a]; } }); }); }); return l.open(), l.write(mc(document.doctype) + ""), hc(this.referenceElement.ownerDocument, o, s), l.replaceChild(l.adoptNode(this.documentElement), l.documentElement), l.close(), u; }, e.prototype.createElementClone = function(e) { if (Na(e, 2)) debugger; if (As(e)) return this.createCanvasClone(e); if (js(e)) return this.createVideoClone(e); if (Ps(e)) return this.createStyleClone(e); var t = e.cloneNode(!1); return Ms(t) && (Ms(e) && e.currentSrc && e.currentSrc !== e.src && (t.src = e.currentSrc, t.srcset = ""), t.loading === "lazy" && (t.loading = "eager")), zs(t) ? this.createCustomElementClone(t) : t; }, e.prototype.createCustomElementClone = function(e) { var t = document.createElement("html2canvascustomelement"); return pc(e.style, t), t; }, e.prototype.createStyleClone = function(e) { try { var t = e.sheet; if (t && t.cssRules) { var n = [].slice.call(t.cssRules, 0).reduce(function(e, t) { return t && typeof t.cssText == "string" ? e + t.cssText : e; }, ""), r = e.cloneNode(!1); return r.textContent = n, r; } } catch (e) { if (this.context.logger.error("Unable to access cssRules property", e), e.name !== "SecurityError") throw e; } return e.cloneNode(!1); }, e.prototype.createCanvasClone = function(e) { if (this.options.inlineImages && e.ownerDocument) { var t = e.ownerDocument.createElement("img"); try { return t.src = e.toDataURL(), t; } catch { this.context.logger.info("Unable to inline canvas contents, canvas is tainted", e); } } var n = e.cloneNode(!1); try { n.width = e.width, n.height = e.height; var r = e.getContext("2d"), i = n.getContext("2d"); if (i) if (!this.options.allowTaint && r) i.putImageData(r.getImageData(0, 0, e.width, e.height), 0, 0); else { var a = e.getContext("webgl2") ?? e.getContext("webgl"); a && a.getContextAttributes()?.preserveDrawingBuffer === !1 && this.context.logger.warn("Unable to clone WebGL context as it has preserveDrawingBuffer=false", e), i.drawImage(e, 0, 0); } return n; } catch { this.context.logger.info("Unable to clone canvas as it is tainted", e); } return n; }, e.prototype.createVideoClone = function(e) { var t = e.ownerDocument.createElement("canvas"); t.width = e.offsetWidth, t.height = e.offsetHeight; var n = t.getContext("2d"); try { return n && (n.drawImage(e, 0, 0, t.width, t.height), this.options.allowTaint || n.getImageData(0, 0, t.width, t.height)), t; } catch { this.context.logger.info("Unable to clone video as it is tainted", e); } var r = e.ownerDocument.createElement("canvas"); return r.width = e.offsetWidth, r.height = e.offsetHeight, r; }, e.prototype.appendChildNode = function(e, t, n) { (!xs(t) || !Fs(t) && !t.hasAttribute(ac) && (typeof this.options.ignoreElements != "function" || !this.options.ignoreElements(t))) && (!this.options.copyStyles || !xs(t) || !Ps(t)) && e.appendChild(this.cloneNode(t, n)); }, e.prototype.cloneChildNodes = function(e, t, n) { for (var r = this, i = e.shadowRoot ? e.shadowRoot.firstChild : e.firstChild; i; i = i.nextSibling) if (xs(i) && Rs(i) && typeof i.assignedNodes == "function") { var a = i.assignedNodes(); a.length && a.forEach(function(e) { return r.appendChildNode(t, e, n); }); } else this.appendChildNode(t, i, n); }, e.prototype.cloneNode = function(e, t) { if (bs(e)) return document.createTextNode(e.data); if (!e.ownerDocument) return e.cloneNode(!1); var n = e.ownerDocument.defaultView; if (n && xs(e) && (Ss(e) || Cs(e))) { var r = this.createElementClone(e); r.style.transitionProperty = "none"; var i = n.getComputedStyle(e), a = n.getComputedStyle(e, ":before"), o = n.getComputedStyle(e, ":after"); this.referenceElement === e && Ss(r) && (this.clonedReferenceElement = r), ks(r) && Sc(r); var s = this.counters.parse(new Aa(this.context, i)), c = this.resolvePseudoContent(e, r, a, sc.BEFORE); zs(e) && (t = !0), js(e) || this.cloneChildNodes(e, r, t), c && r.insertBefore(c, r.firstChild); var l = this.resolvePseudoContent(e, r, o, sc.AFTER); return l && r.appendChild(l), this.counters.pop(s), (i && (this.options.copyStyles || Cs(e)) && !Ns(e) || t) && pc(i, r), (e.scrollTop !== 0 || e.scrollLeft !== 0) && this.scrolledElements.push([ r, e.scrollLeft, e.scrollTop ]), (Is(e) || Ls(e)) && (Is(r) || Ls(r)) && (r.value = e.value), r; } return e.cloneNode(!1); }, e.prototype.resolvePseudoContent = function(e, t, n, r) { var i = this; if (n) { var a = n.content, o = t.ownerDocument; if (!(!o || !a || a === "none" || a === "-moz-alt-content" || n.display === "none")) { this.counters.parse(new Aa(this.context, n)); var s = new ka(this.context, n), c = o.createElement("html2canvaspseudoelement"); pc(n, c), s.content.forEach(function(t) { if (t.type === 0) c.appendChild(o.createTextNode(t.value)); else if (t.type === 22) { var n = o.createElement("img"); n.src = t.value, n.style.opacity = "1", c.appendChild(n); } else if (t.type === 18) { if (t.name === "attr") { var r = t.values.filter(Wn); r.length && c.appendChild(o.createTextNode(e.getAttribute(r[0].value) || "")); } else if (t.name === "counter") { var a = t.values.filter(Jn), l = a[0], u = a[1]; if (l && Wn(l)) { var d = i.counters.getCounterValue(l.value), f = u && Wn(u) ? Ii.parse(i.context, u.value) : 3; c.appendChild(o.createTextNode(ic(d, f, !1))); } } else if (t.name === "counters") { var p = t.values.filter(Jn), l = p[0], m = p[1], u = p[2]; if (l && Wn(l)) { var h = i.counters.getCounterValues(l.value), g = u && Wn(u) ? Ii.parse(i.context, u.value) : 3, _ = m && m.type === 0 ? m.value : "", v = h.map(function(e) { return ic(e, g, !1); }).join(_); c.appendChild(o.createTextNode(v)); } } } else if (t.type === 20) switch (t.value) { case "open-quote": c.appendChild(o.createTextNode(Ca(s.quotes, i.quoteDepth++, !0))); break; case "close-quote": c.appendChild(o.createTextNode(Ca(s.quotes, --i.quoteDepth, !1))); break; default: c.appendChild(o.createTextNode(t.value)); } }), c.className = yc + " " + bc; var l = r === sc.BEFORE ? " " + yc : " " + bc; return Cs(t) ? t.className.baseValue += l : t.className += l, c; } } }, e.destroy = function(e) { return e.parentNode ? (e.parentNode.removeChild(e), !0) : !1; }, e; }(), sc; (function(e) { e[e.BEFORE = 0] = "BEFORE", e[e.AFTER = 1] = "AFTER"; })(sc ||= {}); var cc = function(e, t) { var n = e.createElement("iframe"); return n.className = "html2canvas-container", n.style.visibility = "hidden", n.style.position = "fixed", n.style.left = "-10000px", n.style.top = "0px", n.style.border = "0", n.width = t.width.toString(), n.height = t.height.toString(), n.scrolling = "no", n.setAttribute(ac, "true"), e.body.appendChild(n), n; }, lc = function(e) { return new Promise(function(t) { if (e.complete) { t(); return; } if (!e.src) { t(); return; } e.onload = t, e.onerror = t; }); }, uc = function(e) { return Promise.all([].slice.call(e.images, 0).map(lc)); }, dc = function(e) { return new Promise(function(t, n) { var r = e.contentWindow; if (!r) return n("No window assigned for iframe"); var i = r.document; r.onload = e.onload = function() { r.onload = e.onload = null; var n = setInterval(function() { i.body.childNodes.length > 0 && i.readyState === "complete" && (clearInterval(n), t(e)); }, 50); }; }); }, fc = [ "all", "d", "content" ], pc = function(e, t) { for (var n = e.length - 1; n >= 0; n--) { var r = e.item(n); fc.indexOf(r) === -1 && t.style.setProperty(r, e.getPropertyValue(r)); } return t; }, mc = function(e) { var t = ""; return e && (t += ""), t; }, hc = function(e, t, n) { e && e.defaultView && (t !== e.defaultView.pageXOffset || n !== e.defaultView.pageYOffset) && e.defaultView.scrollTo(t, n); }, gc = function(e) { var t = e[0], n = e[1], r = e[2]; t.scrollLeft = n, t.scrollTop = r; }, _c = ":before", vc = ":after", yc = "___html2canvas___pseudoelement_before", bc = "___html2canvas___pseudoelement_after", xc = "{\n content: \"\" !important;\n display: none !important;\n}", Sc = function(e) { Cc(e, "." + yc + _c + xc + "\n ." + bc + vc + xc); }, Cc = function(e, t) { var n = e.ownerDocument; if (n) { var r = n.createElement("style"); r.textContent = t, e.appendChild(r); } }, wc = function() { function e() {} return e.getOrigin = function(t) { var n = e._link; return n ? (n.href = t, n.href = n.href, n.protocol + n.hostname + n.port) : "about:blank"; }, e.isSameOrigin = function(t) { return e.getOrigin(t) === e._origin; }, e.setContext = function(t) { e._link = t.document.createElement("a"), e._origin = e.getOrigin(t.location.href); }, e._origin = "about:blank", e; }(), Tc = function() { function e(e, t) { this.context = e, this._options = t, this._cache = {}; } return e.prototype.addImage = function(e) { var t = Promise.resolve(); return this.has(e) || (Mc(e) || kc(e)) && (this._cache[e] = this.loadImage(e)).catch(function() {}), t; }, e.prototype.match = function(e) { return this._cache[e]; }, e.prototype.loadImage = function(e) { return r(this, void 0, void 0, function() { var t, n, r, a, o = this; return i(this, function(i) { switch (i.label) { case 0: return t = wc.isSameOrigin(e), n = !Ac(e) && this._options.useCORS === !0 && Lo.SUPPORT_CORS_IMAGES && !t, r = !Ac(e) && !t && !Mc(e) && typeof this._options.proxy == "string" && Lo.SUPPORT_CORS_XHR && !n, !t && this._options.allowTaint === !1 && !Ac(e) && !Mc(e) && !r && !n ? [2] : (a = e, r ? [4, this.proxy(a)] : [3, 2]); case 1: a = i.sent(), i.label = 2; case 2: return this.context.logger.debug("Added image " + e.substring(0, 256)), [4, new Promise(function(e, t) { var r = new Image(); r.onload = function() { return e(r); }, r.onerror = t, (jc(a) || n) && (r.crossOrigin = "anonymous"), r.src = a, r.complete === !0 && setTimeout(function() { return e(r); }, 500), o._options.imageTimeout > 0 && setTimeout(function() { return t("Timed out (" + o._options.imageTimeout + "ms) loading image"); }, o._options.imageTimeout); })]; case 3: return [2, i.sent()]; } }); }); }, e.prototype.has = function(e) { return this._cache[e] !== void 0; }, e.prototype.keys = function() { return Promise.resolve(Object.keys(this._cache)); }, e.prototype.proxy = function(e) { var t = this, n = this._options.proxy; if (!n) throw Error("No proxy defined"); var r = e.substring(0, 256); return new Promise(function(i, a) { var o = Lo.SUPPORT_RESPONSE_TYPE ? "blob" : "text", s = new XMLHttpRequest(); s.onload = function() { if (s.status === 200) if (o === "text") i(s.response); else { var e = new FileReader(); e.addEventListener("load", function() { return i(e.result); }, !1), e.addEventListener("error", function(e) { return a(e); }, !1), e.readAsDataURL(s.response); } else a("Failed to proxy resource " + r + " with status code " + s.status); }, s.onerror = a; var c = n.indexOf("?") > -1 ? "&" : "?"; if (s.open("GET", "" + n + c + "url=" + encodeURIComponent(e) + "&responseType=" + o), o !== "text" && s instanceof XMLHttpRequest && (s.responseType = o), t._options.imageTimeout) { var l = t._options.imageTimeout; s.timeout = l, s.ontimeout = function() { return a("Timed out (" + l + "ms) proxying " + r); }; } s.send(); }); }, e; }(), Ec = /^data:image\/svg\+xml/i, Dc = /^data:image\/.*;base64,/i, Oc = /^data:image\/.*/i, kc = function(e) { return Lo.SUPPORT_SVG_DRAWING || !Nc(e); }, Ac = function(e) { return Oc.test(e); }, jc = function(e) { return Dc.test(e); }, Mc = function(e) { return e.substr(0, 4) === "blob"; }, Nc = function(e) { return e.substr(-3).toLowerCase() === "svg" || Ec.test(e); }, q = function() { function e(e, t) { this.type = 0, this.x = e, this.y = t; } return e.prototype.add = function(t, n) { return new e(this.x + t, this.y + n); }, e; }(), Pc = function(e, t, n) { return new q(e.x + (t.x - e.x) * n, e.y + (t.y - e.y) * n); }, Fc = function() { function e(e, t, n, r) { this.type = 1, this.start = e, this.startControl = t, this.endControl = n, this.end = r; } return e.prototype.subdivide = function(t, n) { var r = Pc(this.start, this.startControl, t), i = Pc(this.startControl, this.endControl, t), a = Pc(this.endControl, this.end, t), o = Pc(r, i, t), s = Pc(i, a, t), c = Pc(o, s, t); return n ? new e(this.start, r, o, c) : new e(c, s, a, this.end); }, e.prototype.add = function(t, n) { return new e(this.start.add(t, n), this.startControl.add(t, n), this.endControl.add(t, n), this.end.add(t, n)); }, e.prototype.reverse = function() { return new e(this.end, this.endControl, this.startControl, this.start); }, e; }(), Ic = function(e) { return e.type === 1; }, Lc = function() { function e(e) { var t = e.styles, n = e.bounds, r = rr(t.borderTopLeftRadius, n.width, n.height), i = r[0], a = r[1], o = rr(t.borderTopRightRadius, n.width, n.height), s = o[0], c = o[1], l = rr(t.borderBottomRightRadius, n.width, n.height), u = l[0], d = l[1], f = rr(t.borderBottomLeftRadius, n.width, n.height), p = f[0], m = f[1], h = []; h.push((i + s) / n.width), h.push((p + u) / n.width), h.push((a + m) / n.height), h.push((c + d) / n.height); var g = Math.max.apply(Math, h); g > 1 && (i /= g, a /= g, s /= g, c /= g, u /= g, d /= g, p /= g, m /= g); var _ = n.width - s, v = n.height - d, y = n.width - u, b = n.height - m, x = t.borderTopWidth, S = t.borderRightWidth, C = t.borderBottomWidth, w = t.borderLeftWidth, T = G(t.paddingTop, e.bounds.width), E = G(t.paddingRight, e.bounds.width), D = G(t.paddingBottom, e.bounds.width), O = G(t.paddingLeft, e.bounds.width); this.topLeftBorderDoubleOuterBox = i > 0 || a > 0 ? Y(n.left + w / 3, n.top + x / 3, i - w / 3, a - x / 3, J.TOP_LEFT) : new q(n.left + w / 3, n.top + x / 3), this.topRightBorderDoubleOuterBox = i > 0 || a > 0 ? Y(n.left + _, n.top + x / 3, s - S / 3, c - x / 3, J.TOP_RIGHT) : new q(n.left + n.width - S / 3, n.top + x / 3), this.bottomRightBorderDoubleOuterBox = u > 0 || d > 0 ? Y(n.left + y, n.top + v, u - S / 3, d - C / 3, J.BOTTOM_RIGHT) : new q(n.left + n.width - S / 3, n.top + n.height - C / 3), this.bottomLeftBorderDoubleOuterBox = p > 0 || m > 0 ? Y(n.left + w / 3, n.top + b, p - w / 3, m - C / 3, J.BOTTOM_LEFT) : new q(n.left + w / 3, n.top + n.height - C / 3), this.topLeftBorderDoubleInnerBox = i > 0 || a > 0 ? Y(n.left + w * 2 / 3, n.top + x * 2 / 3, i - w * 2 / 3, a - x * 2 / 3, J.TOP_LEFT) : new q(n.left + w * 2 / 3, n.top + x * 2 / 3), this.topRightBorderDoubleInnerBox = i > 0 || a > 0 ? Y(n.left + _, n.top + x * 2 / 3, s - S * 2 / 3, c - x * 2 / 3, J.TOP_RIGHT) : new q(n.left + n.width - S * 2 / 3, n.top + x * 2 / 3), this.bottomRightBorderDoubleInnerBox = u > 0 || d > 0 ? Y(n.left + y, n.top + v, u - S * 2 / 3, d - C * 2 / 3, J.BOTTOM_RIGHT) : new q(n.left + n.width - S * 2 / 3, n.top + n.height - C * 2 / 3), this.bottomLeftBorderDoubleInnerBox = p > 0 || m > 0 ? Y(n.left + w * 2 / 3, n.top + b, p - w * 2 / 3, m - C * 2 / 3, J.BOTTOM_LEFT) : new q(n.left + w * 2 / 3, n.top + n.height - C * 2 / 3), this.topLeftBorderStroke = i > 0 || a > 0 ? Y(n.left + w / 2, n.top + x / 2, i - w / 2, a - x / 2, J.TOP_LEFT) : new q(n.left + w / 2, n.top + x / 2), this.topRightBorderStroke = i > 0 || a > 0 ? Y(n.left + _, n.top + x / 2, s - S / 2, c - x / 2, J.TOP_RIGHT) : new q(n.left + n.width - S / 2, n.top + x / 2), this.bottomRightBorderStroke = u > 0 || d > 0 ? Y(n.left + y, n.top + v, u - S / 2, d - C / 2, J.BOTTOM_RIGHT) : new q(n.left + n.width - S / 2, n.top + n.height - C / 2), this.bottomLeftBorderStroke = p > 0 || m > 0 ? Y(n.left + w / 2, n.top + b, p - w / 2, m - C / 2, J.BOTTOM_LEFT) : new q(n.left + w / 2, n.top + n.height - C / 2), this.topLeftBorderBox = i > 0 || a > 0 ? Y(n.left, n.top, i, a, J.TOP_LEFT) : new q(n.left, n.top), this.topRightBorderBox = s > 0 || c > 0 ? Y(n.left + _, n.top, s, c, J.TOP_RIGHT) : new q(n.left + n.width, n.top), this.bottomRightBorderBox = u > 0 || d > 0 ? Y(n.left + y, n.top + v, u, d, J.BOTTOM_RIGHT) : new q(n.left + n.width, n.top + n.height), this.bottomLeftBorderBox = p > 0 || m > 0 ? Y(n.left, n.top + b, p, m, J.BOTTOM_LEFT) : new q(n.left, n.top + n.height), this.topLeftPaddingBox = i > 0 || a > 0 ? Y(n.left + w, n.top + x, Math.max(0, i - w), Math.max(0, a - x), J.TOP_LEFT) : new q(n.left + w, n.top + x), this.topRightPaddingBox = s > 0 || c > 0 ? Y(n.left + Math.min(_, n.width - S), n.top + x, _ > n.width + S ? 0 : Math.max(0, s - S), Math.max(0, c - x), J.TOP_RIGHT) : new q(n.left + n.width - S, n.top + x), this.bottomRightPaddingBox = u > 0 || d > 0 ? Y(n.left + Math.min(y, n.width - w), n.top + Math.min(v, n.height - C), Math.max(0, u - S), Math.max(0, d - C), J.BOTTOM_RIGHT) : new q(n.left + n.width - S, n.top + n.height - C), this.bottomLeftPaddingBox = p > 0 || m > 0 ? Y(n.left + w, n.top + Math.min(b, n.height - C), Math.max(0, p - w), Math.max(0, m - C), J.BOTTOM_LEFT) : new q(n.left + w, n.top + n.height - C), this.topLeftContentBox = i > 0 || a > 0 ? Y(n.left + w + O, n.top + x + T, Math.max(0, i - (w + O)), Math.max(0, a - (x + T)), J.TOP_LEFT) : new q(n.left + w + O, n.top + x + T), this.topRightContentBox = s > 0 || c > 0 ? Y(n.left + Math.min(_, n.width + w + O), n.top + x + T, _ > n.width + w + O ? 0 : s - w + O, c - (x + T), J.TOP_RIGHT) : new q(n.left + n.width - (S + E), n.top + x + T), this.bottomRightContentBox = u > 0 || d > 0 ? Y(n.left + Math.min(y, n.width - (w + O)), n.top + Math.min(v, n.height + x + T), Math.max(0, u - (S + E)), d - (C + D), J.BOTTOM_RIGHT) : new q(n.left + n.width - (S + E), n.top + n.height - (C + D)), this.bottomLeftContentBox = p > 0 || m > 0 ? Y(n.left + w + O, n.top + b, Math.max(0, p - (w + O)), m - (C + D), J.BOTTOM_LEFT) : new q(n.left + w + O, n.top + n.height - (C + D)); } return e; }(), J; (function(e) { e[e.TOP_LEFT = 0] = "TOP_LEFT", e[e.TOP_RIGHT = 1] = "TOP_RIGHT", e[e.BOTTOM_RIGHT = 2] = "BOTTOM_RIGHT", e[e.BOTTOM_LEFT = 3] = "BOTTOM_LEFT"; })(J ||= {}); var Y = function(e, t, n, r, i) { var a = 4 * ((Math.sqrt(2) - 1) / 3), o = n * a, s = r * a, c = e + n, l = t + r; switch (i) { case J.TOP_LEFT: return new Fc(new q(e, l), new q(e, l - s), new q(c - o, t), new q(c, t)); case J.TOP_RIGHT: return new Fc(new q(e, t), new q(e + o, t), new q(c, l - s), new q(c, l)); case J.BOTTOM_RIGHT: return new Fc(new q(c, t), new q(c, t + s), new q(e + o, l), new q(e, l)); case J.BOTTOM_LEFT: default: return new Fc(new q(c, l), new q(c - o, l), new q(e, t + s), new q(e, t)); } }, Rc = function(e) { return [ e.topLeftBorderBox, e.topRightBorderBox, e.bottomRightBorderBox, e.bottomLeftBorderBox ]; }, zc = function(e) { return [ e.topLeftContentBox, e.topRightContentBox, e.bottomRightContentBox, e.bottomLeftContentBox ]; }, Bc = function(e) { return [ e.topLeftPaddingBox, e.topRightPaddingBox, e.bottomRightPaddingBox, e.bottomLeftPaddingBox ]; }, Vc = function() { function e(e, t, n) { this.offsetX = e, this.offsetY = t, this.matrix = n, this.type = 0, this.target = 6; } return e; }(), Hc = function() { function e(e, t) { this.path = e, this.target = t, this.type = 1; } return e; }(), Uc = function() { function e(e) { this.opacity = e, this.type = 2, this.target = 6; } return e; }(), Wc = function(e) { return e.type === 0; }, Gc = function(e) { return e.type === 1; }, Kc = function(e) { return e.type === 2; }, qc = function(e, t) { return e.length === t.length ? e.some(function(e, n) { return e === t[n]; }) : !1; }, Jc = function(e, t, n, r, i) { return e.map(function(e, a) { switch (a) { case 0: return e.add(t, n); case 1: return e.add(t + r, n); case 2: return e.add(t + r, n + i); case 3: return e.add(t, n + i); } return e; }); }, Yc = function() { function e(e) { this.element = e, this.inlineLevel = [], this.nonInlineLevel = [], this.negativeZIndex = [], this.zeroOrAutoZIndexOrTransformedOrOpacity = [], this.positiveZIndex = [], this.nonPositionedFloats = [], this.nonPositionedInlineLevel = []; } return e; }(), Xc = function() { function e(e, t) { if (this.container = e, this.parent = t, this.effects = [], this.curves = new Lc(this.container), this.container.styles.opacity < 1 && this.effects.push(new Uc(this.container.styles.opacity)), this.container.styles.transform !== null) { var n = this.container.bounds.left + this.container.styles.transformOrigin[0].number, r = this.container.bounds.top + this.container.styles.transformOrigin[1].number, i = this.container.styles.transform; this.effects.push(new Vc(n, r, i)); } if (this.container.styles.overflowX !== 0) { var a = Rc(this.curves), o = Bc(this.curves); qc(a, o) ? this.effects.push(new Hc(a, 6)) : (this.effects.push(new Hc(a, 2)), this.effects.push(new Hc(o, 4))); } } return e.prototype.getEffects = function(e) { for (var t = [2, 3].indexOf(this.container.styles.position) === -1, n = this.parent, r = this.effects.slice(0); n;) { var i = n.effects.filter(function(e) { return !Gc(e); }); if (t || n.container.styles.position !== 0 || !n.parent) { if (r.unshift.apply(r, i), t = [2, 3].indexOf(n.container.styles.position) === -1, n.container.styles.overflowX !== 0) { var a = Rc(n.curves), o = Bc(n.curves); qc(a, o) || r.unshift(new Hc(o, 6)); } } else r.unshift.apply(r, i); n = n.parent; } return r.filter(function(t) { return _a(t.target, e); }); }, e; }(), Zc = function(e, t, n, r) { e.container.elements.forEach(function(i) { var a = _a(i.flags, 4), o = _a(i.flags, 2), s = new Xc(i, e); _a(i.styles.display, 2048) && r.push(s); var c = _a(i.flags, 8) ? [] : r; if (a || o) { var l = a || i.styles.isPositioned() ? n : t, u = new Yc(s); if (i.styles.isPositioned() || i.styles.opacity < 1 || i.styles.isTransformed()) { var d = i.styles.zIndex.order; if (d < 0) { var f = 0; l.negativeZIndex.some(function(e, t) { return d > e.element.container.styles.zIndex.order ? (f = t, !1) : f > 0; }), l.negativeZIndex.splice(f, 0, u); } else if (d > 0) { var p = 0; l.positiveZIndex.some(function(e, t) { return d >= e.element.container.styles.zIndex.order ? (p = t + 1, !1) : p > 0; }), l.positiveZIndex.splice(p, 0, u); } else l.zeroOrAutoZIndexOrTransformedOrOpacity.push(u); } else i.styles.isFloating() ? l.nonPositionedFloats.push(u) : l.nonPositionedInlineLevel.push(u); Zc(s, u, a ? u : n, c); } else i.styles.isInlineLevel() ? t.inlineLevel.push(s) : t.nonInlineLevel.push(s), Zc(s, t, n, c); _a(i.flags, 8) && Qc(i, c); }); }, Qc = function(e, t) { for (var n = e instanceof ts ? e.start : 1, r = e instanceof ts ? e.reversed : !1, i = 0; i < t.length; i++) { var a = t[i]; a.container instanceof es && typeof a.container.value == "number" && a.container.value !== 0 && (n = a.container.value), a.listValue = ic(n, a.container.styles.listStyleType, !0), n += r ? -1 : 1; } }, $c = function(e) { var t = new Xc(e, null), n = new Yc(t), r = []; return Zc(t, n, n, r), Qc(t.container, r), n; }, el = function(e, t) { switch (t) { case 0: return al(e.topLeftBorderBox, e.topLeftPaddingBox, e.topRightBorderBox, e.topRightPaddingBox); case 1: return al(e.topRightBorderBox, e.topRightPaddingBox, e.bottomRightBorderBox, e.bottomRightPaddingBox); case 2: return al(e.bottomRightBorderBox, e.bottomRightPaddingBox, e.bottomLeftBorderBox, e.bottomLeftPaddingBox); default: return al(e.bottomLeftBorderBox, e.bottomLeftPaddingBox, e.topLeftBorderBox, e.topLeftPaddingBox); } }, tl = function(e, t) { switch (t) { case 0: return al(e.topLeftBorderBox, e.topLeftBorderDoubleOuterBox, e.topRightBorderBox, e.topRightBorderDoubleOuterBox); case 1: return al(e.topRightBorderBox, e.topRightBorderDoubleOuterBox, e.bottomRightBorderBox, e.bottomRightBorderDoubleOuterBox); case 2: return al(e.bottomRightBorderBox, e.bottomRightBorderDoubleOuterBox, e.bottomLeftBorderBox, e.bottomLeftBorderDoubleOuterBox); default: return al(e.bottomLeftBorderBox, e.bottomLeftBorderDoubleOuterBox, e.topLeftBorderBox, e.topLeftBorderDoubleOuterBox); } }, nl = function(e, t) { switch (t) { case 0: return al(e.topLeftBorderDoubleInnerBox, e.topLeftPaddingBox, e.topRightBorderDoubleInnerBox, e.topRightPaddingBox); case 1: return al(e.topRightBorderDoubleInnerBox, e.topRightPaddingBox, e.bottomRightBorderDoubleInnerBox, e.bottomRightPaddingBox); case 2: return al(e.bottomRightBorderDoubleInnerBox, e.bottomRightPaddingBox, e.bottomLeftBorderDoubleInnerBox, e.bottomLeftPaddingBox); default: return al(e.bottomLeftBorderDoubleInnerBox, e.bottomLeftPaddingBox, e.topLeftBorderDoubleInnerBox, e.topLeftPaddingBox); } }, rl = function(e, t) { switch (t) { case 0: return il(e.topLeftBorderStroke, e.topRightBorderStroke); case 1: return il(e.topRightBorderStroke, e.bottomRightBorderStroke); case 2: return il(e.bottomRightBorderStroke, e.bottomLeftBorderStroke); default: return il(e.bottomLeftBorderStroke, e.topLeftBorderStroke); } }, il = function(e, t) { var n = []; return Ic(e) ? n.push(e.subdivide(.5, !1)) : n.push(e), Ic(t) ? n.push(t.subdivide(.5, !0)) : n.push(t), n; }, al = function(e, t, n, r) { var i = []; return Ic(e) ? i.push(e.subdivide(.5, !1)) : i.push(e), Ic(n) ? i.push(n.subdivide(.5, !0)) : i.push(n), Ic(r) ? i.push(r.subdivide(.5, !0).reverse()) : i.push(r), Ic(t) ? i.push(t.subdivide(.5, !1).reverse()) : i.push(t), i; }, ol = function(e) { var t = e.bounds, n = e.styles; return t.add(n.borderLeftWidth, n.borderTopWidth, -(n.borderRightWidth + n.borderLeftWidth), -(n.borderTopWidth + n.borderBottomWidth)); }, sl = function(e) { var t = e.styles, n = e.bounds, r = G(t.paddingLeft, n.width), i = G(t.paddingRight, n.width), a = G(t.paddingTop, n.width), o = G(t.paddingBottom, n.width); return n.add(r + t.borderLeftWidth, a + t.borderTopWidth, -(t.borderRightWidth + t.borderLeftWidth + r + i), -(t.borderTopWidth + t.borderBottomWidth + a + o)); }, cl = function(e, t) { return e === 0 ? t.bounds : e === 2 ? sl(t) : ol(t); }, ll = function(e, t) { return e === 0 ? t.bounds : e === 2 ? sl(t) : ol(t); }, ul = function(e, t, n) { var r = cl(ml(e.styles.backgroundOrigin, t), e), i = ll(ml(e.styles.backgroundClip, t), e), a = pl(ml(e.styles.backgroundSize, t), n, r), o = a[0], s = a[1], c = rr(ml(e.styles.backgroundPosition, t), r.width - o, r.height - s); return [ hl(ml(e.styles.backgroundRepeat, t), c, a, r, i), Math.round(r.left + c[0]), Math.round(r.top + c[1]), o, s ]; }, dl = function(e) { return Wn(e) && e.value === ti.AUTO; }, fl = function(e) { return typeof e == "number"; }, pl = function(e, t, n) { var r = t[0], i = t[1], a = t[2], o = e[0], s = e[1]; if (!o) return [0, 0]; if (Qn(o) && s && Qn(s)) return [G(o, n.width), G(s, n.height)]; var c = fl(a); if (Wn(o) && (o.value === ti.CONTAIN || o.value === ti.COVER)) return fl(a) ? n.width / n.height < a == (o.value === ti.COVER) ? [n.height * a, n.height] : [n.width, n.width / a] : [n.width, n.height]; var l = fl(r), u = fl(i), d = l || u; if (dl(o) && (!s || dl(s))) return l && u ? [r, i] : !c && !d ? [n.width, n.height] : d && c ? [l ? r : i * a, u ? i : r / a] : [l ? r : n.width, u ? i : n.height]; if (c) { var f = 0, p = 0; return Qn(o) ? f = G(o, n.width) : Qn(s) && (p = G(s, n.height)), dl(o) ? f = p * a : (!s || dl(s)) && (p = f / a), [f, p]; } var m = null, h = null; if (Qn(o) ? m = G(o, n.width) : s && Qn(s) && (h = G(s, n.height)), m !== null && (!s || dl(s)) && (h = l && u ? m / r * i : n.height), h !== null && dl(o) && (m = l && u ? h / i * r : n.width), m !== null && h !== null) return [m, h]; throw Error("Unable to calculate background-size for element"); }, ml = function(e, t) { var n = e[t]; return n === void 0 ? e[0] : n; }, hl = function(e, t, n, r, i) { var a = t[0], o = t[1], s = n[0], c = n[1]; switch (e) { case 2: return [ new q(Math.round(r.left), Math.round(r.top + o)), new q(Math.round(r.left + r.width), Math.round(r.top + o)), new q(Math.round(r.left + r.width), Math.round(c + r.top + o)), new q(Math.round(r.left), Math.round(c + r.top + o)) ]; case 3: return [ new q(Math.round(r.left + a), Math.round(r.top)), new q(Math.round(r.left + a + s), Math.round(r.top)), new q(Math.round(r.left + a + s), Math.round(r.height + r.top)), new q(Math.round(r.left + a), Math.round(r.height + r.top)) ]; case 1: return [ new q(Math.round(r.left + a), Math.round(r.top + o)), new q(Math.round(r.left + a + s), Math.round(r.top + o)), new q(Math.round(r.left + a + s), Math.round(r.top + o + c)), new q(Math.round(r.left + a), Math.round(r.top + o + c)) ]; default: return [ new q(Math.round(i.left), Math.round(i.top)), new q(Math.round(i.left + i.width), Math.round(i.top)), new q(Math.round(i.left + i.width), Math.round(i.height + i.top)), new q(Math.round(i.left), Math.round(i.height + i.top)) ]; } }, gl = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7", _l = "Hidden Text", vl = function() { function e(e) { this._data = {}, this._document = e; } return e.prototype.parseMetrics = function(e, t) { var n = this._document.createElement("div"), r = this._document.createElement("img"), i = this._document.createElement("span"), a = this._document.body; n.style.visibility = "hidden", n.style.fontFamily = e, n.style.fontSize = t, n.style.margin = "0", n.style.padding = "0", n.style.whiteSpace = "nowrap", a.appendChild(n), r.src = gl, r.width = 1, r.height = 1, r.style.margin = "0", r.style.padding = "0", r.style.verticalAlign = "baseline", i.style.fontFamily = e, i.style.fontSize = t, i.style.margin = "0", i.style.padding = "0", i.appendChild(this._document.createTextNode(_l)), n.appendChild(i), n.appendChild(r); var o = r.offsetTop - i.offsetTop + 2; n.removeChild(i), n.appendChild(this._document.createTextNode(_l)), n.style.lineHeight = "normal", r.style.verticalAlign = "super"; var s = r.offsetTop - n.offsetTop + 2; return a.removeChild(n), { baseline: o, middle: s }; }, e.prototype.getMetrics = function(e, t) { var n = e + " " + t; return this._data[n] === void 0 && (this._data[n] = this.parseMetrics(e, t)), this._data[n]; }, e; }(), yl = function() { function e(e, t) { this.context = e, this.options = t; } return e; }(), bl = 1e4, xl = function(e) { t(n, e); function n(t, n) { var r = e.call(this, t, n) || this; return r._activeEffects = [], r.canvas = n.canvas ? n.canvas : document.createElement("canvas"), r.ctx = r.canvas.getContext("2d"), n.canvas || (r.canvas.width = Math.floor(n.width * n.scale), r.canvas.height = Math.floor(n.height * n.scale), r.canvas.style.width = n.width + "px", r.canvas.style.height = n.height + "px"), r.fontMetrics = new vl(document), r.ctx.scale(r.options.scale, r.options.scale), r.ctx.translate(-n.x, -n.y), r.ctx.textBaseline = "bottom", r._activeEffects = [], r.context.logger.debug("Canvas renderer initialized (" + n.width + "x" + n.height + ") with scale " + n.scale), r; } return n.prototype.applyEffects = function(e) { for (var t = this; this._activeEffects.length;) this.popEffect(); e.forEach(function(e) { return t.applyEffect(e); }); }, n.prototype.applyEffect = function(e) { this.ctx.save(), Kc(e) && (this.ctx.globalAlpha = e.opacity), Wc(e) && (this.ctx.translate(e.offsetX, e.offsetY), this.ctx.transform(e.matrix[0], e.matrix[1], e.matrix[2], e.matrix[3], e.matrix[4], e.matrix[5]), this.ctx.translate(-e.offsetX, -e.offsetY)), Gc(e) && (this.path(e.path), this.ctx.clip()), this._activeEffects.push(e); }, n.prototype.popEffect = function() { this._activeEffects.pop(), this.ctx.restore(); }, n.prototype.renderStack = function(e) { return r(this, void 0, void 0, function() { var t; return i(this, function(n) { switch (n.label) { case 0: return t = e.element.container.styles, t.isVisible() ? [4, this.renderStackContent(e)] : [3, 2]; case 1: n.sent(), n.label = 2; case 2: return [2]; } }); }); }, n.prototype.renderNode = function(e) { return r(this, void 0, void 0, function() { return i(this, function(t) { switch (t.label) { case 0: if (_a(e.container.flags, 16)) debugger; return e.container.styles.isVisible() ? [4, this.renderNodeBackgroundAndBorders(e)] : [3, 3]; case 1: return t.sent(), [4, this.renderNodeContent(e)]; case 2: t.sent(), t.label = 3; case 3: return [2]; } }); }); }, n.prototype.renderTextWithLetterSpacing = function(e, t, n) { var r = this; t === 0 ? this.ctx.fillText(e.text, e.bounds.left, e.bounds.top + n) : Ho(e.text).reduce(function(t, i) { return r.ctx.fillText(i, t, e.bounds.top + n), t + r.ctx.measureText(i).width; }, e.bounds.left); }, n.prototype.createFontStyle = function(e) { var t = e.fontVariant.filter(function(e) { return e === "normal" || e === "small-caps"; }).join(""), n = El(e.fontFamily).join(", "), r = Hn(e.fontSize) ? "" + e.fontSize.number + e.fontSize.unit : e.fontSize.number + "px"; return [ [ e.fontStyle, t, e.fontWeight, r, n ].join(" "), n, r ]; }, n.prototype.renderTextNode = function(e, t) { return r(this, void 0, void 0, function() { var n, r, a, o, s, c, l, u, d = this; return i(this, function(i) { return n = this.createFontStyle(t), r = n[0], a = n[1], o = n[2], this.ctx.font = r, this.ctx.direction = t.direction === 1 ? "rtl" : "ltr", this.ctx.textAlign = "left", this.ctx.textBaseline = "alphabetic", s = this.fontMetrics.getMetrics(a, o), c = s.baseline, l = s.middle, u = t.paintOrder, e.textBounds.forEach(function(e) { u.forEach(function(n) { switch (n) { case 0: d.ctx.fillStyle = mr(t.color), d.renderTextWithLetterSpacing(e, t.letterSpacing, c); var r = t.textShadow; r.length && e.text.trim().length && (r.slice(0).reverse().forEach(function(n) { d.ctx.shadowColor = mr(n.color), d.ctx.shadowOffsetX = n.offsetX.number * d.options.scale, d.ctx.shadowOffsetY = n.offsetY.number * d.options.scale, d.ctx.shadowBlur = n.blur.number, d.renderTextWithLetterSpacing(e, t.letterSpacing, c); }), d.ctx.shadowColor = "", d.ctx.shadowOffsetX = 0, d.ctx.shadowOffsetY = 0, d.ctx.shadowBlur = 0), t.textDecorationLine.length && (d.ctx.fillStyle = mr(t.textDecorationColor || t.color), t.textDecorationLine.forEach(function(t) { switch (t) { case 1: d.ctx.fillRect(e.bounds.left, Math.round(e.bounds.top + c), e.bounds.width, 1); break; case 2: d.ctx.fillRect(e.bounds.left, Math.round(e.bounds.top), e.bounds.width, 1); break; case 3: d.ctx.fillRect(e.bounds.left, Math.ceil(e.bounds.top + l), e.bounds.width, 1); break; } })); break; case 1: t.webkitTextStrokeWidth && e.text.trim().length && (d.ctx.strokeStyle = mr(t.webkitTextStrokeColor), d.ctx.lineWidth = t.webkitTextStrokeWidth, d.ctx.lineJoin = window.chrome ? "miter" : "round", d.ctx.strokeText(e.text, e.bounds.left, e.bounds.top + c)), d.ctx.strokeStyle = "", d.ctx.lineWidth = 0, d.ctx.lineJoin = "miter"; break; } }); }), [2]; }); }); }, n.prototype.renderReplacedElement = function(e, t, n) { if (n && e.intrinsicWidth > 0 && e.intrinsicHeight > 0) { var r = sl(e), i = Bc(t); this.path(i), this.ctx.save(), this.ctx.clip(), this.ctx.drawImage(n, 0, 0, e.intrinsicWidth, e.intrinsicHeight, r.left, r.top, r.width, r.height), this.ctx.restore(); } }, n.prototype.renderNodeContent = function(e) { return r(this, void 0, void 0, function() { var t, r, a, s, c, l, u, u, d, f, p, m, h, g, _, v, y, b, x, u, S, h, v; return i(this, function(i) { switch (i.label) { case 0: this.applyEffects(e.getEffects(4)), t = e.container, r = e.curves, a = t.styles, s = 0, c = t.textNodes, i.label = 1; case 1: return s < c.length ? (l = c[s], [4, this.renderTextNode(l, a)]) : [3, 4]; case 2: i.sent(), i.label = 3; case 3: return s++, [3, 1]; case 4: if (!(t instanceof Zo)) return [3, 8]; i.label = 5; case 5: return i.trys.push([ 5, 7, , 8 ]), [4, this.context.cache.match(t.src)]; case 6: return u = i.sent(), this.renderReplacedElement(t, r, u), [3, 8]; case 7: return i.sent(), this.context.logger.error("Error loading image " + t.src), [3, 8]; case 8: if (t instanceof Qo && this.renderReplacedElement(t, r, t.canvas), !(t instanceof $o)) return [3, 12]; i.label = 9; case 9: return i.trys.push([ 9, 11, , 12 ]), [4, this.context.cache.match(t.svg)]; case 10: return u = i.sent(), this.renderReplacedElement(t, r, u), [3, 12]; case 11: return i.sent(), this.context.logger.error("Error loading svg " + t.svg.substring(0, 255)), [3, 12]; case 12: return t instanceof ps && t.tree ? (d = new n(this.context, { scale: this.options.scale, backgroundColor: t.backgroundColor, x: 0, y: 0, width: t.width, height: t.height }), [4, d.render(t.tree)]) : [3, 14]; case 13: f = i.sent(), t.width && t.height && this.ctx.drawImage(f, 0, 0, t.width, t.height, t.bounds.left, t.bounds.top, t.bounds.width, t.bounds.height), i.label = 14; case 14: if (t instanceof us && (p = Math.min(t.bounds.width, t.bounds.height), t.type === os ? t.checked && (this.ctx.save(), this.path([ new q(t.bounds.left + p * .39363, t.bounds.top + p * .79), new q(t.bounds.left + p * .16, t.bounds.top + p * .5549), new q(t.bounds.left + p * .27347, t.bounds.top + p * .44071), new q(t.bounds.left + p * .39694, t.bounds.top + p * .5649), new q(t.bounds.left + p * .72983, t.bounds.top + p * .23), new q(t.bounds.left + p * .84, t.bounds.top + p * .34085), new q(t.bounds.left + p * .39363, t.bounds.top + p * .79) ]), this.ctx.fillStyle = mr(ls), this.ctx.fill(), this.ctx.restore()) : t.type === ss && t.checked && (this.ctx.save(), this.ctx.beginPath(), this.ctx.arc(t.bounds.left + p / 2, t.bounds.top + p / 2, p / 4, 0, Math.PI * 2, !0), this.ctx.fillStyle = mr(ls), this.ctx.fill(), this.ctx.restore())), Sl(t) && t.value.length) { switch (m = this.createFontStyle(a), h = m[0], g = m[1], _ = this.fontMetrics.getMetrics(h, g).baseline, this.ctx.font = h, this.ctx.fillStyle = mr(a.color), this.ctx.textBaseline = "alphabetic", this.ctx.textAlign = wl(t.styles.textAlign), v = sl(t), y = 0, t.styles.textAlign) { case 1: y += v.width / 2; break; case 2: y += v.width; break; } b = v.add(y, 0, 0, -v.height / 2 + 1), this.ctx.save(), this.path([ new q(v.left, v.top), new q(v.left + v.width, v.top), new q(v.left + v.width, v.top + v.height), new q(v.left, v.top + v.height) ]), this.ctx.clip(), this.renderTextWithLetterSpacing(new Ro(t.value, b), a.letterSpacing, _), this.ctx.restore(), this.ctx.textBaseline = "alphabetic", this.ctx.textAlign = "left"; } if (!_a(t.styles.display, 2048)) return [3, 20]; if (t.styles.listStyleImage === null) return [3, 19]; if (x = t.styles.listStyleImage, x.type !== 0) return [3, 18]; u = void 0, S = x.url, i.label = 15; case 15: return i.trys.push([ 15, 17, , 18 ]), [4, this.context.cache.match(S)]; case 16: return u = i.sent(), this.ctx.drawImage(u, t.bounds.left - (u.width + 10), t.bounds.top), [3, 18]; case 17: return i.sent(), this.context.logger.error("Error loading list-style-image " + S), [3, 18]; case 18: return [3, 20]; case 19: e.listValue && t.styles.listStyleType !== -1 && (h = this.createFontStyle(a)[0], this.ctx.font = h, this.ctx.fillStyle = mr(a.color), this.ctx.textBaseline = "middle", this.ctx.textAlign = "right", v = new o(t.bounds.left, t.bounds.top + G(t.styles.paddingTop, t.bounds.width), t.bounds.width, Ni(a.lineHeight, a.fontSize.number) / 2 + 1), this.renderTextWithLetterSpacing(new Ro(e.listValue, v), a.letterSpacing, Ni(a.lineHeight, a.fontSize.number) / 2 + 2), this.ctx.textBaseline = "bottom", this.ctx.textAlign = "left"), i.label = 20; case 20: return [2]; } }); }); }, n.prototype.renderStackContent = function(e) { return r(this, void 0, void 0, function() { var t, n, r, a, o, r, s, c, r, l, u, r, d, f, r, p, m, r, h, g, r; return i(this, function(i) { switch (i.label) { case 0: if (_a(e.element.container.flags, 16)) debugger; return [4, this.renderNodeBackgroundAndBorders(e.element)]; case 1: i.sent(), t = 0, n = e.negativeZIndex, i.label = 2; case 2: return t < n.length ? (r = n[t], [4, this.renderStack(r)]) : [3, 5]; case 3: i.sent(), i.label = 4; case 4: return t++, [3, 2]; case 5: return [4, this.renderNodeContent(e.element)]; case 6: i.sent(), a = 0, o = e.nonInlineLevel, i.label = 7; case 7: return a < o.length ? (r = o[a], [4, this.renderNode(r)]) : [3, 10]; case 8: i.sent(), i.label = 9; case 9: return a++, [3, 7]; case 10: s = 0, c = e.nonPositionedFloats, i.label = 11; case 11: return s < c.length ? (r = c[s], [4, this.renderStack(r)]) : [3, 14]; case 12: i.sent(), i.label = 13; case 13: return s++, [3, 11]; case 14: l = 0, u = e.nonPositionedInlineLevel, i.label = 15; case 15: return l < u.length ? (r = u[l], [4, this.renderStack(r)]) : [3, 18]; case 16: i.sent(), i.label = 17; case 17: return l++, [3, 15]; case 18: d = 0, f = e.inlineLevel, i.label = 19; case 19: return d < f.length ? (r = f[d], [4, this.renderNode(r)]) : [3, 22]; case 20: i.sent(), i.label = 21; case 21: return d++, [3, 19]; case 22: p = 0, m = e.zeroOrAutoZIndexOrTransformedOrOpacity, i.label = 23; case 23: return p < m.length ? (r = m[p], [4, this.renderStack(r)]) : [3, 26]; case 24: i.sent(), i.label = 25; case 25: return p++, [3, 23]; case 26: h = 0, g = e.positiveZIndex, i.label = 27; case 27: return h < g.length ? (r = g[h], [4, this.renderStack(r)]) : [3, 30]; case 28: i.sent(), i.label = 29; case 29: return h++, [3, 27]; case 30: return [2]; } }); }); }, n.prototype.mask = function(e) { this.ctx.beginPath(), this.ctx.moveTo(0, 0), this.ctx.lineTo(this.canvas.width, 0), this.ctx.lineTo(this.canvas.width, this.canvas.height), this.ctx.lineTo(0, this.canvas.height), this.ctx.lineTo(0, 0), this.formatPath(e.slice(0).reverse()), this.ctx.closePath(); }, n.prototype.path = function(e) { this.ctx.beginPath(), this.formatPath(e), this.ctx.closePath(); }, n.prototype.formatPath = function(e) { var t = this; e.forEach(function(e, n) { var r = Ic(e) ? e.start : e; n === 0 ? t.ctx.moveTo(r.x, r.y) : t.ctx.lineTo(r.x, r.y), Ic(e) && t.ctx.bezierCurveTo(e.startControl.x, e.startControl.y, e.endControl.x, e.endControl.y, e.end.x, e.end.y); }); }, n.prototype.renderRepeat = function(e, t, n, r) { this.path(e), this.ctx.fillStyle = t, this.ctx.translate(n, r), this.ctx.fill(), this.ctx.translate(-n, -r); }, n.prototype.resizeImage = function(e, t, n) { if (e.width === t && e.height === n) return e; var r = (this.canvas.ownerDocument ?? document).createElement("canvas"); return r.width = Math.max(1, t), r.height = Math.max(1, n), r.getContext("2d").drawImage(e, 0, 0, e.width, e.height, 0, 0, t, n), r; }, n.prototype.renderBackgroundImage = function(e) { return r(this, void 0, void 0, function() { var t, n, r, a, o, s; return i(this, function(c) { switch (c.label) { case 0: t = e.styles.backgroundImage.length - 1, n = function(n) { var a, o, s, c, l, u, d, f, p, m, c, l, u, d, f, h, g, _, v, y, b, x, S, C, p, w, c, T, E, d, f, D, l, u, O, k, A, j, M, N, P, F; return i(this, function(i) { switch (i.label) { case 0: if (n.type !== 0) return [3, 5]; a = void 0, o = n.url, i.label = 1; case 1: return i.trys.push([ 1, 3, , 4 ]), [4, r.context.cache.match(o)]; case 2: return a = i.sent(), [3, 4]; case 3: return i.sent(), r.context.logger.error("Error loading background-image " + o), [3, 4]; case 4: return a && (s = ul(e, t, [ a.width, a.height, a.width / a.height ]), c = s[0], l = s[1], u = s[2], d = s[3], f = s[4], p = r.ctx.createPattern(r.resizeImage(a, d, f), "repeat"), r.renderRepeat(c, p, l, u)), [3, 6]; case 5: Gr(n) ? (m = ul(e, t, [ null, null, null ]), c = m[0], l = m[1], u = m[2], d = m[3], f = m[4], h = Or(n.angle, d, f), g = h[0], _ = h[1], v = h[2], y = h[3], b = h[4], x = document.createElement("canvas"), x.width = d, x.height = f, S = x.getContext("2d"), C = S.createLinearGradient(_, y, v, b), Er(n.stops, g).forEach(function(e) { return C.addColorStop(e.stop, mr(e.color)); }), S.fillStyle = C, S.fillRect(0, 0, d, f), d > 0 && f > 0 && (p = r.ctx.createPattern(x, "repeat"), r.renderRepeat(c, p, l, u))) : Kr(n) && (w = ul(e, t, [ null, null, null ]), c = w[0], T = w[1], E = w[2], d = w[3], f = w[4], D = n.position.length === 0 ? [tr] : n.position, l = G(D[0], d), u = G(D[D.length - 1], f), O = jr(n, l, u, d, f), k = O[0], A = O[1], k > 0 && A > 0 && (j = r.ctx.createRadialGradient(T + l, E + u, 0, T + l, E + u, k), Er(n.stops, k * 2).forEach(function(e) { return j.addColorStop(e.stop, mr(e.color)); }), r.path(c), r.ctx.fillStyle = j, k === A ? r.ctx.fill() : (M = e.bounds.left + .5 * e.bounds.width, N = e.bounds.top + .5 * e.bounds.height, P = A / k, F = 1 / P, r.ctx.save(), r.ctx.translate(M, N), r.ctx.transform(1, 0, 0, P, 0, 0), r.ctx.translate(-M, -N), r.ctx.fillRect(T, F * (E - N) + N, d, f * F), r.ctx.restore()))), i.label = 6; case 6: return t--, [2]; } }); }, r = this, a = 0, o = e.styles.backgroundImage.slice(0).reverse(), c.label = 1; case 1: return a < o.length ? (s = o[a], [5, n(s)]) : [3, 4]; case 2: c.sent(), c.label = 3; case 3: return a++, [3, 1]; case 4: return [2]; } }); }); }, n.prototype.renderSolidBorder = function(e, t, n) { return r(this, void 0, void 0, function() { return i(this, function(r) { return this.path(el(n, t)), this.ctx.fillStyle = mr(e), this.ctx.fill(), [2]; }); }); }, n.prototype.renderDoubleBorder = function(e, t, n, a) { return r(this, void 0, void 0, function() { var r, o; return i(this, function(i) { switch (i.label) { case 0: return t < 3 ? [4, this.renderSolidBorder(e, n, a)] : [3, 2]; case 1: return i.sent(), [2]; case 2: return r = tl(a, n), this.path(r), this.ctx.fillStyle = mr(e), this.ctx.fill(), o = nl(a, n), this.path(o), this.ctx.fill(), [2]; } }); }); }, n.prototype.renderNodeBackgroundAndBorders = function(e) { return r(this, void 0, void 0, function() { var t, n, r, a, o, s, c, l, u = this; return i(this, function(i) { switch (i.label) { case 0: return this.applyEffects(e.getEffects(2)), t = e.container.styles, n = !pr(t.backgroundColor) || t.backgroundImage.length, r = [ { style: t.borderTopStyle, color: t.borderTopColor, width: t.borderTopWidth }, { style: t.borderRightStyle, color: t.borderRightColor, width: t.borderRightWidth }, { style: t.borderBottomStyle, color: t.borderBottomColor, width: t.borderBottomWidth }, { style: t.borderLeftStyle, color: t.borderLeftColor, width: t.borderLeftWidth } ], a = Cl(ml(t.backgroundClip, 0), e.curves), n || t.boxShadow.length ? (this.ctx.save(), this.path(a), this.ctx.clip(), pr(t.backgroundColor) || (this.ctx.fillStyle = mr(t.backgroundColor), this.ctx.fill()), [4, this.renderBackgroundImage(e.container)]) : [3, 2]; case 1: i.sent(), this.ctx.restore(), t.boxShadow.slice(0).reverse().forEach(function(t) { u.ctx.save(); var n = Rc(e.curves), r = t.inset ? 0 : bl, i = Jc(n, -r + (t.inset ? 1 : -1) * t.spread.number, (t.inset ? 1 : -1) * t.spread.number, t.spread.number * (t.inset ? -2 : 2), t.spread.number * (t.inset ? -2 : 2)); t.inset ? (u.path(n), u.ctx.clip(), u.mask(i)) : (u.mask(n), u.ctx.clip(), u.path(i)), u.ctx.shadowOffsetX = t.offsetX.number + r, u.ctx.shadowOffsetY = t.offsetY.number, u.ctx.shadowColor = mr(t.color), u.ctx.shadowBlur = t.blur.number, u.ctx.fillStyle = t.inset ? mr(t.color) : "rgba(0,0,0,1)", u.ctx.fill(), u.ctx.restore(); }), i.label = 2; case 2: o = 0, s = 0, c = r, i.label = 3; case 3: return s < c.length ? (l = c[s], l.style !== 0 && !pr(l.color) && l.width > 0 ? l.style === 2 ? [4, this.renderDashedDottedBorder(l.color, l.width, o, e.curves, 2)] : [3, 5] : [3, 11]) : [3, 13]; case 4: return i.sent(), [3, 11]; case 5: return l.style === 3 ? [4, this.renderDashedDottedBorder(l.color, l.width, o, e.curves, 3)] : [3, 7]; case 6: return i.sent(), [3, 11]; case 7: return l.style === 4 ? [4, this.renderDoubleBorder(l.color, l.width, o, e.curves)] : [3, 9]; case 8: return i.sent(), [3, 11]; case 9: return [4, this.renderSolidBorder(l.color, o, e.curves)]; case 10: i.sent(), i.label = 11; case 11: o++, i.label = 12; case 12: return s++, [3, 3]; case 13: return [2]; } }); }); }, n.prototype.renderDashedDottedBorder = function(e, t, n, a, o) { return r(this, void 0, void 0, function() { var r, s, c, l, u, d, f, p, m, h, g, _, v, y, b, x, b, x; return i(this, function(i) { return this.ctx.save(), r = rl(a, n), s = el(a, n), o === 2 && (this.path(s), this.ctx.clip()), Ic(s[0]) ? (c = s[0].start.x, l = s[0].start.y) : (c = s[0].x, l = s[0].y), Ic(s[1]) ? (u = s[1].end.x, d = s[1].end.y) : (u = s[1].x, d = s[1].y), f = Math.abs(n === 0 || n === 2 ? c - u : l - d), this.ctx.beginPath(), o === 3 ? this.formatPath(r) : this.formatPath(s.slice(0, 2)), p = t < 3 ? t * 3 : t * 2, m = t < 3 ? t * 2 : t, o === 3 && (p = t, m = t), h = !0, f <= p * 2 ? h = !1 : f <= p * 2 + m ? (g = f / (2 * p + m), p *= g, m *= g) : (_ = Math.floor((f + m) / (p + m)), v = (f - _ * p) / (_ - 1), y = (f - (_ + 1) * p) / _, m = y <= 0 || Math.abs(m - v) < Math.abs(m - y) ? v : y), h && (o === 3 ? this.ctx.setLineDash([0, p + m]) : this.ctx.setLineDash([p, m])), o === 3 ? (this.ctx.lineCap = "round", this.ctx.lineWidth = t) : this.ctx.lineWidth = t * 2 + 1.1, this.ctx.strokeStyle = mr(e), this.ctx.stroke(), this.ctx.setLineDash([]), o === 2 && (Ic(s[0]) && (b = s[3], x = s[0], this.ctx.beginPath(), this.formatPath([new q(b.end.x, b.end.y), new q(x.start.x, x.start.y)]), this.ctx.stroke()), Ic(s[1]) && (b = s[1], x = s[2], this.ctx.beginPath(), this.formatPath([new q(b.end.x, b.end.y), new q(x.start.x, x.start.y)]), this.ctx.stroke())), this.ctx.restore(), [2]; }); }); }, n.prototype.render = function(e) { return r(this, void 0, void 0, function() { var t; return i(this, function(n) { switch (n.label) { case 0: return this.options.backgroundColor && (this.ctx.fillStyle = mr(this.options.backgroundColor), this.ctx.fillRect(this.options.x, this.options.y, this.options.width, this.options.height)), t = $c(e), [4, this.renderStack(t)]; case 1: return n.sent(), this.applyEffects([]), [2, this.canvas]; } }); }); }, n; }(yl), Sl = function(e) { return e instanceof fs || e instanceof ds ? !0 : e instanceof us && e.type !== ss && e.type !== os; }, Cl = function(e, t) { switch (e) { case 0: return Rc(t); case 2: return zc(t); default: return Bc(t); } }, wl = function(e) { switch (e) { case 1: return "center"; case 2: return "right"; default: return "left"; } }, Tl = ["-apple-system", "system-ui"], El = function(e) { return /iPhone OS 15_(0|1)/.test(window.navigator.userAgent) ? e.filter(function(e) { return Tl.indexOf(e) === -1; }) : e; }, Dl = function(e) { t(n, e); function n(t, n) { var r = e.call(this, t, n) || this; return r.canvas = n.canvas ? n.canvas : document.createElement("canvas"), r.ctx = r.canvas.getContext("2d"), r.options = n, r.canvas.width = Math.floor(n.width * n.scale), r.canvas.height = Math.floor(n.height * n.scale), r.canvas.style.width = n.width + "px", r.canvas.style.height = n.height + "px", r.ctx.scale(r.options.scale, r.options.scale), r.ctx.translate(-n.x, -n.y), r.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized (" + n.width + "x" + n.height + " at " + n.x + "," + n.y + ") with scale " + n.scale), r; } return n.prototype.render = function(e) { return r(this, void 0, void 0, function() { var t, n; return i(this, function(r) { switch (r.label) { case 0: return t = Fo(this.options.width * this.options.scale, this.options.height * this.options.scale, this.options.scale, this.options.scale, e), [4, Ol(t)]; case 1: return n = r.sent(), this.options.backgroundColor && (this.ctx.fillStyle = mr(this.options.backgroundColor), this.ctx.fillRect(0, 0, this.options.width * this.options.scale, this.options.height * this.options.scale)), this.ctx.drawImage(n, -this.options.x * this.options.scale, -this.options.y * this.options.scale), [2, this.canvas]; } }); }); }, n; }(yl), Ol = function(e) { return new Promise(function(t, n) { var r = new Image(); r.onload = function() { t(r); }, r.onerror = n, r.src = "data:image/svg+xml;charset=utf-8," + encodeURIComponent(new XMLSerializer().serializeToString(e)); }); }, kl = function() { function e(e) { var t = e.id, n = e.enabled; this.id = t, this.enabled = n, this.start = Date.now(); } return e.prototype.debug = function() { var e = [...arguments]; this.enabled && (typeof window < "u" && window.console && typeof console.debug == "function" ? console.debug.apply(console, a([this.id, this.getTime() + "ms"], e)) : this.info.apply(this, e)); }, e.prototype.getTime = function() { return Date.now() - this.start; }, e.prototype.info = function() { var e = [...arguments]; this.enabled && typeof window < "u" && window.console && typeof console.info == "function" && console.info.apply(console, a([this.id, this.getTime() + "ms"], e)); }, e.prototype.warn = function() { var e = [...arguments]; this.enabled && (typeof window < "u" && window.console && typeof console.warn == "function" ? console.warn.apply(console, a([this.id, this.getTime() + "ms"], e)) : this.info.apply(this, e)); }, e.prototype.error = function() { var e = [...arguments]; this.enabled && (typeof window < "u" && window.console && typeof console.error == "function" ? console.error.apply(console, a([this.id, this.getTime() + "ms"], e)) : this.info.apply(this, e)); }, e.instances = {}, e; }(), Al = function() { function e(t, n) { this.windowBounds = n, this.instanceName = "#" + e.instanceCount++, this.logger = new kl({ id: this.instanceName, enabled: t.logging }), this.cache = t.cache ?? new Tc(this, t); } return e.instanceCount = 1, e; }(), jl = function(e, t) { return t === void 0 && (t = {}), Ml(e, t); }; typeof window < "u" && wc.setContext(window); var Ml = function(e, t) { return r(void 0, void 0, void 0, function() { var r, a, l, u, d, f, p, m, h, g, _, v, y, b, x, S, C, w, T, E, D, O, D; return i(this, function(i) { switch (i.label) { case 0: if (!e || typeof e != "object") return [2, Promise.reject("Invalid element provided as first argument")]; if (r = e.ownerDocument, !r) throw Error("Element is not attached to a Document"); if (a = r.defaultView, !a) throw Error("Document is not attached to a Window"); return l = { allowTaint: t.allowTaint ?? !1, imageTimeout: t.imageTimeout ?? 15e3, proxy: t.proxy, useCORS: t.useCORS ?? !1 }, u = n({ logging: t.logging ?? !0, cache: t.cache }, l), d = { windowWidth: t.windowWidth ?? a.innerWidth, windowHeight: t.windowHeight ?? a.innerHeight, scrollX: t.scrollX ?? a.pageXOffset, scrollY: t.scrollY ?? a.pageYOffset }, f = new o(d.scrollX, d.scrollY, d.windowWidth, d.windowHeight), p = new Al(u, f), m = t.foreignObjectRendering ?? !1, h = { allowTaint: t.allowTaint ?? !1, onclone: t.onclone, ignoreElements: t.ignoreElements, inlineImages: m, copyStyles: m }, p.logger.debug("Starting document clone with size " + f.width + "x" + f.height + " scrolled to " + -f.left + "," + -f.top), g = new oc(p, e, h), _ = g.clonedReferenceElement, _ ? [4, g.toIFrame(r, f)] : [2, Promise.reject("Unable to find element in cloned iframe")]; case 1: return v = i.sent(), y = ks(_) || Ds(_) ? c(_.ownerDocument) : s(p, _), b = y.width, x = y.height, S = y.left, C = y.top, w = Nl(p, _, t.backgroundColor), T = { canvas: t.canvas, backgroundColor: w, scale: t.scale ?? a.devicePixelRatio ?? 1, x: (t.x ?? 0) + S, y: (t.y ?? 0) + C, width: t.width ?? Math.ceil(b), height: t.height ?? Math.ceil(x) }, m ? (p.logger.debug("Document cloned, using foreign object rendering"), D = new Dl(p, T), [4, D.render(_)]) : [3, 3]; case 2: return E = i.sent(), [3, 5]; case 3: return p.logger.debug("Document cloned, element located at " + S + "," + C + " with size " + b + "x" + x + " using computed rendering"), p.logger.debug("Starting DOM parsing"), O = _s(p, _), w === O.styles.backgroundColor && (O.styles.backgroundColor = Sr.TRANSPARENT), p.logger.debug("Starting renderer for element at " + T.x + "," + T.y + " with size " + T.width + "x" + T.height), D = new xl(p, T), [4, D.render(O)]; case 4: E = i.sent(), i.label = 5; case 5: return (t.removeContainer ?? !0) && (oc.destroy(v) || p.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")), p.logger.debug("Finished rendering"), [2, E]; } }); }); }, Nl = function(e, t, n) { var r = t.ownerDocument, i = r.documentElement ? xr(e, getComputedStyle(r.documentElement).backgroundColor) : Sr.TRANSPARENT, a = r.body ? xr(e, getComputedStyle(r.body).backgroundColor) : Sr.TRANSPARENT, o = typeof n == "string" ? xr(e, n) : n === null ? Sr.TRANSPARENT : 4294967295; return t === r.documentElement ? pr(i) ? pr(a) ? o : a : i : o; }; return jl; })); })))(), 1), eu = /* @__PURE__ */ function(e) { return e.TOP = "top", e.BOTTOM = "bottom", e.LEFT = "left", e.RIGHT = "right", e; }({}), tu = class { name; group; cubeData = /* @__PURE__ */ new Map(); panelMesh = null; options; titleObject = null; titleConfig = null; fontLoader = new Qe(); font = null; smallTextObjects = []; smallTextPlanes = []; smallTextCanvas = null; visibleColumns = /* @__PURE__ */ new Set(); constructor(t) { this.options = { name: t.name, size: t.size ?? 2, cubeSize: t.cubeSize ?? .3, cubeGap: t.cubeGap ?? .05, position: t.position ?? new e.Vector3(0, 0, 0), rotation: t.rotation ?? new e.Euler(0, 0, 0), initialData: t.initialData ?? [], titleConfig: t.titleConfig ?? { text: "", position: eu.TOP, rotation: 0, fontSize: 24, color: "#000000" }, smallTextConfig: t.smallTextConfig ?? { position: eu.RIGHT, smallText1: [], smallText2: [], rotation: 0 } }, this.name = this.options.name, t.visibleColumns === void 0 ? this.visibleColumns = new Set([ 0, 1, 2, 3, 4 ]) : this.visibleColumns = new Set(t.visibleColumns), this.group = new e.Group(), this.group.name = this.name, this.group.position.copy(this.options.position), this.group.rotation.copy(this.options.rotation), zr.setHiddenAndUnselectable(this.group), this.createPanel(), t.initialData !== void 0 && this.setPanelData(t.initialData), t.titleConfig !== void 0 && this.setTitle(t.titleConfig), t.smallTextConfig !== void 0 && this.setSmallText(t.smallTextConfig); } static getModelSize(t) { let n = new e.Box3().setFromObject(t), r = new e.Vector3(); return n.getSize(r), r; } static getModelFaceCenters(t) { let n = new e.Box3().setFromObject(t), r = new e.Vector3(); n.getCenter(r); let i = new e.Vector3(); return n.getSize(i), { YF: new e.Vector3(r.x, r.y, r.z + i.z / 2), BEI: new e.Vector3(r.x, r.y, r.z - i.z / 2), ZUO: new e.Vector3(r.x - i.x / 2, r.y, r.z), YOU: new e.Vector3(r.x + i.x / 2, r.y, r.z), SHANG: new e.Vector3(r.x, r.y + i.y / 2, r.z), XIA: new e.Vector3(r.x, r.y - i.y / 2, r.z) }; } createPanel() { let { size: t } = this.options, n = new e.PlaneGeometry(t, t), r = new e.MeshBasicMaterial({ color: new e.Color(16777215), side: e.DoubleSide, opacity: 1, transparent: !1 }); this.panelMesh = new e.Mesh(n, r), this.panelMesh.name = `${this.name}_panel`, this.panelMesh.renderOrder = 2, this.group.add(this.panelMesh), this.initDefaultData(); } initDefaultData() { for (let t = 0; t < 5; t++) for (let n = 0; n < 5; n++) { let r = `${t}_${n}`; this.cubeData.set(r, { color: new e.Color(13421772), text: "" }); } } generatePanelHTML() { let { cubeSize: t, cubeGap: n } = this.options, r = 5 * t + 4 * n, i = t / r, a = n / r, o = i * 512, s = `
`; for (let t = 0; t < 5; t++) for (let n = 0; n < 5; n++) { let r = `${t}_${n}`, i = this.cubeData.get(r) || { color: new e.Color(13421772), text: "" }, a = this.visibleColumns.has(n), c = a ? i.color.getStyle() : "#ffffff", l = a ? i.text : "", u = a ? "border: 2px solid rgba(0,0,0,0.5);" : ""; s += `
${l}
`; } return s += "
", s; } async updatePanelTexture() { let t = this.generatePanelHTML(), n = document.createElement("div"); n.style.position = "fixed", n.style.left = "-9999px", n.style.top = "-9999px", n.style.zIndex = "9999", n.style.backgroundColor = "#fff", n.innerHTML = t, document.body.appendChild(n); try { await new Promise((e) => setTimeout(e, 100)); let t = await (0, $l.default)(n, { scale: 2, useCORS: !0, logging: !1, backgroundColor: null }); this.smallTextCanvas = t; let r = new e.CanvasTexture(t); r.needsUpdate = !0, this.panelMesh && this.panelMesh.material instanceof e.MeshBasicMaterial && (this.panelMesh.material.map = r, this.panelMesh.material.needsUpdate = !0); } catch (e) { console.error("Error updating panel texture:", e); } finally { document.body.removeChild(n); } } setCubeData(e, t, n) { let r = `${e}_${t}`; this.cubeData.set(r, n), this.updatePanelTexture(); } getCubeData(e, t) { let n = `${e}_${t}`; return this.cubeData.get(n); } setPanelData(e) { if (Array.isArray(e)) for (let t = 0; t < e.length; t++) { let n = e[t]; if (Array.isArray(n)) for (let e = 0; e < n.length; e++) { let r = n[e]; if (r !== void 0) { let n = `${t}_${e}`; this.cubeData.set(n, r); } } } this.updatePanelTexture(); } setTitle(e) { this.clearTitle(), this.titleConfig = { text: e.text, position: e.position, rotation: e.rotation ?? 0, fontSize: e.fontSize ?? 24, color: e.color ?? "#000000", offset: e.offset ?? .1 }, this.loadFontAndCreateTitle(); } loadFontAndCreateTitle() { this.fontLoader.load("https://threejs.org/examples/fonts/helvetiker_regular.typeface.json", (e) => { this.font = e, this.createTitleObject(); }, void 0, (e) => { console.error("[CubePanel] Error loading font:", e); }); } createTitleObject() { if (!this.titleConfig || !this.font) { console.warn("[CubePanel] createTitleObject: titleConfig or font is null"); return; } let { size: t } = this.options, { text: n, position: r, rotation: i = 0, fontSize: a = 24, color: o = "#000000", offset: s = .1 } = this.titleConfig, c = this.font.generateShapes(n, a), l = new e.ShapeGeometry(c); l.computeBoundingBox(); let u = -.5 * (l.boundingBox.max.x - l.boundingBox.min.x); l.translate(u, 0, 0); let d = new e.MeshBasicMaterial({ color: new e.Color(o), side: e.DoubleSide, opacity: 1, transparent: !1 }), f = new e.Mesh(l, d), p = t / 2 + s; switch (r) { case eu.TOP: f.position.set(0, p, 0); break; case eu.BOTTOM: f.position.set(0, -p, 0); break; case eu.LEFT: f.position.set(-p, 0, 0), f.rotation.z = Math.PI / 2; break; case eu.RIGHT: f.position.set(p, 0, 0), f.rotation.z = -Math.PI / 2; break; } i !== 0 && (f.rotation.z += i * Math.PI / 180), this.group.add(f), this.titleObject = f; } async setSmallText(e) { this.clearSmallText(), await this.createSmallTextHTML(e); } async createSmallTextHTML(t) { let { size: n } = this.options, { position: r, smallText1: i, smallText2: a, rotation: o = 0 } = t, s = document.createElement("div"); s.style.position = "fixed", s.style.left = "-9999px", s.style.top = "-9999px", s.style.zIndex = "9999", s.style.backgroundColor = "transparent", s.style.width = "512px", s.style.height = "512px"; let c = 512 / 5; if (i) for (let e of i) { let { text: t, cubeIndex: n, offset: r, fontSize: i = 5, color: a = "#000000", fontWeight: o = "normal" } = e; if (n >= 0 && n < 5) { let e = document.createElement("div"); e.style.position = "absolute", e.style.left = `${r}px`, e.style.fontSize = `${i}px`, e.style.color = a, e.style.fontWeight = o, e.style.backgroundColor = "transparent", e.textContent = t; let l = n * c + c / 2; e.style.top = `${l}px`, e.style.transform = "translateY(-50%)", s.appendChild(e); } } if (a) for (let e of a) { let { text: t, cubeIndex: n, offset: r, fontSize: i = 12, color: a = "#000000", fontWeight: o = "normal" } = e; if (n >= 0 && n < 5) { let e = document.createElement("div"); e.style.position = "absolute", e.style.left = `${r}px`, e.style.fontSize = `${i}px`, e.style.color = a, e.style.fontWeight = o, e.style.backgroundColor = "transparent", e.textContent = t; let l = n * c + c / 2; e.style.top = `${l}px`, e.style.transform = "translateY(-50%)", s.appendChild(e); } } if (document.body.appendChild(s), !(i === void 0 && a == null)) try { await new Promise((e) => setTimeout(e, 100)); let t = await (0, $l.default)(s, { scale: 2, useCORS: !0, logging: !1, backgroundColor: null }), i = new e.CanvasTexture(t); i.needsUpdate = !0; let a = n, c = n, l = new e.PlaneGeometry(a, c), u = new e.MeshBasicMaterial({ map: i, side: e.DoubleSide, transparent: !0, depthWrite: !1 }), d = new e.Mesh(l, u), f = n; switch (r) { case eu.TOP: d.position.set(0, f, 0); break; case eu.BOTTOM: d.position.set(0, -f, 0); break; case eu.LEFT: d.position.set(-f, 0, 0); break; case eu.RIGHT: d.position.set(f, 0, 0); break; } o !== 0 && (d.rotation.z += o * Math.PI / 180), this.group.add(d), this.smallTextObjects.push(d), this.smallTextPlanes.push(d); } catch (e) { console.error("Error creating small text HTML:", e); } finally { document.body.removeChild(s); } } clearSmallText() { this.smallTextObjects.forEach((e) => { e.parent ? (e.parent.remove(e), this.group.remove(e.parent)) : this.group.remove(e), e.geometry && e.geometry.dispose(), e.material && (Array.isArray(e.material) ? e.material.forEach((e) => e.dispose()) : e.material.dispose()); }), this.smallTextObjects = [], this.smallTextPlanes = []; } clearTitle() { this.titleObject &&= (this.group.remove(this.titleObject), this.titleObject.geometry && this.titleObject.geometry.dispose(), this.titleObject.material && (Array.isArray(this.titleObject.material) ? this.titleObject.material.forEach((e) => e.dispose()) : this.titleObject.material.dispose()), null), this.titleConfig = null; } addDebugSpheres() { this.smallTextObjects.forEach((t) => { let n = new e.SphereGeometry(.03, 12, 12), r = new e.MeshBasicMaterial({ color: 16711680 }), i = new e.Mesh(n, r); t.add(i); }); } clearDebugSpheres() { this.smallTextObjects.forEach((t) => { let n = []; t.children.forEach((t) => { t instanceof e.Mesh && t.geometry instanceof e.SphereGeometry && n.push(t); }), n.forEach((e) => { t.remove(e), e.geometry && e.geometry.dispose(), e.material && (Array.isArray(e.material) ? e.material.forEach((e) => e.dispose()) : e.material.dispose()); }); }); } dispose() { this.clearTitle(), this.clearSmallText(), this.panelMesh && (this.panelMesh.geometry && this.panelMesh.geometry.dispose(), this.panelMesh.material && (Array.isArray(this.panelMesh.material) ? this.panelMesh.material.forEach((e) => { e.map && e.map.dispose(), e.dispose(); }) : this.panelMesh.material instanceof e.Material && (this.panelMesh.material.map && this.panelMesh.material.map.dispose(), this.panelMesh.material.dispose()))), this.cubeData.clear(); } setVisibleColumns(e) { this.visibleColumns = new Set(e), this.updatePanelTexture(); } toggleColumnVisibility(e) { this.visibleColumns.has(e) ? this.visibleColumns.delete(e) : this.visibleColumns.add(e), this.updatePanelTexture(); } }, nu = class { points; textureUrl; options; pathPointList; geometry; material; mesh; texture; playing; progress; playSpeed; textureAnimating; textureAnimationSpeed; constructor(e = {}) { let { points: t = [], textureUrl: n = null, radius: r = .2, radialSegments: i = 8, cornerRadius: a = .3, cornerSplit: o = 10, scrollSpeed: s = .03, flowDirection: c = 1, ...l } = e; this.points = t, this.textureUrl = n, this.options = { radius: r, radialSegments: i, cornerRadius: a, cornerSplit: o, scrollSpeed: s, flowDirection: c, ...l }, this.pathPointList = null, this.geometry = null, this.material = null, this.mesh = null, this.texture = null, this.playing = !1, this.progress = 0, this.playSpeed = .14, this.textureAnimating = !1, this.textureAnimationSpeed = 1, this.init(); } init() { this.pathPointList = new zl(), this.pathPointList.set(this.points, this.options.cornerRadius, this.options.cornerSplit, null, !1), this.geometry = new Jl({ pathPointList: this.pathPointList, options: { radius: this.options.radius, radialSegments: this.options.radialSegments } }), console.log(this.geometry), this.material = new e.MeshPhongMaterial({ color: 5824222, depthWrite: !0, transparent: !0, opacity: .9, side: e.FrontSide }), this.textureUrl && this.loadTexture(this.textureUrl), this.mesh = new e.Mesh(this.geometry, this.material); } loadTexture(t) { this.texture = new e.TextureLoader().load(t, (t) => { t.wrapS = t.wrapT = e.RepeatWrapping, t.anisotropy = 16, t.colorSpace = e.SRGBColorSpace, this.material && (this.material.map = t, this.material.needsUpdate = !0); }); } addToScene(e) { this.mesh && e && e.add(this.mesh); } removeFromScene(e) { this.mesh && e && e.remove(this.mesh); } startAnimation() { this.playing = !0, this.progress = 0, this.#e(); } stopAnimation() { this.playing = !1, this.#t(); } startTextureAnimation() { this.textureAnimating = !0, this.#n(); } stopTextureAnimation() { this.textureAnimating = !1, this.#r(); } update() { if (this.playing && this.pathPointList && this.geometry) { let e = this.pathPointList.distance(); e > 0 && (this.progress += this.playSpeed / e * this.options.flowDirection, this.progress > 1 ? (this.playing = !1, this.progress = 1) : this.progress < 0 && (this.playing = !1, this.progress = 0), this.geometry.update(this.pathPointList, { radius: this.options.radius, radialSegments: this.options.radialSegments, progress: this.progress })); } } updateTextureAnimation() { this.texture && this.textureAnimating && (this.texture.offset.x -= this.options.scrollSpeed * this.options.flowDirection * this.textureAnimationSpeed, this.texture.repeat.x = 1); } setTextureAnimationSpeed(e) { this.textureAnimationSpeed = e; } getTextureAnimationSpeed() { return this.textureAnimationSpeed; } toggleTextureAnimation() { return this.textureAnimating = !this.textureAnimating, this.textureAnimating; } setFlowDirection(e) { this.options.flowDirection = e; } setScrollSpeed(e) { this.options.scrollSpeed = e; } setPlaySpeed(e) { this.playSpeed = e; } updatePoints(e) { this.points = e || [], this.pathPointList && this.geometry && (this.pathPointList.set(this.points, this.options.cornerRadius, this.options.cornerSplit, null, !1), this.geometry.update(this.pathPointList, { radius: this.options.radius, radialSegments: this.options.radialSegments })); } updateRadius(e) { this.options.radius = e, this.geometry && this.pathPointList && this.geometry.update(this.pathPointList, { radius: this.options.radius, radialSegments: this.options.radialSegments }); } getMesh() { return this.mesh; } #e() { let e = Sl.defaultViewer; e && e.emitter.on(Yt.BEFORE_RENDER, this.update.bind(this)); } #t() { let e = Sl.defaultViewer; e && e.emitter.off(Yt.BEFORE_RENDER, this.update.bind(this)); } #n() { let e = Sl.defaultViewer; e && e.emitter.on(Yt.BEFORE_RENDER, this.updateTextureAnimation.bind(this)); } #r() { let e = Sl.defaultViewer; e && e.emitter.off(Yt.BEFORE_RENDER, this.updateTextureAnimation.bind(this)); } }, ru = class extends e.Sprite { id; constructor(t, n, r = 1) { let i = new e.TextureLoader().load(n), a = new e.SpriteMaterial({ map: i }); super(a), this.id = t, this.scale.set(r, r, r); } getId() { return this.id; } setPosition(e) { return this.position.copy(e), this; } setSize(e) { return this.scale.set(e, e, e), this; } dispose() { if (this.material instanceof e.SpriteMaterial) { let e = this.material.map; e && e.dispose(), this.material.dispose(); } } }, iu = class extends e.Sprite { canvas; context; options; constructor(e) { let t = document.createElement("canvas"), n = t.getContext("2d"), r = { text: e.text, textColor: e.textColor || "#ffffff", backgroundColor: e.backgroundColor || "#ffcc00", borderColor: e.borderColor || "#0066cc", borderWidth: e.borderWidth ?? 4, fontSize: e.fontSize || 32, padding: e.padding || 16, sizeAttenuation: e.sizeAttenuation ?? !0 }; super(), this.canvas = t, this.context = n, this.options = r, this.updateTexture(); } setText(e) { this.options.text = e, this.updateTexture(); } dispose() { this.material instanceof e.SpriteMaterial && (this.material.map?.dispose(), this.material.dispose()); } updateTexture() { let { text: t, textColor: n, backgroundColor: r, borderColor: i, borderWidth: a, fontSize: o, padding: s } = this.options, c = this.context; c.font = `${o}px Arial`; let l = c.measureText(t).width, u = o, d = l + s * 2, f = u + s * 2; this.canvas.width = d * 2, this.canvas.height = f * 2, c.scale(2, 2), c.font = `${o}px Arial`, c.fillStyle = r, c.fillRect(0, 0, d, f), a > 0 && (c.strokeStyle = i, c.lineWidth = a, c.strokeRect(a / 2, a / 2, d - a, f - a)), c.fillStyle = n, c.textBaseline = "middle", c.fillText(t, s, f / 2); let p = new e.CanvasTexture(this.canvas); this.material = new e.SpriteNodeMaterial({ map: p, sizeAttenuation: this.options.sizeAttenuation }), this.material.depthWrite = !1, this.material.depthTest = !1, this.renderOrder = 1; let m = d / f; this.scale.set(m, 1, 1); } }, au = /* @__PURE__ */ function(e) { return e.CSS2D = "css2d", e.CSS3D = "css3d", e.CSS3DSprite = "css3dsprite", e; }({}), ou = class { container; cssObject; isVisible = !1; position = new e.Vector3(0, 0, 0); constructor(e = au.CSS3D) { this.type = e, this.container = document.createElement("div"), this.container.style.display = "none", this.container.style.pointerEvents = "none", this.container.classList.add("html-panel"), this.createCssObject(); } getCssObject() { return this.cssObject; } getUniqueId() { return this.cssObject.uuid; } show() { this.container.style.display = "block", this.isVisible = !0; } hide() { this.container.style.display = "none", this.isVisible = !1; } toggle() { this.isVisible ? this.hide() : this.show(); } updatePosition(e) { this.cssObject.position.copy(e); } updateContent(e) { this.container.innerHTML = e; } getVisible() { return this.isVisible; } changeCssType(e) { let t = this.container.innerHTML, n = this.isVisible; return this.position.copy(this.cssObject.position), this.type = e, this.createCssObject(), this.container.innerHTML = t, n ? this.show() : this.hide(), this.cssObject; } getCssType() { return this.type; } dispose() { this.hide(), this.container.innerHTML = "", this.container.parentNode && this.container.parentNode.removeChild(this.container), this.cssObject.parent && this.cssObject.parent.remove(this.cssObject); } createCssObject() { switch (this.type) { case au.CSS2D: this.cssObject = new qe(this.container); break; case au.CSS3DSprite: this.cssObject = new Ze(this.container); break; case au.CSS3D: default: this.cssObject = new Ye(this.container); break; } zr.setHiddenAndUnselectable(this.cssObject), this.cssObject.position.copy(this.position), (this.type === au.CSS3D || this.type === au.CSS3DSprite) && this.cssObject.scale.set(.001, .001, .001); } }, su = class extends i { constructor(e = new f([ new _(.5, .5), new _(-.5, .5), new _(-.5, -.5), new _(.5, -.5) ]), t = {}) { super(), this.type = "DExtrudeGeometry", this.parameters = { shapes: e, options: t }, e = Array.isArray(e) ? e : [e]; let n = this, r = [], i = []; for (let t = 0, n = e.length; t < n; t++) { let n = e[t]; a(n); } this.setAttribute("position", new s(r, 3)), this.setAttribute("uv", new s(i, 2)), this.computeVertexNormals(); function a(e) { let a = [], o = t.curveSegments === void 0 ? 12 : t.curveSegments, s = t.steps === void 0 ? 1 : t.steps, c = t.depth === void 0 ? 1 : t.depth, l = t.bevelEnabled === void 0 ? !0 : t.bevelEnabled, u = t.bevelThickness === void 0 ? .2 : t.bevelThickness, d = t.bevelSize === void 0 ? u - .1 : t.bevelSize, f = t.bevelOffset === void 0 ? 0 : t.bevelOffset, m = t.bevelSegments === void 0 ? 3 : t.bevelSegments, h = t.extrudePath, g = t.UVGenerator === void 0 ? cu : t.UVGenerator, b = t.bottomEnabled === void 0 ? !0 : t.bottomEnabled, x = t.topEnabled === void 0 ? !0 : t.topEnabled, S = t.upVector, C, w = !1, T, E, D, O; if (h) { C = h.getSpacedPoints(s), w = !0, l = !1; let e = h.isCatmullRomCurve3 ? h.closed : !1; T = h.computeFrenetFrames(s, e, S), E = new v(), D = new v(), O = new v(); } l || (m = 0, u = 0, d = 0, f = 0); let k = e.extractPoints(o), A = k.shape, j = k.holes; if (!p.isClockWise(A)) { A = A.reverse(); for (let e = 0, t = j.length; e < t; e++) { let t = j[e]; p.isClockWise(t) && (j[e] = t.reverse()); } } function M(e) { let t = 1e-10; t * t; let n = e[0]; for (let t = 1; t <= e.length; t++) { let r = t % e.length, i = e[r], a = i.x - n.x, o = i.y - n.y, s = a * a + o * o, c = Math.max(Math.abs(i.x), Math.abs(i.y), Math.abs(n.x), Math.abs(n.y)); if (s <= 10000000000000001e-36 * c * c) { e.splice(r, 1), t--; continue; } n = i; } } M(A), j.forEach(M); let N = j.length, P = A; for (let e = 0; e < N; e++) { let t = j[e]; A = A.concat(t); } function F(e, t, n) { return t || y("ExtrudeGeometry: vec does not exist"), e.clone().addScaledVector(t, n); } let I = A.length; function L(e, t, n) { let r, i, a, o = e.x - t.x, s = e.y - t.y, c = n.x - e.x, l = n.y - e.y, u = o * o + s * s, d = o * l - s * c; if (Math.abs(d) > 2 ** -52) { let d = Math.sqrt(u), f = Math.sqrt(c * c + l * l), p = t.x - s / d, m = t.y + o / d, h = n.x - l / f, g = n.y + c / f, v = ((h - p) * l - (g - m) * c) / (o * l - s * c); r = p + o * v - e.x, i = m + s * v - e.y; let y = r * r + i * i; if (y <= 2) return new _(r, i); a = Math.sqrt(y / 2); } else { let e = !1; o > 2 ** -52 ? c > 2 ** -52 && (e = !0) : o < -(2 ** -52) ? c < -(2 ** -52) && (e = !0) : Math.sign(s) === Math.sign(l) && (e = !0), e ? (r = -s, i = o, a = Math.sqrt(u)) : (r = o, i = s, a = Math.sqrt(u / 2)); } return new _(r / a, i / a); } let R = []; for (let e = 0, t = P.length, n = t - 1, r = e + 1; e < t; e++, n++, r++) n === t && (n = 0), r === t && (r = 0), R[e] = L(P[e], P[n], P[r]); let z = [], ee, B = R.concat(); for (let e = 0, t = N; e < t; e++) { let t = j[e]; ee = []; for (let e = 0, n = t.length, r = n - 1, i = e + 1; e < n; e++, r++, i++) r === n && (r = 0), i === n && (i = 0), ee[e] = L(t[e], t[r], t[i]); z.push(ee), B = B.concat(ee); } let V; if (m === 0) V = p.triangulateShape(P, j); else { let e = [], t = []; for (let n = 0; n < m; n++) { let r = n / m, i = u * Math.cos(r * Math.PI / 2), a = d * Math.sin(r * Math.PI / 2) + f; for (let t = 0, n = P.length; t < n; t++) { let n = F(P[t], R[t], a); ie(n.x, n.y, -i), r === 0 && e.push(n); } for (let e = 0, n = N; e < n; e++) { let n = j[e]; ee = z[e]; let o = []; for (let e = 0, t = n.length; e < t; e++) { let t = F(n[e], ee[e], a); ie(t.x, t.y, -i), r === 0 && o.push(t); } r === 0 && t.push(o); } } V = p.triangulateShape(e, t); } let H = V.length, U = d + f; for (let e = 0; e < I; e++) { let t = l ? F(A[e], B[e], U) : A[e]; w ? (D.copy(T.normals[0]).multiplyScalar(t.x), E.copy(T.binormals[0]).multiplyScalar(t.y), O.copy(C[0]).add(D).add(E), ie(O.x, O.y, O.z)) : ie(t.x, t.y, 0); } for (let e = 1; e <= s; e++) for (let t = 0; t < I; t++) { let n = l ? F(A[t], B[t], U) : A[t]; w ? (D.copy(T.normals[e]).multiplyScalar(n.x), E.copy(T.binormals[e]).multiplyScalar(n.y), O.copy(C[e]).add(D).add(E), ie(O.x, O.y, O.z)) : ie(n.x, n.y, c / s * e); } for (let e = m - 1; e >= 0; e--) { let t = e / m, n = u * Math.cos(t * Math.PI / 2), r = d * Math.sin(t * Math.PI / 2) + f; for (let e = 0, t = P.length; e < t; e++) { let t = F(P[e], R[e], r); ie(t.x, t.y, c + n); } for (let e = 0, t = j.length; e < t; e++) { let t = j[e]; ee = z[e]; for (let e = 0, i = t.length; e < i; e++) { let i = F(t[e], ee[e], r); w ? ie(i.x, i.y + C[s - 1].y, C[s - 1].x + n) : ie(i.x, i.y, c + n); } } } te(), ne(); function te() { let e = r.length / 3; if (l) { let e = 0, t = I * e; if (b) for (let e = 0; e < H; e++) { let n = V[e]; ae(n[2] + t, n[1] + t, n[0] + t); } if (e = s + m * 2, t = I * e, x) for (let e = 0; e < H; e++) { let n = V[e]; ae(n[0] + t, n[1] + t, n[2] + t); } } else { if (b) for (let e = 0; e < H; e++) { let t = V[e]; ae(t[2], t[1], t[0]); } if (x) for (let e = 0; e < H; e++) { let t = V[e]; ae(t[0] + I * s, t[1] + I * s, t[2] + I * s); } } n.addGroup(e, r.length / 3 - e, 0); } function ne() { let e = r.length / 3, t = 0; re(P, t), t += P.length; for (let e = 0, n = j.length; e < n; e++) { let n = j[e]; re(n, t), t += n.length; } n.addGroup(e, r.length / 3 - e, 1); } function re(e, t) { let n = e.length; for (; --n >= 0;) { let r = n, i = n - 1; i < 0 && (i = e.length - 1); for (let e = 0, n = s + m * 2; e < n; e++) { let n = I * e, a = I * (e + 1); oe(t + r + n, t + i + n, t + i + a, t + r + a); } } } function ie(e, t, n) { a.push(e), a.push(t), a.push(n); } function ae(e, t, i) { se(e), se(t), se(i); let a = r.length / 3, o = g.generateTopUV(n, r, a - 3, a - 2, a - 1); ce(o[0]), ce(o[1]), ce(o[2]); } function oe(e, t, i, a) { se(e), se(t), se(a), se(t), se(i), se(a); let o = r.length / 3, s = g.generateSideWallUV(n, r, o - 6, o - 3, o - 2, o - 1); ce(s[0]), ce(s[1]), ce(s[3]), ce(s[1]), ce(s[2]), ce(s[3]); } function se(e) { r.push(a[e * 3 + 0]), r.push(a[e * 3 + 1]), r.push(a[e * 3 + 2]); } function ce(e) { i.push(e.x), i.push(e.y); } } } copy(e) { return super.copy(e), this.parameters = Object.assign({}, e.parameters), this; } toJSON() { let e = super.toJSON(), t = this.parameters.shapes, n = this.parameters.options; return toJSON(t, n, e); } }, cu = { generateTopUV: function(e, t, n, r, i) { let a = t[n * 3], o = t[n * 3 + 1], s = t[r * 3], c = t[r * 3 + 1], l = t[i * 3], u = t[i * 3 + 1]; return [ new _(a, o), new _(s, c), new _(l, u) ]; }, generateSideWallUV: function(e, t, n, r, i, a) { let o = t[n * 3], s = t[n * 3 + 1], c = t[n * 3 + 2], l = t[r * 3], u = t[r * 3 + 1], d = t[r * 3 + 2], f = t[i * 3], p = t[i * 3 + 1], m = t[i * 3 + 2], h = t[a * 3], g = t[a * 3 + 1], v = t[a * 3 + 2]; return Math.abs(s - u) < Math.abs(o - l) ? [ new _(o, 1 - c), new _(l, 1 - d), new _(f, 1 - m), new _(h, 1 - v) ] : [ new _(s, 1 - c), new _(u, 1 - d), new _(p, 1 - m), new _(g, 1 - v) ]; } }, lu = class extends Ql { geometry; material; options; isAnimating = !1; animationRequestId = null; originalExtrudePathPoints = null; pathPointList = null; spline = null; animationDuration = 9e3; animationDelay = 1e3; animationProgress = 0; followMesh = null; viewer = null; collisionProxyMesh = null; outerShape = null; _elapsedTime = 0; _boundAnimateHandler = null; _lastCollisionCheckProgress = -1; _debugCollisionMeshes = []; constructor(t, n = {}) { super(), this.viewer = t, this.options = { width: n.width ?? 2, height: n.height ?? 3, depth: n.depth ?? 4, thickness: n.thickness ?? .1, curveSegments: n.curveSegments ?? 24, steps: n.steps ?? 8, hasHole: n.hasHole ?? !0, extrudePathPoints: n.extrudePathPoints ?? [], animate: n.animate ?? !1, bottomEnabled: n.bottomEnabled ?? !1, topEnabled: n.topEnabled ?? !1, followMeshOffset: n.followMeshOffset ?? new e.Vector3(0, 0, 0), upVector: n.upVector ?? new e.Vector3(0, 1, 0), material: n.material ?? new e.MeshBasicNodeMaterial({ side: e.DoubleSide, color: 9127187 }), enableCSGOperation: n.enableCSGOperation ?? !0, showDebugMesh: n.showDebugMesh ?? !1, collisionCheckProgressStep: n.collisionCheckProgressStep ?? 0, collisionProxyDepth: n.collisionProxyDepth ?? .3, debugCollisionProxy: n.debugCollisionProxy ?? !1, ...n.followMesh && { followMesh: n.followMesh }, ...n.followMeshUrl && { followMeshUrl: n.followMeshUrl } }, this.material = this.options.material, this.syncCSGDebugMode(), this.options.followMesh ? (this.followMesh = this.options.followMesh, this.followMesh && !this.followMesh.parent && t.scene.add(this.followMesh), this.followMesh && (this.followMesh.visible = !1)) : this.options.followMeshUrl && this.loadFollowMesh(this.options.followMeshUrl), this.geometry = this.createGeometry(), this.geometry.computeBoundingBox(), this.geometry.computeBoundingSphere(), this.name = "ParametricArch", this.createCollisionProxyMesh(), this.userData.archOptions = { width: this.options.width, height: this.options.height, depth: this.options.depth, thickness: this.options.thickness, curveSegments: this.options.curveSegments, steps: this.options.steps, hasHole: this.options.hasHole, bottomEnabled: this.options.bottomEnabled, topEnabled: this.options.topEnabled }; } createGeometry() { if (!this.options.extrudePathPoints || this.options.extrudePathPoints.length === 0) return new Xl(100); let t = zr.getPoints(this.options.extrudePathPoints), n = new e.CatmullRomCurve3(t), r = (t.length - 1) * this.options.curveSegments, i = n.getPoints(r), a = new zl(); return a.set(i, 0, 0, this.options.upVector, !1), new Xl({ pathPointList: a, options: { width: this.options.width, height: this.options.height, progress: this.options.animate ? 0 : 1, radialSegments: this.options.curveSegments, bottomEnabled: this.options.bottomEnabled, topEnabled: this.options.topEnabled } }); } updateParameters(e) { e.width !== void 0 && (this.options.width = e.width), e.height !== void 0 && (this.options.height = e.height), e.thickness !== void 0 && (this.options.thickness = e.thickness), e.curveSegments !== void 0 && (this.options.curveSegments = e.curveSegments), e.extrudePathPoints !== void 0 && (this.options.extrudePathPoints = e.extrudePathPoints), this.updateGeometry(); } updateGeometry() { !this.pathPointList || !this.options.extrudePathPoints || (this.geometry.update(this.pathPointList, { width: this.options.width, height: this.options.height, progress: this.animationProgress, radialSegments: this.options.curveSegments, bottomEnabled: this.options.bottomEnabled, topEnabled: this.options.topEnabled }), this.geometry.computeBoundingBox(), this.geometry.computeBoundingSphere()); } startAnimation() { if (!this.isAnimating && (!this.originalExtrudePathPoints && this.options.extrudePathPoints && (this.originalExtrudePathPoints = [...this.options.extrudePathPoints]), !(!this.originalExtrudePathPoints || this.originalExtrudePathPoints.length === 0))) { if (this.pathPointList) { let t = zr.getPoints(this.originalExtrudePathPoints); this.spline = new e.CatmullRomCurve3(t); } else { let t = zr.getPoints(this.originalExtrudePathPoints), n = new e.CatmullRomCurve3(t); this.spline = n; let r = (t.length - 1) * this.options.curveSegments, i = n.getPoints(r); this.pathPointList = new zl(), this.pathPointList.set(i, 0, 0, this.options.upVector, !1); } if (this.followMesh && this.originalExtrudePathPoints.length > 0) { let e = zr.getPoints(this.originalExtrudePathPoints)[0]; e && (this.followMesh.position.copy(e), this.followMesh.rotation.set(0, 0, 0)), this.followMesh.visible = !1; } this._elapsedTime = 0, this.animationProgress = 0, this.isAnimating = !0, this._lastCollisionCheckProgress = -1, this.viewer && (this._boundAnimateHandler = (e) => this.animate(e), this.viewer.emitter.on(Yt.BEFORE_RENDER, this._boundAnimateHandler)); } } stopAnimation() { this.isAnimating && (this.isAnimating = !1, this._lastCollisionCheckProgress = -1, this.viewer && this._boundAnimateHandler && (this.viewer.emitter.off(Yt.BEFORE_RENDER, this._boundAnimateHandler), this._boundAnimateHandler = null), this.animationRequestId &&= (cancelAnimationFrame(this.animationRequestId), null)); } resetAnimation() { if (this.stopAnimation(), this._elapsedTime = 0, this.animationProgress = 0, this.pathPointList = null, this.followMesh && this.originalExtrudePathPoints && this.originalExtrudePathPoints.length > 0) { let e = zr.getPoints(this.originalExtrudePathPoints)[0]; e && (this.followMesh.position.copy(e), this.followMesh.rotation.set(0, 0, 0)), this.followMesh.visible = !1; } this.originalExtrudePathPoints && (this.options.extrudePathPoints = this.originalExtrudePathPoints); } setAnimationDuration(e) { this.animationDuration = e; } setAnimationDelay(e) { this.animationDelay = e; } createDebugPanel() { if (!this.viewer) return; let e = this.viewer.inspector.createParameters(`Arch: ${this.name}`); e.add(this.options, "width", .1, 20, .1).name("宽度").onChange(() => this.updateGeometry()), e.add(this.options, "height", .1, 20, .1).name("高度").onChange(() => this.updateGeometry()), e.add(this.options, "depth", .1, 50, .1).name("深度").onChange(() => this.updateGeometry()), e.add(this.options, "curveSegments", 4, 64, 1).name("圆弧分段").onChange(() => this.updateGeometry()), e.add(this.options, "collisionProxyDepth", .01, 5, .01).name("代理体深度").onChange(() => this.createCollisionProxyMesh()), e.add(this.options, "collisionCheckProgressStep", 0, .2, .001).name("碰撞检测步长"), e.add(this, "animationDuration", 500, 3e4, 100).name("动画时长(ms)"), e.add(this, "animationDelay", 0, 5e3, 100).name("动画延迟(ms)"); let t = { play: () => this.startAnimation(), stop: () => this.stopAnimation(), reset: () => this.resetAnimation() }; e.add(t, "play").name("播放动画"), e.add(t, "stop").name("停止动画"), e.add(t, "reset").name("重置动画"), e.add(this, "visible").name("可见性"), e.add(this.options, "debugCollisionProxy").name("碰撞代理调试").onChange((e) => { this.options.debugCollisionProxy = e, this.syncCSGDebugMode(); }); } syncCSGDebugMode() { this.csgOperator.debugMode = this.options.debugCollisionProxy; } dispose() { this.clearDebugCollisionMeshes(), this.geometry.dispose(), this.material instanceof e.Material && this.material.dispose(), this.collisionProxyMesh &&= (this.collisionProxyMesh.geometry.dispose(), this.collisionProxyMesh.material instanceof e.Material && this.collisionProxyMesh.material.dispose(), this.viewer && this.collisionProxyMesh.parent && this.viewer.scene.remove(this.collisionProxyMesh), null), this.disposeCollisionResources(); } createShapes() { let { width: t, height: n } = this.options, r = t * .5, i = n * .5; this.outerShape = new e.Shape(), this.outerShape.moveTo(-r, -i), this.outerShape.lineTo(r, -i), this.outerShape.lineTo(r, i), this.outerShape.absarc(0, i, r, 0, Math.PI, !1), this.outerShape.lineTo(-r, -i); } createCollisionProxyMesh() { if (!this.options.extrudePathPoints || this.options.extrudePathPoints.length < 2 || (this.collisionProxyMesh && (this.collisionProxyMesh.geometry.dispose(), this.collisionProxyMesh.material instanceof e.Material && this.collisionProxyMesh.material.dispose()), this.createShapes(), !this.outerShape)) return; let t = new su(this.outerShape.clone(), { depth: this.options.collisionProxyDepth, bevelEnabled: !1, steps: 1, curveSegments: this.options.curveSegments, bottomEnabled: !0, topEnabled: !0 }), n = new e.MeshBasicMaterial({ visible: !1 }); if (this.collisionProxyMesh = new e.Mesh(t, n), this.options.animate) { let e = zr.getPoints(this.options.extrudePathPoints), t = e[0], n = e[1]; t && n && this.updateCollisionProxyTransform(t, n); } else this.collisionProxyMesh.position.set(0, 0, 0), this.collisionProxyMesh.rotation.set(0, 0, 0); } updateCollisionProxyTransform(t, n) { if (!this.collisionProxyMesh) return; this.collisionProxyMesh.position.copy(t); let r = new e.Vector3().subVectors(n, t).normalize(), i = new e.Vector3(0, 0, 1), a = new e.Quaternion().setFromUnitVectors(i, r); this.collisionProxyMesh.quaternion.copy(a); } async loadFollowMesh(e) { if (!this.viewer) { console.error("Viewer 未初始化,无法加载模型"); return; } try { let t = await this.viewer.resources.loadGLTF(e); this.followMesh = t, this.followMesh && (this.viewer.scene.add(this.followMesh), zr.setExcludeAll(t, !0), this.followMesh.visible = !1); } catch (e) { console.error("加载跟随动画的模型失败:", e); } } animate(e) { if (!this.isAnimating || !this.pathPointList) return; this._elapsedTime += e.data.delta * 1e3; let t = 0; if (this._elapsedTime > this.animationDelay) { let e = this._elapsedTime - this.animationDelay; t = Math.min(1, e / this.animationDuration); } if (this.animationProgress = t, this.geometry.update(this.pathPointList, { width: this.options.width, height: this.options.height, progress: t, radialSegments: this.options.curveSegments, bottomEnabled: this.options.bottomEnabled, topEnabled: this.options.topEnabled }), this.geometry.computeBoundingBox(), this.geometry.computeBoundingSphere(), this.followMesh && t > 0 && this.spline) { this.followMesh.visible || (this.followMesh.visible = !0); let e = this.spline.getPointAt(t), n = this.spline.getTangentAt(t), r = e.clone().add(this.options.followMeshOffset); this.followMesh.position.copy(r), this.followMesh.lookAt(r.clone().add(n)); } if (this.collisionProxyMesh && this.spline && t > 0) { let e = this.spline.getPointAt(t), n = Math.min(t + .01, 1), r = this.spline.getPointAt(n); this.updateCollisionProxyTransform(e, r), this.options.enableCSGOperation && this.shouldCheckCollisionNow() && (this.debugCollisionProxyMeshOnHit(), this.checkCollisionsAndApplyCSG()); } if (t >= 1) { this.stopAnimation(); return; } } debugCollisionProxyMeshOnHit() { if (!this.options.debugCollisionProxy || !this.viewer) return; let t = this.getCSGMesh(); if (!t) return; let n = !1; for (let e of this.collisionTargets) { let r = e.mesh, i = this.collisionCountMap.get(r) ?? 0; if (!(e.maxCollisionCount !== -1 && i >= e.maxCollisionCount) && this.collisionDetector.checkIntersection(t, r)) { n = !0; break; } } if (!n) return; let r = new e.Mesh(t.geometry.clone(), new e.MeshBasicMaterial({ color: 16711935, wireframe: !0, transparent: !0, opacity: .75 })); r.name = `ArchCollisionProxyDebug_${Date.now()}`, r.position.copy(t.position), r.quaternion.copy(t.quaternion), r.scale.copy(t.scale), this.viewer.scene.add(r), this._debugCollisionMeshes.push(r); } clearDebugCollisionMeshes() { this._debugCollisionMeshes.forEach((t) => { t.parent && t.parent.remove(t), t.geometry.dispose(), t.material instanceof e.Material && t.material.dispose(); }), this._debugCollisionMeshes = []; } shouldCheckCollisionNow() { let e = this.options.collisionCheckProgressStep; return e <= 0 ? !0 : this._lastCollisionCheckProgress < 0 || Math.abs(this.animationProgress - this._lastCollisionCheckProgress) >= e || this.animationProgress >= 1 ? (this._lastCollisionCheckProgress = this.animationProgress, !0) : !1; } subtractMesh() { let t = this.getCSGMesh(); if (!t || this.collisionTargets.length === 0) return 0; if (!this.options.animate && this.collisionProxyMesh) { this.collisionProxyMesh.position.copy(this.position), this.collisionProxyMesh.rotation.copy(this.rotation), this.collisionProxyMesh.scale.copy(this.scale); let t = this.options.collisionProxyDepth / 2, n = new e.Vector3(0, 0, t); n.applyQuaternion(this.quaternion), this.collisionProxyMesh.position.add(n), this.collisionProxyMesh.updateMatrixWorld(!0); } let n = 0; this.collisionDetector.buildBVH(t); for (let r of this.collisionTargets) { let i = r.mesh, a = this.collisionCountMap.get(i) ?? 0; if (!(r.maxCollisionCount !== -1 && a >= r.maxCollisionCount)) try { let o = this.collisionProxyMesh?.position.clone(), s = this.collisionProxyMesh?.rotation.clone(); if (this.collisionDetector.buildBVH(i), !this.collisionDetector.checkIntersection(this, i)) continue; let c = this.collisionDetector.checkIntersection(t, i); if (!c && this.collisionProxyMesh) { let t = this.options.collisionProxyDepth, o = Math.abs(this.options.depth), s = this.options.depth >= 0 ? 1 : -1, l = Math.ceil(o / t) - 1, u = this.collisionProxyMesh.position.clone(), d = new e.Vector3(0, 0, s).applyQuaternion(this.quaternion), f = []; for (let n = 0; n < l; n++) { let r = d.clone().multiplyScalar(t); if (this.collisionProxyMesh.position.add(r), this.collisionProxyMesh.updateMatrixWorld(!0), this.collisionDetector.buildBVH(this.collisionProxyMesh), this.collisionDetector.checkIntersection(this.collisionProxyMesh, i)) { if (f.push(this.collisionProxyMesh.position.clone()), this.options.showDebugMesh && this.viewer) { let t = new e.Mesh(this.collisionProxyMesh.geometry.clone(), new e.MeshBasicMaterial({ color: 65280, wireframe: !0, transparent: !0, opacity: .5 })); t.position.copy(this.collisionProxyMesh.position), t.rotation.copy(this.collisionProxyMesh.rotation), t.scale.copy(this.collisionProxyMesh.scale), t.name = `DebugProxyMesh_Collision_Step${n + 1}`, this.viewer.scene.add(t); } } else if (this.options.showDebugMesh && this.viewer) { let t = new e.Mesh(this.collisionProxyMesh.geometry.clone(), new e.MeshBasicMaterial({ color: 16711680, wireframe: !0, transparent: !0, opacity: .3 })); t.position.copy(this.collisionProxyMesh.position), t.rotation.copy(this.collisionProxyMesh.rotation), t.scale.copy(this.collisionProxyMesh.scale), t.name = `DebugProxyMesh_NoCollision_Step${n + 1}`, this.viewer.scene.add(t); } } if (f.length > 0) { for (let e = 0; e < f.length; e++) { let t = f[e]; if (t) { this.collisionProxyMesh.position.copy(t), this.collisionProxyMesh.updateMatrixWorld(!0), this.collisionDetector.buildBVH(this.collisionProxyMesh); try { let e = this.csgOperator.operate(i, this.collisionProxyMesh, r.operationType), t = i.geometry; i.geometry = e, i.geometry.computeBoundingBox(), i.geometry.computeBoundingSphere(), t.dispose(); } catch (t) { console.error(`[ParametricArch.subtractMesh] 碰撞位置 ${e + 1} CSG 操作失败:`, t); } } } this.collisionCountMap.set(i, a + 1), n++, c = !0; } else this.collisionProxyMesh.position.copy(u), this.collisionProxyMesh.updateMatrixWorld(!0), this.collisionDetector.buildBVH(this.collisionProxyMesh); } if (c && (this.collisionProxyMesh && o && s && (this.collisionProxyMesh.position.copy(o), this.collisionProxyMesh.rotation.copy(s), this.collisionProxyMesh.updateMatrixWorld(!0), this.collisionDetector.buildBVH(this.collisionProxyMesh)), (this.collisionCountMap.get(i) ?? 0) > a) || !c) continue; let l = this.csgOperator.operate(i, t, r.operationType), u = i.geometry; i.geometry = l, i.geometry.computeBoundingBox(), i.geometry.computeBoundingSphere(), u.dispose(), this.collisionCountMap.set(i, a + 1), n++, this.collisionProxyMesh && o && s && (this.collisionProxyMesh.position.copy(o), this.collisionProxyMesh.rotation.copy(s), this.collisionProxyMesh.updateMatrixWorld(!0), this.collisionDetector.buildBVH(this.collisionProxyMesh)); } catch (e) { console.error("[ParametricArch.subtractMesh] CSG 操作失败:", e); } } return n; } getCSGMesh() { return this.collisionProxyMesh ? this.collisionProxyMesh : this; } }, uu = class { group; cylinder; cone; options; constructor(t) { this.options = { pipeRadius: t.pipeRadius, color: t.color ?? 16711680, cylinderLengthRatio: t.cylinderLengthRatio ?? 3, coneLengthRatio: t.coneLengthRatio ?? 2 }, this.group = new e.Group(), this.group.name = "DrillingRobot", zr.setExcludeAll(this.group); let n = new e.MeshPhysicalMaterial({ color: this.options.color, metalness: .8, roughness: .3 }), r = this.options.pipeRadius * .8, i = this.options.pipeRadius * this.options.cylinderLengthRatio, a = this.options.pipeRadius * this.options.coneLengthRatio, o = new e.CylinderGeometry(r, r, i, 16); this.cylinder = new e.Mesh(o, n), this.cylinder.name = "RobotCylinder", this.cylinder.position.y = a + i / 2; let s = new e.ConeGeometry(r, a, 16); this.cone = new e.Mesh(s, n), this.cone.name = "RobotCone", this.cone.rotation.x = Math.PI, this.cone.position.y = a / 2, this.group.add(this.cylinder), this.group.add(this.cone); } setPosition(e) { this.group.position.copy(e); } setRotation(e) { this.group.quaternion.copy(e); } setDirection(t) { let n = new e.Vector3(0, -1, 0), r = new e.Quaternion().setFromUnitVectors(n, t); this.group.quaternion.copy(r); } updateSize(t) { this.options.pipeRadius = t; let n = t * .8, r = t * this.options.cylinderLengthRatio, i = t * this.options.coneLengthRatio; this.cylinder.geometry.dispose(), this.cylinder.geometry = new e.CylinderGeometry(n, n, r, 16), this.cylinder.position.y = i + r / 2, this.cone.geometry.dispose(), this.cone.geometry = new e.ConeGeometry(n, i, 16), this.cone.rotation.x = Math.PI, this.cone.position.y = i / 2; } dispose() { this.cylinder.geometry.dispose(), this.cone.geometry.dispose(), this.cylinder.material instanceof e.Material && this.cylinder.material.dispose(), this.cone.material instanceof e.Material && this.cone.material.dispose(), this.group.parent && this.group.parent.remove(this.group); } }, du = class { group; mainBody; cuttingHead; connector; frontIndicator; options; animationId = null; isMining = !1; collisionDetector; csgTargets = []; csgOperator; viewer = null; animationState = null; unsubscribeRender = null; constructor(t = {}) { this.collisionDetector = new Ko(), this.options = { size: t.size ?? 1, color: t.color ?? 16753920, widthRatio: t.widthRatio ?? 1.5, heightRatio: t.heightRatio ?? 1.2, depthRatio: t.depthRatio ?? 2 }, this.csgOperator = new wl(), this.group = new e.Group(), this.group.name = "MiningRobot"; let n = new e.MeshPhysicalNodeMaterial({ color: this.options.color, metalness: .7, roughness: .4 }), r = new e.MeshPhysicalNodeMaterial({ color: "#f5f5f5", metalness: .9, roughness: .2 }), i = new e.MeshPhysicalNodeMaterial({ color: 6710886, metalness: .8, roughness: .3 }), a = new e.MeshPhysicalNodeMaterial({ color: 16711680, metalness: .5, roughness: .5 }), o = this.options.size, s = o * this.options.widthRatio, c = o * this.options.heightRatio, l = o * this.options.depthRatio, u = new e.BoxGeometry(s, c, l); this.mainBody = new e.Mesh(u, n), this.mainBody.name = "RobotMainBody", this.mainBody.position.set(0, 0, 0); let d = o * .2, f = l * .3, p = new e.CylinderGeometry(d, d, f, 16); this.connector = new e.Mesh(p, i), this.connector.name = "RobotConnector", this.connector.rotation.x = Math.PI / 2, this.connector.position.set(0, 0, l / 2 + f / 2); let m = o * 1.5, h = new e.BoxGeometry(m, m, m); this.cuttingHead = new e.Mesh(h, r), this.cuttingHead.name = "RobotCuttingHead", this.cuttingHead.position.set(0, 0, l / 2 + f + m / 2); let g = o * .2, _ = new e.BoxGeometry(g, g, g); this.frontIndicator = new e.Mesh(_, a), this.frontIndicator.name = "RobotFrontIndicator", this.frontIndicator.position.set(0, c / 2 + g / 2, l / 3), this.group.add(this.mainBody), this.group.add(this.connector), this.group.add(this.cuttingHead), this.group.add(this.frontIndicator); } addCSGTarget(e, t, n = !0) { e.geometry.computeBoundsTree?.(), this.csgTargets.push({ mesh: e, operationType: t, enabled: n }); } removeCSGTarget(e) { let t = this.csgTargets.findIndex((t) => t.mesh === e); t !== -1 && this.csgTargets.splice(t, 1); } clearCSGTargets() { this.csgTargets = []; } getCSGTargets() { return this.csgTargets; } setCSGTargetEnabled(e, t) { let n = this.csgTargets.find((t) => t.mesh === e); n && (n.enabled = t); } setPosition(e) { this.group.position.copy(e); } setDirection(t) { let n = new e.Vector3(0, 0, 1), r = new e.Quaternion().setFromUnitVectors(n, t); this.group.quaternion.copy(r); } updateSize(t) { this.options.size = t; let n = t, r = n * this.options.widthRatio, i = n * this.options.heightRatio, a = n * this.options.depthRatio; this.mainBody.geometry.dispose(), this.mainBody.geometry = new e.BoxGeometry(r, i, a); let o = n * .2, s = a * .3; this.connector.geometry.dispose(), this.connector.geometry = new e.CylinderGeometry(o, o, s, 16), this.connector.rotation.x = Math.PI / 2, this.connector.position.set(0, 0, a / 2 + s / 2); let c = n * 1.2; this.cuttingHead.geometry.dispose(), this.cuttingHead.geometry = new e.BoxGeometry(c, c, c), this.cuttingHead.position.set(0, 0, a / 2 + s + c / 2); let l = n * .2; this.frontIndicator.geometry.dispose(), this.frontIndicator.geometry = new e.BoxGeometry(l, l, l), this.frontIndicator.position.set(0, i / 2 + l / 2, a / 3); } startMining(e, t, n, r = {}) { this.isMining && this.stopMining(), this.viewer = e; let i = r.duration ?? 1, a = { duration: i, csgFrequency: r.csgFrequency ?? 1, onComplete: r.onComplete ?? (() => {}), onProgress: r.onProgress ?? (() => {}) }; this.animationState = { startPosition: t.clone(), endPosition: n.clone(), elapsedTime: 0, duration: i, lastCSGPosition: null, options: a }, this.isMining = !0, this.setPosition(t), this.unsubscribeRender = e.emitter.on(Yt.BEFORE_RENDER, this.onBeforeRender.bind(this)); } executeCSGOperation() { if (this.csgTargets.length !== 0) { this.collisionDetector.buildBVH(this.cuttingHead); try { for (let e of this.csgTargets) { if (!e.enabled) continue; this.collisionDetector.buildBVH(e.mesh); let t = this.csgOperator.operate(e.mesh, this.cuttingHead, e.operationType), n = e.mesh.geometry; e.mesh.geometry = t, e.mesh.geometry.computeBoundingBox(), e.mesh.geometry.computeBoundingSphere(), n.dispose(); } } catch (e) { console.error("CSG 操作失败:", e); } } } stopMining() { this.isMining = !1, this.animationState = null, this.unsubscribeRender &&= (this.unsubscribeRender(), null); } getIsMining() { return this.isMining; } dispose() { this.stopMining(), this.clearCSGTargets(), this.mainBody.geometry.dispose(), this.cuttingHead.geometry.dispose(), this.connector.geometry.dispose(), this.frontIndicator.geometry.dispose(), this.mainBody.material instanceof e.Material && this.mainBody.material.dispose(), this.cuttingHead.material instanceof e.Material && this.cuttingHead.material.dispose(), this.connector.material instanceof e.Material && this.connector.material.dispose(), this.frontIndicator.material instanceof e.Material && this.frontIndicator.material.dispose(), this.group.parent && this.group.parent.remove(this.group); } onBeforeRender(t) { if (!this.isMining || !this.animationState) return; this.animationState.elapsedTime += t.data.delta; let n = Math.min(this.animationState.elapsedTime / this.animationState.duration, 1), r = new e.Vector3().lerpVectors(this.animationState.startPosition, this.animationState.endPosition, n); this.setPosition(r); let i = this.options.size * 1.2 * this.animationState.options.csgFrequency, a = !1; if (this.animationState.lastCSGPosition ? r.distanceTo(this.animationState.lastCSGPosition) >= i && (a = !0) : a = !0, a && (this.executeCSGOperation(), this.animationState.lastCSGPosition = r.clone()), this.animationState.options.onProgress(n), n >= 1) { this.executeCSGOperation(); let e = this.animationState.options.onComplete; this.stopMining(), e(); } } }, fu = class extends Ql { geometry; material; options; emitter; pathPointList; pathTubeGeometry; viewer = null; startCapMesh = null; endCapMesh = null; drillingRobot = null; collisionProxyMesh = null; staticCollisionProxyMesh = null; useStaticProxy = !1; bvhHelper = null; playing = !1; duration = 2; texture = null; textureAnimating = !1; scrollSpeed = .03; scrollDirection = 1; scrollAxis = "y"; textureRepeatX = 1; textureRepeatY = 3; _elapsedTime = 0; _targetProgress = 1; _textureElapsedTime = 0; _textureDuration = 0; _boundProgressHandler = null; _boundTextureHandler = null; _lastCollisionCheckProgress = -1; _debugCollisionMeshes = []; _uvOffsetUniform = ze(new e.Vector2(0, 0)); constructor(t, n = {}) { super(), this.emitter = new Kt(), this.viewer = t, this.useStaticProxy = n.useStaticCollisionProxy ?? !1, this.options = { points: n.points ?? [], radius: n.radius ?? .2, radialSegments: n.radialSegments ?? 32, cornerRadius: n.cornerRadius ?? .1, cornerSplit: n.cornerSplit ?? 10, progress: n.progress ?? 1, startRad: n.startRad ?? 0, upVector: n.upVector ?? null, close: n.close ?? !1, capStart: n.capStart ?? !1, capEnd: n.capEnd ?? !1, enableDrillingRobot: n.enableDrillingRobot ?? !1, robotColor: n.robotColor ?? 16711680, robotCylinderLengthRatio: n.robotCylinderLengthRatio ?? 3, robotConeLengthRatio: n.robotConeLengthRatio ?? 2, useStaticCollisionProxy: n.useStaticCollisionProxy ?? !1, collisionProxyHeight: n.collisionProxyHeight ?? 0, metadata: n.metadata ?? {}, collisionCheckProgressStep: n.collisionCheckProgressStep ?? 0, debugCollisionProxy: n.debugCollisionProxy ?? !1, material: n.material ?? new e.MeshBasicNodeMaterial({ color: 16119285, side: e.DoubleSide }) }, this.syncCSGDebugMode(), this.material = this.options.material, this.pathPointList = new zl(); let r = this.createGeometry(); this.pathTubeGeometry = r, this.geometry = r, this.name = "ParametricPipe", this.createCaps(), this.options.enableDrillingRobot && this.createDrillingRobot(), this.useStaticProxy ? this.createStaticCollisionProxyMesh() : this.updateCollisionProxyMesh(), this.viewer && this.viewer.parametric.addPipe(this); } setCollisionProxyType(e) { this.useStaticProxy = e, e ? this.createStaticCollisionProxyMesh() : this.updateCollisionProxyMesh(); } createGeometry() { let e = zr.getPoints(this.options.points); return this.pathPointList.set(e, this.options.cornerRadius, this.options.cornerSplit, this.options.upVector, this.options.close), new Jl({ pathPointList: this.pathPointList, options: { radius: this.options.radius, radialSegments: this.options.radialSegments, progress: this.options.progress, startRad: this.options.startRad } }); } updateParameters(e) { let t = !1; e.points !== void 0 && (this.options.points = e.points, t = !0), e.radius !== void 0 && (this.options.radius = e.radius, t = !0), e.radialSegments !== void 0 && (this.options.radialSegments = e.radialSegments, t = !0), e.cornerRadius !== void 0 && (this.options.cornerRadius = e.cornerRadius, t = !0), e.cornerSplit !== void 0 && (this.options.cornerSplit = e.cornerSplit, t = !0), e.progress !== void 0 && (this.options.progress = e.progress, t = !0), e.startRad !== void 0 && (this.options.startRad = e.startRad, t = !0), e.upVector !== void 0 && (this.options.upVector = e.upVector, t = !0), e.close !== void 0 && (this.options.close = e.close, t = !0); let n = !1; e.collisionProxyHeight !== void 0 && (this.options.collisionProxyHeight = Math.max(0, e.collisionProxyHeight), n = !0), e.collisionCheckProgressStep !== void 0 && (this.options.collisionCheckProgressStep = Math.max(0, e.collisionCheckProgressStep)), e.debugCollisionProxy !== void 0 && (this.options.debugCollisionProxy = e.debugCollisionProxy, this.syncCSGDebugMode()), t && this.updateGeometry(), this.useStaticProxy && n ? this.createStaticCollisionProxyMesh() : !this.useStaticProxy && n && this.updateCollisionProxyMesh(); } updateGeometry() { let e = zr.getPoints(this.options.points); this.pathPointList.set(e, this.options.cornerRadius, this.options.cornerSplit, this.options.upVector, this.options.close), this.pathTubeGeometry.update(this.pathPointList, { radius: this.options.radius, radialSegments: this.options.radialSegments, progress: this.options.progress, startRad: this.options.startRad }), this.createCaps(); } updatePoints(e) { this.options.points = e, this.updateGeometry(); } updateRadius(e) { this.options.radius = e, this.updateGeometry(); } updateProgress(e) { this.options.progress = Math.max(0, Math.min(1, e)), this.updateGeometry(), this.useStaticProxy || this.updateCollisionProxyMesh(); } getPathDistance() { return this.pathPointList.distance(); } addToScene() { this.viewer && !this.parent && this.viewer.scene.add(this); } removeFromScene() { this.parent && this.parent.remove(this); } getBVHBoundingBox() { return this.geometry.boundsTree?.getBoundingBox(new e.Box3()); } dispose() { this.stopAnimation(), this.stopTextureAnimation(), this.disposeCaps(), this.disposeDrillingRobot(), this.collisionProxyMesh &&= (this.collisionProxyMesh.geometry.dispose(), this.collisionProxyMesh.material instanceof e.Material && this.collisionProxyMesh.material.dispose(), null), this.staticCollisionProxyMesh &&= (this.staticCollisionProxyMesh.geometry.dispose(), this.staticCollisionProxyMesh.material instanceof e.Material && this.staticCollisionProxyMesh.material.dispose(), null), this.clearDebugCollisionMeshes(), this.disposeCollisionResources(), this.bvhHelper &&= (this.bvhHelper.parent && this.bvhHelper.parent.remove(this.bvhHelper), null), this.geometry && typeof this.geometry.dispose == "function" && this.geometry.dispose(), this.material instanceof e.Material && this.material.dispose(), this.texture && this.texture.dispose(), this.removeFromScene(), this.viewer && this.viewer.parametric.removePipe(this); } startAnimation(e) { this.playing = !0, this.options.progress = 0, this._elapsedTime = 0, this._targetProgress = e ?? 1, this._lastCollisionCheckProgress = -1, this.drillingRobot && (this.drillingRobot.group.visible = !0), this.#e(); } continueAnimation(e) { this.playing = !0, this._targetProgress = e ?? 1, this._lastCollisionCheckProgress = -1, this._elapsedTime = (1 - (this._targetProgress - this.options.progress)) * this.duration, this.drillingRobot && (this.drillingRobot.group.visible = !0), this.#e(); } stopAnimation() { this.playing = !1, this._lastCollisionCheckProgress = -1, this.#t(); } startTextureAnimation(e) { this.textureAnimating = !0, this._textureElapsedTime = 0, this._textureDuration = e ?? 0, this.#n(); } stopTextureAnimation() { this.textureAnimating = !1, this.#r(); } setDuration(e) { this.duration = e; } getDuration() { return this.duration; } setScrollSpeed(e) { this.scrollSpeed = e; } getScrollSpeed() { return this.scrollSpeed; } setScrollDirection(e) { this.scrollDirection = e; } setScrollAxis(e) { this.scrollAxis = e; } getScrollAxis() { return this.scrollAxis; } setColorNode(t, n) { this.texture = t, this.texture.wrapS = this.texture.wrapT = e.RepeatWrapping, this.texture.anisotropy = 16, this.texture.colorSpace = e.SRGBColorSpace; let r = Be().mul(He(this.textureRepeatX, this.textureRepeatY)).add(this._uvOffsetUniform), i = Ie(this.texture, r), a = i; if (n) { let t = new e.Color(n); a = i.mul(Ue(t.r, t.g, t.b)); } this.material.colorNode = a, this.material.needsUpdate = !0; } setTextureRepeat(e, t) { this.textureRepeatX = e, this.textureRepeatY = t, this.texture && this.texture.repeat.set(e, t); } getTextureRepeat() { return { x: this.textureRepeatX, y: this.textureRepeatY }; } setTextureCoverMode() { this.setTextureRepeat(1, 1); } setTextureScale(e, t) { let n = 1 / e, r = 1 / t; this.setTextureRepeat(n, r); } removeTexture() { this.texture &&= (this.texture.dispose(), null), this._uvOffsetUniform.value.x = 0, this._uvOffsetUniform.value.y = 0, this.material instanceof e.MeshStandardNodeMaterial || this.material instanceof e.MeshPhysicalNodeMaterial || this.material instanceof e.MeshBasicNodeMaterial ? (this.material.colorNode = null, this.material.needsUpdate = !0) : (this.material.map = null, this.material.needsUpdate = !0); } createDebugPanel() { if (!this.viewer) return; let e = this.viewer.inspector.createParameters(`Pipe: ${this.name}`); e.add(this.options, "radius", .01, 2, .01).name("半径").onChange(() => this.updateGeometry()), e.add(this.options, "radialSegments", 3, 32, 1).name("径向分段").onChange(() => this.updateGeometry()), e.add(this.options, "cornerRadius", 0, 1, .01).name("转角半径").onChange(() => this.updateGeometry()), e.add(this.options, "cornerSplit", 1, 20, 1).name("转角分段").onChange(() => this.updateGeometry()), e.add(this.options, "progress", 0, 1, .01).name("进度").onChange(() => this.updateGeometry()), e.add(this.options, "collisionProxyHeight", 0, 20, .01).name("代理高度").onChange(() => { this.useStaticProxy ? this.createStaticCollisionProxyMesh() : this.updateCollisionProxyMesh(); }), e.add(this.options, "collisionCheckProgressStep", 0, .2, .001).name("碰撞检测步长"), e.add(this, "duration", .5, 30, .5).name("动画时长(s)"), e.add(this, "scrollSpeed", .001, .1, .001).name("纹理速度"); let t = { play: () => this.startAnimation(), stop: () => this.stopAnimation() }; e.add(t, "play").name("播放动画"), e.add(t, "stop").name("停止动画"), e.add({ showBVH: !1 }, "showBVH").name("显示 BVH").onChange((e) => { e ? (this.bvhHelper ||= new Uo(this, 10), this.viewer.scene.add(this.bvhHelper)) : this.bvhHelper && this.viewer.scene.remove(this.bvhHelper); }), e.add(this, "visible").name("可见性"), e.add(this.options, "debugCollisionProxy").name("碰撞代理调试").onChange((e) => { this.options.debugCollisionProxy = e, this.syncCSGDebugMode(); }); } createCaps() { this.disposeCaps(); let t = zr.getPoints(this.options.points); if (!(t.length < 2)) { if (this.options.capStart) { let n = t[0], r = t[1]; if (!n || !r) return; let i = new e.CircleGeometry(this.options.radius, this.options.radialSegments); this.startCapMesh = new e.Mesh(i, this.material), this.startCapMesh.position.copy(n); let a = new e.Vector3().subVectors(r, n).normalize(), o = new e.Vector3(0, 0, 1), s = new e.Quaternion().setFromUnitVectors(o, a); this.startCapMesh.quaternion.copy(s), this.viewer && this.viewer.scene.add(this.startCapMesh); } if (this.options.capEnd) { let n = t[t.length - 1], r = t[t.length - 2]; if (!n || !r) return; let i = new e.CircleGeometry(this.options.radius, this.options.radialSegments); this.endCapMesh = new e.Mesh(i, this.material), this.endCapMesh.position.copy(n); let a = new e.Vector3().subVectors(n, r).normalize(), o = new e.Vector3(0, 0, 1), s = new e.Quaternion().setFromUnitVectors(o, a); this.endCapMesh.quaternion.copy(s), this.viewer && this.viewer.scene.add(this.endCapMesh); } } } disposeCaps() { this.startCapMesh &&= (this.startCapMesh.parent && this.startCapMesh.parent.remove(this.startCapMesh), this.startCapMesh.geometry.dispose(), null), this.endCapMesh &&= (this.endCapMesh.parent && this.endCapMesh.parent.remove(this.endCapMesh), this.endCapMesh.geometry.dispose(), null); } createDrillingRobot() { this.options.enableDrillingRobot && (this.disposeDrillingRobot(), this.drillingRobot = new uu({ pipeRadius: this.options.radius, color: this.options.robotColor, cylinderLengthRatio: this.options.robotCylinderLengthRatio, coneLengthRatio: this.options.robotConeLengthRatio }), this.viewer && (this.viewer.scene.add(this.drillingRobot.group), this.drillingRobot.group.visible = !1), this.updateDrillingRobotPosition()); } updateDrillingRobotPosition() { if (!this.drillingRobot || !this.options.enableDrillingRobot) return; let e = this.samplePathPoseByProgress(this.options.progress); e && (this.drillingRobot.setPosition(e.position), this.drillingRobot.setDirection(e.direction)); } disposeDrillingRobot() { this.drillingRobot &&= (this.drillingRobot.dispose(), null); } disposeCollisionProxyMeshes() { this.collisionProxyMesh &&= (this.collisionProxyMesh.geometry.dispose(), this.collisionProxyMesh.material instanceof e.Material && this.collisionProxyMesh.material.dispose(), null), this.staticCollisionProxyMesh &&= (this.staticCollisionProxyMesh.geometry.dispose(), this.staticCollisionProxyMesh.material instanceof e.Material && this.staticCollisionProxyMesh.material.dispose(), null); } updateCollisionProxyMesh() { let t = this.samplePathPoseByProgress(this.options.progress); if (!t) return; let n = this.getCollisionProxyHeight(), r = t.position.clone().sub(t.direction.clone().multiplyScalar(n * .5)), i = new e.CylinderGeometry(this.options.radius, this.options.radius, n, this.options.radialSegments, 1, !1), a = new e.Vector3(0, 1, 0), o = new e.Quaternion().setFromUnitVectors(a, t.direction); this.collisionProxyMesh ? (this.collisionProxyMesh.geometry.dispose(), this.collisionProxyMesh.geometry = i) : (this.collisionProxyMesh = new e.Mesh(i, new e.MeshBasicMaterial({ visible: !1 })), zr.setExcludeAll(this.collisionProxyMesh), this.collisionProxyMesh.name = "CollisionProxyMesh"), this.collisionProxyMesh.position.copy(r), this.collisionProxyMesh.quaternion.copy(o); } createStaticCollisionProxyMesh() { let t = zr.getPoints(this.options.points); if (t.length < 2) return; let n = t[0], r = t[1]; if (!n || !r) return; let i = this.getCollisionProxyHeight(), a = new e.Vector3().subVectors(r, n).normalize(), o = new e.CylinderGeometry(this.options.radius, this.options.radius, i, this.options.radialSegments, 1, !1), s = n.clone().add(a.clone().multiplyScalar(i * .5)); this.staticCollisionProxyMesh ? (this.staticCollisionProxyMesh.geometry.dispose(), this.staticCollisionProxyMesh.geometry = o, this.staticCollisionProxyMesh.position.copy(s)) : (this.staticCollisionProxyMesh = new e.Mesh(o, new e.MeshBasicMaterial({})), this.staticCollisionProxyMesh.name = "StaticCollisionProxyMesh", this.staticCollisionProxyMesh.position.copy(s), zr.setExcludeAll(this.staticCollisionProxyMesh)); let c = new e.Vector3(0, 1, 0), l = new e.Quaternion().setFromUnitVectors(c, a); this.staticCollisionProxyMesh.quaternion.copy(l); } updateProgressAnimation(e) { this.playing && (this._elapsedTime += e.data.delta, this.options.progress = Math.min(this._elapsedTime / this.duration, this._targetProgress), this.options.progress >= this._targetProgress && (this.playing = !1, this.options.progress = this._targetProgress, this.drillingRobot && (this.drillingRobot.group.visible = !1), this._targetProgress >= 1 && this.disposeCollisionProxyMeshes()), this.pathTubeGeometry.update(this.pathPointList, { radius: this.options.radius, radialSegments: this.options.radialSegments, progress: this.options.progress, startRad: this.options.startRad }), this.geometry.computeBoundingBox(), this.geometry.computeBoundingSphere(), this.drillingRobot && this.options.enableDrillingRobot && this.updateDrillingRobotPosition(), this.useStaticProxy || this.updateCollisionProxyMesh(), this.shouldCheckCollisionNow() && (this.debugCollisionProxyMeshOnHit(), this.checkCollisionsAndApplyCSG())); } updateTextureAnimation(e) { if (this.texture && this.textureAnimating) { if (this._uvOffsetUniform) { let e = this._uvOffsetUniform.value; this.scrollAxis === "x" ? e.x += this.scrollSpeed * this.scrollDirection : e.y += this.scrollSpeed * this.scrollDirection; } this._textureDuration > 0 && (this._textureElapsedTime += e, this._textureElapsedTime >= this._textureDuration && (this.textureAnimating = !1, this.#r(), this.emitter.emit("textureAnimationComplete"))); } } getCSGMesh() { return this.useStaticProxy ? this.staticCollisionProxyMesh : this.collisionProxyMesh; } samplePathPoseByProgress(t) { let n = this.pathPointList.count; if (n <= 0) return null; let r = this.pathPointList.array, i = []; for (let e = 0; e < n; e++) { let t = r[e]; t && i.push(t.pos.clone()); } if (i.length === 0) return null; let a = Math.max(0, Math.min(1, t)); if (i.length === 1) { let t = i[0]; return t ? { position: t.clone(), direction: new e.Vector3(0, 1, 0) } : null; } let o = new e.CatmullRomCurve3(i, this.options.close, "centripetal", .5), s = o.getPointAt(a), c = o.getTangentAt(a); return c.lengthSq() <= 2 ** -52 ? c.set(0, 1, 0) : c.normalize(), { position: s, direction: c }; } getCollisionProxyHeight() { return this.options.collisionProxyHeight > 0 ? this.options.collisionProxyHeight : this.options.radius * 3; } debugCollisionProxyMeshOnHit() { if (!this.options.debugCollisionProxy || !this.viewer) return; let t = this.getCSGMesh(); if (!t) return; let n = !1; for (let e of this.collisionTargets) { let r = e.mesh, i = this.collisionCountMap.get(r) ?? 0; if (!(e.maxCollisionCount !== -1 && i >= e.maxCollisionCount) && this.collisionDetector.checkIntersection(t, r)) { n = !0; break; } } if (!n) return; let r = new e.Mesh(t.geometry.clone(), new e.MeshBasicMaterial({ color: 16711935, wireframe: !0, transparent: !0, opacity: .75 })); r.name = `CollisionProxyDebug_${Date.now()}`, r.position.copy(t.position), r.quaternion.copy(t.quaternion), r.scale.copy(t.scale), this.viewer.scene.add(r), this._debugCollisionMeshes.push(r); } clearDebugCollisionMeshes() { this._debugCollisionMeshes.forEach((t) => { t.parent && t.parent.remove(t), t.geometry.dispose(), t.material instanceof e.Material && t.material.dispose(); }), this._debugCollisionMeshes = []; } shouldCheckCollisionNow() { let e = this.options.collisionCheckProgressStep; return e <= 0 ? !0 : this._lastCollisionCheckProgress < 0 || Math.abs(this.options.progress - this._lastCollisionCheckProgress) >= e || this.options.progress >= this._targetProgress ? (this._lastCollisionCheckProgress = this.options.progress, !0) : !1; } syncCSGDebugMode() { this.csgOperator.debugMode = this.options.debugCollisionProxy; } #e() { this.viewer && (this._boundProgressHandler = (e) => { this.updateProgressAnimation(e); }, this.viewer.emitter.on(Yt.BEFORE_RENDER, this._boundProgressHandler)); } #t() { this.viewer && this._boundProgressHandler && (this.viewer.emitter.off(Yt.BEFORE_RENDER, this._boundProgressHandler), this._boundProgressHandler = null); } #n() { this.viewer && (this._boundTextureHandler = (e) => this.updateTextureAnimation(e.data.delta), this.viewer.emitter.on(Yt.BEFORE_RENDER, this._boundTextureHandler)); } #r() { this.viewer && this._boundTextureHandler && (this.viewer.emitter.off(Yt.BEFORE_RENDER, this._boundTextureHandler), this._boundTextureHandler = null); } }, pu = class extends U { options; constructor(e = {}) { let t = { innerRadius: e.innerRadius ?? .5, outerRadius: e.outerRadius ?? 1, thetaSegments: e.thetaSegments ?? 32, phiSegments: e.phiSegments ?? 1, thetaStart: e.thetaStart ?? 0, thetaLength: e.thetaLength ?? Math.PI * 2, material: e.material ?? new l({ color: 16711680, metalness: .3, roughness: .4, side: P }) }, n = new se(t.innerRadius, t.outerRadius, t.thetaSegments, t.phiSegments, t.thetaStart, t.thetaLength); super(n, t.material), this.options = t, this.name = "ParametricRing"; } createGeometry() { return new se(this.options.innerRadius, this.options.outerRadius, this.options.thetaSegments, this.options.phiSegments, this.options.thetaStart, this.options.thetaLength); } updateParameters(e) { e.innerRadius !== void 0 && (this.options.innerRadius = e.innerRadius), e.outerRadius !== void 0 && (this.options.outerRadius = e.outerRadius), e.thetaSegments !== void 0 && (this.options.thetaSegments = e.thetaSegments), e.phiSegments !== void 0 && (this.options.phiSegments = e.phiSegments), e.thetaStart !== void 0 && (this.options.thetaStart = e.thetaStart), e.thetaLength !== void 0 && (this.options.thetaLength = e.thetaLength), this.updateGeometry(); } updateGeometry() { this.geometry.dispose(), this.geometry = this.createGeometry(); } dispose() { this.geometry.dispose(), this.material.dispose(); } }, mu = class extends U { options; constructor(e = {}) { let t = { radius: e.radius ?? 1, tube: e.tube ?? .4, radialSegments: e.radialSegments ?? 16, tubularSegments: e.tubularSegments ?? 100, arc: e.arc ?? Math.PI * 2, material: e.material ?? new l({ color: 16711680, metalness: .3, roughness: .4, side: P }) }, n = new le(t.radius, t.tube, t.radialSegments, t.tubularSegments, t.arc); super(n, t.material), this.options = t, this.name = "ParametricTorus"; } createGeometry() { return new le(this.options.radius, this.options.tube, this.options.radialSegments, this.options.tubularSegments, this.options.arc); } updateParameters(e) { e.radius !== void 0 && (this.options.radius = e.radius), e.tube !== void 0 && (this.options.tube = e.tube), e.radialSegments !== void 0 && (this.options.radialSegments = e.radialSegments), e.tubularSegments !== void 0 && (this.options.tubularSegments = e.tubularSegments), e.arc !== void 0 && (this.options.arc = e.arc), this.updateGeometry(); } updateGeometry() { this.geometry.dispose(), this.geometry = this.createGeometry(); } dispose() { this.geometry.dispose(), this.material.dispose(); } }, hu = class t extends B { options; sourceBox; constructor(e = {}) { let n = e.width ?? 1, r = e.height ?? 1, i = e.depth ?? 1; e.box && (n = e.box.options.width, r = e.box.options.height, i = e.box.options.depth); let a = { color: e.color ?? 16777215, linewidth: e.linewidth ?? 1, width: n, height: r, depth: i }, o = new z({ color: a.color, linewidth: a.linewidth }), s = t.createWireframeGeometry(a.width, a.height, a.depth); super(s, o), this.options = a, this.sourceBox = e.box, this.name = "ParametricWireframe"; } static createWireframeGeometry(t, n, r) { let i = t / 2, a = n / 2, o = r / 2, s = [ new W(-i, -a, -o), new W(i, -a, -o), new W(i, -a, o), new W(-i, -a, o), new W(-i, a, -o), new W(i, a, -o), new W(i, a, o), new W(-i, a, o) ], c = [ 0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7 ], l = new M(), u = []; for (let e = 0; e < c.length; e++) { let t = s[c[e]]; u.push(t.x, t.y, t.z); } return l.setAttribute("position", new e.Float32BufferAttribute(u, 3)), l; } updateParameters(e) { if (e.color !== void 0 && (this.options.color = e.color, this.material.color.setHex(e.color)), e.linewidth !== void 0 && (this.options.linewidth = e.linewidth, this.material.linewidth = e.linewidth), e.box) this.sourceBox = e.box, this.options.width = e.box.options.width, this.options.height = e.box.options.height, this.options.depth = e.box.options.depth, this.updateGeometry(); else { let t = !1; e.width !== void 0 && (this.options.width = e.width, t = !0), e.height !== void 0 && (this.options.height = e.height, t = !0), e.depth !== void 0 && (this.options.depth = e.depth, t = !0), t && this.updateGeometry(); } } syncFromBox() { this.sourceBox && (this.options.width = this.sourceBox.options.width, this.options.height = this.sourceBox.options.height, this.options.depth = this.sourceBox.options.depth, this.updateGeometry()); } updateGeometry() { this.geometry.dispose(), this.geometry = t.createWireframeGeometry(this.options.width, this.options.height, this.options.depth); } dispose() { this.geometry.dispose(), this.material.dispose(); } }, gu = class { boxes = []; cylinders = []; spheres = []; arches = []; pipes = []; addBox(e) { this.boxes.includes(e) || this.boxes.push(e); } removeBox(e) { let t = this.boxes.indexOf(e); t > -1 && this.boxes.splice(t, 1); } addCylinder(e) { this.cylinders.includes(e) || this.cylinders.push(e); } removeCylinder(e) { let t = this.cylinders.indexOf(e); t > -1 && this.cylinders.splice(t, 1); } addSphere(e) { this.spheres.includes(e) || this.spheres.push(e); } removeSphere(e) { let t = this.spheres.indexOf(e); t > -1 && this.spheres.splice(t, 1); } addArch(e) { this.arches.includes(e) || this.arches.push(e); } removeArch(e) { let t = this.arches.indexOf(e); t > -1 && this.arches.splice(t, 1); } addPipe(e) { this.pipes.includes(e) || this.pipes.push(e); } removePipe(e) { let t = this.pipes.indexOf(e); t > -1 && this.pipes.splice(t, 1); } findPipe(e) { return this.pipes.find(e) || null; } findAllPipes(e) { return this.pipes.filter(e); } findPipeByMetadata(e, t) { return this.pipes.find((n) => n.options.metadata?.[e] === t) || null; } findAllPipesByMetadata(e, t) { return this.pipes.filter((n) => n.options.metadata?.[e] === t); } findPipeByName(e) { return this.pipes.find((t) => t.name === e) || null; } findBox(e) { return this.boxes.find(e) || null; } findAllBoxes(e) { return this.boxes.filter(e); } findCylinder(e) { return this.cylinders.find(e) || null; } findAllCylinders(e) { return this.cylinders.filter(e); } findSphere(e) { return this.spheres.find(e) || null; } findAllSpheres(e) { return this.spheres.filter(e); } findArch(e) { return this.arches.find(e) || null; } findAllArches(e) { return this.arches.filter(e); } clearBoxes() { this.boxes = []; } clearCylinders() { this.cylinders = []; } clearSpheres() { this.spheres = []; } clearArches() { this.arches = []; } clearPipes() { this.pipes = []; } clearAll() { this.clearBoxes(), this.clearCylinders(), this.clearSpheres(), this.clearArches(), this.clearPipes(); } getTotalCount() { return this.boxes.length + this.cylinders.length + this.spheres.length + this.arches.length + this.pipes.length; } }, _u = { LEFT: 1, RIGHT: 2, MIDDLE: 4 }, X = Object.freeze({ NONE: 0, ROTATE: 1, TRUCK: 2, SCREEN_PAN: 4, OFFSET: 8, DOLLY: 16, ZOOM: 32, TOUCH_ROTATE: 64, TOUCH_TRUCK: 128, TOUCH_SCREEN_PAN: 256, TOUCH_OFFSET: 512, TOUCH_DOLLY: 1024, TOUCH_ZOOM: 2048, TOUCH_DOLLY_TRUCK: 4096, TOUCH_DOLLY_SCREEN_PAN: 8192, TOUCH_DOLLY_OFFSET: 16384, TOUCH_DOLLY_ROTATE: 32768, TOUCH_ZOOM_TRUCK: 65536, TOUCH_ZOOM_OFFSET: 131072, TOUCH_ZOOM_SCREEN_PAN: 262144, TOUCH_ZOOM_ROTATE: 524288 }), vu = { NONE: 0, IN: 1, OUT: -1 }; function yu(e) { return e.isPerspectiveCamera; } function bu(e) { return e.isOrthographicCamera; } var xu = Math.PI * 2, Su = Math.PI / 2, Cu = 1e-5, wu = Math.PI / 180; function Tu(e, t, n) { return Math.max(t, Math.min(n, e)); } function Eu(e, t = Cu) { return Math.abs(e) < t; } function Du(e, t, n = Cu) { return Eu(e - t, n); } function Ou(e, t) { return Math.round(e / t) * t; } function ku(e) { return isFinite(e) ? e : e < 0 ? -Number.MAX_VALUE : Number.MAX_VALUE; } function Au(e) { return Math.abs(e) < Number.MAX_VALUE ? e : e * Infinity; } function ju(e, t, n, r, i = Infinity, a) { r = Math.max(1e-4, r); let o = 2 / r, s = o * a, c = 1 / (1 + s + .48 * s * s + .235 * s * s * s), l = e - t, u = t, d = i * r; l = Tu(l, -d, d), t = e - l; let f = (n.value + o * l) * a; n.value = (n.value - o * f) * c; let p = t + (l + f) * c; return u - e > 0 == p > u && (p = u, n.value = (p - u) / a), p; } function Mu(e, t, n, r, i = Infinity, a, o) { r = Math.max(1e-4, r); let s = 2 / r, c = s * a, l = 1 / (1 + c + .48 * c * c + .235 * c * c * c), u = t.x, d = t.y, f = t.z, p = e.x - u, m = e.y - d, h = e.z - f, g = u, _ = d, v = f, y = i * r, b = y * y, x = p * p + m * m + h * h; if (x > b) { let e = Math.sqrt(x); p = p / e * y, m = m / e * y, h = h / e * y; } u = e.x - p, d = e.y - m, f = e.z - h; let S = (n.x + s * p) * a, C = (n.y + s * m) * a, w = (n.z + s * h) * a; n.x = (n.x - s * S) * l, n.y = (n.y - s * C) * l, n.z = (n.z - s * w) * l, o.x = u + (p + S) * l, o.y = d + (m + C) * l, o.z = f + (h + w) * l; let T = g - e.x, E = _ - e.y, D = v - e.z, O = o.x - g, k = o.y - _, A = o.z - v; return T * O + E * k + D * A > 0 && (o.x = g, o.y = _, o.z = v, n.x = (o.x - g) / a, n.y = (o.y - _) / a, n.z = (o.z - v) / a), o; } function Nu(e, t) { t.set(0, 0), e.forEach((e) => { t.x += e.clientX, t.y += e.clientY; }), t.x /= e.length, t.y /= e.length; } function Pu(e, t) { return bu(e) ? (console.warn(`${t} is not supported in OrthographicCamera`), !0) : !1; } var Fu = class { _listeners = {}; addEventListener(e, t) { let n = this._listeners; n[e] === void 0 && (n[e] = []), n[e].indexOf(t) === -1 && n[e].push(t); } hasEventListener(e, t) { let n = this._listeners; return n[e] !== void 0 && n[e].indexOf(t) !== -1; } removeEventListener(e, t) { let n = this._listeners[e]; if (n !== void 0) { let e = n.indexOf(t); e !== -1 && n.splice(e, 1); } } removeAllEventListeners(e) { if (!e) { this._listeners = {}; return; } Array.isArray(this._listeners[e]) && (this._listeners[e].length = 0); } dispatchEvent(e) { let t = this._listeners[e.type]; if (t !== void 0) { e.target = this; let n = t.slice(0); for (let t = 0, r = n.length; t < r; t++) n[t].call(this, e); } } }, Iu = "3.1.2", Lu = 1 / 8, Ru = /Mac/.test(globalThis?.navigator?.platform), Z, zu, Bu, Vu, Hu, Q, $, Uu, Wu, Gu, Ku, qu, Ju, Yu, Xu, Zu, Qu, $u, ed, td, nd, rd, id, ad = class e extends Fu { static install(e) { Z = e.THREE, zu = Object.freeze(new Z.Vector3(0, 0, 0)), Bu = Object.freeze(new Z.Vector3(0, 1, 0)), Vu = Object.freeze(new Z.Vector3(0, 0, 1)), Hu = new Z.Vector2(), Q = new Z.Vector3(), $ = new Z.Vector3(), Uu = new Z.Vector3(), Wu = new Z.Vector3(), Gu = new Z.Vector3(), Ku = new Z.Vector3(), qu = new Z.Vector3(), Ju = new Z.Vector3(), Yu = new Z.Vector3(), Xu = new Z.Spherical(), Zu = new Z.Spherical(), Qu = new Z.Box3(), $u = new Z.Box3(), ed = new Z.Sphere(), td = new Z.Quaternion(), nd = new Z.Quaternion(), rd = new Z.Matrix4(), id = new Z.Raycaster(); } static get ACTION() { return X; } minPolarAngle = 0; maxPolarAngle = Math.PI; minAzimuthAngle = -Infinity; maxAzimuthAngle = Infinity; minDistance = 2 ** -52; maxDistance = Infinity; infinityDolly = !1; minZoom = .01; maxZoom = Infinity; smoothTime = .25; draggingSmoothTime = .125; maxSpeed = Infinity; azimuthRotateSpeed = 1; polarRotateSpeed = 1; dollySpeed = 1; dollyDragInverted = !1; truckSpeed = 2; dollyToCursor = !1; dragToOffset = !1; boundaryFriction = 0; restThreshold = .01; colliderMeshes = []; mouseButtons; touches; cancel = () => {}; lockPointer; unlockPointer; _enabled = !0; _camera; _yAxisUpSpace; _yAxisUpSpaceInverse; _state = X.NONE; _domElement; _viewport = null; _target; _targetEnd; _focalOffset; _focalOffsetEnd; _spherical; _sphericalEnd; _lastDistance; _zoom; _zoomEnd; _lastZoom; _cameraUp0; _target0; _position0; _zoom0; _focalOffset0; _dollyControlCoord; _changedDolly = 0; _changedZoom = 0; _nearPlaneCorners; _hasRested = !0; _boundary; _boundaryEnclosesCamera = !1; _needsUpdate = !0; _updatedLastTime = !1; _elementRect = new DOMRect(); _isDragging = !1; _dragNeedsUpdate = !0; _activePointers = []; _lockedPointer = null; _interactiveArea = new DOMRect(0, 0, 1, 1); _isUserControllingRotate = !1; _isUserControllingDolly = !1; _isUserControllingTruck = !1; _isUserControllingOffset = !1; _isUserControllingZoom = !1; _lastDollyDirection = vu.NONE; _thetaVelocity = { value: 0 }; _phiVelocity = { value: 0 }; _radiusVelocity = { value: 0 }; _targetVelocity = new Z.Vector3(); _focalOffsetVelocity = new Z.Vector3(); _zoomVelocity = { value: 0 }; set verticalDragToForward(e) { console.warn("camera-controls: `verticalDragToForward` was removed. Use `mouseButtons.left = CameraControls.ACTION.SCREEN_PAN` instead."); } constructor(t, n) { super(), Z === void 0 && console.error("camera-controls: `THREE` is undefined. You must first run `CameraControls.install( { THREE: THREE } )`. Check the docs for further information."), this._camera = t, this._yAxisUpSpace = new Z.Quaternion().setFromUnitVectors(this._camera.up, Bu), this._yAxisUpSpaceInverse = this._yAxisUpSpace.clone().invert(), this._state = X.NONE, this._target = new Z.Vector3(), this._targetEnd = this._target.clone(), this._focalOffset = new Z.Vector3(), this._focalOffsetEnd = this._focalOffset.clone(), this._spherical = new Z.Spherical().setFromVector3(Q.copy(this._camera.position).applyQuaternion(this._yAxisUpSpace)), this._sphericalEnd = this._spherical.clone(), this._lastDistance = this._spherical.radius, this._zoom = this._camera.zoom, this._zoomEnd = this._zoom, this._lastZoom = this._zoom, this._nearPlaneCorners = [ new Z.Vector3(), new Z.Vector3(), new Z.Vector3(), new Z.Vector3() ], this._updateNearPlaneCorners(), this._boundary = new Z.Box3(new Z.Vector3(-Infinity, -Infinity, -Infinity), new Z.Vector3(Infinity, Infinity, Infinity)), this._cameraUp0 = this._camera.up.clone(), this._target0 = this._target.clone(), this._position0 = this._camera.position.clone(), this._zoom0 = this._zoom, this._focalOffset0 = this._focalOffset.clone(), this._dollyControlCoord = new Z.Vector2(), this.mouseButtons = { left: X.ROTATE, middle: X.DOLLY, right: X.TRUCK, wheel: yu(this._camera) ? X.DOLLY : bu(this._camera) ? X.ZOOM : X.NONE }, this.touches = { one: X.TOUCH_ROTATE, two: yu(this._camera) ? X.TOUCH_DOLLY_TRUCK : bu(this._camera) ? X.TOUCH_ZOOM_TRUCK : X.NONE, three: X.TOUCH_TRUCK }; let r = new Z.Vector2(), i = new Z.Vector2(), a = new Z.Vector2(), o = (e) => { if (!this._enabled || !this._domElement) return; if (this._interactiveArea.left !== 0 || this._interactiveArea.top !== 0 || this._interactiveArea.width !== 1 || this._interactiveArea.height !== 1) { let t = this._domElement.getBoundingClientRect(), n = e.clientX / t.width, r = e.clientY / t.height; if (n < this._interactiveArea.left || n > this._interactiveArea.right || r < this._interactiveArea.top || r > this._interactiveArea.bottom) return; } let t = e.pointerType === "mouse" ? (e.buttons & _u.LEFT) === _u.LEFT ? _u.LEFT : (e.buttons & _u.MIDDLE) === _u.MIDDLE ? _u.MIDDLE : (e.buttons & _u.RIGHT) === _u.RIGHT ? _u.RIGHT : null : null; if (t !== null) { let e = this._findPointerByMouseButton(t); e && this._disposePointer(e); } if ((e.buttons & _u.LEFT) === _u.LEFT && this._lockedPointer) return; let n = { pointerId: e.pointerId, clientX: e.clientX, clientY: e.clientY, deltaX: 0, deltaY: 0, mouseButton: t }; this._activePointers.push(n), this._domElement.ownerDocument.removeEventListener("pointermove", s, { passive: !1 }), this._domElement.ownerDocument.removeEventListener("pointerup", c), this._domElement.ownerDocument.addEventListener("pointermove", s, { passive: !1 }), this._domElement.ownerDocument.addEventListener("pointerup", c), this._isDragging = !0, f(e); }, s = (e) => { e.cancelable && e.preventDefault(); let t = e.pointerId, n = this._lockedPointer || this._findPointerById(t); if (n) { if (n.clientX = e.clientX, n.clientY = e.clientY, n.deltaX = e.movementX, n.deltaY = e.movementY, this._state = 0, e.pointerType === "touch") switch (this._activePointers.length) { case 1: this._state = this.touches.one; break; case 2: this._state = this.touches.two; break; case 3: this._state = this.touches.three; break; } else (!this._isDragging && this._lockedPointer || this._isDragging && (e.buttons & _u.LEFT) === _u.LEFT) && (this._state |= this.mouseButtons.left), this._isDragging && (e.buttons & _u.MIDDLE) === _u.MIDDLE && (this._state |= this.mouseButtons.middle), this._isDragging && (e.buttons & _u.RIGHT) === _u.RIGHT && (this._state |= this.mouseButtons.right); p(); } }, c = (e) => { let t = this._findPointerById(e.pointerId); if (!(t && t === this._lockedPointer)) { if (t && this._disposePointer(t), e.pointerType === "touch") switch (this._activePointers.length) { case 0: this._state = X.NONE; break; case 1: this._state = this.touches.one; break; case 2: this._state = this.touches.two; break; case 3: this._state = this.touches.three; break; } else this._state = X.NONE; m(); } }, l = -1, u = (e) => { if (!this._domElement || !this._enabled || this.mouseButtons.wheel === X.NONE) return; if (this._interactiveArea.left !== 0 || this._interactiveArea.top !== 0 || this._interactiveArea.width !== 1 || this._interactiveArea.height !== 1) { let t = this._domElement.getBoundingClientRect(), n = e.clientX / t.width, r = e.clientY / t.height; if (n < this._interactiveArea.left || n > this._interactiveArea.right || r < this._interactiveArea.top || r > this._interactiveArea.bottom) return; } if (e.preventDefault(), this.dollyToCursor || this.mouseButtons.wheel === X.ROTATE || this.mouseButtons.wheel === X.TRUCK) { let e = performance.now(); l - e < 1e3 && this._getClientRect(this._elementRect), l = e; } let t = Ru ? -1 : -3, n = e.deltaMode === 1 && !e.ctrlKey ? e.deltaY / t : e.deltaY / (t * 10), r = this.dollyToCursor ? (e.clientX - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, i = this.dollyToCursor ? (e.clientY - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0; switch (e.ctrlKey ? X.ZOOM : this.mouseButtons.wheel) { case X.ROTATE: this._rotateInternal(e.deltaX, e.deltaY), this._isUserControllingRotate = !0; break; case X.TRUCK: this._truckInternal(e.deltaX, e.deltaY, !1, !1), this._isUserControllingTruck = !0; break; case X.SCREEN_PAN: this._truckInternal(e.deltaX, e.deltaY, !1, !0), this._isUserControllingTruck = !0; break; case X.OFFSET: this._truckInternal(e.deltaX, e.deltaY, !0, !1), this._isUserControllingOffset = !0; break; case X.DOLLY: this._dollyInternal(-n, r, i), this._isUserControllingDolly = !0; break; case X.ZOOM: this._zoomInternal(-n, r, i), this._isUserControllingZoom = !0; break; } this.dispatchEvent({ type: "control" }); }, d = (t) => { if (!(!this._domElement || !this._enabled)) { if (this.mouseButtons.right === e.ACTION.NONE) { let e = t instanceof PointerEvent ? t.pointerId : 0, n = this._findPointerById(e); n && this._disposePointer(n), this._domElement.ownerDocument.removeEventListener("pointermove", s, { passive: !1 }), this._domElement.ownerDocument.removeEventListener("pointerup", c); return; } t.preventDefault(); } }, f = (e) => { if (this._enabled) { if (Nu(this._activePointers, Hu), this._getClientRect(this._elementRect), r.copy(Hu), i.copy(Hu), this._activePointers.length >= 2) { let e = Hu.x - this._activePointers[1].clientX, t = Hu.y - this._activePointers[1].clientY, n = Math.sqrt(e * e + t * t); a.set(0, n); let r = (this._activePointers[0].clientX + this._activePointers[1].clientX) * .5, o = (this._activePointers[0].clientY + this._activePointers[1].clientY) * .5; i.set(r, o); } if (this._state = 0, !e) this._lockedPointer && (this._state |= this.mouseButtons.left); else if ("pointerType" in e && e.pointerType === "touch") switch (this._activePointers.length) { case 1: this._state = this.touches.one; break; case 2: this._state = this.touches.two; break; case 3: this._state = this.touches.three; break; } else !this._lockedPointer && (e.buttons & _u.LEFT) === _u.LEFT && (this._state |= this.mouseButtons.left), (e.buttons & _u.MIDDLE) === _u.MIDDLE && (this._state |= this.mouseButtons.middle), (e.buttons & _u.RIGHT) === _u.RIGHT && (this._state |= this.mouseButtons.right); ((this._state & X.ROTATE) === X.ROTATE || (this._state & X.TOUCH_ROTATE) === X.TOUCH_ROTATE || (this._state & X.TOUCH_DOLLY_ROTATE) === X.TOUCH_DOLLY_ROTATE || (this._state & X.TOUCH_ZOOM_ROTATE) === X.TOUCH_ZOOM_ROTATE) && (this._sphericalEnd.theta = this._spherical.theta, this._sphericalEnd.phi = this._spherical.phi, this._thetaVelocity.value = 0, this._phiVelocity.value = 0), ((this._state & X.TRUCK) === X.TRUCK || (this._state & X.SCREEN_PAN) === X.SCREEN_PAN || (this._state & X.TOUCH_TRUCK) === X.TOUCH_TRUCK || (this._state & X.TOUCH_SCREEN_PAN) === X.TOUCH_SCREEN_PAN || (this._state & X.TOUCH_DOLLY_TRUCK) === X.TOUCH_DOLLY_TRUCK || (this._state & X.TOUCH_DOLLY_SCREEN_PAN) === X.TOUCH_DOLLY_SCREEN_PAN || (this._state & X.TOUCH_ZOOM_TRUCK) === X.TOUCH_ZOOM_TRUCK || (this._state & X.TOUCH_ZOOM_SCREEN_PAN) === X.TOUCH_DOLLY_SCREEN_PAN) && (this._targetEnd.copy(this._target), this._targetVelocity.set(0, 0, 0)), ((this._state & X.DOLLY) === X.DOLLY || (this._state & X.TOUCH_DOLLY) === X.TOUCH_DOLLY || (this._state & X.TOUCH_DOLLY_TRUCK) === X.TOUCH_DOLLY_TRUCK || (this._state & X.TOUCH_DOLLY_SCREEN_PAN) === X.TOUCH_DOLLY_SCREEN_PAN || (this._state & X.TOUCH_DOLLY_OFFSET) === X.TOUCH_DOLLY_OFFSET || (this._state & X.TOUCH_DOLLY_ROTATE) === X.TOUCH_DOLLY_ROTATE) && (this._sphericalEnd.radius = this._spherical.radius, this._radiusVelocity.value = 0), ((this._state & X.ZOOM) === X.ZOOM || (this._state & X.TOUCH_ZOOM) === X.TOUCH_ZOOM || (this._state & X.TOUCH_ZOOM_TRUCK) === X.TOUCH_ZOOM_TRUCK || (this._state & X.TOUCH_ZOOM_SCREEN_PAN) === X.TOUCH_ZOOM_SCREEN_PAN || (this._state & X.TOUCH_ZOOM_OFFSET) === X.TOUCH_ZOOM_OFFSET || (this._state & X.TOUCH_ZOOM_ROTATE) === X.TOUCH_ZOOM_ROTATE) && (this._zoomEnd = this._zoom, this._zoomVelocity.value = 0), ((this._state & X.OFFSET) === X.OFFSET || (this._state & X.TOUCH_OFFSET) === X.TOUCH_OFFSET || (this._state & X.TOUCH_DOLLY_OFFSET) === X.TOUCH_DOLLY_OFFSET || (this._state & X.TOUCH_ZOOM_OFFSET) === X.TOUCH_ZOOM_OFFSET) && (this._focalOffsetEnd.copy(this._focalOffset), this._focalOffsetVelocity.set(0, 0, 0)), this.dispatchEvent({ type: "controlstart" }); } }, p = () => { if (!this._enabled || !this._dragNeedsUpdate) return; this._dragNeedsUpdate = !1, Nu(this._activePointers, Hu); let e = this._domElement && this._domElement.ownerDocument.pointerLockElement === this._domElement ? this._lockedPointer || this._activePointers[0] : null, t = e ? -e.deltaX : i.x - Hu.x, n = e ? -e.deltaY : i.y - Hu.y; if (i.copy(Hu), ((this._state & X.ROTATE) === X.ROTATE || (this._state & X.TOUCH_ROTATE) === X.TOUCH_ROTATE || (this._state & X.TOUCH_DOLLY_ROTATE) === X.TOUCH_DOLLY_ROTATE || (this._state & X.TOUCH_ZOOM_ROTATE) === X.TOUCH_ZOOM_ROTATE) && (this._rotateInternal(t, n), this._isUserControllingRotate = !0), (this._state & X.DOLLY) === X.DOLLY || (this._state & X.ZOOM) === X.ZOOM) { let e = this.dollyToCursor ? (r.x - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, t = this.dollyToCursor ? (r.y - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0, i = this.dollyDragInverted ? -1 : 1; (this._state & X.DOLLY) === X.DOLLY ? (this._dollyInternal(i * n * Lu, e, t), this._isUserControllingDolly = !0) : (this._zoomInternal(i * n * Lu, e, t), this._isUserControllingZoom = !0); } if ((this._state & X.TOUCH_DOLLY) === X.TOUCH_DOLLY || (this._state & X.TOUCH_ZOOM) === X.TOUCH_ZOOM || (this._state & X.TOUCH_DOLLY_TRUCK) === X.TOUCH_DOLLY_TRUCK || (this._state & X.TOUCH_ZOOM_TRUCK) === X.TOUCH_ZOOM_TRUCK || (this._state & X.TOUCH_DOLLY_SCREEN_PAN) === X.TOUCH_DOLLY_SCREEN_PAN || (this._state & X.TOUCH_ZOOM_SCREEN_PAN) === X.TOUCH_ZOOM_SCREEN_PAN || (this._state & X.TOUCH_DOLLY_OFFSET) === X.TOUCH_DOLLY_OFFSET || (this._state & X.TOUCH_ZOOM_OFFSET) === X.TOUCH_ZOOM_OFFSET || (this._state & X.TOUCH_DOLLY_ROTATE) === X.TOUCH_DOLLY_ROTATE || (this._state & X.TOUCH_ZOOM_ROTATE) === X.TOUCH_ZOOM_ROTATE) { let e = Hu.x - this._activePointers[1].clientX, t = Hu.y - this._activePointers[1].clientY, n = Math.sqrt(e * e + t * t), r = a.y - n; a.set(0, n); let o = this.dollyToCursor ? (i.x - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, s = this.dollyToCursor ? (i.y - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0; (this._state & X.TOUCH_DOLLY) === X.TOUCH_DOLLY || (this._state & X.TOUCH_DOLLY_ROTATE) === X.TOUCH_DOLLY_ROTATE || (this._state & X.TOUCH_DOLLY_TRUCK) === X.TOUCH_DOLLY_TRUCK || (this._state & X.TOUCH_DOLLY_SCREEN_PAN) === X.TOUCH_DOLLY_SCREEN_PAN || (this._state & X.TOUCH_DOLLY_OFFSET) === X.TOUCH_DOLLY_OFFSET ? (this._dollyInternal(r * Lu, o, s), this._isUserControllingDolly = !0) : (this._zoomInternal(r * Lu, o, s), this._isUserControllingZoom = !0); } ((this._state & X.TRUCK) === X.TRUCK || (this._state & X.TOUCH_TRUCK) === X.TOUCH_TRUCK || (this._state & X.TOUCH_DOLLY_TRUCK) === X.TOUCH_DOLLY_TRUCK || (this._state & X.TOUCH_ZOOM_TRUCK) === X.TOUCH_ZOOM_TRUCK) && (this._truckInternal(t, n, !1, !1), this._isUserControllingTruck = !0), ((this._state & X.SCREEN_PAN) === X.SCREEN_PAN || (this._state & X.TOUCH_SCREEN_PAN) === X.TOUCH_SCREEN_PAN || (this._state & X.TOUCH_DOLLY_SCREEN_PAN) === X.TOUCH_DOLLY_SCREEN_PAN || (this._state & X.TOUCH_ZOOM_SCREEN_PAN) === X.TOUCH_ZOOM_SCREEN_PAN) && (this._truckInternal(t, n, !1, !0), this._isUserControllingTruck = !0), ((this._state & X.OFFSET) === X.OFFSET || (this._state & X.TOUCH_OFFSET) === X.TOUCH_OFFSET || (this._state & X.TOUCH_DOLLY_OFFSET) === X.TOUCH_DOLLY_OFFSET || (this._state & X.TOUCH_ZOOM_OFFSET) === X.TOUCH_ZOOM_OFFSET) && (this._truckInternal(t, n, !0, !1), this._isUserControllingOffset = !0), this.dispatchEvent({ type: "control" }); }, m = () => { Nu(this._activePointers, Hu), i.copy(Hu), this._dragNeedsUpdate = !1, (this._activePointers.length === 0 || this._activePointers.length === 1 && this._activePointers[0] === this._lockedPointer) && (this._isDragging = !1), this._activePointers.length === 0 && this._domElement && (this._domElement.ownerDocument.removeEventListener("pointermove", s, { passive: !1 }), this._domElement.ownerDocument.removeEventListener("pointerup", c), this.dispatchEvent({ type: "controlend" })); }; this.lockPointer = () => { !this._enabled || !this._domElement || (this.cancel(), this._lockedPointer = { pointerId: -1, clientX: 0, clientY: 0, deltaX: 0, deltaY: 0, mouseButton: null }, this._activePointers.push(this._lockedPointer), this._domElement.ownerDocument.removeEventListener("pointermove", s, { passive: !1 }), this._domElement.ownerDocument.removeEventListener("pointerup", c), this._domElement.requestPointerLock(), this._domElement.ownerDocument.addEventListener("pointerlockchange", h), this._domElement.ownerDocument.addEventListener("pointerlockerror", g), this._domElement.ownerDocument.addEventListener("pointermove", s, { passive: !1 }), this._domElement.ownerDocument.addEventListener("pointerup", c), f()); }, this.unlockPointer = () => { this._lockedPointer !== null && (this._disposePointer(this._lockedPointer), this._lockedPointer = null), this._domElement?.ownerDocument.exitPointerLock(), this._domElement?.ownerDocument.removeEventListener("pointerlockchange", h), this._domElement?.ownerDocument.removeEventListener("pointerlockerror", g), this.cancel(); }; let h = () => { this._domElement && this._domElement.ownerDocument.pointerLockElement === this._domElement || this.unlockPointer(); }, g = () => { this.unlockPointer(); }; this._addAllEventListeners = (e) => { this._domElement = e, this._domElement.style.touchAction = "none", this._domElement.style.userSelect = "none", this._domElement.style.webkitUserSelect = "none", this._domElement.addEventListener("pointerdown", o), this._domElement.addEventListener("pointercancel", c), this._domElement.addEventListener("wheel", u, { passive: !1 }), this._domElement.addEventListener("contextmenu", d); }, this._removeAllEventListeners = () => { this._domElement && (this._domElement.style.touchAction = "", this._domElement.style.userSelect = "", this._domElement.style.webkitUserSelect = "", this._domElement.removeEventListener("pointerdown", o), this._domElement.removeEventListener("pointercancel", c), this._domElement.removeEventListener("wheel", u, { passive: !1 }), this._domElement.removeEventListener("contextmenu", d), this._domElement.ownerDocument.removeEventListener("pointermove", s, { passive: !1 }), this._domElement.ownerDocument.removeEventListener("pointerup", c), this._domElement.ownerDocument.removeEventListener("pointerlockchange", h), this._domElement.ownerDocument.removeEventListener("pointerlockerror", g)); }, this.cancel = () => { this._state !== X.NONE && (this._state = X.NONE, this._activePointers.length = 0, m()); }, n && this.connect(n), this.update(0); } get camera() { return this._camera; } set camera(e) { this._camera = e, this.updateCameraUp(), this._camera.updateProjectionMatrix(), this._updateNearPlaneCorners(), this._needsUpdate = !0; } get enabled() { return this._enabled; } set enabled(e) { this._enabled = e, this._domElement && (e ? (this._domElement.style.touchAction = "none", this._domElement.style.userSelect = "none", this._domElement.style.webkitUserSelect = "none") : (this.cancel(), this._domElement.style.touchAction = "", this._domElement.style.userSelect = "", this._domElement.style.webkitUserSelect = "")); } get active() { return !this._hasRested; } get currentAction() { return this._state; } get distance() { return this._spherical.radius; } set distance(e) { this._spherical.radius === e && this._sphericalEnd.radius === e || (this._spherical.radius = e, this._sphericalEnd.radius = e, this._needsUpdate = !0); } get azimuthAngle() { return this._spherical.theta; } set azimuthAngle(e) { this._spherical.theta === e && this._sphericalEnd.theta === e || (this._spherical.theta = e, this._sphericalEnd.theta = e, this._needsUpdate = !0); } get polarAngle() { return this._spherical.phi; } set polarAngle(e) { this._spherical.phi === e && this._sphericalEnd.phi === e || (this._spherical.phi = e, this._sphericalEnd.phi = e, this._needsUpdate = !0); } get boundaryEnclosesCamera() { return this._boundaryEnclosesCamera; } set boundaryEnclosesCamera(e) { this._boundaryEnclosesCamera = e, this._needsUpdate = !0; } set interactiveArea(e) { this._interactiveArea.width = Tu(e.width, 0, 1), this._interactiveArea.height = Tu(e.height, 0, 1), this._interactiveArea.x = Tu(e.x, 0, 1 - this._interactiveArea.width), this._interactiveArea.y = Tu(e.y, 0, 1 - this._interactiveArea.height); } addEventListener(e, t) { super.addEventListener(e, t); } removeEventListener(e, t) { super.removeEventListener(e, t); } rotate(e, t, n = !1) { return this.rotateTo(this._sphericalEnd.theta + e, this._sphericalEnd.phi + t, n); } rotateAzimuthTo(e, t = !1) { return this.rotateTo(e, this._sphericalEnd.phi, t); } rotatePolarTo(e, t = !1) { return this.rotateTo(this._sphericalEnd.theta, e, t); } rotateTo(e, t, n = !1) { this._isUserControllingRotate = !1; let r = Tu(e, this.minAzimuthAngle, this.maxAzimuthAngle), i = Tu(t, this.minPolarAngle, this.maxPolarAngle); this._sphericalEnd.theta = r, this._sphericalEnd.phi = i, this._sphericalEnd.makeSafe(), this._needsUpdate = !0, n || (this._spherical.theta = this._sphericalEnd.theta, this._spherical.phi = this._sphericalEnd.phi); let a = !n || Du(this._spherical.theta, this._sphericalEnd.theta, this.restThreshold) && Du(this._spherical.phi, this._sphericalEnd.phi, this.restThreshold); return this._createOnRestPromise(a); } dolly(e, t = !1) { return this.dollyTo(this._sphericalEnd.radius - e, t); } dollyTo(e, t = !1) { return this._isUserControllingDolly = !1, this._lastDollyDirection = vu.NONE, this._changedDolly = 0, this._dollyToNoClamp(Tu(e, this.minDistance, this.maxDistance), t); } _dollyToNoClamp(e, t = !1) { let n = this._sphericalEnd.radius; if (this.colliderMeshes.length >= 1) { let t = this._collisionTest(), r = Du(t, this._spherical.radius); if (!(n > e) && r) return Promise.resolve(); this._sphericalEnd.radius = Math.min(e, t); } else this._sphericalEnd.radius = e; this._needsUpdate = !0, t || (this._spherical.radius = this._sphericalEnd.radius); let r = !t || Du(this._spherical.radius, this._sphericalEnd.radius, this.restThreshold); return this._createOnRestPromise(r); } dollyInFixed(e, t = !1) { this._targetEnd.add(this._getCameraDirection(Wu).multiplyScalar(e)), t || this._target.copy(this._targetEnd); let n = !t || Du(this._target.x, this._targetEnd.x, this.restThreshold) && Du(this._target.y, this._targetEnd.y, this.restThreshold) && Du(this._target.z, this._targetEnd.z, this.restThreshold); return this._createOnRestPromise(n); } zoom(e, t = !1) { return this.zoomTo(this._zoomEnd + e, t); } zoomTo(e, t = !1) { this._isUserControllingZoom = !1, this._zoomEnd = Tu(e, this.minZoom, this.maxZoom), this._needsUpdate = !0, t || (this._zoom = this._zoomEnd); let n = !t || Du(this._zoom, this._zoomEnd, this.restThreshold); return this._changedZoom = 0, this._createOnRestPromise(n); } pan(e, t, n = !1) { return console.warn("`pan` has been renamed to `truck`"), this.truck(e, t, n); } truck(e, t, n = !1) { this._camera.updateMatrix(), Gu.setFromMatrixColumn(this._camera.matrix, 0), Ku.setFromMatrixColumn(this._camera.matrix, 1), Gu.multiplyScalar(e), Ku.multiplyScalar(-t); let r = Q.copy(Gu).add(Ku), i = $.copy(this._targetEnd).add(r); return this.moveTo(i.x, i.y, i.z, n); } forward(e, t = !1) { Q.setFromMatrixColumn(this._camera.matrix, 0), Q.crossVectors(this._camera.up, Q), Q.multiplyScalar(e); let n = $.copy(this._targetEnd).add(Q); return this.moveTo(n.x, n.y, n.z, t); } elevate(e, t = !1) { return Q.copy(this._camera.up).multiplyScalar(e), this.moveTo(this._targetEnd.x + Q.x, this._targetEnd.y + Q.y, this._targetEnd.z + Q.z, t); } moveTo(e, t, n, r = !1) { this._isUserControllingTruck = !1; let i = Q.set(e, t, n).sub(this._targetEnd); this._encloseToBoundary(this._targetEnd, i, this.boundaryFriction), this._needsUpdate = !0, r || this._target.copy(this._targetEnd); let a = !r || Du(this._target.x, this._targetEnd.x, this.restThreshold) && Du(this._target.y, this._targetEnd.y, this.restThreshold) && Du(this._target.z, this._targetEnd.z, this.restThreshold); return this._createOnRestPromise(a); } lookInDirectionOf(e, t, n, r = !1) { let i = Q.set(e, t, n).sub(this._targetEnd).normalize().multiplyScalar(-this._sphericalEnd.radius).add(this._targetEnd); return this.setPosition(i.x, i.y, i.z, r); } fitToBox(e, t, { cover: n = !1, paddingLeft: r = 0, paddingRight: i = 0, paddingBottom: a = 0, paddingTop: o = 0 } = {}) { let s = [], c = e.isBox3 ? Qu.copy(e) : Qu.setFromObject(e); c.isEmpty() && (console.warn("camera-controls: fitTo() cannot be used with an empty box. Aborting"), Promise.resolve()); let l = Ou(this._sphericalEnd.theta, Su), u = Ou(this._sphericalEnd.phi, Su); s.push(this.rotateTo(l, u, t)); let d = Q.setFromSpherical(this._sphericalEnd).normalize(), f = td.setFromUnitVectors(d, Vu), p = Du(Math.abs(d.y), 1); p && f.multiply(nd.setFromAxisAngle(Bu, l)), f.multiply(this._yAxisUpSpaceInverse); let m = $u.makeEmpty(); $.copy(c.min).applyQuaternion(f), m.expandByPoint($), $.copy(c.min).setX(c.max.x).applyQuaternion(f), m.expandByPoint($), $.copy(c.min).setY(c.max.y).applyQuaternion(f), m.expandByPoint($), $.copy(c.max).setZ(c.min.z).applyQuaternion(f), m.expandByPoint($), $.copy(c.min).setZ(c.max.z).applyQuaternion(f), m.expandByPoint($), $.copy(c.max).setY(c.min.y).applyQuaternion(f), m.expandByPoint($), $.copy(c.max).setX(c.min.x).applyQuaternion(f), m.expandByPoint($), $.copy(c.max).applyQuaternion(f), m.expandByPoint($), m.min.x -= r, m.min.y -= a, m.max.x += i, m.max.y += o, f.setFromUnitVectors(Vu, d), p && f.premultiply(nd.invert()), f.premultiply(this._yAxisUpSpace); let h = m.getSize(Q), g = m.getCenter($).applyQuaternion(f); if (yu(this._camera)) { let e = this.getDistanceToFitBox(h.x, h.y, h.z, n); s.push(this.moveTo(g.x, g.y, g.z, t)), s.push(this.dollyTo(e, t)), s.push(this.setFocalOffset(0, 0, 0, t)); } else if (bu(this._camera)) { let e = this._camera, r = e.right - e.left, i = e.top - e.bottom, a = n ? Math.max(r / h.x, i / h.y) : Math.min(r / h.x, i / h.y); s.push(this.moveTo(g.x, g.y, g.z, t)), s.push(this.zoomTo(a, t)), s.push(this.setFocalOffset(0, 0, 0, t)); } return Promise.all(s); } fitToSphere(t, n) { let r = [], i = "isObject3D" in t ? e.createBoundingSphere(t, ed) : ed.copy(t); if (r.push(this.moveTo(i.center.x, i.center.y, i.center.z, n)), yu(this._camera)) { let e = this.getDistanceToFitSphere(i.radius); r.push(this.dollyTo(e, n)); } else if (bu(this._camera)) { let e = this._camera.right - this._camera.left, t = this._camera.top - this._camera.bottom, a = 2 * i.radius, o = Math.min(e / a, t / a); r.push(this.zoomTo(o, n)); } return r.push(this.setFocalOffset(0, 0, 0, n)), Promise.all(r); } setLookAt(e, t, n, r, i, a, o = !1) { this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._lastDollyDirection = vu.NONE, this._changedDolly = 0; let s = $.set(r, i, a), c = Q.set(e, t, n); this._targetEnd.copy(s), this._sphericalEnd.setFromVector3(c.sub(s).applyQuaternion(this._yAxisUpSpace)), this._needsUpdate = !0, o || (this._target.copy(this._targetEnd), this._spherical.copy(this._sphericalEnd)); let l = !o || Du(this._target.x, this._targetEnd.x, this.restThreshold) && Du(this._target.y, this._targetEnd.y, this.restThreshold) && Du(this._target.z, this._targetEnd.z, this.restThreshold) && Du(this._spherical.theta, this._sphericalEnd.theta, this.restThreshold) && Du(this._spherical.phi, this._sphericalEnd.phi, this.restThreshold) && Du(this._spherical.radius, this._sphericalEnd.radius, this.restThreshold); return this._createOnRestPromise(l); } lerp(e, t, n, r = !1) { this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._lastDollyDirection = vu.NONE, this._changedDolly = 0; let i = Q.set(...e.target); if ("spherical" in e) Xu.set(...e.spherical); else { let t = $.set(...e.position); Xu.setFromVector3(t.sub(i).applyQuaternion(this._yAxisUpSpace)); } let a = Uu.set(...t.target); if ("spherical" in t) Zu.set(...t.spherical); else { let e = $.set(...t.position); Zu.setFromVector3(e.sub(a).applyQuaternion(this._yAxisUpSpace)); } this._targetEnd.copy(i.lerp(a, n)); let o = Zu.theta - Xu.theta, s = Zu.phi - Xu.phi, c = Zu.radius - Xu.radius; this._sphericalEnd.set(Xu.radius + c * n, Xu.phi + s * n, Xu.theta + o * n), this._needsUpdate = !0, r || (this._target.copy(this._targetEnd), this._spherical.copy(this._sphericalEnd)); let l = !r || Du(this._target.x, this._targetEnd.x, this.restThreshold) && Du(this._target.y, this._targetEnd.y, this.restThreshold) && Du(this._target.z, this._targetEnd.z, this.restThreshold) && Du(this._spherical.theta, this._sphericalEnd.theta, this.restThreshold) && Du(this._spherical.phi, this._sphericalEnd.phi, this.restThreshold) && Du(this._spherical.radius, this._sphericalEnd.radius, this.restThreshold); return this._createOnRestPromise(l); } lerpLookAt(e, t, n, r, i, a, o, s, c, l, u, d, f, p = !1) { return this.lerp({ position: [ e, t, n ], target: [ r, i, a ] }, { position: [ o, s, c ], target: [ l, u, d ] }, f, p); } setPosition(e, t, n, r = !1) { return this.setLookAt(e, t, n, this._targetEnd.x, this._targetEnd.y, this._targetEnd.z, r); } setTarget(e, t, n, r = !1) { let i = this.getPosition(Q), a = this.setLookAt(i.x, i.y, i.z, e, t, n, r); return this._sphericalEnd.phi = Tu(this._sphericalEnd.phi, this.minPolarAngle, this.maxPolarAngle), a; } setFocalOffset(e, t, n, r = !1) { this._isUserControllingOffset = !1, this._focalOffsetEnd.set(e, t, n), this._needsUpdate = !0, r || this._focalOffset.copy(this._focalOffsetEnd); let i = !r || Du(this._focalOffset.x, this._focalOffsetEnd.x, this.restThreshold) && Du(this._focalOffset.y, this._focalOffsetEnd.y, this.restThreshold) && Du(this._focalOffset.z, this._focalOffsetEnd.z, this.restThreshold); return this._createOnRestPromise(i); } setOrbitPoint(e, t, n) { this._camera.updateMatrixWorld(), Gu.setFromMatrixColumn(this._camera.matrixWorldInverse, 0), Ku.setFromMatrixColumn(this._camera.matrixWorldInverse, 1), qu.setFromMatrixColumn(this._camera.matrixWorldInverse, 2); let r = Q.set(e, t, n), i = r.distanceTo(this._camera.position), a = r.sub(this._camera.position); Gu.multiplyScalar(a.x), Ku.multiplyScalar(a.y), qu.multiplyScalar(a.z), Q.copy(Gu).add(Ku).add(qu), Q.z += i, this.dollyTo(i, !1), this.setFocalOffset(-Q.x, Q.y, -Q.z, !1), this.moveTo(e, t, n, !1); } setBoundary(e) { if (!e) { this._boundary.min.set(-Infinity, -Infinity, -Infinity), this._boundary.max.set(Infinity, Infinity, Infinity), this._needsUpdate = !0; return; } this._boundary.copy(e), this._boundary.clampPoint(this._targetEnd, this._targetEnd), this._needsUpdate = !0; } setViewport(e, t, n, r) { if (e === null) { this._viewport = null; return; } this._viewport = this._viewport || new Z.Vector4(), typeof e == "number" ? this._viewport.set(e, t, n, r) : this._viewport.copy(e); } getDistanceToFitBox(e, t, n, r = !1) { if (Pu(this._camera, "getDistanceToFitBox")) return this._spherical.radius; let i = e / t, a = this._camera.getEffectiveFOV() * wu, o = this._camera.aspect; return ((r ? i > o : i < o) ? t : e / o) * .5 / Math.tan(a * .5) + n * .5; } getDistanceToFitSphere(e) { if (Pu(this._camera, "getDistanceToFitSphere")) return this._spherical.radius; let t = this._camera.getEffectiveFOV() * wu, n = Math.atan(Math.tan(t * .5) * this._camera.aspect) * 2, r = 1 < this._camera.aspect ? t : n; return e / Math.sin(r * .5); } getTarget(e, t = !0) { return (e && e.isVector3 ? e : new Z.Vector3()).copy(t ? this._targetEnd : this._target); } getPosition(e, t = !0) { return (e && e.isVector3 ? e : new Z.Vector3()).setFromSpherical(t ? this._sphericalEnd : this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(t ? this._targetEnd : this._target); } getSpherical(e, t = !0) { return (e || new Z.Spherical()).copy(t ? this._sphericalEnd : this._spherical); } getFocalOffset(e, t = !0) { return (e && e.isVector3 ? e : new Z.Vector3()).copy(t ? this._focalOffsetEnd : this._focalOffset); } normalizeRotations() { return this._sphericalEnd.theta = (this._sphericalEnd.theta % xu + xu) % xu, this._sphericalEnd.theta > Math.PI && (this._sphericalEnd.theta -= xu), this._spherical.theta += xu * Math.round((this._sphericalEnd.theta - this._spherical.theta) / xu), this; } stop() { this._focalOffset.copy(this._focalOffsetEnd), this._target.copy(this._targetEnd), this._spherical.copy(this._sphericalEnd), this._zoom = this._zoomEnd; } reset(e = !1) { if (!Du(this._camera.up.x, this._cameraUp0.x) || !Du(this._camera.up.y, this._cameraUp0.y) || !Du(this._camera.up.z, this._cameraUp0.z)) { this._camera.up.copy(this._cameraUp0); let e = this.getPosition(Q); this.updateCameraUp(), this.setPosition(e.x, e.y, e.z); } let t = [ this.setLookAt(this._position0.x, this._position0.y, this._position0.z, this._target0.x, this._target0.y, this._target0.z, e), this.setFocalOffset(this._focalOffset0.x, this._focalOffset0.y, this._focalOffset0.z, e), this.zoomTo(this._zoom0, e) ]; return Promise.all(t); } saveState() { this._cameraUp0.copy(this._camera.up), this.getTarget(this._target0), this.getPosition(this._position0), this._zoom0 = this._zoom, this._focalOffset0.copy(this._focalOffset); } updateCameraUp() { this._yAxisUpSpace.setFromUnitVectors(this._camera.up, Bu), this._yAxisUpSpaceInverse.copy(this._yAxisUpSpace).invert(); } applyCameraUp() { let e = Q.subVectors(this._target, this._camera.position).normalize(), t = $.crossVectors(e, this._camera.up); this._camera.up.crossVectors(t, e).normalize(), this._camera.updateMatrixWorld(); let n = this.getPosition(Q); this.updateCameraUp(), this.setPosition(n.x, n.y, n.z); } update(e) { let t = this._sphericalEnd.theta - this._spherical.theta, n = this._sphericalEnd.phi - this._spherical.phi, r = this._sphericalEnd.radius - this._spherical.radius, i = Ju.subVectors(this._targetEnd, this._target), a = Yu.subVectors(this._focalOffsetEnd, this._focalOffset), o = this._zoomEnd - this._zoom; if (Eu(t)) this._thetaVelocity.value = 0, this._spherical.theta = this._sphericalEnd.theta; else { let t = this._isUserControllingRotate ? this.draggingSmoothTime : this.smoothTime; this._spherical.theta = ju(this._spherical.theta, this._sphericalEnd.theta, this._thetaVelocity, t, Infinity, e), this._needsUpdate = !0; } if (Eu(n)) this._phiVelocity.value = 0, this._spherical.phi = this._sphericalEnd.phi; else { let t = this._isUserControllingRotate ? this.draggingSmoothTime : this.smoothTime; this._spherical.phi = ju(this._spherical.phi, this._sphericalEnd.phi, this._phiVelocity, t, Infinity, e), this._needsUpdate = !0; } if (Eu(r)) this._radiusVelocity.value = 0, this._spherical.radius = this._sphericalEnd.radius; else { let t = this._isUserControllingDolly ? this.draggingSmoothTime : this.smoothTime; this._spherical.radius = ju(this._spherical.radius, this._sphericalEnd.radius, this._radiusVelocity, t, this.maxSpeed, e), this._needsUpdate = !0; } if (Eu(i.x) && Eu(i.y) && Eu(i.z)) this._targetVelocity.set(0, 0, 0), this._target.copy(this._targetEnd); else { let t = this._isUserControllingTruck ? this.draggingSmoothTime : this.smoothTime; Mu(this._target, this._targetEnd, this._targetVelocity, t, this.maxSpeed, e, this._target), this._needsUpdate = !0; } if (Eu(a.x) && Eu(a.y) && Eu(a.z)) this._focalOffsetVelocity.set(0, 0, 0), this._focalOffset.copy(this._focalOffsetEnd); else { let t = this._isUserControllingOffset ? this.draggingSmoothTime : this.smoothTime; Mu(this._focalOffset, this._focalOffsetEnd, this._focalOffsetVelocity, t, this.maxSpeed, e, this._focalOffset), this._needsUpdate = !0; } if (Eu(o)) this._zoomVelocity.value = 0, this._zoom = this._zoomEnd; else { let t = this._isUserControllingZoom ? this.draggingSmoothTime : this.smoothTime; this._zoom = ju(this._zoom, this._zoomEnd, this._zoomVelocity, t, Infinity, e); } if (this.dollyToCursor) { if (yu(this._camera) && this._changedDolly !== 0) { let e = this._spherical.radius - this._lastDistance, t = this._camera, n = this._getCameraDirection(Wu), r = Q.copy(n).cross(t.up).normalize(); r.lengthSq() === 0 && (r.x = 1); let i = $.crossVectors(r, n), a = this._sphericalEnd.radius * Math.tan(t.getEffectiveFOV() * wu * .5), o = (this._sphericalEnd.radius - e - this._sphericalEnd.radius) / this._sphericalEnd.radius, s = Uu.copy(this._targetEnd).add(r.multiplyScalar(this._dollyControlCoord.x * a * t.aspect)).add(i.multiplyScalar(this._dollyControlCoord.y * a)), c = Q.copy(this._targetEnd).lerp(s, o), l = this._lastDollyDirection === vu.IN && this._spherical.radius <= this.minDistance, u = this._lastDollyDirection === vu.OUT && this.maxDistance <= this._spherical.radius; if (this.infinityDolly && (l || u)) { this._sphericalEnd.radius -= e, this._spherical.radius -= e; let t = $.copy(n).multiplyScalar(-e); c.add(t); } this._boundary.clampPoint(c, c); let d = $.subVectors(c, this._targetEnd); this._targetEnd.copy(c), this._target.add(d), this._changedDolly -= e, Eu(this._changedDolly) && (this._changedDolly = 0); } else if (bu(this._camera) && this._changedZoom !== 0) { let e = this._zoom - this._lastZoom, t = this._camera, n = Q.set(this._dollyControlCoord.x, this._dollyControlCoord.y, (t.near + t.far) / (t.near - t.far)).unproject(t), r = $.set(0, 0, -1).applyQuaternion(t.quaternion), i = Uu.copy(n).add(r.multiplyScalar(-n.dot(t.up))), a = -(this._zoom - e - this._zoom) / this._zoom, o = this._getCameraDirection(Wu), s = this._targetEnd.dot(o), c = Q.copy(this._targetEnd).lerp(i, a), l = c.dot(o), u = o.multiplyScalar(l - s); c.sub(u), this._boundary.clampPoint(c, c); let d = $.subVectors(c, this._targetEnd); this._targetEnd.copy(c), this._target.add(d), this._changedZoom -= e, Eu(this._changedZoom) && (this._changedZoom = 0); } } this._camera.zoom !== this._zoom && (this._camera.zoom = this._zoom, this._camera.updateProjectionMatrix(), this._updateNearPlaneCorners(), this._needsUpdate = !0), this._dragNeedsUpdate = !0; let s = this._collisionTest(); this._spherical.radius = Math.min(this._spherical.radius, s), this._spherical.makeSafe(), this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target), this._camera.lookAt(this._target), (!Eu(this._focalOffset.x) || !Eu(this._focalOffset.y) || !Eu(this._focalOffset.z)) && (this._camera.matrix.compose(this._camera.position, this._camera.quaternion, this._camera.scale), Gu.setFromMatrixColumn(this._camera.matrix, 0), Ku.setFromMatrixColumn(this._camera.matrix, 1), qu.setFromMatrixColumn(this._camera.matrix, 2), Gu.multiplyScalar(this._focalOffset.x), Ku.multiplyScalar(-this._focalOffset.y), qu.multiplyScalar(this._focalOffset.z), Q.copy(Gu).add(Ku).add(qu), this._camera.position.add(Q), this._camera.updateMatrixWorld()), this._boundaryEnclosesCamera && this._encloseToBoundary(this._camera.position.copy(this._target), Q.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse), 1); let c = this._needsUpdate; return c && !this._updatedLastTime ? (this._hasRested = !1, this.dispatchEvent({ type: "wake" }), this.dispatchEvent({ type: "update" })) : c ? (this.dispatchEvent({ type: "update" }), Eu(t, this.restThreshold) && Eu(n, this.restThreshold) && Eu(r, this.restThreshold) && Eu(i.x, this.restThreshold) && Eu(i.y, this.restThreshold) && Eu(i.z, this.restThreshold) && Eu(a.x, this.restThreshold) && Eu(a.y, this.restThreshold) && Eu(a.z, this.restThreshold) && Eu(o, this.restThreshold) && !this._hasRested && (this._hasRested = !0, this.dispatchEvent({ type: "rest" }))) : !c && this._updatedLastTime && this.dispatchEvent({ type: "sleep" }), this._lastDistance = this._spherical.radius, this._lastZoom = this._zoom, this._updatedLastTime = c, this._needsUpdate = !1, c; } toJSON() { return JSON.stringify({ enabled: this._enabled, minDistance: this.minDistance, maxDistance: ku(this.maxDistance), minZoom: this.minZoom, maxZoom: ku(this.maxZoom), minPolarAngle: this.minPolarAngle, maxPolarAngle: ku(this.maxPolarAngle), minAzimuthAngle: ku(this.minAzimuthAngle), maxAzimuthAngle: ku(this.maxAzimuthAngle), smoothTime: this.smoothTime, draggingSmoothTime: this.draggingSmoothTime, dollySpeed: this.dollySpeed, truckSpeed: this.truckSpeed, dollyToCursor: this.dollyToCursor, target: this._targetEnd.toArray(), position: Q.setFromSpherical(this._sphericalEnd).add(this._targetEnd).toArray(), zoom: this._zoomEnd, focalOffset: this._focalOffsetEnd.toArray(), target0: this._target0.toArray(), position0: this._position0.toArray(), zoom0: this._zoom0, focalOffset0: this._focalOffset0.toArray() }); } fromJSON(e, t = !1) { let n = JSON.parse(e); this.enabled = n.enabled, this.minDistance = n.minDistance, this.maxDistance = Au(n.maxDistance), this.minZoom = n.minZoom, this.maxZoom = Au(n.maxZoom), this.minPolarAngle = n.minPolarAngle, this.maxPolarAngle = Au(n.maxPolarAngle), this.minAzimuthAngle = Au(n.minAzimuthAngle), this.maxAzimuthAngle = Au(n.maxAzimuthAngle), this.smoothTime = n.smoothTime, this.draggingSmoothTime = n.draggingSmoothTime, this.dollySpeed = n.dollySpeed, this.truckSpeed = n.truckSpeed, this.dollyToCursor = n.dollyToCursor, this._target0.fromArray(n.target0), this._position0.fromArray(n.position0), this._zoom0 = n.zoom0, this._focalOffset0.fromArray(n.focalOffset0), this.moveTo(n.target[0], n.target[1], n.target[2], t), Xu.setFromVector3(Q.fromArray(n.position).sub(this._targetEnd).applyQuaternion(this._yAxisUpSpace)), this.rotateTo(Xu.theta, Xu.phi, t), this.dollyTo(Xu.radius, t), this.zoomTo(n.zoom, t), this.setFocalOffset(n.focalOffset[0], n.focalOffset[1], n.focalOffset[2], t), this._needsUpdate = !0; } connect(e) { if (this._domElement) { console.warn("camera-controls is already connected."); return; } e.setAttribute("data-camera-controls-version", Iu), this._addAllEventListeners(e), this._getClientRect(this._elementRect); } disconnect() { this.cancel(), this._removeAllEventListeners(), this._domElement &&= (this._domElement.removeAttribute("data-camera-controls-version"), void 0); } dispose() { this.removeAllEventListeners(), this.disconnect(); } _getTargetDirection(e) { return e.setFromSpherical(this._spherical).divideScalar(this._spherical.radius).applyQuaternion(this._yAxisUpSpaceInverse); } _getCameraDirection(e) { return this._getTargetDirection(e).negate(); } _findPointerById(e) { return this._activePointers.find((t) => t.pointerId === e); } _findPointerByMouseButton(e) { return this._activePointers.find((t) => t.mouseButton === e); } _disposePointer(e) { this._activePointers.splice(this._activePointers.indexOf(e), 1); } _encloseToBoundary(e, t, n) { let r = t.lengthSq(); if (r === 0) return e; let i = $.copy(t).add(e), a = this._boundary.clampPoint(i, Uu).sub(i), o = a.lengthSq(); if (o === 0) return e.add(t); if (o === r) return e; if (n === 0) return e.add(t).add(a); { let r = 1 + n * o / t.dot(a); return e.add($.copy(t).multiplyScalar(r)).add(a.multiplyScalar(1 - n)); } } _updateNearPlaneCorners() { if (yu(this._camera)) { let e = this._camera, t = e.near, n = e.getEffectiveFOV() * wu, r = Math.tan(n * .5) * t, i = r * e.aspect; this._nearPlaneCorners[0].set(-i, -r, 0), this._nearPlaneCorners[1].set(i, -r, 0), this._nearPlaneCorners[2].set(i, r, 0), this._nearPlaneCorners[3].set(-i, r, 0); } else if (bu(this._camera)) { let e = this._camera, t = 1 / e.zoom, n = e.left * t, r = e.right * t, i = e.top * t, a = e.bottom * t; this._nearPlaneCorners[0].set(n, i, 0), this._nearPlaneCorners[1].set(r, i, 0), this._nearPlaneCorners[2].set(r, a, 0), this._nearPlaneCorners[3].set(n, a, 0); } } _truckInternal = (e, t, n, r) => { let i, a; if (yu(this._camera)) { let n = Q.copy(this._camera.position).sub(this._target), r = this._camera.getEffectiveFOV() * wu, o = n.length() * Math.tan(r * .5); i = this.truckSpeed * e * o / this._elementRect.height, a = this.truckSpeed * t * o / this._elementRect.height; } else if (bu(this._camera)) { let n = this._camera; i = this.truckSpeed * e * (n.right - n.left) / n.zoom / this._elementRect.width, a = this.truckSpeed * t * (n.top - n.bottom) / n.zoom / this._elementRect.height; } else return; r ? (n ? this.setFocalOffset(this._focalOffsetEnd.x + i, this._focalOffsetEnd.y, this._focalOffsetEnd.z, !0) : this.truck(i, 0, !0), this.forward(-a, !0)) : n ? this.setFocalOffset(this._focalOffsetEnd.x + i, this._focalOffsetEnd.y + a, this._focalOffsetEnd.z, !0) : this.truck(i, a, !0); }; _rotateInternal = (e, t) => { let n = xu * this.azimuthRotateSpeed * e / this._elementRect.height, r = xu * this.polarRotateSpeed * t / this._elementRect.height; this.rotate(n, r, !0); }; _dollyInternal = (e, t, n) => { let r = .95 ** (-e * this.dollySpeed), i = this._sphericalEnd.radius, a = this._sphericalEnd.radius * r, o = Tu(a, this.minDistance, this.maxDistance), s = o - a; this.infinityDolly && this.dollyToCursor ? this._dollyToNoClamp(a, !0) : (this.infinityDolly && !this.dollyToCursor && this.dollyInFixed(s, !0), this._dollyToNoClamp(o, !0)), this.dollyToCursor && (this._changedDolly += (this.infinityDolly ? a : o) - i, this._dollyControlCoord.set(t, n)), this._lastDollyDirection = Math.sign(-e); }; _zoomInternal = (e, t, n) => { let r = .95 ** (e * this.dollySpeed), i = this._zoom, a = this._zoom * r; this.zoomTo(a, !0), this.dollyToCursor && (this._changedZoom += a - i, this._dollyControlCoord.set(t, n)); }; _collisionTest() { let e = Infinity; if (!(this.colliderMeshes.length >= 1) || Pu(this._camera, "_collisionTest")) return e; let t = this._getTargetDirection(Wu); rd.lookAt(zu, t, this._camera.up); for (let n = 0; n < 4; n++) { let r = $.copy(this._nearPlaneCorners[n]); r.applyMatrix4(rd); let i = Uu.addVectors(this._target, r); id.set(i, t), id.far = this._spherical.radius + 1; let a = id.intersectObjects(this.colliderMeshes); a.length !== 0 && a[0].distance < e && (e = a[0].distance); } return e; } _getClientRect(e) { if (!this._domElement) return; let t = this._domElement.getBoundingClientRect(); return e.x = t.left, e.y = t.top, this._viewport ? (e.x += this._viewport.x, e.y += t.height - this._viewport.w - this._viewport.y, e.width = this._viewport.z, e.height = this._viewport.w) : (e.width = t.width, e.height = t.height), e; } _createOnRestPromise(e) { return e ? Promise.resolve() : (this._hasRested = !1, this.dispatchEvent({ type: "transitionstart" }), new Promise((e) => { let t = () => { this.removeEventListener("rest", t), e(); }; this.addEventListener("rest", t); })); } _addAllEventListeners(e) {} _removeAllEventListeners() {} get dampingFactor() { return console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead."), 0; } set dampingFactor(e) { console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead."); } get draggingDampingFactor() { return console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead."), 0; } set draggingDampingFactor(e) { console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead."); } static createBoundingSphere(e, t = new Z.Sphere()) { let n = t, r = n.center; Qu.makeEmpty(), e.traverseVisible((e) => { e.isMesh && Qu.expandByObject(e); }), Qu.getCenter(r); let i = 0; return e.traverseVisible((e) => { if (!e.isMesh) return; let t = e; if (!t.geometry) return; let n = t.geometry.clone(); n.applyMatrix4(t.matrixWorld); let a = n.attributes.position; for (let e = 0, t = a.count; e < t; e++) Q.fromBufferAttribute(a, e), i = Math.max(i, r.distanceToSquared(Q)); }), n.radius = Math.sqrt(i), n; } }, od = class { viewer; scene; events = /* @__PURE__ */ new Map(); config; minTime = Infinity; maxTime = -Infinity; crackModels = []; isLoadingModels = !1; constructor(e, t) { this.viewer = e, this.scene = e.scene, this.config = { minRadius: t?.minRadius ?? .1, maxRadius: t?.maxRadius ?? .3, minEnergy: t?.minEnergy ?? 0, maxEnergy: t?.maxEnergy ?? 100, mappingType: t?.mappingType ?? "linear", crackModelUrls: t?.crackModelUrls ?? [ "/model/fracture/b_r.glb", "/model/fracture/b_t.glb", "/model/fracture/b_y.glb", "/model/fracture/r_r.glb", "/model/fracture/s_r.glb" ], crackBaseScale: t?.crackBaseScale ?? .9 }, this.loadCrackModels(); } async loadCrackModels() { if (!this.isLoadingModels) { this.isLoadingModels = !0; try { let e = this.config.crackModelUrls.map((e) => this.viewer.resources.loadGLTF(e).then((e) => (e.visible = !1, e))); this.crackModels = await Promise.all(e); } catch {} finally { this.isLoadingModels = !1; } } } createCrackModel(e, t) { if (this.crackModels.length === 0) return; let n = Math.floor(Math.random() * this.crackModels.length), r = this.crackModels[n].clone(); r.visible = !0; let i = this.config.crackBaseScale * t; return r.scale.setScalar(i), r.position.set(e.position.x, e.position.y, e.position.z), r.rotation.set(Math.random() * Math.PI * 2, Math.random() * Math.PI * 2, Math.random() * Math.PI * 2), r; } addEvent(e) { if (this.events.has(e.time)) return console.warn(`Rupture event with time "${e.time}" already exists.`), this.events.get(e.time).mesh; this.updateTimeRange(e.time); let t = this.createEventSphere(e), n = this.mapEnergyToRadius(e.energy), r = this.createCrackModel(e, n); return this.scene.add(t), r && this.scene.add(r), this.events.set(e.time, { event: e, mesh: t, crackModel: r }), this.updateAllColors(), t; } addEvents(e) { let t = []; for (let t of e) this.updateTimeRange(t.time); for (let n of e) { if (this.events.has(n.time)) { console.warn(`Rupture event with time "${n.time}" already exists, skipping.`); continue; } let e = this.createEventSphere(n), r = this.mapEnergyToRadius(n.energy), i = this.createCrackModel(n, r); this.scene.add(e), zr.setSceneTreeExclude(e), i && (zr.setExcludeAll(i), this.scene.add(i)), this.events.set(n.time, { event: n, mesh: e, crackModel: i }), t.push(e); } return this.updateAllColors(), t; } removeEvent(t) { let n = this.events.get(t); return n ? (this.scene.remove(n.mesh), n.mesh.geometry.dispose(), n.mesh.material.dispose(), n.crackModel && (this.scene.remove(n.crackModel), n.crackModel.traverse((t) => { t instanceof e.Mesh && (t.geometry?.dispose(), Array.isArray(t.material) ? t.material.forEach((e) => e.dispose()) : t.material?.dispose()); })), this.events.delete(t), this.recalculateTimeRange(), this.updateAllColors(), !0) : (console.warn(`Rupture event with time "${t}" not found.`), !1); } clearEvents() { for (let [t, n] of this.events) this.scene.remove(n.mesh), n.mesh.geometry.dispose(), n.mesh.material.dispose(), n.crackModel && (this.scene.remove(n.crackModel), n.crackModel.traverse((t) => { t instanceof e.Mesh && (t.geometry?.dispose(), Array.isArray(t.material) ? t.material.forEach((e) => e.dispose()) : t.material?.dispose()); })); this.events.clear(), this.minTime = Infinity, this.maxTime = -Infinity; } applyFilter(e, t) { let n = e ? Date.now() - e * 60 * 1e3 : null; for (let [e, r] of this.events) { let e = !0; n !== null && r.event.time < n && (e = !1), t !== null && r.event.energy < t && (e = !1), r.mesh.visible = e, r.crackModel && (r.crackModel.visible = e); } } cancelFilter() { for (let [e, t] of this.events) t.mesh.visible = !0, t.crackModel && (t.crackModel.visible = !0); } getEvent(e) { return this.events.get(e); } getAllEvents() { return this.events; } getVisibleEventCount() { let e = 0; for (let [t, n] of this.events) n.mesh.visible && e++; return e; } getTotalEventCount() { return this.events.size; } updateConfig(e) { this.config = { ...this.config, ...e }; let t = Array.from(this.events.values()).map((e) => e.event); this.clearEvents(), this.addEvents(t); } createEventSphere(t) { let n = this.mapEnergyToRadius(t.energy), r = new e.SphereGeometry(n, 32, 32), i = new e.MeshStandardNodeMaterial({ roughness: .2, metalness: .1 }), a = new e.Mesh(r, i); return a.position.set(t.position.x, t.position.y, t.position.z), a.name = `RuptureEvent_${t.time}`, a.userData = { ruptureEvent: { position: t.position, time: t.time, energy: t.energy } }, a; } mapEnergyToRadius(e) { let { minEnergy: t, maxEnergy: n, minRadius: r, maxRadius: i, mappingType: a } = this.config, o = Math.max(0, Math.min(1, (e - t) / (n - t))); return a === "logarithmic" ? r + Math.log10(1 + o * 9) * (i - r) : r + o * (i - r); } mapTimeToColor(t) { if (this.minTime === this.maxTime) return new e.Color(15381256); let n = (t - this.minTime) / (this.maxTime - this.minTime), r = new e.Color(3900150), i = new e.Color(15381256), a = new e.Color(15680580); if (n < .5) { let t = n * 2; return new e.Color().lerpColors(r, i, t); } else { let t = (n - .5) * 2; return new e.Color().lerpColors(i, a, t); } } updateTimeRange(e) { this.minTime = Math.min(this.minTime, e), this.maxTime = Math.max(this.maxTime, e); } recalculateTimeRange() { this.minTime = Infinity, this.maxTime = -Infinity; for (let [e, t] of this.events) this.updateTimeRange(t.event.time); } updateAllColors() { for (let [e, t] of this.events) { let e = this.mapTimeToColor(t.event.time); t.mesh.material.color = e; } } }, sd = class extends e.ClippingGroup { viewer; name = "localClippingGroup"; constructor(e) { super(), this.viewer = e; } init(e) { this.generateClippingPlanesFromMesh(e), this.viewer.scene.add(this); } generateClippingPlanesFromMesh(t) { let n = new e.Box3().setFromObject(t), r = new e.Vector3(), i = new e.Vector3(); n.getCenter(r), n.getSize(i); let a = i.x / 2, o = i.y / 2, s = i.z / 2; this.clippingPlanes = []; let c = new e.Plane(new e.Vector3(-1, 0, 0), 0); c.translate(new e.Vector3(r.x + a, r.y, r.z)), this.clippingPlanes.push(c); let l = new e.Plane(new e.Vector3(1, 0, 0), 0); l.translate(new e.Vector3(r.x - a, r.y, r.z)), this.clippingPlanes.push(l); let u = new e.Plane(new e.Vector3(0, -1, 0), 0); u.translate(new e.Vector3(r.x, r.y + o, r.z)), this.clippingPlanes.push(u); let d = new e.Plane(new e.Vector3(0, 1, 0), 0); d.translate(new e.Vector3(r.x, r.y - o, r.z)), this.clippingPlanes.push(d); let f = new e.Plane(new e.Vector3(0, 0, -1), 0); f.translate(new e.Vector3(r.x, r.y, r.z + s)), this.clippingPlanes.push(f); let p = new e.Plane(new e.Vector3(0, 0, 1), 0); p.translate(new e.Vector3(r.x, r.y, r.z - s)), this.clippingPlanes.push(p); } }, cd = class { options; group; active; mesh; arrowAnims; flatArrowShaftGeom; flatArrowHeadGeom; flatArrowMat; tmpV; tmpV2; tmpV3; tmpM; updateBound; _elapsedTime = 0; constructor(t, n) { this.mesh = t, this.options = { normal: n?.normal || new e.Vector3(1, .24, -.16), rows: n?.rows ?? 4, cols: n?.cols ?? 5, spacingU: n?.spacingU ?? .52, spacingV: n?.spacingV ?? .58, arrowLength: n?.arrowLength ?? .78, shaftWidth: n?.shaftWidth ?? .06, headWidth: n?.headWidth ?? .18, headLength: n?.headLength ?? .2, colorHex: n?.colorHex ?? 16765820, arrowSideOffset: n?.arrowSideOffset ?? .03, arrowMoveAmp: n?.arrowMoveAmp ?? .14, arrowMoveSpeed: n?.arrowMoveSpeed ?? 2.1, autoStart: n?.autoStart ?? !1 }, this.group = new e.Group(), this.group.name = "fault-slip-effect", zr.setExcludeAll(this.group), this.group.visible = !1, this.active = !1, this.arrowAnims = [], this.updateBound = null, this.tmpV = new e.Vector3(), this.tmpV2 = new e.Vector3(), this.tmpV3 = new e.Vector3(), this.tmpM = new e.Matrix4(), this.flatArrowShaftGeom = new e.PlaneGeometry(1, 1); let r = new e.Shape().moveTo(0, 1).lineTo(.5, 0).lineTo(-.5, 0).lineTo(0, 1); this.flatArrowHeadGeom = new e.ShapeGeometry(r), this.flatArrowMat = new e.MeshBasicMaterial({ color: this.options.colorHex, transparent: !0, opacity: .95, side: e.DoubleSide, depthTest: !0, depthWrite: !1 }), this.init(); } start() { this.active || (this.active = !0, this.group.visible = !0, this._elapsedTime = 0, this.#e()); } stop() { this.active && (this.active = !1, this.group.visible = !1, this.#t()); } toggle() { this.active ? this.stop() : this.start(); } update(e) { if (!this.active || !this.group.visible) return; this._elapsedTime += e.data.delta; let t = this.options.arrowMoveSpeed, n = this.options.arrowMoveAmp; for (let e = 0; e < this.arrowAnims.length; e++) { let r = this.arrowAnims[e]; if (!r) continue; let i = Math.sin(this._elapsedTime * t + r.phase) * n; r.mesh.position.copy(r.basePos).addScaledVector(r.moveDir, i); } } setColor(e) { this.options.colorHex = e, this.flatArrowMat.color.setHex(e); } setOpacity(e) { this.flatArrowMat.opacity = Math.max(0, Math.min(1, e)); } setSpeed(e) { this.options.arrowMoveSpeed = e; } setAmplitude(e) { this.options.arrowMoveAmp = e; } dispose() { this.stop(), this.flatArrowShaftGeom.dispose(), this.flatArrowHeadGeom.dispose(), this.flatArrowMat.dispose(), this.group.traverse((t) => { t instanceof e.Mesh && (t.geometry && t.geometry.dispose(), t.material instanceof e.Material && t.material.dispose()); }), this.group.parent && this.group.parent.remove(this.group), this.arrowAnims = []; } init() { this.mesh.add(this.group), this.buildVisualization(), this.options.autoStart && this.start(); } makeArrowMesh(t) { let n = Math.max(.01, t.length - t.headLength), r = new e.Group(), i = new e.Mesh(this.flatArrowShaftGeom, this.flatArrowMat); i.scale.set(t.shaftWidth, n, 1), i.position.y = n * .5, r.add(i); let a = new e.Mesh(this.flatArrowHeadGeom, this.flatArrowMat); return a.scale.set(t.headWidth, t.headLength, 1), a.position.y = n, r.add(a), r; } orientArrowOnSection(e, t, n) { let r = this.tmpV.copy(t).normalize(), i = this.tmpV2.copy(n).normalize(), a = this.tmpV3.crossVectors(r, i); a.lengthSq() < 1e-8 || (a.normalize(), this.tmpM.makeBasis(a, r, i), e.quaternion.setFromRotationMatrix(this.tmpM)); } buildVisualization() { this.arrowAnims = [], this.group.clear(); let t = this.mesh.geometry, n = t.attributes.position; if (!n) return; let r = t.index, i = r ? r.count / 3 : n.count / 3; if (i <= 0) return; let a = 1e4, o = (e) => Math.round(e * a) / a, s = (e) => `${o(e.x)},${o(e.y)},${o(e.z)}`, c = (e) => `${o(Math.abs(e.x))},${o(Math.abs(e.y))},${o(Math.abs(e.z))}`, l = /* @__PURE__ */ new Map(), u = new e.Vector3(), d = new e.Vector3(), f = new e.Vector3(), p = new e.Vector3(), m = new e.Vector3(), h = new e.Vector3(), g = new e.Vector3(); for (let t = 0; t < i; t++) { let i = r ? r.getX(t * 3) : t * 3, a = r ? r.getX(t * 3 + 1) : t * 3 + 1, c = r ? r.getX(t * 3 + 2) : t * 3 + 2; u.fromBufferAttribute(n, i), d.fromBufferAttribute(n, a), f.fromBufferAttribute(n, c), p.subVectors(d, u), m.subVectors(f, u), h.crossVectors(p, m); let _ = h.length() * .5; if (_ < 1e-8) continue; h.normalize(); let v = h.dot(u), y = `${s(h)}|${o(v)}`, b = l.get(y); b || (b = { normal: h.clone(), area: 0, centerAccum: new e.Vector3(), center: new e.Vector3() }, l.set(y, b)), g.copy(u).add(d).add(f).multiplyScalar(1 / 3), b.area += _, b.centerAccum.addScaledVector(g, _); } let _ = Array.from(l.values()); if (_.length < 2) return; for (let e = 0; e < _.length; e++) { let t = _[e]; !t || t.area < 1e-8 || t.center.copy(t.centerAccum).multiplyScalar(1 / t.area); } let v = /* @__PURE__ */ new Map(); for (let e = 0; e < _.length; e++) { let t = _[e]; if (!t) continue; let n = c(t.normal), r = v.get(n); r ? r.push(t) : v.set(n, [t]); } let y = null, b = null, x = -Infinity; for (let e of v.values()) if (!(e.length < 2)) for (let t = 0; t < e.length; t++) for (let n = t + 1; n < e.length; n++) { let r = e[t], i = e[n]; if (!r || !i || r.normal.dot(i.normal) > -.9) continue; let a = r.area + i.area; a > x && (x = a, y = r, b = i); } if (!y || !b) return; let S = y, C = b, w = Math.abs(S.normal.y) < .95 ? new e.Vector3(0, 1, 0) : new e.Vector3(1, 0, 0), T = new e.Vector3().crossVectors(w, S.normal).normalize(); if (T.lengthSq() < 1e-8) return; let E = new e.Vector3().crossVectors(S.normal, T).normalize(), D = E.clone(), O = D.clone().multiplyScalar(-1), k = this.options.rows, A = this.options.cols, j = -((A - 1) * this.options.spacingU) * .5, M = -((k - 1) * this.options.spacingV) * .5; for (let e = 0; e < 2; e++) { let t = e === 0 ? S : C, n = e === 0 ? D : O, r = t.normal, i = this.options.arrowSideOffset, a = t.center; for (let t = 0; t < k; t++) for (let o = 0; o < A; o++) { let s = j + o * this.options.spacingU + t % 2 * (this.options.spacingU * .5), c = M + t * this.options.spacingV, l = a.clone().addScaledVector(T, s).addScaledVector(E, c).addScaledVector(r, i), u = this.makeArrowMesh({ length: this.options.arrowLength, shaftWidth: this.options.shaftWidth, headWidth: this.options.headWidth, headLength: this.options.headLength }); this.orientArrowOnSection(u, n, r), u.position.copy(l), this.group.add(u), this.arrowAnims.push({ mesh: u, basePos: l.clone(), moveDir: n.clone(), sideSign: e === 0 ? 1 : -1, phase: (t * A + o) * .37 + e * Math.PI * .5 }); } } } #e() { let e = Sl.defaultViewer; e && (this.updateBound = this.update.bind(this), e.emitter.on(Yt.BEFORE_RENDER, this.updateBound)); } #t() { let e = Sl.defaultViewer; e && this.updateBound && e.emitter.off(Yt.BEFORE_RENDER, this.updateBound); } }, ld = class { viewer; startPipe; endPipe; particleCount; speedMultiplier; particleSize; heatingThreshold; flowPathCount; colorStops; flowPaths = []; particles = []; flowGeometry = null; flowMaterial = null; flowPoints = null; updateHandler = null; startPipeTopWorld = null; startPipeBottomWorld = null; endPipeTopWorld = null; endPipeBottomWorld = null; startPipeRadiusWorld = 0; endPipeRadiusWorld = 0; frozenProbability = 0; constructor(e, t) { this.viewer = e, this.startPipe = t.startPipe, this.endPipe = t.endPipe, this.particleCount = t.particleCount ?? 2400, this.speedMultiplier = t.speedMultiplier ?? 1, this.particleSize = t.particleSize ?? .01, this.heatingThreshold = t.heatingThreshold ?? .5, this.flowPathCount = t.flowPathCount ?? 100, this.colorStops = this.normalizeColorStops(t.colorStops ?? [ { color: "#0000FF", step: 0 }, { color: "#00FF00", step: .25 }, { color: "#FFFF00", step: .5 }, { color: "#FF0000", step: 1 } ]), this.init(); } setParticleCount(e) { this.particleCount = Math.max(1, Math.floor(e)), this.dispose(), this.init(); } setSpeedMultiplier(e) { this.speedMultiplier = e; } setFrozenProbability(e) { this.frozenProbability = Math.max(0, Math.min(1, e)); for (let e of this.particles) e.t < .05 && (e.frozen = Math.random() < this.frozenProbability); } setHeatingThreshold(e) { this.heatingThreshold = Math.max(0, Math.min(1, e)); } setColorStops(e) { this.colorStops = this.normalizeColorStops(e), this.refreshParticleColors(); } dispose() { this.updateHandler &&= (this.viewer.emitter.off(Yt.BEFORE_RENDER, this.updateHandler), null), this.flowPoints &&= (this.viewer.scene.remove(this.flowPoints), null), this.flowGeometry &&= (this.flowGeometry.dispose(), null), this.flowMaterial &&= (this.flowMaterial.dispose(), null), this.particles = [], this.flowPaths = [], this.startPipeTopWorld = null, this.startPipeBottomWorld = null, this.endPipeTopWorld = null, this.endPipeBottomWorld = null, this.startPipeRadiusWorld = 0, this.endPipeRadiusWorld = 0; } toVector3(t) { return t instanceof e.Vector3 ? t.clone() : new e.Vector3(t.x, t.y, t.z); } init() { this.createFlowPaths(), this.initParticles(), this.setupUpdateLoop(); } createFlowPaths() { let t = this.getPipeBoundary(this.startPipe), n = this.getPipeBoundary(this.endPipe); this.startPipeTopWorld = t.top.clone(), this.startPipeBottomWorld = t.bottom.clone(), this.endPipeTopWorld = n.top.clone(), this.endPipeBottomWorld = n.bottom.clone(), this.startPipeRadiusWorld = t.radius, this.endPipeRadiusWorld = n.radius; let r = new e.Vector3().subVectors(t.bottom, t.top).normalize(), i = new e.Vector3().subVectors(n.bottom, n.top).normalize(), a = this.getPerpendicularBasis(r), o = this.getPerpendicularBasis(i), s = Math.max(t.radius - this.particleSize, 0), c = Math.max(n.radius - this.particleSize, 0); for (let l = 0; l < this.flowPathCount; l++) { let l = new e.Vector3().subVectors(n.bottom, t.bottom), u = l.lengthSq() <= 2 ** -52 ? new e.Vector3(1, 0, 0) : l.normalize(), d = new e.Vector3().crossVectors(u, new e.Vector3(0, 0, 1)).normalize(); d.lengthSq() <= 2 ** -52 && (d = new e.Vector3().crossVectors(u, new e.Vector3(0, 1, 0)).normalize()); let f = t.bottom.clone().lerp(n.bottom, .5).addScaledVector(d, (Math.random() - .5) * .18).add(new e.Vector3((Math.random() - .5) * .08, -.3 + (Math.random() - .5) * .05, (Math.random() - .5) * .08)), p = this.createRandomDiskOffset(a.perp1, a.perp2, s), m = this.createRandomDiskOffset(o.perp1, o.perp2, c), h = t.bottom.clone().add(p), g = n.bottom.clone().add(m), _ = .12, v = h.clone().addScaledVector(r, _), y = g.clone().addScaledVector(i, _), b = t.top.clone().add(p), x = n.top.clone().add(m), S = new e.CatmullRomCurve3([ b, h, v, f, y, g, x ], !1, "centripetal", .2); this.flowPaths.push(S); } } initParticles() { if (this.flowPaths.length === 0) return; this.flowGeometry = new e.SphereGeometry(this.particleSize, 8, 8); let t = new e.MeshBasicMaterial({ vertexColors: !0 }); this.flowMaterial = t, this.flowPoints = new e.InstancedMesh(this.flowGeometry, t, this.particleCount), this.flowPoints.frustumCulled = !1, this.flowPoints.instanceMatrix.setUsage(e.DynamicDrawUsage), this.flowPoints.renderOrder = 1; let n = new e.Matrix4(), r = new e.Vector3(1, 1, 1), i = new e.Quaternion(), a = new e.Color(), o = new e.Vector3(); for (let e = 0; e < this.particleCount; e++) { let t = Math.floor(Math.random() * this.flowPaths.length), s = Math.random(), c = Math.random(), l = .001 + c * .004, u = .02 + Math.random() * .03, d = Math.random() * Math.PI * 2, f = this.calculateHeatColor(s), p = this.createInitialColorState(f), m = this.colorStops.some((e) => e.step <= s && (e.frozenProbability ?? 0) > 0 && Math.random() < (e.frozenProbability ?? 0)); this.particles.push({ t: s, speed: l, jitter: u, phase: d, layer: c, pathIndex: t, lastHeatValue: f, currentColor: p.color.clone(), frozen: m }); let h = this.flowPaths[t]; h && (o.copy(h.getPointAt(s)), this.constrainParticleInsidePipe(o, s), n.compose(o, i, r), this.flowPoints.setMatrixAt(e, n), a.copy(p.color), this.flowPoints.setColorAt(e, a)); } this.flowPoints.instanceMatrix.needsUpdate = !0, this.flowPoints.instanceColor && (this.flowPoints.instanceColor.needsUpdate = !0), this.viewer.scene.add(this.flowPoints); } setupUpdateLoop() { this.updateHandler = () => this.update(), this.viewer.emitter.on(Yt.BEFORE_RENDER, this.updateHandler); } update() { if (!this.flowPoints || this.flowPaths.length === 0) return; let t = new e.Vector3(0, 0, 1), n = new e.Vector3(), r = new e.Vector3(1, 1, 1), i = new e.Quaternion(), a = new e.Matrix4(), o = new e.Color(), s = new e.Vector3(); for (let e = 0; e < this.particles.length; e++) { let c = this.particles[e]; if (!c) continue; c.t += c.speed * this.speedMultiplier, c.t > 1 && (--c.t, c.pathIndex = Math.floor(Math.random() * this.flowPaths.length), c.frozen = !1, c.currentColor.copy(this.interpolateStopColor(0)), c.frozen = Math.random() < this.frozenProbability); let l = this.flowPaths[c.pathIndex]; if (!l) continue; let u = l.getPointAt(c.t), d = l.getTangentAt(c.t).normalize(); n.crossVectors(d, t).normalize(); let f = c.jitter * Math.sin(c.phase + c.t * Math.PI * 4); s.set(u.x + n.x * f, u.y + n.y * f, u.z + n.z * f * .5), this.constrainParticleInsidePipe(s, c.t); let p = c.t > .97 ? 1 - (c.t - .97) / .03 : 1, m = this.calculateHeatColor(c.t), h = this.resetParticleColorState(c, m); a.compose(s, i, r), this.flowPoints.setMatrixAt(e, a), o.copy(h).multiplyScalar(p), this.flowPoints.setColorAt(e, o); } this.flowPoints.instanceMatrix.needsUpdate = !0, this.flowPoints.instanceColor && (this.flowPoints.instanceColor.needsUpdate = !0); } calculateHeatColor(e) { return Math.max(0, Math.min(1, e)); } constrainParticleInsidePipe(e, t) { return t <= .3 ? this.clampPointInsidePipe(e, this.startPipeTopWorld, this.startPipeBottomWorld, this.startPipeRadiusWorld) : t >= .7 ? this.clampPointInsidePipe(e, this.endPipeTopWorld, this.endPipeBottomWorld, this.endPipeRadiusWorld) : e; } clampPointInsidePipe(t, n, r, i) { if (!n || !r || i <= 0) return t; let a = new e.Vector3().subVectors(r, n), o = a.lengthSq(); if (o <= 2 ** -52) return t; let s = new e.Vector3().subVectors(t, n), c = e.MathUtils.clamp(s.dot(a) / o, 0, 1), l = n.clone().addScaledVector(a, c), u = new e.Vector3().subVectors(t, l), d = u.lengthSq(), f = Math.max(i - this.particleSize, 0); if (d <= f * f) return t; if (d <= 2 ** -52) { let e = this.getPerpendicularUnitVector(a); return t.copy(l).addScaledVector(e, f), t; } return u.normalize(), t.copy(l).addScaledVector(u, f), t; } getPerpendicularUnitVector(t) { let n = Math.abs(t.x) < .9 ? new e.Vector3(1, 0, 0) : new e.Vector3(0, 1, 0); return new e.Vector3().crossVectors(t, n).normalize(); } createInitialColorState(e) { return { color: this.interpolateStopColor(e), appliedStopIndex: 0 }; } interpolateStopColor(t) { let n = Math.max(0, Math.min(1, t)), r = this.colorStops; if (r.length === 0) return new e.Color("#FF0000"); if (r.length === 1) return new e.Color(r[0].color); let i = r[0], a = r[1]; for (let e = 0; e < r.length - 1; e++) { if (n <= r[e + 1].step) { i = r[e], a = r[e + 1]; break; } i = r[e + 1], a = r[e + 1]; } let o = a.step - i.step, s = o <= 2 ** -52 ? 1 : (n - i.step) / o; return new e.Color(i.color).lerp(new e.Color(a.color), s); } resetParticleColorState(e, t) { if (e.frozen) return e.currentColor; let n = Math.max(0, Math.min(1, t)); return e.currentColor.copy(this.interpolateStopColor(n)), e.lastHeatValue = n, e.currentColor; } refreshParticleColors() { if (!this.flowPoints || this.particles.length === 0) return; let t = new e.Color(); for (let e = 0; e < this.particles.length; e++) { let n = this.particles[e]; if (!n) continue; let r = this.calculateHeatColor(n.t), i = this.resetParticleColorState(n, r); t.copy(i), this.flowPoints.setColorAt(e, t); } this.flowPoints.instanceColor && (this.flowPoints.instanceColor.needsUpdate = !0); } normalizeColorStops(e) { let t = [ { color: "#0000FF", step: 0 }, { color: "#00FF00", step: .25 }, { color: "#FFFF00", step: .5 }, { color: "#FF0000", step: 1 } ], n = (e.length > 0 ? e : t).map((e) => ({ color: e.color, step: Math.max(0, Math.min(1, e.step)), frozenProbability: Math.max(0, Math.min(1, e.frozenProbability ?? 0)) })).sort((e, t) => e.step - t.step), r = []; for (let e = 0; e < n.length; e++) { let t = n[e]; if (!t) continue; let i = r[r.length - 1]; if (i && Math.abs(i.step - t.step) <= 2 ** -52) { r[r.length - 1] = t; continue; } r.push(t); } let i = r[0]; return i ? (i.step > 0 && r.unshift({ color: i.color, step: 0 }), r) : t; } getPipePoints(e) { let t = e.options.points; return e.updateWorldMatrix(!0, !1), t.map((t) => this.toVector3(t).applyMatrix4(e.matrixWorld)); } getPipeRadius(t) { let n = t.options.radius, r = new e.Vector3(); return t.matrixWorld.decompose(new e.Vector3(), new e.Quaternion(), r), n * Math.max(r.x, r.y, r.z); } getPipeBoundary(e) { let t = this.getPipePoints(e); if (t.length < 2) throw Error("Pipe must have at least 2 points"); let n = t[0], r = t[t.length - 1]; if (!n || !r) throw Error("Invalid pipe points"); return { top: this.toVector3(n), bottom: this.toVector3(r), radius: this.getPipeRadius(e) }; } getPerpendicularBasis(t) { let n = Math.abs(t.x) < .9 ? new e.Vector3(1, 0, 0) : new e.Vector3(0, 1, 0), r = new e.Vector3().crossVectors(t, n).normalize(); return { perp1: r, perp2: new e.Vector3().crossVectors(t, r).normalize() }; } createRandomDiskOffset(t, n, r) { let i = Math.sqrt(Math.random()) * r, a = Math.random() * Math.PI * 2, o = new e.Vector3(); return o.addScaledVector(t, Math.cos(a) * i), o.addScaledVector(n, Math.sin(a) * i), o; } }, ud = class { options; active; running; spheres; group; crackModels; crackModelTemplates; progressCallback; curve; constructor(t) { this.options = { points: t.points, curveType: t.curveType ?? "catmullrom", tension: t.tension ?? .5, closed: t.closed ?? !1, spacing: Math.max(t.spacing ?? .08, .01), bufferRatio: t.bufferRatio ?? .05, minRadius: t.minRadius ?? .05, maxRadius: t.maxRadius ?? .2, animationDuration: t.animationDuration ?? 6e3, sphereAnimDuration: t.sphereAnimDuration ?? 500, sphereOpacity: t.sphereOpacity ?? .6, spheresVisible: t.spheresVisible ?? !0, cracksVisible: t.cracksVisible ?? !0, colorMode: t.colorMode ?? "random", fixedColor: t.fixedColor ?? 4491519, gradientStart: t.gradientStart ?? 4491519, gradientEnd: t.gradientEnd ?? 16729156, autoStart: t.autoStart ?? !1, crackModelUrls: t.crackModelUrls ?? [ "/model/fracture/b_h.glb", "/model/fracture/b_r.glb", "/model/fracture/b_t.glb", "/model/fracture/b_y.glb", "/model/fracture/r_r.glb", "/model/fracture/s_r.glb" ] }, this.curve = null, this.curve = null, this.active = !1, this.running = !1, this.spheres = [], this.crackModels = [], this.crackModelTemplates = [], this.group = new e.Group(), this.group.name = "fracture-effect", this.progressCallback = null, this.createCurve(); let n = Sl.defaultViewer; n && n.scene && n.scene.add(this.group), this.options.autoStart && this.start(); } createCurve() { if (this.options.points.length < 2) throw Error("FractureEffect: At least 2 points are required"); if (this.options.curveType === "catmullrom") this.curve = new e.CatmullRomCurve3(this.options.points, this.options.closed, "catmullrom", this.options.tension); else if (this.curve = new e.LineCurve3(this.options.points[0], this.options.points[this.options.points.length - 1]), this.options.points.length > 2) { let t = []; for (let n = 0; n < this.options.points.length - 1; n++) t.push(new e.LineCurve3(this.options.points[n], this.options.points[n + 1])); this.curve = new e.CurvePath(), t.forEach((e) => this.curve.add(e)); } } onProgress(e) { this.progressCallback = e; } async start() { if (this.running) { console.warn("FractureEffect: Animation already running"); return; } if (!this.curve) { console.error("FractureEffect: Curve not initialized"); return; } this.clear(), this.running = !0, this.active = !0, await this.loadCrackModels(); let t = this.calculatePositions(), n = this.options.animationDuration / t.length; for (let r = 0; r < t.length && this.running; r++) { await new Promise((e) => setTimeout(e, n)); let i = t[r]; if (!i) continue; let a = this.options.minRadius + Math.random() * (this.options.maxRadius - this.options.minRadius), o = this.getSphereColor(i.t), s = new e.SphereGeometry(a, 32, 32), c = new e.MeshPhysicalNodeMaterial({ color: o, metalness: .3, roughness: .4, transparent: !0, opacity: this.options.sphereOpacity }), l = new e.Mesh(s, c); l.position.copy(i.position), l.scale.setScalar(0), l.visible = this.options.spheresVisible, this.group.add(l), this.spheres.push({ mesh: l, targetRadius: a, position: i.position.clone(), index: i.index, t: i.t }); let u = this.curve.getTangent(i.t), d = Math.atan2(u.x, -u.z), f = Math.sqrt(u.x * u.x + u.z * u.z), p = Math.atan2(u.y, f); if (this.crackModelTemplates.length > 0) { let t = this.crackModelTemplates[Math.floor(Math.random() * this.crackModelTemplates.length)].clone(), n = new e.Box3().setFromObject(t).getSize(new e.Vector3()), r = Math.max(n.x, n.y, n.z); t.scale.setScalar(a * 2 / r), t.position.copy(i.position), t.rotation.set(p, d + Math.PI, 0), t.visible = this.options.cracksVisible, this.group.add(t), this.crackModels.push(t); } this.animateSphereIn(l); let m = (r + 1) / t.length; this.progressCallback && this.progressCallback(m); } this.running = !1, console.log(`FractureEffect: Completed, generated ${this.spheres.length} spheres`); } stop() { this.running = !1; } clear() { this.spheres.forEach((t) => { this.group.remove(t.mesh), t.mesh.geometry.dispose(), t.mesh.material instanceof e.Material && t.mesh.material.dispose(); }), this.spheres = [], this.crackModels.forEach((e) => { this.group.remove(e); }), this.crackModels = []; } showCracks() { this.options.cracksVisible = !0, this.crackModels.forEach((e) => e.visible = !0); } hideCracks() { this.options.cracksVisible = !1, this.crackModels.forEach((e) => e.visible = !1); } toggleCracks() { this.options.cracksVisible ? this.hideCracks() : this.showCracks(); } showSpheres() { this.options.spheresVisible = !0, this.spheres.forEach((e) => { e.mesh.visible = !0; }); } hideSpheres() { this.options.spheresVisible = !1, this.spheres.forEach((e) => { e.mesh.visible = !1; }); } toggleSpheres() { this.options.spheresVisible ? this.hideSpheres() : this.showSpheres(); } setOpacity(t) { this.options.sphereOpacity = Math.max(0, Math.min(1, t)), this.spheres.forEach((t) => { t.mesh.material instanceof e.Material && (t.mesh.material.opacity = this.options.sphereOpacity); }); } updatePoints(e) { this.options.points = e, this.createCurve(); } async restart() { this.stop(), this.clear(), await this.start(); } getSphereCount() { return this.spheres.length; } getSpheres() { return this.spheres; } dispose() { this.stop(), this.clear(); let e = Sl.defaultViewer; e && e.scene && this.group.parent && e.scene.remove(this.group), this.active = !1; } async loadCrackModels() { if (this.crackModelTemplates.length > 0) return; let e = new C(); (await Promise.allSettled(this.options.crackModelUrls.map((t) => new Promise((n, r) => { e.load(t, (e) => n(e.scene), void 0, r); })))).forEach((e) => { e.status === "fulfilled" && this.crackModelTemplates.push(e.value); }); } getRandomHighContrastColor() { let t = Math.random() * 360, n = 70 + Math.random() * 30, r = 30 + Math.random() * 40, i = new e.Color(); return i.setHSL(t / 360, n / 100, r / 100), i; } getGradientColor(t) { let n = new e.Color(this.options.gradientStart), r = new e.Color(this.options.gradientEnd); return n.clone().lerp(r, t); } getSphereColor(t) { switch (this.options.colorMode) { case "random": return this.getRandomHighContrastColor(); case "gradient": return this.getGradientColor(t); case "fixed": return new e.Color(this.options.fixedColor); default: return new e.Color(4491519); } } easeOutElastic(e) { let t = 2 * Math.PI / 3; return e === 0 ? 0 : e === 1 ? 1 : 2 ** (-10 * e) * Math.sin((e * 10 - .75) * t) + 1; } animateSphereIn(e) { return new Promise((t) => { let n = this.options.sphereAnimDuration, r = Date.now(), i = () => { let a = Date.now() - r, o = Math.min(a / n, 1), s = this.easeOutElastic(o); e.scale.setScalar(s), o < 1 ? requestAnimationFrame(i) : t(); }; i(); }); } calculatePositions() { if (!this.curve) return []; let e = this.curve.getLength(), t = e * this.options.bufferRatio, n = e - 2 * t, r = Math.floor(n / this.options.spacing) + 1, i = [], a = t / e, o = 1 - t / e; for (let e = 0; e < r; e++) { let t = a + (o - a) * (e / (r - 1)), n = this.curve.getPoint(t); i.push({ position: n, t, index: e }); } return i; } }, dd = class { options; emitters; waves; geometry; active; startTime; delayTimer; boundingBox; _elapsedTime = 0; _boundUpdateHandler = null; constructor(t, n) { let r = {}; t instanceof e.Vector3 ? r = { emitterPositions: [t], startDelay: n } : Array.isArray(t) ? r = { emitterPositions: t, startDelay: n } : t && (r = t); let i = this.createDefaultEmitters(); this.options = { emitterPositions: r.emitterPositions || i, minRadius: r.minRadius ?? .2, maxRadius: r.maxRadius ?? 1.6, waveDuration: r.waveDuration ?? 2200, spawnInterval: r.spawnInterval ?? 700, opacity: r.opacity ?? .2, color: r.color ?? new e.Color("#00fcff"), autoStart: r.autoStart ?? !1, startDelay: r.startDelay ?? 0, shape: r.shape ?? "hemisphere", useRangeCulling: r.useRangeCulling ?? !0 }, this.emitters = [], this.waves = [], this.geometry = null, this.active = !1, this.startTime = null, this.delayTimer = null, this.boundingBox = null, this.boxUpdateListener = null, this._elapsedTime = 0, this._boundUpdateHandler = null, this.init(); } init() { this.options.shape === "sphere" ? this.geometry = new e.SphereGeometry(1, 48, 24) : this.geometry = new e.SphereGeometry(1, 48, 24, 0, Math.PI * 2, 0, Math.PI / 2); let t = performance.now(); this.options.emitterPositions.forEach((e, n) => { this.emitters.push({ position: e.clone(), nextSpawn: t + n * 120 }); }), this.options.autoStart && (this.options.startDelay > 0 ? this.startWithDelay(this.options.startDelay) : this.start()); } start() { this.active || (this.active = !0, this._elapsedTime = 0, this.startTime = 0, this.emitters.forEach((e, t) => { e.nextSpawn = t * 120; }), this.#e()); } startWithDelay(e) { this.delayTimer !== null && clearTimeout(this.delayTimer), this.delayTimer = window.setTimeout(() => { this.delayTimer = null, this.start(); }, e); } stop() { this.active = !1, this.delayTimer !== null && (clearTimeout(this.delayTimer), this.delayTimer = null), this.#t(), this.clearWaves(); } clearWaves() { this.waves.forEach((t) => { t.mesh.parent && t.mesh.parent.remove(t.mesh), t.mesh.geometry.dispose(), t.mesh.material instanceof e.Material && t.mesh.material.dispose(); }), this.waves = []; } spawnWave(t) { if (!this.geometry) return; let n = new e.MeshBasicMaterial({ color: this.options.color, transparent: !0, opacity: this.options.opacity, side: e.DoubleSide, depthWrite: !1, depthTest: !0 }), r = new e.Mesh(this.geometry, n); zr.setExcludeAll(r), r.position.copy(t), r.scale.set(this.options.minRadius, this.options.minRadius, this.options.minRadius), r.renderOrder = 1; let i = Sl.defaultViewer; i && (this.options.useRangeCulling ? i.rangeCullingManager.add(r) : i.scene.add(r)), this.waves.push({ mesh: r, startTime: this._elapsedTime }); } update(t) { if (!this.active) return; this._elapsedTime += t.data.delta * 1e3; let n = this._elapsedTime; this.emitters.forEach((e) => { n >= e.nextSpawn && (this.spawnWave(e.position), e.nextSpawn = n + this.options.spawnInterval + Math.random() * 200); }); for (let t = this.waves.length - 1; t >= 0; t--) { let r = this.waves[t], i = (n - r.startTime) / this.options.waveDuration; if (i >= 1) { r.mesh.parent && r.mesh.parent.remove(r.mesh), r.mesh.material instanceof e.Material && r.mesh.material.dispose(), this.waves.splice(t, 1); continue; } let a = 1 - (1 - i) ** 2, o = this.options.minRadius + (this.options.maxRadius - this.options.minRadius) * a; r.mesh.scale.set(o, o, o), r.mesh.material instanceof e.MeshBasicMaterial && (r.mesh.material.opacity = this.options.opacity * (1 - i * .7)); } } removeFromScene(e) { this.waves.forEach((t) => { t.mesh.parent === e && e.remove(t.mesh); }); } setOpacity(t) { this.options.opacity = Math.max(0, Math.min(1, t)), this.waves.forEach((t) => { t.mesh.material instanceof e.MeshBasicMaterial && (t.mesh.material.opacity = this.options.opacity, t.mesh.material.transparent = this.options.opacity < 1); }); } setColor(t) { this.options.color = t, this.waves.forEach((n) => { n.mesh.material instanceof e.MeshBasicMaterial && n.mesh.material.color.setHex(t); }); } updateEmitterPositions(e) { this.options.emitterPositions = e, this.emitters = []; let t = this._elapsedTime; e.forEach((e, n) => { this.emitters.push({ position: e.clone(), nextSpawn: t + n * 120 }); }); } dispose() { this.stop(), this.geometry &&= (this.geometry.dispose(), null); } createDefaultEmitters() { let t = []; for (let n = 0; n < 5; n++) { let r = -2 + 1 * n; t.push(new e.Vector3(r, 0, -2.5)); } return t; } #e() { let e = Sl.defaultViewer; e && (this._boundUpdateHandler = (e) => this.update(e), e.emitter.on(Yt.BEFORE_RENDER, this._boundUpdateHandler)); } #t() { let e = Sl.defaultViewer; e && this._boundUpdateHandler && (e.emitter.off(Yt.BEFORE_RENDER, this._boundUpdateHandler), this._boundUpdateHandler = null); } }, fd = class { static configureTexture(t) { t.wrapS = e.RepeatWrapping, t.wrapT = e.RepeatWrapping, t.repeat.set(1, 1); } static createMaterial(t, n, r = {}, i = !0) { let a = new e.TextureLoader(), o = {}; n.map && (o.map = a.load(t + n.map), o.map.colorSpace = e.SRGBColorSpace, this.configureTexture(o.map)); let s = { color: 16777215, side: e.DoubleSide, map: o.map, transparent: !1, opacity: 1, ...r }; return i && o.displacement && (s.displacementMap = o.displacement, s.displacementScale = .1, s.displacementBias = -.05), s.opacity && s.opacity < 1 && (s.transparent = !0), new e.MeshBasicMaterial(s); } }, pd = class extends fd { static create(e = {}, t = !0) { return this.createMaterial("/texture/rock/forest_ground_04_", { map: "diff_1k.jpg" }, e, t); } }; function md(e = {}, t = !0) { return pd.create(e, t); } //#endregion //#region src/materials/Rock1Material.ts var hd = class extends fd { static create(e = {}, t = !0) { return this.createMaterial("/texture/rock1/coral_fort_wall_01_", { map: "diff_1k.jpg" }, e, t); } }; function gd(e = {}, t = !0) { return hd.create(e, t); } //#endregion //#region src/materials/Rock2Material.ts var _d = class extends fd { static create(e = {}, t = !0) { return this.createMaterial("/texture/rock2/Rock030_1K-JPG_", { map: "Color.jpg" }, e, t); } }; function vd(e = {}, t = !0) { return _d.create(e, t); } //#endregion //#region src/materials/Rock3Material.ts var yd = class extends fd { static create(e = {}, t = !0) { return this.createMaterial("/texture/rock3/plastered_stone_wall_", { map: "diff_1k.jpg" }, e, t); } }; function bd(e = {}, t = !0) { return yd.create(e, t); } //#endregion //#region src/materials/Rock4Material.ts var xd = class extends fd { static create(e = {}, t = !0) { return this.createMaterial("/texture/rock4/brown_mud_02_", { map: "diff_1k.jpg" }, e, t); } }; function Sd(e = {}, t = !0) { return xd.create(e, t); } //#endregion //#region src/materials/Rock5Material.ts var Cd = class extends fd { static create(e = {}, t = !0) { return this.createMaterial("/texture/rock5/lichen_rock_", { map: "diff_1k.jpg" }, e, t); } }; function wd(e = {}, t = !0) { return Cd.create(e, t); } //#endregion //#region src/materials/Rock6Material.ts var Td = class extends fd { static create(e = {}, t = !0) { return this.createMaterial("/texture/rock6/", { map: "rock.png" }, e, t); } }; function Ed(e = {}, t = !0) { return Td.create(e, t); } //#endregion //#region src/materials/Rock7Material.ts var Dd = class extends fd { static create(e = {}, t = !0) { return this.createMaterial("/texture/rock7/", { map: "grey_plaster_02_diff_1k.jpg" }, e, t); } }; function Od(e = {}, t = !0) { return Dd.create(e, t); } //#endregion //#region src/materials/Rock8Material.ts var kd = class extends fd { static create(e = {}, t = !0) { return this.createMaterial("/texture/rock8/", { map: "rock8.jpg" }, e, t); } }; function Ad(e = {}, t = !0) { return kd.create(e, t); } //#endregion //#region src/effect/RockDebris.ts var jd = Ed({}, !1), Md = [ "/model/rock/SM_Temp_10_.glb", "/model/rock/SM_Temp_11_.glb", "/model/rock/SM_Temp_12_.glb", "/model/rock/SM_Temp_13_.glb", "/model/rock/SM_Temp_14_.glb", "/model/rock/SM_Temp_15_.glb", "/model/rock/SM_Temp_16_.glb", "/model/rock/SM_Temp_17_.glb", "/model/rock/SM_Temp_18_.glb", "/model/rock/SM_Temp_19_.glb", "/model/rock/SM_Temp_20_.glb", "/model/rock/SM_Temp_21_.glb", "/model/rock/SM_Temp_22_.glb", "/model/rock/SM_Temp_23_.glb", "/model/rock/SM_Temp_24_.glb" ]; function Nd() { return [...Md]; } var Pd = /* @__PURE__ */ function(e) { return e.GENERATED = "GENERATED", e.URL = "URL", e; }({}), Fd = /* @__PURE__ */ function(e) { return e.IDLE = "IDLE", e.LOADING = "LOADING", e.LOADED = "LOADED", e; }(Fd || {}), Id = /* @__PURE__ */ function(e) { return e.VALID = "VALID", e.NO_HIT = "NO_HIT", e.ON_WALL = "ON_WALL", e.OVER_HEIGHT = "OVER_HEIGHT", e; }(Id || {}), Ld = class { options; rocks = []; rockModelTemplates = []; gltfLoader = new C(); modelLoadStatus = Fd.IDLE; modelLoadTask = null; active = !1; updateBound = null; _matrix = new e.Matrix4(); _raycaster = new e.Raycaster(); _rayDirection = new e.Vector3(0, -1, 0); SPAWN_MAX_RETRY = 20; SPAWN_MIN_RAY_DISTANCE = .05; _spawnCandidatePosition = new e.Vector3(); _meshWorldBox = new e.Box3(); _meshWorldSize = new e.Vector3(); _meshWorldScale = new e.Vector3(); FALL_LIMIT = 50; constructor(e) { if (this.options = { count: e.count ?? 60, size: e.size, office: e.office, speed: e.speed, startPosition: e.startPosition, mesh: e.mesh, modelSourceType: e.modelSourceType ?? Pd.GENERATED, modelUrls: e.modelUrls ?? Nd() }, this.options.modelSourceType === Pd.URL && this.options.modelUrls.length === 0) throw Error("RockDebris: modelSourceType 为 URL 时,modelUrls 不能为空"); this.options.mesh.geometry.computeBoundsTree?.(), this.updateBound = this.update.bind(this), this.init(); } async spawn() { if (await this.ensureRockPoolInitialized(), this.rocks.length === 0) throw Error("RockDebris: 未初始化任何落石实例,无法执行 spawn"); let { startPosition: e, office: t, speed: n, count: r } = this.options, [i, a] = t, o = Math.min(1.5, Math.max(.6, r * .05)); this.options.mesh.updateWorldMatrix(!0, !1); let s = this.getSpawnMaxRayDistance(); for (let t = 0; t < r; t++) { let r = this.rocks[t]; if (r) { if (r.active = !1, r.settled = !1, r.velocityY = -n * (.8 + Math.random() * .4), r.delayRemaining = Math.random() * o, !this.tryResolveSpawnPosition(e, i, a, r.radius, s, r.mesh.position)) { r.active = !1, r.settled = !0, r.mesh.visible = !1, r.mesh.position.set(0, -9999, 0); continue; } r.mesh.rotation.set(Math.random() * Math.PI * 2, Math.random() * Math.PI * 2, Math.random() * Math.PI * 2), r.mesh.visible = !1; } } this.active || this.start(); } async ensureRockPoolInitialized() { if (!(this.rocks.length > 0)) { if (this.options.modelSourceType === Pd.GENERATED) { this.createGeneratedRockPool(); return; } await this.createUrlRockPool(); } } createGeneratedRockPool() { let t = Sl.defaultViewer; if (!t?.scene) throw Error("RockDebris: 场景未就绪,无法创建生成落石对象池"); let { count: n, size: r } = this.options; for (let i = 0; i < n; i++) { let n = r[0] + Math.random() * (r[1] - r[0]), i = new e.DodecahedronGeometry(n, 0), a = jd.clone(), o = new e.Mesh(i, a); o.position.set(0, -9999, 0), o.visible = !1, t.scene.add(o), zr.setExcludeAll(o), this.rocks.push({ mesh: o, active: !1, settled: !1, velocityY: 0, radius: n, delayRemaining: 0 }); } } async createUrlRockPool() { let e = Sl.defaultViewer; if (!e?.scene) throw Error("RockDebris: 场景未就绪,无法创建 URL 落石对象池"); if (await this.ensureUrlModelTemplatesLoaded(), this.rockModelTemplates.length === 0) throw Error("RockDebris: URL 模型模板为空,无法创建落石对象池"); let { count: t, size: n } = this.options; for (let r = 0; r < t; r++) { let t = this.rockModelTemplates[Math.floor(Math.random() * this.rockModelTemplates.length)]; if (!t) throw Error("RockDebris: 随机选择 URL 模型模板失败"); let r = n[0] + Math.random() * (n[1] - n[0]), i = t.mesh.clone(); i.position.set(0, -9999, 0), i.visible = !1, e.scene.add(i), zr.setExcludeAll(i), this.rocks.push({ mesh: i, active: !1, settled: !1, velocityY: 0, radius: r, delayRemaining: 0 }); } } async ensureUrlModelTemplatesLoaded() { if (this.modelLoadStatus !== Fd.LOADED) { if (this.modelLoadStatus === Fd.LOADING) { if (!this.modelLoadTask) throw Error("RockDebris: URL 模型加载状态异常"); await this.modelLoadTask; return; } this.modelLoadStatus = Fd.LOADING, this.modelLoadTask = (async () => { let e = await Promise.all(this.options.modelUrls.map((e) => this.loadGltfScene(e))); for (let t of e) { let e = t.children[0]; e.scale.set(.01, .01, .01), t.updateWorldMatrix(!0, !0); let n = e.geometry; n.applyMatrix4(t.matrixWorld), n.computeBoundingSphere(); let r = n.boundingSphere?.radius; if (!r || r <= 0) throw Error("RockDebris: URL 模型网格包围球半径无效"); this.rockModelTemplates.push({ mesh: e, radius: r }); } if (this.rockModelTemplates.length === 0) throw Error("RockDebris: 未从 modelUrls 中解析出可用网格"); })(); try { await this.modelLoadTask, this.modelLoadStatus = Fd.LOADED; } catch (e) { throw this.modelLoadStatus = Fd.IDLE, this.modelLoadTask = null, e; } } } async loadGltfScene(e) { return await new Promise((t, n) => { this.gltfLoader.load(e, (e) => t(e.scene), void 0, n); }); } disposeRockMaterial(e) { if (Array.isArray(e)) { for (let t of e) t.dispose(); return; } e.dispose(); } getSpawnMaxRayDistanceFromParametricArch() { let e = this.options.mesh, t = e.options ?? e.userData.archOptions; if (!t) return null; let n = t.width, r = t.height; if (typeof n != "number" || typeof r != "number") return null; let i = r + n * .5; return i <= 0 ? null : i * Math.abs(this.options.mesh.getWorldScale(this._meshWorldScale).y) * 1.05; } getSpawnMaxRayDistance() { let e = this.getSpawnMaxRayDistanceFromParametricArch(); if (e !== null) return e; this._meshWorldBox.setFromObject(this.options.mesh), this._meshWorldBox.getSize(this._meshWorldSize); let t = this._meshWorldSize.y; return t <= 0 ? this.FALL_LIMIT : t; } getSpawnMinRayDistance(e) { return Math.max(this.SPAWN_MIN_RAY_DISTANCE, e * 1.2); } sampleSpawnCandidatePosition(e, t, n, r) { let i = t + Math.random() * (n - t), a = t + Math.random() * (n - t); r.set(e.x + i, e.y, e.z + a); } getSpawnRaycastStatus(e, t, n) { this._raycaster.set(e, this._rayDirection), this._raycaster.firstHitOnly = !0; let r = this._raycaster.intersectObject(this.options.mesh, !1); if (!r[0]) return Id.NO_HIT; let i = r[0].distance; return i <= t ? Id.ON_WALL : i > n ? Id.OVER_HEIGHT : Id.VALID; } tryResolveSpawnPosition(e, t, n, r, i, a) { let o = this.getSpawnMinRayDistance(r); for (let r = 0; r < this.SPAWN_MAX_RETRY; r++) if (this.sampleSpawnCandidatePosition(e, t, n, this._spawnCandidatePosition), this.getSpawnRaycastStatus(this._spawnCandidatePosition, o, i) === Id.VALID) return a.copy(this._spawnCandidatePosition), !0; return !1; } start() { if (this.active) return; this.active = !0; let e = Sl.defaultViewer; e && (this.updateBound = (e) => this.update(e), e.emitter.on(Yt.BEFORE_RENDER, this.updateBound)); } stop() { if (!this.active) return; this.active = !1; let e = Sl.defaultViewer; e && this.updateBound && (e.emitter.off(Yt.BEFORE_RENDER, this.updateBound), this.updateBound = null); } update(e) { let t = Math.min(e.data.delta, .05), n = this.options.startPosition.y, r = !1; for (let e of this.rocks) { if (e.settled) continue; if (!e.active) { if (e.delayRemaining > 0) { e.delayRemaining -= t, r = !0; continue; } e.active = !0, e.mesh.visible = !0; } if (e.mesh.position.y < n - this.FALL_LIMIT) { e.active = !1, e.mesh.visible = !1; continue; } e.mesh.position.y += e.velocityY * t, e.mesh.updateMatrixWorld(); let i = this._matrix.copy(this.options.mesh.matrixWorld).invert().multiply(e.mesh.matrixWorld); if (this.options.mesh.geometry.boundsTree?.intersectsGeometry(e.mesh.geometry, i)) { this._raycaster.set(e.mesh.position, this._rayDirection), this._raycaster.firstHitOnly = !0; let t = this._raycaster.intersectObject(this.options.mesh, !1); t.length > 0 && t[0] && (e.mesh.position.y = t[0].point.y + e.radius), e.settled = !0; continue; } r = !0; } r || this.stop(); } clear() { for (let e of this.rocks) e.active = !1, e.settled = !1, e.delayRemaining = 0, e.mesh.visible = !1, e.mesh.position.set(0, -9999, 0); this.stop(); } dispose() { this.stop(); let e = Sl.defaultViewer; for (let t of this.rocks) e?.scene?.remove(t.mesh), this.options.modelSourceType === Pd.GENERATED && (t.mesh.geometry.dispose(), this.disposeRockMaterial(t.mesh.material)); this.rocks = []; for (let e of this.rockModelTemplates) e.mesh.geometry.dispose(), this.disposeRockMaterial(e.mesh.material); this.rockModelTemplates.length = 0, this.modelLoadStatus = Fd.IDLE, this.modelLoadTask = null; } init() { this.options.modelSourceType !== Pd.URL && this.createGeneratedRockPool(); } }, Rd = ge(([e, t, n, r, i]) => e.sub(t).div(n.sub(t)).mul(i.sub(r)).add(r).clamp(r, i)), zd = ge(({ minx: e, miny: t, minz: n, orig: r, dir: i }) => { let a = Ue(e, t, n), o = Ue(.5, .5, .5), s = i.reciprocal(), c = a.sub(r).mul(s), l = o.sub(r).mul(s), u = Te(c, l), d = we(c, l); return He(we(u.x, we(u.y, u.z)), Te(d.x, Te(d.y, d.z))); }), Bd = (e, t, n, r, i, a) => { let o = Ve(Ue(De.mul(We(ye, 1)))), s = Ve(Me.sub(o)).normalize(), c = He(zd({ minx: t, miny: n, minz: r, orig: o, dir: s })).toVar(); if (c.x.greaterThan(c.y).discard(), a) { let e = Ue(a.x, a.y, a.z), t = Se(e.length()).toVar(); _e(t.greaterThan(1e-5), () => { let n = Ue(e.div(t)).toVar(), r = Ue(Ee.mul(We(o, 1))).toVar(), i = Se(Ue(Ee.mul(We(s, 0))).toVar().dot(n)).toVar(), l = Se(r.dot(n).sub(a.w)).toVar(); _e(i.abs().lessThanEqual(1e-8), () => { _e(l.lessThan(0), () => { c.assign(He(1, 0)); }); }).Else(() => { let e = Se(a.w.sub(r.dot(n)).div(i)).toVar(); _e(i.greaterThan(0), () => { c.x.assign(we(c.x, e)); }).Else(() => { c.y.assign(Te(c.y, e)); }); }); }); } c.x.greaterThan(c.y).discard(), c.assign(He(we(c.x, 0), c.y)); let l = Ue(s.abs().reciprocal()).toVar(), u = Se(Te(l.x, Te(l.y, l.z))).toVar(); u.divAssign(Se(e)); let d = Ue(o.add(c.x.mul(s))).toVar(); ve({ type: "float", start: c.x, end: c.y, update: u }, () => { i({ positionRay: d }), d.addAssign(s.mul(u)); }); }, Vd = ge(([e, t]) => { let n = be(t, 0, .99); return e.sample(He(n, .1)).rgb; }), Hd = ge(({ colorTexture: e, texture: t, range: n, threshold: r, opacity: i, steps: a, useSmoothing: o, clipMode: s, clipPlane: c, clipPlaneX: l, clipPlaneY: u, clipPlaneZ: d }) => { let f = We(0).toVar(), p = ({ positionRay: a }) => { let s = Se(t.sample(a.add(.5)).r).toVar(); _e(o, () => { s.assign(Fe(r.sub(n), r.add(n), s)); }).Else(() => { s.assign(s); }), s.assign(s.mul(i)); let c = Vd(e, s); f.rgb.addAssign(c.mul(s)), f.a.addAssign(f.a.oneMinus().mul(s)), _e(f.a.greaterThanEqual(.95), () => { me(); }); }; return _e(s.equal(0), () => { Bd(a, Rd(l.w, -2.5, 2.5, -.5, .5), Rd(u.w, -2.5, 2.5, -.5, .5), Rd(d.w, -2.5, 2.5, -.5, .5), ({ positionRay: e }) => { p({ positionRay: e }); }); }).Else(() => { Bd(a, -.5, -.5, -.5, ({ positionRay: e }) => { p({ positionRay: e }); }, c); }), f; }), Ud = ge(({ colorTexture: e, texture: t, opacity: n, steps: r, clipMode: i, clipPlane: a, clipPlaneX: o, clipPlaneY: s, clipPlaneZ: c }) => { let l = Se(1).toVar(), u = We(0).toVar(), d = ({ positionRay: e }) => { let n = Se(t.sample(e.add(.5)).r).toVar(); _e(n.lessThan(l), () => { l.assign(n); }), _e(l.lessThanEqual(.05), () => { me(); }); }; return _e(i.equal(0), () => { Bd(r, Rd(o.w, -2.5, 2.5, -.5, .5), Rd(s.w, -2.5, 2.5, -.5, .5), Rd(c.w, -2.5, 2.5, -.5, .5), ({ positionRay: e }) => { d({ positionRay: e }); }); }).Else(() => { Bd(r, -.5, -.5, -.5, ({ positionRay: e }) => { d({ positionRay: e }); }, a); }), u.rgb.assign(Vd(e, l.mul(n))), u.a.assign(l.mul(n)), u; }), Wd = ge(({ colorTexture: e, texture: t, opacity: n, steps: r, clipMode: i, clipPlane: a, clipPlaneX: o, clipPlaneY: s, clipPlaneZ: c }) => { let l = Se(0).toVar(), u = We(0).toVar(), d = ({ positionRay: e }) => { let n = Se(t.sample(e.add(.5)).r).toVar(); _e(n.greaterThan(l), () => { l.assign(n); }), _e(l.greaterThanEqual(.99), () => { me(); }); }; return _e(i.equal(0), () => { Bd(r, Rd(o.w, -2.5, 2.5, -.5, .5), Rd(s.w, -2.5, 2.5, -.5, .5), Rd(c.w, -2.5, 2.5, -.5, .5), ({ positionRay: e }) => { d({ positionRay: e }); }); }).Else(() => { Bd(r, -.5, -.5, -.5, ({ positionRay: e }) => { d({ positionRay: e }); }, a); }), u.rgb.assign(Vd(e, l.mul(n))), u.a.assign(l.mul(n)), u; }), Gd = ge(({ colorTexture: e, texture: t, range: n, threshold: r, opacity: i, steps: a, useSmoothing: o, mode: s, clipMode: c, clipPlane: l, clipPlaneX: u, clipPlaneY: d, clipPlaneZ: f }) => { let p = We(0).toVar(); return _e(s.equal(0), () => { p.assign(Hd({ colorTexture: e, texture: t, range: n, threshold: r, opacity: i, steps: a, useSmoothing: o, clipMode: c, clipPlane: l, clipPlaneX: u, clipPlaneY: d, clipPlaneZ: f })); }).ElseIf(s.equal(1), () => { p.assign(Ud({ colorTexture: e, texture: t, opacity: i, steps: a, clipMode: c, clipPlane: l, clipPlaneX: u, clipPlaneY: d, clipPlaneZ: f })); }).Else(() => { p.assign(Wd({ colorTexture: e, texture: t, opacity: i, steps: a, clipMode: c, clipPlane: l, clipPlaneX: u, clipPlaneY: d, clipPlaneZ: f })); }), p; }), Kd = /* @__PURE__ */ Math.sqrt(3), qd = /* @__PURE__ */ Math.sqrt(5); .5 * (Kd - 1), (3 - Kd) / 6; var Jd = 1 / 3, Yd = 1 / 6; (qd - 1) / 4, (5 - qd) / 20; var Xd = (e) => Math.floor(e) | 0, Zd = /* @__PURE__ */ new Float64Array([ 1, 1, 0, -1, 1, 0, 1, -1, 0, -1, -1, 0, 1, 0, 1, -1, 0, 1, 1, 0, -1, -1, 0, -1, 0, 1, 1, 0, -1, 1, 0, 1, -1, 0, -1, -1 ]); function Qd(e = Math.random) { let t = $d(e), n = new Float64Array(t).map((e) => Zd[e % 12 * 3]), r = new Float64Array(t).map((e) => Zd[e % 12 * 3 + 1]), i = new Float64Array(t).map((e) => Zd[e % 12 * 3 + 2]); return function(e, a, o) { let s, c, l, u, d = (e + a + o) * Jd, f = Xd(e + d), p = Xd(a + d), m = Xd(o + d), h = (f + p + m) * Yd, g = f - h, _ = p - h, v = m - h, y = e - g, b = a - _, x = o - v, S, C, w, T, E, D; y >= b ? b >= x ? (S = 1, C = 0, w = 0, T = 1, E = 1, D = 0) : y >= x ? (S = 1, C = 0, w = 0, T = 1, E = 0, D = 1) : (S = 0, C = 0, w = 1, T = 1, E = 0, D = 1) : b < x ? (S = 0, C = 0, w = 1, T = 0, E = 1, D = 1) : y < x ? (S = 0, C = 1, w = 0, T = 0, E = 1, D = 1) : (S = 0, C = 1, w = 0, T = 1, E = 1, D = 0); let O = y - S + Yd, k = b - C + Yd, A = x - w + Yd, j = y - T + 2 * Yd, M = b - E + 2 * Yd, N = x - D + 2 * Yd, P = y - 1 + 3 * Yd, F = b - 1 + 3 * Yd, I = x - 1 + 3 * Yd, L = f & 255, R = p & 255, z = m & 255, ee = .6 - y * y - b * b - x * x; if (ee < 0) s = 0; else { let e = L + t[R + t[z]]; ee *= ee, s = ee * ee * (n[e] * y + r[e] * b + i[e] * x); } let B = .6 - O * O - k * k - A * A; if (B < 0) c = 0; else { let e = L + S + t[R + C + t[z + w]]; B *= B, c = B * B * (n[e] * O + r[e] * k + i[e] * A); } let V = .6 - j * j - M * M - N * N; if (V < 0) l = 0; else { let e = L + T + t[R + E + t[z + D]]; V *= V, l = V * V * (n[e] * j + r[e] * M + i[e] * N); } let H = .6 - P * P - F * F - I * I; if (H < 0) u = 0; else { let e = L + 1 + t[R + 1 + t[z + 1]]; H *= H, u = H * H * (n[e] * P + r[e] * F + i[e] * I); } return 32 * (s + c + l + u); }; } function $d(e) { let t = new Uint8Array(512); for (let e = 0; e < 512 / 2; e++) t[e] = e; for (let n = 0; n < 512 / 2 - 1; n++) { let r = n + ~~(e() * (256 - n)), i = t[n]; t[n] = t[r], t[r] = i; } for (let e = 256; e < 512; e++) t[e] = t[e - 256]; return t; } //#endregion //#region src/effect/volume/VolumeTool.ts var ef = class t { static remap(e, t, n, r = 0, i = 1) { return t === n ? r : (e - t) / (n - t) * (i - r) + r; } static generateVolumeData({ x: e, y: n, z: r, size: i = 256, rangeMin: a, rangeMax: o }) { let s = i ?? e ?? 0, c = i ?? n ?? 0, l = i ?? r ?? 0, u = Qd(Math.random), d = new Uint8Array(s * c * l); for (let e = 0; e < s; e++) for (let n = 0; n < c; n++) for (let r = 0; r < l; r++) { let i = u(e / s, n / c, r / l), f = t.remap(i, -1, 1, a, o); f = t.remap(f, a, o, 0, 255), d[e + n * s + r * c * s] = f; } return d; } static generateVolumeDataWithClearLayers({ x: e, y: n, z: r, size: i = 256, rangeMin: a, rangeMax: o, clearLayers: s = 0 }) { let c = t.generateVolumeData({ x: e, y: n, z: r, size: i, rangeMin: a, rangeMax: o }); if (s > 0) { let a = i ?? e ?? 0, o = i ?? n ?? 0, l = i ?? r ?? 0; t.clearOuterLayers({ data: c, width: a, height: o, depth: l, layers: s }); } return c; } static generateNoiseAroundPoints({ size: e = 256, worldOrigin: n, worldSize: r, points: i, rangeMin: a, rangeMax: o }) { let s = e, c = e, l = e, u = new Uint8Array(s * c * l), d = Qd(Math.random); for (let e = 0; e < s; e++) for (let n = 0; n < c; n++) for (let r = 0; r < l; r++) { let i = d(e / s, n / c, r / l); u[e + n * s + r * c * s] = Math.round(t.remap(i, -1, 1, 0, 100)); } let f = r / 2, p = [ n[0] - f, n[1] - f, n[2] - f ], m = [ n[0] + f, n[1] + f, n[2] + f ]; for (let { position: e, radius: n, density: d } of i) { let [i, f, h] = e, g = Math.round(t.remap(i, p[0], m[0], 0, s - 1)), _ = Math.round(t.remap(f, p[1], m[1], 0, c - 1)), v = Math.round(t.remap(h, p[2], m[2], 0, l - 1)), y = Math.round(s / r * n), b = Math.max(.01, (d - a) / (o - a)), x = Math.max(0, g - y), S = Math.min(s - 1, g + y), C = Math.max(0, _ - y), w = Math.min(c - 1, _ + y), T = Math.max(0, v - y), E = Math.min(l - 1, v + y); for (let e = x; e <= S; e++) for (let t = C; t <= w; t++) for (let n = T; n <= E; n++) { let r = e - g, i = t - _, a = n - v, o = Math.sqrt(r * r + i * i + a * a); if (o <= y) { let r = b * (1 - o / y) * 255, i = e + t * s + n * c * s; u[i] = Math.min(255, u[i] + r); } } } return u; } static clearOuterLayers({ data: e, width: t, height: n, depth: r, layers: i }) { for (let a = 0; a < t; a++) for (let o = 0; o < n; o++) for (let s = 0; s < r; s++) (a < i || a >= t - i || o < i || o >= n - i || s < i || s >= r - i) && (e[a + o * t + s * n * t] = 0); } static generateRandomVolumeInBox({ outerBox: e, innerBox: n, size: r = 256, rangeMin: i = 0, rangeMax: a = 255 }) { let o = new Uint8Array(r * r * r), s = Qd(Math.random), c = Math.round(t.remap(n.min.x, e.min.x, e.max.x, 0, r - 1)), l = Math.round(t.remap(n.min.y, e.min.y, e.max.y, 0, r - 1)), u = Math.round(t.remap(n.min.z, e.min.z, e.max.z, 0, r - 1)), d = Math.round(t.remap(n.max.x, e.min.x, e.max.x, 0, r - 1)), f = Math.round(t.remap(n.max.y, e.min.y, e.max.y, 0, r - 1)), p = Math.round(t.remap(n.max.z, e.min.z, e.max.z, 0, r - 1)), m = 0; for (let e = c; e <= d; e++) for (let n = l; n <= f; n++) for (let c = u; c <= p; c++) { let l = s(e / r * 5, n / r * 5, c / r * 5); console.log(l); let u = Math.round(t.remap(l, -1, 1, i, a)); o[e + n * r + c * r * r] = u, m = Math.max(m, u); } return console.log(m), o; } static generateRandomVolumeAroundPipe({ outerBox: n, pipeStart: r, pipeEnd: i, pipeRadius: a, size: o = 256, rangeMin: s = 0, rangeMax: c = 255 }) { let l = new Uint8Array(o * o * o), u = Qd(Math.random), d = new e.Vector3().subVectors(i, r), f = d.length(); d.normalize(); for (let i = 0; i < o; i++) for (let p = 0; p < o; p++) for (let m = 0; m < o; m++) { let h = t.remap(i, 0, o - 1, n.min.x, n.max.x), g = t.remap(p, 0, o - 1, n.min.y, n.max.y), _ = t.remap(m, 0, o - 1, n.min.z, n.max.z), v = new e.Vector3(h, g, _), y = new e.Vector3().subVectors(v, r).dot(d); if (y >= 0 && y <= f) { let n = new e.Vector3().copy(r).addScaledVector(d, y); if (v.distanceTo(n) <= a) { let e = u(i / o * 10, p / o * 10, m / o * 10); l[i + p * o + m * o * o] = Math.round(t.remap(e, -1, 1, s, c)); } } } return l; } static generateRandomVolumeAroundPipeWithBaseData({ outerBox: n, pipeStart: r, pipeEnd: i, pipeRadius: a, size: o = 256, rangeMin: s = 0, rangeMax: c = 255, baseData: l }) { let u = o * o * o, d = l.length === u ? new Uint8Array(l) : new Uint8Array(u), f = Qd(Math.random), p = new e.Vector3().subVectors(i, r), m = p.length(); p.normalize(); for (let i = 0; i < o; i++) for (let l = 0; l < o; l++) for (let u = 0; u < o; u++) { let h = t.remap(i, 0, o - 1, n.min.x, n.max.x), g = t.remap(l, 0, o - 1, n.min.y, n.max.y), _ = t.remap(u, 0, o - 1, n.min.z, n.max.z), v = new e.Vector3(h, g, _), y = new e.Vector3().subVectors(v, r).dot(p); if (y >= 0 && y <= m) { let n = new e.Vector3().copy(r).addScaledVector(p, y); if (v.distanceTo(n) <= a) { let e = f(i / o * 10, l / o * 10, u / o * 10); d[i + l * o + u * o * o] = Math.round(t.remap(e, -1, 1, s, c)); } } } return d; } }, tf = class e { static generateNoisePointCloudData(t) { let n = t.size ?? t.x ?? 256, r = t.size ?? t.y ?? 256, i = t.size ?? t.z ?? 256, a = Math.min(1, Math.max(0, t.threshold ?? .1)), o = t.spaceSize ?? 5, s = t.noiseScale ?? 1, c = Math.max(n, 1), l = Math.max(r, 1), u = Math.max(i, 1), d = o / 2, f = t.min ?? [ -d, -d, -d ], p = t.max ?? [ d, d, d ], m = e.normalizeRange([f[0], p[0]]), h = e.normalizeRange([f[1], p[1]]), g = e.normalizeRange([f[2], p[2]]), _ = Qd(Math.random), v = 0; for (let t = 0; t < u; t++) for (let n = 0; n < l; n++) for (let r = 0; r < c; r++) { let i = e.resolveNormalizedIndex(r, c), o = e.resolveNormalizedIndex(n, l), d = e.resolveNormalizedIndex(t, u), f = _(i * s, o * s, d * s); e.resolveNoiseDensity(f) > a && v++; } let y = new Float32Array(v * 3), b = new Float32Array(v), x = 0; for (let t = 0; t < u; t++) for (let n = 0; n < l; n++) for (let r = 0; r < c; r++) { let i = e.resolveNormalizedIndex(r, c), o = e.resolveNormalizedIndex(n, l), d = e.resolveNormalizedIndex(t, u), f = _(i * s, o * s, d * s), p = e.resolveNoiseDensity(f); if (p <= a) continue; let v = x * 3; y[v] = e.resolveRangeValue(r, c, m), y[v + 1] = e.resolveRangeValue(n, l, h), y[v + 2] = e.resolveRangeValue(t, u, g), b[x] = p, x++; } return { positions: y, densities: b }; } static generateGridPointCloud(t) { let n = Math.max(t.xCount, 1), r = Math.max(t.yCount, 1), i = Math.max(t.zCount, 1), a = n * r * i, o = new Float32Array(a * 3), s = new Float32Array(a), c = 0, l = e.normalizeRange(t.xRange), u = e.normalizeRange(t.yRange), d = e.normalizeRange(t.zRange); for (let a = 0; a < i; a++) for (let f = 0; f < r; f++) for (let p = 0; p < n; p++) { let m = e.resolveRangeValue(p, n, l), h = e.resolveRangeValue(f, r, u), g = e.resolveRangeValue(a, i, d), _ = c * 3; o[_] = m, o[_ + 1] = h, o[_ + 2] = g, s[c] = e.resolveDensity(t.density, m, h, g), c++; } return { positions: o, densities: s }; } static convertVolumeToPointCloudData(t) { let n = t.data; if (!n || n.length === 0) return { positions: new Float32Array(), densities: new Float32Array() }; let r = Math.max(1, Math.round(Math.cbrt(n.length))), i = t.size ?? t.x ?? r, a = t.size ?? t.y ?? r, o = t.size ?? t.z ?? r, s = Math.max(i, 1), c = Math.max(a, 1), l = Math.max(o, 1), u = Math.min(s * c * l, n.length), d = Math.min(1, Math.max(0, t.threshold ?? 0)), f = t.sourceMin ?? 0, p = t.sourceMax ?? 255, m = (t.spaceSize ?? 5) / 2, h = t.min ?? [ -m, -m, -m ], g = t.max ?? [ m, m, m ], _ = e.normalizeRange([h[0], g[0]]), v = e.normalizeRange([h[1], g[1]]), y = e.normalizeRange([h[2], g[2]]), b = 0; for (let t = 0; t < u; t++) e.resolveVolumeDensity(n[t], f, p) > d && b++; let x = new Float32Array(b * 3), S = new Float32Array(b), C = 0; for (let t = 0; t < u; t++) { let r = e.resolveVolumeDensity(n[t], f, p); if (r <= d) continue; let i = t % s, a = Math.floor(t / s) % c, o = Math.floor(t / (s * c)), u = C * 3; x[u] = e.resolveRangeValue(i, s, _), x[u + 1] = e.resolveRangeValue(a, c, v), x[u + 2] = e.resolveRangeValue(o, l, y), S[C] = r, C++; } return { positions: x, densities: S }; } static resolveNormalizedIndex(e, t) { return t <= 1 ? 0 : e / (t - 1); } static resolveNoiseDensity(e) { return ef.remap(e, -1, 1, 0, 1); } static resolveVolumeDensity(e, t, n) { if (t === n) return e >= n ? 1 : 0; let r = ef.remap(e, t, n, 0, 1); return Math.min(1, Math.max(0, r)); } static resolveRangeValue(t, n, r) { let i = e.normalizeRange(r); if (n <= 1) return (i[0] + i[1]) / 2; let a = ef.remap(t, 0, n - 1, i[0], i[1]); return Math.min(i[1], Math.max(i[0], a)); } static normalizeRange(e) { return [Math.min(e[0], e[1]), Math.max(e[0], e[1])]; } static resolveDensity(e, t, n, r) { if (typeof e == "function") { let i = e(t, n, r); return Math.min(1, Math.max(0, i)); } return Math.min(1, Math.max(0, e ?? 1)); } }, nf = [ { color: "#0000FF", step: 0 }, { color: "#00FF00", step: .33 }, { color: "#FFFF00", step: .66 }, { color: "#FF0000", step: 1 } ], rf = class t extends e.Sprite { viewer; densities; pointCount; opacity; densityRange; constructor(n, r) { let i = Math.min(.1, Math.max(.001, r.pointSize ?? .001)), a = r.pointCloudData, o = a.densities.length; t.validatePointCloudData(a); let s = t.buildColorArray(a.densities, r.colorStops ?? nf), c = new e.InstancedBufferAttribute(new Float32Array(a.positions), 3), l = new e.InstancedBufferAttribute(s, 3), u = new e.InstancedBufferAttribute(a.densities, 1), d = ze(new e.Vector2(0, 1)), f = Ce(l), p = Ce(u), m = ze(1), h = ge(({}) => { let e = We(f, m).toVar(), t = He(p).toVar(); return _e(t.x.lessThan(d.x), () => { he(); }), _e(t.x.greaterThan(d.y), () => { he(); }), e; }), g = new e.PointsNodeMaterial({ size: i, opacityNode: Pe(), positionNode: Ce(c), colorNode: h(), alphaToCoverage: !0, transparent: !0 }); Reflect.set(g, "customOpacity", !0), Object.defineProperty(g, "opacity", { get: () => m.value, set: (e) => { console.log("`1111", e), m.value = e; } }), super(g), this.densityRange = d, this.renderOrder = 0, this.count = o, this.frustumCulled = !1, this.name = r.name, this.viewer = n, this.pointCount = o, this.densities = new Float32Array(a.densities), this.viewer.scene.add(this); } filterByIntensity(e, t = 1) { this.densityRange.value.set(e, t); } setPointSize(e) { let t = Math.min(.1, Math.max(.001, e)); this.material.size = t; } dispose() { this.material.dispose(), this.viewer.scene.remove(this); } static validatePointCloudData(e) { if (e.positions.length !== e.densities.length * 3) throw Error("点云位置数组长度必须为密度数组长度的 3 倍"); } static buildColorArray(e, n) { let r = t.createGradientLookupData(n), i = new Float32Array(e.length * 3); for (let t = 0; t < e.length; t++) { let n = Math.min(1, Math.max(0, e[t] ?? 0)), a = Math.floor(n * 255) * 4; i[t * 3] = (r[a] ?? 0) / 255, i[t * 3 + 1] = (r[a + 1] ?? 0) / 255, i[t * 3 + 2] = (r[a + 2] ?? 0) / 255; } return i; } static createGradientLookupData(e) { let t = document.createElement("canvas"); t.width = 256, t.height = 1; let n = t.getContext("2d"); if (!n) throw Error("无法创建点云颜色查找表上下文"); let r = [...e].sort((e, t) => e.step - t.step), i = n.createLinearGradient(0, 0, 255, 0); return r.forEach((e) => { let t = Math.min(1, Math.max(0, e.step)); i.addColorStop(t, e.color); }), n.fillStyle = i, n.fillRect(0, 0, 256, 1), n.getImageData(0, 0, 256, 1).data; } }, af = /* @__PURE__ */ function(e) { return e[e.EmissionAbsorptionModel = 0] = "EmissionAbsorptionModel", e[e.MinimumIntensityProjection = 1] = "MinimumIntensityProjection", e[e.MaximumIntensityProjection = 2] = "MaximumIntensityProjection", e; }({}); function of(e) { return Reflect.get(e, "isVolumeMesh") === !0; } var sf = class t extends e.Mesh { static panelCounter = 0; range; threshold; opacity; steps; useSmoothing; mode; clipMode; clipPlane; clipPlaneX; clipPlaneY; clipPlaneZ; uniformScale = 1; data; viewer; volumeTexture; transferTexture; material; wireframe; sizeX; sizeY; sizeZ; canvas; colorStops; isVolumeMesh = !0; constructor(t, n) { if (!n.size && (!n.sizeX || !n.sizeY || !n.sizeZ)) throw Error("必须提供 size 或完整的 sizeX/sizeY/sizeZ"); let r = n.size || n.sizeX, i = n.size || n.sizeY, a = n.size || n.sizeZ, o = n.scale ?? 1, s = ze(n.range ?? .1), c = ze(n.threshold ?? .25), l = ze(1), u = ze(n.steps ?? 200), d = ze(n.useSmoothing ? 1 : 0), f = ze(n.mode ?? 2), p = ze(n.clipMode ?? 0), m = ze(n.clipPlane ?? new e.Vector4(0, 0, 0, 1)), h = ze(new e.Vector4(-1, 0, 0, -2.5)), g = ze(new e.Vector4(0, -1, 0, -2.5)), _ = ze(new e.Vector4(0, 0, -1, -2.5)), v = n.colorStops || [ { color: "#0000FF", step: .25 }, { color: "#00FF00", step: .5 }, { color: "#FFFF00", step: .75 }, { color: "#FF0000", step: 1 } ], y = document.createElement("canvas"); y.width = 256, y.height = 30; let b = y.getContext("2d"), x = b.createLinearGradient(0, 0, y.width - 1, y.height - 1); v.forEach((e) => x.addColorStop(e.step, e.color)), b.fillStyle = x, b.fillRect(0, 0, y.width - 1, y.height - 1); let S = new e.Texture(y); S.wrapS = e.ClampToEdgeWrapping, S.wrapT = e.ClampToEdgeWrapping, S.needsUpdate = !0; let C = new e.Data3DTexture(n.data, r, i, a); C.format = e.RedFormat, C.minFilter = e.LinearFilter, C.magFilter = e.LinearFilter, C.unpackAlignment = 1, C.needsUpdate = !0; let w = Gd({ colorTexture: Ie(S), texture: Le(C), range: s, threshold: c, opacity: l, steps: u, useSmoothing: d, mode: f, clipMode: p, clipPlane: m, clipPlaneX: h, clipPlaneY: g, clipPlaneZ: _ }), T = new e.NodeMaterial(); T.colorNode = w, T.side = e.DoubleSide, T.transparent = !0, T.depthTest = !1; let E = new e.BoxGeometry(1, 1, 1); super(E, T), this.viewer = t, this.sizeX = r, this.sizeY = i, this.sizeZ = a, this.data = n.data, this.uniformScale = o, this.range = s, this.threshold = c, this.opacity = l, this.steps = u, this.useSmoothing = d, this.mode = f, this.clipMode = p, this.clipPlane = m, this.clipPlaneX = h, this.clipPlaneY = g, this.clipPlaneZ = _, this.transferTexture = S, this.volumeTexture = C, this.material = T, this.colorStops = v, this.scale.setScalar(this.uniformScale), this.name = n.name, this.viewer.scene.add(this), Reflect.set(this, "customOpacity", !0), (n.showWireframe ?? !1) && (this.wireframe = new hu({ width: 1, height: 1, depth: 1, color: 65280, linewidth: 2 }), this.wireframe && (this.wireframe.position.copy(this.position), this.wireframe.scale.copy(this.scale), this.viewer.scene.add(this.wireframe))); } updateTransferTexture(e) { this.updateTransferTextureCanvas(e), this.transferTexture.needsUpdate = !0; } updateVolumeData(e) { this.volumeTexture.image.data = e, this.volumeTexture.needsUpdate = !0; } setWireframeVisible(e) { e ? (this.wireframe || (this.wireframe = new hu({ width: 1, height: 1, depth: 1, color: 65280, linewidth: 2 }), this.wireframe.position.copy(this.position), this.wireframe.scale.copy(this.scale)), this.viewer.scene.add(this.wireframe)) : this.wireframe && this.viewer.scene.remove(this.wireframe); } updateTransferTextureCanvas(e) { this.canvas || (this.canvas = document.createElement("canvas"), this.canvas.width = 256, this.canvas.height = 30); let t = this.canvas.getContext("2d"), n = t.createLinearGradient(0, 0, this.canvas.width - 1, this.canvas.height - 1); e.forEach((e) => { n.addColorStop(e.step, e.color); }), t.fillStyle = n, t.fillRect(0, 0, this.canvas.width - 1, this.canvas.height - 1); } createTransferTexture(t) { this.updateTransferTextureCanvas(t); let n = new e.Texture(this.canvas); return n.wrapS = e.ClampToEdgeWrapping, n.wrapT = e.ClampToEdgeWrapping, n.needsUpdate = !0, n; } numberToHex(e) { return "#" + e.toString(16).padStart(6, "0"); } dispose() { this.volumeTexture.dispose(), this.transferTexture.dispose(), this.material.dispose(), this.viewer.scene.remove(this), this.wireframe && this.viewer.scene.remove(this.wireframe); } createDebugPanel() { let e = ++t.panelCounter, n = this.viewer.inspector.createParameters(`Volume Rendering ${e}`), r = { value0: this.colorStops[0]?.step || 0, value1: this.colorStops[1]?.step || .25, value2: this.colorStops[2]?.step || .5, value3: this.colorStops[3]?.step || .75, value4: this.colorStops[4]?.step || 1 }; n.add(r, "value0", 0, 1, .01).name("色条位置 0").onChange((e) => { this.colorStops[0] && (this.colorStops[0].step = e), this.updateTransferTexture(this.colorStops); }), n.add(r, "value1", 0, 1, .01).name("色条位置 1").onChange((e) => { this.colorStops[1] && (this.colorStops[1].step = e), this.updateTransferTexture(this.colorStops); }), n.add(r, "value2", 0, 1, .01).name("色条位置 2").onChange((e) => { this.colorStops[2] && (this.colorStops[2].step = e), this.updateTransferTexture(this.colorStops); }), n.add(r, "value3", 0, 1, .01).name("色条位置 3").onChange((e) => { this.colorStops[3] && (this.colorStops[3].step = e), this.updateTransferTexture(this.colorStops); }), n.add(r, "value4", 0, 1, .01).name("色条位置 4").onChange((e) => { this.colorStops[4] && (this.colorStops[4].step = e), this.updateTransferTexture(this.colorStops); }); let i = { color0: this.colorStops[0]?.color || "#0082FA", color1: this.colorStops[1]?.color || "#00CC92", color2: this.colorStops[2]?.color || "#6ACC00", color3: this.colorStops[3]?.color || "#CCB000", color4: this.colorStops[4]?.color || "#F20000" }; n.addColor(i, "color0").name("颜色 0").onChange((e) => { this.colorStops[0] && (this.colorStops[0].color = this.numberToHex(e)), this.updateTransferTexture(this.colorStops); }), n.addColor(i, "color1").name("颜色 1").onChange((e) => { this.colorStops[1] && (this.colorStops[1].color = this.numberToHex(e)), this.updateTransferTexture(this.colorStops); }), n.addColor(i, "color2").name("颜色 2").onChange((e) => { this.colorStops[2] && (this.colorStops[2].color = this.numberToHex(e)), this.updateTransferTexture(this.colorStops); }), n.addColor(i, "color3").name("颜色 3").onChange((e) => { this.colorStops[3] && (this.colorStops[3].color = this.numberToHex(e)), this.updateTransferTexture(this.colorStops); }), n.addColor(i, "color4").name("颜色 4").onChange((e) => { this.colorStops[4] && (this.colorStops[4].color = this.numberToHex(e)), this.updateTransferTexture(this.colorStops); }), n.add({ enabled: !1 }, "enabled").name("使用平滑过渡").onChange((e) => { this.useSmoothing.value = e ? 1 : 0; }), n.add(this.range, "value", 0, 1, .01).name("范围"), n.add(this.threshold, "value", 0, 1, .01).name("密度阈值"), n.add(this.opacity, "value", 0, 1, .01).name("不透明度").onChange((e) => {}), n.add(this.steps, "value", 0, 1e3, 1).name("光线步进次数"); let a = { mode: this.mode.value }; n.add(a, "mode", { 发射吸收模型: 0, 最小强度投影: 1, 最大强度投影: 2 }).name("渲染模式").onChange((e) => { this.mode.value = e; }), n.add({ regenerate: () => { let e = ef.generateVolumeData({ size: 256, rangeMin: 7, rangeMax: 51 }); this.updateVolumeData(e); } }, "regenerate").name("随机数据"), n.add(this.material, "blending", { 无: 0, 正常: 1, 加法: 2, 减法: 3, 乘法: 4, 自定义: 5 }).name("混合").onChange(() => { this.material.needsUpdate = !0; }), n.add(this.material, "transparent").name("透明性"), n.add(this.material, "forceSinglePass").name("强制单通道"), n.add(this.material, "depthTest").name("深度测试"), n.add(this.material, "depthWrite").name("深度缓冲"); let o = n.addFolder("裁剪平面"); o.add(this.clipMode, "value", { 三平面剖切: 0, 单平面旋转剖切: 1 }).name("剖切模式"), o.add(this.clipPlane.value, "x", -1, 1, .01).name("单平面法向 X"), o.add(this.clipPlane.value, "y", -1, 1, .01).name("单平面法向 Y"), o.add(this.clipPlane.value, "z", -1, 1, .01).name("单平面法向 Z"), o.add(this.clipPlane.value, "w", -2.5, 2.5, .01).name("单平面距离"), o.add(this.clipPlaneX.value, "w", -2.5, 2.5, .01).name("裁剪平面1 (X轴)"), o.add(this.clipPlaneY.value, "w", -2.5, 2.5, .01).name("裁剪平面2 (Y轴)"), o.add(this.clipPlaneZ.value, "w", -2.5, 2.5, .01).name("裁剪平面3 (Z轴)"), this.canvas && (this.canvas.style.position = "fixed", this.canvas.style.bottom = "10px", this.canvas.style.right = "10px", this.canvas.style.zIndex = "1000", this.canvas.style.border = "1px solid #ccc", document.body.appendChild(this.canvas)); } }; //#endregion //#region src/core/Viewer.ts Math.PI * .5; var cf = Math.PI, lf = { Vector2: e.Vector2, Vector3: e.Vector3, Vector4: e.Vector4, Quaternion: e.Quaternion, Matrix4: e.Matrix4, Spherical: e.Spherical, Box3: e.Box3, Sphere: e.Sphere, Raycaster: e.Raycaster }; ad.install({ THREE: lf }); var uf = class { events; resources; clipping; container; scene; sceneHelpers; perspectiveCamera; orthographicCamera; currentCameraType = "perspective"; renderer; animationFrameId; isInitialized; pipelineManager; selection; css2d; css3d; parametric; inspector = new $e(); ruptureEvents; emitter = new Kt(); options; modelNameMappings = /* @__PURE__ */ new Map(); rangeCullingManager; timer = new e.Timer(); perspectiveCameraControls; orthographicCameraControls; constructor(t, n = {}) { this.options = n, n.modelNameMappings && n.modelNameMappings.forEach((e) => { this.modelNameMappings.set(e.name, e.displayName); }), this.resources = new Hr(), this.container = null, this.scene = new e.Scene(), this.sceneHelpers = new e.Scene(), this.renderer = null, this.parametric = new gu(), this.animationFrameId = null, this.isInitialized = !1, this.initContainer(t), this.initRenderer(), this.timer.connect(document), window.aa = () => { this.scene.traverse((e) => { e.isMesh && (console.log(e), console.log(e.geometry.index), e.geometry.index || console.warn("❗ no index:", e)); }); }; } get camera() { return this.currentCameraType === "perspective" ? this.perspectiveCamera : this.orthographicCamera; } get cameraControls() { return this.currentCameraType === "perspective" ? this.perspectiveCameraControls : this.orthographicCameraControls; } initCameraControls() { let { width: t, height: n } = this.getSize(); this.perspectiveCamera = new e.PerspectiveCamera(60, t / n, .01, 18e3), this.orthographicCamera = new e.OrthographicCamera(t / -2, t / 2, n / 2, n / -2, .01, 18e3), this.perspectiveCameraControls = new ad(this.perspectiveCamera, this.renderer.domElement), this.orthographicCameraControls = new ad(this.orthographicCamera, this.renderer.domElement), this.perspectiveCameraControls.maxDistance = 30; let r = new e.Box3(new e.Vector3(-10, -10, -10), new e.Vector3(10, 10, 10)); if (this.perspectiveCameraControls.setBoundary(r), this.orthographicCameraControls.zoomTo(100, !1), this.orthographicCameraControls.minZoom = 60, this.orthographicCameraControls.setBoundary(r), this.options?.initCameraState) { let e = this.options.initCameraState.position, t = this.options.initCameraState.target; this.perspectiveCameraControls.setPosition(e.x, e.y, e.z).then(), this.perspectiveCameraControls.setTarget(t.x, t.y, t.z).then(), this.orthographicCameraControls.setPosition(e.x, e.y, e.z).then(), this.orthographicCameraControls.setTarget(t.x, t.y, t.z).then(); } else this.perspectiveCameraControls.setPosition(5, 5, 5).then(), this.perspectiveCameraControls.setTarget(0, 0, 0).then(), this.orthographicCameraControls.setPosition(5, 5, 5).then(), this.orthographicCameraControls.setTarget(0, 0, 0).then(); } initContainer(e) { if (Nr(e)) { let t = document.getElementById(e); if (t !== null) this.container = t; else throw Error(`当前没有找到 id 为 ${e} 的 div 标签`); } else this.container = e; } getSize() { let e = this.container; return { width: e.offsetWidth, height: e.offsetHeight }; } getSizeVector2() { let { width: t, height: n } = this.getSize(); return new e.Vector2(t, n); } initRenderer() { if (this.isInitialized) { console.warn("Viewer 已经初始化"); return; } this.renderer = new e.WebGPURenderer({ logarithmicDepthBuffer: !0, alpha: !1, depth: !0, antialias: !0, samples: 4 }), this.renderer.init().then(() => { this.renderer.setPixelRatio(window.devicePixelRatio), this.renderer.setSize(this.container.clientWidth, this.container.clientHeight), this.container.appendChild(this.renderer.domElement), this.isInitialized = !0, this.initCameraControls(), this.pipelineManager = new jl(this), this.css2d = new Nl(this), this.css3d = new Pl(this), this.clipping = new Dl(this, this.options.clipping), this.events = new Br(this), this.selection = new Ml(this), this.ruptureEvents = new od(this), this.rangeCullingManager = new sd(this), this.emitter.emit(Yt.INIT, null), Sl.register(this, !0), window.addEventListener("resize", this.handleResize), this.handleResize(), this.renderer.setAnimationLoop(this.animate.bind(this)); }); } openInspector() { this.renderer.inspector = this.inspector, this.inspector.init(), this.inspector.profiler.domElement.style.display = "block"; } closeInspector() { this.inspector.profiler.domElement.style.display = "none"; } handleResize = () => { if (!this.container || !this.renderer) return; let e = this.container.clientWidth, t = this.container.clientHeight; this.perspectiveCamera.aspect = e / t, this.perspectiveCamera.updateProjectionMatrix(), this.orthographicCamera.left = -e / 2, this.orthographicCamera.right = e / 2, this.orthographicCamera.top = t / 2, this.orthographicCamera.bottom = -t / 2, this.orthographicCamera.updateProjectionMatrix(), this.renderer.setSize(e, t); }; animate(e, t) { if (!this.renderer || !this.isInitialized) return; this.timer.update(); let n = this.timer.getDelta(); this.emitter.emit(Yt.BEFORE_RENDER, { delta: n }), this.cameraControls.update(n), this.pipelineManager.render(), this.css2d && this.css2d.render(), this.css3d && this.css3d.render(), this.emitter.emit(Yt.AFTER_RENDER, { delta: n }); } dispose() { this.isInitialized &&= (this.animationFrameId !== null && (cancelAnimationFrame(this.animationFrameId), this.animationFrameId = null), window.removeEventListener("resize", this.handleResize), this.renderer &&= (this.renderer.dispose(), this.container && this.renderer.domElement.parentNode === this.container && this.container.removeChild(this.renderer.domElement), null), this.scene.clear(), this.resources.dispose(), this.clipping.dispose(), this.pipelineManager &&= (this.pipelineManager.dispose(), null), this.selection && this.selection.dispose(), this.css2d &&= (this.css2d.dispose(), null), this.css3d &&= (this.css3d.dispose(), null), !1); } isReady() { return this.isInitialized; } getModelDisplayName(e) { return this.modelNameMappings.get(e) || e; } addModelNameMapping(e) { this.modelNameMappings.set(e.name, e.displayName); } addModelNameMappings(e) { e.forEach((e) => { this.modelNameMappings.set(e.name, e.displayName); }); } clearModelNameMappings() { this.modelNameMappings.clear(); } serializeObject(e) { let t = e.name || e.type, n = this.getModelDisplayName(t); return { uuid: e.uuid, name: t, displayName: n, hasMappedName: n !== t, type: e.type, parent: e.parent ? e.parent.uuid : null, children: e.children.map((e) => this.serializeObject(e)) }; } sceneToTreeJSON(e = this.scene) { return this.serializeObject(e); } serializeObjectFiltered(t = this.scene, n) { if (t.userData[Rr.SCENE_TREE_EXCLUDE] || Pr(t) || Lr(t)) return null; let r = []; for (let e of t.children) { let t = this.serializeObjectFiltered(e, n); t && r.push(t); } if (Ir(t)) return r.length === 0 || n && r.length === 0 ? null : { uuid: t.uuid, name: t.name || t.type, displayName: t.name || t.type, hasMappedName: !1, type: t.type, parent: t.parent ? t.parent.uuid : null, visible: t.visible, opacity: -1, isClippingGroup: !0, children: r }; let i = t.name || t.type, a = this.getModelDisplayName(i), o = a !== i; o && (t.userData.displayName = a, t.userData.hasMappedName = o); let s = { uuid: t.uuid, name: i, displayName: a, hasMappedName: o, type: t.type, parent: t.parent ? t.parent.uuid : null, visible: t.visible, opacity: -1, isClippingGroup: Ir(t) }; if (t instanceof e.Mesh || Fr(t)) { t.userData[Rr.SELECTION] || (t.userData[Rr.SELECTION] = !1), Reflect.set(s, "selectable", t.userData[Rr.SELECTION]); let e = zr.getOpacity(t); Reflect.set(s, "opacity", e); } if (n) { let e = t.name && t.name.includes(n), i = r.length > 0; if (!e && !i) return null; } return r.length > 0 && (s.children = r), s; } serializeSceneFiltered(e) { let t = []; for (let n of this.scene.children) { let r = this.serializeObjectFiltered(n, e); r && t.push(r); } return this.flattenClippingGroups(t); } sceneToTreeJSONFiltered(e = this.scene, t) { return this.serializeObjectFiltered(e, t); } getCameraState() { let t = { position: this.cameraControls.camera.position.clone(), target: this.cameraControls.getTarget(new e.Vector3()) }; return console.log(t), t; } setCameraState(e, t = !0) { return this.cameraControls.setLookAt(e.position.x, e.position.y, e.position.z, e.target.x, e.target.y, e.target.z, t); } resetCamera(e = !0) { if (this.options?.initCameraState) { let t = this.options.initCameraState.position, n = this.options.initCameraState.target; this.cameraControls.setLookAt(t.x, t.y, t.z, n.x, n.y, n.z, e); } else this.cameraControls.setLookAt(5, 5, 5, 0, 0, 0, e); } async switchCameraType(t) { if (this.currentCameraType === t) return; let n = this.cameraControls.getPosition(new e.Vector3()), r = this.cameraControls.getTarget(new e.Vector3()); if (this.currentCameraType = t, t === "orthographic") { let e = this.perspectiveCamera.fov; this.perspectiveCamera.far; let t = Math.tan(e / 2 * cf / 180) * 2 * n.distanceTo(n), r = t * this.perspectiveCamera.aspect; this.orthographicCamera.left = -r / 2, this.orthographicCamera.right = r / 2, this.orthographicCamera.top = t / 2, this.orthographicCamera.bottom = -t / 2, this.orthographicCamera.updateProjectionMatrix(); } await this.cameraControls.setLookAt(n.x, n.y, n.z, r.x, r.y, r.z, !1), this.emitter.emit(Yt.CAMERA_TYPE_CHANGED, { type: t }), this.handleResize(); } exportSceneToJSON() { return JSON.stringify(this.scene.toJSON()); } downloadSceneJSON(e = "scene.json") { let t = this.exportSceneToJSON(), n = new Blob([t], { type: "application/json" }), r = URL.createObjectURL(n), i = document.createElement("a"); i.href = r, i.download = e, document.body.appendChild(i), i.click(), document.body.removeChild(i), URL.revokeObjectURL(r); } getAllVolumeMesh() { return this.scene.getObjectsByProperty("isVolumeMesh", !0); } setTestBackground() { let e = Ne.x.mix(xe(1251115), xe(3216969)), t = Ne.distance(He(.5, 1)).oneMinus().mul(xe(810344)); this.scene.backgroundNode = e.add(t); } flattenClippingGroups(e) { let t = []; for (let n of e) if (n.isClippingGroup && n.children) { let e = this.flattenClippingGroups(n.children); t.push(...e); } else n.children &&= this.flattenClippingGroups(n.children), t.push(n); return t; } }; //#endregion export { Cl as CSGOperationType, wl as CSGOperator, El as ClippingPlane, Ko as CollisionDetector, au as CssType, tu as CubePanel, su as DExtrudeGeometry, uu as DrillingRobot, Jt as EventManagerEvents, cd as FaultSlip, nu as FlowLine, ld as FlowParticles, ud as FractureEffect, ou as HtmlPanel, ru as Icon, eu as LabelPosition, du as MiningRobot, lu as ParametricArch, Ll as ParametricBox, Il as ParametricCylinder, gu as ParametricManager, fu as ParametricPipe, pu as ParametricRing, Fl as ParametricSphere, mu as ParametricTorus, hu as ParametricWireframe, rf as PointCloud, tf as PointCloudTool, sd as RangeCullingManager, Bd as RaymarchingBox, Ld as RockDebris, Pd as RockDebrisModelSourceType, od as RuptureEventManager, dd as SeismicWave, Al as SelectionManagerEvents, iu as SpritePanel, zr as Tool, Rr as UserDataProperty, uf as Viewer, Yt as ViewerEvents, sf as VolumeMesh, Gd as VolumeNode, af as VolumeRenderMode, ef as VolumeTool, gd as createRock1Material, vd as createRock2Material, bd as createRock3Material, Sd as createRock4Material, wd as createRock5Material, Ed as createRock6Material, Od as createRock7Material, Ad as createRock8Material, md as createRockMaterial, of as isVolumeMesh, Rd as remap };