efficient-easel 18.1.0 → 19.0.0

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 (112) hide show
  1. package/README.md +26 -1
  2. package/dist/{CanvasDragLayer-dZCPbQCP.d.ts → CanvasDragLayer-ARfaivCu.d.ts} +21 -3
  3. package/dist/{host-epHo7r8P.d.ts → ScreenDocumentContext-D55vIrG3.d.ts} +208 -208
  4. package/dist/autosave/index.d.ts +4 -4
  5. package/dist/{canvas-typing-BsNigaCa.d.ts → canvas-typing-Be4FO4q7.d.ts} +5 -5
  6. package/dist/chrome/chrome.css +2 -18
  7. package/dist/chrome/index.d.ts +5 -39
  8. package/dist/chrome/index.js +1 -1
  9. package/dist/{chunk-C2RHV42O.js → chunk-23DYNW6S.js} +1 -1
  10. package/dist/chunk-324PHMLC.js +8 -0
  11. package/dist/{chunk-HGV3FWOB.js → chunk-5DPIGWUL.js} +1 -1
  12. package/dist/{chunk-YLQYEDUQ.js → chunk-6DNDTEF6.js} +1 -1
  13. package/dist/chunk-AJSDWWJW.js +1 -0
  14. package/dist/chunk-C56MPJBH.js +1 -0
  15. package/dist/{chunk-N5AN2RF2.js → chunk-CM732ENS.js} +1 -1
  16. package/dist/{chunk-QEAUF632.js → chunk-CPFDJMFD.js} +12 -12
  17. package/dist/{chunk-S4AWJX4Q.js → chunk-EZG3TGQ7.js} +1 -1
  18. package/dist/chunk-EZKUTVQP.js +62 -0
  19. package/dist/{chunk-XHHVMAGM.js → chunk-FGYJ5DJY.js} +1 -1
  20. package/dist/chunk-J4MHNAED.js +5 -0
  21. package/dist/{chunk-VEZPDGDQ.js → chunk-JBOSEHIX.js} +1 -1
  22. package/dist/{chunk-RFE7ZG3Y.js → chunk-JC34NH4G.js} +1 -1
  23. package/dist/chunk-KRL3IUV3.js +1 -0
  24. package/dist/chunk-LNHT2KPX.js +2 -0
  25. package/dist/{chunk-SNB4LQMK.js → chunk-LUBJKUVV.js} +1 -1
  26. package/dist/chunk-M62P4IQK.js +2 -0
  27. package/dist/chunk-MS2U6MV5.js +1 -0
  28. package/dist/{chunk-7TOQCTHV.js → chunk-PY7OOQEZ.js} +3 -3
  29. package/dist/{chunk-KG7RJWOK.js → chunk-RYNBSKE7.js} +1 -1
  30. package/dist/{chunk-XDZHKYQX.js → chunk-SINAM2IT.js} +1 -1
  31. package/dist/{chunk-DXROGLB5.js → chunk-SP3TRDKA.js} +1 -1
  32. package/dist/{chunk-X52NFKUS.js → chunk-T5WDR5IE.js} +1 -1
  33. package/dist/{chunk-4QWTHRMD.js → chunk-WMQKV3DK.js} +4 -4
  34. package/dist/chunk-Z2V3TTAR.js +18 -0
  35. package/dist/chunk-ZG6PVMC3.js +19 -0
  36. package/dist/copy/index.d.ts +7 -7
  37. package/dist/copy/index.js +29 -29
  38. package/dist/drag/drag.css +23 -0
  39. package/dist/drag/index.d.ts +1 -1
  40. package/dist/drag/index.js +1 -1
  41. package/dist/easel/index.d.ts +2 -2
  42. package/dist/easel/index.js +1 -1
  43. package/dist/fields/fields.css +3 -3
  44. package/dist/fields/index.d.ts +1 -1
  45. package/dist/panel/index.d.ts +17 -84
  46. package/dist/panel/index.js +13 -19
  47. package/dist/panel/panel.css +41 -137
  48. package/dist/{panelWidths-D9hTLR25.d.ts → panelWidths-DgQXiPXU.d.ts} +34 -6
  49. package/dist/screen/components/AddBlockRow.js +1 -1
  50. package/dist/screen/components/AddSidePanel.js +1 -1
  51. package/dist/screen/components/MediaPopup.d.ts +21 -0
  52. package/dist/screen/components/MediaPopup.js +1 -0
  53. package/dist/screen/components/NodeContextMenu.d.ts +4 -4
  54. package/dist/screen/components/NodeContextMenu.js +1 -1
  55. package/dist/screen/components/PageEditGuardNotices.js +1 -1
  56. package/dist/screen/components/SaveControls.d.ts +6 -6
  57. package/dist/screen/components/SaveControls.js +1 -1
  58. package/dist/screen/components/ScreenChrome.js +1 -1
  59. package/dist/screen/components/ScreenDocumentContext.d.ts +1 -1
  60. package/dist/screen/components/ScreenDocumentContext.js +1 -1
  61. package/dist/screen/components/ScreenMount.d.ts +8 -8
  62. package/dist/screen/components/ScreenMount.js +1 -1
  63. package/dist/screen/components/ScreenStoreProvider.d.ts +7 -7
  64. package/dist/screen/components/ScreenStoreProvider.js +1 -1
  65. package/dist/screen/components/SectionScreenShell.js +17 -16
  66. package/dist/screen/components/SidePanelHead.js +1 -1
  67. package/dist/screen/components/panel-widths.d.ts +7 -6
  68. package/dist/screen/components/panel-widths.js +1 -1
  69. package/dist/screen/components/usePartBridge.d.ts +7 -7
  70. package/dist/screen/components/usePartBridge.js +1 -1
  71. package/dist/screen/index.d.ts +5 -5
  72. package/dist/screen/index.js +1 -1
  73. package/dist/screen/lib/document-addressing.d.ts +1 -1
  74. package/dist/screen/lib/host-inbound.js +1 -1
  75. package/dist/screen/lib/host.d.ts +5 -5
  76. package/dist/screen/lib/key-scope.js +1 -1
  77. package/dist/screen/lib/media-panel.d.ts +74 -37
  78. package/dist/screen/lib/media-panel.js +1 -1
  79. package/dist/screen/lib/media-picker.d.ts +5 -5
  80. package/dist/screen/lib/media-picker.js +1 -1
  81. package/dist/screen/lib/puck/device-fields.js +1 -1
  82. package/dist/screen/lib/puck/style-clipboard.d.ts +7 -7
  83. package/dist/screen/lib/puck/style-clipboard.js +1 -1
  84. package/dist/screen/lib/puck/use-section-ops.js +1 -1
  85. package/dist/screen/lib/save-status.d.ts +2 -2
  86. package/dist/screen/lib/screen-parts.d.ts +52 -11
  87. package/dist/screen/lib/screen-parts.js +1 -1
  88. package/dist/screen/screen.css +5 -4
  89. package/dist/screen/words.d.ts +3 -0
  90. package/dist/screen/words.js +1 -1
  91. package/dist/strings/index.d.ts +6 -6
  92. package/dist/strings/index.js +2 -2
  93. package/dist/{types-DT8ywrFQ.d.ts → types-B3iSHX-w.d.ts} +2 -22
  94. package/dist/{words-zH1H0WFw.d.ts → words-BeX5eGq7.d.ts} +2 -2
  95. package/dist/words-BpTjCfqO.d.ts +89 -0
  96. package/dist/{words-DkWcK1rh.d.ts → words-Cm8PMYn0.d.ts} +1 -1
  97. package/dist/{words-BpiVrsW5.d.ts → words-DYu4iBrR.d.ts} +1 -21
  98. package/package.json +9 -9
  99. package/dist/chunk-2ZWA6ARJ.js +0 -8
  100. package/dist/chunk-B4JN227A.js +0 -1
  101. package/dist/chunk-GWIVPLOX.js +0 -23
  102. package/dist/chunk-LLDHIBYG.js +0 -18
  103. package/dist/chunk-OBIL7BZO.js +0 -4
  104. package/dist/chunk-QNAPTJRM.js +0 -62
  105. package/dist/chunk-R6WTQWAC.js +0 -2
  106. package/dist/chunk-STWSCR25.js +0 -2
  107. package/dist/chunk-U277UX5I.js +0 -1
  108. package/dist/chunk-W6SDWCOL.js +0 -5
  109. package/dist/chunk-Z6PVRXVY.js +0 -1
  110. package/dist/screen/components/MediaSidePanel.d.ts +0 -49
  111. package/dist/screen/components/MediaSidePanel.js +0 -1
  112. package/dist/words-D-yhjdOg.d.ts +0 -183
@@ -0,0 +1,89 @@
1
+ import { MarkStyle, MarkPlaceholders } from 'efficient-shell/markup';
2
+
3
+ /**
4
+ * The copy box's own words (`efficient-easel/strings`, 0.95.0): the bar's and
5
+ * the alignment strip's name, each mark button's name
6
+ * and tooltip, and the words a mark writes when nothing is selected. The link
7
+ * window is efficient-shell's `LinkPicker`: its words are the shell
8
+ * catalogue's (`ShellStringsProvider`, `link`).
9
+ *
10
+ * NO REACT here, and no import but the grammar: the marks' names, tooltips and
11
+ * placeholders are READ from `efficient-shell/markup` (`MARKUP_TOOLS`,
12
+ * `MARK_PLACEHOLDERS`) rather than typed a second time, so the English lives
13
+ * once, in the grammar, where the campaign designer's own toolbar reads it too.
14
+ */
15
+
16
+ type CopyWords = {
17
+ /** The formatting bar's accessible name. */
18
+ formatting: string;
19
+ /** The alignment strip's accessible name. */
20
+ alignment: string;
21
+ /**
22
+ * Each mark button, for a bar handed STYLES (`tools={['bold', 'link']}`).
23
+ * `name` is what the button is called; `title` its tooltip, which also says
24
+ * what the mark writes and its shortcut. A host's own descriptors
25
+ * (`MarkupTool[]`) are used as given and never read these.
26
+ *
27
+ * @deprecated Read by nothing since the copy box's one bar became the shell's
28
+ * `TextToolbar`, which names its buttons in the shell catalogue
29
+ * (`ShellStringsProvider`, `textToolbar`). Removed in 12.0.0.
30
+ */
31
+ marks: Record<MarkStyle, {
32
+ name: string;
33
+ title: string;
34
+ }>;
35
+ /** What a mark writes when nothing is selected — typed over at once. */
36
+ placeholders: MarkPlaceholders;
37
+ /** The switch under a many-line box that shows the raw text with its marks
38
+ * (E5a). Optional, so a host's words from before still type; English when
39
+ * left out. */
40
+ showMarks?: string;
41
+ /** The colour window: its name, the theme row's label, and Remove. */
42
+ colors?: {
43
+ title: string;
44
+ theme: string;
45
+ remove: string;
46
+ /** "Any color": the square, the hue bar and the hex box under the theme. */
47
+ any: string;
48
+ square: string;
49
+ hue: string;
50
+ hex: string;
51
+ };
52
+ /** The one text panel's rows (`TextPartPanel`, text panel v3) and their
53
+ * answers. Optional, so a host's words from before still type; English when left
54
+ * out. */
55
+ panel?: {
56
+ style: string;
57
+ editStyles: string;
58
+ updateStyle: string;
59
+ font: string;
60
+ italic: string;
61
+ list: string;
62
+ lists: {
63
+ none: string;
64
+ bullet: string;
65
+ number: string;
66
+ };
67
+ capitalization: string;
68
+ cases: {
69
+ none: string;
70
+ upper: string;
71
+ capitalize: string;
72
+ lower: string;
73
+ };
74
+ };
75
+ /** The number cells' names, and the tooltip each one carries. */
76
+ cells?: {
77
+ fontSize: string;
78
+ lineHeight: string;
79
+ letterSpacing: string;
80
+ paragraphSpacing: string;
81
+ tip: (v: {
82
+ name: string;
83
+ step: number;
84
+ unit: string;
85
+ }) => string;
86
+ };
87
+ };
88
+
89
+ export type { CopyWords as C };
@@ -1,4 +1,4 @@
1
- import { S as SaveTone } from './types-DT8ywrFQ.js';
1
+ import { S as SaveTone } from './types-B3iSHX-w.js';
2
2
  import { A as AutosaveSnapshot } from './engine-CvXpFE86.js';
3
3
 
4
4
  /**
@@ -82,28 +82,8 @@ type ChromeWords = {
82
82
  partOf: (v: {
83
83
  name: string;
84
84
  }) => string;
85
- /** `MediaPanelHead`, browsing: the panel's name. */
85
+ /** The media library's name, as the host's window is asked for it. */
86
86
  mediaLibrary: string;
87
- /** `MediaPanelHead`, choosing: the panel's name. `kind` is a `mediaKinds` word. */
88
- mediaChoose: (v: {
89
- kind: string;
90
- }) => string;
91
- /** `MediaPanelHead`, choosing: the line under the name. `field` is the host's label for the field. */
92
- mediaFor: (v: {
93
- field: string;
94
- }) => string;
95
- /** What a field can hold, as the head says it, by `MediaPickKind`. */
96
- mediaKinds: {
97
- image: string;
98
- video: string;
99
- svg: string;
100
- };
101
- /** `MediaPanelHead`: the word that leaves choosing. */
102
- mediaCancel: string;
103
- /** `MediaPanelHead`: Cancel's tooltip. `kind` is a `mediaKinds` word. */
104
- mediaKeep: (v: {
105
- kind: string;
106
- }) => string;
107
87
  /** The Hide panel button at the end of a side panel's head: the tooltip. */
108
88
  hidePanel: string;
109
89
  /** The same button: its accessible name. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efficient-easel",
3
- "version": "18.1.0",
3
+ "version": "19.0.0",
4
4
  "description": "Efficient Easel: the EFFICIENT editors' shared engine and chrome: the saved document as pure functions, the published renderer, and the editor frame, panels, Layers tree, text grammar and type-in-place box. Published as editor-shell up to 0.66.0 and as efficient-editor up to 0.95.0.",
5
5
  "license": "UNLICENSED",
6
6
  "author": "Efficient Pty Ltd",
@@ -25,6 +25,7 @@
25
25
  "./draw",
26
26
  "./draw/client",
27
27
  "./blocks",
28
+ "./text-styles/model",
28
29
  "./screen/lib/session",
29
30
  "./screen/components/PreviewDeviceContext",
30
31
  "./screen/components/UiIcon",
@@ -46,7 +47,6 @@
46
47
  "./pick",
47
48
  "./fields",
48
49
  "./text-styles",
49
- "./text-styles/model",
50
50
  "./easel",
51
51
  "./autosave",
52
52
  "./canvas",
@@ -57,7 +57,7 @@
57
57
  "./screen/components/AddBlockRow",
58
58
  "./screen/components/AddChildRow",
59
59
  "./screen/components/AddSidePanel",
60
- "./screen/components/MediaSidePanel",
60
+ "./screen/components/MediaPopup",
61
61
  "./screen/components/NodeContextMenu",
62
62
  "./screen/components/PageEditGuardNotices",
63
63
  "./screen/components/PanelToggleIcon",
@@ -272,10 +272,10 @@
272
272
  "import": "./dist/screen/components/AddSidePanel.js",
273
273
  "default": "./dist/screen/components/AddSidePanel.js"
274
274
  },
275
- "./screen/components/MediaSidePanel": {
276
- "types": "./dist/screen/components/MediaSidePanel.d.ts",
277
- "import": "./dist/screen/components/MediaSidePanel.js",
278
- "default": "./dist/screen/components/MediaSidePanel.js"
275
+ "./screen/components/MediaPopup": {
276
+ "types": "./dist/screen/components/MediaPopup.d.ts",
277
+ "import": "./dist/screen/components/MediaPopup.js",
278
+ "default": "./dist/screen/components/MediaPopup.js"
279
279
  },
280
280
  "./screen/components/NodeContextMenu": {
281
281
  "types": "./dist/screen/components/NodeContextMenu.d.ts",
@@ -627,7 +627,7 @@
627
627
  "dist"
628
628
  ],
629
629
  "peerDependencies": {
630
- "efficient-shell": "^8.20.0",
630
+ "efficient-shell": "^8.39.0",
631
631
  "react": ">=18",
632
632
  "react-dom": ">=18"
633
633
  },
@@ -637,7 +637,7 @@
637
637
  "@types/node": "^22.0.0",
638
638
  "@types/react": "^18.2.0",
639
639
  "@types/react-dom": "^18.2.0",
640
- "efficient-shell": "^8.20.0",
640
+ "efficient-shell": "^8.39.0",
641
641
  "esbuild": "^0.27.0",
642
642
  "jsdom": "^26.1.0",
643
643
  "react": "^18.2.0",
@@ -1,8 +0,0 @@
1
- import{buildPaletteSections as e,pinnedSection as t,categoryLabel as n}from"./chunk-PA3PNTVV.js";import{blockTypesIn as o}from"./chunk-5ZBY24K7.js";import{sectionTemplatesOf as l}from"./chunk-BVN33R76.js";import{sharedSectionsOf as r}from"./chunk-43AEUUNQ.js";import{SidePanelHead as i,PanelModeExit as s}from"./chunk-XDZHKYQX.js";import{blockRuns as c}from"./chunk-M2Z775ZC.js";import{useScreenBlockLook as a,useScreenBlockRules as d,useScreenPinned as p}from"./chunk-W6SDWCOL.js";import{useEaselSession as m}from"./chunk-O7Q4DDJT.js";import{DEFAULT_SCREEN_WORDS as f}from"./chunk-C2RHV42O.js";import{useEasel as u}from"./chunk-QEAUF632.js";import{easelMenuEntries as y}from"./chunk-BALFHI3G.js";import{useWords as h}from"./chunk-MFIRYGHW.js";import{AddPanel as k}from"./chunk-LLDHIBYG.js";import{DEFAULT_DRAG_WORDS as g}from"./chunk-KAML3KQH.js";import{useState as b,useEffect as v,useMemo as j,useRef as C}from"react";import{SharedIcon as w,AddIcon as L}from"efficient-shell/icons/efficient";import{ContextMenu as A,toast as D,Dialog as H,Button as O}from"efficient-shell/ui";import{jsx as $,jsxs as x,Fragment as B}from"react/jsx-runtime";function E({name:e,pages:t,onDelete:n,onCancel:o}){const l=h("screen",f).shared,[r,i]=b(!1),s=C(null);/* @__PURE__ */
2
- return $(H,{open:!0,role:"alertdialog",size:"sm",title:l.deleteTitle({name:e}),onClose:o,initialFocus:s,footer:/* @__PURE__ */x(B,{children:[
3
- /* @__PURE__ */$(O,{ref:s,variant:"secondary",onClick:o,children:l.cancel}),
4
- /* @__PURE__ */$(O,{variant:"danger",loading:r,onClick:()=>{(async()=>{i(!0);try{await n()}finally{i(!1)}})()},children:l.deleteShared})]}),children:l.deleteMessage({count:t})})}var F=e=>`section:${e}`,T=e=>`block:${e}`,I=e=>`template:${e}`,M=e=>`shared:${e}`;function N({at:C,placeBlocks:H,canTake:O,onPick:N,itemFor:Q,session:S,siteWide:W,onClose:z,onHide:K,readOnly:P}){const R=u(e=>e.config),V=a(),{labelAtLevel:Y,categoryLabel:Z,firstSection:G,Icon:U,Thumbnail:X}=V,{blockIsOffered:_,canAddTo:J}=d(),q=h("screen",f).add,ee=h("drag",g).add,te=m(),[ne,oe]=b([]);v(()=>{let e=!1;const t=e=>_(e,te);return l(te).list().then(n=>{if(e)return;const l=R.components;oe(n.filter(e=>e.node?.type&&l[e.node.type]&&o(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[R,te]);const le=p().shared,re=h("screen",f).shared,[ie,se]=b([]),[ce,ae]=b(0);v(()=>{if(!le)return;let e=!1;const t=e=>_(e,te);return r(te).list().then(n=>{if(e)return;const l=R.components;se(n.filter(e=>e.node?.type&&l[e.node.type]&&o(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[R,te,ce]);const[de,pe]=b(null),[me,fe]=b(null),ue=j(()=>e(R,V),[R]),ye=e=>Y(e,"section",R.components[e]?.label??e),he=e=>({type:F(e.type),label:e.name,cover:/* @__PURE__ */$(X,{type:e.type}),title:e.desc?`${e.name} — ${e.desc}`:q.tile({name:e.name}),keywords:[e.alias??"",e.desc,e.type,e.catLabel].filter(Boolean)}),ke=e=>{const t=e.indexOf(":"),n=e.slice(0,t),o=e.slice(t+1);if("section"===n)return{kind:"section",type:o};if("block"===n)return{kind:"block",type:o};if("template"===n){const e=ne.find(e=>e.id===o);return e?{kind:"template",template:e}:null}if("shared"===n){const e=ie.find(e=>e.id===o);return e?{kind:"shared",section:e}:null}return null},ge=e=>/* @__PURE__ */$("span",{className:"es-add-glyph-cover",children:/* @__PURE__ */$(U,{type:e,size:26})}),be=j(()=>{const e=t(ue,G),o=/* @__PURE__ */new Map,l=e=>{e.retired||o.has(e.type)||!_(e.type,te)||o.set(e.type,e)};for(const t of e?[e]:ue){const e=J(t.type)?.choices??[];e.forEach(l),e.forEach(e=>J(e.type,1)?.choices?.forEach(l))}H?.forEach(l);const r=new Set(ue.map(e=>e.type)),i=[...o.values()].filter(e=>!r.has(e.type)),s=e=>({type:T(e.type),label:e.label,cover:ge(e.type),title:q.tile({name:e.label}),keywords:[e.group??"",e.type].filter(Boolean)}),a=e=>o.has(e.type)?{...he(e),cover:ge(e.type)}:he(e),d=[];ie.length>0&&d.push({key:"shared",title:re.group,tiles:ie.map(e=>({type:M(e.id),label:e.title,cover:/* @__PURE__ */$(X,{type:e.node.type}),mark:/* @__PURE__ */$(w,{size:12}),title:re.onPages({count:e.used_on.length}),keywords:[ye(e.node.type),e.node.type]}))}),ne.length>0&&d.push({key:"templates",title:q.templates,tiles:ne.map(e=>({type:I(e.id),label:e.name,cover:/* @__PURE__ */$(X,{type:e.node.type}),keywords:[ye(e.node.type),e.node.type]}))});const p=i.filter(e=>!e.group);let m=!1;for(const t of Object.keys(R.categories??{})){const o=ue.filter(e=>e.cat===t);if(0===o.length)continue;const l=e&&o.some(t=>t.type===e.type)?e:null,r=(l?[l,...o.filter(e=>e.type!==l.type)]:o).map(a);l&&!m&&(r.splice(1,0,...p.map(s)),m=!0),d.push({key:`category:${t}`,title:n(R,t,Z),tiles:r})}const f=d.find(e=>e.key?.startsWith("category:"));if(!m&&f&&p.length>0&&(f.tiles=[...f.tiles,...p.map(s)],m=!0),c(i.filter(e=>e.group||!m)).forEach((e,t)=>{d.push({key:`blocks:${t}`,title:e.group??"",tiles:e.items.map(s)})}),!O)return d;const u=d.map(e=>({...e,tiles:e.tiles.map(e=>{const t=ke(e.type),n=t?O(t):null;return n?{...e,disabled:!0,disabledReason:n}:e})})),y=e=>e.tiles.some(e=>!e.disabled);return[...u.filter(y),...u.filter(e=>!y(e))]},[ne,ie,re,ue,R,q,O,H,te]);/* @__PURE__ */
5
- return x(B,{children:[
6
- /* @__PURE__ */$(i,{icon:/* @__PURE__ */$(L,{size:15}),title:q.title,context:q.contextAll,actions:/* @__PURE__ */$(s,{label:q.done,description:q.doneDescription,onClick:z}),onHide:K}),
7
- /* @__PURE__ */x("div",{className:"sf-addside sf-scroll",children:[
8
- /* @__PURE__ */$(k,{groups:be,session:S,itemFor:e=>Q(ke(e)??{kind:"section",type:e}),onInsert:N?e=>{const t=ke(e);t&&N(t)}:void 0,onTileMenu:(e,t)=>{const n=ke(e);return"shared"===n?.kind&&!P&&(pe({section:n.section,...t}),!0)},at:C,hint:q.hint,searchLabel:q.search,readOnly:P,words:ee}),W??null]}),de?/* @__PURE__ */$(A,{at:{x:de.x,y:de.y},owner:de.owner,onClose:()=>pe(null),"aria-label":de.section.title,items:y([{label:re.deleteShared,danger:!0,onClick:()=>{fe(de.section),pe(null)}}])}):null,me?/* @__PURE__ */$(E,{name:me.title,pages:me.used_on.length,onDelete:()=>(async e=>{try{await r(te).remove(e.id)}catch{return void D.error(re.deleteFailed)}fe(null),le?.removed?.(e),se(t=>t.filter(t=>t.id!==e.id)),ae(e=>e+1)})(me),onCancel:()=>fe(null)}):null]})}export{N as AddSidePanel,T as blockKey,F as sectionKey,M as sharedKey,I as templateKey};
@@ -1 +0,0 @@
1
- import{MARKUP_TOOLS as e,MARK_PLACEHOLDERS as t}from"efficient-shell/markup";var i={formatting:"Formatting",alignment:"Alignment",align:{left:"Left",center:"Center",right:"Right",justify:"Justify"},marks:{...Object.fromEntries(e.map(e=>[e.style,{name:e.name??e.title,title:e.title}])),underline:{name:"Underline",title:"Underline · [words]{underline}"},sup:{name:"Superscript",title:"Superscript · [words]{sup}"},sub:{name:"Subscript",title:"Subscript · [words]{sub}"}},placeholders:t,showMarks:"Show marks",colors:{title:"Color",theme:"Theme colors",remove:"Remove",any:"Any color",square:"Saturation and brightness",hue:"Hue",hex:"Hex color"},panel:{style:"Style",editStyles:"Edit styles",updateStyle:"Update style",font:"Font",italic:"Italic",list:"List",lists:{none:"No list",bullet:"Bulleted",number:"Numbered"},capitalization:"Capitalization",cases:{none:"As typed",upper:"Uppercase",capitalize:"Capitalized",lower:"Lowercase"}},cells:{fontSize:"Font size",lineHeight:"Line spacing",letterSpacing:"Letter spacing",paragraphSpacing:"Paragraph spacing",tip:({name:e,step:t,unit:i})=>`${e} · step ${t} ${i} · Shift ×10`}};export{i as DEFAULT_COPY_WORDS};
@@ -1,23 +0,0 @@
1
- import{EaselRail as e}from"./chunk-MJM6SFD3.js";import{DEFAULT_NOTICE_WORDS as n,DEFAULT_CHROME_WORDS as i}from"./chunk-Z6PVRXVY.js";import{DEFAULT_RAIL_WORDS as a}from"./chunk-2OAZYSWJ.js";import{holderOf as t,describeAge as s,nameOrSomeone as l}from"./chunk-THWO5YVZ.js";import{DEFAULT_LOCK_WORDS as r}from"./chunk-RE4LP46F.js";import{useWords as o}from"./chunk-MFIRYGHW.js";import{jsx as c,jsxs as d,Fragment as u}from"react/jsx-runtime";import{Tooltip as h,IconButton as m,Segmented as p,Switch as v,SpinnerRing as f,ResizeHandle as k,Button as b,Banner as g}from"efficient-shell/ui";import{useState as y,useEffect as N}from"react";import{LockIcon as w,CloudPauseIcon as O,CloudSlashIcon as C,CloudAlertIcon as x,CloudArrowUpIcon as z,CloudCheckIcon as B,PanelLeftIcon as R,PanelRightIcon as L,MediaIcon as $,ImageIcon as S}from"efficient-shell/icons/efficient";function W({children:e}){/* @__PURE__ */
2
- return c("div",{className:"es-topbar",children:e})}function j({kind:e,style:n,children:i}){/* @__PURE__ */
3
- return c("div",{className:e?`es-cluster es-cluster--${e}`:"es-cluster",style:n,children:i})}function M(){/* @__PURE__ */
4
- return c("div",{className:"es-divider-v","aria-hidden":"true"})}function P({items:n,ariaLabel:i,onWords:t}){const s=o("rail",a);/* @__PURE__ */
5
- return c("div",{className:"es-cluster es-cluster--rail es-rail-fit",children:/* @__PURE__ */c(e,{items:n,ariaLabel:i??s.label,orientation:"row",onLabelsShown:t})})}function Y({label:e,tip:n,onClick:i,disabled:a,state:t,buttonRef:s,children:l}){/* @__PURE__ */
6
- return c(h,{content:n??e,side:"bottom",children:/* @__PURE__ */c(m,{ref:s,"aria-label":e,"aria-pressed":t?"active"===t:void 0,className:"es-iconbtn",disabled:a,onClick:i,children:l})})}function T({devices:e,value:n,onChange:a,ariaLabel:t}){const s=o("chrome",i);/* @__PURE__ */
7
- return c(p,{className:"es-devseg",size:"sm",label:t??s.device,value:n,onChange:e=>{e!==n&&a(e)},options:e.map(e=>({value:e.id,icon:/* @__PURE__ */c(h,{content:e.label,side:"bottom",children:/* @__PURE__ */c("span",{className:"es-devseg-glyph","aria-hidden":"true",children:e.icon})}),label:/* @__PURE__ */c("span",{className:"es-vh",children:e.label})}))})}var F={idle:"is-quiet",saved:"is-quiet is-saved",saving:"is-saving",error:"is-error",off:"is-off","off-unsaved":"is-off is-unsaved"};function H({tone:e,label:n,counting:i,waitMs:a,ringRef:t,role:s}){/* @__PURE__ */
8
- return d("span",{className:`es-savestate ${F[e]}`,role:s,"aria-live":"polite",children:[/* @__PURE__ */c("span",i?{ref:t,className:"es-savestate-ring is-counting",style:void 0!==a?{"--es-savewait":`${a}ms`}:void 0,"aria-hidden":"true"}:{className:"es-savestate-dot","aria-hidden":"true"}),n]})}function V({pressed:e,title:n,onToggle:i,children:a}){/* @__PURE__ */
9
- return c("span",{className:"es-savestate-toggle",children:/* @__PURE__ */c(h,{content:n,side:"bottom",children:/* @__PURE__ */c(v,{size:"sm",checked:!e,"aria-label":n,label:a,onChange:()=>i()})})})}var I={saved:{glyph:()=>/* @__PURE__ */c(B,{}),tone:"muted"},saving:{glyph:()=>/* @__PURE__ */c(f,{className:"",ink:"",style:{width:20,height:20}}),tone:"muted"},pending:{glyph:()=>/* @__PURE__ */c(z,{}),tone:"muted"},failed:{glyph:()=>/* @__PURE__ */c(x,{}),tone:"danger"},offline:{glyph:()=>/* @__PURE__ */c(C,{}),tone:"warning"},paused:{glyph:()=>/* @__PURE__ */c(O,{}),tone:"warning"},locked:{glyph:()=>/* @__PURE__ */c(w,{}),tone:"warning"}},Z=e=>I[e].tone;function q({state:e,label:n}){const i=I[e],[a,t]=y(n);return N(()=>t(n),[e]),/* @__PURE__ */d("span",{className:"es-saveicon-wrap",children:[
10
- /* @__PURE__ */c(h,{content:n,side:"bottom",describe:!1,children:/* @__PURE__ */c("span",{className:"es-saveicon",role:"img","aria-label":n,tabIndex:0,"data-save-state":e,"data-tone":i.tone,children:i.glyph()})}),
11
- /* @__PURE__ */c("span",{className:"es-vh",role:"status","aria-live":"polite",children:a})]})}function A({side:e,width:n,min:a,max:t,defaultWidth:s,label:l,onResize:r}){const d=o("chrome",i);/* @__PURE__ */
12
- return c(k,{side:e,width:n,min:a,max:t,defaultWidth:s,label:l,hint:d.resize,onResize:e=>r(e),className:`es-resizer es-resizer--${e}`})}function D({icon:e,name:n,kind:i,actions:a}){/* @__PURE__ */
13
- return d("div",{className:"es-insp-head",children:[
14
- /* @__PURE__ */c("span",{className:"es-insp-chip","aria-hidden":"true",children:e}),
15
- /* @__PURE__ */d("div",{className:"es-insp-titles",children:[
16
- /* @__PURE__ */c(h,{content:n,describe:!1,side:"bottom",className:"es-insp-name-tip",children:/* @__PURE__ */c("h2",{className:"es-insp-name",children:n})}),
17
- /* @__PURE__ */c("div",{className:"es-insp-kind",children:i})]}),a?/* @__PURE__ */c("div",{className:"es-insp-actions",children:a}):null]})}function J({label:e,title:n,hasPopup:i,onClick:a,disabled:t,danger:s,expanded:l,buttonRef:r,children:o}){/* @__PURE__ */
18
- return c(h,{content:n??e,side:"bottom",children:/* @__PURE__ */c(m,{ref:r,variant:s?"ghost-danger":"ghost",className:"es-insp-iconbtn","aria-label":e,"aria-haspopup":i,"aria-expanded":l,disabled:t,onClick:a,children:o})})}function K({name:e,onSelect:n,label:a,inline:t}){const s=o("chrome",i),l=a??s.upLevel,r=/* @__PURE__ */c(h,{content:l,side:"bottom",children:/* @__PURE__ */c(b,{variant:"link",size:"sm",className:"es-insp-up-btn","aria-label":s.upLevelTo({label:l,name:e}),leftIcon:/* @__PURE__ */c("span",{className:"es-insp-up-arrow","aria-hidden":"true",children:"←"}),onClick:n,children:/* @__PURE__ */c("span",{className:"es-insp-up-name",children:e})})});return t?r:/* @__PURE__ */c("div",{className:"es-insp-up",children:r})}function E({name:e,tier:n,of:a},t){const s={...i,...t};return{name:e,kind:"section"===n?s.tierSection:"block"===n?s.tierBlock:a?s.partOf({name:a}):s.tierBlock}}function G({context:e,pick:n,onCancel:a,onHide:t,side:s="left"}){const l=o("chrome",i),r=t?/* @__PURE__ */c(J,{label:l.hidePanelLabel({side:s}),title:l.hidePanel,onClick:t,children:/* @__PURE__ */c("left"===s?R:L,{size:16})}):null;if(!n)/* @__PURE__ */
19
- return c(D,{icon:/* @__PURE__ */c($,{}),name:l.mediaLibrary,kind:e,actions:r??void 0});const m=l.mediaKinds[n.kind];/* @__PURE__ */
20
- return c(D,{icon:/* @__PURE__ */c(S,{size:15}),name:l.mediaChoose({kind:m}),kind:n.field?l.mediaFor({field:n.field}):e,actions:/* @__PURE__ */d(u,{children:[
21
- /* @__PURE__ */c(h,{content:l.mediaKeep({kind:m}),side:"bottom",children:/* @__PURE__ */c(b,{variant:"secondary",size:"sm",className:"es-insp-textbtn",onClick:a,children:l.mediaCancel})}),r?/* @__PURE__ */d(u,{children:[
22
- /* @__PURE__ */c("span",{className:"es-insp-divider","aria-hidden":"true"}),r]}):null]})})}function X(e){return/svg/i.test(e)?"svg":e.startsWith("video")?"video":"image"}var Q={notice:n,lock:r};function U(e,n,i,a=Q){const r=a.notice,o=t(e),c={kind:"reload",label:r.reload};if(n){const e=s(n.secondsAgo,a.lock);return{tone:"warning",urgent:!0,lead:n.savedByYou?r.savedByYou({noun:i,when:e}):r.savedByOther({name:l(n.savedBy,a.lock),noun:i,when:e}),body:r.conflictBody,actions:o?[c,{kind:"take-over",label:r.takeOver,title:r.takeOverWhileDeciding}]:[c]}}if(!o)return null;const d=l(o.name,a.lock),u=s(o.secondsSinceSeen,a.lock);switch(e.kind){case"takenover":return{tone:"warning",urgent:!0,lead:r.tookOver({name:d,noun:i,when:s(o.secondsSinceHeld,a.lock)}),body:r.tookOverBody,actions:[{kind:"take-back",label:r.takeBack},c]};case"readonly":return{tone:"neutral",urgent:!1,lead:r.viewingOnly,body:r.viewingOnlyBody({name:d,noun:i,seen:u}),actions:[{kind:"take-over",label:r.takeOver}]};default:return{tone:"warning",urgent:!1,lead:r.editing({name:d,noun:i}),body:r.editingBody({seen:u}),actions:[{kind:"view-read-only",label:r.viewReadOnly},{kind:"take-over",label:r.takeOver,title:r.takeOverTold}]}}}function _({access:e,conflict:i,noun:a,onTakeOver:t,onViewReadOnly:s,onReload:l}){const d=U(e,i,a,{notice:o("notice",n),lock:o("lock",r)});if(!d)return null;const u={reload:l,"take-over":t,"take-back":t,"view-read-only":s},m=d.actions.map(e=>e.title?/* @__PURE__ */c(h,{content:e.title,side:"bottom",children:/* @__PURE__ */c(b,{variant:"secondary",size:"sm",onClick:u[e.kind],children:e.label})},e.kind):/* @__PURE__ */c(b,{variant:"secondary",size:"sm",onClick:u[e.kind],children:e.label},e.kind));/* @__PURE__ */
23
- return c("div",{className:`es-notice is-${d.tone}`,role:d.urgent?"alert":"status",children:/* @__PURE__ */c(g,{tone:"warning"===d.tone?"warning":"info",title:d.lead,action:/* @__PURE__ */c("span",{className:"es-notice-actions",children:m}),children:d.body})})}var ee={left:288,right:320},ne=220,ie=560;function ae(e){return Math.min(560,Math.max(220,Math.round(e)))}function te(e){return{"--es-left-w":`${e.left}px`,"--es-right-w":`${e.right}px`}}function se(e,n){e.style.setProperty("--es-left-w",`${n.left}px`),e.style.setProperty("--es-right-w",`${n.right}px`)}export{ee as DEFAULT_PANEL_W,T as DeviceSwitch,Y as EaselIconButton,W as EaselTopBar,_ as EditNotice,D as InspectorHead,J as InspectorIconButton,K as InspectorUpLevel,ie as MAX_PANEL_W,ne as MIN_PANEL_W,G as MediaPanelHead,A as PanelResizeHandle,q as SaveIcon,H as SaveState,V as SaveStateToggle,j as TopBarCluster,M as TopBarDivider,P as TopBarRail,ae as clampPanelWidth,U as editNotice,E as headWords,X as mediaPickKind,te as panelWidthVars,Z as saveIconTone,se as setPanelWidthVars};
@@ -1,18 +0,0 @@
1
- import{DEFAULT_DRAG_WORDS as e}from"./chunk-KAML3KQH.js";import{dropEffectFor as t,scrollBoxOf as n,frameScrollBox as l,startAutoScroll as a,isNoOpDrop as r}from"./chunk-67GNT6PF.js";import{withTip as i}from"./chunk-P2VEMZH5.js";import{useCanvasLayout as s,useCanvasTyping as o,useCanvasEvent as c,CANVAS_TYPABLE_EVENT as d,framePointToHost as u,elementScale as h,frameRectToLayer as f,clientPointToLayer as p}from"./chunk-X4T6JT3M.js";import{parseZoneKey as m}from"./chunk-KRXQM65X.js";import{useRef as g,useEffect as x,useState as b,useCallback as y,useMemo as v,useSyncExternalStore as w,useId as k,useLayoutEffect as N}from"react";import{Tooltip as A,IconButton as z,solidSurfaceStyle as D,Input as T}from"efficient-shell/ui";import{AddIcon as M,CloseIcon as $,SearchIcon as C}from"efficient-shell/icons/efficient";import{jsxs as S,jsx as E}from"react/jsx-runtime";function j({label:e,onInsert:t,style:n,axis:l="y",className:a,index:r}){const i=["es-canvas-insert","x"===l?"is-x":"",a??""].filter(Boolean).join(" ");/* @__PURE__ */
2
- return S("div",{className:i,style:n,"data-index":r,children:[
3
- /* @__PURE__ */E("span",{className:"es-canvas-insert-line","aria-hidden":"true"}),
4
- /* @__PURE__ */E("span",{className:"es-canvas-insert-chip",children:/* @__PURE__ */E(A,{content:e,children:/* @__PURE__ */E(z,{variant:"ghost",size:"sm","aria-label":e,onClick:t,children:/* @__PURE__ */E(M,{})})})})]})}var L=(e,t,n)=>t>=e.left&&t<=e.left+e.width&&n>=e.top&&n<=e.top+e.height,K=e=>e.width*e.height;function B(e,t,n){return e.map((e,t)=>({s:e,at:t})).filter(({s:e})=>L(e.box,t,n)).sort((e,t)=>K(t.s.box)-K(e.s.box)||e.at-t.at).map(({s:e})=>e)}function X(e,t,n){return B(e,t,n).at(-1)??null}function q(e,t,n){const l="x"===e.axis?t:n;let a=0;for(const t of e.children){l>("x"===e.axis?t.left+t.width/2:t.top+t.height/2)&&(a+=1)}return a}function I(e,t){const n=e.children;if("x"===e.axis){const l=n[t-1],a=n[t],r=l&&a?(l.left+l.width+a.left)/2:l?l.left+l.width:a?a.left:e.box.left,i=a??l??e.box;return{left:r-1,top:i.top,width:2,height:i.height}}const l=n[t-1],a=n[t],r=l&&a?(l.top+l.height+a.top)/2:l?l.top+l.height:a?a.top:e.box.top;return{left:e.box.left,top:r-1,width:e.box.width,height:2}}function O(e,t,n,l,a=()=>!1,r=()=>!0){const i=e.filter(e=>L(e.box,t,n)).sort((e,t)=>K(e.box)-K(t.box));for(const e of i){const i=q(e,t,n),s={...e.list,index:i};if(a(s))return null;if(l(s))return{zone:e,to:s,line:I(e,i)};if(!r(s))return null}return null}function P(e,t,n=12){const l=e.children;if(0===l.length)return[];const a=e.box,r="x"===e.axis,i=r?a.left:a.top,s=i+(r?a.width:a.height),o=e=>r?e.left:e.top,c=e=>r?e.left+e.width:e.top+e.height,d=[];for(let u=0;u<=l.length;u++){const h=l[u-1],f=l[u];let p,m;if(h&&f)p=c(h),m=Math.max(o(f)-p,0);else{const e=h?(c(h)+s)/2:(i+o(f))/2;p=Math.min(Math.max(e,i+n),s-n),m=0}const g=r?{left:p,top:a.top,width:m,height:a.height}:{left:a.left,top:p,width:a.width,height:m};d.push({key:`${e.key}:+${u}`,place:{...e.list,index:u},box:g,axis:e.axis,label:t})}return d}function H(e,t=e.key){const n=[];for(let l=1;l<e.children.length;l++){const a=e.children[l-1],r=e.children[l],i=a.top+a.height;n.push({key:`${t}:${l}`,place:{...e.list,index:l},box:{left:e.box.left,top:i,width:e.box.width,height:Math.max(r.top-i,0)}})}return n}var R={nodes:[],zones:[]},Y="data-puck-dropzone",Z="data-puck-component";function F(e,t){if(e.length>=2){const[t,n]=e;return Math.abs(n.top-t.top)<Math.min(t.height,n.height)/2&&n.left>t.left?"x":"y"}const n=t.ownerDocument.defaultView?.getComputedStyle(t);return n&&n.display.includes("flex")&&n.flexDirection.startsWith("row")?"x":"y"}function Q(e,t){const{frame:n,document:l}=e,a=e=>f(n,function(e){const t=e.getBoundingClientRect();return{left:t.left,top:t.top,width:t.width,height:t.height}}(e),t),r=[],i=[];for(const e of l.querySelectorAll(`[${Y}]`)){const t=e.getAttribute(Y)??"";let n;try{n=m(t)}catch{continue}const l=[...e.querySelectorAll(`[${Z}]`)].filter(t=>t.parentElement?.closest(`[${Y}]`)===e),s=l.map(a);i.push({key:t,list:n,box:a(e),axis:F(s,e),children:s}),l.forEach((e,t)=>{const l=e.getAttribute(Z);l&&r.push({id:l,place:{...n,index:t},box:s[t]})})}return{nodes:r,zones:i}}var V="data-es-empty-cell",G="data-puck-dropzone",J=140;var W=e=>({left:e.left,top:e.top,width:e.width,height:e.height});function U(i){const{canvas:f,session:m,readOnly:k,words:z=e.canvas}=i,T=g(i);x(()=>{T.current=i});const M=g(null),$=s(f),[C,L]=b(0),K=y(()=>L(e=>e+1),[]),[X,q]=b(R);x(()=>{const e=M.current;f&&e&&q((T.current.measure??Q)(f,e))},[f,$,i.revision,C]);const I=i.model,P=v(()=>I(X),[I,X]),H=w(m.subscribe,m.shown,m.shown),Y=i.choose,Z=(e,t)=>{const n=B(P.sources,e,t);return 0===n.length?null:Y?Y(n):n[n.length-1]},[F,J]=b(null),[U,_]=b(null),ee=g(null),te=()=>{ee.current&&clearTimeout(ee.current),ee.current=null},ne=()=>{te(),ee.current=setTimeout(()=>{m.get()||J(null)},140)};x(()=>te,[]);const le=g(null),ae=o(f),re=g(!1);re.current=ae,x(()=>{ae&&(te(),J(null))},[ae]);const[ie,se]=b(null);c(f,d,e=>se(e.detail?.id??null));const oe=!ie||ae||k||H?null:X.nodes.find(e=>e.id===ie)?.box??null;c(f,"mousemove",e=>{const t=M.current;if(!f||!t)return;const n=u(f.frame,e.clientX,e.clientY,t),l=h(t),a={x:n.x/l,y:n.y/l};if(le.current=a,T.current.readOnly||m.get()||re.current)return;te();const r=Z(a.x,a.y);J(e=>e?.key===r?.key&&e?.box===r?.box?e:r)}),c(f,"mouseout",e=>{e.relatedTarget||(le.current=null,ne())}),c(f,"mouseover",e=>{e.relatedTarget||K()});const ce=g(null),de=y(()=>{ce.current?.(),ce.current=null,_(null)},[]);x(()=>m.subscribe(()=>{m.get()?K():de()}),[m,de,K]),x(()=>de,[de]),("undefined"==typeof document?x:N)(()=>{if(m.get())return;const e=le.current;J(t=>k||re.current?null:e?Z(e.x,e.y):t?P.sources.find(e=>e.key===t.key)??null:null)},[P,H,m,k,Y]);const ue=e=>{const t=m.get(),n=M.current;if(!t||!n)return null;const l=p(n,e.clientX,e.clientY);le.current=l;const a=O(P.zones,l.x,l.y,e=>T.current.canDrop(t.item,e),e=>!!t.from&&r(t.from,e),e=>T.current.fallThrough?.(t.item,e,t.from)??!0);return a?{h:t,t:a}:null},he={onDragEnter:e=>{if(ce.current)return;const t=n(e.currentTarget.parentElement?.parentElement??null),r=f?l(f.document):null,i=[];t&&i.push(a(t)),r&&f&&i.push(a(r,f.frame)),ce.current=i.length?()=>i.forEach(e=>e()):null},onDragOver:e=>{const n=ue(e);if(!n)return void _(null);e.preventDefault(),e.dataTransfer.dropEffect=t(e.dataTransfer.effectAllowed);const l={zoneKey:n.t.zone.key,line:n.t.line,axis:n.t.zone.axis};_(e=>e&&e.zoneKey===l.zoneKey&&e.line.left===l.line.left&&e.line.top===l.line.top?e:l)},onDragLeave:e=>{const t=e.relatedTarget;t&&e.currentTarget.contains(t)||(le.current=null,_(null))},onDrop:e=>{const t=ue(e);t&&(e.preventDefault(),m.end(),de(),T.current.onDrop(t.h.item,t.t.to))}},fe={draggable:!k&&!!F,onMouseEnter:te,onMouseLeave:()=>!m.get()&&ne(),onDragStart:e=>{if(F&&!k){m.start({key:F.key,item:F.item,from:F.from}),e.dataTransfer.effectAllowed="move";try{e.dataTransfer.setData("text/plain",F.key)}catch{}}else e.preventDefault()},onDragEnd:()=>{m.end(),de()},onClick:()=>{F&&!k&&T.current.onPick?.(F.item)}},{seams:pe=[]}=P,me=P.zones.filter(e=>0===e.children.length),ge=!i.onZoneAdd||k||ae?[]:me,xe=ge.map(e=>e.key).join("\n");return x(()=>{const e=f?.document;if(!e)return;const t=new Set(xe?xe.split("\n"):[]);for(const n of e.querySelectorAll(`[${G}]`))n.toggleAttribute(V,t.has(n.getAttribute(G)??""));return()=>{for(const t of e.querySelectorAll(`[${V}]`))t.removeAttribute(V)}},[f,xe,X,$,C]),/* @__PURE__ */S("div",{ref:M,className:"es-canvas-layer",children:[H||!i.onSeamAdd||k||ae?null:pe.map(e=>
5
- /* @__PURE__ */E(j,{className:"es-canvas-seam",axis:e.axis,index:e.place.index,label:e.label??i.seamLabel??z.addSection,onInsert:()=>i.onSeamAdd?.(e.place),style:"x"===e.axis?{left:e.box.left+e.box.width/2-12,top:e.box.top,width:24,height:e.box.height}:{left:e.box.left,top:e.box.top+e.box.height/2-12,width:e.box.width,height:24}},e.key)),ge.length?ge.map(e=>/* @__PURE__ */E("button",{type:"button",className:["es-canvas-empty",e.addAlways?"is-always":"",U?.zoneKey===e.key?"is-over":""].filter(Boolean).join(" "),style:W(e.box),onClick:()=>i.onZoneAdd?.({...e.list,index:0}),children:/* @__PURE__ */E("span",{className:"es-canvas-empty-add",children:z.addButton({label:e.addLabel??i.zoneAddLabel??z.addBlock})})},e.key)):null,H?/* @__PURE__ */E("div",{className:"es-canvas-catch",...he}):null,U&&!me.some(e=>e.key===U.zoneKey)?/* @__PURE__ */E("div",{className:`es-canvas-line is-${U.axis}`,style:W(U.line)}):null,oe?/* @__PURE__ */E("span",{className:"es-canvas-hint"+(oe.width<200?" is-below":""),style:{...D(),left:oe.left+oe.width,top:oe.width<200?oe.top+oe.height:oe.top},children:z.typeHint}):null,
6
- /* @__PURE__ */E("div",{className:"es-canvas-handle-spot",style:F?{"--es-handle-x":`${F.box.left+2}px`,"--es-handle-y":`${Math.max(F.box.top-11,0)}px`}:void 0,children:/* @__PURE__ */E(A,{className:"es-canvas-handle-tip",side:"top",content:!F||k||H?null:F.title??z.handle({label:F.label}),children:/* @__PURE__ */S("div",{className:["es-canvas-handle",F&&!k?"is-shown":"",H?"is-dragging":""].filter(Boolean).join(" "),...fe,children:[
7
- /* @__PURE__ */E("span",{className:"es-canvas-grip","aria-hidden":"true",children:"⋮⋮"}),F?.label]})})})]})}var _=e=>e.tiles.length>0&&e.tiles.every(e=>null!=e.cover);function ee({groups:t,session:n,itemFor:l,onInsert:a,onTileMenu:r,at:s,hint:o,searchLabel:c,readOnly:d,words:u=e.add}){const h=o??u.hint,f=c??u.search,[p,m]=b(""),g=k(),x=p.trim().toLowerCase(),y=function(e){const t=/* @__PURE__ */new Map;return e.map(e=>{const n=e.key??e.title,l=t.get(n)??0;return t.set(n,l+1),0===l?n:`${n}\0${l}`})}(t),v=t.map((e,t)=>({...e,key:y[t],tiles:x?e.tiles.filter(e=>((e,t)=>e.label.toLowerCase().includes(t)||(e.keywords??[]).some(e=>e.toLowerCase().includes(t)))(e,x)):e.tiles})).filter(e=>e.tiles.length>0),w=(e,t)=>a=>{if(t)a.preventDefault();else{n.start({key:`new:${e}`,item:l(e)}),a.dataTransfer.effectAllowed="copy";try{a.dataTransfer.setData("text/plain",e)}catch{}}};/* @__PURE__ */
8
- return S("div",{className:"es-add",children:[s?/* @__PURE__ */S("div",{className:"es-add-at",role:"status",children:[
9
- /* @__PURE__ */E("span",{children:s.label}),i(u.stop,/* @__PURE__ */E("button",{type:"button",className:"es-add-at-clear","aria-label":u.stop,onClick:s.onClear,children:/* @__PURE__ */E($,{size:12,"aria-hidden":"true"})}))]}):null,
10
- /* @__PURE__ */E("p",{className:"es-add-hint",children:h}),
11
- /* @__PURE__ */E("div",{className:"es-add-find",children:/* @__PURE__ */E(T,{id:g,type:"search","aria-label":f,placeholder:u.searchPlaceholder({label:f}),value:p,onChange:e=>m(e.target.value),leftIcon:/* @__PURE__ */E(C,{size:16,"aria-hidden":"true"}),rightAdornment:p?/* @__PURE__ */E(z,{size:"sm","aria-label":u.clearSearch,onClick:()=>m(""),children:/* @__PURE__ */E($,{size:12,"aria-hidden":"true"})}):void 0})}),0===v.length?/* @__PURE__ */S("div",{className:"es-add-empty",role:"status",children:[
12
- /* @__PURE__ */E("div",{className:"es-add-empty-title",children:u.nothing({query:p.trim()})}),
13
- /* @__PURE__ */E("div",{className:"es-add-empty-sub",children:u.tryAnother})]}):v.map(e=>/* @__PURE__ */S("section",{className:"es-add-group","aria-label":e.title,children:[
14
- /* @__PURE__ */S("div",{className:"es-add-group-head",children:[
15
- /* @__PURE__ */E("span",{className:"es-add-group-title",children:e.title}),
16
- /* @__PURE__ */E("span",{className:"es-add-group-count",children:e.tiles.length})]}),
17
- /* @__PURE__ */E("div",{className:_(e)?"es-add-grid is-cards":"es-add-grid",children:e.tiles.map(e=>{const t=Boolean(d||e.disabled),l=d?void 0:e.disabled?e.disabledReason:e.title??u.tile({label:e.label});return i(l,/* @__PURE__ */S("button",{type:"button",className:null!=e.cover?"es-add-tile has-cover":"es-add-tile",draggable:!t,"aria-disabled":t||void 0,"aria-label":u.tile({label:e.label}),onDragStart:w(e.type,t),onDragEnd:()=>n.end(),onClick:()=>!t&&a?.(e.type),onContextMenu:r?t=>{r(e.type,{x:t.clientX,y:t.clientY,owner:t.currentTarget})&&t.preventDefault()}:void 0,children:[null!=e.cover?/* @__PURE__ */E("span",{className:"es-add-tile-cover","aria-hidden":"true",children:e.cover}):e.icon?/* @__PURE__ */E("span",{className:"es-add-tile-glyph","aria-hidden":"true",children:e.icon}):null,
18
- /* @__PURE__ */S("span",{className:"es-add-tile-label",children:[e.label,null!=e.mark?/* @__PURE__ */E("span",{className:"es-add-tile-mark","aria-hidden":"true",children:e.mark}):null]})]},e.type))})})]},e.key))]})}export{ee as AddPanel,U as CanvasDragLayer,j as CanvasInsert,R as EMPTY_MEASURE,J as HANDLE_GRACE_MS,O as canvasTarget,L as contains,q as gapInZone,I as gapLine,P as insertSeams,Q as measureCanvas,X as pickSource,H as seamsBetween,B as sourcesAt};
@@ -1,4 +0,0 @@
1
- import{useScreenOwnerName as e}from"./chunk-W6SDWCOL.js";import{settlePanelPick as n}from"./chunk-R6WTQWAC.js";import{MediaPanelHead as i,mediaPickKind as c}from"./chunk-GWIVPLOX.js";import{jsxs as o,Fragment as r,jsx as t}from"react/jsx-runtime";function l({panel:l,pick:d,onHide:m}){const p=e();/* @__PURE__ */
2
- return o(r,{children:[
3
- /* @__PURE__ */t(i,{context:p,pick:d?{kind:c(d.accept),field:d.title||void 0}:null,onCancel:()=>d&&n(d.requestId,null),onHide:m}),
4
- /* @__PURE__ */t("div",{className:"sf-media-panel",children:/* @__PURE__ */t(l,{pick:d,onPick:e=>d&&n(d.requestId,e)})})]})}export{l as MediaSidePanel};
@@ -1,62 +0,0 @@
1
- import{cloneNodeWithFreshIds as e}from"./chunk-2GVCAIPX.js";import{dedupeSlotChildren as n}from"./chunk-26OOWIJJ.js";import{styleClipboardOf as t}from"./chunk-VEZPDGDQ.js";import{markedTreeNodeId as o,revealSelectedTreeRow as r,sameSelector as i}from"./chunk-FGNR22NY.js";import{scrollPreviewToSection as l,gotoPreviewSlide as s,scrollPreviewToTop as d}from"./chunk-4ES5JGGX.js";import{useEaselKeyTarget as a,useEaselUndoKeys as c,useEaselSaveKey as p,editorRootFocus as u}from"./chunk-YLQYEDUQ.js";import{SlotChildActionsProvider as h}from"./chunk-KCBEE2MC.js";import{screenStorageKeys as f,DEFAULT_PANEL_W as m,clampPanelWidth as g}from"./chunk-U277UX5I.js";import{usePartBridge as y}from"./chunk-X52NFKUS.js";import{useSectionOps as k}from"./chunk-SNB4LQMK.js";import{ScreenSaveIcon as v,ScreenMainButton as S}from"./chunk-7TOQCTHV.js";import{useBrowserOffline as b}from"./chunk-RKTF5XLP.js";import{AddChildRow as w}from"./chunk-5545A3PC.js";import{AddSidePanel as x}from"./chunk-2ZWA6ARJ.js";import{keepsSharedSections as z,sharedSectionsOf as C}from"./chunk-43AEUUNQ.js";import{SidePanelHead as O,PanelShowStrip as B}from"./chunk-XDZHKYQX.js";import{offeredChoices as I}from"./chunk-M2Z775ZC.js";import{MediaSidePanel as N}from"./chunk-OBIL7BZO.js";import{useScreenSaveSwitch as P,useScreenNodeKeys as $,useScreenPinned as M,useScreenDocumentLabel as j,useScreenCanvasFrame as T,useScreenInspectorPanel as A,useScreenDevices as L,useScreenPickFollowsSelection as R,useScreenLeftView as E,SELECTION_MODE as V,sameInspectorMode as F,useScreenBridges as D,useScreenBlockRules as H,useScreenBlockLook as W,useScreenStorageNamespace as U,useScreenNotify as G,useScreenCanvasHead as X,isSlotMode as Y,useScreenStyleClipboard as J,useScreenDocumentPass as K,useScreenCanvasDrag as Q,ScreenCanvasTargetProvider as Z,isPinnedFirst as q,isPinnedLast as _,screenSlotsOf as ee}from"./chunk-W6SDWCOL.js";import{useNodeClipboard as ne,useNodeContextMenu as te}from"./chunk-RFE7ZG3Y.js";import{PageEditGuardNotices as oe}from"./chunk-HGV3FWOB.js";import{useScreenDocument as re}from"./chunk-STWSCR25.js";import{requestMediaPick as ie}from"./chunk-KG7RJWOK.js";import{useMediaPanel as le,usePanelPick as se,useCancelPanelPick as de}from"./chunk-R6WTQWAC.js";import{useEaselSession as ae}from"./chunk-O7Q4DDJT.js";import{useEaselHost as ce,useHostEscape as pe}from"./chunk-U3JP4VGF.js";import{LayersIcon as ue,MediaIcon as he}from"./chunk-4VJATVVR.js";import{DEFAULT_SCREEN_WORDS as fe}from"./chunk-C2RHV42O.js";import{heldStyle as me,styleShortcut as ge}from"./chunk-V7U33NF2.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as ye}from"./chunk-6WY6ZXJG.js";import{rootRowName as ke,slotChildRowName as ve,slotChildRenameProp as Se,sectionRenameProp as be}from"./chunk-BHRC3ASL.js";import{ROOT_ZONE as we,blockNodeActions as xe,TREE_MAX_DEPTH as ze,childSlotsOf as Ce,slotFieldsOf as Oe,slotChildrenIn as Be,nestsInTree as Ie,newNodeId as Ne}from"./chunk-PLVEGYK6.js";import{useEasel as Pe,useEaselApi as $e,CanvasPassThroughContext as Me,CanvasSharedContext as je}from"./chunk-QEAUF632.js";import{TreeRow as Te,Subtree as Ae,LayersTree as Le,TreeGroupLabel as Re,TreeRowAction as Ee,TreeSeam as Ve}from"./chunk-A6Z4SD3I.js";import{DEFAULT_TREE_WORDS as Fe}from"./chunk-K56YDHYQ.js";import{DEFAULT_NODE_MENU_WORDS as De}from"./chunk-WK3AFPXY.js";import{toItemSelector as He,useNodeOps as We,clickPick as Ue}from"./chunk-X3TYRF5V.js";import{EaselTopBar as Ge,TopBarRail as Xe,TopBarCluster as Ye,EaselIconButton as Je,TopBarDivider as Ke,DeviceSwitch as Qe,InspectorIconButton as Ze,PanelResizeHandle as qe,MAX_PANEL_W as _e,MIN_PANEL_W as en,panelWidthVars as nn}from"./chunk-GWIVPLOX.js";import{DEFAULT_NOTICE_WORDS as tn,DEFAULT_CHROME_WORDS as on}from"./chunk-Z6PVRXVY.js";import{holderOf as rn,nameOrSomeone as ln}from"./chunk-THWO5YVZ.js";import{DEFAULT_LOCK_WORDS as sn}from"./chunk-RE4LP46F.js";import{useWords as dn}from"./chunk-MFIRYGHW.js";import{insertSeams as an,CanvasDragLayer as cn,CanvasInsert as pn}from"./chunk-LLDHIBYG.js";import{DEFAULT_DRAG_WORDS as un}from"./chunk-KAML3KQH.js";import{createDragSession as hn,useTreeDrag as fn,gapToMoveIndex as mn}from"./chunk-67GNT6PF.js";import{useCanvasFrame as gn,LIST_SELECTOR as yn,BLOCK_SELECTOR as kn,useCanvasTyping as vn,useCanvasEvent as Sn,nodeIdAt as bn,frameRectToHost as wn,BLOCK_ATTRIBUTE as xn,drawnBox as zn}from"./chunk-X4T6JT3M.js";import{ROOT_ID as Cn,ROOT_SLOT as On,zoneKey as Bn,parseZoneKey as In,find as Nn,DataError as Pn}from"./chunk-KRXQM65X.js";import{useRef as $n,useMemo as Mn,useState as jn,useEffect as Tn,useCallback as An,useLayoutEffect as Ln,Fragment as Rn,useId as En}from"react";import{ColoredBadge as Vn,toast as Fn,Tooltip as Dn,groupColors as Hn,Dialog as Wn,FormField as Un,Input as Gn,Button as Xn}from"efficient-shell/ui";import{UndoIcon as Yn,RedoIcon as Jn,RefreshIcon as Kn,AddIcon as Qn,TrashIcon as Zn,EyeOffIcon as qn,EyeIcon as _n,SharedIcon as et,DuplicateIcon as nt}from"efficient-shell/icons/efficient";import{jsx as tt,jsxs as ot,Fragment as rt}from"react/jsx-runtime";function it({name:e,onMake:n,onCancel:t}){const o=dn("screen",fe).shared,[r,i]=jn(e),[l,s]=jn(!1),d=En(),a=$n(null),c=async()=>{const e=r.trim();if(e&&!l){s(!0);try{await n(e)}finally{s(!1)}}};/* @__PURE__ */
2
- return tt(Wn,{open:!0,size:"sm",title:o.makeShared,description:o.makeSharedHint,onClose:t,initialFocus:a,footer:/* @__PURE__ */ot(rt,{children:[
3
- /* @__PURE__ */tt(Xn,{variant:"secondary",onClick:t,children:o.cancel}),
4
- /* @__PURE__ */tt(Xn,{variant:"primary",loading:l,disabled:!r.trim(),onClick:()=>{c()},children:o.makeShared})]}),children:/* @__PURE__ */tt("form",{onSubmit:e=>{e.preventDefault(),c()},children:/* @__PURE__ */tt(Un,{label:o.name,htmlFor:d,children:/* @__PURE__ */tt(Gn,{id:d,ref:a,value:r,onChange:e=>i(e.target.value)})})})})}var lt=/* @__PURE__ */new WeakSet;function st(e,n,t){const o=Nn(e,n,t);if(!o)return null;const r=o.path.find(e=>"root"!==e.parentId);return r?r.parentId:t}function dt({canvas:e,tabs:n,onSelect:t}){const o=$n(null),[r,i]=jn({}),l=n.map(e=>`${e.id}:${e.below?1:0}`).join("|");return Ln(()=>{const t=e?.document,r=e?.window,l=e?.frame;if(!t||!r||!l||0===n.length)return void i({});let s=0;const d=()=>{s=0;const e=o.current;if(!e)return;const d=wn(l,{left:0,top:0,width:r.innerWidth,height:r.innerHeight},e),a={};for(const o of n){const n=t.querySelector(`[${xn}="${r.CSS?.escape?r.CSS.escape(o.id):o.id}"]`),i=n?zn(n):null;if(!i||0===i.height){a[o.id]=null;continue}const s=wn(l,{left:i.left,top:i.top,width:i.width,height:i.height},e),c=s.top+s.height;if(c<d.top||s.top>d.top+d.height){a[o.id]=null;continue}const p=o.below?c+4:Math.max(s.top,d.top)+6;a[o.id]={left:Math.max(s.left,d.left)+6,top:p}}i(a)},a=()=>{s||(s=r.requestAnimationFrame(d))};d(),r.addEventListener("scroll",a,!0),r.addEventListener("resize",a);const c=new r.MutationObserver(a);return c.observe(t.body,{childList:!0,subtree:!0,attributes:!0}),()=>{s&&r.cancelAnimationFrame(s),r.removeEventListener("scroll",a,!0),r.removeEventListener("resize",a),c.disconnect()}},[e,l]),/* @__PURE__ */tt("div",{ref:o,className:"es-band-tabs","aria-hidden":"true",children:n.map(e=>{const n=r[e.id];return n?/* @__PURE__ */tt("span",{className:"es-band-tab","data-band-tab":e.id,style:{left:n.left,top:n.top},onClick:n=>{n.stopPropagation(),t(e.id)},children:e.reach?
5
- /* @__PURE__ */tt(Dn,{content:e.reach,children:/* @__PURE__ */ot(Vn,{colorClass:Hn("success","solid"),size:"sm",children:[
6
- /* @__PURE__ */tt("span",{className:"es-band-tab-mark",children:/* @__PURE__ */tt(et,{size:12})}),e.label]})}):/* @__PURE__ */tt(Vn,{colorClass:Hn("info","solid"),size:"sm",children:e.label})},e.id):null})})}function at({expand:e}){/* @__PURE__ */
7
- return tt("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:/* @__PURE__ */ot(rt,e?{children:[
8
- /* @__PURE__ */tt("path",{d:"M8 9l4-4 4 4"}),
9
- /* @__PURE__ */tt("path",{d:"M8 15l4 4 4-4"})]}:{children:[
10
- /* @__PURE__ */tt("path",{d:"M8 4l4 4 4-4"}),
11
- /* @__PURE__ */tt("path",{d:"M8 20l4-4 4 4"}),
12
- /* @__PURE__ */tt("path",{d:"M5 12h14"})]})})}var ct=`${yn}, ${kn}`;function pt(e,n,t){const o=t-n;if(o<6)return null;if(o<24)return{top:Math.round((n+t)/2),height:Math.round(o)};return{top:Math.round(Math.min(Math.max(e,n+12),t-12))}}var ut="__rungs";var ht="screen:band",ft={duplicate:!0,delete:!0};function mt(){const yn=ce(),{target:wn,docId:xn,capabilities:zn,currentSlug:En,siteId:Dn,onPublish:Hn,saveState:Wn,saveConflict:Un,retrySave:Gn,toggleAutoSave:Xn,flushSave:et,access:mt,saveUnreachable:gt=!1,readOnly:yt,readOnlyReason:kt=null}=re(),vt=P(),St=$(),{mediaEditing:bt,hasEditGuard:wt,hasPinnedChrome:xt}=zn,{appState:zt,dispatch:Ct,history:Ot,selectedItem:Bt,getSelectorForId:It,config:Nt}=Pe(e=>e),Pt=M(),{first:$t,firstGroup:Mt,lastGroup:jt,isSectionGroup:Tt,sectionGroupZone:At,panelOf:Lt}=Pt,Rt=Lt($t),Et=e=>q(Pt,e),Vt=e=>_(Pt,e),Ft="node"===Pt.firstRow,Dt=Pt.band??null,Ht=dn("screen",fe),Wt=dn("tree",Fe),Ut=dn("drag",un),Gt=dn("notice",tn),Xt=dn("lock",sn),Yt=dn("menu",De),Jt=dn("styleClipboard",ye),Kt=dn("chrome",on),Qt=j()??`/${En}`,Zt=T(),qt=A(),_t=k({readOnly:yt}),eo=k({readOnly:yt,foldIntoHistory:!0}),no=$n(null),to=$e(),oo=Mn(()=>({..._t,select:e=>{no.current=e,_t.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=to.config;no.current=He(e,t,n)}_t.commitDocument(e,n)}}),[_t,to]),ro=zt.ui,io=ro.leftSideBarVisible,lo=ro.rightSideBarVisible,{options:so,widths:ao,initial:co,fluid:po,fit:uo}=L(),[ho,fo]=jn(co),mo=le(),go=bt&&null!==mo,yo=se(),ko=de();R(Bt?.props.id);const{read:vo,write:So,forSelection:bo}=E(),[wo,xo]=jn(vo);Tn(()=>{So(wo)},[wo]);const[zo,Co]=jn(0),Oo=$n(null),Bo=$n(null),Io=gn(Bo,{readySelector:ct}),No=vn(Io),Po=a(Bo);c(Bo,Io);const $o=b(),Mo=rn(mt),jo={state:Wn,offline:$o||Wn.failed&&gt,readOnlyReason:kt,editing:Mo?Gt.editing({name:ln(Mo.name,Xt),noun:Ht.noun}):null,conflict:null!=Un,notSaving:Ht.bar.notSaving},To=()=>{yt||(Wn.failed?Gn():et())};p(Bo,Io,To);const[Ao,Lo]=jn(!1),Ro=$n(!1),Eo=$n(!1),[Vo,Fo]=jn(null),[Do,Ho]=jn([]),[Wo,Uo]=jn(V),Go="puck"===Wo.kind,Xo=o(Wo,Bt?.props.id),[Yo,Jo]=jn(null);Tn(()=>{Yo&&(r(),Jo(null))},[Yo]);const Ko=$n(It);Ko.current=It;const Qo=An((e,{scroll:n})=>{xo(n=>bo(e,n)),n&&Jo(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=Ko.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),t.push(e),o=n}0!==t.length&&Cr(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),Zo=$n(null);Tn(()=>{const e=Zo.current;Zo.current=null;const n=null==Bt?.props.id?null:String(Bt.props.id);Uo(t=>e&&e.id===n?e.mode:"part"===t.kind&&"nodeId"in t&&t.nodeId===n?t:Lt(Bt?.type)??V);const t=Bt?.props.id,o=no.current;if(no.current=null,!t)return;const r=It(t);Qo(String(t),{scroll:!i(o,r??null,we)})},[Bt?.props.id,Qo]);const qo=An(e=>{Uo(n=>F(n,e)?n:e),Ct({type:"setUi",ui:{rightSideBarVisible:!0}})},[Ct]),_o=$n(()=>{});_o.current=(e,n)=>{const t=e?wi(e.zone??we)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==Bt?.props.id?null:String(Bt.props.id);Uo(e=>F(e,n)?e:n),o!==r&&(Zo.current={id:o,mode:n},oo.select(e))};const er=An((e,n)=>_o.current(e,n),[]),nr={kind:Wo.kind,mode:Wo,open:qo,show:e=>Uo(e),reveal:()=>{lo||Ct({type:"setUi",ui:{rightSideBarVisible:!0}})},select:er},tr=D(nr,{data:zt.data,selected:Bt??null,zoneOf:e=>It(e)?.zone,readOnly:Boolean(yt),select:e=>{Uo(V),oo.select({index:e})},replace:(e,n)=>oo.replaceComponent(we,e,n),scrollTo:e=>l(e)},{device:ho,refreshes:zo},{setView:xo,reveal:()=>{io||Ct({type:"setUi",ui:{leftSideBarVisible:!0}})}}),or=tr.resolveLeftView?tr.resolveLeftView(wo,go):"media"===wo&&go?wo:"sections",rr=H(),{isLockedBlock:ir,duplicateBlocked:lr,nestDepth:sr,newSectionNode:dr,canAddTo:ar,blockIsOffered:cr}=rr,pr=W(),{labelAtLevel:ur,Icon:hr,useProducts:fr}=pr,mr=pr.rowName?(e,n,t)=>pr.rowName(e,n,t):void 0,gr=An(e=>{Ct({type:"setUi",ui:{rightSideBarVisible:!0}}),l(e),Qo(e,{scroll:!0})},[Ct,Qo]),{selectNode:yr,openPartId:kr}=y({mode:Wo,setMode:Uo,onOpenPart:gr}),[vr,Sr]=jn(null);pe(null!==vr,()=>Sr(null));const br=f(U()),wr=br.collapsed,xr=br.panelWidths,[zr,Cr]=jn(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(wr);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
13
- return new Set}});Tn(()=>{try{window.localStorage.setItem(wr,JSON.stringify([...zr]))}catch{}},[zr]);const[Or,Br]=jn(()=>{if("undefined"==typeof window)return{...m};try{const e=window.localStorage.getItem(xr);if(!e)return{...m};const n=JSON.parse(e);return{left:g(Number(n.left)||m.left),right:g(Number(n.right)||m.right)}}catch{return{...m}}});Tn(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(xr,JSON.stringify(Or))}catch{}},300);return()=>clearTimeout(e)},[Or]);const Ir=An((e,n)=>Br(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),Nr=An(e=>Ir("left",e),[Ir]),Pr=An(e=>Ir("right",e),[Ir]),$r=e=>zr.has(e),Mr=e=>Cr(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),jr=$n(!1),Tr=$n(null);Tn(()=>{if(jr.current&&!Ao){const e=Tr.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??Bo.current?.querySelector(`button[aria-label="${CSS.escape(Ht.add.title)}"]`))?.focus(),Tr.current=null}jr.current=Ao},[Ao]),Tn(()=>{if(!Ao||!Po)return;const e=e=>{"Escape"===e.key&&el()};return Po.addEventListener("keydown",e),()=>Po.removeEventListener("keydown",e)},[Ao,Po]),pe(Ao,()=>el()),Tn(()=>{!io&&Ao&&(Lo(!1),Fo(null),Ro.current=!1)},[io]),Tn(()=>{if(!yo)return Eo.current&&Ct({type:"setUi",ui:{leftSideBarVisible:!1}}),void(Eo.current=!1);Ao&&(Lo(!1),Fo(null),Eo.current=Ro.current,Ro.current=!1),io||(Eo.current=!0,Ct({type:"setUi",ui:{leftSideBarVisible:!0}}))},[yo]),Tn(()=>{!io&&yo&&(Eo.current=!1,ko())},[io]),Tn(()=>{if(!yo||!Po)return;const e=e=>{"Escape"===e.key&&ko()};return Po.addEventListener("keydown",e),()=>Po.removeEventListener("keydown",e)},[yo,Po]),pe(null!==yo,()=>ko());const Ar=G(),Lr=(e,n="success",t)=>{if(Ar)return void(t?Ar(e,"error"===n?"error":"info",t):Ar(e,"error"===n?"error":"info"));const o={sound:!1,action:t?.action,onClose:t?.onClose};"error"===n?Fn.error(e,{...o,duration:t?.duration??3200}):Fn.success(e,{...o,duration:t?.duration??1900})},Rr=$n(null),[Er,Vr]=jn(0),[Fr,Dr]=jn(0),Hr=X(),Wr=$n(null),Ur=e=>Math.max(0,e.clientHeight-(Wr.current?.offsetHeight??0));Tn(()=>{const e=Rr.current;if(!e)return;const n=()=>{Vr(e.clientWidth),Dr(Ur(e))};n();const t=new ResizeObserver(n);return t.observe(e),Wr.current&&t.observe(Wr.current),()=>t.disconnect()},[]),Ln(()=>{Rr.current&&(Vr(Rr.current.clientWidth),Dr(Ur(Rr.current)))},[Or,io,lo]);const Gr=ho===po?Er>0?Er:ao[po]:ao[ho],Xr=Er>0?Math.min(Er/Gr,"shrink"===uo?1:2):1,Yr=Gr*Xr,Jr=Er>0&&Yr>Er+1,Kr={width:Yr,height:Fr||"100%",flex:"none",position:"relative"},Qr={width:Gr,height:Fr?Fr/Xr:"100%",maxHeight:"none",transform:1!==Xr?`scale(${Xr})`:void 0,transformOrigin:"top left"},Zr=()=>Ct({type:"setUi",ui:{leftSideBarVisible:!io}}),qr=()=>Ct({type:"setUi",ui:{rightSideBarVisible:!lo}}),_r=e=>{Ao&&(Lo(!1),Fo(null),Ro.current=!1,io&&wo===e)||yo&&(Eo.current=!1,ko(),io&&wo===e)||(io&&wo===e?Zr():(xo(e),io||Ct({type:"setUi",ui:{leftSideBarVisible:!0}})))},ei=()=>{ie(yn,{accept:"image/*",title:Kt.mediaLibrary})},ni=()=>{Uo(V),oo.select(null),d()},ti=()=>{Uo(Rt??V),lo||Ct({type:"setUi",ui:{rightSideBarVisible:!0}})},oi=zt.data.content??[],ri=()=>{const e=oi.findIndex(Et),n=oi.findIndex(Vt);return{floor:e>=0?e+1:0,cap:n>=0?n:oi.length}},ii=Nt,li=rr.stripCopy,si=n=>e(n,li),di=ne(),ai=We({data:zt.data,config:ii,readOnly:Boolean(yt),clipboard:di,strip:li?e=>li(e):void 0,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==Cn||e.slot!==On)return{min:0,max:n-1};const{floor:t,cap:o}=ri();return{min:t,max:o-1}},commit:(e,{select:n})=>{void 0!==n&&Uo(V);const t=void 0===n||"node"===n?.kind?n:null;oo.commitDocument(e,t)}}),ci=ae(),[pi,ui]=jn(null),hi=e=>{const n=oi.find(n=>String(n.props.id)===e),t=Pt.shared;n&&t&&ai.swap(e,t.detach(n))},fi=e=>{const n=Nn(zt.data,Nt,e);if(!n)return!1;const t=Bn(n.place),o=n.node,r=t===we?vi(o):ji(o),i=t===we?Pt.shared?.usedOn(o):null;return!!ai.remove(e)&&(Lr(i?Ht.shared.removed({count:Math.max(0,i.length-1)}):Ht.deleted({name:r}),"success",{duration:8e3,action:{label:Ht.bar.undo,onClick:()=>{ai.restore(n.node,n.place)}}}),!0)},mi={...ai,remove:fi},gi=e=>ur(e,"block",Nt.components[e]?.label??e),yi=An(e=>Nt.components[e]?.defaultProps??{},[Nt]),ki=e=>ur(e,"section",gi(e)),vi=e=>ke({type:e.type,props:e.props??{}},ki(e.type),mr),{nodeAddresses:Si,zoneItems:bi}=Mn(()=>{const e=/* @__PURE__ */new Map,n=/* @__PURE__ */new Map,t=(o,r,i)=>{n.set(r,o),o.forEach((n,o)=>{const l=String(n.props?.id??"");if(l&&e.set(l,{zone:r,index:o}),i>=ze)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of Ce(Nt,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(oi,we,0),{nodeAddresses:e,zoneItems:n}},[oi,Nt]),wi=An(e=>bi.get(e)??[],[bi]),xi=e=>{const n=Si.get(e);return n?wi(n.zone)[n.index]:void 0},zi=e=>ee(rr,Nt,e),Ci=e=>{if(!rr.slotsOf||e===we)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=xi(e.slice(0,n));if(!t)return null;const o=zi(t).filter(e=>e.rung),r=o.findIndex(t=>t.slot===e.slice(n+1));return r<0?null:{node:t,slot:o[r],position:r}},Oi=(()=>{if(!Y(Wo))return null;const e=`${Wo.nodeId}:${Wo.slot}`;return Ci(e)?.slot.panel===Wo.kind?e:null})(),Bi=$n(null);Tn(()=>{const e=Bi.current;if(Bi.current=null,!Oi||!Y(Wo))return;const n=Wo.nodeId;Qo(n,{scroll:e!==Oi}),Cr(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[Wo]);const Ii=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void(e=>{const n=Si.get(e);n&&(n.zone===we?Yi(n.index):Sl(n.zone,n.index,e,xi(n.zone.slice(0,n.zone.lastIndexOf(":")))?.type??""))})(o);const r={kind:n.panel,nodeId:o,slot:n.slot},i=`${o}:${n.slot}`;t&&Oi!==i&&(Bi.current=i),er(null,r),lo||Ct({type:"setUi",ui:{rightSideBarVisible:!0}}),l(o)},Ni=(e,n,t)=>{const o=`${e}:${n}`;if(Cr(n=>{if(!n.has(o)&&!n.has(e))return n;const t=new Set(n);return t.delete(o),t.delete(e),t}),!t)return;Oi!==o&&(Bi.current=o);er(null,{kind:t,nodeId:e,slot:n})},Pi=(e,n,t)=>{if(yt||!rr.moveSlot)return;const o=xi(e),r=o?zi(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:ut,index:n},s=mn(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=rr.moveSlot(e,n,s);"string"==typeof d&&Ni(e,d,i.panel)},$i=fr(),Mi=Mn(()=>{const e=/* @__PURE__ */new Map;for(const n of $i??[])e.set(n.slug,n.name);return e},[$i]),ji=e=>ve(e,gi,pr.plainText,e=>Mi.get(e),pr.rowName),Ti=(e,n)=>{const t=Nt.components[e.type]?.fields,o=n===we||Xl(n)?"section":"block",r=n===we&&(Et(e)||Vt(e)||Tt(e.type)),i="block"===o?Se(t):r?null:be(t);return pr.renamePropOf?pr.renamePropOf(e,o,i):i},Ai=(e,n,t,o)=>{if(!(!yt&&vr?.zone===e&&vr.index===n))return;const r=(t,o)=>{Sr(null),o&&((e,n,t)=>{const o=wi(e)[n];if(!o)return;const r=Ti(o,e);r&&oo.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
14
- return tt("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":Ht.rename,onClick:e=>e.stopPropagation(),onBlur:e=>r(e.currentTarget.value,!0),onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),r(e.currentTarget.value,!0)):"Escape"===e.key&&(e.preventDefault(),r("",!1))}},t)},Li=t(J(),Jt),Ri=Li.scope({target:wn,siteId:Dn,docId:xn}),Ei=Nt,Vi=(e,n)=>n===we?ki(e):gi(e),Fi=(e,n,t)=>{const o=Li.plan(Ri,t,Vi(t.type,e),Ei);o&&(o.changed&&oo.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),Lr(o.message))},Di=te({nodesIn:wi,nodeAt:(e,n)=>wi(e)[n]??null,labelOf:(e,n)=>n===we?ki(e):gi(e),renamePropOf:Ti,beginRename:(e,n)=>Sr({zone:e,index:n}),history:{hasPast:Ot.hasPast,hasFuture:Ot.hasFuture,back:()=>Ot.back(),forward:()=>Ot.forward()},openPageSettings:()=>{oo.select(null),Uo(V)},pageSettingsLabel:Ht.pageSettings,words:{menu:Yt,styleClipboard:Jt,screen:Ht.menu},readOnly:Boolean(yt),collapseAll:()=>Cr(new Set(wi(we).map(e=>String(e.props.id)))),onPasteRefused:e=>Lr(e?Ht.pasteRefused({name:e.label}):Ht.menu.clipboardRefused,"error"),canPasteAt:(e,n)=>Kl(e,n),menuRows:(e,n,t)=>{const o=tr.menuRows?.(e,n,t)??null,r=((e,n)=>{const t=Pt.shared;if(!t||n!==we)return null;const o=t.usedOn(e);if(o){const n={pick:[{label:Ht.shared.onPages({count:o.length}),onClick:()=>{},children:o.map(e=>({label:e.title,onClick:()=>t.openPage(e)}))}]};return yt||ir(e.type,e)?n:{...n,change:[{label:Ht.shared.detach,onClick:()=>hi(e.props.id)}],remove:[{label:Ht.shared.removeFromPage,danger:!0,onClick:()=>{fi(e.props.id)}}]}}return yt||Et(e)||Vt(e)||Tt(e.type)?null:z(ci)?{change:[{label:Ht.shared.makeShared,onClick:()=>ui({id:e.props.id,name:vi(e)})}]}:null})(e,n);if(!r)return o;return Object.fromEntries(["pick","make","change","remove"].map(e=>[e,[...o?.[e]??[],...r[e]??[]]]).filter(([,e])=>e.length>0))},isLocked:e=>ir(e.type,e),duplicateBlocked:e=>lr(zt.data,e),permits:e=>{const n=xe(Nt,e.type);return Pt.shared?.usedOn(e)?{...n,delete:!1}:n},nodeOps:mi,isPinned:(e,n)=>n===we&&(Et(e)||Vt(e)),sectionBand:ri,locate:e=>Si.get(e)??null,rowNameOf:(e,n)=>n===we?vi(e):ji(e),selectAt:(e,n,t,o)=>{e===we?Yi(n):Sl(e,n,t,o??"")},slotRung:e=>{const n=Ci(e);return n?.slot.panel?{label:n.slot.label,select:()=>Ii(n.node,n.slot,!1)}:null},style:{held:()=>me(Ri),canCopy:e=>Li.rows(Ei,e).some(e=>!1!==e.counted),copy:(e,n)=>Li.copy(Ri,e,Vi(e.type,n),Ei),paste:(e,n,t)=>Fi(e,n,t)},keys:St?{target:Po,selected:()=>{const e=zt.ui.itemSelector;return e?{zone:e.zone??we,index:e.index}:null},held:()=>di.get(),readOnly:Boolean(yt),onDone:({done:e,name:n})=>{"copied"===e&&Lr(Ht.copied({name:n}))}}:void 0},Io),Hi=$n({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});Tn(()=>{Hi.current={copy:(e,n)=>Li.copy(Ri,e,Vi(e.type,n),Ei),paste:Fi,at:()=>{const e=zt.ui.itemSelector;if(!e)return null;const n=e.zone??we,t=wi(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean(yt)}});const Wi=An(e=>{const n=ge(e);if(!n)return;const t=Hi.current,o=t.at();o&&(e.preventDefault(),"copy"===n?t.copy(o.node,o.zone):t.readOnly||t.paste(o.zone,o.index,o.node))},[]);Tn(()=>{if(!Po)return;const e=e=>Wi(e);return Po.addEventListener("keydown",e),()=>Po.removeEventListener("keydown",e)},[Wi,Po]),Sn(Io,"keydown",Wi);const Ui=oi.map(e=>e.props.id).join("|");Tn(()=>{const e=Io?.document??null,n=Io?.window??null;let t=0;const o=[],r=()=>{if(!e)return void Ho(e=>e.length?[]:e);const n=oi.findIndex(Vt),t=n>=0?n:oi.length,o=n=>{const t=oi[n]?.props?.id;return null==t?null:e.querySelector(`[data-puck-component="${CSS.escape(String(t))}"]`)},r=e=>e?[...e.querySelectorAll(kn)].map(e=>e.getBoundingClientRect()).filter(e=>e.width>0||e.height>0):[],i=[];for(let e=oi.length>0&&!Et(oi[0])?0:1;e<=t;e++){const n=o(e),t=o(e-1),l=n?.getBoundingClientRect()??null,s=t?.getBoundingClientRect()??null;if(!l&&!s)continue;const d=pt(l&&s?(s.bottom+l.top)/2:l?0===e?l.top+12:l.top:s.bottom,Math.max(0===e?0:-1/0,...r(t).map(e=>e.bottom)),Math.min(1/0,...r(n).map(e=>e.top)));d&&i.push({...d,index:e})}Ho(e=>function(e,n){if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(e[t].top!==n[t].top||e[t].index!==n[t].index||e[t].height!==n[t].height)return!1;return!0}(e,i)?e:i)},i=()=>{cancelAnimationFrame(t),t=requestAnimationFrame(r)};if(!e||!n)return void r();n.addEventListener("scroll",i,{passive:!0});const l=new ResizeObserver(i);return l.observe(e.documentElement),r(),o.push(setTimeout(r,150),setTimeout(r,450)),()=>{cancelAnimationFrame(t),o.forEach(clearTimeout),n.removeEventListener("scroll",i),l.disconnect()}},[Io,Ui,ho,Xr,io,lo,Bt?.props.id]);const Gi=Io?.document??null,Xi=Io?.window??null;Tn(()=>{const e=Oo.current;if(!e||!Gi||!Xi)return;const n=[],t=()=>{const n=Gi.querySelector(`[data-puck-component="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&Xi.scrollTo({left:Xi.scrollX,top:Xi.scrollY+t,behavior:"instant"}),!0};return Oo.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[Gi,Xi]);const Yi=e=>{Uo(V),oo.select({index:e}),tr.sectionPressed?.(oi[e]);const n=oi[e]?.props?.id;n&&l(n)},Ji=e=>{const{floor:n,cap:t}=ri(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=Bt&&Wo.kind!==Rt?.kind?oi.findIndex(e=>e.props.id===Bt.props.id):-1;return o(r>=0?r+1:t)},Ki=(e,n)=>{const{floor:t,cap:o}=ri(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(oo.reorderComponent(we,e,i),oo.select({index:i}),{moved:!0,dest:i})},Qi=(e,n,t,o)=>{Uo(V),oo.select(o?{index:o.index,zone:o.zone}:{index:e}),l(n),Lr(Ht.sectionAdded({name:t}))},Zi=(e,n)=>{const t=Ji(n),o=dr(e,{nodeDefaults:yi,newNodeId:Ne,sectionLabel:ki,blockIsOffered:cr}),r=o?oo.insertNode(we,t,o):oo.insertSection(e,t);return Qi(t,r,ki(e),o?((e,n,t)=>{if(e.type===t)return null;const o={at:null},r=(e,n,i)=>{const l=i.filter(n=>n===e.type).length;for(const{child:s,zone:d,index:a}of Ce(Nt,e)){if(s.type===t&&(!o.at||n>o.at.depth)){const r=ar(e.type,l,d.slice(d.lastIndexOf(":")+1)),i=r?.choices??(r?.spec?[{type:r.spec.childType,label:r.spec.childType}]:[]);null!==r&&"footer"!==r.source&&`${e.props.id}:${r.slot}`===d&&i.some(e=>e.type===t)&&(o.at={zone:d,index:a,depth:n})}r(s,n+1,[...i,e.type])}};return r({type:e.type,props:{...e.props,id:n}},1,[]),o.at?{zone:o.at.zone,index:o.at.index}:null})(o,r,e):null),t},qi=e=>_i(we,e),_i=(e,n)=>{Tr.current=document.activeElement??null,yo&&(Ro.current=Eo.current,Eo.current=!1,ko()),Fo(null===n?null:{zone:e,index:n}),Lo(!0),io||(Ro.current=!0,Ct({type:"setUi",ui:{leftSideBarVisible:!0}}))},el=()=>{Lo(!1),Fo(null),Ro.current&&Ct({type:"setUi",ui:{leftSideBarVisible:!1}}),Ro.current=!1},nl=(e,n)=>pr.rowName?n?Et(e)?pr.rowName(e,"section",Ht.header):Vt(e)?pr.rowName(e,"section",Ht.footer):Tt(e.type)?pr.rowName(e,"section",gi(e.type)):vi(e):ji(e):n?ki(e.type):gi(e.type),tl=e=>n=>{e()},ol=(e,n,t)=>{if(yt)return null;const o=wi(e)[n];return o&&!xe(Nt,o.type).delete||o&&ir(o.type,o)?null:/* @__PURE__ */tt(Ee,{kind:"delete",label:e===we&&o&&Pt.shared?.usedOn(o)?Ht.shared.removeFromPage:Ht.deleteNamed({name:t}),onClick:()=>((e,n)=>{const t=wi(e)[n]?.props?.id;null!=t&&fi(String(t))})(e,n),children:/* @__PURE__ */tt(Zn,{size:15})})},rl=e=>pr.rowPreview?.(e)||void 0,il=e=>pr.rowMarks?.(e)??void 0,ll=(e,n,t)=>pr.rowActions?.(e,n,t)??null,sl=(e,n,t,o)=>{if(yt)return null;if(ir(t.type,t))return null;const r=Boolean(t.props._hidden);/* @__PURE__ */
15
- return tt(Ee,{kind:"eye",label:r?Ht.showNamed({name:o}):Ht.hideNamed({name:o}),onClick:()=>al(e,n,t),children:/* @__PURE__ */tt(r?qn:_n,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},dl=e=>Is(we,e),al=(e,n,t)=>{oo.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},cl=e=>Oe(Nt,e),pl=e=>Ce(Nt,e),ul=e=>rr.slotsOf?zi(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:Be(e,n.slot)})):[{slot:null,rung:null,kids:pl(e)}],hl=e=>rr.slotsOf?ul(e).flatMap(e=>e.kids):pl(e),fl=e=>Boolean(rr.slotsOf)&&zi(e).some(e=>e.rung),ml=(e,n,t)=>null===t?void 0===n?ar(e):ar(e,n):ar(e,n,t),gl=(e,n,t)=>{const o=Ie(Nt,e.type,n)&&(t||hl(e).length>0||fl(e));return{collapsible:o,folded:o&&$r(String(e.props.id))}},yl=(e,n,t)=>ul(e).flatMap(o=>{const r=o.rung?n+1:n,i=o.kids.flatMap(({child:e})=>gl(e,r,t(e.type)).collapsible?[String(e.props.id),...yl(e,r+1,t)]:[]);return o.rung?[`${e.props.id}:${o.rung.slot}`,...i]:i}),kl=e=>hl(e).length>0||fl(e)||Boolean(ar(e.type)),vl=e=>Boolean(ar(e)),Sl=(e,n,t,o)=>{if(Uo(V),ar(o)?.spec?.slider){const t=e.split(":")[0];s(t,n),oo.select({index:n,zone:e}),l(t)}else oo.select({index:n,zone:e}),l(t)},bl=(e,n,t,o,r)=>{const i=`${e}:${n}`;oo.insertComponent(i,t,o),ar(r)?.spec?.slider?requestAnimationFrame(()=>{s(e,o),oo.select({index:o,zone:i})}):oo.select({index:o,zone:i})},wl=$n(/* @__PURE__ */new Set);Tn(()=>{oi.forEach(e=>{const n=ar(e.type)?.spec;if(!n)return;const t=e.props.id;if(wl.current.has(t))return;wl.current.add(t);if((Array.isArray(e.props[n.slot])?e.props[n.slot]:[]).length>0)return;if(n.skipSeed?.(e.props))return;const o=`${t}:${n.slot}`,r=n.legacy?.(e.props)??[];(r.length?r:n.seeds(yi)).forEach((e,t)=>eo.seedChild(o,t,n.childType,e))})},[oi,eo,yi]);const xl=$n(/* @__PURE__ */new Set);Tn(()=>{oi.forEach((e,t)=>{const o=e.props.id;if(xl.current.has(o))return;const r=n(e,cl(e.type));xl.current.add(o),r&&eo.replaceComponent(we,t,{...e,props:r})})},[oi,eo]),K(eo,Nt);const zl=oi.findIndex(Vt),Cl=zl>=0?oi[zl]:null,Ol=Ft?oi.findIndex(Et):-1,Bl=Ol>=0?oi[Ol]:null,Il=Pt.groupTab,Nl=Mn(()=>Il?e=>Tt(e.type):void 0,[Il]),Pl=Boolean(Pt.groupBadge),$l=Pt.sharedReach,Ml=e=>$l?.(e)??void 0,jl=Mn(()=>$l?new Set(oi.filter(e=>Ml(e)).map(e=>String(e.props.id))):null,[oi,$l]),Tl=Mn(()=>jl?e=>jl.has(e):void 0,[jl]),Al=Pt.first?$l?.({type:Pt.first,props:{id:""}})??void 0:void 0,Ll=Pt.groupBadge?/* @__PURE__ */tt("span",{className:"es-tree-group-badge",children:/* @__PURE__ */tt(Vn,{tone:"info",size:"xs",children:Pt.groupBadge})}):void 0,Rl=oi.find(e=>e.type===Mt)??null,El=oi.find(e=>e.type===jt)??null,Vl=zl>=0?zl:oi.length,Fl=[];oi.forEach(e=>{Vt(e)||(kl(e)&&Fl.push(String(e.props.id)),Fl.push(...yl(e,1,vl)))}),Cl&&(Fl.push(String(Cl.props.id)),Fl.push(...yl(Cl,1,vl)));const Dl=Fl.length>0&&Fl.every(e=>zr.has(e)),Hl=e=>{const n=pr.blockRowName(e,gi);return pr.rowName?pr.rowName(e,"block",n):n},Wl=(e,n,t,o)=>{const r=wi(e)[t];if(!r)return;const i={...In(e),index:t},l={...In(n),index:Math.min(Math.max(o,0),wi(n).length)},s=mn(i,l);if(e!==n||s!==t)try{ai.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof Pn))throw e}},Ul=e=>{const n=/* @__PURE__ */new Set,t=e=>{for(const{child:o,zone:r}of pl(e))n.add(r),t(o)};for(const t of cl(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},Gl=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=Si.get(n);if(!e)return null;if(e.zone===we)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},Xl=e=>{const n=e.slice(0,e.indexOf(":")),t=oi.find(e=>Tt(e.type)&&String(e.props.id)===n);return t&&At(n)===e?t:null},Yl=(e,n)=>{const t=Xl(e);return!t||(!Pt.groupAccepts||Pt.groupAccepts(t.type,n,wi(e).length))},Jl=(e,n,t)=>{if(e.rung){const t=xi(e.rung.nodeId),o=t?zi(t).filter(e=>e.rung).length:0;return n.parentId===e.rung.nodeId&&n.slot===ut&&n.index>=0&&n.index<=o}if(n.slot===ut)return!1;if(e.add)return ql(e.add,n);const o=Bn(n);if(Tt(e.type))return!1;const r=Xl(o),i=Xl(e.zone);if(r||i)return!(!r||!i)&&(!(r!==i&&!Yl(o,e.type))&&(n.index>=0&&n.index<=wi(o).length));if(e.zone===we||o===we){if(e.zone!==o)return!1;const{floor:t,cap:r}=ri();return n.index>=t&&n.index<=r}if(n.index<0||n.index>wi(o).length)return!1;if(e.zone===o)return!0;const l=Cl&&!Pt.lastIsOpen?String(Cl.props.id):null;return(!l||Gl(e.zone)!==l&&Gl(o)!==l)&&((e,n,t,o)=>{if(e===n)return!0;const r=o??wi(e)[t];if(!r)return!1;const i=n.split(":")[0],l=Si.get(i),s=l?wi(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&Ul(r).has(n))return!1;const d=ar(s.type,sr(zt?.data,s.type,i),n.slice(n.lastIndexOf(":")+1));return!!d&&(!!(d.choices?d.choices.some(e=>e.type===r.type):d.spec?.childType===r.type)&&!d.spec?.addBlocked?.(wi(n),r))})(e.zone,o,e.index,t)},Kl=(e,n)=>{const t=Bn(e.from),o=e.node;return t===Bn(n)?Yl(t,o.type):Jl({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},Ql=e=>{const n=e.slice(0,e.indexOf(":")),t=Si.get(n),o=t?wi(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=ar(o.type,sr(zt?.data,o.type,n),e.slice(e.lastIndexOf(":")+1));if(!r||`${n}:${r.slot}`!==e)return null;if("footer"===r.source)return null;const i=I(r.choices??(r.spec?[{type:r.spec.childType,label:gi(r.spec.childType)}]:[])),l=Ci(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:nl(o,t.zone===we)}},Zl=(e,n)=>{if("section"!==e.kind)return e;const t=Bn(n);return t===we||Xl(t)?e:Ql(t)?.choices.some(n=>n.type===e.type)?{kind:"block",type:e.type}:e},ql=(e,n)=>{const t=Zl(e,n),o=Bn(n);if("shared"===t.kind){if(o!==we||!Pt.shared?.nodeOf(t.section))return!1;const{floor:e,cap:r}=ri();return n.index>=e&&n.index<=r}if("block"!==t.kind){if(Xl(o)){const e="section"===t.kind?t.type:t.template.node.type;return Yl(o,e)&&n.index>=0&&n.index<=wi(o).length}if(o!==we)return!1;const{floor:e,cap:r}=ri();return n.index>=e&&n.index<=r}if(o===we)return!1;const r=Ql(o);return!(!r||!r.choices.some(e=>e.type===t.type))&&!r.target.spec?.addBlocked?.(wi(o))},_l=(e,n)=>{const t=Zl(e,n);if("block"!==t.kind&&Xl(Bn(n)))return void((e,n,t)=>{const o="section"===e.kind?e.type:"template"===e.kind?e.template.node.type:null;if(o&&Yl(n,o)){if("section"===e.kind)oo.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;oo.insertNode(n,t,si(e.template.node))}Uo(V),oo.select({index:t,zone:n})}})(t,Bn(n),n.index);if("section"===t.kind)return void Zi(t.type,n.index);if("template"===t.kind)return void((e,n,t)=>{const o=Ji(t),r=oo.insertNode(we,o,n);Qi(o,r,e)})(t.template.name,si(t.template.node),n.index);if("shared"===t.kind){const e=Pt.shared?.nodeOf(t.section);if(!e)return;const o=Ji(n.index);return void(ai.restore(e,{parentId:Cn,slot:On,index:o})&&Qi(o,e.props.id,t.section.title))}const o=Bn(n),r=Ql(o);r&&(r.target.spec?bl(r.parentId,r.target.slot,t.type,n.index,r.parent.type):((e,n,t)=>{oo.insertComponent(e,n,t),Uo(V),oo.select({index:t,zone:e})})(o,t.type,n.index))},es=(e,n)=>{e.rung?Pi(e.rung.nodeId,e.index,n.index):e.add?_l(e.add,n):e.zone===we?Ki(e.index,n.index):Wl(e.zone,Bn(n),e.index,n.index)},[ns]=jn(()=>hn()),ts=fn({keyOf:e=>e.id,readOnly:Boolean(yt),session:ns,canDrop:Jl,onDrop:es,onStep:(e,n)=>{e.rung?Pi(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===we?((e,n)=>{const t=ki(oi[e]?.type??""),o=Ki(e,n<0?e-1:e+2);if(!o.moved)return void Lr(n<0?Ht.sectionFirst({name:t}):Ht.sectionLast({name:t}));const{floor:r,cap:i}=ri();Lr(Ht.sectionMoved({name:t,n:o.dest-r+1,total:i-r}))})(e.index,n):Wl(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),os=An(e=>{const{floor:n,cap:t}=ri(),o=[];for(const r of e.nodes){const e=Bn(r.place),i=wi(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(Et(i)||Vt(i)||ir(i.type,i))continue;if(Tt(i.type))continue;const l=Boolean(Xl(e)),s=e===we||l;e===we&&t-n<2||o.push({key:r.id,item:{id:r.id,zone:e,index:r.place.index,type:i.type},box:r.box,label:s?ki(i.type):ji(i),from:r.place})}const r=e.zones.flatMap(e=>{const n=Bn(e.list);if(n===we&&0===e.children.length)return[{...e,addLabel:Ht.addSection,addAlways:!0}];const t=Ql(n),o=t?.target.spec?.addLabel;return e.children.length>0||Boolean(t?.choices.length)||Boolean(Xl(n))?[o?{...e,addLabel:o}:e]:[]}),i=r.flatMap(e=>{const n=Bn(e.list),t=n===we||Xl(n)?null:Ql(n);return t?.choices.length?an(e,t.target.spec?.addLabel??Ht.addBlockHere):[]});return{sources:o,zones:r,seams:i}},[zt.data]),rs=null==Bt?.props.id?null:String(Bt.props.id),is=An(e=>{const n=Nt,t=e=>!e.item.rung&&null!==Nn(zt.data,n,e.item.id),o=e[e.length-1];if(!t(o))return o;const r=n=>e.find(e=>t(e)&&e.item.id===n),i=r(rs);return i||(r(Ue(zt.data,n,o.item.id,rs,Nl))??o)},[zt.data,Nt,rs,Nl]),[ls,ss]=jn(null),ds=Boolean(Il||$l);Sn(Io,"mouseover",e=>{if(!ds)return;const n=bn(e.target),t=n?st(zt.data,Nt,n):null;t!==ls&&ss(t)}),Sn(Io,"mouseout",e=>{ds&&!e.relatedTarget&&ss(null)});const as=e=>Et(e)||Vt(e)||Tt(e.type),cs=e=>{const n=Tt(e.type)?gi(e.type):Et(e)?Ht.header:Vt(e)?Ht.footer:null;return null===n?vi(e):pr.rowName?pr.rowName(e,"section",n):n},ps=[];if(ds){const e=rs?st(zt.data,Nt,rs):null;for(const n of/* @__PURE__ */new Set([e,ls])){const e=n?oi.find(e=>String(e.props.id)===n):void 0;if(!e)continue;const t=Et(e)||e.type===Mt,o=Ml(e);if(o){ps.push({id:String(e.props.id),label:cs(e),below:t,reach:o});continue}if(!Il||!as(e))continue;const r=Il(e);r&&ps.push({id:String(e.props.id),label:r,below:t})}}const us=ae(),hs=$n(null);Tn(()=>{const e=Pt.changeNotice;if(!e)return;const n=JSON.stringify(oi.filter(as)),t=hs.current;if(hs.current={doc:xn,bands:n,index:Ot.index},!t||t.doc!==xn||t.bands===n)return;Ot.hasPast&&Ot.index>=t.index&&!lt.has(us)&&(lt.add(us),Lr(e,"success",{action:{label:Ht.bar.undo,onClick:()=>Ot.back()},duration:8e3}))},[oi]);const fs=e=>{Uo(V),oo.select(e.zone===we?{index:e.index}:{index:e.index,zone:e.zone})},ms=Q(),gs=()=>({data:zt.data,device:ho,ops:oo,inspector:nr}),ys=ms?.model,ks=Mn(()=>ys?e=>ys(e,os(e),gs()):os,[ys,os,ho]),vs=ms?.measure,Ss=vs?(e,n)=>vs(e,n,gs()):void 0,bs=ms?.canDrop,ws=bs?(e,n)=>bs(e,n,Jl,gs()):Jl,xs=ms?.drop,zs=xs?(e,n)=>xs(e,n,es,gs()):es,Cs=ms?.pick,Os=Cs?e=>Cs(e,fs,gs()):fs,Bs=e=>{const n=Bn(e),t=Ci(n);t&&Ii(t.node,t.slot,!1),_i(n,e.index)},Is=(e,n)=>/* @__PURE__ */tt(Ve,{...yt?{}:ts.seam({place:{...In(e),index:n}})},`seam:${e}:${n}`),Ns={rowClick:tl,isCollapsed:$r,toggleCollapse:Mr},Ps=e=>{const n=String(e.props.id),t=oi.findIndex(e=>String(e.props.id)===n),o=At(n),r=wi(o),i=$r(n),l=gi(e.type),s=pr.rowName?pr.rowName(e,"section",l):l,d=e=>Is(o,e);/* @__PURE__ */
16
- return ot(rt,{children:[
17
- /* @__PURE__ */tt(Te,{words:Wt,icon:/* @__PURE__ */tt(hr,{type:e.type,size:13}),name:s,preview:rl(e),marks:il(e),onSelect:()=>Yi(t),nameSlot:Ai(we,t,n,s),selected:Xo===n,badge:Ml(e)?void 0:Ll,shared:Ml(e),actions:ll(e,we,t)??void 0,rowProps:{"data-node-id":n,onClick:tl(()=>Yi(t))},fold:{open:!i,label:"section",onToggle:()=>Mr(n)}}),!i&&/* @__PURE__ */ot(Ae,{children:[r.map((n,t)=>{const r=String(n.props.id),i=vi(n),l=kl(n),s=l&&$r(r),a=()=>Sl(o,t,r,e.type),{rowProps:c,...p}=ts.row({item:{id:r,zone:o,index:t,type:n.type},place:{...In(o),index:t}},{"data-node-id":r,onClick:tl(a)});/* @__PURE__ */
18
- return ot(Rn,{children:[d(t),
19
- /* @__PURE__ */tt(Te,{words:Wt,icon:/* @__PURE__ */tt(hr,{type:n.type,size:13}),name:i,preview:rl(n),marks:il(n),onSelect:a,nameSlot:Ai(o,t,r,i),selected:Xo===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>Mr(r)}:void 0,actions:/* @__PURE__ */ot(rt,{children:[ol(o,t,i),ll(n,o,t),sl(o,t,n,i)]}),rowProps:c}),l&&!s&&/* @__PURE__ */tt(Ae,{children:js(n,2)})]},r)}),d(r.length)]})]})},$s=(e,n,t,o,r)=>{const i=String(e.props.id),l=`${i}:${n.slot}`,s=ts.dragging,d=!$r(l)&&s?.rung?.nodeId!==i,a={...In(l),index:0},c=s&&!s.rung&&Jl(s,a)?a:void 0,p=()=>Ii(e,n,!0),{rowProps:u,...h}=ts.row({item:{id:`rung:${l}`,zone:`${i}:${ut}`,index:t,type:e.type,rung:{nodeId:i,slot:n.slot}},place:{parentId:i,slot:ut,index:t},into:c,canDrag:Boolean(rr.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:tl(p)}),f=yt?null:rr.slotActions?.(e,n.slot);/* @__PURE__ */
20
- return ot(Rn,{children:[n.heading,
21
- /* @__PURE__ */tt(Te,{words:Wt,icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:Oi===l,...h,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>Mr(l)},actions:f&&f.length>0?/* @__PURE__ */tt(rt,{children:f.map((t,o)=>/* @__PURE__ */tt(Ee,{kind:"delete"===t.kind?"delete":"plain",label:t.label,disabled:t.disabled,onClick:()=>((e,n,t)=>{if(yt||t.disabled)return;const o=String(e.props.id),r=e=>{"string"==typeof e&&Ni(o,e,n.panel)},i=t.run();i&&"function"==typeof i.then?i.then(r):r(i)})(e,n,t),children:"delete"===t.kind?/* @__PURE__ */tt(Zn,{size:15}):/* @__PURE__ */tt(nt,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */tt(Ae,{children:r})]},l)},Ms=(e,n)=>{const t=ul(e),o=t.filter(e=>e.rung).length;let r=0;/* @__PURE__ */
22
- return tt(rt,{children:t.map(t=>{const i=t.kids,l=t.rung?n+1:n,s=ml(e.type,void 0,t.slot),d=s?`${e.props.id}:${s.slot}`:null,a=null===t.slot?null:`${e.props.id}:${t.slot}`,c=(e,n)=>Is(e,n),p=/* @__PURE__ */ot(rt,{children:[i.map(({child:n,zone:t,index:o})=>{const r=Xo===String(n.props.id),{collapsible:i,folded:s}=gl(n,l,vl(n.type)),d=String(n.props.id),a=Hl(n),p=()=>Sl(t,o,d,e.type),{rowProps:u,...h}=ts.row({item:{id:d,zone:t,index:o,type:n.type},place:{...In(t),index:o}},{"data-node-id":d,onClick:tl(p)});/* @__PURE__ */
23
- return ot(Rn,{children:[0===o&&c(t,0),
24
- /* @__PURE__ */tt(Te,{words:Wt,icon:/* @__PURE__ */tt(hr,{type:n.type,size:13}),name:a,preview:rl(n),marks:il(n),onSelect:p,nameSlot:Ai(t,o,d,a),selected:r,hidden:Boolean(n.props._hidden),...h,fold:i?{open:!s,label:"group",onToggle:()=>Mr(d)}:void 0,actions:/* @__PURE__ */ot(rt,{children:[ol(t,o,a),ll(n,t,o),sl(t,o,n,a)]}),rowProps:u}),i&&!s&&/* @__PURE__ */tt(Ae,{children:Ms(n,l+1)}),c(t,o+1)]},String(n.props.id??`${t}-${o}`))}),null===a?d&&!i.some(e=>e.zone===d)?c(d,0):null:0!==i.length||!t.rung&&d!==a?null:c(a,0)]});return t.rung?$s(e,t.rung,r++,o,p):/* @__PURE__ */tt(Rn,{children:p},t.slot??"")})})},js=(e,n)=>{const t=sr(zt?.data,e.type,String(e.props.id)),o=ul(e),r=o.filter(e=>e.rung).length;let i=0;/* @__PURE__ */
25
- return tt(rt,{children:o.map(o=>{const l=o.kids,s=o.rung?n+1:n,d=ml(e.type,t,o.slot),a=d?.spec??null,c=a&&Array.isArray(e.props[a.slot])?e.props[a.slot]:[],p=d&&d.choices?{slot:d.slot,choices:d.choices}:null,u=String(e.props.id),h=a&&!a.fixed?`${u}:${a.slot}`:null,f=p?`${u}:${p.slot}`:null,m=(e,n)=>Is(e,n),g=null===o.slot?null:`${u}:${o.slot}`,y=Boolean(a&&!a.fixed&&(null===g||g===h)),k=/* @__PURE__ */ot(rt,{children:[l.map(({child:n,zone:t,index:o})=>{const r=Xo===String(n.props.id),i=ji(n),l=String(n.props.id),{collapsible:d,folded:a}=gl(n,s,vl(n.type)),c=cl(n.type),p=1===c.length?`${l}:${c[0]}`:null,u=p?{...In(p),index:wi(p).length}:void 0,h=ts.dragging,f=u&&h&&Jl(h,u)?u:void 0,g=()=>Sl(t,o,l,e.type),{rowProps:y,...k}=ts.row({item:{id:l,zone:t,index:o,type:n.type},place:{...In(t),index:o},into:f,canDrag:!ir(n.type,n)},{"data-node-id":l,onClick:tl(g)});/* @__PURE__ */
26
- return ot(Rn,{children:[0===o&&m(t,0),
27
- /* @__PURE__ */tt(Te,{words:Wt,icon:/* @__PURE__ */tt(hr,{type:n.type,size:13}),name:i,preview:rl(n),marks:il(n),onSelect:g,nameSlot:Ai(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...k,fold:d?{open:!a,label:"group",onToggle:()=>Mr(l)}:void 0,actions:ir(n.type,n)?ll(n,t,o)??void 0:/* @__PURE__ */ot(rt,{children:[ol(t,o,i),ll(n,t,o),sl(t,o,n,i)]}),rowProps:y}),d&&!a&&/* @__PURE__ */tt(Ae,{children:js(n,s+1)}),m(t,o+1)]},String(n.props.id??`${t}-${o}`))}),y&&a&&
28
- /* @__PURE__ */tt(w,{small:!0,label:a.addLabel,blocked:a.addBlocked?.(c)??null,onAdd:()=>bl(e.props.id,a.slot,a.childType,c.length,e.type)}),null===g?f&&!l.some(e=>e.zone===f)?m(f,0):null:0!==l.length||(o.rung?y:g!==f)?null:m(g,0)]});return o.rung?$s(e,o.rung,i++,r,k):/* @__PURE__ */tt(Rn,{children:k},o.slot??"")})})},Ts=Ao||null!==yo,As=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:io&&!Ts&&or===e.id,onSelect:()=>_r(e.id)}:e,Ls=[...(tr.railLead??[]).map(As),{id:"sections",label:Ht.layers,icon:/* @__PURE__ */tt(ue,{}),active:io&&!Ts&&"sections"===or,onSelect:()=>_r("sections")},...(tr.railTrail??[]).map(As)];go?Ls.push({id:"media",label:Ht.railMedia,icon:/* @__PURE__ */tt(he,{}),active:io&&!Ao&&(null!==yo||"media"===or),onSelect:()=>_r("media")}):bt&&Ls.push({id:"media",label:Ht.railMedia,icon:/* @__PURE__ */tt(he,{}),onSelect:ei});const Rs=[...tr.railLead??[],...tr.railTrail??[]].find(e=>"panel"in e&&e.id===or),Es=Boolean(Dt?.foldable),Vs=Dt?.label??(wt?Ht.pageSections:Ht.templateSections),Fs=Es&&$r(ht),Ds=/* @__PURE__ */ot(rt,{children:[oi.map((e,n)=>{if(Et(e)||Vt(e)||Tt(e.type))return null;const t=Xo===String(e.props.id),o=Boolean(e.props._hidden);pl(e);const r=String(e.props.id),i=tr.hasOwnRows?.(e)??!1,l=kl(e)||i,s=l&&$r(r),d=cl(e.type),a=1===d.length?`${r}:${d[0]}`:null,c=a?{...In(a),index:wi(a).length}:void 0,p=ts.dragging,u=c&&p&&Jl(p,c)?c:void 0,{rowProps:h,...f}=ts.row({item:{id:r,zone:we,index:n,type:e.type},place:{...In(we),index:n},into:u,canDrag:!ir(e.type,e)},{"data-node-id":r,onClick:tl(()=>Yi(n))});/* @__PURE__ */
29
- return ot(Rn,{children:[n>0&&dl(n),
30
- /* @__PURE__ */tt(Te,{words:Wt,icon:/* @__PURE__ */tt(hr,{type:e.type,size:13}),name:vi(e),preview:rl(e),marks:il(e),shared:Ml(e),onSelect:()=>Yi(n),nameSlot:Ai(we,n,r,vi(e)),selected:t,hidden:o,...f,fold:l?{open:!s,label:"section",onToggle:()=>Mr(r)}:void 0,actions:/* @__PURE__ */ot(rt,{children:[ol(we,n,vi(e)),ll(e,we,n),sl(we,n,e,vi(e))]}),rowProps:h}),kl(e)&&!s&&/* @__PURE__ */ot(Ae,{children:[js(e,1),tr.partRows?.(e,Ns)]}),i&&!s&&/* @__PURE__ */tt(Ae,{children:tr.ownRows?.(e,n,Ns)})]},String(e.props.id??n))}),Vl>0&&dl(Vl)]}),Hs=(e,n,t)=>{const o=String(e.props.id),r=hl(e).length>0||fl(e)||Boolean(ar(e.type)),i=r&&$r(o),l="header"===t?Ht.header:Ht.footer,s=pr.rowName?pr.rowName(e,"section",l):l;/* @__PURE__ */
31
- return ot(rt,{children:[
32
- /* @__PURE__ */tt(Te,{words:Wt,icon:/* @__PURE__ */tt(hr,{type:t,size:13}),name:s,preview:rl(e),marks:il(e),badge:Ml(e)?void 0:Ll,shared:Ml(e),onSelect:()=>Yi(n),nameSlot:Ai(we,n,o,s),selected:Xo===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>Mr(o)}:void 0,actions:ll(e,we,n)??void 0,rowProps:{"data-node-id":o,onClick:tl(()=>Yi(n))}}),r&&!i&&/* @__PURE__ */tt(Ae,{children:Ms(e,1)})]})};return(tr.wrap??(e=>e))(
33
- /* @__PURE__ */tt(Z,{target:Io,children:/* @__PURE__ */ot("div",{ref:Bo,className:"sf-editor es-editor",style:nn(Or),onContextMenu:Di.onEditorContextMenu,...u(yn),children:[
34
- /* @__PURE__ */ot(Ge,{children:[
35
- /* @__PURE__ */tt(Xe,{items:Ls,ariaLabel:Ht.bar.views}),
36
- /* @__PURE__ */ot(Ye,{children:[
37
- /* @__PURE__ */tt(Je,{label:Ht.bar.undo,disabled:Boolean(yt)||!Ot.hasPast,onClick:()=>Ot.back(),children:/* @__PURE__ */tt(Yn,{})}),
38
- /* @__PURE__ */tt(Je,{label:Ht.bar.redo,disabled:Boolean(yt)||!Ot.hasFuture,onClick:()=>Ot.forward(),children:/* @__PURE__ */tt(Jn,{})}),
39
- /* @__PURE__ */tt(Ke,{}),
40
- /* @__PURE__ */tt(Qe,{devices:so,value:ho,onChange:fo}),
41
- /* @__PURE__ */tt(Je,{label:Ht.bar.refresh,tip:Ht.bar.refreshTip,onClick:()=>{Oo.current=(()=>{const e=Io?.document;if(!e)return null;const n=oi.findIndex(Vt),t=n>=0?n:oi.length;let o=null;for(let n=0;n<t;n++){const t=oi[n]?.props?.id;if(null==t)continue;const r=e.querySelector(`[data-puck-component="${CSS.escape(String(t))}"]`);if(!r)continue;const i=r.getBoundingClientRect().top;i<=4&&(null===o||i>o.offset)&&(o={id:String(t),offset:i})}if(!o){const e=Bt?.props?.id??oi[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),Co(e=>e+1)},children:/* @__PURE__ */tt(Kn,{})})]}),
42
- /* @__PURE__ */ot(Ye,{kind:"right",style:{minWidth:300},children:[
43
- /* @__PURE__ */tt(v,{input:jo,words:Ht.saveStatus}),tr.barLead?.(),tr.barTrail?.(),tr.mainAction||!tr.barMain?/* @__PURE__ */tt(S,{input:jo,action:tr.mainAction??{label:Ht.done,onPress:()=>{Hn(zt.data)}},readOnly:Boolean(yt),saveSwitch:vt,onToggleAutoSave:Xn,onSaveNow:To,bar:Ht.bar,words:Ht.saveStatus}):tr.barMain()]})]}),
44
- /* @__PURE__ */tt(oe,{}),
45
- /* @__PURE__ */ot("div",{className:"sf-body",children:[io?/* @__PURE__ */ot(rt,{children:[
46
- /* @__PURE__ */tt("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left","aria-label":Ht.leftPanel,children:Ao?/* @__PURE__ */tt(x,{at:Vo?{label:(e=>{const n=Xl(e.zone);if(n)return Ht.add.addingTo({name:pr.rowName?nl(n,!0):gi(n.type)});if(e.zone===we){const n=oi[e.index];return n&&!Vt(n)?Ht.add.addingBefore({name:nl(n,!0)}):Ht.add.addingAtEnd}const t=Ql(e.zone);return t?Ht.add.addingTo({name:t.parentName}):Ht.add.addingHere})(Vo),onClear:()=>Fo(null)}:void 0,placeBlocks:Vo&&Vo.zone!==we?Ql(Vo.zone)?.choices:void 0,canTake:Vo?e=>{if(!Vo)return null;const n={...In(Vo.zone),index:Vo.index};if(ql(e,n))return null;if("shared"===e.kind&&Vo.zone===we&&!Pt.shared?.nodeOf(e.section))return Ht.shared.alreadyHere;const t=Xl(Vo.zone);if(t)return Ht.add.notInside({name:nl(t,!0)});if(Vo.zone===we)return Ht.add.onlySections;const o=Ql(Vo.zone);return o?Ht.add.notInside({name:o.parentName}):Ht.add.onlySections}:void 0,onPick:Vo?e=>{if(!Vo)return;const n={...In(Vo.zone),index:Vo.index};ql(e,n)&&(_l(e,n),el())}:void 0,itemFor:e=>({id:`new:${e.kind}:${"template"===e.kind?e.template.id:"shared"===e.kind?e.section.id:e.type}`,zone:"",index:-1,type:"template"===e.kind?e.template.node.type:"shared"===e.kind?e.section.node.type:e.type,add:e}),session:ns,siteWide:tr.addPanelRow?.(el),onClose:el,onHide:Zr,readOnly:Boolean(yt)}):yo&&mo?
47
- /* @__PURE__ */tt(N,{panel:mo,pick:yo,onHide:Zr}):Rs?Rs.panel({onHide:Zr,notify:Lr}):"media"===or&&mo?/* @__PURE__ */tt(N,{panel:mo,pick:null,onHide:Zr}):/* @__PURE__ */ot(rt,{children:[
48
- /* @__PURE__ */tt(O,{icon:/* @__PURE__ */tt(ue,{}),title:Ht.layers,context:Qt,actions:/* @__PURE__ */ot(rt,{children:[!yt&&/* @__PURE__ */tt(Ze,{label:Ht.add.title,onClick:()=>qi(null),children:/* @__PURE__ */tt(Qn,{size:15})}),
49
- /* @__PURE__ */tt(Ze,{label:Dl?Ht.expandAll:Ht.collapseAll,title:0===Fl.length?Ht.nothingToFold:void 0,disabled:0===Fl.length,onClick:()=>Cr(e=>{const n=new Set(Fl);return Dl?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,...Fl])}),children:/* @__PURE__ */tt(at,{expand:Dl})})]}),onHide:Zr}),
50
- /* @__PURE__ */ot(Le,{className:"sf-tree sf-scroll",words:Wt,children:[
51
- /* @__PURE__ */tt(Te,{words:Wt,icon:/* @__PURE__ */tt(hr,{type:"page",size:13}),name:Ht.pageSettings,onSelect:ni,selected:!Bt&&Go,rowProps:{onClick:tl(ni)}}),Rl&&/* @__PURE__ */ot(rt,{children:[!Pl&&/* @__PURE__ */tt(Re,{children:Ht.header}),Ps(Rl)]}),xt&&!(Pl&&Rl)&&/* @__PURE__ */ot(rt,{children:[!Pl&&/* @__PURE__ */tt(Re,{children:Ht.header}),!Ft&&/* @__PURE__ */tt(Te,{words:Wt,icon:/* @__PURE__ */tt(hr,{type:"header",size:13}),name:Ht.header,badge:Al?void 0:Ll,shared:Al,onSelect:ti,selected:Wo.kind===Rt?.kind,rowProps:{onClick:tl(ti)}})]}),Bl&&!(Pl&&Rl)&&Hs(Bl,Ol,"header"),!Es&&/* @__PURE__ */tt(Re,{children:Vs}),Es?/* @__PURE__ */ot(rt,{children:[
52
- /* @__PURE__ */tt(Te,{words:Wt,icon:null,name:Vs,fold:{open:!Fs,label:Vs,onToggle:()=>Mr(ht)}}),!Fs&&/* @__PURE__ */tt(Ae,{children:Ds})]}):Ds,xt&&!Pl&&/* @__PURE__ */tt(Re,{children:Ht.footer}),Cl&&!(Pl&&El)&&Hs(Cl,zl,"footer"),El&&Ps(El),tr.treeFoot?.()]})]})}),
53
- /* @__PURE__ */tt(qe,{side:"left",width:Or.left,min:en,max:_e,defaultWidth:m.left,label:Ht.resizeLeftPanel,onResize:Nr})]}):/* @__PURE__ */tt(B,{side:"left",onShow:Zr}),
54
- /* @__PURE__ */ot("div",{ref:Rr,className:"sf-center sf-scroll","data-sf-canvas-head":Hr?"":void 0,style:{overflowX:Jr?"auto":"hidden",overflowY:"hidden"},children:[Hr&&/* @__PURE__ */tt("div",{ref:Wr,className:"sf-canvas-head",children:/* @__PURE__ */tt(Hr,{device:ho})}),
55
- /* @__PURE__ */ot("div",{className:"sf-frame-scaler",style:Kr,children:[
56
- /* @__PURE__ */tt("div",{className:"sf-frame "+(ho===po?"":`sf-frame--${ho}`),style:Qr,children:/* @__PURE__ */ot("div",{className:"sf-preview-host",children:[
57
- /* @__PURE__ */tt(Me.Provider,{value:Nl,children:/* @__PURE__ */tt(je.Provider,{value:Tl,children:/* @__PURE__ */tt(Zt,{},zo)})}),
58
- /* @__PURE__ */tt(cn,{canvas:Io,session:ns,model:ks,measure:Ss,canDrop:ws,onDrop:zs,choose:is,onPick:Os,onZoneAdd:Bs,onSeamAdd:Bs,zoneAddLabel:Ht.canvasAddBlock,words:Ut.canvas,readOnly:Boolean(yt),revision:zt.data}),Do.length>0&&!No&&/* @__PURE__ */tt("div",{className:"sf-preview-gaps",children:Do.map(e=>
59
- /* @__PURE__ */tt(pn,{index:e.index,label:Ht.addSectionHere,onInsert:()=>qi(e.index),className:void 0===e.height?"sf-preview-gap":"sf-preview-gap sf-preview-gap--tight",style:void 0===e.height?{top:e.top}:{top:e.top,height:e.height}},e.index))})]})}),ds?/* @__PURE__ */tt(dt,{canvas:Io,tabs:ps,onSelect:e=>{const n=oi.findIndex(n=>String(n.props.id)===e);n>=0&&Yi(n)}}):null]})]}),lo?/* @__PURE__ */ot(rt,{children:[
60
- /* @__PURE__ */tt(h,{value:{selectChild:Sl,addChild:bl,childRowName:ji,blockRowName:Hl},children:/* @__PURE__ */tt(qt,{mode:Wo,onOpenWebsiteSettings:tr.openSettings??(()=>{}),onOpenSiteStyles:tr.openStyles,onSelectNode:yr,onNotify:Lr,onHidePanel:qr,nodeActions:Bt?xe(Nt,Bt.type):ft})}),
61
- /* @__PURE__ */tt(qe,{side:"right",width:Or.right,min:en,max:_e,defaultWidth:m.right,label:Ht.resizeSettingsPanel,onResize:Pr})]}):
62
- /* @__PURE__ */tt(B,{side:"right",onShow:qr})]}),Di.menu,pi?/* @__PURE__ */tt(it,{name:pi.name,onMake:e=>(async(e,n)=>{const t=oi.find(n=>String(n.props.id)===e),o=Pt.shared;if(!t||!o)return;let r;try{r=await C(ci).create(n,t)}catch{return void Lr(Ht.shared.makeFailed,"error")}o.adopt(t,r),ui(null)})(pi.id,e),onCancel:()=>ui(null)}):null]})}))}export{mt as ScreenChrome};
@@ -1,2 +0,0 @@
1
- import{useEaselHost as e}from"./chunk-U3JP4VGF.js";import{createContext as n,useState as t,useEffect as r,useMemo as l,useContext as o,useSyncExternalStore as u,useRef as c}from"react";import{jsx as s}from"react/jsx-runtime";var i=/* @__PURE__ */new Set,f=()=>{for(const e of[...i])e()};function a(){let e=null;const n=/* @__PURE__ */new Set,t=()=>{for(const e of[...n])e();f()},r=(n,r)=>{if(!e||e.request.requestId!==n)return;const{resolve:l}=e;e=null,t(),l(r)};return{current:()=>e?.request??null,request:n=>new Promise(r=>{const l=e;e={request:n,resolve:r},t(),l?.resolve(null)}),settle:r,cancel:()=>{e&&r(e.request.requestId,null)},subscribe:e=>(n.add(e),()=>{n.delete(e)})}}var d=[],p=null,h=a(),v=()=>d[d.length-1]??p,m=()=>v()?.store??h,q=n(null);function b({panel:n,children:o}){const u=e(),[c]=t(()=>({panel:n,host:u,store:a()}));c.panel=n,c.host=u,d.includes(c)||(p=c),r(()=>{const e=d.indexOf(c);return e>=0&&d.splice(e,1),d.push(c),p?.host===c.host&&(p=null),f(),()=>{const e=d.indexOf(c);e>=0&&d.splice(e,1),p===c&&(p=null),c.store.cancel(),f()}},[c]);const i=l(()=>({panel:n,store:c.store}),[n,c]);/* @__PURE__ */
2
- return s(q.Provider,{value:i,children:o})}function x(){return o(q)?.panel??null}function j(e){let n=null;for(let t=d.length-1;t>=0&&!n;t-=1)d[t].host===e&&(n=d[t]);n||p?.host!==e||(n=p);const t=n??v();return t?.panel?t.store:null}function w(){return null!=v()?.panel}function O(e){return m().request(e)}function P(e,n){for(const{store:t}of[...d])t.settle(e,n);p?.store.settle(e,n),h.settle(e,n)}function g(){m().cancel()}var I={current:()=>m().current(),subscribe:e=>(i.add(e),()=>{i.delete(e)}),cancel:()=>m().cancel()};function S(){return o(q)?.store??I}var k=()=>null;function F(){const e=S();return u(e.subscribe,e.current,k)}function G(){return S().cancel}function J(e,n){const t=S(),l=c(n);r(()=>{Object.is(l.current,n)||(l.current=n,e&&t.cancel())},[e,n,t])}export{b as MediaPanelProvider,g as cancelPanelPick,a as createMediaPickStore,w as hasMediaPanel,j as mediaPickStoreFor,O as requestPanelPick,P as settlePanelPick,G as useCancelPanelPick,x as useMediaPanel,F as usePanelPick,J as usePickFollowsSelection};
@@ -1,2 +0,0 @@
1
- import{routeSharedHostMessage as e}from"./chunk-S4AWJX4Q.js";import{describeLoadFailure as r,hostLoadRefusal as n}from"./chunk-ERR437B5.js";import{editLockOf as t}from"./chunk-GMCZXMOV.js";import{NO_DOCUMENT_ADDRESSING as o}from"./chunk-RLBXE4EU.js";import{saveStatusOf as u,resetForDocumentSwitch as a}from"./chunk-HNKB2ZYR.js";import{isExpiredSession as s,readEaselFailure as i}from"./chunk-CLOS6SSX.js";import{useAdminBridge as l}from"./chunk-VPFNZ7TB.js";import{STATUS_UNREACHABLE as c}from"./chunk-KCOBHPN6.js";import{useEaselSession as d}from"./chunk-O7Q4DDJT.js";import{backendOf as f,setSessionDocumentSite as m}from"./chunk-RSCMJIWS.js";import{useEaselHost as k}from"./chunk-U3JP4VGF.js";import{DEFAULT_SCREEN_WORDS as v}from"./chunk-C2RHV42O.js";import{useAutosave as g}from"./chunk-NDRZP6YR.js";import{canWriteDocument as p,newEaselClientId as h,reloadIfVersionMoved as y,openUnansweredClaim as w,FAIL_OPEN_RETRY_MS as S,CLAIM_FAIL_OPEN_MS as b,holderOf as P}from"./chunk-THWO5YVZ.js";import{useWords as I}from"./chunk-MFIRYGHW.js";import{createContext as j,useContext as R,useState as B,useMemo as C,useCallback as H,useEffect as O,useRef as E}from"react";import{jsx as T}from"react/jsx-runtime";var A={content:[],root:{},zones:{}};var D=j(null);function M(){const e=R(D);if(!e)throw new Error("useStorefrontDocument must be used within StorefrontDocumentProvider");return e}function N({target:j,addressing:R=o,onHostMessage:M,children:N}){const V=R,{homeSlug:F,entryMayBounce:L,entryBounce:W,onSwitch:Y,tellsHost:Z,adapterFor:J,migrateRenamedProps:U,describeMissing:X,onLoadFailed:x}=V,[G,K]=B(j),Q=k(),z=d(),_=C(()=>f(z),[z]),q=C(()=>t(z),[z]),$="template"===G.kind,ee="template"===G.kind?G.id:null,re="template"===G.kind?G.pageSlug??F??"":"document"===G.kind?G.slug??"":G.slug,ne="page"===G.kind?G.siteId??null:null,te=z.blocks,oe=C(()=>J(G,_,te),[J,_,te,G.kind,"template"===G.kind?G.id:"document"===G.kind?G.record:G.siteId]),ue=oe.capabilities,ae=H(e=>z.documentHooks?.stored?.(e)??e,[z]);O(()=>{m(z,ne)},[z,ne]);const se=E(G);O(()=>{se.current=G},[G]);const{token:ie,tokenRef:le,capabilities:ce}=l({onMessage:r=>{if(M?.(r)||e(r))return;const n=r;if("storefront-editor:navigate"===n?.type){const e=r;e?.target&&Br(e.target)}}}),de=!z.usesBridgedToken||null!==ie,fe=oe.lock,me=Boolean(_.lock),[ke,ve]=B(null),[ge,pe]=B(null),[he,ye]=B(null),[we,Se]=B(null),be=I("screen",v),Pe=we?function(e,r){if(null!==e.sentence)return e.sentence;if(!e.missing)return r.loadFailed({cause:e.cause});switch(e.target.kind){case"template":return r.missingTemplatePage;case"document":return r.missingDocument;default:return r.missingPage({slug:e.slug})}}(we,be):null,[Ie,je]=B(null),Re=E(null),Be=E(null),[Ce,He]=B(!1),Oe=E(null),[Ee,Te]=B(null),Ae=E(null),[De,Me]=B(null),[Ne,Ve]=B(!1),Fe=E(null);O(()=>{Fe.current=De},[De]);const[Le,We]=B(ue.hasEditLock?{kind:"checking"}:{kind:"editing"}),Ye=E(Le);O(()=>{Ye.current=Le},[Le]);const Ze=E(()=>Promise.resolve(!1)),Je=H(e=>{Be.current=e,He(!0)},[]),Ue=g({save:async({id:e,data:r})=>{if(p(Ye.current)){if(!await Ze.current(e,r)){if(!p(Ye.current))return void Je({id:e,data:r});throw new Error("page save did not land")}}else Je({id:e,data:r})},onFailure:(e,r)=>{0===r&&Q.send("storefront-editor:save-failed")}}),{state:Xe,push:xe,flush:Ge,pause:Ke,resume:Qe,stop:ze,reset:_e,retryNow:qe,hasPending:$e}=Ue,er=E(Xe);O(()=>{er.current=Xe},[Xe]);const rr=u(Xe),nr=H(()=>{const e=Be.current;e&&(Be.current=null,He(!1),xe(e))},[xe]),tr=E("");tr.current||(tr.current=h());const[or,ur]=B(0),ar=E(!1),[sr,ir]=B(L(j)),lr=E(!1);O(()=>{if(lr.current)return;lr.current=!0;const e=Q.address.search(),r=W(j,e);r?Q.address.load(r):L(j)&&ir(!1)},[j,Q]);const cr=Q.send;O(()=>{if(!de)return;let e=!1;const t=se.current,o=oe.resolve(re),u=z.documentHooks?.opening?.({slug:re,isTemplate:$,capabilities:ue});return o.then(async r=>{if(e)return;if(!r)return"page"===t.kind&&null!==F&&re!==F?void Q.address.load({kind:"page",slug:F,siteId:ne??void 0}):(Se({target:t,slug:re,missing:!0,sentence:X?.(t)??null}),void x?.(t,null));const n=r.readOnlyReason?r.readOnlyReason:null;Re.current=n,je(n),ve(r.id),pe(r.kind??null),Ae.current=r.version??null;const o=r.layout,a=o&&Object.keys(o).length?o:A,s=U(a),i=u?await u(s):s;e||ye(i)}).catch(o=>{e||(console.error("[storefront-editor] document load failed",o),Se({target:t,slug:re,missing:!1,sentence:n(o,{slug:re},z),cause:r(o,z)}),x?.(t,o))}),()=>{e=!0}},[de,ie,$,oe,re]);const dr=H(e=>new Promise(r=>{const n=Date.now(),t=setInterval(()=>{const o=le.current;o&&o!==e?(clearInterval(t),r(o)):Date.now()-n>6e3&&(clearInterval(t),r(null))},200)}),[]),fr=H(async e=>{const r=le.current;if(!r&&z.usesBridgedToken)return{ok:!1,error:new Error("no editor token")};try{return{ok:!0,value:await e(r??"")}}catch(n){if(s(n,z)){cr("storefront-editor:auth-expired");const n=r?await dr(r):null;if(n)try{return{ok:!0,value:await e(n)}}catch(e){return{ok:!1,error:e}}}return{ok:!1,error:n}}},[cr,dr,z]),mr=H(async e=>{const r=le.current?await fr(e):{ok:!1};return r.ok||cr("storefront-editor:save-failed"),r.ok},[cr,fr]),kr=H(async(e,r,n=!1)=>{if(null!==Re.current)return!1;if(!p(Ye.current))return!1;if(Fe.current)return!1;const t=await fr(()=>oe.saveLayout(e,r,Ae.current,tr.current));if(t.ok)return Ae.current=t.value.version??Ae.current,Ve(!1),!0;const o=q.readLockTaken(t.error);if(o){const e={kind:"takenover",holder:o};return Ye.current=e,We(e),!1}const u=q.readSaveConflict(t.error);if(u){if(u.savedByYou&&!n&&oe.rereadVersion){const n=await fr(()=>oe.rereadVersion(e));if(n.ok&&n.value)return Ae.current=n.value,Ze.current(e,r,!0)}ze(),Fe.current=u,Me(u)}return Ve(i(t.error,z)?.status===c),!1},[oe,fr,ze,z]);O(()=>{Ze.current=kr},[kr]);const vr=H(e=>{if(null!==Re.current)return;if(cr("storefront-editor:dirty"),!ke)return;const r=ae(e);Oe.current=r,p(Ye.current)?xe({id:ke,data:r}):Je({id:ke,data:r})},[ke,cr,Je,xe,ae]),gr=H(async()=>{p(Ye.current)&&nr();return await Ge()&&null==Be.current},[nr,Ge]),pr=E(gr);O(()=>{pr.current=gr},[gr]);const hr=E(fr);O(()=>{hr.current=fr},[fr]);const yr=H(()=>{Q.address.reload()},[Q]),wr=E(()=>Promise.resolve(!1));O(()=>{wr.current=()=>{const e=oe.rereadVersion;return ke&&e?y({ours:Ae.current,stored:async()=>{const r=await hr.current(()=>e(ke));return r.ok?r.value:null},hasPending:()=>null!=Be.current||$e(),reload:yr}):Promise.resolve(!1)}},[oe,ke,$e,yr]);const Sr=null!==Ie;O(()=>{if(!fe||!ke||!de||Sr)return;let e=!1,r=null,n=null;const t=tr.current,o={claim:async e=>{const r=await hr.current(()=>fe.claim(ke,t,e));if(r.ok)return{heartbeat_seconds:r.value.heartbeatSeconds};throw r.error},cancelled:()=>e,currentAccess:()=>Ye.current,heldWrite:()=>({pending:null!=Be.current||$e(),autoSaveEnabled:!er.current.paused,saveConflict:null!=Fe.current}),setAccess:e=>{Ye.current=e,We(e)},releaseHeldWrite:()=>{pr.current()},startHeartbeat:e=>{r&&clearInterval(r),r=setInterval(()=>{u(!1)},e)},stopHeartbeat:()=>{r&&(clearInterval(r),r=null)},reloadIfMoved:()=>{wr.current()}},u=q.makeClaimBeat(o),a=ar.current;return ar.current=!1,a||(We({kind:"checking"}),n=setTimeout(()=>{n=null,w(o)&&o.startHeartbeat(S)},b)),u(a).finally(()=>{n&&clearTimeout(n),n=null}),()=>{e=!0,n&&clearTimeout(n),r&&clearInterval(r),fe.release(ke,t).catch(()=>{})}},[ke,fe,de,ie,or,Sr]);const br=H(()=>{fe&&ke&&(ar.current=!0,ur(e=>e+1))},[ke,fe]),Pr=H(()=>{We(e=>{const r="blocked"===e.kind||"takenover"===e.kind?e.holder:null;return r?{kind:"readonly",holder:r}:e})},[]),Ir=H(()=>{er.current.paused?(p(Ye.current)&&nr(),Qe()):Ke()},[nr,Ke,Qe]),jr=H(()=>{qe()},[qe]),Rr=H(e=>{Oe.current=null,a("template"!==e.kind&&me,{resetAutosave:()=>{_e(),Be.current=null,He(!1)},setVersion:e=>{Ae.current=e},setSaveConflict:Me,setAccess:We}),Y(e),K(e),Re.current=null,je(null),ve(null),pe(null),ye(null),Se(null),Q.address.show(e),"document"!==e.kind&&Z(e)&&Q.send("storefront-editor:navigated",{target:e})},[_e,Q,me,Y,Z]),Br=H(e=>{if(function(e,r,n){if(e.kind!==r.kind)return!1;if("template"===e.kind){const t=r;return e.id===t.id&&(e.pageSlug??n)===(t.pageSlug??n)}if("document"===e.kind){const n=r;return e.record===n.record&&(e.slug??"")===(n.slug??"")}const t=r;return e.slug===t.slug&&e.siteId===t.siteId}(e,se.current,F))return;const r=null!=Be.current;if(!r&&!$e())return void Rr(e);const n=er.current;r||n.paused||n.failed||n.stopped?Te(e):Ge().then(r=>{r?Rr(e):Te(e)})},[Rr,$e,Ge,F]),Cr=H(()=>Te(null),[]),Hr=H(()=>{Te(e=>(e&&Rr(e),null))},[Rr]),Or=H(async()=>{const e=Ee;if(!e)return;await gr()&&(Te(null),Rr(e))},[Ee,gr,Rr]),Er=H(async e=>{if(null!==Re.current)return;if(!ke)return;if(!p(Ye.current)||Fe.current)return;const r=ae(e);if(!await kr(ke,r))return void(Fe.current||cr("storefront-editor:save-failed"));const n=oe.publish;if(!ue.canPublish||!n)return void cr("storefront-editor:saved");const t=await fr(()=>n(ke,Ae.current??void 0));if(!t.ok){const{error:e}=t;return void cr("storefront-editor:publish-failed",{reason:e instanceof Error&&e.message?e.message:null})}Ae.current=t.value.version??Ae.current,cr("storefront-editor:published")},[ke,oe,ue.canPublish,cr,kr,fr,ae]);/* @__PURE__ */
2
- return T(D.Provider,{value:{target:G,adapter:oe,capabilities:ue,templateId:ee,currentSlug:re,currentKind:ge,siteId:ne,ready:de,token:ie,tokenRef:le,notifyParent:cr,bridgeCapabilities:ce,runAuthed:mr,docId:ke,data:he,getLiveData:()=>Oe.current??he,error:Pe,redirecting:sr,saveStatus:rr,saveState:Xe,autoSaveEnabled:!Xe.paused,autoSaveStoppedByConflict:Xe.stopped,hasUnsavedEdits:Xe.pending||Ce,toggleAutoSave:Ir,retrySave:jr,onChange:vr,flushSave:gr,onPublish:Er,access:Le,readOnly:null!==P(Le)||null!==Ie||null!==De,readOnlyReason:Ie,takeOverEditing:br,viewReadOnly:Pr,saveConflict:De,saveUnreachable:Ne,reloadFromServer:yr,navigate:Br,pendingNav:Ee,cancelPendingNav:Cr,discardAndNavigate:Hr,saveAndNavigate:Or},children:N})}export{D as ScreenDocumentContext,N as ScreenDocumentProvider,M as useScreenDocument};
@@ -1 +0,0 @@
1
- import{DEFAULT_PANEL_W as s,clampPanelWidth as e}from"./chunk-GWIVPLOX.js";var a="sf-editor-panel-widths",l="sf-editor-collapsed-sections";function t(s){return s?{panelWidths:`${s}-panel-widths`,collapsed:`${s}-collapsed-sections`}:{panelWidths:a,collapsed:l}}var o={...s},d=s=>e(s);export{l as COLLAPSED_SECTIONS_KEY,o as DEFAULT_PANEL_W,a as PANEL_WIDTHS_KEY,d as clampPanelWidth,t as screenStorageKeys};
@@ -1,5 +0,0 @@
1
- import{usePickFollowsSelection as n}from"./chunk-R6WTQWAC.js";import{slotFieldsOf as e}from"./chunk-PLVEGYK6.js";import{EaselCanvas as t,useSelectedFields as r}from"./chunk-QEAUF632.js";import{Inspector as i}from"./chunk-5ZBV5RA6.js";import{createContext as o,useContext as u}from"react";import{DesktopIcon as l}from"efficient-shell/icons/efficient";import{jsx as s}from"react/jsx-runtime";var c={kind:"puck"};function f(n,e){const t=n,r=e,i=Object.keys(t);return i.length===Object.keys(r).length&&i.every(n=>Object.is(t[n],r[n]))}function a(n){const e=n;return"string"==typeof e.nodeId&&"string"==typeof e.slot}function d(n,t,r){const i=n.slotsOf?.(r);return i||e(t,r.type).map(n=>({slot:n,label:n,rung:!1}))}function p(n,e){return n.isFirst?n.isFirst(e):e.type===n.first}function m(n,e){return n.isLast?n.isLast(e):e.type===n.last}var k={},h=()=>k,v=()=>"",g=()=>null,y=()=>{},b={isLockedBlock:()=>!1,duplicateBlocked:()=>null,nestDepth:()=>0,newSectionNode:()=>null,canAddTo:()=>null,blockIsOffered:()=>!0},O={labelAtLevel:(n,e,t)=>t,descriptions:{},categoryLabel:()=>{},firstSection:null,blockRowName:(n,e)=>e(n.type),plainText:n=>n,Icon:()=>null,Thumbnail:()=>null,useProducts:()=>null},j={options:[{id:"desktop",label:"Desktop",icon:/* @__PURE__ */s(l,{})}],initial:"desktop",fluid:"desktop",widths:{desktop:2e3}},w={read:()=>"sections",write:()=>{},forSelection:(n,e)=>n?"sections":e},L={first:null,last:null,firstGroup:null,lastGroup:null,isSectionGroup:()=>!1,sectionGroupZone:()=>"",panelOf:()=>null};function S(){/* @__PURE__ */
2
- return s(t,{height:"fill"})}function C(){const{id:n,fields:e,values:t,readOnly:o,onChange:u}=r();/* @__PURE__ */
3
- return s("div",{className:"es-sidepanel es-sidepanel--right",children:/* @__PURE__ */s(i,{fields:e,values:t,onChange:u,readOnly:o,idPrefix:n})})}var P=o({});function A({parts:n,children:e}){/* @__PURE__ */
4
- return s(P.Provider,{value:n,children:e})}function B(){return u(P)}function D(){return(B().useOwnerName??v)()}function G(){return(B().useDocumentLabel??g)()}function N(n,e,t,r){return(B().useBridges??h)(n,e,t,r)}function x(n){return(B().useStandaloneBridges??h)(n)}function F(n,e){(B().useDocumentPass??y)(n,e)}function I(){return B().blockRules??b}function R(){return B().blockLook??O}function T(){return B().devices??j}function V(){return B().leftView??w}function E(){return B().pinned??L}function K(){return B().saveSwitch??!0}function Q(e){n(!0===B().pickFollowsSelection,e)}function W(){return B().storageNamespace||void 0}function Z(){return B().styleClipboard??null}function H(){return B().nodeKeys??!0}function U(){return B().notify??null}function Y(){return B().Canvas??S}function q(){return B().CanvasHead??null}function z(){return B().canvasDrag??null}var J=o(null);function M({target:n,children:e}){/* @__PURE__ */
5
- return s(J.Provider,{value:n,children:e})}function X(){return u(J)}function $(){return B().Inspector??C}export{c as SELECTION_MODE,M as ScreenCanvasTargetProvider,A as ScreenPartsProvider,p as isPinnedFirst,m as isPinnedLast,a as isSlotMode,f as sameInspectorMode,d as screenSlotsOf,R as useScreenBlockLook,I as useScreenBlockRules,N as useScreenBridges,z as useScreenCanvasDrag,Y as useScreenCanvasFrame,q as useScreenCanvasHead,X as useScreenCanvasTarget,T as useScreenDevices,G as useScreenDocumentLabel,F as useScreenDocumentPass,$ as useScreenInspectorPanel,V as useScreenLeftView,H as useScreenNodeKeys,U as useScreenNotify,D as useScreenOwnerName,B as useScreenParts,Q as useScreenPickFollowsSelection,E as useScreenPinned,K as useScreenSaveSwitch,W as useScreenStorageNamespace,Z as useScreenStyleClipboard,x as useStandaloneScreenBridges};
@@ -1 +0,0 @@
1
- var e={reload:"Reload the saved version",takeOver:"Take over editing",takeBack:"Take it back",viewReadOnly:"View read-only",savedByYou:({noun:e,when:i})=>`You saved this ${e} in another tab or window ${i}.`,savedByOther:({name:e,noun:i,when:n})=>`${e} saved this ${i} ${n}.`,conflictBody:"Your last change was not saved. It is still on screen here, but this copy is out of date — copy anything you need, then reload to carry on from the saved version.",takeOverWhileDeciding:"Nobody else can save while you decide. Nothing on your screen is lost.",tookOver:({name:e,noun:i,when:n})=>`${e} took over this ${i} ${n}.`,tookOverBody:"Your changes since then are still on screen but are no longer being saved.",viewingOnly:"Viewing only.",viewingOnlyBody:({name:e,noun:i,seen:n})=>`${e} is editing this ${i} (last seen ${n}). Nothing you change here is saved.`,editing:({name:e,noun:i})=>`${e} is editing this ${i}`,editingBody:({seen:e})=>`(last seen ${e}). Nothing you change here will be saved while they are in it.`,takeOverTold:"They are told straight away and stop being able to save."},i={device:"Preview device",upLevel:"Go up one level",upLevelTo:({label:e,name:i})=>`${e} to ${i}`,resize:"Drag to resize · double-click to reset",tierSection:"Section",tierBlock:"Block",partOf:({name:e})=>`Part of ${e}`,mediaLibrary:"Media library",mediaChoose:({kind:e})=>`Choose ${e}`,mediaFor:({field:e})=>`For ${e}`,mediaKinds:{image:"image",video:"video",svg:"SVG logo"},mediaCancel:"Cancel",mediaKeep:({kind:e})=>`Keep the current ${e}`,hidePanel:"Hide panel",hidePanelLabel:({side:e})=>`Hide the ${e} panel`,showPanel:"Show panel",showPanelLabel:({side:e})=>`Show the ${e} panel`};export{i as DEFAULT_CHROME_WORDS,e as DEFAULT_NOTICE_WORDS};