@cristiancosano/pallet-builder 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/pallet-builder.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import Le, { createContext as Ge, useContext as Ve, useMemo as k, useCallback as q, memo as V, useRef as
|
|
2
|
-
import { Html as ke, OrbitControls as
|
|
1
|
+
import Le, { createContext as Ge, useContext as Ve, useMemo as k, useCallback as q, memo as V, useRef as _e, useEffect as fe, useState as ae } from "react";
|
|
2
|
+
import { Edges as Xe, Html as ke, OrbitControls as Ze } from "@react-three/drei";
|
|
3
3
|
import * as B from "three";
|
|
4
|
-
import { useThree as Ae, Canvas as
|
|
4
|
+
import { useThree as Ae, Canvas as pe } from "@react-three/fiber";
|
|
5
5
|
const N = {
|
|
6
6
|
WOOD: "WOOD",
|
|
7
7
|
PLASTIC: "PLASTIC",
|
|
@@ -11,7 +11,7 @@ const N = {
|
|
|
11
11
|
CARDBOARD: "CARDBOARD",
|
|
12
12
|
WOOD: "WOOD",
|
|
13
13
|
PLASTIC: "PLASTIC"
|
|
14
|
-
},
|
|
14
|
+
}, ie = {
|
|
15
15
|
BOX: "BOX",
|
|
16
16
|
REFRIGERATED: "REFRIGERATED",
|
|
17
17
|
FLATBED: "FLATBED",
|
|
@@ -92,24 +92,24 @@ const N = {
|
|
|
92
92
|
}
|
|
93
93
|
};
|
|
94
94
|
ue.GMA;
|
|
95
|
-
const
|
|
96
|
-
[
|
|
95
|
+
const De = {
|
|
96
|
+
[ie.BOX]: {
|
|
97
97
|
dimensions: { width: 2480, height: 2700, depth: 13600 },
|
|
98
98
|
maxWeight: 24e3
|
|
99
99
|
},
|
|
100
|
-
[
|
|
100
|
+
[ie.REFRIGERATED]: {
|
|
101
101
|
dimensions: { width: 2440, height: 2590, depth: 13100 },
|
|
102
102
|
maxWeight: 22e3
|
|
103
103
|
},
|
|
104
|
-
[
|
|
104
|
+
[ie.FLATBED]: {
|
|
105
105
|
dimensions: { width: 2480, height: 2700, depth: 13600 },
|
|
106
106
|
maxWeight: 25e3
|
|
107
107
|
},
|
|
108
|
-
[
|
|
108
|
+
[ie.TAUTLINER]: {
|
|
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,17 +207,17 @@ 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
|
-
var
|
|
220
|
-
function t(
|
|
219
|
+
var i = /* @__PURE__ */ Symbol.for("react.transitional.element"), e = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
220
|
+
function t(o, s, n) {
|
|
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 = {};
|
|
@@ -225,8 +225,8 @@ function He() {
|
|
|
225
225
|
c !== "key" && (n[c] = s[c]);
|
|
226
226
|
} else n = s;
|
|
227
227
|
return s = n.ref, {
|
|
228
|
-
$$typeof:
|
|
229
|
-
type:
|
|
228
|
+
$$typeof: i,
|
|
229
|
+
type: o,
|
|
230
230
|
key: a,
|
|
231
231
|
ref: s !== void 0 ? s : null,
|
|
232
232
|
props: n
|
|
@@ -234,16 +234,16 @@ function He() {
|
|
|
234
234
|
}
|
|
235
235
|
return te.Fragment = e, te.jsx = t, te.jsxs = t, te;
|
|
236
236
|
}
|
|
237
|
-
var
|
|
237
|
+
var oe = {};
|
|
238
238
|
var Pe;
|
|
239
|
-
function
|
|
239
|
+
function Fe() {
|
|
240
240
|
return Pe || (Pe = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
241
|
-
function
|
|
242
|
-
if (
|
|
243
|
-
if (typeof
|
|
244
|
-
return
|
|
245
|
-
if (typeof
|
|
246
|
-
switch (
|
|
241
|
+
function i(p) {
|
|
242
|
+
if (p == null) return null;
|
|
243
|
+
if (typeof p == "function")
|
|
244
|
+
return p.$$typeof === T ? null : p.displayName || p.name || null;
|
|
245
|
+
if (typeof p == "string") return p;
|
|
246
|
+
switch (p) {
|
|
247
247
|
case d:
|
|
248
248
|
return "Fragment";
|
|
249
249
|
case j:
|
|
@@ -254,130 +254,130 @@ function Ye() {
|
|
|
254
254
|
return "Suspense";
|
|
255
255
|
case y:
|
|
256
256
|
return "SuspenseList";
|
|
257
|
-
case
|
|
257
|
+
case _:
|
|
258
258
|
return "Activity";
|
|
259
259
|
}
|
|
260
|
-
if (typeof
|
|
261
|
-
switch (typeof
|
|
260
|
+
if (typeof p == "object")
|
|
261
|
+
switch (typeof p.tag == "number" && console.error(
|
|
262
262
|
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
263
|
-
),
|
|
263
|
+
), p.$$typeof) {
|
|
264
264
|
case u:
|
|
265
265
|
return "Portal";
|
|
266
266
|
case S:
|
|
267
|
-
return
|
|
268
|
-
case
|
|
269
|
-
return (
|
|
267
|
+
return p.displayName || "Context";
|
|
268
|
+
case E:
|
|
269
|
+
return (p._context.displayName || "Context") + ".Consumer";
|
|
270
270
|
case C:
|
|
271
|
-
var P =
|
|
272
|
-
return
|
|
271
|
+
var P = p.render;
|
|
272
|
+
return p = p.displayName, p || (p = P.displayName || P.name || "", p = p !== "" ? "ForwardRef(" + p + ")" : "ForwardRef"), p;
|
|
273
273
|
case v:
|
|
274
|
-
return P =
|
|
274
|
+
return P = p.displayName || null, P !== null ? P : i(p.type) || "Memo";
|
|
275
275
|
case M:
|
|
276
|
-
P =
|
|
276
|
+
P = p._payload, p = p._init;
|
|
277
277
|
try {
|
|
278
|
-
return
|
|
278
|
+
return i(p(P));
|
|
279
279
|
} catch {
|
|
280
280
|
}
|
|
281
281
|
}
|
|
282
282
|
return null;
|
|
283
283
|
}
|
|
284
|
-
function e(
|
|
285
|
-
return "" +
|
|
284
|
+
function e(p) {
|
|
285
|
+
return "" + p;
|
|
286
286
|
}
|
|
287
|
-
function t(
|
|
287
|
+
function t(p) {
|
|
288
288
|
try {
|
|
289
|
-
e(
|
|
289
|
+
e(p);
|
|
290
290
|
var P = !1;
|
|
291
291
|
} catch {
|
|
292
292
|
P = !0;
|
|
293
293
|
}
|
|
294
294
|
if (P) {
|
|
295
295
|
P = console;
|
|
296
|
-
var O = P.error, W = typeof Symbol == "function" && Symbol.toStringTag &&
|
|
296
|
+
var O = P.error, W = typeof Symbol == "function" && Symbol.toStringTag && p[Symbol.toStringTag] || p.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
|
W
|
|
301
|
-
), e(
|
|
301
|
+
), e(p);
|
|
302
302
|
}
|
|
303
303
|
}
|
|
304
|
-
function
|
|
305
|
-
if (
|
|
306
|
-
if (typeof
|
|
304
|
+
function o(p) {
|
|
305
|
+
if (p === d) return "<>";
|
|
306
|
+
if (typeof p == "object" && p !== null && p.$$typeof === M)
|
|
307
307
|
return "<...>";
|
|
308
308
|
try {
|
|
309
|
-
var P =
|
|
309
|
+
var P = i(p);
|
|
310
310
|
return P ? "<" + P + ">" : "<...>";
|
|
311
311
|
} catch {
|
|
312
312
|
return "<...>";
|
|
313
313
|
}
|
|
314
314
|
}
|
|
315
315
|
function s() {
|
|
316
|
-
var
|
|
317
|
-
return
|
|
316
|
+
var p = I.A;
|
|
317
|
+
return p === null ? null : p.getOwner();
|
|
318
318
|
}
|
|
319
319
|
function n() {
|
|
320
320
|
return Error("react-stack-top-frame");
|
|
321
321
|
}
|
|
322
|
-
function a(
|
|
323
|
-
if (R.call(
|
|
324
|
-
var P = Object.getOwnPropertyDescriptor(
|
|
322
|
+
function a(p) {
|
|
323
|
+
if (R.call(p, "key")) {
|
|
324
|
+
var P = Object.getOwnPropertyDescriptor(p, "key").get;
|
|
325
325
|
if (P && P.isReactWarning) return !1;
|
|
326
326
|
}
|
|
327
|
-
return
|
|
327
|
+
return p.key !== void 0;
|
|
328
328
|
}
|
|
329
|
-
function c(
|
|
329
|
+
function c(p, P) {
|
|
330
330
|
function O() {
|
|
331
331
|
D || (D = !0, console.error(
|
|
332
332
|
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
333
333
|
P
|
|
334
334
|
));
|
|
335
335
|
}
|
|
336
|
-
O.isReactWarning = !0, Object.defineProperty(
|
|
336
|
+
O.isReactWarning = !0, Object.defineProperty(p, "key", {
|
|
337
337
|
get: O,
|
|
338
338
|
configurable: !0
|
|
339
339
|
});
|
|
340
340
|
}
|
|
341
341
|
function l() {
|
|
342
|
-
var
|
|
343
|
-
return H[
|
|
342
|
+
var p = i(this.type);
|
|
343
|
+
return H[p] || (H[p] = !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
|
+
)), p = this.props.ref, p !== void 0 ? p : null;
|
|
346
346
|
}
|
|
347
|
-
function p
|
|
347
|
+
function f(p, P, O, W, ne, de) {
|
|
348
348
|
var $ = O.ref;
|
|
349
|
-
return
|
|
349
|
+
return p = {
|
|
350
350
|
$$typeof: x,
|
|
351
|
-
type:
|
|
351
|
+
type: p,
|
|
352
352
|
key: P,
|
|
353
353
|
props: O,
|
|
354
354
|
_owner: W
|
|
355
|
-
}, ($ !== void 0 ? $ : null) !== null ? Object.defineProperty(
|
|
355
|
+
}, ($ !== void 0 ? $ : null) !== null ? Object.defineProperty(p, "ref", {
|
|
356
356
|
enumerable: !1,
|
|
357
357
|
get: l
|
|
358
|
-
}) : Object.defineProperty(
|
|
358
|
+
}) : Object.defineProperty(p, "ref", { enumerable: !1, value: null }), p._store = {}, Object.defineProperty(p._store, "validated", {
|
|
359
359
|
configurable: !1,
|
|
360
360
|
enumerable: !1,
|
|
361
361
|
writable: !0,
|
|
362
362
|
value: 0
|
|
363
|
-
}), Object.defineProperty(
|
|
363
|
+
}), Object.defineProperty(p, "_debugInfo", {
|
|
364
364
|
configurable: !1,
|
|
365
365
|
enumerable: !1,
|
|
366
366
|
writable: !0,
|
|
367
367
|
value: null
|
|
368
|
-
}), Object.defineProperty(
|
|
368
|
+
}), Object.defineProperty(p, "_debugStack", {
|
|
369
369
|
configurable: !1,
|
|
370
370
|
enumerable: !1,
|
|
371
371
|
writable: !0,
|
|
372
372
|
value: ne
|
|
373
|
-
}), Object.defineProperty(
|
|
373
|
+
}), Object.defineProperty(p, "_debugTask", {
|
|
374
374
|
configurable: !1,
|
|
375
375
|
enumerable: !1,
|
|
376
376
|
writable: !0,
|
|
377
377
|
value: de
|
|
378
|
-
}), Object.freeze && (Object.freeze(
|
|
378
|
+
}), Object.freeze && (Object.freeze(p.props), Object.freeze(p)), p;
|
|
379
379
|
}
|
|
380
|
-
function h(
|
|
380
|
+
function h(p, P, O, W, ne, de) {
|
|
381
381
|
var $ = P.children;
|
|
382
382
|
if ($ !== void 0)
|
|
383
383
|
if (W)
|
|
@@ -391,7 +391,7 @@ function Ye() {
|
|
|
391
391
|
);
|
|
392
392
|
else g($);
|
|
393
393
|
if (R.call(P, "key")) {
|
|
394
|
-
$ =
|
|
394
|
+
$ = i(p);
|
|
395
395
|
var Q = Object.keys(P).filter(function($e) {
|
|
396
396
|
return $e !== "key";
|
|
397
397
|
});
|
|
@@ -415,9 +415,9 @@ React keys must be passed directly to JSX without using spread:
|
|
|
415
415
|
} else O = P;
|
|
416
416
|
return $ && c(
|
|
417
417
|
O,
|
|
418
|
-
typeof
|
|
419
|
-
),
|
|
420
|
-
|
|
418
|
+
typeof p == "function" ? p.displayName || p.name || "Unknown" : p
|
|
419
|
+
), f(
|
|
420
|
+
p,
|
|
421
421
|
$,
|
|
422
422
|
O,
|
|
423
423
|
s(),
|
|
@@ -425,88 +425,88 @@ React keys must be passed directly to JSX without using spread:
|
|
|
425
425
|
de
|
|
426
426
|
);
|
|
427
427
|
}
|
|
428
|
-
function g(
|
|
429
|
-
w(
|
|
428
|
+
function g(p) {
|
|
429
|
+
w(p) ? p._store && (p._store.validated = 1) : typeof p == "object" && p !== null && p.$$typeof === M && (p._payload.status === "fulfilled" ? w(p._payload.value) && p._payload.value._store && (p._payload.value._store.validated = 1) : p._store && (p._store.validated = 1));
|
|
430
430
|
}
|
|
431
|
-
function w(
|
|
432
|
-
return typeof
|
|
431
|
+
function w(p) {
|
|
432
|
+
return typeof p == "object" && p !== null && p.$$typeof === x;
|
|
433
433
|
}
|
|
434
|
-
var m = Le, x = /* @__PURE__ */ Symbol.for("react.transitional.element"), u = /* @__PURE__ */ Symbol.for("react.portal"), d = /* @__PURE__ */ Symbol.for("react.fragment"), b = /* @__PURE__ */ Symbol.for("react.strict_mode"), j = /* @__PURE__ */ Symbol.for("react.profiler"),
|
|
434
|
+
var m = Le, x = /* @__PURE__ */ Symbol.for("react.transitional.element"), u = /* @__PURE__ */ Symbol.for("react.portal"), d = /* @__PURE__ */ Symbol.for("react.fragment"), b = /* @__PURE__ */ Symbol.for("react.strict_mode"), j = /* @__PURE__ */ Symbol.for("react.profiler"), E = /* @__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"), _ = /* @__PURE__ */ Symbol.for("react.activity"), T = /* @__PURE__ */ Symbol.for("react.client.reference"), I = m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, R = Object.prototype.hasOwnProperty, A = Array.isArray, G = console.createTask ? console.createTask : function() {
|
|
435
435
|
return null;
|
|
436
436
|
};
|
|
437
437
|
m = {
|
|
438
|
-
react_stack_bottom_frame: function(
|
|
439
|
-
return
|
|
438
|
+
react_stack_bottom_frame: function(p) {
|
|
439
|
+
return p();
|
|
440
440
|
}
|
|
441
441
|
};
|
|
442
442
|
var D, H = {}, F = m.react_stack_bottom_frame.bind(
|
|
443
443
|
m,
|
|
444
444
|
n
|
|
445
|
-
)(), X = G(
|
|
446
|
-
|
|
445
|
+
)(), X = G(o(n)), J = {};
|
|
446
|
+
oe.Fragment = d, oe.jsx = function(p, P, O) {
|
|
447
447
|
var W = 1e4 > I.recentlyCreatedOwnerStacks++;
|
|
448
448
|
return h(
|
|
449
|
-
|
|
449
|
+
p,
|
|
450
450
|
P,
|
|
451
451
|
O,
|
|
452
452
|
!1,
|
|
453
453
|
W ? Error("react-stack-top-frame") : F,
|
|
454
|
-
W ? G(
|
|
454
|
+
W ? G(o(p)) : X
|
|
455
455
|
);
|
|
456
|
-
},
|
|
456
|
+
}, oe.jsxs = function(p, P, O) {
|
|
457
457
|
var W = 1e4 > I.recentlyCreatedOwnerStacks++;
|
|
458
458
|
return h(
|
|
459
|
-
|
|
459
|
+
p,
|
|
460
460
|
P,
|
|
461
461
|
O,
|
|
462
462
|
!0,
|
|
463
463
|
W ? Error("react-stack-top-frame") : F,
|
|
464
|
-
W ? G(
|
|
464
|
+
W ? G(o(p)) : X
|
|
465
465
|
);
|
|
466
466
|
};
|
|
467
|
-
})()),
|
|
467
|
+
})()), oe;
|
|
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
|
-
function we({ preset:
|
|
476
|
-
const t = k(() =>
|
|
475
|
+
function we({ preset: i, children: e }) {
|
|
476
|
+
const t = k(() => i ? typeof i == "string" ? He[i] ?? xe : i : xe, [i]);
|
|
477
477
|
return /* @__PURE__ */ r.jsx(Be.Provider, { value: t, children: e });
|
|
478
478
|
}
|
|
479
479
|
function ce() {
|
|
480
480
|
return Ve(Be);
|
|
481
481
|
}
|
|
482
|
-
function le(
|
|
482
|
+
function le(i) {
|
|
483
483
|
let e = 0;
|
|
484
|
-
for (const t of
|
|
484
|
+
for (const t of i.floors) {
|
|
485
485
|
e += t.pallet.dimensions.height;
|
|
486
|
-
const
|
|
486
|
+
const o = t.boxes.reduce((s, n) => {
|
|
487
487
|
const a = n.position.y + n.box.dimensions.height;
|
|
488
488
|
return Math.max(s, a);
|
|
489
489
|
}, 0);
|
|
490
|
-
e +=
|
|
490
|
+
e += o, t.separatorAbove && (e += t.separatorAbove.dimensions.height);
|
|
491
491
|
}
|
|
492
492
|
return e;
|
|
493
493
|
}
|
|
494
|
-
function ye(
|
|
494
|
+
function ye(i) {
|
|
495
495
|
let e = 0;
|
|
496
|
-
for (const t of
|
|
497
|
-
e += t.pallet.weight, e += t.boxes.reduce((
|
|
496
|
+
for (const t of i.floors)
|
|
497
|
+
e += t.pallet.weight, e += t.boxes.reduce((o, s) => o + s.box.weight, 0), t.separatorAbove && (e += t.separatorAbove.weight);
|
|
498
498
|
return e;
|
|
499
499
|
}
|
|
500
|
-
function
|
|
501
|
-
const t = e ||
|
|
500
|
+
function Je(i, e) {
|
|
501
|
+
const t = e || i.id, o = i.floors.map((s, n) => {
|
|
502
502
|
const a = s.boxes.map((c, l) => {
|
|
503
|
-
const
|
|
503
|
+
const f = `${t}:f${n}:b${l}`, h = (g) => g.map((w) => {
|
|
504
504
|
const m = s.boxes.findIndex((x) => x.id === w);
|
|
505
505
|
return m >= 0 ? `${t}:f${n}:b${m}` : w;
|
|
506
506
|
});
|
|
507
507
|
return {
|
|
508
508
|
...c,
|
|
509
|
-
id:
|
|
509
|
+
id: f,
|
|
510
510
|
supportedBy: h(c.supportedBy),
|
|
511
511
|
supporting: h(c.supporting)
|
|
512
512
|
};
|
|
@@ -517,210 +517,210 @@ function qe(o, e) {
|
|
|
517
517
|
};
|
|
518
518
|
});
|
|
519
519
|
return {
|
|
520
|
-
...
|
|
521
|
-
floors:
|
|
520
|
+
...i,
|
|
521
|
+
floors: o
|
|
522
522
|
};
|
|
523
523
|
}
|
|
524
|
-
function L(
|
|
525
|
-
let e =
|
|
526
|
-
const
|
|
527
|
-
return (
|
|
528
|
-
minX:
|
|
529
|
-
maxX:
|
|
530
|
-
minY:
|
|
531
|
-
maxY:
|
|
532
|
-
minZ:
|
|
533
|
-
maxZ:
|
|
524
|
+
function L(i) {
|
|
525
|
+
let e = i.box.dimensions.width, t = i.box.dimensions.depth;
|
|
526
|
+
const o = i.box.dimensions.height;
|
|
527
|
+
return (i.rotation.y === 90 || i.rotation.y === 270) && ([e, t] = [t, e]), {
|
|
528
|
+
minX: i.position.x,
|
|
529
|
+
maxX: i.position.x + e,
|
|
530
|
+
minY: i.position.y,
|
|
531
|
+
maxY: i.position.y + o,
|
|
532
|
+
minZ: i.position.z,
|
|
533
|
+
maxZ: i.position.z + t
|
|
534
534
|
};
|
|
535
535
|
}
|
|
536
|
-
function se(
|
|
537
|
-
const e =
|
|
536
|
+
function se(i) {
|
|
537
|
+
const e = i.stackedPallet, t = e.floors[0].pallet, o = t.dimensions.width, s = t.dimensions.depth, n = le(e), a = i.yRotation * Math.PI / 180, c = Math.cos(a), l = Math.sin(a), h = [
|
|
538
538
|
{ x: 0, z: 0 },
|
|
539
|
-
{ x:
|
|
540
|
-
{ x:
|
|
539
|
+
{ x: o, z: 0 },
|
|
540
|
+
{ x: o, z: s },
|
|
541
541
|
{ x: 0, z: s }
|
|
542
542
|
].map((u) => ({
|
|
543
|
-
x:
|
|
544
|
-
z:
|
|
543
|
+
x: i.position.x + u.x * c + u.z * l,
|
|
544
|
+
z: i.position.z - u.x * l + u.z * c
|
|
545
545
|
})), g = Math.min(...h.map((u) => u.x)), w = Math.max(...h.map((u) => u.x)), m = Math.min(...h.map((u) => u.z)), x = Math.max(...h.map((u) => u.z));
|
|
546
546
|
return {
|
|
547
547
|
minX: g,
|
|
548
548
|
maxX: w,
|
|
549
|
-
minY:
|
|
550
|
-
maxY:
|
|
549
|
+
minY: i.position.y,
|
|
550
|
+
maxY: i.position.y + n,
|
|
551
551
|
minZ: m,
|
|
552
552
|
maxZ: x
|
|
553
553
|
};
|
|
554
554
|
}
|
|
555
|
-
function ve(
|
|
556
|
-
return
|
|
555
|
+
function ve(i, e, t = Ne) {
|
|
556
|
+
return i.minX < e.maxX - t && i.maxX > e.minX + t && i.minY < e.maxY - t && i.maxY > e.minY + t && i.minZ < e.maxZ - t && i.maxZ > e.minZ + t;
|
|
557
557
|
}
|
|
558
|
-
function
|
|
558
|
+
function Qe(i) {
|
|
559
559
|
const e = [];
|
|
560
|
-
for (let t = 0; t <
|
|
561
|
-
for (let
|
|
562
|
-
const s = L(
|
|
560
|
+
for (let t = 0; t < i.length; t++)
|
|
561
|
+
for (let o = t + 1; o < i.length; o++) {
|
|
562
|
+
const s = L(i[t]), n = L(i[o]);
|
|
563
563
|
ve(s, n) && e.push({
|
|
564
564
|
code: "BR-002",
|
|
565
565
|
severity: "error",
|
|
566
|
-
message: `Colisión entre cajas ${
|
|
567
|
-
involvedIds: [
|
|
566
|
+
message: `Colisión entre cajas ${i[t].id} y ${i[o].id}`,
|
|
567
|
+
involvedIds: [i[t].id, i[o].id]
|
|
568
568
|
});
|
|
569
569
|
}
|
|
570
570
|
return { isValid: e.length === 0, violations: e };
|
|
571
571
|
}
|
|
572
|
-
function
|
|
572
|
+
function Ke(i) {
|
|
573
573
|
const e = [];
|
|
574
|
-
for (let t = 0; t <
|
|
575
|
-
for (let
|
|
576
|
-
const s = se(
|
|
574
|
+
for (let t = 0; t < i.length; t++)
|
|
575
|
+
for (let o = t + 1; o < i.length; o++) {
|
|
576
|
+
const s = se(i[t]), n = se(i[o]);
|
|
577
577
|
ve(s, n) && e.push({
|
|
578
578
|
code: "BR-003",
|
|
579
579
|
severity: "error",
|
|
580
|
-
message: `Colisión entre palets ${
|
|
581
|
-
involvedIds: [
|
|
580
|
+
message: `Colisión entre palets ${i[t].id} y ${i[o].id}`,
|
|
581
|
+
involvedIds: [i[t].id, i[o].id]
|
|
582
582
|
});
|
|
583
583
|
}
|
|
584
584
|
return { isValid: e.length === 0, violations: e };
|
|
585
585
|
}
|
|
586
|
-
function
|
|
587
|
-
const t = [],
|
|
588
|
-
return (
|
|
586
|
+
function et(i, e) {
|
|
587
|
+
const t = [], o = L(i);
|
|
588
|
+
return (o.minX < 0 || o.maxX > e.dimensions.width) && t.push({
|
|
589
589
|
code: "BR-001",
|
|
590
590
|
severity: "error",
|
|
591
|
-
message: `Caja ${
|
|
592
|
-
involvedIds: [
|
|
593
|
-
}), (
|
|
591
|
+
message: `Caja ${i.id} sobresale por el eje X del palet`,
|
|
592
|
+
involvedIds: [i.id, e.id]
|
|
593
|
+
}), (o.minZ < 0 || o.maxZ > e.dimensions.depth) && t.push({
|
|
594
594
|
code: "BR-001",
|
|
595
595
|
severity: "error",
|
|
596
|
-
message: `Caja ${
|
|
597
|
-
involvedIds: [
|
|
598
|
-
}),
|
|
596
|
+
message: `Caja ${i.id} sobresale por el eje Z del palet`,
|
|
597
|
+
involvedIds: [i.id, e.id]
|
|
598
|
+
}), o.maxY > e.maxStackHeight && t.push({
|
|
599
599
|
code: "BR-001",
|
|
600
600
|
severity: "error",
|
|
601
|
-
message: `Caja ${
|
|
602
|
-
involvedIds: [
|
|
601
|
+
message: `Caja ${i.id} excede la altura máxima de apilamiento del palet`,
|
|
602
|
+
involvedIds: [i.id, e.id]
|
|
603
603
|
}), { isValid: t.length === 0, violations: t };
|
|
604
604
|
}
|
|
605
|
-
function
|
|
605
|
+
function tt(i, e) {
|
|
606
606
|
const t = [];
|
|
607
|
-
for (const
|
|
608
|
-
const s =
|
|
607
|
+
for (const o of i) {
|
|
608
|
+
const s = et(o, e);
|
|
609
609
|
t.push(...s.violations);
|
|
610
610
|
}
|
|
611
611
|
return { isValid: t.length === 0, violations: t };
|
|
612
612
|
}
|
|
613
|
-
function
|
|
614
|
-
const t = [],
|
|
615
|
-
return (
|
|
613
|
+
function ot(i, e) {
|
|
614
|
+
const t = [], o = se(i), s = e.dimensions;
|
|
615
|
+
return (o.minX < 0 || o.maxX > s.width) && t.push({
|
|
616
616
|
code: "BR-402",
|
|
617
617
|
severity: "error",
|
|
618
|
-
message: `Palet ${
|
|
619
|
-
involvedIds: [
|
|
620
|
-
}), (
|
|
618
|
+
message: `Palet ${i.id} sobresale por el ancho del camión`,
|
|
619
|
+
involvedIds: [i.id, e.id]
|
|
620
|
+
}), (o.minZ < 0 || o.maxZ > s.depth) && t.push({
|
|
621
621
|
code: "BR-402",
|
|
622
622
|
severity: "error",
|
|
623
|
-
message: `Palet ${
|
|
624
|
-
involvedIds: [
|
|
625
|
-
}),
|
|
623
|
+
message: `Palet ${i.id} sobresale por la profundidad del camión`,
|
|
624
|
+
involvedIds: [i.id, e.id]
|
|
625
|
+
}), o.maxY > s.height && t.push({
|
|
626
626
|
code: "BR-404",
|
|
627
627
|
severity: "error",
|
|
628
|
-
message: `Palet ${
|
|
629
|
-
involvedIds: [
|
|
628
|
+
message: `Palet ${i.id} excede la altura del camión`,
|
|
629
|
+
involvedIds: [i.id, e.id]
|
|
630
630
|
}), { isValid: t.length === 0, violations: t };
|
|
631
631
|
}
|
|
632
|
-
function
|
|
633
|
-
const t = [],
|
|
634
|
-
return
|
|
632
|
+
function Bt(i, e) {
|
|
633
|
+
const t = [], o = se(i);
|
|
634
|
+
return o.maxY > e && t.push({
|
|
635
635
|
code: "BR-403",
|
|
636
636
|
severity: "error",
|
|
637
|
-
message: `Palet ${
|
|
638
|
-
involvedIds: [
|
|
637
|
+
message: `Palet ${i.id} excede el techo de la estancia (${o.maxY}mm > ${e}mm)`,
|
|
638
|
+
involvedIds: [i.id]
|
|
639
639
|
}), { isValid: t.length === 0, violations: t };
|
|
640
640
|
}
|
|
641
|
-
function it(
|
|
642
|
-
const e = [], t =
|
|
643
|
-
return t >
|
|
641
|
+
function it(i) {
|
|
642
|
+
const e = [], t = i.boxes.reduce((s, n) => s + n.box.weight, 0), o = i.pallet.maxWeight;
|
|
643
|
+
return t > o ? e.push({
|
|
644
644
|
code: "BR-101",
|
|
645
645
|
severity: "error",
|
|
646
|
-
message: `Peso de cajas (${t.toFixed(1)}kg) excede el máximo del palet (${
|
|
647
|
-
involvedIds: [
|
|
648
|
-
}) : t >
|
|
646
|
+
message: `Peso de cajas (${t.toFixed(1)}kg) excede el máximo del palet (${o}kg)`,
|
|
647
|
+
involvedIds: [i.pallet.id]
|
|
648
|
+
}) : t > o * Ie && e.push({
|
|
649
649
|
code: "BR-101",
|
|
650
650
|
severity: "warning",
|
|
651
|
-
message: `Peso de cajas (${t.toFixed(1)}kg) supera el 90% del máximo del palet (${
|
|
652
|
-
involvedIds: [
|
|
651
|
+
message: `Peso de cajas (${t.toFixed(1)}kg) supera el 90% del máximo del palet (${o}kg)`,
|
|
652
|
+
involvedIds: [i.pallet.id]
|
|
653
653
|
}), { isValid: e.filter((s) => s.severity === "error").length === 0, violations: e };
|
|
654
654
|
}
|
|
655
|
-
function
|
|
656
|
-
const e = [], t =
|
|
657
|
-
(
|
|
655
|
+
function Wt(i) {
|
|
656
|
+
const e = [], t = i.pallets.reduce(
|
|
657
|
+
(o, s) => o + ye(s.stackedPallet),
|
|
658
658
|
0
|
|
659
659
|
);
|
|
660
|
-
return t >
|
|
660
|
+
return t > i.maxWeight ? e.push({
|
|
661
661
|
code: "BR-102",
|
|
662
662
|
severity: "error",
|
|
663
|
-
message: `Peso total (${t.toFixed(1)}kg) excede el máximo del camión (${
|
|
664
|
-
involvedIds: [
|
|
665
|
-
}) : t >
|
|
663
|
+
message: `Peso total (${t.toFixed(1)}kg) excede el máximo del camión (${i.maxWeight}kg)`,
|
|
664
|
+
involvedIds: [i.id]
|
|
665
|
+
}) : t > i.maxWeight * Ie && e.push({
|
|
666
666
|
code: "BR-102",
|
|
667
667
|
severity: "warning",
|
|
668
|
-
message: `Peso total (${t.toFixed(1)}kg) supera el 90% del máximo del camión (${
|
|
669
|
-
involvedIds: [
|
|
670
|
-
}), { isValid: e.filter((
|
|
668
|
+
message: `Peso total (${t.toFixed(1)}kg) supera el 90% del máximo del camión (${i.maxWeight}kg)`,
|
|
669
|
+
involvedIds: [i.id]
|
|
670
|
+
}), { isValid: e.filter((o) => o.severity === "error").length === 0, violations: e };
|
|
671
671
|
}
|
|
672
|
-
function
|
|
672
|
+
function st(i) {
|
|
673
673
|
const e = [];
|
|
674
|
-
for (const t of
|
|
674
|
+
for (const t of i) {
|
|
675
675
|
if (!t.box.fragile) continue;
|
|
676
|
-
const
|
|
677
|
-
s >
|
|
676
|
+
const o = t.box.fragilityMaxWeight ?? 0, s = nt(t, i);
|
|
677
|
+
s > o && e.push({
|
|
678
678
|
code: "BR-103",
|
|
679
679
|
severity: "error",
|
|
680
|
-
message: `Caja frágil ${t.id} soporta ${s.toFixed(1)}kg (máx: ${
|
|
680
|
+
message: `Caja frágil ${t.id} soporta ${s.toFixed(1)}kg (máx: ${o}kg)`,
|
|
681
681
|
involvedIds: [t.id]
|
|
682
682
|
});
|
|
683
683
|
}
|
|
684
684
|
return { isValid: e.length === 0, violations: e };
|
|
685
685
|
}
|
|
686
|
-
function
|
|
687
|
-
const t = L(
|
|
688
|
-
let
|
|
686
|
+
function nt(i, e) {
|
|
687
|
+
const t = L(i);
|
|
688
|
+
let o = 0;
|
|
689
689
|
for (const s of e) {
|
|
690
|
-
if (s.id ===
|
|
690
|
+
if (s.id === i.id) continue;
|
|
691
691
|
const n = L(s);
|
|
692
|
-
n.minY >= t.maxY - 1 && n.minX < t.maxX && n.maxX > t.minX && n.minZ < t.maxZ && n.maxZ > t.minZ && (
|
|
692
|
+
n.minY >= t.maxY - 1 && n.minX < t.maxX && n.maxX > t.minX && n.minZ < t.maxZ && n.maxZ > t.minZ && (o += s.box.weight);
|
|
693
693
|
}
|
|
694
|
-
return
|
|
694
|
+
return o;
|
|
695
695
|
}
|
|
696
|
-
function
|
|
696
|
+
function rt(i, e) {
|
|
697
697
|
const t = [];
|
|
698
698
|
if (e.length === 0) return { isValid: !0, violations: t };
|
|
699
|
-
const
|
|
700
|
-
if (
|
|
699
|
+
const o = e.reduce((l, f) => l + f.box.weight, 0);
|
|
700
|
+
if (o === 0) return { isValid: !0, violations: t };
|
|
701
701
|
let s = 0, n = 0;
|
|
702
702
|
for (const l of e) {
|
|
703
|
-
const
|
|
703
|
+
const f = L(l), h = (f.minX + f.maxX) / 2, g = (f.minZ + f.maxZ) / 2;
|
|
704
704
|
s += h * l.box.weight, n += g * l.box.weight;
|
|
705
705
|
}
|
|
706
|
-
s /=
|
|
707
|
-
const a =
|
|
708
|
-
return (Math.abs(s - a) >
|
|
706
|
+
s /= o, n /= o;
|
|
707
|
+
const a = i.dimensions.width / 2, c = i.dimensions.depth / 2;
|
|
708
|
+
return (Math.abs(s - a) > i.dimensions.width / 6 || Math.abs(n - c) > i.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
|
-
involvedIds: [
|
|
712
|
+
involvedIds: [i.id]
|
|
713
713
|
}), { isValid: !0, violations: t };
|
|
714
714
|
}
|
|
715
|
-
function
|
|
715
|
+
function at(i) {
|
|
716
716
|
const e = [];
|
|
717
|
-
for (const t of
|
|
717
|
+
for (const t of i) {
|
|
718
718
|
if (t.box.stackable) continue;
|
|
719
|
-
const
|
|
720
|
-
for (const s of
|
|
719
|
+
const o = L(t);
|
|
720
|
+
for (const s of i) {
|
|
721
721
|
if (s.id === t.id) continue;
|
|
722
722
|
const n = L(s);
|
|
723
|
-
n.minY >=
|
|
723
|
+
n.minY >= o.maxY - 1 && n.minX < o.maxX && n.maxX > o.minX && n.minZ < o.maxZ && n.maxZ > o.minZ && e.push({
|
|
724
724
|
code: "BR-201",
|
|
725
725
|
severity: "error",
|
|
726
726
|
message: `Caja ${s.id} apilada sobre caja no apilable ${t.id}`,
|
|
@@ -730,14 +730,14 @@ function rt(o) {
|
|
|
730
730
|
}
|
|
731
731
|
return { isValid: e.length === 0, violations: e };
|
|
732
732
|
}
|
|
733
|
-
function
|
|
733
|
+
function ct(i) {
|
|
734
734
|
const e = [];
|
|
735
|
-
for (const t of
|
|
736
|
-
const
|
|
737
|
-
for (const n of
|
|
735
|
+
for (const t of i) {
|
|
736
|
+
const o = L(t), s = (o.maxX - o.minX) * (o.maxZ - o.minZ);
|
|
737
|
+
for (const n of i) {
|
|
738
738
|
if (n.id === t.id) continue;
|
|
739
739
|
const a = L(n);
|
|
740
|
-
if (a.minY <
|
|
740
|
+
if (a.minY < o.maxY - 1 || a.minX >= o.maxX || a.maxX <= o.minX || a.minZ >= o.maxZ || a.maxZ <= o.minZ) continue;
|
|
741
741
|
const c = (a.maxX - a.minX) * (a.maxZ - a.minZ);
|
|
742
742
|
n.box.weight > t.box.weight * 1.5 && c > s * 1.2 && e.push({
|
|
743
743
|
code: "BR-203",
|
|
@@ -749,63 +749,63 @@ function at(o) {
|
|
|
749
749
|
}
|
|
750
750
|
return { isValid: !0, violations: e };
|
|
751
751
|
}
|
|
752
|
-
function
|
|
752
|
+
function $t(i) {
|
|
753
753
|
const e = [];
|
|
754
|
-
if (
|
|
755
|
-
const t =
|
|
756
|
-
for (let
|
|
757
|
-
const s =
|
|
754
|
+
if (i.floors.length <= 1) return { isValid: !0, violations: e };
|
|
755
|
+
const t = i.floors[0].pallet;
|
|
756
|
+
for (let o = 1; o < i.floors.length; o++) {
|
|
757
|
+
const s = i.floors[o].pallet;
|
|
758
758
|
(s.dimensions.width !== t.dimensions.width || s.dimensions.depth !== t.dimensions.depth) && e.push({
|
|
759
759
|
code: "BR-301",
|
|
760
760
|
severity: "error",
|
|
761
|
-
message: `Piso ${
|
|
761
|
+
message: `Piso ${o}: dimensiones (${s.dimensions.width}×${s.dimensions.depth}) distintas a la base (${t.dimensions.width}×${t.dimensions.depth})`,
|
|
762
762
|
involvedIds: [t.id, s.id]
|
|
763
763
|
});
|
|
764
764
|
}
|
|
765
765
|
return { isValid: e.length === 0, violations: e };
|
|
766
766
|
}
|
|
767
|
-
function
|
|
767
|
+
function Lt(i) {
|
|
768
768
|
const e = [];
|
|
769
|
-
for (let t = 0; t <
|
|
770
|
-
|
|
769
|
+
for (let t = 0; t < i.floors.length - 1; t++)
|
|
770
|
+
i.floors[t].separatorAbove || e.push({
|
|
771
771
|
code: "BR-302",
|
|
772
772
|
severity: "error",
|
|
773
773
|
message: `Falta separador entre piso ${t} y piso ${t + 1}`,
|
|
774
|
-
involvedIds: [
|
|
774
|
+
involvedIds: [i.id]
|
|
775
775
|
});
|
|
776
776
|
return { isValid: e.length === 0, violations: e };
|
|
777
777
|
}
|
|
778
|
-
function
|
|
779
|
-
const t = [],
|
|
780
|
-
return
|
|
778
|
+
function Gt(i, e) {
|
|
779
|
+
const t = [], o = le(i);
|
|
780
|
+
return o > e && t.push({
|
|
781
781
|
code: "BR-303",
|
|
782
782
|
severity: "error",
|
|
783
|
-
message: `Altura del stack (${
|
|
784
|
-
involvedIds: [
|
|
783
|
+
message: `Altura del stack (${o}mm) excede la del contenedor (${e}mm)`,
|
|
784
|
+
involvedIds: [i.id]
|
|
785
785
|
}), { isValid: t.length === 0, violations: t };
|
|
786
786
|
}
|
|
787
|
-
function
|
|
788
|
-
const e = [], t = ye(
|
|
789
|
-
return s >
|
|
787
|
+
function Vt(i) {
|
|
788
|
+
const e = [], t = ye(i), o = i.floors[0].pallet.maxWeight, s = t - i.floors[0].pallet.weight;
|
|
789
|
+
return s > o && e.push({
|
|
790
790
|
code: "BR-304",
|
|
791
791
|
severity: "error",
|
|
792
|
-
message: `Peso de carga del stack (${s.toFixed(1)}kg) excede la capacidad del palet base (${
|
|
793
|
-
involvedIds: [
|
|
792
|
+
message: `Peso de carga del stack (${s.toFixed(1)}kg) excede la capacidad del palet base (${o}kg)`,
|
|
793
|
+
involvedIds: [i.id]
|
|
794
794
|
}), { isValid: e.length === 0, violations: e };
|
|
795
795
|
}
|
|
796
|
-
function
|
|
796
|
+
function lt(i) {
|
|
797
797
|
const e = [];
|
|
798
|
-
for (const t of
|
|
799
|
-
const
|
|
800
|
-
if (
|
|
801
|
-
const s = (
|
|
798
|
+
for (const t of i) {
|
|
799
|
+
const o = L(t);
|
|
800
|
+
if (o.minY <= 1) continue;
|
|
801
|
+
const s = (o.maxX - o.minX) * (o.maxZ - o.minZ);
|
|
802
802
|
let n = 0;
|
|
803
|
-
for (const a of
|
|
803
|
+
for (const a of i) {
|
|
804
804
|
if (a.id === t.id) continue;
|
|
805
805
|
const c = L(a);
|
|
806
|
-
if (Math.abs(c.maxY -
|
|
807
|
-
const l = Math.max(0, Math.min(
|
|
808
|
-
n += l *
|
|
806
|
+
if (Math.abs(c.maxY - o.minY) > 2) continue;
|
|
807
|
+
const l = Math.max(0, Math.min(o.maxX, c.maxX) - Math.max(o.minX, c.minX)), f = Math.max(0, Math.min(o.maxZ, c.maxZ) - Math.max(o.minZ, c.minZ));
|
|
808
|
+
n += l * f;
|
|
809
809
|
}
|
|
810
810
|
s > 0 && n / s < ze && e.push({
|
|
811
811
|
code: "BR-004",
|
|
@@ -816,99 +816,99 @@ function ct(o) {
|
|
|
816
816
|
}
|
|
817
817
|
return { isValid: e.length === 0, violations: e };
|
|
818
818
|
}
|
|
819
|
-
function Y(
|
|
820
|
-
if (
|
|
821
|
-
let e = 0, t = 0,
|
|
822
|
-
for (const n of
|
|
823
|
-
const a = L(n), c = (a.minX + a.maxX) / 2, l = (a.minY + a.maxY) / 2,
|
|
824
|
-
t += c * h,
|
|
819
|
+
function Y(i) {
|
|
820
|
+
if (i.length === 0) return { x: 0, y: 0, z: 0 };
|
|
821
|
+
let e = 0, t = 0, o = 0, s = 0;
|
|
822
|
+
for (const n of i) {
|
|
823
|
+
const a = L(n), c = (a.minX + a.maxX) / 2, l = (a.minY + a.maxY) / 2, f = (a.minZ + a.maxZ) / 2, h = n.box.weight;
|
|
824
|
+
t += c * h, o += l * h, s += f * h, e += h;
|
|
825
825
|
}
|
|
826
826
|
return e === 0 ? { x: 0, y: 0, z: 0 } : {
|
|
827
827
|
x: t / e,
|
|
828
|
-
y:
|
|
828
|
+
y: o / e,
|
|
829
829
|
z: s / e
|
|
830
830
|
};
|
|
831
831
|
}
|
|
832
|
-
function ee(
|
|
832
|
+
function ee(i, e) {
|
|
833
833
|
if (e.length === 0) return 100;
|
|
834
|
-
const t = Y(e),
|
|
834
|
+
const t = Y(e), o = i.dimensions.width / 2, s = i.dimensions.depth / 2, n = Math.abs(t.x - o) / (i.dimensions.width / 2), a = Math.abs(t.z - s) / (i.dimensions.depth / 2), c = Math.max(0, 100 - (n + a) * 50), l = e.reduce((g, w) => {
|
|
835
835
|
const m = L(w);
|
|
836
836
|
return Math.max(g, m.maxY);
|
|
837
|
-
}, 0),
|
|
837
|
+
}, 0), f = l > 0 ? t.y / l : 0, h = Math.max(0, 100 - Math.max(0, f - 0.5) * 100);
|
|
838
838
|
return Math.round(c * 0.7 + h * 0.3);
|
|
839
839
|
}
|
|
840
|
-
function
|
|
840
|
+
function dt(i, e) {
|
|
841
841
|
const t = [];
|
|
842
842
|
if (e.length === 0) return { isValid: !0, violations: t };
|
|
843
|
-
const
|
|
844
|
-
return (
|
|
843
|
+
const o = Y(e);
|
|
844
|
+
return (o.x < 0 || o.x > i.dimensions.width || o.z < 0 || o.z > i.dimensions.depth) && t.push({
|
|
845
845
|
code: "BR-502",
|
|
846
846
|
severity: "error",
|
|
847
|
-
message: `Centro de gravedad (${
|
|
848
|
-
involvedIds: [
|
|
847
|
+
message: `Centro de gravedad (${o.x.toFixed(0)}, ${o.z.toFixed(0)}) fuera del palet`,
|
|
848
|
+
involvedIds: [i.id]
|
|
849
849
|
}), { isValid: t.length === 0, violations: t };
|
|
850
850
|
}
|
|
851
|
-
function
|
|
851
|
+
function ht(i, e) {
|
|
852
852
|
const t = [];
|
|
853
853
|
if (e.length === 0) return { isValid: !0, violations: t };
|
|
854
|
-
const
|
|
855
|
-
|
|
854
|
+
const o = ee(i, e);
|
|
855
|
+
o < 50 ? t.push({
|
|
856
856
|
code: "BR-501",
|
|
857
857
|
severity: "error",
|
|
858
|
-
message: `Score de estabilidad bajo (${
|
|
859
|
-
involvedIds: [
|
|
860
|
-
}) :
|
|
858
|
+
message: `Score de estabilidad bajo (${o}/100, mínimo: 50)`,
|
|
859
|
+
involvedIds: [i.id]
|
|
860
|
+
}) : o < 70 && t.push({
|
|
861
861
|
code: "BR-501",
|
|
862
862
|
severity: "warning",
|
|
863
|
-
message: `Score de estabilidad mejorable (${
|
|
864
|
-
involvedIds: [
|
|
863
|
+
message: `Score de estabilidad mejorable (${o}/100, recomendado: ≥70)`,
|
|
864
|
+
involvedIds: [i.id]
|
|
865
865
|
});
|
|
866
866
|
const s = Y(e), n = e.reduce((a, c) => Math.max(a, L(c).maxY), 0);
|
|
867
867
|
return n > 0 && s.y > n * 0.6 && t.push({
|
|
868
868
|
code: "BR-503",
|
|
869
869
|
severity: "warning",
|
|
870
870
|
message: `Centro de gravedad alto (${s.y.toFixed(0)}mm, ${(s.y / n * 100).toFixed(0)}% de la altura)`,
|
|
871
|
-
involvedIds: [
|
|
871
|
+
involvedIds: [i.id]
|
|
872
872
|
}), { isValid: t.filter((a) => a.severity === "error").length === 0, violations: t };
|
|
873
873
|
}
|
|
874
|
-
function
|
|
874
|
+
function mt(i, e) {
|
|
875
875
|
let t = !1;
|
|
876
|
-
const
|
|
877
|
-
for (let s = 0, n =
|
|
878
|
-
const a = e[s].x, c = e[s].z, l = e[n].x,
|
|
879
|
-
c >
|
|
876
|
+
const o = e.length;
|
|
877
|
+
for (let s = 0, n = o - 1; s < o; n = s++) {
|
|
878
|
+
const a = e[s].x, c = e[s].z, l = e[n].x, f = e[n].z;
|
|
879
|
+
c > i.z != f > i.z && i.x < (l - a) * (i.z - c) / (f - c) + a && (t = !t);
|
|
880
880
|
}
|
|
881
881
|
return t;
|
|
882
882
|
}
|
|
883
|
-
function We(
|
|
884
|
-
const t = [],
|
|
885
|
-
{ x:
|
|
886
|
-
{ x:
|
|
887
|
-
{ x:
|
|
888
|
-
{ x:
|
|
883
|
+
function We(i, e) {
|
|
884
|
+
const t = [], o = se(i), s = [
|
|
885
|
+
{ x: o.minX, z: o.minZ },
|
|
886
|
+
{ x: o.maxX, z: o.minZ },
|
|
887
|
+
{ x: o.maxX, z: o.maxZ },
|
|
888
|
+
{ x: o.minX, z: o.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",
|
|
895
|
-
message: `Palet ${
|
|
896
|
-
involvedIds: [
|
|
895
|
+
message: `Palet ${i.id} fuera de la estancia ${e.name} en (${n.x}, ${n.z})`,
|
|
896
|
+
involvedIds: [i.id, e.id]
|
|
897
897
|
});
|
|
898
898
|
break;
|
|
899
899
|
}
|
|
900
|
-
return
|
|
900
|
+
return o.maxY > e.ceilingHeight && t.push({
|
|
901
901
|
code: "BR-403",
|
|
902
902
|
severity: "error",
|
|
903
|
-
message: `Palet ${
|
|
904
|
-
involvedIds: [
|
|
903
|
+
message: `Palet ${i.id} excede el techo de la estancia ${e.name}`,
|
|
904
|
+
involvedIds: [i.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
|
-
const
|
|
911
|
+
const o = [], s = [], n = /* @__PURE__ */ new Map();
|
|
912
912
|
for (const m of e) {
|
|
913
913
|
const x = m.type ?? m.sku ?? "default";
|
|
914
914
|
n.has(x) || n.set(x, []), n.get(x).push(m);
|
|
@@ -921,20 +921,20 @@ class mt {
|
|
|
921
921
|
s.push(...m);
|
|
922
922
|
continue;
|
|
923
923
|
}
|
|
924
|
-
let j = 0,
|
|
924
|
+
let j = 0, E = 0, S = 0;
|
|
925
925
|
for (; S < m.length; ) {
|
|
926
926
|
const C = m[S];
|
|
927
927
|
if (j + d > t.dimensions.depth) {
|
|
928
|
-
if (j = 0,
|
|
928
|
+
if (j = 0, E += b, E + b > t.maxStackHeight) {
|
|
929
929
|
s.push(...m.slice(S));
|
|
930
930
|
break;
|
|
931
931
|
}
|
|
932
932
|
continue;
|
|
933
933
|
}
|
|
934
|
-
|
|
934
|
+
o.push({
|
|
935
935
|
id: `placed-${++c}`,
|
|
936
936
|
box: C,
|
|
937
|
-
position: { x: a, y:
|
|
937
|
+
position: { x: a, y: E, z: j },
|
|
938
938
|
rotation: { x: 0, y: 0, z: 0 },
|
|
939
939
|
supportedBy: [],
|
|
940
940
|
supporting: []
|
|
@@ -942,14 +942,14 @@ class mt {
|
|
|
942
942
|
}
|
|
943
943
|
a += u;
|
|
944
944
|
}
|
|
945
|
-
const l = t.dimensions.width * t.maxStackHeight * t.dimensions.depth,
|
|
945
|
+
const l = t.dimensions.width * t.maxStackHeight * t.dimensions.depth, f = o.reduce((m, x) => {
|
|
946
946
|
const u = x.box.dimensions;
|
|
947
947
|
return m + u.width * u.height * u.depth;
|
|
948
|
-
}, 0), h =
|
|
948
|
+
}, 0), h = o.reduce((m, x) => m + x.box.weight, 0), g = Y(o), w = ee(t, o);
|
|
949
949
|
return {
|
|
950
|
-
placements:
|
|
950
|
+
placements: o,
|
|
951
951
|
metrics: {
|
|
952
|
-
volumeUtilization: l > 0 ?
|
|
952
|
+
volumeUtilization: l > 0 ? f / l : 0,
|
|
953
953
|
weightUtilization: t.maxWeight > 0 ? h / t.maxWeight : 0,
|
|
954
954
|
centerOfGravity: g,
|
|
955
955
|
stabilityScore: w
|
|
@@ -958,11 +958,11 @@ class mt {
|
|
|
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
|
|
965
|
+
const o = [], s = [], n = [...e].sort((g, w) => {
|
|
966
966
|
const m = g.dimensions.width * g.dimensions.height * g.dimensions.depth;
|
|
967
967
|
return w.dimensions.width * w.dimensions.height * w.dimensions.depth - m;
|
|
968
968
|
}), a = [
|
|
@@ -994,10 +994,10 @@ class ut {
|
|
|
994
994
|
supportedBy: [],
|
|
995
995
|
supporting: []
|
|
996
996
|
}, j = L(b);
|
|
997
|
-
if (!
|
|
997
|
+
if (!o.some(
|
|
998
998
|
(S) => ve(L(S), j)
|
|
999
999
|
)) {
|
|
1000
|
-
|
|
1000
|
+
o.push(b), w = !0, a.splice(x, 1), u.width - d.w > 0 && a.push({
|
|
1001
1001
|
x: u.x + d.w,
|
|
1002
1002
|
y: u.y,
|
|
1003
1003
|
z: u.z,
|
|
@@ -1025,34 +1025,34 @@ class ut {
|
|
|
1025
1025
|
}
|
|
1026
1026
|
w || s.push(g);
|
|
1027
1027
|
}
|
|
1028
|
-
const l = t.dimensions.width * t.maxStackHeight * t.dimensions.depth,
|
|
1028
|
+
const l = t.dimensions.width * t.maxStackHeight * t.dimensions.depth, f = o.reduce((g, w) => {
|
|
1029
1029
|
const m = w.box.dimensions;
|
|
1030
1030
|
return g + m.width * m.height * m.depth;
|
|
1031
|
-
}, 0), h =
|
|
1031
|
+
}, 0), h = o.reduce((g, w) => g + w.box.weight, 0);
|
|
1032
1032
|
return {
|
|
1033
|
-
placements:
|
|
1033
|
+
placements: o,
|
|
1034
1034
|
metrics: {
|
|
1035
|
-
volumeUtilization: l > 0 ?
|
|
1035
|
+
volumeUtilization: l > 0 ? f / l : 0,
|
|
1036
1036
|
weightUtilization: t.maxWeight > 0 ? h / t.maxWeight : 0,
|
|
1037
|
-
centerOfGravity: Y(
|
|
1038
|
-
stabilityScore: ee(t,
|
|
1037
|
+
centerOfGravity: Y(o),
|
|
1038
|
+
stabilityScore: ee(t, o)
|
|
1039
1039
|
},
|
|
1040
1040
|
unplacedBoxes: s
|
|
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) {
|
|
1048
|
-
const
|
|
1048
|
+
const o = [], s = [], n = [...e].sort((x, u) => {
|
|
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, c = 0, l = 0,
|
|
1052
|
+
let a = 0, c = 0, l = 0, f = 0, h = 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, c +=
|
|
1055
|
+
if (a + u > t.dimensions.width && (a = 0, c += f > 0 ? b : 0), c + b > t.dimensions.depth && (a = 0, c = 0, l += f, f = 0), l + d > t.maxStackHeight) {
|
|
1056
1056
|
s.push(x);
|
|
1057
1057
|
continue;
|
|
1058
1058
|
}
|
|
@@ -1064,32 +1064,32 @@ class xt {
|
|
|
1064
1064
|
s.push(x);
|
|
1065
1065
|
continue;
|
|
1066
1066
|
}
|
|
1067
|
-
|
|
1067
|
+
o.push({
|
|
1068
1068
|
id: `placed-${++h}`,
|
|
1069
1069
|
box: x,
|
|
1070
1070
|
position: { x: a, y: l, z: c },
|
|
1071
1071
|
rotation: { x: 0, y: 0, z: 0 },
|
|
1072
1072
|
supportedBy: [],
|
|
1073
1073
|
supporting: []
|
|
1074
|
-
}), a += u,
|
|
1074
|
+
}), a += u, f = Math.max(f, d);
|
|
1075
1075
|
}
|
|
1076
|
-
const g = t.dimensions.width * t.maxStackHeight * t.dimensions.depth, w =
|
|
1076
|
+
const g = t.dimensions.width * t.maxStackHeight * t.dimensions.depth, w = o.reduce((x, u) => {
|
|
1077
1077
|
const d = u.box.dimensions;
|
|
1078
1078
|
return x + d.width * d.height * d.depth;
|
|
1079
|
-
}, 0), m =
|
|
1079
|
+
}, 0), m = o.reduce((x, u) => x + u.box.weight, 0);
|
|
1080
1080
|
return {
|
|
1081
|
-
placements:
|
|
1081
|
+
placements: o,
|
|
1082
1082
|
metrics: {
|
|
1083
1083
|
volumeUtilization: g > 0 ? w / g : 0,
|
|
1084
1084
|
weightUtilization: t.maxWeight > 0 ? m / t.maxWeight : 0,
|
|
1085
|
-
centerOfGravity: Y(
|
|
1086
|
-
stabilityScore: ee(t,
|
|
1085
|
+
centerOfGravity: Y(o),
|
|
1086
|
+
stabilityScore: ee(t, o)
|
|
1087
1087
|
},
|
|
1088
1088
|
unplacedBoxes: s
|
|
1089
1089
|
};
|
|
1090
1090
|
}
|
|
1091
1091
|
}
|
|
1092
|
-
class
|
|
1092
|
+
class ft {
|
|
1093
1093
|
id = "material-grouping";
|
|
1094
1094
|
name = "Material & Product Grouping";
|
|
1095
1095
|
/**
|
|
@@ -1102,8 +1102,8 @@ class gt {
|
|
|
1102
1102
|
pack(e, t) {
|
|
1103
1103
|
if (e.length === 0)
|
|
1104
1104
|
return this.emptyResult();
|
|
1105
|
-
const
|
|
1106
|
-
(
|
|
1105
|
+
const o = this.sortBoxes(e), s = this.groupByMaterialWeight(o), a = this.buildLayers(s, t).flatMap((f) => f.placements), c = e.filter(
|
|
1106
|
+
(f) => !a.some((h) => h.box.id === f.id)
|
|
1107
1107
|
), l = this.calculateMetrics(a, t);
|
|
1108
1108
|
return {
|
|
1109
1109
|
placements: a,
|
|
@@ -1123,15 +1123,15 @@ class gt {
|
|
|
1123
1123
|
* @returns Sorted boxes array
|
|
1124
1124
|
*/
|
|
1125
1125
|
sortBoxes(e) {
|
|
1126
|
-
return [...e].sort((t,
|
|
1127
|
-
const s = t.materialWeight ?? 5, n =
|
|
1126
|
+
return [...e].sort((t, o) => {
|
|
1127
|
+
const s = t.materialWeight ?? 5, n = o.materialWeight ?? 5;
|
|
1128
1128
|
if (s !== n)
|
|
1129
1129
|
return n - s;
|
|
1130
|
-
const a = t.product ?? "", c =
|
|
1130
|
+
const a = t.product ?? "", c = o.product ?? "";
|
|
1131
1131
|
if (a !== c)
|
|
1132
1132
|
return a.localeCompare(c);
|
|
1133
|
-
const l = t.dimensions.width * t.dimensions.depth,
|
|
1134
|
-
return l !==
|
|
1133
|
+
const l = t.dimensions.width * t.dimensions.depth, f = o.dimensions.width * o.dimensions.depth;
|
|
1134
|
+
return l !== f ? f - l : o.dimensions.height - t.dimensions.height;
|
|
1135
1135
|
});
|
|
1136
1136
|
}
|
|
1137
1137
|
/**
|
|
@@ -1142,11 +1142,11 @@ class gt {
|
|
|
1142
1142
|
*/
|
|
1143
1143
|
groupByMaterialWeight(e) {
|
|
1144
1144
|
const t = /* @__PURE__ */ new Map();
|
|
1145
|
-
for (const
|
|
1146
|
-
const s =
|
|
1147
|
-
t.has(s) || t.set(s, []), t.get(s).push(
|
|
1145
|
+
for (const o of e) {
|
|
1146
|
+
const s = o.materialWeight ?? 5;
|
|
1147
|
+
t.has(s) || t.set(s, []), t.get(s).push(o);
|
|
1148
1148
|
}
|
|
1149
|
-
return new Map([...t.entries()].sort((
|
|
1149
|
+
return new Map([...t.entries()].sort((o, s) => s[0] - o[0]));
|
|
1150
1150
|
}
|
|
1151
1151
|
// ─── Phase 2: Layer Construction ──────────────────────────────────
|
|
1152
1152
|
/**
|
|
@@ -1157,27 +1157,27 @@ class gt {
|
|
|
1157
1157
|
* @returns Array of layers
|
|
1158
1158
|
*/
|
|
1159
1159
|
buildLayers(e, t) {
|
|
1160
|
-
const
|
|
1160
|
+
const o = [], s = /* @__PURE__ */ new Map(), n = [];
|
|
1161
1161
|
let a = 0;
|
|
1162
1162
|
for (const [, c] of e) {
|
|
1163
1163
|
let l = [...c];
|
|
1164
1164
|
for (; l.length > 0; ) {
|
|
1165
|
-
const
|
|
1165
|
+
const f = this.buildNextLayer(
|
|
1166
1166
|
l,
|
|
1167
1167
|
t,
|
|
1168
1168
|
a,
|
|
1169
1169
|
s,
|
|
1170
1170
|
n
|
|
1171
1171
|
);
|
|
1172
|
-
if (
|
|
1172
|
+
if (f.placements.length === 0)
|
|
1173
1173
|
break;
|
|
1174
|
-
|
|
1175
|
-
const h = new Set(
|
|
1174
|
+
o.push(f), n.push(...f.placements), a += f.height;
|
|
1175
|
+
const h = new Set(f.placements.map((g) => g.box.id));
|
|
1176
1176
|
if (l = l.filter((g) => !h.has(g.id)), a >= t.maxStackHeight)
|
|
1177
1177
|
break;
|
|
1178
1178
|
}
|
|
1179
1179
|
}
|
|
1180
|
-
return
|
|
1180
|
+
return o;
|
|
1181
1181
|
}
|
|
1182
1182
|
/**
|
|
1183
1183
|
* Builds the next layer using available boxes
|
|
@@ -1194,11 +1194,11 @@ class gt {
|
|
|
1194
1194
|
* @param allPreviousPlacements - All placements from previous layers (for support calculation)
|
|
1195
1195
|
* @returns Constructed layer
|
|
1196
1196
|
*/
|
|
1197
|
-
buildNextLayer(e, t,
|
|
1197
|
+
buildNextLayer(e, t, o, s, n) {
|
|
1198
1198
|
const a = this.tryUniformHeightLayer(
|
|
1199
1199
|
e,
|
|
1200
1200
|
t,
|
|
1201
|
-
|
|
1201
|
+
o,
|
|
1202
1202
|
s,
|
|
1203
1203
|
n
|
|
1204
1204
|
);
|
|
@@ -1207,11 +1207,11 @@ class gt {
|
|
|
1207
1207
|
const c = this.tryMixedHeightLayer(
|
|
1208
1208
|
e,
|
|
1209
1209
|
t,
|
|
1210
|
-
|
|
1210
|
+
o,
|
|
1211
1211
|
s,
|
|
1212
1212
|
n
|
|
1213
1213
|
);
|
|
1214
|
-
return c && c.coverage >= 95 ? c : ((a?.coverage ?? 0) > (c?.coverage ?? 0) ? a : c) ?? this.emptyLayer(
|
|
1214
|
+
return c && c.coverage >= 95 ? c : ((a?.coverage ?? 0) > (c?.coverage ?? 0) ? a : c) ?? this.emptyLayer(o);
|
|
1215
1215
|
}
|
|
1216
1216
|
/**
|
|
1217
1217
|
* Attempts to create a layer with boxes of uniform height
|
|
@@ -1223,22 +1223,22 @@ class gt {
|
|
|
1223
1223
|
* @param allPreviousPlacements - All placements from previous layers
|
|
1224
1224
|
* @returns Layer or null if not possible
|
|
1225
1225
|
*/
|
|
1226
|
-
tryUniformHeightLayer(e, t,
|
|
1226
|
+
tryUniformHeightLayer(e, t, o, s, n) {
|
|
1227
1227
|
const a = /* @__PURE__ */ new Map();
|
|
1228
1228
|
for (const l of e) {
|
|
1229
|
-
const
|
|
1230
|
-
a.has(
|
|
1229
|
+
const f = l.dimensions.height;
|
|
1230
|
+
a.has(f) || a.set(f, []), a.get(f).push(l);
|
|
1231
1231
|
}
|
|
1232
1232
|
const c = [...a.entries()].sort(
|
|
1233
|
-
(l,
|
|
1233
|
+
(l, f) => f[1].length - l[1].length
|
|
1234
1234
|
);
|
|
1235
|
-
for (const [l,
|
|
1236
|
-
if (
|
|
1235
|
+
for (const [l, f] of c) {
|
|
1236
|
+
if (o + l > t.maxStackHeight)
|
|
1237
1237
|
continue;
|
|
1238
1238
|
const h = this.placeBoxesInLayer(
|
|
1239
|
-
|
|
1239
|
+
f,
|
|
1240
1240
|
t,
|
|
1241
|
-
|
|
1241
|
+
o,
|
|
1242
1242
|
l,
|
|
1243
1243
|
s,
|
|
1244
1244
|
n
|
|
@@ -1258,11 +1258,11 @@ class gt {
|
|
|
1258
1258
|
* @param allPreviousPlacements - All placements from previous layers
|
|
1259
1259
|
* @returns Layer or null if not possible
|
|
1260
1260
|
*/
|
|
1261
|
-
tryMixedHeightLayer(e, t,
|
|
1261
|
+
tryMixedHeightLayer(e, t, o, s, n) {
|
|
1262
1262
|
return this.placeBoxesInLayer(
|
|
1263
1263
|
e,
|
|
1264
1264
|
t,
|
|
1265
|
-
|
|
1265
|
+
o,
|
|
1266
1266
|
null,
|
|
1267
1267
|
s,
|
|
1268
1268
|
n
|
|
@@ -1280,7 +1280,7 @@ class gt {
|
|
|
1280
1280
|
* @param allPreviousPlacements - All placements from previous layers (for support calculation)
|
|
1281
1281
|
* @returns Constructed layer
|
|
1282
1282
|
*/
|
|
1283
|
-
placeBoxesInLayer(e, t,
|
|
1283
|
+
placeBoxesInLayer(e, t, o, s, n, a) {
|
|
1284
1284
|
const c = [
|
|
1285
1285
|
{
|
|
1286
1286
|
x: 0,
|
|
@@ -1295,9 +1295,9 @@ class gt {
|
|
|
1295
1295
|
for (const [u, d] of h) {
|
|
1296
1296
|
const b = s ? d.filter((j) => j.dimensions.height === s) : d;
|
|
1297
1297
|
for (const j of b) {
|
|
1298
|
-
if (
|
|
1298
|
+
if (o + j.dimensions.height > t.maxStackHeight)
|
|
1299
1299
|
continue;
|
|
1300
|
-
const
|
|
1300
|
+
const E = [
|
|
1301
1301
|
{
|
|
1302
1302
|
width: j.dimensions.width,
|
|
1303
1303
|
depth: j.dimensions.depth,
|
|
@@ -1309,7 +1309,7 @@ class gt {
|
|
|
1309
1309
|
rotation: 90
|
|
1310
1310
|
}
|
|
1311
1311
|
];
|
|
1312
|
-
for (const S of
|
|
1312
|
+
for (const S of E) {
|
|
1313
1313
|
const C = [
|
|
1314
1314
|
...a,
|
|
1315
1315
|
...l
|
|
@@ -1318,14 +1318,14 @@ class gt {
|
|
|
1318
1318
|
c,
|
|
1319
1319
|
n,
|
|
1320
1320
|
u,
|
|
1321
|
-
|
|
1321
|
+
o,
|
|
1322
1322
|
C
|
|
1323
1323
|
);
|
|
1324
1324
|
if (z) {
|
|
1325
1325
|
const y = {
|
|
1326
1326
|
id: `placed-${++g}`,
|
|
1327
1327
|
box: j,
|
|
1328
|
-
position: { x: z.x, y:
|
|
1328
|
+
position: { x: z.x, y: o, z: z.z },
|
|
1329
1329
|
rotation: { x: 0, y: S.rotation, z: 0 },
|
|
1330
1330
|
supportedBy: [],
|
|
1331
1331
|
supporting: []
|
|
@@ -1351,7 +1351,7 @@ class gt {
|
|
|
1351
1351
|
return u + b * j;
|
|
1352
1352
|
}, 0), x = l.length > 0 ? Math.max(...l.map((u) => u.box.dimensions.height)) : 0;
|
|
1353
1353
|
return {
|
|
1354
|
-
y:
|
|
1354
|
+
y: o,
|
|
1355
1355
|
height: x,
|
|
1356
1356
|
placements: l,
|
|
1357
1357
|
coverage: m / w * 100
|
|
@@ -1369,21 +1369,21 @@ class gt {
|
|
|
1369
1369
|
* @param pallet - Pallet dimensions
|
|
1370
1370
|
* @returns Best rectangle or null if none fit
|
|
1371
1371
|
*/
|
|
1372
|
-
findBestRectangle(e, t,
|
|
1372
|
+
findBestRectangle(e, t, o, s, n, a) {
|
|
1373
1373
|
let c = null, l = -1 / 0;
|
|
1374
|
-
for (const
|
|
1375
|
-
if (e.width <=
|
|
1374
|
+
for (const f of t)
|
|
1375
|
+
if (e.width <= f.width && e.depth <= f.depth) {
|
|
1376
1376
|
const h = this.calculateSupportArea(
|
|
1377
|
-
|
|
1378
|
-
|
|
1377
|
+
f.x,
|
|
1378
|
+
f.z,
|
|
1379
1379
|
e.width,
|
|
1380
1380
|
e.depth,
|
|
1381
1381
|
n,
|
|
1382
1382
|
a
|
|
1383
1383
|
), g = e.width * e.depth;
|
|
1384
1384
|
if (h / g < 0.7 || this.boxExtendsBeyondLowerLayer(
|
|
1385
|
-
|
|
1386
|
-
|
|
1385
|
+
f.x,
|
|
1386
|
+
f.z,
|
|
1387
1387
|
e.width,
|
|
1388
1388
|
e.depth,
|
|
1389
1389
|
n,
|
|
@@ -1391,12 +1391,12 @@ class gt {
|
|
|
1391
1391
|
))
|
|
1392
1392
|
continue;
|
|
1393
1393
|
const m = this.scoreRectangle(
|
|
1394
|
-
|
|
1394
|
+
f,
|
|
1395
1395
|
e,
|
|
1396
|
-
|
|
1396
|
+
o,
|
|
1397
1397
|
s
|
|
1398
1398
|
);
|
|
1399
|
-
m > l && (l = m, c =
|
|
1399
|
+
m > l && (l = m, c = f);
|
|
1400
1400
|
}
|
|
1401
1401
|
return c;
|
|
1402
1402
|
}
|
|
@@ -1412,22 +1412,22 @@ class gt {
|
|
|
1412
1412
|
* @param pallet - Pallet dimensions
|
|
1413
1413
|
* @returns Supported area in mm²
|
|
1414
1414
|
*/
|
|
1415
|
-
calculateSupportArea(e, t,
|
|
1415
|
+
calculateSupportArea(e, t, o, s, n, a) {
|
|
1416
1416
|
let c = 0;
|
|
1417
1417
|
if (n === 0)
|
|
1418
|
-
return
|
|
1418
|
+
return o * s;
|
|
1419
1419
|
for (const l of a) {
|
|
1420
|
-
const
|
|
1420
|
+
const f = l.rotation.y === 90 ? l.box.dimensions.depth : l.box.dimensions.width, h = l.rotation.y === 90 ? l.box.dimensions.width : l.box.dimensions.depth, g = l.position.y + l.box.dimensions.height;
|
|
1421
1421
|
if (Math.abs(g - n) > 1)
|
|
1422
1422
|
continue;
|
|
1423
1423
|
const m = this.calculateRectangleIntersection(
|
|
1424
1424
|
e,
|
|
1425
1425
|
t,
|
|
1426
|
-
|
|
1426
|
+
o,
|
|
1427
1427
|
s,
|
|
1428
1428
|
l.position.x,
|
|
1429
1429
|
l.position.z,
|
|
1430
|
-
|
|
1430
|
+
f,
|
|
1431
1431
|
h
|
|
1432
1432
|
);
|
|
1433
1433
|
c += m;
|
|
@@ -1439,9 +1439,9 @@ class gt {
|
|
|
1439
1439
|
*
|
|
1440
1440
|
* @returns Intersection area in mm²
|
|
1441
1441
|
*/
|
|
1442
|
-
calculateRectangleIntersection(e, t,
|
|
1443
|
-
const
|
|
1444
|
-
return
|
|
1442
|
+
calculateRectangleIntersection(e, t, o, s, n, a, c, l) {
|
|
1443
|
+
const f = Math.max(0, Math.min(e + o, n + c) - Math.max(e, n)), h = Math.max(0, Math.min(t + s, a + l) - Math.max(t, a));
|
|
1444
|
+
return f * h;
|
|
1445
1445
|
}
|
|
1446
1446
|
/**
|
|
1447
1447
|
* Checks if a box would extend beyond the footprint of boxes in the layer directly below
|
|
@@ -1457,7 +1457,7 @@ class gt {
|
|
|
1457
1457
|
* @param existingPlacements - Boxes already placed in current and previous layers
|
|
1458
1458
|
* @returns true if box extends beyond lower layer footprint
|
|
1459
1459
|
*/
|
|
1460
|
-
boxExtendsBeyondLowerLayer(e, t,
|
|
1460
|
+
boxExtendsBeyondLowerLayer(e, t, o, s, n, a) {
|
|
1461
1461
|
if (n === 0)
|
|
1462
1462
|
return !1;
|
|
1463
1463
|
const c = a.filter((d) => {
|
|
@@ -1466,13 +1466,13 @@ class gt {
|
|
|
1466
1466
|
});
|
|
1467
1467
|
if (c.length === 0)
|
|
1468
1468
|
return !0;
|
|
1469
|
-
let l = 1 / 0,
|
|
1469
|
+
let l = 1 / 0, f = -1 / 0, h = 1 / 0, g = -1 / 0;
|
|
1470
1470
|
for (const d of c) {
|
|
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
|
-
l = Math.min(l, d.position.x),
|
|
1472
|
+
l = Math.min(l, d.position.x), f = Math.max(f, d.position.x + b), h = Math.min(h, d.position.z), g = Math.max(g, d.position.z + j);
|
|
1473
1473
|
}
|
|
1474
|
-
const w = e +
|
|
1475
|
-
return e < l - x || w >
|
|
1474
|
+
const w = e + o, m = t + s, x = 1;
|
|
1475
|
+
return e < l - x || w > f + x || t < h - x || m > g + x;
|
|
1476
1476
|
}
|
|
1477
1477
|
/**
|
|
1478
1478
|
* Scores a rectangle position based on multiple criteria
|
|
@@ -1485,10 +1485,10 @@ class gt {
|
|
|
1485
1485
|
* @param product - Product identifier
|
|
1486
1486
|
* @returns Score value
|
|
1487
1487
|
*/
|
|
1488
|
-
scoreRectangle(e, t,
|
|
1488
|
+
scoreRectangle(e, t, o, s) {
|
|
1489
1489
|
let n = 0;
|
|
1490
1490
|
const a = `${e.x},${e.z}`;
|
|
1491
|
-
|
|
1491
|
+
o.get(a) === s && (n += 100), o.has(a) && o.get(a) !== s && (n -= 50);
|
|
1492
1492
|
const c = e.width * e.depth - t.width * t.depth;
|
|
1493
1493
|
return n += 50 / (1 + c / 1e4), n += 30 / (1 + e.x / 1e3 + e.z / 1e3), n;
|
|
1494
1494
|
}
|
|
@@ -1500,19 +1500,19 @@ class gt {
|
|
|
1500
1500
|
* @param boxWidth - Width of placed box
|
|
1501
1501
|
* @param boxDepth - Depth of placed box
|
|
1502
1502
|
*/
|
|
1503
|
-
updateFreeRectangles(e, t,
|
|
1503
|
+
updateFreeRectangles(e, t, o, s) {
|
|
1504
1504
|
const n = [];
|
|
1505
1505
|
for (let a = e.length - 1; a >= 0; a--) {
|
|
1506
1506
|
const c = e[a];
|
|
1507
|
-
this.rectanglesIntersect(c, t,
|
|
1507
|
+
this.rectanglesIntersect(c, t, o, s) && (e.splice(a, 1), t.x > c.x && n.push({
|
|
1508
1508
|
x: c.x,
|
|
1509
1509
|
z: c.z,
|
|
1510
1510
|
width: t.x - c.x,
|
|
1511
1511
|
depth: c.depth
|
|
1512
|
-
}), t.x +
|
|
1513
|
-
x: t.x +
|
|
1512
|
+
}), t.x + o < c.x + c.width && n.push({
|
|
1513
|
+
x: t.x + o,
|
|
1514
1514
|
z: c.z,
|
|
1515
|
-
width: c.x + c.width - (t.x +
|
|
1515
|
+
width: c.x + c.width - (t.x + o),
|
|
1516
1516
|
depth: c.depth
|
|
1517
1517
|
}), t.z > c.z && n.push({
|
|
1518
1518
|
x: c.x,
|
|
@@ -1531,19 +1531,19 @@ class gt {
|
|
|
1531
1531
|
/**
|
|
1532
1532
|
* Checks if two rectangles intersect
|
|
1533
1533
|
*/
|
|
1534
|
-
rectanglesIntersect(e, t,
|
|
1535
|
-
return !(t.x +
|
|
1534
|
+
rectanglesIntersect(e, t, o, s) {
|
|
1535
|
+
return !(t.x + o <= e.x || t.x >= e.x + e.width || t.z + s <= e.z || t.z >= e.z + e.depth);
|
|
1536
1536
|
}
|
|
1537
1537
|
/**
|
|
1538
1538
|
* Removes rectangles that are fully contained within other rectangles
|
|
1539
1539
|
*/
|
|
1540
1540
|
removeContainedRectangles(e) {
|
|
1541
1541
|
for (let t = e.length - 1; t >= 0; t--) {
|
|
1542
|
-
const
|
|
1542
|
+
const o = e[t];
|
|
1543
1543
|
for (let s = 0; s < e.length; s++) {
|
|
1544
1544
|
if (t === s) continue;
|
|
1545
1545
|
const n = e[s];
|
|
1546
|
-
if (
|
|
1546
|
+
if (o.x >= n.x && o.z >= n.z && o.x + o.width <= n.x + n.width && o.z + o.depth <= n.z + n.depth) {
|
|
1547
1547
|
e.splice(t, 1);
|
|
1548
1548
|
break;
|
|
1549
1549
|
}
|
|
@@ -1553,8 +1553,8 @@ class gt {
|
|
|
1553
1553
|
/**
|
|
1554
1554
|
* Updates the occupied columns map after placing a box
|
|
1555
1555
|
*/
|
|
1556
|
-
updateOccupiedColumns(e, t,
|
|
1557
|
-
const n = `${t},${
|
|
1556
|
+
updateOccupiedColumns(e, t, o, s) {
|
|
1557
|
+
const n = `${t},${o}`;
|
|
1558
1558
|
e.has(n) || e.set(n, s);
|
|
1559
1559
|
}
|
|
1560
1560
|
// ─── Utility Methods ───────────────────────────────────────────────
|
|
@@ -1563,9 +1563,9 @@ class gt {
|
|
|
1563
1563
|
*/
|
|
1564
1564
|
groupByProduct(e) {
|
|
1565
1565
|
const t = /* @__PURE__ */ new Map();
|
|
1566
|
-
for (const
|
|
1567
|
-
const s =
|
|
1568
|
-
t.has(s) || t.set(s, []), t.get(s).push(
|
|
1566
|
+
for (const o of e) {
|
|
1567
|
+
const s = o.product ?? "default";
|
|
1568
|
+
t.has(s) || t.set(s, []), t.get(s).push(o);
|
|
1569
1569
|
}
|
|
1570
1570
|
return t;
|
|
1571
1571
|
}
|
|
@@ -1599,12 +1599,12 @@ class gt {
|
|
|
1599
1599
|
* Calculates packing metrics
|
|
1600
1600
|
*/
|
|
1601
1601
|
calculateMetrics(e, t) {
|
|
1602
|
-
const
|
|
1602
|
+
const o = t.dimensions.width * t.maxStackHeight * t.dimensions.depth, s = e.reduce((a, c) => {
|
|
1603
1603
|
const l = c.box.dimensions;
|
|
1604
1604
|
return a + l.width * l.height * l.depth;
|
|
1605
1605
|
}, 0), n = e.reduce((a, c) => a + c.box.weight, 0);
|
|
1606
1606
|
return {
|
|
1607
|
-
volumeUtilization:
|
|
1607
|
+
volumeUtilization: o > 0 ? s / o : 0,
|
|
1608
1608
|
weightUtilization: t.maxWeight > 0 ? n / t.maxWeight : 0,
|
|
1609
1609
|
centerOfGravity: Y(e),
|
|
1610
1610
|
stabilityScore: ee(t, e)
|
|
@@ -1614,7 +1614,7 @@ class gt {
|
|
|
1614
1614
|
class pt {
|
|
1615
1615
|
strategies = /* @__PURE__ */ new Map();
|
|
1616
1616
|
constructor() {
|
|
1617
|
-
this.register(new
|
|
1617
|
+
this.register(new ut()), this.register(new xt()), this.register(new gt()), this.register(new ft());
|
|
1618
1618
|
}
|
|
1619
1619
|
register(e) {
|
|
1620
1620
|
this.strategies.set(e.id, e);
|
|
@@ -1635,10 +1635,10 @@ class pt {
|
|
|
1635
1635
|
return this.strategies.has(e);
|
|
1636
1636
|
}
|
|
1637
1637
|
}
|
|
1638
|
-
const
|
|
1639
|
-
let
|
|
1638
|
+
const wt = new pt();
|
|
1639
|
+
let yt = 0;
|
|
1640
1640
|
function Te() {
|
|
1641
|
-
return `pallet-${++
|
|
1641
|
+
return `pallet-${++yt}`;
|
|
1642
1642
|
}
|
|
1643
1643
|
class Z {
|
|
1644
1644
|
// ═══ Palets estándar internacionales ═══════════════════════════
|
|
@@ -1689,16 +1689,16 @@ class Z {
|
|
|
1689
1689
|
* @param overrides - Propiedades a sobrescribir
|
|
1690
1690
|
*/
|
|
1691
1691
|
static fromPreset(e, t) {
|
|
1692
|
-
const
|
|
1693
|
-
if (!
|
|
1692
|
+
const o = ue[e];
|
|
1693
|
+
if (!o)
|
|
1694
1694
|
throw new Error(`Unknown pallet preset: ${e}`);
|
|
1695
1695
|
return {
|
|
1696
1696
|
id: Te(),
|
|
1697
|
-
dimensions: { ...
|
|
1698
|
-
material:
|
|
1699
|
-
maxWeight:
|
|
1700
|
-
maxStackHeight:
|
|
1701
|
-
weight:
|
|
1697
|
+
dimensions: { ...o.dimensions },
|
|
1698
|
+
material: o.material,
|
|
1699
|
+
maxWeight: o.maxWeight,
|
|
1700
|
+
maxStackHeight: o.maxStackHeight,
|
|
1701
|
+
weight: o.weight,
|
|
1702
1702
|
metadata: { preset: e },
|
|
1703
1703
|
...t
|
|
1704
1704
|
};
|
|
@@ -1730,42 +1730,42 @@ class Z {
|
|
|
1730
1730
|
}));
|
|
1731
1731
|
}
|
|
1732
1732
|
}
|
|
1733
|
-
let
|
|
1734
|
-
function
|
|
1735
|
-
return `truck-${++
|
|
1733
|
+
let vt = 0;
|
|
1734
|
+
function Ee() {
|
|
1735
|
+
return `truck-${++vt}`;
|
|
1736
1736
|
}
|
|
1737
|
-
class
|
|
1737
|
+
class Xt {
|
|
1738
1738
|
/** Crea un camión a partir de un preset de tipo */
|
|
1739
1739
|
static fromPreset(e, t) {
|
|
1740
|
-
const
|
|
1740
|
+
const o = De[e];
|
|
1741
1741
|
return {
|
|
1742
|
-
id:
|
|
1742
|
+
id: Ee(),
|
|
1743
1743
|
name: `Camión ${e}`,
|
|
1744
1744
|
truckType: e,
|
|
1745
|
-
dimensions: { ...
|
|
1746
|
-
maxWeight:
|
|
1745
|
+
dimensions: { ...o.dimensions },
|
|
1746
|
+
maxWeight: o.maxWeight,
|
|
1747
1747
|
pallets: [],
|
|
1748
1748
|
metadata: {},
|
|
1749
1749
|
...t
|
|
1750
1750
|
};
|
|
1751
1751
|
}
|
|
1752
1752
|
/** Crea un camión custom con dimensiones y peso arbitrarios */
|
|
1753
|
-
static custom(e, t,
|
|
1753
|
+
static custom(e, t, o) {
|
|
1754
1754
|
return {
|
|
1755
|
-
id:
|
|
1755
|
+
id: Ee(),
|
|
1756
1756
|
name: "Camión Custom",
|
|
1757
|
-
truckType:
|
|
1757
|
+
truckType: ie.CUSTOM,
|
|
1758
1758
|
dimensions: { ...e },
|
|
1759
1759
|
maxWeight: t,
|
|
1760
1760
|
pallets: [],
|
|
1761
1761
|
metadata: {},
|
|
1762
|
-
...
|
|
1762
|
+
...o
|
|
1763
1763
|
};
|
|
1764
1764
|
}
|
|
1765
1765
|
}
|
|
1766
|
-
let
|
|
1767
|
-
function
|
|
1768
|
-
return `box-${++
|
|
1766
|
+
let bt = 0;
|
|
1767
|
+
function St() {
|
|
1768
|
+
return `box-${++bt}`;
|
|
1769
1769
|
}
|
|
1770
1770
|
class ge {
|
|
1771
1771
|
/**
|
|
@@ -1783,7 +1783,7 @@ class ge {
|
|
|
1783
1783
|
*/
|
|
1784
1784
|
static create(e, t) {
|
|
1785
1785
|
return {
|
|
1786
|
-
id:
|
|
1786
|
+
id: St(),
|
|
1787
1787
|
dimensions: { ...e },
|
|
1788
1788
|
weight: 5,
|
|
1789
1789
|
materialWeight: 5,
|
|
@@ -1809,13 +1809,13 @@ class ge {
|
|
|
1809
1809
|
* { materialWeight: 0, product: 'PROD-FRAGILE' }
|
|
1810
1810
|
* )
|
|
1811
1811
|
*/
|
|
1812
|
-
static fragile(e, t,
|
|
1812
|
+
static fragile(e, t, o) {
|
|
1813
1813
|
return ge.create(e, {
|
|
1814
1814
|
fragile: !0,
|
|
1815
1815
|
fragilityMaxWeight: t,
|
|
1816
1816
|
materialWeight: 0,
|
|
1817
1817
|
// Fragile boxes go on top
|
|
1818
|
-
...
|
|
1818
|
+
...o
|
|
1819
1819
|
});
|
|
1820
1820
|
}
|
|
1821
1821
|
/**
|
|
@@ -1833,21 +1833,21 @@ class ge {
|
|
|
1833
1833
|
* { materialWeight: 8, product: 'PROD-HEAVY' }
|
|
1834
1834
|
* )
|
|
1835
1835
|
*/
|
|
1836
|
-
static heavy(e, t,
|
|
1836
|
+
static heavy(e, t, o) {
|
|
1837
1837
|
return ge.create(e, {
|
|
1838
1838
|
weight: t,
|
|
1839
1839
|
stackable: !1,
|
|
1840
1840
|
materialWeight: 8,
|
|
1841
1841
|
// Heavy boxes have high resistance
|
|
1842
|
-
...
|
|
1842
|
+
...o
|
|
1843
1843
|
});
|
|
1844
1844
|
}
|
|
1845
1845
|
}
|
|
1846
|
-
function
|
|
1846
|
+
function Zt(i, e) {
|
|
1847
1847
|
return k(() => {
|
|
1848
|
-
const t =
|
|
1848
|
+
const t = Qe(i), o = tt(i, e), n = it({ pallet: e, boxes: i }), a = lt(i), c = at(i), l = ct(i), f = ht(e, i), h = dt(e, i), g = st(i), w = rt(e, i), m = [...c.violations, ...l.violations], x = [...f.violations, ...h.violations], u = [
|
|
1849
1849
|
...t.violations,
|
|
1850
|
-
...
|
|
1850
|
+
...o.violations,
|
|
1851
1851
|
...n.violations,
|
|
1852
1852
|
...a.violations,
|
|
1853
1853
|
...m,
|
|
@@ -1859,7 +1859,7 @@ function Xt(o, e) {
|
|
|
1859
1859
|
isValid: u.filter((d) => d.severity === "error").length === 0,
|
|
1860
1860
|
violations: u,
|
|
1861
1861
|
collisions: t,
|
|
1862
|
-
bounds:
|
|
1862
|
+
bounds: o,
|
|
1863
1863
|
weight: n,
|
|
1864
1864
|
gravity: a,
|
|
1865
1865
|
stacking: {
|
|
@@ -1867,17 +1867,17 @@ function Xt(o, e) {
|
|
|
1867
1867
|
violations: m
|
|
1868
1868
|
},
|
|
1869
1869
|
stability: {
|
|
1870
|
-
isValid:
|
|
1870
|
+
isValid: f.isValid && h.isValid,
|
|
1871
1871
|
violations: x
|
|
1872
1872
|
},
|
|
1873
1873
|
fragile: g,
|
|
1874
1874
|
distribution: w
|
|
1875
1875
|
};
|
|
1876
|
-
}, [
|
|
1876
|
+
}, [i, e]);
|
|
1877
1877
|
}
|
|
1878
|
-
function
|
|
1878
|
+
function Dt(i) {
|
|
1879
1879
|
return k(() => {
|
|
1880
|
-
if (!
|
|
1880
|
+
if (!i || i.floors.length === 0)
|
|
1881
1881
|
return {
|
|
1882
1882
|
volumeUtilization: 0,
|
|
1883
1883
|
weightUtilization: 0,
|
|
@@ -1888,67 +1888,67 @@ function Zt(o) {
|
|
|
1888
1888
|
boxCount: 0,
|
|
1889
1889
|
floorCount: 0
|
|
1890
1890
|
};
|
|
1891
|
-
const e = le(
|
|
1891
|
+
const e = le(i), t = ye(i), o = i.floors[0].pallet, s = i.floors.flatMap((g) => g.boxes), n = s.length, a = i.floors.length, c = o.dimensions.width * o.maxStackHeight * o.dimensions.depth, l = s.reduce((g, w) => {
|
|
1892
1892
|
const m = w.box.dimensions;
|
|
1893
1893
|
return g + m.width * m.height * m.depth;
|
|
1894
|
-
}, 0),
|
|
1894
|
+
}, 0), f = Y(s), h = ee(o, s);
|
|
1895
1895
|
return {
|
|
1896
1896
|
volumeUtilization: c > 0 ? l / c : 0,
|
|
1897
|
-
weightUtilization:
|
|
1898
|
-
centerOfGravity:
|
|
1897
|
+
weightUtilization: o.maxWeight > 0 ? t / o.maxWeight : 0,
|
|
1898
|
+
centerOfGravity: f,
|
|
1899
1899
|
stabilityScore: h,
|
|
1900
1900
|
totalHeight: e,
|
|
1901
1901
|
totalWeight: t,
|
|
1902
1902
|
boxCount: n,
|
|
1903
1903
|
floorCount: a
|
|
1904
1904
|
};
|
|
1905
|
-
}, [
|
|
1905
|
+
}, [i]);
|
|
1906
1906
|
}
|
|
1907
|
-
function
|
|
1907
|
+
function Nt(i, e = wt) {
|
|
1908
1908
|
const t = k(
|
|
1909
1909
|
() => e.list().map((s) => ({ id: s.id, name: s.name })),
|
|
1910
1910
|
[e]
|
|
1911
|
-
),
|
|
1912
|
-
(s, n) => e.get(
|
|
1913
|
-
[
|
|
1911
|
+
), o = q(
|
|
1912
|
+
(s, n) => e.get(i).pack(s, n),
|
|
1913
|
+
[i, e]
|
|
1914
1914
|
);
|
|
1915
|
-
return { availableStrategies: t, pack:
|
|
1915
|
+
return { availableStrategies: t, pack: o };
|
|
1916
1916
|
}
|
|
1917
|
-
function
|
|
1917
|
+
function Ut(i) {
|
|
1918
1918
|
return k(() => {
|
|
1919
1919
|
const e = [];
|
|
1920
|
-
for (const s of
|
|
1921
|
-
const n = We(s,
|
|
1920
|
+
for (const s of i.pallets) {
|
|
1921
|
+
const n = We(s, i);
|
|
1922
1922
|
e.push(...n.violations);
|
|
1923
1923
|
}
|
|
1924
|
-
const t =
|
|
1924
|
+
const t = Ke(i.pallets), o = [
|
|
1925
1925
|
...e,
|
|
1926
1926
|
...t.violations
|
|
1927
1927
|
];
|
|
1928
1928
|
return {
|
|
1929
|
-
isValid:
|
|
1930
|
-
violations:
|
|
1929
|
+
isValid: o.filter((s) => s.severity === "error").length === 0,
|
|
1930
|
+
violations: o,
|
|
1931
1931
|
palletInRoom: {
|
|
1932
1932
|
isValid: e.length === 0,
|
|
1933
1933
|
violations: e
|
|
1934
1934
|
},
|
|
1935
1935
|
palletCollisions: t
|
|
1936
1936
|
};
|
|
1937
|
-
}, [
|
|
1937
|
+
}, [i]);
|
|
1938
1938
|
}
|
|
1939
|
-
const
|
|
1939
|
+
const jt = V(function({
|
|
1940
1940
|
placedBox: e,
|
|
1941
1941
|
selected: t = !1,
|
|
1942
|
-
highlighted:
|
|
1942
|
+
highlighted: o = !1,
|
|
1943
1943
|
showLabel: s = !1,
|
|
1944
1944
|
color: n,
|
|
1945
1945
|
opacity: a,
|
|
1946
1946
|
selectedColor: c,
|
|
1947
1947
|
highlightedColor: l,
|
|
1948
|
-
onClick:
|
|
1948
|
+
onClick: f,
|
|
1949
1949
|
onHover: h
|
|
1950
1950
|
}) {
|
|
1951
|
-
const g =
|
|
1951
|
+
const g = _e(null), w = ce(), { box: m, position: x, rotation: u } = e, d = U.MM_TO_M, b = n ?? m.color ?? w.box.color, j = a ?? w.box.opacity, E = c ?? w.selection.selectedColor, S = l ?? w.selection.highlightedColor;
|
|
1952
1952
|
let C = m.dimensions.width, z = m.dimensions.depth;
|
|
1953
1953
|
(u.y === 90 || u.y === 270) && ([C, z] = [z, C]);
|
|
1954
1954
|
const y = k(
|
|
@@ -1961,11 +1961,11 @@ const St = V(function({
|
|
|
1961
1961
|
x.z * d + y[2] / 2
|
|
1962
1962
|
),
|
|
1963
1963
|
[x, y, d]
|
|
1964
|
-
), M = t ?
|
|
1964
|
+
), M = t ? E : o ? S : null, _ = q(
|
|
1965
1965
|
(R) => {
|
|
1966
|
-
R.stopPropagation(),
|
|
1966
|
+
R.stopPropagation(), f?.(e.id);
|
|
1967
1967
|
},
|
|
1968
|
-
[
|
|
1968
|
+
[f, e.id]
|
|
1969
1969
|
), T = q(
|
|
1970
1970
|
(R) => {
|
|
1971
1971
|
R.stopPropagation(), h?.(e.id);
|
|
@@ -1980,7 +1980,7 @@ const St = V(function({
|
|
|
1980
1980
|
{
|
|
1981
1981
|
ref: g,
|
|
1982
1982
|
position: v,
|
|
1983
|
-
onClick:
|
|
1983
|
+
onClick: _,
|
|
1984
1984
|
onPointerOver: T,
|
|
1985
1985
|
onPointerOut: I,
|
|
1986
1986
|
castShadow: !0,
|
|
@@ -1994,23 +1994,26 @@ const St = V(function({
|
|
|
1994
1994
|
transparent: j < 1,
|
|
1995
1995
|
opacity: j,
|
|
1996
1996
|
roughness: w.box.roughness,
|
|
1997
|
-
metalness: w.box.metalness
|
|
1997
|
+
metalness: w.box.metalness,
|
|
1998
|
+
polygonOffset: !0,
|
|
1999
|
+
polygonOffsetFactor: 1,
|
|
2000
|
+
polygonOffsetUnits: 1
|
|
2001
|
+
}
|
|
2002
|
+
),
|
|
2003
|
+
/* @__PURE__ */ r.jsx(
|
|
2004
|
+
Xe,
|
|
2005
|
+
{
|
|
2006
|
+
linewidth: 2,
|
|
2007
|
+
scale: 1.001,
|
|
2008
|
+
threshold: 15,
|
|
2009
|
+
color: M ?? "#000000",
|
|
2010
|
+
opacity: M ? 1 : 0.6,
|
|
2011
|
+
transparent: !0
|
|
1998
2012
|
}
|
|
1999
2013
|
)
|
|
2000
2014
|
]
|
|
2001
2015
|
}
|
|
2002
2016
|
),
|
|
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
2017
|
M && /* @__PURE__ */ r.jsxs("mesh", { position: v, children: [
|
|
2015
2018
|
/* @__PURE__ */ r.jsx("boxGeometry", { args: y }),
|
|
2016
2019
|
/* @__PURE__ */ r.jsx(
|
|
@@ -2018,7 +2021,7 @@ const St = V(function({
|
|
|
2018
2021
|
{
|
|
2019
2022
|
color: M,
|
|
2020
2023
|
wireframe: !0,
|
|
2021
|
-
wireframeLinewidth:
|
|
2024
|
+
wireframeLinewidth: 2,
|
|
2022
2025
|
transparent: !0,
|
|
2023
2026
|
opacity: 0.9,
|
|
2024
2027
|
depthTest: !1
|
|
@@ -2043,15 +2046,15 @@ const St = V(function({
|
|
|
2043
2046
|
}
|
|
2044
2047
|
)
|
|
2045
2048
|
] });
|
|
2046
|
-
}),
|
|
2049
|
+
}), Mt = V(function({
|
|
2047
2050
|
pallet: e,
|
|
2048
2051
|
position: t = { x: 0, y: 0, z: 0 },
|
|
2049
|
-
color:
|
|
2052
|
+
color: o,
|
|
2050
2053
|
edgeColor: s
|
|
2051
2054
|
}) {
|
|
2052
|
-
const n = ce(), a =
|
|
2053
|
-
() => [
|
|
2054
|
-
[
|
|
2055
|
+
const n = ce(), a = o ?? n.pallet.color, c = s ?? n.pallet.edgeColor, l = U.MM_TO_M, f = e.dimensions, h = k(
|
|
2056
|
+
() => [f.width * l, f.height * l, f.depth * l],
|
|
2057
|
+
[f, l]
|
|
2055
2058
|
), g = k(
|
|
2056
2059
|
() => new B.Vector3(
|
|
2057
2060
|
t.x * l + h[0] / 2,
|
|
@@ -2070,25 +2073,25 @@ const St = V(function({
|
|
|
2070
2073
|
/* @__PURE__ */ r.jsx("lineBasicMaterial", { color: c })
|
|
2071
2074
|
] })
|
|
2072
2075
|
] });
|
|
2073
|
-
}),
|
|
2076
|
+
}), zt = {
|
|
2074
2077
|
[me.CARDBOARD]: "#b5926b",
|
|
2075
2078
|
[me.WOOD]: "#c4a26e",
|
|
2076
2079
|
[me.PLASTIC]: "#90a4ae"
|
|
2077
|
-
},
|
|
2080
|
+
}, Ct = V(function({
|
|
2078
2081
|
separator: e,
|
|
2079
2082
|
position: t = { x: 0, y: 0, z: 0 }
|
|
2080
2083
|
}) {
|
|
2081
|
-
const
|
|
2082
|
-
() => [s.width *
|
|
2083
|
-
[s,
|
|
2084
|
+
const o = U.MM_TO_M, s = e.dimensions, n = k(
|
|
2085
|
+
() => [s.width * o, s.height * o, s.depth * o],
|
|
2086
|
+
[s, o]
|
|
2084
2087
|
), a = k(
|
|
2085
2088
|
() => new B.Vector3(
|
|
2086
|
-
t.x *
|
|
2087
|
-
t.y *
|
|
2088
|
-
t.z *
|
|
2089
|
+
t.x * o + n[0] / 2,
|
|
2090
|
+
t.y * o + n[1] / 2,
|
|
2091
|
+
t.z * o + n[2] / 2
|
|
2089
2092
|
),
|
|
2090
|
-
[t, n,
|
|
2091
|
-
), c =
|
|
2093
|
+
[t, n, o]
|
|
2094
|
+
), c = zt[e.material];
|
|
2092
2095
|
return /* @__PURE__ */ r.jsxs("mesh", { position: a, receiveShadow: !0, children: [
|
|
2093
2096
|
/* @__PURE__ */ r.jsx("boxGeometry", { args: n }),
|
|
2094
2097
|
/* @__PURE__ */ r.jsx(
|
|
@@ -2106,29 +2109,29 @@ const St = V(function({
|
|
|
2106
2109
|
function({
|
|
2107
2110
|
stackedPallet: e,
|
|
2108
2111
|
position: t = { x: 0, y: 0, z: 0 },
|
|
2109
|
-
yRotation:
|
|
2112
|
+
yRotation: o = 0,
|
|
2110
2113
|
palletId: s,
|
|
2111
2114
|
selectedBoxId: n,
|
|
2112
2115
|
highlightedBoxId: a,
|
|
2113
2116
|
selectedColor: c,
|
|
2114
2117
|
highlightedColor: l,
|
|
2115
|
-
showLabels:
|
|
2118
|
+
showLabels: f = !1,
|
|
2116
2119
|
onBoxClick: h,
|
|
2117
2120
|
onBoxHover: g
|
|
2118
2121
|
}) {
|
|
2119
2122
|
const w = k(
|
|
2120
|
-
() =>
|
|
2123
|
+
() => Je(e, s),
|
|
2121
2124
|
[e, s]
|
|
2122
|
-
), m = U.MM_TO_M, x = k(() =>
|
|
2125
|
+
), m = U.MM_TO_M, x = k(() => o * Math.PI / 180, [o]), u = k(() => {
|
|
2123
2126
|
const d = [];
|
|
2124
2127
|
let b = 0;
|
|
2125
2128
|
for (const j of w.floors) {
|
|
2126
2129
|
d.push(b), b += j.pallet.dimensions.height;
|
|
2127
|
-
const
|
|
2130
|
+
const E = j.boxes.reduce(
|
|
2128
2131
|
(S, C) => Math.max(S, C.position.y + C.box.dimensions.height),
|
|
2129
2132
|
0
|
|
2130
2133
|
);
|
|
2131
|
-
b +=
|
|
2134
|
+
b += E, j.separatorAbove && (b += j.separatorAbove.dimensions.height);
|
|
2132
2135
|
}
|
|
2133
2136
|
return d;
|
|
2134
2137
|
}, [w]);
|
|
@@ -2138,23 +2141,23 @@ const St = V(function({
|
|
|
2138
2141
|
position: [t.x * m, t.y * m, t.z * m],
|
|
2139
2142
|
rotation: [0, x, 0],
|
|
2140
2143
|
children: w.floors.map((d, b) => {
|
|
2141
|
-
const j = u[b],
|
|
2144
|
+
const j = u[b], E = j + d.pallet.dimensions.height;
|
|
2142
2145
|
return /* @__PURE__ */ r.jsxs("group", { children: [
|
|
2143
2146
|
/* @__PURE__ */ r.jsx(
|
|
2144
|
-
|
|
2147
|
+
Mt,
|
|
2145
2148
|
{
|
|
2146
2149
|
pallet: d.pallet,
|
|
2147
2150
|
position: { x: 0, y: j, z: 0 }
|
|
2148
2151
|
}
|
|
2149
2152
|
),
|
|
2150
2153
|
d.boxes.map((S) => /* @__PURE__ */ r.jsx(
|
|
2151
|
-
|
|
2154
|
+
jt,
|
|
2152
2155
|
{
|
|
2153
2156
|
placedBox: {
|
|
2154
2157
|
...S,
|
|
2155
2158
|
position: {
|
|
2156
2159
|
x: S.position.x,
|
|
2157
|
-
y: S.position.y +
|
|
2160
|
+
y: S.position.y + E,
|
|
2158
2161
|
z: S.position.z
|
|
2159
2162
|
}
|
|
2160
2163
|
},
|
|
@@ -2162,19 +2165,19 @@ const St = V(function({
|
|
|
2162
2165
|
highlighted: a === S.id,
|
|
2163
2166
|
selectedColor: c,
|
|
2164
2167
|
highlightedColor: l,
|
|
2165
|
-
showLabel:
|
|
2168
|
+
showLabel: f,
|
|
2166
2169
|
onClick: h,
|
|
2167
2170
|
onHover: g
|
|
2168
2171
|
},
|
|
2169
2172
|
S.id
|
|
2170
2173
|
)),
|
|
2171
2174
|
d.separatorAbove && /* @__PURE__ */ r.jsx(
|
|
2172
|
-
|
|
2175
|
+
Ct,
|
|
2173
2176
|
{
|
|
2174
2177
|
separator: d.separatorAbove,
|
|
2175
2178
|
position: {
|
|
2176
2179
|
x: 0,
|
|
2177
|
-
y:
|
|
2180
|
+
y: E + d.boxes.reduce(
|
|
2178
2181
|
(S, C) => Math.max(S, C.position.y + C.box.dimensions.height),
|
|
2179
2182
|
0
|
|
2180
2183
|
),
|
|
@@ -2187,15 +2190,15 @@ const St = V(function({
|
|
|
2187
2190
|
}
|
|
2188
2191
|
);
|
|
2189
2192
|
}
|
|
2190
|
-
),
|
|
2193
|
+
), Ht = V(function({
|
|
2191
2194
|
text: e,
|
|
2192
2195
|
position: t,
|
|
2193
|
-
visible:
|
|
2196
|
+
visible: o = !0,
|
|
2194
2197
|
fontSize: s = 12,
|
|
2195
2198
|
color: n = "white",
|
|
2196
2199
|
background: a = "rgba(0,0,0,0.75)"
|
|
2197
2200
|
}) {
|
|
2198
|
-
if (!
|
|
2201
|
+
if (!o) return null;
|
|
2199
2202
|
const c = U.MM_TO_M;
|
|
2200
2203
|
return /* @__PURE__ */ r.jsx(
|
|
2201
2204
|
ke,
|
|
@@ -2215,24 +2218,24 @@ const St = V(function({
|
|
|
2215
2218
|
children: e
|
|
2216
2219
|
}
|
|
2217
2220
|
);
|
|
2218
|
-
}),
|
|
2221
|
+
}), Pt = V(
|
|
2219
2222
|
function({
|
|
2220
2223
|
room: e,
|
|
2221
2224
|
floorColor: t,
|
|
2222
|
-
wallColor:
|
|
2225
|
+
wallColor: o,
|
|
2223
2226
|
showGrid: s,
|
|
2224
2227
|
children: n
|
|
2225
2228
|
}) {
|
|
2226
|
-
const a = ce(), c = t ?? a.warehouse.floorColor, l =
|
|
2229
|
+
const a = ce(), c = t ?? a.warehouse.floorColor, l = o ?? a.warehouse.wallColor, f = s ?? a.warehouse.showGrid, h = U.MM_TO_M, g = e.ceilingHeight * h, { shape: w, minX: m, maxX: x, minZ: u, maxZ: d } = k(() => {
|
|
2227
2230
|
const y = e.floorPolygon;
|
|
2228
|
-
let v = 1 / 0, M = -1 / 0,
|
|
2231
|
+
let v = 1 / 0, M = -1 / 0, _ = 1 / 0, T = -1 / 0;
|
|
2229
2232
|
for (const R of y)
|
|
2230
|
-
v = Math.min(v, R.x * h), M = Math.max(M, R.x * h),
|
|
2233
|
+
v = Math.min(v, R.x * h), M = Math.max(M, R.x * h), _ = Math.min(_, R.z * h), T = Math.max(T, R.z * h);
|
|
2231
2234
|
const I = new B.Shape();
|
|
2232
2235
|
I.moveTo(y[0].x * h, -y[0].z * h);
|
|
2233
2236
|
for (let R = 1; R < y.length; R++)
|
|
2234
2237
|
I.lineTo(y[R].x * h, -y[R].z * h);
|
|
2235
|
-
return I.closePath(), { shape: I, minX: v, maxX: M, minZ:
|
|
2238
|
+
return I.closePath(), { shape: I, minX: v, maxX: M, minZ: _, maxZ: T };
|
|
2236
2239
|
}, [e.floorPolygon, h]), b = k(() => {
|
|
2237
2240
|
const y = e.floorPolygon, v = [], M = [];
|
|
2238
2241
|
for (let T = 0; T < y.length; T++) {
|
|
@@ -2259,18 +2262,18 @@ const St = V(function({
|
|
|
2259
2262
|
A + 3
|
|
2260
2263
|
);
|
|
2261
2264
|
}
|
|
2262
|
-
const
|
|
2263
|
-
return
|
|
2264
|
-
}, [e.floorPolygon, g, h]), j = x - m,
|
|
2265
|
-
if (!
|
|
2265
|
+
const _ = new B.BufferGeometry();
|
|
2266
|
+
return _.setAttribute("position", new B.Float32BufferAttribute(v, 3)), _.setIndex(M), _.computeVertexNormals(), _;
|
|
2267
|
+
}, [e.floorPolygon, g, h]), j = x - m, E = d - u, S = (m + x) / 2, C = (u + d) / 2, z = k(() => {
|
|
2268
|
+
if (!f) return null;
|
|
2266
2269
|
const y = 0.5, v = 0.01, M = [];
|
|
2267
2270
|
for (let T = m; T <= x; T += y)
|
|
2268
2271
|
M.push(T, v, u, T, v, d);
|
|
2269
2272
|
for (let T = u; T <= d; T += y)
|
|
2270
2273
|
M.push(m, v, T, x, v, T);
|
|
2271
|
-
const
|
|
2272
|
-
return
|
|
2273
|
-
}, [
|
|
2274
|
+
const _ = new B.BufferGeometry();
|
|
2275
|
+
return _.setAttribute("position", new B.Float32BufferAttribute(M, 3)), _;
|
|
2276
|
+
}, [f, m, x, u, d]);
|
|
2274
2277
|
return /* @__PURE__ */ r.jsxs("group", { children: [
|
|
2275
2278
|
/* @__PURE__ */ r.jsxs("mesh", { rotation: [-Math.PI / 2, 0, 0], position: [0, -5e-3, 0], receiveShadow: !0, children: [
|
|
2276
2279
|
/* @__PURE__ */ r.jsx("shapeGeometry", { args: [w] }),
|
|
@@ -2293,7 +2296,7 @@ const St = V(function({
|
|
|
2293
2296
|
opacity: a.warehouse.wallOpacity
|
|
2294
2297
|
}
|
|
2295
2298
|
) }),
|
|
2296
|
-
|
|
2299
|
+
f && z && /* @__PURE__ */ r.jsx("lineSegments", { geometry: z, children: /* @__PURE__ */ r.jsx(
|
|
2297
2300
|
"lineBasicMaterial",
|
|
2298
2301
|
{
|
|
2299
2302
|
color: a.warehouse.gridColor,
|
|
@@ -2306,7 +2309,7 @@ const St = V(function({
|
|
|
2306
2309
|
/* @__PURE__ */ r.jsx(
|
|
2307
2310
|
"directionalLight",
|
|
2308
2311
|
{
|
|
2309
|
-
position: [S + j, g * 0.8, C +
|
|
2312
|
+
position: [S + j, g * 0.8, C + E],
|
|
2310
2313
|
intensity: a.warehouse.directionalIntensity,
|
|
2311
2314
|
castShadow: !0,
|
|
2312
2315
|
"shadow-mapSize-width": 1024,
|
|
@@ -2318,33 +2321,33 @@ const St = V(function({
|
|
|
2318
2321
|
{
|
|
2319
2322
|
position: [S, g * 0.9, C],
|
|
2320
2323
|
intensity: 0.5,
|
|
2321
|
-
distance: Math.max(j,
|
|
2324
|
+
distance: Math.max(j, E) * 2
|
|
2322
2325
|
}
|
|
2323
2326
|
),
|
|
2324
2327
|
n
|
|
2325
2328
|
] });
|
|
2326
2329
|
}
|
|
2327
|
-
), K = V(function({ position: e, radius: t, width:
|
|
2330
|
+
), K = V(function({ position: e, radius: t, width: o, color: s }) {
|
|
2328
2331
|
return /* @__PURE__ */ r.jsxs("group", { position: e, children: [
|
|
2329
2332
|
/* @__PURE__ */ r.jsxs("mesh", { rotation: [0, 0, Math.PI / 2], castShadow: !0, children: [
|
|
2330
|
-
/* @__PURE__ */ r.jsx("cylinderGeometry", { args: [t, t,
|
|
2333
|
+
/* @__PURE__ */ r.jsx("cylinderGeometry", { args: [t, t, o, 24] }),
|
|
2331
2334
|
/* @__PURE__ */ r.jsx("meshStandardMaterial", { color: s, roughness: 0.9, metalness: 0.1 })
|
|
2332
2335
|
] }),
|
|
2333
2336
|
/* @__PURE__ */ r.jsxs("mesh", { rotation: [0, 0, Math.PI / 2], children: [
|
|
2334
|
-
/* @__PURE__ */ r.jsx("cylinderGeometry", { args: [t * 0.55, t * 0.55,
|
|
2337
|
+
/* @__PURE__ */ r.jsx("cylinderGeometry", { args: [t * 0.55, t * 0.55, o + 5e-3, 16] }),
|
|
2335
2338
|
/* @__PURE__ */ r.jsx("meshStandardMaterial", { color: "#888888", roughness: 0.3, metalness: 0.7 })
|
|
2336
2339
|
] })
|
|
2337
2340
|
] });
|
|
2338
|
-
}),
|
|
2341
|
+
}), Rt = V(function({
|
|
2339
2342
|
truck: e,
|
|
2340
2343
|
showGrid: t,
|
|
2341
|
-
wallOpacity:
|
|
2344
|
+
wallOpacity: o = 0.3,
|
|
2342
2345
|
showRoof: s = !1,
|
|
2343
2346
|
showSideWalls: n = !0,
|
|
2344
2347
|
children: a
|
|
2345
2348
|
}) {
|
|
2346
|
-
const l = ce().truck,
|
|
2347
|
-
if (!
|
|
2349
|
+
const l = ce().truck, f = t ?? l.showGrid, h = U.MM_TO_M, g = e.dimensions.width * h, w = e.dimensions.height * h, m = e.dimensions.depth * h, x = 0.05, u = 0.08, d = 0.28, b = 0.18, j = 0.15, E = 0.25, S = d + j, C = S + d + 0.1, z = C + E / 2 + u / 2, y = g + x * 2, v = g * 0.65, M = w * 0.85, _ = 0.15, T = m + x + _, I = z, R = k(() => {
|
|
2350
|
+
if (!f) return null;
|
|
2348
2351
|
const G = 0.5, D = z + 2e-3, H = [];
|
|
2349
2352
|
for (let X = 0; X <= g; X += G)
|
|
2350
2353
|
H.push(X, D, 0, X, D, m);
|
|
@@ -2352,20 +2355,20 @@ const St = V(function({
|
|
|
2352
2355
|
H.push(0, D, X, g, D, X);
|
|
2353
2356
|
const F = new B.BufferGeometry();
|
|
2354
2357
|
return F.setAttribute("position", new B.Float32BufferAttribute(H, 3)), F;
|
|
2355
|
-
}, [
|
|
2358
|
+
}, [f, g, m, z]), A = k(
|
|
2356
2359
|
() => /* @__PURE__ */ r.jsx(
|
|
2357
2360
|
"meshStandardMaterial",
|
|
2358
2361
|
{
|
|
2359
2362
|
color: l.wallColor,
|
|
2360
2363
|
roughness: 0.5,
|
|
2361
2364
|
metalness: 0.3,
|
|
2362
|
-
transparent:
|
|
2363
|
-
opacity:
|
|
2365
|
+
transparent: o < 1,
|
|
2366
|
+
opacity: o,
|
|
2364
2367
|
side: B.DoubleSide,
|
|
2365
|
-
depthWrite:
|
|
2368
|
+
depthWrite: o >= 0.95
|
|
2366
2369
|
}
|
|
2367
2370
|
),
|
|
2368
|
-
[l.wallColor,
|
|
2371
|
+
[l.wallColor, o]
|
|
2369
2372
|
);
|
|
2370
2373
|
return /* @__PURE__ */ r.jsxs("group", { children: [
|
|
2371
2374
|
/* @__PURE__ */ r.jsxs(
|
|
@@ -2400,7 +2403,7 @@ const St = V(function({
|
|
|
2400
2403
|
/* @__PURE__ */ r.jsx("boxGeometry", { args: [g + x * 2, x, m + x] }),
|
|
2401
2404
|
A
|
|
2402
2405
|
] }),
|
|
2403
|
-
|
|
2406
|
+
f && R && /* @__PURE__ */ r.jsx("lineSegments", { geometry: R, children: /* @__PURE__ */ r.jsx(
|
|
2404
2407
|
"lineBasicMaterial",
|
|
2405
2408
|
{
|
|
2406
2409
|
color: l.gridColor,
|
|
@@ -2409,12 +2412,12 @@ const St = V(function({
|
|
|
2409
2412
|
depthWrite: !1
|
|
2410
2413
|
}
|
|
2411
2414
|
) }),
|
|
2412
|
-
/* @__PURE__ */ r.jsxs("mesh", { position: [g * 0.25, C, (m + v +
|
|
2413
|
-
/* @__PURE__ */ r.jsx("boxGeometry", { args: [0.12,
|
|
2415
|
+
/* @__PURE__ */ r.jsxs("mesh", { position: [g * 0.25, C, (m + v + _) / 2], castShadow: !0, children: [
|
|
2416
|
+
/* @__PURE__ */ r.jsx("boxGeometry", { args: [0.12, E, m + v + _] }),
|
|
2414
2417
|
/* @__PURE__ */ r.jsx("meshStandardMaterial", { color: l.chassisColor, roughness: 0.7, metalness: 0.5 })
|
|
2415
2418
|
] }),
|
|
2416
|
-
/* @__PURE__ */ r.jsxs("mesh", { position: [g * 0.75, C, (m + v +
|
|
2417
|
-
/* @__PURE__ */ r.jsx("boxGeometry", { args: [0.12,
|
|
2419
|
+
/* @__PURE__ */ r.jsxs("mesh", { position: [g * 0.75, C, (m + v + _) / 2], castShadow: !0, children: [
|
|
2420
|
+
/* @__PURE__ */ r.jsx("boxGeometry", { args: [0.12, E, m + v + _] }),
|
|
2418
2421
|
/* @__PURE__ */ r.jsx("meshStandardMaterial", { color: l.chassisColor, roughness: 0.7, metalness: 0.5 })
|
|
2419
2422
|
] }),
|
|
2420
2423
|
[0.15, 0.35, 0.55, 0.75, 0.95].map((G) => /* @__PURE__ */ r.jsxs("mesh", { position: [g / 2, C, m * G], castShadow: !0, children: [
|
|
@@ -2542,7 +2545,7 @@ const St = V(function({
|
|
|
2542
2545
|
/* @__PURE__ */ r.jsx("group", { position: [0, z, 0], children: a })
|
|
2543
2546
|
] });
|
|
2544
2547
|
});
|
|
2545
|
-
function
|
|
2548
|
+
function Tt(i, e, t) {
|
|
2546
2549
|
if (!t)
|
|
2547
2550
|
return {
|
|
2548
2551
|
perspective: [3, 3, 3],
|
|
@@ -2550,9 +2553,9 @@ function Rt(o, e, t) {
|
|
|
2550
2553
|
top: [0, 5, 0],
|
|
2551
2554
|
front: [0, 1.5, 5],
|
|
2552
2555
|
side: [5, 1.5, 0]
|
|
2553
|
-
}[
|
|
2554
|
-
const { width:
|
|
2555
|
-
switch (
|
|
2556
|
+
}[i];
|
|
2557
|
+
const { width: o, height: s, depth: n } = t, [a, c, l] = e, h = Math.sqrt(o ** 2 + s ** 2 + n ** 2) * 3;
|
|
2558
|
+
switch (i) {
|
|
2556
2559
|
case "perspective":
|
|
2557
2560
|
return [
|
|
2558
2561
|
a + h * 0.6,
|
|
@@ -2570,34 +2573,34 @@ function Rt(o, e, t) {
|
|
|
2570
2573
|
case "front":
|
|
2571
2574
|
return [a, c + s * 0.5, l + Math.max(h, n * 1.5)];
|
|
2572
2575
|
case "side":
|
|
2573
|
-
return [a + Math.max(h,
|
|
2576
|
+
return [a + Math.max(h, o * 1.5), c + s * 0.5, l];
|
|
2574
2577
|
}
|
|
2575
2578
|
}
|
|
2576
2579
|
const Se = V(function({
|
|
2577
2580
|
preset: e = "perspective",
|
|
2578
2581
|
autoRotate: t = !1,
|
|
2579
|
-
enablePan:
|
|
2582
|
+
enablePan: o = !0,
|
|
2580
2583
|
enableZoom: s = !0,
|
|
2581
2584
|
target: n = [0, 0, 0],
|
|
2582
2585
|
minDistance: a = 0.5,
|
|
2583
2586
|
maxDistance: c = 50,
|
|
2584
2587
|
sceneSize: l
|
|
2585
2588
|
}) {
|
|
2586
|
-
const { camera:
|
|
2587
|
-
return
|
|
2588
|
-
const g =
|
|
2589
|
-
const j = Date.now() - d,
|
|
2590
|
-
|
|
2589
|
+
const { camera: f } = Ae(), h = _e(null);
|
|
2590
|
+
return fe(() => {
|
|
2591
|
+
const g = Tt(e, n, l), w = new B.Vector3(g[0], g[1], g[2]), m = new B.Vector3(...n), x = f.position.clone(), u = 1e3, d = Date.now(), b = () => {
|
|
2592
|
+
const j = Date.now() - d, E = Math.min(j / u, 1), S = 1 - Math.pow(1 - E, 3);
|
|
2593
|
+
f.position.lerpVectors(x, w, S), h.current && (h.current.target.lerp(m, S), h.current.update()), E < 1 && requestAnimationFrame(b);
|
|
2591
2594
|
};
|
|
2592
2595
|
b();
|
|
2593
|
-
}, [e, l,
|
|
2594
|
-
|
|
2596
|
+
}, [e, l, f, n]), /* @__PURE__ */ r.jsx(
|
|
2597
|
+
Ze,
|
|
2595
2598
|
{
|
|
2596
2599
|
ref: h,
|
|
2597
2600
|
target: n,
|
|
2598
2601
|
autoRotate: t,
|
|
2599
2602
|
autoRotateSpeed: 0.5,
|
|
2600
|
-
enablePan:
|
|
2603
|
+
enablePan: o,
|
|
2601
2604
|
enableZoom: s,
|
|
2602
2605
|
enableRotate: !0,
|
|
2603
2606
|
minDistance: a,
|
|
@@ -2610,7 +2613,7 @@ const Se = V(function({
|
|
|
2610
2613
|
makeDefault: !0
|
|
2611
2614
|
}
|
|
2612
2615
|
);
|
|
2613
|
-
}),
|
|
2616
|
+
}), Et = {
|
|
2614
2617
|
perspective: { label: "Perspectiva", icon: "📐" },
|
|
2615
2618
|
isometric: { label: "Isométrica", icon: "🔲" },
|
|
2616
2619
|
top: { label: "Superior", icon: "⬇️" },
|
|
@@ -2620,13 +2623,13 @@ const Se = V(function({
|
|
|
2620
2623
|
V(function({
|
|
2621
2624
|
currentPreset: e,
|
|
2622
2625
|
onPresetChange: t,
|
|
2623
|
-
position:
|
|
2626
|
+
position: o = "top-right"
|
|
2624
2627
|
}) {
|
|
2625
2628
|
const s = ["perspective", "isometric", "top", "front", "side"];
|
|
2626
|
-
return /* @__PURE__ */ r.jsxs("div", { className: `view-controls view-controls--${
|
|
2629
|
+
return /* @__PURE__ */ r.jsxs("div", { className: `view-controls view-controls--${o}`, children: [
|
|
2627
2630
|
/* @__PURE__ */ r.jsx("div", { className: "view-controls__title", children: "Vista" }),
|
|
2628
2631
|
/* @__PURE__ */ r.jsx("div", { className: "view-controls__buttons", children: s.map((n) => {
|
|
2629
|
-
const { label: a, icon: c } =
|
|
2632
|
+
const { label: a, icon: c } = Et[n], l = e === n;
|
|
2630
2633
|
return /* @__PURE__ */ r.jsxs(
|
|
2631
2634
|
"button",
|
|
2632
2635
|
{
|
|
@@ -2647,7 +2650,7 @@ V(function({
|
|
|
2647
2650
|
const je = V(function({
|
|
2648
2651
|
sceneWidth: e,
|
|
2649
2652
|
sceneDepth: t,
|
|
2650
|
-
sceneType:
|
|
2653
|
+
sceneType: o,
|
|
2651
2654
|
floorPolygon: s,
|
|
2652
2655
|
cameraPosition: n,
|
|
2653
2656
|
targetPosition: a,
|
|
@@ -2656,11 +2659,11 @@ const je = V(function({
|
|
|
2656
2659
|
const h = k(() => 130 / Math.max(e, t), [e, t]), g = (d, b) => ({
|
|
2657
2660
|
x: 10 + d * h,
|
|
2658
2661
|
y: 10 + b * h
|
|
2659
|
-
}), w = k(() =>
|
|
2662
|
+
}), w = k(() => o !== "warehouse" || !s || s.length === 0 ? "" : `M ${s.map((b) => {
|
|
2660
2663
|
const j = g(b.x, b.z);
|
|
2661
2664
|
return `${j.x},${j.y}`;
|
|
2662
|
-
}).join(" L ")} Z`, [
|
|
2663
|
-
if (
|
|
2665
|
+
}).join(" L ")} Z`, [o, s, h]), m = k(() => {
|
|
2666
|
+
if (o !== "truck") return null;
|
|
2664
2667
|
const d = g(0, 0);
|
|
2665
2668
|
return {
|
|
2666
2669
|
x: d.x,
|
|
@@ -2668,7 +2671,7 @@ const je = V(function({
|
|
|
2668
2671
|
width: e * h,
|
|
2669
2672
|
height: t * h
|
|
2670
2673
|
};
|
|
2671
|
-
}, [
|
|
2674
|
+
}, [o, e, t, h]), x = n ? g(n.x, n.z) : null, u = a ? g(a.x, a.z) : null;
|
|
2672
2675
|
return /* @__PURE__ */ r.jsxs("div", { className: `minimap minimap--${c}`, children: [
|
|
2673
2676
|
/* @__PURE__ */ r.jsx("div", { className: "minimap__title", children: "Mapa" }),
|
|
2674
2677
|
/* @__PURE__ */ r.jsxs(
|
|
@@ -2681,8 +2684,8 @@ const je = V(function({
|
|
|
2681
2684
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2682
2685
|
children: [
|
|
2683
2686
|
/* @__PURE__ */ r.jsx("rect", { width: 150, height: 150, fill: "#1a1a2e" }),
|
|
2684
|
-
|
|
2685
|
-
|
|
2687
|
+
o === "warehouse" && w && /* @__PURE__ */ r.jsx("path", { d: w, fill: "rgba(96, 165, 250, 0.15)", stroke: "#60a5fa", strokeWidth: "2" }),
|
|
2688
|
+
o === "truck" && m && /* @__PURE__ */ r.jsx(
|
|
2686
2689
|
"rect",
|
|
2687
2690
|
{
|
|
2688
2691
|
x: m.x,
|
|
@@ -2712,7 +2715,7 @@ const je = V(function({
|
|
|
2712
2715
|
)
|
|
2713
2716
|
}
|
|
2714
2717
|
) }),
|
|
2715
|
-
|
|
2718
|
+
o === "truck" && m && /* @__PURE__ */ r.jsx(
|
|
2716
2719
|
"rect",
|
|
2717
2720
|
{
|
|
2718
2721
|
x: m.x,
|
|
@@ -2758,56 +2761,56 @@ const je = V(function({
|
|
|
2758
2761
|
] });
|
|
2759
2762
|
});
|
|
2760
2763
|
function _t() {
|
|
2761
|
-
const { camera:
|
|
2762
|
-
x:
|
|
2763
|
-
y:
|
|
2764
|
-
z:
|
|
2764
|
+
const { camera: i } = Ae(), [e, t] = ae({
|
|
2765
|
+
x: i.position.x,
|
|
2766
|
+
y: i.position.y,
|
|
2767
|
+
z: i.position.z
|
|
2765
2768
|
});
|
|
2766
|
-
return
|
|
2767
|
-
let
|
|
2769
|
+
return fe(() => {
|
|
2770
|
+
let o;
|
|
2768
2771
|
const s = () => {
|
|
2769
2772
|
t({
|
|
2770
|
-
x:
|
|
2771
|
-
y:
|
|
2772
|
-
z:
|
|
2773
|
-
}),
|
|
2773
|
+
x: i.position.x,
|
|
2774
|
+
y: i.position.y,
|
|
2775
|
+
z: i.position.z
|
|
2776
|
+
}), o = requestAnimationFrame(s);
|
|
2774
2777
|
};
|
|
2775
|
-
return
|
|
2776
|
-
|
|
2778
|
+
return o = requestAnimationFrame(s), () => {
|
|
2779
|
+
o && cancelAnimationFrame(o);
|
|
2777
2780
|
};
|
|
2778
|
-
}, [
|
|
2781
|
+
}, [i]), e;
|
|
2779
2782
|
}
|
|
2780
|
-
function Me({ onPositionChange:
|
|
2783
|
+
function Me({ onPositionChange: i }) {
|
|
2781
2784
|
const e = _t();
|
|
2782
|
-
return
|
|
2783
|
-
|
|
2784
|
-
}, [e,
|
|
2785
|
+
return fe(() => {
|
|
2786
|
+
i(e);
|
|
2787
|
+
}, [e, i]), null;
|
|
2785
2788
|
}
|
|
2786
|
-
const
|
|
2789
|
+
const Yt = V(function({
|
|
2787
2790
|
stackedPallet: e,
|
|
2788
2791
|
preset: t,
|
|
2789
|
-
selectedBoxId:
|
|
2792
|
+
selectedBoxId: o,
|
|
2790
2793
|
highlightedBoxId: s,
|
|
2791
2794
|
selectedColor: n,
|
|
2792
2795
|
highlightedColor: a,
|
|
2793
2796
|
showLabels: c = !1,
|
|
2794
2797
|
cameraPreset: l = "perspective",
|
|
2795
|
-
showGrid:
|
|
2798
|
+
showGrid: f = !0,
|
|
2796
2799
|
showMiniMap: h = !1,
|
|
2797
2800
|
onBoxClick: g,
|
|
2798
2801
|
onBoxHover: w,
|
|
2799
2802
|
children: m,
|
|
2800
2803
|
style: x
|
|
2801
2804
|
}) {
|
|
2802
|
-
const u = U.MM_TO_M, d = e.floors[0]?.pallet, [b, j] = ae({ x: 0, z: 0 }),
|
|
2805
|
+
const u = U.MM_TO_M, d = e.floors[0]?.pallet, [b, j] = ae({ x: 0, z: 0 }), E = q((v) => {
|
|
2803
2806
|
j({ x: v.x, z: v.z });
|
|
2804
2807
|
}, []), S = k(() => d ? {
|
|
2805
2808
|
width: d.dimensions.width * u,
|
|
2806
2809
|
height: le(e) * u,
|
|
2807
2810
|
depth: d.dimensions.depth * u
|
|
2808
2811
|
} : { width: 1.2, height: 1, depth: 0.8 }, [d, e, u]), C = k(() => {
|
|
2809
|
-
const v = d ? d.dimensions.width * u / 2 : 0, M = d ? d.dimensions.depth * u / 2 : 0,
|
|
2810
|
-
return [v,
|
|
2812
|
+
const v = d ? d.dimensions.width * u / 2 : 0, M = d ? d.dimensions.depth * u / 2 : 0, _ = S.height / 2;
|
|
2813
|
+
return [v, _, M];
|
|
2811
2814
|
}, [d, u, S.height]), z = k(() => {
|
|
2812
2815
|
const M = Math.sqrt(
|
|
2813
2816
|
S.width ** 2 + S.height ** 2 + S.depth ** 2
|
|
@@ -2818,18 +2821,18 @@ const Ht = V(function({
|
|
|
2818
2821
|
C[2] + M * 0.7
|
|
2819
2822
|
];
|
|
2820
2823
|
}, [C, S]), y = k(() => {
|
|
2821
|
-
if (!
|
|
2822
|
-
const v = d.dimensions.width * u, M = d.dimensions.depth * u,
|
|
2823
|
-
for (let A = 0; A <= v; A +=
|
|
2824
|
+
if (!f || !d) return null;
|
|
2825
|
+
const v = d.dimensions.width * u, M = d.dimensions.depth * u, _ = 0.2, T = 1e-3, I = [];
|
|
2826
|
+
for (let A = 0; A <= v; A += _)
|
|
2824
2827
|
I.push(A, T, 0, A, T, M);
|
|
2825
|
-
for (let A = 0; A <= M; A +=
|
|
2828
|
+
for (let A = 0; A <= M; A += _)
|
|
2826
2829
|
I.push(0, T, A, v, T, A);
|
|
2827
2830
|
const R = new B.BufferGeometry();
|
|
2828
2831
|
return R.setAttribute("position", new B.Float32BufferAttribute(I, 3)), R;
|
|
2829
|
-
}, [
|
|
2832
|
+
}, [f, d, u]);
|
|
2830
2833
|
return /* @__PURE__ */ r.jsxs("div", { style: { position: "relative", width: "100%", height: "100%" }, children: [
|
|
2831
2834
|
/* @__PURE__ */ r.jsx(
|
|
2832
|
-
|
|
2835
|
+
pe,
|
|
2833
2836
|
{
|
|
2834
2837
|
shadows: !0,
|
|
2835
2838
|
camera: {
|
|
@@ -2862,7 +2865,7 @@ const Ht = V(function({
|
|
|
2862
2865
|
maxDistance: Math.max(S.width, S.height, S.depth) * 4
|
|
2863
2866
|
}
|
|
2864
2867
|
),
|
|
2865
|
-
/* @__PURE__ */ r.jsx(Me, { onPositionChange:
|
|
2868
|
+
/* @__PURE__ */ r.jsx(Me, { onPositionChange: E }),
|
|
2866
2869
|
/* @__PURE__ */ r.jsxs("mesh", { rotation: [-Math.PI / 2, 0, 0], position: [C[0], -2e-3, C[2]], receiveShadow: !0, children: [
|
|
2867
2870
|
/* @__PURE__ */ r.jsx("planeGeometry", { args: [
|
|
2868
2871
|
d ? d.dimensions.width * u * 1.5 : 3,
|
|
@@ -2870,7 +2873,7 @@ const Ht = V(function({
|
|
|
2870
2873
|
] }),
|
|
2871
2874
|
/* @__PURE__ */ r.jsx("meshStandardMaterial", { color: "#e0e0e0", roughness: 0.9 })
|
|
2872
2875
|
] }),
|
|
2873
|
-
|
|
2876
|
+
f && y && /* @__PURE__ */ r.jsx("lineSegments", { geometry: y, children: /* @__PURE__ */ r.jsx(
|
|
2874
2877
|
"lineBasicMaterial",
|
|
2875
2878
|
{
|
|
2876
2879
|
color: "#aaaaaa",
|
|
@@ -2883,7 +2886,7 @@ const Ht = V(function({
|
|
|
2883
2886
|
be,
|
|
2884
2887
|
{
|
|
2885
2888
|
stackedPallet: e,
|
|
2886
|
-
selectedBoxId:
|
|
2889
|
+
selectedBoxId: o,
|
|
2887
2890
|
highlightedBoxId: s,
|
|
2888
2891
|
selectedColor: n,
|
|
2889
2892
|
highlightedColor: a,
|
|
@@ -2908,16 +2911,16 @@ const Ht = V(function({
|
|
|
2908
2911
|
}
|
|
2909
2912
|
)
|
|
2910
2913
|
] });
|
|
2911
|
-
}),
|
|
2914
|
+
}), Ft = V(function({
|
|
2912
2915
|
truck: e,
|
|
2913
2916
|
preset: t,
|
|
2914
|
-
selectedBoxId:
|
|
2917
|
+
selectedBoxId: o,
|
|
2915
2918
|
highlightedBoxId: s,
|
|
2916
2919
|
selectedColor: n,
|
|
2917
2920
|
highlightedColor: a,
|
|
2918
2921
|
showLabels: c = !1,
|
|
2919
2922
|
showGrid: l,
|
|
2920
|
-
wallOpacity:
|
|
2923
|
+
wallOpacity: f = 0.3,
|
|
2921
2924
|
showRoof: h = !1,
|
|
2922
2925
|
showSideWalls: g = !0,
|
|
2923
2926
|
cameraPreset: w = "perspective",
|
|
@@ -2927,16 +2930,16 @@ const Ht = V(function({
|
|
|
2927
2930
|
children: d,
|
|
2928
2931
|
style: b
|
|
2929
2932
|
}) {
|
|
2930
|
-
const [j,
|
|
2931
|
-
|
|
2933
|
+
const [j, E] = ae({ x: 0, z: 0 }), S = q((R) => {
|
|
2934
|
+
E({ x: R.x, z: R.z });
|
|
2932
2935
|
}, []), C = U.MM_TO_M, z = e.dimensions.width * C, y = e.dimensions.height * C, v = e.dimensions.depth * C, M = k(
|
|
2933
2936
|
() => [z / 2, y / 2, v / 2],
|
|
2934
2937
|
[z, y, v]
|
|
2935
|
-
),
|
|
2938
|
+
), _ = k(
|
|
2936
2939
|
() => ({ width: z, height: y, depth: v }),
|
|
2937
2940
|
[z, y, v]
|
|
2938
2941
|
), T = k(() => [z * 0.8, y * 1.2, v * 0.4], [z, y, v]), I = k(() => e.pallets.filter((R) => {
|
|
2939
|
-
const A =
|
|
2942
|
+
const A = ot(R, e);
|
|
2940
2943
|
return A.isValid ? !0 : (console.error(
|
|
2941
2944
|
`[TruckScene] Palet "${R.id}" fuera de los límites del camión.`,
|
|
2942
2945
|
"Violaciones:",
|
|
@@ -2945,7 +2948,7 @@ const Ht = V(function({
|
|
|
2945
2948
|
}), [e]);
|
|
2946
2949
|
return /* @__PURE__ */ r.jsxs("div", { style: { position: "relative", width: "100%", height: "100%" }, children: [
|
|
2947
2950
|
/* @__PURE__ */ r.jsx(
|
|
2948
|
-
|
|
2951
|
+
pe,
|
|
2949
2952
|
{
|
|
2950
2953
|
shadows: !0,
|
|
2951
2954
|
camera: {
|
|
@@ -2961,18 +2964,18 @@ const Ht = V(function({
|
|
|
2961
2964
|
{
|
|
2962
2965
|
preset: w,
|
|
2963
2966
|
target: M,
|
|
2964
|
-
sceneSize:
|
|
2967
|
+
sceneSize: _,
|
|
2965
2968
|
maxDistance: Math.max(z, y, v) * 3,
|
|
2966
2969
|
minDistance: 0.5
|
|
2967
2970
|
}
|
|
2968
2971
|
),
|
|
2969
2972
|
/* @__PURE__ */ r.jsx(Me, { onPositionChange: S }),
|
|
2970
2973
|
/* @__PURE__ */ r.jsxs(
|
|
2971
|
-
|
|
2974
|
+
Rt,
|
|
2972
2975
|
{
|
|
2973
2976
|
truck: e,
|
|
2974
2977
|
showGrid: l,
|
|
2975
|
-
wallOpacity:
|
|
2978
|
+
wallOpacity: f,
|
|
2976
2979
|
showRoof: h,
|
|
2977
2980
|
showSideWalls: g,
|
|
2978
2981
|
children: [
|
|
@@ -2983,7 +2986,7 @@ const Ht = V(function({
|
|
|
2983
2986
|
position: R.position,
|
|
2984
2987
|
yRotation: R.yRotation,
|
|
2985
2988
|
palletId: R.id,
|
|
2986
|
-
selectedBoxId:
|
|
2989
|
+
selectedBoxId: o,
|
|
2987
2990
|
highlightedBoxId: s,
|
|
2988
2991
|
selectedColor: n,
|
|
2989
2992
|
highlightedColor: a,
|
|
@@ -3012,16 +3015,16 @@ const Ht = V(function({
|
|
|
3012
3015
|
}
|
|
3013
3016
|
)
|
|
3014
3017
|
] });
|
|
3015
|
-
}),
|
|
3018
|
+
}), qt = V(function({
|
|
3016
3019
|
room: e,
|
|
3017
3020
|
preset: t,
|
|
3018
|
-
selectedBoxId:
|
|
3021
|
+
selectedBoxId: o,
|
|
3019
3022
|
highlightedBoxId: s,
|
|
3020
3023
|
selectedColor: n,
|
|
3021
3024
|
highlightedColor: a,
|
|
3022
3025
|
showLabels: c = !1,
|
|
3023
3026
|
cameraPreset: l = "perspective",
|
|
3024
|
-
showMiniMap:
|
|
3027
|
+
showMiniMap: f = !1,
|
|
3025
3028
|
onBoxClick: h,
|
|
3026
3029
|
onBoxHover: g,
|
|
3027
3030
|
children: w,
|
|
@@ -3029,12 +3032,12 @@ const Ht = V(function({
|
|
|
3029
3032
|
}) {
|
|
3030
3033
|
const x = U.MM_TO_M, [u, d] = ae({ x: 0, z: 0 }), b = q((y) => {
|
|
3031
3034
|
d({ x: y.x, z: y.z });
|
|
3032
|
-
}, []), { target: j, sceneSize:
|
|
3035
|
+
}, []), { target: j, sceneSize: E, initialCameraPosition: S } = k(() => {
|
|
3033
3036
|
const y = e.floorPolygon;
|
|
3034
|
-
let v = 1 / 0, M = -1 / 0,
|
|
3037
|
+
let v = 1 / 0, M = -1 / 0, _ = 1 / 0, T = -1 / 0;
|
|
3035
3038
|
for (const P of y)
|
|
3036
|
-
v = Math.min(v, P.x * x), M = Math.max(M, P.x * x),
|
|
3037
|
-
const I = M - v, R = T -
|
|
3039
|
+
v = Math.min(v, P.x * x), M = Math.max(M, P.x * x), _ = Math.min(_, P.z * x), T = Math.max(T, P.z * x);
|
|
3040
|
+
const I = M - v, R = T - _, A = e.ceilingHeight * x, G = (v + M) / 2, D = (_ + T) / 2, H = [G, A / 2, D], F = { width: I, height: A, depth: R }, J = Math.sqrt(I ** 2 + A ** 2 + R ** 2) * 0.8, p = [
|
|
3038
3041
|
G + J * 0.6,
|
|
3039
3042
|
A + J * 0.5,
|
|
3040
3043
|
D + J * 0.6
|
|
@@ -3042,7 +3045,7 @@ const Ht = V(function({
|
|
|
3042
3045
|
return {
|
|
3043
3046
|
target: H,
|
|
3044
3047
|
sceneSize: F,
|
|
3045
|
-
initialCameraPosition:
|
|
3048
|
+
initialCameraPosition: p
|
|
3046
3049
|
};
|
|
3047
3050
|
}, [e.floorPolygon, e.ceilingHeight, x]), C = k(() => e.floorPolygon.map((y) => ({ x: y.x * x, z: y.z * x })), [e.floorPolygon, x]), z = k(() => e.pallets.filter((y) => {
|
|
3048
3051
|
const v = We(y, e);
|
|
@@ -3054,7 +3057,7 @@ const Ht = V(function({
|
|
|
3054
3057
|
}), [e]);
|
|
3055
3058
|
return /* @__PURE__ */ r.jsxs("div", { style: { position: "relative", width: "100%", height: "100%" }, children: [
|
|
3056
3059
|
/* @__PURE__ */ r.jsx(
|
|
3057
|
-
|
|
3060
|
+
pe,
|
|
3058
3061
|
{
|
|
3059
3062
|
shadows: !0,
|
|
3060
3063
|
camera: {
|
|
@@ -3070,13 +3073,13 @@ const Ht = V(function({
|
|
|
3070
3073
|
{
|
|
3071
3074
|
preset: l,
|
|
3072
3075
|
target: j,
|
|
3073
|
-
sceneSize:
|
|
3074
|
-
maxDistance: Math.max(
|
|
3076
|
+
sceneSize: E,
|
|
3077
|
+
maxDistance: Math.max(E.width, E.height, E.depth) * 4,
|
|
3075
3078
|
minDistance: 0.5
|
|
3076
3079
|
}
|
|
3077
3080
|
),
|
|
3078
3081
|
/* @__PURE__ */ r.jsx(Me, { onPositionChange: b }),
|
|
3079
|
-
/* @__PURE__ */ r.jsxs(
|
|
3082
|
+
/* @__PURE__ */ r.jsxs(Pt, { room: e, children: [
|
|
3080
3083
|
z.map((y) => /* @__PURE__ */ r.jsx(
|
|
3081
3084
|
be,
|
|
3082
3085
|
{
|
|
@@ -3084,7 +3087,7 @@ const Ht = V(function({
|
|
|
3084
3087
|
position: y.position,
|
|
3085
3088
|
yRotation: y.yRotation,
|
|
3086
3089
|
palletId: y.id,
|
|
3087
|
-
selectedBoxId:
|
|
3090
|
+
selectedBoxId: o,
|
|
3088
3091
|
highlightedBoxId: s,
|
|
3089
3092
|
selectedColor: n,
|
|
3090
3093
|
highlightedColor: a,
|
|
@@ -3099,11 +3102,11 @@ const Ht = V(function({
|
|
|
3099
3102
|
] })
|
|
3100
3103
|
}
|
|
3101
3104
|
),
|
|
3102
|
-
|
|
3105
|
+
f && /* @__PURE__ */ r.jsx(
|
|
3103
3106
|
je,
|
|
3104
3107
|
{
|
|
3105
|
-
sceneWidth:
|
|
3106
|
-
sceneDepth:
|
|
3108
|
+
sceneWidth: E.width,
|
|
3109
|
+
sceneDepth: E.depth,
|
|
3107
3110
|
sceneType: "warehouse",
|
|
3108
3111
|
floorPolygon: C,
|
|
3109
3112
|
cameraPosition: u,
|
|
@@ -3114,73 +3117,73 @@ const Ht = V(function({
|
|
|
3114
3117
|
] });
|
|
3115
3118
|
});
|
|
3116
3119
|
export {
|
|
3117
|
-
|
|
3118
|
-
|
|
3120
|
+
xt as BinPacking3DStrategy,
|
|
3121
|
+
jt as BoxComponent,
|
|
3119
3122
|
ge as BoxFactory,
|
|
3120
|
-
|
|
3123
|
+
Ne as COLLISION_TOLERANCE,
|
|
3121
3124
|
Se as CameraControlsComponent,
|
|
3122
|
-
|
|
3125
|
+
ut as ColumnStrategy,
|
|
3123
3126
|
xe as DEFAULT_PRESET,
|
|
3124
|
-
|
|
3127
|
+
Ht as Label,
|
|
3125
3128
|
ze as MIN_SUPPORT_PERCENTAGE,
|
|
3126
3129
|
Oe as PRESET_INDUSTRIAL,
|
|
3127
|
-
|
|
3130
|
+
Ue as PRESET_UNSTYLED,
|
|
3128
3131
|
pt as PackingRegistry,
|
|
3129
|
-
|
|
3132
|
+
Mt as PalletComponent,
|
|
3130
3133
|
Z as PalletFactory,
|
|
3131
3134
|
N as PalletMaterial,
|
|
3132
|
-
|
|
3135
|
+
Yt as PalletScene,
|
|
3133
3136
|
we as PresetProvider,
|
|
3134
|
-
|
|
3135
|
-
|
|
3137
|
+
He as SCENE_PRESETS,
|
|
3138
|
+
Ot as SEPARATOR_DEFAULTS,
|
|
3136
3139
|
ue as STANDARD_PALLETS,
|
|
3137
|
-
|
|
3140
|
+
Ct as SeparatorComponent,
|
|
3138
3141
|
me as SeparatorMaterial,
|
|
3139
3142
|
be as StackedPalletComponent,
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3143
|
+
De as TRUCK_PRESETS,
|
|
3144
|
+
Rt as TruckEnvironment,
|
|
3145
|
+
Xt as TruckFactory,
|
|
3146
|
+
Ft as TruckScene,
|
|
3147
|
+
ie as TruckType,
|
|
3148
|
+
gt as TypeGroupStrategy,
|
|
3146
3149
|
U as UNITS,
|
|
3147
3150
|
Ie as WEIGHT_WARNING_THRESHOLD,
|
|
3148
|
-
|
|
3149
|
-
|
|
3151
|
+
Pt as WarehouseEnvironment,
|
|
3152
|
+
qt as WarehouseScene,
|
|
3150
3153
|
ve as aabbIntersects,
|
|
3151
3154
|
Y as calculateCenterOfGravity,
|
|
3152
3155
|
ee as calculateStabilityScore,
|
|
3153
|
-
|
|
3154
|
-
|
|
3156
|
+
wt as defaultRegistry,
|
|
3157
|
+
Je as ensureUniqueBoxIds,
|
|
3155
3158
|
L as getBoxBoundingBox,
|
|
3156
3159
|
se as getPalletBoundingBox,
|
|
3157
3160
|
le as getStackedPalletTotalHeight,
|
|
3158
3161
|
ye as getStackedPalletTotalWeight,
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3162
|
+
mt as pointInPolygon,
|
|
3163
|
+
Nt as usePackingStrategy,
|
|
3164
|
+
Dt as usePalletMetrics,
|
|
3165
|
+
Zt as usePhysicsValidation,
|
|
3163
3166
|
ce as usePreset,
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3167
|
+
Ut as useWarehouseValidation,
|
|
3168
|
+
tt as validateAllBoxesInPalletBounds,
|
|
3169
|
+
et as validateBoxInPalletBounds,
|
|
3170
|
+
at as validateBoxStackability,
|
|
3171
|
+
dt as validateCogInsideSupport,
|
|
3172
|
+
st as validateFragileLoad,
|
|
3173
|
+
ct as validateInvertedPyramid,
|
|
3174
|
+
Qe as validateNoBoxCollisions,
|
|
3175
|
+
Ke as validateNoPalletCollisions,
|
|
3176
|
+
Bt as validatePalletHeight,
|
|
3174
3177
|
We as validatePalletInRoom,
|
|
3175
|
-
|
|
3178
|
+
ot as validatePalletInTruck,
|
|
3176
3179
|
it as validatePalletWeight,
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3180
|
+
Lt as validateSeparators,
|
|
3181
|
+
ht as validateStability,
|
|
3182
|
+
$t as validateStackDimensions,
|
|
3183
|
+
Gt as validateStackHeight,
|
|
3184
|
+
Vt as validateStackWeight,
|
|
3185
|
+
lt as validateSupport,
|
|
3186
|
+
Wt as validateTruckWeight,
|
|
3187
|
+
rt as validateWeightDistribution
|
|
3185
3188
|
};
|
|
3186
3189
|
//# sourceMappingURL=pallet-builder.js.map
|