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