@cristiancosano/pallet-builder 0.1.3 → 0.1.5
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/components/primitives/Box/Box.d.ts +1 -1
- package/dist/core/packing/MultiPalletBuilder.d.ts +17 -0
- package/dist/core/packing/index.d.ts +6 -6
- package/dist/examples/store/useExampleStore.d.ts +10 -10
- package/dist/lib.d.ts +59 -56
- package/dist/pallet-builder.js +749 -687
- package/dist/pallet-builder.js.map +1 -1
- package/package.json +1 -1
package/dist/pallet-builder.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import Le, { createContext as Ge, useContext as Ve, useMemo as
|
|
2
|
-
import { Html as
|
|
1
|
+
import Le, { createContext as Ge, useContext as Ve, useMemo as _, useCallback as q, memo as V, useRef as Ee, useEffect as pe, useState as ce } from "react";
|
|
2
|
+
import { Edges as Xe, Html as _e, OrbitControls as De } from "@react-three/drei";
|
|
3
3
|
import * as B from "three";
|
|
4
4
|
import { useThree as Ae, Canvas as fe } from "@react-three/fiber";
|
|
5
5
|
const N = {
|
|
@@ -7,7 +7,7 @@ const N = {
|
|
|
7
7
|
PLASTIC: "PLASTIC",
|
|
8
8
|
METAL: "METAL",
|
|
9
9
|
COMPOSITE: "COMPOSITE"
|
|
10
|
-
},
|
|
10
|
+
}, ae = {
|
|
11
11
|
CARDBOARD: "CARDBOARD",
|
|
12
12
|
WOOD: "WOOD",
|
|
13
13
|
PLASTIC: "PLASTIC"
|
|
@@ -109,7 +109,7 @@ const Ze = {
|
|
|
109
109
|
dimensions: { width: 2480, height: 2700, depth: 13600 },
|
|
110
110
|
maxWeight: 24e3
|
|
111
111
|
}
|
|
112
|
-
},
|
|
112
|
+
}, Ot = {
|
|
113
113
|
thickness: 10,
|
|
114
114
|
// mm
|
|
115
115
|
weight: 2
|
|
@@ -117,7 +117,7 @@ const Ze = {
|
|
|
117
117
|
}, U = {
|
|
118
118
|
MM_TO_M: 1e-3,
|
|
119
119
|
M_TO_MM: 1e3
|
|
120
|
-
},
|
|
120
|
+
}, Ne = 1, ze = 0.6, Ie = 0.9, Ue = {
|
|
121
121
|
id: "unstyled",
|
|
122
122
|
name: "Sin estilo",
|
|
123
123
|
box: {
|
|
@@ -207,13 +207,13 @@ const Ze = {
|
|
|
207
207
|
chassisColor: "#1e1e1e",
|
|
208
208
|
wheelColor: "#111111"
|
|
209
209
|
}
|
|
210
|
-
},
|
|
211
|
-
unstyled:
|
|
210
|
+
}, He = {
|
|
211
|
+
unstyled: Ue,
|
|
212
212
|
industrial: Oe
|
|
213
213
|
}, xe = Oe;
|
|
214
214
|
var re = { exports: {} }, te = {};
|
|
215
215
|
var Ce;
|
|
216
|
-
function
|
|
216
|
+
function Ye() {
|
|
217
217
|
if (Ce) return te;
|
|
218
218
|
Ce = 1;
|
|
219
219
|
var o = /* @__PURE__ */ Symbol.for("react.transitional.element"), e = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
@@ -221,8 +221,8 @@ function He() {
|
|
|
221
221
|
var a = null;
|
|
222
222
|
if (n !== void 0 && (a = "" + n), s.key !== void 0 && (a = "" + s.key), "key" in s) {
|
|
223
223
|
n = {};
|
|
224
|
-
for (var
|
|
225
|
-
|
|
224
|
+
for (var l in s)
|
|
225
|
+
l !== "key" && (n[l] = s[l]);
|
|
226
226
|
} else n = s;
|
|
227
227
|
return s = n.ref, {
|
|
228
228
|
$$typeof: o,
|
|
@@ -236,12 +236,12 @@ function He() {
|
|
|
236
236
|
}
|
|
237
237
|
var ie = {};
|
|
238
238
|
var Pe;
|
|
239
|
-
function
|
|
239
|
+
function Fe() {
|
|
240
240
|
return Pe || (Pe = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
241
241
|
function o(f) {
|
|
242
242
|
if (f == null) return null;
|
|
243
243
|
if (typeof f == "function")
|
|
244
|
-
return f.$$typeof ===
|
|
244
|
+
return f.$$typeof === k ? null : f.displayName || f.name || null;
|
|
245
245
|
if (typeof f == "string") return f;
|
|
246
246
|
switch (f) {
|
|
247
247
|
case d:
|
|
@@ -265,7 +265,7 @@ function Ye() {
|
|
|
265
265
|
return "Portal";
|
|
266
266
|
case S:
|
|
267
267
|
return f.displayName || "Context";
|
|
268
|
-
case
|
|
268
|
+
case T:
|
|
269
269
|
return (f._context.displayName || "Context") + ".Consumer";
|
|
270
270
|
case C:
|
|
271
271
|
var P = f.render;
|
|
@@ -293,11 +293,11 @@ function Ye() {
|
|
|
293
293
|
}
|
|
294
294
|
if (P) {
|
|
295
295
|
P = console;
|
|
296
|
-
var O = P.error,
|
|
296
|
+
var O = P.error, $ = typeof Symbol == "function" && Symbol.toStringTag && f[Symbol.toStringTag] || f.constructor.name || "Object";
|
|
297
297
|
return O.call(
|
|
298
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
|
+
$
|
|
301
301
|
), e(f);
|
|
302
302
|
}
|
|
303
303
|
}
|
|
@@ -326,9 +326,9 @@ function Ye() {
|
|
|
326
326
|
}
|
|
327
327
|
return f.key !== void 0;
|
|
328
328
|
}
|
|
329
|
-
function
|
|
329
|
+
function l(f, P) {
|
|
330
330
|
function O() {
|
|
331
|
-
|
|
331
|
+
Z || (Z = !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
|
));
|
|
@@ -338,23 +338,23 @@ function Ye() {
|
|
|
338
338
|
configurable: !0
|
|
339
339
|
});
|
|
340
340
|
}
|
|
341
|
-
function
|
|
341
|
+
function c() {
|
|
342
342
|
var f = o(this.type);
|
|
343
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
|
|
347
|
+
function g(f, P, O, $, ne, he) {
|
|
348
|
+
var W = O.ref;
|
|
349
349
|
return f = {
|
|
350
350
|
$$typeof: x,
|
|
351
351
|
type: f,
|
|
352
352
|
key: P,
|
|
353
353
|
props: O,
|
|
354
|
-
_owner:
|
|
355
|
-
}, (
|
|
354
|
+
_owner: $
|
|
355
|
+
}, (W !== void 0 ? W : null) !== null ? Object.defineProperty(f, "ref", {
|
|
356
356
|
enumerable: !1,
|
|
357
|
-
get:
|
|
357
|
+
get: c
|
|
358
358
|
}) : Object.defineProperty(f, "ref", { enumerable: !1, value: null }), f._store = {}, Object.defineProperty(f._store, "validated", {
|
|
359
359
|
configurable: !1,
|
|
360
360
|
enumerable: !1,
|
|
@@ -374,112 +374,112 @@ function Ye() {
|
|
|
374
374
|
configurable: !1,
|
|
375
375
|
enumerable: !1,
|
|
376
376
|
writable: !0,
|
|
377
|
-
value:
|
|
377
|
+
value: he
|
|
378
378
|
}), Object.freeze && (Object.freeze(f.props), Object.freeze(f)), f;
|
|
379
379
|
}
|
|
380
|
-
function
|
|
381
|
-
var
|
|
382
|
-
if (
|
|
383
|
-
if (
|
|
384
|
-
if (A(
|
|
385
|
-
for (
|
|
386
|
-
|
|
387
|
-
Object.freeze && Object.freeze(
|
|
380
|
+
function m(f, P, O, $, ne, he) {
|
|
381
|
+
var W = P.children;
|
|
382
|
+
if (W !== void 0)
|
|
383
|
+
if ($)
|
|
384
|
+
if (A(W)) {
|
|
385
|
+
for ($ = 0; $ < W.length; $++)
|
|
386
|
+
p(W[$]);
|
|
387
|
+
Object.freeze && Object.freeze(W);
|
|
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
|
|
392
|
+
else p(W);
|
|
393
393
|
if (R.call(P, "key")) {
|
|
394
|
-
|
|
395
|
-
var Q = Object.keys(P).filter(function(
|
|
396
|
-
return
|
|
394
|
+
W = o(f);
|
|
395
|
+
var Q = Object.keys(P).filter(function(We) {
|
|
396
|
+
return We !== "key";
|
|
397
397
|
});
|
|
398
|
-
|
|
398
|
+
$ = 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} />
|
|
402
402
|
React keys must be passed directly to JSX without using spread:
|
|
403
403
|
let props = %s;
|
|
404
404
|
<%s key={someKey} {...props} />`,
|
|
405
|
-
W,
|
|
406
405
|
$,
|
|
406
|
+
W,
|
|
407
407
|
Q,
|
|
408
|
-
|
|
409
|
-
), J[
|
|
408
|
+
W
|
|
409
|
+
), J[W + $] = !0);
|
|
410
410
|
}
|
|
411
|
-
if (
|
|
411
|
+
if (W = null, O !== void 0 && (t(O), W = "" + O), a(P) && (t(P.key), W = "" + P.key), "key" in P) {
|
|
412
412
|
O = {};
|
|
413
|
-
for (var
|
|
414
|
-
|
|
413
|
+
for (var me in P)
|
|
414
|
+
me !== "key" && (O[me] = P[me]);
|
|
415
415
|
} else O = P;
|
|
416
|
-
return
|
|
416
|
+
return W && l(
|
|
417
417
|
O,
|
|
418
418
|
typeof f == "function" ? f.displayName || f.name || "Unknown" : f
|
|
419
|
-
),
|
|
419
|
+
), g(
|
|
420
420
|
f,
|
|
421
|
-
|
|
421
|
+
W,
|
|
422
422
|
O,
|
|
423
423
|
s(),
|
|
424
424
|
ne,
|
|
425
|
-
|
|
425
|
+
he
|
|
426
426
|
);
|
|
427
427
|
}
|
|
428
|
-
function
|
|
428
|
+
function p(f) {
|
|
429
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
431
|
function w(f) {
|
|
432
432
|
return typeof f == "object" && f !== null && f.$$typeof === x;
|
|
433
433
|
}
|
|
434
|
-
var
|
|
434
|
+
var h = 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"), T = /* @__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"), k = /* @__PURE__ */ Symbol.for("react.client.reference"), I = h.__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
|
-
|
|
437
|
+
h = {
|
|
438
438
|
react_stack_bottom_frame: function(f) {
|
|
439
439
|
return f();
|
|
440
440
|
}
|
|
441
441
|
};
|
|
442
|
-
var
|
|
443
|
-
|
|
442
|
+
var Z, H = {}, F = h.react_stack_bottom_frame.bind(
|
|
443
|
+
h,
|
|
444
444
|
n
|
|
445
445
|
)(), X = G(i(n)), J = {};
|
|
446
446
|
ie.Fragment = d, ie.jsx = function(f, P, O) {
|
|
447
|
-
var
|
|
448
|
-
return
|
|
447
|
+
var $ = 1e4 > I.recentlyCreatedOwnerStacks++;
|
|
448
|
+
return m(
|
|
449
449
|
f,
|
|
450
450
|
P,
|
|
451
451
|
O,
|
|
452
452
|
!1,
|
|
453
|
-
|
|
454
|
-
|
|
453
|
+
$ ? Error("react-stack-top-frame") : F,
|
|
454
|
+
$ ? G(i(f)) : X
|
|
455
455
|
);
|
|
456
456
|
}, ie.jsxs = function(f, P, O) {
|
|
457
|
-
var
|
|
458
|
-
return
|
|
457
|
+
var $ = 1e4 > I.recentlyCreatedOwnerStacks++;
|
|
458
|
+
return m(
|
|
459
459
|
f,
|
|
460
460
|
P,
|
|
461
461
|
O,
|
|
462
462
|
!0,
|
|
463
|
-
|
|
464
|
-
|
|
463
|
+
$ ? Error("react-stack-top-frame") : F,
|
|
464
|
+
$ ? G(i(f)) : X
|
|
465
465
|
);
|
|
466
466
|
};
|
|
467
467
|
})()), ie;
|
|
468
468
|
}
|
|
469
469
|
var Re;
|
|
470
|
-
function
|
|
471
|
-
return Re || (Re = 1, process.env.NODE_ENV === "production" ? re.exports =
|
|
470
|
+
function qe() {
|
|
471
|
+
return Re || (Re = 1, process.env.NODE_ENV === "production" ? re.exports = Ye() : re.exports = Fe()), re.exports;
|
|
472
472
|
}
|
|
473
|
-
var r =
|
|
473
|
+
var r = qe();
|
|
474
474
|
const Be = Ge(xe);
|
|
475
475
|
function we({ preset: o, children: e }) {
|
|
476
|
-
const t =
|
|
476
|
+
const t = _(() => o ? typeof o == "string" ? He[o] ?? xe : o : xe, [o]);
|
|
477
477
|
return /* @__PURE__ */ r.jsx(Be.Provider, { value: t, children: e });
|
|
478
478
|
}
|
|
479
|
-
function
|
|
479
|
+
function le() {
|
|
480
480
|
return Ve(Be);
|
|
481
481
|
}
|
|
482
|
-
function
|
|
482
|
+
function de(o) {
|
|
483
483
|
let e = 0;
|
|
484
484
|
for (const t of o.floors) {
|
|
485
485
|
e += t.pallet.dimensions.height;
|
|
@@ -497,18 +497,18 @@ function ye(o) {
|
|
|
497
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
|
-
function
|
|
500
|
+
function Je(o, e) {
|
|
501
501
|
const t = e || o.id, i = o.floors.map((s, n) => {
|
|
502
|
-
const a = s.boxes.map((
|
|
503
|
-
const
|
|
504
|
-
const
|
|
505
|
-
return
|
|
502
|
+
const a = s.boxes.map((l, c) => {
|
|
503
|
+
const g = `${t}:f${n}:b${c}`, m = (p) => p.map((w) => {
|
|
504
|
+
const h = s.boxes.findIndex((x) => x.id === w);
|
|
505
|
+
return h >= 0 ? `${t}:f${n}:b${h}` : w;
|
|
506
506
|
});
|
|
507
507
|
return {
|
|
508
|
-
...
|
|
509
|
-
id:
|
|
510
|
-
supportedBy:
|
|
511
|
-
supporting:
|
|
508
|
+
...l,
|
|
509
|
+
id: g,
|
|
510
|
+
supportedBy: m(l.supportedBy),
|
|
511
|
+
supporting: m(l.supporting)
|
|
512
512
|
};
|
|
513
513
|
});
|
|
514
514
|
return {
|
|
@@ -534,28 +534,28 @@ function L(o) {
|
|
|
534
534
|
};
|
|
535
535
|
}
|
|
536
536
|
function se(o) {
|
|
537
|
-
const e = o.stackedPallet, t = e.floors[0].pallet, i = t.dimensions.width, s = t.dimensions.depth, n =
|
|
537
|
+
const e = o.stackedPallet, t = e.floors[0].pallet, i = t.dimensions.width, s = t.dimensions.depth, n = de(e), a = o.yRotation * Math.PI / 180, l = Math.cos(a), c = Math.sin(a), m = [
|
|
538
538
|
{ x: 0, z: 0 },
|
|
539
539
|
{ x: i, z: 0 },
|
|
540
540
|
{ x: i, z: s },
|
|
541
541
|
{ x: 0, z: s }
|
|
542
542
|
].map((u) => ({
|
|
543
|
-
x: o.position.x + u.x *
|
|
544
|
-
z: o.position.z - u.x *
|
|
545
|
-
})),
|
|
543
|
+
x: o.position.x + u.x * l + u.z * c,
|
|
544
|
+
z: o.position.z - u.x * c + u.z * l
|
|
545
|
+
})), p = Math.min(...m.map((u) => u.x)), w = Math.max(...m.map((u) => u.x)), h = Math.min(...m.map((u) => u.z)), x = Math.max(...m.map((u) => u.z));
|
|
546
546
|
return {
|
|
547
|
-
minX:
|
|
547
|
+
minX: p,
|
|
548
548
|
maxX: w,
|
|
549
549
|
minY: o.position.y,
|
|
550
550
|
maxY: o.position.y + n,
|
|
551
|
-
minZ:
|
|
551
|
+
minZ: h,
|
|
552
552
|
maxZ: x
|
|
553
553
|
};
|
|
554
554
|
}
|
|
555
|
-
function ve(o, e, t =
|
|
555
|
+
function ve(o, e, t = Ne) {
|
|
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
|
-
function
|
|
558
|
+
function Qe(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++) {
|
|
@@ -569,7 +569,7 @@ function Je(o) {
|
|
|
569
569
|
}
|
|
570
570
|
return { isValid: e.length === 0, violations: e };
|
|
571
571
|
}
|
|
572
|
-
function
|
|
572
|
+
function Ke(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++) {
|
|
@@ -583,7 +583,7 @@ function Qe(o) {
|
|
|
583
583
|
}
|
|
584
584
|
return { isValid: e.length === 0, violations: e };
|
|
585
585
|
}
|
|
586
|
-
function
|
|
586
|
+
function et(o, e) {
|
|
587
587
|
const t = [], i = L(o);
|
|
588
588
|
return (i.minX < 0 || i.maxX > e.dimensions.width) && t.push({
|
|
589
589
|
code: "BR-001",
|
|
@@ -602,15 +602,15 @@ function Ke(o, e) {
|
|
|
602
602
|
involvedIds: [o.id, e.id]
|
|
603
603
|
}), { isValid: t.length === 0, violations: t };
|
|
604
604
|
}
|
|
605
|
-
function
|
|
605
|
+
function tt(o, e) {
|
|
606
606
|
const t = [];
|
|
607
607
|
for (const i of o) {
|
|
608
|
-
const s =
|
|
608
|
+
const s = et(i, e);
|
|
609
609
|
t.push(...s.violations);
|
|
610
610
|
}
|
|
611
611
|
return { isValid: t.length === 0, violations: t };
|
|
612
612
|
}
|
|
613
|
-
function
|
|
613
|
+
function it(o, e) {
|
|
614
614
|
const t = [], i = se(o), s = e.dimensions;
|
|
615
615
|
return (i.minX < 0 || i.maxX > s.width) && t.push({
|
|
616
616
|
code: "BR-402",
|
|
@@ -629,7 +629,7 @@ function tt(o, e) {
|
|
|
629
629
|
involvedIds: [o.id, e.id]
|
|
630
630
|
}), { isValid: t.length === 0, violations: t };
|
|
631
631
|
}
|
|
632
|
-
function
|
|
632
|
+
function Bt(o, e) {
|
|
633
633
|
const t = [], i = se(o);
|
|
634
634
|
return i.maxY > e && t.push({
|
|
635
635
|
code: "BR-403",
|
|
@@ -638,7 +638,7 @@ function Ot(o, e) {
|
|
|
638
638
|
involvedIds: [o.id]
|
|
639
639
|
}), { isValid: t.length === 0, violations: t };
|
|
640
640
|
}
|
|
641
|
-
function
|
|
641
|
+
function ot(o) {
|
|
642
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",
|
|
@@ -652,7 +652,7 @@ function it(o) {
|
|
|
652
652
|
involvedIds: [o.pallet.id]
|
|
653
653
|
}), { isValid: e.filter((s) => s.severity === "error").length === 0, violations: e };
|
|
654
654
|
}
|
|
655
|
-
function
|
|
655
|
+
function $t(o) {
|
|
656
656
|
const e = [], t = o.pallets.reduce(
|
|
657
657
|
(i, s) => i + ye(s.stackedPallet),
|
|
658
658
|
0
|
|
@@ -669,11 +669,11 @@ function Bt(o) {
|
|
|
669
669
|
involvedIds: [o.id]
|
|
670
670
|
}), { isValid: e.filter((i) => i.severity === "error").length === 0, violations: e };
|
|
671
671
|
}
|
|
672
|
-
function
|
|
672
|
+
function st(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, s =
|
|
676
|
+
const i = t.box.fragilityMaxWeight ?? 0, s = nt(t, o);
|
|
677
677
|
s > i && e.push({
|
|
678
678
|
code: "BR-103",
|
|
679
679
|
severity: "error",
|
|
@@ -683,7 +683,7 @@ function ot(o) {
|
|
|
683
683
|
}
|
|
684
684
|
return { isValid: e.length === 0, violations: e };
|
|
685
685
|
}
|
|
686
|
-
function
|
|
686
|
+
function nt(o, e) {
|
|
687
687
|
const t = L(o);
|
|
688
688
|
let i = 0;
|
|
689
689
|
for (const s of e) {
|
|
@@ -693,26 +693,26 @@ function st(o, e) {
|
|
|
693
693
|
}
|
|
694
694
|
return i;
|
|
695
695
|
}
|
|
696
|
-
function
|
|
696
|
+
function rt(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((c, g) => c + g.box.weight, 0);
|
|
700
700
|
if (i === 0) return { isValid: !0, violations: t };
|
|
701
701
|
let s = 0, n = 0;
|
|
702
|
-
for (const
|
|
703
|
-
const
|
|
704
|
-
s +=
|
|
702
|
+
for (const c of e) {
|
|
703
|
+
const g = L(c), m = (g.minX + g.maxX) / 2, p = (g.minZ + g.maxZ) / 2;
|
|
704
|
+
s += m * c.box.weight, n += p * c.box.weight;
|
|
705
705
|
}
|
|
706
706
|
s /= i, n /= i;
|
|
707
|
-
const a = o.dimensions.width / 2,
|
|
708
|
-
return (Math.abs(s - a) > o.dimensions.width / 6 || Math.abs(n -
|
|
707
|
+
const a = o.dimensions.width / 2, l = o.dimensions.depth / 2;
|
|
708
|
+
return (Math.abs(s - a) > o.dimensions.width / 6 || Math.abs(n - l) > o.dimensions.depth / 6) && t.push({
|
|
709
709
|
code: "BR-104",
|
|
710
710
|
severity: "warning",
|
|
711
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
|
}
|
|
715
|
-
function
|
|
715
|
+
function at(o) {
|
|
716
716
|
const e = [];
|
|
717
717
|
for (const t of o) {
|
|
718
718
|
if (t.box.stackable) continue;
|
|
@@ -730,7 +730,7 @@ function rt(o) {
|
|
|
730
730
|
}
|
|
731
731
|
return { isValid: e.length === 0, violations: e };
|
|
732
732
|
}
|
|
733
|
-
function
|
|
733
|
+
function ct(o) {
|
|
734
734
|
const e = [];
|
|
735
735
|
for (const t of o) {
|
|
736
736
|
const i = L(t), s = (i.maxX - i.minX) * (i.maxZ - i.minZ);
|
|
@@ -738,8 +738,8 @@ function at(o) {
|
|
|
738
738
|
if (n.id === t.id) continue;
|
|
739
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
|
-
n.box.weight > t.box.weight * 1.5 &&
|
|
741
|
+
const l = (a.maxX - a.minX) * (a.maxZ - a.minZ);
|
|
742
|
+
n.box.weight > t.box.weight * 1.5 && l > s * 1.2 && e.push({
|
|
743
743
|
code: "BR-203",
|
|
744
744
|
severity: "warning",
|
|
745
745
|
message: `Pirámide invertida: caja ${n.id} (${n.box.weight}kg) sobre caja ${t.id} (${t.box.weight}kg)`,
|
|
@@ -764,7 +764,7 @@ function Wt(o) {
|
|
|
764
764
|
}
|
|
765
765
|
return { isValid: e.length === 0, violations: e };
|
|
766
766
|
}
|
|
767
|
-
function
|
|
767
|
+
function Lt(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,8 +775,8 @@ function $t(o) {
|
|
|
775
775
|
});
|
|
776
776
|
return { isValid: e.length === 0, violations: e };
|
|
777
777
|
}
|
|
778
|
-
function
|
|
779
|
-
const t = [], i =
|
|
778
|
+
function Gt(o, e) {
|
|
779
|
+
const t = [], i = de(o);
|
|
780
780
|
return i > e && t.push({
|
|
781
781
|
code: "BR-303",
|
|
782
782
|
severity: "error",
|
|
@@ -784,7 +784,7 @@ function Lt(o, e) {
|
|
|
784
784
|
involvedIds: [o.id]
|
|
785
785
|
}), { isValid: t.length === 0, violations: t };
|
|
786
786
|
}
|
|
787
|
-
function
|
|
787
|
+
function Vt(o) {
|
|
788
788
|
const e = [], t = ye(o), i = o.floors[0].pallet.maxWeight, s = t - o.floors[0].pallet.weight;
|
|
789
789
|
return s > i && e.push({
|
|
790
790
|
code: "BR-304",
|
|
@@ -793,7 +793,7 @@ function Gt(o) {
|
|
|
793
793
|
involvedIds: [o.id]
|
|
794
794
|
}), { isValid: e.length === 0, violations: e };
|
|
795
795
|
}
|
|
796
|
-
function
|
|
796
|
+
function lt(o) {
|
|
797
797
|
const e = [];
|
|
798
798
|
for (const t of o) {
|
|
799
799
|
const i = L(t);
|
|
@@ -802,10 +802,10 @@ function ct(o) {
|
|
|
802
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
|
-
n +=
|
|
805
|
+
const l = L(a);
|
|
806
|
+
if (Math.abs(l.maxY - i.minY) > 2) continue;
|
|
807
|
+
const c = Math.max(0, Math.min(i.maxX, l.maxX) - Math.max(i.minX, l.minX)), g = Math.max(0, Math.min(i.maxZ, l.maxZ) - Math.max(i.minZ, l.minZ));
|
|
808
|
+
n += c * g;
|
|
809
809
|
}
|
|
810
810
|
s > 0 && n / s < ze && e.push({
|
|
811
811
|
code: "BR-004",
|
|
@@ -820,8 +820,8 @@ function Y(o) {
|
|
|
820
820
|
if (o.length === 0) return { x: 0, y: 0, z: 0 };
|
|
821
821
|
let e = 0, t = 0, i = 0, s = 0;
|
|
822
822
|
for (const n of o) {
|
|
823
|
-
const a = L(n),
|
|
824
|
-
t +=
|
|
823
|
+
const a = L(n), l = (a.minX + a.maxX) / 2, c = (a.minY + a.maxY) / 2, g = (a.minZ + a.maxZ) / 2, m = n.box.weight;
|
|
824
|
+
t += l * m, i += c * m, s += g * m, e += m;
|
|
825
825
|
}
|
|
826
826
|
return e === 0 ? { x: 0, y: 0, z: 0 } : {
|
|
827
827
|
x: t / e,
|
|
@@ -831,13 +831,13 @@ function Y(o) {
|
|
|
831
831
|
}
|
|
832
832
|
function ee(o, e) {
|
|
833
833
|
if (e.length === 0) return 100;
|
|
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),
|
|
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), l = Math.max(0, 100 - (n + a) * 50), c = e.reduce((p, w) => {
|
|
835
|
+
const h = L(w);
|
|
836
|
+
return Math.max(p, h.maxY);
|
|
837
|
+
}, 0), g = c > 0 ? t.y / c : 0, m = Math.max(0, 100 - Math.max(0, g - 0.5) * 100);
|
|
838
|
+
return Math.round(l * 0.7 + m * 0.3);
|
|
839
839
|
}
|
|
840
|
-
function
|
|
840
|
+
function dt(o, e) {
|
|
841
841
|
const t = [];
|
|
842
842
|
if (e.length === 0) return { isValid: !0, violations: t };
|
|
843
843
|
const i = Y(e);
|
|
@@ -848,7 +848,7 @@ function lt(o, e) {
|
|
|
848
848
|
involvedIds: [o.id]
|
|
849
849
|
}), { isValid: t.length === 0, violations: t };
|
|
850
850
|
}
|
|
851
|
-
function
|
|
851
|
+
function ht(o, e) {
|
|
852
852
|
const t = [];
|
|
853
853
|
if (e.length === 0) return { isValid: !0, violations: t };
|
|
854
854
|
const i = ee(o, e);
|
|
@@ -863,7 +863,7 @@ function dt(o, e) {
|
|
|
863
863
|
message: `Score de estabilidad mejorable (${i}/100, recomendado: ≥70)`,
|
|
864
864
|
involvedIds: [o.id]
|
|
865
865
|
});
|
|
866
|
-
const s = Y(e), n = e.reduce((a,
|
|
866
|
+
const s = Y(e), n = e.reduce((a, l) => Math.max(a, L(l).maxY), 0);
|
|
867
867
|
return n > 0 && s.y > n * 0.6 && t.push({
|
|
868
868
|
code: "BR-503",
|
|
869
869
|
severity: "warning",
|
|
@@ -871,16 +871,16 @@ function dt(o, e) {
|
|
|
871
871
|
involvedIds: [o.id]
|
|
872
872
|
}), { isValid: t.filter((a) => a.severity === "error").length === 0, violations: t };
|
|
873
873
|
}
|
|
874
|
-
function
|
|
874
|
+
function mt(o, e) {
|
|
875
875
|
let t = !1;
|
|
876
876
|
const i = e.length;
|
|
877
877
|
for (let s = 0, n = i - 1; s < i; n = s++) {
|
|
878
|
-
const a = e[s].x,
|
|
879
|
-
|
|
878
|
+
const a = e[s].x, l = e[s].z, c = e[n].x, g = e[n].z;
|
|
879
|
+
l > o.z != g > o.z && o.x < (c - a) * (o.z - l) / (g - l) + a && (t = !t);
|
|
880
880
|
}
|
|
881
881
|
return t;
|
|
882
882
|
}
|
|
883
|
-
function
|
|
883
|
+
function $e(o, e) {
|
|
884
884
|
const t = [], i = se(o), s = [
|
|
885
885
|
{ x: i.minX, z: i.minZ },
|
|
886
886
|
{ x: i.maxX, z: i.minZ },
|
|
@@ -888,7 +888,7 @@ function We(o, e) {
|
|
|
888
888
|
{ x: i.minX, z: i.maxZ }
|
|
889
889
|
];
|
|
890
890
|
for (const n of s)
|
|
891
|
-
if (!
|
|
891
|
+
if (!mt(n, e.floorPolygon)) {
|
|
892
892
|
t.push({
|
|
893
893
|
code: "BR-401",
|
|
894
894
|
severity: "error",
|
|
@@ -904,37 +904,37 @@ function We(o, e) {
|
|
|
904
904
|
involvedIds: [o.id, e.id]
|
|
905
905
|
}), { isValid: t.length === 0, violations: t };
|
|
906
906
|
}
|
|
907
|
-
class
|
|
907
|
+
class ut {
|
|
908
908
|
id = "column";
|
|
909
909
|
name = "Columnas por tipo";
|
|
910
910
|
pack(e, t) {
|
|
911
911
|
const i = [], s = [], n = /* @__PURE__ */ new Map();
|
|
912
|
-
for (const
|
|
913
|
-
const x =
|
|
914
|
-
n.has(x) || n.set(x, []), n.get(x).push(
|
|
912
|
+
for (const h of e) {
|
|
913
|
+
const x = h.type ?? h.sku ?? "default";
|
|
914
|
+
n.has(x) || n.set(x, []), n.get(x).push(h);
|
|
915
915
|
}
|
|
916
|
-
let a = 0,
|
|
917
|
-
for (const [,
|
|
918
|
-
if (
|
|
919
|
-
const x =
|
|
916
|
+
let a = 0, l = 0;
|
|
917
|
+
for (const [, h] of n) {
|
|
918
|
+
if (h.length === 0) continue;
|
|
919
|
+
const x = h[0], u = x.dimensions.width, d = x.dimensions.depth, b = x.dimensions.height;
|
|
920
920
|
if (a + u > t.dimensions.width) {
|
|
921
|
-
s.push(...
|
|
921
|
+
s.push(...h);
|
|
922
922
|
continue;
|
|
923
923
|
}
|
|
924
|
-
let j = 0,
|
|
925
|
-
for (; S <
|
|
926
|
-
const C =
|
|
924
|
+
let j = 0, T = 0, S = 0;
|
|
925
|
+
for (; S < h.length; ) {
|
|
926
|
+
const C = h[S];
|
|
927
927
|
if (j + d > t.dimensions.depth) {
|
|
928
|
-
if (j = 0,
|
|
929
|
-
s.push(...
|
|
928
|
+
if (j = 0, T += b, T + b > t.maxStackHeight) {
|
|
929
|
+
s.push(...h.slice(S));
|
|
930
930
|
break;
|
|
931
931
|
}
|
|
932
932
|
continue;
|
|
933
933
|
}
|
|
934
934
|
i.push({
|
|
935
|
-
id: `placed-${++
|
|
935
|
+
id: `placed-${++l}`,
|
|
936
936
|
box: C,
|
|
937
|
-
position: { x: a, y:
|
|
937
|
+
position: { x: a, y: T, z: j },
|
|
938
938
|
rotation: { x: 0, y: 0, z: 0 },
|
|
939
939
|
supportedBy: [],
|
|
940
940
|
supporting: []
|
|
@@ -942,29 +942,29 @@ class mt {
|
|
|
942
942
|
}
|
|
943
943
|
a += u;
|
|
944
944
|
}
|
|
945
|
-
const
|
|
945
|
+
const c = t.dimensions.width * t.maxStackHeight * t.dimensions.depth, g = i.reduce((h, x) => {
|
|
946
946
|
const u = x.box.dimensions;
|
|
947
|
-
return
|
|
948
|
-
}, 0),
|
|
947
|
+
return h + u.width * u.height * u.depth;
|
|
948
|
+
}, 0), m = i.reduce((h, x) => h + x.box.weight, 0), p = 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:
|
|
952
|
+
volumeUtilization: c > 0 ? g / c : 0,
|
|
953
|
+
weightUtilization: t.maxWeight > 0 ? m / t.maxWeight : 0,
|
|
954
|
+
centerOfGravity: p,
|
|
955
955
|
stabilityScore: w
|
|
956
956
|
},
|
|
957
957
|
unplacedBoxes: s
|
|
958
958
|
};
|
|
959
959
|
}
|
|
960
960
|
}
|
|
961
|
-
class
|
|
961
|
+
class xt {
|
|
962
962
|
id = "bin-packing-3d";
|
|
963
963
|
name = "Bin Packing 3D (FFD Height)";
|
|
964
964
|
pack(e, t) {
|
|
965
|
-
const i = [], s = [], n = [...e].sort((
|
|
966
|
-
const
|
|
967
|
-
return w.dimensions.width * w.dimensions.height * w.dimensions.depth -
|
|
965
|
+
const i = [], s = [], n = [...e].sort((p, w) => {
|
|
966
|
+
const h = p.dimensions.width * p.dimensions.height * p.dimensions.depth;
|
|
967
|
+
return w.dimensions.width * w.dimensions.height * w.dimensions.depth - h;
|
|
968
968
|
}), a = [
|
|
969
969
|
{
|
|
970
970
|
x: 0,
|
|
@@ -975,20 +975,20 @@ class ut {
|
|
|
975
975
|
depth: t.dimensions.depth
|
|
976
976
|
}
|
|
977
977
|
];
|
|
978
|
-
let
|
|
979
|
-
for (const
|
|
978
|
+
let l = 0;
|
|
979
|
+
for (const p of n) {
|
|
980
980
|
let w = !1;
|
|
981
|
-
const
|
|
982
|
-
{ w:
|
|
983
|
-
{ w:
|
|
981
|
+
const h = [
|
|
982
|
+
{ w: p.dimensions.width, h: p.dimensions.height, d: p.dimensions.depth, rot: 0 },
|
|
983
|
+
{ w: p.dimensions.depth, h: p.dimensions.height, d: p.dimensions.width, rot: 90 }
|
|
984
984
|
];
|
|
985
985
|
for (let x = 0; x < a.length && !w; x++) {
|
|
986
986
|
const u = a[x];
|
|
987
|
-
for (const d of
|
|
987
|
+
for (const d of h)
|
|
988
988
|
if (d.w <= u.width && d.h <= u.height && d.d <= u.depth) {
|
|
989
989
|
const b = {
|
|
990
|
-
id: `placed-${++
|
|
991
|
-
box:
|
|
990
|
+
id: `placed-${++l}`,
|
|
991
|
+
box: p,
|
|
992
992
|
position: { x: u.x, y: u.y, z: u.z },
|
|
993
993
|
rotation: { x: 0, y: d.rot, z: 0 },
|
|
994
994
|
supportedBy: [],
|
|
@@ -1023,17 +1023,17 @@ class ut {
|
|
|
1023
1023
|
}
|
|
1024
1024
|
}
|
|
1025
1025
|
}
|
|
1026
|
-
w || s.push(
|
|
1026
|
+
w || s.push(p);
|
|
1027
1027
|
}
|
|
1028
|
-
const
|
|
1029
|
-
const
|
|
1030
|
-
return
|
|
1031
|
-
}, 0),
|
|
1028
|
+
const c = t.dimensions.width * t.maxStackHeight * t.dimensions.depth, g = i.reduce((p, w) => {
|
|
1029
|
+
const h = w.box.dimensions;
|
|
1030
|
+
return p + h.width * h.height * h.depth;
|
|
1031
|
+
}, 0), m = i.reduce((p, w) => p + w.box.weight, 0);
|
|
1032
1032
|
return {
|
|
1033
1033
|
placements: i,
|
|
1034
1034
|
metrics: {
|
|
1035
|
-
volumeUtilization:
|
|
1036
|
-
weightUtilization: t.maxWeight > 0 ?
|
|
1035
|
+
volumeUtilization: c > 0 ? g / c : 0,
|
|
1036
|
+
weightUtilization: t.maxWeight > 0 ? m / t.maxWeight : 0,
|
|
1037
1037
|
centerOfGravity: Y(i),
|
|
1038
1038
|
stabilityScore: ee(t, i)
|
|
1039
1039
|
},
|
|
@@ -1041,7 +1041,7 @@ class ut {
|
|
|
1041
1041
|
};
|
|
1042
1042
|
}
|
|
1043
1043
|
}
|
|
1044
|
-
class
|
|
1044
|
+
class gt {
|
|
1045
1045
|
id = "type-group";
|
|
1046
1046
|
name = "Agrupación por tipo";
|
|
1047
1047
|
pack(e, t) {
|
|
@@ -1049,10 +1049,10 @@ class xt {
|
|
|
1049
1049
|
const d = x.type ?? x.sku ?? "z", b = u.type ?? u.sku ?? "z";
|
|
1050
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,
|
|
1052
|
+
let a = 0, l = 0, c = 0, g = 0, m = 0;
|
|
1053
1053
|
for (const x of n) {
|
|
1054
1054
|
const u = x.dimensions.width, d = x.dimensions.height, b = x.dimensions.depth;
|
|
1055
|
-
if (a + u > t.dimensions.width && (a = 0,
|
|
1055
|
+
if (a + u > t.dimensions.width && (a = 0, l += g > 0 ? b : 0), l + b > t.dimensions.depth && (a = 0, l = 0, c += g, g = 0), c + d > t.maxStackHeight) {
|
|
1056
1056
|
s.push(x);
|
|
1057
1057
|
continue;
|
|
1058
1058
|
}
|
|
@@ -1060,28 +1060,28 @@ class xt {
|
|
|
1060
1060
|
s.push(x);
|
|
1061
1061
|
continue;
|
|
1062
1062
|
}
|
|
1063
|
-
if (
|
|
1063
|
+
if (l + b > t.dimensions.depth) {
|
|
1064
1064
|
s.push(x);
|
|
1065
1065
|
continue;
|
|
1066
1066
|
}
|
|
1067
1067
|
i.push({
|
|
1068
|
-
id: `placed-${++
|
|
1068
|
+
id: `placed-${++m}`,
|
|
1069
1069
|
box: x,
|
|
1070
|
-
position: { x: a, y:
|
|
1070
|
+
position: { x: a, y: c, z: l },
|
|
1071
1071
|
rotation: { x: 0, y: 0, z: 0 },
|
|
1072
1072
|
supportedBy: [],
|
|
1073
1073
|
supporting: []
|
|
1074
|
-
}), a += u,
|
|
1074
|
+
}), a += u, g = Math.max(g, d);
|
|
1075
1075
|
}
|
|
1076
|
-
const
|
|
1076
|
+
const p = t.dimensions.width * t.maxStackHeight * t.dimensions.depth, w = i.reduce((x, u) => {
|
|
1077
1077
|
const d = u.box.dimensions;
|
|
1078
1078
|
return x + d.width * d.height * d.depth;
|
|
1079
|
-
}, 0),
|
|
1079
|
+
}, 0), h = 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 ?
|
|
1083
|
+
volumeUtilization: p > 0 ? w / p : 0,
|
|
1084
|
+
weightUtilization: t.maxWeight > 0 ? h / t.maxWeight : 0,
|
|
1085
1085
|
centerOfGravity: Y(i),
|
|
1086
1086
|
stabilityScore: ee(t, i)
|
|
1087
1087
|
},
|
|
@@ -1089,7 +1089,7 @@ class xt {
|
|
|
1089
1089
|
};
|
|
1090
1090
|
}
|
|
1091
1091
|
}
|
|
1092
|
-
class
|
|
1092
|
+
class pt {
|
|
1093
1093
|
id = "material-grouping";
|
|
1094
1094
|
name = "Material & Product Grouping";
|
|
1095
1095
|
/**
|
|
@@ -1102,13 +1102,13 @@ class gt {
|
|
|
1102
1102
|
pack(e, t) {
|
|
1103
1103
|
if (e.length === 0)
|
|
1104
1104
|
return this.emptyResult();
|
|
1105
|
-
const i = this.sortBoxes(e), s = this.groupByMaterialWeight(i), a = this.buildLayers(s, t).flatMap((
|
|
1106
|
-
(
|
|
1107
|
-
),
|
|
1105
|
+
const i = this.sortBoxes(e), s = this.groupByMaterialWeight(i), a = this.buildLayers(s, t).flatMap((g) => g.placements), l = e.filter(
|
|
1106
|
+
(g) => !a.some((m) => m.box.id === g.id)
|
|
1107
|
+
), c = this.calculateMetrics(a, t);
|
|
1108
1108
|
return {
|
|
1109
1109
|
placements: a,
|
|
1110
|
-
metrics:
|
|
1111
|
-
unplacedBoxes:
|
|
1110
|
+
metrics: c,
|
|
1111
|
+
unplacedBoxes: l
|
|
1112
1112
|
};
|
|
1113
1113
|
}
|
|
1114
1114
|
// ─── Phase 1: Sorting ──────────────────────────────────────────────
|
|
@@ -1127,11 +1127,11 @@ class gt {
|
|
|
1127
1127
|
const s = t.materialWeight ?? 5, n = i.materialWeight ?? 5;
|
|
1128
1128
|
if (s !== n)
|
|
1129
1129
|
return n - s;
|
|
1130
|
-
const a = t.product ?? "",
|
|
1131
|
-
if (a !==
|
|
1132
|
-
return a.localeCompare(
|
|
1133
|
-
const
|
|
1134
|
-
return
|
|
1130
|
+
const a = t.product ?? "", l = i.product ?? "";
|
|
1131
|
+
if (a !== l)
|
|
1132
|
+
return a.localeCompare(l);
|
|
1133
|
+
const c = t.dimensions.width * t.dimensions.depth, g = i.dimensions.width * i.dimensions.depth;
|
|
1134
|
+
return c !== g ? g - c : i.dimensions.height - t.dimensions.height;
|
|
1135
1135
|
});
|
|
1136
1136
|
}
|
|
1137
1137
|
/**
|
|
@@ -1159,21 +1159,21 @@ class gt {
|
|
|
1159
1159
|
buildLayers(e, t) {
|
|
1160
1160
|
const i = [], s = /* @__PURE__ */ new Map(), n = [];
|
|
1161
1161
|
let a = 0;
|
|
1162
|
-
for (const [,
|
|
1163
|
-
let
|
|
1164
|
-
for (;
|
|
1165
|
-
const
|
|
1166
|
-
|
|
1162
|
+
for (const [, l] of e) {
|
|
1163
|
+
let c = [...l];
|
|
1164
|
+
for (; c.length > 0; ) {
|
|
1165
|
+
const g = this.buildNextLayer(
|
|
1166
|
+
c,
|
|
1167
1167
|
t,
|
|
1168
1168
|
a,
|
|
1169
1169
|
s,
|
|
1170
1170
|
n
|
|
1171
1171
|
);
|
|
1172
|
-
if (
|
|
1172
|
+
if (g.placements.length === 0)
|
|
1173
1173
|
break;
|
|
1174
|
-
i.push(
|
|
1175
|
-
const
|
|
1176
|
-
if (
|
|
1174
|
+
i.push(g), n.push(...g.placements), a += g.height;
|
|
1175
|
+
const m = new Set(g.placements.map((p) => p.box.id));
|
|
1176
|
+
if (c = c.filter((p) => !m.has(p.id)), a >= t.maxStackHeight)
|
|
1177
1177
|
break;
|
|
1178
1178
|
}
|
|
1179
1179
|
}
|
|
@@ -1204,14 +1204,14 @@ class gt {
|
|
|
1204
1204
|
);
|
|
1205
1205
|
if (a && a.coverage >= 95)
|
|
1206
1206
|
return a;
|
|
1207
|
-
const
|
|
1207
|
+
const l = this.tryMixedHeightLayer(
|
|
1208
1208
|
e,
|
|
1209
1209
|
t,
|
|
1210
1210
|
i,
|
|
1211
1211
|
s,
|
|
1212
1212
|
n
|
|
1213
1213
|
);
|
|
1214
|
-
return
|
|
1214
|
+
return l && l.coverage >= 95 ? l : ((a?.coverage ?? 0) > (l?.coverage ?? 0) ? a : l) ?? this.emptyLayer(i);
|
|
1215
1215
|
}
|
|
1216
1216
|
/**
|
|
1217
1217
|
* Attempts to create a layer with boxes of uniform height
|
|
@@ -1225,26 +1225,26 @@ class gt {
|
|
|
1225
1225
|
*/
|
|
1226
1226
|
tryUniformHeightLayer(e, t, i, s, n) {
|
|
1227
1227
|
const a = /* @__PURE__ */ new Map();
|
|
1228
|
-
for (const
|
|
1229
|
-
const
|
|
1230
|
-
a.has(
|
|
1228
|
+
for (const c of e) {
|
|
1229
|
+
const g = c.dimensions.height;
|
|
1230
|
+
a.has(g) || a.set(g, []), a.get(g).push(c);
|
|
1231
1231
|
}
|
|
1232
|
-
const
|
|
1233
|
-
(
|
|
1232
|
+
const l = [...a.entries()].sort(
|
|
1233
|
+
(c, g) => g[1].length - c[1].length
|
|
1234
1234
|
);
|
|
1235
|
-
for (const [
|
|
1236
|
-
if (i +
|
|
1235
|
+
for (const [c, g] of l) {
|
|
1236
|
+
if (i + c > t.maxStackHeight)
|
|
1237
1237
|
continue;
|
|
1238
|
-
const
|
|
1239
|
-
|
|
1238
|
+
const m = this.placeBoxesInLayer(
|
|
1239
|
+
g,
|
|
1240
1240
|
t,
|
|
1241
1241
|
i,
|
|
1242
|
-
|
|
1242
|
+
c,
|
|
1243
1243
|
s,
|
|
1244
1244
|
n
|
|
1245
1245
|
);
|
|
1246
|
-
if (
|
|
1247
|
-
return
|
|
1246
|
+
if (m.coverage >= 95)
|
|
1247
|
+
return m;
|
|
1248
1248
|
}
|
|
1249
1249
|
return null;
|
|
1250
1250
|
}
|
|
@@ -1281,23 +1281,23 @@ class gt {
|
|
|
1281
1281
|
* @returns Constructed layer
|
|
1282
1282
|
*/
|
|
1283
1283
|
placeBoxesInLayer(e, t, i, s, n, a) {
|
|
1284
|
-
const
|
|
1284
|
+
const l = [
|
|
1285
1285
|
{
|
|
1286
1286
|
x: 0,
|
|
1287
1287
|
z: 0,
|
|
1288
1288
|
width: t.dimensions.width,
|
|
1289
1289
|
depth: t.dimensions.depth
|
|
1290
1290
|
}
|
|
1291
|
-
],
|
|
1291
|
+
], c = [], m = [...this.groupByProduct(e).entries()].sort(
|
|
1292
1292
|
(u, d) => d[1].length - u[1].length
|
|
1293
1293
|
);
|
|
1294
|
-
let
|
|
1295
|
-
for (const [u, d] of
|
|
1294
|
+
let p = 0;
|
|
1295
|
+
for (const [u, d] of m) {
|
|
1296
1296
|
const b = s ? d.filter((j) => j.dimensions.height === s) : d;
|
|
1297
1297
|
for (const j of b) {
|
|
1298
1298
|
if (i + j.dimensions.height > t.maxStackHeight)
|
|
1299
1299
|
continue;
|
|
1300
|
-
const
|
|
1300
|
+
const T = [
|
|
1301
1301
|
{
|
|
1302
1302
|
width: j.dimensions.width,
|
|
1303
1303
|
depth: j.dimensions.depth,
|
|
@@ -1309,13 +1309,13 @@ class gt {
|
|
|
1309
1309
|
rotation: 90
|
|
1310
1310
|
}
|
|
1311
1311
|
];
|
|
1312
|
-
for (const S of
|
|
1312
|
+
for (const S of T) {
|
|
1313
1313
|
const C = [
|
|
1314
1314
|
...a,
|
|
1315
|
-
...
|
|
1315
|
+
...c
|
|
1316
1316
|
], z = this.findBestRectangle(
|
|
1317
1317
|
S,
|
|
1318
|
-
|
|
1318
|
+
l,
|
|
1319
1319
|
n,
|
|
1320
1320
|
u,
|
|
1321
1321
|
i,
|
|
@@ -1323,20 +1323,20 @@ class gt {
|
|
|
1323
1323
|
);
|
|
1324
1324
|
if (z) {
|
|
1325
1325
|
const y = {
|
|
1326
|
-
id: `placed-${++
|
|
1326
|
+
id: `placed-${++p}`,
|
|
1327
1327
|
box: j,
|
|
1328
1328
|
position: { x: z.x, y: i, z: z.z },
|
|
1329
1329
|
rotation: { x: 0, y: S.rotation, z: 0 },
|
|
1330
1330
|
supportedBy: [],
|
|
1331
1331
|
supporting: []
|
|
1332
1332
|
};
|
|
1333
|
-
|
|
1333
|
+
c.push(y), this.updateOccupiedColumns(
|
|
1334
1334
|
n,
|
|
1335
1335
|
z.x,
|
|
1336
1336
|
z.z,
|
|
1337
1337
|
u
|
|
1338
1338
|
), this.updateFreeRectangles(
|
|
1339
|
-
|
|
1339
|
+
l,
|
|
1340
1340
|
z,
|
|
1341
1341
|
S.width,
|
|
1342
1342
|
S.depth
|
|
@@ -1346,15 +1346,15 @@ class gt {
|
|
|
1346
1346
|
}
|
|
1347
1347
|
}
|
|
1348
1348
|
}
|
|
1349
|
-
const w = t.dimensions.width * t.dimensions.depth,
|
|
1349
|
+
const w = t.dimensions.width * t.dimensions.depth, h = c.reduce((u, d) => {
|
|
1350
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
1351
|
return u + b * j;
|
|
1352
|
-
}, 0), x =
|
|
1352
|
+
}, 0), x = c.length > 0 ? Math.max(...c.map((u) => u.box.dimensions.height)) : 0;
|
|
1353
1353
|
return {
|
|
1354
1354
|
y: i,
|
|
1355
1355
|
height: x,
|
|
1356
|
-
placements:
|
|
1357
|
-
coverage:
|
|
1356
|
+
placements: c,
|
|
1357
|
+
coverage: h / w * 100
|
|
1358
1358
|
};
|
|
1359
1359
|
}
|
|
1360
1360
|
/**
|
|
@@ -1370,35 +1370,35 @@ class gt {
|
|
|
1370
1370
|
* @returns Best rectangle or null if none fit
|
|
1371
1371
|
*/
|
|
1372
1372
|
findBestRectangle(e, t, i, s, n, a) {
|
|
1373
|
-
let
|
|
1374
|
-
for (const
|
|
1375
|
-
if (e.width <=
|
|
1376
|
-
const
|
|
1377
|
-
|
|
1378
|
-
|
|
1373
|
+
let l = null, c = -1 / 0;
|
|
1374
|
+
for (const g of t)
|
|
1375
|
+
if (e.width <= g.width && e.depth <= g.depth) {
|
|
1376
|
+
const m = this.calculateSupportArea(
|
|
1377
|
+
g.x,
|
|
1378
|
+
g.z,
|
|
1379
1379
|
e.width,
|
|
1380
1380
|
e.depth,
|
|
1381
1381
|
n,
|
|
1382
1382
|
a
|
|
1383
|
-
),
|
|
1384
|
-
if (
|
|
1385
|
-
|
|
1386
|
-
|
|
1383
|
+
), p = e.width * e.depth;
|
|
1384
|
+
if (m / p < 0.7 || this.boxExtendsBeyondLowerLayer(
|
|
1385
|
+
g.x,
|
|
1386
|
+
g.z,
|
|
1387
1387
|
e.width,
|
|
1388
1388
|
e.depth,
|
|
1389
1389
|
n,
|
|
1390
1390
|
a
|
|
1391
1391
|
))
|
|
1392
1392
|
continue;
|
|
1393
|
-
const
|
|
1394
|
-
|
|
1393
|
+
const h = this.scoreRectangle(
|
|
1394
|
+
g,
|
|
1395
1395
|
e,
|
|
1396
1396
|
i,
|
|
1397
1397
|
s
|
|
1398
1398
|
);
|
|
1399
|
-
|
|
1399
|
+
h > c && (c = h, l = g);
|
|
1400
1400
|
}
|
|
1401
|
-
return
|
|
1401
|
+
return l;
|
|
1402
1402
|
}
|
|
1403
1403
|
/**
|
|
1404
1404
|
* Calculates the area of support a box would have at a given position
|
|
@@ -1413,35 +1413,35 @@ class gt {
|
|
|
1413
1413
|
* @returns Supported area in mm²
|
|
1414
1414
|
*/
|
|
1415
1415
|
calculateSupportArea(e, t, i, s, n, a) {
|
|
1416
|
-
let
|
|
1416
|
+
let l = 0;
|
|
1417
1417
|
if (n === 0)
|
|
1418
1418
|
return i * s;
|
|
1419
|
-
for (const
|
|
1420
|
-
const
|
|
1421
|
-
if (Math.abs(
|
|
1419
|
+
for (const c of a) {
|
|
1420
|
+
const g = c.rotation.y === 90 ? c.box.dimensions.depth : c.box.dimensions.width, m = c.rotation.y === 90 ? c.box.dimensions.width : c.box.dimensions.depth, p = c.position.y + c.box.dimensions.height;
|
|
1421
|
+
if (Math.abs(p - n) > 1)
|
|
1422
1422
|
continue;
|
|
1423
|
-
const
|
|
1423
|
+
const h = this.calculateRectangleIntersection(
|
|
1424
1424
|
e,
|
|
1425
1425
|
t,
|
|
1426
1426
|
i,
|
|
1427
1427
|
s,
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1428
|
+
c.position.x,
|
|
1429
|
+
c.position.z,
|
|
1430
|
+
g,
|
|
1431
|
+
m
|
|
1432
1432
|
);
|
|
1433
|
-
|
|
1433
|
+
l += h;
|
|
1434
1434
|
}
|
|
1435
|
-
return
|
|
1435
|
+
return l;
|
|
1436
1436
|
}
|
|
1437
1437
|
/**
|
|
1438
1438
|
* Calculates intersection area between two rectangles
|
|
1439
1439
|
*
|
|
1440
1440
|
* @returns Intersection area in mm²
|
|
1441
1441
|
*/
|
|
1442
|
-
calculateRectangleIntersection(e, t, i, s, n, a,
|
|
1443
|
-
const
|
|
1444
|
-
return
|
|
1442
|
+
calculateRectangleIntersection(e, t, i, s, n, a, l, c) {
|
|
1443
|
+
const g = Math.max(0, Math.min(e + i, n + l) - Math.max(e, n)), m = Math.max(0, Math.min(t + s, a + c) - Math.max(t, a));
|
|
1444
|
+
return g * m;
|
|
1445
1445
|
}
|
|
1446
1446
|
/**
|
|
1447
1447
|
* Checks if a box would extend beyond the footprint of boxes in the layer directly below
|
|
@@ -1460,19 +1460,19 @@ class gt {
|
|
|
1460
1460
|
boxExtendsBeyondLowerLayer(e, t, i, s, n, a) {
|
|
1461
1461
|
if (n === 0)
|
|
1462
1462
|
return !1;
|
|
1463
|
-
const
|
|
1463
|
+
const l = a.filter((d) => {
|
|
1464
1464
|
const b = d.position.y + d.box.dimensions.height;
|
|
1465
1465
|
return Math.abs(b - n) <= 1;
|
|
1466
1466
|
});
|
|
1467
|
-
if (
|
|
1467
|
+
if (l.length === 0)
|
|
1468
1468
|
return !0;
|
|
1469
|
-
let
|
|
1470
|
-
for (const d of
|
|
1469
|
+
let c = 1 / 0, g = -1 / 0, m = 1 / 0, p = -1 / 0;
|
|
1470
|
+
for (const d of l) {
|
|
1471
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
|
-
|
|
1472
|
+
c = Math.min(c, d.position.x), g = Math.max(g, d.position.x + b), m = Math.min(m, d.position.z), p = Math.max(p, d.position.z + j);
|
|
1473
1473
|
}
|
|
1474
|
-
const w = e + i,
|
|
1475
|
-
return e <
|
|
1474
|
+
const w = e + i, h = t + s, x = 1;
|
|
1475
|
+
return e < c - x || w > g + x || t < m - x || h > p + x;
|
|
1476
1476
|
}
|
|
1477
1477
|
/**
|
|
1478
1478
|
* Scores a rectangle position based on multiple criteria
|
|
@@ -1489,8 +1489,8 @@ class gt {
|
|
|
1489
1489
|
let n = 0;
|
|
1490
1490
|
const a = `${e.x},${e.z}`;
|
|
1491
1491
|
i.get(a) === s && (n += 100), i.has(a) && i.get(a) !== s && (n -= 50);
|
|
1492
|
-
const
|
|
1493
|
-
return n += 50 / (1 +
|
|
1492
|
+
const l = e.width * e.depth - t.width * t.depth;
|
|
1493
|
+
return n += 50 / (1 + l / 1e4), n += 30 / (1 + e.x / 1e3 + e.z / 1e3), n;
|
|
1494
1494
|
}
|
|
1495
1495
|
/**
|
|
1496
1496
|
* Updates free rectangles after placing a box (Maximal Rectangles algorithm)
|
|
@@ -1503,27 +1503,27 @@ class gt {
|
|
|
1503
1503
|
updateFreeRectangles(e, t, i, s) {
|
|
1504
1504
|
const n = [];
|
|
1505
1505
|
for (let a = e.length - 1; a >= 0; a--) {
|
|
1506
|
-
const
|
|
1507
|
-
this.rectanglesIntersect(
|
|
1508
|
-
x:
|
|
1509
|
-
z:
|
|
1510
|
-
width: t.x -
|
|
1511
|
-
depth:
|
|
1512
|
-
}), t.x + i <
|
|
1506
|
+
const l = e[a];
|
|
1507
|
+
this.rectanglesIntersect(l, t, i, s) && (e.splice(a, 1), t.x > l.x && n.push({
|
|
1508
|
+
x: l.x,
|
|
1509
|
+
z: l.z,
|
|
1510
|
+
width: t.x - l.x,
|
|
1511
|
+
depth: l.depth
|
|
1512
|
+
}), t.x + i < l.x + l.width && n.push({
|
|
1513
1513
|
x: t.x + i,
|
|
1514
|
-
z:
|
|
1515
|
-
width:
|
|
1516
|
-
depth:
|
|
1517
|
-
}), t.z >
|
|
1518
|
-
x:
|
|
1519
|
-
z:
|
|
1520
|
-
width:
|
|
1521
|
-
depth: t.z -
|
|
1522
|
-
}), t.z + s <
|
|
1523
|
-
x:
|
|
1514
|
+
z: l.z,
|
|
1515
|
+
width: l.x + l.width - (t.x + i),
|
|
1516
|
+
depth: l.depth
|
|
1517
|
+
}), t.z > l.z && n.push({
|
|
1518
|
+
x: l.x,
|
|
1519
|
+
z: l.z,
|
|
1520
|
+
width: l.width,
|
|
1521
|
+
depth: t.z - l.z
|
|
1522
|
+
}), t.z + s < l.z + l.depth && n.push({
|
|
1523
|
+
x: l.x,
|
|
1524
1524
|
z: t.z + s,
|
|
1525
|
-
width:
|
|
1526
|
-
depth:
|
|
1525
|
+
width: l.width,
|
|
1526
|
+
depth: l.z + l.depth - (t.z + s)
|
|
1527
1527
|
}));
|
|
1528
1528
|
}
|
|
1529
1529
|
e.push(...n), this.removeContainedRectangles(e);
|
|
@@ -1599,10 +1599,10 @@ class gt {
|
|
|
1599
1599
|
* Calculates packing metrics
|
|
1600
1600
|
*/
|
|
1601
1601
|
calculateMetrics(e, t) {
|
|
1602
|
-
const i = t.dimensions.width * t.maxStackHeight * t.dimensions.depth, s = e.reduce((a,
|
|
1603
|
-
const
|
|
1604
|
-
return a +
|
|
1605
|
-
}, 0), n = e.reduce((a,
|
|
1602
|
+
const i = t.dimensions.width * t.maxStackHeight * t.dimensions.depth, s = e.reduce((a, l) => {
|
|
1603
|
+
const c = l.box.dimensions;
|
|
1604
|
+
return a + c.width * c.height * c.depth;
|
|
1605
|
+
}, 0), n = e.reduce((a, l) => a + l.box.weight, 0);
|
|
1606
1606
|
return {
|
|
1607
1607
|
volumeUtilization: i > 0 ? s / i : 0,
|
|
1608
1608
|
weightUtilization: t.maxWeight > 0 ? n / t.maxWeight : 0,
|
|
@@ -1611,10 +1611,67 @@ class gt {
|
|
|
1611
1611
|
};
|
|
1612
1612
|
}
|
|
1613
1613
|
}
|
|
1614
|
-
class
|
|
1614
|
+
class Xt {
|
|
1615
|
+
/**
|
|
1616
|
+
* Empaqueta un array de cajas en tantos pallets como sea necesario.
|
|
1617
|
+
* Utiliza la estrategia proporcionada para llenar piso por piso cada pallet,
|
|
1618
|
+
* creando nuevos pallets hasta ubicar todas las cajas.
|
|
1619
|
+
*
|
|
1620
|
+
* @param options Opciones de configuración
|
|
1621
|
+
* @returns Un array de StackedPallet construidos
|
|
1622
|
+
*/
|
|
1623
|
+
static packMultiple(e) {
|
|
1624
|
+
const {
|
|
1625
|
+
boxes: t,
|
|
1626
|
+
palletBase: i,
|
|
1627
|
+
strategy: s,
|
|
1628
|
+
maxFloorsPerPallet: n = 1,
|
|
1629
|
+
namePrefix: a = "Pallet"
|
|
1630
|
+
} = e, l = [];
|
|
1631
|
+
let c = [...t], g = 1;
|
|
1632
|
+
for (; c.length > 0; ) {
|
|
1633
|
+
const m = [], p = {
|
|
1634
|
+
id: `sep-auto-${g}`,
|
|
1635
|
+
dimensions: {
|
|
1636
|
+
width: i.dimensions.width,
|
|
1637
|
+
height: 5,
|
|
1638
|
+
depth: i.dimensions.depth
|
|
1639
|
+
},
|
|
1640
|
+
material: ae.CARDBOARD,
|
|
1641
|
+
weight: 1,
|
|
1642
|
+
metadata: {}
|
|
1643
|
+
};
|
|
1644
|
+
for (let w = 0; w < n && c.length !== 0; w++) {
|
|
1645
|
+
const h = s.pack(c, i);
|
|
1646
|
+
if (h.placements.length === 0) break;
|
|
1647
|
+
m.push({
|
|
1648
|
+
level: w,
|
|
1649
|
+
pallet: i,
|
|
1650
|
+
boxes: h.placements,
|
|
1651
|
+
...w < n - 1 && h.unplacedBoxes.length > 0 ? {
|
|
1652
|
+
separatorAbove: { ...p, id: `sep-${g}-${w}` }
|
|
1653
|
+
} : {}
|
|
1654
|
+
}), c = h.unplacedBoxes;
|
|
1655
|
+
}
|
|
1656
|
+
if (m.length === 0)
|
|
1657
|
+
break;
|
|
1658
|
+
l.push({
|
|
1659
|
+
id: `multi-${Date.now()}-${g}`,
|
|
1660
|
+
floors: m,
|
|
1661
|
+
metadata: { name: `${a} ${g}` }
|
|
1662
|
+
}), g++;
|
|
1663
|
+
}
|
|
1664
|
+
return {
|
|
1665
|
+
pallets: l,
|
|
1666
|
+
// Devuelve las que no se pudieron empaquetar por algún error (caja más grande que el pallet, etc)
|
|
1667
|
+
unplacedBoxes: c
|
|
1668
|
+
};
|
|
1669
|
+
}
|
|
1670
|
+
}
|
|
1671
|
+
class ft {
|
|
1615
1672
|
strategies = /* @__PURE__ */ new Map();
|
|
1616
1673
|
constructor() {
|
|
1617
|
-
this.register(new
|
|
1674
|
+
this.register(new ut()), this.register(new xt()), this.register(new gt()), this.register(new pt());
|
|
1618
1675
|
}
|
|
1619
1676
|
register(e) {
|
|
1620
1677
|
this.strategies.set(e.id, e);
|
|
@@ -1635,52 +1692,52 @@ class pt {
|
|
|
1635
1692
|
return this.strategies.has(e);
|
|
1636
1693
|
}
|
|
1637
1694
|
}
|
|
1638
|
-
const
|
|
1639
|
-
let
|
|
1640
|
-
function
|
|
1641
|
-
return `pallet-${++
|
|
1695
|
+
const wt = new ft();
|
|
1696
|
+
let yt = 0;
|
|
1697
|
+
function ke() {
|
|
1698
|
+
return `pallet-${++yt}`;
|
|
1642
1699
|
}
|
|
1643
|
-
class
|
|
1700
|
+
class D {
|
|
1644
1701
|
// ═══ Palets estándar internacionales ═══════════════════════════
|
|
1645
1702
|
/** Palet EUR/EPAL — Estándar europeo (1200×800×144mm, ISO 6780, madera, 1000kg) */
|
|
1646
1703
|
static euro(e) {
|
|
1647
|
-
return
|
|
1704
|
+
return D.fromPreset("EUR", e);
|
|
1648
1705
|
}
|
|
1649
1706
|
/** Palet GMA — Estándar norteamericano (1219×1016×145mm, 48"×40", madera, 1200kg) */
|
|
1650
1707
|
static gma(e) {
|
|
1651
|
-
return
|
|
1708
|
+
return D.fromPreset("GMA", e);
|
|
1652
1709
|
}
|
|
1653
1710
|
/** @deprecated Use gma() instead. Alias para compatibilidad. */
|
|
1654
1711
|
static american(e) {
|
|
1655
|
-
return
|
|
1712
|
+
return D.gma(e);
|
|
1656
1713
|
}
|
|
1657
1714
|
/** Palet UK Standard — Reino Unido (1200×1000×150mm, madera, 1000kg) */
|
|
1658
1715
|
static uk(e) {
|
|
1659
|
-
return
|
|
1716
|
+
return D.fromPreset("UK", e);
|
|
1660
1717
|
}
|
|
1661
1718
|
/** Palet Asia — Estándar asiático (1100×1100×150mm, ISO 6780, madera, 1000kg) */
|
|
1662
1719
|
static asia(e) {
|
|
1663
|
-
return
|
|
1720
|
+
return D.fromPreset("ASIA", e);
|
|
1664
1721
|
}
|
|
1665
1722
|
/** Palet australiano — Estándar de Australia (1165×1165×150mm, madera, 1000kg) */
|
|
1666
1723
|
static australian(e) {
|
|
1667
|
-
return
|
|
1724
|
+
return D.fromPreset("AUSTRALIAN", e);
|
|
1668
1725
|
}
|
|
1669
1726
|
/** Medio palet EUR — Half European Pallet (800×600×144mm, madera, 500kg) */
|
|
1670
1727
|
static halfEuro(e) {
|
|
1671
|
-
return
|
|
1728
|
+
return D.fromPreset("HALF_EUR", e);
|
|
1672
1729
|
}
|
|
1673
1730
|
/** Cuarto de palet EUR — Quarter European Pallet (600×400×144mm, madera, 250kg) */
|
|
1674
1731
|
static quarterEuro(e) {
|
|
1675
|
-
return
|
|
1732
|
+
return D.fromPreset("QUARTER_EUR", e);
|
|
1676
1733
|
}
|
|
1677
1734
|
/** Palet ISO 1 — ISO 6780 (1200×1000×150mm, igual que UK) */
|
|
1678
1735
|
static iso1(e) {
|
|
1679
|
-
return
|
|
1736
|
+
return D.fromPreset("ISO_1", e);
|
|
1680
1737
|
}
|
|
1681
1738
|
/** Palet ISO 2 — ISO 6780 (1200×800×144mm, equivalente a EUR) */
|
|
1682
1739
|
static iso2(e) {
|
|
1683
|
-
return
|
|
1740
|
+
return D.fromPreset("ISO_2", e);
|
|
1684
1741
|
}
|
|
1685
1742
|
// ═══ Método genérico desde preset ═════════════════════════════
|
|
1686
1743
|
/**
|
|
@@ -1693,7 +1750,7 @@ class Z {
|
|
|
1693
1750
|
if (!i)
|
|
1694
1751
|
throw new Error(`Unknown pallet preset: ${e}`);
|
|
1695
1752
|
return {
|
|
1696
|
-
id:
|
|
1753
|
+
id: ke(),
|
|
1697
1754
|
dimensions: { ...i.dimensions },
|
|
1698
1755
|
material: i.material,
|
|
1699
1756
|
maxWeight: i.maxWeight,
|
|
@@ -1707,7 +1764,7 @@ class Z {
|
|
|
1707
1764
|
/** Palet custom con dimensiones arbitrarias */
|
|
1708
1765
|
static custom(e, t) {
|
|
1709
1766
|
return {
|
|
1710
|
-
id:
|
|
1767
|
+
id: ke(),
|
|
1711
1768
|
dimensions: { ...e },
|
|
1712
1769
|
material: N.WOOD,
|
|
1713
1770
|
maxWeight: 1e3,
|
|
@@ -1730,16 +1787,16 @@ class Z {
|
|
|
1730
1787
|
}));
|
|
1731
1788
|
}
|
|
1732
1789
|
}
|
|
1733
|
-
let
|
|
1734
|
-
function
|
|
1735
|
-
return `truck-${++
|
|
1790
|
+
let vt = 0;
|
|
1791
|
+
function Te() {
|
|
1792
|
+
return `truck-${++vt}`;
|
|
1736
1793
|
}
|
|
1737
|
-
class
|
|
1794
|
+
class Dt {
|
|
1738
1795
|
/** Crea un camión a partir de un preset de tipo */
|
|
1739
1796
|
static fromPreset(e, t) {
|
|
1740
1797
|
const i = Ze[e];
|
|
1741
1798
|
return {
|
|
1742
|
-
id:
|
|
1799
|
+
id: Te(),
|
|
1743
1800
|
name: `Camión ${e}`,
|
|
1744
1801
|
truckType: e,
|
|
1745
1802
|
dimensions: { ...i.dimensions },
|
|
@@ -1752,7 +1809,7 @@ class Vt {
|
|
|
1752
1809
|
/** Crea un camión custom con dimensiones y peso arbitrarios */
|
|
1753
1810
|
static custom(e, t, i) {
|
|
1754
1811
|
return {
|
|
1755
|
-
id:
|
|
1812
|
+
id: Te(),
|
|
1756
1813
|
name: "Camión Custom",
|
|
1757
1814
|
truckType: oe.CUSTOM,
|
|
1758
1815
|
dimensions: { ...e },
|
|
@@ -1763,9 +1820,9 @@ class Vt {
|
|
|
1763
1820
|
};
|
|
1764
1821
|
}
|
|
1765
1822
|
}
|
|
1766
|
-
let
|
|
1767
|
-
function
|
|
1768
|
-
return `box-${++
|
|
1823
|
+
let bt = 0;
|
|
1824
|
+
function St() {
|
|
1825
|
+
return `box-${++bt}`;
|
|
1769
1826
|
}
|
|
1770
1827
|
class ge {
|
|
1771
1828
|
/**
|
|
@@ -1783,7 +1840,7 @@ class ge {
|
|
|
1783
1840
|
*/
|
|
1784
1841
|
static create(e, t) {
|
|
1785
1842
|
return {
|
|
1786
|
-
id:
|
|
1843
|
+
id: St(),
|
|
1787
1844
|
dimensions: { ...e },
|
|
1788
1845
|
weight: 5,
|
|
1789
1846
|
materialWeight: 5,
|
|
@@ -1843,16 +1900,16 @@ class ge {
|
|
|
1843
1900
|
});
|
|
1844
1901
|
}
|
|
1845
1902
|
}
|
|
1846
|
-
function
|
|
1847
|
-
return
|
|
1848
|
-
const t =
|
|
1903
|
+
function Zt(o, e) {
|
|
1904
|
+
return _(() => {
|
|
1905
|
+
const t = Qe(o), i = tt(o, e), n = ot({ pallet: e, boxes: o }), a = lt(o), l = at(o), c = ct(o), g = ht(e, o), m = dt(e, o), p = st(o), w = rt(e, o), h = [...l.violations, ...c.violations], x = [...g.violations, ...m.violations], u = [
|
|
1849
1906
|
...t.violations,
|
|
1850
1907
|
...i.violations,
|
|
1851
1908
|
...n.violations,
|
|
1852
1909
|
...a.violations,
|
|
1853
|
-
...
|
|
1910
|
+
...h,
|
|
1854
1911
|
...x,
|
|
1855
|
-
...
|
|
1912
|
+
...p.violations,
|
|
1856
1913
|
...w.violations
|
|
1857
1914
|
];
|
|
1858
1915
|
return {
|
|
@@ -1863,20 +1920,20 @@ function Xt(o, e) {
|
|
|
1863
1920
|
weight: n,
|
|
1864
1921
|
gravity: a,
|
|
1865
1922
|
stacking: {
|
|
1866
|
-
isValid:
|
|
1867
|
-
violations:
|
|
1923
|
+
isValid: l.isValid,
|
|
1924
|
+
violations: h
|
|
1868
1925
|
},
|
|
1869
1926
|
stability: {
|
|
1870
|
-
isValid:
|
|
1927
|
+
isValid: g.isValid && m.isValid,
|
|
1871
1928
|
violations: x
|
|
1872
1929
|
},
|
|
1873
|
-
fragile:
|
|
1930
|
+
fragile: p,
|
|
1874
1931
|
distribution: w
|
|
1875
1932
|
};
|
|
1876
1933
|
}, [o, e]);
|
|
1877
1934
|
}
|
|
1878
|
-
function
|
|
1879
|
-
return
|
|
1935
|
+
function Nt(o) {
|
|
1936
|
+
return _(() => {
|
|
1880
1937
|
if (!o || o.floors.length === 0)
|
|
1881
1938
|
return {
|
|
1882
1939
|
volumeUtilization: 0,
|
|
@@ -1888,15 +1945,15 @@ function Zt(o) {
|
|
|
1888
1945
|
boxCount: 0,
|
|
1889
1946
|
floorCount: 0
|
|
1890
1947
|
};
|
|
1891
|
-
const e =
|
|
1892
|
-
const
|
|
1893
|
-
return
|
|
1894
|
-
}, 0),
|
|
1948
|
+
const e = de(o), t = ye(o), i = o.floors[0].pallet, s = o.floors.flatMap((p) => p.boxes), n = s.length, a = o.floors.length, l = i.dimensions.width * i.maxStackHeight * i.dimensions.depth, c = s.reduce((p, w) => {
|
|
1949
|
+
const h = w.box.dimensions;
|
|
1950
|
+
return p + h.width * h.height * h.depth;
|
|
1951
|
+
}, 0), g = Y(s), m = ee(i, s);
|
|
1895
1952
|
return {
|
|
1896
|
-
volumeUtilization:
|
|
1953
|
+
volumeUtilization: l > 0 ? c / l : 0,
|
|
1897
1954
|
weightUtilization: i.maxWeight > 0 ? t / i.maxWeight : 0,
|
|
1898
|
-
centerOfGravity:
|
|
1899
|
-
stabilityScore:
|
|
1955
|
+
centerOfGravity: g,
|
|
1956
|
+
stabilityScore: m,
|
|
1900
1957
|
totalHeight: e,
|
|
1901
1958
|
totalWeight: t,
|
|
1902
1959
|
boxCount: n,
|
|
@@ -1904,8 +1961,8 @@ function Zt(o) {
|
|
|
1904
1961
|
};
|
|
1905
1962
|
}, [o]);
|
|
1906
1963
|
}
|
|
1907
|
-
function
|
|
1908
|
-
const t =
|
|
1964
|
+
function Ut(o, e = wt) {
|
|
1965
|
+
const t = _(
|
|
1909
1966
|
() => e.list().map((s) => ({ id: s.id, name: s.name })),
|
|
1910
1967
|
[e]
|
|
1911
1968
|
), i = q(
|
|
@@ -1914,14 +1971,14 @@ function Dt(o, e = ft) {
|
|
|
1914
1971
|
);
|
|
1915
1972
|
return { availableStrategies: t, pack: i };
|
|
1916
1973
|
}
|
|
1917
|
-
function
|
|
1918
|
-
return
|
|
1974
|
+
function Ht(o) {
|
|
1975
|
+
return _(() => {
|
|
1919
1976
|
const e = [];
|
|
1920
1977
|
for (const s of o.pallets) {
|
|
1921
|
-
const n =
|
|
1978
|
+
const n = $e(s, o);
|
|
1922
1979
|
e.push(...n.violations);
|
|
1923
1980
|
}
|
|
1924
|
-
const t =
|
|
1981
|
+
const t = Ke(o.pallets), i = [
|
|
1925
1982
|
...e,
|
|
1926
1983
|
...t.violations
|
|
1927
1984
|
];
|
|
@@ -1936,52 +1993,52 @@ function Nt(o) {
|
|
|
1936
1993
|
};
|
|
1937
1994
|
}, [o]);
|
|
1938
1995
|
}
|
|
1939
|
-
const
|
|
1996
|
+
const jt = V(function({
|
|
1940
1997
|
placedBox: e,
|
|
1941
1998
|
selected: t = !1,
|
|
1942
1999
|
highlighted: i = !1,
|
|
1943
2000
|
showLabel: s = !1,
|
|
1944
2001
|
color: n,
|
|
1945
2002
|
opacity: a,
|
|
1946
|
-
selectedColor:
|
|
1947
|
-
highlightedColor:
|
|
1948
|
-
onClick:
|
|
1949
|
-
onHover:
|
|
2003
|
+
selectedColor: l,
|
|
2004
|
+
highlightedColor: c,
|
|
2005
|
+
onClick: g,
|
|
2006
|
+
onHover: m
|
|
1950
2007
|
}) {
|
|
1951
|
-
const
|
|
1952
|
-
let C =
|
|
2008
|
+
const p = Ee(null), w = le(), { box: h, position: x, rotation: u } = e, d = U.MM_TO_M, b = n ?? h.color ?? w.box.color, j = a ?? w.box.opacity, T = l ?? w.selection.selectedColor, S = c ?? w.selection.highlightedColor;
|
|
2009
|
+
let C = h.dimensions.width, z = h.dimensions.depth;
|
|
1953
2010
|
(u.y === 90 || u.y === 270) && ([C, z] = [z, C]);
|
|
1954
|
-
const y =
|
|
1955
|
-
() => [C * d,
|
|
1956
|
-
[C, z,
|
|
1957
|
-
), v =
|
|
2011
|
+
const y = _(
|
|
2012
|
+
() => [C * d, h.dimensions.height * d, z * d],
|
|
2013
|
+
[C, z, h.dimensions.height, d]
|
|
2014
|
+
), v = _(
|
|
1958
2015
|
() => new B.Vector3(
|
|
1959
2016
|
x.x * d + y[0] / 2,
|
|
1960
2017
|
x.y * d + y[1] / 2,
|
|
1961
2018
|
x.z * d + y[2] / 2
|
|
1962
2019
|
),
|
|
1963
2020
|
[x, y, d]
|
|
1964
|
-
), M = t ?
|
|
2021
|
+
), M = t ? T : i ? S : null, E = q(
|
|
1965
2022
|
(R) => {
|
|
1966
|
-
R.stopPropagation(),
|
|
2023
|
+
R.stopPropagation(), g?.(e.id);
|
|
1967
2024
|
},
|
|
1968
|
-
[
|
|
1969
|
-
),
|
|
2025
|
+
[g, e.id]
|
|
2026
|
+
), k = q(
|
|
1970
2027
|
(R) => {
|
|
1971
|
-
R.stopPropagation(),
|
|
2028
|
+
R.stopPropagation(), m?.(e.id);
|
|
1972
2029
|
},
|
|
1973
|
-
[
|
|
2030
|
+
[m, e.id]
|
|
1974
2031
|
), I = q(() => {
|
|
1975
|
-
|
|
1976
|
-
}, [
|
|
2032
|
+
m?.(null);
|
|
2033
|
+
}, [m]);
|
|
1977
2034
|
return /* @__PURE__ */ r.jsxs("group", { children: [
|
|
1978
2035
|
/* @__PURE__ */ r.jsxs(
|
|
1979
2036
|
"mesh",
|
|
1980
2037
|
{
|
|
1981
|
-
ref:
|
|
2038
|
+
ref: p,
|
|
1982
2039
|
position: v,
|
|
1983
2040
|
onClick: E,
|
|
1984
|
-
onPointerOver:
|
|
2041
|
+
onPointerOver: k,
|
|
1985
2042
|
onPointerOut: I,
|
|
1986
2043
|
castShadow: !0,
|
|
1987
2044
|
receiveShadow: !0,
|
|
@@ -1994,23 +2051,26 @@ const St = V(function({
|
|
|
1994
2051
|
transparent: j < 1,
|
|
1995
2052
|
opacity: j,
|
|
1996
2053
|
roughness: w.box.roughness,
|
|
1997
|
-
metalness: w.box.metalness
|
|
2054
|
+
metalness: w.box.metalness,
|
|
2055
|
+
polygonOffset: !0,
|
|
2056
|
+
polygonOffsetFactor: 1,
|
|
2057
|
+
polygonOffsetUnits: 1
|
|
2058
|
+
}
|
|
2059
|
+
),
|
|
2060
|
+
/* @__PURE__ */ r.jsx(
|
|
2061
|
+
Xe,
|
|
2062
|
+
{
|
|
2063
|
+
linewidth: 2,
|
|
2064
|
+
scale: 1.001,
|
|
2065
|
+
threshold: 15,
|
|
2066
|
+
color: M ?? "#000000",
|
|
2067
|
+
opacity: M ? 1 : 0.6,
|
|
2068
|
+
transparent: !0
|
|
1998
2069
|
}
|
|
1999
2070
|
)
|
|
2000
2071
|
]
|
|
2001
2072
|
}
|
|
2002
2073
|
),
|
|
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
2074
|
M && /* @__PURE__ */ r.jsxs("mesh", { position: v, children: [
|
|
2015
2075
|
/* @__PURE__ */ r.jsx("boxGeometry", { args: y }),
|
|
2016
2076
|
/* @__PURE__ */ r.jsx(
|
|
@@ -2018,7 +2078,7 @@ const St = V(function({
|
|
|
2018
2078
|
{
|
|
2019
2079
|
color: M,
|
|
2020
2080
|
wireframe: !0,
|
|
2021
|
-
wireframeLinewidth:
|
|
2081
|
+
wireframeLinewidth: 2,
|
|
2022
2082
|
transparent: !0,
|
|
2023
2083
|
opacity: 0.9,
|
|
2024
2084
|
depthTest: !1
|
|
@@ -2026,7 +2086,7 @@ const St = V(function({
|
|
|
2026
2086
|
)
|
|
2027
2087
|
] }),
|
|
2028
2088
|
s && /* @__PURE__ */ r.jsx(
|
|
2029
|
-
|
|
2089
|
+
_e,
|
|
2030
2090
|
{
|
|
2031
2091
|
position: [v.x, v.y + y[1] / 2 + 0.05, v.z],
|
|
2032
2092
|
center: !0,
|
|
@@ -2039,62 +2099,62 @@ const St = V(function({
|
|
|
2039
2099
|
whiteSpace: "nowrap",
|
|
2040
2100
|
pointerEvents: "none"
|
|
2041
2101
|
},
|
|
2042
|
-
children:
|
|
2102
|
+
children: h.sku ?? h.type ?? h.id
|
|
2043
2103
|
}
|
|
2044
2104
|
)
|
|
2045
2105
|
] });
|
|
2046
|
-
}),
|
|
2106
|
+
}), Mt = V(function({
|
|
2047
2107
|
pallet: e,
|
|
2048
2108
|
position: t = { x: 0, y: 0, z: 0 },
|
|
2049
2109
|
color: i,
|
|
2050
2110
|
edgeColor: s
|
|
2051
2111
|
}) {
|
|
2052
|
-
const n =
|
|
2053
|
-
() => [
|
|
2054
|
-
[
|
|
2055
|
-
),
|
|
2112
|
+
const n = le(), a = i ?? n.pallet.color, l = s ?? n.pallet.edgeColor, c = U.MM_TO_M, g = e.dimensions, m = _(
|
|
2113
|
+
() => [g.width * c, g.height * c, g.depth * c],
|
|
2114
|
+
[g, c]
|
|
2115
|
+
), p = _(
|
|
2056
2116
|
() => new B.Vector3(
|
|
2057
|
-
t.x *
|
|
2058
|
-
t.y *
|
|
2059
|
-
t.z *
|
|
2117
|
+
t.x * c + m[0] / 2,
|
|
2118
|
+
t.y * c + m[1] / 2,
|
|
2119
|
+
t.z * c + m[2] / 2
|
|
2060
2120
|
),
|
|
2061
|
-
[t,
|
|
2121
|
+
[t, m, c]
|
|
2062
2122
|
);
|
|
2063
2123
|
return /* @__PURE__ */ r.jsxs("group", { children: [
|
|
2064
|
-
/* @__PURE__ */ r.jsxs("mesh", { position:
|
|
2065
|
-
/* @__PURE__ */ r.jsx("boxGeometry", { args:
|
|
2124
|
+
/* @__PURE__ */ r.jsxs("mesh", { position: p, castShadow: !0, receiveShadow: !0, children: [
|
|
2125
|
+
/* @__PURE__ */ r.jsx("boxGeometry", { args: m }),
|
|
2066
2126
|
/* @__PURE__ */ r.jsx("meshStandardMaterial", { color: a, roughness: n.pallet.roughness, metalness: n.pallet.metalness })
|
|
2067
2127
|
] }),
|
|
2068
|
-
/* @__PURE__ */ r.jsxs("lineSegments", { position:
|
|
2069
|
-
/* @__PURE__ */ r.jsx("edgesGeometry", { args: [new B.BoxGeometry(...
|
|
2070
|
-
/* @__PURE__ */ r.jsx("lineBasicMaterial", { color:
|
|
2128
|
+
/* @__PURE__ */ r.jsxs("lineSegments", { position: p, children: [
|
|
2129
|
+
/* @__PURE__ */ r.jsx("edgesGeometry", { args: [new B.BoxGeometry(...m)] }),
|
|
2130
|
+
/* @__PURE__ */ r.jsx("lineBasicMaterial", { color: l })
|
|
2071
2131
|
] })
|
|
2072
2132
|
] });
|
|
2073
|
-
}),
|
|
2074
|
-
[
|
|
2075
|
-
[
|
|
2076
|
-
[
|
|
2077
|
-
},
|
|
2133
|
+
}), zt = {
|
|
2134
|
+
[ae.CARDBOARD]: "#b5926b",
|
|
2135
|
+
[ae.WOOD]: "#c4a26e",
|
|
2136
|
+
[ae.PLASTIC]: "#90a4ae"
|
|
2137
|
+
}, Ct = V(function({
|
|
2078
2138
|
separator: e,
|
|
2079
2139
|
position: t = { x: 0, y: 0, z: 0 }
|
|
2080
2140
|
}) {
|
|
2081
|
-
const i = U.MM_TO_M, s = e.dimensions, n =
|
|
2141
|
+
const i = U.MM_TO_M, s = e.dimensions, n = _(
|
|
2082
2142
|
() => [s.width * i, s.height * i, s.depth * i],
|
|
2083
2143
|
[s, i]
|
|
2084
|
-
), a =
|
|
2144
|
+
), a = _(
|
|
2085
2145
|
() => new B.Vector3(
|
|
2086
2146
|
t.x * i + n[0] / 2,
|
|
2087
2147
|
t.y * i + n[1] / 2,
|
|
2088
2148
|
t.z * i + n[2] / 2
|
|
2089
2149
|
),
|
|
2090
2150
|
[t, n, i]
|
|
2091
|
-
),
|
|
2151
|
+
), l = zt[e.material];
|
|
2092
2152
|
return /* @__PURE__ */ r.jsxs("mesh", { position: a, receiveShadow: !0, children: [
|
|
2093
2153
|
/* @__PURE__ */ r.jsx("boxGeometry", { args: n }),
|
|
2094
2154
|
/* @__PURE__ */ r.jsx(
|
|
2095
2155
|
"meshStandardMaterial",
|
|
2096
2156
|
{
|
|
2097
|
-
color:
|
|
2157
|
+
color: l,
|
|
2098
2158
|
roughness: 0.9,
|
|
2099
2159
|
metalness: 0,
|
|
2100
2160
|
transparent: !0,
|
|
@@ -2110,71 +2170,71 @@ const St = V(function({
|
|
|
2110
2170
|
palletId: s,
|
|
2111
2171
|
selectedBoxId: n,
|
|
2112
2172
|
highlightedBoxId: a,
|
|
2113
|
-
selectedColor:
|
|
2114
|
-
highlightedColor:
|
|
2115
|
-
showLabels:
|
|
2116
|
-
onBoxClick:
|
|
2117
|
-
onBoxHover:
|
|
2173
|
+
selectedColor: l,
|
|
2174
|
+
highlightedColor: c,
|
|
2175
|
+
showLabels: g = !1,
|
|
2176
|
+
onBoxClick: m,
|
|
2177
|
+
onBoxHover: p
|
|
2118
2178
|
}) {
|
|
2119
|
-
const w =
|
|
2120
|
-
() =>
|
|
2179
|
+
const w = _(
|
|
2180
|
+
() => Je(e, s),
|
|
2121
2181
|
[e, s]
|
|
2122
|
-
),
|
|
2182
|
+
), h = U.MM_TO_M, x = _(() => i * Math.PI / 180, [i]), u = _(() => {
|
|
2123
2183
|
const d = [];
|
|
2124
2184
|
let b = 0;
|
|
2125
2185
|
for (const j of w.floors) {
|
|
2126
2186
|
d.push(b), b += j.pallet.dimensions.height;
|
|
2127
|
-
const
|
|
2187
|
+
const T = j.boxes.reduce(
|
|
2128
2188
|
(S, C) => Math.max(S, C.position.y + C.box.dimensions.height),
|
|
2129
2189
|
0
|
|
2130
2190
|
);
|
|
2131
|
-
b +=
|
|
2191
|
+
b += T, j.separatorAbove && (b += j.separatorAbove.dimensions.height);
|
|
2132
2192
|
}
|
|
2133
2193
|
return d;
|
|
2134
2194
|
}, [w]);
|
|
2135
2195
|
return /* @__PURE__ */ r.jsx(
|
|
2136
2196
|
"group",
|
|
2137
2197
|
{
|
|
2138
|
-
position: [t.x *
|
|
2198
|
+
position: [t.x * h, t.y * h, t.z * h],
|
|
2139
2199
|
rotation: [0, x, 0],
|
|
2140
2200
|
children: w.floors.map((d, b) => {
|
|
2141
|
-
const j = u[b],
|
|
2201
|
+
const j = u[b], T = j + d.pallet.dimensions.height;
|
|
2142
2202
|
return /* @__PURE__ */ r.jsxs("group", { children: [
|
|
2143
2203
|
/* @__PURE__ */ r.jsx(
|
|
2144
|
-
|
|
2204
|
+
Mt,
|
|
2145
2205
|
{
|
|
2146
2206
|
pallet: d.pallet,
|
|
2147
2207
|
position: { x: 0, y: j, z: 0 }
|
|
2148
2208
|
}
|
|
2149
2209
|
),
|
|
2150
2210
|
d.boxes.map((S) => /* @__PURE__ */ r.jsx(
|
|
2151
|
-
|
|
2211
|
+
jt,
|
|
2152
2212
|
{
|
|
2153
2213
|
placedBox: {
|
|
2154
2214
|
...S,
|
|
2155
2215
|
position: {
|
|
2156
2216
|
x: S.position.x,
|
|
2157
|
-
y: S.position.y +
|
|
2217
|
+
y: S.position.y + T,
|
|
2158
2218
|
z: S.position.z
|
|
2159
2219
|
}
|
|
2160
2220
|
},
|
|
2161
2221
|
selected: n === S.id,
|
|
2162
2222
|
highlighted: a === S.id,
|
|
2163
|
-
selectedColor:
|
|
2164
|
-
highlightedColor:
|
|
2165
|
-
showLabel:
|
|
2166
|
-
onClick:
|
|
2167
|
-
onHover:
|
|
2223
|
+
selectedColor: l,
|
|
2224
|
+
highlightedColor: c,
|
|
2225
|
+
showLabel: g,
|
|
2226
|
+
onClick: m,
|
|
2227
|
+
onHover: p
|
|
2168
2228
|
},
|
|
2169
2229
|
S.id
|
|
2170
2230
|
)),
|
|
2171
2231
|
d.separatorAbove && /* @__PURE__ */ r.jsx(
|
|
2172
|
-
|
|
2232
|
+
Ct,
|
|
2173
2233
|
{
|
|
2174
2234
|
separator: d.separatorAbove,
|
|
2175
2235
|
position: {
|
|
2176
2236
|
x: 0,
|
|
2177
|
-
y:
|
|
2237
|
+
y: T + d.boxes.reduce(
|
|
2178
2238
|
(S, C) => Math.max(S, C.position.y + C.box.dimensions.height),
|
|
2179
2239
|
0
|
|
2180
2240
|
),
|
|
@@ -2187,7 +2247,7 @@ const St = V(function({
|
|
|
2187
2247
|
}
|
|
2188
2248
|
);
|
|
2189
2249
|
}
|
|
2190
|
-
),
|
|
2250
|
+
), Yt = V(function({
|
|
2191
2251
|
text: e,
|
|
2192
2252
|
position: t,
|
|
2193
2253
|
visible: i = !0,
|
|
@@ -2196,11 +2256,11 @@ const St = V(function({
|
|
|
2196
2256
|
background: a = "rgba(0,0,0,0.75)"
|
|
2197
2257
|
}) {
|
|
2198
2258
|
if (!i) return null;
|
|
2199
|
-
const
|
|
2259
|
+
const l = U.MM_TO_M;
|
|
2200
2260
|
return /* @__PURE__ */ r.jsx(
|
|
2201
|
-
|
|
2261
|
+
_e,
|
|
2202
2262
|
{
|
|
2203
|
-
position: [t.x *
|
|
2263
|
+
position: [t.x * l, t.y * l, t.z * l],
|
|
2204
2264
|
center: !0,
|
|
2205
2265
|
style: {
|
|
2206
2266
|
background: a,
|
|
@@ -2215,7 +2275,7 @@ const St = V(function({
|
|
|
2215
2275
|
children: e
|
|
2216
2276
|
}
|
|
2217
2277
|
);
|
|
2218
|
-
}),
|
|
2278
|
+
}), Pt = V(
|
|
2219
2279
|
function({
|
|
2220
2280
|
room: e,
|
|
2221
2281
|
floorColor: t,
|
|
@@ -2223,33 +2283,33 @@ const St = V(function({
|
|
|
2223
2283
|
showGrid: s,
|
|
2224
2284
|
children: n
|
|
2225
2285
|
}) {
|
|
2226
|
-
const a =
|
|
2286
|
+
const a = le(), l = t ?? a.warehouse.floorColor, c = i ?? a.warehouse.wallColor, g = s ?? a.warehouse.showGrid, m = U.MM_TO_M, p = e.ceilingHeight * m, { shape: w, minX: h, maxX: x, minZ: u, maxZ: d } = _(() => {
|
|
2227
2287
|
const y = e.floorPolygon;
|
|
2228
|
-
let v = 1 / 0, M = -1 / 0, E = 1 / 0,
|
|
2288
|
+
let v = 1 / 0, M = -1 / 0, E = 1 / 0, k = -1 / 0;
|
|
2229
2289
|
for (const R of y)
|
|
2230
|
-
v = Math.min(v, R.x *
|
|
2290
|
+
v = Math.min(v, R.x * m), M = Math.max(M, R.x * m), E = Math.min(E, R.z * m), k = Math.max(k, R.z * m);
|
|
2231
2291
|
const I = new B.Shape();
|
|
2232
|
-
I.moveTo(y[0].x *
|
|
2292
|
+
I.moveTo(y[0].x * m, -y[0].z * m);
|
|
2233
2293
|
for (let R = 1; R < y.length; R++)
|
|
2234
|
-
I.lineTo(y[R].x *
|
|
2235
|
-
return I.closePath(), { shape: I, minX: v, maxX: M, minZ: E, maxZ:
|
|
2236
|
-
}, [e.floorPolygon,
|
|
2294
|
+
I.lineTo(y[R].x * m, -y[R].z * m);
|
|
2295
|
+
return I.closePath(), { shape: I, minX: v, maxX: M, minZ: E, maxZ: k };
|
|
2296
|
+
}, [e.floorPolygon, m]), b = _(() => {
|
|
2237
2297
|
const y = e.floorPolygon, v = [], M = [];
|
|
2238
|
-
for (let
|
|
2239
|
-
const I = y[
|
|
2298
|
+
for (let k = 0; k < y.length; k++) {
|
|
2299
|
+
const I = y[k], R = y[(k + 1) % y.length], A = k * 4;
|
|
2240
2300
|
v.push(
|
|
2241
|
-
I.x *
|
|
2301
|
+
I.x * m,
|
|
2242
2302
|
0,
|
|
2243
|
-
I.z *
|
|
2244
|
-
R.x *
|
|
2303
|
+
I.z * m,
|
|
2304
|
+
R.x * m,
|
|
2245
2305
|
0,
|
|
2246
|
-
R.z *
|
|
2247
|
-
R.x *
|
|
2248
|
-
|
|
2249
|
-
R.z *
|
|
2250
|
-
I.x *
|
|
2251
|
-
|
|
2252
|
-
I.z *
|
|
2306
|
+
R.z * m,
|
|
2307
|
+
R.x * m,
|
|
2308
|
+
p,
|
|
2309
|
+
R.z * m,
|
|
2310
|
+
I.x * m,
|
|
2311
|
+
p,
|
|
2312
|
+
I.z * m
|
|
2253
2313
|
), M.push(
|
|
2254
2314
|
A,
|
|
2255
2315
|
A + 1,
|
|
@@ -2261,23 +2321,23 @@ const St = V(function({
|
|
|
2261
2321
|
}
|
|
2262
2322
|
const E = new B.BufferGeometry();
|
|
2263
2323
|
return E.setAttribute("position", new B.Float32BufferAttribute(v, 3)), E.setIndex(M), E.computeVertexNormals(), E;
|
|
2264
|
-
}, [e.floorPolygon,
|
|
2265
|
-
if (!
|
|
2324
|
+
}, [e.floorPolygon, p, m]), j = x - h, T = d - u, S = (h + x) / 2, C = (u + d) / 2, z = _(() => {
|
|
2325
|
+
if (!g) return null;
|
|
2266
2326
|
const y = 0.5, v = 0.01, M = [];
|
|
2267
|
-
for (let
|
|
2268
|
-
M.push(
|
|
2269
|
-
for (let
|
|
2270
|
-
M.push(
|
|
2327
|
+
for (let k = h; k <= x; k += y)
|
|
2328
|
+
M.push(k, v, u, k, v, d);
|
|
2329
|
+
for (let k = u; k <= d; k += y)
|
|
2330
|
+
M.push(h, v, k, x, v, k);
|
|
2271
2331
|
const E = new B.BufferGeometry();
|
|
2272
2332
|
return E.setAttribute("position", new B.Float32BufferAttribute(M, 3)), E;
|
|
2273
|
-
}, [
|
|
2333
|
+
}, [g, h, x, u, d]);
|
|
2274
2334
|
return /* @__PURE__ */ r.jsxs("group", { children: [
|
|
2275
2335
|
/* @__PURE__ */ r.jsxs("mesh", { rotation: [-Math.PI / 2, 0, 0], position: [0, -5e-3, 0], receiveShadow: !0, children: [
|
|
2276
2336
|
/* @__PURE__ */ r.jsx("shapeGeometry", { args: [w] }),
|
|
2277
2337
|
/* @__PURE__ */ r.jsx(
|
|
2278
2338
|
"meshStandardMaterial",
|
|
2279
2339
|
{
|
|
2280
|
-
color:
|
|
2340
|
+
color: l,
|
|
2281
2341
|
side: B.DoubleSide,
|
|
2282
2342
|
roughness: a.warehouse.floorRoughness
|
|
2283
2343
|
}
|
|
@@ -2286,14 +2346,14 @@ const St = V(function({
|
|
|
2286
2346
|
/* @__PURE__ */ r.jsx("mesh", { geometry: b, position: [0, 0, 0], receiveShadow: !0, children: /* @__PURE__ */ r.jsx(
|
|
2287
2347
|
"meshStandardMaterial",
|
|
2288
2348
|
{
|
|
2289
|
-
color:
|
|
2349
|
+
color: c,
|
|
2290
2350
|
side: B.DoubleSide,
|
|
2291
2351
|
roughness: 0.7,
|
|
2292
2352
|
transparent: !0,
|
|
2293
2353
|
opacity: a.warehouse.wallOpacity
|
|
2294
2354
|
}
|
|
2295
2355
|
) }),
|
|
2296
|
-
|
|
2356
|
+
g && z && /* @__PURE__ */ r.jsx("lineSegments", { geometry: z, children: /* @__PURE__ */ r.jsx(
|
|
2297
2357
|
"lineBasicMaterial",
|
|
2298
2358
|
{
|
|
2299
2359
|
color: a.warehouse.gridColor,
|
|
@@ -2306,7 +2366,7 @@ const St = V(function({
|
|
|
2306
2366
|
/* @__PURE__ */ r.jsx(
|
|
2307
2367
|
"directionalLight",
|
|
2308
2368
|
{
|
|
2309
|
-
position: [S + j,
|
|
2369
|
+
position: [S + j, p * 0.8, C + T],
|
|
2310
2370
|
intensity: a.warehouse.directionalIntensity,
|
|
2311
2371
|
castShadow: !0,
|
|
2312
2372
|
"shadow-mapSize-width": 1024,
|
|
@@ -2316,9 +2376,9 @@ const St = V(function({
|
|
|
2316
2376
|
/* @__PURE__ */ r.jsx(
|
|
2317
2377
|
"pointLight",
|
|
2318
2378
|
{
|
|
2319
|
-
position: [S,
|
|
2379
|
+
position: [S, p * 0.9, C],
|
|
2320
2380
|
intensity: 0.5,
|
|
2321
|
-
distance: Math.max(j,
|
|
2381
|
+
distance: Math.max(j, T) * 2
|
|
2322
2382
|
}
|
|
2323
2383
|
),
|
|
2324
2384
|
n
|
|
@@ -2335,7 +2395,7 @@ const St = V(function({
|
|
|
2335
2395
|
/* @__PURE__ */ r.jsx("meshStandardMaterial", { color: "#888888", roughness: 0.3, metalness: 0.7 })
|
|
2336
2396
|
] })
|
|
2337
2397
|
] });
|
|
2338
|
-
}),
|
|
2398
|
+
}), Rt = V(function({
|
|
2339
2399
|
truck: e,
|
|
2340
2400
|
showGrid: t,
|
|
2341
2401
|
wallOpacity: i = 0.3,
|
|
@@ -2343,20 +2403,20 @@ const St = V(function({
|
|
|
2343
2403
|
showSideWalls: n = !0,
|
|
2344
2404
|
children: a
|
|
2345
2405
|
}) {
|
|
2346
|
-
const
|
|
2347
|
-
if (!
|
|
2348
|
-
const G = 0.5,
|
|
2349
|
-
for (let X = 0; X <=
|
|
2350
|
-
H.push(X,
|
|
2351
|
-
for (let X = 0; X <=
|
|
2352
|
-
H.push(0,
|
|
2406
|
+
const c = le().truck, g = t ?? c.showGrid, m = U.MM_TO_M, p = e.dimensions.width * m, w = e.dimensions.height * m, h = e.dimensions.depth * m, x = 0.05, u = 0.08, d = 0.28, b = 0.18, j = 0.15, T = 0.25, S = d + j, C = S + d + 0.1, z = C + T / 2 + u / 2, y = p + x * 2, v = p * 0.65, M = w * 0.85, E = 0.15, k = h + x + E, I = z, R = _(() => {
|
|
2407
|
+
if (!g) return null;
|
|
2408
|
+
const G = 0.5, Z = z + 2e-3, H = [];
|
|
2409
|
+
for (let X = 0; X <= p; X += G)
|
|
2410
|
+
H.push(X, Z, 0, X, Z, h);
|
|
2411
|
+
for (let X = 0; X <= h; X += G)
|
|
2412
|
+
H.push(0, Z, X, p, Z, X);
|
|
2353
2413
|
const F = new B.BufferGeometry();
|
|
2354
2414
|
return F.setAttribute("position", new B.Float32BufferAttribute(H, 3)), F;
|
|
2355
|
-
}, [
|
|
2415
|
+
}, [g, p, h, z]), A = _(
|
|
2356
2416
|
() => /* @__PURE__ */ r.jsx(
|
|
2357
2417
|
"meshStandardMaterial",
|
|
2358
2418
|
{
|
|
2359
|
-
color:
|
|
2419
|
+
color: c.wallColor,
|
|
2360
2420
|
roughness: 0.5,
|
|
2361
2421
|
metalness: 0.3,
|
|
2362
2422
|
transparent: i < 1,
|
|
@@ -2365,72 +2425,72 @@ const St = V(function({
|
|
|
2365
2425
|
depthWrite: i >= 0.95
|
|
2366
2426
|
}
|
|
2367
2427
|
),
|
|
2368
|
-
[
|
|
2428
|
+
[c.wallColor, i]
|
|
2369
2429
|
);
|
|
2370
2430
|
return /* @__PURE__ */ r.jsxs("group", { children: [
|
|
2371
2431
|
/* @__PURE__ */ r.jsxs(
|
|
2372
2432
|
"mesh",
|
|
2373
2433
|
{
|
|
2374
|
-
position: [
|
|
2434
|
+
position: [p / 2, z, h / 2],
|
|
2375
2435
|
rotation: [-Math.PI / 2, 0, 0],
|
|
2376
2436
|
receiveShadow: !0,
|
|
2377
2437
|
children: [
|
|
2378
|
-
/* @__PURE__ */ r.jsx("planeGeometry", { args: [
|
|
2379
|
-
/* @__PURE__ */ r.jsx("meshStandardMaterial", { color:
|
|
2438
|
+
/* @__PURE__ */ r.jsx("planeGeometry", { args: [p, h] }),
|
|
2439
|
+
/* @__PURE__ */ r.jsx("meshStandardMaterial", { color: c.floorColor, roughness: 0.85 })
|
|
2380
2440
|
]
|
|
2381
2441
|
}
|
|
2382
2442
|
),
|
|
2383
|
-
/* @__PURE__ */ r.jsxs("mesh", { position: [
|
|
2384
|
-
/* @__PURE__ */ r.jsx("boxGeometry", { args: [
|
|
2385
|
-
/* @__PURE__ */ r.jsx("meshStandardMaterial", { color:
|
|
2443
|
+
/* @__PURE__ */ r.jsxs("mesh", { position: [p / 2, z - u / 2, h / 2], castShadow: !0, receiveShadow: !0, children: [
|
|
2444
|
+
/* @__PURE__ */ r.jsx("boxGeometry", { args: [p + x * 2, u, h + x] }),
|
|
2445
|
+
/* @__PURE__ */ r.jsx("meshStandardMaterial", { color: c.floorColor, roughness: 0.85, metalness: 0.1 })
|
|
2386
2446
|
] }),
|
|
2387
|
-
n && /* @__PURE__ */ r.jsxs("mesh", { position: [-x / 2, z + w / 2,
|
|
2388
|
-
/* @__PURE__ */ r.jsx("boxGeometry", { args: [x, w,
|
|
2447
|
+
n && /* @__PURE__ */ r.jsxs("mesh", { position: [-x / 2, z + w / 2, h / 2], castShadow: !0, children: [
|
|
2448
|
+
/* @__PURE__ */ r.jsx("boxGeometry", { args: [x, w, h + x] }),
|
|
2389
2449
|
A
|
|
2390
2450
|
] }),
|
|
2391
|
-
n && /* @__PURE__ */ r.jsxs("mesh", { position: [
|
|
2392
|
-
/* @__PURE__ */ r.jsx("boxGeometry", { args: [x, w,
|
|
2451
|
+
n && /* @__PURE__ */ r.jsxs("mesh", { position: [p + x / 2, z + w / 2, h / 2], castShadow: !0, children: [
|
|
2452
|
+
/* @__PURE__ */ r.jsx("boxGeometry", { args: [x, w, h + x] }),
|
|
2393
2453
|
A
|
|
2394
2454
|
] }),
|
|
2395
|
-
/* @__PURE__ */ r.jsxs("mesh", { position: [
|
|
2396
|
-
/* @__PURE__ */ r.jsx("boxGeometry", { args: [
|
|
2455
|
+
/* @__PURE__ */ r.jsxs("mesh", { position: [p / 2, z + w / 2, h + x / 2], castShadow: !0, children: [
|
|
2456
|
+
/* @__PURE__ */ r.jsx("boxGeometry", { args: [p + x * 2, w, x] }),
|
|
2397
2457
|
A
|
|
2398
2458
|
] }),
|
|
2399
|
-
s && /* @__PURE__ */ r.jsxs("mesh", { position: [
|
|
2400
|
-
/* @__PURE__ */ r.jsx("boxGeometry", { args: [
|
|
2459
|
+
s && /* @__PURE__ */ r.jsxs("mesh", { position: [p / 2, z + w, h / 2], castShadow: !0, children: [
|
|
2460
|
+
/* @__PURE__ */ r.jsx("boxGeometry", { args: [p + x * 2, x, h + x] }),
|
|
2401
2461
|
A
|
|
2402
2462
|
] }),
|
|
2403
|
-
|
|
2463
|
+
g && R && /* @__PURE__ */ r.jsx("lineSegments", { geometry: R, children: /* @__PURE__ */ r.jsx(
|
|
2404
2464
|
"lineBasicMaterial",
|
|
2405
2465
|
{
|
|
2406
|
-
color:
|
|
2466
|
+
color: c.gridColor,
|
|
2407
2467
|
opacity: 0.5,
|
|
2408
2468
|
transparent: !0,
|
|
2409
2469
|
depthWrite: !1
|
|
2410
2470
|
}
|
|
2411
2471
|
) }),
|
|
2412
|
-
/* @__PURE__ */ r.jsxs("mesh", { position: [
|
|
2413
|
-
/* @__PURE__ */ r.jsx("boxGeometry", { args: [0.12,
|
|
2414
|
-
/* @__PURE__ */ r.jsx("meshStandardMaterial", { color:
|
|
2472
|
+
/* @__PURE__ */ r.jsxs("mesh", { position: [p * 0.25, C, (h + v + E) / 2], castShadow: !0, children: [
|
|
2473
|
+
/* @__PURE__ */ r.jsx("boxGeometry", { args: [0.12, T, h + v + E] }),
|
|
2474
|
+
/* @__PURE__ */ r.jsx("meshStandardMaterial", { color: c.chassisColor, roughness: 0.7, metalness: 0.5 })
|
|
2415
2475
|
] }),
|
|
2416
|
-
/* @__PURE__ */ r.jsxs("mesh", { position: [
|
|
2417
|
-
/* @__PURE__ */ r.jsx("boxGeometry", { args: [0.12,
|
|
2418
|
-
/* @__PURE__ */ r.jsx("meshStandardMaterial", { color:
|
|
2476
|
+
/* @__PURE__ */ r.jsxs("mesh", { position: [p * 0.75, C, (h + v + E) / 2], castShadow: !0, children: [
|
|
2477
|
+
/* @__PURE__ */ r.jsx("boxGeometry", { args: [0.12, T, h + v + E] }),
|
|
2478
|
+
/* @__PURE__ */ r.jsx("meshStandardMaterial", { color: c.chassisColor, roughness: 0.7, metalness: 0.5 })
|
|
2419
2479
|
] }),
|
|
2420
|
-
[0.15, 0.35, 0.55, 0.75, 0.95].map((G) => /* @__PURE__ */ r.jsxs("mesh", { position: [
|
|
2421
|
-
/* @__PURE__ */ r.jsx("boxGeometry", { args: [
|
|
2422
|
-
/* @__PURE__ */ r.jsx("meshStandardMaterial", { color:
|
|
2480
|
+
[0.15, 0.35, 0.55, 0.75, 0.95].map((G) => /* @__PURE__ */ r.jsxs("mesh", { position: [p / 2, C, h * G], castShadow: !0, children: [
|
|
2481
|
+
/* @__PURE__ */ r.jsx("boxGeometry", { args: [p * 0.6, 0.06, 0.06] }),
|
|
2482
|
+
/* @__PURE__ */ r.jsx("meshStandardMaterial", { color: c.chassisColor, roughness: 0.7, metalness: 0.5 })
|
|
2423
2483
|
] }, G)),
|
|
2424
|
-
/* @__PURE__ */ r.jsx(K, { position: [-b / 2 - x, S,
|
|
2425
|
-
/* @__PURE__ */ r.jsx(K, { position: [
|
|
2426
|
-
/* @__PURE__ */ r.jsx(K, { position: [-b / 2 - x, S,
|
|
2427
|
-
/* @__PURE__ */ r.jsx(K, { position: [
|
|
2428
|
-
/* @__PURE__ */ r.jsx(K, { position: [-b / 2 - x, S,
|
|
2429
|
-
/* @__PURE__ */ r.jsx(K, { position: [
|
|
2430
|
-
/* @__PURE__ */ r.jsxs("group", { position: [
|
|
2484
|
+
/* @__PURE__ */ r.jsx(K, { position: [-b / 2 - x, S, h * 0.12], radius: d, width: b, color: c.wheelColor }),
|
|
2485
|
+
/* @__PURE__ */ r.jsx(K, { position: [p + b / 2 + x, S, h * 0.12], radius: d, width: b, color: c.wheelColor }),
|
|
2486
|
+
/* @__PURE__ */ r.jsx(K, { position: [-b / 2 - x, S, h * 0.22], radius: d, width: b, color: c.wheelColor }),
|
|
2487
|
+
/* @__PURE__ */ r.jsx(K, { position: [p + b / 2 + x, S, h * 0.22], radius: d, width: b, color: c.wheelColor }),
|
|
2488
|
+
/* @__PURE__ */ r.jsx(K, { position: [-b / 2 - x, S, k + v * 0.5], radius: d, width: b, color: c.wheelColor }),
|
|
2489
|
+
/* @__PURE__ */ r.jsx(K, { position: [p + b / 2 + x, S, k + v * 0.5], radius: d, width: b, color: c.wheelColor }),
|
|
2490
|
+
/* @__PURE__ */ r.jsxs("group", { position: [p / 2, I, k], children: [
|
|
2431
2491
|
/* @__PURE__ */ r.jsxs("mesh", { position: [0, M / 2, v / 2], castShadow: !0, receiveShadow: !0, children: [
|
|
2432
2492
|
/* @__PURE__ */ r.jsx("boxGeometry", { args: [y, M, v] }),
|
|
2433
|
-
/* @__PURE__ */ r.jsx("meshStandardMaterial", { color:
|
|
2493
|
+
/* @__PURE__ */ r.jsx("meshStandardMaterial", { color: c.cabColor, roughness: 0.4, metalness: 0.3 })
|
|
2434
2494
|
] }),
|
|
2435
2495
|
/* @__PURE__ */ r.jsxs(
|
|
2436
2496
|
"mesh",
|
|
@@ -2483,11 +2543,11 @@ const St = V(function({
|
|
|
2483
2543
|
] }),
|
|
2484
2544
|
/* @__PURE__ */ r.jsxs("mesh", { position: [0, M + 0.04, v / 2], children: [
|
|
2485
2545
|
/* @__PURE__ */ r.jsx("boxGeometry", { args: [y * 0.95, 0.08, v * 0.9] }),
|
|
2486
|
-
/* @__PURE__ */ r.jsx("meshStandardMaterial", { color:
|
|
2546
|
+
/* @__PURE__ */ r.jsx("meshStandardMaterial", { color: c.cabColor, roughness: 0.4, metalness: 0.3 })
|
|
2487
2547
|
] }),
|
|
2488
2548
|
/* @__PURE__ */ r.jsxs("mesh", { position: [0, M + 0.25, v * 0.1], rotation: [-0.3, 0, 0], children: [
|
|
2489
2549
|
/* @__PURE__ */ r.jsx("boxGeometry", { args: [y * 0.9, 0.04, v * 0.5] }),
|
|
2490
|
-
/* @__PURE__ */ r.jsx("meshStandardMaterial", { color:
|
|
2550
|
+
/* @__PURE__ */ r.jsx("meshStandardMaterial", { color: c.cabColor, roughness: 0.4, metalness: 0.3 })
|
|
2491
2551
|
] }),
|
|
2492
2552
|
/* @__PURE__ */ r.jsxs("mesh", { position: [-y * 0.35, M * 0.2, v + 0.02], children: [
|
|
2493
2553
|
/* @__PURE__ */ r.jsx("boxGeometry", { args: [y * 0.15, 0.08, 0.02] }),
|
|
@@ -2499,21 +2559,21 @@ const St = V(function({
|
|
|
2499
2559
|
] }),
|
|
2500
2560
|
/* @__PURE__ */ r.jsxs("mesh", { position: [0, 0.06, v + 0.04], castShadow: !0, children: [
|
|
2501
2561
|
/* @__PURE__ */ r.jsx("boxGeometry", { args: [y * 1.02, 0.12, 0.06] }),
|
|
2502
|
-
/* @__PURE__ */ r.jsx("meshStandardMaterial", { color:
|
|
2562
|
+
/* @__PURE__ */ r.jsx("meshStandardMaterial", { color: c.chassisColor, roughness: 0.5, metalness: 0.6 })
|
|
2503
2563
|
] })
|
|
2504
2564
|
] }),
|
|
2505
2565
|
[-1, 1].map((G) => /* @__PURE__ */ r.jsxs(
|
|
2506
2566
|
"mesh",
|
|
2507
2567
|
{
|
|
2508
2568
|
position: [
|
|
2509
|
-
G === -1 ? -x - b * 0.5 :
|
|
2569
|
+
G === -1 ? -x - b * 0.5 : p + x + b * 0.5,
|
|
2510
2570
|
S + d * 0.6,
|
|
2511
|
-
|
|
2571
|
+
h * 0.17
|
|
2512
2572
|
],
|
|
2513
2573
|
castShadow: !0,
|
|
2514
2574
|
children: [
|
|
2515
2575
|
/* @__PURE__ */ r.jsx("boxGeometry", { args: [b + 0.04, 0.04, d * 2.5] }),
|
|
2516
|
-
/* @__PURE__ */ r.jsx("meshStandardMaterial", { color:
|
|
2576
|
+
/* @__PURE__ */ r.jsx("meshStandardMaterial", { color: c.chassisColor, roughness: 0.6, metalness: 0.4 })
|
|
2517
2577
|
]
|
|
2518
2578
|
},
|
|
2519
2579
|
`fender-rear-${G}`
|
|
@@ -2522,7 +2582,7 @@ const St = V(function({
|
|
|
2522
2582
|
/* @__PURE__ */ r.jsx("boxGeometry", { args: [0.08, 0.12, 0.02] }),
|
|
2523
2583
|
/* @__PURE__ */ r.jsx("meshStandardMaterial", { color: "#ff3333", emissive: "#ff0000", emissiveIntensity: 0.3 })
|
|
2524
2584
|
] }),
|
|
2525
|
-
/* @__PURE__ */ r.jsxs("mesh", { position: [
|
|
2585
|
+
/* @__PURE__ */ r.jsxs("mesh", { position: [p + x / 2 - 0.01, z + w * 0.3, -0.01], children: [
|
|
2526
2586
|
/* @__PURE__ */ r.jsx("boxGeometry", { args: [0.08, 0.12, 0.02] }),
|
|
2527
2587
|
/* @__PURE__ */ r.jsx("meshStandardMaterial", { color: "#ff3333", emissive: "#ff0000", emissiveIntensity: 0.3 })
|
|
2528
2588
|
] }),
|
|
@@ -2530,19 +2590,19 @@ const St = V(function({
|
|
|
2530
2590
|
/* @__PURE__ */ r.jsx(
|
|
2531
2591
|
"directionalLight",
|
|
2532
2592
|
{
|
|
2533
|
-
position: [
|
|
2593
|
+
position: [p / 2, z + w * 1.5, h * 0.8],
|
|
2534
2594
|
intensity: 0.75,
|
|
2535
2595
|
castShadow: !0,
|
|
2536
2596
|
"shadow-mapSize-width": 1024,
|
|
2537
2597
|
"shadow-mapSize-height": 1024
|
|
2538
2598
|
}
|
|
2539
2599
|
),
|
|
2540
|
-
/* @__PURE__ */ r.jsx("pointLight", { position: [
|
|
2541
|
-
/* @__PURE__ */ r.jsx("pointLight", { position: [
|
|
2600
|
+
/* @__PURE__ */ r.jsx("pointLight", { position: [p / 2, z + w * 0.7, h / 2], intensity: 0.35 }),
|
|
2601
|
+
/* @__PURE__ */ r.jsx("pointLight", { position: [p / 2, z + w * 0.9, h * 0.3], intensity: 0.25 }),
|
|
2542
2602
|
/* @__PURE__ */ r.jsx("group", { position: [0, z, 0], children: a })
|
|
2543
2603
|
] });
|
|
2544
2604
|
});
|
|
2545
|
-
function
|
|
2605
|
+
function kt(o, e, t) {
|
|
2546
2606
|
if (!t)
|
|
2547
2607
|
return {
|
|
2548
2608
|
perspective: [3, 3, 3],
|
|
@@ -2551,26 +2611,26 @@ function Rt(o, e, t) {
|
|
|
2551
2611
|
front: [0, 1.5, 5],
|
|
2552
2612
|
side: [5, 1.5, 0]
|
|
2553
2613
|
}[o];
|
|
2554
|
-
const { width: i, height: s, depth: n } = t, [a,
|
|
2614
|
+
const { width: i, height: s, depth: n } = t, [a, l, c] = e, m = Math.sqrt(i ** 2 + s ** 2 + n ** 2) * 3;
|
|
2555
2615
|
switch (o) {
|
|
2556
2616
|
case "perspective":
|
|
2557
2617
|
return [
|
|
2558
|
-
a +
|
|
2559
|
-
|
|
2560
|
-
|
|
2618
|
+
a + m * 0.6,
|
|
2619
|
+
l + m * 0.5,
|
|
2620
|
+
c + m * 0.6
|
|
2561
2621
|
];
|
|
2562
2622
|
case "isometric":
|
|
2563
2623
|
return [
|
|
2564
|
-
a +
|
|
2565
|
-
|
|
2566
|
-
|
|
2624
|
+
a + m * 0.577,
|
|
2625
|
+
l + m * 0.577,
|
|
2626
|
+
c + m * 0.577
|
|
2567
2627
|
];
|
|
2568
2628
|
case "top":
|
|
2569
|
-
return [a,
|
|
2629
|
+
return [a, l + Math.max(m, s * 2), c];
|
|
2570
2630
|
case "front":
|
|
2571
|
-
return [a,
|
|
2631
|
+
return [a, l + s * 0.5, c + Math.max(m, n * 1.5)];
|
|
2572
2632
|
case "side":
|
|
2573
|
-
return [a + Math.max(
|
|
2633
|
+
return [a + Math.max(m, i * 1.5), l + s * 0.5, c];
|
|
2574
2634
|
}
|
|
2575
2635
|
}
|
|
2576
2636
|
const Se = V(function({
|
|
@@ -2580,20 +2640,20 @@ const Se = V(function({
|
|
|
2580
2640
|
enableZoom: s = !0,
|
|
2581
2641
|
target: n = [0, 0, 0],
|
|
2582
2642
|
minDistance: a = 0.5,
|
|
2583
|
-
maxDistance:
|
|
2584
|
-
sceneSize:
|
|
2643
|
+
maxDistance: l = 50,
|
|
2644
|
+
sceneSize: c
|
|
2585
2645
|
}) {
|
|
2586
|
-
const { camera:
|
|
2646
|
+
const { camera: g } = Ae(), m = Ee(null);
|
|
2587
2647
|
return pe(() => {
|
|
2588
|
-
const
|
|
2589
|
-
const j = Date.now() - d,
|
|
2590
|
-
|
|
2648
|
+
const p = kt(e, n, c), w = new B.Vector3(p[0], p[1], p[2]), h = new B.Vector3(...n), x = g.position.clone(), u = 1e3, d = Date.now(), b = () => {
|
|
2649
|
+
const j = Date.now() - d, T = Math.min(j / u, 1), S = 1 - Math.pow(1 - T, 3);
|
|
2650
|
+
g.position.lerpVectors(x, w, S), m.current && (m.current.target.lerp(h, S), m.current.update()), T < 1 && requestAnimationFrame(b);
|
|
2591
2651
|
};
|
|
2592
2652
|
b();
|
|
2593
|
-
}, [e,
|
|
2594
|
-
|
|
2653
|
+
}, [e, c, g, n]), /* @__PURE__ */ r.jsx(
|
|
2654
|
+
De,
|
|
2595
2655
|
{
|
|
2596
|
-
ref:
|
|
2656
|
+
ref: m,
|
|
2597
2657
|
target: n,
|
|
2598
2658
|
autoRotate: t,
|
|
2599
2659
|
autoRotateSpeed: 0.5,
|
|
@@ -2601,7 +2661,7 @@ const Se = V(function({
|
|
|
2601
2661
|
enableZoom: s,
|
|
2602
2662
|
enableRotate: !0,
|
|
2603
2663
|
minDistance: a,
|
|
2604
|
-
maxDistance:
|
|
2664
|
+
maxDistance: l,
|
|
2605
2665
|
enableDamping: !0,
|
|
2606
2666
|
dampingFactor: 0.05,
|
|
2607
2667
|
rotateSpeed: 0.5,
|
|
@@ -2626,16 +2686,16 @@ V(function({
|
|
|
2626
2686
|
return /* @__PURE__ */ r.jsxs("div", { className: `view-controls view-controls--${i}`, children: [
|
|
2627
2687
|
/* @__PURE__ */ r.jsx("div", { className: "view-controls__title", children: "Vista" }),
|
|
2628
2688
|
/* @__PURE__ */ r.jsx("div", { className: "view-controls__buttons", children: s.map((n) => {
|
|
2629
|
-
const { label: a, icon:
|
|
2689
|
+
const { label: a, icon: l } = Tt[n], c = e === n;
|
|
2630
2690
|
return /* @__PURE__ */ r.jsxs(
|
|
2631
2691
|
"button",
|
|
2632
2692
|
{
|
|
2633
|
-
className: `view-controls__button ${
|
|
2693
|
+
className: `view-controls__button ${c ? "view-controls__button--active" : ""}`,
|
|
2634
2694
|
onClick: () => t(n),
|
|
2635
2695
|
title: a,
|
|
2636
2696
|
"aria-label": a,
|
|
2637
2697
|
children: [
|
|
2638
|
-
/* @__PURE__ */ r.jsx("span", { className: "view-controls__icon", role: "img", "aria-hidden": "true", children:
|
|
2698
|
+
/* @__PURE__ */ r.jsx("span", { className: "view-controls__icon", role: "img", "aria-hidden": "true", children: l }),
|
|
2639
2699
|
/* @__PURE__ */ r.jsx("span", { className: "view-controls__label", children: a })
|
|
2640
2700
|
]
|
|
2641
2701
|
},
|
|
@@ -2651,25 +2711,25 @@ const je = V(function({
|
|
|
2651
2711
|
floorPolygon: s,
|
|
2652
2712
|
cameraPosition: n,
|
|
2653
2713
|
targetPosition: a,
|
|
2654
|
-
position:
|
|
2714
|
+
position: l = "bottom-left"
|
|
2655
2715
|
}) {
|
|
2656
|
-
const
|
|
2657
|
-
x: 10 + d *
|
|
2658
|
-
y: 10 + b *
|
|
2659
|
-
}), w =
|
|
2660
|
-
const j =
|
|
2716
|
+
const m = _(() => 130 / Math.max(e, t), [e, t]), p = (d, b) => ({
|
|
2717
|
+
x: 10 + d * m,
|
|
2718
|
+
y: 10 + b * m
|
|
2719
|
+
}), w = _(() => i !== "warehouse" || !s || s.length === 0 ? "" : `M ${s.map((b) => {
|
|
2720
|
+
const j = p(b.x, b.z);
|
|
2661
2721
|
return `${j.x},${j.y}`;
|
|
2662
|
-
}).join(" L ")} Z`, [i, s,
|
|
2722
|
+
}).join(" L ")} Z`, [i, s, m]), h = _(() => {
|
|
2663
2723
|
if (i !== "truck") return null;
|
|
2664
|
-
const d =
|
|
2724
|
+
const d = p(0, 0);
|
|
2665
2725
|
return {
|
|
2666
2726
|
x: d.x,
|
|
2667
2727
|
y: d.y,
|
|
2668
|
-
width: e *
|
|
2669
|
-
height: t *
|
|
2728
|
+
width: e * m,
|
|
2729
|
+
height: t * m
|
|
2670
2730
|
};
|
|
2671
|
-
}, [i, e, t,
|
|
2672
|
-
return /* @__PURE__ */ r.jsxs("div", { className: `minimap minimap--${
|
|
2731
|
+
}, [i, e, t, m]), x = n ? p(n.x, n.z) : null, u = a ? p(a.x, a.z) : null;
|
|
2732
|
+
return /* @__PURE__ */ r.jsxs("div", { className: `minimap minimap--${l}`, children: [
|
|
2673
2733
|
/* @__PURE__ */ r.jsx("div", { className: "minimap__title", children: "Mapa" }),
|
|
2674
2734
|
/* @__PURE__ */ r.jsxs(
|
|
2675
2735
|
"svg",
|
|
@@ -2682,13 +2742,13 @@ const je = V(function({
|
|
|
2682
2742
|
children: [
|
|
2683
2743
|
/* @__PURE__ */ r.jsx("rect", { width: 150, height: 150, fill: "#1a1a2e" }),
|
|
2684
2744
|
i === "warehouse" && w && /* @__PURE__ */ r.jsx("path", { d: w, fill: "rgba(96, 165, 250, 0.15)", stroke: "#60a5fa", strokeWidth: "2" }),
|
|
2685
|
-
i === "truck" &&
|
|
2745
|
+
i === "truck" && h && /* @__PURE__ */ r.jsx(
|
|
2686
2746
|
"rect",
|
|
2687
2747
|
{
|
|
2688
|
-
x:
|
|
2689
|
-
y:
|
|
2690
|
-
width:
|
|
2691
|
-
height:
|
|
2748
|
+
x: h.x,
|
|
2749
|
+
y: h.y,
|
|
2750
|
+
width: h.width,
|
|
2751
|
+
height: h.height,
|
|
2692
2752
|
fill: "rgba(96, 165, 250, 0.15)",
|
|
2693
2753
|
stroke: "#60a5fa",
|
|
2694
2754
|
strokeWidth: "2"
|
|
@@ -2698,13 +2758,13 @@ const je = V(function({
|
|
|
2698
2758
|
"pattern",
|
|
2699
2759
|
{
|
|
2700
2760
|
id: "minimap-grid",
|
|
2701
|
-
width:
|
|
2702
|
-
height:
|
|
2761
|
+
width: m,
|
|
2762
|
+
height: m,
|
|
2703
2763
|
patternUnits: "userSpaceOnUse",
|
|
2704
2764
|
children: /* @__PURE__ */ r.jsx(
|
|
2705
2765
|
"path",
|
|
2706
2766
|
{
|
|
2707
|
-
d: `M ${
|
|
2767
|
+
d: `M ${m} 0 L 0 0 0 ${m}`,
|
|
2708
2768
|
fill: "none",
|
|
2709
2769
|
stroke: "rgba(255, 255, 255, 0.08)",
|
|
2710
2770
|
strokeWidth: "0.5"
|
|
@@ -2712,13 +2772,13 @@ const je = V(function({
|
|
|
2712
2772
|
)
|
|
2713
2773
|
}
|
|
2714
2774
|
) }),
|
|
2715
|
-
i === "truck" &&
|
|
2775
|
+
i === "truck" && h && /* @__PURE__ */ r.jsx(
|
|
2716
2776
|
"rect",
|
|
2717
2777
|
{
|
|
2718
|
-
x:
|
|
2719
|
-
y:
|
|
2720
|
-
width:
|
|
2721
|
-
height:
|
|
2778
|
+
x: h.x,
|
|
2779
|
+
y: h.y,
|
|
2780
|
+
width: h.width,
|
|
2781
|
+
height: h.height,
|
|
2722
2782
|
fill: "url(#minimap-grid)"
|
|
2723
2783
|
}
|
|
2724
2784
|
),
|
|
@@ -2757,8 +2817,8 @@ const je = V(function({
|
|
|
2757
2817
|
] })
|
|
2758
2818
|
] });
|
|
2759
2819
|
});
|
|
2760
|
-
function
|
|
2761
|
-
const { camera: o } = Ae(), [e, t] =
|
|
2820
|
+
function Et() {
|
|
2821
|
+
const { camera: o } = Ae(), [e, t] = ce({
|
|
2762
2822
|
x: o.position.x,
|
|
2763
2823
|
y: o.position.y,
|
|
2764
2824
|
z: o.position.z
|
|
@@ -2778,37 +2838,37 @@ function _t() {
|
|
|
2778
2838
|
}, [o]), e;
|
|
2779
2839
|
}
|
|
2780
2840
|
function Me({ onPositionChange: o }) {
|
|
2781
|
-
const e =
|
|
2841
|
+
const e = Et();
|
|
2782
2842
|
return pe(() => {
|
|
2783
2843
|
o(e);
|
|
2784
2844
|
}, [e, o]), null;
|
|
2785
2845
|
}
|
|
2786
|
-
const
|
|
2846
|
+
const Ft = V(function({
|
|
2787
2847
|
stackedPallet: e,
|
|
2788
2848
|
preset: t,
|
|
2789
2849
|
selectedBoxId: i,
|
|
2790
2850
|
highlightedBoxId: s,
|
|
2791
2851
|
selectedColor: n,
|
|
2792
2852
|
highlightedColor: a,
|
|
2793
|
-
showLabels:
|
|
2794
|
-
cameraPreset:
|
|
2795
|
-
showGrid:
|
|
2796
|
-
showMiniMap:
|
|
2797
|
-
onBoxClick:
|
|
2853
|
+
showLabels: l = !1,
|
|
2854
|
+
cameraPreset: c = "perspective",
|
|
2855
|
+
showGrid: g = !0,
|
|
2856
|
+
showMiniMap: m = !1,
|
|
2857
|
+
onBoxClick: p,
|
|
2798
2858
|
onBoxHover: w,
|
|
2799
|
-
children:
|
|
2859
|
+
children: h,
|
|
2800
2860
|
style: x
|
|
2801
2861
|
}) {
|
|
2802
|
-
const u = U.MM_TO_M, d = e.floors[0]?.pallet, [b, j] =
|
|
2862
|
+
const u = U.MM_TO_M, d = e.floors[0]?.pallet, [b, j] = ce({ x: 0, z: 0 }), T = q((v) => {
|
|
2803
2863
|
j({ x: v.x, z: v.z });
|
|
2804
|
-
}, []), S =
|
|
2864
|
+
}, []), S = _(() => d ? {
|
|
2805
2865
|
width: d.dimensions.width * u,
|
|
2806
|
-
height:
|
|
2866
|
+
height: de(e) * u,
|
|
2807
2867
|
depth: d.dimensions.depth * u
|
|
2808
|
-
} : { width: 1.2, height: 1, depth: 0.8 }, [d, e, u]), C =
|
|
2868
|
+
} : { width: 1.2, height: 1, depth: 0.8 }, [d, e, u]), C = _(() => {
|
|
2809
2869
|
const v = d ? d.dimensions.width * u / 2 : 0, M = d ? d.dimensions.depth * u / 2 : 0, E = S.height / 2;
|
|
2810
2870
|
return [v, E, M];
|
|
2811
|
-
}, [d, u, S.height]), z =
|
|
2871
|
+
}, [d, u, S.height]), z = _(() => {
|
|
2812
2872
|
const M = Math.sqrt(
|
|
2813
2873
|
S.width ** 2 + S.height ** 2 + S.depth ** 2
|
|
2814
2874
|
) * 3.5;
|
|
@@ -2817,16 +2877,16 @@ const Ht = V(function({
|
|
|
2817
2877
|
C[1] + M * 0.6,
|
|
2818
2878
|
C[2] + M * 0.7
|
|
2819
2879
|
];
|
|
2820
|
-
}, [C, S]), y =
|
|
2821
|
-
if (!
|
|
2822
|
-
const v = d.dimensions.width * u, M = d.dimensions.depth * u, E = 0.2,
|
|
2880
|
+
}, [C, S]), y = _(() => {
|
|
2881
|
+
if (!g || !d) return null;
|
|
2882
|
+
const v = d.dimensions.width * u, M = d.dimensions.depth * u, E = 0.2, k = 1e-3, I = [];
|
|
2823
2883
|
for (let A = 0; A <= v; A += E)
|
|
2824
|
-
I.push(A,
|
|
2884
|
+
I.push(A, k, 0, A, k, M);
|
|
2825
2885
|
for (let A = 0; A <= M; A += E)
|
|
2826
|
-
I.push(0,
|
|
2886
|
+
I.push(0, k, A, v, k, A);
|
|
2827
2887
|
const R = new B.BufferGeometry();
|
|
2828
2888
|
return R.setAttribute("position", new B.Float32BufferAttribute(I, 3)), R;
|
|
2829
|
-
}, [
|
|
2889
|
+
}, [g, d, u]);
|
|
2830
2890
|
return /* @__PURE__ */ r.jsxs("div", { style: { position: "relative", width: "100%", height: "100%" }, children: [
|
|
2831
2891
|
/* @__PURE__ */ r.jsx(
|
|
2832
2892
|
fe,
|
|
@@ -2855,14 +2915,14 @@ const Ht = V(function({
|
|
|
2855
2915
|
/* @__PURE__ */ r.jsx(
|
|
2856
2916
|
Se,
|
|
2857
2917
|
{
|
|
2858
|
-
preset:
|
|
2918
|
+
preset: c,
|
|
2859
2919
|
target: C,
|
|
2860
2920
|
sceneSize: S,
|
|
2861
2921
|
minDistance: 0.3,
|
|
2862
2922
|
maxDistance: Math.max(S.width, S.height, S.depth) * 4
|
|
2863
2923
|
}
|
|
2864
2924
|
),
|
|
2865
|
-
/* @__PURE__ */ r.jsx(Me, { onPositionChange:
|
|
2925
|
+
/* @__PURE__ */ r.jsx(Me, { onPositionChange: T }),
|
|
2866
2926
|
/* @__PURE__ */ r.jsxs("mesh", { rotation: [-Math.PI / 2, 0, 0], position: [C[0], -2e-3, C[2]], receiveShadow: !0, children: [
|
|
2867
2927
|
/* @__PURE__ */ r.jsx("planeGeometry", { args: [
|
|
2868
2928
|
d ? d.dimensions.width * u * 1.5 : 3,
|
|
@@ -2870,7 +2930,7 @@ const Ht = V(function({
|
|
|
2870
2930
|
] }),
|
|
2871
2931
|
/* @__PURE__ */ r.jsx("meshStandardMaterial", { color: "#e0e0e0", roughness: 0.9 })
|
|
2872
2932
|
] }),
|
|
2873
|
-
|
|
2933
|
+
g && y && /* @__PURE__ */ r.jsx("lineSegments", { geometry: y, children: /* @__PURE__ */ r.jsx(
|
|
2874
2934
|
"lineBasicMaterial",
|
|
2875
2935
|
{
|
|
2876
2936
|
color: "#aaaaaa",
|
|
@@ -2887,16 +2947,16 @@ const Ht = V(function({
|
|
|
2887
2947
|
highlightedBoxId: s,
|
|
2888
2948
|
selectedColor: n,
|
|
2889
2949
|
highlightedColor: a,
|
|
2890
|
-
showLabels:
|
|
2891
|
-
onBoxClick:
|
|
2950
|
+
showLabels: l,
|
|
2951
|
+
onBoxClick: p,
|
|
2892
2952
|
onBoxHover: w
|
|
2893
2953
|
}
|
|
2894
2954
|
),
|
|
2895
|
-
|
|
2955
|
+
h
|
|
2896
2956
|
] })
|
|
2897
2957
|
}
|
|
2898
2958
|
),
|
|
2899
|
-
|
|
2959
|
+
m && d && /* @__PURE__ */ r.jsx(
|
|
2900
2960
|
je,
|
|
2901
2961
|
{
|
|
2902
2962
|
sceneWidth: S.width,
|
|
@@ -2908,35 +2968,35 @@ const Ht = V(function({
|
|
|
2908
2968
|
}
|
|
2909
2969
|
)
|
|
2910
2970
|
] });
|
|
2911
|
-
}),
|
|
2971
|
+
}), qt = V(function({
|
|
2912
2972
|
truck: e,
|
|
2913
2973
|
preset: t,
|
|
2914
2974
|
selectedBoxId: i,
|
|
2915
2975
|
highlightedBoxId: s,
|
|
2916
2976
|
selectedColor: n,
|
|
2917
2977
|
highlightedColor: a,
|
|
2918
|
-
showLabels:
|
|
2919
|
-
showGrid:
|
|
2920
|
-
wallOpacity:
|
|
2921
|
-
showRoof:
|
|
2922
|
-
showSideWalls:
|
|
2978
|
+
showLabels: l = !1,
|
|
2979
|
+
showGrid: c,
|
|
2980
|
+
wallOpacity: g = 0.3,
|
|
2981
|
+
showRoof: m = !1,
|
|
2982
|
+
showSideWalls: p = !0,
|
|
2923
2983
|
cameraPreset: w = "perspective",
|
|
2924
|
-
showMiniMap:
|
|
2984
|
+
showMiniMap: h = !1,
|
|
2925
2985
|
onBoxClick: x,
|
|
2926
2986
|
onBoxHover: u,
|
|
2927
2987
|
children: d,
|
|
2928
2988
|
style: b
|
|
2929
2989
|
}) {
|
|
2930
|
-
const [j,
|
|
2931
|
-
|
|
2932
|
-
}, []), C = U.MM_TO_M, z = e.dimensions.width * C, y = e.dimensions.height * C, v = e.dimensions.depth * C, M =
|
|
2990
|
+
const [j, T] = ce({ x: 0, z: 0 }), S = q((R) => {
|
|
2991
|
+
T({ x: R.x, z: R.z });
|
|
2992
|
+
}, []), C = U.MM_TO_M, z = e.dimensions.width * C, y = e.dimensions.height * C, v = e.dimensions.depth * C, M = _(
|
|
2933
2993
|
() => [z / 2, y / 2, v / 2],
|
|
2934
2994
|
[z, y, v]
|
|
2935
|
-
), E =
|
|
2995
|
+
), E = _(
|
|
2936
2996
|
() => ({ width: z, height: y, depth: v }),
|
|
2937
2997
|
[z, y, v]
|
|
2938
|
-
),
|
|
2939
|
-
const A =
|
|
2998
|
+
), k = _(() => [z * 0.8, y * 1.2, v * 0.4], [z, y, v]), I = _(() => e.pallets.filter((R) => {
|
|
2999
|
+
const A = it(R, e);
|
|
2940
3000
|
return A.isValid ? !0 : (console.error(
|
|
2941
3001
|
`[TruckScene] Palet "${R.id}" fuera de los límites del camión.`,
|
|
2942
3002
|
"Violaciones:",
|
|
@@ -2949,7 +3009,7 @@ const Ht = V(function({
|
|
|
2949
3009
|
{
|
|
2950
3010
|
shadows: !0,
|
|
2951
3011
|
camera: {
|
|
2952
|
-
position:
|
|
3012
|
+
position: k,
|
|
2953
3013
|
fov: 45,
|
|
2954
3014
|
near: 0.01,
|
|
2955
3015
|
far: 200
|
|
@@ -2968,13 +3028,13 @@ const Ht = V(function({
|
|
|
2968
3028
|
),
|
|
2969
3029
|
/* @__PURE__ */ r.jsx(Me, { onPositionChange: S }),
|
|
2970
3030
|
/* @__PURE__ */ r.jsxs(
|
|
2971
|
-
|
|
3031
|
+
Rt,
|
|
2972
3032
|
{
|
|
2973
3033
|
truck: e,
|
|
2974
|
-
showGrid:
|
|
2975
|
-
wallOpacity:
|
|
2976
|
-
showRoof:
|
|
2977
|
-
showSideWalls:
|
|
3034
|
+
showGrid: c,
|
|
3035
|
+
wallOpacity: g,
|
|
3036
|
+
showRoof: m,
|
|
3037
|
+
showSideWalls: p,
|
|
2978
3038
|
children: [
|
|
2979
3039
|
I.map((R) => /* @__PURE__ */ r.jsx(
|
|
2980
3040
|
be,
|
|
@@ -2987,7 +3047,7 @@ const Ht = V(function({
|
|
|
2987
3047
|
highlightedBoxId: s,
|
|
2988
3048
|
selectedColor: n,
|
|
2989
3049
|
highlightedColor: a,
|
|
2990
|
-
showLabels:
|
|
3050
|
+
showLabels: l,
|
|
2991
3051
|
onBoxClick: x,
|
|
2992
3052
|
onBoxHover: u
|
|
2993
3053
|
},
|
|
@@ -3000,7 +3060,7 @@ const Ht = V(function({
|
|
|
3000
3060
|
] })
|
|
3001
3061
|
}
|
|
3002
3062
|
),
|
|
3003
|
-
|
|
3063
|
+
h && /* @__PURE__ */ r.jsx(
|
|
3004
3064
|
je,
|
|
3005
3065
|
{
|
|
3006
3066
|
sceneWidth: z,
|
|
@@ -3012,40 +3072,40 @@ const Ht = V(function({
|
|
|
3012
3072
|
}
|
|
3013
3073
|
)
|
|
3014
3074
|
] });
|
|
3015
|
-
}),
|
|
3075
|
+
}), Jt = V(function({
|
|
3016
3076
|
room: e,
|
|
3017
3077
|
preset: t,
|
|
3018
3078
|
selectedBoxId: i,
|
|
3019
3079
|
highlightedBoxId: s,
|
|
3020
3080
|
selectedColor: n,
|
|
3021
3081
|
highlightedColor: a,
|
|
3022
|
-
showLabels:
|
|
3023
|
-
cameraPreset:
|
|
3024
|
-
showMiniMap:
|
|
3025
|
-
onBoxClick:
|
|
3026
|
-
onBoxHover:
|
|
3082
|
+
showLabels: l = !1,
|
|
3083
|
+
cameraPreset: c = "perspective",
|
|
3084
|
+
showMiniMap: g = !1,
|
|
3085
|
+
onBoxClick: m,
|
|
3086
|
+
onBoxHover: p,
|
|
3027
3087
|
children: w,
|
|
3028
|
-
style:
|
|
3088
|
+
style: h
|
|
3029
3089
|
}) {
|
|
3030
|
-
const x = U.MM_TO_M, [u, d] =
|
|
3090
|
+
const x = U.MM_TO_M, [u, d] = ce({ x: 0, z: 0 }), b = q((y) => {
|
|
3031
3091
|
d({ x: y.x, z: y.z });
|
|
3032
|
-
}, []), { target: j, sceneSize:
|
|
3092
|
+
}, []), { target: j, sceneSize: T, initialCameraPosition: S } = _(() => {
|
|
3033
3093
|
const y = e.floorPolygon;
|
|
3034
|
-
let v = 1 / 0, M = -1 / 0, E = 1 / 0,
|
|
3094
|
+
let v = 1 / 0, M = -1 / 0, E = 1 / 0, k = -1 / 0;
|
|
3035
3095
|
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),
|
|
3037
|
-
const I = M - v, R =
|
|
3096
|
+
v = Math.min(v, P.x * x), M = Math.max(M, P.x * x), E = Math.min(E, P.z * x), k = Math.max(k, P.z * x);
|
|
3097
|
+
const I = M - v, R = k - E, A = e.ceilingHeight * x, G = (v + M) / 2, Z = (E + k) / 2, H = [G, A / 2, Z], F = { width: I, height: A, depth: R }, J = Math.sqrt(I ** 2 + A ** 2 + R ** 2) * 0.8, f = [
|
|
3038
3098
|
G + J * 0.6,
|
|
3039
3099
|
A + J * 0.5,
|
|
3040
|
-
|
|
3100
|
+
Z + J * 0.6
|
|
3041
3101
|
];
|
|
3042
3102
|
return {
|
|
3043
3103
|
target: H,
|
|
3044
3104
|
sceneSize: F,
|
|
3045
3105
|
initialCameraPosition: f
|
|
3046
3106
|
};
|
|
3047
|
-
}, [e.floorPolygon, e.ceilingHeight, x]), C =
|
|
3048
|
-
const v =
|
|
3107
|
+
}, [e.floorPolygon, e.ceilingHeight, x]), C = _(() => e.floorPolygon.map((y) => ({ x: y.x * x, z: y.z * x })), [e.floorPolygon, x]), z = _(() => e.pallets.filter((y) => {
|
|
3108
|
+
const v = $e(y, e);
|
|
3049
3109
|
return v.isValid ? !0 : (console.error(
|
|
3050
3110
|
`[WarehouseScene] Palet "${y.id}" fuera de los límites de la estancia "${e.name}".`,
|
|
3051
3111
|
"Violaciones:",
|
|
@@ -3063,20 +3123,20 @@ const Ht = V(function({
|
|
|
3063
3123
|
near: 0.01,
|
|
3064
3124
|
far: 300
|
|
3065
3125
|
},
|
|
3066
|
-
style: { width: "100%", height: "100%", ...
|
|
3126
|
+
style: { width: "100%", height: "100%", ...h },
|
|
3067
3127
|
children: /* @__PURE__ */ r.jsxs(we, { preset: t, children: [
|
|
3068
3128
|
/* @__PURE__ */ r.jsx(
|
|
3069
3129
|
Se,
|
|
3070
3130
|
{
|
|
3071
|
-
preset:
|
|
3131
|
+
preset: c,
|
|
3072
3132
|
target: j,
|
|
3073
|
-
sceneSize:
|
|
3074
|
-
maxDistance: Math.max(
|
|
3133
|
+
sceneSize: T,
|
|
3134
|
+
maxDistance: Math.max(T.width, T.height, T.depth) * 4,
|
|
3075
3135
|
minDistance: 0.5
|
|
3076
3136
|
}
|
|
3077
3137
|
),
|
|
3078
3138
|
/* @__PURE__ */ r.jsx(Me, { onPositionChange: b }),
|
|
3079
|
-
/* @__PURE__ */ r.jsxs(
|
|
3139
|
+
/* @__PURE__ */ r.jsxs(Pt, { room: e, children: [
|
|
3080
3140
|
z.map((y) => /* @__PURE__ */ r.jsx(
|
|
3081
3141
|
be,
|
|
3082
3142
|
{
|
|
@@ -3088,9 +3148,9 @@ const Ht = V(function({
|
|
|
3088
3148
|
highlightedBoxId: s,
|
|
3089
3149
|
selectedColor: n,
|
|
3090
3150
|
highlightedColor: a,
|
|
3091
|
-
showLabels:
|
|
3092
|
-
onBoxClick:
|
|
3093
|
-
onBoxHover:
|
|
3151
|
+
showLabels: l,
|
|
3152
|
+
onBoxClick: m,
|
|
3153
|
+
onBoxHover: p
|
|
3094
3154
|
},
|
|
3095
3155
|
y.id
|
|
3096
3156
|
)),
|
|
@@ -3099,11 +3159,11 @@ const Ht = V(function({
|
|
|
3099
3159
|
] })
|
|
3100
3160
|
}
|
|
3101
3161
|
),
|
|
3102
|
-
|
|
3162
|
+
g && /* @__PURE__ */ r.jsx(
|
|
3103
3163
|
je,
|
|
3104
3164
|
{
|
|
3105
|
-
sceneWidth:
|
|
3106
|
-
sceneDepth:
|
|
3165
|
+
sceneWidth: T.width,
|
|
3166
|
+
sceneDepth: T.depth,
|
|
3107
3167
|
sceneType: "warehouse",
|
|
3108
3168
|
floorPolygon: C,
|
|
3109
3169
|
cameraPosition: u,
|
|
@@ -3114,73 +3174,75 @@ const Ht = V(function({
|
|
|
3114
3174
|
] });
|
|
3115
3175
|
});
|
|
3116
3176
|
export {
|
|
3117
|
-
|
|
3118
|
-
|
|
3177
|
+
xt as BinPacking3DStrategy,
|
|
3178
|
+
jt as BoxComponent,
|
|
3119
3179
|
ge as BoxFactory,
|
|
3120
|
-
|
|
3180
|
+
Ne as COLLISION_TOLERANCE,
|
|
3121
3181
|
Se as CameraControlsComponent,
|
|
3122
|
-
|
|
3182
|
+
ut as ColumnStrategy,
|
|
3123
3183
|
xe as DEFAULT_PRESET,
|
|
3124
|
-
|
|
3184
|
+
Yt as Label,
|
|
3125
3185
|
ze as MIN_SUPPORT_PERCENTAGE,
|
|
3186
|
+
pt as MaterialGroupingStrategy,
|
|
3187
|
+
Xt as MultiPalletBuilder,
|
|
3126
3188
|
Oe as PRESET_INDUSTRIAL,
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3189
|
+
Ue as PRESET_UNSTYLED,
|
|
3190
|
+
ft as PackingRegistry,
|
|
3191
|
+
Mt as PalletComponent,
|
|
3192
|
+
D as PalletFactory,
|
|
3131
3193
|
N as PalletMaterial,
|
|
3132
|
-
|
|
3194
|
+
Ft as PalletScene,
|
|
3133
3195
|
we as PresetProvider,
|
|
3134
|
-
|
|
3135
|
-
|
|
3196
|
+
He as SCENE_PRESETS,
|
|
3197
|
+
Ot as SEPARATOR_DEFAULTS,
|
|
3136
3198
|
ue as STANDARD_PALLETS,
|
|
3137
|
-
|
|
3138
|
-
|
|
3199
|
+
Ct as SeparatorComponent,
|
|
3200
|
+
ae as SeparatorMaterial,
|
|
3139
3201
|
be as StackedPalletComponent,
|
|
3140
3202
|
Ze as TRUCK_PRESETS,
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3203
|
+
Rt as TruckEnvironment,
|
|
3204
|
+
Dt as TruckFactory,
|
|
3205
|
+
qt as TruckScene,
|
|
3144
3206
|
oe as TruckType,
|
|
3145
|
-
|
|
3207
|
+
gt as TypeGroupStrategy,
|
|
3146
3208
|
U as UNITS,
|
|
3147
3209
|
Ie as WEIGHT_WARNING_THRESHOLD,
|
|
3148
|
-
|
|
3149
|
-
|
|
3210
|
+
Pt as WarehouseEnvironment,
|
|
3211
|
+
Jt as WarehouseScene,
|
|
3150
3212
|
ve as aabbIntersects,
|
|
3151
3213
|
Y as calculateCenterOfGravity,
|
|
3152
3214
|
ee as calculateStabilityScore,
|
|
3153
|
-
|
|
3154
|
-
|
|
3215
|
+
wt as defaultRegistry,
|
|
3216
|
+
Je as ensureUniqueBoxIds,
|
|
3155
3217
|
L as getBoxBoundingBox,
|
|
3156
3218
|
se as getPalletBoundingBox,
|
|
3157
|
-
|
|
3219
|
+
de as getStackedPalletTotalHeight,
|
|
3158
3220
|
ye as getStackedPalletTotalWeight,
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3221
|
+
mt as pointInPolygon,
|
|
3222
|
+
Ut as usePackingStrategy,
|
|
3223
|
+
Nt as usePalletMetrics,
|
|
3224
|
+
Zt as usePhysicsValidation,
|
|
3225
|
+
le as usePreset,
|
|
3226
|
+
Ht as useWarehouseValidation,
|
|
3227
|
+
tt as validateAllBoxesInPalletBounds,
|
|
3228
|
+
et as validateBoxInPalletBounds,
|
|
3229
|
+
at as validateBoxStackability,
|
|
3230
|
+
dt as validateCogInsideSupport,
|
|
3231
|
+
st as validateFragileLoad,
|
|
3232
|
+
ct as validateInvertedPyramid,
|
|
3233
|
+
Qe as validateNoBoxCollisions,
|
|
3234
|
+
Ke as validateNoPalletCollisions,
|
|
3235
|
+
Bt as validatePalletHeight,
|
|
3236
|
+
$e as validatePalletInRoom,
|
|
3237
|
+
it as validatePalletInTruck,
|
|
3238
|
+
ot as validatePalletWeight,
|
|
3239
|
+
Lt as validateSeparators,
|
|
3240
|
+
ht as validateStability,
|
|
3179
3241
|
Wt as validateStackDimensions,
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3242
|
+
Gt as validateStackHeight,
|
|
3243
|
+
Vt as validateStackWeight,
|
|
3244
|
+
lt as validateSupport,
|
|
3245
|
+
$t as validateTruckWeight,
|
|
3246
|
+
rt as validateWeightDistribution
|
|
3185
3247
|
};
|
|
3186
3248
|
//# sourceMappingURL=pallet-builder.js.map
|