@figurosity/consumer-three-dimension-tool 0.2.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,52 +1,46 @@
1
1
  (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".tool-reset-button .qbtn{color:#333;font-weight:700}.debug-color{max-width:100px}.debug-color .swatch{height:20px;width:20px;border-radius:10px;border:1px solid #333}.debug-color .label{font-weight:700}.debug-value span{margin-top:2px;min-width:60px;font-size:11px}.debug-vector{min-width:130px}.debug-vector>div{font-size:10px}.debug-vector>div>span{min-width:20px;font-weight:700}.debug-boolean .indicator{margin-top:6px;margin-right:4px;height:10px;width:10px;border-radius:10px;border:1px solid #333;display:inline-block;background:red}.debug-boolean .indicator.on{background:#adff2f}.debug3D{position:absolute;z-index:14400;top:20px;left:40px;padding:20px;border:1px solid #ccc;border-radius:10px;background-color:#ffffffb3}.debug3D .color-square{display:inline-block;height:15px;width:15px;margin-bottom:-3px;border:1px dotted black}.three-dimension-tool{position:fixed;top:0;left:0;right:0;bottom:0;z-index:100}.three-dimension-tool .tres{width:100%;height:100vh}")),document.head.appendChild(e)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}})();
2
- import { nextTick as Ht, watch as O, ref as ee, onUnmounted as Rt, computed as v, onMounted as Xt, openBlock as Je, createElementBlock as Yt, createCommentVNode as ht, createElementVNode as Qt, onBeforeMount as Wt, defineComponent as $, h, inject as Jt, useModel as eo, onBeforeUnmount as to, createBlock as it, unref as at, withCtx as ct, createVNode as oo, mergeModels as so } from "vue";
3
- import { Platform as ft, useQuasar as no, QBtn as Ot, QSeparator as Fe } from "quasar";
4
- import { CBaseButton as ne, CColorPickerPopup as qt, CExpansion as rt, CToggle as Ke, CSlider as dt, CDraggableDrawer as Qe, CBaseButtons as ro, CDraggableDrawers as lo, CToolPage as io } from "@figurosity/consumer-controls";
5
- import { defineStore as de, storeToRefs as I, getActivePinia as ao } from "pinia";
6
- import * as M from "three";
7
- import tt from "lodash.isequal";
2
+ import { watch as O, ref as pe, nextTick as ns, onUnmounted as _t, computed as C, onMounted as jt, openBlock as nt, createElementBlock as rs, createCommentVNode as vt, createElementVNode as is, onBeforeMount as as, defineComponent as R, h as d, inject as xt, useModel as ls, onBeforeUnmount as cs, createBlock as mt, unref as ft, withCtx as ht, createVNode as us, mergeModels as ds } from "vue";
3
+ import { useQuasar as ps, QBtn as Ut, QSeparator as Ie, Platform as ms } from "quasar";
4
+ import { CBaseButton as Ce, CColorPickerPopup as fs, CExpansion as We, CToggle as Ot, CSlider as Ke, CBaseButtons as $t, CDraggableDrawer as Pe, CDraggableDrawers as hs, CToolPage as gs } from "@figurosity/consumer-controls";
5
+ import { defineStore as Xe, storeToRefs as $, getActivePinia as bs } from "pinia";
6
+ import * as I from "three";
7
+ import Ze from "lodash.isequal";
8
+ import { SKINS as ye, COLORS as se, GRID as Se, LIGHTS as de, RELATED as xe, getConfig as vs, useDynamicImages as ys, DEFAULT as Nt } from "@figurosity/toolbox";
9
+ import { OrbitControls as Ss } from "three/examples/jsm/controls/OrbitControls.js";
8
10
  import "three/examples/jsm/loaders/RGBELoader.js";
9
- import { DEFAULT as ot, COLORS as oe, GRID as xe, LIGHTS as ve, RELATED as we } from "@figurosity/toolbox";
10
- import { OrbitControls as co } from "three/examples/jsm/controls/OrbitControls.js";
11
- import { mergeVertices as Bt, mergeGeometries as uo } from "three/examples/jsm/utils/BufferGeometryUtils.js";
12
- import { RoundedBoxGeometry as po } from "three/examples/jsm/geometries/RoundedBoxGeometry.js";
13
- import { GLTFLoader as mo } from "three/examples/jsm/loaders/GLTFLoader.js";
14
- import { DRACOLoader as ho } from "three/examples/jsm/loaders/DRACOLoader.js";
15
- function be(e) {
16
- const t = e.startsWith("#") ? e.slice(1) : e;
17
- return parseInt(t, 16);
18
- }
19
- function ce(e) {
20
- return `#${e.toString(16).padStart(6, "0")}`;
21
- }
22
- const ut = new M.Vector3(), Mt = (e) => {
23
- const t = new M.Box3().setFromObject(e);
11
+ import { RoomEnvironment as xs } from "three/examples/jsm/environments/RoomEnvironment.js";
12
+ import { mergeVertices as Bt, mergeGeometries as Cs } from "three/examples/jsm/utils/BufferGeometryUtils.js";
13
+ import { RoundedBoxGeometry as ws } from "three/examples/jsm/geometries/RoundedBoxGeometry.js";
14
+ import { GLTFLoader as Es } from "three/examples/jsm/loaders/GLTFLoader.js";
15
+ import { DRACOLoader as Is } from "three/examples/jsm/loaders/DRACOLoader.js";
16
+ const Ms = "tool:switched", Ds = "pose:viewed", Ts = "skin:changed", gt = new I.Vector3(), zt = (e) => {
17
+ const t = new I.Box3().setFromObject(e);
24
18
  console.log("box", t);
25
- const o = t.getSize(new M.Vector3()), s = new M.Vector3(
19
+ const s = t.getSize(new I.Vector3()), i = new I.Vector3(
26
20
  (t.min.x + t.max.x) / 2,
27
21
  (t.min.y + t.max.y) / 2,
28
22
  (t.min.z + t.max.z) / 2
29
23
  );
30
- console.log("center", s);
31
- let n = t.min.y;
32
- return console.log("bottom", n), Math.abs(n) < -0.01 && (n = fo(e)), console.log("bottom", n), {
24
+ console.log("center", i);
25
+ let r = t.min.y;
26
+ return console.log("bottom", r), Math.abs(r) < -0.01 && (r = ks(e)), console.log("bottom", r), {
33
27
  box: t,
34
- size: o,
35
- center: s,
36
- bottom: n,
28
+ size: s,
29
+ center: i,
30
+ bottom: r,
37
31
  top: t.max.y
38
32
  };
39
- }, fo = (e) => {
33
+ }, ks = (e) => {
40
34
  let t = 1 / 0;
41
- return e.updateMatrixWorld(!0), e.traverse((o) => {
42
- var n, r;
43
- if (!o.isMesh) return;
44
- const s = (r = (n = o.geometry) == null ? void 0 : n.attributes) == null ? void 0 : r.position;
45
- if (s)
46
- for (let l = 0; l < s.count; l++)
47
- ut.fromBufferAttribute(s, l), ut.applyMatrix4(o.matrixWorld), t = Math.min(t, ut.y);
35
+ return e.updateMatrixWorld(!0), e.traverse((s) => {
36
+ var r, n;
37
+ if (!s.isMesh) return;
38
+ const i = (n = (r = s.geometry) == null ? void 0 : r.attributes) == null ? void 0 : n.position;
39
+ if (i)
40
+ for (let o = 0; o < i.count; o++)
41
+ gt.fromBufferAttribute(i, o), gt.applyMatrix4(s.matrixWorld), t = Math.min(t, gt.y);
48
42
  }), t;
49
- }, _t = (e) => ({
43
+ }, Ht = (e) => ({
50
44
  box: {
51
45
  min: {
52
46
  x: e.box.min.x,
@@ -71,72 +65,33 @@ const ut = new M.Vector3(), Mt = (e) => {
71
65
  },
72
66
  bottom: e.bottom,
73
67
  top: e.top
74
- }), go = "smooth", vo = [
75
- "#141111",
76
- "#3E251E",
77
- "#633C30",
78
- "#A56F57",
79
- "#CC9E86",
80
- "#543F2E",
81
- "#7C5B48",
82
- "#98775B",
83
- "#AD8B6B",
84
- "#BFA282",
85
- "#794524",
86
- "#8F603E",
87
- "#B08057",
88
- "#D7A56F",
89
- "#F7DBA2",
90
- "#673E28",
91
- "#C5815E",
92
- "#D59671",
93
- "#EFB698",
94
- "#F5D2C0",
95
- "#6E453A",
96
- "#996C5E",
97
- "#C88D7D",
98
- "#E7B09E",
99
- "#EEC1AE",
100
- "#432B26",
101
- "#88635A",
102
- "#BA8C82",
103
- "#EBBAB6",
104
- "#F7D2C8",
105
- "#796362",
106
- "#8F7277",
107
- "#C399A0",
108
- "#E3C7CB",
109
- "#E6D1D2",
110
- "#684C4B",
111
- "#98807B",
112
- "#BDACA8",
113
- "#DACDC9",
114
- "#E5E4E3"
115
- ], bo = (e) => ({
68
+ }), qt = "smooth", As = (e) => ({
116
69
  id: e.id,
117
70
  uuid: e.uuid ?? null,
118
71
  basePoseId: e.basePoseId ?? null,
119
72
  skinId: e.skinId ?? null,
73
+ // Skin slug — host overrides the row's own `slug` (basePose slug) with
74
+ // the resolved skin slug before sending the envelope, so the lib can
75
+ // read this field to drive the skin selector.
76
+ slug: e.slug ?? null,
120
77
  poseId: e.poseId ?? null,
121
78
  url: e.glbPathWebp || e.glbPath || null,
122
- color: e.color ?? 16777215,
123
79
  bounds: e.bounds ?? null
124
- }), ye = de("3d-glbs", {
80
+ }), me = Xe("3d-glbs", {
125
81
  state: () => ({
126
- models: {},
127
- palette: vo
82
+ models: {}
128
83
  }),
129
84
  getters: {
130
85
  selectedId() {
131
- return p().selected;
86
+ return A().selected;
132
87
  },
133
88
  poseId(e) {
134
- var o, s;
135
- const t = p().selected;
136
- return (s = (o = e.models) == null ? void 0 : o[t]) == null ? void 0 : s.poseId;
89
+ var s, i;
90
+ const t = A().selected;
91
+ return (i = (s = e.models) == null ? void 0 : s[t]) == null ? void 0 : i.poseId;
137
92
  },
138
93
  model(e) {
139
- const t = p().selected;
94
+ const t = A().selected;
140
95
  return t && e.models[t] ? e.models[t] : null;
141
96
  },
142
97
  url() {
@@ -146,232 +101,341 @@ const ut = new M.Vector3(), Mt = (e) => {
146
101
  bounds() {
147
102
  var e;
148
103
  return (e = this.model) == null ? void 0 : e.bounds;
149
- },
150
- color() {
151
- var e;
152
- return ((e = this.model) == null ? void 0 : e.color) || 16777215;
153
- },
154
- colorHex() {
155
- var e;
156
- return (e = this.model) != null && e.color ? ce(this.model.color) : "#fefefe";
157
- },
158
- changed(e) {
159
- var o, s, n, r;
160
- const t = p().selected;
161
- return (s = (o = e.models) == null ? void 0 : o[t]) != null && s.color ? ((r = (n = e.models) == null ? void 0 : n[t]) == null ? void 0 : r.color) !== 16777215 : !1;
162
104
  }
163
105
  },
164
106
  actions: {
165
- resetColor() {
166
- const e = p().selected;
167
- this.models[e] && (this.models[e].color = 16777215);
168
- },
169
107
  setBounds(e) {
170
- const t = p().selected;
171
- this.models[t] && (this.models[t].bounds = _t(e));
172
- },
173
- setColorHex(e) {
174
- const t = p().selected;
175
- this.models[t] && (this.models[t].color = be(e));
108
+ const t = A().selected;
109
+ this.models[t] && (this.models[t].bounds = Ht(e));
176
110
  },
177
111
  setSubjectsFromResponse(e) {
178
- var s;
179
- const t = ((s = e == null ? void 0 : e.entities) == null ? void 0 : s.glb) || {}, o = {};
180
- return Object.keys(t).forEach((n) => {
181
- o[n] = bo(t[n]);
182
- }), this.models = { ...this.models, ...o }, this.selectDefaultGlbId(e);
112
+ var i;
113
+ const t = ((i = e == null ? void 0 : e.entities) == null ? void 0 : i.glb) || {}, s = {};
114
+ return Object.keys(t).forEach((r) => {
115
+ s[r] = As(t[r]);
116
+ }), this.models = { ...this.models, ...s }, this.selectDefaultGlbId(e);
183
117
  },
184
118
  // Picks the GLB id whose skin slug matches DEFAULT_SKIN_SLUG, falls
185
119
  // back to result.glb[0], or null when no GLBs are available.
186
120
  selectDefaultGlbId(e) {
187
- var l, a, c;
188
- const t = Array.isArray((l = e == null ? void 0 : e.result) == null ? void 0 : l.glb) ? e.result.glb : [];
121
+ var o, l, a;
122
+ const t = Array.isArray((o = e == null ? void 0 : e.result) == null ? void 0 : o.glb) ? e.result.glb : [];
189
123
  if (t.length === 0) return null;
190
- const o = ((a = e == null ? void 0 : e.entities) == null ? void 0 : a.skins) || {}, s = ((c = e == null ? void 0 : e.entities) == null ? void 0 : c.glb) || {}, r = t.find((u) => {
191
- var b, f;
192
- const g = (b = s[u]) == null ? void 0 : b.skinId;
193
- return g != null && ((f = o[g]) == null ? void 0 : f.slug) === go;
124
+ const s = ((l = e == null ? void 0 : e.entities) == null ? void 0 : l.skins) || {}, i = ((a = e == null ? void 0 : e.entities) == null ? void 0 : a.glb) || {}, n = t.find((u) => {
125
+ var D, w;
126
+ const p = (D = i[u]) == null ? void 0 : D.skinId;
127
+ return p != null && ((w = s[p]) == null ? void 0 : w.slug) === qt;
194
128
  }) ?? t[0];
195
- return typeof r == "string" ? parseInt(r, 10) : r;
129
+ return typeof n == "string" ? parseInt(n, 10) : n;
196
130
  }
197
131
  }
198
- }), gt = { visible: !0, opacity: 1, color: 16711422, texture: "none" }, kt = (e = {}) => ({ ...gt, ...e }), Ve = de("3d-ground", {
132
+ });
133
+ function Ye(e) {
134
+ const t = e.startsWith("#") ? e.slice(1) : e;
135
+ return parseInt(t, 16);
136
+ }
137
+ function ue(e) {
138
+ return `#${e.toString(16).padStart(6, "0")}`;
139
+ }
140
+ const Qe = ({
141
+ storeId: e,
142
+ defaultValues: t = {},
143
+ state: s = {},
144
+ getters: i = {},
145
+ actions: r = {},
146
+ keyBy: n = "selected"
147
+ }) => Xe(e, {
199
148
  state: () => ({
149
+ loading: !1,
200
150
  models: {},
201
- offset: -0.75
151
+ ...s
202
152
  }),
203
153
  getters: {
204
- changed(e) {
205
- var o, s;
206
- const t = p().selected;
207
- return ((s = (o = e.models) == null ? void 0 : o[t]) == null ? void 0 : s.color) !== 16711422;
154
+ keyId() {
155
+ return A()[n];
208
156
  },
209
- property() {
210
- return (e, t = null) => {
211
- var o;
212
- return ((o = this.selectedModel) == null ? void 0 : o[e]) ?? t;
213
- };
157
+ model(o) {
158
+ return o.models[A()[n]];
214
159
  },
215
- selectedId() {
216
- return p().selected;
160
+ exists(o) {
161
+ return typeof o.models[A()[n]] < "u";
217
162
  },
218
- selectedModel(e) {
219
- const t = this.selectedId;
220
- return e.models[t] ?? null;
163
+ selectedModel(o) {
164
+ return o.models[A()[n]] ?? null;
221
165
  },
222
166
  mergedModel() {
223
- return { ...gt, ...this.selectedModel ?? {} };
167
+ return { ...t, ...this.selectedModel ?? {} };
224
168
  },
225
- model(e) {
226
- const o = p().selected;
227
- return o && e.models[o] ? e.models[o] : null;
169
+ propertyById(o) {
170
+ return (l, a, u = null) => o.models[l] && a in o.models[l] ? o.models[l][a] : u;
228
171
  },
229
- color() {
230
- return this.mergedModel.color;
231
- },
232
- colorHex() {
233
- return ce(this.mergedModel.color);
172
+ propertyChangedById() {
173
+ return (o, l) => this.propertyById(o, l) !== t[l];
234
174
  },
235
- opacity() {
236
- return this.mergedModel.opacity;
175
+ propertyChanged(o) {
176
+ const l = A()[n];
177
+ return (a) => o.models[l] ? this.propertyById(l, a) !== t[a] : !1;
237
178
  },
238
- texture() {
239
- return this.mergedModel.texture;
179
+ property() {
180
+ const o = A()[n];
181
+ return (l, a = t[l]) => this.propertyById(o, l, a);
240
182
  },
241
- visible() {
242
- return this.mergedModel.visible;
243
- }
183
+ ...i
244
184
  },
245
185
  actions: {
246
- reset() {
247
- const e = p().selected;
248
- this.models[e] = kt();
186
+ initModel(o) {
187
+ o != null && (typeof this.models[o] < "u" || this.$patch((l) => {
188
+ l.models[o] = { ...t };
189
+ }));
249
190
  },
250
191
  ensureSelectedModel() {
251
- const e = p().selected;
252
- return this.models[e] || (this.models[e] = { ...gt }), this.models[e];
253
- },
254
- patchSelected(e) {
255
- const t = this.ensureSelectedModel();
256
- Object.assign(t, e);
192
+ const o = A()[n];
193
+ return o == null ? null : (this.models[o] || (this.models[o] = { ...t }), this.models[o]);
257
194
  },
258
- setProperty(e, t) {
259
- const o = this.ensureSelectedModel();
260
- o[e] = t;
195
+ setPropertyById(o, l, a) {
196
+ o != null && (this.models[o] || this.initModel(o), this.$patch({
197
+ models: {
198
+ [o]: { ...this.models[o], [l]: a }
199
+ }
200
+ }));
261
201
  },
262
- setColor(e) {
263
- this.setProperty("color", e);
202
+ setProperty(o, l) {
203
+ const a = A()[n];
204
+ a != null && (this.models[a] || this.initModel(a), this.$patch({
205
+ models: {
206
+ [a]: { ...this.models[a], [o]: l }
207
+ }
208
+ }));
264
209
  },
265
- setColorHex(e) {
266
- this.setProperty("color", be(e));
210
+ patchSelected(o) {
211
+ const l = this.ensureSelectedModel();
212
+ l && Object.assign(l, o);
267
213
  },
268
- setTexture(e) {
269
- this.setProperty("texture", e);
214
+ reset() {
215
+ const o = A()[n];
216
+ o != null && this.$patch((l) => {
217
+ l.models[o] = { ...t };
218
+ });
270
219
  },
271
- setVisible(e) {
272
- this.setProperty("visible", e);
220
+ resetProperty(o) {
221
+ const l = A()[n];
222
+ l != null && this.models[l] && this.$patch({
223
+ models: {
224
+ [l]: {
225
+ ...this.models[l],
226
+ [o]: t[o]
227
+ }
228
+ }
229
+ });
273
230
  },
274
- setGroundFromResponse(e) {
275
- this.models[e] || (this.models[e] = kt());
276
- }
231
+ ...r
232
+ }
233
+ }), Kt = {
234
+ visible: !0,
235
+ opacity: 1,
236
+ color: 16711422,
237
+ texture: "none"
238
+ }, Bs = {
239
+ changed() {
240
+ return this.exists ? !Ze(this.mergedModel, Kt) : !1;
241
+ },
242
+ color() {
243
+ return this.property("color");
244
+ },
245
+ colorHex() {
246
+ return ue(this.property("color"));
247
+ },
248
+ opacity() {
249
+ return this.property("opacity");
250
+ },
251
+ texture() {
252
+ return this.property("texture");
253
+ },
254
+ visible() {
255
+ return this.property("visible");
277
256
  }
278
- }), Xe = {
257
+ }, zs = {
258
+ init() {
259
+ this.initModel(this.keyId);
260
+ },
261
+ setColor(e) {
262
+ this.setProperty("color", e);
263
+ },
264
+ setColorHex(e) {
265
+ this.setProperty("color", Ye(e));
266
+ },
267
+ setTexture(e) {
268
+ this.setProperty("texture", e);
269
+ },
270
+ setVisible(e) {
271
+ this.setProperty("visible", e);
272
+ }
273
+ }, Ve = Qe({
274
+ storeId: "3d-ground",
275
+ defaultValues: Kt,
276
+ state: { offset: -0.75 },
277
+ getters: Bs,
278
+ actions: zs,
279
+ keyBy: "basePoseId"
280
+ }), Ls = {
279
281
  color: 16777215,
280
282
  visible: !0,
281
283
  debug: !1,
282
284
  shadow: !0,
283
- opacity: 1,
284
285
  visualization: !0
285
- }, pt = (e = {}) => ({ ...Xe, ...e }), ge = {
286
+ }, Be = 0, te = 1, yt = 1.25, St = 3, et = (e, t, s) => Math.max(t, Math.min(s, e)), Ps = 1.25, ze = (e = {}) => ({ ...Ls, ...e }), Ae = {
286
287
  advanced: !1,
287
288
  move: !1,
288
289
  position: { x: 0, y: 0, z: 1.5 },
289
290
  quaternion: { x: 0, y: 0, z: 0, w: 1 },
290
291
  target: { x: 0, y: 0, z: 0 }
291
- }, Et = (e = {}) => ({ ...ge, ...e }), Be = de("3d-lights", {
292
+ }, Lt = ["advanced", "move"], tt = (e = {}) => ({ ...Ae, ...e }), Vs = {
293
+ ambientScale: te,
294
+ userScale: te
295
+ }, st = (e = {}) => ({ ...Vs, ...e }), bt = () => ({
296
+ key: ze(),
297
+ fill: ze({ shadow: !0 }),
298
+ back: ze({ shadow: !0 })
299
+ }), fe = Xe("3d-lights", {
292
300
  state: () => ({
293
301
  lights: {},
294
302
  options: {},
303
+ scales: {},
304
+ seeds: {},
305
+ // basePoseId -> true once frameToBounds + syncToStore have landed
306
+ // on this basePose's lights rig. Explicit flag rather than an
307
+ // inferred sentinel so the bounds watcher's framing decision
308
+ // doesn't depend on whether option fields happen to look default.
309
+ framed: {},
295
310
  collection: ["key", "fill", "back"],
296
311
  debug: !1
297
312
  }),
298
313
  getters: {
314
+ bpId() {
315
+ return A().basePoseId;
316
+ },
317
+ skinId() {
318
+ return A().selected;
319
+ },
320
+ // The reset button reflects "user has tweaked something on the
321
+ // active skin." Toggles + rig are per-basePose; sliders are
322
+ // per-skin. Rig-orbit fields are written by syncToStore every
323
+ // animate tick and would otherwise read as "changed" immediately
324
+ // after the GLB loads, so they're excluded — only the user-visible
325
+ // toggles + the active skin's slider values count.
299
326
  changed(e) {
300
- const o = p().selected, s = !tt(e.options[o], ge), n = {
301
- key: { ...Xe },
302
- fill: { ...Xe },
303
- back: { ...Xe }
304
- }, r = !tt(e.lights[o], n);
305
- return s || r;
327
+ const t = e.options[this.bpId];
328
+ if (t && Lt.some((i) => !Ze(t[i], Ae[i])))
329
+ return !0;
330
+ const s = e.scales[this.skinId];
331
+ return !!(s && (s.ambientScale !== te || s.userScale !== te));
332
+ },
333
+ // Has frameToBounds + syncToStore landed on this basePose's
334
+ // lights rig? Set by markFramed() from the bounds watcher in
335
+ // ThreeDimensionTool. Used by the GLB load path: a basePose the
336
+ // user has already framed applies the persisted rig instead of
337
+ // reframing on every skin swap.
338
+ hasRig(e) {
339
+ return !!e.framed[this.bpId];
306
340
  },
307
341
  move(e) {
308
- var s;
309
- const o = p().selected;
310
- return ((s = e.options[o]) == null ? void 0 : s.move) || !1;
342
+ var t;
343
+ return ((t = e.options[this.bpId]) == null ? void 0 : t.move) || !1;
311
344
  },
312
345
  advancedMode(e) {
346
+ var t;
347
+ return ((t = e.options[this.bpId]) == null ? void 0 : t.advanced) || !1;
348
+ },
349
+ // Re-clamp on read so persisted values from a session before the
350
+ // per-source ceilings landed (when both maxed at 2.0) don't sit
351
+ // above the new AMBIENT_SCALE_MAX / USER_SCALE_MAX.
352
+ ambientScale(e) {
313
353
  var s;
314
- const o = p().selected;
315
- return ((s = e.options[o]) == null ? void 0 : s.advanced) || !1;
354
+ const t = ((s = e.scales[this.skinId]) == null ? void 0 : s.ambientScale) ?? te;
355
+ return et(t, Be, yt);
316
356
  },
317
- position(e) {
357
+ userScale(e) {
318
358
  var s;
319
- const o = p().selected;
320
- return ((s = e.options[o]) == null ? void 0 : s.position) || ge.position;
359
+ const t = ((s = e.scales[this.skinId]) == null ? void 0 : s.userScale) ?? te;
360
+ return et(t, Be, St);
361
+ },
362
+ position(e) {
363
+ var t;
364
+ return ((t = e.options[this.bpId]) == null ? void 0 : t.position) || Ae.position;
321
365
  },
322
366
  quaternion(e) {
323
- var s;
324
- const o = p().selected;
325
- return ((s = e.options[o]) == null ? void 0 : s.quaternion) || ge.quaternion;
367
+ var t;
368
+ return ((t = e.options[this.bpId]) == null ? void 0 : t.quaternion) || Ae.quaternion;
326
369
  },
327
370
  target(e) {
328
- var s;
329
- const o = p().selected;
330
- return ((s = e.options[o]) == null ? void 0 : s.target) || ge.target;
371
+ var t;
372
+ return ((t = e.options[this.bpId]) == null ? void 0 : t.target) || Ae.target;
331
373
  },
332
374
  radius(e) {
333
- var s;
334
- const o = p().selected;
335
- return ((s = e.options[o]) == null ? void 0 : s.radius) || ge.radius;
375
+ var t;
376
+ return (t = e.options[this.bpId]) == null ? void 0 : t.radius;
336
377
  },
337
378
  property(e) {
338
- return (t, o = null, s = null) => {
339
- const r = p().selected;
340
- return !e.lights[r] || !e.lights[r][t] || !(o in e.lights[r][t]) ? s : e.lights[r][t][o];
379
+ return (t, s = null, i = null) => {
380
+ const r = e.lights[this.bpId];
381
+ return !r || !r[t] || !(s in r[t]) ? i : r[t][s];
341
382
  };
342
383
  },
343
384
  colorHex(e) {
344
385
  return (t) => {
345
- const s = p().selected;
346
- return !e.lights[s] || !e.lights[s][t] ? "#ffffff" : ce(e.lights[s][t].color);
386
+ const s = e.lights[this.bpId];
387
+ return !s || !s[t] ? "#ffffff" : ue(s[t].color);
347
388
  };
348
389
  },
349
390
  lightKeys(e) {
350
- const o = p().selected;
351
- return Object.keys(e.lights[o]);
391
+ return Object.keys(e.lights[this.bpId] || {});
352
392
  },
353
- isVisible(e) {
354
- return (t) => e.move && (this.advancedMode === !0 && this.property(t, "visible") || t === "key");
393
+ isVisible() {
394
+ return () => this.move;
355
395
  }
356
396
  },
357
397
  actions: {
358
398
  reset() {
359
- const e = p().selected;
360
- this.options[e] = { ...ge }, this.collection.forEach(
361
- (t) => this.lights[e][t] = { ...Xe }
362
- );
399
+ const e = this.bpId, t = this.skinId;
400
+ if (e == null) return;
401
+ this.options[e] || (this.options[e] = tt()), Lt.forEach((i) => this.options[e][i] = Ae[i]), t != null && (this.scales[t] || (this.scales[t] = st()), this.scales[t].ambientScale = te, this.scales[t].userScale = te);
402
+ const s = this.seeds[t];
403
+ s ? this.lights[e] = {
404
+ key: { ...s.key },
405
+ fill: { ...s.fill },
406
+ back: { ...s.back }
407
+ } : this.lights[e] = bt();
408
+ },
409
+ // Seed per-skin lights from the recipe and warm the per-basePose
410
+ // user-state buckets if absent. The recipe is always rewritten
411
+ // (different skin = different intensities); lights[bpId] and
412
+ // options[bpId] are only initialized on first entry into the
413
+ // basePose bucket so user state — color picks, rig position —
414
+ // survives subsequent skin swaps within the same basePose.
415
+ // scales[skinId] is per-skin and warmed once per skin.
416
+ seedFromRecipe(e, t) {
417
+ const s = ((t == null ? void 0 : t.spotIntensity) ?? 1) * Ps, i = (t == null ? void 0 : t.ambientIntensity) ?? 0, r = (t == null ? void 0 : t.envIntensity) ?? 1;
418
+ this.seeds[e] = {
419
+ key: ze({ intensity: s }),
420
+ fill: ze({ intensity: s, shadow: !0 }),
421
+ back: ze({ intensity: s, shadow: !0 }),
422
+ ambient: { intensity: i },
423
+ env: { intensity: r }
424
+ }, e != null && !this.scales[e] && (this.scales[e] = st());
425
+ const n = this.bpId;
426
+ n != null && (this.lights[n] || (this.lights[n] = bt()), this.options[n] || (this.options[n] = tt()));
363
427
  },
364
428
  ensureSelectedOptions() {
365
- const e = p().selected;
366
- return this.options[e] || (this.options[e] = { ...ge }), this.options[e];
429
+ const e = this.bpId;
430
+ return e == null ? null : (this.options[e] || (this.options[e] = tt()), this.options[e]);
367
431
  },
368
- patchSelected(e) {
369
- const t = this.ensureSelectedOptions();
370
- Object.assign(t, e);
432
+ ensureSelectedScales() {
433
+ const e = this.skinId;
434
+ return e == null ? null : (this.scales[e] || (this.scales[e] = st()), this.scales[e]);
371
435
  },
372
436
  setControlProperty(e, t) {
373
- const o = this.ensureSelectedOptions();
374
- o[e] = t;
437
+ const s = this.ensureSelectedOptions();
438
+ s && (s[e] = t);
375
439
  },
376
440
  setPosition(e) {
377
441
  this.setControlProperty("position", e);
@@ -386,169 +450,152 @@ const ut = new M.Vector3(), Mt = (e) => {
386
450
  this.setControlProperty("radius", e);
387
451
  },
388
452
  setMove(e = !1) {
389
- const o = p().selected;
390
- this.options[o].move = e;
453
+ this.initLights();
454
+ const t = this.ensureSelectedOptions();
455
+ t && (t.move = e);
391
456
  },
392
457
  setAdvanced(e = !1) {
393
- const o = p().selected;
458
+ const t = this.bpId;
459
+ if (t == null) return;
460
+ const s = this.ensureSelectedOptions();
461
+ if (!s) return;
394
462
  if (e === !0) {
395
- this.options[o].advanced = !0;
463
+ s.advanced = !0;
396
464
  return;
397
465
  }
398
- this.options[o].advanced = !1;
399
- const s = this.lights[o].key;
400
- this.lightKeys.forEach((n) => {
401
- n !== "key" && (this.lights[o][n].color = s.color);
466
+ s.advanced = !1;
467
+ const i = this.lights[t];
468
+ if (!i) return;
469
+ const r = i.key;
470
+ this.collection.forEach((n) => {
471
+ n !== "key" && (i[n].color = r.color);
402
472
  });
403
473
  },
404
- setControlOptions(e, t, o = null) {
405
- o === null && (o = p().selected), this.options[o] || (this.options[o] = Et());
406
- const s = e.position.clone(), n = e.quaternion.clone(), r = t.target.clone();
407
- this.options[o].position = { x: s.x, y: s.y, z: s.z }, this.options[o].quaternion = { x: n.x, y: n.y, z: n.z, w: n.w }, this.options[o].target = { x: r.x, y: r.y, z: r.z };
408
- },
409
474
  setColorHex(e, t) {
410
- var l;
411
- const s = p().selected, n = this.lights[s], r = be(t);
412
- if (((l = this.options[s]) == null ? void 0 : l.advanced) === !0) {
413
- n[e].color = r;
475
+ var n;
476
+ this.initLights();
477
+ const s = this.bpId;
478
+ if (s == null) return;
479
+ const i = this.lights[s];
480
+ if (!i) return;
481
+ const r = Ye(t);
482
+ if (((n = this.options[s]) == null ? void 0 : n.advanced) === !0) {
483
+ i[e].color = r;
414
484
  return;
415
485
  }
416
- this.collection.forEach((a) => {
417
- n[a].color = r;
486
+ this.collection.forEach((o) => {
487
+ i[o].color = r;
418
488
  });
419
489
  },
420
- setProperty(e, t, o) {
421
- const n = p().selected;
422
- this.lights[n][e][t] = o;
490
+ setProperty(e, t, s) {
491
+ this.initLights();
492
+ const i = this.bpId;
493
+ if (i == null) return;
494
+ const r = this.lights[i];
495
+ r && (r[e][t] = s);
496
+ },
497
+ setAmbientScale(e) {
498
+ this.initLights();
499
+ const t = this.ensureSelectedScales();
500
+ t && (t.ambientScale = et(e, Be, yt));
501
+ },
502
+ setUserScale(e) {
503
+ this.initLights();
504
+ const t = this.ensureSelectedScales();
505
+ t && (t.userScale = et(e, Be, St));
423
506
  },
424
507
  initLights() {
425
- const t = p().selected;
426
- this.lights[t] || (this.lights[t] = {
427
- key: pt(),
428
- fill: pt({ shadow: !0 }),
429
- back: pt({ shadow: !0 })
430
- }), this.options[t] || (this.options[t] = Et());
508
+ const e = this.bpId, t = this.skinId;
509
+ t != null && !this.scales[t] && (this.scales[t] = st()), e != null && (this.lights[e] || (this.lights[e] = bt()), this.options[e] || (this.options[e] = tt()));
510
+ },
511
+ markFramed() {
512
+ const e = this.bpId;
513
+ e != null && (this.framed[e] = !0);
431
514
  }
432
515
  }
433
- }), Ye = {
516
+ }), Wt = {
434
517
  position: { x: 0, y: 0.39999999999999986, z: 1.5 },
435
518
  quaternion: { x: -0.12993279108591813, y: 0, z: 0, w: 0.9915228034698058 },
436
519
  target: { x: 0, y: 0, z: 0 },
437
520
  radius: 1.5
438
- }, At = (e = {}) => ({ ...Ye, ...e }), Ct = de("3d-controls", {
439
- state: () => ({
440
- models: {}
441
- }),
442
- getters: {
443
- changed(e) {
444
- var s;
445
- const o = p().selected;
446
- return (s = e.models) != null && s[o] ? !tt(e.models[o], Ye) : !1;
447
- },
448
- property() {
449
- return (e, t = null) => {
450
- var o;
451
- return ((o = this.selectedModel) == null ? void 0 : o[e]) ?? t;
452
- };
453
- },
454
- selectedId() {
455
- return p().selected;
456
- },
457
- selectedModel(e) {
458
- const t = this.selectedId;
459
- return e.models[t] ?? null;
460
- },
461
- mergedModel() {
462
- return { ...Ye, ...this.selectedModel ?? {} };
463
- },
464
- position() {
465
- return this.mergedModel.position;
466
- },
467
- quaternion() {
468
- return this.mergedModel.quaternion;
469
- },
470
- target() {
471
- return this.mergedModel.target;
472
- },
473
- radius() {
474
- return this.mergedModel.radius;
475
- }
521
+ }, Rs = {
522
+ changed() {
523
+ return this.exists ? !Ze(this.mergedModel, Wt) : !1;
476
524
  },
477
- actions: {
478
- reset() {
479
- const e = p().selected;
480
- this.models[e] = { ...Ye };
481
- },
482
- ensureSelectedModel() {
483
- const e = p().selected;
484
- return this.models[e] || (this.models[e] = { ...Ye }), this.models[e];
485
- },
486
- patchSelected(e) {
487
- const t = this.ensureSelectedModel();
488
- Object.assign(t, e);
489
- },
490
- setProperty(e, t) {
491
- const o = this.ensureSelectedModel();
492
- o[e] = t;
493
- },
494
- setPosition(e) {
495
- this.setProperty("position", e);
496
- },
497
- setQuaternion(e) {
498
- this.setProperty("quaternion", e);
499
- },
500
- setTarget(e) {
501
- this.setProperty("target", e);
502
- },
503
- setRadius(e) {
504
- this.setProperty("radius", e);
505
- },
506
- setControlOptions(e, t, o = null) {
507
- o === null && (o = p().selected), this.models[o] || (this.models[o] = At());
508
- const s = e.position.clone(), n = e.quaternion.clone(), r = t.target.clone();
509
- this.models[o].position = { x: s.x, y: s.y, z: s.z }, this.models[o].quaternion = { x: n.x, y: n.y, z: n.z, w: n.w }, this.models[o].target = { x: r.x, y: r.y, z: r.z };
510
- },
511
- initControls() {
512
- const t = p().selected;
513
- t && !this.models[t] && (this.models[t] = At());
514
- }
525
+ // Has frameToBounds + syncToStore landed on this basePose's
526
+ // bucket? An explicit per-basePose flag, set by markFramed() from
527
+ // the bounds watcher in ThreeDimensionTool. We can't infer this by
528
+ // comparing position to defaults: applyFromStore normalizes the
529
+ // default direction and scales by radius, so syncToStore writes a
530
+ // position that's close to but not exactly equal to defaults, and
531
+ // happens every animate frame — by the time bounds arrive, a
532
+ // value-based check would already read "rigged" on a fresh basePose
533
+ // and skip the initial framing.
534
+ hasRig(e) {
535
+ return !!e.framed[this.keyId];
536
+ },
537
+ position() {
538
+ return this.mergedModel.position;
539
+ },
540
+ quaternion() {
541
+ return this.mergedModel.quaternion;
542
+ },
543
+ target() {
544
+ return this.mergedModel.target;
545
+ },
546
+ radius() {
547
+ return this.mergedModel.radius;
548
+ }
549
+ }, Gs = {
550
+ initControls() {
551
+ this.initModel(this.keyId);
552
+ },
553
+ markFramed() {
554
+ const e = this.keyId;
555
+ e != null && (this.framed[e] = !0);
556
+ },
557
+ setPosition(e) {
558
+ this.setProperty("position", e);
559
+ },
560
+ setQuaternion(e) {
561
+ this.setProperty("quaternion", e);
562
+ },
563
+ setTarget(e) {
564
+ this.setProperty("target", e);
565
+ },
566
+ setRadius(e) {
567
+ this.setProperty("radius", e);
515
568
  }
516
- }), vt = {
569
+ }, ct = Qe({
570
+ storeId: "3d-controls",
571
+ defaultValues: Wt,
572
+ state: { framed: {} },
573
+ getters: Rs,
574
+ actions: Gs,
575
+ keyBy: "basePoseId"
576
+ }), Fs = {
517
577
  color: 16711422
518
- }, zt = (e = {}) => ({ ...vt, ...e }), lt = de("3d-scene", {
519
- state: () => ({
520
- models: {}
521
- }),
522
- getters: {
523
- changed(e) {
524
- var s, n;
525
- const o = p().selected;
526
- return ((n = (s = e.models) == null ? void 0 : s[o]) == null ? void 0 : n.color) !== 16711422;
527
- },
528
- colorHex(e) {
529
- var n;
530
- const o = p().selected, s = (n = e.models[o]) == null ? void 0 : n.color;
531
- return ce(s || vt.color);
532
- }
578
+ }, _s = {
579
+ changed() {
580
+ return this.propertyChanged("color");
533
581
  },
534
- actions: {
535
- reset() {
536
- const t = p().selected;
537
- this.models[t] = { ...vt };
538
- },
539
- selectedId() {
540
- return p().selected;
541
- },
542
- setColorHex(e) {
543
- const o = p().selected;
544
- this.models[o] || (this.models[o] = zt()), this.models[o].color = be(e);
545
- },
546
- init() {
547
- const t = p().selected;
548
- this.models[t] || (this.models[t] = zt());
549
- }
582
+ colorHex() {
583
+ return ue(this.property("color"));
550
584
  }
551
- }), Te = {
585
+ }, js = {
586
+ init() {
587
+ this.initModel(this.keyId);
588
+ },
589
+ setColorHex(e) {
590
+ this.setProperty("color", Ye(e));
591
+ }
592
+ }, ut = Qe({
593
+ storeId: "3d-scene",
594
+ defaultValues: Fs,
595
+ getters: _s,
596
+ actions: js,
597
+ keyBy: "basePoseId"
598
+ }), Xt = {
552
599
  show: !1,
553
600
  front: !1,
554
601
  back: !1,
@@ -558,90 +605,34 @@ const ut = new M.Vector3(), Mt = (e) => {
558
605
  bottom: !1,
559
606
  divisions: 6,
560
607
  opacity: 0.5,
561
- size: 2,
562
- lineColor: 13421772,
563
- centerLineColor: 16711680
564
- }, yo = (e = {}) => ({ ...Te, ...e }), Me = de("3d-grid", {
565
- state: () => ({
566
- models: {}
567
- }),
568
- getters: {
569
- changed(e) {
570
- const o = p().selected;
571
- return console.log("state.models[id]", e.models[o]), console.log("defaults", Te), !tt(e.models[o], Te);
572
- },
573
- property() {
574
- return (e, t = null) => {
575
- var o;
576
- return ((o = this.selectedModel) == null ? void 0 : o[e]) ?? t;
577
- };
578
- },
579
- selectedId() {
580
- return p().selected;
581
- },
582
- selectedModel(e) {
583
- const t = this.selectedId;
584
- return e.models[t] ?? null;
585
- },
586
- mergedModel() {
587
- return { ...Te, ...this.selectedModel ?? {} };
588
- },
589
- show() {
590
- return this.mergedModel.show;
591
- },
592
- lineColor() {
593
- return this.mergedModel.lineColor;
594
- },
595
- centerLineColor() {
596
- return this.mergedModel.centerLineColor;
597
- },
598
- opacity() {
599
- return this.mergedModel.opacity;
600
- },
601
- size() {
602
- return this.mergedModel.size;
603
- },
604
- divisions() {
605
- return this.mergedModel.divisions;
606
- },
607
- lineColorHex() {
608
- return ce(this.mergedModel.lineColor);
609
- },
610
- centerLineColorHex() {
611
- return ce(this.mergedModel.centerLineColor);
612
- }
608
+ size: 2
609
+ }, Us = {
610
+ changed() {
611
+ return !Ze(this.mergedModel, Xt);
613
612
  },
614
- actions: {
615
- reset() {
616
- const t = p().selected;
617
- this.models[t] = { ...Te }, Ht(() => {
618
- this.models[t].show = !1;
619
- });
620
- },
621
- ensureSelectedModel() {
622
- const e = p().selected;
623
- return this.models[e] || (this.models[e] = { ...Te }), this.models[e];
624
- },
625
- patchSelected(e) {
626
- const t = this.ensureSelectedModel();
627
- Object.assign(t, e);
628
- },
629
- setProperty(e, t) {
630
- const o = this.ensureSelectedModel();
631
- o[e] = t;
632
- },
633
- setLineColorHex(e) {
634
- this.setProperty("lineColor", be(e));
635
- },
636
- setCenterLineColorHex(e) {
637
- this.setProperty("centerLineColor", be(e));
638
- },
639
- init() {
640
- const t = p().selected;
641
- this.models[t] || (this.models[t] = yo());
642
- }
613
+ show() {
614
+ return this.property("show");
615
+ },
616
+ opacity() {
617
+ return this.property("opacity");
618
+ },
619
+ size() {
620
+ return this.property("size");
621
+ },
622
+ divisions() {
623
+ return this.property("divisions");
643
624
  }
644
- }), So = [
625
+ }, Os = {
626
+ init() {
627
+ this.initModel(this.keyId);
628
+ }
629
+ }, Ee = Qe({
630
+ storeId: "3d-grid",
631
+ defaultValues: Xt,
632
+ getters: Us,
633
+ actions: Os,
634
+ keyBy: "basePoseId"
635
+ }), $s = [
645
636
  "#141111",
646
637
  "#3E251E",
647
638
  "#633C30",
@@ -682,74 +673,60 @@ const ut = new M.Vector3(), Mt = (e) => {
682
673
  "#BDACA8",
683
674
  "#DACDC9",
684
675
  "#E5E4E3"
685
- ], bt = "background", et = "subject", yt = "ground", Tt = {
686
- [et]: 16711422,
687
- [bt]: 16777215,
688
- [yt]: 12961221
689
- }, Ut = de("3d-colors", {
690
- state: () => ({
691
- models: {},
692
- palette: So
693
- }),
694
- getters: {
695
- property() {
696
- return (e, t = null) => {
697
- var o;
698
- return ((o = this.selectedModel) == null ? void 0 : o[e]) ?? t;
699
- };
700
- },
701
- selectedId() {
702
- return p().selected;
703
- },
704
- selectedModel(e) {
705
- const t = this.selectedId;
706
- return e.models[t] ?? null;
707
- },
708
- mergedModel() {
709
- return { ...Tt, ...this.selectedModel ?? {} };
710
- },
711
- model(e) {
712
- const o = p().selected;
713
- return o && e.models[o] ? e.models[o] : null;
714
- },
715
- subjectHex() {
716
- return this.getHexColor(et);
717
- },
718
- groundHex() {
719
- return this.getHexColor(yt);
720
- },
721
- backgroundHex() {
722
- return this.getHexColor(bt);
723
- }
676
+ ], Ct = "background", wt = "subject", Et = "ground", Zt = {
677
+ [wt]: 16711422,
678
+ [Ct]: 16777215,
679
+ [Et]: 12961221
680
+ }, Ns = {
681
+ changed() {
682
+ return this.exists ? !Ze(this.mergedModel, Zt) : !1;
724
683
  },
725
- actions: {
726
- initModel(e) {
727
- this.models[e] = { ...Tt };
728
- },
729
- getHexColor(e) {
730
- const o = p().selected;
731
- if (!this.models[o] || !this.models[o][e]) return "#F0F0F0";
732
- const s = this.models[o][e];
733
- return ce(s);
734
- },
735
- setHexColor(e = et, t = "#e6e6e6") {
736
- const s = p().selected;
737
- !this.models[s] || !this.models[s][e] || (this.models[s][e] = be(t));
738
- },
739
- setSubjectHex(e) {
740
- this.setHexColor(et, e);
741
- },
742
- setGroundHex(e) {
743
- this.setHexColor(yt, e);
744
- },
745
- setBackgroundHex(e) {
746
- this.setHexColor(bt, e);
747
- }
684
+ subjectHex() {
685
+ return ue(this.property(wt));
686
+ },
687
+ groundHex() {
688
+ return ue(this.property(Et));
689
+ },
690
+ backgroundHex() {
691
+ return ue(this.property(Ct));
692
+ },
693
+ getHexColor() {
694
+ return (e) => ue(this.property(e, "#F0F0F0"));
695
+ }
696
+ }, Hs = {
697
+ setHexColor(e, t) {
698
+ this.setProperty(e, Ye(t));
699
+ },
700
+ setSubjectHex(e) {
701
+ this.setHexColor(wt, e);
702
+ },
703
+ setGroundHex(e) {
704
+ this.setHexColor(Et, e);
705
+ },
706
+ setBackgroundHex(e) {
707
+ this.setHexColor(Ct, e);
748
708
  }
749
- }), p = de("3d", {
709
+ }, It = Qe({
710
+ storeId: "3d-colors",
711
+ defaultValues: Zt,
712
+ state: { palette: $s },
713
+ getters: Ns,
714
+ actions: Hs,
715
+ keyBy: "basePoseId"
716
+ }), A = Xe("3d", {
750
717
  state: () => ({
751
718
  // models: {},
752
719
  selected: null,
720
+ // Identifies the per-session bucket for stores keyed by basePoseId
721
+ // (3d-grid, and future basePose-scoped 3D stores) so they survive
722
+ // skin/GLB swaps within the same basePose. Set in setFromResponse
723
+ // from the host envelope's result.basePoseId. Mirrors use360Store's
724
+ // basePoseId field — see GitHub #149 / #145.
725
+ basePoseId: null,
726
+ // Per-set thumbnail UUID from the host envelope. Used by the skins
727
+ // selector to render preview thumbnails against the dynamic-images
728
+ // server's /sets/{uuid}/.../{slug}.webp pattern.
729
+ setUuid: null,
753
730
  width: 0,
754
731
  height: 0,
755
732
  loaded: {
@@ -768,9 +745,8 @@ const ut = new M.Vector3(), Mt = (e) => {
768
745
  }),
769
746
  getters: {
770
747
  active(e) {
771
- var o, s;
772
- const t = ft.is.mobile ? ot : oe;
773
- return ((s = (o = this.models) == null ? void 0 : o[e.selected]) == null ? void 0 : s.active) || t;
748
+ var t, s;
749
+ return ((s = (t = this.models) == null ? void 0 : t[e.selected]) == null ? void 0 : s.active) || ye;
774
750
  },
775
751
  aspect(e) {
776
752
  return e.height > 0 ? e.width / e.height : 0;
@@ -793,120 +769,124 @@ const ut = new M.Vector3(), Mt = (e) => {
793
769
  },
794
770
  subscribe(e) {
795
771
  const t = this;
796
- e.$on("glb:loaded", (o) => {
797
- t.setFromResponse(o);
772
+ e.$on("glb:loaded", (s) => {
773
+ t.setFromResponse(s);
798
774
  });
799
775
  },
800
776
  setFromResponse(e) {
801
- var u;
802
- const t = Ut(), o = Ct(), s = Me(), n = Ve(), r = Be(), l = lt(), c = ye().setSubjectsFromResponse(e);
803
- if (c == null) {
777
+ var u, p, D;
778
+ const t = It(), s = ct(), i = Ee(), r = Ve(), n = fe(), o = ut(), a = me().setSubjectsFromResponse(e);
779
+ if (this.setUuid = ((u = e == null ? void 0 : e.result) == null ? void 0 : u.setUuid) ?? null, this.basePoseId = ((p = e == null ? void 0 : e.result) == null ? void 0 : p.basePoseId) ?? null, a == null) {
804
780
  this.selected = null;
805
781
  return;
806
782
  }
807
- this.selected = c, t.initModel(c), r.initLights(), n.setGroundFromResponse(c), o.initControls(), s.init(), l.init(), this.models[c] || (this.models[c] = {}), (u = this.models[c]) != null && u.active || (this.models[c].active = ft.is.mobile ? ot : oe);
783
+ this.selected = a, t.initModel(this.basePoseId), n.initLights(), r.init(), s.initControls(), i.init(), o.init(), this.models[a] || (this.models[a] = {}), (D = this.models[a]) != null && D.active || (this.models[a].active = ye);
808
784
  }
809
785
  }
810
786
  });
811
- let ie = null, Pe = null;
787
+ let J = null, Ge = null;
812
788
  const Le = () => {
813
- const e = p(), { aspect: t, width: o, height: s } = I(e), n = (a = { x: 0, y: 0.8, z: 1.5 }) => (console.debug("useCamera init"), ie ? (console.debug("view camera already inited"), ie) : (ie = new M.PerspectiveCamera(75, t.value, 0.1, 100), e.loaded.camera = !0, ie)), r = () => {
814
- if (ie)
815
- return ie;
789
+ const e = A(), { aspect: t, width: s, height: i } = $(e), r = (l = { x: 0, y: 0.8, z: 1.5 }) => (console.debug("useCamera init"), J ? (console.debug("view camera already inited"), J) : (J = new I.PerspectiveCamera(75, t.value, 0.1, 100), e.loaded.camera = !0, J)), n = () => {
790
+ if (J)
791
+ return J;
816
792
  };
817
- return Pe = O(
793
+ return Ge = O(
818
794
  () => t.value,
819
- (a) => {
820
- if (!ie) {
821
- n();
795
+ (l) => {
796
+ if (!J) {
797
+ r();
822
798
  return;
823
799
  }
824
- ie.aspect = a, ie.updateProjectionMatrix();
800
+ J.aspect = l, J.updateProjectionMatrix();
825
801
  }
826
802
  ), {
827
- init: n,
828
- getCamera: r,
803
+ init: r,
804
+ getCamera: n,
829
805
  dispose: () => {
830
- Pe == null || Pe(), Pe = null, ie = null;
806
+ Ge == null || Ge(), Ge = null, J = null;
831
807
  }
832
808
  };
833
809
  };
834
- let se = null;
835
- const st = () => {
836
- const e = ee(!1), t = ee({
810
+ let Q = null;
811
+ const rt = () => {
812
+ const e = pe(!1), t = pe({
837
813
  mode: null,
838
814
  camera: null,
839
815
  // camera (or your lights-camera)
840
816
  store: null
841
817
  // pinia store with position/quaternion/target
842
- }), o = (b, f = {}) => {
843
- if (console.debug("useOrbitControlsBase init"), se)
844
- return console.debug("controls already inited"), se;
845
- const E = new M.Object3D();
846
- return se = new co(E, b.domElement), n(f), se;
847
- }, s = () => {
848
- if (!se) throw new Error("OrbitControls not initialized");
849
- return se;
850
- }, n = (b = {}) => {
851
- const f = s();
852
- f.enableDamping = b.enableDamping ?? !0, f.dampingFactor = b.dampingFactor ?? 0.5, f.rotateSpeed = b.rotateSpeed ?? 0.2, f.enableZoom = b.enableZoom ?? !0, f.minDistance = b.minDistance ?? 0.5, f.maxDistance = b.maxDistance ?? 6;
853
- }, r = ({ mode: b, camera: f, store: E, options: D }) => {
854
- const y = s();
855
- if (!f) throw new Error(`setMode(${b}): camera is required`);
856
- if (!E) throw new Error(`setMode(${b}): store is required`);
857
- y.object = f, n(D), t.value = { mode: b, camera: f, store: E }, c(), y.update();
818
+ }), s = (h, f = {}) => {
819
+ if (console.debug("useOrbitControlsBase init"), Q)
820
+ return console.debug("controls already inited"), Q;
821
+ const S = new I.Object3D();
822
+ return Q = new Ss(S, h.domElement), r(f), Q;
823
+ }, i = () => {
824
+ if (!Q) throw new Error("OrbitControls not initialized");
825
+ return Q;
826
+ }, r = (h = {}) => {
827
+ const f = i();
828
+ f.enableDamping = h.enableDamping ?? !0, f.dampingFactor = h.dampingFactor ?? 0.5, f.rotateSpeed = h.rotateSpeed ?? 0.2, f.enableZoom = h.enableZoom ?? !0, f.minDistance = h.minDistance ?? 0.5, f.maxDistance = h.maxDistance ?? 6, f.panSpeed = h.panSpeed ?? 1;
829
+ }, n = ({ mode: h, camera: f, store: S, options: E }) => {
830
+ const y = i();
831
+ if (!f) throw new Error(`setMode(${h}): camera is required`);
832
+ if (!S) throw new Error(`setMode(${h}): store is required`);
833
+ y.object = f, r(E), t.value = { mode: h, camera: f, store: S }, a(), y.update();
834
+ }, o = () => {
835
+ Q && Q.update();
858
836
  }, l = () => {
859
- se && se.update();
837
+ const h = i(), { camera: f, store: S } = t.value;
838
+ !f || !S || e.value || (S.setPosition({ ...f.position }), S.setQuaternion({ ...f.quaternion }), S.setTarget({ ...h.target }), S.setRadius(f.position.distanceTo(h.target)));
860
839
  }, a = () => {
861
- const b = s(), { camera: f, store: E } = t.value;
862
- !f || !E || e.value || (E.setPosition({ ...f.position }), E.setQuaternion({ ...f.quaternion }), E.setTarget({ ...b.target }), E.setRadius(f.position.distanceTo(b.target)));
863
- }, c = () => {
864
- const b = s(), { camera: f, store: E } = t.value;
865
- if (!f || !E) return;
840
+ const h = i(), { camera: f, store: S } = t.value;
841
+ if (!f || !S) return;
866
842
  e.value = !0;
867
- const { position: D, quaternion: y, target: k, radius: S } = E;
868
- b.target.set(k.x, k.y, k.z);
869
- const w = new M.Vector3(
870
- D.x - k.x,
871
- D.y - k.y,
872
- D.z - k.z
843
+ const { position: E, quaternion: y, target: T, radius: P } = S;
844
+ h.target.set(T.x, T.y, T.z);
845
+ const G = new I.Vector3(
846
+ E.x - T.x,
847
+ E.y - T.y,
848
+ E.z - T.z
873
849
  ).normalize();
874
- f.position.copy(b.target).add(w.multiplyScalar(S)), f.quaternion.set(
850
+ f.position.copy(h.target).add(G.multiplyScalar(P)), f.quaternion.set(
875
851
  y.x,
876
852
  y.y,
877
853
  y.z,
878
854
  y.w
879
- ), b.update(), e.value = !1;
880
- };
855
+ ), h.update(), e.value = !1;
856
+ }, u = 0, p = 0.1;
881
857
  return {
882
- init: o,
883
- get: s,
884
- setMode: r,
885
- update: l,
886
- syncToStore: a,
887
- applyFromStore: c,
888
- frameToBounds: (b, f = 1.75, E = 0.02) => {
889
- const D = s(), { camera: y } = t.value;
890
- if (!y || !b) return;
891
- const k = new M.Vector3(
892
- b.center.x,
893
- b.center.y + b.size.y * E,
894
- b.center.z
858
+ init: s,
859
+ get: i,
860
+ setMode: n,
861
+ update: o,
862
+ syncToStore: l,
863
+ applyFromStore: a,
864
+ frameToBounds: (h, f = 1.75) => {
865
+ const S = i(), { camera: E } = t.value;
866
+ if (!E || !h) return;
867
+ const y = new I.Vector3(
868
+ h.center.x,
869
+ h.center.y + h.size.y * u,
870
+ h.center.z
895
871
  );
896
- console.log("bounds", b);
897
- const S = Math.max(b.size.x, b.size.y, b.size.z), w = M.MathUtils.degToRad(y.fov);
898
- let F = S / 2 / Math.tan(w / 2) * f;
899
- D.target.copy(k), y.position.set(k.x, k.y, k.z + F), y.near = F / 100, y.far = F * 100, y.updateProjectionMatrix(), D.update();
872
+ console.log("bounds", h);
873
+ const T = Math.max(h.size.x, h.size.y, h.size.z), P = I.MathUtils.degToRad(E.fov);
874
+ let G = T / 2 / Math.tan(P / 2) * f;
875
+ S.target.copy(y), E.position.set(
876
+ y.x,
877
+ y.y + h.size.y * p,
878
+ y.z + G
879
+ ), E.near = G / 100, E.far = G * 100, E.updateProjectionMatrix(), S.update();
900
880
  },
901
881
  dispose: () => {
902
- console.debug("controls disposed"), se && (se.dispose(), se = null, t.value = { mode: null, camera: null, store: null });
882
+ console.debug("controls disposed"), Q && (Q.dispose(), Q = null, t.value = { mode: null, camera: null, store: null });
903
883
  }
904
884
  };
905
- }, xt = () => {
906
- const { getCamera: e } = Le(), t = Ct(), o = st();
885
+ }, Mt = () => {
886
+ const { getCamera: e } = Le(), t = ct(), s = rt();
907
887
  return {
908
888
  activate: () => {
909
- o.setMode({
889
+ s.setMode({
910
890
  mode: "camera",
911
891
  camera: e(),
912
892
  store: t,
@@ -917,35 +897,40 @@ const st = () => {
917
897
  }
918
898
  });
919
899
  },
920
- frameToBounds: o.frameToBounds,
921
- syncToStore: o.syncToStore,
922
- applyFromStore: o.applyFromStore
900
+ frameToBounds: s.frameToBounds,
901
+ syncToStore: s.syncToStore,
902
+ applyFromStore: s.applyFromStore
923
903
  };
924
904
  };
925
- let te = null, Ge = null;
926
- const De = () => {
927
- const e = lt(), t = p(), { colorHex: o } = I(e), s = () => (console.debug("useScene init"), te ? (console.debug("scene already inited"), te) : (te = new M.Scene(), r(o.value), t.loaded.scene = !0, te)), n = () => {
928
- if (te)
929
- return te;
930
- }, r = (a) => {
931
- if (!te) throw new Error("Scene has not been initialized");
932
- te.background = new M.Color(a);
905
+ let X = null, ge = null, be = null, Fe = null;
906
+ const we = () => {
907
+ const e = ut(), t = A(), { colorHex: s } = $(e), i = () => (console.debug("useScene init"), X ? (console.debug("scene already inited"), X) : (X = new I.Scene(), n(s.value), t.loaded.scene = !0, X)), r = () => {
908
+ if (X)
909
+ return X;
910
+ }, n = (a) => {
911
+ if (!X) throw new Error("Scene has not been initialized");
912
+ X.background = new I.Color(a);
913
+ }, o = (a) => {
914
+ if (!X) throw new Error("Scene has not been initialized");
915
+ if (!a) throw new Error("Renderer required to build environment");
916
+ ge || (be = new I.PMREMGenerator(a), be.compileEquirectangularShader(), ge = be.fromScene(new xs(), 0.04).texture, X.environment = ge);
933
917
  };
934
- return Ge = O(
935
- () => o.value,
936
- (a) => r(a)
918
+ return Fe = O(
919
+ () => s.value,
920
+ (a) => n(a)
937
921
  ), {
938
- init: s,
939
- get: n,
922
+ init: i,
923
+ get: r,
940
924
  dispose: () => {
941
- t.loaded.scene = !1, Ge == null || Ge(), Ge = null, te && (te.traverse((a) => {
942
- var c, u;
943
- a.isMesh && ((c = a.geometry) == null || c.dispose(), Array.isArray(a.material) ? a.material.forEach((g) => g == null ? void 0 : g.dispose()) : (u = a.material) == null || u.dispose());
944
- }), te.clear(), te = null);
925
+ t.loaded.scene = !1, Fe == null || Fe(), Fe = null, X && (X.traverse((a) => {
926
+ var u, p;
927
+ a.isMesh && ((u = a.geometry) == null || u.dispose(), Array.isArray(a.material) ? a.material.forEach((D) => D == null ? void 0 : D.dispose()) : (p = a.material) == null || p.dispose());
928
+ }), X.clear(), X = null, ge == null || ge.dispose(), be == null || be.dispose(), ge = null, be = null);
945
929
  },
946
- setBackgroundColor: r
930
+ setBackgroundColor: n,
931
+ setEnvironment: o
947
932
  };
948
- }, Co = {
933
+ }, qs = {
949
934
  asphalt: {
950
935
  ao: "ao.jpg",
951
936
  color: "color.jpg",
@@ -981,544 +966,595 @@ const De = () => {
981
966
  repeat: 100
982
967
  }
983
968
  };
984
- let z = null, He = null, Re = null, Oe = null;
985
- const Lt = () => {
986
- const e = Ve(), { get: t } = De(), { getCamera: o } = Le(), {
987
- visible: s,
988
- color: n,
989
- texture: r,
990
- offset: l
991
- } = I(e), a = () => {
992
- if (console.debug("useGround init"), z)
993
- return console.debug("ground already inited"), z;
994
- const D = t(), y = new M.PlaneGeometry(100, 100), k = new M.Color(n.value || 16777215), S = new M.MeshStandardMaterial({
995
- color: k,
969
+ let k = null, _e = null, je = null, Ue = null;
970
+ const Pt = () => {
971
+ const e = Ve(), { get: t } = we(), { getCamera: s } = Le(), {
972
+ visible: i,
973
+ color: r,
974
+ texture: n,
975
+ offset: o
976
+ } = $(e), l = () => {
977
+ if (console.debug("useGround init"), k)
978
+ return console.debug("ground already inited"), k;
979
+ const f = t(), S = new I.PlaneGeometry(100, 100), E = new I.Color(r.value || 16777215), y = new I.MeshStandardMaterial({
980
+ color: E,
996
981
  // Default to white
997
- side: M.DoubleSide,
982
+ side: I.DoubleSide,
998
983
  roughness: 0.4,
999
984
  metalness: 0.3,
1000
- emissive: k,
985
+ emissive: E,
1001
986
  emissiveIntensity: 0.05
1002
987
  // tweak 0.1–0.6
1003
988
  });
1004
- return z = new M.Mesh(y, S), z.rotation.x = -Math.PI / 2, z.receiveShadow = !0, z.visible = s.value, D.add(z), He = O(
1005
- () => s.value,
1006
- () => c()
1007
- ), Re = O(
1008
- () => n.value,
1009
- (w) => f(w)
1010
- ), Oe = O(
989
+ return k = new I.Mesh(S, y), k.rotation.x = -Math.PI / 2, k.receiveShadow = !0, k.visible = i.value, f.add(k), _e = O(
990
+ () => i.value,
991
+ () => a()
992
+ ), je = O(
1011
993
  () => r.value,
1012
- (w) => g(w)
1013
- ), z;
994
+ (T) => w(T)
995
+ ), Ue = O(
996
+ () => n.value,
997
+ (T) => p(T)
998
+ ), k;
1014
999
  };
1015
- function c() {
1016
- if (o().position.y < z.position.y) {
1017
- z.visible = !1;
1000
+ function a() {
1001
+ if (s().position.y < k.position.y) {
1002
+ k.visible = !1;
1018
1003
  return;
1019
1004
  }
1020
- z.visible = s.value;
1005
+ k.visible = i.value;
1021
1006
  }
1022
- function u(D, y = 1, k = 1) {
1023
- return new M.TextureLoader().load(D, (F) => {
1024
- F.wrapS = M.RepeatWrapping, F.wrapT = M.RepeatWrapping, F.repeat.set(y, k), F.needsUpdate = !0;
1007
+ function u(f, S = 1, E = 1) {
1008
+ return new I.TextureLoader().load(f, (P) => {
1009
+ P.wrapS = I.RepeatWrapping, P.wrapT = I.RepeatWrapping, P.repeat.set(S, E), P.needsUpdate = !0;
1025
1010
  });
1026
1011
  }
1027
- const g = (D) => {
1028
- if (!z) throw new Error("Ground has not been initialized");
1029
- const y = Co[D];
1030
- if (!y)
1031
- z.material.map = null, z.material.normalMap = null, z.material.displacementMap = null, z.material.roughnessMap = null, z.material.aoMap = null, z.material.metalnessMap = null, z.material.needsUpdate = !0;
1012
+ const p = (f) => {
1013
+ if (!k) throw new Error("Ground has not been initialized");
1014
+ const S = qs[f];
1015
+ if (!S)
1016
+ k.material.map = null, k.material.normalMap = null, k.material.displacementMap = null, k.material.roughnessMap = null, k.material.aoMap = null, k.material.metalnessMap = null, k.material.needsUpdate = !0;
1032
1017
  else {
1033
- const k = `https://static.figurosity.com/3d/textures/${D}/`, S = y.repeat;
1034
- z.material.map = u(
1035
- `${k}${y.color}`,
1036
- S,
1037
- S
1038
- ), z.material.normalMap = u(
1039
- `${k}${y.normal}`,
1040
- S,
1041
- S
1042
- ), z.material.displacementMap = u(
1043
- `${k}${y.displacement}`,
1044
- S,
1045
- S
1046
- ), z.material.roughnessMap = u(
1047
- `${k}${y.roughness}`,
1048
- S,
1049
- S
1050
- ), z.material.aoMap = u(
1051
- `${k}${y.ao}`,
1052
- S,
1053
- S
1054
- ), y.metalness && (z.material.metalnessMap = u(
1055
- `${k}${y.metalness}`,
1056
- S,
1057
- S
1058
- )), z.material.displacementScale = 0.1, z.material.displacementBias = -0.05, z.material.needsUpdate = !0;
1018
+ const E = `https://static.figurosity.com/3d/textures/${f}/`, y = S.repeat;
1019
+ k.material.map = u(
1020
+ `${E}${S.color}`,
1021
+ y,
1022
+ y
1023
+ ), k.material.normalMap = u(
1024
+ `${E}${S.normal}`,
1025
+ y,
1026
+ y
1027
+ ), k.material.displacementMap = u(
1028
+ `${E}${S.displacement}`,
1029
+ y,
1030
+ y
1031
+ ), k.material.roughnessMap = u(
1032
+ `${E}${S.roughness}`,
1033
+ y,
1034
+ y
1035
+ ), k.material.aoMap = u(
1036
+ `${E}${S.ao}`,
1037
+ y,
1038
+ y
1039
+ ), S.metalness && (k.material.metalnessMap = u(
1040
+ `${E}${S.metalness}`,
1041
+ y,
1042
+ y
1043
+ )), k.material.displacementScale = 0.1, k.material.displacementBias = -0.05, k.material.needsUpdate = !0;
1059
1044
  }
1060
- z.position.y = l.value, z.geometry.computeBoundingBox(), z.geometry.computeVertexNormals();
1061
- }, b = () => {
1062
- if (!z) throw new Error("Ground has not been initialized");
1063
- return z;
1064
- }, f = (D) => {
1065
- if (!z) throw new Error("Ground has not been initialized");
1066
- z.material.color.set(D);
1045
+ k.position.y = o.value, k.geometry.computeBoundingBox(), k.geometry.computeVertexNormals();
1046
+ }, D = () => {
1047
+ if (!k) throw new Error("Ground has not been initialized");
1048
+ return k;
1049
+ }, w = (f) => {
1050
+ if (!k) throw new Error("Ground has not been initialized");
1051
+ k.material.color.set(f);
1067
1052
  };
1068
- return { init: a, get: b, setColor: f, updateVisibility: c, dispose: () => {
1069
- var y, k;
1070
- if (He == null || He(), Re == null || Re(), Oe == null || Oe(), He = null, Re = null, Oe = null, !z) return;
1071
- const D = t();
1072
- D == null || D.remove(z), (y = z.geometry) == null || y.dispose(), Array.isArray(z.material) ? z.material.forEach((S) => S == null ? void 0 : S.dispose()) : (k = z.material) == null || k.dispose(), z = null;
1053
+ return { init: l, get: D, setColor: w, updateVisibility: a, dispose: () => {
1054
+ var S, E;
1055
+ if (_e == null || _e(), je == null || je(), Ue == null || Ue(), _e = null, je = null, Ue = null, !k) return;
1056
+ const f = t();
1057
+ f == null || f.remove(k), (S = k.geometry) == null || S.dispose(), Array.isArray(k.material) ? k.material.forEach((y) => y == null ? void 0 : y.dispose()) : (E = k.material) == null || E.dispose(), k = null;
1073
1058
  } };
1074
- }, xo = (e, t = 16711422) => {
1075
- const o = new po(0.1, 0.1, 0.1, 6, 0.01), s = 0.1, n = 0.05, r = new M.ConeGeometry(n, s, 32);
1076
- o.index || o.setIndex(
1059
+ }, Ks = (e, t = 16711422) => {
1060
+ const s = new ws(0.1, 0.1, 0.1, 6, 0.01), i = 0.1, r = 0.05, n = new I.ConeGeometry(r, i, 32);
1061
+ s.index || s.setIndex(
1077
1062
  Array.from(
1078
- { length: o.attributes.position.count },
1079
- (u, g) => g
1063
+ { length: s.attributes.position.count },
1064
+ (u, p) => p
1080
1065
  )
1081
- ), r.index || r.setIndex(
1066
+ ), n.index || n.setIndex(
1082
1067
  Array.from(
1083
- { length: r.attributes.position.count },
1084
- (u, g) => g
1068
+ { length: n.attributes.position.count },
1069
+ (u, p) => p
1085
1070
  )
1086
- ), r.rotateX(-Math.PI / 2), r.translate(0, 0, s / 2), Bt(o), Bt(r);
1087
- const l = uo([o, r]), a = new M.MeshBasicMaterial({
1071
+ ), n.rotateX(-Math.PI / 2), n.translate(0, 0, i / 2), Bt(s), Bt(n);
1072
+ const o = Cs([s, n]), l = new I.MeshBasicMaterial({
1088
1073
  color: t,
1089
1074
  transparent: !0,
1090
1075
  opacity: 0.8
1091
- }), c = new M.Mesh(l, a);
1092
- if (c.position.set(0, 0, 0), c.rotateX(Math.PI), e && e.target) {
1093
- const u = new M.Vector3();
1094
- e.target.getWorldPosition(u), c.lookAt(u);
1076
+ }), a = new I.Mesh(o, l);
1077
+ if (a.position.set(0, 0, 0), a.rotateX(Math.PI), e && e.target) {
1078
+ const u = new I.Vector3();
1079
+ e.target.getWorldPosition(u), a.lookAt(u);
1095
1080
  }
1096
- return c.position.copy(e.position), c;
1081
+ return a.position.copy(e.position), a;
1097
1082
  };
1098
- let We = {}, ae = {}, X = {}, mt = {}, Ce = {}, ke = null, pe = null, qe = [], Ee = /* @__PURE__ */ new Map();
1099
- const nt = () => {
1100
- const e = p(), t = Be(), o = ye();
1101
- ee(!1);
1102
- const { subjectLoaded: s, width: n, height: r, selected: l } = I(e), { debug: a, collection: c, advancedMode: u, move: g } = I(t), { get: b } = De(), f = t.property, E = () => {
1103
- if (pe)
1104
- return console.warn("lights camera already inited"), pe;
1105
- const d = b();
1106
- return ke = y(), pe = k(), c.value.forEach((i) => {
1107
- const x = i === "key" ? pe : d, { group: V, light: A, directional: j, visualization: L } = S(
1108
- i,
1109
- x
1110
- );
1111
- X[i] = A, We[i] = V, mt[i] = j, Ce[i] = L, X[i].castShadow = !0, X[i].angle = Math.PI / 8, X[i].penumbra = 0.2, X[i].shadow.camera.near = 0.5, X[i].shadow.camera.far = 12, X[i].shadow.focus = 0.9, X[i].shadow.mapSize.set(4096, 4096), X[i].shadow.bias = -2e-4, X[i].shadow.normalBias = 0.02, X[i].shadow.radius = 2, X[i].shadow.camera.updateProjectionMatrix();
1112
- }), q(), C(), pe;
1113
- }, D = () => {
1114
- if (!pe)
1083
+ let ot = {}, ne = {}, N = {}, ie = {}, Me = null, ae = null, De = [], Te = /* @__PURE__ */ new Map();
1084
+ const it = () => {
1085
+ const e = A(), t = fe(), s = me();
1086
+ pe(!1);
1087
+ const { subjectLoaded: i, width: r, height: n, selected: o, basePoseId: l } = $(e), { debug: a, collection: u, advancedMode: p, move: D } = $(t), { get: w } = we(), h = t.property, f = () => {
1088
+ if (ae)
1089
+ return console.warn("lights camera already inited"), ae;
1090
+ const g = w();
1091
+ return Me = y(), ae = T(), u.value.forEach((c) => {
1092
+ const v = c === "key" ? ae : g, { group: L, light: M, visualization: x } = P(c, v);
1093
+ N[c] = M, ot[c] = L, ie[c] = x, N[c].castShadow = !0, N[c].angle = Math.PI / 4, N[c].penumbra = 0.5, N[c].shadow.camera.near = 0.5, N[c].shadow.camera.far = 12, N[c].shadow.focus = 0.9, N[c].shadow.mapSize.set(4096, 4096), N[c].shadow.bias = -2e-4, N[c].shadow.normalBias = 0.02, N[c].shadow.radius = 2, N[c].shadow.camera.updateProjectionMatrix();
1094
+ }), F(), Y(), ae;
1095
+ }, S = () => {
1096
+ if (!ae)
1115
1097
  throw new Error("Light camera not initialized.");
1116
- return pe;
1098
+ return ae;
1099
+ }, E = (g) => {
1100
+ g && (Object.values(N).forEach((c) => c == null ? void 0 : c.color.set(g)), Object.values(ie).forEach((c) => {
1101
+ var v;
1102
+ return (v = c == null ? void 0 : c.material) == null ? void 0 : v.color.set(g);
1103
+ }));
1117
1104
  }, y = () => {
1118
- const d = b(), i = new M.AmbientLight(f("key", "color"), 0.75);
1119
- return d.add(i), i;
1120
- }, k = () => {
1121
- const d = b(), i = new M.PerspectiveCamera(
1105
+ const g = w(), c = new I.AmbientLight(16777215, 0.2);
1106
+ return g.add(c), c;
1107
+ }, T = () => {
1108
+ const g = w(), c = new I.PerspectiveCamera(
1122
1109
  75,
1123
- n.value / r.value,
1110
+ r.value / n.value,
1124
1111
  0.1,
1125
1112
  100
1126
1113
  );
1127
- return i.position.set(0, 0, 1.5), d.add(i), i;
1114
+ return c.position.set(0, 0, 1.5), g.add(c), c;
1128
1115
  };
1129
- function S(d, i = null) {
1130
- const x = b(), V = new M.Group(), A = new M.SpotLight(
1131
- f(d, "color"),
1132
- f(d, "opacity")
1116
+ function P(g, c = null) {
1117
+ const v = w(), L = new I.Group(), M = new I.SpotLight(
1118
+ h(g, "color"),
1119
+ h(g, "intensity")
1133
1120
  );
1134
- A.position.set(0, 0, 0);
1135
- const j = new M.DirectionalLight(f(d, "color"), 0.2);
1136
- j.position.set(0, 0, 4), F(), A.target.position.set(0, 1, 0), A.target.updateMatrixWorld(), x.add(A.target), V.add(A), V.add(j);
1137
- const L = xo(
1138
- A,
1139
- f(d, "visualizationColor")
1140
- ), P = t.isVisible(d);
1141
- return L.visible = P, V.add(L), i.add(V), { group: V, light: A, directional: j, visualization: L };
1121
+ M.position.set(0, 0, 0), H(), M.target.position.set(0, 1, 0), M.target.updateMatrixWorld(), v.add(M.target), L.add(M);
1122
+ const x = Ks(
1123
+ M,
1124
+ h(g, "visualizationColor")
1125
+ ), U = t.isVisible(g);
1126
+ return x.visible = U, L.add(x), c.add(L), { group: L, light: M, visualization: x };
1142
1127
  }
1143
- const w = () => {
1144
- F(), Z(), U();
1145
- }, F = () => {
1146
- ke && ke.color.set(f("key", "color"));
1147
- const d = t.lights[l.value];
1148
- d && Object.keys(d).forEach((i) => {
1149
- const x = X[i];
1128
+ const G = () => {
1129
+ H(), Z(), b();
1130
+ }, H = () => {
1131
+ if (!t.lights[l.value]) return;
1132
+ const c = t.seeds[o.value], v = t.ambientScale, L = t.userScale;
1133
+ if (Me && (c != null && c.ambient) && (Me.intensity = c.ambient.intensity * v), c != null && c.env) {
1134
+ const M = w();
1135
+ M && (M.environmentIntensity = c.env.intensity * v);
1136
+ }
1137
+ u.value.forEach((M) => {
1138
+ const x = N[M];
1150
1139
  if (!x) return;
1151
- const V = f(i, "color"), A = f(i, "visible"), j = f(i, "opacity"), L = f(i, "shadow") || !1;
1152
- if (V && x.color.set(V), x.visible = A, j != null && (x.intensity = j), x.castShadow = L, L) {
1153
- const P = f(i, "shadowSettings", {});
1140
+ const U = h(M, "color"), he = h(M, "visible"), K = h(M, "shadow") || !1;
1141
+ if (U && x.color.set(U), x.visible = he, c != null && c[M] && (x.intensity = c[M].intensity * L), x.castShadow = K, K) {
1142
+ const re = h(M, "shadowSettings", {});
1154
1143
  x.shadow.mapSize.set(
1155
- P.width || 1024,
1156
- P.height || 1024
1157
- ), x.shadow.camera.near = P.near || 0.5, x.shadow.camera.far = P.far || 50, x.shadow.needsUpdate = !0;
1144
+ re.width || 1024,
1145
+ re.height || 1024
1146
+ ), x.shadow.camera.near = re.near || 0.5, x.shadow.camera.far = re.far || 50, x.shadow.needsUpdate = !0;
1158
1147
  }
1159
1148
  });
1160
1149
  }, Z = () => {
1161
- const d = t.lights[l.value];
1162
- d && Object.keys(d).forEach((i) => {
1163
- if (!Ce[i]) return console.warn(`${i} does not exist`);
1164
- const x = t.isVisible(i);
1165
- Ce[i].visible = x, Ce[i].material.color.set(f(i, "color"));
1150
+ t.lights[l.value] && u.value.forEach((c) => {
1151
+ if (!ie[c]) return console.warn(`${c} does not exist`);
1152
+ const v = t.isVisible(c);
1153
+ ie[c].visible = v, ie[c].material.color.set(h(c, "color"));
1166
1154
  });
1167
- }, U = () => {
1168
- const d = t.lights[l.value];
1169
- d && Object.keys(d).forEach((i) => {
1170
- const x = f(i, "debug") || a.value;
1171
- !ae[i] && x && (ae[i] = Y(i, X[i]), X[i].add(ae[i])), ae[i] && !x && (ae[i] = Q(ae[i]));
1155
+ }, b = () => {
1156
+ t.lights[l.value] && u.value.forEach((c) => {
1157
+ const v = h(c, "debug") || a.value;
1158
+ !ne[c] && v && (ne[c] = m(c, N[c]), N[c].add(ne[c])), ne[c] && !v && (ne[c] = B(ne[c]));
1172
1159
  });
1173
- }, Y = (d, i) => {
1174
- const x = b(), V = new M.SpotLightHelper(
1175
- i,
1176
- f(d, "visualizationColor")
1160
+ }, m = (g, c) => {
1161
+ const v = w(), L = new I.SpotLightHelper(
1162
+ c,
1163
+ h(g, "visualizationColor")
1177
1164
  );
1178
- return x.add(V), V;
1179
- }, Q = (d) => {
1180
- const i = b();
1181
- if (!(!i || !d))
1182
- return i.remove(d), d.dispose(), d = null, d;
1183
- }, q = () => {
1184
- const d = D(), i = o.bounds;
1185
- if (!i) return;
1186
- const x = new M.Vector3(
1187
- i.center.x,
1188
- i.center.y,
1189
- // + bounds.size.y + 0.05,
1190
- i.center.z
1191
- ), V = new M.Vector3().subVectors(x, d.position).normalize(), A = new M.Vector3(
1192
- V.x,
1165
+ return v.add(L), L;
1166
+ }, B = (g) => {
1167
+ const c = w();
1168
+ if (!(!c || !g))
1169
+ return c.remove(g), g.dispose(), g = null, g;
1170
+ }, F = () => {
1171
+ const g = S();
1172
+ if (!s.bounds) return;
1173
+ const v = t.target, L = new I.Vector3(v.x, v.y, v.z), M = new I.Vector3().subVectors(L, g.position).normalize(), x = new I.Vector3(
1174
+ M.x,
1193
1175
  0,
1194
- V.z
1195
- ).normalize(), j = new M.Vector3(
1196
- -A.z,
1176
+ M.z
1177
+ ).normalize(), U = new I.Vector3(
1178
+ -x.z,
1197
1179
  0,
1198
- A.x
1199
- ), P = 2 * d.position.distanceTo(x) / Math.sqrt(3), W = 1, _ = x.clone().add(j.clone().multiplyScalar(-P / W)).add(V.clone().multiplyScalar(Math.sqrt(3) * P / 2)), K = x.clone().add(j.clone().multiplyScalar(P / W)).add(V.clone().multiplyScalar(Math.sqrt(3) * P / 2));
1200
- We.fill.position.copy(_), We.back.position.copy(K), c.value.forEach((re) => {
1201
- var N, le, ue;
1202
- const m = X[re];
1203
- m.shadow.needsUpdate = !0, m.target.position.copy(x), m.target.updateMatrixWorld(), (N = Ce[re]) == null || N.lookAt(x), (ue = (le = ae[re]) == null ? void 0 : le.update) == null || ue.call(le);
1204
- });
1205
- }, B = (d) => {
1206
- const i = t.lights[d];
1207
- if (!i) return;
1208
- const x = `watcher-${d}`;
1209
- if (Ee.has(x)) return;
1210
- const V = [];
1211
- Object.keys(i).forEach((j) => {
1212
- var L, P;
1213
- (L = i[j]) != null && L.color && V.push(() => i[j].color), (P = i[j]) != null && P.visible && V.push(() => i[j].visible);
1180
+ x.x
1181
+ ), K = 2 * g.position.distanceTo(L) / Math.sqrt(3), re = 1, Re = L.clone().add(U.clone().multiplyScalar(-K / re)).add(M.clone().multiplyScalar(Math.sqrt(3) * K / 2)), os = L.clone().add(U.clone().multiplyScalar(K / re)).add(M.clone().multiplyScalar(Math.sqrt(3) * K / 2));
1182
+ ot.fill.position.copy(Re), ot.back.position.copy(os), u.value.forEach((dt) => {
1183
+ var kt, Je, At;
1184
+ const pt = N[dt];
1185
+ pt.shadow.needsUpdate = !0, pt.target.position.copy(L), pt.target.updateMatrixWorld(), (kt = ie[dt]) == null || kt.lookAt(L), (At = (Je = ne[dt]) == null ? void 0 : Je.update) == null || At.call(Je);
1214
1186
  });
1215
- const A = O(
1216
- () => V.map((j) => j()),
1217
- w,
1187
+ }, z = (g) => {
1188
+ const c = `watcher-${g}`;
1189
+ if (Te.has(c)) return;
1190
+ const v = O(
1191
+ () => [t.lights[g], t.options[g]],
1192
+ G,
1218
1193
  { deep: !0 }
1219
1194
  );
1220
- Ee.set(x, A);
1221
- }, T = (d) => {
1222
- const i = `watcher-${d}`, x = Ee.get(i);
1223
- x && (x(), Ee.delete(i));
1224
- }, C = () => {
1225
- qe.push(
1195
+ Te.set(c, v);
1196
+ }, j = (g) => {
1197
+ const c = `watcher-${g}`, v = Te.get(c);
1198
+ v && (v(), Te.delete(c));
1199
+ }, Y = () => {
1200
+ De.push(
1226
1201
  O(
1227
- () => [u.value, l.value, g.value],
1228
- () => w()
1202
+ () => [p.value, o.value, D.value],
1203
+ () => G()
1229
1204
  )
1230
- ), qe.push(
1205
+ ), De.push(
1231
1206
  O(
1232
- () => s.value,
1233
- (d) => {
1234
- d === !0 && q();
1207
+ () => [t.ambientScale, t.userScale],
1208
+ () => G()
1209
+ )
1210
+ ), De.push(
1211
+ O(
1212
+ () => i.value,
1213
+ (g) => {
1214
+ g === !0 && F();
1235
1215
  }
1236
1216
  )
1237
- ), qe.push(
1217
+ ), De.push(
1238
1218
  O(
1239
1219
  () => l.value,
1240
- (d, i) => {
1241
- i && T(i), d != null && (B(d), Ht(w));
1220
+ (g, c) => {
1221
+ c && j(c), g != null && (z(g), ns(G));
1242
1222
  },
1243
1223
  { immediate: !0 }
1244
1224
  )
1245
1225
  );
1246
1226
  };
1247
1227
  return {
1248
- init: E,
1249
- updatePosition: q,
1250
- getCamera: D,
1228
+ init: f,
1229
+ updatePosition: F,
1230
+ getCamera: S,
1251
1231
  dispose: () => {
1252
- const d = b();
1253
- d && (qe.forEach((i) => i()), qe = [], Ee.forEach((i) => i()), Ee.clear(), Object.values(X).forEach((i) => d.remove(i)), Object.values(mt).forEach((i) => d.remove(i)), Object.values(ae).forEach((i) => d.remove(i)), Object.values(Ce).forEach((i) => {
1254
- var x, V, A, j;
1255
- d.remove(i), (V = (x = i.geometry) == null ? void 0 : x.dispose) == null || V.call(x), (j = (A = i.material) == null ? void 0 : A.dispose) == null || j.call(A);
1256
- }), ke && d.remove(ke), We = {}, ae = {}, X = {}, mt = {}, Ce = {}, ke = null, pe = null);
1257
- }
1232
+ const g = w();
1233
+ g && (De.forEach((c) => c()), De = [], Te.forEach((c) => c()), Te.clear(), Object.values(N).forEach((c) => g.remove(c)), Object.values(ne).forEach((c) => g.remove(c)), Object.values(ie).forEach((c) => {
1234
+ var v, L, M, x;
1235
+ g.remove(c), (L = (v = c.geometry) == null ? void 0 : v.dispose) == null || L.call(v), (x = (M = c.material) == null ? void 0 : M.dispose) == null || x.call(M);
1236
+ }), Me && g.remove(Me), ot = {}, ne = {}, N = {}, ie = {}, Me = null, ae = null);
1237
+ },
1238
+ applyColorPreview: E,
1239
+ applyFromStore: G
1258
1240
  };
1259
- }, wt = () => {
1260
- const e = Be(), t = st(), { getCamera: o } = nt();
1241
+ }, Ws = 0.4, Xs = 0.25, Dt = () => {
1242
+ const e = fe(), t = rt(), { getCamera: s } = it();
1261
1243
  return {
1262
1244
  activate: () => {
1263
1245
  t.setMode({
1264
1246
  mode: "lights",
1265
- camera: o(),
1247
+ camera: s(),
1266
1248
  store: e,
1267
1249
  options: {
1268
1250
  enableZoom: !0,
1269
1251
  minDistance: 0.5,
1270
- maxDistance: 10
1252
+ maxDistance: 10,
1253
+ // Invert OrbitControls' "drag the world" pan so shift+drag
1254
+ // translates the rig in the direction of the drag — matches
1255
+ // the user's "I'm moving the lights" mental model.
1256
+ panSpeed: -1
1271
1257
  }
1272
1258
  });
1273
1259
  },
1274
- frameToBounds: t.frameToBounds,
1260
+ frameToBounds: (n, o = 1.75) => {
1261
+ if (!n) return;
1262
+ const l = t.get(), a = s(), u = new I.Vector3(
1263
+ n.center.x,
1264
+ n.center.y + n.size.y * Ws,
1265
+ n.center.z
1266
+ ), p = Math.max(n.size.x, n.size.y, n.size.z), D = I.MathUtils.degToRad(a.fov), w = p / 2 / Math.tan(D / 2) * o;
1267
+ l.target.copy(u), a.position.set(u.x, u.y + n.size.y * Xs, u.z + w), a.near = w / 100, a.far = w * 100, a.updateProjectionMatrix(), l.update();
1268
+ },
1275
1269
  syncToStore: t.syncToStore,
1276
1270
  applyFromStore: t.applyFromStore
1277
1271
  };
1278
1272
  };
1279
- let me = null;
1280
- const wo = () => {
1273
+ let le = null;
1274
+ const Zs = () => {
1281
1275
  const e = () => {
1282
- const o = p();
1283
- return me = new M.LoadingManager(), me.onStart = function(s) {
1284
- o.loading.active = !0, o.loading.url = s, o.loading.percent = 0;
1285
- }, me.onError = () => {
1286
- o.loading.active = !1, o.loading.url = null;
1287
- }, me.onLoad = function() {
1288
- o.loading.active = !1, o.loading.url = null, o.loading.percent = 100;
1289
- }, me.onProgress = function(s, n, r) {
1290
- o.loading.percent = Math.round(n / r * 100);
1291
- }, me;
1276
+ const s = A();
1277
+ return le = new I.LoadingManager(), le.onStart = function(i) {
1278
+ s.loading.active = !0, s.loading.url = i, s.loading.percent = 0;
1279
+ }, le.onError = () => {
1280
+ s.loading.active = !1, s.loading.url = null;
1281
+ }, le.onLoad = function() {
1282
+ s.loading.active = !1, s.loading.url = null, s.loading.percent = 100;
1283
+ }, le.onProgress = function(i, r, n) {
1284
+ s.loading.percent = Math.round(r / n * 100);
1285
+ }, le;
1292
1286
  };
1293
- return { get: () => (me || e(), me) };
1287
+ return { get: () => (le || e(), le) };
1294
1288
  };
1295
- let R = null, _e = null, Ue = null;
1296
- const St = () => {
1297
- const e = p(), { get: t } = De(), { getCamera: o } = Le(), { width: s, height: n, subjectLoaded: r } = I(e);
1298
- function l(g) {
1299
- return console.debug("useRenderer init"), R ? (console.debug("renderer already inited"), R) : (R = new M.WebGLRenderer({ antialias: !0, alpha: !0 }), R.setSize(s.value, n.value), R.toneMapping = M.ACESFilmicToneMapping, R.toneMappingExposure = 1.2, R.shadowMap.enabled = !0, R.shadowMap.type = M.PCFSoftShadowMap, R.gammaFactor = 2.2, R.gammaOutput = !0, R.outputColorSpace = M.SRGBColorSpace, g && g.appendChild(R.domElement), e.loaded.renderer = !0, R);
1289
+ let _ = null, Oe = null, $e = null;
1290
+ const at = () => {
1291
+ const e = A(), { get: t } = we(), { getCamera: s } = Le(), { width: i, height: r, subjectLoaded: n } = $(e);
1292
+ function o(D) {
1293
+ return console.debug("useRenderer init"), _ ? (console.debug("renderer already inited"), _) : (_ = new I.WebGLRenderer({ antialias: !0, alpha: !0 }), _.setSize(i.value, r.value), _.toneMapping = I.ACESFilmicToneMapping, _.toneMappingExposure = 0.8, _.shadowMap.enabled = !0, _.shadowMap.type = I.PCFSoftShadowMap, _.outputColorSpace = I.SRGBColorSpace, D && D.appendChild(_.domElement), e.loaded.renderer = !0, _);
1300
1294
  }
1301
- const a = () => {
1302
- if (!R) throw new Error("Renderer has not been initialized");
1303
- return R;
1304
- }, c = () => {
1305
- const g = t(), b = o();
1306
- !g || !b || R.render(g, b);
1295
+ const l = () => {
1296
+ if (!_) throw new Error("Renderer has not been initialized");
1297
+ return _;
1298
+ }, a = (D) => {
1299
+ _ && (_.toneMappingExposure = D);
1300
+ }, u = () => {
1301
+ const D = t(), w = s();
1302
+ !D || !w || _.render(D, w);
1307
1303
  };
1308
- _e = O(
1309
- () => [s.value, n.value],
1310
- ([g, b]) => {
1311
- !g || !b || !R || R.setSize(g, b);
1304
+ Oe = O(
1305
+ () => [i.value, r.value],
1306
+ ([D, w]) => {
1307
+ !D || !w || !_ || _.setSize(D, w);
1312
1308
  }
1313
- ), Ue = O(
1314
- () => r.value,
1315
- () => c()
1309
+ ), $e = O(
1310
+ () => n.value,
1311
+ () => u()
1316
1312
  );
1317
- function u() {
1318
- console.debug("renderer disposed"), e.loaded.renderer = !1, _e == null || _e(), Ue == null || Ue(), _e = null, Ue = null, R && (R.domElement.parentElement && R.domElement.parentElement.removeChild(R.domElement), R.dispose(), R = null);
1313
+ function p() {
1314
+ console.debug("renderer disposed"), e.loaded.renderer = !1, Oe == null || Oe(), $e == null || $e(), Oe = null, $e = null, _ && (_.domElement.parentElement && _.domElement.parentElement.removeChild(_.domElement), _.dispose(), _ = null);
1319
1315
  }
1320
1316
  return {
1321
- init: l,
1322
- get: a,
1323
- dispose: u,
1324
- render: c
1317
+ init: o,
1318
+ get: l,
1319
+ dispose: p,
1320
+ render: u,
1321
+ setExposure: a
1325
1322
  };
1326
- }, Vt = (e, t, o = {}) => {
1327
- const { removeSpecular: s = !1, removeShininess: n = !1 } = o;
1328
- e && e.traverse((r) => {
1329
- if (!r.isMesh) return;
1330
- (Array.isArray(r.material) ? r.material : [r.material]).forEach((a) => {
1331
- a && (a.color && a.color.set(t), s && a.specular && a.specular.set(0), n && typeof a.shininess == "number" && (a.shininess = 0), a.needsUpdate = !0);
1323
+ }, Ys = /hair|lash|brow|eye|cornea|sclera|iris|pupil|tear|teeth|tongue|mouth|gum|lip|nail/i, Qs = (e, t, s = {}) => {
1324
+ const { removeSpecular: i = !1, removeShininess: r = !1 } = s;
1325
+ e && e.traverse((n) => {
1326
+ if (!n.isMesh) return;
1327
+ (Array.isArray(n.material) ? n.material : [n.material]).forEach((l) => {
1328
+ if (!l) return;
1329
+ const a = `${n.name} ${l.name || ""}`;
1330
+ Ys.test(a) || (l.color && l.color.set(t), i && l.specular && l.specular.set(0), r && typeof l.shininess == "number" && (l.shininess = 0), l.needsUpdate = !0);
1332
1331
  });
1333
1332
  });
1334
- }, Do = 1, Bo = "https://www.gstatic.com/draco/v1/decoders/";
1335
- let he = null, fe = null, Ae, ze, jt = 0;
1336
- const Ft = () => {
1337
- const { get: e } = wo(), t = ye(), o = p(), s = Ve(), { selected: n } = I(o), { color: r, url: l } = I(t), { offset: a } = I(s), { getCamera: c } = Le(), { get: u } = De(), { render: g } = St(), b = (S) => {
1338
- const { frameToBounds: w } = xt(), { frameToBounds: F } = wt(), Z = ++jt;
1339
- o.subjectLoaded = !1, f();
1340
- const U = e();
1341
- fe || (fe = new ho(U), fe.setDecoderPath(Bo));
1342
- const Y = new mo(U);
1343
- Y.setDRACOLoader(fe), Y.setWithCredentials(!0), Y.manager.setURLModifier((Q) => Q), Y.load(S, (Q) => {
1344
- const q = Q == null ? void 0 : Q.scene;
1345
- if (Z !== jt) {
1346
- q == null || q.traverse((i) => {
1347
- var V;
1348
- if (!i.isMesh) return;
1349
- (V = i.geometry) == null || V.dispose();
1350
- const x = i.material;
1351
- Array.isArray(x) ? x.forEach((A) => A == null ? void 0 : A.dispose()) : x == null || x.dispose();
1333
+ }, Js = 1, eo = "https://www.gstatic.com/draco/v1/decoders/", lt = {
1334
+ roughnessFloor: 0.85,
1335
+ metalness: null,
1336
+ envMapIntensity: null,
1337
+ applyTint: !0,
1338
+ exposure: 0.8,
1339
+ ambientIntensity: 0.2,
1340
+ spotIntensity: 1,
1341
+ envIntensity: 1
1342
+ }, to = {
1343
+ nude: { ...lt },
1344
+ // Smooth ships with no texture maps — pure-white sculpting reference.
1345
+ // All "detail" has to come from form-revealing shading on the
1346
+ // geometry, not from albedo. Same metalness=1 Diffeomorphic bug as
1347
+ // muscle; flipping to 0 restores diffuse. Studio-marble lighting:
1348
+ // strong directional spots, very low ambient and env fill, lower
1349
+ // exposure so lit surfaces don't saturate to white. The contrast
1350
+ // between lit and unlit faces is what makes form readable.
1351
+ smooth: {
1352
+ ...lt,
1353
+ roughnessFloor: 0.3,
1354
+ metalness: 0,
1355
+ envMapIntensity: 0.02,
1356
+ exposure: 0.5,
1357
+ ambientIntensity: 0
1358
+ },
1359
+ muscle: {
1360
+ roughnessFloor: 0.9,
1361
+ metalness: 0,
1362
+ envMapIntensity: 0,
1363
+ applyTint: !1,
1364
+ exposure: 0.2,
1365
+ ambientIntensity: 0.5,
1366
+ spotIntensity: 0.3,
1367
+ envIntensity: 1
1368
+ }
1369
+ };
1370
+ let ve = null, ce = null, ke, Vt = 0, ee = lt;
1371
+ const Rt = () => {
1372
+ const { get: e } = Zs(), t = me(), s = A(), i = Ve(), r = It(), { selected: n } = $(s), { url: o } = $(t), { subjectHex: l } = $(r), { offset: a } = $(i), { getCamera: u } = Le(), { get: p } = we(), { render: D } = at(), w = (y) => {
1373
+ const { setExposure: T } = at(), P = fe(), G = ++Vt;
1374
+ s.subjectLoaded = !1, h();
1375
+ const H = e();
1376
+ ce || (ce = new Is(H), ce.setDecoderPath(eo));
1377
+ const Z = new Es(H);
1378
+ Z.setDRACOLoader(ce), Z.setWithCredentials(!0), Z.manager.setURLModifier((b) => b), Z.load(y, (b) => {
1379
+ var g;
1380
+ const m = b == null ? void 0 : b.scene;
1381
+ if (G !== Vt) {
1382
+ m == null || m.traverse((c) => {
1383
+ var L;
1384
+ if (!c.isMesh) return;
1385
+ (L = c.geometry) == null || L.dispose();
1386
+ const v = c.material;
1387
+ Array.isArray(v) ? v.forEach((M) => M == null ? void 0 : M.dispose()) : v == null || v.dispose();
1352
1388
  });
1353
1389
  return;
1354
1390
  }
1355
- if (!q)
1391
+ if (!m)
1356
1392
  return;
1357
- he = q;
1358
- const B = u(), T = c(), C = new M.Group();
1359
- C.name = "GLBSubject", C.add(q), q.traverse((i) => {
1360
- i.isMesh && (i.castShadow = !0, i.receiveShadow = !0);
1361
- }), Vt(q, r.value), q.scale.setScalar(Do), q.updateMatrixWorld(!0);
1362
- const G = Mt(q);
1363
- C.position.y -= G.bottom, C.updateMatrixWorld(!0), B.add(C), he = C;
1364
- const d = Mt(C);
1365
- t.setBounds(d), g(B, T), w(d), F(d), o.subjectLoaded = !0;
1393
+ ve = m, ee = to[(g = t.model) == null ? void 0 : g.slug] || lt, T(ee.exposure), P.seedFromRecipe(s.selected, ee);
1394
+ const B = p(), F = u(), z = new I.Group();
1395
+ z.name = "GLBSubject", z.add(m);
1396
+ const j = /brow|lash/i;
1397
+ m.traverse((c) => {
1398
+ if (!c.isMesh) return;
1399
+ c.castShadow = !0, c.receiveShadow = !0;
1400
+ const v = Array.isArray(c.material) ? c.material : [c.material], L = `${c.name} ${v.map((x) => x == null ? void 0 : x.name).join(" ")}`, M = j.test(L);
1401
+ v.forEach((x) => {
1402
+ x && (ee.roughnessFloor !== null && typeof x.roughness == "number" && (x.roughness = Math.max(
1403
+ x.roughness,
1404
+ ee.roughnessFloor
1405
+ )), ee.metalness !== null && typeof x.metalness == "number" && (x.metalness = ee.metalness), ee.envMapIntensity !== null && typeof x.envMapIntensity == "number" && (x.envMapIntensity = ee.envMapIntensity), x.transparent && M && (x.alphaTest = 0.2, x.depthWrite = !0), x.needsUpdate = !0);
1406
+ });
1407
+ }), ee.applyTint && Qs(m, l.value), m.scale.setScalar(Js), m.updateMatrixWorld(!0);
1408
+ const Y = zt(m);
1409
+ z.position.y -= Y.bottom, z.updateMatrixWorld(!0), B.add(z), ve = z;
1410
+ const q = zt(z);
1411
+ t.setBounds(q), D(B, F), s.subjectLoaded = !0;
1366
1412
  });
1367
- }, f = () => {
1368
- if (!he) return;
1369
- u().remove(he), he.traverse((w) => {
1370
- var Z;
1371
- if (!w.isMesh) return;
1372
- (Z = w.geometry) == null || Z.dispose();
1373
- const F = w.material;
1374
- Array.isArray(F) ? F.forEach((U) => U == null ? void 0 : U.dispose()) : F == null || F.dispose();
1375
- }), he = null, o.subjectLoaded = !1;
1376
- }, E = (S) => {
1377
- Vt(he, S);
1378
- }, D = () => he, y = () => {
1379
- if (Ae || ze) {
1413
+ }, h = () => {
1414
+ if (!ve) return;
1415
+ p().remove(ve), ve.traverse((T) => {
1416
+ var G;
1417
+ if (!T.isMesh) return;
1418
+ (G = T.geometry) == null || G.dispose();
1419
+ const P = T.material;
1420
+ Array.isArray(P) ? P.forEach((H) => H == null ? void 0 : H.dispose()) : P == null || P.dispose();
1421
+ }), ve = null, s.subjectLoaded = !1;
1422
+ }, f = () => ve, S = () => {
1423
+ if (ke) {
1380
1424
  console.warn("useGLB.init() called more than once");
1381
1425
  return;
1382
1426
  }
1383
- Ae = O(
1427
+ ke = O(
1384
1428
  () => n.value,
1385
- (S, w) => {
1386
- !S || S === w || l.value && b(l.value);
1429
+ (y, T) => {
1430
+ !y || y === T || o.value && w(o.value);
1387
1431
  },
1388
1432
  { immediate: !0 }
1389
- ), ze = O(
1390
- () => r.value,
1391
- (S) => E(S)
1392
1433
  );
1393
- }, k = () => {
1394
- Ae == null || Ae(), ze == null || ze(), Ae = null, ze = null, f(), fe == null || fe.dispose(), fe = null;
1434
+ }, E = () => {
1435
+ ke == null || ke(), ke = null, h(), ce == null || ce.dispose(), ce = null;
1395
1436
  };
1396
- return Rt(() => {
1397
- k();
1398
- }), { init: y, get: D, dispose: k, updateColor: E };
1399
- }, Mo = (e, t, o = 500) => {
1400
- const s = e.material;
1401
- s.transparent = !0;
1402
- const n = s.opacity, r = performance.now(), l = (a) => {
1403
- const c = a - r, u = Math.min(c / o, 1), g = n + (t - n) * u;
1404
- s.opacity = g, u < 1 && requestAnimationFrame(l);
1437
+ return _t(() => {
1438
+ E();
1439
+ }), { init: S, get: f, dispose: E };
1440
+ }, so = (e, t, s = 500) => {
1441
+ const i = e.material;
1442
+ i.transparent = !0;
1443
+ const r = i.opacity, n = performance.now(), o = (l) => {
1444
+ const a = l - n, u = Math.min(a / s, 1), p = r + (t - r) * u;
1445
+ i.opacity = p, u < 1 && requestAnimationFrame(o);
1405
1446
  };
1406
- requestAnimationFrame(l);
1407
- };
1408
- let H = null, Ie = null, $e = null, Ne = null, Ze = null;
1409
- const Pt = () => {
1410
- const e = Me(), t = Ve(), o = ye(), { show: s, lineColor: n, centerLineColor: r, divisions: l, size: a, opacity: c } = I(e), { offset: u } = I(t), { bounds: g } = I(o), { get: b } = De(), f = () => {
1411
- const B = Z(n.value), T = Z(r.value), { positions: C, colors: G } = E({
1412
- size: a.value,
1413
- divisions: l.value,
1414
- color: B,
1415
- centerColor: T
1416
- }), d = D(C, G), i = y(c.value);
1417
- return new M.LineSegments(d, i);
1418
- }, E = ({ size: B, divisions: T, color: C, centerColor: G }) => {
1419
- const d = B / 2, i = B / T, x = [], V = [], A = Math.floor(T / 2), j = (L, P, W, _) => {
1420
- x.push(L, P, W);
1421
- const K = _ ? G : C;
1422
- V.push(K.r, K.g, K.b);
1447
+ requestAnimationFrame(o);
1448
+ }, oo = 34815;
1449
+ let V = null, Ne = null, He = null, qe = null;
1450
+ const Gt = () => {
1451
+ const e = Ee(), t = Ve(), s = me(), { show: i, divisions: r, size: n, opacity: o } = $(e), { offset: l } = $(t), { bounds: a } = $(s), { get: u } = we(), p = () => {
1452
+ const b = T(oo), m = b, { positions: B, colors: F } = D({
1453
+ size: n.value,
1454
+ divisions: r.value,
1455
+ color: b,
1456
+ centerColor: m
1457
+ }), z = w(B, F), j = h(o.value);
1458
+ return new I.LineSegments(z, j);
1459
+ }, D = ({ size: b, divisions: m, color: B, centerColor: F }) => {
1460
+ const z = b / 2, j = b / m, Y = [], q = [], g = Math.floor(m / 2), c = (v, L, M, x) => {
1461
+ Y.push(v, L, M);
1462
+ const U = x ? F : B;
1463
+ q.push(U.r, U.g, U.b);
1423
1464
  };
1424
- for (let L = 0; L <= T; L++) {
1425
- const P = -d + L * i, W = L === A;
1426
- for (let _ = 0; _ <= T; _++) {
1427
- const K = -d + _ * i, m = W || _ === A;
1428
- j(-d, P, K, m), j(+d, P, K, m);
1465
+ for (let v = 0; v <= m; v++) {
1466
+ const L = -z + v * j, M = v === g;
1467
+ for (let x = 0; x <= m; x++) {
1468
+ const U = -z + x * j, K = M || x === g;
1469
+ c(-z, L, U, K), c(+z, L, U, K);
1429
1470
  }
1430
1471
  }
1431
- for (let L = 0; L <= T; L++) {
1432
- const P = -d + L * i, W = L === A;
1433
- for (let _ = 0; _ <= T; _++) {
1434
- const K = -d + _ * i, m = W || _ === A;
1435
- j(P, -d, K, m), j(P, +d, K, m);
1472
+ for (let v = 0; v <= m; v++) {
1473
+ const L = -z + v * j, M = v === g;
1474
+ for (let x = 0; x <= m; x++) {
1475
+ const U = -z + x * j, K = M || x === g;
1476
+ c(L, -z, U, K), c(L, +z, U, K);
1436
1477
  }
1437
1478
  }
1438
- for (let L = 0; L <= T; L++) {
1439
- const P = -d + L * i, W = L === A;
1440
- for (let _ = 0; _ <= T; _++) {
1441
- const K = -d + _ * i, m = W || _ === A;
1442
- j(P, K, -d, m), j(P, K, +d, m);
1479
+ for (let v = 0; v <= m; v++) {
1480
+ const L = -z + v * j, M = v === g;
1481
+ for (let x = 0; x <= m; x++) {
1482
+ const U = -z + x * j, K = M || x === g;
1483
+ c(L, U, -z, K), c(L, U, +z, K);
1443
1484
  }
1444
1485
  }
1445
- return { positions: x, colors: V };
1446
- }, D = (B, T) => {
1447
- const C = new M.BufferGeometry();
1448
- return C.setAttribute(
1486
+ return { positions: Y, colors: q };
1487
+ }, w = (b, m) => {
1488
+ const B = new I.BufferGeometry();
1489
+ return B.setAttribute(
1449
1490
  "position",
1450
- new M.Float32BufferAttribute(B, 3)
1451
- ), C.setAttribute("color", new M.Float32BufferAttribute(T, 3)), C;
1452
- }, y = (B) => new M.LineBasicMaterial({
1491
+ new I.Float32BufferAttribute(b, 3)
1492
+ ), B.setAttribute("color", new I.Float32BufferAttribute(m, 3)), B;
1493
+ }, h = (b) => new I.LineBasicMaterial({
1453
1494
  transparent: !0,
1454
- opacity: B,
1495
+ opacity: b,
1455
1496
  depthWrite: !1,
1456
- blending: M.NormalBlending,
1457
- vertexColors: !1
1458
- }), k = () => {
1459
- H && F(s.value);
1497
+ blending: I.NormalBlending,
1498
+ vertexColors: !0
1499
+ }), f = () => {
1500
+ V && y(i.value);
1460
1501
  }, S = () => {
1461
- const B = b();
1462
- H = f(n.value), Q(), B.add(H), w(0);
1463
- }, w = (B) => {
1464
- H && (H.material.transparent = !0, B = s.value ? B : 0, H.material.opacity = B);
1465
- }, F = (B) => {
1466
- const T = B ? c.value : 0;
1467
- Mo(H, T, 500);
1468
- }, Z = (B) => ({
1469
- r: (B >> 16 & 255) / 255,
1470
- g: (B >> 8 & 255) / 255,
1471
- b: (B & 255) / 255
1472
- }), U = (B, T) => {
1473
- if (!H) return;
1474
- const C = Z(B), G = Z(T), d = H.geometry.attributes.color, i = H.geometry.attributes.position, x = i.count, V = a.value / 2, A = a.value / l.value, j = Math.floor(l.value / 2);
1475
- for (let L = 0; L < x; L++) {
1476
- const P = i.getX(L), W = i.getY(L), _ = i.getZ(L), K = Math.round((P + V) / A), re = Math.round((W + V) / A), m = Math.round((_ + V) / A), le = K === j || re === j || m === j ? C : G;
1477
- d.setXYZ(L, le.r, le.g, le.b);
1502
+ const b = u();
1503
+ V = p(), H(), b.add(V), E(0);
1504
+ }, E = (b) => {
1505
+ V && (V.material.transparent = !0, b = i.value ? b : 0, V.material.opacity = b);
1506
+ }, y = (b) => {
1507
+ const m = b ? o.value : 0;
1508
+ so(V, m, 500);
1509
+ }, T = (b) => ({
1510
+ r: (b >> 16 & 255) / 255,
1511
+ g: (b >> 8 & 255) / 255,
1512
+ b: (b & 255) / 255
1513
+ }), P = (b, m) => {
1514
+ if (!V) return;
1515
+ const B = T(b), F = T(m), z = V.geometry.attributes.color, j = V.geometry.attributes.position, Y = j.count, q = n.value / 2, g = n.value / r.value, c = Math.floor(r.value / 2);
1516
+ for (let v = 0; v < Y; v++) {
1517
+ const L = j.getX(v), M = j.getY(v), x = j.getZ(v), U = Math.round((L + q) / g), he = Math.round((M + q) / g), K = Math.round((x + q) / g), Re = U === c || he === c || K === c ? B : F;
1518
+ z.setXYZ(v, Re.r, Re.g, Re.b);
1478
1519
  }
1479
- d.needsUpdate = !0;
1480
- }, Y = () => {
1481
- const B = b();
1482
- H && (B.remove(H), H.geometry.dispose(), H.material.dispose(), H = null), H = f(n.value), Q(), B.add(H);
1483
- }, Q = () => {
1484
- var T;
1485
- const B = ((T = g.value) == null ? void 0 : T.bottom) || 0;
1486
- H.position.set(0, B + a.value / 2 + 7e-3, 0);
1520
+ z.needsUpdate = !0;
1521
+ }, G = () => {
1522
+ const b = u();
1523
+ V && (b.remove(V), V.geometry.dispose(), V.material.dispose(), V = null), V = p(), H(), b.add(V);
1524
+ }, H = () => {
1525
+ var m;
1526
+ const b = ((m = a.value) == null ? void 0 : m.bottom) || 0;
1527
+ V.position.set(0, b + n.value / 2 + 7e-3, 0);
1487
1528
  };
1488
- return Ie = O(
1489
- () => [a.value, l.value],
1490
- ([B, T], [C, G]) => {
1491
- B === C && T === G || (Y(), k());
1529
+ return Ne = O(
1530
+ () => [n.value, r.value],
1531
+ ([b, m], [B, F]) => {
1532
+ b === B && m === F || (G(), f());
1492
1533
  },
1493
1534
  { flush: "post" }
1494
- ), $e = O(
1495
- () => s.value,
1535
+ ), He = O(
1536
+ () => i.value,
1496
1537
  () => {
1497
- k();
1538
+ f();
1498
1539
  },
1499
1540
  { flush: "post" }
1500
- ), Ne = O(
1501
- () => c.value,
1502
- (B) => {
1503
- w(B);
1541
+ ), qe = O(
1542
+ () => o.value,
1543
+ (b) => {
1544
+ E(b);
1504
1545
  },
1505
1546
  { flush: "post" }
1506
- ), Ze = O(
1507
- () => [n.value, r.value],
1508
- ([B, T]) => {
1509
- U(T, B);
1510
- }
1511
1547
  ), {
1512
1548
  init: S,
1513
- showHideGrid: F,
1514
- updateGridColors: U,
1549
+ showHideGrid: y,
1550
+ updateGridColors: P,
1515
1551
  dispose: () => {
1516
- var T, C;
1517
- const B = b();
1518
- Ie == null || Ie(), $e == null || $e(), Ne == null || Ne(), Ze == null || Ze(), Ie = null, $e = null, Ne = null, Ze = null, H && (B.remove(H), (T = H.geometry) == null || T.dispose(), Array.isArray(H.material) ? H.material.forEach((G) => G == null ? void 0 : G.dispose()) : (C = H.material) == null || C.dispose(), H = null);
1552
+ var m, B;
1553
+ const b = u();
1554
+ Ne == null || Ne(), He == null || He(), qe == null || qe(), Ne = null, He = null, qe = null, V && (b.remove(V), (m = V.geometry) == null || m.dispose(), Array.isArray(V.material) ? V.material.forEach((F) => F == null ? void 0 : F.dispose()) : (B = V.material) == null || B.dispose(), V = null);
1519
1555
  }
1520
1556
  };
1521
- }, ko = { class: "three-dimension-tool" }, Eo = ["data-id"], Ao = /* @__PURE__ */ Object.assign({
1557
+ }, no = { class: "three-dimension-tool" }, ro = ["data-id"], io = /* @__PURE__ */ Object.assign({
1522
1558
  name: "ThreeDimensionTool",
1523
1559
  slug: "three-dimension-tool",
1524
1560
  inheritAttrs: !1
@@ -1529,200 +1565,181 @@ const Pt = () => {
1529
1565
  },
1530
1566
  setup(e) {
1531
1567
  const t = e;
1532
- let o = null;
1533
- const s = v(() => Number(t.id)), n = p(), r = Be(), l = ye(), { move: a } = I(r), c = ee(null), u = ee(!1);
1534
- let g, b, f;
1535
- const E = st(), D = xt(), y = wt(), { init: k } = De(), { init: S } = St(), { init: w } = Le(), { init: F, updateVisibility: Z } = Lt(), { init: U, updatePosition: Y } = nt(), { init: Q } = Ft(), { init: q } = Pt(), B = () => {
1536
- if (!c.value || u.value) {
1568
+ let s = null;
1569
+ const i = C(() => Number(t.id)), r = A(), n = ct(), o = fe(), l = me(), { move: a } = $(o), u = pe(null), p = pe(!1);
1570
+ let D, w, h;
1571
+ const f = rt(), S = Mt(), E = Dt(), { init: y, setEnvironment: T } = we(), { init: P } = at(), { init: G } = Le(), { init: H, updateVisibility: Z } = Pt(), { init: b, updatePosition: m } = it(), { init: B } = Rt(), { init: F } = Gt(), z = () => {
1572
+ if (!u.value || p.value) {
1537
1573
  console.warn("Canvas element not found");
1538
1574
  return;
1539
1575
  }
1540
- u.value = !0, f = k(), b = S(c.value), Q(), g = w(), U(), q(), F(), E.init(b), T();
1541
- }, T = () => {
1542
- u.value && (a.value !== o && (o = a.value, a.value ? y.activate() : D.activate()), E.update(), a.value ? (Y(), y.syncToStore()) : D.syncToStore(), Z(), b.render(f, g), requestAnimationFrame(T));
1543
- }, C = () => {
1544
- if (c.value) {
1545
- const G = window.innerWidth, d = window.innerHeight;
1546
- n.$patch({ width: G, height: d }), c.value.style.height = d + "px";
1576
+ p.value = !0, h = y(), w = P(u.value), T(w), B(), D = G(), b(), F(), H(), f.init(w), j();
1577
+ }, j = () => {
1578
+ p.value && (a.value !== s && (s = a.value, a.value ? E.activate() : S.activate()), f.update(), a.value ? (m(), E.syncToStore()) : S.syncToStore(), Z(), w.render(h, D), requestAnimationFrame(j));
1579
+ }, Y = () => {
1580
+ if (u.value) {
1581
+ const q = window.innerWidth, g = window.innerHeight;
1582
+ r.$patch({ width: q, height: g }), u.value.style.height = g + "px";
1547
1583
  }
1548
1584
  };
1549
- return Xt(() => {
1550
- console.log("onMounted", c.value), B(), window.addEventListener("resize", C), C();
1585
+ return jt(() => {
1586
+ console.log("onMounted", u.value), z(), window.addEventListener("resize", Y), Y();
1551
1587
  }), O(
1552
1588
  () => l.bounds,
1553
- (G) => {
1554
- G && (E.frameToBounds(G), y.activate(), y.frameToBounds(G), y.syncToStore(), D.activate(), D.frameToBounds(G), D.syncToStore());
1589
+ (q) => {
1590
+ q && (E.activate(), o.hasRig || (E.frameToBounds(q), E.syncToStore(), o.markFramed()), S.activate(), n.hasRig || (S.frameToBounds(q), S.syncToStore(), n.markFramed()));
1555
1591
  }
1556
1592
  ), O(
1557
- () => n.subjectLoaded,
1558
- (G) => {
1559
- if (!G) return;
1560
- const d = l.bounds;
1561
- if (!d) return;
1562
- E.frameToBounds(d);
1563
- const i = E.get();
1564
- i.update(), i.saveState();
1593
+ () => r.subjectLoaded,
1594
+ (q) => {
1595
+ if (!q) return;
1596
+ const g = l.bounds;
1597
+ if (!g) return;
1598
+ n.hasRig || (f.frameToBounds(g), n.markFramed());
1599
+ const c = f.get();
1600
+ c.update(), c.saveState();
1565
1601
  }
1566
- ), Rt(() => {
1567
- console.debug("ThreeDimensionTool unMounted"), window.removeEventListener("resize", this), u.value = !1, Ft().dispose(), Pt().dispose(), Lt().dispose(), nt().dispose(), st().dispose(), Le().dispose(), De().dispose(), St().dispose();
1568
- }), (G, d) => (Je(), Yt("div", ko, [
1569
- ht("", !0),
1570
- Qt("div", {
1602
+ ), _t(() => {
1603
+ console.debug("ThreeDimensionTool unMounted"), window.removeEventListener("resize", this), p.value = !1, Rt().dispose(), Gt().dispose(), Pt().dispose(), it().dispose(), rt().dispose(), Le().dispose(), we().dispose(), at().dispose();
1604
+ }), (q, g) => (nt(), rs("div", no, [
1605
+ vt("", !0),
1606
+ is("div", {
1571
1607
  class: "tres",
1572
1608
  ref_key: "tres",
1573
- ref: c,
1574
- "data-id": s.value
1575
- }, null, 8, Eo)
1609
+ ref: u,
1610
+ "data-id": i.value
1611
+ }, null, 8, ro)
1576
1612
  ]));
1577
1613
  }
1578
- }), Gt = /* @__PURE__ */ Object.assign({ "../i18n/en-US/index.js": () => import("./index-CIql5zKW.js") }), J = (e = "../i18n") => {
1579
- const t = no(), o = ee({}), s = v(() => t.lang.isoName || "en-US"), n = async () => {
1580
- const r = `${e}/${s.value}/index.js`;
1581
- if (Gt[r])
1614
+ }), Ft = /* @__PURE__ */ Object.assign({ "../i18n/en-US/index.js": () => import("./index-CwHAnjEe.js") }), W = (e = "../i18n") => {
1615
+ const t = ps(), s = pe({}), i = C(() => t.lang.isoName || "en-US"), r = async () => {
1616
+ const n = `${e}/${i.value}/index.js`;
1617
+ if (Ft[n])
1582
1618
  try {
1583
- const l = await Gt[r]();
1584
- l.default && Object.assign(o.value, l.default);
1585
- } catch (l) {
1586
- console.error(`Error loading i18n for ${s.value}`, l);
1619
+ const o = await Ft[n]();
1620
+ o.default && Object.assign(s.value, o.default);
1621
+ } catch (o) {
1622
+ console.error(`Error loading i18n for ${i.value}`, o);
1587
1623
  }
1588
1624
  else
1589
- console.error(`Module not found: ${r}`);
1625
+ console.error(`Module not found: ${n}`);
1590
1626
  };
1591
1627
  return O(
1592
- () => s.value,
1628
+ () => i.value,
1593
1629
  () => {
1594
- n();
1630
+ r();
1595
1631
  },
1596
1632
  { immediate: !0 }
1597
- ), Wt(() => {
1598
- n();
1599
- }), { lang: o };
1600
- }, Se = ({ tab: e = oe, store: t, options: o = [] }) => {
1601
- const s = ao(), n = p(s), r = v({
1602
- get: () => n.isExpanded(o),
1603
- set: (c) => {
1604
- c && n.setActive(e);
1633
+ ), as(() => {
1634
+ r();
1635
+ }), { lang: s };
1636
+ }, oe = ({ tab: e = se, store: t, options: s = [] }) => {
1637
+ const i = bs(), r = A(i), n = C({
1638
+ get: () => r.isExpanded(s),
1639
+ set: (a) => {
1640
+ a && r.setActive(e);
1605
1641
  }
1606
- }), l = v(() => t && t.changed);
1607
- return { click: () => n.setActive(e), expanded: r, selected: l };
1608
- }, Dt = $({
1642
+ }), o = C(() => t && t.changed);
1643
+ return { click: () => r.setActive(e), expanded: n, selected: o };
1644
+ }, Tt = R({
1609
1645
  name: "ToolResetButton",
1610
1646
  props: {
1611
1647
  label: { type: String, required: !1, default: "Reset" },
1612
1648
  disable: Boolean
1613
1649
  },
1614
1650
  emits: ["click"],
1615
- setup(e, { slots: t, emit: o }) {
1616
- function s() {
1617
- o("click");
1651
+ setup(e, { slots: t, emit: s }) {
1652
+ function i() {
1653
+ s("click");
1618
1654
  }
1619
- function n() {
1620
- const r = {
1655
+ function r() {
1656
+ const n = {
1621
1657
  label: e.label,
1622
1658
  class: "full-width",
1623
1659
  flat: !0,
1624
- onClick: s,
1660
+ onClick: i,
1625
1661
  disable: e.disable
1626
1662
  };
1627
- return h("div", { class: "tool-reset-button q-pa-md" }, h(Ot, r));
1663
+ return d("div", { class: "tool-reset-button q-pa-md" }, d(Ut, n));
1628
1664
  }
1629
- return () => n();
1665
+ return () => r();
1630
1666
  }
1631
- }), It = $({
1667
+ }), Yt = R({
1632
1668
  name: "TdColorsSection",
1633
- setup(e, { slots: t, emit: o }) {
1634
- const { lang: s } = J(), n = p(), r = lt(), l = ye(), a = Ve(), { active: c } = I(n), u = ee(!1), g = ee(!1), b = ee(!1), f = v(
1635
- () => {
1636
- var C;
1637
- return (C = s.value.td) == null ? void 0 : C.components.colors.items.background;
1638
- }
1639
- ), E = v(
1669
+ setup(e, { slots: t, emit: s }) {
1670
+ const { lang: i } = W(), r = A(), n = ut(), o = Ve(), { active: l } = $(r), a = pe(!1), u = pe(!1), p = C(
1640
1671
  () => {
1641
- var C;
1642
- return (C = s.value.td) == null ? void 0 : C.components.colors.items.subject;
1672
+ var b;
1673
+ return (b = i.value.td) == null ? void 0 : b.components.colors.items.background;
1643
1674
  }
1644
- ), D = v(
1675
+ ), D = C(
1645
1676
  () => {
1646
- var C;
1647
- return (C = s.value.td) == null ? void 0 : C.components.colors.items.ground;
1677
+ var b;
1678
+ return (b = i.value.td) == null ? void 0 : b.components.colors.items.ground;
1648
1679
  }
1649
- ), y = v(() => ({
1650
- key: E.value,
1651
- label: E.value,
1652
- type: "none",
1653
- icon: "f_subject",
1654
- size: "sm",
1655
- color: l.colorHex,
1656
- onClick: () => g.value = !0
1657
- })), k = v(() => ({
1658
- key: f.value,
1659
- label: f.value,
1680
+ ), w = C(() => ({
1681
+ key: p.value,
1682
+ label: p.value,
1660
1683
  type: "none",
1661
1684
  icon: "f_scene",
1662
1685
  size: "sm",
1663
- color: r.colorHex,
1664
- onClick: () => u.value = !0
1665
- })), S = v(() => ({
1686
+ color: n.colorHex,
1687
+ onClick: () => a.value = !0
1688
+ })), h = C(() => ({
1666
1689
  key: D.value,
1667
1690
  label: D.value,
1668
1691
  type: "none",
1669
1692
  icon: "f_ground",
1670
1693
  size: "sm",
1671
- color: a.colorHex,
1672
- onClick: () => b.value = !0
1673
- })), w = v({
1674
- get: () => b.value || u.value || g.value,
1675
- set: (C) => b.value = u.value = g.value = !1
1676
- }), F = v({
1677
- get: () => b.value ? a.colorHex : u.value ? r.colorHex : l.colorHex,
1678
- set: (C) => {
1679
- if (console.log("showGround", b.value), b.value) {
1680
- console.log("val", C), a.setColorHex(C);
1681
- return;
1682
- }
1694
+ color: o.colorHex,
1695
+ onClick: () => u.value = !0
1696
+ })), f = C({
1697
+ get: () => u.value || a.value,
1698
+ set: (b) => u.value = a.value = !1
1699
+ }), S = C({
1700
+ get: () => u.value ? o.colorHex : n.colorHex,
1701
+ set: (b) => {
1683
1702
  if (u.value) {
1684
- r.setColorHex(C);
1703
+ o.setColorHex(b);
1685
1704
  return;
1686
1705
  }
1687
- l.setColorHex(C);
1706
+ n.setColorHex(b);
1688
1707
  }
1689
- }), Z = v(() => ({
1708
+ }), E = C(() => ({
1690
1709
  class: "td-colors-tool q-pa-xs row justify-center items-center q-gutter-md",
1691
- style: w.value ? "display: none" : ""
1692
- })), U = v(() => ({
1693
- modelValue: F.value,
1694
- "onUpdate:modelValue": (C) => F.value = C,
1695
- show: w.value,
1696
- "onUpdate:show": (C) => w.value = C,
1697
- label: Y.value
1698
- })), Y = v(() => b.value ? D.value : u.value ? f.value : E.value), Q = () => {
1699
- r.reset(), l.resetColor(), a.reset();
1700
- }, q = v(() => l.changed || a.changed || r.changed), B = v(() => ({
1710
+ style: f.value ? "display: none" : ""
1711
+ })), y = C(() => ({
1712
+ modelValue: S.value,
1713
+ "onUpdate:modelValue": (b) => S.value = b,
1714
+ show: f.value,
1715
+ "onUpdate:show": (b) => f.value = b,
1716
+ label: T.value
1717
+ })), T = C(() => u.value ? D.value : p.value), P = () => {
1718
+ n.reset(), o.reset();
1719
+ }, G = C(() => o.changed || n.changed), H = C(() => ({
1701
1720
  label: "Reset Colors",
1702
- onClick: Q,
1703
- style: w.value ? "display: none" : "",
1704
- disable: !q.value
1721
+ onClick: P,
1722
+ style: f.value ? "display: none" : "",
1723
+ disable: !G.value
1705
1724
  }));
1706
- O(c, (C) => {
1707
- C !== oe && (w.value = !1);
1725
+ O(l, (b) => {
1726
+ b !== se && (f.value = !1);
1708
1727
  });
1709
- function T() {
1710
- return h("div", {
1728
+ function Z() {
1729
+ return d("div", {
1711
1730
  class: "full-width"
1712
- // style: pickerShow.value ? 'display: none' : '',
1713
1731
  }, [
1714
- h("div", Z.value, [
1715
- h(ne, y.value),
1716
- h(ne, k.value),
1717
- h(ne, S.value)
1732
+ d("div", E.value, [
1733
+ d(Ce, w.value),
1734
+ d(Ce, h.value)
1718
1735
  ]),
1719
- h(Dt, B.value),
1720
- h(qt, U.value)
1736
+ d(Tt, H.value),
1737
+ d(fs, y.value)
1721
1738
  ]);
1722
1739
  }
1723
- return () => T();
1740
+ return () => Z();
1724
1741
  }
1725
- }), zo = $({
1742
+ }), ao = R({
1726
1743
  name: "TdColorsExpansion",
1727
1744
  props: {
1728
1745
  modelValue: { type: Number, default: 0 },
@@ -1730,101 +1747,103 @@ const Pt = () => {
1730
1747
  label: { type: String, required: !1 }
1731
1748
  },
1732
1749
  emits: ["click", "update:modelValue"],
1733
- setup(e, { slots: t, emit: o }) {
1734
- const { lang: s } = J(), n = Ut(), { expanded: r, selected: l } = Se({
1735
- store: n,
1736
- options: oe,
1737
- tab: oe
1738
- }), a = v(() => {
1750
+ setup(e, { slots: t, emit: s }) {
1751
+ const { lang: i } = W(), r = It(), { expanded: n, selected: o } = oe({
1752
+ store: r,
1753
+ options: se,
1754
+ tab: se
1755
+ }), l = C(() => {
1739
1756
  var u;
1740
- return (u = s.value.td) == null ? void 0 : u.components.colors.title;
1757
+ return (u = i.value.td) == null ? void 0 : u.components.colors.title;
1741
1758
  });
1742
- v({
1759
+ C({
1743
1760
  get: () => e.modelValue,
1744
- set: (u) => o("update:modelValue", u)
1761
+ set: (u) => s("update:modelValue", u)
1745
1762
  });
1746
- function c() {
1763
+ function a() {
1747
1764
  const u = {
1748
1765
  class: "td-colors-expansion",
1749
1766
  "data-cy": "td-colors-expansion",
1750
- modelValue: r.value,
1751
- "onUpdate:modelValue": (g) => r.value = g,
1752
- label: a.value,
1753
- selected: l.value,
1767
+ modelValue: n.value,
1768
+ "onUpdate:modelValue": (p) => n.value = p,
1769
+ label: l.value,
1770
+ selected: o.value,
1754
1771
  icon: "f_palette"
1755
1772
  };
1756
- return h(rt, u, () => h(It));
1773
+ return d(We, u, () => d(Yt));
1757
1774
  }
1758
- return () => c();
1775
+ return () => a();
1759
1776
  }
1760
- }), $t = $({
1777
+ }), Qt = R({
1761
1778
  name: "TdGridSection",
1762
- setup(e, { slots: t, emit: o }) {
1763
- const { lang: s } = J(), n = Me(), r = v(
1779
+ setup(e, { slots: t, emit: s }) {
1780
+ const { lang: i } = W(), r = Ee(), n = C(
1764
1781
  () => {
1765
- var f, E;
1766
- return l.value ? ((f = s.value.td) == null ? void 0 : f.components.grid.toggle.off) || "" : ((E = s.value.td) == null ? void 0 : E.components.grid.toggle.on) || "";
1782
+ var w, h;
1783
+ return o.value ? ((w = i.value.td) == null ? void 0 : w.components.grid.toggle.off) || "" : ((h = i.value.td) == null ? void 0 : h.components.grid.toggle.on) || "";
1767
1784
  }
1768
- ), l = v({
1769
- get: () => n.show,
1770
- set: (f) => n.setProperty("show", f)
1771
- }), a = v({
1772
- get: () => n.opacity,
1773
- set: (f) => n.setProperty("opacity", f)
1774
- }), c = v({
1775
- get: () => n.size,
1776
- set: (f) => n.setProperty("size", f)
1777
- }), u = v({
1778
- get: () => n.divisions,
1779
- set: (f) => n.setProperty("divisions", f)
1780
- }), g = v(() => ({
1785
+ ), o = C({
1786
+ get: () => r.show,
1787
+ set: (w) => r.setProperty("show", w)
1788
+ }), l = C({
1789
+ get: () => r.opacity,
1790
+ set: (w) => r.setProperty("opacity", w)
1791
+ }), a = C({
1792
+ get: () => r.size,
1793
+ set: (w) => r.setProperty("size", w)
1794
+ }), u = C({
1795
+ get: () => r.divisions,
1796
+ set: (w) => r.setProperty("divisions", w)
1797
+ }), p = C(() => ({
1781
1798
  label: "Reset Grid",
1782
- disable: !n.changed,
1783
- onClick: n.reset
1799
+ disable: !r.changed,
1800
+ onClick: r.reset
1784
1801
  }));
1785
- function b() {
1786
- const f = {
1802
+ function D() {
1803
+ const w = {
1787
1804
  class: "td-grid-tool"
1788
- }, E = {
1805
+ }, h = {
1789
1806
  access: "grd",
1790
1807
  // drawer: !props.noIcons,
1791
- modelValue: l.value,
1792
- "onUpdate:modelValue": (w) => l.value = w,
1793
- label: r.value
1808
+ modelValue: o.value,
1809
+ "onUpdate:modelValue": (T) => o.value = T,
1810
+ label: n.value
1794
1811
  // dark: props.dark,
1795
1812
  // disable: props.disable,
1796
1813
  // hasAccess: props.hasAccess,
1797
1814
  // onBlockAccess: emitBlockAccess,
1798
- }, D = {
1815
+ }, f = {
1799
1816
  title: "Opacity",
1800
1817
  icon: "f_opacity",
1801
1818
  min: 1,
1802
1819
  max: 100,
1803
1820
  initial: 50,
1804
- modelValue: a.value * 100,
1805
- "onUpdate:modelValue": (w) => a.value = w / 100
1806
- }, y = {
1821
+ modelValue: l.value * 100,
1822
+ "onUpdate:modelValue": (T) => l.value = T / 100
1823
+ }, S = {
1807
1824
  title: "Size",
1808
1825
  icon: "f_size",
1809
1826
  min: 100,
1810
1827
  max: 300,
1811
1828
  initial: 200,
1812
- modelValue: c.value * 100,
1813
- "onUpdate:modelValue": (w) => c.value = w / 100
1814
- }, k = {
1829
+ modelValue: a.value * 100,
1830
+ "onUpdate:modelValue": (T) => a.value = T / 100
1831
+ }, E = {
1815
1832
  title: "Number of lines",
1816
1833
  icon: "f_grid",
1817
1834
  min: 2,
1818
1835
  max: 10,
1836
+ // Even-only so a grid line always passes through the model's center
1837
+ step: 2,
1819
1838
  initial: 6,
1820
1839
  modelValue: u.value,
1821
- "onUpdate:modelValue": (w) => u.value = w
1822
- }, S = [h(Ke, E)];
1823
- return l.value && (S.push(h(dt, y)), S.push(h(dt, k)), S.push(h(dt, D)), S.push(h(Dt, g.value))), h("div", f, S);
1840
+ "onUpdate:modelValue": (T) => u.value = T
1841
+ }, y = [d(Ot, h)];
1842
+ return o.value && (y.push(d(Ke, S)), y.push(d(Ke, E)), y.push(d(Ke, f)), y.push(d(Tt, p.value))), d("div", w, y);
1824
1843
  }
1825
- return () => b();
1844
+ return () => D();
1826
1845
  }
1827
- }), To = $({
1846
+ }), lo = R({
1828
1847
  name: "TdGridExpansion",
1829
1848
  props: {
1830
1849
  modelValue: { type: Number, default: 0 },
@@ -1832,34 +1851,34 @@ const Pt = () => {
1832
1851
  label: { type: String, required: !1 }
1833
1852
  },
1834
1853
  emits: ["click", "update:modelValue"],
1835
- setup(e, { slots: t, emit: o }) {
1836
- const { lang: s } = J(), n = Me(), { expanded: r, selected: l } = Se({
1837
- store: n,
1838
- options: xe,
1839
- tab: xe
1840
- }), a = v(() => {
1854
+ setup(e, { slots: t, emit: s }) {
1855
+ const { lang: i } = W(), r = Ee(), { expanded: n, selected: o } = oe({
1856
+ store: r,
1857
+ options: Se,
1858
+ tab: Se
1859
+ }), l = C(() => {
1841
1860
  var u;
1842
- return (u = s.value.td) == null ? void 0 : u.components.grid.title;
1861
+ return (u = i.value.td) == null ? void 0 : u.components.grid.title;
1843
1862
  });
1844
- v({
1863
+ C({
1845
1864
  get: () => e.modelValue,
1846
- set: (u) => o("update:modelValue", u)
1865
+ set: (u) => s("update:modelValue", u)
1847
1866
  });
1848
- function c() {
1867
+ function a() {
1849
1868
  const u = {
1850
1869
  class: "td-colors-expansion",
1851
1870
  "data-cy": "td-colors-expansion",
1852
- modelValue: r.value,
1853
- "onUpdate:modelValue": (g) => r.value = g,
1854
- label: a.value,
1855
- selected: l.value,
1871
+ modelValue: n.value,
1872
+ "onUpdate:modelValue": (p) => n.value = p,
1873
+ label: l.value,
1874
+ selected: o.value,
1856
1875
  icon: "f_grid"
1857
1876
  };
1858
- return h(rt, u, () => h($t));
1877
+ return d(We, u, () => d(Qt));
1859
1878
  }
1860
- return () => c();
1879
+ return () => a();
1861
1880
  }
1862
- }), Nt = $({
1881
+ }), Jt = R({
1863
1882
  name: "TdLightsSection",
1864
1883
  props: {
1865
1884
  modelValue: { type: Number, default: 0 },
@@ -1867,172 +1886,90 @@ const Pt = () => {
1867
1886
  label: { type: String, required: !1 }
1868
1887
  },
1869
1888
  emits: ["click", "update:modelValue"],
1870
- setup(e, { slots: t, emit: o }) {
1871
- const { lang: s } = J(), n = Be(), r = p(), l = nt(), { active: a } = I(r), c = v({
1872
- get: () => n.advancedMode,
1873
- set: (m) => n.setAdvanced(m)
1874
- }), u = v({
1875
- get: () => n.move,
1876
- set: (m) => n.setMove(m)
1877
- }), g = v(
1878
- () => {
1879
- var m, N;
1880
- return n.advancedMode ? ((m = s.value.td) == null ? void 0 : m.components.lights.toggles.advanced.off) || "" : ((N = s.value.td) == null ? void 0 : N.components.lights.toggles.advanced.on) || "";
1881
- }
1882
- ), b = v(() => ({
1883
- modelValue: c.value,
1884
- "onUpdate:modelValue": (m) => c.value = m,
1885
- label: g.value
1886
- })), f = v(
1887
- () => {
1888
- var m, N;
1889
- return n.move ? ((m = s.value.td) == null ? void 0 : m.components.lights.toggles.position.off) || "" : ((N = s.value.td) == null ? void 0 : N.components.lights.toggles.position.on) || "";
1890
- }
1891
- ), E = v(() => ({
1892
- modelValue: u.value,
1893
- "onUpdate:modelValue": (m) => u.value = m,
1894
- label: f.value
1895
- })), D = v(
1896
- () => {
1897
- var m;
1898
- return ((m = s.value.td) == null ? void 0 : m.components.lights.color) || "";
1899
- }
1900
- ), y = ee(!1), k = v(() => ({
1901
- key: D.value,
1902
- label: D.value,
1903
- type: "none",
1904
- icon: "f_bulb_light",
1905
- size: "sm",
1906
- color: n.colorHex("key"),
1907
- onClick: () => y.value = !0
1908
- })), S = v(
1889
+ setup() {
1890
+ const { lang: e } = W(), t = fe(), s = A(), i = me(), r = it(), n = Dt(), o = Mt(), { active: l } = $(s), a = C({
1891
+ get: () => t.move,
1892
+ set: (m) => t.setMove(m)
1893
+ }), u = C(
1909
1894
  () => {
1910
- var m;
1911
- return ((m = s.value.td) == null ? void 0 : m.components.lights.labels.key) || "";
1895
+ var m, B;
1896
+ return t.move ? ((m = e.value.td) == null ? void 0 : m.components.lights.toggles.position.off) || "" : ((B = e.value.td) == null ? void 0 : B.components.lights.toggles.position.on) || "";
1912
1897
  }
1913
- ), w = ee(!1), F = v({
1914
- get: () => n.colorHex("key"),
1915
- set: (m) => n.setColorHex("key", m)
1916
- }), Z = v(() => ({
1917
- key: S.value,
1918
- label: S.value,
1919
- type: "none",
1920
- icon: "f_bulb_key",
1921
- size: "sm",
1922
- color: F.value,
1923
- onClick: () => w.value = !0
1924
- })), U = v(
1898
+ ), p = C(() => ({
1899
+ modelValue: a.value,
1900
+ "onUpdate:modelValue": (m) => a.value = m,
1901
+ label: u.value
1902
+ })), D = C(
1925
1903
  () => {
1926
1904
  var m;
1927
- return ((m = s.value.td) == null ? void 0 : m.components.lights.labels.back) || "";
1905
+ return ((m = e.value.td) == null ? void 0 : m.components.lights.ambientIntensity) || "";
1928
1906
  }
1929
- ), Y = ee(!1), Q = v({
1930
- get: () => n.colorHex("back"),
1931
- set: (m) => n.setColorHex("back", m)
1932
- }), q = v(() => ({
1933
- key: U.value,
1934
- label: U.value,
1935
- type: "none",
1936
- icon: "f_bulb_back",
1937
- size: "sm",
1938
- color: Q.value,
1939
- onClick: () => Y.value = !0,
1940
- disable: !T.value
1941
- })), B = v(
1942
- () => {
1943
- var m, N;
1944
- return T.value ? ((m = s.value.td) == null ? void 0 : m.components.lights.toggles.back.off) || "" : ((N = s.value.td) == null ? void 0 : N.components.lights.toggles.back.on) || "";
1945
- }
1946
- ), T = v({
1947
- get: () => n.property("back", "visible", !0),
1948
- set: (m) => n.setProperty("back", "visible", m)
1949
- }), C = v(() => ({
1950
- modelValue: T.value,
1951
- "onUpdate:modelValue": (m) => T.value = m,
1952
- label: B.value
1953
- })), G = v(
1907
+ ), w = C(
1954
1908
  () => {
1955
1909
  var m;
1956
- return ((m = s.value.td) == null ? void 0 : m.components.lights.labels.fill) || "";
1910
+ return ((m = e.value.td) == null ? void 0 : m.components.lights.userIntensity) || "";
1957
1911
  }
1958
- ), d = ee(!1), i = v({
1959
- get: () => n.colorHex("fill"),
1960
- set: (m) => n.setColorHex("fill", m)
1961
- }), x = v(() => ({
1962
- key: G.value,
1963
- label: G.value,
1964
- type: "none",
1965
- icon: "f_bulb_fill",
1966
- size: "sm",
1967
- color: i.value,
1968
- onClick: () => d.value = !0,
1969
- disable: !A.value
1970
- })), V = v(
1971
- () => {
1972
- var m, N;
1973
- return A.value ? ((m = s.value.td) == null ? void 0 : m.components.lights.toggles.fill.off) || "" : ((N = s.value.td) == null ? void 0 : N.components.lights.toggles.fill.on) || "";
1974
- }
1975
- ), A = v({
1976
- get: () => n.property("fill", "visible", !0),
1977
- set: (m) => n.setProperty("fill", "visible", m)
1978
- }), j = v(() => ({
1979
- modelValue: A.value,
1980
- "onUpdate:modelValue": (m) => A.value = m,
1981
- label: V.value
1982
- })), L = v({
1983
- get: () => y.value || w.value || d.value || Y.value,
1984
- set: (m) => y.value = w.value = d.value = Y.value = !1
1985
- }), P = v({
1986
- get: () => y.value || w.value ? n.colorHex("key") : d.value ? n.colorHex("fill") : n.colorHex("back"),
1987
- set: (m) => {
1988
- if (y.value || w.value) {
1989
- n.setColorHex("key", m);
1990
- return;
1991
- }
1992
- if (d.value) {
1993
- n.setColorHex("fill", m);
1994
- return;
1995
- }
1996
- n.setColorHex("back", m);
1912
+ ), h = 0, f = 50, S = 100, E = (m, B, F) => ({
1913
+ toSlider: (z) => z <= B ? h + (z - m) / (B - m) * (f - h) : f + (z - B) / (F - B) * (S - f),
1914
+ fromSlider: (z) => z <= f ? m + (z - h) / (f - h) * (B - m) : B + (z - f) / (S - f) * (F - B)
1915
+ }), y = E(
1916
+ Be,
1917
+ te,
1918
+ yt
1919
+ ), T = E(
1920
+ Be,
1921
+ te,
1922
+ St
1923
+ ), P = (m, B, F, z) => ({
1924
+ title: m,
1925
+ icon: "f_brightness",
1926
+ min: h,
1927
+ max: S,
1928
+ modelValue: B.toSlider(F),
1929
+ "onUpdate:modelValue": (j) => {
1930
+ z(B.fromSlider(j));
1997
1931
  }
1998
- }), W = v(() => ({
1999
- modelValue: P.value,
2000
- "onUpdate:modelValue": (m) => P.value = m,
2001
- show: L.value,
2002
- "onUpdate:show": (m) => L.value = m,
2003
- label: _.value
2004
- })), _ = v(() => y.value ? D.value : w.value ? S.value : d.value ? G.value : U.value), K = v(() => ({
1932
+ }), G = C(
1933
+ () => P(
1934
+ D.value,
1935
+ y,
1936
+ t.ambientScale,
1937
+ (m) => t.setAmbientScale(m)
1938
+ )
1939
+ ), H = C(
1940
+ () => P(
1941
+ w.value,
1942
+ T,
1943
+ t.userScale,
1944
+ (m) => t.setUserScale(m)
1945
+ )
1946
+ ), Z = C(() => ({
2005
1947
  label: "Reset Lights",
2006
- disable: !n.changed,
1948
+ disable: !t.changed,
2007
1949
  onClick: () => {
2008
- n.reset(), l.applyFromStore();
1950
+ var B;
1951
+ t.reset();
1952
+ const m = i.bounds;
1953
+ m && (n.activate(), n.frameToBounds(m), n.syncToStore(), o.activate()), (B = r.applyFromStore) == null || B.call(r);
2009
1954
  }
2010
1955
  }));
2011
- O(c, (m) => {
2012
- m || (A.value = !0, T.value = !0);
2013
- }), O(a, (m) => {
2014
- m !== ve && (L.value = !1, u.value = !1);
1956
+ O(l, (m) => {
1957
+ m !== de && (a.value = !1);
2015
1958
  });
2016
- function re() {
1959
+ function b() {
2017
1960
  const m = {
2018
1961
  class: "td-lights-tool"
2019
- };
2020
- let N = [];
2021
- if (L.value)
2022
- N = [h(qt, W.value)];
2023
- else {
2024
- const le = {
2025
- class: "td-colors-tool q-pa-xs row justify-center items-center q-gutter-md"
2026
- }, ue = [];
2027
- c.value ? (ue.push(h(ne, Z.value)), ue.push(h(ne, x.value)), ue.push(h(ne, q.value))) : ue.push(h(ne, k.value));
2028
- const je = [];
2029
- je.push(h(Ke, E.value)), c.value && (je.push(h(Ke, j.value)), je.push(h(Ke, C.value))), je.push(h(Ke, b.value)), N = [h("div", le, ue), ...je], N.push(h(Dt, K.value));
2030
- }
2031
- return h("div", m, N);
1962
+ }, B = [
1963
+ d(Ot, p.value),
1964
+ d(Ke, G.value),
1965
+ d(Ke, H.value),
1966
+ d(Tt, Z.value)
1967
+ ];
1968
+ return d("div", m, B);
2032
1969
  }
2033
- return () => re();
1970
+ return () => b();
2034
1971
  }
2035
- }), Lo = $({
1972
+ }), co = R({
2036
1973
  name: "TdLightExpansion",
2037
1974
  props: {
2038
1975
  modelValue: { type: Number, default: 0 },
@@ -2040,70 +1977,177 @@ const Pt = () => {
2040
1977
  label: { type: String, required: !1 }
2041
1978
  },
2042
1979
  emits: ["click", "update:modelValue"],
2043
- setup(e, { slots: t, emit: o }) {
2044
- const { lang: s } = J(), n = Be(), { expanded: r, selected: l } = Se({
2045
- store: n,
2046
- options: ve,
2047
- tab: ve
2048
- }), a = v(() => {
1980
+ setup(e, { slots: t, emit: s }) {
1981
+ const { lang: i } = W(), r = fe(), { expanded: n, selected: o } = oe({
1982
+ store: r,
1983
+ options: de,
1984
+ tab: de
1985
+ }), l = C(() => {
2049
1986
  var u;
2050
- return (u = s.value.td) == null ? void 0 : u.components.lights.title;
1987
+ return (u = i.value.td) == null ? void 0 : u.components.lights.title;
2051
1988
  });
2052
- v({
1989
+ C({
2053
1990
  get: () => e.modelValue,
2054
- set: (u) => o("update:modelValue", u)
1991
+ set: (u) => s("update:modelValue", u)
2055
1992
  });
2056
- function c() {
1993
+ function a() {
2057
1994
  const u = {
2058
1995
  class: "td-lights-expansion",
2059
1996
  "data-cy": "td-lights-expansion",
2060
- modelValue: r.value,
2061
- "onUpdate:modelValue": (g) => r.value = g,
2062
- label: a.value,
2063
- selected: l.value,
1997
+ modelValue: n.value,
1998
+ "onUpdate:modelValue": (p) => n.value = p,
1999
+ label: l.value,
2000
+ selected: o.value,
2064
2001
  icon: "f_bulb_light"
2065
2002
  };
2066
- return h(rt, u, () => h(Nt));
2003
+ return d(We, u, () => d(Jt));
2067
2004
  }
2068
- return () => c();
2005
+ return () => a();
2069
2006
  }
2070
- }), Zt = $({
2007
+ }), es = R({
2071
2008
  name: "TdRelatedSection",
2072
- setup(e, { slots: t, emit: o }) {
2073
- const s = Symbol.for("RelatedThreeDSection"), n = Jt(s), r = p(), l = ye(), { poseId: a } = I(l);
2074
- function c() {
2075
- const u = {
2009
+ setup() {
2010
+ const e = Symbol.for("RelatedSection"), t = xt(e);
2011
+ function s() {
2012
+ const i = {
2076
2013
  class: "td-related-section q-mx-lg q-my-sm"
2077
- }, g = [];
2078
- return n && a.value && g.push(
2079
- h(n, {
2080
- id: a.value,
2081
- glbId: r.selected
2082
- })
2083
- ), h("div", u, g);
2014
+ }, r = [];
2015
+ return t && r.push(d(t)), d("div", i, r);
2084
2016
  }
2085
- return () => c();
2017
+ return () => s();
2086
2018
  }
2087
- }), Vo = $({
2019
+ }), uo = R({
2088
2020
  name: "TdRelatedExpansion",
2089
- setup(e, { slots: t, emit: o }) {
2090
- const { expanded: s } = Se({
2091
- options: we,
2092
- tab: we
2093
- }), n = v(() => "Related");
2094
- function r() {
2095
- const l = {
2021
+ setup(e, { slots: t, emit: s }) {
2022
+ const { expanded: i } = oe({
2023
+ options: xe,
2024
+ tab: xe
2025
+ }), r = C(() => "Related");
2026
+ function n() {
2027
+ const o = {
2096
2028
  class: "td-related-expansion",
2097
- modelValue: s.value,
2098
- "onUpdate:modelValue": (a) => s.value = a,
2099
- label: n.value,
2029
+ modelValue: i.value,
2030
+ "onUpdate:modelValue": (l) => i.value = l,
2031
+ label: r.value,
2100
2032
  icon: "f_related"
2101
2033
  };
2102
- return h(rt, l, () => h(Zt));
2034
+ return d(We, o, () => d(es));
2103
2035
  }
2104
- return () => r();
2036
+ return () => n();
2037
+ }
2038
+ });
2039
+ function po() {
2040
+ const { freeServer: e, paidServer: t } = vs();
2041
+ return ys({ freeServer: e, paidServer: t });
2042
+ }
2043
+ const mo = Symbol.for("activity-tracking"), fo = ["nude", "muscle", "smooth"];
2044
+ function ho() {
2045
+ const e = A(), t = me(), s = xt(mo, null), { getThumbnail: i } = po();
2046
+ return { skins: C(() => {
2047
+ const n = e.setUuid, o = e.selected, l = {};
2048
+ return Object.values(t.models).forEach((a) => {
2049
+ !(a != null && a.slug) || l[a.slug] || (l[a.slug] = a);
2050
+ }), fo.filter((a) => l[a]).map((a) => {
2051
+ const u = l[a];
2052
+ return {
2053
+ id: u.id,
2054
+ slug: a,
2055
+ name: a,
2056
+ imageUrl: n ? i({ type: "sets", uuid: n, image: a }) : null,
2057
+ selected: u.id === o,
2058
+ click: () => {
2059
+ e.selected = u.id, s == null || s.trackEvent(Ts, { value: a });
2060
+ }
2061
+ };
2062
+ });
2063
+ }) };
2064
+ }
2065
+ const go = R({
2066
+ name: "TdSkinButton",
2067
+ props: {
2068
+ id: { type: Number, required: !0 },
2069
+ slug: { type: String, required: !0 },
2070
+ label: { type: String, default: "" },
2071
+ image: { type: String, default: null },
2072
+ selected: { type: Boolean, default: !1 },
2073
+ size: { type: String, default: "sm" }
2074
+ },
2075
+ emits: ["click"],
2076
+ setup(e, { emit: t }) {
2077
+ const s = C(() => ({
2078
+ margin: "3px",
2079
+ marginBottom: e.size === "sm" ? "40px" : "30px"
2080
+ }));
2081
+ function i() {
2082
+ const r = {
2083
+ class: `td-${e.slug}-button td-skin-button`,
2084
+ key: e.id,
2085
+ label: e.label,
2086
+ image: e.image,
2087
+ size: e.size,
2088
+ style: s.value,
2089
+ type: "radio",
2090
+ dark: !0,
2091
+ selected: e.selected,
2092
+ onClick: () => t("click")
2093
+ };
2094
+ return d(Ce, r);
2095
+ }
2096
+ return () => i();
2097
+ }
2098
+ }), ts = R({
2099
+ name: "TdSkinsSection",
2100
+ props: { size: { type: String, default: "sm" } },
2101
+ setup(e) {
2102
+ const { skins: t } = ho(), { lang: s } = W();
2103
+ function i() {
2104
+ const r = t.value.map(
2105
+ (n) => {
2106
+ var o, l;
2107
+ return d(go, {
2108
+ id: n.id,
2109
+ slug: n.slug,
2110
+ label: ((l = (o = s.value.td) == null ? void 0 : o.components.skins.items) == null ? void 0 : l[n.slug]) ?? n.slug,
2111
+ image: n.imageUrl,
2112
+ selected: n.selected,
2113
+ size: e.size,
2114
+ onClick: n.click
2115
+ });
2116
+ }
2117
+ );
2118
+ return d($t, {}, () => r);
2119
+ }
2120
+ return () => i();
2105
2121
  }
2106
- }), Kt = $({
2122
+ }), bo = R({
2123
+ name: "TdSkinsExpansion",
2124
+ setup() {
2125
+ const { lang: e } = W(), t = me(), { expanded: s } = oe({
2126
+ options: ye,
2127
+ tab: ye
2128
+ }), i = C(() => {
2129
+ var l;
2130
+ const o = (l = t.model) == null ? void 0 : l.slug;
2131
+ return !!o && o !== qt;
2132
+ }), r = C(() => {
2133
+ var o;
2134
+ return (o = e.value.td) == null ? void 0 : o.components.skins.title;
2135
+ });
2136
+ function n() {
2137
+ const o = {
2138
+ class: "td-skins-expansion",
2139
+ "data-cy": "td-skins-expansion",
2140
+ modelValue: s.value,
2141
+ "onUpdate:modelValue": (l) => s.value = l,
2142
+ label: r.value,
2143
+ selected: i.value,
2144
+ icon: "f_shirt"
2145
+ };
2146
+ return d(We, o, () => d(ts, { size: "sm", class: "q-py-sm" }));
2147
+ }
2148
+ return () => n();
2149
+ }
2150
+ }), ss = R({
2107
2151
  name: "TdButtons",
2108
2152
  props: {
2109
2153
  modelValue: { type: Number, default: 0 },
@@ -2115,309 +2159,334 @@ const Pt = () => {
2115
2159
  }
2116
2160
  },
2117
2161
  emits: ["click", "update:modelValue"],
2118
- setup(e, { slots: t, emit: o }) {
2119
- const s = xt(), n = wt(), r = Ct(), l = Ve(), a = Be(), c = lt(), u = ye(), { changed: g } = I(r), { changed: b } = I(l), { changed: f } = I(a), { changed: E } = I(c), { changed: D } = I(u), y = v(() => !(g.value || b.value || f.value || E.value || D.value));
2120
- function k() {
2121
- r.reset(), l.reset(), a.reset(), c.reset(), u.resetColor(), s.applyFromStore(), n.applyFromStore();
2162
+ setup(e, { slots: t, emit: s }) {
2163
+ const i = Mt(), r = Dt(), n = ct(), o = Ve(), l = fe(), a = ut(), { changed: u } = $(n), { changed: p } = $(o), { changed: D } = $(l), { changed: w } = $(a), h = C(() => !(u.value || p.value || D.value || w.value));
2164
+ function f() {
2165
+ n.reset(), o.reset(), l.reset(), a.reset(), i.applyFromStore(), r.applyFromStore();
2122
2166
  }
2123
- const S = (F) => F.preventDefault();
2124
- function w() {
2125
- const Z = {
2126
- style: v(() => e.fixed ? "position: fixed;bottom: 0; left: 0; right: 0;border-top: 1px solid var(--grey-300)" : ""),
2167
+ const S = (y) => y.preventDefault();
2168
+ function E() {
2169
+ const T = {
2170
+ style: C(() => e.fixed ? "position: fixed;bottom: 0; left: 0; right: 0;border-top: 1px solid var(--grey-300)" : ""),
2127
2171
  class: "row justify-center items-center q-pa-md"
2128
- }, U = {
2172
+ }, P = {
2129
2173
  class: "td-reset-button",
2130
2174
  label: "Reset All",
2131
- onClick: k,
2175
+ onClick: f,
2132
2176
  onKeyup: S,
2133
2177
  rounded: !0,
2134
2178
  unelevated: !0,
2135
2179
  outline: !0,
2136
- disable: y.value
2180
+ disable: h.value
2137
2181
  };
2138
- return h("div", Z, [h(Ot, U)]);
2182
+ return d("div", T, [d(Ut, P)]);
2139
2183
  }
2140
- return () => w();
2184
+ return () => E();
2141
2185
  }
2142
- }), jo = $({
2186
+ }), vo = R({
2143
2187
  name: "TdExpansions",
2144
- setup(e, { slots: t, emit: o }) {
2145
- function s() {
2146
- return h("div", {
2188
+ setup(e, { slots: t, emit: s }) {
2189
+ function i() {
2190
+ return d("div", {
2147
2191
  class: "td-expansions",
2148
- onClick: (r) => r.stopPropagation(),
2192
+ onClick: (n) => n.stopPropagation(),
2149
2193
  style: "padding-bottom: 60px; position: relative "
2150
2194
  }, [
2151
2195
  // h(TsPoseButtonsSection),
2152
- h(Fe),
2153
- h(zo),
2154
- h(Fe),
2155
- h(To),
2156
- h(Fe),
2157
- h(Lo),
2158
- h(Fe),
2196
+ d(Ie),
2197
+ d(bo),
2198
+ d(Ie),
2199
+ d(ao),
2200
+ d(Ie),
2201
+ d(lo),
2202
+ d(Ie),
2203
+ d(co),
2204
+ d(Ie),
2159
2205
  // h(TsGridExpansion),
2160
2206
  // h(QSeparator),
2161
2207
  // h(TsAdjustmentExpansion),
2162
- h(Vo),
2163
- h(Fe),
2208
+ d(uo),
2209
+ d(Ie),
2164
2210
  // h('div', {}, store.loading.percent),
2165
- h(Kt)
2211
+ d(ss)
2166
2212
  ]);
2167
2213
  }
2168
- return () => s();
2214
+ return () => i();
2169
2215
  }
2170
- }), Fo = $({
2216
+ }), yo = R({
2171
2217
  name: "TdColorsButton",
2172
2218
  props: { size: String },
2173
2219
  setup(e, {}) {
2174
- const t = Me(), o = p(), s = v(() => (o == null ? void 0 : o.hasAccess("grd")) || !1), { lang: n } = J(), r = v(() => {
2175
- var g;
2176
- return (g = n.value.td) == null ? void 0 : g.controls.colors.iconTitle;
2177
- }), { click: l, selected: a } = Se({
2220
+ const t = Ee(), s = A(), i = C(() => (s == null ? void 0 : s.hasAccess("grd")) || !1), { lang: r } = W(), n = C(() => {
2221
+ var p;
2222
+ return (p = r.value.td) == null ? void 0 : p.controls.colors.iconTitle;
2223
+ }), { click: o, selected: l } = oe({
2178
2224
  store: t,
2179
- options: oe,
2180
- tab: oe
2225
+ options: se,
2226
+ tab: se
2181
2227
  });
2182
- function c(g) {
2183
- return o.block(g);
2228
+ function a(p) {
2229
+ return s.block(p);
2184
2230
  }
2185
2231
  function u() {
2186
- const g = {
2187
- hasAccess: s.value,
2188
- selected: a.value,
2189
- onClick: l,
2190
- onBlockAccess: c,
2232
+ const p = {
2233
+ hasAccess: i.value,
2234
+ selected: l.value,
2235
+ onClick: o,
2236
+ onBlockAccess: a,
2191
2237
  size: e.size,
2192
- "data-id": oe,
2238
+ "data-id": se,
2193
2239
  name: "colors",
2194
2240
  type: "none",
2195
2241
  icon: "f_palette",
2196
- label: r.value
2242
+ label: n.value
2197
2243
  };
2198
- return h(ne, g, () => []);
2244
+ return d(Ce, p, () => []);
2199
2245
  }
2200
2246
  return () => u();
2201
2247
  }
2202
- }), Po = $({
2248
+ }), So = R({
2203
2249
  name: "TdGridButton",
2204
2250
  props: { size: String },
2205
2251
  setup(e, {}) {
2206
- const t = Me(), o = p(), s = v(() => (o == null ? void 0 : o.hasAccess("grd")) || !1), { lang: n } = J(), r = v(() => {
2207
- var g;
2208
- return (g = n.value.td) == null ? void 0 : g.controls.grid.iconTitle;
2209
- }), { click: l, selected: a } = Se({
2252
+ const t = Ee(), s = A(), i = C(() => (s == null ? void 0 : s.hasAccess("grd")) || !1), { lang: r } = W(), n = C(() => {
2253
+ var p;
2254
+ return (p = r.value.td) == null ? void 0 : p.controls.grid.iconTitle;
2255
+ }), { click: o, selected: l } = oe({
2210
2256
  store: t,
2211
- options: xe,
2212
- tab: xe
2257
+ options: Se,
2258
+ tab: Se
2213
2259
  });
2214
- function c(g) {
2215
- return o.block(g);
2260
+ function a(p) {
2261
+ return s.block(p);
2216
2262
  }
2217
2263
  function u() {
2218
- const g = {
2219
- hasAccess: s.value,
2220
- selected: a.value,
2221
- onClick: l,
2222
- onBlockAccess: c,
2264
+ const p = {
2265
+ hasAccess: i.value,
2266
+ selected: l.value,
2267
+ onClick: o,
2268
+ onBlockAccess: a,
2223
2269
  size: e.size,
2224
- "data-id": xe,
2270
+ "data-id": Se,
2225
2271
  name: "grid",
2226
2272
  type: "none",
2227
2273
  icon: "f_grid",
2228
- label: r.value
2274
+ label: n.value
2229
2275
  };
2230
- return h(ne, g, () => []);
2276
+ return d(Ce, p, () => []);
2231
2277
  }
2232
2278
  return () => u();
2233
2279
  }
2234
- }), Go = $({
2280
+ }), xo = R({
2235
2281
  name: "TdLightsButton",
2236
2282
  props: { size: String },
2237
2283
  setup(e, {}) {
2238
- const t = Me(), o = p(), s = v(() => (o == null ? void 0 : o.hasAccess("grd")) || !1), { lang: n } = J(), r = v(() => {
2239
- var g;
2240
- return (g = n.value.td) == null ? void 0 : g.controls.lights.iconTitle;
2241
- }), { click: l, selected: a } = Se({
2284
+ const t = Ee(), s = A(), i = C(() => (s == null ? void 0 : s.hasAccess("grd")) || !1), { lang: r } = W(), n = C(() => {
2285
+ var p;
2286
+ return (p = r.value.td) == null ? void 0 : p.controls.lights.iconTitle;
2287
+ }), { click: o, selected: l } = oe({
2242
2288
  store: t,
2243
- options: ve,
2244
- tab: ve
2289
+ options: de,
2290
+ tab: de
2245
2291
  });
2246
- function c(g) {
2247
- return o.block(g);
2292
+ function a(p) {
2293
+ return s.block(p);
2248
2294
  }
2249
2295
  function u() {
2250
- const g = {
2251
- hasAccess: s.value,
2252
- selected: a.value,
2253
- onClick: l,
2254
- onBlockAccess: c,
2296
+ const p = {
2297
+ hasAccess: i.value,
2298
+ selected: l.value,
2299
+ onClick: o,
2300
+ onBlockAccess: a,
2255
2301
  size: e.size,
2256
- "data-id": ve,
2302
+ "data-id": de,
2257
2303
  name: "lights",
2258
2304
  type: "none",
2259
2305
  icon: "f_bulb_light",
2260
- label: r.value
2306
+ label: n.value
2261
2307
  };
2262
- return h(ne, g, () => []);
2308
+ return d(Ce, p, () => []);
2263
2309
  }
2264
2310
  return () => u();
2265
2311
  }
2266
- }), Ho = $({
2312
+ }), Co = R({
2267
2313
  name: "TsAdjustmentsButton",
2268
2314
  props: { size: String },
2269
2315
  setup(e, {}) {
2270
- const t = p(), { lang: o } = J(), s = v(() => {
2271
- var c;
2272
- return (c = o.value.td) == null ? void 0 : c.controls.related.iconTitle;
2273
- }), { click: n, selected: r } = Se({
2274
- options: we,
2275
- tab: we
2316
+ const t = A(), { lang: s } = W(), i = C(() => {
2317
+ var a;
2318
+ return (a = s.value.td) == null ? void 0 : a.controls.related.iconTitle;
2319
+ }), { click: r, selected: n } = oe({
2320
+ options: xe,
2321
+ tab: xe
2276
2322
  });
2277
- function l(c) {
2278
- return t.block(c);
2323
+ function o(a) {
2324
+ return t.block(a);
2279
2325
  }
2280
- function a() {
2281
- const c = {
2326
+ function l() {
2327
+ const a = {
2282
2328
  hasAccess: !0,
2283
- selected: r.value,
2284
- onClick: n,
2285
- onBlockAccess: l,
2286
- "data-id": we,
2329
+ selected: n.value,
2330
+ onClick: r,
2331
+ onBlockAccess: o,
2332
+ "data-id": xe,
2287
2333
  size: e.size,
2288
2334
  name: "related",
2289
2335
  icon: "f_related",
2290
2336
  type: "none",
2291
- label: s.value
2337
+ label: i.value
2292
2338
  };
2293
- return h(ne, c, () => []);
2339
+ return d(Ce, a, () => []);
2294
2340
  }
2295
- return () => a();
2341
+ return () => l();
2296
2342
  }
2297
- }), Ro = $({
2343
+ }), wo = R({
2298
2344
  name: "TsDefaultDrawer",
2299
2345
  props: {},
2300
2346
  emits: ["click"],
2301
- setup(e, { slots: t, emit: o }) {
2302
- const s = p(), n = "q-ma-xs";
2303
- function r(l) {
2347
+ setup(e, { slots: t, emit: s }) {
2348
+ const i = A(), r = "q-ma-xs";
2349
+ function n(o) {
2304
2350
  return {
2305
- class: n,
2351
+ class: r,
2306
2352
  size: "sm",
2307
- onClick: () => s.setActive(l)
2353
+ onClick: () => i.setActive(o)
2308
2354
  };
2309
2355
  }
2310
- return () => h(
2311
- Qe,
2312
- { name: ot },
2356
+ return () => d(
2357
+ Pe,
2358
+ { name: Nt },
2313
2359
  {
2314
- default: () => h(ro, {}, () => [
2315
- h(Fo, r(oe)),
2316
- h(Po, r(xe)),
2317
- h(Go, r(ve)),
2318
- h(Ho, r(we))
2360
+ default: () => d($t, {}, () => [
2361
+ d(yo, n(se)),
2362
+ d(So, n(Se)),
2363
+ d(xo, n(de)),
2364
+ d(Co, n(xe))
2319
2365
  ]),
2320
- secondary: () => h(Kt, { fixed: !1 })
2366
+ secondary: () => d(ss, { fixed: !1 })
2321
2367
  }
2322
2368
  );
2323
2369
  }
2324
- }), Oo = $({
2370
+ }), Eo = R({
2325
2371
  name: "TdGridDrawer",
2326
- setup(e, { slots: t, emit: o }) {
2327
- const { lang: s } = J(), n = v(() => {
2328
- var l;
2329
- return (l = s.value.td) == null ? void 0 : l.controls.grid.title;
2372
+ setup(e, { slots: t, emit: s }) {
2373
+ const { lang: i } = W(), r = C(() => {
2374
+ var o;
2375
+ return (o = i.value.td) == null ? void 0 : o.controls.grid.title;
2330
2376
  });
2331
- function r() {
2332
- const l = {
2377
+ function n() {
2378
+ const o = {
2333
2379
  class: "td-grid-drawer",
2334
- name: xe,
2335
- label: n.value
2380
+ name: Se,
2381
+ label: r.value
2336
2382
  };
2337
- return h(Qe, l, () => h($t));
2383
+ return d(Pe, o, () => d(Qt));
2338
2384
  }
2339
- return () => r();
2385
+ return () => n();
2340
2386
  }
2341
- }), qo = $({
2387
+ }), Io = R({
2342
2388
  name: "TdRelatedDrawer",
2343
- setup(e, { slots: t, emit: o }) {
2344
- const { lang: s } = J(), n = v(() => {
2345
- var l;
2346
- return (l = s.value.td) == null ? void 0 : l.controls.related.title;
2389
+ setup(e, { slots: t, emit: s }) {
2390
+ const { lang: i } = W(), r = C(() => {
2391
+ var o;
2392
+ return (o = i.value.td) == null ? void 0 : o.controls.related.title;
2347
2393
  });
2348
- function r() {
2349
- const l = {
2394
+ function n() {
2395
+ const o = {
2350
2396
  class: "td-related-drawer",
2351
- name: we,
2352
- label: n.value
2397
+ name: xe,
2398
+ label: r.value
2353
2399
  };
2354
- return h(Qe, l, () => h(Zt));
2400
+ return d(Pe, o, () => d(es));
2355
2401
  }
2356
- return () => r();
2402
+ return () => n();
2357
2403
  }
2358
- }), _o = $({
2404
+ }), Mo = R({
2359
2405
  name: "TdLightsDrawer",
2360
- setup(e, { slots: t, emit: o }) {
2361
- const { lang: s } = J(), n = v(() => {
2362
- var l;
2363
- return (l = s.value.td) == null ? void 0 : l.controls.lights.title;
2406
+ setup(e, { slots: t, emit: s }) {
2407
+ const { lang: i } = W(), r = C(() => {
2408
+ var o;
2409
+ return (o = i.value.td) == null ? void 0 : o.controls.lights.title;
2364
2410
  });
2365
- function r() {
2366
- const l = {
2411
+ function n() {
2412
+ const o = {
2367
2413
  class: "td-lights-drawer",
2368
- name: ve,
2369
- label: n.value
2414
+ name: de,
2415
+ label: r.value
2370
2416
  };
2371
- return h(Qe, l, () => h(Nt));
2417
+ return d(Pe, o, () => d(Jt));
2372
2418
  }
2373
- return () => r();
2419
+ return () => n();
2374
2420
  }
2375
- }), Uo = $({
2421
+ }), Do = R({
2376
2422
  name: "TdLightsDrawer",
2377
- setup(e, { slots: t, emit: o }) {
2378
- const { lang: s } = J(), n = v(() => {
2379
- var l;
2380
- return (l = s.value.td) == null ? void 0 : l.controls.colors.title;
2423
+ setup(e, { slots: t, emit: s }) {
2424
+ const { lang: i } = W(), r = C(() => {
2425
+ var o;
2426
+ return (o = i.value.td) == null ? void 0 : o.controls.colors.title;
2381
2427
  });
2382
- function r() {
2383
- const l = {
2428
+ function n() {
2429
+ const o = {
2384
2430
  class: "td-colors-drawer",
2385
- name: oe,
2386
- label: n.value
2431
+ name: se,
2432
+ label: r.value
2387
2433
  };
2388
- return h(Qe, l, () => h(It));
2434
+ return d(Pe, o, () => d(Yt));
2389
2435
  }
2390
- return () => r();
2436
+ return () => n();
2437
+ }
2438
+ }), To = R({
2439
+ name: "TdSkinsDrawer",
2440
+ setup() {
2441
+ const { lang: e } = W(), { expanded: t } = oe({
2442
+ options: ye,
2443
+ tab: ye
2444
+ }), s = C(() => {
2445
+ var r;
2446
+ return (r = e.value.td) == null ? void 0 : r.controls.skins.title;
2447
+ });
2448
+ function i() {
2449
+ const r = {
2450
+ class: "td-skins-drawer",
2451
+ name: ye,
2452
+ label: s.value,
2453
+ modelValue: t.value,
2454
+ "onUpdate:modelValue": (n) => t.value = n
2455
+ };
2456
+ return d(Pe, r, () => d(ts));
2457
+ }
2458
+ return () => i();
2391
2459
  }
2392
- }), Io = $({
2460
+ }), ko = R({
2393
2461
  name: "TsDrawers",
2394
- setup(e, { slots: t, emit: o }) {
2395
- const s = p(), n = v({
2396
- get: () => s.active,
2397
- set: (l) => s.setActive(l)
2462
+ setup(e, { slots: t, emit: s }) {
2463
+ const i = A(), r = C({
2464
+ get: () => i.active,
2465
+ set: (o) => i.setActive(o)
2398
2466
  });
2399
- function r() {
2400
- const l = {
2401
- modelValue: n.value,
2402
- "onUpdate:modelValue": (a) => n.value = a
2467
+ function n() {
2468
+ const o = {
2469
+ modelValue: r.value,
2470
+ "onUpdate:modelValue": (l) => r.value = l
2403
2471
  };
2404
- return h(lo, l, () => [
2405
- h(Ro),
2406
- h(_o),
2407
- h(Uo),
2408
- h(Oo),
2409
- h(qo)
2472
+ return d(hs, o, () => [
2473
+ d(wo),
2474
+ d(To),
2475
+ d(Mo),
2476
+ d(Do),
2477
+ d(Eo),
2478
+ d(Io)
2410
2479
  ]);
2411
2480
  }
2412
- return () => r();
2481
+ return () => n();
2413
2482
  }
2414
- }), ns = /* @__PURE__ */ Object.assign({
2483
+ }), No = /* @__PURE__ */ Object.assign({
2415
2484
  name: "TdPage",
2416
2485
  slug: "td-page",
2417
2486
  inheritAttrs: !1
2418
2487
  }, {
2419
2488
  __name: "TdPage",
2420
- props: /* @__PURE__ */ so({
2489
+ props: /* @__PURE__ */ ds({
2421
2490
  id: Number
2422
2491
  }, {
2423
2492
  miniState: { type: Boolean },
@@ -2425,29 +2494,41 @@ const Pt = () => {
2425
2494
  }),
2426
2495
  emits: ["update:miniState"],
2427
2496
  setup(e) {
2428
- const t = e, o = p(), s = v(() => Number(t.id)), n = eo(e, "miniState");
2429
- return to(() => {
2430
- o.setActive(ft.is.mobile ? ot : oe);
2431
- }), (r, l) => (Je(), it(at(io), {
2497
+ const t = e, s = Symbol.for("activity-tracking"), i = A(), r = xt(s, null), n = C(() => Number(t.id)), o = ls(e, "miniState"), l = (a) => {
2498
+ a && (r == null || r.trackEvent(Ds, {
2499
+ glb_id: i.selected || null,
2500
+ base_pose_id: a
2501
+ }));
2502
+ };
2503
+ return jt(async () => {
2504
+ r && (await r.beginExplore(), r.trackEvent(Ms, { from: null, to: "3d" }), i.basePoseId && (r.beginSegment(String(i.basePoseId)), l(i.basePoseId)));
2505
+ }), O(
2506
+ () => i.basePoseId,
2507
+ (a, u) => {
2508
+ !a || a === u || (r == null || r.beginSegment(String(a)), l(a));
2509
+ }
2510
+ ), cs(() => {
2511
+ i.setActive(ms.is.mobile ? Nt : se), r == null || r.end();
2512
+ }), (a, u) => (nt(), mt(ft(gs), {
2432
2513
  class: "three-dimension-page",
2433
- miniState: n.value,
2434
- "onUpdate:miniState": l[0] || (l[0] = (a) => n.value = a),
2514
+ miniState: o.value,
2515
+ "onUpdate:miniState": u[0] || (u[0] = (p) => o.value = p),
2435
2516
  "no-drawer-padding": !0,
2436
2517
  title: "3D Viewer"
2437
2518
  }, {
2438
- toolDrawer: ct(() => [
2439
- r.$q.platform.is.mobile ? ht("", !0) : (Je(), it(at(jo), { key: 0 }))
2519
+ toolDrawer: ht(() => [
2520
+ a.$q.platform.is.mobile ? vt("", !0) : (nt(), mt(ft(vo), { key: 0 }))
2440
2521
  ]),
2441
- bottomDrawer: ct(() => [
2442
- r.$q.platform.is.mobile ? (Je(), it(at(Io), { key: 0 })) : ht("", !0)
2522
+ bottomDrawer: ht(() => [
2523
+ a.$q.platform.is.mobile ? (nt(), mt(ft(ko), { key: 0 })) : vt("", !0)
2443
2524
  ]),
2444
- default: ct(() => [
2445
- oo(Ao, { id: s.value }, null, 8, ["id"])
2525
+ default: ht(() => [
2526
+ us(io, { id: n.value }, null, 8, ["id"])
2446
2527
  ]),
2447
2528
  _: 1
2448
2529
  }, 8, ["miniState"]));
2449
2530
  }
2450
- }), $o = [
2531
+ }), Ao = [
2451
2532
  "#141111",
2452
2533
  "#3E251E",
2453
2534
  "#633C30",
@@ -2488,29 +2569,29 @@ const Pt = () => {
2488
2569
  "#BDACA8",
2489
2570
  "#DACDC9",
2490
2571
  "#E5E4E3"
2491
- ], rs = de("3d-fbxs", {
2572
+ ], Ho = Xe("3d-fbxs", {
2492
2573
  state: () => ({
2493
2574
  models: {},
2494
2575
  loadingUrl: null,
2495
- palette: $o
2576
+ palette: Ao
2496
2577
  }),
2497
2578
  getters: {
2498
2579
  changed(e) {
2499
- var s, n, r, l, a;
2500
- const o = p().selected;
2501
- return console.log("fbx model", (s = e.models) == null ? void 0 : s[o]), (r = (n = e.models) == null ? void 0 : n[o]) != null && r.color ? ((a = (l = e.models) == null ? void 0 : l[o]) == null ? void 0 : a.color) !== 16777215 : !1;
2580
+ var i, r, n, o, l;
2581
+ const s = A().selected;
2582
+ return console.log("fbx model", (i = e.models) == null ? void 0 : i[s]), (n = (r = e.models) == null ? void 0 : r[s]) != null && n.color ? ((l = (o = e.models) == null ? void 0 : o[s]) == null ? void 0 : l.color) !== 16777215 : !1;
2502
2583
  },
2503
2584
  selectedId() {
2504
- return p().selected;
2585
+ return A().selected;
2505
2586
  },
2506
2587
  poseId(e) {
2507
- var s, n;
2508
- const o = p().selected;
2509
- return (n = (s = e.models) == null ? void 0 : s[o]) == null ? void 0 : n.poseId;
2588
+ var i, r;
2589
+ const s = A().selected;
2590
+ return (r = (i = e.models) == null ? void 0 : i[s]) == null ? void 0 : r.poseId;
2510
2591
  },
2511
2592
  model(e) {
2512
- const o = p().selected;
2513
- return o && e.models[o] ? e.models[o] : null;
2593
+ const s = A().selected;
2594
+ return s && e.models[s] ? e.models[s] : null;
2514
2595
  },
2515
2596
  url() {
2516
2597
  var e;
@@ -2526,37 +2607,37 @@ const Pt = () => {
2526
2607
  },
2527
2608
  colorHex() {
2528
2609
  var e;
2529
- return (e = this.model) != null && e.color ? ce(this.model.color) : "#fefefe";
2610
+ return (e = this.model) != null && e.color ? ue(this.model.color) : "#fefefe";
2530
2611
  }
2531
2612
  },
2532
2613
  actions: {
2533
2614
  resetColor() {
2534
- const t = p().selected;
2615
+ const t = A().selected;
2535
2616
  this.models[t].color = 16777215;
2536
2617
  },
2537
2618
  setBounds(e) {
2538
- const o = p().selected;
2539
- this.models[o].bounds = _t(e);
2619
+ const s = A().selected;
2620
+ this.models[s].bounds = Ht(e);
2540
2621
  },
2541
2622
  setSubjectsFromResponse(e) {
2542
2623
  const t = e.entities.fbx;
2543
2624
  this.models = { ...this.models, ...t };
2544
2625
  },
2545
2626
  setColorHex(e) {
2546
- const o = p().selected;
2547
- this.models[o].color = be(e);
2627
+ const s = A().selected;
2628
+ this.models[s].color = Ye(e);
2548
2629
  }
2549
2630
  }
2550
2631
  });
2551
2632
  export {
2552
- ns as TdPage,
2553
- p as use3dStore,
2554
- Ut as useColorsStore,
2555
- Ct as useControlsStore,
2556
- rs as useFBXStore,
2557
- ye as useGLBStore,
2558
- Me as useGridStore,
2633
+ No as TdPage,
2634
+ A as use3dStore,
2635
+ It as useColorsStore,
2636
+ ct as useControlsStore,
2637
+ Ho as useFBXStore,
2638
+ me as useGLBStore,
2639
+ Ee as useGridStore,
2559
2640
  Ve as useGroundStore,
2560
- Be as useLightsStore,
2561
- lt as useSceneStore
2641
+ fe as useLightsStore,
2642
+ ut as useSceneStore
2562
2643
  };