@popcraft/kit 0.53.17 → 0.53.19

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.
Files changed (81) hide show
  1. package/dist/chunks/{agent-76MOJF7H.js → agent-QQAYZ5WB.js} +1 -1
  2. package/dist/chunks/{builtin-O5D2Q6RV.js → builtin-KE5VRKPQ.js} +4 -4
  3. package/dist/chunks/{buy-credits-2RI5ALP3.js → buy-credits-R6PSWUM2.js} +2 -2
  4. package/dist/chunks/{check-template-5FJPJLKN.js → check-template-BMGDUIRP.js} +3 -3
  5. package/dist/chunks/{chunk-GZZNTUHF.js → chunk-2O3AJLC7.js} +5 -5
  6. package/dist/chunks/{chunk-MUOTQRR5.js → chunk-35ZHGX7R.js} +3 -3
  7. package/dist/chunks/{chunk-B4FB4B2M.js → chunk-5IRV2SAQ.js} +1 -1
  8. package/dist/chunks/{chunk-64TRA3OH.js → chunk-6DDTIGDY.js} +4 -4
  9. package/dist/chunks/{chunk-ZIOF5AO6.js → chunk-7G7UOKM4.js} +1 -1
  10. package/dist/chunks/{chunk-IAL55FGC.js → chunk-DSFTJ6BI.js} +2 -2
  11. package/dist/chunks/{chunk-YLNK64NW.js → chunk-DW7H5O5F.js} +12 -12
  12. package/dist/chunks/{chunk-N6T6XKGC.js → chunk-ERXWGXIF.js} +1 -1
  13. package/dist/chunks/{chunk-SELEMFEP.js → chunk-FIFDX2PJ.js} +1 -1
  14. package/dist/chunks/{chunk-NAXSGXBD.js → chunk-GYRYPM3N.js} +11 -11
  15. package/dist/chunks/{chunk-LVENLTN6.js → chunk-HC2BCDFS.js} +4 -4
  16. package/dist/chunks/{chunk-4UOE2QLJ.js → chunk-HE2HQQF7.js} +4 -4
  17. package/dist/chunks/{chunk-ZEERADTI.js → chunk-I5VBP754.js} +12 -12
  18. package/dist/chunks/{chunk-IIPH3CZZ.js → chunk-IY5UZMTO.js} +251 -2
  19. package/dist/chunks/{chunk-QJU5LRJX.js → chunk-J6Q7JXER.js} +2 -2
  20. package/dist/chunks/{chunk-NH42V7UK.js → chunk-JGJZXJRJ.js} +1 -1
  21. package/dist/chunks/{chunk-AMQ2XV6E.js → chunk-JUHBI75X.js} +10 -10
  22. package/dist/chunks/{chunk-UXNXHMBD.js → chunk-K3AZGLLD.js} +5 -7
  23. package/dist/chunks/{chunk-YZYQTXAK.js → chunk-KT3VWNJF.js} +4 -4
  24. package/dist/chunks/{chunk-U6OKU7J4.js → chunk-PIVR4JOX.js} +2 -2
  25. package/dist/chunks/{chunk-MEEB2X3B.js → chunk-RCYPJTDS.js} +54 -54
  26. package/dist/chunks/{chunk-QS4AT3DM.js → chunk-RPZJC2IG.js} +2 -4
  27. package/dist/chunks/{chunk-ROIDWBDQ.js → chunk-USXZ2Z7E.js} +4 -4
  28. package/dist/chunks/{chunk-SAUZ2HYM.js → chunk-VO5AERM4.js} +4 -4
  29. package/dist/chunks/{chunk-XKUI2K2V.js → chunk-X4JKF2JG.js} +214 -1
  30. package/dist/chunks/{chunk-K63NQAOB.js → chunk-XE6NJFI2.js} +89 -89
  31. package/dist/chunks/{chunk-VRGEEHBR.js → chunk-Y7SVEIXZ.js} +270 -50
  32. package/dist/chunks/{chunk-E4P2HVUD.js → chunk-ZDBDOXNF.js} +3 -1
  33. package/dist/chunks/{client-RIPJA5PK.js → client-6AZSG3ZL.js} +1 -1
  34. package/dist/chunks/{client-3EX4LVI6.js → client-DBACY2LR.js} +3 -3
  35. package/dist/chunks/{client-N525NCFB.js → client-R43QZ4QR.js} +2 -2
  36. package/dist/chunks/{client-actions-232DIA3G.js → client-actions-FBVLWSY2.js} +13 -14
  37. package/dist/chunks/{dangerous-2CPJMLP6.js → dangerous-N4RC6QXK.js} +4 -4
  38. package/dist/chunks/{delete-current-file-IVQD2M3K.js → delete-current-file-KB34A5H7.js} +9 -10
  39. package/dist/chunks/{editor-seams-AFXFNM6K.js → editor-seams-YTHZIEZ2.js} +18 -20
  40. package/dist/chunks/{editor-store-ZFR2ZHNM.js → editor-store-I7XK3PGQ.js} +5 -5
  41. package/dist/chunks/{export-FWVSW5AN.js → export-FZA6A6I6.js} +1 -1
  42. package/dist/chunks/{export-watermark-KT25FYVD.js → export-watermark-6YAEKDKK.js} +9 -10
  43. package/dist/chunks/{eyedropper-W6X2VHUB.js → eyedropper-UWISBVOX.js} +7 -11
  44. package/dist/chunks/{generate-media-Y3NYLLSS.js → generate-media-6VUWK57N.js} +4 -4
  45. package/dist/chunks/{host-PKGEIJZF.js → host-MIEETQXP.js} +14 -17
  46. package/dist/chunks/{integrations-4NFCLH3S.js → integrations-DWTRYAL5.js} +1 -1
  47. package/dist/chunks/{libraries-565L4UXX.js → libraries-LHFSA7JJ.js} +9 -10
  48. package/dist/chunks/{live-X3AP4MHF.js → live-6C5QKVRX.js} +5 -5
  49. package/dist/chunks/{lottie-AGAHYTZE.js → lottie-ZKR6H64U.js} +3 -4
  50. package/dist/chunks/{media-tool-HVMNAVAE.js → media-tool-Z6ND5SKE.js} +12 -126
  51. package/dist/chunks/{new-file-Z7EJFO2J.js → new-file-ZD27RMLG.js} +7 -7
  52. package/dist/chunks/{pdf-X3ZB6QKO.js → pdf-RPD6QHMP.js} +5 -7
  53. package/dist/chunks/{player-check-ZGWLAHXY.js → player-check-CZVWUJXW.js} +3 -4
  54. package/dist/chunks/{plugin-OLV3V7ZN.js → plugin-IIVMHWXJ.js} +3 -3
  55. package/dist/chunks/{plugin-import-SM3NLQ5A.js → plugin-import-VVPFCMMO.js} +23 -26
  56. package/dist/chunks/{pptx-OI7DTHPN.js → pptx-QZMA6SRM.js} +3 -4
  57. package/dist/chunks/{presence-TL24PA2T.js → presence-X4HNN2NN.js} +6 -6
  58. package/dist/chunks/{project-TS27R5XO.js → project-ZSZAT2MB.js} +3 -3
  59. package/dist/chunks/{publish-site-34NCZ274.js → publish-site-B36S2CS7.js} +10 -11
  60. package/dist/chunks/{publish-store-V27NWG4I.js → publish-store-7ZCGU56C.js} +5 -5
  61. package/dist/chunks/{raster-actions-PGNW6BX6.js → raster-actions-I5TJ5I7S.js} +7 -11
  62. package/dist/chunks/{reference-images-36D6WIRI.js → reference-images-RAJE3NRE.js} +2 -2
  63. package/dist/chunks/{resolvers-V6SR7XRN.js → resolvers-J3DRJJ7P.js} +5 -6
  64. package/dist/chunks/{runner-Q6HI2WVB.js → runner-7PSSJXP6.js} +25 -27
  65. package/dist/chunks/{store-SIAVD2I6.js → store-D7M2QNWT.js} +14 -15
  66. package/dist/chunks/{storefront-prepare-6WYLPH6E.js → storefront-prepare-S6A5FZXC.js} +1 -1
  67. package/dist/chunks/{svg-export-QTVHP7B2.js → svg-export-J23NHZWC.js} +4 -5
  68. package/dist/chunks/{sync-PQCW3ZLW.js → sync-GQHOTPE4.js} +9 -10
  69. package/dist/chunks/{tabs-HTDE6XGQ.js → tabs-ZRZQW5HB.js} +12 -12
  70. package/dist/chunks/{team-H4DYU4NF.js → team-GZOX67CF.js} +1 -1
  71. package/dist/chunks/{team-client-DW5CMJ4L.js → team-client-PQQV3564.js} +1 -1
  72. package/dist/chunks/{theme-store-FAYEXX7K.js → theme-store-CBS2LI4H.js} +2 -3
  73. package/dist/chunks/{tools-HBJ2I7YP.js → tools-KNCUAUHK.js} +2 -2
  74. package/dist/chunks/{ui-commands-NRTJFHI6.js → ui-commands-WNPLJR4F.js} +20 -22
  75. package/dist/chunks/{versions-22FL7N6P.js → versions-SFXXLEBS.js} +9 -10
  76. package/dist/index.js +1 -1
  77. package/package.json +1 -1
  78. package/dist/chunks/chunk-C3QJHVOH.js +0 -269
  79. package/dist/chunks/chunk-I5REOOP7.js +0 -225
  80. package/dist/chunks/chunk-P4LE4WLR.js +0 -25
  81. package/dist/chunks/chunk-ZBANBY2Q.js +0 -27
@@ -26,10 +26,14 @@ import {
26
26
  stageFit,
27
27
  stageTarget,
28
28
  textLinkSource
29
- } from "./chunk-K63NQAOB.js";
29
+ } from "./chunk-XE6NJFI2.js";
30
30
  import {
31
- parseColor
32
- } from "./chunk-I5REOOP7.js";
31
+ BUILTIN_THEMES,
32
+ INITIAL_THEME_ID,
33
+ canvasColors,
34
+ parseColor,
35
+ resolveTheme
36
+ } from "./chunk-X4JKF2JG.js";
33
37
  import {
34
38
  seekTime,
35
39
  spanOf,
@@ -63,7 +67,7 @@ import {
63
67
  computeBooleanMultiPoly,
64
68
  nonzeroMultiPoly,
65
69
  require_polygon_clipping_cjs
66
- } from "./chunk-IIPH3CZZ.js";
70
+ } from "./chunk-IY5UZMTO.js";
67
71
  import {
68
72
  selectionWorldBounds
69
73
  } from "./chunk-TXEWYX4G.js";
@@ -82,17 +86,18 @@ import {
82
86
  import {
83
87
  snapToFrame
84
88
  } from "./chunk-W2P5XUAY.js";
89
+ import {
90
+ canBePixelLayer,
91
+ compositePixelLayers,
92
+ ensurePixelLayers,
93
+ layerInFrame
94
+ } from "./chunk-CMOVCY42.js";
85
95
  import {
86
96
  decodeImageUrl
87
97
  } from "./chunk-OD63RI3Y.js";
88
98
  import {
89
99
  getActiveRenderer
90
100
  } from "./chunk-A2DCJZGE.js";
91
- import {
92
- compositePixelLayers,
93
- ensurePixelLayers,
94
- layerInFrame
95
- } from "./chunk-CMOVCY42.js";
96
101
  import {
97
102
  cloudUser
98
103
  } from "./chunk-BXFKOMNU.js";
@@ -315,9 +320,11 @@ import {
315
320
  getAncestors,
316
321
  getNodeBounds,
317
322
  getRenderableNodes,
323
+ getWorldMatrix,
318
324
  getWorldRenderBounds,
319
325
  getWorldTransform,
320
326
  init_flatten,
327
+ init_glyph_linear,
321
328
  init_print_pages,
322
329
  init_routing,
323
330
  init_scene_graph,
@@ -390,6 +397,9 @@ import {
390
397
  shapeToVectorPath,
391
398
  writePath
392
399
  } from "./chunk-HOQFG5J7.js";
400
+ import {
401
+ init_layout_access
402
+ } from "./chunk-DC7CJQXE.js";
393
403
  import {
394
404
  init_time,
395
405
  localTime,
@@ -406,9 +416,16 @@ import {
406
416
  init_easing,
407
417
  interpOfEasing
408
418
  } from "./chunk-UHWYDCJ7.js";
419
+ import {
420
+ init_scene3d
421
+ } from "./chunk-DZHR24NY.js";
422
+ import {
423
+ init_transform3d
424
+ } from "./chunk-GHDFAWY2.js";
409
425
  import {
410
426
  apply,
411
- init_transform
427
+ init_transform,
428
+ invert
412
429
  } from "./chunk-5HGDT4AZ.js";
413
430
  import {
414
431
  init_dist_node,
@@ -432,6 +449,221 @@ import {
432
449
  // lib/store/editor-store.ts
433
450
  init_define_POPCRAFT_COMPONENT_IDS();
434
451
 
452
+ // lib/engine/camera.ts
453
+ init_define_POPCRAFT_COMPONENT_IDS();
454
+ function screenToWorld(screenX, screenY, camera, canvasWidth, canvasHeight) {
455
+ const ndcX = screenX / canvasWidth * 2 - 1;
456
+ const ndcY = screenY / canvasHeight * 2 - 1;
457
+ const halfWidth = canvasWidth / (2 * camera.zoom);
458
+ const halfHeight = canvasHeight / (2 * camera.zoom);
459
+ const worldX = ndcX * halfWidth + camera.x;
460
+ const worldY = ndcY * halfHeight + camera.y;
461
+ return { x: worldX, y: worldY };
462
+ }
463
+
464
+ // lib/editor/paste-place.ts
465
+ init_define_POPCRAFT_COMPONENT_IDS();
466
+ init_scene_graph();
467
+ init_transform();
468
+
469
+ // lib/editor/hit-test.ts
470
+ init_define_POPCRAFT_COMPONENT_IDS();
471
+
472
+ // lib/document/containers.ts
473
+ init_define_POPCRAFT_COMPONENT_IDS();
474
+
475
+ // lib/document/editability.ts
476
+ init_define_POPCRAFT_COMPONENT_IDS();
477
+ function isLocked(document2, nodeId) {
478
+ let id = nodeId;
479
+ const seen = /* @__PURE__ */ new Set();
480
+ while (id && !seen.has(id)) {
481
+ seen.add(id);
482
+ const node = document2.nodes[id];
483
+ if (!node) return false;
484
+ if (node.locked) return true;
485
+ id = node.parentId ?? void 0;
486
+ }
487
+ return false;
488
+ }
489
+ function editableIds(document2, ids) {
490
+ return ids.filter((id) => !isLocked(document2, id));
491
+ }
492
+ var NEVER_ROTATES = /* @__PURE__ */ new Set(["STICKY"]);
493
+ function canRotate(document2, nodeId) {
494
+ const node = document2.nodes[nodeId];
495
+ if (!node) return false;
496
+ return !NEVER_ROTATES.has(node.type) && !isLocked(document2, nodeId);
497
+ }
498
+
499
+ // lib/editor/hit-test.ts
500
+ init_scene_graph();
501
+ init_transform();
502
+ init_scene3d();
503
+ init_transform3d();
504
+
505
+ // lib/extensions/table/cell-text.ts
506
+ init_define_POPCRAFT_COMPONENT_IDS();
507
+ init_types();
508
+
509
+ // lib/editor/pointer/move/group-resize.ts
510
+ init_define_POPCRAFT_COMPONENT_IDS();
511
+
512
+ // lib/document/resize-children.ts
513
+ init_define_POPCRAFT_COMPONENT_IDS();
514
+
515
+ // lib/editor/pointer/move/group-resize.ts
516
+ init_scene_graph();
517
+
518
+ // lib/editor/pointer/move/snap.ts
519
+ init_define_POPCRAFT_COMPONENT_IDS();
520
+
521
+ // lib/engine/canvas-dpr.ts
522
+ init_define_POPCRAFT_COMPONENT_IDS();
523
+ function isAppleMobile() {
524
+ if (typeof navigator === "undefined") return false;
525
+ return /iPad|iPhone|iPod/.test(navigator.userAgent) || /Mac/.test(navigator.platform) && navigator.maxTouchPoints > 1;
526
+ }
527
+ function canvasDpr() {
528
+ if (typeof window === "undefined") return 1;
529
+ const dpr = window.devicePixelRatio || 1;
530
+ return dpr > 1 ? Math.max(1, dpr * renderScale) : dpr;
531
+ }
532
+ var renderScale = 1;
533
+
534
+ // lib/editor/hit-test.ts
535
+ init_layout_access();
536
+ init_glyph_linear();
537
+
538
+ // lib/editor/overlays/frame-labels.ts
539
+ init_define_POPCRAFT_COMPONENT_IDS();
540
+ init_scene_graph();
541
+
542
+ // lib/theme/chrome.ts
543
+ init_define_POPCRAFT_COMPONENT_IDS();
544
+ var defaults = resolveTheme(INITIAL_THEME_ID, (id) => BUILTIN_THEMES.find((t2) => t2.id === id));
545
+ var colors = canvasColors(defaults);
546
+
547
+ // lib/editor/hit-test.ts
548
+ function placement(state, nodeId, node) {
549
+ const t2 = getWorldTransform(state.document, nodeId);
550
+ return { m: unmirroredMatrix(t2, node.width, node.height), t: t2 };
551
+ }
552
+ function worldToNodeLocal(state, worldX, worldY, nodeId) {
553
+ const node = resolveVirtualNode(state.document.nodes, nodeId);
554
+ if (!node) return { x: worldX, y: worldY };
555
+ const inv = invert(placement(state, nodeId, node).m);
556
+ if (!inv) return { x: Infinity, y: Infinity };
557
+ const [x, y] = apply(inv, worldX, worldY);
558
+ return { x, y };
559
+ }
560
+ function getNodeWorldCenter(state, nodeId) {
561
+ const transform = getWorldTransform(state.document, nodeId);
562
+ return { x: transform.cx, y: transform.cy };
563
+ }
564
+ function findContainingFrame(state, nodeId) {
565
+ const node = state.document.nodes[nodeId];
566
+ if (!node) return null;
567
+ const allNodes = state.document.nodes;
568
+ const pageId = state.currentPageId;
569
+ const page = allNodes[pageId];
570
+ if (!page) return null;
571
+ const containers = [];
572
+ function collectContainers(ids) {
573
+ for (const id of ids) {
574
+ const n = allNodes[id];
575
+ if (!n) continue;
576
+ if (n.locked) continue;
577
+ const parentType = n.parentId ? allNodes[n.parentId]?.type : void 0;
578
+ const topFrame = n.type === "FRAME" && (parentType === "PAGE" || parentType === "SECTION");
579
+ const acceptsNode = topFrame || n.type === "SECTION" || n.type === "PIXEL_GRID" && canBePixelLayer(node);
580
+ if (acceptsNode && id !== nodeId && id !== node.parentId) {
581
+ containers.push(n);
582
+ }
583
+ if (n.childIds && n.childIds.length > 0) collectContainers(n.childIds);
584
+ }
585
+ }
586
+ collectContainers(page.childIds);
587
+ const worldCenter = getNodeWorldCenter(state, nodeId);
588
+ const cx = worldCenter.x;
589
+ const cy = worldCenter.y;
590
+ let best = null;
591
+ let bestArea = Infinity;
592
+ for (const container of containers) {
593
+ const cCenter = getNodeWorldCenter(state, container.id);
594
+ const cWorldX = cCenter.x - container.width / 2;
595
+ const cWorldY = cCenter.y - container.height / 2;
596
+ if (cx >= cWorldX && cx <= cWorldX + container.width && cy >= cWorldY && cy <= cWorldY + container.height) {
597
+ const area2 = container.width * container.height;
598
+ if (area2 < bestArea) {
599
+ bestArea = area2;
600
+ best = container;
601
+ }
602
+ }
603
+ }
604
+ return best ? best.id : null;
605
+ }
606
+ function findCreationParent(state, nodeId) {
607
+ const node = state.document.nodes[nodeId];
608
+ if (!node) return null;
609
+ const nodes = state.document.nodes;
610
+ const c = getNodeWorldCenter(state, nodeId);
611
+ let best = null;
612
+ let bestDepth = -1;
613
+ const visit = (id, depth) => {
614
+ const n = nodes[id];
615
+ if (!n || id === nodeId || !n.visible || n.locked) return;
616
+ const ok = node.type === "SECTION" ? n.type === "SECTION" : n.type === "FRAME" || n.type === "SECTION" || n.type === "COMPONENT";
617
+ if (ok) {
618
+ const p = worldToNodeLocal(state, c.x, c.y, id);
619
+ if (p.x >= 0 && p.y >= 0 && p.x <= n.width && p.y <= n.height && depth > bestDepth) {
620
+ best = id;
621
+ bestDepth = depth;
622
+ }
623
+ }
624
+ if (n.type === "FRAME" || n.type === "SECTION" || n.type === "COMPONENT") for (const k of n.childIds ?? []) visit(k, depth + 1);
625
+ };
626
+ for (const id of nodes[state.currentPageId]?.childIds ?? []) visit(id, 0);
627
+ return best;
628
+ }
629
+
630
+ // lib/editor/paste-place.ts
631
+ var inside = (b, c) => b.minX >= c.minX - 0.5 && b.minY >= c.minY - 0.5 && b.maxX <= c.maxX + 0.5 && b.maxY <= c.maxY + 0.5;
632
+ var overlaps = (b, c) => b.maxX > c.minX && b.minX < c.maxX && b.maxY > c.minY && b.minY < c.maxY;
633
+ function placePasted(doc, pageId, ids, view, opts = {}) {
634
+ if (!ids.length) return doc;
635
+ const parentId = doc.nodes[ids[0]]?.parentId;
636
+ if (!parentId) return doc;
637
+ const onPage = doc.nodes[parentId]?.type === "PAGE";
638
+ const b = selectionWorldBounds(doc.nodes, ids);
639
+ const c = onPage ? view : selectionWorldBounds(doc.nodes, [parentId]);
640
+ if (b && c && (opts.centre || (onPage ? !overlaps(b, c) : !inside(b, c)))) {
641
+ const dx = (c.minX + c.maxX) / 2 - (b.minX + b.maxX) / 2;
642
+ const dy = (c.minY + c.maxY) / 2 - (b.minY + b.maxY) / 2;
643
+ const inv = onPage ? null : invert(getWorldMatrix(doc, parentId));
644
+ const [ox, oy] = inv ? apply(inv, 0, 0) : [0, 0];
645
+ const [lx, ly] = inv ? apply(inv, dx, dy) : [dx, dy];
646
+ for (const id of ids) {
647
+ const n = doc.nodes[id];
648
+ doc = updateNode(doc, id, { x: n.x + (lx - ox), y: n.y + (ly - oy) });
649
+ }
650
+ }
651
+ if (onPage) return doc;
652
+ const within = (id) => {
653
+ for (let p = id; p; p = doc.nodes[p]?.parentId) if (p === parentId) return true;
654
+ return false;
655
+ };
656
+ for (const id of ids) {
657
+ const state = { document: doc, currentPageId: pageId, camera: { x: 0, y: 0, zoom: 1 } };
658
+ const target = findCreationParent(state, id);
659
+ if (!target || target === doc.nodes[id]?.parentId || !within(target)) continue;
660
+ const placed2 = placementUnder(doc, id, target);
661
+ if (placed2) doc = updateNode(doc, id, placed2);
662
+ doc = reparentNode(doc, id, target);
663
+ }
664
+ return doc;
665
+ }
666
+
435
667
  // lib/editor/selection-drill.ts
436
668
  init_define_POPCRAFT_COMPONENT_IDS();
437
669
  init_scene_graph();
@@ -481,30 +713,6 @@ function prefersReducedMotion(prefs = getA11yPrefs()) {
481
713
  return prefs.motion === "reduce" || prefs.motion === "system" && media(REDUCED_QUERY);
482
714
  }
483
715
 
484
- // lib/document/editability.ts
485
- init_define_POPCRAFT_COMPONENT_IDS();
486
- function isLocked(document2, nodeId) {
487
- let id = nodeId;
488
- const seen = /* @__PURE__ */ new Set();
489
- while (id && !seen.has(id)) {
490
- seen.add(id);
491
- const node = document2.nodes[id];
492
- if (!node) return false;
493
- if (node.locked) return true;
494
- id = node.parentId ?? void 0;
495
- }
496
- return false;
497
- }
498
- function editableIds(document2, ids) {
499
- return ids.filter((id) => !isLocked(document2, id));
500
- }
501
- var NEVER_ROTATES = /* @__PURE__ */ new Set(["STICKY"]);
502
- function canRotate(document2, nodeId) {
503
- const node = document2.nodes[nodeId];
504
- if (!node) return false;
505
- return !NEVER_ROTATES.has(node.type) && !isLocked(document2, nodeId);
506
- }
507
-
508
716
  // node_modules/.pnpm/zustand@5.0.15_@types+react@19.3.0_immer@11.1.21_react@19.3.0_use-sync-external-store@1.6.0_react@19.3.0_/node_modules/zustand/esm/middleware.mjs
509
717
  init_define_POPCRAFT_COMPONENT_IDS();
510
718
  var subscribeWithSelectorImpl = (fn) => (set2, get2, api) => {
@@ -2187,11 +2395,11 @@ function arrangementFaces(shapes) {
2187
2395
  const next = [];
2188
2396
  let rest = shape;
2189
2397
  for (const f of faces) {
2190
- const inside = op(import_polygon_clipping.default.intersection, f.mp, shape);
2191
- if (solid(inside)) next.push({ mp: inside, sources: [...f.sources, i] });
2398
+ const inside2 = op(import_polygon_clipping.default.intersection, f.mp, shape);
2399
+ if (solid(inside2)) next.push({ mp: inside2, sources: [...f.sources, i] });
2192
2400
  const outside = op(import_polygon_clipping.default.difference, f.mp, shape);
2193
2401
  if (solid(outside)) next.push({ mp: outside, sources: f.sources });
2194
- if (solid(inside)) rest = op(import_polygon_clipping.default.difference, rest, f.mp);
2402
+ if (solid(inside2)) rest = op(import_polygon_clipping.default.difference, rest, f.mp);
2195
2403
  }
2196
2404
  if (solid(rest)) next.push({ mp: rest, sources: [i] });
2197
2405
  faces = next;
@@ -2200,15 +2408,15 @@ function arrangementFaces(shapes) {
2200
2408
  }
2201
2409
  function pointInMultiPoly(mp, x, y) {
2202
2410
  for (const poly of mp) {
2203
- let inside = false;
2411
+ let inside2 = false;
2204
2412
  for (const ring of poly) {
2205
2413
  for (let i = 0, j = ring.length - 1; i < ring.length; j = i++) {
2206
2414
  const [xi, yi] = ring[i];
2207
2415
  const [xj, yj] = ring[j];
2208
- if (yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi) inside = !inside;
2416
+ if (yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi) inside2 = !inside2;
2209
2417
  }
2210
2418
  }
2211
- if (inside) return true;
2419
+ if (inside2) return true;
2212
2420
  }
2213
2421
  return false;
2214
2422
  }
@@ -3915,8 +4123,8 @@ function createPixelSlice(set2, get2) {
3915
4123
  pixelAddTag: (id, from, to) => {
3916
4124
  const n = node(id);
3917
4125
  if (!n) return;
3918
- const colors = ["#e9720c", "#0c8ce9", "#34c759", "#af52de", "#ff2d55", "#ffcc00"];
3919
- const tag = { id: v4_default(), name: `Tag ${n.tags.length + 1}`, from: clampFrame(n, Math.min(from, to)), to: clampFrame(n, Math.max(from, to)), direction: "FORWARD", color: colors[n.tags.length % colors.length] };
4126
+ const colors2 = ["#e9720c", "#0c8ce9", "#34c759", "#af52de", "#ff2d55", "#ffcc00"];
4127
+ const tag = { id: v4_default(), name: `Tag ${n.tags.length + 1}`, from: clampFrame(n, Math.min(from, to)), to: clampFrame(n, Math.max(from, to)), direction: "FORWARD", color: colors2[n.tags.length % colors2.length] };
3920
4128
  commit(id, { tags: [...n.tags, tag] }, "Add tag");
3921
4129
  },
3922
4130
  pixelUpdateTag: (id, tagId, patch) => {
@@ -4551,8 +4759,8 @@ function washiOutline(length, width, seed, edge = "SPIKY") {
4551
4759
  }
4552
4760
  function washiFill(style, width, seed) {
4553
4761
  if (style.pattern) {
4554
- const colors = paletteColors(style.palette ?? "denim");
4555
- return { type: "PATTERN", visible: true, opacity: 1, patternPreset: style.pattern, patternColors: colors, patternScale: Math.max(0.3, Math.min(3, width / 36)) };
4762
+ const colors2 = paletteColors(style.palette ?? "denim");
4763
+ return { type: "PATTERN", visible: true, opacity: 1, patternPreset: style.pattern, patternColors: colors2, patternScale: Math.max(0.3, Math.min(3, width / 36)) };
4556
4764
  }
4557
4765
  const color = style.color ?? { r: 0.97, g: 0.62, b: 0.7, a: 1 };
4558
4766
  const tex = {
@@ -4630,7 +4838,7 @@ function createPopcornSlice(set2, get2) {
4630
4838
  privateMode: false,
4631
4839
  setPrivateMode: (on) => {
4632
4840
  set2({ privateMode: on });
4633
- void import("./presence-TL24PA2T.js").then((m) => m.setPresencePrivate(on)).catch(() => {
4841
+ void import("./presence-X4HNN2NN.js").then((m) => m.setPresencePrivate(on)).catch(() => {
4634
4842
  });
4635
4843
  },
4636
4844
  /** Reveal every private item THIS user created (they sync to collaborators). Others' stay theirs. */
@@ -6675,7 +6883,7 @@ var useEditorStore = create()(
6675
6883
  // A copy is a new file, so it is cloud-backed like any other (see lib/client/cloud/new-file.ts).
6676
6884
  // Returns '' when it was refused (offline, signed out, plan full) or failed; nothing is left behind.
6677
6885
  duplicateDocument: async (id) => {
6678
- const { duplicateDocumentToCloud } = await import("./sync-PQCW3ZLW.js");
6886
+ const { duplicateDocumentToCloud } = await import("./sync-GQHOTPE4.js");
6679
6887
  return duplicateDocumentToCloud(id);
6680
6888
  },
6681
6889
  deleteDocument: async (id) => {
@@ -7565,6 +7773,14 @@ var useEditorStore = create()(
7565
7773
  doc = { ...doc, nodes: newNodes };
7566
7774
  doc = relinkCopies(doc, idMap);
7567
7775
  doc = adoptPastedLibraryInstances(doc, newSelection, carried, libraryLink());
7776
+ {
7777
+ const vp = canvasViewport();
7778
+ const a = screenToWorld(0, 0, state.camera, vp.width, vp.height);
7779
+ const z = screenToWorld(vp.width, vp.height, state.camera, vp.width, vp.height);
7780
+ const view = { minX: Math.min(a.x, z.x), minY: Math.min(a.y, z.y), maxX: Math.max(a.x, z.x), maxY: Math.max(a.y, z.y) };
7781
+ const fromElsewhere = !!into && into.type === "SECTION" && topLevelNodes.every((n) => n.parentId !== into.id);
7782
+ doc = placePasted(doc, state.currentPageId, newSelection.filter((id) => doc.nodes[id]), view, { centre: fromElsewhere });
7783
+ }
7568
7784
  const command = createCommand("PASTE_NODES", `Paste ${topLevelNodes.length} node(s)`, documentBefore, doc);
7569
7785
  set2({
7570
7786
  document: applyAutoLayout(doc),
@@ -10171,9 +10387,9 @@ if (typeof window !== "undefined") {
10171
10387
  if (typeof window !== "undefined" && navigator.webdriver) {
10172
10388
  window.__vpDesign = async (script, o = {}) => {
10173
10389
  const [{ registerBuiltinTools, runTool }, { editorToolContext }, { createDesignPreview }] = await Promise.all([
10174
- import("./tools-HBJ2I7YP.js").then(async (m) => ({ ...m, registerBuiltinTools: (await import("./builtin-O5D2Q6RV.js")).registerBuiltinTools })),
10175
- import("./editor-seams-AFXFNM6K.js"),
10176
- import("./live-X3AP4MHF.js")
10390
+ import("./tools-KNCUAUHK.js").then(async (m) => ({ ...m, registerBuiltinTools: (await import("./builtin-KE5VRKPQ.js")).registerBuiltinTools })),
10391
+ import("./editor-seams-YTHZIEZ2.js"),
10392
+ import("./live-6C5QKVRX.js")
10177
10393
  ]);
10178
10394
  registerBuiltinTools();
10179
10395
  const args = JSON.stringify({ ...o.name ? { name: o.name } : {}, ...o.size ? { size: o.size } : {}, ...o.frame ? { frame: o.frame } : {}, script });
@@ -10230,7 +10446,7 @@ if (typeof window !== "undefined" && navigator.webdriver) {
10230
10446
  return { type, width: spec.width, height: spec.height, b64: btoa(bin) };
10231
10447
  };
10232
10448
  window.__vpLottieCheck = async (what, at) => {
10233
- const [{ lottieCheckFrames }, { getActiveRenderer: getActiveRenderer2 }] = await Promise.all([import("./player-check-ZGWLAHXY.js"), import("./renderer-registry-UWFTNNVB.js")]);
10449
+ const [{ lottieCheckFrames }, { getActiveRenderer: getActiveRenderer2 }] = await Promise.all([import("./player-check-CZVWUJXW.js"), import("./renderer-registry-UWFTNNVB.js")]);
10234
10450
  const renderer = getActiveRenderer2();
10235
10451
  if (!renderer) throw new Error("no renderer on this route");
10236
10452
  const doc = useEditorStore.getState().document;
@@ -10442,6 +10658,10 @@ onWriteFromReadOnly(() => {
10442
10658
  });
10443
10659
 
10444
10660
  export {
10661
+ screenToWorld,
10662
+ isAppleMobile,
10663
+ canvasDpr,
10664
+ findContainingFrame,
10445
10665
  fileOpeningMode,
10446
10666
  RASTER_MAX_SIDE,
10447
10667
  setPluginTabs,
@@ -6,7 +6,7 @@ const __filename = __popcraftPath(import.meta.url);
6
6
  const __dirname = __popcraftDirname(__filename);
7
7
  import {
8
8
  hyperyRequestHeaders
9
- } from "./chunk-B4FB4B2M.js";
9
+ } from "./chunk-5IRV2SAQ.js";
10
10
  import {
11
11
  aiAvailability,
12
12
  effectiveChatModel,
@@ -75,6 +75,8 @@ var AiClientError = class extends Error {
75
75
  this.code = code;
76
76
  this.status = status;
77
77
  }
78
+ code;
79
+ status;
78
80
  };
79
81
  var needsReauth = (e) => e instanceof AiClientError && (e.code === "ai_reauth" || e.code === "ai_scope" || e.code === "unauthenticated");
80
82
  function ensureAvailable() {
@@ -14,7 +14,7 @@ import {
14
14
  placeStockPhoto,
15
15
  searchStockPhotos,
16
16
  stockPhotoInfo
17
- } from "./chunk-IAL55FGC.js";
17
+ } from "./chunk-DSFTJ6BI.js";
18
18
  import "./chunk-AKNWNB6A.js";
19
19
  import "./chunk-63KP74KB.js";
20
20
  import "./chunk-LJSVREWM.js";
@@ -16,11 +16,11 @@ import {
16
16
  requestEmbeddings,
17
17
  requestImage,
18
18
  requestImageAction
19
- } from "./chunk-E4P2HVUD.js";
20
- import "./chunk-B4FB4B2M.js";
19
+ } from "./chunk-ZDBDOXNF.js";
20
+ import "./chunk-5IRV2SAQ.js";
21
21
  import "./chunk-L47DGY5Z.js";
22
22
  import "./chunk-6TMH7HCQ.js";
23
- import "./chunk-NH42V7UK.js";
23
+ import "./chunk-JGJZXJRJ.js";
24
24
  import "./chunk-7OJZZPU4.js";
25
25
  import "./chunk-4DCE2NBA.js";
26
26
  import "./chunk-RVNIEOXA.js";
@@ -7,7 +7,7 @@ const __dirname = __popcraftDirname(__filename);
7
7
  import {
8
8
  defaultMeasure,
9
9
  placePicture
10
- } from "./chunk-IAL55FGC.js";
10
+ } from "./chunk-DSFTJ6BI.js";
11
11
  import "./chunk-AKNWNB6A.js";
12
12
  import {
13
13
  api
@@ -121,7 +121,7 @@ async function placeLibraryItem(item, opts = {}) {
121
121
  }
122
122
  if (item.contentType.startsWith("video/")) {
123
123
  const file = await libraryFile(item, opts);
124
- const [{ useEditorStore }, { placeMediaFile }] = await Promise.all([import("./editor-store-ZFR2ZHNM.js"), import("./media-tool-HVMNAVAE.js")]);
124
+ const [{ useEditorStore }, { placeMediaFile }] = await Promise.all([import("./editor-store-I7XK3PGQ.js"), import("./media-tool-Z6ND5SKE.js")]);
125
125
  const cam = useEditorStore.getState().camera;
126
126
  await placeMediaFile(file, { kind: "point", ...opts.at ?? { x: cam.x, y: cam.y } });
127
127
  return useEditorStore.getState().selection[0] ?? null;
@@ -16,52 +16,51 @@ import {
16
16
  selectedVectorTarget,
17
17
  startImageAction,
18
18
  startImageGeneration
19
- } from "./chunk-YZYQTXAK.js";
19
+ } from "./chunk-KT3VWNJF.js";
20
20
  import "./chunk-FXQCJKLS.js";
21
- import "./chunk-E4P2HVUD.js";
22
- import "./chunk-B4FB4B2M.js";
21
+ import "./chunk-ZDBDOXNF.js";
22
+ import "./chunk-5IRV2SAQ.js";
23
23
  import "./chunk-L47DGY5Z.js";
24
24
  import "./chunk-UDDWBCFE.js";
25
25
  import "./chunk-53RJWF2A.js";
26
- import "./chunk-ZEERADTI.js";
26
+ import "./chunk-I5VBP754.js";
27
27
  import "./chunk-L2VARVQP.js";
28
28
  import "./chunk-PQS6DHQP.js";
29
29
  import "./chunk-AKNWNB6A.js";
30
- import "./chunk-LVENLTN6.js";
30
+ import "./chunk-HC2BCDFS.js";
31
31
  import "./chunk-AFRAXU4Y.js";
32
- import "./chunk-C3QJHVOH.js";
33
32
  import "./chunk-FJL3DZQB.js";
34
- import "./chunk-ZIOF5AO6.js";
35
- import "./chunk-MUOTQRR5.js";
33
+ import "./chunk-7G7UOKM4.js";
34
+ import "./chunk-35ZHGX7R.js";
36
35
  import "./chunk-FFIZKGS2.js";
37
36
  import "./chunk-ZJA62LXW.js";
38
37
  import "./chunk-7SQJMUIG.js";
39
38
  import "./chunk-EH6D57EA.js";
40
39
  import "./chunk-6TMH7HCQ.js";
41
- import "./chunk-NH42V7UK.js";
40
+ import "./chunk-JGJZXJRJ.js";
42
41
  import "./chunk-7OJZZPU4.js";
43
42
  import "./chunk-4DCE2NBA.js";
44
- import "./chunk-VRGEEHBR.js";
43
+ import "./chunk-Y7SVEIXZ.js";
45
44
  import "./chunk-PPM77AQB.js";
46
45
  import "./chunk-HU75T2CC.js";
47
46
  import "./chunk-DUH4J3CB.js";
48
- import "./chunk-K63NQAOB.js";
49
- import "./chunk-I5REOOP7.js";
47
+ import "./chunk-XE6NJFI2.js";
48
+ import "./chunk-X4JKF2JG.js";
50
49
  import "./chunk-ECOCNQ6W.js";
51
50
  import "./chunk-VB3ZFOB6.js";
52
51
  import "./chunk-ZVISQBYU.js";
53
52
  import "./chunk-4VF6RACM.js";
54
53
  import "./chunk-GHCOZHSC.js";
55
- import "./chunk-IIPH3CZZ.js";
54
+ import "./chunk-IY5UZMTO.js";
56
55
  import "./chunk-TXEWYX4G.js";
57
56
  import "./chunk-W2RK7P4W.js";
58
57
  import "./chunk-AO3NHCYW.js";
59
58
  import "./chunk-RVNIEOXA.js";
60
59
  import "./chunk-5EEX2536.js";
61
60
  import "./chunk-W2P5XUAY.js";
61
+ import "./chunk-CMOVCY42.js";
62
62
  import "./chunk-OD63RI3Y.js";
63
63
  import "./chunk-A2DCJZGE.js";
64
- import "./chunk-CMOVCY42.js";
65
64
  import "./chunk-BXFKOMNU.js";
66
65
  import "./chunk-YWBO5ISN.js";
67
66
  import "./chunk-4G6BX5RD.js";
@@ -8,9 +8,9 @@ import {
8
8
  confirmTierCommands,
9
9
  dangerousCommands,
10
10
  registerDangerousCommands
11
- } from "./chunk-NAXSGXBD.js";
12
- import "./chunk-ROIDWBDQ.js";
13
- import "./chunk-MEEB2X3B.js";
11
+ } from "./chunk-GYRYPM3N.js";
12
+ import "./chunk-USXZ2Z7E.js";
13
+ import "./chunk-RCYPJTDS.js";
14
14
  import "./chunk-LJZR7CU3.js";
15
15
  import "./chunk-JNBUJE2Z.js";
16
16
  import "./chunk-EGUH2RFR.js";
@@ -30,7 +30,7 @@ import "./chunk-FJL3DZQB.js";
30
30
  import "./chunk-FIJRNTK2.js";
31
31
  import "./chunk-NPFIKFPP.js";
32
32
  import "./chunk-DUH4J3CB.js";
33
- import "./chunk-K63NQAOB.js";
33
+ import "./chunk-XE6NJFI2.js";
34
34
  import "./chunk-VB3ZFOB6.js";
35
35
  import "./chunk-ZVISQBYU.js";
36
36
  import "./chunk-TXEWYX4G.js";
@@ -6,32 +6,31 @@ const __filename = __popcraftPath(import.meta.url);
6
6
  const __dirname = __popcraftDirname(__filename);
7
7
  import {
8
8
  syncStatus
9
- } from "./chunk-UXNXHMBD.js";
10
- import "./chunk-ZBANBY2Q.js";
11
- import "./chunk-QJU5LRJX.js";
9
+ } from "./chunk-K3AZGLLD.js";
10
+ import "./chunk-J6Q7JXER.js";
12
11
  import "./chunk-6TMH7HCQ.js";
13
12
  import "./chunk-HFCMTDPQ.js";
14
- import "./chunk-NH42V7UK.js";
13
+ import "./chunk-JGJZXJRJ.js";
15
14
  import {
16
15
  cloudApi
17
16
  } from "./chunk-7OJZZPU4.js";
18
17
  import "./chunk-4DCE2NBA.js";
19
18
  import "./chunk-LCLQWQO2.js";
20
- import "./chunk-N6T6XKGC.js";
19
+ import "./chunk-ERXWGXIF.js";
21
20
  import {
22
21
  useEditorStore
23
- } from "./chunk-VRGEEHBR.js";
22
+ } from "./chunk-Y7SVEIXZ.js";
24
23
  import "./chunk-PPM77AQB.js";
25
24
  import "./chunk-HU75T2CC.js";
26
25
  import "./chunk-DUH4J3CB.js";
27
- import "./chunk-K63NQAOB.js";
28
- import "./chunk-I5REOOP7.js";
26
+ import "./chunk-XE6NJFI2.js";
27
+ import "./chunk-X4JKF2JG.js";
29
28
  import "./chunk-ECOCNQ6W.js";
30
29
  import "./chunk-VB3ZFOB6.js";
31
30
  import "./chunk-ZVISQBYU.js";
32
31
  import "./chunk-4VF6RACM.js";
33
32
  import "./chunk-GHCOZHSC.js";
34
- import "./chunk-IIPH3CZZ.js";
33
+ import "./chunk-IY5UZMTO.js";
35
34
  import "./chunk-TXEWYX4G.js";
36
35
  import "./chunk-W2RK7P4W.js";
37
36
  import "./chunk-AO3NHCYW.js";
@@ -39,9 +38,9 @@ import "./chunk-MBI3PCPN.js";
39
38
  import "./chunk-RVNIEOXA.js";
40
39
  import "./chunk-5EEX2536.js";
41
40
  import "./chunk-W2P5XUAY.js";
41
+ import "./chunk-CMOVCY42.js";
42
42
  import "./chunk-OD63RI3Y.js";
43
43
  import "./chunk-A2DCJZGE.js";
44
- import "./chunk-CMOVCY42.js";
45
44
  import {
46
45
  cloudUser
47
46
  } from "./chunk-BXFKOMNU.js";