@cristiancosano/pallet-builder 0.1.2 → 0.1.3
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.
package/dist/pallet-builder.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Le, { createContext as Ge, useContext as Ve, useMemo as k, useCallback as q, memo as V, useRef as Ee, useEffect as pe, useState as ae } from "react";
|
|
2
2
|
import { Html as ke, OrbitControls as Xe } from "@react-three/drei";
|
|
3
|
-
import * as
|
|
4
|
-
import { useThree as Ae, Canvas as
|
|
5
|
-
const
|
|
3
|
+
import * as B from "three";
|
|
4
|
+
import { useThree as Ae, Canvas as fe } from "@react-three/fiber";
|
|
5
|
+
const N = {
|
|
6
6
|
WOOD: "WOOD",
|
|
7
7
|
PLASTIC: "PLASTIC",
|
|
8
8
|
METAL: "METAL",
|
|
@@ -11,7 +11,7 @@ const L = {
|
|
|
11
11
|
CARDBOARD: "CARDBOARD",
|
|
12
12
|
WOOD: "WOOD",
|
|
13
13
|
PLASTIC: "PLASTIC"
|
|
14
|
-
},
|
|
14
|
+
}, oe = {
|
|
15
15
|
BOX: "BOX",
|
|
16
16
|
REFRIGERATED: "REFRIGERATED",
|
|
17
17
|
FLATBED: "FLATBED",
|
|
@@ -21,7 +21,7 @@ const L = {
|
|
|
21
21
|
/** Palet EUR/EPAL — Estándar europeo (1200×800×144mm, ISO 6780) */
|
|
22
22
|
EUR: {
|
|
23
23
|
dimensions: { width: 1200, height: 144, depth: 800 },
|
|
24
|
-
material:
|
|
24
|
+
material: N.WOOD,
|
|
25
25
|
maxWeight: 1e3,
|
|
26
26
|
maxStackHeight: 2200,
|
|
27
27
|
weight: 25
|
|
@@ -29,7 +29,7 @@ const L = {
|
|
|
29
29
|
/** Palet GMA/Americano — Estándar norteamericano (1219×1016×145mm, 48"×40") */
|
|
30
30
|
GMA: {
|
|
31
31
|
dimensions: { width: 1219, height: 145, depth: 1016 },
|
|
32
|
-
material:
|
|
32
|
+
material: N.WOOD,
|
|
33
33
|
maxWeight: 1200,
|
|
34
34
|
maxStackHeight: 2200,
|
|
35
35
|
weight: 30
|
|
@@ -37,7 +37,7 @@ const L = {
|
|
|
37
37
|
/** Palet UK Standard — Reino Unido (1200×1000×150mm) */
|
|
38
38
|
UK: {
|
|
39
39
|
dimensions: { width: 1200, height: 150, depth: 1e3 },
|
|
40
|
-
material:
|
|
40
|
+
material: N.WOOD,
|
|
41
41
|
maxWeight: 1e3,
|
|
42
42
|
maxStackHeight: 2200,
|
|
43
43
|
weight: 28
|
|
@@ -45,7 +45,7 @@ const L = {
|
|
|
45
45
|
/** Palet asiático estándar — Asia Pallet (1100×1100×150mm, ISO 6780) */
|
|
46
46
|
ASIA: {
|
|
47
47
|
dimensions: { width: 1100, height: 150, depth: 1100 },
|
|
48
|
-
material:
|
|
48
|
+
material: N.WOOD,
|
|
49
49
|
maxWeight: 1e3,
|
|
50
50
|
maxStackHeight: 2200,
|
|
51
51
|
weight: 28
|
|
@@ -53,7 +53,7 @@ const L = {
|
|
|
53
53
|
/** Palet australiano estándar — Australia (1165×1165×150mm) */
|
|
54
54
|
AUSTRALIAN: {
|
|
55
55
|
dimensions: { width: 1165, height: 150, depth: 1165 },
|
|
56
|
-
material:
|
|
56
|
+
material: N.WOOD,
|
|
57
57
|
maxWeight: 1e3,
|
|
58
58
|
maxStackHeight: 2200,
|
|
59
59
|
weight: 29
|
|
@@ -61,7 +61,7 @@ const L = {
|
|
|
61
61
|
/** Medio palet EUR — Half European Pallet (800×600×144mm) */
|
|
62
62
|
HALF_EUR: {
|
|
63
63
|
dimensions: { width: 800, height: 144, depth: 600 },
|
|
64
|
-
material:
|
|
64
|
+
material: N.WOOD,
|
|
65
65
|
maxWeight: 500,
|
|
66
66
|
maxStackHeight: 2200,
|
|
67
67
|
weight: 12
|
|
@@ -69,7 +69,7 @@ const L = {
|
|
|
69
69
|
/** Cuarto de palet EUR — Quarter European Pallet (600×400×144mm) */
|
|
70
70
|
QUARTER_EUR: {
|
|
71
71
|
dimensions: { width: 600, height: 144, depth: 400 },
|
|
72
|
-
material:
|
|
72
|
+
material: N.WOOD,
|
|
73
73
|
maxWeight: 250,
|
|
74
74
|
maxStackHeight: 2200,
|
|
75
75
|
weight: 6
|
|
@@ -77,7 +77,7 @@ const L = {
|
|
|
77
77
|
/** Palet ISO 1 — ISO 6780 (1200×1000×150mm) */
|
|
78
78
|
ISO_1: {
|
|
79
79
|
dimensions: { width: 1200, height: 150, depth: 1e3 },
|
|
80
|
-
material:
|
|
80
|
+
material: N.WOOD,
|
|
81
81
|
maxWeight: 1e3,
|
|
82
82
|
maxStackHeight: 2200,
|
|
83
83
|
weight: 28
|
|
@@ -85,7 +85,7 @@ const L = {
|
|
|
85
85
|
/** Palet ISO 2 — ISO 6780 (1200×800×144mm, equivalente a EUR) */
|
|
86
86
|
ISO_2: {
|
|
87
87
|
dimensions: { width: 1200, height: 144, depth: 800 },
|
|
88
|
-
material:
|
|
88
|
+
material: N.WOOD,
|
|
89
89
|
maxWeight: 1e3,
|
|
90
90
|
maxStackHeight: 2200,
|
|
91
91
|
weight: 25
|
|
@@ -93,31 +93,31 @@ const L = {
|
|
|
93
93
|
};
|
|
94
94
|
ue.GMA;
|
|
95
95
|
const Ze = {
|
|
96
|
-
[
|
|
96
|
+
[oe.BOX]: {
|
|
97
97
|
dimensions: { width: 2480, height: 2700, depth: 13600 },
|
|
98
98
|
maxWeight: 24e3
|
|
99
99
|
},
|
|
100
|
-
[
|
|
100
|
+
[oe.REFRIGERATED]: {
|
|
101
101
|
dimensions: { width: 2440, height: 2590, depth: 13100 },
|
|
102
102
|
maxWeight: 22e3
|
|
103
103
|
},
|
|
104
|
-
[
|
|
104
|
+
[oe.FLATBED]: {
|
|
105
105
|
dimensions: { width: 2480, height: 2700, depth: 13600 },
|
|
106
106
|
maxWeight: 25e3
|
|
107
107
|
},
|
|
108
|
-
[
|
|
108
|
+
[oe.TAUTLINER]: {
|
|
109
109
|
dimensions: { width: 2480, height: 2700, depth: 13600 },
|
|
110
110
|
maxWeight: 24e3
|
|
111
111
|
}
|
|
112
|
-
},
|
|
112
|
+
}, It = {
|
|
113
113
|
thickness: 10,
|
|
114
114
|
// mm
|
|
115
115
|
weight: 2
|
|
116
116
|
// kg
|
|
117
|
-
},
|
|
117
|
+
}, U = {
|
|
118
118
|
MM_TO_M: 1e-3,
|
|
119
119
|
M_TO_MM: 1e3
|
|
120
|
-
},
|
|
120
|
+
}, De = 1, ze = 0.6, Ie = 0.9, Ne = {
|
|
121
121
|
id: "unstyled",
|
|
122
122
|
name: "Sin estilo",
|
|
123
123
|
box: {
|
|
@@ -162,7 +162,7 @@ const Ze = {
|
|
|
162
162
|
chassisColor: "#2a2a2a",
|
|
163
163
|
wheelColor: "#1a1a1a"
|
|
164
164
|
}
|
|
165
|
-
},
|
|
165
|
+
}, Oe = {
|
|
166
166
|
id: "industrial",
|
|
167
167
|
name: "Industrial",
|
|
168
168
|
box: {
|
|
@@ -207,195 +207,195 @@ const Ze = {
|
|
|
207
207
|
chassisColor: "#1e1e1e",
|
|
208
208
|
wheelColor: "#111111"
|
|
209
209
|
}
|
|
210
|
-
},
|
|
211
|
-
unstyled:
|
|
212
|
-
industrial:
|
|
213
|
-
}, xe =
|
|
214
|
-
var re = { exports: {} },
|
|
215
|
-
var
|
|
216
|
-
function
|
|
217
|
-
if (
|
|
218
|
-
|
|
210
|
+
}, Ue = {
|
|
211
|
+
unstyled: Ne,
|
|
212
|
+
industrial: Oe
|
|
213
|
+
}, xe = Oe;
|
|
214
|
+
var re = { exports: {} }, te = {};
|
|
215
|
+
var Ce;
|
|
216
|
+
function He() {
|
|
217
|
+
if (Ce) return te;
|
|
218
|
+
Ce = 1;
|
|
219
219
|
var o = /* @__PURE__ */ Symbol.for("react.transitional.element"), e = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
220
|
-
function t(i,
|
|
220
|
+
function t(i, s, n) {
|
|
221
221
|
var a = null;
|
|
222
|
-
if (
|
|
223
|
-
|
|
224
|
-
for (var
|
|
225
|
-
|
|
226
|
-
} else
|
|
227
|
-
return
|
|
222
|
+
if (n !== void 0 && (a = "" + n), s.key !== void 0 && (a = "" + s.key), "key" in s) {
|
|
223
|
+
n = {};
|
|
224
|
+
for (var c in s)
|
|
225
|
+
c !== "key" && (n[c] = s[c]);
|
|
226
|
+
} else n = s;
|
|
227
|
+
return s = n.ref, {
|
|
228
228
|
$$typeof: o,
|
|
229
229
|
type: i,
|
|
230
230
|
key: a,
|
|
231
|
-
ref:
|
|
232
|
-
props:
|
|
231
|
+
ref: s !== void 0 ? s : null,
|
|
232
|
+
props: n
|
|
233
233
|
};
|
|
234
234
|
}
|
|
235
|
-
return
|
|
235
|
+
return te.Fragment = e, te.jsx = t, te.jsxs = t, te;
|
|
236
236
|
}
|
|
237
|
-
var
|
|
238
|
-
var
|
|
239
|
-
function
|
|
240
|
-
return
|
|
241
|
-
function o(
|
|
242
|
-
if (
|
|
243
|
-
if (typeof
|
|
244
|
-
return
|
|
245
|
-
if (typeof
|
|
246
|
-
switch (
|
|
247
|
-
case
|
|
237
|
+
var ie = {};
|
|
238
|
+
var Pe;
|
|
239
|
+
function Ye() {
|
|
240
|
+
return Pe || (Pe = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
241
|
+
function o(f) {
|
|
242
|
+
if (f == null) return null;
|
|
243
|
+
if (typeof f == "function")
|
|
244
|
+
return f.$$typeof === T ? null : f.displayName || f.name || null;
|
|
245
|
+
if (typeof f == "string") return f;
|
|
246
|
+
switch (f) {
|
|
247
|
+
case d:
|
|
248
248
|
return "Fragment";
|
|
249
|
-
case T:
|
|
250
|
-
return "Profiler";
|
|
251
249
|
case j:
|
|
250
|
+
return "Profiler";
|
|
251
|
+
case b:
|
|
252
252
|
return "StrictMode";
|
|
253
|
-
case
|
|
253
|
+
case z:
|
|
254
254
|
return "Suspense";
|
|
255
255
|
case y:
|
|
256
256
|
return "SuspenseList";
|
|
257
257
|
case E:
|
|
258
258
|
return "Activity";
|
|
259
259
|
}
|
|
260
|
-
if (typeof
|
|
261
|
-
switch (typeof
|
|
260
|
+
if (typeof f == "object")
|
|
261
|
+
switch (typeof f.tag == "number" && console.error(
|
|
262
262
|
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
263
|
-
),
|
|
264
|
-
case
|
|
263
|
+
), f.$$typeof) {
|
|
264
|
+
case u:
|
|
265
265
|
return "Portal";
|
|
266
|
-
case b:
|
|
267
|
-
return m.displayName || "Context";
|
|
268
|
-
case z:
|
|
269
|
-
return (m._context.displayName || "Context") + ".Consumer";
|
|
270
|
-
case M:
|
|
271
|
-
var C = m.render;
|
|
272
|
-
return m = m.displayName, m || (m = C.displayName || C.name || "", m = m !== "" ? "ForwardRef(" + m + ")" : "ForwardRef"), m;
|
|
273
|
-
case w:
|
|
274
|
-
return C = m.displayName || null, C !== null ? C : o(m.type) || "Memo";
|
|
275
266
|
case S:
|
|
276
|
-
|
|
267
|
+
return f.displayName || "Context";
|
|
268
|
+
case _:
|
|
269
|
+
return (f._context.displayName || "Context") + ".Consumer";
|
|
270
|
+
case C:
|
|
271
|
+
var P = f.render;
|
|
272
|
+
return f = f.displayName, f || (f = P.displayName || P.name || "", f = f !== "" ? "ForwardRef(" + f + ")" : "ForwardRef"), f;
|
|
273
|
+
case v:
|
|
274
|
+
return P = f.displayName || null, P !== null ? P : o(f.type) || "Memo";
|
|
275
|
+
case M:
|
|
276
|
+
P = f._payload, f = f._init;
|
|
277
277
|
try {
|
|
278
|
-
return o(
|
|
278
|
+
return o(f(P));
|
|
279
279
|
} catch {
|
|
280
280
|
}
|
|
281
281
|
}
|
|
282
282
|
return null;
|
|
283
283
|
}
|
|
284
|
-
function e(
|
|
285
|
-
return "" +
|
|
284
|
+
function e(f) {
|
|
285
|
+
return "" + f;
|
|
286
286
|
}
|
|
287
|
-
function t(
|
|
287
|
+
function t(f) {
|
|
288
288
|
try {
|
|
289
|
-
e(
|
|
290
|
-
var
|
|
289
|
+
e(f);
|
|
290
|
+
var P = !1;
|
|
291
291
|
} catch {
|
|
292
|
-
|
|
292
|
+
P = !0;
|
|
293
293
|
}
|
|
294
|
-
if (
|
|
295
|
-
|
|
296
|
-
var
|
|
297
|
-
return
|
|
298
|
-
|
|
294
|
+
if (P) {
|
|
295
|
+
P = console;
|
|
296
|
+
var O = P.error, W = typeof Symbol == "function" && Symbol.toStringTag && f[Symbol.toStringTag] || f.constructor.name || "Object";
|
|
297
|
+
return O.call(
|
|
298
|
+
P,
|
|
299
299
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
300
300
|
W
|
|
301
|
-
), e(
|
|
301
|
+
), e(f);
|
|
302
302
|
}
|
|
303
303
|
}
|
|
304
|
-
function i(
|
|
305
|
-
if (
|
|
306
|
-
if (typeof
|
|
304
|
+
function i(f) {
|
|
305
|
+
if (f === d) return "<>";
|
|
306
|
+
if (typeof f == "object" && f !== null && f.$$typeof === M)
|
|
307
307
|
return "<...>";
|
|
308
308
|
try {
|
|
309
|
-
var
|
|
310
|
-
return
|
|
309
|
+
var P = o(f);
|
|
310
|
+
return P ? "<" + P + ">" : "<...>";
|
|
311
311
|
} catch {
|
|
312
312
|
return "<...>";
|
|
313
313
|
}
|
|
314
314
|
}
|
|
315
|
-
function
|
|
316
|
-
var
|
|
317
|
-
return
|
|
315
|
+
function s() {
|
|
316
|
+
var f = I.A;
|
|
317
|
+
return f === null ? null : f.getOwner();
|
|
318
318
|
}
|
|
319
|
-
function
|
|
319
|
+
function n() {
|
|
320
320
|
return Error("react-stack-top-frame");
|
|
321
321
|
}
|
|
322
|
-
function a(
|
|
323
|
-
if (
|
|
324
|
-
var
|
|
325
|
-
if (
|
|
322
|
+
function a(f) {
|
|
323
|
+
if (R.call(f, "key")) {
|
|
324
|
+
var P = Object.getOwnPropertyDescriptor(f, "key").get;
|
|
325
|
+
if (P && P.isReactWarning) return !1;
|
|
326
326
|
}
|
|
327
|
-
return
|
|
327
|
+
return f.key !== void 0;
|
|
328
328
|
}
|
|
329
|
-
function f
|
|
330
|
-
function
|
|
331
|
-
|
|
329
|
+
function c(f, P) {
|
|
330
|
+
function O() {
|
|
331
|
+
D || (D = !0, console.error(
|
|
332
332
|
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
333
|
-
|
|
333
|
+
P
|
|
334
334
|
));
|
|
335
335
|
}
|
|
336
|
-
|
|
337
|
-
get:
|
|
336
|
+
O.isReactWarning = !0, Object.defineProperty(f, "key", {
|
|
337
|
+
get: O,
|
|
338
338
|
configurable: !0
|
|
339
339
|
});
|
|
340
340
|
}
|
|
341
|
-
function
|
|
342
|
-
var
|
|
343
|
-
return
|
|
341
|
+
function l() {
|
|
342
|
+
var f = o(this.type);
|
|
343
|
+
return H[f] || (H[f] = !0, console.error(
|
|
344
344
|
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
345
|
-
)),
|
|
345
|
+
)), f = this.props.ref, f !== void 0 ? f : null;
|
|
346
346
|
}
|
|
347
|
-
function
|
|
348
|
-
var
|
|
349
|
-
return
|
|
350
|
-
$$typeof:
|
|
351
|
-
type:
|
|
352
|
-
key:
|
|
353
|
-
props:
|
|
347
|
+
function p(f, P, O, W, ne, de) {
|
|
348
|
+
var $ = O.ref;
|
|
349
|
+
return f = {
|
|
350
|
+
$$typeof: x,
|
|
351
|
+
type: f,
|
|
352
|
+
key: P,
|
|
353
|
+
props: O,
|
|
354
354
|
_owner: W
|
|
355
|
-
}, (
|
|
355
|
+
}, ($ !== void 0 ? $ : null) !== null ? Object.defineProperty(f, "ref", {
|
|
356
356
|
enumerable: !1,
|
|
357
|
-
get:
|
|
358
|
-
}) : Object.defineProperty(
|
|
357
|
+
get: l
|
|
358
|
+
}) : Object.defineProperty(f, "ref", { enumerable: !1, value: null }), f._store = {}, Object.defineProperty(f._store, "validated", {
|
|
359
359
|
configurable: !1,
|
|
360
360
|
enumerable: !1,
|
|
361
361
|
writable: !0,
|
|
362
362
|
value: 0
|
|
363
|
-
}), Object.defineProperty(
|
|
363
|
+
}), Object.defineProperty(f, "_debugInfo", {
|
|
364
364
|
configurable: !1,
|
|
365
365
|
enumerable: !1,
|
|
366
366
|
writable: !0,
|
|
367
367
|
value: null
|
|
368
|
-
}), Object.defineProperty(
|
|
368
|
+
}), Object.defineProperty(f, "_debugStack", {
|
|
369
369
|
configurable: !1,
|
|
370
370
|
enumerable: !1,
|
|
371
371
|
writable: !0,
|
|
372
372
|
value: ne
|
|
373
|
-
}), Object.defineProperty(
|
|
373
|
+
}), Object.defineProperty(f, "_debugTask", {
|
|
374
374
|
configurable: !1,
|
|
375
375
|
enumerable: !1,
|
|
376
376
|
writable: !0,
|
|
377
377
|
value: de
|
|
378
|
-
}), Object.freeze && (Object.freeze(
|
|
378
|
+
}), Object.freeze && (Object.freeze(f.props), Object.freeze(f)), f;
|
|
379
379
|
}
|
|
380
|
-
function
|
|
381
|
-
var
|
|
382
|
-
if (
|
|
380
|
+
function h(f, P, O, W, ne, de) {
|
|
381
|
+
var $ = P.children;
|
|
382
|
+
if ($ !== void 0)
|
|
383
383
|
if (W)
|
|
384
|
-
if (A(
|
|
385
|
-
for (W = 0; W <
|
|
386
|
-
|
|
387
|
-
Object.freeze && Object.freeze(
|
|
384
|
+
if (A($)) {
|
|
385
|
+
for (W = 0; W < $.length; W++)
|
|
386
|
+
g($[W]);
|
|
387
|
+
Object.freeze && Object.freeze($);
|
|
388
388
|
} else
|
|
389
389
|
console.error(
|
|
390
390
|
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
391
391
|
);
|
|
392
|
-
else
|
|
393
|
-
if (
|
|
394
|
-
|
|
395
|
-
var Q = Object.keys(
|
|
396
|
-
return
|
|
392
|
+
else g($);
|
|
393
|
+
if (R.call(P, "key")) {
|
|
394
|
+
$ = o(f);
|
|
395
|
+
var Q = Object.keys(P).filter(function($e) {
|
|
396
|
+
return $e !== "key";
|
|
397
397
|
});
|
|
398
|
-
W = 0 < Q.length ? "{key: someKey, " + Q.join(": ..., ") + ": ...}" : "{key: someKey}", J[
|
|
398
|
+
W = 0 < Q.length ? "{key: someKey, " + Q.join(": ..., ") + ": ...}" : "{key: someKey}", J[$ + W] || (Q = 0 < Q.length ? "{" + Q.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
399
399
|
`A props object containing a "key" prop is being spread into JSX:
|
|
400
400
|
let props = %s;
|
|
401
401
|
<%s {...props} />
|
|
@@ -403,116 +403,116 @@ React keys must be passed directly to JSX without using spread:
|
|
|
403
403
|
let props = %s;
|
|
404
404
|
<%s key={someKey} {...props} />`,
|
|
405
405
|
W,
|
|
406
|
-
|
|
406
|
+
$,
|
|
407
407
|
Q,
|
|
408
|
-
|
|
409
|
-
), J[
|
|
408
|
+
$
|
|
409
|
+
), J[$ + W] = !0);
|
|
410
410
|
}
|
|
411
|
-
if (
|
|
412
|
-
|
|
413
|
-
for (var he in
|
|
414
|
-
he !== "key" && (
|
|
415
|
-
} else
|
|
416
|
-
return
|
|
417
|
-
|
|
418
|
-
typeof
|
|
419
|
-
),
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
411
|
+
if ($ = null, O !== void 0 && (t(O), $ = "" + O), a(P) && (t(P.key), $ = "" + P.key), "key" in P) {
|
|
412
|
+
O = {};
|
|
413
|
+
for (var he in P)
|
|
414
|
+
he !== "key" && (O[he] = P[he]);
|
|
415
|
+
} else O = P;
|
|
416
|
+
return $ && c(
|
|
417
|
+
O,
|
|
418
|
+
typeof f == "function" ? f.displayName || f.name || "Unknown" : f
|
|
419
|
+
), p(
|
|
420
|
+
f,
|
|
421
|
+
$,
|
|
422
|
+
O,
|
|
423
|
+
s(),
|
|
424
424
|
ne,
|
|
425
425
|
de
|
|
426
426
|
);
|
|
427
427
|
}
|
|
428
|
-
function
|
|
429
|
-
|
|
428
|
+
function g(f) {
|
|
429
|
+
w(f) ? f._store && (f._store.validated = 1) : typeof f == "object" && f !== null && f.$$typeof === M && (f._payload.status === "fulfilled" ? w(f._payload.value) && f._payload.value._store && (f._payload.value._store.validated = 1) : f._store && (f._store.validated = 1));
|
|
430
430
|
}
|
|
431
|
-
function
|
|
432
|
-
return typeof
|
|
431
|
+
function w(f) {
|
|
432
|
+
return typeof f == "object" && f !== null && f.$$typeof === x;
|
|
433
433
|
}
|
|
434
|
-
var
|
|
434
|
+
var m = Le, x = /* @__PURE__ */ Symbol.for("react.transitional.element"), u = /* @__PURE__ */ Symbol.for("react.portal"), d = /* @__PURE__ */ Symbol.for("react.fragment"), b = /* @__PURE__ */ Symbol.for("react.strict_mode"), j = /* @__PURE__ */ Symbol.for("react.profiler"), _ = /* @__PURE__ */ Symbol.for("react.consumer"), S = /* @__PURE__ */ Symbol.for("react.context"), C = /* @__PURE__ */ Symbol.for("react.forward_ref"), z = /* @__PURE__ */ Symbol.for("react.suspense"), y = /* @__PURE__ */ Symbol.for("react.suspense_list"), v = /* @__PURE__ */ Symbol.for("react.memo"), M = /* @__PURE__ */ Symbol.for("react.lazy"), E = /* @__PURE__ */ Symbol.for("react.activity"), T = /* @__PURE__ */ Symbol.for("react.client.reference"), I = m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, R = Object.prototype.hasOwnProperty, A = Array.isArray, G = console.createTask ? console.createTask : function() {
|
|
435
435
|
return null;
|
|
436
436
|
};
|
|
437
|
-
|
|
438
|
-
react_stack_bottom_frame: function(
|
|
439
|
-
return
|
|
437
|
+
m = {
|
|
438
|
+
react_stack_bottom_frame: function(f) {
|
|
439
|
+
return f();
|
|
440
440
|
}
|
|
441
441
|
};
|
|
442
|
-
var
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
)(), X = G(i(
|
|
446
|
-
|
|
447
|
-
var W = 1e4 >
|
|
448
|
-
return
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
442
|
+
var D, H = {}, F = m.react_stack_bottom_frame.bind(
|
|
443
|
+
m,
|
|
444
|
+
n
|
|
445
|
+
)(), X = G(i(n)), J = {};
|
|
446
|
+
ie.Fragment = d, ie.jsx = function(f, P, O) {
|
|
447
|
+
var W = 1e4 > I.recentlyCreatedOwnerStacks++;
|
|
448
|
+
return h(
|
|
449
|
+
f,
|
|
450
|
+
P,
|
|
451
|
+
O,
|
|
452
452
|
!1,
|
|
453
453
|
W ? Error("react-stack-top-frame") : F,
|
|
454
|
-
W ? G(i(
|
|
454
|
+
W ? G(i(f)) : X
|
|
455
455
|
);
|
|
456
|
-
},
|
|
457
|
-
var W = 1e4 >
|
|
458
|
-
return
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
456
|
+
}, ie.jsxs = function(f, P, O) {
|
|
457
|
+
var W = 1e4 > I.recentlyCreatedOwnerStacks++;
|
|
458
|
+
return h(
|
|
459
|
+
f,
|
|
460
|
+
P,
|
|
461
|
+
O,
|
|
462
462
|
!0,
|
|
463
463
|
W ? Error("react-stack-top-frame") : F,
|
|
464
|
-
W ? G(i(
|
|
464
|
+
W ? G(i(f)) : X
|
|
465
465
|
);
|
|
466
466
|
};
|
|
467
|
-
})()),
|
|
467
|
+
})()), ie;
|
|
468
468
|
}
|
|
469
|
-
var
|
|
470
|
-
function
|
|
471
|
-
return
|
|
469
|
+
var Re;
|
|
470
|
+
function Fe() {
|
|
471
|
+
return Re || (Re = 1, process.env.NODE_ENV === "production" ? re.exports = He() : re.exports = Ye()), re.exports;
|
|
472
472
|
}
|
|
473
|
-
var
|
|
474
|
-
const
|
|
475
|
-
function
|
|
476
|
-
const t = k(() => o ? typeof o == "string" ?
|
|
477
|
-
return /* @__PURE__ */
|
|
473
|
+
var r = Fe();
|
|
474
|
+
const Be = Ge(xe);
|
|
475
|
+
function we({ preset: o, children: e }) {
|
|
476
|
+
const t = k(() => o ? typeof o == "string" ? Ue[o] ?? xe : o : xe, [o]);
|
|
477
|
+
return /* @__PURE__ */ r.jsx(Be.Provider, { value: t, children: e });
|
|
478
478
|
}
|
|
479
479
|
function ce() {
|
|
480
|
-
return Ve(
|
|
480
|
+
return Ve(Be);
|
|
481
481
|
}
|
|
482
482
|
function le(o) {
|
|
483
483
|
let e = 0;
|
|
484
484
|
for (const t of o.floors) {
|
|
485
485
|
e += t.pallet.dimensions.height;
|
|
486
|
-
const i = t.boxes.reduce((
|
|
487
|
-
const a =
|
|
488
|
-
return Math.max(
|
|
486
|
+
const i = t.boxes.reduce((s, n) => {
|
|
487
|
+
const a = n.position.y + n.box.dimensions.height;
|
|
488
|
+
return Math.max(s, a);
|
|
489
489
|
}, 0);
|
|
490
490
|
e += i, t.separatorAbove && (e += t.separatorAbove.dimensions.height);
|
|
491
491
|
}
|
|
492
492
|
return e;
|
|
493
493
|
}
|
|
494
|
-
function
|
|
494
|
+
function ye(o) {
|
|
495
495
|
let e = 0;
|
|
496
496
|
for (const t of o.floors)
|
|
497
|
-
e += t.pallet.weight, e += t.boxes.reduce((i,
|
|
497
|
+
e += t.pallet.weight, e += t.boxes.reduce((i, s) => i + s.box.weight, 0), t.separatorAbove && (e += t.separatorAbove.weight);
|
|
498
498
|
return e;
|
|
499
499
|
}
|
|
500
500
|
function qe(o, e) {
|
|
501
|
-
const t = e || o.id, i = o.floors.map((
|
|
502
|
-
const a =
|
|
503
|
-
const
|
|
504
|
-
const
|
|
505
|
-
return
|
|
501
|
+
const t = e || o.id, i = o.floors.map((s, n) => {
|
|
502
|
+
const a = s.boxes.map((c, l) => {
|
|
503
|
+
const p = `${t}:f${n}:b${l}`, h = (g) => g.map((w) => {
|
|
504
|
+
const m = s.boxes.findIndex((x) => x.id === w);
|
|
505
|
+
return m >= 0 ? `${t}:f${n}:b${m}` : w;
|
|
506
506
|
});
|
|
507
507
|
return {
|
|
508
|
-
...
|
|
509
|
-
id:
|
|
510
|
-
supportedBy:
|
|
511
|
-
supporting:
|
|
508
|
+
...c,
|
|
509
|
+
id: p,
|
|
510
|
+
supportedBy: h(c.supportedBy),
|
|
511
|
+
supporting: h(c.supporting)
|
|
512
512
|
};
|
|
513
513
|
});
|
|
514
514
|
return {
|
|
515
|
-
...
|
|
515
|
+
...s,
|
|
516
516
|
boxes: a
|
|
517
517
|
};
|
|
518
518
|
});
|
|
@@ -521,7 +521,7 @@ function qe(o, e) {
|
|
|
521
521
|
floors: i
|
|
522
522
|
};
|
|
523
523
|
}
|
|
524
|
-
function
|
|
524
|
+
function L(o) {
|
|
525
525
|
let e = o.box.dimensions.width, t = o.box.dimensions.depth;
|
|
526
526
|
const i = o.box.dimensions.height;
|
|
527
527
|
return (o.rotation.y === 90 || o.rotation.y === 270) && ([e, t] = [t, e]), {
|
|
@@ -533,34 +533,34 @@ function D(o) {
|
|
|
533
533
|
maxZ: o.position.z + t
|
|
534
534
|
};
|
|
535
535
|
}
|
|
536
|
-
function
|
|
537
|
-
const e = o.stackedPallet, t = e.floors[0].pallet, i = t.dimensions.width,
|
|
536
|
+
function se(o) {
|
|
537
|
+
const e = o.stackedPallet, t = e.floors[0].pallet, i = t.dimensions.width, s = t.dimensions.depth, n = le(e), a = o.yRotation * Math.PI / 180, c = Math.cos(a), l = Math.sin(a), h = [
|
|
538
538
|
{ x: 0, z: 0 },
|
|
539
539
|
{ x: i, z: 0 },
|
|
540
|
-
{ x: i, z:
|
|
541
|
-
{ x: 0, z:
|
|
542
|
-
].map((
|
|
543
|
-
x: o.position.x +
|
|
544
|
-
z: o.position.z -
|
|
545
|
-
})),
|
|
540
|
+
{ x: i, z: s },
|
|
541
|
+
{ x: 0, z: s }
|
|
542
|
+
].map((u) => ({
|
|
543
|
+
x: o.position.x + u.x * c + u.z * l,
|
|
544
|
+
z: o.position.z - u.x * l + u.z * c
|
|
545
|
+
})), g = Math.min(...h.map((u) => u.x)), w = Math.max(...h.map((u) => u.x)), m = Math.min(...h.map((u) => u.z)), x = Math.max(...h.map((u) => u.z));
|
|
546
546
|
return {
|
|
547
|
-
minX:
|
|
548
|
-
maxX:
|
|
547
|
+
minX: g,
|
|
548
|
+
maxX: w,
|
|
549
549
|
minY: o.position.y,
|
|
550
|
-
maxY: o.position.y +
|
|
551
|
-
minZ:
|
|
552
|
-
maxZ:
|
|
550
|
+
maxY: o.position.y + n,
|
|
551
|
+
minZ: m,
|
|
552
|
+
maxZ: x
|
|
553
553
|
};
|
|
554
554
|
}
|
|
555
|
-
function
|
|
555
|
+
function ve(o, e, t = De) {
|
|
556
556
|
return o.minX < e.maxX - t && o.maxX > e.minX + t && o.minY < e.maxY - t && o.maxY > e.minY + t && o.minZ < e.maxZ - t && o.maxZ > e.minZ + t;
|
|
557
557
|
}
|
|
558
558
|
function Je(o) {
|
|
559
559
|
const e = [];
|
|
560
560
|
for (let t = 0; t < o.length; t++)
|
|
561
561
|
for (let i = t + 1; i < o.length; i++) {
|
|
562
|
-
const
|
|
563
|
-
|
|
562
|
+
const s = L(o[t]), n = L(o[i]);
|
|
563
|
+
ve(s, n) && e.push({
|
|
564
564
|
code: "BR-002",
|
|
565
565
|
severity: "error",
|
|
566
566
|
message: `Colisión entre cajas ${o[t].id} y ${o[i].id}`,
|
|
@@ -573,8 +573,8 @@ function Qe(o) {
|
|
|
573
573
|
const e = [];
|
|
574
574
|
for (let t = 0; t < o.length; t++)
|
|
575
575
|
for (let i = t + 1; i < o.length; i++) {
|
|
576
|
-
const
|
|
577
|
-
|
|
576
|
+
const s = se(o[t]), n = se(o[i]);
|
|
577
|
+
ve(s, n) && e.push({
|
|
578
578
|
code: "BR-003",
|
|
579
579
|
severity: "error",
|
|
580
580
|
message: `Colisión entre palets ${o[t].id} y ${o[i].id}`,
|
|
@@ -584,7 +584,7 @@ function Qe(o) {
|
|
|
584
584
|
return { isValid: e.length === 0, violations: e };
|
|
585
585
|
}
|
|
586
586
|
function Ke(o, e) {
|
|
587
|
-
const t = [], i =
|
|
587
|
+
const t = [], i = L(o);
|
|
588
588
|
return (i.minX < 0 || i.maxX > e.dimensions.width) && t.push({
|
|
589
589
|
code: "BR-001",
|
|
590
590
|
severity: "error",
|
|
@@ -605,24 +605,24 @@ function Ke(o, e) {
|
|
|
605
605
|
function et(o, e) {
|
|
606
606
|
const t = [];
|
|
607
607
|
for (const i of o) {
|
|
608
|
-
const
|
|
609
|
-
t.push(...
|
|
608
|
+
const s = Ke(i, e);
|
|
609
|
+
t.push(...s.violations);
|
|
610
610
|
}
|
|
611
611
|
return { isValid: t.length === 0, violations: t };
|
|
612
612
|
}
|
|
613
613
|
function tt(o, e) {
|
|
614
|
-
const t = [], i =
|
|
615
|
-
return (i.minX < 0 || i.maxX >
|
|
614
|
+
const t = [], i = se(o), s = e.dimensions;
|
|
615
|
+
return (i.minX < 0 || i.maxX > s.width) && t.push({
|
|
616
616
|
code: "BR-402",
|
|
617
617
|
severity: "error",
|
|
618
618
|
message: `Palet ${o.id} sobresale por el ancho del camión`,
|
|
619
619
|
involvedIds: [o.id, e.id]
|
|
620
|
-
}), (i.minZ < 0 || i.maxZ >
|
|
620
|
+
}), (i.minZ < 0 || i.maxZ > s.depth) && t.push({
|
|
621
621
|
code: "BR-402",
|
|
622
622
|
severity: "error",
|
|
623
623
|
message: `Palet ${o.id} sobresale por la profundidad del camión`,
|
|
624
624
|
involvedIds: [o.id, e.id]
|
|
625
|
-
}), i.maxY >
|
|
625
|
+
}), i.maxY > s.height && t.push({
|
|
626
626
|
code: "BR-404",
|
|
627
627
|
severity: "error",
|
|
628
628
|
message: `Palet ${o.id} excede la altura del camión`,
|
|
@@ -630,7 +630,7 @@ function tt(o, e) {
|
|
|
630
630
|
}), { isValid: t.length === 0, violations: t };
|
|
631
631
|
}
|
|
632
632
|
function Ot(o, e) {
|
|
633
|
-
const t = [], i =
|
|
633
|
+
const t = [], i = se(o);
|
|
634
634
|
return i.maxY > e && t.push({
|
|
635
635
|
code: "BR-403",
|
|
636
636
|
severity: "error",
|
|
@@ -639,22 +639,22 @@ function Ot(o, e) {
|
|
|
639
639
|
}), { isValid: t.length === 0, violations: t };
|
|
640
640
|
}
|
|
641
641
|
function it(o) {
|
|
642
|
-
const e = [], t = o.boxes.reduce((
|
|
642
|
+
const e = [], t = o.boxes.reduce((s, n) => s + n.box.weight, 0), i = o.pallet.maxWeight;
|
|
643
643
|
return t > i ? e.push({
|
|
644
644
|
code: "BR-101",
|
|
645
645
|
severity: "error",
|
|
646
646
|
message: `Peso de cajas (${t.toFixed(1)}kg) excede el máximo del palet (${i}kg)`,
|
|
647
647
|
involvedIds: [o.pallet.id]
|
|
648
|
-
}) : t > i *
|
|
648
|
+
}) : t > i * Ie && e.push({
|
|
649
649
|
code: "BR-101",
|
|
650
650
|
severity: "warning",
|
|
651
651
|
message: `Peso de cajas (${t.toFixed(1)}kg) supera el 90% del máximo del palet (${i}kg)`,
|
|
652
652
|
involvedIds: [o.pallet.id]
|
|
653
|
-
}), { isValid: e.filter((
|
|
653
|
+
}), { isValid: e.filter((s) => s.severity === "error").length === 0, violations: e };
|
|
654
654
|
}
|
|
655
|
-
function
|
|
655
|
+
function Bt(o) {
|
|
656
656
|
const e = [], t = o.pallets.reduce(
|
|
657
|
-
(i,
|
|
657
|
+
(i, s) => i + ye(s.stackedPallet),
|
|
658
658
|
0
|
|
659
659
|
);
|
|
660
660
|
return t > o.maxWeight ? e.push({
|
|
@@ -662,7 +662,7 @@ function It(o) {
|
|
|
662
662
|
severity: "error",
|
|
663
663
|
message: `Peso total (${t.toFixed(1)}kg) excede el máximo del camión (${o.maxWeight}kg)`,
|
|
664
664
|
involvedIds: [o.id]
|
|
665
|
-
}) : t > o.maxWeight *
|
|
665
|
+
}) : t > o.maxWeight * Ie && e.push({
|
|
666
666
|
code: "BR-102",
|
|
667
667
|
severity: "warning",
|
|
668
668
|
message: `Peso total (${t.toFixed(1)}kg) supera el 90% del máximo del camión (${o.maxWeight}kg)`,
|
|
@@ -673,42 +673,42 @@ function ot(o) {
|
|
|
673
673
|
const e = [];
|
|
674
674
|
for (const t of o) {
|
|
675
675
|
if (!t.box.fragile) continue;
|
|
676
|
-
const i = t.box.fragilityMaxWeight ?? 0,
|
|
677
|
-
|
|
676
|
+
const i = t.box.fragilityMaxWeight ?? 0, s = st(t, o);
|
|
677
|
+
s > i && e.push({
|
|
678
678
|
code: "BR-103",
|
|
679
679
|
severity: "error",
|
|
680
|
-
message: `Caja frágil ${t.id} soporta ${
|
|
680
|
+
message: `Caja frágil ${t.id} soporta ${s.toFixed(1)}kg (máx: ${i}kg)`,
|
|
681
681
|
involvedIds: [t.id]
|
|
682
682
|
});
|
|
683
683
|
}
|
|
684
684
|
return { isValid: e.length === 0, violations: e };
|
|
685
685
|
}
|
|
686
686
|
function st(o, e) {
|
|
687
|
-
const t =
|
|
687
|
+
const t = L(o);
|
|
688
688
|
let i = 0;
|
|
689
|
-
for (const
|
|
690
|
-
if (
|
|
691
|
-
const
|
|
692
|
-
|
|
689
|
+
for (const s of e) {
|
|
690
|
+
if (s.id === o.id) continue;
|
|
691
|
+
const n = L(s);
|
|
692
|
+
n.minY >= t.maxY - 1 && n.minX < t.maxX && n.maxX > t.minX && n.minZ < t.maxZ && n.maxZ > t.minZ && (i += s.box.weight);
|
|
693
693
|
}
|
|
694
694
|
return i;
|
|
695
695
|
}
|
|
696
696
|
function nt(o, e) {
|
|
697
697
|
const t = [];
|
|
698
698
|
if (e.length === 0) return { isValid: !0, violations: t };
|
|
699
|
-
const i = e.reduce((
|
|
699
|
+
const i = e.reduce((l, p) => l + p.box.weight, 0);
|
|
700
700
|
if (i === 0) return { isValid: !0, violations: t };
|
|
701
|
-
let
|
|
702
|
-
for (const
|
|
703
|
-
const
|
|
704
|
-
|
|
705
|
-
}
|
|
706
|
-
|
|
707
|
-
const a = o.dimensions.width / 2,
|
|
708
|
-
return (Math.abs(
|
|
701
|
+
let s = 0, n = 0;
|
|
702
|
+
for (const l of e) {
|
|
703
|
+
const p = L(l), h = (p.minX + p.maxX) / 2, g = (p.minZ + p.maxZ) / 2;
|
|
704
|
+
s += h * l.box.weight, n += g * l.box.weight;
|
|
705
|
+
}
|
|
706
|
+
s /= i, n /= i;
|
|
707
|
+
const a = o.dimensions.width / 2, c = o.dimensions.depth / 2;
|
|
708
|
+
return (Math.abs(s - a) > o.dimensions.width / 6 || Math.abs(n - c) > o.dimensions.depth / 6) && t.push({
|
|
709
709
|
code: "BR-104",
|
|
710
710
|
severity: "warning",
|
|
711
|
-
message: `Centro de gravedad descentrado (${
|
|
711
|
+
message: `Centro de gravedad descentrado (${s.toFixed(0)}, ${n.toFixed(0)}) respecto al centro del palet`,
|
|
712
712
|
involvedIds: [o.id]
|
|
713
713
|
}), { isValid: !0, violations: t };
|
|
714
714
|
}
|
|
@@ -716,15 +716,15 @@ function rt(o) {
|
|
|
716
716
|
const e = [];
|
|
717
717
|
for (const t of o) {
|
|
718
718
|
if (t.box.stackable) continue;
|
|
719
|
-
const i =
|
|
720
|
-
for (const
|
|
721
|
-
if (
|
|
722
|
-
const
|
|
723
|
-
|
|
719
|
+
const i = L(t);
|
|
720
|
+
for (const s of o) {
|
|
721
|
+
if (s.id === t.id) continue;
|
|
722
|
+
const n = L(s);
|
|
723
|
+
n.minY >= i.maxY - 1 && n.minX < i.maxX && n.maxX > i.minX && n.minZ < i.maxZ && n.maxZ > i.minZ && e.push({
|
|
724
724
|
code: "BR-201",
|
|
725
725
|
severity: "error",
|
|
726
|
-
message: `Caja ${
|
|
727
|
-
involvedIds: [t.id,
|
|
726
|
+
message: `Caja ${s.id} apilada sobre caja no apilable ${t.id}`,
|
|
727
|
+
involvedIds: [t.id, s.id]
|
|
728
728
|
});
|
|
729
729
|
}
|
|
730
730
|
}
|
|
@@ -733,38 +733,38 @@ function rt(o) {
|
|
|
733
733
|
function at(o) {
|
|
734
734
|
const e = [];
|
|
735
735
|
for (const t of o) {
|
|
736
|
-
const i =
|
|
737
|
-
for (const
|
|
738
|
-
if (
|
|
739
|
-
const a =
|
|
736
|
+
const i = L(t), s = (i.maxX - i.minX) * (i.maxZ - i.minZ);
|
|
737
|
+
for (const n of o) {
|
|
738
|
+
if (n.id === t.id) continue;
|
|
739
|
+
const a = L(n);
|
|
740
740
|
if (a.minY < i.maxY - 1 || a.minX >= i.maxX || a.maxX <= i.minX || a.minZ >= i.maxZ || a.maxZ <= i.minZ) continue;
|
|
741
|
-
const
|
|
742
|
-
|
|
741
|
+
const c = (a.maxX - a.minX) * (a.maxZ - a.minZ);
|
|
742
|
+
n.box.weight > t.box.weight * 1.5 && c > s * 1.2 && e.push({
|
|
743
743
|
code: "BR-203",
|
|
744
744
|
severity: "warning",
|
|
745
|
-
message: `Pirámide invertida: caja ${
|
|
746
|
-
involvedIds: [t.id,
|
|
745
|
+
message: `Pirámide invertida: caja ${n.id} (${n.box.weight}kg) sobre caja ${t.id} (${t.box.weight}kg)`,
|
|
746
|
+
involvedIds: [t.id, n.id]
|
|
747
747
|
});
|
|
748
748
|
}
|
|
749
749
|
}
|
|
750
750
|
return { isValid: !0, violations: e };
|
|
751
751
|
}
|
|
752
|
-
function
|
|
752
|
+
function Wt(o) {
|
|
753
753
|
const e = [];
|
|
754
754
|
if (o.floors.length <= 1) return { isValid: !0, violations: e };
|
|
755
755
|
const t = o.floors[0].pallet;
|
|
756
756
|
for (let i = 1; i < o.floors.length; i++) {
|
|
757
|
-
const
|
|
758
|
-
(
|
|
757
|
+
const s = o.floors[i].pallet;
|
|
758
|
+
(s.dimensions.width !== t.dimensions.width || s.dimensions.depth !== t.dimensions.depth) && e.push({
|
|
759
759
|
code: "BR-301",
|
|
760
760
|
severity: "error",
|
|
761
|
-
message: `Piso ${i}: dimensiones (${
|
|
762
|
-
involvedIds: [t.id,
|
|
761
|
+
message: `Piso ${i}: dimensiones (${s.dimensions.width}×${s.dimensions.depth}) distintas a la base (${t.dimensions.width}×${t.dimensions.depth})`,
|
|
762
|
+
involvedIds: [t.id, s.id]
|
|
763
763
|
});
|
|
764
764
|
}
|
|
765
765
|
return { isValid: e.length === 0, violations: e };
|
|
766
766
|
}
|
|
767
|
-
function
|
|
767
|
+
function $t(o) {
|
|
768
768
|
const e = [];
|
|
769
769
|
for (let t = 0; t < o.floors.length - 1; t++)
|
|
770
770
|
o.floors[t].separatorAbove || e.push({
|
|
@@ -775,7 +775,7 @@ function Wt(o) {
|
|
|
775
775
|
});
|
|
776
776
|
return { isValid: e.length === 0, violations: e };
|
|
777
777
|
}
|
|
778
|
-
function
|
|
778
|
+
function Lt(o, e) {
|
|
779
779
|
const t = [], i = le(o);
|
|
780
780
|
return i > e && t.push({
|
|
781
781
|
code: "BR-303",
|
|
@@ -784,63 +784,63 @@ function Bt(o, e) {
|
|
|
784
784
|
involvedIds: [o.id]
|
|
785
785
|
}), { isValid: t.length === 0, violations: t };
|
|
786
786
|
}
|
|
787
|
-
function
|
|
788
|
-
const e = [], t =
|
|
789
|
-
return
|
|
787
|
+
function Gt(o) {
|
|
788
|
+
const e = [], t = ye(o), i = o.floors[0].pallet.maxWeight, s = t - o.floors[0].pallet.weight;
|
|
789
|
+
return s > i && e.push({
|
|
790
790
|
code: "BR-304",
|
|
791
791
|
severity: "error",
|
|
792
|
-
message: `Peso de carga del stack (${
|
|
792
|
+
message: `Peso de carga del stack (${s.toFixed(1)}kg) excede la capacidad del palet base (${i}kg)`,
|
|
793
793
|
involvedIds: [o.id]
|
|
794
794
|
}), { isValid: e.length === 0, violations: e };
|
|
795
795
|
}
|
|
796
796
|
function ct(o) {
|
|
797
797
|
const e = [];
|
|
798
798
|
for (const t of o) {
|
|
799
|
-
const i =
|
|
799
|
+
const i = L(t);
|
|
800
800
|
if (i.minY <= 1) continue;
|
|
801
|
-
const
|
|
802
|
-
let
|
|
801
|
+
const s = (i.maxX - i.minX) * (i.maxZ - i.minZ);
|
|
802
|
+
let n = 0;
|
|
803
803
|
for (const a of o) {
|
|
804
804
|
if (a.id === t.id) continue;
|
|
805
|
-
const
|
|
806
|
-
if (Math.abs(
|
|
807
|
-
const
|
|
808
|
-
|
|
805
|
+
const c = L(a);
|
|
806
|
+
if (Math.abs(c.maxY - i.minY) > 2) continue;
|
|
807
|
+
const l = Math.max(0, Math.min(i.maxX, c.maxX) - Math.max(i.minX, c.minX)), p = Math.max(0, Math.min(i.maxZ, c.maxZ) - Math.max(i.minZ, c.minZ));
|
|
808
|
+
n += l * p;
|
|
809
809
|
}
|
|
810
|
-
|
|
810
|
+
s > 0 && n / s < ze && e.push({
|
|
811
811
|
code: "BR-004",
|
|
812
812
|
severity: "error",
|
|
813
|
-
message: `Caja ${t.id} sin soporte suficiente (${(
|
|
813
|
+
message: `Caja ${t.id} sin soporte suficiente (${(n / s * 100).toFixed(0)}% < ${ze * 100}%)`,
|
|
814
814
|
involvedIds: [t.id]
|
|
815
815
|
});
|
|
816
816
|
}
|
|
817
817
|
return { isValid: e.length === 0, violations: e };
|
|
818
818
|
}
|
|
819
|
-
function
|
|
819
|
+
function Y(o) {
|
|
820
820
|
if (o.length === 0) return { x: 0, y: 0, z: 0 };
|
|
821
|
-
let e = 0, t = 0, i = 0,
|
|
822
|
-
for (const
|
|
823
|
-
const a =
|
|
824
|
-
t +=
|
|
821
|
+
let e = 0, t = 0, i = 0, s = 0;
|
|
822
|
+
for (const n of o) {
|
|
823
|
+
const a = L(n), c = (a.minX + a.maxX) / 2, l = (a.minY + a.maxY) / 2, p = (a.minZ + a.maxZ) / 2, h = n.box.weight;
|
|
824
|
+
t += c * h, i += l * h, s += p * h, e += h;
|
|
825
825
|
}
|
|
826
826
|
return e === 0 ? { x: 0, y: 0, z: 0 } : {
|
|
827
827
|
x: t / e,
|
|
828
828
|
y: i / e,
|
|
829
|
-
z:
|
|
829
|
+
z: s / e
|
|
830
830
|
};
|
|
831
831
|
}
|
|
832
|
-
function
|
|
832
|
+
function ee(o, e) {
|
|
833
833
|
if (e.length === 0) return 100;
|
|
834
|
-
const t =
|
|
835
|
-
const
|
|
836
|
-
return Math.max(
|
|
837
|
-
}, 0),
|
|
838
|
-
return Math.round(
|
|
834
|
+
const t = Y(e), i = o.dimensions.width / 2, s = o.dimensions.depth / 2, n = Math.abs(t.x - i) / (o.dimensions.width / 2), a = Math.abs(t.z - s) / (o.dimensions.depth / 2), c = Math.max(0, 100 - (n + a) * 50), l = e.reduce((g, w) => {
|
|
835
|
+
const m = L(w);
|
|
836
|
+
return Math.max(g, m.maxY);
|
|
837
|
+
}, 0), p = l > 0 ? t.y / l : 0, h = Math.max(0, 100 - Math.max(0, p - 0.5) * 100);
|
|
838
|
+
return Math.round(c * 0.7 + h * 0.3);
|
|
839
839
|
}
|
|
840
840
|
function lt(o, e) {
|
|
841
841
|
const t = [];
|
|
842
842
|
if (e.length === 0) return { isValid: !0, violations: t };
|
|
843
|
-
const i =
|
|
843
|
+
const i = Y(e);
|
|
844
844
|
return (i.x < 0 || i.x > o.dimensions.width || i.z < 0 || i.z > o.dimensions.depth) && t.push({
|
|
845
845
|
code: "BR-502",
|
|
846
846
|
severity: "error",
|
|
@@ -851,7 +851,7 @@ function lt(o, e) {
|
|
|
851
851
|
function dt(o, e) {
|
|
852
852
|
const t = [];
|
|
853
853
|
if (e.length === 0) return { isValid: !0, violations: t };
|
|
854
|
-
const i =
|
|
854
|
+
const i = ee(o, e);
|
|
855
855
|
i < 50 ? t.push({
|
|
856
856
|
code: "BR-501",
|
|
857
857
|
severity: "error",
|
|
@@ -863,36 +863,36 @@ function dt(o, e) {
|
|
|
863
863
|
message: `Score de estabilidad mejorable (${i}/100, recomendado: ≥70)`,
|
|
864
864
|
involvedIds: [o.id]
|
|
865
865
|
});
|
|
866
|
-
const
|
|
867
|
-
return
|
|
866
|
+
const s = Y(e), n = e.reduce((a, c) => Math.max(a, L(c).maxY), 0);
|
|
867
|
+
return n > 0 && s.y > n * 0.6 && t.push({
|
|
868
868
|
code: "BR-503",
|
|
869
869
|
severity: "warning",
|
|
870
|
-
message: `Centro de gravedad alto (${
|
|
870
|
+
message: `Centro de gravedad alto (${s.y.toFixed(0)}mm, ${(s.y / n * 100).toFixed(0)}% de la altura)`,
|
|
871
871
|
involvedIds: [o.id]
|
|
872
872
|
}), { isValid: t.filter((a) => a.severity === "error").length === 0, violations: t };
|
|
873
873
|
}
|
|
874
874
|
function ht(o, e) {
|
|
875
875
|
let t = !1;
|
|
876
876
|
const i = e.length;
|
|
877
|
-
for (let
|
|
878
|
-
const a = e[
|
|
879
|
-
|
|
877
|
+
for (let s = 0, n = i - 1; s < i; n = s++) {
|
|
878
|
+
const a = e[s].x, c = e[s].z, l = e[n].x, p = e[n].z;
|
|
879
|
+
c > o.z != p > o.z && o.x < (l - a) * (o.z - c) / (p - c) + a && (t = !t);
|
|
880
880
|
}
|
|
881
881
|
return t;
|
|
882
882
|
}
|
|
883
883
|
function We(o, e) {
|
|
884
|
-
const t = [], i =
|
|
884
|
+
const t = [], i = se(o), s = [
|
|
885
885
|
{ x: i.minX, z: i.minZ },
|
|
886
886
|
{ x: i.maxX, z: i.minZ },
|
|
887
887
|
{ x: i.maxX, z: i.maxZ },
|
|
888
888
|
{ x: i.minX, z: i.maxZ }
|
|
889
889
|
];
|
|
890
|
-
for (const
|
|
891
|
-
if (!ht(
|
|
890
|
+
for (const n of s)
|
|
891
|
+
if (!ht(n, e.floorPolygon)) {
|
|
892
892
|
t.push({
|
|
893
893
|
code: "BR-401",
|
|
894
894
|
severity: "error",
|
|
895
|
-
message: `Palet ${o.id} fuera de la estancia ${e.name} en (${
|
|
895
|
+
message: `Palet ${o.id} fuera de la estancia ${e.name} en (${n.x}, ${n.z})`,
|
|
896
896
|
involvedIds: [o.id, e.id]
|
|
897
897
|
});
|
|
898
898
|
break;
|
|
@@ -908,53 +908,53 @@ class mt {
|
|
|
908
908
|
id = "column";
|
|
909
909
|
name = "Columnas por tipo";
|
|
910
910
|
pack(e, t) {
|
|
911
|
-
const i = [],
|
|
912
|
-
for (const
|
|
913
|
-
const
|
|
914
|
-
|
|
911
|
+
const i = [], s = [], n = /* @__PURE__ */ new Map();
|
|
912
|
+
for (const m of e) {
|
|
913
|
+
const x = m.type ?? m.sku ?? "default";
|
|
914
|
+
n.has(x) || n.set(x, []), n.get(x).push(m);
|
|
915
915
|
}
|
|
916
|
-
let a = 0,
|
|
917
|
-
for (const [,
|
|
918
|
-
if (
|
|
919
|
-
const
|
|
920
|
-
if (a +
|
|
921
|
-
|
|
916
|
+
let a = 0, c = 0;
|
|
917
|
+
for (const [, m] of n) {
|
|
918
|
+
if (m.length === 0) continue;
|
|
919
|
+
const x = m[0], u = x.dimensions.width, d = x.dimensions.depth, b = x.dimensions.height;
|
|
920
|
+
if (a + u > t.dimensions.width) {
|
|
921
|
+
s.push(...m);
|
|
922
922
|
continue;
|
|
923
923
|
}
|
|
924
|
-
let
|
|
925
|
-
for (;
|
|
926
|
-
const
|
|
927
|
-
if (
|
|
928
|
-
if (
|
|
929
|
-
|
|
924
|
+
let j = 0, _ = 0, S = 0;
|
|
925
|
+
for (; S < m.length; ) {
|
|
926
|
+
const C = m[S];
|
|
927
|
+
if (j + d > t.dimensions.depth) {
|
|
928
|
+
if (j = 0, _ += b, _ + b > t.maxStackHeight) {
|
|
929
|
+
s.push(...m.slice(S));
|
|
930
930
|
break;
|
|
931
931
|
}
|
|
932
932
|
continue;
|
|
933
933
|
}
|
|
934
934
|
i.push({
|
|
935
|
-
id: `placed-${++
|
|
936
|
-
box:
|
|
937
|
-
position: { x: a, y:
|
|
935
|
+
id: `placed-${++c}`,
|
|
936
|
+
box: C,
|
|
937
|
+
position: { x: a, y: _, z: j },
|
|
938
938
|
rotation: { x: 0, y: 0, z: 0 },
|
|
939
939
|
supportedBy: [],
|
|
940
940
|
supporting: []
|
|
941
|
-
}),
|
|
941
|
+
}), j += d, S++;
|
|
942
942
|
}
|
|
943
|
-
a +=
|
|
943
|
+
a += u;
|
|
944
944
|
}
|
|
945
|
-
const
|
|
946
|
-
const
|
|
947
|
-
return
|
|
948
|
-
}, 0),
|
|
945
|
+
const l = t.dimensions.width * t.maxStackHeight * t.dimensions.depth, p = i.reduce((m, x) => {
|
|
946
|
+
const u = x.box.dimensions;
|
|
947
|
+
return m + u.width * u.height * u.depth;
|
|
948
|
+
}, 0), h = i.reduce((m, x) => m + x.box.weight, 0), g = Y(i), w = ee(t, i);
|
|
949
949
|
return {
|
|
950
950
|
placements: i,
|
|
951
951
|
metrics: {
|
|
952
|
-
volumeUtilization:
|
|
953
|
-
weightUtilization: t.maxWeight > 0 ?
|
|
954
|
-
centerOfGravity:
|
|
955
|
-
stabilityScore:
|
|
952
|
+
volumeUtilization: l > 0 ? p / l : 0,
|
|
953
|
+
weightUtilization: t.maxWeight > 0 ? h / t.maxWeight : 0,
|
|
954
|
+
centerOfGravity: g,
|
|
955
|
+
stabilityScore: w
|
|
956
956
|
},
|
|
957
|
-
unplacedBoxes:
|
|
957
|
+
unplacedBoxes: s
|
|
958
958
|
};
|
|
959
959
|
}
|
|
960
960
|
}
|
|
@@ -962,9 +962,9 @@ class ut {
|
|
|
962
962
|
id = "bin-packing-3d";
|
|
963
963
|
name = "Bin Packing 3D (FFD Height)";
|
|
964
964
|
pack(e, t) {
|
|
965
|
-
const i = [],
|
|
966
|
-
const
|
|
967
|
-
return
|
|
965
|
+
const i = [], s = [], n = [...e].sort((g, w) => {
|
|
966
|
+
const m = g.dimensions.width * g.dimensions.height * g.dimensions.depth;
|
|
967
|
+
return w.dimensions.width * w.dimensions.height * w.dimensions.depth - m;
|
|
968
968
|
}), a = [
|
|
969
969
|
{
|
|
970
970
|
x: 0,
|
|
@@ -975,69 +975,69 @@ class ut {
|
|
|
975
975
|
depth: t.dimensions.depth
|
|
976
976
|
}
|
|
977
977
|
];
|
|
978
|
-
let
|
|
979
|
-
for (const
|
|
980
|
-
let
|
|
981
|
-
const
|
|
982
|
-
{ w:
|
|
983
|
-
{ w:
|
|
978
|
+
let c = 0;
|
|
979
|
+
for (const g of n) {
|
|
980
|
+
let w = !1;
|
|
981
|
+
const m = [
|
|
982
|
+
{ w: g.dimensions.width, h: g.dimensions.height, d: g.dimensions.depth, rot: 0 },
|
|
983
|
+
{ w: g.dimensions.depth, h: g.dimensions.height, d: g.dimensions.width, rot: 90 }
|
|
984
984
|
];
|
|
985
|
-
for (let
|
|
986
|
-
const
|
|
987
|
-
for (const
|
|
988
|
-
if (
|
|
989
|
-
const
|
|
990
|
-
id: `placed-${++
|
|
991
|
-
box:
|
|
992
|
-
position: { x:
|
|
993
|
-
rotation: { x: 0, y:
|
|
985
|
+
for (let x = 0; x < a.length && !w; x++) {
|
|
986
|
+
const u = a[x];
|
|
987
|
+
for (const d of m)
|
|
988
|
+
if (d.w <= u.width && d.h <= u.height && d.d <= u.depth) {
|
|
989
|
+
const b = {
|
|
990
|
+
id: `placed-${++c}`,
|
|
991
|
+
box: g,
|
|
992
|
+
position: { x: u.x, y: u.y, z: u.z },
|
|
993
|
+
rotation: { x: 0, y: d.rot, z: 0 },
|
|
994
994
|
supportedBy: [],
|
|
995
995
|
supporting: []
|
|
996
|
-
},
|
|
996
|
+
}, j = L(b);
|
|
997
997
|
if (!i.some(
|
|
998
|
-
(
|
|
998
|
+
(S) => ve(L(S), j)
|
|
999
999
|
)) {
|
|
1000
|
-
i.push(
|
|
1001
|
-
x:
|
|
1002
|
-
y:
|
|
1003
|
-
z:
|
|
1004
|
-
width:
|
|
1005
|
-
height:
|
|
1006
|
-
depth:
|
|
1007
|
-
}),
|
|
1008
|
-
x:
|
|
1009
|
-
y:
|
|
1010
|
-
z:
|
|
1011
|
-
width:
|
|
1012
|
-
height:
|
|
1013
|
-
depth:
|
|
1014
|
-
}),
|
|
1015
|
-
x:
|
|
1016
|
-
y:
|
|
1017
|
-
z:
|
|
1018
|
-
width:
|
|
1019
|
-
height:
|
|
1020
|
-
depth:
|
|
1021
|
-
}), a.sort((
|
|
1000
|
+
i.push(b), w = !0, a.splice(x, 1), u.width - d.w > 0 && a.push({
|
|
1001
|
+
x: u.x + d.w,
|
|
1002
|
+
y: u.y,
|
|
1003
|
+
z: u.z,
|
|
1004
|
+
width: u.width - d.w,
|
|
1005
|
+
height: u.height,
|
|
1006
|
+
depth: u.depth
|
|
1007
|
+
}), u.height - d.h > 0 && a.push({
|
|
1008
|
+
x: u.x,
|
|
1009
|
+
y: u.y + d.h,
|
|
1010
|
+
z: u.z,
|
|
1011
|
+
width: d.w,
|
|
1012
|
+
height: u.height - d.h,
|
|
1013
|
+
depth: d.d
|
|
1014
|
+
}), u.depth - d.d > 0 && a.push({
|
|
1015
|
+
x: u.x,
|
|
1016
|
+
y: u.y,
|
|
1017
|
+
z: u.z + d.d,
|
|
1018
|
+
width: d.w,
|
|
1019
|
+
height: u.height,
|
|
1020
|
+
depth: u.depth - d.d
|
|
1021
|
+
}), a.sort((S, C) => S.y - C.y || S.x - C.x || S.z - C.z);
|
|
1022
1022
|
break;
|
|
1023
1023
|
}
|
|
1024
1024
|
}
|
|
1025
1025
|
}
|
|
1026
|
-
|
|
1026
|
+
w || s.push(g);
|
|
1027
1027
|
}
|
|
1028
|
-
const
|
|
1029
|
-
const
|
|
1030
|
-
return
|
|
1031
|
-
}, 0),
|
|
1028
|
+
const l = t.dimensions.width * t.maxStackHeight * t.dimensions.depth, p = i.reduce((g, w) => {
|
|
1029
|
+
const m = w.box.dimensions;
|
|
1030
|
+
return g + m.width * m.height * m.depth;
|
|
1031
|
+
}, 0), h = i.reduce((g, w) => g + w.box.weight, 0);
|
|
1032
1032
|
return {
|
|
1033
1033
|
placements: i,
|
|
1034
1034
|
metrics: {
|
|
1035
|
-
volumeUtilization:
|
|
1036
|
-
weightUtilization: t.maxWeight > 0 ?
|
|
1037
|
-
centerOfGravity:
|
|
1038
|
-
stabilityScore:
|
|
1035
|
+
volumeUtilization: l > 0 ? p / l : 0,
|
|
1036
|
+
weightUtilization: t.maxWeight > 0 ? h / t.maxWeight : 0,
|
|
1037
|
+
centerOfGravity: Y(i),
|
|
1038
|
+
stabilityScore: ee(t, i)
|
|
1039
1039
|
},
|
|
1040
|
-
unplacedBoxes:
|
|
1040
|
+
unplacedBoxes: s
|
|
1041
1041
|
};
|
|
1042
1042
|
}
|
|
1043
1043
|
}
|
|
@@ -1045,54 +1045,576 @@ class xt {
|
|
|
1045
1045
|
id = "type-group";
|
|
1046
1046
|
name = "Agrupación por tipo";
|
|
1047
1047
|
pack(e, t) {
|
|
1048
|
-
const i = [],
|
|
1049
|
-
const
|
|
1050
|
-
return
|
|
1048
|
+
const i = [], s = [], n = [...e].sort((x, u) => {
|
|
1049
|
+
const d = x.type ?? x.sku ?? "z", b = u.type ?? u.sku ?? "z";
|
|
1050
|
+
return d !== b ? d.localeCompare(b) : x.fragile !== u.fragile ? x.fragile ? 1 : -1 : u.weight - x.weight;
|
|
1051
1051
|
});
|
|
1052
|
-
let a = 0,
|
|
1053
|
-
for (const
|
|
1054
|
-
const
|
|
1055
|
-
if (a +
|
|
1056
|
-
|
|
1052
|
+
let a = 0, c = 0, l = 0, p = 0, h = 0;
|
|
1053
|
+
for (const x of n) {
|
|
1054
|
+
const u = x.dimensions.width, d = x.dimensions.height, b = x.dimensions.depth;
|
|
1055
|
+
if (a + u > t.dimensions.width && (a = 0, c += p > 0 ? b : 0), c + b > t.dimensions.depth && (a = 0, c = 0, l += p, p = 0), l + d > t.maxStackHeight) {
|
|
1056
|
+
s.push(x);
|
|
1057
1057
|
continue;
|
|
1058
1058
|
}
|
|
1059
|
-
if (a +
|
|
1060
|
-
|
|
1059
|
+
if (a + u > t.dimensions.width) {
|
|
1060
|
+
s.push(x);
|
|
1061
1061
|
continue;
|
|
1062
1062
|
}
|
|
1063
|
-
if (
|
|
1064
|
-
|
|
1063
|
+
if (c + b > t.dimensions.depth) {
|
|
1064
|
+
s.push(x);
|
|
1065
1065
|
continue;
|
|
1066
1066
|
}
|
|
1067
1067
|
i.push({
|
|
1068
|
-
id: `placed-${++
|
|
1069
|
-
box:
|
|
1070
|
-
position: { x: a, y:
|
|
1068
|
+
id: `placed-${++h}`,
|
|
1069
|
+
box: x,
|
|
1070
|
+
position: { x: a, y: l, z: c },
|
|
1071
1071
|
rotation: { x: 0, y: 0, z: 0 },
|
|
1072
1072
|
supportedBy: [],
|
|
1073
1073
|
supporting: []
|
|
1074
|
-
}), a +=
|
|
1074
|
+
}), a += u, p = Math.max(p, d);
|
|
1075
1075
|
}
|
|
1076
|
-
const
|
|
1077
|
-
const
|
|
1078
|
-
return
|
|
1079
|
-
}, 0),
|
|
1076
|
+
const g = t.dimensions.width * t.maxStackHeight * t.dimensions.depth, w = i.reduce((x, u) => {
|
|
1077
|
+
const d = u.box.dimensions;
|
|
1078
|
+
return x + d.width * d.height * d.depth;
|
|
1079
|
+
}, 0), m = i.reduce((x, u) => x + u.box.weight, 0);
|
|
1080
1080
|
return {
|
|
1081
1081
|
placements: i,
|
|
1082
1082
|
metrics: {
|
|
1083
|
-
volumeUtilization:
|
|
1084
|
-
weightUtilization: t.maxWeight > 0 ?
|
|
1085
|
-
centerOfGravity:
|
|
1086
|
-
stabilityScore:
|
|
1083
|
+
volumeUtilization: g > 0 ? w / g : 0,
|
|
1084
|
+
weightUtilization: t.maxWeight > 0 ? m / t.maxWeight : 0,
|
|
1085
|
+
centerOfGravity: Y(i),
|
|
1086
|
+
stabilityScore: ee(t, i)
|
|
1087
1087
|
},
|
|
1088
|
-
unplacedBoxes:
|
|
1088
|
+
unplacedBoxes: s
|
|
1089
1089
|
};
|
|
1090
1090
|
}
|
|
1091
1091
|
}
|
|
1092
1092
|
class gt {
|
|
1093
|
+
id = "material-grouping";
|
|
1094
|
+
name = "Material & Product Grouping";
|
|
1095
|
+
/**
|
|
1096
|
+
* Packs boxes into a pallet using layer-based approach with material ordering
|
|
1097
|
+
*
|
|
1098
|
+
* @param boxes - Boxes to pack
|
|
1099
|
+
* @param pallet - Target pallet
|
|
1100
|
+
* @returns Packing result with placements and metrics
|
|
1101
|
+
*/
|
|
1102
|
+
pack(e, t) {
|
|
1103
|
+
if (e.length === 0)
|
|
1104
|
+
return this.emptyResult();
|
|
1105
|
+
const i = this.sortBoxes(e), s = this.groupByMaterialWeight(i), a = this.buildLayers(s, t).flatMap((p) => p.placements), c = e.filter(
|
|
1106
|
+
(p) => !a.some((h) => h.box.id === p.id)
|
|
1107
|
+
), l = this.calculateMetrics(a, t);
|
|
1108
|
+
return {
|
|
1109
|
+
placements: a,
|
|
1110
|
+
metrics: l,
|
|
1111
|
+
unplacedBoxes: c
|
|
1112
|
+
};
|
|
1113
|
+
}
|
|
1114
|
+
// ─── Phase 1: Sorting ──────────────────────────────────────────────
|
|
1115
|
+
/**
|
|
1116
|
+
* Sorts boxes by multiple criteria:
|
|
1117
|
+
* 1. Material weight (descending) - more resistant boxes first
|
|
1118
|
+
* 2. Product (alphabetical) - group same products together
|
|
1119
|
+
* 3. Base area (descending) - larger boxes first for stable base
|
|
1120
|
+
* 4. Height (descending) - taller boxes first for better layer filling
|
|
1121
|
+
*
|
|
1122
|
+
* @param boxes - Boxes to sort
|
|
1123
|
+
* @returns Sorted boxes array
|
|
1124
|
+
*/
|
|
1125
|
+
sortBoxes(e) {
|
|
1126
|
+
return [...e].sort((t, i) => {
|
|
1127
|
+
const s = t.materialWeight ?? 5, n = i.materialWeight ?? 5;
|
|
1128
|
+
if (s !== n)
|
|
1129
|
+
return n - s;
|
|
1130
|
+
const a = t.product ?? "", c = i.product ?? "";
|
|
1131
|
+
if (a !== c)
|
|
1132
|
+
return a.localeCompare(c);
|
|
1133
|
+
const l = t.dimensions.width * t.dimensions.depth, p = i.dimensions.width * i.dimensions.depth;
|
|
1134
|
+
return l !== p ? p - l : i.dimensions.height - t.dimensions.height;
|
|
1135
|
+
});
|
|
1136
|
+
}
|
|
1137
|
+
/**
|
|
1138
|
+
* Groups boxes by material weight for layer construction
|
|
1139
|
+
*
|
|
1140
|
+
* @param boxes - Sorted boxes
|
|
1141
|
+
* @returns Map of material weight → boxes with that weight
|
|
1142
|
+
*/
|
|
1143
|
+
groupByMaterialWeight(e) {
|
|
1144
|
+
const t = /* @__PURE__ */ new Map();
|
|
1145
|
+
for (const i of e) {
|
|
1146
|
+
const s = i.materialWeight ?? 5;
|
|
1147
|
+
t.has(s) || t.set(s, []), t.get(s).push(i);
|
|
1148
|
+
}
|
|
1149
|
+
return new Map([...t.entries()].sort((i, s) => s[0] - i[0]));
|
|
1150
|
+
}
|
|
1151
|
+
// ─── Phase 2: Layer Construction ──────────────────────────────────
|
|
1152
|
+
/**
|
|
1153
|
+
* Builds layers from bottom to top, processing each material weight group
|
|
1154
|
+
*
|
|
1155
|
+
* @param materialGroups - Boxes grouped by material weight
|
|
1156
|
+
* @param pallet - Target pallet
|
|
1157
|
+
* @returns Array of layers
|
|
1158
|
+
*/
|
|
1159
|
+
buildLayers(e, t) {
|
|
1160
|
+
const i = [], s = /* @__PURE__ */ new Map(), n = [];
|
|
1161
|
+
let a = 0;
|
|
1162
|
+
for (const [, c] of e) {
|
|
1163
|
+
let l = [...c];
|
|
1164
|
+
for (; l.length > 0; ) {
|
|
1165
|
+
const p = this.buildNextLayer(
|
|
1166
|
+
l,
|
|
1167
|
+
t,
|
|
1168
|
+
a,
|
|
1169
|
+
s,
|
|
1170
|
+
n
|
|
1171
|
+
);
|
|
1172
|
+
if (p.placements.length === 0)
|
|
1173
|
+
break;
|
|
1174
|
+
i.push(p), n.push(...p.placements), a += p.height;
|
|
1175
|
+
const h = new Set(p.placements.map((g) => g.box.id));
|
|
1176
|
+
if (l = l.filter((g) => !h.has(g.id)), a >= t.maxStackHeight)
|
|
1177
|
+
break;
|
|
1178
|
+
}
|
|
1179
|
+
}
|
|
1180
|
+
return i;
|
|
1181
|
+
}
|
|
1182
|
+
/**
|
|
1183
|
+
* Builds the next layer using available boxes
|
|
1184
|
+
*
|
|
1185
|
+
* Strategy:
|
|
1186
|
+
* 1. Try uniform height layer with 100% coverage
|
|
1187
|
+
* 2. If not possible, try mixed height layer
|
|
1188
|
+
* 3. If still not possible, use partial coverage (last resort)
|
|
1189
|
+
*
|
|
1190
|
+
* @param availableBoxes - Boxes available for this layer
|
|
1191
|
+
* @param pallet - Target pallet
|
|
1192
|
+
* @param currentY - Current vertical position
|
|
1193
|
+
* @param occupiedColumns - Track which (x,z) positions have which product
|
|
1194
|
+
* @param allPreviousPlacements - All placements from previous layers (for support calculation)
|
|
1195
|
+
* @returns Constructed layer
|
|
1196
|
+
*/
|
|
1197
|
+
buildNextLayer(e, t, i, s, n) {
|
|
1198
|
+
const a = this.tryUniformHeightLayer(
|
|
1199
|
+
e,
|
|
1200
|
+
t,
|
|
1201
|
+
i,
|
|
1202
|
+
s,
|
|
1203
|
+
n
|
|
1204
|
+
);
|
|
1205
|
+
if (a && a.coverage >= 95)
|
|
1206
|
+
return a;
|
|
1207
|
+
const c = this.tryMixedHeightLayer(
|
|
1208
|
+
e,
|
|
1209
|
+
t,
|
|
1210
|
+
i,
|
|
1211
|
+
s,
|
|
1212
|
+
n
|
|
1213
|
+
);
|
|
1214
|
+
return c && c.coverage >= 95 ? c : ((a?.coverage ?? 0) > (c?.coverage ?? 0) ? a : c) ?? this.emptyLayer(i);
|
|
1215
|
+
}
|
|
1216
|
+
/**
|
|
1217
|
+
* Attempts to create a layer with boxes of uniform height
|
|
1218
|
+
*
|
|
1219
|
+
* @param boxes - Available boxes
|
|
1220
|
+
* @param pallet - Target pallet
|
|
1221
|
+
* @param currentY - Current vertical position
|
|
1222
|
+
* @param occupiedColumns - Occupied column tracker
|
|
1223
|
+
* @param allPreviousPlacements - All placements from previous layers
|
|
1224
|
+
* @returns Layer or null if not possible
|
|
1225
|
+
*/
|
|
1226
|
+
tryUniformHeightLayer(e, t, i, s, n) {
|
|
1227
|
+
const a = /* @__PURE__ */ new Map();
|
|
1228
|
+
for (const l of e) {
|
|
1229
|
+
const p = l.dimensions.height;
|
|
1230
|
+
a.has(p) || a.set(p, []), a.get(p).push(l);
|
|
1231
|
+
}
|
|
1232
|
+
const c = [...a.entries()].sort(
|
|
1233
|
+
(l, p) => p[1].length - l[1].length
|
|
1234
|
+
);
|
|
1235
|
+
for (const [l, p] of c) {
|
|
1236
|
+
if (i + l > t.maxStackHeight)
|
|
1237
|
+
continue;
|
|
1238
|
+
const h = this.placeBoxesInLayer(
|
|
1239
|
+
p,
|
|
1240
|
+
t,
|
|
1241
|
+
i,
|
|
1242
|
+
l,
|
|
1243
|
+
s,
|
|
1244
|
+
n
|
|
1245
|
+
);
|
|
1246
|
+
if (h.coverage >= 95)
|
|
1247
|
+
return h;
|
|
1248
|
+
}
|
|
1249
|
+
return null;
|
|
1250
|
+
}
|
|
1251
|
+
/**
|
|
1252
|
+
* Attempts to create a layer with boxes of mixed heights
|
|
1253
|
+
*
|
|
1254
|
+
* @param boxes - Available boxes
|
|
1255
|
+
* @param pallet - Target pallet
|
|
1256
|
+
* @param currentY - Current vertical position
|
|
1257
|
+
* @param occupiedColumns - Occupied column tracker
|
|
1258
|
+
* @param allPreviousPlacements - All placements from previous layers
|
|
1259
|
+
* @returns Layer or null if not possible
|
|
1260
|
+
*/
|
|
1261
|
+
tryMixedHeightLayer(e, t, i, s, n) {
|
|
1262
|
+
return this.placeBoxesInLayer(
|
|
1263
|
+
e,
|
|
1264
|
+
t,
|
|
1265
|
+
i,
|
|
1266
|
+
null,
|
|
1267
|
+
s,
|
|
1268
|
+
n
|
|
1269
|
+
);
|
|
1270
|
+
}
|
|
1271
|
+
// ─── Phase 3: Maximal Rectangles 2D Packing ───────────────────────
|
|
1272
|
+
/**
|
|
1273
|
+
* Places boxes in a layer using Maximal Rectangles algorithm
|
|
1274
|
+
*
|
|
1275
|
+
* @param boxes - Boxes to place
|
|
1276
|
+
* @param pallet - Target pallet
|
|
1277
|
+
* @param currentY - Y coordinate of this layer
|
|
1278
|
+
* @param targetHeight - If specified, only use boxes of this height
|
|
1279
|
+
* @param occupiedColumns - Track product columns
|
|
1280
|
+
* @param allPreviousPlacements - All placements from previous layers (for support calculation)
|
|
1281
|
+
* @returns Constructed layer
|
|
1282
|
+
*/
|
|
1283
|
+
placeBoxesInLayer(e, t, i, s, n, a) {
|
|
1284
|
+
const c = [
|
|
1285
|
+
{
|
|
1286
|
+
x: 0,
|
|
1287
|
+
z: 0,
|
|
1288
|
+
width: t.dimensions.width,
|
|
1289
|
+
depth: t.dimensions.depth
|
|
1290
|
+
}
|
|
1291
|
+
], l = [], h = [...this.groupByProduct(e).entries()].sort(
|
|
1292
|
+
(u, d) => d[1].length - u[1].length
|
|
1293
|
+
);
|
|
1294
|
+
let g = 0;
|
|
1295
|
+
for (const [u, d] of h) {
|
|
1296
|
+
const b = s ? d.filter((j) => j.dimensions.height === s) : d;
|
|
1297
|
+
for (const j of b) {
|
|
1298
|
+
if (i + j.dimensions.height > t.maxStackHeight)
|
|
1299
|
+
continue;
|
|
1300
|
+
const _ = [
|
|
1301
|
+
{
|
|
1302
|
+
width: j.dimensions.width,
|
|
1303
|
+
depth: j.dimensions.depth,
|
|
1304
|
+
rotation: 0
|
|
1305
|
+
},
|
|
1306
|
+
{
|
|
1307
|
+
width: j.dimensions.depth,
|
|
1308
|
+
depth: j.dimensions.width,
|
|
1309
|
+
rotation: 90
|
|
1310
|
+
}
|
|
1311
|
+
];
|
|
1312
|
+
for (const S of _) {
|
|
1313
|
+
const C = [
|
|
1314
|
+
...a,
|
|
1315
|
+
...l
|
|
1316
|
+
], z = this.findBestRectangle(
|
|
1317
|
+
S,
|
|
1318
|
+
c,
|
|
1319
|
+
n,
|
|
1320
|
+
u,
|
|
1321
|
+
i,
|
|
1322
|
+
C
|
|
1323
|
+
);
|
|
1324
|
+
if (z) {
|
|
1325
|
+
const y = {
|
|
1326
|
+
id: `placed-${++g}`,
|
|
1327
|
+
box: j,
|
|
1328
|
+
position: { x: z.x, y: i, z: z.z },
|
|
1329
|
+
rotation: { x: 0, y: S.rotation, z: 0 },
|
|
1330
|
+
supportedBy: [],
|
|
1331
|
+
supporting: []
|
|
1332
|
+
};
|
|
1333
|
+
l.push(y), this.updateOccupiedColumns(
|
|
1334
|
+
n,
|
|
1335
|
+
z.x,
|
|
1336
|
+
z.z,
|
|
1337
|
+
u
|
|
1338
|
+
), this.updateFreeRectangles(
|
|
1339
|
+
c,
|
|
1340
|
+
z,
|
|
1341
|
+
S.width,
|
|
1342
|
+
S.depth
|
|
1343
|
+
);
|
|
1344
|
+
break;
|
|
1345
|
+
}
|
|
1346
|
+
}
|
|
1347
|
+
}
|
|
1348
|
+
}
|
|
1349
|
+
const w = t.dimensions.width * t.dimensions.depth, m = l.reduce((u, d) => {
|
|
1350
|
+
const b = d.rotation.y === 90 ? d.box.dimensions.depth : d.box.dimensions.width, j = d.rotation.y === 90 ? d.box.dimensions.width : d.box.dimensions.depth;
|
|
1351
|
+
return u + b * j;
|
|
1352
|
+
}, 0), x = l.length > 0 ? Math.max(...l.map((u) => u.box.dimensions.height)) : 0;
|
|
1353
|
+
return {
|
|
1354
|
+
y: i,
|
|
1355
|
+
height: x,
|
|
1356
|
+
placements: l,
|
|
1357
|
+
coverage: m / w * 100
|
|
1358
|
+
};
|
|
1359
|
+
}
|
|
1360
|
+
/**
|
|
1361
|
+
* Finds the best free rectangle for a box using scoring
|
|
1362
|
+
*
|
|
1363
|
+
* @param boxDims - Box dimensions (with rotation applied)
|
|
1364
|
+
* @param freeRectangles - Available free spaces
|
|
1365
|
+
* @param occupiedColumns - Product column tracker
|
|
1366
|
+
* @param product - Product identifier
|
|
1367
|
+
* @param currentY - Current layer Y position
|
|
1368
|
+
* @param existingPlacements - Already placed boxes in this layer and below
|
|
1369
|
+
* @param pallet - Pallet dimensions
|
|
1370
|
+
* @returns Best rectangle or null if none fit
|
|
1371
|
+
*/
|
|
1372
|
+
findBestRectangle(e, t, i, s, n, a) {
|
|
1373
|
+
let c = null, l = -1 / 0;
|
|
1374
|
+
for (const p of t)
|
|
1375
|
+
if (e.width <= p.width && e.depth <= p.depth) {
|
|
1376
|
+
const h = this.calculateSupportArea(
|
|
1377
|
+
p.x,
|
|
1378
|
+
p.z,
|
|
1379
|
+
e.width,
|
|
1380
|
+
e.depth,
|
|
1381
|
+
n,
|
|
1382
|
+
a
|
|
1383
|
+
), g = e.width * e.depth;
|
|
1384
|
+
if (h / g < 0.7 || this.boxExtendsBeyondLowerLayer(
|
|
1385
|
+
p.x,
|
|
1386
|
+
p.z,
|
|
1387
|
+
e.width,
|
|
1388
|
+
e.depth,
|
|
1389
|
+
n,
|
|
1390
|
+
a
|
|
1391
|
+
))
|
|
1392
|
+
continue;
|
|
1393
|
+
const m = this.scoreRectangle(
|
|
1394
|
+
p,
|
|
1395
|
+
e,
|
|
1396
|
+
i,
|
|
1397
|
+
s
|
|
1398
|
+
);
|
|
1399
|
+
m > l && (l = m, c = p);
|
|
1400
|
+
}
|
|
1401
|
+
return c;
|
|
1402
|
+
}
|
|
1403
|
+
/**
|
|
1404
|
+
* Calculates the area of support a box would have at a given position
|
|
1405
|
+
*
|
|
1406
|
+
* @param x - X position of box
|
|
1407
|
+
* @param z - Z position of box
|
|
1408
|
+
* @param width - Width of box
|
|
1409
|
+
* @param depth - Depth of box
|
|
1410
|
+
* @param currentY - Y position where box will be placed
|
|
1411
|
+
* @param existingPlacements - Boxes already placed in current and previous layers
|
|
1412
|
+
* @param pallet - Pallet dimensions
|
|
1413
|
+
* @returns Supported area in mm²
|
|
1414
|
+
*/
|
|
1415
|
+
calculateSupportArea(e, t, i, s, n, a) {
|
|
1416
|
+
let c = 0;
|
|
1417
|
+
if (n === 0)
|
|
1418
|
+
return i * s;
|
|
1419
|
+
for (const l of a) {
|
|
1420
|
+
const p = l.rotation.y === 90 ? l.box.dimensions.depth : l.box.dimensions.width, h = l.rotation.y === 90 ? l.box.dimensions.width : l.box.dimensions.depth, g = l.position.y + l.box.dimensions.height;
|
|
1421
|
+
if (Math.abs(g - n) > 1)
|
|
1422
|
+
continue;
|
|
1423
|
+
const m = this.calculateRectangleIntersection(
|
|
1424
|
+
e,
|
|
1425
|
+
t,
|
|
1426
|
+
i,
|
|
1427
|
+
s,
|
|
1428
|
+
l.position.x,
|
|
1429
|
+
l.position.z,
|
|
1430
|
+
p,
|
|
1431
|
+
h
|
|
1432
|
+
);
|
|
1433
|
+
c += m;
|
|
1434
|
+
}
|
|
1435
|
+
return c;
|
|
1436
|
+
}
|
|
1437
|
+
/**
|
|
1438
|
+
* Calculates intersection area between two rectangles
|
|
1439
|
+
*
|
|
1440
|
+
* @returns Intersection area in mm²
|
|
1441
|
+
*/
|
|
1442
|
+
calculateRectangleIntersection(e, t, i, s, n, a, c, l) {
|
|
1443
|
+
const p = Math.max(0, Math.min(e + i, n + c) - Math.max(e, n)), h = Math.max(0, Math.min(t + s, a + l) - Math.max(t, a));
|
|
1444
|
+
return p * h;
|
|
1445
|
+
}
|
|
1446
|
+
/**
|
|
1447
|
+
* Checks if a box would extend beyond the footprint of boxes in the layer directly below
|
|
1448
|
+
*
|
|
1449
|
+
* This ensures that boxes in upper layers are always stacked on top of lower boxes,
|
|
1450
|
+
* preventing boxes from "hanging" over edges when there's available space in the lower layer.
|
|
1451
|
+
*
|
|
1452
|
+
* @param x - X position of box
|
|
1453
|
+
* @param z - Z position of box
|
|
1454
|
+
* @param width - Width of box
|
|
1455
|
+
* @param depth - Depth of box
|
|
1456
|
+
* @param currentY - Y position where box will be placed
|
|
1457
|
+
* @param existingPlacements - Boxes already placed in current and previous layers
|
|
1458
|
+
* @returns true if box extends beyond lower layer footprint
|
|
1459
|
+
*/
|
|
1460
|
+
boxExtendsBeyondLowerLayer(e, t, i, s, n, a) {
|
|
1461
|
+
if (n === 0)
|
|
1462
|
+
return !1;
|
|
1463
|
+
const c = a.filter((d) => {
|
|
1464
|
+
const b = d.position.y + d.box.dimensions.height;
|
|
1465
|
+
return Math.abs(b - n) <= 1;
|
|
1466
|
+
});
|
|
1467
|
+
if (c.length === 0)
|
|
1468
|
+
return !0;
|
|
1469
|
+
let l = 1 / 0, p = -1 / 0, h = 1 / 0, g = -1 / 0;
|
|
1470
|
+
for (const d of c) {
|
|
1471
|
+
const b = d.rotation.y === 90 ? d.box.dimensions.depth : d.box.dimensions.width, j = d.rotation.y === 90 ? d.box.dimensions.width : d.box.dimensions.depth;
|
|
1472
|
+
l = Math.min(l, d.position.x), p = Math.max(p, d.position.x + b), h = Math.min(h, d.position.z), g = Math.max(g, d.position.z + j);
|
|
1473
|
+
}
|
|
1474
|
+
const w = e + i, m = t + s, x = 1;
|
|
1475
|
+
return e < l - x || w > p + x || t < h - x || m > g + x;
|
|
1476
|
+
}
|
|
1477
|
+
/**
|
|
1478
|
+
* Scores a rectangle position based on multiple criteria
|
|
1479
|
+
*
|
|
1480
|
+
* Higher score = better position
|
|
1481
|
+
*
|
|
1482
|
+
* @param rect - Free rectangle
|
|
1483
|
+
* @param boxDims - Box dimensions
|
|
1484
|
+
* @param occupiedColumns - Product column tracker
|
|
1485
|
+
* @param product - Product identifier
|
|
1486
|
+
* @returns Score value
|
|
1487
|
+
*/
|
|
1488
|
+
scoreRectangle(e, t, i, s) {
|
|
1489
|
+
let n = 0;
|
|
1490
|
+
const a = `${e.x},${e.z}`;
|
|
1491
|
+
i.get(a) === s && (n += 100), i.has(a) && i.get(a) !== s && (n -= 50);
|
|
1492
|
+
const c = e.width * e.depth - t.width * t.depth;
|
|
1493
|
+
return n += 50 / (1 + c / 1e4), n += 30 / (1 + e.x / 1e3 + e.z / 1e3), n;
|
|
1494
|
+
}
|
|
1495
|
+
/**
|
|
1496
|
+
* Updates free rectangles after placing a box (Maximal Rectangles algorithm)
|
|
1497
|
+
*
|
|
1498
|
+
* @param freeRects - Current free rectangles
|
|
1499
|
+
* @param usedRect - Rectangle being used by the new box
|
|
1500
|
+
* @param boxWidth - Width of placed box
|
|
1501
|
+
* @param boxDepth - Depth of placed box
|
|
1502
|
+
*/
|
|
1503
|
+
updateFreeRectangles(e, t, i, s) {
|
|
1504
|
+
const n = [];
|
|
1505
|
+
for (let a = e.length - 1; a >= 0; a--) {
|
|
1506
|
+
const c = e[a];
|
|
1507
|
+
this.rectanglesIntersect(c, t, i, s) && (e.splice(a, 1), t.x > c.x && n.push({
|
|
1508
|
+
x: c.x,
|
|
1509
|
+
z: c.z,
|
|
1510
|
+
width: t.x - c.x,
|
|
1511
|
+
depth: c.depth
|
|
1512
|
+
}), t.x + i < c.x + c.width && n.push({
|
|
1513
|
+
x: t.x + i,
|
|
1514
|
+
z: c.z,
|
|
1515
|
+
width: c.x + c.width - (t.x + i),
|
|
1516
|
+
depth: c.depth
|
|
1517
|
+
}), t.z > c.z && n.push({
|
|
1518
|
+
x: c.x,
|
|
1519
|
+
z: c.z,
|
|
1520
|
+
width: c.width,
|
|
1521
|
+
depth: t.z - c.z
|
|
1522
|
+
}), t.z + s < c.z + c.depth && n.push({
|
|
1523
|
+
x: c.x,
|
|
1524
|
+
z: t.z + s,
|
|
1525
|
+
width: c.width,
|
|
1526
|
+
depth: c.z + c.depth - (t.z + s)
|
|
1527
|
+
}));
|
|
1528
|
+
}
|
|
1529
|
+
e.push(...n), this.removeContainedRectangles(e);
|
|
1530
|
+
}
|
|
1531
|
+
/**
|
|
1532
|
+
* Checks if two rectangles intersect
|
|
1533
|
+
*/
|
|
1534
|
+
rectanglesIntersect(e, t, i, s) {
|
|
1535
|
+
return !(t.x + i <= e.x || t.x >= e.x + e.width || t.z + s <= e.z || t.z >= e.z + e.depth);
|
|
1536
|
+
}
|
|
1537
|
+
/**
|
|
1538
|
+
* Removes rectangles that are fully contained within other rectangles
|
|
1539
|
+
*/
|
|
1540
|
+
removeContainedRectangles(e) {
|
|
1541
|
+
for (let t = e.length - 1; t >= 0; t--) {
|
|
1542
|
+
const i = e[t];
|
|
1543
|
+
for (let s = 0; s < e.length; s++) {
|
|
1544
|
+
if (t === s) continue;
|
|
1545
|
+
const n = e[s];
|
|
1546
|
+
if (i.x >= n.x && i.z >= n.z && i.x + i.width <= n.x + n.width && i.z + i.depth <= n.z + n.depth) {
|
|
1547
|
+
e.splice(t, 1);
|
|
1548
|
+
break;
|
|
1549
|
+
}
|
|
1550
|
+
}
|
|
1551
|
+
}
|
|
1552
|
+
}
|
|
1553
|
+
/**
|
|
1554
|
+
* Updates the occupied columns map after placing a box
|
|
1555
|
+
*/
|
|
1556
|
+
updateOccupiedColumns(e, t, i, s) {
|
|
1557
|
+
const n = `${t},${i}`;
|
|
1558
|
+
e.has(n) || e.set(n, s);
|
|
1559
|
+
}
|
|
1560
|
+
// ─── Utility Methods ───────────────────────────────────────────────
|
|
1561
|
+
/**
|
|
1562
|
+
* Groups boxes by product identifier
|
|
1563
|
+
*/
|
|
1564
|
+
groupByProduct(e) {
|
|
1565
|
+
const t = /* @__PURE__ */ new Map();
|
|
1566
|
+
for (const i of e) {
|
|
1567
|
+
const s = i.product ?? "default";
|
|
1568
|
+
t.has(s) || t.set(s, []), t.get(s).push(i);
|
|
1569
|
+
}
|
|
1570
|
+
return t;
|
|
1571
|
+
}
|
|
1572
|
+
/**
|
|
1573
|
+
* Creates an empty layer
|
|
1574
|
+
*/
|
|
1575
|
+
emptyLayer(e) {
|
|
1576
|
+
return {
|
|
1577
|
+
y: e,
|
|
1578
|
+
height: 0,
|
|
1579
|
+
placements: [],
|
|
1580
|
+
coverage: 0
|
|
1581
|
+
};
|
|
1582
|
+
}
|
|
1583
|
+
/**
|
|
1584
|
+
* Creates an empty packing result
|
|
1585
|
+
*/
|
|
1586
|
+
emptyResult() {
|
|
1587
|
+
return {
|
|
1588
|
+
placements: [],
|
|
1589
|
+
metrics: {
|
|
1590
|
+
volumeUtilization: 0,
|
|
1591
|
+
weightUtilization: 0,
|
|
1592
|
+
centerOfGravity: { x: 0, y: 0, z: 0 },
|
|
1593
|
+
stabilityScore: 100
|
|
1594
|
+
},
|
|
1595
|
+
unplacedBoxes: []
|
|
1596
|
+
};
|
|
1597
|
+
}
|
|
1598
|
+
/**
|
|
1599
|
+
* Calculates packing metrics
|
|
1600
|
+
*/
|
|
1601
|
+
calculateMetrics(e, t) {
|
|
1602
|
+
const i = t.dimensions.width * t.maxStackHeight * t.dimensions.depth, s = e.reduce((a, c) => {
|
|
1603
|
+
const l = c.box.dimensions;
|
|
1604
|
+
return a + l.width * l.height * l.depth;
|
|
1605
|
+
}, 0), n = e.reduce((a, c) => a + c.box.weight, 0);
|
|
1606
|
+
return {
|
|
1607
|
+
volumeUtilization: i > 0 ? s / i : 0,
|
|
1608
|
+
weightUtilization: t.maxWeight > 0 ? n / t.maxWeight : 0,
|
|
1609
|
+
centerOfGravity: Y(e),
|
|
1610
|
+
stabilityScore: ee(t, e)
|
|
1611
|
+
};
|
|
1612
|
+
}
|
|
1613
|
+
}
|
|
1614
|
+
class pt {
|
|
1093
1615
|
strategies = /* @__PURE__ */ new Map();
|
|
1094
1616
|
constructor() {
|
|
1095
|
-
this.register(new mt()), this.register(new ut()), this.register(new xt());
|
|
1617
|
+
this.register(new mt()), this.register(new ut()), this.register(new xt()), this.register(new gt());
|
|
1096
1618
|
}
|
|
1097
1619
|
register(e) {
|
|
1098
1620
|
this.strategies.set(e.id, e);
|
|
@@ -1113,10 +1635,10 @@ class gt {
|
|
|
1113
1635
|
return this.strategies.has(e);
|
|
1114
1636
|
}
|
|
1115
1637
|
}
|
|
1116
|
-
const ft = new
|
|
1117
|
-
let
|
|
1638
|
+
const ft = new pt();
|
|
1639
|
+
let wt = 0;
|
|
1118
1640
|
function Te() {
|
|
1119
|
-
return `pallet-${++
|
|
1641
|
+
return `pallet-${++wt}`;
|
|
1120
1642
|
}
|
|
1121
1643
|
class Z {
|
|
1122
1644
|
// ═══ Palets estándar internacionales ═══════════════════════════
|
|
@@ -1187,7 +1709,7 @@ class Z {
|
|
|
1187
1709
|
return {
|
|
1188
1710
|
id: Te(),
|
|
1189
1711
|
dimensions: { ...e },
|
|
1190
|
-
material:
|
|
1712
|
+
material: N.WOOD,
|
|
1191
1713
|
maxWeight: 1e3,
|
|
1192
1714
|
maxStackHeight: 2200,
|
|
1193
1715
|
weight: 25,
|
|
@@ -1208,16 +1730,16 @@ class Z {
|
|
|
1208
1730
|
}));
|
|
1209
1731
|
}
|
|
1210
1732
|
}
|
|
1211
|
-
let
|
|
1212
|
-
function
|
|
1213
|
-
return `truck-${++
|
|
1733
|
+
let yt = 0;
|
|
1734
|
+
function _e() {
|
|
1735
|
+
return `truck-${++yt}`;
|
|
1214
1736
|
}
|
|
1215
|
-
class
|
|
1737
|
+
class Vt {
|
|
1216
1738
|
/** Crea un camión a partir de un preset de tipo */
|
|
1217
1739
|
static fromPreset(e, t) {
|
|
1218
1740
|
const i = Ze[e];
|
|
1219
1741
|
return {
|
|
1220
|
-
id:
|
|
1742
|
+
id: _e(),
|
|
1221
1743
|
name: `Camión ${e}`,
|
|
1222
1744
|
truckType: e,
|
|
1223
1745
|
dimensions: { ...i.dimensions },
|
|
@@ -1230,9 +1752,9 @@ class Gt {
|
|
|
1230
1752
|
/** Crea un camión custom con dimensiones y peso arbitrarios */
|
|
1231
1753
|
static custom(e, t, i) {
|
|
1232
1754
|
return {
|
|
1233
|
-
id:
|
|
1755
|
+
id: _e(),
|
|
1234
1756
|
name: "Camión Custom",
|
|
1235
|
-
truckType:
|
|
1757
|
+
truckType: oe.CUSTOM,
|
|
1236
1758
|
dimensions: { ...e },
|
|
1237
1759
|
maxWeight: t,
|
|
1238
1760
|
pallets: [],
|
|
@@ -1241,73 +1763,119 @@ class Gt {
|
|
|
1241
1763
|
};
|
|
1242
1764
|
}
|
|
1243
1765
|
}
|
|
1244
|
-
let
|
|
1245
|
-
function
|
|
1246
|
-
return `box-${++
|
|
1766
|
+
let vt = 0;
|
|
1767
|
+
function bt() {
|
|
1768
|
+
return `box-${++vt}`;
|
|
1247
1769
|
}
|
|
1248
1770
|
class ge {
|
|
1249
|
-
/**
|
|
1771
|
+
/**
|
|
1772
|
+
* Creates a box with default values
|
|
1773
|
+
*
|
|
1774
|
+
* @param dims - Box dimensions in millimeters
|
|
1775
|
+
* @param opts - Optional overrides for any Box property
|
|
1776
|
+
* @returns A new Box instance with defaults applied
|
|
1777
|
+
*
|
|
1778
|
+
* @example
|
|
1779
|
+
* const box = BoxFactory.create(
|
|
1780
|
+
* { width: 600, height: 400, depth: 400 },
|
|
1781
|
+
* { product: 'PROD-A', materialWeight: 6 }
|
|
1782
|
+
* )
|
|
1783
|
+
*/
|
|
1250
1784
|
static create(e, t) {
|
|
1251
1785
|
return {
|
|
1252
|
-
id:
|
|
1786
|
+
id: bt(),
|
|
1253
1787
|
dimensions: { ...e },
|
|
1254
1788
|
weight: 5,
|
|
1789
|
+
materialWeight: 5,
|
|
1790
|
+
// Default: medium resistance
|
|
1255
1791
|
fragile: !1,
|
|
1256
1792
|
stackable: !0,
|
|
1257
1793
|
metadata: {},
|
|
1258
1794
|
...t
|
|
1259
1795
|
};
|
|
1260
1796
|
}
|
|
1261
|
-
/**
|
|
1797
|
+
/**
|
|
1798
|
+
* Creates a fragile box with maximum weight limit
|
|
1799
|
+
*
|
|
1800
|
+
* @param dims - Box dimensions in millimeters
|
|
1801
|
+
* @param fragilityMaxWeight - Maximum weight (kg) this box can support on top
|
|
1802
|
+
* @param opts - Optional overrides
|
|
1803
|
+
* @returns A fragile Box instance
|
|
1804
|
+
*
|
|
1805
|
+
* @example
|
|
1806
|
+
* const fragileBox = BoxFactory.fragile(
|
|
1807
|
+
* { width: 400, height: 300, depth: 300 },
|
|
1808
|
+
* 10, // Can support max 10kg on top
|
|
1809
|
+
* { materialWeight: 0, product: 'PROD-FRAGILE' }
|
|
1810
|
+
* )
|
|
1811
|
+
*/
|
|
1262
1812
|
static fragile(e, t, i) {
|
|
1263
1813
|
return ge.create(e, {
|
|
1264
1814
|
fragile: !0,
|
|
1265
1815
|
fragilityMaxWeight: t,
|
|
1816
|
+
materialWeight: 0,
|
|
1817
|
+
// Fragile boxes go on top
|
|
1266
1818
|
...i
|
|
1267
1819
|
});
|
|
1268
1820
|
}
|
|
1269
|
-
/**
|
|
1821
|
+
/**
|
|
1822
|
+
* Creates a heavy, non-stackable box
|
|
1823
|
+
*
|
|
1824
|
+
* @param dims - Box dimensions in millimeters
|
|
1825
|
+
* @param weight - Box weight in kilograms
|
|
1826
|
+
* @param opts - Optional overrides
|
|
1827
|
+
* @returns A heavy Box instance
|
|
1828
|
+
*
|
|
1829
|
+
* @example
|
|
1830
|
+
* const heavyBox = BoxFactory.heavy(
|
|
1831
|
+
* { width: 800, height: 600, depth: 600 },
|
|
1832
|
+
* 50, // 50kg
|
|
1833
|
+
* { materialWeight: 8, product: 'PROD-HEAVY' }
|
|
1834
|
+
* )
|
|
1835
|
+
*/
|
|
1270
1836
|
static heavy(e, t, i) {
|
|
1271
1837
|
return ge.create(e, {
|
|
1272
1838
|
weight: t,
|
|
1273
1839
|
stackable: !1,
|
|
1840
|
+
materialWeight: 8,
|
|
1841
|
+
// Heavy boxes have high resistance
|
|
1274
1842
|
...i
|
|
1275
1843
|
});
|
|
1276
1844
|
}
|
|
1277
1845
|
}
|
|
1278
|
-
function
|
|
1846
|
+
function Xt(o, e) {
|
|
1279
1847
|
return k(() => {
|
|
1280
|
-
const t = Je(o), i = et(o, e),
|
|
1848
|
+
const t = Je(o), i = et(o, e), n = it({ pallet: e, boxes: o }), a = ct(o), c = rt(o), l = at(o), p = dt(e, o), h = lt(e, o), g = ot(o), w = nt(e, o), m = [...c.violations, ...l.violations], x = [...p.violations, ...h.violations], u = [
|
|
1281
1849
|
...t.violations,
|
|
1282
1850
|
...i.violations,
|
|
1283
|
-
...
|
|
1851
|
+
...n.violations,
|
|
1284
1852
|
...a.violations,
|
|
1285
|
-
...
|
|
1286
|
-
...
|
|
1287
|
-
...
|
|
1288
|
-
...
|
|
1853
|
+
...m,
|
|
1854
|
+
...x,
|
|
1855
|
+
...g.violations,
|
|
1856
|
+
...w.violations
|
|
1289
1857
|
];
|
|
1290
1858
|
return {
|
|
1291
|
-
isValid:
|
|
1292
|
-
violations:
|
|
1859
|
+
isValid: u.filter((d) => d.severity === "error").length === 0,
|
|
1860
|
+
violations: u,
|
|
1293
1861
|
collisions: t,
|
|
1294
1862
|
bounds: i,
|
|
1295
|
-
weight:
|
|
1863
|
+
weight: n,
|
|
1296
1864
|
gravity: a,
|
|
1297
1865
|
stacking: {
|
|
1298
|
-
isValid:
|
|
1299
|
-
violations:
|
|
1866
|
+
isValid: c.isValid,
|
|
1867
|
+
violations: m
|
|
1300
1868
|
},
|
|
1301
1869
|
stability: {
|
|
1302
|
-
isValid:
|
|
1303
|
-
violations:
|
|
1870
|
+
isValid: p.isValid && h.isValid,
|
|
1871
|
+
violations: x
|
|
1304
1872
|
},
|
|
1305
|
-
fragile:
|
|
1306
|
-
distribution:
|
|
1873
|
+
fragile: g,
|
|
1874
|
+
distribution: w
|
|
1307
1875
|
};
|
|
1308
1876
|
}, [o, e]);
|
|
1309
1877
|
}
|
|
1310
|
-
function
|
|
1878
|
+
function Zt(o) {
|
|
1311
1879
|
return k(() => {
|
|
1312
1880
|
if (!o || o.floors.length === 0)
|
|
1313
1881
|
return {
|
|
@@ -1320,28 +1888,28 @@ function Xt(o) {
|
|
|
1320
1888
|
boxCount: 0,
|
|
1321
1889
|
floorCount: 0
|
|
1322
1890
|
};
|
|
1323
|
-
const e = le(o), t =
|
|
1324
|
-
const
|
|
1325
|
-
return
|
|
1326
|
-
}, 0),
|
|
1891
|
+
const e = le(o), t = ye(o), i = o.floors[0].pallet, s = o.floors.flatMap((g) => g.boxes), n = s.length, a = o.floors.length, c = i.dimensions.width * i.maxStackHeight * i.dimensions.depth, l = s.reduce((g, w) => {
|
|
1892
|
+
const m = w.box.dimensions;
|
|
1893
|
+
return g + m.width * m.height * m.depth;
|
|
1894
|
+
}, 0), p = Y(s), h = ee(i, s);
|
|
1327
1895
|
return {
|
|
1328
|
-
volumeUtilization:
|
|
1896
|
+
volumeUtilization: c > 0 ? l / c : 0,
|
|
1329
1897
|
weightUtilization: i.maxWeight > 0 ? t / i.maxWeight : 0,
|
|
1330
|
-
centerOfGravity:
|
|
1331
|
-
stabilityScore:
|
|
1898
|
+
centerOfGravity: p,
|
|
1899
|
+
stabilityScore: h,
|
|
1332
1900
|
totalHeight: e,
|
|
1333
1901
|
totalWeight: t,
|
|
1334
|
-
boxCount:
|
|
1902
|
+
boxCount: n,
|
|
1335
1903
|
floorCount: a
|
|
1336
1904
|
};
|
|
1337
1905
|
}, [o]);
|
|
1338
1906
|
}
|
|
1339
|
-
function
|
|
1907
|
+
function Dt(o, e = ft) {
|
|
1340
1908
|
const t = k(
|
|
1341
|
-
() => e.list().map((
|
|
1909
|
+
() => e.list().map((s) => ({ id: s.id, name: s.name })),
|
|
1342
1910
|
[e]
|
|
1343
|
-
), i =
|
|
1344
|
-
(
|
|
1911
|
+
), i = q(
|
|
1912
|
+
(s, n) => e.get(o).pack(s, n),
|
|
1345
1913
|
[o, e]
|
|
1346
1914
|
);
|
|
1347
1915
|
return { availableStrategies: t, pack: i };
|
|
@@ -1349,16 +1917,16 @@ function Zt(o, e = ft) {
|
|
|
1349
1917
|
function Nt(o) {
|
|
1350
1918
|
return k(() => {
|
|
1351
1919
|
const e = [];
|
|
1352
|
-
for (const
|
|
1353
|
-
const
|
|
1354
|
-
e.push(...
|
|
1920
|
+
for (const s of o.pallets) {
|
|
1921
|
+
const n = We(s, o);
|
|
1922
|
+
e.push(...n.violations);
|
|
1355
1923
|
}
|
|
1356
1924
|
const t = Qe(o.pallets), i = [
|
|
1357
1925
|
...e,
|
|
1358
1926
|
...t.violations
|
|
1359
1927
|
];
|
|
1360
1928
|
return {
|
|
1361
|
-
isValid: i.filter((
|
|
1929
|
+
isValid: i.filter((s) => s.severity === "error").length === 0,
|
|
1362
1930
|
violations: i,
|
|
1363
1931
|
palletInRoom: {
|
|
1364
1932
|
isValid: e.length === 0,
|
|
@@ -1368,76 +1936,87 @@ function Nt(o) {
|
|
|
1368
1936
|
};
|
|
1369
1937
|
}, [o]);
|
|
1370
1938
|
}
|
|
1371
|
-
const
|
|
1939
|
+
const St = V(function({
|
|
1372
1940
|
placedBox: e,
|
|
1373
1941
|
selected: t = !1,
|
|
1374
1942
|
highlighted: i = !1,
|
|
1375
|
-
showLabel:
|
|
1376
|
-
color:
|
|
1943
|
+
showLabel: s = !1,
|
|
1944
|
+
color: n,
|
|
1377
1945
|
opacity: a,
|
|
1378
|
-
selectedColor:
|
|
1379
|
-
highlightedColor:
|
|
1380
|
-
onClick:
|
|
1381
|
-
onHover:
|
|
1946
|
+
selectedColor: c,
|
|
1947
|
+
highlightedColor: l,
|
|
1948
|
+
onClick: p,
|
|
1949
|
+
onHover: h
|
|
1382
1950
|
}) {
|
|
1383
|
-
const
|
|
1384
|
-
let
|
|
1385
|
-
(
|
|
1951
|
+
const g = Ee(null), w = ce(), { box: m, position: x, rotation: u } = e, d = U.MM_TO_M, b = n ?? m.color ?? w.box.color, j = a ?? w.box.opacity, _ = c ?? w.selection.selectedColor, S = l ?? w.selection.highlightedColor;
|
|
1952
|
+
let C = m.dimensions.width, z = m.dimensions.depth;
|
|
1953
|
+
(u.y === 90 || u.y === 270) && ([C, z] = [z, C]);
|
|
1386
1954
|
const y = k(
|
|
1387
|
-
() => [
|
|
1388
|
-
[
|
|
1389
|
-
),
|
|
1390
|
-
() => new
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1955
|
+
() => [C * d, m.dimensions.height * d, z * d],
|
|
1956
|
+
[C, z, m.dimensions.height, d]
|
|
1957
|
+
), v = k(
|
|
1958
|
+
() => new B.Vector3(
|
|
1959
|
+
x.x * d + y[0] / 2,
|
|
1960
|
+
x.y * d + y[1] / 2,
|
|
1961
|
+
x.z * d + y[2] / 2
|
|
1394
1962
|
),
|
|
1395
|
-
[
|
|
1396
|
-
),
|
|
1397
|
-
(
|
|
1398
|
-
|
|
1963
|
+
[x, y, d]
|
|
1964
|
+
), M = t ? _ : i ? S : null, E = q(
|
|
1965
|
+
(R) => {
|
|
1966
|
+
R.stopPropagation(), p?.(e.id);
|
|
1399
1967
|
},
|
|
1400
|
-
[
|
|
1401
|
-
),
|
|
1402
|
-
(
|
|
1403
|
-
|
|
1968
|
+
[p, e.id]
|
|
1969
|
+
), T = q(
|
|
1970
|
+
(R) => {
|
|
1971
|
+
R.stopPropagation(), h?.(e.id);
|
|
1404
1972
|
},
|
|
1405
|
-
[
|
|
1406
|
-
),
|
|
1407
|
-
|
|
1408
|
-
}, [
|
|
1409
|
-
return /* @__PURE__ */
|
|
1410
|
-
/* @__PURE__ */
|
|
1973
|
+
[h, e.id]
|
|
1974
|
+
), I = q(() => {
|
|
1975
|
+
h?.(null);
|
|
1976
|
+
}, [h]);
|
|
1977
|
+
return /* @__PURE__ */ r.jsxs("group", { children: [
|
|
1978
|
+
/* @__PURE__ */ r.jsxs(
|
|
1411
1979
|
"mesh",
|
|
1412
1980
|
{
|
|
1413
|
-
ref:
|
|
1414
|
-
position:
|
|
1981
|
+
ref: g,
|
|
1982
|
+
position: v,
|
|
1415
1983
|
onClick: E,
|
|
1416
|
-
onPointerOver:
|
|
1417
|
-
onPointerOut:
|
|
1984
|
+
onPointerOver: T,
|
|
1985
|
+
onPointerOut: I,
|
|
1418
1986
|
castShadow: !0,
|
|
1419
1987
|
receiveShadow: !0,
|
|
1420
1988
|
children: [
|
|
1421
|
-
/* @__PURE__ */
|
|
1422
|
-
/* @__PURE__ */
|
|
1989
|
+
/* @__PURE__ */ r.jsx("boxGeometry", { args: y }),
|
|
1990
|
+
/* @__PURE__ */ r.jsx(
|
|
1423
1991
|
"meshStandardMaterial",
|
|
1424
1992
|
{
|
|
1425
|
-
color:
|
|
1426
|
-
transparent:
|
|
1427
|
-
opacity:
|
|
1428
|
-
roughness:
|
|
1429
|
-
metalness:
|
|
1993
|
+
color: b,
|
|
1994
|
+
transparent: j < 1,
|
|
1995
|
+
opacity: j,
|
|
1996
|
+
roughness: w.box.roughness,
|
|
1997
|
+
metalness: w.box.metalness
|
|
1430
1998
|
}
|
|
1431
1999
|
)
|
|
1432
2000
|
]
|
|
1433
2001
|
}
|
|
1434
2002
|
),
|
|
1435
|
-
|
|
1436
|
-
/* @__PURE__ */
|
|
1437
|
-
/* @__PURE__ */
|
|
2003
|
+
/* @__PURE__ */ r.jsxs("lineSegments", { position: v, children: [
|
|
2004
|
+
/* @__PURE__ */ r.jsx("edgesGeometry", { args: [new B.BoxGeometry(...y)] }),
|
|
2005
|
+
/* @__PURE__ */ r.jsx(
|
|
2006
|
+
"lineBasicMaterial",
|
|
2007
|
+
{
|
|
2008
|
+
color: M ?? "#000000",
|
|
2009
|
+
opacity: M ? 1 : 0.4,
|
|
2010
|
+
transparent: !0
|
|
2011
|
+
}
|
|
2012
|
+
)
|
|
2013
|
+
] }),
|
|
2014
|
+
M && /* @__PURE__ */ r.jsxs("mesh", { position: v, children: [
|
|
2015
|
+
/* @__PURE__ */ r.jsx("boxGeometry", { args: y }),
|
|
2016
|
+
/* @__PURE__ */ r.jsx(
|
|
1438
2017
|
"meshBasicMaterial",
|
|
1439
2018
|
{
|
|
1440
|
-
color:
|
|
2019
|
+
color: M,
|
|
1441
2020
|
wireframe: !0,
|
|
1442
2021
|
wireframeLinewidth: 1,
|
|
1443
2022
|
transparent: !0,
|
|
@@ -1446,14 +2025,10 @@ const bt = V(function({
|
|
|
1446
2025
|
}
|
|
1447
2026
|
)
|
|
1448
2027
|
] }),
|
|
1449
|
-
|
|
1450
|
-
/* @__PURE__ */ s.jsx("edgesGeometry", { args: [new $.BoxGeometry(...y)] }),
|
|
1451
|
-
/* @__PURE__ */ s.jsx("lineBasicMaterial", { color: S })
|
|
1452
|
-
] }),
|
|
1453
|
-
n && /* @__PURE__ */ s.jsx(
|
|
2028
|
+
s && /* @__PURE__ */ r.jsx(
|
|
1454
2029
|
ke,
|
|
1455
2030
|
{
|
|
1456
|
-
position: [
|
|
2031
|
+
position: [v.x, v.y + y[1] / 2 + 0.05, v.z],
|
|
1457
2032
|
center: !0,
|
|
1458
2033
|
style: {
|
|
1459
2034
|
background: "rgba(0,0,0,0.75)",
|
|
@@ -1464,7 +2039,7 @@ const bt = V(function({
|
|
|
1464
2039
|
whiteSpace: "nowrap",
|
|
1465
2040
|
pointerEvents: "none"
|
|
1466
2041
|
},
|
|
1467
|
-
children:
|
|
2042
|
+
children: m.sku ?? m.type ?? m.id
|
|
1468
2043
|
}
|
|
1469
2044
|
)
|
|
1470
2045
|
] });
|
|
@@ -1472,54 +2047,54 @@ const bt = V(function({
|
|
|
1472
2047
|
pallet: e,
|
|
1473
2048
|
position: t = { x: 0, y: 0, z: 0 },
|
|
1474
2049
|
color: i,
|
|
1475
|
-
edgeColor:
|
|
2050
|
+
edgeColor: s
|
|
1476
2051
|
}) {
|
|
1477
|
-
const
|
|
1478
|
-
() => [
|
|
1479
|
-
[
|
|
1480
|
-
),
|
|
1481
|
-
() => new
|
|
1482
|
-
t.x *
|
|
1483
|
-
t.y *
|
|
1484
|
-
t.z *
|
|
2052
|
+
const n = ce(), a = i ?? n.pallet.color, c = s ?? n.pallet.edgeColor, l = U.MM_TO_M, p = e.dimensions, h = k(
|
|
2053
|
+
() => [p.width * l, p.height * l, p.depth * l],
|
|
2054
|
+
[p, l]
|
|
2055
|
+
), g = k(
|
|
2056
|
+
() => new B.Vector3(
|
|
2057
|
+
t.x * l + h[0] / 2,
|
|
2058
|
+
t.y * l + h[1] / 2,
|
|
2059
|
+
t.z * l + h[2] / 2
|
|
1485
2060
|
),
|
|
1486
|
-
[t,
|
|
2061
|
+
[t, h, l]
|
|
1487
2062
|
);
|
|
1488
|
-
return /* @__PURE__ */
|
|
1489
|
-
/* @__PURE__ */
|
|
1490
|
-
/* @__PURE__ */
|
|
1491
|
-
/* @__PURE__ */
|
|
2063
|
+
return /* @__PURE__ */ r.jsxs("group", { children: [
|
|
2064
|
+
/* @__PURE__ */ r.jsxs("mesh", { position: g, castShadow: !0, receiveShadow: !0, children: [
|
|
2065
|
+
/* @__PURE__ */ r.jsx("boxGeometry", { args: h }),
|
|
2066
|
+
/* @__PURE__ */ r.jsx("meshStandardMaterial", { color: a, roughness: n.pallet.roughness, metalness: n.pallet.metalness })
|
|
1492
2067
|
] }),
|
|
1493
|
-
/* @__PURE__ */
|
|
1494
|
-
/* @__PURE__ */
|
|
1495
|
-
/* @__PURE__ */
|
|
2068
|
+
/* @__PURE__ */ r.jsxs("lineSegments", { position: g, children: [
|
|
2069
|
+
/* @__PURE__ */ r.jsx("edgesGeometry", { args: [new B.BoxGeometry(...h)] }),
|
|
2070
|
+
/* @__PURE__ */ r.jsx("lineBasicMaterial", { color: c })
|
|
1496
2071
|
] })
|
|
1497
2072
|
] });
|
|
1498
|
-
}),
|
|
2073
|
+
}), Mt = {
|
|
1499
2074
|
[me.CARDBOARD]: "#b5926b",
|
|
1500
2075
|
[me.WOOD]: "#c4a26e",
|
|
1501
2076
|
[me.PLASTIC]: "#90a4ae"
|
|
1502
|
-
},
|
|
2077
|
+
}, zt = V(function({
|
|
1503
2078
|
separator: e,
|
|
1504
2079
|
position: t = { x: 0, y: 0, z: 0 }
|
|
1505
2080
|
}) {
|
|
1506
|
-
const i =
|
|
1507
|
-
() => [
|
|
1508
|
-
[
|
|
2081
|
+
const i = U.MM_TO_M, s = e.dimensions, n = k(
|
|
2082
|
+
() => [s.width * i, s.height * i, s.depth * i],
|
|
2083
|
+
[s, i]
|
|
1509
2084
|
), a = k(
|
|
1510
|
-
() => new
|
|
1511
|
-
t.x * i +
|
|
1512
|
-
t.y * i +
|
|
1513
|
-
t.z * i +
|
|
2085
|
+
() => new B.Vector3(
|
|
2086
|
+
t.x * i + n[0] / 2,
|
|
2087
|
+
t.y * i + n[1] / 2,
|
|
2088
|
+
t.z * i + n[2] / 2
|
|
1514
2089
|
),
|
|
1515
|
-
[t,
|
|
1516
|
-
),
|
|
1517
|
-
return /* @__PURE__ */
|
|
1518
|
-
/* @__PURE__ */
|
|
1519
|
-
/* @__PURE__ */
|
|
2090
|
+
[t, n, i]
|
|
2091
|
+
), c = Mt[e.material];
|
|
2092
|
+
return /* @__PURE__ */ r.jsxs("mesh", { position: a, receiveShadow: !0, children: [
|
|
2093
|
+
/* @__PURE__ */ r.jsx("boxGeometry", { args: n }),
|
|
2094
|
+
/* @__PURE__ */ r.jsx(
|
|
1520
2095
|
"meshStandardMaterial",
|
|
1521
2096
|
{
|
|
1522
|
-
color:
|
|
2097
|
+
color: c,
|
|
1523
2098
|
roughness: 0.9,
|
|
1524
2099
|
metalness: 0,
|
|
1525
2100
|
transparent: !0,
|
|
@@ -1532,107 +2107,107 @@ const bt = V(function({
|
|
|
1532
2107
|
stackedPallet: e,
|
|
1533
2108
|
position: t = { x: 0, y: 0, z: 0 },
|
|
1534
2109
|
yRotation: i = 0,
|
|
1535
|
-
palletId:
|
|
1536
|
-
selectedBoxId:
|
|
2110
|
+
palletId: s,
|
|
2111
|
+
selectedBoxId: n,
|
|
1537
2112
|
highlightedBoxId: a,
|
|
1538
|
-
selectedColor:
|
|
1539
|
-
highlightedColor:
|
|
1540
|
-
showLabels:
|
|
1541
|
-
onBoxClick:
|
|
1542
|
-
onBoxHover:
|
|
2113
|
+
selectedColor: c,
|
|
2114
|
+
highlightedColor: l,
|
|
2115
|
+
showLabels: p = !1,
|
|
2116
|
+
onBoxClick: h,
|
|
2117
|
+
onBoxHover: g
|
|
1543
2118
|
}) {
|
|
1544
|
-
const
|
|
1545
|
-
() => qe(e,
|
|
1546
|
-
[e,
|
|
1547
|
-
),
|
|
1548
|
-
const
|
|
1549
|
-
let
|
|
1550
|
-
for (const
|
|
1551
|
-
|
|
1552
|
-
const
|
|
1553
|
-
(
|
|
2119
|
+
const w = k(
|
|
2120
|
+
() => qe(e, s),
|
|
2121
|
+
[e, s]
|
|
2122
|
+
), m = U.MM_TO_M, x = k(() => i * Math.PI / 180, [i]), u = k(() => {
|
|
2123
|
+
const d = [];
|
|
2124
|
+
let b = 0;
|
|
2125
|
+
for (const j of w.floors) {
|
|
2126
|
+
d.push(b), b += j.pallet.dimensions.height;
|
|
2127
|
+
const _ = j.boxes.reduce(
|
|
2128
|
+
(S, C) => Math.max(S, C.position.y + C.box.dimensions.height),
|
|
1554
2129
|
0
|
|
1555
2130
|
);
|
|
1556
|
-
|
|
2131
|
+
b += _, j.separatorAbove && (b += j.separatorAbove.dimensions.height);
|
|
1557
2132
|
}
|
|
1558
|
-
return
|
|
1559
|
-
}, [
|
|
1560
|
-
return /* @__PURE__ */
|
|
2133
|
+
return d;
|
|
2134
|
+
}, [w]);
|
|
2135
|
+
return /* @__PURE__ */ r.jsx(
|
|
1561
2136
|
"group",
|
|
1562
2137
|
{
|
|
1563
|
-
position: [t.x *
|
|
1564
|
-
rotation: [0,
|
|
1565
|
-
children:
|
|
1566
|
-
const
|
|
1567
|
-
return /* @__PURE__ */
|
|
1568
|
-
/* @__PURE__ */
|
|
2138
|
+
position: [t.x * m, t.y * m, t.z * m],
|
|
2139
|
+
rotation: [0, x, 0],
|
|
2140
|
+
children: w.floors.map((d, b) => {
|
|
2141
|
+
const j = u[b], _ = j + d.pallet.dimensions.height;
|
|
2142
|
+
return /* @__PURE__ */ r.jsxs("group", { children: [
|
|
2143
|
+
/* @__PURE__ */ r.jsx(
|
|
1569
2144
|
jt,
|
|
1570
2145
|
{
|
|
1571
|
-
pallet:
|
|
1572
|
-
position: { x: 0, y:
|
|
2146
|
+
pallet: d.pallet,
|
|
2147
|
+
position: { x: 0, y: j, z: 0 }
|
|
1573
2148
|
}
|
|
1574
2149
|
),
|
|
1575
|
-
|
|
1576
|
-
|
|
2150
|
+
d.boxes.map((S) => /* @__PURE__ */ r.jsx(
|
|
2151
|
+
St,
|
|
1577
2152
|
{
|
|
1578
2153
|
placedBox: {
|
|
1579
|
-
...
|
|
2154
|
+
...S,
|
|
1580
2155
|
position: {
|
|
1581
|
-
x:
|
|
1582
|
-
y:
|
|
1583
|
-
z:
|
|
2156
|
+
x: S.position.x,
|
|
2157
|
+
y: S.position.y + _,
|
|
2158
|
+
z: S.position.z
|
|
1584
2159
|
}
|
|
1585
2160
|
},
|
|
1586
|
-
selected:
|
|
1587
|
-
highlighted: a ===
|
|
1588
|
-
selectedColor:
|
|
1589
|
-
highlightedColor:
|
|
1590
|
-
showLabel:
|
|
1591
|
-
onClick:
|
|
1592
|
-
onHover:
|
|
2161
|
+
selected: n === S.id,
|
|
2162
|
+
highlighted: a === S.id,
|
|
2163
|
+
selectedColor: c,
|
|
2164
|
+
highlightedColor: l,
|
|
2165
|
+
showLabel: p,
|
|
2166
|
+
onClick: h,
|
|
2167
|
+
onHover: g
|
|
1593
2168
|
},
|
|
1594
|
-
|
|
2169
|
+
S.id
|
|
1595
2170
|
)),
|
|
1596
|
-
|
|
1597
|
-
|
|
2171
|
+
d.separatorAbove && /* @__PURE__ */ r.jsx(
|
|
2172
|
+
zt,
|
|
1598
2173
|
{
|
|
1599
|
-
separator:
|
|
2174
|
+
separator: d.separatorAbove,
|
|
1600
2175
|
position: {
|
|
1601
2176
|
x: 0,
|
|
1602
|
-
y:
|
|
1603
|
-
(
|
|
2177
|
+
y: _ + d.boxes.reduce(
|
|
2178
|
+
(S, C) => Math.max(S, C.position.y + C.box.dimensions.height),
|
|
1604
2179
|
0
|
|
1605
2180
|
),
|
|
1606
2181
|
z: 0
|
|
1607
2182
|
}
|
|
1608
2183
|
}
|
|
1609
2184
|
)
|
|
1610
|
-
] }, `floor-${
|
|
2185
|
+
] }, `floor-${b}`);
|
|
1611
2186
|
})
|
|
1612
2187
|
}
|
|
1613
2188
|
);
|
|
1614
2189
|
}
|
|
1615
|
-
),
|
|
2190
|
+
), Ut = V(function({
|
|
1616
2191
|
text: e,
|
|
1617
2192
|
position: t,
|
|
1618
2193
|
visible: i = !0,
|
|
1619
|
-
fontSize:
|
|
1620
|
-
color:
|
|
2194
|
+
fontSize: s = 12,
|
|
2195
|
+
color: n = "white",
|
|
1621
2196
|
background: a = "rgba(0,0,0,0.75)"
|
|
1622
2197
|
}) {
|
|
1623
2198
|
if (!i) return null;
|
|
1624
|
-
const
|
|
1625
|
-
return /* @__PURE__ */
|
|
2199
|
+
const c = U.MM_TO_M;
|
|
2200
|
+
return /* @__PURE__ */ r.jsx(
|
|
1626
2201
|
ke,
|
|
1627
2202
|
{
|
|
1628
|
-
position: [t.x *
|
|
2203
|
+
position: [t.x * c, t.y * c, t.z * c],
|
|
1629
2204
|
center: !0,
|
|
1630
2205
|
style: {
|
|
1631
2206
|
background: a,
|
|
1632
|
-
color:
|
|
2207
|
+
color: n,
|
|
1633
2208
|
padding: "2px 8px",
|
|
1634
2209
|
borderRadius: "4px",
|
|
1635
|
-
fontSize: `${
|
|
2210
|
+
fontSize: `${s}px`,
|
|
1636
2211
|
whiteSpace: "nowrap",
|
|
1637
2212
|
pointerEvents: "none",
|
|
1638
2213
|
userSelect: "none"
|
|
@@ -1640,42 +2215,42 @@ const bt = V(function({
|
|
|
1640
2215
|
children: e
|
|
1641
2216
|
}
|
|
1642
2217
|
);
|
|
1643
|
-
}),
|
|
2218
|
+
}), Ct = V(
|
|
1644
2219
|
function({
|
|
1645
2220
|
room: e,
|
|
1646
2221
|
floorColor: t,
|
|
1647
2222
|
wallColor: i,
|
|
1648
|
-
showGrid:
|
|
1649
|
-
children:
|
|
2223
|
+
showGrid: s,
|
|
2224
|
+
children: n
|
|
1650
2225
|
}) {
|
|
1651
|
-
const a = ce(),
|
|
2226
|
+
const a = ce(), c = t ?? a.warehouse.floorColor, l = i ?? a.warehouse.wallColor, p = s ?? a.warehouse.showGrid, h = U.MM_TO_M, g = e.ceilingHeight * h, { shape: w, minX: m, maxX: x, minZ: u, maxZ: d } = k(() => {
|
|
1652
2227
|
const y = e.floorPolygon;
|
|
1653
|
-
let
|
|
1654
|
-
for (const
|
|
1655
|
-
|
|
1656
|
-
const
|
|
1657
|
-
|
|
1658
|
-
for (let
|
|
1659
|
-
|
|
1660
|
-
return
|
|
1661
|
-
}, [e.floorPolygon,
|
|
1662
|
-
const y = e.floorPolygon,
|
|
1663
|
-
for (let
|
|
1664
|
-
const
|
|
1665
|
-
|
|
1666
|
-
|
|
2228
|
+
let v = 1 / 0, M = -1 / 0, E = 1 / 0, T = -1 / 0;
|
|
2229
|
+
for (const R of y)
|
|
2230
|
+
v = Math.min(v, R.x * h), M = Math.max(M, R.x * h), E = Math.min(E, R.z * h), T = Math.max(T, R.z * h);
|
|
2231
|
+
const I = new B.Shape();
|
|
2232
|
+
I.moveTo(y[0].x * h, -y[0].z * h);
|
|
2233
|
+
for (let R = 1; R < y.length; R++)
|
|
2234
|
+
I.lineTo(y[R].x * h, -y[R].z * h);
|
|
2235
|
+
return I.closePath(), { shape: I, minX: v, maxX: M, minZ: E, maxZ: T };
|
|
2236
|
+
}, [e.floorPolygon, h]), b = k(() => {
|
|
2237
|
+
const y = e.floorPolygon, v = [], M = [];
|
|
2238
|
+
for (let T = 0; T < y.length; T++) {
|
|
2239
|
+
const I = y[T], R = y[(T + 1) % y.length], A = T * 4;
|
|
2240
|
+
v.push(
|
|
2241
|
+
I.x * h,
|
|
1667
2242
|
0,
|
|
1668
|
-
|
|
1669
|
-
|
|
2243
|
+
I.z * h,
|
|
2244
|
+
R.x * h,
|
|
1670
2245
|
0,
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
),
|
|
2246
|
+
R.z * h,
|
|
2247
|
+
R.x * h,
|
|
2248
|
+
g,
|
|
2249
|
+
R.z * h,
|
|
2250
|
+
I.x * h,
|
|
2251
|
+
g,
|
|
2252
|
+
I.z * h
|
|
2253
|
+
), M.push(
|
|
1679
2254
|
A,
|
|
1680
2255
|
A + 1,
|
|
1681
2256
|
A + 2,
|
|
@@ -1684,41 +2259,41 @@ const bt = V(function({
|
|
|
1684
2259
|
A + 3
|
|
1685
2260
|
);
|
|
1686
2261
|
}
|
|
1687
|
-
const E = new
|
|
1688
|
-
return E.setAttribute("position", new
|
|
1689
|
-
}, [e.floorPolygon,
|
|
1690
|
-
if (!
|
|
1691
|
-
const y = 0.5,
|
|
1692
|
-
for (let
|
|
1693
|
-
|
|
1694
|
-
for (let
|
|
1695
|
-
|
|
1696
|
-
const E = new
|
|
1697
|
-
return E.setAttribute("position", new
|
|
1698
|
-
}, [
|
|
1699
|
-
return /* @__PURE__ */
|
|
1700
|
-
/* @__PURE__ */
|
|
1701
|
-
/* @__PURE__ */
|
|
1702
|
-
/* @__PURE__ */
|
|
2262
|
+
const E = new B.BufferGeometry();
|
|
2263
|
+
return E.setAttribute("position", new B.Float32BufferAttribute(v, 3)), E.setIndex(M), E.computeVertexNormals(), E;
|
|
2264
|
+
}, [e.floorPolygon, g, h]), j = x - m, _ = d - u, S = (m + x) / 2, C = (u + d) / 2, z = k(() => {
|
|
2265
|
+
if (!p) return null;
|
|
2266
|
+
const y = 0.5, v = 0.01, M = [];
|
|
2267
|
+
for (let T = m; T <= x; T += y)
|
|
2268
|
+
M.push(T, v, u, T, v, d);
|
|
2269
|
+
for (let T = u; T <= d; T += y)
|
|
2270
|
+
M.push(m, v, T, x, v, T);
|
|
2271
|
+
const E = new B.BufferGeometry();
|
|
2272
|
+
return E.setAttribute("position", new B.Float32BufferAttribute(M, 3)), E;
|
|
2273
|
+
}, [p, m, x, u, d]);
|
|
2274
|
+
return /* @__PURE__ */ r.jsxs("group", { children: [
|
|
2275
|
+
/* @__PURE__ */ r.jsxs("mesh", { rotation: [-Math.PI / 2, 0, 0], position: [0, -5e-3, 0], receiveShadow: !0, children: [
|
|
2276
|
+
/* @__PURE__ */ r.jsx("shapeGeometry", { args: [w] }),
|
|
2277
|
+
/* @__PURE__ */ r.jsx(
|
|
1703
2278
|
"meshStandardMaterial",
|
|
1704
2279
|
{
|
|
1705
|
-
color:
|
|
1706
|
-
side:
|
|
2280
|
+
color: c,
|
|
2281
|
+
side: B.DoubleSide,
|
|
1707
2282
|
roughness: a.warehouse.floorRoughness
|
|
1708
2283
|
}
|
|
1709
2284
|
)
|
|
1710
2285
|
] }),
|
|
1711
|
-
/* @__PURE__ */
|
|
2286
|
+
/* @__PURE__ */ r.jsx("mesh", { geometry: b, position: [0, 0, 0], receiveShadow: !0, children: /* @__PURE__ */ r.jsx(
|
|
1712
2287
|
"meshStandardMaterial",
|
|
1713
2288
|
{
|
|
1714
|
-
color:
|
|
1715
|
-
side:
|
|
2289
|
+
color: l,
|
|
2290
|
+
side: B.DoubleSide,
|
|
1716
2291
|
roughness: 0.7,
|
|
1717
2292
|
transparent: !0,
|
|
1718
2293
|
opacity: a.warehouse.wallOpacity
|
|
1719
2294
|
}
|
|
1720
2295
|
) }),
|
|
1721
|
-
|
|
2296
|
+
p && z && /* @__PURE__ */ r.jsx("lineSegments", { geometry: z, children: /* @__PURE__ */ r.jsx(
|
|
1722
2297
|
"lineBasicMaterial",
|
|
1723
2298
|
{
|
|
1724
2299
|
color: a.warehouse.gridColor,
|
|
@@ -1727,144 +2302,144 @@ const bt = V(function({
|
|
|
1727
2302
|
depthWrite: !1
|
|
1728
2303
|
}
|
|
1729
2304
|
) }),
|
|
1730
|
-
/* @__PURE__ */
|
|
1731
|
-
/* @__PURE__ */
|
|
2305
|
+
/* @__PURE__ */ r.jsx("ambientLight", { intensity: a.warehouse.ambientIntensity }),
|
|
2306
|
+
/* @__PURE__ */ r.jsx(
|
|
1732
2307
|
"directionalLight",
|
|
1733
2308
|
{
|
|
1734
|
-
position: [
|
|
2309
|
+
position: [S + j, g * 0.8, C + _],
|
|
1735
2310
|
intensity: a.warehouse.directionalIntensity,
|
|
1736
2311
|
castShadow: !0,
|
|
1737
2312
|
"shadow-mapSize-width": 1024,
|
|
1738
2313
|
"shadow-mapSize-height": 1024
|
|
1739
2314
|
}
|
|
1740
2315
|
),
|
|
1741
|
-
/* @__PURE__ */
|
|
2316
|
+
/* @__PURE__ */ r.jsx(
|
|
1742
2317
|
"pointLight",
|
|
1743
2318
|
{
|
|
1744
|
-
position: [
|
|
2319
|
+
position: [S, g * 0.9, C],
|
|
1745
2320
|
intensity: 0.5,
|
|
1746
|
-
distance: Math.max(
|
|
2321
|
+
distance: Math.max(j, _) * 2
|
|
1747
2322
|
}
|
|
1748
2323
|
),
|
|
1749
|
-
|
|
2324
|
+
n
|
|
1750
2325
|
] });
|
|
1751
2326
|
}
|
|
1752
|
-
), K = V(function({ position: e, radius: t, width: i, color:
|
|
1753
|
-
return /* @__PURE__ */
|
|
1754
|
-
/* @__PURE__ */
|
|
1755
|
-
/* @__PURE__ */
|
|
1756
|
-
/* @__PURE__ */
|
|
2327
|
+
), K = V(function({ position: e, radius: t, width: i, color: s }) {
|
|
2328
|
+
return /* @__PURE__ */ r.jsxs("group", { position: e, children: [
|
|
2329
|
+
/* @__PURE__ */ r.jsxs("mesh", { rotation: [0, 0, Math.PI / 2], castShadow: !0, children: [
|
|
2330
|
+
/* @__PURE__ */ r.jsx("cylinderGeometry", { args: [t, t, i, 24] }),
|
|
2331
|
+
/* @__PURE__ */ r.jsx("meshStandardMaterial", { color: s, roughness: 0.9, metalness: 0.1 })
|
|
1757
2332
|
] }),
|
|
1758
|
-
/* @__PURE__ */
|
|
1759
|
-
/* @__PURE__ */
|
|
1760
|
-
/* @__PURE__ */
|
|
2333
|
+
/* @__PURE__ */ r.jsxs("mesh", { rotation: [0, 0, Math.PI / 2], children: [
|
|
2334
|
+
/* @__PURE__ */ r.jsx("cylinderGeometry", { args: [t * 0.55, t * 0.55, i + 5e-3, 16] }),
|
|
2335
|
+
/* @__PURE__ */ r.jsx("meshStandardMaterial", { color: "#888888", roughness: 0.3, metalness: 0.7 })
|
|
1761
2336
|
] })
|
|
1762
2337
|
] });
|
|
1763
2338
|
}), Pt = V(function({
|
|
1764
2339
|
truck: e,
|
|
1765
2340
|
showGrid: t,
|
|
1766
2341
|
wallOpacity: i = 0.3,
|
|
1767
|
-
showRoof:
|
|
1768
|
-
showSideWalls:
|
|
2342
|
+
showRoof: s = !1,
|
|
2343
|
+
showSideWalls: n = !0,
|
|
1769
2344
|
children: a
|
|
1770
2345
|
}) {
|
|
1771
|
-
const
|
|
1772
|
-
if (!
|
|
1773
|
-
const G = 0.5,
|
|
1774
|
-
for (let X = 0; X <=
|
|
1775
|
-
|
|
1776
|
-
for (let X = 0; X <=
|
|
1777
|
-
|
|
1778
|
-
const F = new
|
|
1779
|
-
return F.setAttribute("position", new
|
|
1780
|
-
}, [
|
|
1781
|
-
() => /* @__PURE__ */
|
|
2346
|
+
const l = ce().truck, p = t ?? l.showGrid, h = U.MM_TO_M, g = e.dimensions.width * h, w = e.dimensions.height * h, m = e.dimensions.depth * h, x = 0.05, u = 0.08, d = 0.28, b = 0.18, j = 0.15, _ = 0.25, S = d + j, C = S + d + 0.1, z = C + _ / 2 + u / 2, y = g + x * 2, v = g * 0.65, M = w * 0.85, E = 0.15, T = m + x + E, I = z, R = k(() => {
|
|
2347
|
+
if (!p) return null;
|
|
2348
|
+
const G = 0.5, D = z + 2e-3, H = [];
|
|
2349
|
+
for (let X = 0; X <= g; X += G)
|
|
2350
|
+
H.push(X, D, 0, X, D, m);
|
|
2351
|
+
for (let X = 0; X <= m; X += G)
|
|
2352
|
+
H.push(0, D, X, g, D, X);
|
|
2353
|
+
const F = new B.BufferGeometry();
|
|
2354
|
+
return F.setAttribute("position", new B.Float32BufferAttribute(H, 3)), F;
|
|
2355
|
+
}, [p, g, m, z]), A = k(
|
|
2356
|
+
() => /* @__PURE__ */ r.jsx(
|
|
1782
2357
|
"meshStandardMaterial",
|
|
1783
2358
|
{
|
|
1784
|
-
color:
|
|
2359
|
+
color: l.wallColor,
|
|
1785
2360
|
roughness: 0.5,
|
|
1786
2361
|
metalness: 0.3,
|
|
1787
2362
|
transparent: i < 1,
|
|
1788
2363
|
opacity: i,
|
|
1789
|
-
side:
|
|
2364
|
+
side: B.DoubleSide,
|
|
1790
2365
|
depthWrite: i >= 0.95
|
|
1791
2366
|
}
|
|
1792
2367
|
),
|
|
1793
|
-
[
|
|
2368
|
+
[l.wallColor, i]
|
|
1794
2369
|
);
|
|
1795
|
-
return /* @__PURE__ */
|
|
1796
|
-
/* @__PURE__ */
|
|
2370
|
+
return /* @__PURE__ */ r.jsxs("group", { children: [
|
|
2371
|
+
/* @__PURE__ */ r.jsxs(
|
|
1797
2372
|
"mesh",
|
|
1798
2373
|
{
|
|
1799
|
-
position: [
|
|
2374
|
+
position: [g / 2, z, m / 2],
|
|
1800
2375
|
rotation: [-Math.PI / 2, 0, 0],
|
|
1801
2376
|
receiveShadow: !0,
|
|
1802
2377
|
children: [
|
|
1803
|
-
/* @__PURE__ */
|
|
1804
|
-
/* @__PURE__ */
|
|
2378
|
+
/* @__PURE__ */ r.jsx("planeGeometry", { args: [g, m] }),
|
|
2379
|
+
/* @__PURE__ */ r.jsx("meshStandardMaterial", { color: l.floorColor, roughness: 0.85 })
|
|
1805
2380
|
]
|
|
1806
2381
|
}
|
|
1807
2382
|
),
|
|
1808
|
-
/* @__PURE__ */
|
|
1809
|
-
/* @__PURE__ */
|
|
1810
|
-
/* @__PURE__ */
|
|
2383
|
+
/* @__PURE__ */ r.jsxs("mesh", { position: [g / 2, z - u / 2, m / 2], castShadow: !0, receiveShadow: !0, children: [
|
|
2384
|
+
/* @__PURE__ */ r.jsx("boxGeometry", { args: [g + x * 2, u, m + x] }),
|
|
2385
|
+
/* @__PURE__ */ r.jsx("meshStandardMaterial", { color: l.floorColor, roughness: 0.85, metalness: 0.1 })
|
|
1811
2386
|
] }),
|
|
1812
|
-
|
|
1813
|
-
/* @__PURE__ */
|
|
2387
|
+
n && /* @__PURE__ */ r.jsxs("mesh", { position: [-x / 2, z + w / 2, m / 2], castShadow: !0, children: [
|
|
2388
|
+
/* @__PURE__ */ r.jsx("boxGeometry", { args: [x, w, m + x] }),
|
|
1814
2389
|
A
|
|
1815
2390
|
] }),
|
|
1816
|
-
|
|
1817
|
-
/* @__PURE__ */
|
|
2391
|
+
n && /* @__PURE__ */ r.jsxs("mesh", { position: [g + x / 2, z + w / 2, m / 2], castShadow: !0, children: [
|
|
2392
|
+
/* @__PURE__ */ r.jsx("boxGeometry", { args: [x, w, m + x] }),
|
|
1818
2393
|
A
|
|
1819
2394
|
] }),
|
|
1820
|
-
/* @__PURE__ */
|
|
1821
|
-
/* @__PURE__ */
|
|
2395
|
+
/* @__PURE__ */ r.jsxs("mesh", { position: [g / 2, z + w / 2, m + x / 2], castShadow: !0, children: [
|
|
2396
|
+
/* @__PURE__ */ r.jsx("boxGeometry", { args: [g + x * 2, w, x] }),
|
|
1822
2397
|
A
|
|
1823
2398
|
] }),
|
|
1824
|
-
|
|
1825
|
-
/* @__PURE__ */
|
|
2399
|
+
s && /* @__PURE__ */ r.jsxs("mesh", { position: [g / 2, z + w, m / 2], castShadow: !0, children: [
|
|
2400
|
+
/* @__PURE__ */ r.jsx("boxGeometry", { args: [g + x * 2, x, m + x] }),
|
|
1826
2401
|
A
|
|
1827
2402
|
] }),
|
|
1828
|
-
|
|
2403
|
+
p && R && /* @__PURE__ */ r.jsx("lineSegments", { geometry: R, children: /* @__PURE__ */ r.jsx(
|
|
1829
2404
|
"lineBasicMaterial",
|
|
1830
2405
|
{
|
|
1831
|
-
color:
|
|
2406
|
+
color: l.gridColor,
|
|
1832
2407
|
opacity: 0.5,
|
|
1833
2408
|
transparent: !0,
|
|
1834
2409
|
depthWrite: !1
|
|
1835
2410
|
}
|
|
1836
2411
|
) }),
|
|
1837
|
-
/* @__PURE__ */
|
|
1838
|
-
/* @__PURE__ */
|
|
1839
|
-
/* @__PURE__ */
|
|
2412
|
+
/* @__PURE__ */ r.jsxs("mesh", { position: [g * 0.25, C, (m + v + E) / 2], castShadow: !0, children: [
|
|
2413
|
+
/* @__PURE__ */ r.jsx("boxGeometry", { args: [0.12, _, m + v + E] }),
|
|
2414
|
+
/* @__PURE__ */ r.jsx("meshStandardMaterial", { color: l.chassisColor, roughness: 0.7, metalness: 0.5 })
|
|
1840
2415
|
] }),
|
|
1841
|
-
/* @__PURE__ */
|
|
1842
|
-
/* @__PURE__ */
|
|
1843
|
-
/* @__PURE__ */
|
|
2416
|
+
/* @__PURE__ */ r.jsxs("mesh", { position: [g * 0.75, C, (m + v + E) / 2], castShadow: !0, children: [
|
|
2417
|
+
/* @__PURE__ */ r.jsx("boxGeometry", { args: [0.12, _, m + v + E] }),
|
|
2418
|
+
/* @__PURE__ */ r.jsx("meshStandardMaterial", { color: l.chassisColor, roughness: 0.7, metalness: 0.5 })
|
|
1844
2419
|
] }),
|
|
1845
|
-
[0.15, 0.35, 0.55, 0.75, 0.95].map((G) => /* @__PURE__ */
|
|
1846
|
-
/* @__PURE__ */
|
|
1847
|
-
/* @__PURE__ */
|
|
2420
|
+
[0.15, 0.35, 0.55, 0.75, 0.95].map((G) => /* @__PURE__ */ r.jsxs("mesh", { position: [g / 2, C, m * G], castShadow: !0, children: [
|
|
2421
|
+
/* @__PURE__ */ r.jsx("boxGeometry", { args: [g * 0.6, 0.06, 0.06] }),
|
|
2422
|
+
/* @__PURE__ */ r.jsx("meshStandardMaterial", { color: l.chassisColor, roughness: 0.7, metalness: 0.5 })
|
|
1848
2423
|
] }, G)),
|
|
1849
|
-
/* @__PURE__ */
|
|
1850
|
-
/* @__PURE__ */
|
|
1851
|
-
/* @__PURE__ */
|
|
1852
|
-
/* @__PURE__ */
|
|
1853
|
-
/* @__PURE__ */
|
|
1854
|
-
/* @__PURE__ */
|
|
1855
|
-
/* @__PURE__ */
|
|
1856
|
-
/* @__PURE__ */
|
|
1857
|
-
/* @__PURE__ */
|
|
1858
|
-
/* @__PURE__ */
|
|
2424
|
+
/* @__PURE__ */ r.jsx(K, { position: [-b / 2 - x, S, m * 0.12], radius: d, width: b, color: l.wheelColor }),
|
|
2425
|
+
/* @__PURE__ */ r.jsx(K, { position: [g + b / 2 + x, S, m * 0.12], radius: d, width: b, color: l.wheelColor }),
|
|
2426
|
+
/* @__PURE__ */ r.jsx(K, { position: [-b / 2 - x, S, m * 0.22], radius: d, width: b, color: l.wheelColor }),
|
|
2427
|
+
/* @__PURE__ */ r.jsx(K, { position: [g + b / 2 + x, S, m * 0.22], radius: d, width: b, color: l.wheelColor }),
|
|
2428
|
+
/* @__PURE__ */ r.jsx(K, { position: [-b / 2 - x, S, T + v * 0.5], radius: d, width: b, color: l.wheelColor }),
|
|
2429
|
+
/* @__PURE__ */ r.jsx(K, { position: [g + b / 2 + x, S, T + v * 0.5], radius: d, width: b, color: l.wheelColor }),
|
|
2430
|
+
/* @__PURE__ */ r.jsxs("group", { position: [g / 2, I, T], children: [
|
|
2431
|
+
/* @__PURE__ */ r.jsxs("mesh", { position: [0, M / 2, v / 2], castShadow: !0, receiveShadow: !0, children: [
|
|
2432
|
+
/* @__PURE__ */ r.jsx("boxGeometry", { args: [y, M, v] }),
|
|
2433
|
+
/* @__PURE__ */ r.jsx("meshStandardMaterial", { color: l.cabColor, roughness: 0.4, metalness: 0.3 })
|
|
1859
2434
|
] }),
|
|
1860
|
-
/* @__PURE__ */
|
|
2435
|
+
/* @__PURE__ */ r.jsxs(
|
|
1861
2436
|
"mesh",
|
|
1862
2437
|
{
|
|
1863
|
-
position: [0,
|
|
2438
|
+
position: [0, M * 0.6, v + 0.01],
|
|
1864
2439
|
castShadow: !0,
|
|
1865
2440
|
children: [
|
|
1866
|
-
/* @__PURE__ */
|
|
1867
|
-
/* @__PURE__ */
|
|
2441
|
+
/* @__PURE__ */ r.jsx("planeGeometry", { args: [y * 0.75, M * 0.4] }),
|
|
2442
|
+
/* @__PURE__ */ r.jsx(
|
|
1868
2443
|
"meshStandardMaterial",
|
|
1869
2444
|
{
|
|
1870
2445
|
color: "#88bbdd",
|
|
@@ -1872,15 +2447,15 @@ const bt = V(function({
|
|
|
1872
2447
|
opacity: 0.5,
|
|
1873
2448
|
roughness: 0.1,
|
|
1874
2449
|
metalness: 0.6,
|
|
1875
|
-
side:
|
|
2450
|
+
side: B.DoubleSide
|
|
1876
2451
|
}
|
|
1877
2452
|
)
|
|
1878
2453
|
]
|
|
1879
2454
|
}
|
|
1880
2455
|
),
|
|
1881
|
-
/* @__PURE__ */
|
|
1882
|
-
/* @__PURE__ */
|
|
1883
|
-
/* @__PURE__ */
|
|
2456
|
+
/* @__PURE__ */ r.jsxs("mesh", { position: [-y / 2 - 0.01, M * 0.6, v * 0.55], rotation: [0, Math.PI / 2, 0], children: [
|
|
2457
|
+
/* @__PURE__ */ r.jsx("planeGeometry", { args: [v * 0.5, M * 0.3] }),
|
|
2458
|
+
/* @__PURE__ */ r.jsx(
|
|
1884
2459
|
"meshStandardMaterial",
|
|
1885
2460
|
{
|
|
1886
2461
|
color: "#88bbdd",
|
|
@@ -1888,13 +2463,13 @@ const bt = V(function({
|
|
|
1888
2463
|
opacity: 0.4,
|
|
1889
2464
|
roughness: 0.1,
|
|
1890
2465
|
metalness: 0.6,
|
|
1891
|
-
side:
|
|
2466
|
+
side: B.DoubleSide
|
|
1892
2467
|
}
|
|
1893
2468
|
)
|
|
1894
2469
|
] }),
|
|
1895
|
-
/* @__PURE__ */
|
|
1896
|
-
/* @__PURE__ */
|
|
1897
|
-
/* @__PURE__ */
|
|
2470
|
+
/* @__PURE__ */ r.jsxs("mesh", { position: [y / 2 + 0.01, M * 0.6, v * 0.55], rotation: [0, -Math.PI / 2, 0], children: [
|
|
2471
|
+
/* @__PURE__ */ r.jsx("planeGeometry", { args: [v * 0.5, M * 0.3] }),
|
|
2472
|
+
/* @__PURE__ */ r.jsx(
|
|
1898
2473
|
"meshStandardMaterial",
|
|
1899
2474
|
{
|
|
1900
2475
|
color: "#88bbdd",
|
|
@@ -1902,69 +2477,69 @@ const bt = V(function({
|
|
|
1902
2477
|
opacity: 0.4,
|
|
1903
2478
|
roughness: 0.1,
|
|
1904
2479
|
metalness: 0.6,
|
|
1905
|
-
side:
|
|
2480
|
+
side: B.DoubleSide
|
|
1906
2481
|
}
|
|
1907
2482
|
)
|
|
1908
2483
|
] }),
|
|
1909
|
-
/* @__PURE__ */
|
|
1910
|
-
/* @__PURE__ */
|
|
1911
|
-
/* @__PURE__ */
|
|
2484
|
+
/* @__PURE__ */ r.jsxs("mesh", { position: [0, M + 0.04, v / 2], children: [
|
|
2485
|
+
/* @__PURE__ */ r.jsx("boxGeometry", { args: [y * 0.95, 0.08, v * 0.9] }),
|
|
2486
|
+
/* @__PURE__ */ r.jsx("meshStandardMaterial", { color: l.cabColor, roughness: 0.4, metalness: 0.3 })
|
|
1912
2487
|
] }),
|
|
1913
|
-
/* @__PURE__ */
|
|
1914
|
-
/* @__PURE__ */
|
|
1915
|
-
/* @__PURE__ */
|
|
2488
|
+
/* @__PURE__ */ r.jsxs("mesh", { position: [0, M + 0.25, v * 0.1], rotation: [-0.3, 0, 0], children: [
|
|
2489
|
+
/* @__PURE__ */ r.jsx("boxGeometry", { args: [y * 0.9, 0.04, v * 0.5] }),
|
|
2490
|
+
/* @__PURE__ */ r.jsx("meshStandardMaterial", { color: l.cabColor, roughness: 0.4, metalness: 0.3 })
|
|
1916
2491
|
] }),
|
|
1917
|
-
/* @__PURE__ */
|
|
1918
|
-
/* @__PURE__ */
|
|
1919
|
-
/* @__PURE__ */
|
|
2492
|
+
/* @__PURE__ */ r.jsxs("mesh", { position: [-y * 0.35, M * 0.2, v + 0.02], children: [
|
|
2493
|
+
/* @__PURE__ */ r.jsx("boxGeometry", { args: [y * 0.15, 0.08, 0.02] }),
|
|
2494
|
+
/* @__PURE__ */ r.jsx("meshStandardMaterial", { color: "#ffffcc", emissive: "#ffffaa", emissiveIntensity: 0.3 })
|
|
1920
2495
|
] }),
|
|
1921
|
-
/* @__PURE__ */
|
|
1922
|
-
/* @__PURE__ */
|
|
1923
|
-
/* @__PURE__ */
|
|
2496
|
+
/* @__PURE__ */ r.jsxs("mesh", { position: [y * 0.35, M * 0.2, v + 0.02], children: [
|
|
2497
|
+
/* @__PURE__ */ r.jsx("boxGeometry", { args: [y * 0.15, 0.08, 0.02] }),
|
|
2498
|
+
/* @__PURE__ */ r.jsx("meshStandardMaterial", { color: "#ffffcc", emissive: "#ffffaa", emissiveIntensity: 0.3 })
|
|
1924
2499
|
] }),
|
|
1925
|
-
/* @__PURE__ */
|
|
1926
|
-
/* @__PURE__ */
|
|
1927
|
-
/* @__PURE__ */
|
|
2500
|
+
/* @__PURE__ */ r.jsxs("mesh", { position: [0, 0.06, v + 0.04], castShadow: !0, children: [
|
|
2501
|
+
/* @__PURE__ */ r.jsx("boxGeometry", { args: [y * 1.02, 0.12, 0.06] }),
|
|
2502
|
+
/* @__PURE__ */ r.jsx("meshStandardMaterial", { color: l.chassisColor, roughness: 0.5, metalness: 0.6 })
|
|
1928
2503
|
] })
|
|
1929
2504
|
] }),
|
|
1930
|
-
[-1, 1].map((G) => /* @__PURE__ */
|
|
2505
|
+
[-1, 1].map((G) => /* @__PURE__ */ r.jsxs(
|
|
1931
2506
|
"mesh",
|
|
1932
2507
|
{
|
|
1933
2508
|
position: [
|
|
1934
|
-
G === -1 ? -
|
|
1935
|
-
|
|
1936
|
-
|
|
2509
|
+
G === -1 ? -x - b * 0.5 : g + x + b * 0.5,
|
|
2510
|
+
S + d * 0.6,
|
|
2511
|
+
m * 0.17
|
|
1937
2512
|
],
|
|
1938
2513
|
castShadow: !0,
|
|
1939
2514
|
children: [
|
|
1940
|
-
/* @__PURE__ */
|
|
1941
|
-
/* @__PURE__ */
|
|
2515
|
+
/* @__PURE__ */ r.jsx("boxGeometry", { args: [b + 0.04, 0.04, d * 2.5] }),
|
|
2516
|
+
/* @__PURE__ */ r.jsx("meshStandardMaterial", { color: l.chassisColor, roughness: 0.6, metalness: 0.4 })
|
|
1942
2517
|
]
|
|
1943
2518
|
},
|
|
1944
2519
|
`fender-rear-${G}`
|
|
1945
2520
|
)),
|
|
1946
|
-
/* @__PURE__ */
|
|
1947
|
-
/* @__PURE__ */
|
|
1948
|
-
/* @__PURE__ */
|
|
2521
|
+
/* @__PURE__ */ r.jsxs("mesh", { position: [-x / 2 + 0.01, z + w * 0.3, -0.01], children: [
|
|
2522
|
+
/* @__PURE__ */ r.jsx("boxGeometry", { args: [0.08, 0.12, 0.02] }),
|
|
2523
|
+
/* @__PURE__ */ r.jsx("meshStandardMaterial", { color: "#ff3333", emissive: "#ff0000", emissiveIntensity: 0.3 })
|
|
1949
2524
|
] }),
|
|
1950
|
-
/* @__PURE__ */
|
|
1951
|
-
/* @__PURE__ */
|
|
1952
|
-
/* @__PURE__ */
|
|
2525
|
+
/* @__PURE__ */ r.jsxs("mesh", { position: [g + x / 2 - 0.01, z + w * 0.3, -0.01], children: [
|
|
2526
|
+
/* @__PURE__ */ r.jsx("boxGeometry", { args: [0.08, 0.12, 0.02] }),
|
|
2527
|
+
/* @__PURE__ */ r.jsx("meshStandardMaterial", { color: "#ff3333", emissive: "#ff0000", emissiveIntensity: 0.3 })
|
|
1953
2528
|
] }),
|
|
1954
|
-
/* @__PURE__ */
|
|
1955
|
-
/* @__PURE__ */
|
|
2529
|
+
/* @__PURE__ */ r.jsx("ambientLight", { intensity: 0.45 }),
|
|
2530
|
+
/* @__PURE__ */ r.jsx(
|
|
1956
2531
|
"directionalLight",
|
|
1957
2532
|
{
|
|
1958
|
-
position: [
|
|
2533
|
+
position: [g / 2, z + w * 1.5, m * 0.8],
|
|
1959
2534
|
intensity: 0.75,
|
|
1960
2535
|
castShadow: !0,
|
|
1961
2536
|
"shadow-mapSize-width": 1024,
|
|
1962
2537
|
"shadow-mapSize-height": 1024
|
|
1963
2538
|
}
|
|
1964
2539
|
),
|
|
1965
|
-
/* @__PURE__ */
|
|
1966
|
-
/* @__PURE__ */
|
|
1967
|
-
/* @__PURE__ */
|
|
2540
|
+
/* @__PURE__ */ r.jsx("pointLight", { position: [g / 2, z + w * 0.7, m / 2], intensity: 0.35 }),
|
|
2541
|
+
/* @__PURE__ */ r.jsx("pointLight", { position: [g / 2, z + w * 0.9, m * 0.3], intensity: 0.25 }),
|
|
2542
|
+
/* @__PURE__ */ r.jsx("group", { position: [0, z, 0], children: a })
|
|
1968
2543
|
] });
|
|
1969
2544
|
});
|
|
1970
2545
|
function Rt(o, e, t) {
|
|
@@ -1976,57 +2551,57 @@ function Rt(o, e, t) {
|
|
|
1976
2551
|
front: [0, 1.5, 5],
|
|
1977
2552
|
side: [5, 1.5, 0]
|
|
1978
2553
|
}[o];
|
|
1979
|
-
const { width: i, height:
|
|
2554
|
+
const { width: i, height: s, depth: n } = t, [a, c, l] = e, h = Math.sqrt(i ** 2 + s ** 2 + n ** 2) * 3;
|
|
1980
2555
|
switch (o) {
|
|
1981
2556
|
case "perspective":
|
|
1982
2557
|
return [
|
|
1983
|
-
a +
|
|
1984
|
-
|
|
1985
|
-
|
|
2558
|
+
a + h * 0.6,
|
|
2559
|
+
c + h * 0.5,
|
|
2560
|
+
l + h * 0.6
|
|
1986
2561
|
];
|
|
1987
2562
|
case "isometric":
|
|
1988
2563
|
return [
|
|
1989
|
-
a +
|
|
1990
|
-
|
|
1991
|
-
|
|
2564
|
+
a + h * 0.577,
|
|
2565
|
+
c + h * 0.577,
|
|
2566
|
+
l + h * 0.577
|
|
1992
2567
|
];
|
|
1993
2568
|
case "top":
|
|
1994
|
-
return [a,
|
|
2569
|
+
return [a, c + Math.max(h, s * 2), l];
|
|
1995
2570
|
case "front":
|
|
1996
|
-
return [a,
|
|
2571
|
+
return [a, c + s * 0.5, l + Math.max(h, n * 1.5)];
|
|
1997
2572
|
case "side":
|
|
1998
|
-
return [a + Math.max(
|
|
2573
|
+
return [a + Math.max(h, i * 1.5), c + s * 0.5, l];
|
|
1999
2574
|
}
|
|
2000
2575
|
}
|
|
2001
|
-
const
|
|
2576
|
+
const Se = V(function({
|
|
2002
2577
|
preset: e = "perspective",
|
|
2003
2578
|
autoRotate: t = !1,
|
|
2004
2579
|
enablePan: i = !0,
|
|
2005
|
-
enableZoom:
|
|
2006
|
-
target:
|
|
2580
|
+
enableZoom: s = !0,
|
|
2581
|
+
target: n = [0, 0, 0],
|
|
2007
2582
|
minDistance: a = 0.5,
|
|
2008
|
-
maxDistance:
|
|
2009
|
-
sceneSize:
|
|
2583
|
+
maxDistance: c = 50,
|
|
2584
|
+
sceneSize: l
|
|
2010
2585
|
}) {
|
|
2011
|
-
const { camera:
|
|
2012
|
-
return
|
|
2013
|
-
const
|
|
2014
|
-
const
|
|
2015
|
-
|
|
2586
|
+
const { camera: p } = Ae(), h = Ee(null);
|
|
2587
|
+
return pe(() => {
|
|
2588
|
+
const g = Rt(e, n, l), w = new B.Vector3(g[0], g[1], g[2]), m = new B.Vector3(...n), x = p.position.clone(), u = 1e3, d = Date.now(), b = () => {
|
|
2589
|
+
const j = Date.now() - d, _ = Math.min(j / u, 1), S = 1 - Math.pow(1 - _, 3);
|
|
2590
|
+
p.position.lerpVectors(x, w, S), h.current && (h.current.target.lerp(m, S), h.current.update()), _ < 1 && requestAnimationFrame(b);
|
|
2016
2591
|
};
|
|
2017
|
-
|
|
2018
|
-
}, [e,
|
|
2592
|
+
b();
|
|
2593
|
+
}, [e, l, p, n]), /* @__PURE__ */ r.jsx(
|
|
2019
2594
|
Xe,
|
|
2020
2595
|
{
|
|
2021
|
-
ref:
|
|
2022
|
-
target:
|
|
2596
|
+
ref: h,
|
|
2597
|
+
target: n,
|
|
2023
2598
|
autoRotate: t,
|
|
2024
2599
|
autoRotateSpeed: 0.5,
|
|
2025
2600
|
enablePan: i,
|
|
2026
|
-
enableZoom:
|
|
2601
|
+
enableZoom: s,
|
|
2027
2602
|
enableRotate: !0,
|
|
2028
2603
|
minDistance: a,
|
|
2029
|
-
maxDistance:
|
|
2604
|
+
maxDistance: c,
|
|
2030
2605
|
enableDamping: !0,
|
|
2031
2606
|
dampingFactor: 0.05,
|
|
2032
2607
|
rotateSpeed: 0.5,
|
|
@@ -2035,7 +2610,7 @@ const je = V(function({
|
|
|
2035
2610
|
makeDefault: !0
|
|
2036
2611
|
}
|
|
2037
2612
|
);
|
|
2038
|
-
}),
|
|
2613
|
+
}), Tt = {
|
|
2039
2614
|
perspective: { label: "Perspectiva", icon: "📐" },
|
|
2040
2615
|
isometric: { label: "Isométrica", icon: "🔲" },
|
|
2041
2616
|
top: { label: "Superior", icon: "⬇️" },
|
|
@@ -2047,56 +2622,56 @@ V(function({
|
|
|
2047
2622
|
onPresetChange: t,
|
|
2048
2623
|
position: i = "top-right"
|
|
2049
2624
|
}) {
|
|
2050
|
-
const
|
|
2051
|
-
return /* @__PURE__ */
|
|
2052
|
-
/* @__PURE__ */
|
|
2053
|
-
/* @__PURE__ */
|
|
2054
|
-
const { label: a, icon:
|
|
2055
|
-
return /* @__PURE__ */
|
|
2625
|
+
const s = ["perspective", "isometric", "top", "front", "side"];
|
|
2626
|
+
return /* @__PURE__ */ r.jsxs("div", { className: `view-controls view-controls--${i}`, children: [
|
|
2627
|
+
/* @__PURE__ */ r.jsx("div", { className: "view-controls__title", children: "Vista" }),
|
|
2628
|
+
/* @__PURE__ */ r.jsx("div", { className: "view-controls__buttons", children: s.map((n) => {
|
|
2629
|
+
const { label: a, icon: c } = Tt[n], l = e === n;
|
|
2630
|
+
return /* @__PURE__ */ r.jsxs(
|
|
2056
2631
|
"button",
|
|
2057
2632
|
{
|
|
2058
|
-
className: `view-controls__button ${
|
|
2059
|
-
onClick: () => t(
|
|
2633
|
+
className: `view-controls__button ${l ? "view-controls__button--active" : ""}`,
|
|
2634
|
+
onClick: () => t(n),
|
|
2060
2635
|
title: a,
|
|
2061
2636
|
"aria-label": a,
|
|
2062
2637
|
children: [
|
|
2063
|
-
/* @__PURE__ */
|
|
2064
|
-
/* @__PURE__ */
|
|
2638
|
+
/* @__PURE__ */ r.jsx("span", { className: "view-controls__icon", role: "img", "aria-hidden": "true", children: c }),
|
|
2639
|
+
/* @__PURE__ */ r.jsx("span", { className: "view-controls__label", children: a })
|
|
2065
2640
|
]
|
|
2066
2641
|
},
|
|
2067
|
-
|
|
2642
|
+
n
|
|
2068
2643
|
);
|
|
2069
2644
|
}) })
|
|
2070
2645
|
] });
|
|
2071
2646
|
});
|
|
2072
|
-
const
|
|
2647
|
+
const je = V(function({
|
|
2073
2648
|
sceneWidth: e,
|
|
2074
2649
|
sceneDepth: t,
|
|
2075
2650
|
sceneType: i,
|
|
2076
|
-
floorPolygon:
|
|
2077
|
-
cameraPosition:
|
|
2651
|
+
floorPolygon: s,
|
|
2652
|
+
cameraPosition: n,
|
|
2078
2653
|
targetPosition: a,
|
|
2079
|
-
position:
|
|
2654
|
+
position: c = "bottom-left"
|
|
2080
2655
|
}) {
|
|
2081
|
-
const
|
|
2082
|
-
x: 10 +
|
|
2083
|
-
y: 10 +
|
|
2084
|
-
}),
|
|
2085
|
-
const
|
|
2086
|
-
return `${
|
|
2087
|
-
}).join(" L ")} Z`, [i,
|
|
2656
|
+
const h = k(() => 130 / Math.max(e, t), [e, t]), g = (d, b) => ({
|
|
2657
|
+
x: 10 + d * h,
|
|
2658
|
+
y: 10 + b * h
|
|
2659
|
+
}), w = k(() => i !== "warehouse" || !s || s.length === 0 ? "" : `M ${s.map((b) => {
|
|
2660
|
+
const j = g(b.x, b.z);
|
|
2661
|
+
return `${j.x},${j.y}`;
|
|
2662
|
+
}).join(" L ")} Z`, [i, s, h]), m = k(() => {
|
|
2088
2663
|
if (i !== "truck") return null;
|
|
2089
|
-
const
|
|
2664
|
+
const d = g(0, 0);
|
|
2090
2665
|
return {
|
|
2091
|
-
x:
|
|
2092
|
-
y:
|
|
2093
|
-
width: e *
|
|
2094
|
-
height: t *
|
|
2666
|
+
x: d.x,
|
|
2667
|
+
y: d.y,
|
|
2668
|
+
width: e * h,
|
|
2669
|
+
height: t * h
|
|
2095
2670
|
};
|
|
2096
|
-
}, [i, e, t,
|
|
2097
|
-
return /* @__PURE__ */
|
|
2098
|
-
/* @__PURE__ */
|
|
2099
|
-
/* @__PURE__ */
|
|
2671
|
+
}, [i, e, t, h]), x = n ? g(n.x, n.z) : null, u = a ? g(a.x, a.z) : null;
|
|
2672
|
+
return /* @__PURE__ */ r.jsxs("div", { className: `minimap minimap--${c}`, children: [
|
|
2673
|
+
/* @__PURE__ */ r.jsx("div", { className: "minimap__title", children: "Mapa" }),
|
|
2674
|
+
/* @__PURE__ */ r.jsxs(
|
|
2100
2675
|
"svg",
|
|
2101
2676
|
{
|
|
2102
2677
|
className: "minimap__canvas",
|
|
@@ -2105,31 +2680,31 @@ const Se = V(function({
|
|
|
2105
2680
|
viewBox: "0 0 150 150",
|
|
2106
2681
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2107
2682
|
children: [
|
|
2108
|
-
/* @__PURE__ */
|
|
2109
|
-
i === "warehouse" &&
|
|
2110
|
-
i === "truck" &&
|
|
2683
|
+
/* @__PURE__ */ r.jsx("rect", { width: 150, height: 150, fill: "#1a1a2e" }),
|
|
2684
|
+
i === "warehouse" && w && /* @__PURE__ */ r.jsx("path", { d: w, fill: "rgba(96, 165, 250, 0.15)", stroke: "#60a5fa", strokeWidth: "2" }),
|
|
2685
|
+
i === "truck" && m && /* @__PURE__ */ r.jsx(
|
|
2111
2686
|
"rect",
|
|
2112
2687
|
{
|
|
2113
|
-
x:
|
|
2114
|
-
y:
|
|
2115
|
-
width:
|
|
2116
|
-
height:
|
|
2688
|
+
x: m.x,
|
|
2689
|
+
y: m.y,
|
|
2690
|
+
width: m.width,
|
|
2691
|
+
height: m.height,
|
|
2117
2692
|
fill: "rgba(96, 165, 250, 0.15)",
|
|
2118
2693
|
stroke: "#60a5fa",
|
|
2119
2694
|
strokeWidth: "2"
|
|
2120
2695
|
}
|
|
2121
2696
|
),
|
|
2122
|
-
/* @__PURE__ */
|
|
2697
|
+
/* @__PURE__ */ r.jsx("defs", { children: /* @__PURE__ */ r.jsx(
|
|
2123
2698
|
"pattern",
|
|
2124
2699
|
{
|
|
2125
2700
|
id: "minimap-grid",
|
|
2126
|
-
width:
|
|
2127
|
-
height:
|
|
2701
|
+
width: h,
|
|
2702
|
+
height: h,
|
|
2128
2703
|
patternUnits: "userSpaceOnUse",
|
|
2129
|
-
children: /* @__PURE__ */
|
|
2704
|
+
children: /* @__PURE__ */ r.jsx(
|
|
2130
2705
|
"path",
|
|
2131
2706
|
{
|
|
2132
|
-
d: `M ${
|
|
2707
|
+
d: `M ${h} 0 L 0 0 0 ${h}`,
|
|
2133
2708
|
fill: "none",
|
|
2134
2709
|
stroke: "rgba(255, 255, 255, 0.08)",
|
|
2135
2710
|
strokeWidth: "0.5"
|
|
@@ -2137,29 +2712,29 @@ const Se = V(function({
|
|
|
2137
2712
|
)
|
|
2138
2713
|
}
|
|
2139
2714
|
) }),
|
|
2140
|
-
i === "truck" &&
|
|
2715
|
+
i === "truck" && m && /* @__PURE__ */ r.jsx(
|
|
2141
2716
|
"rect",
|
|
2142
2717
|
{
|
|
2143
|
-
x:
|
|
2144
|
-
y:
|
|
2145
|
-
width:
|
|
2146
|
-
height:
|
|
2718
|
+
x: m.x,
|
|
2719
|
+
y: m.y,
|
|
2720
|
+
width: m.width,
|
|
2721
|
+
height: m.height,
|
|
2147
2722
|
fill: "url(#minimap-grid)"
|
|
2148
2723
|
}
|
|
2149
2724
|
),
|
|
2150
|
-
|
|
2151
|
-
/* @__PURE__ */
|
|
2152
|
-
/* @__PURE__ */
|
|
2725
|
+
u && /* @__PURE__ */ r.jsxs("g", { children: [
|
|
2726
|
+
/* @__PURE__ */ r.jsx("circle", { cx: u.x, cy: u.y, r: "3", fill: "#f87171", opacity: "0.6" }),
|
|
2727
|
+
/* @__PURE__ */ r.jsx("circle", { cx: u.x, cy: u.y, r: "5", fill: "none", stroke: "#f87171", strokeWidth: "1.5" })
|
|
2153
2728
|
] }),
|
|
2154
|
-
|
|
2155
|
-
/* @__PURE__ */
|
|
2156
|
-
|
|
2729
|
+
x && /* @__PURE__ */ r.jsxs("g", { children: [
|
|
2730
|
+
/* @__PURE__ */ r.jsx("circle", { cx: x.x, cy: x.y, r: "4", fill: "#60a5fa" }),
|
|
2731
|
+
u && /* @__PURE__ */ r.jsx(
|
|
2157
2732
|
"line",
|
|
2158
2733
|
{
|
|
2159
|
-
x1:
|
|
2160
|
-
y1:
|
|
2161
|
-
x2:
|
|
2162
|
-
y2:
|
|
2734
|
+
x1: x.x,
|
|
2735
|
+
y1: x.y,
|
|
2736
|
+
x2: u.x,
|
|
2737
|
+
y2: u.y,
|
|
2163
2738
|
stroke: "#60a5fa",
|
|
2164
2739
|
strokeWidth: "1",
|
|
2165
2740
|
strokeDasharray: "2,2",
|
|
@@ -2170,103 +2745,103 @@ const Se = V(function({
|
|
|
2170
2745
|
]
|
|
2171
2746
|
}
|
|
2172
2747
|
),
|
|
2173
|
-
/* @__PURE__ */
|
|
2174
|
-
/* @__PURE__ */
|
|
2175
|
-
/* @__PURE__ */
|
|
2176
|
-
/* @__PURE__ */
|
|
2748
|
+
/* @__PURE__ */ r.jsxs("div", { className: "minimap__legend", children: [
|
|
2749
|
+
/* @__PURE__ */ r.jsxs("div", { className: "minimap__legend-item", children: [
|
|
2750
|
+
/* @__PURE__ */ r.jsx("span", { className: "minimap__legend-dot minimap__legend-dot--camera" }),
|
|
2751
|
+
/* @__PURE__ */ r.jsx("span", { className: "minimap__legend-text", children: "Cámara" })
|
|
2177
2752
|
] }),
|
|
2178
|
-
/* @__PURE__ */
|
|
2179
|
-
/* @__PURE__ */
|
|
2180
|
-
/* @__PURE__ */
|
|
2753
|
+
/* @__PURE__ */ r.jsxs("div", { className: "minimap__legend-item", children: [
|
|
2754
|
+
/* @__PURE__ */ r.jsx("span", { className: "minimap__legend-dot minimap__legend-dot--target" }),
|
|
2755
|
+
/* @__PURE__ */ r.jsx("span", { className: "minimap__legend-text", children: "Objetivo" })
|
|
2181
2756
|
] })
|
|
2182
2757
|
] })
|
|
2183
2758
|
] });
|
|
2184
2759
|
});
|
|
2185
|
-
function
|
|
2760
|
+
function _t() {
|
|
2186
2761
|
const { camera: o } = Ae(), [e, t] = ae({
|
|
2187
2762
|
x: o.position.x,
|
|
2188
2763
|
y: o.position.y,
|
|
2189
2764
|
z: o.position.z
|
|
2190
2765
|
});
|
|
2191
|
-
return
|
|
2766
|
+
return pe(() => {
|
|
2192
2767
|
let i;
|
|
2193
|
-
const
|
|
2768
|
+
const s = () => {
|
|
2194
2769
|
t({
|
|
2195
2770
|
x: o.position.x,
|
|
2196
2771
|
y: o.position.y,
|
|
2197
2772
|
z: o.position.z
|
|
2198
|
-
}), i = requestAnimationFrame(
|
|
2773
|
+
}), i = requestAnimationFrame(s);
|
|
2199
2774
|
};
|
|
2200
|
-
return i = requestAnimationFrame(
|
|
2775
|
+
return i = requestAnimationFrame(s), () => {
|
|
2201
2776
|
i && cancelAnimationFrame(i);
|
|
2202
2777
|
};
|
|
2203
2778
|
}, [o]), e;
|
|
2204
2779
|
}
|
|
2205
|
-
function
|
|
2206
|
-
const e =
|
|
2207
|
-
return
|
|
2780
|
+
function Me({ onPositionChange: o }) {
|
|
2781
|
+
const e = _t();
|
|
2782
|
+
return pe(() => {
|
|
2208
2783
|
o(e);
|
|
2209
2784
|
}, [e, o]), null;
|
|
2210
2785
|
}
|
|
2211
|
-
const
|
|
2786
|
+
const Ht = V(function({
|
|
2212
2787
|
stackedPallet: e,
|
|
2213
2788
|
preset: t,
|
|
2214
2789
|
selectedBoxId: i,
|
|
2215
|
-
highlightedBoxId:
|
|
2216
|
-
selectedColor:
|
|
2790
|
+
highlightedBoxId: s,
|
|
2791
|
+
selectedColor: n,
|
|
2217
2792
|
highlightedColor: a,
|
|
2218
|
-
showLabels:
|
|
2219
|
-
cameraPreset:
|
|
2220
|
-
showGrid:
|
|
2221
|
-
showMiniMap:
|
|
2222
|
-
onBoxClick:
|
|
2223
|
-
onBoxHover:
|
|
2224
|
-
children:
|
|
2225
|
-
style:
|
|
2793
|
+
showLabels: c = !1,
|
|
2794
|
+
cameraPreset: l = "perspective",
|
|
2795
|
+
showGrid: p = !0,
|
|
2796
|
+
showMiniMap: h = !1,
|
|
2797
|
+
onBoxClick: g,
|
|
2798
|
+
onBoxHover: w,
|
|
2799
|
+
children: m,
|
|
2800
|
+
style: x
|
|
2226
2801
|
}) {
|
|
2227
|
-
const
|
|
2228
|
-
|
|
2229
|
-
}, []),
|
|
2230
|
-
width:
|
|
2231
|
-
height: le(e) *
|
|
2232
|
-
depth:
|
|
2233
|
-
} : { width: 1.2, height: 1, depth: 0.8 }, [
|
|
2234
|
-
const
|
|
2235
|
-
return [
|
|
2236
|
-
}, [
|
|
2237
|
-
const
|
|
2238
|
-
|
|
2802
|
+
const u = U.MM_TO_M, d = e.floors[0]?.pallet, [b, j] = ae({ x: 0, z: 0 }), _ = q((v) => {
|
|
2803
|
+
j({ x: v.x, z: v.z });
|
|
2804
|
+
}, []), S = k(() => d ? {
|
|
2805
|
+
width: d.dimensions.width * u,
|
|
2806
|
+
height: le(e) * u,
|
|
2807
|
+
depth: d.dimensions.depth * u
|
|
2808
|
+
} : { width: 1.2, height: 1, depth: 0.8 }, [d, e, u]), C = k(() => {
|
|
2809
|
+
const v = d ? d.dimensions.width * u / 2 : 0, M = d ? d.dimensions.depth * u / 2 : 0, E = S.height / 2;
|
|
2810
|
+
return [v, E, M];
|
|
2811
|
+
}, [d, u, S.height]), z = k(() => {
|
|
2812
|
+
const M = Math.sqrt(
|
|
2813
|
+
S.width ** 2 + S.height ** 2 + S.depth ** 2
|
|
2239
2814
|
) * 3.5;
|
|
2240
2815
|
return [
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2816
|
+
C[0] + M * 0.7,
|
|
2817
|
+
C[1] + M * 0.6,
|
|
2818
|
+
C[2] + M * 0.7
|
|
2244
2819
|
];
|
|
2245
|
-
}, [
|
|
2246
|
-
if (!
|
|
2247
|
-
const
|
|
2248
|
-
for (let A = 0; A <=
|
|
2249
|
-
|
|
2250
|
-
for (let A = 0; A <=
|
|
2251
|
-
|
|
2252
|
-
const
|
|
2253
|
-
return
|
|
2254
|
-
}, [
|
|
2255
|
-
return /* @__PURE__ */
|
|
2256
|
-
/* @__PURE__ */
|
|
2257
|
-
|
|
2820
|
+
}, [C, S]), y = k(() => {
|
|
2821
|
+
if (!p || !d) return null;
|
|
2822
|
+
const v = d.dimensions.width * u, M = d.dimensions.depth * u, E = 0.2, T = 1e-3, I = [];
|
|
2823
|
+
for (let A = 0; A <= v; A += E)
|
|
2824
|
+
I.push(A, T, 0, A, T, M);
|
|
2825
|
+
for (let A = 0; A <= M; A += E)
|
|
2826
|
+
I.push(0, T, A, v, T, A);
|
|
2827
|
+
const R = new B.BufferGeometry();
|
|
2828
|
+
return R.setAttribute("position", new B.Float32BufferAttribute(I, 3)), R;
|
|
2829
|
+
}, [p, d, u]);
|
|
2830
|
+
return /* @__PURE__ */ r.jsxs("div", { style: { position: "relative", width: "100%", height: "100%" }, children: [
|
|
2831
|
+
/* @__PURE__ */ r.jsx(
|
|
2832
|
+
fe,
|
|
2258
2833
|
{
|
|
2259
2834
|
shadows: !0,
|
|
2260
2835
|
camera: {
|
|
2261
|
-
position:
|
|
2836
|
+
position: z,
|
|
2262
2837
|
fov: 45,
|
|
2263
2838
|
near: 0.01,
|
|
2264
2839
|
far: 100
|
|
2265
2840
|
},
|
|
2266
|
-
style: { width: "100%", height: "100%", ...
|
|
2267
|
-
children: /* @__PURE__ */
|
|
2268
|
-
/* @__PURE__ */
|
|
2269
|
-
/* @__PURE__ */
|
|
2841
|
+
style: { width: "100%", height: "100%", ...x },
|
|
2842
|
+
children: /* @__PURE__ */ r.jsxs(we, { preset: t, children: [
|
|
2843
|
+
/* @__PURE__ */ r.jsx("ambientLight", { intensity: 0.4 }),
|
|
2844
|
+
/* @__PURE__ */ r.jsx(
|
|
2270
2845
|
"directionalLight",
|
|
2271
2846
|
{
|
|
2272
2847
|
position: [5, 8, 5],
|
|
@@ -2276,26 +2851,26 @@ const Yt = V(function({
|
|
|
2276
2851
|
"shadow-mapSize-height": 1024
|
|
2277
2852
|
}
|
|
2278
2853
|
),
|
|
2279
|
-
/* @__PURE__ */
|
|
2280
|
-
/* @__PURE__ */
|
|
2281
|
-
|
|
2854
|
+
/* @__PURE__ */ r.jsx("hemisphereLight", { intensity: 0.3, color: "#ffffff", groundColor: "#444444" }),
|
|
2855
|
+
/* @__PURE__ */ r.jsx(
|
|
2856
|
+
Se,
|
|
2282
2857
|
{
|
|
2283
|
-
preset:
|
|
2284
|
-
target:
|
|
2285
|
-
sceneSize:
|
|
2858
|
+
preset: l,
|
|
2859
|
+
target: C,
|
|
2860
|
+
sceneSize: S,
|
|
2286
2861
|
minDistance: 0.3,
|
|
2287
|
-
maxDistance: Math.max(
|
|
2862
|
+
maxDistance: Math.max(S.width, S.height, S.depth) * 4
|
|
2288
2863
|
}
|
|
2289
2864
|
),
|
|
2290
|
-
/* @__PURE__ */
|
|
2291
|
-
/* @__PURE__ */
|
|
2292
|
-
/* @__PURE__ */
|
|
2293
|
-
|
|
2294
|
-
|
|
2865
|
+
/* @__PURE__ */ r.jsx(Me, { onPositionChange: _ }),
|
|
2866
|
+
/* @__PURE__ */ r.jsxs("mesh", { rotation: [-Math.PI / 2, 0, 0], position: [C[0], -2e-3, C[2]], receiveShadow: !0, children: [
|
|
2867
|
+
/* @__PURE__ */ r.jsx("planeGeometry", { args: [
|
|
2868
|
+
d ? d.dimensions.width * u * 1.5 : 3,
|
|
2869
|
+
d ? d.dimensions.depth * u * 1.5 : 3
|
|
2295
2870
|
] }),
|
|
2296
|
-
/* @__PURE__ */
|
|
2871
|
+
/* @__PURE__ */ r.jsx("meshStandardMaterial", { color: "#e0e0e0", roughness: 0.9 })
|
|
2297
2872
|
] }),
|
|
2298
|
-
|
|
2873
|
+
p && y && /* @__PURE__ */ r.jsx("lineSegments", { geometry: y, children: /* @__PURE__ */ r.jsx(
|
|
2299
2874
|
"lineBasicMaterial",
|
|
2300
2875
|
{
|
|
2301
2876
|
color: "#aaaaaa",
|
|
@@ -2304,135 +2879,135 @@ const Yt = V(function({
|
|
|
2304
2879
|
depthWrite: !1
|
|
2305
2880
|
}
|
|
2306
2881
|
) }),
|
|
2307
|
-
/* @__PURE__ */
|
|
2882
|
+
/* @__PURE__ */ r.jsx(
|
|
2308
2883
|
be,
|
|
2309
2884
|
{
|
|
2310
2885
|
stackedPallet: e,
|
|
2311
2886
|
selectedBoxId: i,
|
|
2312
|
-
highlightedBoxId:
|
|
2313
|
-
selectedColor:
|
|
2887
|
+
highlightedBoxId: s,
|
|
2888
|
+
selectedColor: n,
|
|
2314
2889
|
highlightedColor: a,
|
|
2315
|
-
showLabels:
|
|
2316
|
-
onBoxClick:
|
|
2317
|
-
onBoxHover:
|
|
2890
|
+
showLabels: c,
|
|
2891
|
+
onBoxClick: g,
|
|
2892
|
+
onBoxHover: w
|
|
2318
2893
|
}
|
|
2319
2894
|
),
|
|
2320
|
-
|
|
2895
|
+
m
|
|
2321
2896
|
] })
|
|
2322
2897
|
}
|
|
2323
2898
|
),
|
|
2324
|
-
|
|
2325
|
-
|
|
2899
|
+
h && d && /* @__PURE__ */ r.jsx(
|
|
2900
|
+
je,
|
|
2326
2901
|
{
|
|
2327
|
-
sceneWidth:
|
|
2328
|
-
sceneDepth:
|
|
2902
|
+
sceneWidth: S.width,
|
|
2903
|
+
sceneDepth: S.depth,
|
|
2329
2904
|
sceneType: "truck",
|
|
2330
|
-
cameraPosition:
|
|
2331
|
-
targetPosition: { x:
|
|
2905
|
+
cameraPosition: b,
|
|
2906
|
+
targetPosition: { x: C[0], z: C[2] },
|
|
2332
2907
|
position: "bottom-left"
|
|
2333
2908
|
}
|
|
2334
2909
|
)
|
|
2335
2910
|
] });
|
|
2336
|
-
}),
|
|
2911
|
+
}), Yt = V(function({
|
|
2337
2912
|
truck: e,
|
|
2338
2913
|
preset: t,
|
|
2339
2914
|
selectedBoxId: i,
|
|
2340
|
-
highlightedBoxId:
|
|
2341
|
-
selectedColor:
|
|
2915
|
+
highlightedBoxId: s,
|
|
2916
|
+
selectedColor: n,
|
|
2342
2917
|
highlightedColor: a,
|
|
2343
|
-
showLabels:
|
|
2344
|
-
showGrid:
|
|
2345
|
-
wallOpacity:
|
|
2346
|
-
showRoof:
|
|
2347
|
-
showSideWalls:
|
|
2348
|
-
cameraPreset:
|
|
2349
|
-
showMiniMap:
|
|
2350
|
-
onBoxClick:
|
|
2351
|
-
onBoxHover:
|
|
2352
|
-
children:
|
|
2353
|
-
style:
|
|
2918
|
+
showLabels: c = !1,
|
|
2919
|
+
showGrid: l,
|
|
2920
|
+
wallOpacity: p = 0.3,
|
|
2921
|
+
showRoof: h = !1,
|
|
2922
|
+
showSideWalls: g = !0,
|
|
2923
|
+
cameraPreset: w = "perspective",
|
|
2924
|
+
showMiniMap: m = !1,
|
|
2925
|
+
onBoxClick: x,
|
|
2926
|
+
onBoxHover: u,
|
|
2927
|
+
children: d,
|
|
2928
|
+
style: b
|
|
2354
2929
|
}) {
|
|
2355
|
-
const [
|
|
2356
|
-
|
|
2357
|
-
}, []),
|
|
2358
|
-
() => [
|
|
2359
|
-
[
|
|
2930
|
+
const [j, _] = ae({ x: 0, z: 0 }), S = q((R) => {
|
|
2931
|
+
_({ x: R.x, z: R.z });
|
|
2932
|
+
}, []), C = U.MM_TO_M, z = e.dimensions.width * C, y = e.dimensions.height * C, v = e.dimensions.depth * C, M = k(
|
|
2933
|
+
() => [z / 2, y / 2, v / 2],
|
|
2934
|
+
[z, y, v]
|
|
2360
2935
|
), E = k(
|
|
2361
|
-
() => ({ width:
|
|
2362
|
-
[
|
|
2363
|
-
),
|
|
2364
|
-
const A = tt(
|
|
2936
|
+
() => ({ width: z, height: y, depth: v }),
|
|
2937
|
+
[z, y, v]
|
|
2938
|
+
), T = k(() => [z * 0.8, y * 1.2, v * 0.4], [z, y, v]), I = k(() => e.pallets.filter((R) => {
|
|
2939
|
+
const A = tt(R, e);
|
|
2365
2940
|
return A.isValid ? !0 : (console.error(
|
|
2366
|
-
`[TruckScene] Palet "${
|
|
2941
|
+
`[TruckScene] Palet "${R.id}" fuera de los límites del camión.`,
|
|
2367
2942
|
"Violaciones:",
|
|
2368
2943
|
A.violations
|
|
2369
2944
|
), !1);
|
|
2370
2945
|
}), [e]);
|
|
2371
|
-
return /* @__PURE__ */
|
|
2372
|
-
/* @__PURE__ */
|
|
2373
|
-
|
|
2946
|
+
return /* @__PURE__ */ r.jsxs("div", { style: { position: "relative", width: "100%", height: "100%" }, children: [
|
|
2947
|
+
/* @__PURE__ */ r.jsx(
|
|
2948
|
+
fe,
|
|
2374
2949
|
{
|
|
2375
2950
|
shadows: !0,
|
|
2376
2951
|
camera: {
|
|
2377
|
-
position:
|
|
2952
|
+
position: T,
|
|
2378
2953
|
fov: 45,
|
|
2379
2954
|
near: 0.01,
|
|
2380
2955
|
far: 200
|
|
2381
2956
|
},
|
|
2382
|
-
style: { width: "100%", height: "100%", ...
|
|
2383
|
-
children: /* @__PURE__ */
|
|
2384
|
-
/* @__PURE__ */
|
|
2385
|
-
|
|
2957
|
+
style: { width: "100%", height: "100%", ...b },
|
|
2958
|
+
children: /* @__PURE__ */ r.jsxs(we, { preset: t, children: [
|
|
2959
|
+
/* @__PURE__ */ r.jsx(
|
|
2960
|
+
Se,
|
|
2386
2961
|
{
|
|
2387
|
-
preset:
|
|
2388
|
-
target:
|
|
2962
|
+
preset: w,
|
|
2963
|
+
target: M,
|
|
2389
2964
|
sceneSize: E,
|
|
2390
|
-
maxDistance: Math.max(
|
|
2965
|
+
maxDistance: Math.max(z, y, v) * 3,
|
|
2391
2966
|
minDistance: 0.5
|
|
2392
2967
|
}
|
|
2393
2968
|
),
|
|
2394
|
-
/* @__PURE__ */
|
|
2395
|
-
/* @__PURE__ */
|
|
2969
|
+
/* @__PURE__ */ r.jsx(Me, { onPositionChange: S }),
|
|
2970
|
+
/* @__PURE__ */ r.jsxs(
|
|
2396
2971
|
Pt,
|
|
2397
2972
|
{
|
|
2398
2973
|
truck: e,
|
|
2399
|
-
showGrid:
|
|
2400
|
-
wallOpacity:
|
|
2401
|
-
showRoof:
|
|
2402
|
-
showSideWalls:
|
|
2974
|
+
showGrid: l,
|
|
2975
|
+
wallOpacity: p,
|
|
2976
|
+
showRoof: h,
|
|
2977
|
+
showSideWalls: g,
|
|
2403
2978
|
children: [
|
|
2404
|
-
|
|
2979
|
+
I.map((R) => /* @__PURE__ */ r.jsx(
|
|
2405
2980
|
be,
|
|
2406
2981
|
{
|
|
2407
|
-
stackedPallet:
|
|
2408
|
-
position:
|
|
2409
|
-
yRotation:
|
|
2410
|
-
palletId:
|
|
2982
|
+
stackedPallet: R.stackedPallet,
|
|
2983
|
+
position: R.position,
|
|
2984
|
+
yRotation: R.yRotation,
|
|
2985
|
+
palletId: R.id,
|
|
2411
2986
|
selectedBoxId: i,
|
|
2412
|
-
highlightedBoxId:
|
|
2413
|
-
selectedColor:
|
|
2987
|
+
highlightedBoxId: s,
|
|
2988
|
+
selectedColor: n,
|
|
2414
2989
|
highlightedColor: a,
|
|
2415
|
-
showLabels:
|
|
2416
|
-
onBoxClick:
|
|
2417
|
-
onBoxHover:
|
|
2990
|
+
showLabels: c,
|
|
2991
|
+
onBoxClick: x,
|
|
2992
|
+
onBoxHover: u
|
|
2418
2993
|
},
|
|
2419
|
-
|
|
2994
|
+
R.id
|
|
2420
2995
|
)),
|
|
2421
|
-
|
|
2996
|
+
d
|
|
2422
2997
|
]
|
|
2423
2998
|
}
|
|
2424
2999
|
)
|
|
2425
3000
|
] })
|
|
2426
3001
|
}
|
|
2427
3002
|
),
|
|
2428
|
-
|
|
2429
|
-
|
|
3003
|
+
m && /* @__PURE__ */ r.jsx(
|
|
3004
|
+
je,
|
|
2430
3005
|
{
|
|
2431
|
-
sceneWidth:
|
|
2432
|
-
sceneDepth:
|
|
3006
|
+
sceneWidth: z,
|
|
3007
|
+
sceneDepth: v,
|
|
2433
3008
|
sceneType: "truck",
|
|
2434
|
-
cameraPosition:
|
|
2435
|
-
targetPosition: { x:
|
|
3009
|
+
cameraPosition: j,
|
|
3010
|
+
targetPosition: { x: M[0], z: M[2] },
|
|
2436
3011
|
position: "bottom-left"
|
|
2437
3012
|
}
|
|
2438
3013
|
)
|
|
@@ -2441,68 +3016,68 @@ const Yt = V(function({
|
|
|
2441
3016
|
room: e,
|
|
2442
3017
|
preset: t,
|
|
2443
3018
|
selectedBoxId: i,
|
|
2444
|
-
highlightedBoxId:
|
|
2445
|
-
selectedColor:
|
|
3019
|
+
highlightedBoxId: s,
|
|
3020
|
+
selectedColor: n,
|
|
2446
3021
|
highlightedColor: a,
|
|
2447
|
-
showLabels:
|
|
2448
|
-
cameraPreset:
|
|
2449
|
-
showMiniMap:
|
|
2450
|
-
onBoxClick:
|
|
2451
|
-
onBoxHover:
|
|
2452
|
-
children:
|
|
2453
|
-
style:
|
|
3022
|
+
showLabels: c = !1,
|
|
3023
|
+
cameraPreset: l = "perspective",
|
|
3024
|
+
showMiniMap: p = !1,
|
|
3025
|
+
onBoxClick: h,
|
|
3026
|
+
onBoxHover: g,
|
|
3027
|
+
children: w,
|
|
3028
|
+
style: m
|
|
2454
3029
|
}) {
|
|
2455
|
-
const
|
|
2456
|
-
|
|
2457
|
-
}, []), { target:
|
|
3030
|
+
const x = U.MM_TO_M, [u, d] = ae({ x: 0, z: 0 }), b = q((y) => {
|
|
3031
|
+
d({ x: y.x, z: y.z });
|
|
3032
|
+
}, []), { target: j, sceneSize: _, initialCameraPosition: S } = k(() => {
|
|
2458
3033
|
const y = e.floorPolygon;
|
|
2459
|
-
let
|
|
2460
|
-
for (const
|
|
2461
|
-
|
|
2462
|
-
const
|
|
3034
|
+
let v = 1 / 0, M = -1 / 0, E = 1 / 0, T = -1 / 0;
|
|
3035
|
+
for (const P of y)
|
|
3036
|
+
v = Math.min(v, P.x * x), M = Math.max(M, P.x * x), E = Math.min(E, P.z * x), T = Math.max(T, P.z * x);
|
|
3037
|
+
const I = M - v, R = T - E, A = e.ceilingHeight * x, G = (v + M) / 2, D = (E + T) / 2, H = [G, A / 2, D], F = { width: I, height: A, depth: R }, J = Math.sqrt(I ** 2 + A ** 2 + R ** 2) * 0.8, f = [
|
|
2463
3038
|
G + J * 0.6,
|
|
2464
3039
|
A + J * 0.5,
|
|
2465
|
-
|
|
3040
|
+
D + J * 0.6
|
|
2466
3041
|
];
|
|
2467
3042
|
return {
|
|
2468
|
-
target:
|
|
3043
|
+
target: H,
|
|
2469
3044
|
sceneSize: F,
|
|
2470
|
-
initialCameraPosition:
|
|
3045
|
+
initialCameraPosition: f
|
|
2471
3046
|
};
|
|
2472
|
-
}, [e.floorPolygon, e.ceilingHeight,
|
|
2473
|
-
const
|
|
2474
|
-
return
|
|
3047
|
+
}, [e.floorPolygon, e.ceilingHeight, x]), C = k(() => e.floorPolygon.map((y) => ({ x: y.x * x, z: y.z * x })), [e.floorPolygon, x]), z = k(() => e.pallets.filter((y) => {
|
|
3048
|
+
const v = We(y, e);
|
|
3049
|
+
return v.isValid ? !0 : (console.error(
|
|
2475
3050
|
`[WarehouseScene] Palet "${y.id}" fuera de los límites de la estancia "${e.name}".`,
|
|
2476
3051
|
"Violaciones:",
|
|
2477
|
-
|
|
3052
|
+
v.violations
|
|
2478
3053
|
), !1);
|
|
2479
3054
|
}), [e]);
|
|
2480
|
-
return /* @__PURE__ */
|
|
2481
|
-
/* @__PURE__ */
|
|
2482
|
-
|
|
3055
|
+
return /* @__PURE__ */ r.jsxs("div", { style: { position: "relative", width: "100%", height: "100%" }, children: [
|
|
3056
|
+
/* @__PURE__ */ r.jsx(
|
|
3057
|
+
fe,
|
|
2483
3058
|
{
|
|
2484
3059
|
shadows: !0,
|
|
2485
3060
|
camera: {
|
|
2486
|
-
position:
|
|
3061
|
+
position: S,
|
|
2487
3062
|
fov: 45,
|
|
2488
3063
|
near: 0.01,
|
|
2489
3064
|
far: 300
|
|
2490
3065
|
},
|
|
2491
|
-
style: { width: "100%", height: "100%", ...
|
|
2492
|
-
children: /* @__PURE__ */
|
|
2493
|
-
/* @__PURE__ */
|
|
2494
|
-
|
|
3066
|
+
style: { width: "100%", height: "100%", ...m },
|
|
3067
|
+
children: /* @__PURE__ */ r.jsxs(we, { preset: t, children: [
|
|
3068
|
+
/* @__PURE__ */ r.jsx(
|
|
3069
|
+
Se,
|
|
2495
3070
|
{
|
|
2496
|
-
preset:
|
|
2497
|
-
target:
|
|
2498
|
-
sceneSize:
|
|
2499
|
-
maxDistance: Math.max(
|
|
3071
|
+
preset: l,
|
|
3072
|
+
target: j,
|
|
3073
|
+
sceneSize: _,
|
|
3074
|
+
maxDistance: Math.max(_.width, _.height, _.depth) * 4,
|
|
2500
3075
|
minDistance: 0.5
|
|
2501
3076
|
}
|
|
2502
3077
|
),
|
|
2503
|
-
/* @__PURE__ */
|
|
2504
|
-
/* @__PURE__ */
|
|
2505
|
-
|
|
3078
|
+
/* @__PURE__ */ r.jsx(Me, { onPositionChange: b }),
|
|
3079
|
+
/* @__PURE__ */ r.jsxs(Ct, { room: e, children: [
|
|
3080
|
+
z.map((y) => /* @__PURE__ */ r.jsx(
|
|
2506
3081
|
be,
|
|
2507
3082
|
{
|
|
2508
3083
|
stackedPallet: y.stackedPallet,
|
|
@@ -2510,29 +3085,29 @@ const Yt = V(function({
|
|
|
2510
3085
|
yRotation: y.yRotation,
|
|
2511
3086
|
palletId: y.id,
|
|
2512
3087
|
selectedBoxId: i,
|
|
2513
|
-
highlightedBoxId:
|
|
2514
|
-
selectedColor:
|
|
3088
|
+
highlightedBoxId: s,
|
|
3089
|
+
selectedColor: n,
|
|
2515
3090
|
highlightedColor: a,
|
|
2516
|
-
showLabels:
|
|
2517
|
-
onBoxClick:
|
|
2518
|
-
onBoxHover:
|
|
3091
|
+
showLabels: c,
|
|
3092
|
+
onBoxClick: h,
|
|
3093
|
+
onBoxHover: g
|
|
2519
3094
|
},
|
|
2520
3095
|
y.id
|
|
2521
3096
|
)),
|
|
2522
|
-
|
|
3097
|
+
w
|
|
2523
3098
|
] })
|
|
2524
3099
|
] })
|
|
2525
3100
|
}
|
|
2526
3101
|
),
|
|
2527
|
-
|
|
2528
|
-
|
|
3102
|
+
p && /* @__PURE__ */ r.jsx(
|
|
3103
|
+
je,
|
|
2529
3104
|
{
|
|
2530
|
-
sceneWidth:
|
|
2531
|
-
sceneDepth:
|
|
3105
|
+
sceneWidth: _.width,
|
|
3106
|
+
sceneDepth: _.depth,
|
|
2532
3107
|
sceneType: "warehouse",
|
|
2533
|
-
floorPolygon:
|
|
2534
|
-
cameraPosition:
|
|
2535
|
-
targetPosition: { x:
|
|
3108
|
+
floorPolygon: C,
|
|
3109
|
+
cameraPosition: u,
|
|
3110
|
+
targetPosition: { x: j[0], z: j[2] },
|
|
2536
3111
|
position: "bottom-left"
|
|
2537
3112
|
}
|
|
2538
3113
|
)
|
|
@@ -2540,51 +3115,51 @@ const Yt = V(function({
|
|
|
2540
3115
|
});
|
|
2541
3116
|
export {
|
|
2542
3117
|
ut as BinPacking3DStrategy,
|
|
2543
|
-
|
|
3118
|
+
St as BoxComponent,
|
|
2544
3119
|
ge as BoxFactory,
|
|
2545
|
-
|
|
2546
|
-
|
|
3120
|
+
De as COLLISION_TOLERANCE,
|
|
3121
|
+
Se as CameraControlsComponent,
|
|
2547
3122
|
mt as ColumnStrategy,
|
|
2548
3123
|
xe as DEFAULT_PRESET,
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
3124
|
+
Ut as Label,
|
|
3125
|
+
ze as MIN_SUPPORT_PERCENTAGE,
|
|
3126
|
+
Oe as PRESET_INDUSTRIAL,
|
|
3127
|
+
Ne as PRESET_UNSTYLED,
|
|
3128
|
+
pt as PackingRegistry,
|
|
2554
3129
|
jt as PalletComponent,
|
|
2555
3130
|
Z as PalletFactory,
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
3131
|
+
N as PalletMaterial,
|
|
3132
|
+
Ht as PalletScene,
|
|
3133
|
+
we as PresetProvider,
|
|
3134
|
+
Ue as SCENE_PRESETS,
|
|
3135
|
+
It as SEPARATOR_DEFAULTS,
|
|
2561
3136
|
ue as STANDARD_PALLETS,
|
|
2562
|
-
|
|
3137
|
+
zt as SeparatorComponent,
|
|
2563
3138
|
me as SeparatorMaterial,
|
|
2564
3139
|
be as StackedPalletComponent,
|
|
2565
3140
|
Ze as TRUCK_PRESETS,
|
|
2566
3141
|
Pt as TruckEnvironment,
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
3142
|
+
Vt as TruckFactory,
|
|
3143
|
+
Yt as TruckScene,
|
|
3144
|
+
oe as TruckType,
|
|
2570
3145
|
xt as TypeGroupStrategy,
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
3146
|
+
U as UNITS,
|
|
3147
|
+
Ie as WEIGHT_WARNING_THRESHOLD,
|
|
3148
|
+
Ct as WarehouseEnvironment,
|
|
2574
3149
|
Ft as WarehouseScene,
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
3150
|
+
ve as aabbIntersects,
|
|
3151
|
+
Y as calculateCenterOfGravity,
|
|
3152
|
+
ee as calculateStabilityScore,
|
|
2578
3153
|
ft as defaultRegistry,
|
|
2579
3154
|
qe as ensureUniqueBoxIds,
|
|
2580
|
-
|
|
2581
|
-
|
|
3155
|
+
L as getBoxBoundingBox,
|
|
3156
|
+
se as getPalletBoundingBox,
|
|
2582
3157
|
le as getStackedPalletTotalHeight,
|
|
2583
|
-
|
|
3158
|
+
ye as getStackedPalletTotalWeight,
|
|
2584
3159
|
ht as pointInPolygon,
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
3160
|
+
Dt as usePackingStrategy,
|
|
3161
|
+
Zt as usePalletMetrics,
|
|
3162
|
+
Xt as usePhysicsValidation,
|
|
2588
3163
|
ce as usePreset,
|
|
2589
3164
|
Nt as useWarehouseValidation,
|
|
2590
3165
|
et as validateAllBoxesInPalletBounds,
|
|
@@ -2599,13 +3174,13 @@ export {
|
|
|
2599
3174
|
We as validatePalletInRoom,
|
|
2600
3175
|
tt as validatePalletInTruck,
|
|
2601
3176
|
it as validatePalletWeight,
|
|
2602
|
-
|
|
3177
|
+
$t as validateSeparators,
|
|
2603
3178
|
dt as validateStability,
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
3179
|
+
Wt as validateStackDimensions,
|
|
3180
|
+
Lt as validateStackHeight,
|
|
3181
|
+
Gt as validateStackWeight,
|
|
2607
3182
|
ct as validateSupport,
|
|
2608
|
-
|
|
3183
|
+
Bt as validateTruckWeight,
|
|
2609
3184
|
nt as validateWeightDistribution
|
|
2610
3185
|
};
|
|
2611
3186
|
//# sourceMappingURL=pallet-builder.js.map
|