videx-3d
Version:
React 3D component library designed for sub surface visualizations in the browser
859 lines (846 loc) • 23.5 kB
JavaScript
var bt = Object.defineProperty;
var Pt = (t, n, r) => n in t ? bt(t, n, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[n] = r;
var Z = (t, n, r) => Pt(t, typeof n != "symbol" ? n + "" : n, r);
import { BufferGeometry as lt, BufferAttribute as L, Vector3 as U, Layers as Tt, MeshDepthMaterial as kt, RGBADepthPacking as It, WebGLRenderTarget as ft, UnsignedByteType as dt, ShaderMaterial as pt, OrthographicCamera as vt, Scene as Ft, PlaneGeometry as Et, Mesh as Ut, RGBAFormat as Dt, DataTexture as mt, LinearFilter as N } from "three";
import "comlink";
import Bt from "p-limit";
import Rt from "p-queue";
import { CurveInterpolator as Vt, EPS as zt } from "curve-interpolator";
import "three/src/math/MathUtils.js";
import "proj4";
const Ct = Bt(50), Lt = new Rt({ concurrency: 20 }), Y = (t) => Ct(t), hn = (t, n = 0) => Lt.add(t, { priority: n });
async function yn(t, n, r, e = !0, a) {
const [s, o] = await Y(
() => Promise.all([
r.get("wellbore-headers", t),
r.get("strat-columns", n)
])
);
if (!s || !o) return null;
const i = /* @__PURE__ */ new Map();
s.parent && e && (await Y(
() => r.query("wellbore-headers", { well: s.well })
)).forEach((d) => {
i.set(d.name, d);
});
const u = o.units.reduce(
(g, d) => (g.set(d.top, d), g.set(d.base, d), g),
/* @__PURE__ */ new Map()
), c = [], f = [], p = /* @__PURE__ */ new Set();
a = a === void 0 ? -1 / 0 : a;
let l = 1 / 0;
const m = async (g) => {
if (g.kickoffDepthMsl === null || g.kickoffDepthMsl < l) {
let d = null;
if (d = await Y(() => r.get("picks", g.id)), d) {
d = d.filter((h) => h.mdMsl <= l && h.mdMsl).sort((h, w) => w.mdMsl - h.mdMsl);
for (let h = 0; h < d.length; h++) {
const w = d[h];
if (w.mdMsl <= l && !p.has(w.id)) {
const T = u.get(w.pickIdentifier);
T ? (c.push({
pick: w,
unit: T
}), l = w.mdMsl) : f.push(w), p.add(w.id);
}
}
}
}
if (e && g.parent && l > a) {
g.kickoffDepthMsl !== null && (l = Math.min(l, g.kickoffDepthMsl));
const d = i.get(g.parent);
d && await m(d);
}
};
return await m(s), { matched: c, unmatched: f, wellbore: s };
}
function Mn(t, n = 1 / 0) {
const r = [];
if (!Array.isArray(t) || t.length < 2) return r;
let e = t.map((s) => ({
...s,
deleted: !1
}));
e.sort(
(s, o) => s.unit.level - o.unit.level || s.pick.mdMsl - o.pick.mdMsl || s.unit.topAge - o.unit.topAge
);
const a = () => {
let s = null;
const o = e.shift();
if (o) {
for (let i = 0; i < e.length; i++) {
const u = e[i];
if (o.unit.level < u.unit.level)
break;
if (u.unit.name === o.unit.name)
if (u.pick.pickIdentifier !== o.pick.pickIdentifier) {
e[i].deleted = !0, s = {
entry: o.pick,
exit: u.pick,
unit: o.unit
};
break;
} else
e[i].deleted = !0;
}
e = e.filter((i) => !i.deleted);
}
return s;
};
for (; e.length; ) {
const s = a();
s && s.entry.mdMsl !== s.exit.mdMsl && s.entry.mdMsl < n && (s.exit.mdMsl > n && (s.exit.mdMsl = n), r.push(s));
}
return r;
}
function An(t) {
if (!t.length) return [];
const n = [], r = [...t].sort(
(o, i) => o.entry.mdMsl - i.entry.mdMsl || o.unit.level - i.unit.level
), e = r[0], a = [e];
let s = e.entry.mdMsl;
for (let o = 1; o < r.length; o++) {
const i = r[o];
if (i.entry.mdMsl > s) {
const u = i.entry.mdMsl;
for (; a.length && s < u; ) {
const c = a.pop();
if (c.exit.mdMsl > s) {
const f = i.unit.level >= c.unit.level ? Math.min(c.exit.mdMsl, u) : c.exit.mdMsl;
n.push({
mdMslTop: s,
mdMslBottom: f,
unit: c.unit
}), s = f, c.exit.mdMsl > s && a.push(c);
}
}
s = Math.max(u, s);
}
a.push(i);
}
for (; a.length; ) {
const o = a.pop();
if (o.exit.mdMsl > s) {
const i = o.exit.mdMsl;
n.push({
mdMslTop: s,
mdMslBottom: i,
unit: o.unit
}), s = i;
}
}
return n;
}
function wn(t) {
const n = [], r = [...t].sort(
(s, o) => s.entry.mdMsl - o.entry.mdMsl || o.unit.level - s.unit.level
);
let e = null, a = -1 / 0;
for (let s = 0; s < r.length; s++) {
const o = r[s];
o.entry.mdMsl > a && (a = o.entry.mdMsl, e && e.exit.mdMsl < a && n.push({
color: e.unit.color,
name: e.unit.name,
type: "base",
mdMsl: e.exit.mdMsl,
tvdMsl: e.exit.tvdMsl,
level: e.unit.level
}), n.push({
color: o.unit.color,
name: o.unit.name,
type: "top",
mdMsl: a,
tvdMsl: o.entry.tvdMsl,
level: o.unit.level
}), e = o);
}
return e && n.push({
color: e.unit.color,
name: e.unit.name,
type: "base",
mdMsl: e.exit.mdMsl,
tvdMsl: e.exit.tvdMsl,
level: e.unit.level
}), n;
}
function j(t, n = 0, r = 1) {
return t < n ? n : t > r ? r : t;
}
function Nt(t, n, r) {
return r = j(r, 0, 1), (1 - r) * t + r * n;
}
function St(t, n, r) {
return (t - n) / (r - n);
}
function xn(t, n, r, e, a) {
const s = St(t, n, r);
return Nt(e, a, s);
}
const Gt = (t) => {
if (t < 0) return [0, 0, 0];
if (t > 16777.215) throw Error("Value out of range!");
const n = Math.round(t * 1e3), r = Math.floor(n / 65536), e = Math.floor(n / 256) - r * 256, a = Math.floor(n) - r * 65536 - e * 256;
return [r, e, a];
}, bn = Math.PI, ot = 2 * Math.PI, _t = Math.PI / 2, Pn = Math.PI / 4, Tn = Math.PI / 8;
function kn(t, n) {
for (; n < -Math.PI; )
n += ot;
for (; n > Math.PI; )
n -= ot;
const r = Math.atan2(t[1], t[0]), e = Math.tan(n);
let a;
n > -r && n <= r ? a = 1 : n > r && n <= Math.PI - r ? a = 2 : n > Math.PI - r || n <= -(Math.PI - r) ? a = 3 : a = 4;
const s = [0, 0];
let o = 1, i = 1;
switch (a) {
case 1:
i = -1;
break;
case 2:
i = -1;
break;
case 3:
o = -1;
break;
case 4:
o = -1;
break;
}
return a === 1 || a === 3 ? (s[0] += o * (t[0] / 2), s[1] += i * (t[0] / 2) * e) : (s[0] += o * (t[1] / (2 * e)), s[1] += i * (t[1] / 2)), s;
}
function In(t) {
return t[0] = -t[0], t[1] = -t[1], t[2] = -t[2], t;
}
function vn(t, n) {
return [t[n], t[n + 1], t[n + 2]];
}
function Fn(t, n, r) {
t[n] = r[0], t[n + 1] = r[1], t[n + 2] = r[2];
}
function En(t, n) {
return [t[0] + n[0], t[1] + n[1], t[2] + n[2]];
}
function it(t, n) {
return [t[0] - n[0], t[1] - n[1], t[2] - n[2]];
}
function Un(t, n) {
return t[0] = t[0] * n, t[1] = t[1] * n, t[2] = t[2] * n, t;
}
function jt(t) {
const n = t[0] ** 2 + t[1] ** 2 + t[2] ** 2;
return n > 0 ? Math.sqrt(n) : 0;
}
function k(t, n) {
return [
t[1] * n[2] - t[2] * n[1],
t[2] * n[0] - t[0] * n[2],
t[0] * n[1] - t[1] * n[0]
];
}
function K(t, n) {
return t[0] * n[0] + t[1] * n[1] + t[2] * n[2];
}
function S(t) {
const n = Math.sqrt(t[0] * t[0] + t[1] * t[1] + t[2] * t[2]);
return t[0] = t[0] / n, t[1] = t[1] / n, t[2] = t[2] / n, t;
}
function Dn(t, n, r = 0.5) {
const e = 1 - r;
return [
t[0] * e + n[0] * r,
t[1] * e + n[1] * r,
t[2] * e + n[2] * r
];
}
function qt(t) {
return [
t[0],
t[1],
t[2]
];
}
function Bn(t, n) {
const r = Math.sqrt((t[0] ** 2 + t[1] ** 2 + t[2] ** 2) * (n[0] ** 2 + n[1] ** 2 + n[2] ** 2));
if (r === 0) return _t;
const e = K(t, n) / r;
return Math.acos(j(e, -1, 1));
}
function gt(t, n = [0, 1, 0], r = 0) {
const e = Math.cos(r), a = Math.sin(r), s = 1 - e, o = t[0], i = t[1], u = t[2], c = n[0], f = n[1], p = n[2], l = s * c, m = s * f;
return [
(l * c + e) * o + (l * f - a * p) * i + (l * p + a * f) * u,
(l * f + a * p) * o + (m * f + e) * i + (m * p - a * c) * u,
(l * p - a * f) * o + (m * p + a * c) * i + (s * p * p + e) * u
];
}
function Rn(t, n) {
return [t[n], t[n + 1]];
}
function Vn(t, n, r) {
t[n] = r[0], t[n + 1] = r[1];
}
function zn(t) {
const n = Math.sqrt(t[0] * t[0] + t[1] * t[1]);
return t[0] = t[0] / n, t[1] = t[1] / n, t;
}
function Cn(t, n) {
return [t[0] + n[0], t[1] + n[1]];
}
function Ln(t, n) {
return [t[0] - n[0], t[1] - n[1]];
}
function Nn(t) {
return t[0] = -t[0], t[1] = -t[1], t;
}
function Sn(t, n) {
return t[0] = t[0] * n, t[1] = t[1] * n, t;
}
function Gn(t) {
const n = t[0] ** 2 + t[1] ** 2;
return n > 0 ? Math.sqrt(n) : 0;
}
function _n(t, n, r = 0.5) {
const e = 1 - r;
return [
t[0] * e + n[0] * r,
t[1] * e + n[1] * r
];
}
function Ot(t, n = !1) {
const r = {
alpha: 1,
tension: 0,
closed: n
}, e = new Vt(t, r);
return {
getPointAt: (s) => e.getPointAt(s),
getPoints: (s, o = 0, i = 1) => e.getPoints(s, null, o, i),
getTangentAt: (s) => e.getTangentAt(s),
getNormalAt: (s) => e.getNormalAt(s),
getBoundingBox: (s = 0, o = 1) => {
const i = e.getBoundingBox(s, o);
return {
min: i.min,
max: i.max
};
},
nearest: (s) => {
const o = e.getNearestPosition(s);
return {
position: o.u,
point: o.point,
distance: o.distance
};
},
get length() {
return e.length;
},
closed: n
};
}
function jn(t, n) {
const r = n.length, e = new Array(r);
if (!e.length) return [];
n.forEach((c, f) => {
e[f] = {
curvePosition: c,
position: t.getPointAt(c),
tangent: t.getTangentAt(c),
normal: [0, 0, 0],
binormal: [0, 0, 0]
};
});
let a = [0, 1, 0], s = Math.abs(e[0].tangent[1]);
const o = Math.abs(e[0].tangent[0]), i = Math.abs(e[0].tangent[2]);
o <= s && (s = o, a = [1, 0, 0]), i <= s && (a = [0, 0, 1]);
let u = S(k(e[0].tangent, a));
e[0].normal = k(e[0].tangent, u), e[0].binormal = k(e[0].tangent, e[0].normal);
for (let c = 1; c < n.length; c++) {
if (u = k(e[c - 1].tangent, e[c].tangent), e[c].normal = qt(e[c - 1].normal), jt(u) > zt) {
S(u);
const f = Math.acos(j(K(e[c - 1].tangent, e[c].tangent), -1, 1));
e[c].normal = gt(e[c - 1].normal, u, f);
}
e[c].binormal = k(e[c].tangent, e[c].normal);
}
return e;
}
function qn(t, n = 0, r = 1, e = 0.1, a = 0) {
const s = [], o = t.length, i = Math.ceil(e * o), u = 1 / i, c = 1 / (o * 0.01);
a && (a *= 0.1), s.push(n);
let f = a ? t.getTangentAt(n) : null;
const p = Math.floor(n * i);
let l = n;
for (let m = p; m <= i; m++) {
const g = m * u, d = g - l, h = a ? t.getTangentAt(g) : null;
g > n && g < r && (d >= c || !a || Math.abs(K(f, h)) < 1 - a) && (s.push(g), f = h, l = g);
}
return s.push(r), s;
}
function G(t) {
if (t.constructor === Uint8Array) return "Uint8Array";
if (t.constructor === Uint16Array) return "Uint16Array";
if (t.constructor === Uint32Array) return "Uint32Array";
if (t.constructor === Int8Array) return "Int8Array";
if (t.constructor === Int16Array) return "Int16Array";
if (t.constructor === Int32Array) return "Int32Array";
if (t.constructor === Float32Array) return "Float32Array";
if (t.constructor === Float64Array) return "Float64Array";
throw Error("Unsupported typed array!");
}
function _(t, n) {
switch (n) {
case "Uint8Array":
return new Uint8Array(t);
case "Uint16Array":
return new Uint16Array(t);
case "Uint32Array":
return new Uint32Array(t);
case "Int8Array":
return new Int8Array(t);
case "Int16Array":
return new Int16Array(t);
case "Int32Array":
return new Int32Array(t);
case "Float32Array":
return new Float32Array(t);
case "Float64Array":
return new Float64Array(t);
default:
throw Error("Unsupported typed array!");
}
}
function $t(t, n = 1) {
return { buffer: t.buffer, attributeType: G(t), itemSize: n };
}
function On(t) {
const n = [], r = {
drawRange: t.drawRange || { start: 0, count: 1 / 0 },
groups: t.groups || [],
attributes: {},
index: t.index,
indexType: t.index ? G(t.index) : void 0,
userData: t.userData ? structuredClone(t.userData) : void 0
};
for (const e in t.attributes)
r.attributes[e] = $t(t.attributes[e].array, t.attributes[e].itemSize), n.push(r.attributes[e].buffer);
return [r, n];
}
function Ht(t) {
const n = [], r = {
drawRange: t.drawRange,
groups: t.groups,
attributes: {},
index: void 0,
indexType: void 0
}, e = t.getIndex();
e && (r.index = e.array.buffer, r.indexType = G(e.array));
for (const a in t.attributes) {
const s = t.getAttribute(a);
r.attributes[a] = { buffer: s.array.buffer, attributeType: G(s.array), itemSize: s.itemSize }, n.push(r.attributes[a].buffer);
}
return t.userData && (r.userData = structuredClone(t.userData)), [r, n];
}
function $n(t) {
const n = {}, r = [];
for (const e in t) {
const a = t[e], s = Ht(a);
n[e] = s[0], s[1].length && r.push(...s[1]);
}
return { data: n, transferrables: r };
}
function Hn(t) {
const n = new lt();
if (t.index) {
const r = _(t.index, t.indexType || "Uint32Array"), e = new L(r, 1);
n.setIndex(e);
}
for (const r in t.attributes) {
const e = new L(
_(t.attributes[r].buffer, t.attributes[r].attributeType),
t.attributes[r].itemSize
);
n.setAttribute(r, e);
}
return n.drawRange = t.drawRange, n.groups = t.groups, t.userData && (n.userData = t.userData), n;
}
function Wn(t) {
const n = {};
for (const r in t) {
const e = new lt();
if (t[r].index) {
const a = _(t[r].index, t[r].indexType || "Uint32Array"), s = new L(a, 1);
e.setIndex(s);
}
for (const a in t[r].attributes) {
const s = new L(
_(t[r].attributes[a].buffer, t[r].attributes[a].attributeType),
t[r].attributes[a].itemSize
);
e.setAttribute(a, s);
}
e.drawRange = t[r].drawRange, e.groups = t[r].groups, n[r] = e;
}
return n;
}
const Q = "camera-set-position", J = "camera-focus-point";
class Zn extends CustomEvent {
constructor(n) {
super(Q, { detail: n });
}
}
class Yn extends CustomEvent {
constructor(n) {
super(J, { detail: n });
}
}
const M = new U(), y = new U(), I = new U(), v = new U(), ct = new U();
async function Wt(t, n, r) {
const e = Math.min(r.distance, n);
return M.set(...t), r.getPosition(y), I.subVectors(M, y), n = Math.min(I.length() * 1.5, e), I.normalize(), y.copy(M).addScaledVector(I, -e), r.setLookAt(y.x, y.y, y.z, M.x, M.y, M.z, !0);
}
function Zt(t, n) {
v.set(...t), n.getTarget(M), ct.subVectors(M, v), n.getPosition(y), y.sub(ct), n.setPosition(y.x, y.y, y.z), n.setTarget(v.x, v.y, v.z);
}
class Yt {
constructor() {
Z(this, "controls", null);
Z(this, "removeEventlisteners", null);
this.setControls = this.setControls.bind(this);
}
addEventListeners() {
const n = (e) => {
this.controls && Zt(e.detail, this.controls);
}, r = (e) => {
if (this.controls) {
const a = e.detail.callback;
Wt(
e.detail.point,
e.detail.distance || 200,
this.controls
).then(() => {
a && a();
});
}
};
addEventListener(Q, n), addEventListener(J, r), this.removeEventlisteners = () => {
removeEventListener(Q, n), removeEventListener(J, r);
};
}
async setTarget(n) {
const r = this.controls;
return r ? (M.set(...n), r.getPosition(y), I.subVectors(M, y), I.normalize(), r.setLookAt(y.x, y.y, y.z, M.x, M.y, M.z, !0)) : null;
}
setControls(n) {
this.controls = n, this.removeEventlisteners && this.removeEventlisteners(), this.addEventListeners();
}
dispose() {
this.controls = null, this.removeEventlisteners && this.removeEventlisteners();
}
}
const Qn = new Yt(), Qt = {
NOT_EMITTER: 29,
// can be used to exclude an object from being used as an event emitter
EMITTER: 30,
// used internally to flag an object as an event emitter
OCCLUDER: 31
// object will be considered in occlusion checks in the annotations system
};
function Jn(...t) {
const n = new Tt();
return t.forEach((r) => n.enable(r)), n;
}
const Jt = new kt({ depthPacking: It }), B = 255 / 256, R = new Float32Array([
B,
B / 256,
B / 256 ** 2,
B / 256 ** 3
]);
function Kt(t, n, r, e) {
return t / 255 * R[0] + n / 255 * R[1] + r / 255 * R[2] + e / 255 * R[3];
}
let x = null, P = null, F = null;
async function Kn(t, n, r, e, a) {
const s = r.layers.mask;
if (r.layers.disableAll(), r.layers.set(Qt.OCCLUDER), (!x || x.width !== e || x.height !== a) && (x == null || x.dispose(), P = new Uint8Array(4 * e * a), F = new Float32Array(e * a), x = new ft(e, a, {
type: dt
})), t.setRenderTarget(x), n.overrideMaterial = Jt, t.clear(), t.render(n, r), n.overrideMaterial = null, t.setRenderTarget(null), r.layers.mask = s, await t.readRenderTargetPixelsAsync(
x,
0,
0,
e,
a,
P
), P && F)
for (let o = 0; o < F.length; o++) {
const i = o * 4, u = Kt(
P[i],
P[i + 1],
P[i + 2],
P[i + 3]
);
F[o] = u * 2 - 1;
}
return F;
}
var Xt = `#include <common>
varying vec2 vUv;
void main() {
vUv = uv;
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
}`, tn = `#include <common>
#include <packing>
varying vec2 vUv;
uniform sampler2D depthTexture;
uniform float cameraFar;
uniform float cameraNear;
float linearizeDepth(in float depth) {
float a = cameraFar / (cameraFar - cameraNear);
float b = cameraFar * cameraNear / (cameraNear - cameraFar);
return a + b / depth;
}
float reconstructDepth(const in float depth) {
return pow(2.0, depth * log2(cameraFar + 1.0)) - 1.0;
}
float getDepth(vec2 uv) {
float depth = texture2D(depthTexture, uv).x;
#if defined( USE_LOGDEPTHBUF )
return linearizeDepth(reconstructDepth(depth));
#else
return texture2D(depthTexture, uv).x;
#endif
}
void main() {
gl_FragColor = packDepthToRGBA(getDepth(vUv));
}`;
class nn extends pt {
constructor() {
super({
vertexShader: Xt,
fragmentShader: tn,
uniforms: {
cameraNear: { value: 0 },
cameraFar: { value: 1 },
depthTexture: { value: null },
cameraWasPerspective: { value: null }
},
toneMapped: !1,
depthWrite: !1,
depthTest: !1
});
}
}
const V = 255 / 256, z = new Float32Array([
V,
V / 256,
V / 256 ** 2,
V / 256 ** 3
]);
function ut(t) {
return t[0] / 255 * z[0] + t[1] / 255 * z[1] + t[2] / 255 * z[2] + t[3] / 255 * z[3];
}
const en = new vt(-1, 1, 1, -1, 0, 1), E = new nn(), ht = new Ft(), rn = new Et(2, 2), sn = new Ut(rn, E);
let b = null, A = null;
ht.add(sn);
async function Xn(t, n, r, e) {
if (!t) return null;
try {
const { width: a, height: s } = t.image;
if ((!b || !A || b.width !== a || b.height !== s) && (b == null || b.dispose(), A = new Uint8Array(4 * a * s), b = new ft(a, s, {
type: dt,
format: Dt,
depthBuffer: !1,
stencilBuffer: !1
})), E.uniforms.depthTexture.value = t, E.uniforms.cameraNear.value = r.near, E.uniforms.cameraFar.value = r.far, E.uniforms.cameraWasPerspective.value = r.isPerspectiveCamera, n.setRenderTarget(b), n.clear(), n.render(ht, en), n.setRenderTarget(null), await n.readRenderTargetPixelsAsync(
b,
0,
// x
0,
// y
a,
s,
A
), e !== void 0 && Number.isFinite(e)) {
const o = [
A[e],
A[e + 1],
A[e + 2],
A[e + 3]
];
return ut(o) * 2 - 1;
} else {
const o = new Array(A.length / 4);
for (let i = 0; i < o.length; i++) {
const u = i * 4, c = [
A[u],
A[u + 1],
A[u + 2],
A[u + 3]
];
o[i] = ut(c) * 2 - 1;
}
return o;
}
} catch (a) {
return console.error(a), null;
}
}
function C(t, n, r) {
const e = it(t, n), a = it(t, r);
return S(k(e, a));
}
function te(t, n = -1) {
const r = new Uint8Array(t.length * 4);
for (let e = 0; e < t.length; e++) {
const a = t[e], s = a === n ? [0, 0, 0] : Gt(a), o = e * 4;
r[o] = s[0], r[o + 1] = s[1], r[o + 2] = s[2], r[o + 3] = a === -1 ? 0 : 255;
}
return r;
}
function ne(t, n, r, e, a = 0, s = -1) {
const o = t.length / n, i = n - 1, u = o - 1, c = new Uint8Array(i * u * 4);
let f = 0;
const p = (l, m) => t[m * n + l];
for (let l = 0; l < u; l++) {
const m = l + 1, g = l + 0.5;
for (let d = 0; d < i; d++) {
const h = d + 1, w = d + 0.5, T = p(d, l);
if (T !== s) {
const X = p(d, m), tt = p(h, l), nt = p(h, m), yt = (T + X + tt + nt) / 4, et = [d * r, l * e, T], rt = [d * r, m * e, X], st = [h * r, l * e, tt], at = [h * r, m * e, nt], D = [w * r, g * e, yt], q = C(D, et, st), O = C(D, st, at), $ = C(D, at, rt), H = C(D, rt, et), Mt = S([
q[0] + O[0] + $[0] + H[0],
q[2] + O[2] + $[2] + H[2],
q[1] + O[1] + $[1] + H[1]
]), W = gt(Mt, [0, 1, 0], a * (Math.PI / 180)), At = Math.floor((W[0] + 1) / 2 * 255), wt = Math.floor((W[1] + 1) / 2 * 255), xt = Math.floor((W[2] + 1) / 2 * 255);
c[f] = At, c[f + 1] = wt, c[f + 2] = xt, c[f + 3] = 255;
} else
c[f] = 0, c[f + 1] = 0, c[f + 2] = 0, c[f + 3] = 0;
f += 4;
}
}
return c;
}
function ee(t, n, r) {
const e = new mt(t, n, r);
return e.minFilter = N, e.magFilter = N, e.flipY = !0, e.anisotropy = 4, e.needsUpdate = !0, e;
}
function re(t, n, r) {
const e = new mt(t, n, r);
return e.minFilter = N, e.magFilter = N, e.needsUpdate = !0, e.flipY = !0, e;
}
function se(t, n) {
if (!n || n.length < 2 * 4) return null;
const [r, , e] = n, a = new Array(n.length / 4);
for (let p = 0, l = 0; p < a.length; p++, l += 4)
a[p] = [
n[l] - r,
-n[l + 1],
e - n[l + 2]
];
const s = Ot(a, !1);
if (!s) return null;
const o = n[3], i = n[n.length - 1], u = i - o, c = (p, l = !1) => {
let m = (p - o) / u;
return l && (m = j(m, 0, 1)), m < 0 || m > 1 ? null : m;
};
return {
id: t,
curve: s,
get measuredLength() {
return u;
},
get measuredTop() {
return o;
},
get measuredBottom() {
return i;
},
getPositionAtDepth: c,
getPointAtDepth: (p, l = !1) => {
const m = c(p, l);
return m !== null ? s.getPointAt(m) : null;
}
};
}
var an = `varying vec2 vUv;
void main() {
vUv = uv;
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
}`, on = `varying vec2 vUv;
void main() {
gl_FragColor = vec4(vUv, 1.0, 1.0);
}`;
const ae = new pt({
vertexShader: an,
fragmentShader: on
});
export {
Un as $,
wn as A,
Ot as B,
Zn as C,
G as D,
_ as E,
$t as F,
On as G,
Ht as H,
$n as I,
Wn as J,
Yt as K,
Qt as L,
Qn as M,
C as N,
te as O,
Pn as P,
ne as Q,
Nt as R,
St as S,
ot as T,
xn as U,
Gt as V,
In as W,
vn as X,
Fn as Y,
En as Z,
it as _,
_t as a,
jt as a0,
k as a1,
K as a2,
Dn as a3,
qt as a4,
Bn as a5,
gt as a6,
Rn as a7,
Vn as a8,
Cn as a9,
Nn as aa,
Sn as ab,
Gn as ac,
nn as ad,
ae,
bn as b,
Tn as c,
j as d,
kn as e,
S as f,
Kn as g,
yn as h,
Mn as i,
An as j,
se as k,
Jn as l,
_n as m,
zn as n,
re as o,
ee as p,
hn as q,
Xn as r,
Ln as s,
Y as t,
Hn as u,
Q as v,
J as w,
qn as x,
jn as y,
Yn as z
};