@agent-play/sdk 3.4.1 → 3.4.2
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/{browser-DhKo5Hv7.d.ts → browser-tX4_SW1K.d.ts} +502 -40
- package/dist/browser.d.ts +1 -1
- package/dist/browser.js +77 -1
- package/dist/{chunk-Z2PYRHFU.js → chunk-WTI6DVRD.js} +777 -82
- package/dist/chunk-WTI6DVRD.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +91 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-Z2PYRHFU.js.map +0 -1
|
@@ -17,6 +17,22 @@ var MINIMUM_STREET_LAYOUT_BOUNDS = {
|
|
|
17
17
|
maxX: 19,
|
|
18
18
|
maxY: 2
|
|
19
19
|
};
|
|
20
|
+
var COLUMN_STREET_ROW_HEIGHT = 3;
|
|
21
|
+
var PARKING_STREET_ROW_HEIGHT = 4;
|
|
22
|
+
var PARKING_COLUMN_GAP_ROWS = 2.5;
|
|
23
|
+
var parkingZoneMinYFromColumnBase = (columnMinY) => {
|
|
24
|
+
const columnMaxY = columnMinY + COLUMN_STREET_ROW_HEIGHT - 1;
|
|
25
|
+
return Math.ceil(columnMaxY + 1 + PARKING_COLUMN_GAP_ROWS);
|
|
26
|
+
};
|
|
27
|
+
var parkingZoneMaxYFromColumnBase = (columnMinY) => {
|
|
28
|
+
return parkingZoneMinYFromColumnBase(columnMinY) + PARKING_STREET_ROW_HEIGHT - 1;
|
|
29
|
+
};
|
|
30
|
+
var DEFAULT_LAYOUT_BOUNDS_WITH_PARKING = {
|
|
31
|
+
minX: 0,
|
|
32
|
+
minY: 0,
|
|
33
|
+
maxX: 19,
|
|
34
|
+
maxY: parkingZoneMaxYFromColumnBase(0)
|
|
35
|
+
};
|
|
20
36
|
function expandBoundsToMinimumPlayArea(bounds) {
|
|
21
37
|
return {
|
|
22
38
|
minX: Math.min(bounds.minX, MINIMUM_PLAY_WORLD_BOUNDS.minX),
|
|
@@ -264,6 +280,64 @@ function getStreetPoolEntryById(id) {
|
|
|
264
280
|
}
|
|
265
281
|
|
|
266
282
|
// src/lib/world-layout-model.ts
|
|
283
|
+
var LEGACY_MCP_PRIMARY_GROUP = "mcp";
|
|
284
|
+
function normalizeLegacyOccupantGroup(value) {
|
|
285
|
+
if (value === LEGACY_MCP_PRIMARY_GROUP) {
|
|
286
|
+
return "arcade";
|
|
287
|
+
}
|
|
288
|
+
if (value === "agent" || value === "space" || value === "arcade" || value === "parking") {
|
|
289
|
+
return value;
|
|
290
|
+
}
|
|
291
|
+
throw new Error(
|
|
292
|
+
`normalizeLegacyWorldLayout: unknown primaryGroup ${value}`
|
|
293
|
+
);
|
|
294
|
+
}
|
|
295
|
+
function migrateLegacyWorldLayoutZone(zone) {
|
|
296
|
+
const rawPrimary = String(zone.primaryGroup);
|
|
297
|
+
const primaryGroup = normalizeLegacyOccupantGroup(rawPrimary);
|
|
298
|
+
const id = zone.id === "zone-mcp-strip" || rawPrimary === LEGACY_MCP_PRIMARY_GROUP ? primaryGroup === "arcade" ? "zone-arcade-strip" : zone.id : zone.id;
|
|
299
|
+
const allowedGroups = [
|
|
300
|
+
...new Set(
|
|
301
|
+
zone.allowedGroups.map(
|
|
302
|
+
(group) => normalizeLegacyOccupantGroup(String(group))
|
|
303
|
+
)
|
|
304
|
+
)
|
|
305
|
+
];
|
|
306
|
+
return { ...zone, id, primaryGroup, allowedGroups };
|
|
307
|
+
}
|
|
308
|
+
function threeStreetsFromLayoutOrPool(layout) {
|
|
309
|
+
if (layout.streets.length >= 3) {
|
|
310
|
+
const s0 = layout.streets[0];
|
|
311
|
+
const s1 = layout.streets[1];
|
|
312
|
+
const s2 = layout.streets[2];
|
|
313
|
+
if (s0 !== void 0 && s1 !== void 0 && s2 !== void 0) {
|
|
314
|
+
return [
|
|
315
|
+
{ id: s0.id, label: s0.label },
|
|
316
|
+
{ id: s1.id, label: s1.label },
|
|
317
|
+
{ id: s2.id, label: s2.label }
|
|
318
|
+
];
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
const a = STREET_NAME_POOL[0];
|
|
322
|
+
const b = STREET_NAME_POOL[1];
|
|
323
|
+
const c = STREET_NAME_POOL[2];
|
|
324
|
+
if (a === void 0 || b === void 0 || c === void 0) {
|
|
325
|
+
throw new Error("normalizeLegacyWorldLayout: STREET_NAME_POOL too small");
|
|
326
|
+
}
|
|
327
|
+
return [a, b, c];
|
|
328
|
+
}
|
|
329
|
+
function normalizeLegacyWorldLayout(layout) {
|
|
330
|
+
const migratedZones = layout.zones.map(migrateLegacyWorldLayoutZone);
|
|
331
|
+
if (migratedZones.some((zone) => zone.primaryGroup === "arcade")) {
|
|
332
|
+
return { ...layout, zones: migratedZones };
|
|
333
|
+
}
|
|
334
|
+
const streets = threeStreetsFromLayoutOrPool(layout);
|
|
335
|
+
const rebuilt = createVerticalStripSeedLayout({
|
|
336
|
+
bounds: layout.bounds,
|
|
337
|
+
streets
|
|
338
|
+
});
|
|
339
|
+
return { ...rebuilt, rev: layout.rev };
|
|
340
|
+
}
|
|
267
341
|
function streetFromPoolEntry(entry) {
|
|
268
342
|
return { id: entry.id, label: entry.label };
|
|
269
343
|
}
|
|
@@ -382,7 +456,88 @@ function assertValidLayoutBounds(bounds) {
|
|
|
382
456
|
);
|
|
383
457
|
}
|
|
384
458
|
}
|
|
385
|
-
var PRIMARY_GROUP_ORDER = [
|
|
459
|
+
var PRIMARY_GROUP_ORDER = [
|
|
460
|
+
"agent",
|
|
461
|
+
"space",
|
|
462
|
+
"arcade"
|
|
463
|
+
];
|
|
464
|
+
function partitionColumnWidths(spanX) {
|
|
465
|
+
if (spanX === 20) {
|
|
466
|
+
return [7, 7, 6];
|
|
467
|
+
}
|
|
468
|
+
const w0 = Math.floor(spanX / 3);
|
|
469
|
+
const w1 = Math.floor((spanX - w0) / 2);
|
|
470
|
+
const w2 = spanX - w0 - w1;
|
|
471
|
+
return [w0, w1, w2];
|
|
472
|
+
}
|
|
473
|
+
function buildColumnZones(input) {
|
|
474
|
+
const { minX, maxX } = input.bounds;
|
|
475
|
+
const spanX = maxX - minX + 1;
|
|
476
|
+
const widths = partitionColumnWidths(spanX);
|
|
477
|
+
const w0 = widths[0];
|
|
478
|
+
const w1 = widths[1];
|
|
479
|
+
const w2 = widths[2];
|
|
480
|
+
if (w0 === void 0 || w1 === void 0 || w2 === void 0) {
|
|
481
|
+
throw new Error("buildColumnZones: width partition failed");
|
|
482
|
+
}
|
|
483
|
+
const x0 = minX;
|
|
484
|
+
const x0Max = x0 + w0 - 1;
|
|
485
|
+
const x1 = x0Max + 1;
|
|
486
|
+
const x1Max = x1 + w1 - 1;
|
|
487
|
+
const x2 = x1Max + 1;
|
|
488
|
+
const x2Max = x2 + w2 - 1;
|
|
489
|
+
const s0 = input.streets[0];
|
|
490
|
+
const s1 = input.streets[1];
|
|
491
|
+
const s2 = input.streets[2];
|
|
492
|
+
if (s0 === void 0 || s1 === void 0 || s2 === void 0) {
|
|
493
|
+
throw new Error("buildColumnZones: expected three streets");
|
|
494
|
+
}
|
|
495
|
+
const { columnMinY, columnMaxY } = input;
|
|
496
|
+
return [
|
|
497
|
+
{
|
|
498
|
+
id: "zone-agent-strip",
|
|
499
|
+
streetId: s0.id,
|
|
500
|
+
streetLabel: s0.label,
|
|
501
|
+
rect: { minX: x0, maxX: x0Max, minY: columnMinY, maxY: columnMaxY },
|
|
502
|
+
primaryGroup: "agent",
|
|
503
|
+
allowedGroups: ["agent"]
|
|
504
|
+
},
|
|
505
|
+
{
|
|
506
|
+
id: "zone-space-strip",
|
|
507
|
+
streetId: s1.id,
|
|
508
|
+
streetLabel: s1.label,
|
|
509
|
+
rect: { minX: x1, maxX: x1Max, minY: columnMinY, maxY: columnMaxY },
|
|
510
|
+
primaryGroup: "space",
|
|
511
|
+
allowedGroups: ["space"]
|
|
512
|
+
},
|
|
513
|
+
{
|
|
514
|
+
id: "zone-arcade-strip",
|
|
515
|
+
streetId: s2.id,
|
|
516
|
+
streetLabel: s2.label,
|
|
517
|
+
rect: { minX: x2, maxX: x2Max, minY: columnMinY, maxY: columnMaxY },
|
|
518
|
+
primaryGroup: "arcade",
|
|
519
|
+
allowedGroups: ["arcade"]
|
|
520
|
+
}
|
|
521
|
+
];
|
|
522
|
+
}
|
|
523
|
+
function layoutHasParkingZone(layout) {
|
|
524
|
+
return layout.zones.some((z) => z.primaryGroup === "parking");
|
|
525
|
+
}
|
|
526
|
+
function streetsFromLayoutWithParking(layout) {
|
|
527
|
+
const agent = primaryZoneForGroup(layout, "agent");
|
|
528
|
+
const space = primaryZoneForGroup(layout, "space");
|
|
529
|
+
const arcade = primaryZoneForGroup(layout, "arcade");
|
|
530
|
+
const parking = primaryZoneForGroup(layout, "parking");
|
|
531
|
+
if (agent === void 0 || space === void 0 || arcade === void 0 || parking === void 0) {
|
|
532
|
+
throw new Error("streetsFromLayoutWithParking: missing primary zone");
|
|
533
|
+
}
|
|
534
|
+
return [
|
|
535
|
+
{ id: agent.streetId, label: agent.streetLabel },
|
|
536
|
+
{ id: space.streetId, label: space.streetLabel },
|
|
537
|
+
{ id: arcade.streetId, label: arcade.streetLabel },
|
|
538
|
+
{ id: parking.streetId, label: parking.streetLabel }
|
|
539
|
+
];
|
|
540
|
+
}
|
|
386
541
|
function streetsFromLayoutPrimaryGroups(layout) {
|
|
387
542
|
const picks = PRIMARY_GROUP_ORDER.map((g) => {
|
|
388
543
|
const zone = primaryZoneForGroup(layout, g);
|
|
@@ -403,6 +558,14 @@ function streetsFromLayoutPrimaryGroups(layout) {
|
|
|
403
558
|
}
|
|
404
559
|
function migrateWorldLayoutBounds(input) {
|
|
405
560
|
assertValidLayoutBounds(input.bounds);
|
|
561
|
+
if (layoutHasParkingZone(input.layout)) {
|
|
562
|
+
const streets2 = streetsFromLayoutWithParking(input.layout);
|
|
563
|
+
const reseeded2 = createWorldLayoutWithParkingRow({
|
|
564
|
+
bounds: input.bounds,
|
|
565
|
+
streets: streets2
|
|
566
|
+
});
|
|
567
|
+
return { ...reseeded2, rev: input.layout.rev + 1 };
|
|
568
|
+
}
|
|
406
569
|
const streets = streetsFromLayoutPrimaryGroups(input.layout);
|
|
407
570
|
const reseeded = createVerticalStripSeedLayout({
|
|
408
571
|
bounds: input.bounds,
|
|
@@ -410,6 +573,72 @@ function migrateWorldLayoutBounds(input) {
|
|
|
410
573
|
});
|
|
411
574
|
return { ...reseeded, rev: input.layout.rev + 1 };
|
|
412
575
|
}
|
|
576
|
+
function layoutNeedsParkingColumnGapMigration(layout) {
|
|
577
|
+
if (!layoutHasParkingZone(layout)) {
|
|
578
|
+
return false;
|
|
579
|
+
}
|
|
580
|
+
const agent = primaryZoneForGroup(layout, "agent");
|
|
581
|
+
const parking = primaryZoneForGroup(layout, "parking");
|
|
582
|
+
if (agent === void 0 || parking === void 0) {
|
|
583
|
+
return false;
|
|
584
|
+
}
|
|
585
|
+
const expectedParkingMinY = parkingZoneMinYFromColumnBase(agent.rect.minY);
|
|
586
|
+
return parking.rect.minY < expectedParkingMinY;
|
|
587
|
+
}
|
|
588
|
+
function migrateLayoutToParkingColumnGap(layout) {
|
|
589
|
+
const normalized = normalizeLegacyWorldLayout(layout);
|
|
590
|
+
if (!layoutNeedsParkingColumnGapMigration(normalized)) {
|
|
591
|
+
return normalized;
|
|
592
|
+
}
|
|
593
|
+
const streets = streetsFromLayoutWithParking(normalized);
|
|
594
|
+
const { minX, minY, maxX } = normalized.bounds;
|
|
595
|
+
const requiredMaxY = parkingZoneMaxYFromColumnBase(minY);
|
|
596
|
+
const nextBounds = {
|
|
597
|
+
minX,
|
|
598
|
+
minY,
|
|
599
|
+
maxX,
|
|
600
|
+
maxY: Math.max(normalized.bounds.maxY, requiredMaxY)
|
|
601
|
+
};
|
|
602
|
+
const reseeded = createWorldLayoutWithParkingRow({
|
|
603
|
+
bounds: nextBounds,
|
|
604
|
+
streets
|
|
605
|
+
});
|
|
606
|
+
return { ...reseeded, rev: normalized.rev + 1 };
|
|
607
|
+
}
|
|
608
|
+
function migrateLayoutToParkingRow(layout) {
|
|
609
|
+
const normalized = normalizeLegacyWorldLayout(layout);
|
|
610
|
+
if (layoutHasParkingZone(normalized)) {
|
|
611
|
+
return normalized;
|
|
612
|
+
}
|
|
613
|
+
const agent = primaryZoneForGroup(normalized, "agent");
|
|
614
|
+
const space = primaryZoneForGroup(normalized, "space");
|
|
615
|
+
const arcade = primaryZoneForGroup(normalized, "arcade");
|
|
616
|
+
if (agent === void 0 || space === void 0 || arcade === void 0) {
|
|
617
|
+
throw new Error("migrateLayoutToParkingRow: missing column zone");
|
|
618
|
+
}
|
|
619
|
+
const parkingStreet = nextStreetFromPool(
|
|
620
|
+
new Set(normalized.streets.map((s) => s.id))
|
|
621
|
+
);
|
|
622
|
+
if (parkingStreet === void 0) {
|
|
623
|
+
throw new Error("migrateLayoutToParkingRow: no street available in pool");
|
|
624
|
+
}
|
|
625
|
+
const nextBounds = {
|
|
626
|
+
...normalized.bounds,
|
|
627
|
+
maxY: Math.max(
|
|
628
|
+
normalized.bounds.maxY,
|
|
629
|
+
parkingZoneMaxYFromColumnBase(normalized.bounds.minY)
|
|
630
|
+
)
|
|
631
|
+
};
|
|
632
|
+
return createWorldLayoutWithParkingRow({
|
|
633
|
+
bounds: nextBounds,
|
|
634
|
+
streets: [
|
|
635
|
+
{ id: agent.streetId, label: agent.streetLabel },
|
|
636
|
+
{ id: space.streetId, label: space.streetLabel },
|
|
637
|
+
{ id: arcade.streetId, label: arcade.streetLabel },
|
|
638
|
+
parkingStreet
|
|
639
|
+
]
|
|
640
|
+
});
|
|
641
|
+
}
|
|
413
642
|
function applyBoundsFieldUpdateToLayout(input) {
|
|
414
643
|
assertIntegerBoundsValue(input.value, input.field);
|
|
415
644
|
const nextBounds = {
|
|
@@ -419,61 +648,19 @@ function applyBoundsFieldUpdateToLayout(input) {
|
|
|
419
648
|
return migrateWorldLayoutBounds({ layout: input.layout, bounds: nextBounds });
|
|
420
649
|
}
|
|
421
650
|
function createVerticalStripSeedLayout(input) {
|
|
422
|
-
const {
|
|
423
|
-
const
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
const w12 = Math.floor((spanX - w02) / 2);
|
|
430
|
-
const w22 = spanX - w02 - w12;
|
|
431
|
-
return [w02, w12, w22];
|
|
432
|
-
})();
|
|
433
|
-
const w0 = widths[0];
|
|
434
|
-
const w1 = widths[1];
|
|
435
|
-
const w2 = widths[2];
|
|
436
|
-
if (w0 === void 0 || w1 === void 0 || w2 === void 0) {
|
|
437
|
-
throw new Error("createVerticalStripSeedLayout: width partition failed");
|
|
438
|
-
}
|
|
439
|
-
const x0 = minX;
|
|
440
|
-
const x0Max = x0 + w0 - 1;
|
|
441
|
-
const x1 = x0Max + 1;
|
|
442
|
-
const x1Max = x1 + w1 - 1;
|
|
443
|
-
const x2 = x1Max + 1;
|
|
444
|
-
const x2Max = x2 + w2 - 1;
|
|
651
|
+
const { minY, maxY } = input.bounds;
|
|
652
|
+
const zones = buildColumnZones({
|
|
653
|
+
bounds: input.bounds,
|
|
654
|
+
columnMinY: minY,
|
|
655
|
+
columnMaxY: maxY,
|
|
656
|
+
streets: input.streets
|
|
657
|
+
});
|
|
445
658
|
const s0 = input.streets[0];
|
|
446
659
|
const s1 = input.streets[1];
|
|
447
660
|
const s2 = input.streets[2];
|
|
448
661
|
if (s0 === void 0 || s1 === void 0 || s2 === void 0) {
|
|
449
662
|
throw new Error("createVerticalStripSeedLayout: expected three streets");
|
|
450
663
|
}
|
|
451
|
-
const zones = [
|
|
452
|
-
{
|
|
453
|
-
id: "zone-agent-strip",
|
|
454
|
-
streetId: s0.id,
|
|
455
|
-
streetLabel: s0.label,
|
|
456
|
-
rect: { minX: x0, maxX: x0Max, minY, maxY },
|
|
457
|
-
primaryGroup: "agent",
|
|
458
|
-
allowedGroups: ["agent"]
|
|
459
|
-
},
|
|
460
|
-
{
|
|
461
|
-
id: "zone-space-strip",
|
|
462
|
-
streetId: s1.id,
|
|
463
|
-
streetLabel: s1.label,
|
|
464
|
-
rect: { minX: x1, maxX: x1Max, minY, maxY },
|
|
465
|
-
primaryGroup: "space",
|
|
466
|
-
allowedGroups: ["space"]
|
|
467
|
-
},
|
|
468
|
-
{
|
|
469
|
-
id: "zone-arcade-strip",
|
|
470
|
-
streetId: s2.id,
|
|
471
|
-
streetLabel: s2.label,
|
|
472
|
-
rect: { minX: x2, maxX: x2Max, minY, maxY },
|
|
473
|
-
primaryGroup: "arcade",
|
|
474
|
-
allowedGroups: ["arcade"]
|
|
475
|
-
}
|
|
476
|
-
];
|
|
477
664
|
const streets = [
|
|
478
665
|
streetFromPoolEntry(s0),
|
|
479
666
|
streetFromPoolEntry(s1),
|
|
@@ -486,6 +673,62 @@ function createVerticalStripSeedLayout(input) {
|
|
|
486
673
|
streets
|
|
487
674
|
};
|
|
488
675
|
}
|
|
676
|
+
function createWorldLayoutWithParkingRow(input) {
|
|
677
|
+
const { minX, maxX, minY, maxY } = input.bounds;
|
|
678
|
+
const spanX = maxX - minX + 1;
|
|
679
|
+
if (spanX < 3) {
|
|
680
|
+
throw new Error("createWorldLayoutWithParkingRow: bounds spanX too small");
|
|
681
|
+
}
|
|
682
|
+
const requiredSpanY = Math.ceil(
|
|
683
|
+
COLUMN_STREET_ROW_HEIGHT + PARKING_COLUMN_GAP_ROWS + PARKING_STREET_ROW_HEIGHT
|
|
684
|
+
);
|
|
685
|
+
const actualSpanY = maxY - minY + 1;
|
|
686
|
+
if (actualSpanY < requiredSpanY) {
|
|
687
|
+
throw new Error(
|
|
688
|
+
`createWorldLayoutWithParkingRow: spanY must be >= ${String(requiredSpanY)}`
|
|
689
|
+
);
|
|
690
|
+
}
|
|
691
|
+
const columnMinY = minY;
|
|
692
|
+
const columnMaxY = minY + COLUMN_STREET_ROW_HEIGHT - 1;
|
|
693
|
+
const parkingMinY = parkingZoneMinYFromColumnBase(columnMinY);
|
|
694
|
+
const parkingMaxY = parkingMinY + PARKING_STREET_ROW_HEIGHT - 1;
|
|
695
|
+
if (parkingMaxY > maxY) {
|
|
696
|
+
throw new Error("createWorldLayoutWithParkingRow: parking band exceeds bounds");
|
|
697
|
+
}
|
|
698
|
+
const s0 = input.streets[0];
|
|
699
|
+
const s1 = input.streets[1];
|
|
700
|
+
const s2 = input.streets[2];
|
|
701
|
+
const s3 = input.streets[3];
|
|
702
|
+
if (s0 === void 0 || s1 === void 0 || s2 === void 0 || s3 === void 0) {
|
|
703
|
+
throw new Error("createWorldLayoutWithParkingRow: expected four streets");
|
|
704
|
+
}
|
|
705
|
+
const columnZones = buildColumnZones({
|
|
706
|
+
bounds: input.bounds,
|
|
707
|
+
columnMinY,
|
|
708
|
+
columnMaxY,
|
|
709
|
+
streets: [s0, s1, s2]
|
|
710
|
+
});
|
|
711
|
+
const parkingZone = {
|
|
712
|
+
id: "zone-parking-strip",
|
|
713
|
+
streetId: s3.id,
|
|
714
|
+
streetLabel: s3.label,
|
|
715
|
+
rect: { minX, maxX, minY: parkingMinY, maxY: parkingMaxY },
|
|
716
|
+
primaryGroup: "parking",
|
|
717
|
+
allowedGroups: ["parking"]
|
|
718
|
+
};
|
|
719
|
+
const streets = [
|
|
720
|
+
streetFromPoolEntry(s0),
|
|
721
|
+
streetFromPoolEntry(s1),
|
|
722
|
+
streetFromPoolEntry(s2),
|
|
723
|
+
streetFromPoolEntry(s3)
|
|
724
|
+
];
|
|
725
|
+
return {
|
|
726
|
+
rev: 1,
|
|
727
|
+
bounds: input.bounds,
|
|
728
|
+
zones: [...columnZones, parkingZone],
|
|
729
|
+
streets
|
|
730
|
+
};
|
|
731
|
+
}
|
|
489
732
|
|
|
490
733
|
// ../../node_modules/zod/v3/external.js
|
|
491
734
|
var external_exports = {};
|
|
@@ -4621,6 +4864,8 @@ var PurchaseRecordSchema = external_exports.object({
|
|
|
4621
4864
|
"shop",
|
|
4622
4865
|
"supermarket",
|
|
4623
4866
|
"car_wash",
|
|
4867
|
+
"parking",
|
|
4868
|
+
"house",
|
|
4624
4869
|
"talk_time",
|
|
4625
4870
|
"wallet_bundle",
|
|
4626
4871
|
"apu_credit",
|
|
@@ -4631,6 +4876,8 @@ var PurchaseRecordSchema = external_exports.object({
|
|
|
4631
4876
|
"shop",
|
|
4632
4877
|
"supermarket",
|
|
4633
4878
|
"carwash",
|
|
4879
|
+
"parking",
|
|
4880
|
+
"house",
|
|
4634
4881
|
"game",
|
|
4635
4882
|
"apu",
|
|
4636
4883
|
"talk",
|
|
@@ -4661,6 +4908,409 @@ function desaturateColor(hex) {
|
|
|
4661
4908
|
return y << 16 | y << 8 | y;
|
|
4662
4909
|
}
|
|
4663
4910
|
|
|
4911
|
+
// src/lib/parking-pricing.ts
|
|
4912
|
+
var PARKING_DURATION_TIERS = [
|
|
4913
|
+
"1h",
|
|
4914
|
+
"12h",
|
|
4915
|
+
"1d",
|
|
4916
|
+
"3d",
|
|
4917
|
+
"7d",
|
|
4918
|
+
"1mo",
|
|
4919
|
+
"3mo",
|
|
4920
|
+
"1y",
|
|
4921
|
+
"forever"
|
|
4922
|
+
];
|
|
4923
|
+
var HOURS_PER_TIER = {
|
|
4924
|
+
"1h": 1,
|
|
4925
|
+
"12h": 12,
|
|
4926
|
+
"1d": 24,
|
|
4927
|
+
"3d": 72,
|
|
4928
|
+
"7d": 168,
|
|
4929
|
+
"1mo": 24 * 30,
|
|
4930
|
+
"3mo": 24 * 90,
|
|
4931
|
+
"1y": 24 * 365,
|
|
4932
|
+
forever: null
|
|
4933
|
+
};
|
|
4934
|
+
var DEFAULT_PARKING_RATES_USD = {
|
|
4935
|
+
"1h": 0.75,
|
|
4936
|
+
"12h": 3.5,
|
|
4937
|
+
"1d": 5,
|
|
4938
|
+
"3d": 12,
|
|
4939
|
+
"7d": 22,
|
|
4940
|
+
"1mo": 65,
|
|
4941
|
+
"3mo": 165,
|
|
4942
|
+
"1y": 480,
|
|
4943
|
+
forever: 750
|
|
4944
|
+
};
|
|
4945
|
+
var effectiveHourlyRateUsd = (tier) => {
|
|
4946
|
+
const hours = HOURS_PER_TIER[tier];
|
|
4947
|
+
if (hours === null) {
|
|
4948
|
+
return DEFAULT_PARKING_RATES_USD.forever;
|
|
4949
|
+
}
|
|
4950
|
+
return DEFAULT_PARKING_RATES_USD[tier] / hours;
|
|
4951
|
+
};
|
|
4952
|
+
var computeParkingExpiresAt = (input) => {
|
|
4953
|
+
if (input.tier === "forever") {
|
|
4954
|
+
return null;
|
|
4955
|
+
}
|
|
4956
|
+
const hours = HOURS_PER_TIER[input.tier];
|
|
4957
|
+
if (hours === null) {
|
|
4958
|
+
return null;
|
|
4959
|
+
}
|
|
4960
|
+
const purchasedAt = new Date(input.purchasedAtIso);
|
|
4961
|
+
if (Number.isNaN(purchasedAt.getTime())) {
|
|
4962
|
+
throw new Error("computeParkingExpiresAt: invalid purchasedAtIso");
|
|
4963
|
+
}
|
|
4964
|
+
return new Date(purchasedAt.getTime() + hours * 60 * 60 * 1e3).toISOString();
|
|
4965
|
+
};
|
|
4966
|
+
var isParkingOccupantActive = (input) => {
|
|
4967
|
+
if (input.expiresAt === null) {
|
|
4968
|
+
return true;
|
|
4969
|
+
}
|
|
4970
|
+
const expires = new Date(input.expiresAt).getTime();
|
|
4971
|
+
const now = new Date(input.nowIso).getTime();
|
|
4972
|
+
if (Number.isNaN(expires) || Number.isNaN(now)) {
|
|
4973
|
+
return false;
|
|
4974
|
+
}
|
|
4975
|
+
return expires > now;
|
|
4976
|
+
};
|
|
4977
|
+
|
|
4978
|
+
// src/lib/parking-content-model.ts
|
|
4979
|
+
var NonEmpty2 = external_exports.string().trim().min(1);
|
|
4980
|
+
var IsoTimestamp2 = external_exports.string().trim().min(1);
|
|
4981
|
+
var PositivePrice2 = external_exports.number().finite().positive();
|
|
4982
|
+
var HexColor2 = external_exports.string().trim().regex(/^#[0-9a-fA-F]{6}$/, "expected #rrggbb hex color");
|
|
4983
|
+
var ParkingDurationTierSchema = external_exports.enum([
|
|
4984
|
+
"1h",
|
|
4985
|
+
"12h",
|
|
4986
|
+
"1d",
|
|
4987
|
+
"3d",
|
|
4988
|
+
"7d",
|
|
4989
|
+
"1mo",
|
|
4990
|
+
"3mo",
|
|
4991
|
+
"1y",
|
|
4992
|
+
"forever"
|
|
4993
|
+
]);
|
|
4994
|
+
var ParkingBaySchema = external_exports.union([
|
|
4995
|
+
external_exports.literal(1),
|
|
4996
|
+
external_exports.literal(2),
|
|
4997
|
+
external_exports.literal(3),
|
|
4998
|
+
external_exports.literal(4)
|
|
4999
|
+
]);
|
|
5000
|
+
var ParkingLayerSchema = external_exports.union([external_exports.literal(1), external_exports.literal(2)]);
|
|
5001
|
+
var ParkingOccupantSchema = external_exports.object({
|
|
5002
|
+
nodeId: NonEmpty2,
|
|
5003
|
+
carPurchaseId: NonEmpty2,
|
|
5004
|
+
displayNick: external_exports.string().trim().min(1).max(24),
|
|
5005
|
+
colorHex: HexColor2,
|
|
5006
|
+
model: NonEmpty2,
|
|
5007
|
+
tier: ParkingDurationTierSchema,
|
|
5008
|
+
purchasedAt: IsoTimestamp2,
|
|
5009
|
+
expiresAt: IsoTimestamp2.nullable()
|
|
5010
|
+
});
|
|
5011
|
+
var ParkingSpotSchema = external_exports.object({
|
|
5012
|
+
id: NonEmpty2,
|
|
5013
|
+
bay: ParkingBaySchema,
|
|
5014
|
+
layer: ParkingLayerSchema,
|
|
5015
|
+
occupant: ParkingOccupantSchema.nullable()
|
|
5016
|
+
});
|
|
5017
|
+
var ParkingStreetContentSchema = external_exports.object({
|
|
5018
|
+
spots: external_exports.array(ParkingSpotSchema).length(8),
|
|
5019
|
+
rates: external_exports.record(ParkingDurationTierSchema, PositivePrice2)
|
|
5020
|
+
});
|
|
5021
|
+
var PARKING_BAY_COUNT = 4;
|
|
5022
|
+
var PARKING_LAYERS_PER_BAY = 2;
|
|
5023
|
+
var PARKING_SPOT_COUNT = PARKING_BAY_COUNT * PARKING_LAYERS_PER_BAY;
|
|
5024
|
+
var spotIdFor = (bay, layer) => `parking-bay-${String(bay)}-layer-${String(layer)}`;
|
|
5025
|
+
var createEmptyParkingStreetContent = () => {
|
|
5026
|
+
const spots = [];
|
|
5027
|
+
for (let bay = 1; bay <= PARKING_BAY_COUNT; bay += 1) {
|
|
5028
|
+
for (let layer = 1; layer <= PARKING_LAYERS_PER_BAY; layer += 1) {
|
|
5029
|
+
spots.push({
|
|
5030
|
+
id: spotIdFor(bay, layer),
|
|
5031
|
+
bay,
|
|
5032
|
+
layer,
|
|
5033
|
+
occupant: null
|
|
5034
|
+
});
|
|
5035
|
+
}
|
|
5036
|
+
}
|
|
5037
|
+
return ParkingStreetContentSchema.parse({
|
|
5038
|
+
spots,
|
|
5039
|
+
rates: { ...DEFAULT_PARKING_RATES_USD }
|
|
5040
|
+
});
|
|
5041
|
+
};
|
|
5042
|
+
var listActiveParkingOccupancies = (content, nowIso) => {
|
|
5043
|
+
const active = [];
|
|
5044
|
+
for (const spot of content.spots) {
|
|
5045
|
+
const occupant = spot.occupant;
|
|
5046
|
+
if (occupant === null) {
|
|
5047
|
+
continue;
|
|
5048
|
+
}
|
|
5049
|
+
if (occupant.expiresAt !== null && new Date(occupant.expiresAt).getTime() <= new Date(nowIso).getTime()) {
|
|
5050
|
+
continue;
|
|
5051
|
+
}
|
|
5052
|
+
active.push({
|
|
5053
|
+
nodeId: occupant.nodeId,
|
|
5054
|
+
tier: occupant.tier,
|
|
5055
|
+
expiresAt: occupant.expiresAt
|
|
5056
|
+
});
|
|
5057
|
+
}
|
|
5058
|
+
return active;
|
|
5059
|
+
};
|
|
5060
|
+
var findParkingSpot = (content, bay, layer) => content.spots.find((s) => s.bay === bay && s.layer === layer);
|
|
5061
|
+
|
|
5062
|
+
// src/lib/house-content-model.ts
|
|
5063
|
+
var NonEmpty3 = external_exports.string().trim().min(1);
|
|
5064
|
+
var IsoTimestamp3 = external_exports.string().trim().min(1);
|
|
5065
|
+
var PositivePrice3 = external_exports.number().finite().positive();
|
|
5066
|
+
var OwnerName = external_exports.string().trim().min(1).max(40);
|
|
5067
|
+
var OwnerSignature = external_exports.string().trim().min(1).max(8);
|
|
5068
|
+
var OwnerDisplayName = external_exports.string().trim().min(1).max(24);
|
|
5069
|
+
var HOUSE_WORLD_X = [3, 8, 13, 18];
|
|
5070
|
+
var HouseIdSchema = external_exports.union([
|
|
5071
|
+
external_exports.literal(1),
|
|
5072
|
+
external_exports.literal(2),
|
|
5073
|
+
external_exports.literal(3),
|
|
5074
|
+
external_exports.literal(4)
|
|
5075
|
+
]);
|
|
5076
|
+
var ParkingHouseBaySchema = external_exports.union([
|
|
5077
|
+
external_exports.literal(1),
|
|
5078
|
+
external_exports.literal(2),
|
|
5079
|
+
external_exports.literal(3),
|
|
5080
|
+
external_exports.literal(4)
|
|
5081
|
+
]);
|
|
5082
|
+
var HOUSE_CATALOG = [
|
|
5083
|
+
{ houseId: 1, bay: 1, priceUsd: 1299.99, layoutLabel: "Studio layout" },
|
|
5084
|
+
{ houseId: 2, bay: 2, priceUsd: 2199.99, layoutLabel: "Split room" },
|
|
5085
|
+
{ houseId: 3, bay: 3, priceUsd: 3499.99, layoutLabel: "L-shaped" },
|
|
5086
|
+
{ houseId: 4, bay: 4, priceUsd: 5999.99, layoutLabel: "Loft" }
|
|
5087
|
+
];
|
|
5088
|
+
var HouseSlotSchema = external_exports.object({
|
|
5089
|
+
id: NonEmpty3,
|
|
5090
|
+
houseId: HouseIdSchema,
|
|
5091
|
+
bay: ParkingHouseBaySchema,
|
|
5092
|
+
worldX: external_exports.number().finite(),
|
|
5093
|
+
priceUsd: PositivePrice3,
|
|
5094
|
+
layoutId: HouseIdSchema,
|
|
5095
|
+
layoutLabel: NonEmpty3,
|
|
5096
|
+
ownerNodeId: NonEmpty3.nullable(),
|
|
5097
|
+
ownerDisplayName: OwnerDisplayName.nullable(),
|
|
5098
|
+
ownerName: OwnerName.nullable(),
|
|
5099
|
+
ownerSignature: OwnerSignature.nullable(),
|
|
5100
|
+
purchasedAt: IsoTimestamp3.nullable()
|
|
5101
|
+
});
|
|
5102
|
+
var HouseStreetContentSchema = external_exports.object({
|
|
5103
|
+
houses: external_exports.array(HouseSlotSchema).length(4)
|
|
5104
|
+
});
|
|
5105
|
+
var PARKING_HOUSE_COUNT = 4;
|
|
5106
|
+
var houseIdFor = (houseId) => `house-${String(houseId)}`;
|
|
5107
|
+
var createEmptyHouseStreetContent = () => {
|
|
5108
|
+
const houses = HOUSE_CATALOG.map((entry, index) => {
|
|
5109
|
+
const worldX = HOUSE_WORLD_X[index];
|
|
5110
|
+
if (worldX === void 0) {
|
|
5111
|
+
throw new Error("HOUSE_WORLD_X index mismatch");
|
|
5112
|
+
}
|
|
5113
|
+
return {
|
|
5114
|
+
id: houseIdFor(entry.houseId),
|
|
5115
|
+
houseId: entry.houseId,
|
|
5116
|
+
bay: entry.bay,
|
|
5117
|
+
worldX,
|
|
5118
|
+
priceUsd: entry.priceUsd,
|
|
5119
|
+
layoutId: entry.houseId,
|
|
5120
|
+
layoutLabel: entry.layoutLabel,
|
|
5121
|
+
ownerNodeId: null,
|
|
5122
|
+
ownerDisplayName: null,
|
|
5123
|
+
ownerName: null,
|
|
5124
|
+
ownerSignature: null,
|
|
5125
|
+
purchasedAt: null
|
|
5126
|
+
};
|
|
5127
|
+
});
|
|
5128
|
+
return HouseStreetContentSchema.parse({ houses });
|
|
5129
|
+
};
|
|
5130
|
+
var findHouseSlot = (content, houseId) => content.houses.find((h) => h.houseId === houseId);
|
|
5131
|
+
var isHouseOwned = (house) => house.ownerNodeId !== null;
|
|
5132
|
+
var housePurchaseDetail = (house) => `House ${String(house.houseId)} \xB7 ${house.layoutLabel}`;
|
|
5133
|
+
var formatHouseOwnerDisplayName = (input) => {
|
|
5134
|
+
const name = input.name.trim();
|
|
5135
|
+
const signature = input.signature.trim().toUpperCase();
|
|
5136
|
+
const divider = " \xB7 ";
|
|
5137
|
+
const combined = `${name}${divider}${signature}`;
|
|
5138
|
+
if (combined.length <= 24) {
|
|
5139
|
+
return combined;
|
|
5140
|
+
}
|
|
5141
|
+
const suffix = `${divider}${signature}`;
|
|
5142
|
+
const maxNameLen = 24 - suffix.length;
|
|
5143
|
+
if (maxNameLen < 1) {
|
|
5144
|
+
return signature.slice(0, 24);
|
|
5145
|
+
}
|
|
5146
|
+
return `${name.slice(0, maxNameLen)}${suffix}`;
|
|
5147
|
+
};
|
|
5148
|
+
var buildHouseOwnershipPanelLines = (house) => {
|
|
5149
|
+
if (!isHouseOwned(house)) {
|
|
5150
|
+
return [];
|
|
5151
|
+
}
|
|
5152
|
+
const ownerName = house.ownerName ?? house.ownerDisplayName ?? "Owner";
|
|
5153
|
+
const ownerSignature = house.ownerSignature ?? "\u2014";
|
|
5154
|
+
const purchasedAt = house.purchasedAt !== null ? new Date(house.purchasedAt).toLocaleDateString(void 0, {
|
|
5155
|
+
dateStyle: "medium"
|
|
5156
|
+
}) : "\u2014";
|
|
5157
|
+
return [
|
|
5158
|
+
"PROPERTY RECORD",
|
|
5159
|
+
`Owner: ${ownerName}`,
|
|
5160
|
+
`Signature: ${ownerSignature}`,
|
|
5161
|
+
`Purchased: ${purchasedAt}`,
|
|
5162
|
+
"Security: Node-verified title",
|
|
5163
|
+
"Private residence \xB7 authorized entry only"
|
|
5164
|
+
];
|
|
5165
|
+
};
|
|
5166
|
+
|
|
5167
|
+
// src/lib/house-layout-model.ts
|
|
5168
|
+
var BASE_BOUNDS = {
|
|
5169
|
+
minX: 0,
|
|
5170
|
+
minY: 0,
|
|
5171
|
+
maxX: 10,
|
|
5172
|
+
maxY: 7
|
|
5173
|
+
};
|
|
5174
|
+
var HOUSE_BLUEPRINTS = [
|
|
5175
|
+
{
|
|
5176
|
+
houseId: 1,
|
|
5177
|
+
label: "Studio layout",
|
|
5178
|
+
bounds: BASE_BOUNDS,
|
|
5179
|
+
floor: { color: 12887412, pattern: "planks" },
|
|
5180
|
+
exteriorPalette: {
|
|
5181
|
+
wall: 16115400,
|
|
5182
|
+
roof: 12986408,
|
|
5183
|
+
door: 5125166,
|
|
5184
|
+
window: 9489145,
|
|
5185
|
+
trim: 16777215
|
|
5186
|
+
},
|
|
5187
|
+
fixtures: [
|
|
5188
|
+
{ kind: "bed", variant: "single-left", x: 2, y: 1.2 },
|
|
5189
|
+
{ kind: "wardrobe", variant: "single", x: 8.5, y: 1.5 },
|
|
5190
|
+
{ kind: "mirror", variant: "wall", x: 5, y: 0.4 },
|
|
5191
|
+
{ kind: "window", variant: "double", x: 1.5, y: 0.3 },
|
|
5192
|
+
{ kind: "window", variant: "single", x: 8, y: 0.3 }
|
|
5193
|
+
],
|
|
5194
|
+
spawn: { x: 5, y: 5.5 }
|
|
5195
|
+
},
|
|
5196
|
+
{
|
|
5197
|
+
houseId: 2,
|
|
5198
|
+
label: "Split room",
|
|
5199
|
+
bounds: BASE_BOUNDS,
|
|
5200
|
+
floor: { color: 11583173, pattern: "tiles" },
|
|
5201
|
+
exteriorPalette: {
|
|
5202
|
+
wall: 15527921,
|
|
5203
|
+
roof: 3622735,
|
|
5204
|
+
door: 2503224,
|
|
5205
|
+
window: 16774557,
|
|
5206
|
+
trim: 7901340
|
|
5207
|
+
},
|
|
5208
|
+
fixtures: [
|
|
5209
|
+
{ kind: "bed", variant: "single-right", x: 8, y: 5 },
|
|
5210
|
+
{ kind: "wardrobe", variant: "double", x: 1.5, y: 1.5 },
|
|
5211
|
+
{ kind: "mirror", variant: "standing", x: 9, y: 2.5 },
|
|
5212
|
+
{ kind: "window", variant: "single", x: 3, y: 0.3 },
|
|
5213
|
+
{ kind: "window", variant: "single", x: 7, y: 0.3 }
|
|
5214
|
+
],
|
|
5215
|
+
spawn: { x: 5, y: 3 }
|
|
5216
|
+
},
|
|
5217
|
+
{
|
|
5218
|
+
houseId: 3,
|
|
5219
|
+
label: "L-shaped",
|
|
5220
|
+
bounds: BASE_BOUNDS,
|
|
5221
|
+
floor: { color: 14142664, pattern: "carpet" },
|
|
5222
|
+
exteriorPalette: {
|
|
5223
|
+
wall: 15984117,
|
|
5224
|
+
roof: 6953882,
|
|
5225
|
+
door: 4854924,
|
|
5226
|
+
window: 14794471,
|
|
5227
|
+
trim: 13538264
|
|
5228
|
+
},
|
|
5229
|
+
fixtures: [
|
|
5230
|
+
{ kind: "bed", variant: "single-left", x: 1.5, y: 5.5 },
|
|
5231
|
+
{ kind: "wardrobe", variant: "single", x: 8.5, y: 5 },
|
|
5232
|
+
{ kind: "mirror", variant: "wall", x: 5, y: 0.4 },
|
|
5233
|
+
{ kind: "window", variant: "tall", x: 9, y: 0.3 },
|
|
5234
|
+
{ kind: "window", variant: "double", x: 2, y: 0.3 }
|
|
5235
|
+
],
|
|
5236
|
+
spawn: { x: 5.5, y: 2.5 }
|
|
5237
|
+
},
|
|
5238
|
+
{
|
|
5239
|
+
houseId: 4,
|
|
5240
|
+
label: "Loft",
|
|
5241
|
+
bounds: BASE_BOUNDS,
|
|
5242
|
+
floor: { color: 6111287, pattern: "planks" },
|
|
5243
|
+
exteriorPalette: {
|
|
5244
|
+
wall: 9268835,
|
|
5245
|
+
roof: 4073251,
|
|
5246
|
+
door: 2171169,
|
|
5247
|
+
window: 16772275,
|
|
5248
|
+
trim: 6111287
|
|
5249
|
+
},
|
|
5250
|
+
fixtures: [
|
|
5251
|
+
{ kind: "bed", variant: "bunk", x: 7.5, y: 1 },
|
|
5252
|
+
{ kind: "wardrobe", variant: "double", x: 2, y: 4.5 },
|
|
5253
|
+
{ kind: "mirror", variant: "standing", x: 5, y: 4 },
|
|
5254
|
+
{ kind: "window", variant: "tall", x: 1, y: 0.3 },
|
|
5255
|
+
{ kind: "window", variant: "single", x: 6, y: 0.3 }
|
|
5256
|
+
],
|
|
5257
|
+
spawn: { x: 4, y: 6 }
|
|
5258
|
+
}
|
|
5259
|
+
];
|
|
5260
|
+
var getHouseBlueprint = (houseId) => {
|
|
5261
|
+
const blueprint = HOUSE_BLUEPRINTS.find((b) => b.houseId === houseId);
|
|
5262
|
+
if (blueprint === void 0) {
|
|
5263
|
+
throw new Error(`getHouseBlueprint: unknown houseId ${String(houseId)}`);
|
|
5264
|
+
}
|
|
5265
|
+
return blueprint;
|
|
5266
|
+
};
|
|
5267
|
+
var layoutHouseFixtures = (blueprint) => blueprint.fixtures.map((fixture) => {
|
|
5268
|
+
const slot = {
|
|
5269
|
+
kind: fixture.kind,
|
|
5270
|
+
variant: fixture.variant,
|
|
5271
|
+
x: fixture.x,
|
|
5272
|
+
y: fixture.y
|
|
5273
|
+
};
|
|
5274
|
+
if (fixture.rotation !== void 0) {
|
|
5275
|
+
return { ...slot, rotation: fixture.rotation };
|
|
5276
|
+
}
|
|
5277
|
+
return slot;
|
|
5278
|
+
});
|
|
5279
|
+
var houseSpawnPosition = (blueprint) => ({
|
|
5280
|
+
x: blueprint.spawn.x,
|
|
5281
|
+
y: blueprint.spawn.y
|
|
5282
|
+
});
|
|
5283
|
+
var clampHousePosition = (blueprint, pos) => {
|
|
5284
|
+
const { minX, minY, maxX, maxY } = blueprint.bounds;
|
|
5285
|
+
return {
|
|
5286
|
+
x: Math.min(maxX, Math.max(minX, pos.x)),
|
|
5287
|
+
y: Math.min(maxY, Math.max(minY, pos.y))
|
|
5288
|
+
};
|
|
5289
|
+
};
|
|
5290
|
+
|
|
5291
|
+
// src/lib/parking-ownership.ts
|
|
5292
|
+
var MAX_TIMED_PARKING_SLOTS_PER_NODE = 2;
|
|
5293
|
+
var MAX_SLOTS_WITH_FOREVER = 1;
|
|
5294
|
+
var canNodeAcquireParkingSpot = (input) => {
|
|
5295
|
+
const mine = input.active.filter((o) => o.nodeId === input.nodeId);
|
|
5296
|
+
const hasForever = mine.some(
|
|
5297
|
+
(o) => o.tier === "forever" || o.expiresAt === null
|
|
5298
|
+
);
|
|
5299
|
+
if (input.tier === "forever") {
|
|
5300
|
+
if (mine.length > 0) {
|
|
5301
|
+
return { ok: false, error: "PARKING_FOREVER_LIMIT" };
|
|
5302
|
+
}
|
|
5303
|
+
return { ok: true };
|
|
5304
|
+
}
|
|
5305
|
+
if (hasForever) {
|
|
5306
|
+
return { ok: false, error: "PARKING_FOREVER_LIMIT" };
|
|
5307
|
+
}
|
|
5308
|
+
if (mine.length >= MAX_TIMED_PARKING_SLOTS_PER_NODE) {
|
|
5309
|
+
return { ok: false, error: "PARKING_OWNERSHIP_LIMIT" };
|
|
5310
|
+
}
|
|
5311
|
+
return { ok: true };
|
|
5312
|
+
};
|
|
5313
|
+
|
|
4664
5314
|
// src/lib/wallet-apu-transaction.ts
|
|
4665
5315
|
var APU_TOKEN = "APU";
|
|
4666
5316
|
var buildApuWalletTransaction = (input) => {
|
|
@@ -4904,8 +5554,8 @@ var createEmptyGameStats = (date) => {
|
|
|
4904
5554
|
};
|
|
4905
5555
|
|
|
4906
5556
|
// src/lib/scanner-model.ts
|
|
4907
|
-
var
|
|
4908
|
-
var
|
|
5557
|
+
var NonEmpty4 = external_exports.string().trim().min(1);
|
|
5558
|
+
var IsoTimestamp4 = external_exports.string().trim().min(1);
|
|
4909
5559
|
var ScannerTxOpSchema = external_exports.enum([
|
|
4910
5560
|
"purchase",
|
|
4911
5561
|
"redeemWalletBundle",
|
|
@@ -4916,8 +5566,8 @@ var ScannerTxOpSchema = external_exports.enum([
|
|
|
4916
5566
|
"walletSeeded"
|
|
4917
5567
|
]);
|
|
4918
5568
|
var ScannerTxRecordSchema = PurchaseRecordSchema.extend({
|
|
4919
|
-
hostId:
|
|
4920
|
-
indexedAt:
|
|
5569
|
+
hostId: NonEmpty4,
|
|
5570
|
+
indexedAt: IsoTimestamp4,
|
|
4921
5571
|
op: ScannerTxOpSchema,
|
|
4922
5572
|
blockRev: external_exports.number().int().nonnegative().optional(),
|
|
4923
5573
|
merkleRootHex: external_exports.string().optional()
|
|
@@ -4926,7 +5576,7 @@ var ScannerBlockRecordSchema = external_exports.object({
|
|
|
4926
5576
|
rev: external_exports.number().int().nonnegative(),
|
|
4927
5577
|
merkleRootHex: external_exports.string(),
|
|
4928
5578
|
merkleLeafCount: external_exports.number().int().nonnegative(),
|
|
4929
|
-
at:
|
|
5579
|
+
at: IsoTimestamp4,
|
|
4930
5580
|
occupantCount: external_exports.number().int().nonnegative().optional(),
|
|
4931
5581
|
leafDeltaCount: external_exports.number().int().nonnegative().optional(),
|
|
4932
5582
|
label: external_exports.string().optional()
|
|
@@ -4941,19 +5591,19 @@ var ScannerMigrationStateSchema = external_exports.object({
|
|
|
4941
5591
|
status: ScannerMigrationStatusSchema,
|
|
4942
5592
|
cursor: external_exports.string(),
|
|
4943
5593
|
totalIndexed: external_exports.number().int().nonnegative(),
|
|
4944
|
-
startedAt:
|
|
4945
|
-
completedAt:
|
|
5594
|
+
startedAt: IsoTimestamp4,
|
|
5595
|
+
completedAt: IsoTimestamp4.optional(),
|
|
4946
5596
|
error: external_exports.string().optional()
|
|
4947
5597
|
});
|
|
4948
5598
|
var ScannerWalletSnapshotSchema = external_exports.object({
|
|
4949
|
-
playerId:
|
|
5599
|
+
playerId: NonEmpty4,
|
|
4950
5600
|
balanceUsd: external_exports.number().finite().nonnegative(),
|
|
4951
5601
|
powerUps: external_exports.number().int().nonnegative(),
|
|
4952
|
-
updatedAt:
|
|
5602
|
+
updatedAt: IsoTimestamp4
|
|
4953
5603
|
});
|
|
4954
5604
|
var ScannerHeadSchema = external_exports.object({
|
|
4955
|
-
generatedAt:
|
|
4956
|
-
hostId:
|
|
5605
|
+
generatedAt: IsoTimestamp4,
|
|
5606
|
+
hostId: NonEmpty4,
|
|
4957
5607
|
snapshotRev: external_exports.number().int().nonnegative(),
|
|
4958
5608
|
merkleRootHex: external_exports.string().nullable(),
|
|
4959
5609
|
merkleLeafCount: external_exports.number().int().nonnegative().nullable(),
|
|
@@ -4968,14 +5618,14 @@ var ScannerNodeWalletSchema = external_exports.object({
|
|
|
4968
5618
|
balanceUsd: external_exports.number().finite().nonnegative(),
|
|
4969
5619
|
powerUps: external_exports.number().int().nonnegative(),
|
|
4970
5620
|
currency: external_exports.literal("USD"),
|
|
4971
|
-
updatedAt:
|
|
5621
|
+
updatedAt: IsoTimestamp4
|
|
4972
5622
|
});
|
|
4973
5623
|
var ScannerNodeLedgerKpisSchema = external_exports.object({
|
|
4974
5624
|
txCount: external_exports.number().int().nonnegative(),
|
|
4975
5625
|
usdSpent: external_exports.number().finite().nonnegative(),
|
|
4976
5626
|
apuMinted: external_exports.number().int().nonnegative(),
|
|
4977
5627
|
apuBurned: external_exports.number().int().nonnegative(),
|
|
4978
|
-
lastTxAt:
|
|
5628
|
+
lastTxAt: IsoTimestamp4.nullable()
|
|
4979
5629
|
});
|
|
4980
5630
|
var ScannerNodeBreakdownSchema = external_exports.object({
|
|
4981
5631
|
byAmenityKind: external_exports.record(external_exports.string(), external_exports.number().int().nonnegative()),
|
|
@@ -4989,15 +5639,15 @@ var ScannerNodeAnalyticsKpisSchema = external_exports.object({
|
|
|
4989
5639
|
eventsLast24h: external_exports.number().int().nonnegative(),
|
|
4990
5640
|
topEvents: external_exports.array(
|
|
4991
5641
|
external_exports.object({
|
|
4992
|
-
event:
|
|
5642
|
+
event: NonEmpty4,
|
|
4993
5643
|
count: external_exports.number().int().nonnegative()
|
|
4994
5644
|
})
|
|
4995
5645
|
)
|
|
4996
5646
|
});
|
|
4997
5647
|
var ScannerNodeProfileSchema = external_exports.object({
|
|
4998
|
-
nodeId:
|
|
5648
|
+
nodeId: NonEmpty4,
|
|
4999
5649
|
kind: ScannerNodeKindSchema,
|
|
5000
|
-
generatedAt:
|
|
5650
|
+
generatedAt: IsoTimestamp4,
|
|
5001
5651
|
wallet: ScannerNodeWalletSchema.nullable(),
|
|
5002
5652
|
ledger: ScannerNodeLedgerKpisSchema,
|
|
5003
5653
|
breakdown: ScannerNodeBreakdownSchema,
|
|
@@ -5021,10 +5671,10 @@ var ScannerNodeProfileSchema = external_exports.object({
|
|
|
5021
5671
|
}).nullable(),
|
|
5022
5672
|
analyticsEvents: external_exports.array(
|
|
5023
5673
|
external_exports.object({
|
|
5024
|
-
messageId:
|
|
5025
|
-
event:
|
|
5026
|
-
distinctId:
|
|
5027
|
-
timestamp:
|
|
5674
|
+
messageId: NonEmpty4,
|
|
5675
|
+
event: NonEmpty4,
|
|
5676
|
+
distinctId: NonEmpty4,
|
|
5677
|
+
timestamp: IsoTimestamp4,
|
|
5028
5678
|
properties: external_exports.record(
|
|
5029
5679
|
external_exports.union([external_exports.string(), external_exports.number(), external_exports.boolean(), external_exports.null()])
|
|
5030
5680
|
)
|
|
@@ -5038,8 +5688,8 @@ var ScannerNodeProfileSchema = external_exports.object({
|
|
|
5038
5688
|
});
|
|
5039
5689
|
|
|
5040
5690
|
// src/lib/analytics-event-model.ts
|
|
5041
|
-
var
|
|
5042
|
-
var
|
|
5691
|
+
var NonEmpty5 = external_exports.string().trim().min(1);
|
|
5692
|
+
var IsoTimestamp5 = external_exports.string().trim().min(1);
|
|
5043
5693
|
var AnalyticsPropertyValueSchema = external_exports.union([
|
|
5044
5694
|
external_exports.string(),
|
|
5045
5695
|
external_exports.number(),
|
|
@@ -5047,23 +5697,23 @@ var AnalyticsPropertyValueSchema = external_exports.union([
|
|
|
5047
5697
|
external_exports.null()
|
|
5048
5698
|
]);
|
|
5049
5699
|
var AnalyticsContextSchema = external_exports.object({
|
|
5050
|
-
hostId:
|
|
5700
|
+
hostId: NonEmpty5,
|
|
5051
5701
|
sid: external_exports.string().optional(),
|
|
5052
5702
|
snapshotRev: external_exports.number().int().nonnegative().optional(),
|
|
5053
5703
|
library: external_exports.enum(["agent-play-server", "agent-play-client"])
|
|
5054
5704
|
});
|
|
5055
5705
|
var AnalyticsEventSchema = external_exports.object({
|
|
5056
|
-
messageId:
|
|
5057
|
-
event:
|
|
5058
|
-
distinctId:
|
|
5059
|
-
timestamp:
|
|
5706
|
+
messageId: NonEmpty5,
|
|
5707
|
+
event: NonEmpty5,
|
|
5708
|
+
distinctId: NonEmpty5,
|
|
5709
|
+
timestamp: IsoTimestamp5,
|
|
5060
5710
|
properties: external_exports.record(AnalyticsPropertyValueSchema),
|
|
5061
5711
|
context: AnalyticsContextSchema.optional()
|
|
5062
5712
|
});
|
|
5063
5713
|
var AnalyticsTraitsSchema = external_exports.object({
|
|
5064
|
-
distinctId:
|
|
5714
|
+
distinctId: NonEmpty5,
|
|
5065
5715
|
traits: external_exports.record(AnalyticsPropertyValueSchema),
|
|
5066
|
-
timestamp:
|
|
5716
|
+
timestamp: IsoTimestamp5
|
|
5067
5717
|
});
|
|
5068
5718
|
var AnalyticsMigrationStatusSchema = external_exports.enum([
|
|
5069
5719
|
"pending",
|
|
@@ -5075,8 +5725,8 @@ var AnalyticsMigrationStateSchema = external_exports.object({
|
|
|
5075
5725
|
status: AnalyticsMigrationStatusSchema,
|
|
5076
5726
|
cursor: external_exports.string(),
|
|
5077
5727
|
totalIndexed: external_exports.number().int().nonnegative(),
|
|
5078
|
-
startedAt:
|
|
5079
|
-
completedAt:
|
|
5728
|
+
startedAt: IsoTimestamp5,
|
|
5729
|
+
completedAt: IsoTimestamp5.optional(),
|
|
5080
5730
|
error: external_exports.string().optional()
|
|
5081
5731
|
});
|
|
5082
5732
|
var ANALYTICS_EVENT_NAMES = {
|
|
@@ -5522,6 +6172,12 @@ function mergeSnapshotWithPlayerChainNode(snapshot, node) {
|
|
|
5522
6172
|
export {
|
|
5523
6173
|
MINIMUM_PLAY_WORLD_BOUNDS,
|
|
5524
6174
|
MINIMUM_STREET_LAYOUT_BOUNDS,
|
|
6175
|
+
COLUMN_STREET_ROW_HEIGHT,
|
|
6176
|
+
PARKING_STREET_ROW_HEIGHT,
|
|
6177
|
+
PARKING_COLUMN_GAP_ROWS,
|
|
6178
|
+
parkingZoneMinYFromColumnBase,
|
|
6179
|
+
parkingZoneMaxYFromColumnBase,
|
|
6180
|
+
DEFAULT_LAYOUT_BOUNDS_WITH_PARKING,
|
|
5525
6181
|
expandBoundsToMinimumPlayArea,
|
|
5526
6182
|
clampWorldPosition,
|
|
5527
6183
|
boundsContain,
|
|
@@ -5565,9 +6221,14 @@ export {
|
|
|
5565
6221
|
availableCellsForZone,
|
|
5566
6222
|
isAgentSpawnOccupancyPointAvailableInZone,
|
|
5567
6223
|
isSpaceAnchorOccupancyPointAvailableInZone,
|
|
6224
|
+
layoutHasParkingZone,
|
|
5568
6225
|
migrateWorldLayoutBounds,
|
|
6226
|
+
layoutNeedsParkingColumnGapMigration,
|
|
6227
|
+
migrateLayoutToParkingColumnGap,
|
|
6228
|
+
migrateLayoutToParkingRow,
|
|
5569
6229
|
applyBoundsFieldUpdateToLayout,
|
|
5570
6230
|
createVerticalStripSeedLayout,
|
|
6231
|
+
createWorldLayoutWithParkingRow,
|
|
5571
6232
|
SaleStateSchema,
|
|
5572
6233
|
ShopItemSchema,
|
|
5573
6234
|
SupermarketItemSchema,
|
|
@@ -5579,6 +6240,40 @@ export {
|
|
|
5579
6240
|
PurchaseRecordSchema,
|
|
5580
6241
|
isItemAvailableForPurchase,
|
|
5581
6242
|
desaturateColor,
|
|
6243
|
+
PARKING_DURATION_TIERS,
|
|
6244
|
+
DEFAULT_PARKING_RATES_USD,
|
|
6245
|
+
effectiveHourlyRateUsd,
|
|
6246
|
+
computeParkingExpiresAt,
|
|
6247
|
+
isParkingOccupantActive,
|
|
6248
|
+
ParkingDurationTierSchema,
|
|
6249
|
+
ParkingSpotSchema,
|
|
6250
|
+
ParkingStreetContentSchema,
|
|
6251
|
+
PARKING_BAY_COUNT,
|
|
6252
|
+
PARKING_LAYERS_PER_BAY,
|
|
6253
|
+
PARKING_SPOT_COUNT,
|
|
6254
|
+
createEmptyParkingStreetContent,
|
|
6255
|
+
listActiveParkingOccupancies,
|
|
6256
|
+
findParkingSpot,
|
|
6257
|
+
HOUSE_WORLD_X,
|
|
6258
|
+
HouseIdSchema,
|
|
6259
|
+
HOUSE_CATALOG,
|
|
6260
|
+
HouseSlotSchema,
|
|
6261
|
+
HouseStreetContentSchema,
|
|
6262
|
+
PARKING_HOUSE_COUNT,
|
|
6263
|
+
createEmptyHouseStreetContent,
|
|
6264
|
+
findHouseSlot,
|
|
6265
|
+
isHouseOwned,
|
|
6266
|
+
housePurchaseDetail,
|
|
6267
|
+
formatHouseOwnerDisplayName,
|
|
6268
|
+
buildHouseOwnershipPanelLines,
|
|
6269
|
+
HOUSE_BLUEPRINTS,
|
|
6270
|
+
getHouseBlueprint,
|
|
6271
|
+
layoutHouseFixtures,
|
|
6272
|
+
houseSpawnPosition,
|
|
6273
|
+
clampHousePosition,
|
|
6274
|
+
MAX_TIMED_PARKING_SLOTS_PER_NODE,
|
|
6275
|
+
MAX_SLOTS_WITH_FOREVER,
|
|
6276
|
+
canNodeAcquireParkingSpot,
|
|
5582
6277
|
APU_TOKEN,
|
|
5583
6278
|
buildApuWalletTransaction,
|
|
5584
6279
|
buildAmenityPurchaseApuFields,
|
|
@@ -5636,4 +6331,4 @@ export {
|
|
|
5636
6331
|
parsePlayerChainNodeRpcBody,
|
|
5637
6332
|
mergeSnapshotWithPlayerChainNode
|
|
5638
6333
|
};
|
|
5639
|
-
//# sourceMappingURL=chunk-
|
|
6334
|
+
//# sourceMappingURL=chunk-WTI6DVRD.js.map
|