efficient-easel 27.1.0 → 27.3.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.
- package/dist/AddSidePanel-DwfZOS5C.d.ts +2002 -0
- package/dist/{ScreenDocumentContext-DPW_6gOC.d.ts → ScreenDocumentContext-JQr4hTeP.d.ts} +7 -5
- package/dist/blocks/index.d.ts +1 -1
- package/dist/{canvas-typing-CD1aeYnk.d.ts → canvas-typing-B33ssbpU.d.ts} +22 -3
- package/dist/{chunk-J5VPNHOW.js → chunk-2DFSODES.js} +1 -1
- package/dist/{chunk-LAJYMOY3.js → chunk-2ODVRWRM.js} +1 -1
- package/dist/{chunk-WL57KM5C.js → chunk-36AWYQLN.js} +6 -6
- package/dist/{chunk-QPNNWQ24.js → chunk-4JPAVKV6.js} +1 -1
- package/dist/chunk-64NREOML.js +1 -0
- package/dist/chunk-7WONGRN3.js +64 -0
- package/dist/chunk-AI5IQV4A.js +2 -0
- package/dist/chunk-BDYS3UAD.js +5 -0
- package/dist/{chunk-RTMDZJNE.js → chunk-DFLPDOZF.js} +1 -1
- package/dist/chunk-IHYRYSP2.js +7 -0
- package/dist/chunk-JEKFHCKS.js +8 -0
- package/dist/{chunk-SEH3Q3EL.js → chunk-JNNBGI6Y.js} +1 -1
- package/dist/chunk-KRONK73U.js +1 -0
- package/dist/{chunk-L36E2WCO.js → chunk-NMLAW6FI.js} +17 -17
- package/dist/chunk-OHHODU7N.js +26 -0
- package/dist/{chunk-XESNAMI3.js → chunk-PMDIDRDB.js} +4 -4
- package/dist/{chunk-P3HXHLES.js → chunk-TWXA55SR.js} +1 -1
- package/dist/copy/index.d.ts +3 -3
- package/dist/copy/index.js +29 -29
- package/dist/data/index.d.ts +1 -1
- package/dist/easel/index.d.ts +10 -2
- package/dist/easel/index.js +1 -1
- package/dist/fields/index.d.ts +1 -1
- package/dist/fields/index.js +1 -1
- package/dist/panel/index.d.ts +5 -0
- package/dist/panel/index.js +1 -1
- package/dist/{phone-order-CRKvsTsz.d.ts → phone-order-BCM_f8A1.d.ts} +7 -1
- package/dist/screen/components/AddBlockRow.js +1 -1
- package/dist/screen/components/AddSidePanel.d.ts +3 -5
- package/dist/screen/components/AddSidePanel.js +1 -1
- package/dist/screen/components/NodeContextMenu.d.ts +3 -5
- package/dist/screen/components/SaveControls.d.ts +3 -5
- package/dist/screen/components/ScreenChrome.js +1 -1
- package/dist/screen/components/ScreenDocumentContext.d.ts +2 -2
- package/dist/screen/components/ScreenMount.d.ts +3 -5
- package/dist/screen/components/ScreenMount.js +1 -1
- package/dist/screen/components/ScreenStoreProvider.d.ts +3 -5
- package/dist/screen/components/ScreenStoreProvider.js +1 -1
- package/dist/screen/components/SectionScreenShell.js +17 -17
- package/dist/screen/components/usePartBridge.d.ts +3 -5
- package/dist/screen/components/usePartBridge.js +1 -1
- package/dist/screen/index.d.ts +3 -5
- package/dist/screen/index.js +1 -1
- package/dist/screen/lib/admin-bridge.d.ts +1 -1
- package/dist/screen/lib/document/add-target-types.d.ts +37 -55
- package/dist/screen/lib/document/block-set-host.js +1 -1
- package/dist/screen/lib/document/block-size-fields.d.ts +2 -2
- package/dist/screen/lib/document/block-size-fields.js +1 -1
- package/dist/screen/lib/document/box-fields.d.ts +2 -2
- package/dist/screen/lib/document/box-fields.js +1 -1
- package/dist/screen/lib/document/button-fields.d.ts +2 -2
- package/dist/screen/lib/document/button-fields.js +1 -1
- package/dist/screen/lib/document/image-fields.d.ts +2 -2
- package/dist/screen/lib/document/image-fields.js +4 -4
- package/dist/screen/lib/document/new-child.d.ts +58 -0
- package/dist/screen/lib/document/new-child.js +1 -0
- package/dist/screen/lib/document/palette-sections.d.ts +3 -5
- package/dist/screen/lib/document/section-doc.d.ts +1 -1
- package/dist/screen/lib/document/shadow-fields.d.ts +2 -2
- package/dist/screen/lib/document/shadow-fields.js +1 -1
- package/dist/screen/lib/document/slot-section-spec.d.ts +37 -96
- package/dist/screen/lib/document/style-clipboard.d.ts +3 -5
- package/dist/screen/lib/document/style-fields.d.ts +2 -2
- package/dist/screen/lib/document/style-fields.js +1 -1
- package/dist/screen/lib/document/use-section-ops.d.ts +37 -3
- package/dist/screen/lib/document/use-section-ops.js +1 -1
- package/dist/screen/lib/document-addressing.d.ts +2 -2
- package/dist/screen/lib/document-hooks.d.ts +1 -1
- package/dist/screen/lib/host.d.ts +2 -2
- package/dist/screen/lib/key-scope.js +1 -1
- package/dist/screen/lib/media-panel.d.ts +2 -2
- package/dist/screen/lib/media-picker.d.ts +2 -2
- package/dist/screen/lib/page-lock.d.ts +1 -1
- package/dist/screen/lib/screen-parts.d.ts +21 -1828
- package/dist/screen/lib/screen-parts.js +1 -1
- package/dist/screen/lib/section-templates.d.ts +1 -1
- package/dist/screen/lib/session-context.d.ts +1 -1
- package/dist/screen/lib/session.d.ts +1 -1
- package/dist/screen/lib/shared-sections.d.ts +1 -1
- package/dist/text-styles/index.js +11 -11
- package/package.json +10 -4
- package/dist/chunk-3FANFZ4D.js +0 -1
- package/dist/chunk-D4TH4QQR.js +0 -2
- package/dist/chunk-DTEYSPJE.js +0 -64
- package/dist/chunk-GJ427TZL.js +0 -8
- package/dist/chunk-MNQDOSAX.js +0 -7
- package/dist/chunk-SDSBXW3V.js +0 -26
- package/dist/chunk-TUIBPB77.js +0 -5
|
@@ -261,13 +261,15 @@ type EaselToHostMessage =
|
|
|
261
261
|
slug: string;
|
|
262
262
|
}
|
|
263
263
|
/** Open one section of the website's own pages in the host — its Settings
|
|
264
|
-
* (`section: "settings"`, e.g. Selling, where the stock rules live)
|
|
265
|
-
* Shipping (`"shipping"`, the pickup places)
|
|
266
|
-
*
|
|
267
|
-
*
|
|
264
|
+
* (`section: "settings"`, e.g. Selling, where the stock rules live), its
|
|
265
|
+
* Shipping (`"shipping"`, the pickup places) or its Reviews (`"reviews"`,
|
|
266
|
+
* where shoppers' reviews are moderated). For a panel row that reads a
|
|
267
|
+
* website rule or record it does not own and offers to open where it is
|
|
268
|
+
* kept. The admin portal opens that Storefront section; nothing answers
|
|
269
|
+
* back. */
|
|
268
270
|
| {
|
|
269
271
|
type: "storefront-editor:open-site-section";
|
|
270
|
-
section: "settings" | "shipping";
|
|
272
|
+
section: "settings" | "shipping" | "reviews";
|
|
271
273
|
} | {
|
|
272
274
|
type: "storefront-editor:new-page";
|
|
273
275
|
}
|
package/dist/blocks/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { ReactElement, FC, CSSProperties, ReactNode, JSX } from 'react';
|
|
|
2
2
|
import { P as Permissions, A as AppState } from '../types-BljCVdzR.js';
|
|
3
3
|
import '../data/index.js';
|
|
4
4
|
import '../types-Dq180WRV.js';
|
|
5
|
-
import '../phone-order-
|
|
5
|
+
import '../phone-order-BCM_f8A1.js';
|
|
6
6
|
import '../plan-D0DgSLnY.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -51,16 +51,27 @@ interface CopyThemeColor {
|
|
|
51
51
|
label: string;
|
|
52
52
|
value: string;
|
|
53
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* The host's map from a STORED colour name to its colour's current name.
|
|
56
|
+
* A host that renamed its theme colours (web-builder: `accent` became `main`)
|
|
57
|
+
* keeps old words as they were saved; the map lets them still find their
|
|
58
|
+
* colour. It is read only: nothing is rewritten until a person picks a colour.
|
|
59
|
+
* Left out, a stored name must match a colour's name exactly. A hex never goes
|
|
60
|
+
* through it.
|
|
61
|
+
*/
|
|
62
|
+
type ColorNameOf = (stored: string) => string;
|
|
54
63
|
/**
|
|
55
64
|
* The colour the toolbar's A shows for `current` (a theme colour's name or a
|
|
56
65
|
* hex): the hex itself, or theme colour's value. One rule for every bar
|
|
57
66
|
* that opens this window — the panel's text box and the canvas typing bar.
|
|
58
67
|
*/
|
|
59
|
-
declare function colorRunOf(current: string | null, colors: readonly CopyThemeColor[] | undefined): string | undefined;
|
|
60
|
-
declare function ColorWindow({ colors, current, words, onPick, }: {
|
|
68
|
+
declare function colorRunOf(current: string | null, colors: readonly CopyThemeColor[] | undefined, nameOf?: ColorNameOf): string | undefined;
|
|
69
|
+
declare function ColorWindow({ colors, current, nameOf, words, onPick, }: {
|
|
61
70
|
colors: readonly CopyThemeColor[];
|
|
62
71
|
/** The colour the selection wears — a theme name or a hex — or null. */
|
|
63
72
|
current: string | null;
|
|
73
|
+
/** The host's map from a stored name to its colour's name (`ColorNameOf`). */
|
|
74
|
+
nameOf?: ColorNameOf;
|
|
64
75
|
words: NonNullable<CopyWords['colors']>;
|
|
65
76
|
/** A theme name, a lowercase `#rrggbb`, or null to take the colour off. */
|
|
66
77
|
onPick: (color: string | null) => void;
|
|
@@ -288,6 +299,14 @@ interface CopyBoxProps {
|
|
|
288
299
|
* no colour button, and no blank where it was (Lewis 2026-10-13).
|
|
289
300
|
*/
|
|
290
301
|
colors?: readonly CopyThemeColor[];
|
|
302
|
+
/**
|
|
303
|
+
* The host's map from a STORED colour name to the name of one of `colors`
|
|
304
|
+
* (`ColorNameOf`), for words saved before the host renamed a colour. Read
|
|
305
|
+
* only: the window lights, the A shows and the box paints the mapped colour,
|
|
306
|
+
* and the value is not rewritten until a person picks one. Left out, a
|
|
307
|
+
* stored name must match exactly.
|
|
308
|
+
*/
|
|
309
|
+
colorNameOf?: ColorNameOf;
|
|
291
310
|
/** The number cells between the toolbar and the box (final toolbar), each
|
|
292
311
|
* the host's value — see `COPY_CELLS`. None: no cells. */
|
|
293
312
|
cells?: readonly CopyCell[];
|
|
@@ -459,4 +478,4 @@ interface CanvasTypingSession {
|
|
|
459
478
|
/** Start typing in the words `element()` drew, or `null` where they are not the string's. */
|
|
460
479
|
declare function startCanvasTyping(o: CanvasTypingOptions): CanvasTypingSession | null;
|
|
461
480
|
|
|
462
|
-
export { type CopyBoxLastTool as C, type MarkWriter as M, type SelectionSource as S, type TextBoxHandle as T, type CopyThemeColor as a, type
|
|
481
|
+
export { type CopyBoxLastTool as C, type MarkWriter as M, type SelectionSource as S, type TextBoxHandle as T, type CopyThemeColor as a, type ColorNameOf as b, type CanvasTypingEnd as c, type CopyBoxProps as d, type CopyCell as e, COPY_CELLS as f, type CanvasTypingOptions as g, type CanvasTypingSession as h, ColorWindow as i, type CopyBoxAlign as j, type CopyBoxFooter as k, type CopyCase as l, type CopyCellPreset as m, CopyCells as n, type TextAreaHandle as o, type TextMap as p, type ToolbarMark as q, colorRunOf as r, insertSelection as s, markSelection as t, startCanvasTyping as u, textMap as v };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useSectionOps as o}from"./chunk-
|
|
1
|
+
import{useSectionOps as o}from"./chunk-KRONK73U.js";import{SELECTION_MODE as e}from"./chunk-BDYS3UAD.js";import{decodePartId as r,encodePartId as t}from"./chunk-R4AUZVA3.js";import{useEasel as n}from"./chunk-NMLAW6FI.js";import{usePreviewParts as p}from"./chunk-467WWV4I.js";import{useCallback as d,useEffect as c}from"react";var s=o=>"part"===o.kind;function m({mode:m,setMode:i,onOpenPart:a}){const{getSelectorForId:u}=n(o=>o),I=o(),{setSelectedPartId:f,setSelectHandler:k}=p(),l=d(o=>{const t=r(o);if(!t)return;const{nodeId:n,propKey:p}=t;p?(i(o=>s(o)&&o.nodeId===n&&o.propKey===p?o:{kind:"part",nodeId:n,propKey:p}),a?.(n)):i(o=>"part"===o.kind?e:o)},[i,a]);c(()=>{k(l)},[k,l]);const K=s(m)?t(m.nodeId,m.propKey):null;c(()=>{f(K)},[K,f]);return{selectNode:d(o=>{i(()=>e);const r=u(o);r&&I.select(r)},[i,u,I]),openPartId:K}}export{m as usePartBridge};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{styleFieldBuilders as e,keptByRow as s}from"./chunk-
|
|
1
|
+
import{styleFieldBuilders as e,keptByRow as s}from"./chunk-PMDIDRDB.js";import{boxFieldBuilders as o,PHONE_KEY_ACCESS as l,phoneTwinFields as r,section as i}from"./chunk-36AWYQLN.js";import{deviceField as t}from"./chunk-ZNLODQD4.js";import{BUTTON_STYLE_KEYS as c,BUTTON_PAD_KEYS as n}from"./chunk-PLTTPHK5.js";import{TextColorIcon as u,GroundIcon as d}from"efficient-shell/icons/efficient";import{jsx as f}from"react/jsx-runtime";function a(a){const p=o(a.say),y=e(a.say),m=c,F=a.style,k=a.phone??l;return{...a.padding&&{_dSize:i("Size"),...p.sidesPaddingFields({keys:n,group:!1,...a.padding})},_dDesign:i("Design"),[m.fill]:y.colourField({key:m.fill,access:F,label:"Fill color",icon:/* @__PURE__ */f(d,{}),useFollows:a.follows.useFill,usePresets:a.usePresets,resetTo:a.resetTo,opacity:{key:m.fillOpacity,useUnset:a.follows.useFillOpacity}}),[m.fillOpacity]:s(m.fill),[m.border]:y.borderField({key:m.border,access:F,useFollows:a.follows.useBorder}),[m.text]:y.colourField({key:m.text,access:F,label:"Text color",icon:/* @__PURE__ */f(u,{}),useFollows:a.follows.useText,usePresets:a.usePresets,resetTo:a.resetTo}),[m.corners]:y.cornersField({key:m.corners,access:F,sidesKey:m.cornerSides,useFollows:a.follows.useCorners,useFollowsSides:a.follows.useCornerSides}),[m.cornerSides]:s(m.corners),_dLayout:i("Layout"),...r("align",p.blockAlignmentField({phone:!0},""),k),align:t("desktop",p.blockAlignmentField())}}export{a as buttonFieldSet};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{sidesStartEach as e,SidesInput as n,SidesEachToggle as t}from"./chunk-XWTQTANN.js";import{SettingsDefaultReset as l}from"./chunk-2T22IY3J.js";import{deviceField as o}from"./chunk-ZNLODQD4.js";import{noControlField as a,NoControlMark as i}from"./chunk-22I55W37.js";import{describedAs as r}from"./chunk-LX23TCTP.js";import{withStyleKind as s}from"./chunk-3OOYGEJY.js";import{foldMetaOf as u,FOLD_FIELD_MARKER as c}from"./chunk-ANPOR6EY.js";import{useSelectedHost as d,useEasel as p}from"./chunk-
|
|
2
|
-
return H(ne,{},e)}function le(e){return e.type===ne}function oe(e){return le(e)?void 0:e}function ae(e){for(const[n,t]of Object.entries(e))t&&"object"==typeof t&&!u(t)&&s(t,`section:${n}`);return e}function ie(e,n){return{type:"custom",[c]:{label:e,level:n},marker:!0,fold:e,render:()=>/* @__PURE__ */H(Z,{})}}function re(e){return ie(e,2)}function se(e){return ie(e,1)}var ue=[{label:"Start",value:"start"},{label:"Center",value:"center"},{label:"Space between",value:"between"},{label:"End",value:"end"}],ce=[{label:"Start",value:"start"},{label:"Center",value:"center"},{label:"End",value:"end"},{label:"Stretch",value:"stretch"}],de="Wrap",pe=[{label:"Wrap",value:"wrap"},{label:"No wrap",value:"nowrap"}],fe="Direction",be=[{label:"Stacked",value:"column"},{label:"One row",value:"row"}],me={min:-32,max:64,step:2,builtIn:0},he={min:30,max:100,step:5,fallback:60},ve=["top-left","top-center","top-right","left","center","right","bottom-left","bottom-center","bottom-right"],ge="bottom-left",ye={"top-left":"Top left","top-center":"Top center","top-right":"Top right",left:"Left",center:"Center",right:"Right","bottom-left":"Bottom left","bottom-center":"Bottom center","bottom-right":"Bottom right"},we=ve.map(e=>({value:e,label:ye[e]}));function ke(e,n=ge){return ve.includes(e)?e:n}var xe=40,Ce=e=>"number"==typeof e?e:null;function je(e,n,t){const l={};for(const o of["x","y"])t[o]!==n[o]&&(l[e[o]]=t[o]??void 0);return l}var Fe=["top","right","bottom","left"],Oe={top:"sectionPaddingTop",right:"sectionPaddingRight",bottom:"sectionPaddingBottom",left:"sectionPaddingLeft"},Le=e=>"number"==typeof e?e:null;function Ke(e,n,t){const l={};for(const o of Fe)t[o]!==n[o]&&(l[e[o]]=t[o]??void 0);return l}function Se(e){if("number"==typeof e)return{top:e,right:e,bottom:e,left:e};const n=e&&"object"==typeof e?e:{};return Object.fromEntries(Fe.map(e=>[e,Le(n[e])]))}function Ve(e){const n={};for(const t of Fe)"number"==typeof e[t]&&(n[t]=e[t]);return Object.keys(n).length?n:void 0}function Ee(e,n={}){const t=n=>{const t=n[e];return t&&"object"==typeof t?t:{}},l=e=>Object.hasOwn(n,e)?n[e]:e;return{read:(e,n)=>t(e)[l(n)],write:(n,o,a)=>{const i={...t(n)};return void 0===a?delete i[l(o)]:i[l(o)]=a,{[e]:Object.keys(i).length?i:void 0}}}}function Pe(e,n,t){const l=
|
|
1
|
+
import{sidesStartEach as e,SidesInput as n,SidesEachToggle as t}from"./chunk-XWTQTANN.js";import{SettingsDefaultReset as l}from"./chunk-2T22IY3J.js";import{deviceField as o}from"./chunk-ZNLODQD4.js";import{noControlField as a,NoControlMark as i}from"./chunk-22I55W37.js";import{describedAs as r}from"./chunk-LX23TCTP.js";import{withStyleKind as s}from"./chunk-3OOYGEJY.js";import{foldMetaOf as u,FOLD_FIELD_MARKER as c}from"./chunk-ANPOR6EY.js";import{useSelectedHost as d,useEasel as p}from"./chunk-NMLAW6FI.js";import{DEFAULT_PANEL_WORDS as f}from"./chunk-56ID6FKZ.js";import{SettingsSwitch as b}from"./chunk-OECWLNKJ.js";import{phoneKey as m,tabletKey as h,viewFollows as v,isAuto as g}from"./chunk-DIOTWSCO.js";import{FieldSelect as y}from"./chunk-C63IB4VW.js";import{SettingsSegmented as w}from"./chunk-DX3VILZ3.js";import{SettingsField as k}from"./chunk-MIX7EGRG.js";import{useWords as x}from"./chunk-MFIRYGHW.js";import{useState as C}from"react";import{AlignmentIcon as j,BoxJustifyIcon as F,WrapIcon as O,ArrowRightIcon as L,GapIcon as K,WidthIcon as S,PlacementIcon as V,NudgeIcon as E,DesktopIcon as P,BoxXEndIcon as A,BoxXCenterIcon as R,BoxXStartIcon as I,PaddingAllIcon as M,BoxYBetweenIcon as W,BoxYStretchIcon as B,BoxYEndIcon as N,BoxYCenterIcon as T,BoxYStartIcon as $,BoxXBetweenIcon as G,BoxXStretchIcon as D,BoxItemAlignmentIcon as J}from"efficient-shell/icons/efficient";import{textAlignOptions as Y,AlignmentGrid as X,PositionInput as _,Slider as z}from"efficient-shell/ui";import{jsx as H,Fragment as Z,jsxs as Q}from"react/jsx-runtime";var U=e=>e;function q(e,n,t="desktop"){return e("tablet"===t?"{value} on tablet":"{value} on desktop").replace("{value}",n)}var ee=()=>{};function ne(){return null}function te(e){if(!e.trim())throw new Error("noGlyph() needs a reason naming the ruling that decided it.");/* @__PURE__ */
|
|
2
|
+
return H(ne,{},e)}function le(e){return e.type===ne}function oe(e){return le(e)?void 0:e}function ae(e){for(const[n,t]of Object.entries(e))t&&"object"==typeof t&&!u(t)&&s(t,`section:${n}`);return e}function ie(e,n){return{type:"custom",[c]:{label:e,level:n},marker:!0,fold:e,render:()=>/* @__PURE__ */H(Z,{})}}function re(e){return ie(e,2)}function se(e){return ie(e,1)}var ue=[{label:"Start",value:"start"},{label:"Center",value:"center"},{label:"Space between",value:"between"},{label:"End",value:"end"}],ce=[{label:"Start",value:"start"},{label:"Center",value:"center"},{label:"End",value:"end"},{label:"Stretch",value:"stretch"}],de="Wrap",pe=[{label:"Wrap",value:"wrap"},{label:"No wrap",value:"nowrap"}],fe="Direction",be=[{label:"Stacked",value:"column"},{label:"One row",value:"row"}],me={min:-32,max:64,step:2,builtIn:0},he={min:30,max:100,step:5,fallback:60},ve=["top-left","top-center","top-right","left","center","right","bottom-left","bottom-center","bottom-right"],ge="bottom-left",ye={"top-left":"Top left","top-center":"Top center","top-right":"Top right",left:"Left",center:"Center",right:"Right","bottom-left":"Bottom left","bottom-center":"Bottom center","bottom-right":"Bottom right"},we=ve.map(e=>({value:e,label:ye[e]}));function ke(e,n=ge){return ve.includes(e)?e:n}var xe=40,Ce=e=>"number"==typeof e?e:null;function je(e,n,t){const l={};for(const o of["x","y"])t[o]!==n[o]&&(l[e[o]]=t[o]??void 0);return l}var Fe=["top","right","bottom","left"],Oe={top:"sectionPaddingTop",right:"sectionPaddingRight",bottom:"sectionPaddingBottom",left:"sectionPaddingLeft"},Le=e=>"number"==typeof e?e:null;function Ke(e,n,t){const l={};for(const o of Fe)t[o]!==n[o]&&(l[e[o]]=t[o]??void 0);return l}function Se(e){if("number"==typeof e)return{top:e,right:e,bottom:e,left:e};const n=e&&"object"==typeof e?e:{};return Object.fromEntries(Fe.map(e=>[e,Le(n[e])]))}function Ve(e){const n={};for(const t of Fe)"number"==typeof e[t]&&(n[t]=e[t]);return Object.keys(n).length?n:void 0}function Ee(e,n={}){const t=n=>{const t=n[e];return t&&"object"==typeof t?t:{}},l=e=>Object.hasOwn(n,e)?n[e]:e;return{read:(e,n)=>t(e)[l(n)],write:(n,o,a)=>{const i={...t(n)};return void 0===a?delete i[l(o)]:i[l(o)]=a,{[e]:Object.keys(i).length?i:void 0}}}}function Pe(e,n,t){const l=Ae(e),o=d();if(t)return[t.value,t.onChange];const a=o?.values??{};return[e.read(a,n),e=>l([[n,e]])]}function Ae(e){const n=d();return t=>{n&&n.onChangeMany(n=>{let l={};for(const[o,a]of t)l={...l,...e.write({...n,...l},o,a)};return l})}}var Re={read:(e,n)=>e[n],write:(e,n,t)=>({[n]:t})},Ie={fieldKey:m,ownField:!0,read:(e,n)=>e[m(n)],write:(e,n,t)=>({[m(n)]:t})},Me={fieldKey:h,ownField:!0,read:(e,n)=>e[h(n)],write:(e,n,t)=>({[h(n)]:t})},We={...Ie,tablet:Me};function Be(e){return{...Ee(e),fieldKey:n=>`_${e}_${n}`}}function Ne({row:e,desktopKey:n,access:t,wider:l,props:o}){const a=d(),i=a?.values??{},r=l?.read(i,n),s=v(i[n],r),u=g(r)?"desktop":"tablet",[c,p]=Pe(t,n);return t.ownField?e.render({...o,follows:s,followsView:u,twinAccess:t,widerAccess:l}):e.render({...o,value:c,storedValue:c,follows:s,followsView:u,twinAccess:t,widerAccess:l,onChange:p})}function Te(e,n,t=Ie,l={}){const a=l.phoneRow??n,i=(n,t)=>({...a,render:l=>/* @__PURE__ */H(Ne,{row:a,desktopKey:e,access:n,wider:t,props:l})}),r=t.tablet;return{[e]:o("desktop",n),...r?{[r.fieldKey(e)]:o("tablet",i(r))}:{},[t.fieldKey(e)]:o("mobile",i(t,r))}}var $e=["left","center","right"];function Ge(e,{options:n,value:t,onChange:l,ariaLabel:o,disabled:a=!1}){/* @__PURE__ */
|
|
3
3
|
return H(w,{options:n.map(n=>n.picture?{id:n.value,label:n.picture,title:e(n.title??n.label)}:{id:n.value,label:e(n.label),title:void 0===n.title?void 0:e(n.title)}),value:t,onChange:l,ariaLabel:e(o),disabled:a})}function De(e,{label:n,value:t,onChange:l,points:o}){const a=o.find(e=>e.disabled),i=o.map(n=>({...n,label:e(n.label),...n.title?{title:e(n.title)}:null}));/* @__PURE__ */
|
|
4
|
-
return H(k,{label:e(n),icon:/* @__PURE__ */H(V,{}),hint:a?.title?e(a.title):void 0,children:/* @__PURE__ */H(X,{label:e(n),value:t,points:i,onChange:l})})}function Je({say:e,label:n,value:t,onChange:l,pointsFor:o}){const{appState:a,selectedItem:i}=p(e=>e),r=i?.props?.id?String(i.props.id):void 0;return De(e,{label:n,value:t,onChange:l,points:o(a?.data,r)})}function Ye({say:e,o:n}){const t=d(),o=x("panel",f),a=t?.values??{},i={x:Ce(a[n.keys.x]),y:Ce(a[n.keys.y])},r=e(n.label??"Position"),s=Boolean(i.x||i.y),u=e=>{const l=je(n.keys,i,e);Object.keys(l).length&&t?.onChangeMany(l)},c=/* @__PURE__ */H(_,{label:r,value:i,onChange:u,words:{x:e("Left and right"),y:e("Up and down"),unit:"px"},placeholder:{x:"0",y:"0"},min:n.min,max:n.max,step:n.step??1}),p=/* @__PURE__ */H(l,{words:o,label:r,changed:s,detail:"0 px, 0 px",onReset:()=>u({x:null,y:null})});return null===n.label?/* @__PURE__ */Q("div",{className:"sf-position-line",children:[c,p]}):/* @__PURE__ */H(k,{label:r,icon:/* @__PURE__ */H(E,{}),changed:s,action:p,children:c})}var Xe={x:{start:/* @__PURE__ */H(I,{}),center:/* @__PURE__ */H(
|
|
4
|
+
return H(k,{label:e(n),icon:/* @__PURE__ */H(V,{}),hint:a?.title?e(a.title):void 0,children:/* @__PURE__ */H(X,{label:e(n),value:t,points:i,onChange:l})})}function Je({say:e,label:n,value:t,onChange:l,pointsFor:o}){const{appState:a,selectedItem:i}=p(e=>e),r=i?.props?.id?String(i.props.id):void 0;return De(e,{label:n,value:t,onChange:l,points:o(a?.data,r)})}function Ye({say:e,o:n}){const t=d(),o=x("panel",f),a=t?.values??{},i={x:Ce(a[n.keys.x]),y:Ce(a[n.keys.y])},r=e(n.label??"Position"),s=Boolean(i.x||i.y),u=e=>{const l=je(n.keys,i,e);Object.keys(l).length&&t?.onChangeMany(l)},c=/* @__PURE__ */H(_,{label:r,value:i,onChange:u,words:{x:e("Left and right"),y:e("Up and down"),unit:"px"},placeholder:{x:"0",y:"0"},min:n.min,max:n.max,step:n.step??1}),p=/* @__PURE__ */H(l,{words:o,label:r,changed:s,detail:"0 px, 0 px",onReset:()=>u({x:null,y:null})});return null===n.label?/* @__PURE__ */Q("div",{className:"sf-position-line",children:[c,p]}):/* @__PURE__ */H(k,{label:r,icon:/* @__PURE__ */H(E,{}),changed:s,action:p,children:c})}var Xe={x:{start:/* @__PURE__ */H(I,{}),center:/* @__PURE__ */H(R,{}),end:/* @__PURE__ */H(A,{}),stretch:/* @__PURE__ */H(D,{}),between:/* @__PURE__ */H(G,{})},y:{start:/* @__PURE__ */H($,{}),center:/* @__PURE__ */H(T,{}),end:/* @__PURE__ */H(N,{}),stretch:/* @__PURE__ */H(B,{}),between:/* @__PURE__ */H(W,{})}},_e=e=>"row"===e?"row":"column";function ze({say:e,kind:n,label:t,options:l,value:o,onChange:a,o:i}){const r=d(),s="justify"===n==("row"===(i.runs??_e)(r?.values?.[i.directionKey??"direction"]))?"x":"y";return Ge(e,{options:l.map(e=>({label:e.label,value:e.value,picture:Xe[s][e.value]})),value:o,onChange:a,ariaLabel:t})}function He(e,n){const t=(e.useFallback??ee)(n);return Object.fromEntries(Fe.map(n=>[n,t?.[n]??e.fallback[n]]))}function Ze({say:e,tier:n,o:t,props:l}){const o=He(t,l),a=d(),i=a?.values??{},r="mobile"===n?t.phoneKeys:"tablet"===n?t.tabletKeys:t.keys,s=Object.fromEntries(Fe.map(e=>[e,Le(i[r[e]])])),u="desktop"===n?null:Object.fromEntries(Fe.map(e=>[e,v(Le(i[t.keys[e]]),"mobile"===n?Le(i[t.tabletKeys[e]]):null)]));/* @__PURE__ */
|
|
5
5
|
return H(Ue,{say:e,o:t,fallback:o,value:s,follows:u,followsView:"mobile"===n&&Fe.some(e=>null!==Le(i[t.tabletKeys[e]]))?"tablet":"desktop",readOnly:l.readOnly,onChange:e=>{const n=Ke(r,s,e);Object.keys(n).length&&a?.onChangeMany(n)}})}function Qe({say:e,o:n,props:t}){const l=He(n,t);/* @__PURE__ */
|
|
6
6
|
return H(Ue,{say:e,o:n,fallback:l,value:Se(t.value),follows:"follows"in t?Se(t.follows):null,followsView:t.followsView,readOnly:t.readOnly,onChange:e=>t.onChange(Ve(e))})}function Ue({say:o,o:a,fallback:i,value:r,follows:s,followsView:u,readOnly:c,onChange:d}){const p=Object.fromEntries(Fe.map(e=>[e,String(s?.[e]??i[e])])),[b,m]=C(()=>e(r,p)),h=x("panel",f),v=Fe.map(e=>p[e]),g=`${1===new Set(v).size?v[0]:v.join(" / ")}px`;/* @__PURE__ */
|
|
7
7
|
return H(k,{label:o(a.label),icon:a.icon??/* @__PURE__ */H(M,{}),action:/* @__PURE__ */Q(Z,{children:[
|
|
@@ -10,8 +10,8 @@ return H(k,{label:o(a.label),icon:a.icon??/* @__PURE__ */H(M,{}),action:/* @__PU
|
|
|
10
10
|
return H(k,{label:e??n,action:u,children:s})}function tn({draw:e,props:n,useMax:t,useHint:l}){return e(n,{max:(t??ee)(n),hint:(l??ee)(n)})}function ln(e=U){function n(n,t,l,o,a,i,s="",u){const c="function"==typeof u?{action:u}:u??{},{action:d,clear:p}=c,f=(r,u)=>{const f="storedValue"in r?r.storedValue:r.value,b="follows"in r,m=b&&!1!==p?.phoneFollows,h=b||void 0!==p,v="number"==typeof r.value,g=void 0===p?i:u.hint??("function"==typeof p.hint?p.hint(r):p.hint)??i,y=m&&"number"==typeof r.follows?r.follows:g,w=qe(s),x=!p?.emptyLabel||m&&"number"==typeof r.follows?void 0:p.emptyLabel,C=x??`${y}${w}`,j="function"==typeof c.hint?c.hint(r):c.hint,{track:F,reset:O}=en({label:e(n),value:v?r.value:h?null:i,onChange:e=>r.onChange(e),min:l,max:u.max??o,step:a,unit:s,hint:h?y:void 0,emptyLabel:x,inputMax:c.inputMax,readOnly:!0===r.readOnly,clears:h,detail:m?q(e,C,r.followsView):C});/* @__PURE__ */
|
|
11
11
|
return H(k,{label:e(n),icon:oe(t),hint:void 0===j?void 0:e(j),action:h?O:d?d(f,r.onChange):void 0,children:F})},b=c.useMax,m=p?.useHint;return{type:"custom",...r({},{type:"number",label:n}),render:b||m?e=>/* @__PURE__ */H(tn,{draw:f,props:e,useMax:b,useHint:m}):e=>f(e,{})}}function t(n){return Ge(e,n)}function s(n,o,a,i,s={}){const u=a.map(e=>"string"==typeof e?{label:e,value:e}:e);return{type:"custom",...r({},{type:"radio",label:n,options:u.map(e=>({value:e.value,label:e.label}))}),render:a=>{const{value:r,onChange:c,field:d}=a,p=u.some(e=>e.value===r),f=!0===a.readOnly;if("follows"in a&&!u.some(e=>""===e.value)){const d=s.phoneRest?s.phoneRest(a.follows):a.follows,b=u.find(e=>e.value===d)??u.find(e=>e.value===i);/* @__PURE__ */
|
|
12
12
|
return H(k,{label:e(n),icon:oe(o),action:/* @__PURE__ */H(l,{label:e(n),changed:p,detail:q(e,e(b?.label??""),a.followsView),disabled:f,onReset:()=>c(void 0)}),children:t({options:u,value:p?r:b?.value??i,onChange:c,ariaLabel:n,disabled:f})})}const b="follows"in a&&s.followsLabel?s.followsLabel(a.follows):void 0;/* @__PURE__ */
|
|
13
|
-
return H(k,{label:e(n),icon:oe(o),action:"follows"in a&&s.followsLabel?/* @__PURE__ */H(l,{label:e(n),changed:null!=r&&""!==r,detail:void 0===b?void 0:q(e,e(b),a.followsView),disabled:f,onReset:()=>c(void 0)}):void 0,children:t({options:u,value:p?r:r||d?.currentValue||i,onChange:c,ariaLabel:n,disabled:f})})}}}function u(e,n){return n.phone?e.unshift({label:"Match desktop",value:"",picture:/* @__PURE__ */H(P,{})}):n.inherit&&e.unshift({label:n.inherit,value:""}),e}function c(e,n){return n.inherit||n.phone?{...e,render:n=>e.render({...n,onChange:e=>n.onChange(""===e?void 0:e)})}:e}function d(e,n,t,l){if(l.access){const o=l.inherit?"":l.fallback??"left",a=t({...l,phone:!1}),i=e=>{const n="string"==typeof e&&""!==e&&a.some(n=>n.value===e)?e:o;return a.find(e=>e.value===n)?.label};return
|
|
13
|
+
return H(k,{label:e(n),icon:oe(o),action:"follows"in a&&s.followsLabel?/* @__PURE__ */H(l,{label:e(n),changed:null!=r&&""!==r,detail:void 0===b?void 0:q(e,e(b),a.followsView),disabled:f,onReset:()=>c(void 0)}):void 0,children:t({options:u,value:p?r:r||d?.currentValue||i,onChange:c,ariaLabel:n,disabled:f})})}}}function u(e,n){return n.phone?e.unshift({label:"Match desktop",value:"",picture:/* @__PURE__ */H(P,{})}):n.inherit&&e.unshift({label:n.inherit,value:""}),e}function c(e,n){return n.inherit||n.phone?{...e,render:n=>e.render({...n,onChange:e=>n.onChange(""===e?void 0:e)})}:e}function d(e,n,t,l){if(l.access){const o=l.inherit?"":l.fallback??"left",a=t({...l,phone:!1}),i=e=>{const n="string"==typeof e&&""!==e&&a.some(n=>n.value===e)?e:o;return a.find(e=>e.value===n)?.label};return Te(e,n(l,o),l.access,{phoneRow:n({...l,phone:!0},"",i)})}return{[e]:o("desktop",n(l)),[m(e)]:o("mobile",n({...l,phone:!0},""))}}function p(e){return u(Y(e.allow??$e).map(e=>({label:e.label,value:e.value,picture:e.icon})),e)}function f(e,n=e.fallback??"left",t){return c(s(e.label??"Text alignment",/* @__PURE__ */H(j,{}),p(e),n,t?{followsLabel:t}:{}),e)}function v(e){const n={left:Xe.x.start,center:Xe.x.center,right:Xe.x.end};return u(Y((e.allow??$e).filter(e=>e in n)).map(e=>({label:e.label,value:e.value,picture:n[e.value]})),e)}function g(e,n=e.fallback??"left",t){return c(s(e.label??"Block alignment",/* @__PURE__ */H(F,{}),v(e),n,t?{followsLabel:t}:{}),e)}function w(n,t,l,o,a,i){return{type:"custom",options:o,fallback:a,...r({},{type:"radio",label:t,options:o.map(e=>({value:e.value,label:e.label}))}),render:({value:r,onChange:s,field:u})=>{const c=u.options??o,d=u.fallback??a,p=c.some(e=>e.value===r)?r:d;/* @__PURE__ */
|
|
14
14
|
return H(k,{label:e(t),icon:oe(l),children:/* @__PURE__ */H(ze,{say:e,kind:n,label:t,options:c,value:p,onChange:s,o:i})})}}}function x(e={}){return w("justify","Justify",/* @__PURE__ */H(F,{}),ue,ue[0].value,e)}function C(e={}){return w("align","Item alignment",/* @__PURE__ */H(J,{}),ce,"stretch",e)}function V(){const n=de;return{type:"custom",options:pe,fallback:pe[1].value,...r({},{type:"radio",label:n,options:pe.map(e=>({value:e.value,label:e.label}))}),render:({value:t,onChange:l,id:o,name:a})=>{const i=`${o??a??n}-label`;/* @__PURE__ */
|
|
15
15
|
return H(k,{label:e(n),labelId:i,icon:/* @__PURE__ */H(O,{}),action:/* @__PURE__ */H(b,{checked:(r=t,!0===r||"wrap"===r),onChange:e=>l(e?pe[0].value:pe[1].value),ariaLabelledBy:i})});var r}}}function E({offered:e,fallback:n,resolve:t}){const l=t??(t=>e.some(e=>e.value===t)?t:n),o=s(fe,
|
|
16
|
-
/* @__PURE__ */H(L,{}),e.map(e=>({label:e.label,value:e.value})),l(void 0));return{type:"custom",render:e=>o.render({...e,value:l(e.value),onChange:n=>e.onChange(n)})}}function
|
|
17
|
-
return H(k,{label:e(n),icon:oe(t),action:m?/* @__PURE__ */H(l,{label:e(n),changed:null!=r&&""!==r,detail:v?q(e,e(v.label),i.followsView):void 0,disabled:w,onReset:()=>c(void 0)}):void 0,children:/* @__PURE__ */H(y,{value:g,ariaLabel:e(n),readOnly:w,onChange:c,options:[...s?[{label:e(s),value:"\0note",disabled:!0}]:[],...p.map(n=>({label:e(n.label),value:n.value}))]})})}}},Segmented:t,segmented:s,boxJustifyField:x,boxAlignField:C,boxWrapField:V,directionField:E,gapField:
|
|
16
|
+
/* @__PURE__ */H(L,{}),e.map(e=>({label:e.label,value:e.value})),l(void 0));return{type:"custom",render:e=>o.render({...e,value:l(e.value),onChange:n=>e.onChange(n)})}}function A({min:e,max:t,step:l,builtIn:o,resolve:a,action:i,mark:r}){const s=n("Gap",/* @__PURE__ */H(K,{}),e,t,l,o,"px",i),u=a??(e=>"number"==typeof e?e:o);return{...r,type:"custom",render:e=>s.render({...e,value:u(e.value,e.field),storedValue:e.value,onChange:n=>e.onChange(n)})}}function R(n,{fallback:t=ge,pointsFor:l}={}){return{type:"custom",render:({value:o,onChange:a})=>{const i=ke(o,t);return l?/* @__PURE__ */H(Je,{say:e,label:n,value:i,onChange:a,pointsFor:l}):De(e,{label:n,value:i,onChange:a,points:we})}}}function I(n){return{[n.keys.x]:{type:"custom",render:()=>/* @__PURE__ */H(Ye,{say:e,o:n})},[n.keys.y]:{...a({type:"custom",render:()=>/* @__PURE__ */H(i,{})},"always"),reachedBy:n.keys.x}}}function M(n={}){const t={...Oe,...n.keys},l={keys:t,tabletKeys:Object.fromEntries(Fe.map(e=>[e,h(t[e])])),phoneKeys:Object.fromEntries(Fe.map(e=>[e,m(t[e])])),fallback:{top:0,right:0,bottom:0,left:0,...n.fallback},useFallback:n.useFallback,label:n.label??"Padding",icon:n.icon,min:n.min??0,max:n.max??200,step:n.step??4},r=!1!==n.phone,s=!1===n.group?{}:{_gSpacing:re("Padding")};if(n.object){const t={type:"custom",render:n=>/* @__PURE__ */H(Qe,{say:e,o:l,props:n})};return ae({...s,...r?Te(n.object.key,t,n.object.phone):{[n.object.key]:t}})}const u=r&&!0===n.tablet,c=n=>{const t={type:"custom",render:t=>/* @__PURE__ */H(Ze,{say:e,tier:n,o:l,props:t})};return r?o(n,t):t},d=()=>a({type:"custom",render:()=>/* @__PURE__ */H(i,{})},"always"),p=Fe.filter(e=>"top"!==e);return ae({...s,[l.keys.top]:c("desktop"),...u?{[l.tabletKeys.top]:c("tablet")}:{},...r?{[l.phoneKeys.top]:c("mobile")}:{},...Object.fromEntries(p.map(e=>[l.keys[e],{...d(),reachedBy:l.keys.top}])),...u?Object.fromEntries(p.map(e=>[l.tabletKeys[e],o("tablet",d())])):{},...r?Object.fromEntries(p.map(e=>[l.phoneKeys[e],o("mobile",d())])):{}})}return{slider:n,select:function(n,t,o,a,i){const{note:s,phoneRest:u}="string"==typeof i?{note:i,phoneRest:void 0}:i??{};return{type:"custom",options:o,fallback:a,...s?{note:s}:{},...r({},{type:"select",label:n}),render:i=>{const{value:r,onChange:c,field:d}=i,p=d.options??o,f=d.fallback??a,b=p.some(e=>e.value===r),m="follows"in i,h=m?u?u(i.follows):i.follows:void 0,v=m?p.find(e=>e.value===h)??p.find(e=>e.value===f):void 0,g=b?r:v?.value??f,w=!0===i.readOnly;/* @__PURE__ */
|
|
17
|
+
return H(k,{label:e(n),icon:oe(t),action:m?/* @__PURE__ */H(l,{label:e(n),changed:null!=r&&""!==r,detail:v?q(e,e(v.label),i.followsView):void 0,disabled:w,onReset:()=>c(void 0)}):void 0,children:/* @__PURE__ */H(y,{value:g,ariaLabel:e(n),readOnly:w,onChange:c,options:[...s?[{label:e(s),value:"\0note",disabled:!0}]:[],...p.map(n=>({label:e(n.label),value:n.value}))]})})}}},Segmented:t,segmented:s,boxJustifyField:x,boxAlignField:C,boxWrapField:V,directionField:E,gapField:A,placementField:R,PlacementGridView:function(n){return De(e,n)},positionFields:I,sidesPaddingFields:M,alignmentField:function(e={},n=e.fallback??"left"){return f(e,n)},alignmentFields:function(e="align",n={}){return d(e,f,p,n)},AlignmentStrip:function({opts:e={},value:n,onChange:l,ariaLabel:o,disabled:a=!1}){return t({options:p(e),value:n,onChange:l,ariaLabel:o,disabled:a})},blockAlignmentField:function(e={},n=e.fallback??"left"){return g(e,n)},blockAlignmentFields:function(e="align",n={}){return d(e,g,v,n)},BlockAlignmentStrip:function({opts:e={},value:n,onChange:l,ariaLabel:o,disabled:a=!1}){return t({options:v(e),value:n,onChange:l,ariaLabel:o,disabled:a})},boxFieldSet:function(e={}){const t=e.width??he,l=e.nudge?.limit??40,o=e.direction??{offered:be,fallback:"column"},a=o.resolve??(e=>o.offered.some(n=>n.value===e)?e:o.fallback),i={runs:e=>"row"===a(e)?"row":"column"};return{_gLayout:re("Layout"),placement:R("Placement",e.placement),width:n("Width",/* @__PURE__ */H(S,{}),t.min,t.max,t.step,t.fallback,"%"),direction:E(o),gap:A(e.gap??me),justify:x(i),align:C(i),wrap:V(),_gNudge:re("Nudge"),...I({keys:e.nudge?.keys??{x:"nudgeX",y:"nudgeY"},min:-l,max:l,label:null}),...M(e.padding)}}}}var{slider:on,select:an,Segmented:rn,segmented:sn,boxJustifyField:un,boxAlignField:cn,boxWrapField:dn,directionField:pn,gapField:fn,placementField:bn,PlacementGridView:mn,positionFields:hn,sidesPaddingFields:vn,alignmentField:gn,alignmentFields:yn,AlignmentStrip:wn,blockAlignmentField:kn,blockAlignmentFields:xn,BlockAlignmentStrip:Cn,boxFieldSet:jn}=ln();export{ye as ANCHOR_LABELS,wn as AlignmentStrip,ce as BOX_ALIGN_POINTS,be as BOX_DIRECTIONS,fe as BOX_DIRECTION_LABEL,me as BOX_GAP,ue as BOX_JUSTIFY_POINTS,xe as BOX_NUDGE_LIMIT,ve as BOX_PLACEMENTS,ge as BOX_PLACEMENT_DEFAULT,he as BOX_WIDTH,de as BOX_WRAP_LABEL,pe as BOX_WRAP_POINTS,Cn as BlockAlignmentStrip,Re as FLAT_ACCESS,we as OPEN_PLACEMENT_POINTS,Ie as PHONE_KEY_ACCESS,mn as PlacementGridView,Oe as SIDE_PAD_KEYS,rn as Segmented,nn as SliderControl,We as VIEW_KEY_ACCESS,gn as alignmentField,yn as alignmentFields,kn as blockAlignmentField,xn as blockAlignmentFields,cn as boxAlignField,ln as boxFieldBuilders,jn as boxFieldSet,un as boxJustifyField,dn as boxWrapField,pn as directionField,fn as gapField,re as group,oe as iconOf,le as isNoGlyph,te as noGlyph,ke as normaliseBoxPlacement,Ee as objectAccess,q as onDesktopWords,Be as phoneObjectAccess,Te as phoneTwinFields,bn as placementField,hn as positionFields,je as positionPatch,se as section,sn as segmented,an as select,ae as sharedStyleKinds,Se as sidesFromObject,vn as sidesPaddingFields,Ke as sidesPaddingPatch,Ve as sidesToObject,on as slider,Ae as useAccessPatch,Pe as useAccessValue};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{ScreenPartsProvider as t}from"./chunk-
|
|
1
|
+
import{ScreenPartsProvider as t}from"./chunk-BDYS3UAD.js";import{useEaselHost as e}from"./chunk-LX23TCTP.js";import{createEasel as r,EaselProvider as o}from"./chunk-NMLAW6FI.js";import{useState as n,useEffect as s}from"react";import{jsx as a}from"react/jsx-runtime";function i({config:i,data:c,onChange:m,permissions:p,parts:f,children:u}){const[d]=n(()=>r({config:i,data:c,permissions:p}));s(()=>{d.setConfig(i)},[d,i]),s(()=>{if(!m)return;let t=d.getState().appState.data,e=!1;return d.subscribe(()=>{const r=d.getState().appState.data;r!==t&&(t=r,(e||r!==d.loaded)&&(e=!0,m(r)))})},[d,m]),s(()=>{p&&d.setPermissions(p)},[d,p]);const h=e();/* @__PURE__ */
|
|
2
2
|
return a(o,{easel:d,hotkeys:h.ownsDocument,children:/* @__PURE__ */a(t,{parts:f,children:u})})}export{i as ScreenStoreProvider};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{defaultsFrom as n,blockOf as i}from"./chunk-KXM6YRG2.js";function l(l){return e=>n(i(l,e))??{}}function e(n,i,l){return n?.newChild&&i===n.childType?n.newChild(l):null}function r(n,i){return n?.newChild&&i===n.childType&&n.childLabel?.trim()||null}export{l as configNodeDefaults,r as newChildName,e as newChildOf};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import{markedTreeNodeId as e,revealSelectedTreeRow as n,sameSelector as t}from"./chunk-UMBNBCL4.js";import{cloneNodeWithFreshIds as o}from"./chunk-OXZDSOZV.js";import{dedupeSlotChildren as r}from"./chunk-7OCEPOEJ.js";import{styleClipboardOf as i}from"./chunk-VNUXFD4X.js";import{configNodeDefaults as l,newChildOf as s,newChildName as d}from"./chunk-64NREOML.js";import{scrollPreviewToSection as a,gotoPreviewSlide as c}from"./chunk-LUOY3A3Q.js";import{useEaselKeyTarget as p,useEaselUndoKeys as u,useEaselSaveKey as h,editorRootFocus as f}from"./chunk-DFLPDOZF.js";import{SlotChildActionsProvider as m}from"./chunk-KCBEE2MC.js";import{screenStorageKeys as g,DEFAULT_PANEL_W as y,clampPanelWidth as v}from"./chunk-TQUEVJOO.js";import{usePartBridge as b}from"./chunk-2DFSODES.js";import{useSectionOps as k}from"./chunk-KRONK73U.js";import{PageEditGuardNotices as S}from"./chunk-XV5D4V2T.js";import{ScreenSaveIcon as w,ScreenMainButton as x}from"./chunk-2EEYFRQM.js";import{useBrowserOffline as z}from"./chunk-RKTF5XLP.js";import{useScreenDocument as C}from"./chunk-OB4KI2AN.js";import{requestMediaPick as O}from"./chunk-5HYVOOH3.js";import{AddChildRow as N}from"./chunk-5545A3PC.js";import{AddSidePanel as B}from"./chunk-JEKFHCKS.js";import{keepsSharedSections as I,sharedSectionsOf as P}from"./chunk-N3MJOHAG.js";import{PanelHideButton as M,SidePanelHead as $,PanelShowStrip as E}from"./chunk-MTWQYLJE.js";import{offeredChoices as T}from"./chunk-RUQOIQWI.js";import{useScreenSaveSwitch as j,useScreenNodeKeys as L,useScreenPinned as A,useScreenDocumentLabel as R,useScreenCanvasFrame as F,useScreenInspectorPanel as D,useScreenDevices as V,useScreenPickFollowsSelection as W,useScreenLeftView as H,SELECTION_MODE as Y,isSelectionMode as U,sameInspectorMode as J,useScreenBridges as X,useScreenBlockRules as G,useScreenBlockLook as K,useScreenStorageNamespace as Q,useScreenNotify as _,useScreenCanvasHead as q,isSlotMode as Z,useScreenStyleClipboard as ee,useScreenDocumentPass as ne,useScreenCanvasDrag as te,ScreenCanvasTargetProvider as oe,isPinnedFirst as re,isPinnedLast as ie,screenSlotsOf as le,shownChildSlotsOf as se}from"./chunk-BDYS3UAD.js";import{MediaPopup as de}from"./chunk-T2RINM7R.js";import{useMediaPanel as ae,usePanelPick as ce,useMediaBrowsing as pe,useOpenMediaBrowse as ue,useMediaPlace as he}from"./chunk-NCXYC7WI.js";import{useNodeClipboard as fe,useNodeContextMenu as me}from"./chunk-WW24O7HT.js";import{useEaselSession as ge}from"./chunk-YM4UEGBV.js";import{useEaselHost as ye,useHostEscape as ve}from"./chunk-LX23TCTP.js";import{LayersIcon as be,MediaIcon as ke}from"./chunk-XFYFKITX.js";import{DEFAULT_SCREEN_WORDS as Se}from"./chunk-G2VZ4DET.js";import{heldStyle as we,styleShortcut as xe}from"./chunk-3OOYGEJY.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as ze}from"./chunk-6WY6ZXJG.js";import{rootRowName as Ce,slotChildRowName as Oe,slotChildRenameProp as Ne,sectionRenameProp as Be}from"./chunk-5NHQ452C.js";import{ROOT_ZONE as Ie,blockNodeActions as Pe,TREE_MAX_DEPTH as Me,childSlotsOf as $e,slotFieldsOf as Ee,newNodeId as Te,slotChildrenIn as je,nestsInTree as Le}from"./chunk-TCAAOYQY.js";import{useEasel as Ae,useEaselApi as Re,useSettledAction as Fe,subscribeLateWrites as De,CanvasPartsContext as Ve,partHasOwnBox as We,CanvasPassThroughContext as He,CanvasSharedContext as Ye}from"./chunk-NMLAW6FI.js";import{TreeRow as Ue,Subtree as Je,LayersTree as Xe,TreeGroupLabel as Ge,TreeRowAction as Ke,TreeSeam as Qe}from"./chunk-WHS6Y55E.js";import{DEFAULT_TREE_WORDS as _e}from"./chunk-K56YDHYQ.js";import{DEFAULT_NODE_MENU_WORDS as qe}from"./chunk-WK3AFPXY.js";import{toItemSelector as Ze,useNodeOps as en,clickPick as nn}from"./chunk-TF6NAIV7.js";import{EaselTopBar as tn,EaselIconButton as on,TopBarCluster as rn,DeviceSwitch as ln,InspectorIconButton as sn,PanelResizeHandle as dn,MAX_PANEL_W as an,MIN_PANEL_W_BY_SIDE as cn,panelWidthVars as pn}from"./chunk-VTY7OQB5.js";import{DEFAULT_NOTICE_WORDS as un,DEFAULT_CHROME_WORDS as hn}from"./chunk-AJSDWWJW.js";import{holderOf as fn,nameOrSomeone as mn}from"./chunk-G7J6SGMF.js";import{DEFAULT_LOCK_WORDS as gn}from"./chunk-RE4LP46F.js";import{useWords as yn}from"./chunk-MFIRYGHW.js";import{insertSeams as vn,CanvasDragLayer as bn,CanvasInsert as kn}from"./chunk-SEC6NV6Y.js";import{DEFAULT_DRAG_WORDS as Sn}from"./chunk-TQ5Y6S2X.js";import{createDragSession as wn,useTreeDrag as xn,gapToMoveIndex as zn}from"./chunk-QEEW4X64.js";import{ROOT_ID as Cn,ROOT_SLOT as On,zoneKey as Nn,parseZoneKey as Bn,find as In,DataError as Pn}from"./chunk-YDTEYXQW.js";import{useCanvasFrame as Mn,LIST_SELECTOR as $n,BLOCK_SELECTOR as En,useCanvasTyping as Tn,useCanvasEvent as jn,onMotionEnd as Ln}from"./chunk-6GJEOER4.js";import{nodeIdAt as An,frameRectToHost as Rn,BLOCK_ATTRIBUTE as Fn,drawnBox as Dn}from"./chunk-FR7EEKFF.js";import{queryMainCopy as Vn}from"./chunk-7UFKEX72.js";import{useRef as Wn,useMemo as Hn,useState as Yn,useEffect as Un,useCallback as Jn,useLayoutEffect as Xn,useContext as Gn,Fragment as Kn,useId as Qn}from"react";import{ColoredBadge as _n,Button as qn,Tabs as Zn,toast as et,readMediaFileDrag as nt,Tooltip as tt,groupColors as ot,Dialog as rt,FormField as it,Input as lt,MEDIA_FILE_DRAG_TYPE as st}from"efficient-shell/ui";import{UndoIcon as dt,RedoIcon as at,RefreshIcon as ct,AddIcon as pt,TrashIcon as ut,EyeOffIcon as ht,EyeIcon as ft,SharedIcon as mt,DuplicateIcon as gt}from"efficient-shell/icons/efficient";import{jsx as yt,jsxs as vt,Fragment as bt}from"react/jsx-runtime";var kt="media-file";function St({name:e,onMake:n,onCancel:t}){const o=yn("screen",Se).shared,[r,i]=Yn(e),[l,s]=Yn(!1),d=Qn(),a=Wn(null),c=async()=>{const e=r.trim();if(e&&!l){s(!0);try{await n(e)}finally{s(!1)}}};/* @__PURE__ */
|
|
2
|
+
return yt(rt,{open:!0,size:"sm",title:o.makeShared,description:o.makeSharedHint,onClose:t,initialFocus:a,footer:/* @__PURE__ */vt(bt,{children:[
|
|
3
|
+
/* @__PURE__ */yt(qn,{variant:"secondary",onClick:t,children:o.cancel}),
|
|
4
|
+
/* @__PURE__ */yt(qn,{variant:"primary",loading:l,disabled:!r.trim(),onClick:()=>{c()},children:o.makeShared})]}),children:/* @__PURE__ */yt("form",{onSubmit:e=>{e.preventDefault(),c()},children:/* @__PURE__ */yt(it,{label:o.name,htmlFor:d,children:/* @__PURE__ */yt(lt,{id:d,ref:a,value:r,onChange:e=>i(e.target.value)})})})})}var wt=/* @__PURE__ */new WeakSet;function xt(e,n,t){const o=In(e,n,t);if(!o)return null;const r=o.path.find(e=>"root"!==e.parentId);return r?r.parentId:t}function zt(e,n,t){const o=o=>o>=t.left&&o+e.width<=t.left+t.width&&n.every(n=>n.right<=o||n.left>=o+e.width||n.bottom<=e.top||n.top>=e.top+e.height);if(n.every(n=>n.right<=e.left||n.left>=e.left+e.width||n.bottom<=e.top||n.top>=e.top+e.height))return e.left;const r=n.map(e=>e.right+4).filter(n=>n>e.left&&o(n));if(r.length)return Math.min(...r);const i=n.map(n=>n.left-4-e.width).filter(n=>n<e.left&&o(n));return i.length?Math.max(...i):e.left}function Ct({canvas:e,tabs:n,onSelect:t,onPointer:o}){const r=Wn(null),[i,l]=Yn({}),s=Wn({id:null,places:{},measure:null});s.current.places=i;const d=!(null===s.current.id||n.some(e=>e.id===s.current.id)&&i[s.current.id]);Un(()=>{d&&(s.current.id=null,o(null))},[d,o]),Un(()=>()=>{null!==s.current.id&&o(null)},[o]);const a=n.map(e=>`${e.id}:${e.below?1:0}:${e.label}:${e.reach??""}`).join("|");return Xn(()=>{const t=e?.document,o=e?.window,i=e?.frame;if(!t||!o||!i||0===n.length)return void l(e=>0===Object.keys(e).length?e:{});let d=0;const a=()=>{d=0;const e=r.current;if(!e)return;const a=Rn(i,{left:0,top:0,width:o.innerWidth,height:o.innerHeight},e),p={};let u=!1;const h=e.getBoundingClientRect(),f=[...e.parentElement?.querySelectorAll(".es-canvas-handle.is-shown:not(.is-dragging), .es-canvas-tag, .es-canvas-hint")??[]].map(e=>{const n=e.getBoundingClientRect();return{left:n.left-h.left,top:n.top-h.top,right:n.right-h.left,bottom:n.bottom-h.top}});for(const r of n){const n=o.CSS?.escape?o.CSS.escape(r.id):JSON.stringify(r.id).slice(1,-1),l=Vn(t,`[${Fn}="${n}"]`),d=l?Dn(l):null;if(!d||0===d.height){p[r.id]=null;continue}const c=Rn(i,{left:d.left,top:d.top,width:d.width,height:d.height},e),h=c.top+c.height;if(h<a.top||c.top>a.top+a.height){p[r.id]=null;continue}const m=r.below?h+4:Math.max(c.top,a.top)+6,g=e.querySelector(`[data-band-tab="${n}"]`);g||(u=!0);const y=Math.max(c.left,a.left)+6,v=g?.offsetHeight??0,b=g?.offsetWidth??0,k=s.current.id===r.id?s.current.places[r.id]:null,S=k?k.left:zt({left:y,top:m,width:b,height:v},f,a);b>0&&v>0&&f.push({left:S,top:m,right:S+b,bottom:m+v}),p[r.id]={left:S,top:m}}l(e=>function(e,n){const t=Object.keys(e);return t.length===Object.keys(n).length&&t.every(t=>{const o=e[t],r=n[t];return o===r||!!o&&!!r&&o.left===r.left&&o.top===r.top})}(e,p)?e:p),u&&c()},c=()=>{d||(d=o.requestAnimationFrame(a))};s.current.measure=c,a(),o.addEventListener("scroll",c,!0),o.addEventListener("resize",c);const p=Ln(o,c),u=new o.MutationObserver(c);u.observe(t.body,{childList:!0,subtree:!0,attributes:!0});const h=r.current?.parentElement,f=h?.ownerDocument.defaultView?.MutationObserver,m=f?new f(c):null;return h&&m?.observe(h,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style"]}),()=>{d&&o.cancelAnimationFrame(d),o.removeEventListener("scroll",c,!0),o.removeEventListener("resize",c),p(),u.disconnect(),m?.disconnect(),s.current.measure=null}},[e,a]),/* @__PURE__ */yt("div",{ref:r,className:"es-band-tabs","aria-hidden":"true",children:n.map(e=>{const n=i[e.id];return n?/* @__PURE__ */yt("span",{className:"es-band-tab","data-band-tab":e.id,style:{left:n.left,top:n.top},onMouseEnter:()=>{s.current.id=e.id,o(e.id)},onMouseLeave:()=>{s.current.id=null,o(null),s.current.measure?.()},onClick:n=>{n.stopPropagation(),t(e.id)},children:e.reach?
|
|
5
|
+
/* @__PURE__ */yt(tt,{content:e.reach,children:/* @__PURE__ */vt(_n,{colorClass:ot("success","solid"),size:"sm",children:[
|
|
6
|
+
/* @__PURE__ */yt("span",{className:"es-band-tab-mark",children:/* @__PURE__ */yt(mt,{size:12})}),e.label]})}):/* @__PURE__ */yt(_n,{colorClass:ot("info","solid"),size:"sm",children:e.label})},e.id):null})})}function Ot({expand:e}){/* @__PURE__ */
|
|
7
|
+
return yt("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:/* @__PURE__ */vt(bt,e?{children:[
|
|
8
|
+
/* @__PURE__ */yt("path",{d:"M8 9l4-4 4 4"}),
|
|
9
|
+
/* @__PURE__ */yt("path",{d:"M8 15l4 4 4-4"})]}:{children:[
|
|
10
|
+
/* @__PURE__ */yt("path",{d:"M8 4l4 4 4-4"}),
|
|
11
|
+
/* @__PURE__ */yt("path",{d:"M8 20l4-4 4 4"}),
|
|
12
|
+
/* @__PURE__ */yt("path",{d:"M5 12h14"})]})})}var Nt=`${$n}, ${En}`;function Bt(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 It="__rungs",Pt=e=>"template"===e.kind?e.template.id:"shared"===e.kind?e.section.id:"preset"===e.kind?e.preset.key:e.type;var Mt="screen:band",$t={duplicate:!0,delete:!0},Et=()=>null;function Tt(){const $n=ye(),Rn=$n.panels?.Toolbar,Fn=($n.panels?.useRight??Et)(),{target:Dn,docId:Qn,capabilities:tt,currentSlug:ot,siteId:rt,onPublish:it,saveState:lt,saveConflict:mt,retrySave:zt,toggleAutoSave:Tt,flushSave:jt,access:Lt,saveUnreachable:At=!1,readOnly:Rt,readOnlyReason:Ft=null}=C(),Dt=j(),Vt=L(),{mediaEditing:Wt,hasEditGuard:Ht,hasPinnedChrome:Yt}=tt,{appState:Ut,dispatch:Jt,history:Xt,selectedItem:Gt,getSelectorForId:Kt,config:Qt}=Ae(e=>e),_t=A(),{first:qt,firstGroup:Zt,lastGroup:eo,isSectionGroup:no,sectionGroupZone:to,panelOf:oo}=_t,ro=oo(qt),io=e=>re(_t,e),lo=e=>ie(_t,e),so="node"===_t.firstRow,ao=_t.band??null,co=yn("screen",Se),po=yn("tree",_e),uo=yn("drag",Sn),ho=yn("notice",un),fo=yn("lock",gn),mo=yn("menu",qe),go=yn("styleClipboard",ze),yo=yn("chrome",hn),vo=R()??`/${ot}`,bo=F(),ko=D(),So=k({readOnly:Rt}),wo=k({readOnly:Rt,foldIntoHistory:!0}),xo=Wn(null),zo=Re(),Co=Hn(()=>({...So,select:e=>{xo.current=e,So.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=zo.config;xo.current=Ze(e,t,n)}So.commitDocument(e,n)}}),[So,zo]),Oo=Ut.ui,No=Oo.leftSideBarVisible,Bo=Oo.rightSideBarVisible,{options:Io,widths:Po,initial:Mo,fluid:$o,fit:Eo}=V(),[To,jo]=Yn(Mo),Lo=ae(),Ao=Wt&&null!==Lo;ce(),pe();const Ro=ue();W(Gt?.props.id);const{read:Fo,write:Do,forSelection:Vo}=H(),[Wo,Ho]=Yn(Fo);Un(()=>{Do(Wo)},[Wo]);const[Yo,Uo]=Yn(0),Jo=Wn(null),Xo=Wn(null),Go=Mn(Xo,{readySelector:Nt}),Ko=Tn(Go),Qo=p(Xo);u(Xo,Go);const _o=z(),qo=fn(Lt),Zo={state:lt,offline:_o||lt.failed&&At,readOnlyReason:Ft,editing:qo?ho.editing({name:mn(qo.name,fo),noun:co.noun}):null,conflict:null!=mt,notSaving:co.bar.notSaving},er=Fe({onPress:()=>{Rt||(lt.failed?zt():jt())}}).onPress;h(Xo,Go,er);const[nr,tr]=Yn(!1),or=Wn(!1),[rr,ir]=Yn(null),[lr,sr]=Yn([]),[dr,ar]=Yn(Y);U(dr);const cr=e(dr,Gt?.props.id),[pr,ur]=Yn(null);Un(()=>{pr&&(n(),ur(null))},[pr]);const hr=Wn(Kt);hr.current=Kt;const fr=Jn((e,{scroll:n})=>{Ho(n=>Vo(e,n)),n&&ur(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=hr.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),t.push(e),o=n}0!==t.length&&Yr(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),mr=Wn(null);Un(()=>{const e=mr.current;mr.current=null;const n=null==Gt?.props.id?null:String(Gt.props.id);ar(t=>e&&e.id===n?e.mode:"part"===t.kind&&"nodeId"in t&&t.nodeId===n?t:oo(Gt?.type)??Y);const o=Gt?.props.id,r=xo.current;if(xo.current=null,!o)return;const i=Kt(o);fr(String(o),{scroll:!t(r,i??null,Ie)})},[Gt?.props.id,fr]);const gr=Jn(e=>{ar(n=>J(n,e)?n:e),Jt({type:"setUi",ui:{rightSideBarVisible:!0}})},[Jt]),yr=Wn(()=>{});yr.current=(e,n)=>{const t=e?Wi(e.zone??Ie)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==Gt?.props.id?null:String(Gt.props.id);ar(e=>J(e,n)?e:n),o!==r&&(mr.current={id:o,mode:n},Co.select(e))};const vr=Jn((e,n)=>yr.current(e,n),[]),br={kind:dr.kind,mode:dr,open:gr,show:e=>ar(e),reveal:()=>{Bo||Jt({type:"setUi",ui:{rightSideBarVisible:!0}})},select:vr},kr=X(br,{data:Ut.data,selected:Gt??null,zoneOf:e=>Kt(e)?.zone,readOnly:Boolean(Rt),select:e=>{ar(Y),Co.select({index:e})},replace:(e,n)=>Co.replaceComponent(Ie,e,n),scrollTo:e=>a(e)},{device:To,refreshes:Yo},{setView:Ho,reveal:()=>{No||Jt({type:"setUi",ui:{leftSideBarVisible:!0}})}}),Sr=kr.resolveLeftView?kr.resolveLeftView(Wo):"sections",wr=G(),{isLockedBlock:xr,duplicateBlocked:zr,nestDepth:Cr,newSectionNode:Or,canAddTo:Nr,blockIsOffered:Br}=wr,Ir=e=>({id:String(e.props.id??""),data:Ut?.data}),Pr=K(),{labelAtLevel:Mr,Icon:$r,useProducts:Er}=Pr,Tr=Pr.rowName?(e,n,t)=>Pr.rowName(e,n,t):void 0,jr=Jn(e=>{Jt({type:"setUi",ui:{rightSideBarVisible:!0}}),a(e),fr(e,{scroll:!0})},[Jt,fr]),{selectNode:Lr,openPartId:Ar}=b({mode:dr,setMode:ar,onOpenPart:jr}),[Rr,Fr]=Yn(null);ve(null!==Rr,()=>Fr(null));const Dr=g(Q()),Vr=Dr.collapsed,Wr=Dr.panelWidths,[Hr,Yr]=Yn(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(Vr);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
|
|
13
|
+
return new Set}});Un(()=>{try{window.localStorage.setItem(Vr,JSON.stringify([...Hr]))}catch{}},[Hr]);const[Ur,Jr]=Yn(()=>{if("undefined"==typeof window)return{...y};try{const e=window.localStorage.getItem(Wr);if(!e)return{...y};const n=JSON.parse(e);return{left:v(Number(n.left)||y.left,"left"),right:v(Number(n.right)||y.right,"right")}}catch{return{...y}}});Un(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(Wr,JSON.stringify(Ur))}catch{}},300);return()=>clearTimeout(e)},[Ur]);const Xr=Jn((e,n)=>Jr(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),Gr=Jn(e=>Xr("left",e),[Xr]),Kr=Jn(e=>Xr("right",e),[Xr]),Qr=e=>Hr.has(e),_r=e=>Yr(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),qr=Wn(!1),Zr=Wn(null);Un(()=>{if(qr.current&&!nr){const e=Zr.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??Xo.current?.querySelector(`button[aria-label="${CSS.escape(co.add.title)}"]`))?.focus(),Zr.current=null}qr.current=nr},[nr]),Un(()=>{if(!nr||!Qo)return;const e=e=>{"Escape"===e.key&&Sl()};return Qo.addEventListener("keydown",e),()=>Qo.removeEventListener("keydown",e)},[nr,Qo]),ve(nr,()=>Sl()),Un(()=>{!No&&nr&&(tr(!1),ir(null),or.current=!1)},[No]);const ei=_(),ni=(e,n="success",t)=>{if(ei)return void(t?ei(e,"error"===n?"error":"info",t):ei(e,"error"===n?"error":"info"));const o={sound:!1,action:t?.action,onClose:t?.onClose};"error"===n?et.error(e,{...o,duration:t?.duration??3200}):et.success(e,{...o,duration:t?.duration??1900})},ti=Fe(kr.mainAction??{label:co.done,onPress:()=>{it(zo.getState().appState.data)}}),oi=Wn(ni);oi.current=ni,Un(()=>De(zo,()=>oi.current(co.writeLate,"error")),[zo,co]);const ri=Wn(null),[ii,li]=Yn(0),[si,di]=Yn(0),ai=q(),ci=Wn(null),pi=e=>Math.max(0,e.clientHeight-(ci.current?.offsetHeight??0));Un(()=>{const e=ri.current;if(!e)return;const n=()=>{li(e.clientWidth),di(pi(e))};n();const t=new ResizeObserver(n);return t.observe(e),ci.current&&t.observe(ci.current),()=>t.disconnect()},[]),Xn(()=>{ri.current&&(li(ri.current.clientWidth),di(pi(ri.current)))},[Ur,No,Bo]);const ui=To===$o?ii>0?ii:Po[$o]:Po[To],hi=ii>0?Math.min(ii/ui,"shrink"===Eo?1:2):1,fi=ui*hi,mi=ii>0&&fi>ii+1,gi={width:fi,height:si||"100%",flex:"none",position:"relative"},yi={width:ui,height:si?si/hi:"100%",maxHeight:"none",transform:1!==hi?`scale(${hi})`:void 0,transformOrigin:"top left"},vi=()=>Jt({type:"setUi",ui:{leftSideBarVisible:!No}}),bi=()=>Jt({type:"setUi",ui:{rightSideBarVisible:!Bo}}),ki=e=>{nr&&(tr(!1),ir(null),or.current=!1,No&&Wo===e)||(Ho(e),No||Jt({type:"setUi",ui:{leftSideBarVisible:!0}}))},Si=()=>{ar(ro??Y),Bo||Jt({type:"setUi",ui:{rightSideBarVisible:!0}})},wi=Ut.data.content??[],xi=()=>{const e=wi.findIndex(io),n=wi.findIndex(lo);return{floor:e>=0?e+1:0,cap:n>=0?n:wi.length}},zi=Qt,Ci=wr.stripCopy,Oi=e=>o(e,Ci),Ni=fe(),Bi=en({data:Ut.data,config:zi,readOnly:Boolean(Rt),clipboard:Ni,strip:Ci?e=>Ci(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}=xi();return{min:t,max:o-1}},commit:(e,{select:n})=>{void 0!==n&&ar(Y);const t=void 0===n||"node"===n?.kind?n:null;Co.commitDocument(e,t)}}),Ii=ge(),[Pi,Mi]=Yn(null),$i=e=>{const n=wi.find(n=>String(n.props.id)===e),t=_t.shared;n&&t&&Bi.swap(e,t.detach(n))},Ei=e=>{const n=In(Ut.data,Qt,e);if(!n)return!1;const t=Nn(n.place),o=n.node,r=t===Ie?Fi(o):el(o),i=t===Ie?_t.shared?.usedOn(o):null;return!!Bi.remove(e)&&(ni(i?co.shared.removed({count:Math.max(0,i.length-1)}):co.deleted({name:r}),"success",{duration:8e3,action:{label:co.bar.undo,onClick:()=>{Bi.restore(n.node,n.place)}}}),!0)},Ti={...Bi,remove:Ei},ji=e=>Mr(e,"block",Qt.components[e]?.label??e),Li=Hn(()=>l(Qt),[Qt]),Ai=e=>Mr(e,"section",ji(e)),Ri={nodeDefaults:Li,newNodeId:Te,sectionLabel:Ai,blockIsOffered:Br},Fi=e=>Ce({type:e.type,props:e.props??{}},Ai(e.type),Tr),{nodeAddresses:Di,zoneItems:Vi}=Hn(()=>{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>=Me)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of $e(Qt,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(wi,Ie,0),{nodeAddresses:e,zoneItems:n}},[wi,Qt]),Wi=Jn(e=>Vi.get(e)??[],[Vi]),Hi=e=>{const n=Di.get(e);return n?Wi(n.zone)[n.index]:void 0},Yi=e=>le(wr,Qt,e),Ui=e=>{if(!wr.slotsOf||e===Ie)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=Hi(e.slice(0,n));if(!t)return null;const o=Yi(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}},Ji=(()=>{if(!Z(dr))return null;const e=`${dr.nodeId}:${dr.slot}`;return Ui(e)?.slot.panel===dr.kind?e:null})(),Xi=Wn(null);Un(()=>{const e=Xi.current;if(Xi.current=null,!Ji||!Z(dr))return;const n=dr.nodeId;fr(n,{scroll:e!==Ji}),Yr(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[dr]);const Gi=e=>{const n=Di.get(e);n&&(n.zone===Ie?fl(n.index):Vl(n.zone,n.index,e,Hi(n.zone.slice(0,n.zone.lastIndexOf(":")))?.type??""))},Ki=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void Gi(o);const r={kind:n.panel,nodeId:o,slot:n.slot},i=`${o}:${n.slot}`;t&&Ji!==i&&(Xi.current=i),vr(null,r),Bo||Jt({type:"setUi",ui:{rightSideBarVisible:!0}}),a(o)},Qi=(e,n,t)=>{const o=`${e}:${n}`;if(Yr(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;Ji!==o&&(Xi.current=o);vr(null,{kind:t,nodeId:e,slot:n})},_i=(e,n,t)=>{if(Rt||!wr.moveSlot)return;const o=Hi(e),r=o?Yi(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:It,index:n},s=zn(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=wr.moveSlot(e,n,s);"string"==typeof d&&Qi(e,d,i.panel)},qi=Er(),Zi=Hn(()=>{const e=/* @__PURE__ */new Map;for(const n of qi??[])e.set(n.slug,n.name);return e},[qi]),el=e=>Oe(e,ji,Pr.plainText,e=>Zi.get(e),Pr.rowName),nl=(e,n)=>{const t=Qt.components[e.type]?.fields,o=n===Ie||hs(n)?"section":"block",r=n===Ie&&(io(e)||lo(e)||no(e.type)),i="block"===o?Ne(t):r?null:Be(t);return Pr.renamePropOf?Pr.renamePropOf(e,o,i):i},tl=(e,n,t,o)=>{if(!(!Rt&&Rr?.zone===e&&Rr.index===n))return;const r=(t,o)=>{Fr(null),o&&((e,n,t)=>{const o=Wi(e)[n];if(!o)return;const r=nl(o,e);r&&Co.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
|
|
14
|
+
return yt("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":co.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)},ol=i(ee(),go),rl=ol.scope({target:Dn,siteId:rt,docId:Qn}),il=Qt,ll=(e,n)=>n===Ie?Ai(e):ji(e),sl=(e,n,t)=>{const o=ol.plan(rl,t,ll(t.type,e),il);o&&(o.changed&&Co.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),ni(o.message))},dl=me({nodesIn:Wi,nodeAt:(e,n)=>Wi(e)[n]??null,labelOf:(e,n)=>n===Ie?Ai(e):ji(e),renamePropOf:nl,beginRename:(e,n)=>Fr({zone:e,index:n}),history:{hasPast:Xt.hasPast,hasFuture:Xt.hasFuture,back:()=>Xt.back(),forward:()=>Xt.forward()},openPageStyles:kr.openPageStyles,pageStylesLabel:co.pageStyles,words:{menu:mo,styleClipboard:go,screen:co.menu},readOnly:Boolean(Rt),collapseAll:()=>Yr(new Set(Wi(Ie).map(e=>String(e.props.id)))),onPasteRefused:e=>ni(e?co.pasteRefused({name:e.label}):co.menu.clipboardRefused,"error"),canPasteAt:(e,n)=>gs(e,n),copyItem:kr.onCopyItem,menuRows:(e,n,t)=>{const o=kr.menuRows?.(e,n,t)??null,r=((e,n)=>{const t=_t.shared;if(!t||n!==Ie)return null;const o=t.usedOn(e);if(o){const n={pick:[{label:co.shared.onPages({count:o.length}),onClick:()=>{},children:o.map(e=>({label:e.title,onClick:()=>t.openPage(e)}))}]};return Rt||xr(e.type,e)?n:{...n,change:[{label:co.shared.detach,onClick:()=>$i(e.props.id)}],remove:[{label:co.shared.removeFromPage,danger:!0,onClick:()=>{Ei(e.props.id)}}]}}return Rt||io(e)||lo(e)||no(e.type)?null:I(Ii)?{change:[{label:co.shared.makeShared,onClick:()=>Mi({id:e.props.id,name:Fi(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=>xr(e.type,e),duplicateBlocked:e=>zr(Ut.data,e),permits:e=>{const n=Pe(Qt,e.type);return _t.shared?.usedOn(e)?{...n,delete:!1}:n},nodeOps:Ti,isPinned:(e,n)=>n===Ie&&(io(e)||lo(e)),sectionBand:xi,locate:e=>Di.get(e)??null,rowNameOf:(e,n)=>n===Ie?Fi(e):el(e),selectAt:(e,n,t,o)=>{e===Ie?fl(n):Vl(e,n,t,o??"")},slotRung:e=>{const n=Ui(e);return n?.slot.panel?{label:n.slot.label,select:()=>Ki(n.node,n.slot,!1)}:null},style:{held:()=>we(rl),canCopy:e=>ol.rows(il,e).some(e=>!1!==e.counted),copy:(e,n)=>ol.copy(rl,e,ll(e.type,n),il),paste:(e,n,t)=>sl(e,n,t)},keys:Vt?{target:Qo,selected:()=>{const e=Ut.ui.itemSelector;return e?{zone:e.zone??Ie,index:e.index}:null},held:()=>Ni.get(),readOnly:Boolean(Rt),onDone:({done:e,name:n})=>{"copied"===e&&ni(co.copied({name:n}))}}:void 0},Go),al=Wn({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});Un(()=>{al.current={copy:(e,n)=>ol.copy(rl,e,ll(e.type,n),il),paste:sl,at:()=>{const e=Ut.ui.itemSelector;if(!e)return null;const n=e.zone??Ie,t=Wi(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean(Rt)}});const cl=Jn(e=>{const n=xe(e);if(!n)return;const t=al.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))},[]);Un(()=>{if(!Qo)return;const e=e=>cl(e);return Qo.addEventListener("keydown",e),()=>Qo.removeEventListener("keydown",e)},[cl,Qo]),jn(Go,"keydown",cl);const pl=wi.map(e=>e.props.id).join("|");Un(()=>{const e=Go?.document??null,n=Go?.window??null;let t=0;const o=[],r=()=>{if(!e)return void sr(e=>e.length?[]:e);const n=wi.findIndex(lo),t=n>=0?n:wi.length,o=n=>{const t=wi[n]?.props?.id;return null==t?null:Vn(e,`[data-easel-block="${CSS.escape(String(t))}"]`)},r=e=>e?[...e.querySelectorAll(En)].map(e=>e.getBoundingClientRect()).filter(e=>e.width>0||e.height>0):[],i=[];for(let e=wi.length>0&&!io(wi[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=Bt(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})}sr(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=Ln(n,i),s=new ResizeObserver(i);return s.observe(e.documentElement),r(),o.push(setTimeout(r,150),setTimeout(r,450)),()=>{cancelAnimationFrame(t),o.forEach(clearTimeout),n.removeEventListener("scroll",i),l(),s.disconnect()}},[Go,pl,To,hi,No,Bo,Gt?.props.id]);const ul=Go?.document??null,hl=Go?.window??null;Un(()=>{const e=Jo.current;if(!e||!ul||!hl)return;const n=[],t=()=>{const n=Vn(ul,`[data-easel-block="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&hl.scrollTo({left:hl.scrollX,top:hl.scrollY+t,behavior:"instant"}),!0};return Jo.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[ul,hl]);const fl=e=>{ar(Y),Co.select({index:e}),kr.sectionPressed?.(wi[e]);const n=wi[e]?.props?.id;n&&a(n)},ml=e=>{const{floor:n,cap:t}=xi(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=Gt&&dr.kind!==ro?.kind?wi.findIndex(e=>e.props.id===Gt.props.id):-1;return o(r>=0?r+1:t)},gl=(e,n)=>{const{floor:t,cap:o}=xi(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(Co.reorderComponent(Ie,e,i),Co.select({index:i}),{moved:!0,dest:i})},yl=(e,n,t,o)=>{ar(Y),Co.select(o?{index:o.index,zone:o.zone}:{index:e}),a(n),ni(co.sectionAdded({name:t}))},vl=(e,n)=>{const t=ml(n),o=Or(e,Ri),r=o?Co.insertNode(Ie,t,o):Co.insertSection(e,t);return yl(t,r,Ai(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 $e(Qt,e)){if(s.type===t&&(!o.at||n>o.at.depth)){const r=Nr(e.type,l,d.slice(d.lastIndexOf(":")+1),Ir(e)),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},bl=e=>kl(Ie,e),kl=(e,n)=>{Zr.current=document.activeElement??null,ir(null===n?null:{zone:e,index:n}),tr(!0),No||(or.current=!0,Jt({type:"setUi",ui:{leftSideBarVisible:!0}}))},Sl=()=>{tr(!1),ir(null),or.current&&Jt({type:"setUi",ui:{leftSideBarVisible:!1}}),or.current=!1},wl=(e,n)=>Pr.rowName?n?io(e)?Pr.rowName(e,"section",co.header):lo(e)?Pr.rowName(e,"section",co.footer):no(e.type)?Pr.rowName(e,"section",ji(e.type)):Fi(e):el(e):n?Ai(e.type):ji(e.type),xl=e=>n=>{e()},zl=(e,n,t)=>{if(Rt)return null;const o=Wi(e)[n];return o&&!Pe(Qt,o.type).delete||o&&xr(o.type,o)?null:/* @__PURE__ */yt(Ke,{kind:"delete",label:e===Ie&&o&&_t.shared?.usedOn(o)?co.shared.removeFromPage:co.deleteNamed({name:t}),onClick:()=>((e,n)=>{const t=Wi(e)[n]?.props?.id;null!=t&&Ei(String(t))})(e,n),children:/* @__PURE__ */yt(ut,{size:15})})},Cl=e=>Pr.rowPreview?.(e)||void 0,Ol=e=>Pr.rowMarks?.(e)??void 0,Nl=(e,n,t)=>Pr.rowActions?.(e,n,t)??null,Bl=(e,n,t,o)=>{if(Rt)return null;if(xr(t.type,t))return null;const r=Boolean(t.props._hidden);/* @__PURE__ */
|
|
15
|
+
return yt(Ke,{kind:"eye",label:r?co.showNamed({name:o}):co.hideNamed({name:o}),onClick:()=>Pl(e,n,t),children:/* @__PURE__ */yt(r?ht:ft,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},Il=e=>ad(Ie,e),Pl=(e,n,t)=>{Co.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},Ml=e=>Ee(Qt,e),$l=e=>$e(Qt,e),El=e=>wr.slotsOf?Yi(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:je(e,n.slot)})):[{slot:null,rung:null,kids:se(Qt,e)}],Tl=e=>wr.slotsOf?El(e).flatMap(e=>e.kids):se(Qt,e),jl=e=>Boolean(wr.slotsOf)&&Yi(e).some(e=>e.rung),Ll=(e,n,t)=>Nr(e.type,n,t??void 0,Ir(e)),Al=(e,n,t)=>{const o=Le(Qt,e.type,n)&&(t||Tl(e).length>0||jl(e));return{collapsible:o,folded:o&&Qr(String(e.props.id))}},Rl=(e,n,t)=>El(e).flatMap(o=>{const r=o.rung?n+1:n,i=o.kids.flatMap(({child:e})=>Al(e,r,t(e.type)).collapsible?[String(e.props.id),...Rl(e,r+1,t)]:[]);return o.rung?[`${e.props.id}:${o.rung.slot}`,...i]:i}),Fl=e=>Tl(e).length>0||jl(e)||Boolean(Nr(e.type)),Dl=e=>Boolean(Nr(e)),Vl=(e,n,t,o)=>{if(ar(Y),Nr(o)?.spec?.slider){const t=e.split(":")[0];c(t,n),Co.select({index:n,zone:e}),a(t)}else Co.select({index:n,zone:e}),a(t)},Wl=(e,n,t,o,r)=>{const i=`${e}:${n}`,l=ys(i)?.target.spec??null,d=s(l,t,Ri);d?Co.insertNode(i,o,d):Co.insertComponent(i,t,o),l?.slider?requestAnimationFrame(()=>{c(e,o),Co.select({index:o,zone:i})}):Co.select({index:o,zone:i})},Hl=Wn(/* @__PURE__ */new Set);Un(()=>{wi.forEach(e=>{const n=Nr(e.type)?.spec;if(!n)return;const t=e.props.id;if(Hl.current.has(t))return;Hl.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(Li)).forEach((e,t)=>wo.seedChild(o,t,n.childType,e))})},[wi,wo,Li]);const Yl=Wn(/* @__PURE__ */new Set);Un(()=>{wi.forEach((e,n)=>{const t=e.props.id;if(Yl.current.has(t))return;const o=r(e,Ml(e.type));Yl.current.add(t),o&&wo.replaceComponent(Ie,n,{...e,props:o})})},[wi,wo]),ne(wo,Qt);const Ul=wi.findIndex(lo),Jl=Ul>=0?wi[Ul]:null,Xl=so?wi.findIndex(io):-1,Gl=Xl>=0?wi[Xl]:null,Kl=_t.groupTab,Ql=Hn(()=>Kl?e=>no(e.type):void 0,[Kl]),_l=Boolean(_t.groupBadge),ql=_t.sharedReach,Zl=e=>ql?.(e)??void 0,es=Hn(()=>ql?new Set(wi.filter(e=>Zl(e)).map(e=>String(e.props.id))):null,[wi,ql]),ns=Hn(()=>es?e=>es.has(e):void 0,[es]),ts=_t.first?ql?.({type:_t.first,props:{id:""}})??void 0:void 0,os=_t.groupBadge?/* @__PURE__ */yt("span",{className:"es-tree-group-badge",children:/* @__PURE__ */yt(_n,{tone:"info",size:"xs",children:_t.groupBadge})}):void 0,rs=wi.find(e=>e.type===Zt)??null,is=wi.find(e=>e.type===eo)??null,ls=Ul>=0?Ul:wi.length,ss=[];wi.forEach(e=>{lo(e)||(Fl(e)&&ss.push(String(e.props.id)),ss.push(...Rl(e,1,Dl)))}),Jl&&(ss.push(String(Jl.props.id)),ss.push(...Rl(Jl,1,Dl)));const ds=ss.length>0&&ss.every(e=>Hr.has(e)),as=e=>{const n=Pr.blockRowName(e,ji);return Pr.rowName?Pr.rowName(e,"block",n):n},cs=(e,n,t,o)=>{const r=Wi(e)[t];if(!r)return;const i={...Bn(e),index:t},l={...Bn(n),index:Math.min(Math.max(o,0),Wi(n).length)},s=zn(i,l);if(e!==n||s!==t)try{Bi.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof Pn))throw e}},ps=e=>{const n=/* @__PURE__ */new Set,t=e=>{for(const{child:o,zone:r}of $l(e))n.add(r),t(o)};for(const t of Ml(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},us=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=Di.get(n);if(!e)return null;if(e.zone===Ie)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},hs=e=>{const n=e.slice(0,e.indexOf(":")),t=wi.find(e=>no(e.type)&&String(e.props.id)===n);return t&&to(n)===e?t:null},fs=(e,n)=>{const t=hs(e);return!t||(!_t.groupAccepts||_t.groupAccepts(t.type,n,Wi(e).length))},ms=(e,n,t)=>{if(e.rung){const t=Hi(e.rung.nodeId),o=t?Yi(t).filter(e=>e.rung).length:0;return n.parentId===e.rung.nodeId&&n.slot===It&&n.index>=0&&n.index<=o}if(n.slot===It)return!1;if(e.add)return bs(e.add,n);const o=Nn(n);if(no(e.type))return!1;const r=hs(o),i=hs(e.zone);if(r||i)return!(!r||!i)&&(!(r!==i&&!fs(o,e.type))&&(n.index>=0&&n.index<=Wi(o).length));if(e.zone===Ie||o===Ie){if(e.zone!==o)return!1;const{floor:t,cap:r}=xi();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=Jl&&!_t.lastIsOpen?String(Jl.props.id):null;return(!l||us(e.zone)!==l&&us(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=Di.get(i),s=l?Wi(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&ps(r).has(n))return!1;const d=Nr(s.type,Cr(Ut?.data,s.type,i),n.slice(n.lastIndexOf(":")+1),Ir(s));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)},gs=(e,n)=>{const t=Nn(e.from),o=e.node;return t===Nn(n)?fs(t,o.type):ms({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},ys=e=>{const n=e.slice(0,e.indexOf(":")),t=Di.get(n),o=t?Wi(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=Nr(o.type,Cr(Ut?.data,o.type,n),e.slice(e.lastIndexOf(":")+1),Ir(o));if(!r||`${n}:${r.slot}`!==e)return null;if("footer"===r.source)return null;const i=T(r.choices??(r.spec?[{type:r.spec.childType,label:ji(r.spec.childType)}]:[])),l=Ui(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:wl(o,t.zone===Ie)}},vs=(e,n)=>{if("section"!==e.kind)return e;const t=Nn(n);return t===Ie||hs(t)?e:ys(t)?.choices.some(n=>n.type===e.type)?{kind:"block",type:e.type}:e},bs=(e,n)=>{const t=vs(e,n),o=Nn(n);if("shared"===t.kind){if(o!==Ie||!_t.shared?.nodeOf(t.section))return!1;const{floor:e,cap:r}=xi();return n.index>=e&&n.index<=r}if("block"!==t.kind){if(hs(o)){if("preset"===t.kind)return!1;const e="section"===t.kind?t.type:t.template.node.type;return fs(o,e)&&n.index>=0&&n.index<=Wi(o).length}if(o!==Ie)return!1;const{floor:e,cap:r}=xi();return n.index>=e&&n.index<=r}if(o===Ie)return!1;const r=ys(o);return!(!r||!r.choices.some(e=>e.type===t.type))&&!r.target.spec?.addBlocked?.(Wi(o))},ks=(e,n)=>{const t=vs(e,n);if("block"!==t.kind&&hs(Nn(n)))return void((e,n,t)=>{const o="section"===e.kind?e.type:"template"===e.kind?e.template.node.type:null;if(o&&fs(n,o)){if("section"===e.kind)Co.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;Co.insertNode(n,t,Oi(e.template.node),{copy:!0})}ar(Y),Co.select({index:t,zone:n})}})(t,Nn(n),n.index);if("section"===t.kind)return void vl(t.type,n.index);if("template"===t.kind)return void((e,n,t)=>{const o=ml(t),r=Co.insertNode(Ie,o,n,{copy:!0});yl(o,r,e)})(t.template.name,Oi(t.template.node),n.index);if("preset"===t.kind)return void((e,n,t)=>{const o=n(Ri);if(!o)return;const r=ml(t),i=Co.insertNode(Ie,r,o);yl(r,i,e)})(t.preset.label,t.preset.insert,n.index);if("shared"===t.kind){const e=_t.shared?.nodeOf(t.section);if(!e)return;const o=ml(n.index);return void(Bi.restore(e,{parentId:Cn,slot:On,index:o})&&yl(o,e.props.id,t.section.title))}const o=Nn(n),r=ys(o);r&&(r.target.spec?Wl(r.parentId,r.target.slot,t.type,n.index,r.parent.type):((e,n,t)=>{Co.insertComponent(e,n,t),ar(Y),Co.select({index:t,zone:e})})(o,t.type,n.index))},Ss=(e,n)=>{e.media?function(e){const n=rd();if(!n||!nd)return;ld(n).then(n=>{n&&function(e,n){if(!nd)return;const t=nd.create(e,Ri),o=Nn(n);if(o===Ie){const e=ml(n.index),o=Co.insertNode(Ie,e,t);return void yl(e,o,Ai(t.type))}Co.insertNode(o,n.index,t),ar(Y),Co.select({index:n.index,zone:o})}(n,e)})}(n):e.rung?_i(e.rung.nodeId,e.index,n.index):e.add?ks(e.add,n):e.zone===Ie?gl(e.index,n.index):cs(e.zone,Nn(n),e.index,n.index)},[ws]=Yn(()=>wn()),xs=xn({keyOf:e=>e.id,readOnly:Boolean(Rt),session:ws,canDrop:ms,onDrop:Ss,onStep:(e,n)=>{e.rung?_i(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===Ie?((e,n)=>{const t=Ai(wi[e]?.type??""),o=gl(e,n<0?e-1:e+2);if(!o.moved)return void ni(n<0?co.sectionFirst({name:t}):co.sectionLast({name:t}));const{floor:r,cap:i}=xi();ni(co.sectionMoved({name:t,n:o.dest-r+1,total:i-r}))})(e.index,n):cs(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),zs=Jn(e=>{const{floor:n,cap:t}=xi(),o=[];for(const r of e.nodes){const e=Nn(r.place),i=Wi(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(io(i)||lo(i)||xr(i.type,i))continue;if(no(i.type))continue;const l=Boolean(hs(e)),s=e===Ie||l;e===Ie&&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?Ai(i.type):el(i),from:r.place})}const r=e.zones.flatMap(e=>{const n=Nn(e.list);if(n===Ie&&0===e.children.length)return[{...e,addLabel:co.addSection,addAlways:!0}];const t=ys(n),o=t?.target.spec?.addLabel;return e.children.length>0||Boolean(t?.choices.length)||Boolean(hs(n))?[o?{...e,addLabel:o}:e]:[]}),i=r.flatMap(e=>{const n=Nn(e.list),t=n===Ie||hs(n)?null:ys(n);return t?.choices.length?vn(e,t.target.spec?.addLabel??co.addBlockHere):[]});return{sources:o,zones:r,seams:i}},[Ut.data]),Cs=null==Gt?.props.id?null:String(Gt.props.id),Os=Gn(Ve),Ns=Os?.selected()&&Go?.document&&Cs?Os.selectedPart?.(Go.document)??null:null,Bs=Ns&&Cs&&We(Ut.data,Qt,Cs,Ns)?Ns:null,Is=Bs?.label?{element:Bs.element,label:Bs.label}:null,Ps=null!==Bs,Ms=Jn(e=>{const n=Qt,t=e=>!e.item.rung&&null!==In(Ut.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(Cs);return i?Ps?null:i:r(nn(Ut.data,n,o.item.id,Cs,Ql))??o},[Ut.data,Qt,Cs,Ql,Ps]),[$s,Es]=Yn(null),[Ts,js]=Yn(null),Ls=Boolean(Kl||ql);jn(Go,"mouseover",e=>{if(!Ls)return;const n=An(e.target),t=n?xt(Ut.data,Qt,n):null;t!==$s&&Es(t)}),jn(Go,"mouseout",e=>{Ls&&!e.relatedTarget&&Es(null)});const As=e=>io(e)||lo(e)||no(e.type),Rs=e=>{const n=no(e.type)?ji(e.type):io(e)?co.header:lo(e)?co.footer:null;return null===n?Fi(e):Pr.rowName?Pr.rowName(e,"section",n):n},Fs=[];if(Ls){const e=Cs?xt(Ut.data,Qt,Cs):null;for(const n of/* @__PURE__ */new Set([e,$s,Ts])){const e=n?wi.find(e=>String(e.props.id)===n):void 0;if(!e)continue;const t=io(e)||e.type===Zt,o=Zl(e);if(o){Fs.push({id:String(e.props.id),label:Rs(e),below:t,reach:o});continue}if(!Kl||!As(e))continue;const r=Kl(e);r&&Fs.push({id:String(e.props.id),label:r,below:t})}}const Ds=ge(),Vs=Wn(null);Un(()=>{const e=_t.changeNotice;if(!e)return;const n=JSON.stringify(wi.filter(As)),t=Vs.current;if(Vs.current={doc:Qn,bands:n,index:Xt.index},!t||t.doc!==Qn||t.bands===n)return;Xt.hasPast&&Xt.index>=t.index&&!wt.has(Ds)&&(wt.add(Ds),ni(e,"success",{action:{label:co.bar.undo,onClick:()=>Xt.back()},duration:8e3}))},[wi]);const Ws=e=>{ar(Y),Co.select(e.zone===Ie?{index:e.index}:{index:e.index,zone:e.zone})},Hs=te(),Ys=()=>({data:Ut.data,device:To,ops:Co,inspector:br}),Us=Hs?.model,Js=Hn(()=>Us?e=>Us(e,zs(e),Ys()):zs,[Us,zs,To]),Xs=Hs?.measure,Gs=Xs?(e,n)=>Xs(e,n,Ys()):void 0,Ks=Hs?.canDrop,Qs=Ks?(e,n)=>Ks(e,n,ms,Ys()):ms,_s=Hs?.drop,qs=_s?(e,n)=>_s(e,n,Ss,Ys()):Ss,Zs=Hs?.pick,ed=Zs?e=>Zs(e,Ws,Ys()):Ws,nd=Hs?.media??null,td=Wn(null),od=Hn(()=>nd?{id:kt,zone:"",index:-1,type:nd.adds.type,add:{kind:nd.adds.kind,type:nd.adds.type},media:!0}:null,[nd]);Un(()=>{if(!od||Rt||"undefined"==typeof document)return;const e=e=>{(e=>Array.from(e.dataTransfer?.types??[]).includes(st))(e)&&(td.current=null,ws.start({key:kt,item:od}))},n=e=>{ws.get()?.item.media&&(td.current=nt(e.dataTransfer))},t=()=>{ws.get()?.item.media&&ws.end()};return document.addEventListener("dragstart",e),document.addEventListener("drop",n,!0),document.addEventListener("dragend",t,!0),()=>{document.removeEventListener("dragstart",e),document.removeEventListener("drop",n,!0),document.removeEventListener("dragend",t,!0)}},[od,Rt,ws]);const rd=()=>{const e=td.current;return td.current=null,e},id=he(),ld=async e=>{if(!id)return e;const n=await id(e);return n?{...e,id:n.id,url:n.url}:null};const sd=(e,n)=>{if(!nd)return;const t=In(zo.getState().appState.data,zi,n);if(!t)return;const o=t.node;Co.replaceComponent(Nn(t.place),t.place.index,{...o,props:{...nd.replace(o,e),id:o.props.id}})},dd=e=>{const n=Nn(e),t=Ui(n);t&&Ki(t.node,t.slot,!1),kl(n,e.index)},ad=(e,n)=>/* @__PURE__ */yt(Qe,{...Rt?{}:xs.seam({place:{...Bn(e),index:n}})},`seam:${e}:${n}`),cd={rowClick:xl,isCollapsed:Qr,toggleCollapse:_r},pd=e=>{const n=String(e.props.id),t=wi.findIndex(e=>String(e.props.id)===n),o=to(n),r=Wi(o),i=Qr(n),l=ji(e.type),s=Pr.rowName?Pr.rowName(e,"section",l):l,d=e=>ad(o,e);/* @__PURE__ */
|
|
16
|
+
return vt(bt,{children:[
|
|
17
|
+
/* @__PURE__ */yt(Ue,{words:po,icon:/* @__PURE__ */yt($r,{type:e.type,size:13}),name:s,preview:Cl(e),marks:Ol(e),onSelect:()=>fl(t),nameSlot:tl(Ie,t,n,s),selected:cr===n,badge:Zl(e)?void 0:os,shared:Zl(e),actions:Nl(e,Ie,t)??void 0,rowProps:{"data-node-id":n,onClick:xl(()=>fl(t))},fold:{open:!i,label:"section",onToggle:()=>_r(n)}}),!i&&/* @__PURE__ */vt(Je,{children:[r.map((n,t)=>{const r=String(n.props.id),i=Fi(n),l=Fl(n),s=l&&Qr(r),a=()=>Vl(o,t,r,e.type),{rowProps:c,...p}=xs.row({item:{id:r,zone:o,index:t,type:n.type},place:{...Bn(o),index:t}},{"data-node-id":r,onClick:xl(a)});/* @__PURE__ */
|
|
18
|
+
return vt(Kn,{children:[d(t),
|
|
19
|
+
/* @__PURE__ */yt(Ue,{words:po,icon:/* @__PURE__ */yt($r,{type:n.type,size:13}),name:i,preview:Cl(n),marks:Ol(n),onSelect:a,nameSlot:tl(o,t,r,i),selected:cr===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>_r(r)}:void 0,actions:/* @__PURE__ */vt(bt,{children:[zl(o,t,i),Nl(n,o,t),Bl(o,t,n,i)]}),rowProps:c}),l&&!s&&/* @__PURE__ */yt(Je,{children:fd(n,2)})]},r)}),d(r.length)]})]})},ud=(e,n,t,o,r)=>{const i=String(e.props.id),l=`${i}:${n.slot}`,s=xs.dragging,d=!Qr(l)&&s?.rung?.nodeId!==i,a={...Bn(l),index:0},c=s&&!s.rung&&ms(s,a)?a:void 0,p=()=>Ki(e,n,!0),{rowProps:u,...h}=xs.row({item:{id:`rung:${l}`,zone:`${i}:${It}`,index:t,type:e.type,rung:{nodeId:i,slot:n.slot}},place:{parentId:i,slot:It,index:t},into:c,canDrag:Boolean(wr.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:xl(p)}),f=Rt?null:wr.slotActions?.(e,n.slot);/* @__PURE__ */
|
|
20
|
+
return vt(Kn,{children:[n.heading,
|
|
21
|
+
/* @__PURE__ */yt(Ue,{words:po,icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:Ji===l,...h,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>_r(l)},actions:f&&f.length>0?/* @__PURE__ */yt(bt,{children:f.map((t,o)=>/* @__PURE__ */yt(Ke,{kind:"delete"===t.kind?"delete":"plain",label:t.label,disabled:t.disabled,onClick:()=>((e,n,t)=>{if(Rt||t.disabled)return;const o=String(e.props.id),r=e=>{"string"==typeof e&&Qi(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__ */yt(ut,{size:15}):/* @__PURE__ */yt(gt,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */yt(Je,{children:r})]},l)},hd=(e,n)=>{const t=El(e),o=t.filter(e=>e.rung).length;let r=0;/* @__PURE__ */
|
|
22
|
+
return yt(bt,{children:t.map(t=>{const i=t.kids,l=t.rung?n+1:n,s=Ll(e,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)=>ad(e,n),p=/* @__PURE__ */vt(bt,{children:[i.map(({child:n,zone:t,index:o})=>{const r=cr===String(n.props.id),{collapsible:i,folded:s}=Al(n,l,Dl(n.type)),d=String(n.props.id),a=as(n),p=()=>Vl(t,o,d,e.type),{rowProps:u,...h}=xs.row({item:{id:d,zone:t,index:o,type:n.type},place:{...Bn(t),index:o}},{"data-node-id":d,onClick:xl(p)});/* @__PURE__ */
|
|
23
|
+
return vt(Kn,{children:[0===o&&c(t,0),
|
|
24
|
+
/* @__PURE__ */yt(Ue,{words:po,icon:/* @__PURE__ */yt($r,{type:n.type,size:13}),name:a,preview:Cl(n),marks:Ol(n),onSelect:p,nameSlot:tl(t,o,d,a),selected:r,hidden:Boolean(n.props._hidden),...h,fold:i?{open:!s,label:"group",onToggle:()=>_r(d)}:void 0,actions:/* @__PURE__ */vt(bt,{children:[zl(t,o,a),Nl(n,t,o),Bl(t,o,n,a)]}),rowProps:u}),i&&!s&&/* @__PURE__ */yt(Je,{children:hd(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?ud(e,t.rung,r++,o,p):/* @__PURE__ */yt(Kn,{children:p},t.slot??"")})})},fd=(e,n)=>{const t=Cr(Ut?.data,e.type,String(e.props.id)),o=El(e),r=o.filter(e=>e.rung).length;let i=0;/* @__PURE__ */
|
|
25
|
+
return yt(bt,{children:o.map(o=>{const l=o.kids,s=o.rung?n+1:n,d=Ll(e,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)=>ad(e,n),g=null===o.slot?null:`${u}:${o.slot}`,y=Boolean(a&&!a.fixed&&(null===g||g===h)),v=/* @__PURE__ */vt(bt,{children:[l.map(({child:n,zone:t,index:o})=>{const r=cr===String(n.props.id),i=el(n),l=String(n.props.id),{collapsible:d,folded:a}=Al(n,s,Dl(n.type)),c=Ml(n.type),p=1===c.length?`${l}:${c[0]}`:null,u=p?{...Bn(p),index:Wi(p).length}:void 0,h=xs.dragging,f=u&&h&&ms(h,u)?u:void 0,g=()=>Vl(t,o,l,e.type),{rowProps:y,...v}=xs.row({item:{id:l,zone:t,index:o,type:n.type},place:{...Bn(t),index:o},into:f,canDrag:!xr(n.type,n)},{"data-node-id":l,onClick:xl(g)});/* @__PURE__ */
|
|
26
|
+
return vt(Kn,{children:[0===o&&m(t,0),
|
|
27
|
+
/* @__PURE__ */yt(Ue,{words:po,icon:/* @__PURE__ */yt($r,{type:n.type,size:13}),name:i,preview:Cl(n),marks:Ol(n),onSelect:g,nameSlot:tl(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...v,fold:d?{open:!a,label:"group",onToggle:()=>_r(l)}:void 0,actions:xr(n.type,n)?Nl(n,t,o)??void 0:/* @__PURE__ */vt(bt,{children:[zl(t,o,i),Nl(n,t,o),Bl(t,o,n,i)]}),rowProps:y}),d&&!a&&/* @__PURE__ */yt(Je,{children:fd(n,s+1)}),m(t,o+1)]},String(n.props.id??`${t}-${o}`))}),y&&a&&
|
|
28
|
+
/* @__PURE__ */yt(N,{small:!0,label:a.addLabel,blocked:a.addBlocked?.(c)??null,onAdd:()=>Wl(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?ud(e,o.rung,i++,r,v):/* @__PURE__ */yt(Kn,{children:v},o.slot??"")})})},md=nr,gd=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:No&&!md&&Sr===e.id,onSelect:()=>ki(e.id)}:e,yd=[...(kr.railLead??[]).map(gd),{id:"sections",label:co.layers,icon:/* @__PURE__ */yt(be,{}),active:No&&!md&&"sections"===Sr,onSelect:()=>ki("sections")},...(kr.railTrail??[]).map(gd)],vd=Ao?{onPress:Ro}:Wt?{onPress:()=>{O($n,{accept:"image/*",title:yo.mediaLibrary})}}:null,bd={value:yd.find(e=>!0===e.active)?.id??"",press:e=>{const n=yd.find(n=>n.id===e);n&&!n.disabled&&!0!==n.active&&n.onSelect?.()},items:yd.map(e=>({id:e.id,icon:e.icon,label:/* @__PURE__ */yt("span",{className:"sr-only",children:e.label}),tooltip:e.label,disabled:e.disabled}))},kd=[...kr.railLead??[],...kr.railTrail??[]].find(e=>"panel"in e&&e.id===Sr),Sd=Boolean(ao?.foldable),wd=ao?.label??(Ht?co.pageSections:co.templateSections),xd=Sd&&Qr(Mt),zd=/* @__PURE__ */vt(bt,{children:[wi.map((e,n)=>{if(io(e)||lo(e)||no(e.type))return null;const t=cr===String(e.props.id),o=Boolean(e.props._hidden);$l(e);const r=String(e.props.id),i=kr.hasOwnRows?.(e)??!1,l=Fl(e)||i,s=l&&Qr(r),d=Ml(e.type),a=1===d.length?`${r}:${d[0]}`:null,c=a?{...Bn(a),index:Wi(a).length}:void 0,p=xs.dragging,u=c&&p&&ms(p,c)?c:void 0,{rowProps:h,...f}=xs.row({item:{id:r,zone:Ie,index:n,type:e.type},place:{...Bn(Ie),index:n},into:u,canDrag:!xr(e.type,e)},{"data-node-id":r,onClick:xl(()=>fl(n))});/* @__PURE__ */
|
|
29
|
+
return vt(Kn,{children:[n>0&&Il(n),
|
|
30
|
+
/* @__PURE__ */yt(Ue,{words:po,icon:/* @__PURE__ */yt($r,{type:e.type,size:13}),name:Fi(e),preview:Cl(e),marks:Ol(e),shared:Zl(e),onSelect:()=>fl(n),nameSlot:tl(Ie,n,r,Fi(e)),selected:t,hidden:o,...f,fold:l?{open:!s,label:"section",onToggle:()=>_r(r)}:void 0,actions:/* @__PURE__ */vt(bt,{children:[zl(Ie,n,Fi(e)),Nl(e,Ie,n),Bl(Ie,n,e,Fi(e))]}),rowProps:h}),Fl(e)&&!s&&/* @__PURE__ */vt(Je,{children:[fd(e,1),kr.partRows?.(e,cd)]}),i&&!s&&/* @__PURE__ */yt(Je,{children:kr.ownRows?.(e,n,cd)})]},String(e.props.id??n))}),ls>0&&Il(ls)]}),Cd=(e,n,t)=>{const o=String(e.props.id),r=Tl(e).length>0||jl(e)||Boolean(Nr(e.type)),i=r&&Qr(o),l="header"===t?co.header:co.footer,s=Pr.rowName?Pr.rowName(e,"section",l):l;/* @__PURE__ */
|
|
31
|
+
return vt(bt,{children:[
|
|
32
|
+
/* @__PURE__ */yt(Ue,{words:po,icon:/* @__PURE__ */yt($r,{type:t,size:13}),name:s,preview:Cl(e),marks:Ol(e),badge:Zl(e)?void 0:os,shared:Zl(e),onSelect:()=>fl(n),nameSlot:tl(Ie,n,o,s),selected:cr===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>_r(o)}:void 0,actions:Nl(e,Ie,n)??void 0,rowProps:{"data-node-id":o,onClick:xl(()=>fl(n))}}),r&&!i&&/* @__PURE__ */yt(Je,{children:hd(e,1)})]})};return(kr.wrap??(e=>e))(
|
|
33
|
+
/* @__PURE__ */yt(oe,{target:Go,children:/* @__PURE__ */vt("div",{ref:Xo,className:"sf-editor es-editor",style:pn(Ur),onContextMenu:dl.onEditorContextMenu,...f($n),children:[
|
|
34
|
+
/* @__PURE__ */vt(tn,{children:[
|
|
35
|
+
/* @__PURE__ */vt("div",{className:"es-cluster es-cluster--left",children:[vd?/* @__PURE__ */yt(qn,{variant:"secondary",className:"es-barbtn",leftIcon:/* @__PURE__ */yt(ke,{}),onClick:vd.onPress,children:co.railMedia}):null,
|
|
36
|
+
/* @__PURE__ */yt(on,{label:co.bar.undo,disabled:Boolean(Rt)||!Xt.hasPast,onClick:()=>Xt.back(),children:/* @__PURE__ */yt(dt,{})}),
|
|
37
|
+
/* @__PURE__ */yt(on,{label:co.bar.redo,disabled:Boolean(Rt)||!Xt.hasFuture,onClick:()=>Xt.forward(),children:/* @__PURE__ */yt(at,{})})]}),
|
|
38
|
+
/* @__PURE__ */vt(rn,{children:[
|
|
39
|
+
/* @__PURE__ */yt(ln,{devices:Io,value:To,onChange:jo}),
|
|
40
|
+
/* @__PURE__ */yt(on,{label:co.bar.refresh,tip:co.bar.refreshTip,onClick:()=>{Jo.current=(()=>{const e=Go?.document;if(!e)return null;const n=wi.findIndex(lo),t=n>=0?n:wi.length;let o=null;for(let n=0;n<t;n++){const t=wi[n]?.props?.id;if(null==t)continue;const r=Vn(e,`[data-easel-block="${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=Gt?.props?.id??wi[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),Uo(e=>e+1)},children:/* @__PURE__ */yt(ct,{})}),kr.barView?.()]}),
|
|
41
|
+
/* @__PURE__ */vt(rn,{kind:"right",style:{minWidth:300},children:[
|
|
42
|
+
/* @__PURE__ */yt(w,{input:Zo,words:co.saveStatus}),Rn?/* @__PURE__ */yt(Rn,{}):null,kr.barLead?.(),kr.barTrail?.(),kr.mainAction||!kr.barMain?/* @__PURE__ */yt(x,{input:Zo,action:ti,readOnly:Boolean(Rt),saveSwitch:Dt,onToggleAutoSave:Tt,onSaveNow:er,bar:co.bar,words:co.saveStatus}):kr.barMain()]})]}),
|
|
43
|
+
/* @__PURE__ */yt(S,{}),
|
|
44
|
+
/* @__PURE__ */vt("div",{className:"sf-body",children:[No?/* @__PURE__ */vt(bt,{children:[
|
|
45
|
+
/* @__PURE__ */vt("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left","aria-label":co.leftPanel,children:[
|
|
46
|
+
/* @__PURE__ */vt("div",{className:"es-paneltabs es-paneltabs--with-hide",children:[
|
|
47
|
+
/* @__PURE__ */yt(M,{side:"left",onHide:vi}),
|
|
48
|
+
/* @__PURE__ */yt("span",{className:"es-paneltabs-divider","aria-hidden":"true"}),
|
|
49
|
+
/* @__PURE__ */yt(Zn,{variant:"underline",block:!0,"aria-label":co.bar.views,value:bd.value,onChange:bd.press,items:bd.items})]}),nr?/* @__PURE__ */yt(B,{at:rr?{label:(e=>{const n=hs(e.zone);if(n)return co.add.addingTo({name:Pr.rowName?wl(n,!0):ji(n.type)});if(e.zone===Ie){const n=wi[e.index];return n&&!lo(n)?co.add.addingBefore({name:wl(n,!0)}):co.add.addingAtEnd}const t=ys(e.zone);return t?co.add.addingTo({name:t.parentName}):co.add.addingHere})(rr),onClear:()=>ir(null)}:void 0,placeBlocks:rr&&rr.zone!==Ie?ys(rr.zone)?.choices:void 0,placeNames:rr&&rr.zone!==Ie?(e=>{const n=ys(e),t=n?.target.spec,o=t?d(t,t.childType):null;return t&&o?/* @__PURE__ */new Map([[t.childType,o]]):void 0})(rr.zone):void 0,canTake:rr?e=>{if(!rr)return null;const n={...Bn(rr.zone),index:rr.index};if(bs(e,n))return null;if("shared"===e.kind&&rr.zone===Ie&&!_t.shared?.nodeOf(e.section))return co.shared.alreadyHere;const t=hs(rr.zone);if(t)return co.add.notInside({name:wl(t,!0)});if(rr.zone===Ie)return co.add.onlySections;const o=ys(rr.zone);return o?co.add.notInside({name:o.parentName}):co.add.onlySections}:void 0,onPick:rr?e=>{if(!rr)return;const n={...Bn(rr.zone),index:rr.index};bs(e,n)&&(ks(e,n),Sl())}:void 0,itemFor:e=>({id:`new:${e.kind}:${Pt(e)}`,zone:"",index:-1,type:"template"===e.kind?e.template.node.type:"shared"===e.kind?e.section.node.type:Pt(e),add:e}),session:ws,siteWide:kr.addPanelRow?.(Sl),onClose:Sl,readOnly:Boolean(Rt)}):kd?kd.panel({onHide:vi,notify:ni}):/* @__PURE__ */vt(bt,{children:[
|
|
50
|
+
/* @__PURE__ */yt($,{icon:/* @__PURE__ */yt(be,{}),title:co.layers,context:vo,actions:/* @__PURE__ */vt(bt,{children:[!Rt&&/* @__PURE__ */yt(sn,{label:co.add.title,onClick:()=>bl(null),children:/* @__PURE__ */yt(pt,{size:15})}),
|
|
51
|
+
/* @__PURE__ */yt(sn,{label:ds?co.expandAll:co.collapseAll,title:0===ss.length?co.nothingToFold:void 0,disabled:0===ss.length,onClick:()=>Yr(e=>{const n=new Set(ss);return ds?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,...ss])}),children:/* @__PURE__ */yt(Ot,{expand:ds})})]})}),
|
|
52
|
+
/* @__PURE__ */vt(Xe,{className:"sf-tree sf-scroll",words:po,children:[rs&&/* @__PURE__ */vt(bt,{children:[!_l&&/* @__PURE__ */yt(Ge,{children:co.header}),pd(rs)]}),Yt&&!(_l&&rs)&&/* @__PURE__ */vt(bt,{children:[!_l&&/* @__PURE__ */yt(Ge,{children:co.header}),!so&&/* @__PURE__ */yt(Ue,{words:po,icon:/* @__PURE__ */yt($r,{type:"header",size:13}),name:co.header,badge:ts?void 0:os,shared:ts,onSelect:Si,selected:dr.kind===ro?.kind,rowProps:{onClick:xl(Si)}})]}),Gl&&!(_l&&rs)&&Cd(Gl,Xl,"header"),!Sd&&/* @__PURE__ */yt(Ge,{children:wd}),Sd?/* @__PURE__ */vt(bt,{children:[
|
|
53
|
+
/* @__PURE__ */yt(Ue,{words:po,icon:null,name:wd,fold:{open:!xd,label:wd,onToggle:()=>_r(Mt)}}),!xd&&/* @__PURE__ */yt(Je,{children:zd})]}):zd,Yt&&!_l&&/* @__PURE__ */yt(Ge,{children:co.footer}),Jl&&!(_l&&is)&&Cd(Jl,Ul,"footer"),is&&pd(is),kr.treeFoot?.()]})]})]}),
|
|
54
|
+
/* @__PURE__ */yt(dn,{side:"left",width:Ur.left,min:cn.left,max:an,defaultWidth:y.left,label:co.resizeLeftPanel,onResize:Gr})]}):/* @__PURE__ */yt(E,{side:"left",onShow:vi}),
|
|
55
|
+
/* @__PURE__ */vt("div",{ref:ri,className:"sf-center sf-scroll","data-sf-canvas-head":ai?"":void 0,style:{overflowX:mi?"auto":"hidden",overflowY:"hidden"},children:[ai&&/* @__PURE__ */yt("div",{ref:ci,className:"sf-canvas-head",children:/* @__PURE__ */yt(ai,{device:To})}),
|
|
56
|
+
/* @__PURE__ */vt("div",{className:"sf-frame-scaler",style:gi,children:[
|
|
57
|
+
/* @__PURE__ */yt("div",{className:"sf-frame "+(To===$o?"":`sf-frame--${To}`),style:yi,children:/* @__PURE__ */vt("div",{className:"sf-preview-host",children:[
|
|
58
|
+
/* @__PURE__ */yt(He.Provider,{value:Ql,children:/* @__PURE__ */yt(Ye.Provider,{value:ns,children:/* @__PURE__ */yt(bo,{},Yo)})}),
|
|
59
|
+
/* @__PURE__ */yt(bn,{canvas:Go,session:ws,model:Js,measure:Gs,canDrop:Qs,onDrop:qs,choose:Ms,tag:Is,onPick:ed,dropOn:nd?{accepts:(e,n)=>{if(!e.media||!nd||n.item.rung)return!1;const t=In(Ut.data,zi,n.item.id);return null!==t&&nd.takes(t.node)},onDrop:(e,n)=>(e=>{const n=rd();n&&nd&&ld(n).then(n=>{n&&sd(n,e.item.id)})})(n),label:()=>co.canvasReplaceImage}:void 0,onZoneAdd:dd,onSeamAdd:dd,zoneAddLabel:co.canvasAddBlock,words:uo.canvas,readOnly:Boolean(Rt),revision:Ut.data}),lr.length>0&&!Ko&&/* @__PURE__ */yt("div",{className:"sf-preview-gaps",children:lr.map(e=>
|
|
60
|
+
/* @__PURE__ */yt(kn,{index:e.index,label:co.addSectionHere,onInsert:()=>bl(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))})]})}),Ls?/* @__PURE__ */yt(Ct,{canvas:Go,tabs:Fs,onSelect:Gi,onPointer:js}):null]})]}),Bo?/* @__PURE__ */vt(bt,{children:[Fn?
|
|
61
|
+
/* @__PURE__ */yt("div",{className:"es-sidepanel es-sidepanel--right","data-es-host-panel":"",children:Fn}):/* @__PURE__ */yt(bt,{children:/* @__PURE__ */yt(m,{value:{selectChild:Vl,addChild:Wl,childRowName:el,blockRowName:as},children:/* @__PURE__ */yt(ko,{mode:dr,onOpenWebsiteSettings:kr.openSettings??(()=>{}),onOpenSiteStyles:kr.openStyles,onOpenPageStyles:kr.openPageStyles,onSelectNode:Lr,onNotify:ni,onHidePanel:bi,nodeActions:Gt?Pe(Qt,Gt.type):$t})})}),
|
|
62
|
+
/* @__PURE__ */yt(dn,{side:"right",width:Ur.right,min:cn.right,max:an,defaultWidth:y.right,label:co.resizeSettingsPanel,onResize:Kr})]}):
|
|
63
|
+
/* @__PURE__ */yt(E,{side:"right",onShow:bi})]}),dl.menu,
|
|
64
|
+
/* @__PURE__ */yt(de,{}),Pi?/* @__PURE__ */yt(St,{name:Pi.name,onMake:e=>(async(e,n)=>{const t=wi.find(n=>String(n.props.id)===e),o=_t.shared;if(!t||!o)return;let r;try{r=await P(Ii).create(n,t)}catch{return void ni(co.shared.makeFailed,"error")}o.adopt(t,r),Mi(null)})(Pi.id,e),onCancel:()=>Mi(null)}):null]})}))}export{Tt as ScreenChrome};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Accordion as e,SliderGroup as n}from"efficient-shell/ui";import{jsx as t}from"react/jsx-runtime";var o=Object.freeze(["Design","Animation"]),i=Object.freeze(["Content","Size","Design","Layout","Position","Anchor"]);function l({title:o,open:i,onToggle:l,count:r,level:c=3,id:s,children:a,className:d}){const p=s??"group";/* @__PURE__ */
|
|
2
|
+
return t(e,{level:c,keepMounted:!0,openIds:i?[p]:[],onOpenChange:e=>l(e.includes(p)),items:[{id:p,headId:s,title:o,count:r,className:d?`es-panel-band ${d}`:"es-panel-band",content:/* @__PURE__ */t(n,{children:a})}]})}export{i as DESIGN_GROUPS,o as SETTINGS_BUCKETS,l as SettingsGroup};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{usePickFollowsSelection as n}from"./chunk-NCXYC7WI.js";import{slotFieldsOf as e,slotChildrenIn as t}from"./chunk-TCAAOYQY.js";import{EaselCanvas as r,useSelectedFields as o}from"./chunk-NMLAW6FI.js";import{Inspector as i}from"./chunk-OHHODU7N.js";import{fieldIsShown as u}from"./chunk-BPXEFVSQ.js";import{createContext as l,useContext as s}from"react";import{DesktopIcon as c}from"efficient-shell/icons/efficient";import{jsx as f}from"react/jsx-runtime";var a={kind:"selection"};function d(n){return"selection"===n.kind}function p(n,e){if(d(n)&&d(e))return!0;const t=n,r=e,o=Object.keys(t);return o.length===Object.keys(r).length&&o.every(n=>Object.is(t[n],r[n]))}function m(n){const e=n;return"string"==typeof e.nodeId&&"string"==typeof e.slot}function k(n,t){const r=n.components?.[t.type]?.fields??{};return e(n,t.type).filter(n=>u(r[n],{values:t.props}))}function h(n,e){return k(n,e).flatMap(n=>t(e,n))}function v(n,e,t){const r=n.slotsOf?.(t);return r||k(e,t).map(n=>({slot:n,label:n,rung:!1}))}function y(n,e){return n.isFirst?n.isFirst(e):e.type===n.first}function g(n,e){return n.isLast?n.isLast(e):e.type===n.last}var b={},O=()=>b,j=()=>"",w=()=>null,C=()=>{},L={isLockedBlock:()=>!1,duplicateBlocked:()=>null,nestDepth:()=>0,newSectionNode:()=>null,canAddTo:()=>null,blockIsOffered:()=>!0},N={labelAtLevel:(n,e,t)=>t,descriptions:{},categoryLabel:()=>{},firstSection:null,blockRowName:(n,e)=>e(n.type),plainText:n=>n,Icon:()=>null,Thumbnail:()=>null,useProducts:()=>null},S={options:[{id:"desktop",label:"Desktop",icon:/* @__PURE__ */f(c,{})}],initial:"desktop",fluid:"desktop",widths:{desktop:2e3}},D={read:()=>"sections",write:()=>{},forSelection:(n,e)=>n?"sections":e},I={first:null,last:null,firstGroup:null,lastGroup:null,isSectionGroup:()=>!1,sectionGroupZone:()=>"",panelOf:()=>null};function P(){/* @__PURE__ */
|
|
2
|
+
return f(r,{height:"fill"})}function A(){const{id:n,fields:e,values:t,readOnly:r,onChange:u}=o();/* @__PURE__ */
|
|
3
|
+
return f("div",{className:"es-sidepanel es-sidepanel--right",children:/* @__PURE__ */f(i,{fields:e,values:t,onChange:u,readOnly:r,idPrefix:n})})}var B=l({});function F({parts:n,children:e}){/* @__PURE__ */
|
|
4
|
+
return f(B.Provider,{value:n,children:e})}function x(){return s(B)}function G(){return(x().useOwnerName??j)()}function T(){return(x().useDocumentLabel??w)()}function H(n,e,t,r){return(x().useBridges??O)(n,e,t,r)}function Y(n){return(x().useStandaloneBridges??O)(n)}function M(n,e){(x().useDocumentPass??C)(n,e)}function Q(){return x().blockRules??L}function R(){return x().blockLook??N}function V(){return x().devices??S}function W(){return x().leftView??D}function X(){return x().pinned??I}function E(){return x().saveSwitch??!0}function K(e){n(!0===x().pickFollowsSelection,e)}function U(){return x().storageNamespace||void 0}function Z(){return x().styleClipboard??null}function q(){return x().nodeKeys??!0}function z(){return x().notify??null}function J(){return x().Canvas??P}function $(){return x().CanvasHead??null}function _(){return x().canvasDrag??null}var nn=l(null);function en({target:n,children:e}){/* @__PURE__ */
|
|
5
|
+
return f(nn.Provider,{value:n,children:e})}function tn(){return s(nn)}function rn(){return x().Inspector??A}export{a as SELECTION_MODE,en as ScreenCanvasTargetProvider,F as ScreenPartsProvider,y as isPinnedFirst,g as isPinnedLast,d as isSelectionMode,m as isSlotMode,p as sameInspectorMode,v as screenSlotsOf,h as shownChildSlotsOf,k as shownSlotFieldsOf,R as useScreenBlockLook,Q as useScreenBlockRules,H as useScreenBridges,_ as useScreenCanvasDrag,J as useScreenCanvasFrame,$ as useScreenCanvasHead,tn as useScreenCanvasTarget,V as useScreenDevices,T as useScreenDocumentLabel,M as useScreenDocumentPass,rn as useScreenInspectorPanel,W as useScreenLeftView,q as useScreenNodeKeys,z as useScreenNotify,G as useScreenOwnerName,x as useScreenParts,K as useScreenPickFollowsSelection,X as useScreenPinned,E as useScreenSaveSwitch,U as useScreenStorageNamespace,Z as useScreenStyleClipboard,Y as useStandaloneScreenBridges};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useEaselHost as n}from"./chunk-LX23TCTP.js";import{useEaselApi as e,bindUndoKeys as t}from"./chunk-
|
|
1
|
+
import{useEaselHost as n}from"./chunk-LX23TCTP.js";import{useEaselApi as e,bindUndoKeys as t}from"./chunk-NMLAW6FI.js";import{useState as r,useEffect as o,useRef as u}from"react";function c(e){const t=n(),[u,c]=r(null);return o(()=>c(e.current),[e]),t.ownsDocument?"undefined"==typeof document?null:document:u}function i(r,u){const i=n(),s=e(),f=c(r);o(()=>{if(!i.ownsDocument&&f)return t(f,s,{leaveTyping:!0})},[i,s,f]);const m=u?.document??null;o(()=>{if(!i.ownsDocument&&m)return t(m,s,{leaveTyping:!0})},[i,s,m])}function s(n){return n.ownsDocument?{}:{tabIndex:-1}}function f(n){return!n.altKey&&!n.shiftKey&&(!(!n.metaKey&&!n.ctrlKey)&&("s"===n.key||"S"===n.key||"KeyS"===n.code))}function m(n,e,t){const r=c(n),i=u(t);o(()=>{i.current=t}),o(()=>{if(!r)return;const n=n=>{f(n)&&(n.preventDefault(),i.current())};return r.addEventListener("keydown",n),()=>r.removeEventListener("keydown",n)},[r]);const s=e?.document??null;o(()=>{if(!s)return;const n=n=>{f(n)&&(n.preventDefault(),i.current())};return s.addEventListener("keydown",n),()=>s.removeEventListener("keydown",n)},[s])}export{s as editorRootFocus,f as isSaveShortcut,c as useEaselKeyTarget,m as useEaselSaveKey,i as useEaselUndoKeys};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{STANDARD_MARKUP as t,writeMarkedLines as e,sameMarks as n,markedLines as r,spanFor as l,marksIn as o,toggleMark as i,styleIn as a,styleOver as s,listIn as c,setList as u,colorOver as d,unlinkAt as f,linkOver as h,colorIn as p,findLink as m,clearStyle as g,isSafeLinkHref as b}from"efficient-shell/markup";import{Tooltip as v,ColorSwatch as k,ColorPickerPanel as y,Button as x}from"efficient-shell/ui";import{jsxs as w,jsx as D}from"react/jsx-runtime";function N(t,e){return t&&t.start!==t.end?t:{start:0,end:e}}var T=/* @__PURE__ */new Set(["script","style","head","title","meta","link","template","noscript","svg","math","object","iframe"]),M=/* @__PURE__ */new Set(["p","div","li","ul","ol","dl","dt","dd","h1","h2","h3","h4","h5","h6","blockquote","pre","table","thead","tbody","tfoot","tr","section","article","header","footer","aside","nav","figure","figcaption","address","hr"]);function C(l,o){const i=o.rules??t,a=l.html&&""!==l.html.trim()?function(t,l,o){const i=l.createElement("template");i.innerHTML=t;const a=[[]],s=()=>a[a.length-1],c=()=>{const t=s();for(;t.length>0&&" "===t[t.length-1].ch;)t.pop();t.length>0&&a.push([])},u=(t,e,n,r)=>{if(3===t.nodeType){for(const l of t.textContent??""){const t=/\s/.test(l)?" ":l,o=s();" "===t&&(0===o.length&&a.length>1||" "===o[o.length-1]?.ch)||o.push({ch:t,bold:e,italic:n,href:r})}return}if(1!==t.nodeType&&11!==t.nodeType)return;const l=t,o=1===t.nodeType?l.localName:"";if(T.has(o))return;if("br"===o)return void a.push([]);let i=e,d=n,f=r;if("b"!==o&&"strong"!==o||(i=!0),"i"!==o&&"em"!==o||(d=!0),"a"===o){const t=(l.getAttribute("href")??"").trim();f=b(t)?t:null}const h=1===t.nodeType?l.style:null;if(h){const t=h.fontWeight;"bold"===t||"bolder"===t||Number(t)>=600?i=!0:("normal"===t||"lighter"===t||""!==t&&Number(t)<600)&&(i=!1),"italic"===h.fontStyle||"oblique"===h.fontStyle?d=!0:"normal"===h.fontStyle&&(d=!1)}const p=M.has(o);p&&c();for(const e of[...t.childNodes])u(e,i,d,f);p&&c()};u(i.content,!1,!1,null);for(;a.length>1&&0===a[a.length-1].length;)a.pop();return a.map(t=>function(t,l){const o=e=>t.map((n,r)=>n[e]&&(" "!==n.ch||Boolean(t[r-1]?.[e])&&Boolean(t[r+1]?.[e]))),i=[{bold:!0,italic:!0,links:!0},{bold:!0,italic:!1,links:!0},{bold:!1,italic:!1,links:!0},{bold:!1,italic:!1,links:!1}];for(const a of i){const i=S(t,a.bold?o("bold"):null,a.italic?o("italic"):null,a.links),s=e([i]).text;if(n([i],r(s,l)))return s}return t.map(t=>t.ch).join("")}(t,o))}(l.html,o.doc,i):(l.text??"").replace(/\r\n?/g,"\n").split("\n");return o.multiline?a.join("\n"):1===a.length?a[0]:a.map(t=>t.trim()).filter(t=>""!==t).join(" ")}function S(t,e,n,r){let o=0,i=null,a=null,s=null;return{bullet:!1,chars:t.map((t,c)=>{const u=r?t.href:null;return i=null===u?null:i&&i.href===u?i:l(++o,"link",u),a=e?.[c]?a??l(++o,"bold"):null,s=n?.[c]?s??l(++o,"italic"):null,{ch:t.ch,at:-1,marks:[i,a,s].filter(t=>null!==t)}})}}var A="application/x-efficient-markup",E=/^([0-9]{1,3})\. $/;function B(t,e){const n=t.split("\n"),l=r(t,e);let o=0,i=0;const a=l.map((t,e)=>{const r=!t.bullet&&null==t.number&&"- "===n[e],l=null!=t.number||t.bullet?null:E.exec(n[e]),a=t.bullet||r,s=l?l[1]:t.number??null,c=r||l?[]:t.chars,u=c.map(t=>t.ch).join(""),d=null!=s?s.length+2:a?2:0,f={bullet:a,number:s,chars:c,start:o,src:o+d,vis:i,text:u};return o+=n[e].length+1,i+=u.length+1,f});return{lines:a,text:a.map(t=>t.text).join("\n")}}function W(t,e){const{lines:n}=t;for(let t=0;t<n.length;t+=1){const r=n[t];if(e<=r.vis+r.text.length||t===n.length-1)return[r,Math.max(0,Math.min(e-r.vis,r.text.length)),t]}return[n[0],0,0]}function R(t,e){const[n,r]=W(t,e);if(0===r)return n.src;let l=0;for(const t of n.chars){if(r<=l+t.ch.length)return t.at+(r-l);l+=t.ch.length}return n.src}function L(t,e){const[n,r]=W(t,e);let l=0;for(const t of n.chars){if(r===l)return t.at;l+=t.ch.length}return R(t,e)}function K(t,e){const{lines:n}=t;let r=n[0];for(const t of n)e>=t.start&&(r=t);let l=0;for(const t of r.chars){if(!(e>=t.at+t.ch.length)){e>t.at&&(l+=e-t.at);break}l+=t.ch.length}return r.vis+l}function P(t,e,n){return[K(t,e),K(t,n)]}function j(t,e,n){return e===n?[R(t,e),R(t,e)]:[L(t,e),R(t,n)]}function V(t,e){let n=0;for(let r=0;r<t.chars.length;r+=1){if(n>=e)return r;n+=t.chars[r].ch.length}return t.chars.length}function q(t,o,i,a,s){const c=B(t,o),[u,d,f]=W(c,Math.min(i,a)),[h,p,m]=W(c,Math.max(i,a)),g=V(u,d),b=V(h,p),v=u.chars.slice(0,g),k=h.chars.slice(b),y=i!==a&&u.chars[g]&&(f!==m||g<b)?u.chars[g].marks:function(t,e){const n=t.chars[e-1],r=t.chars[e],l=(t,e)=>{const n=t.findIndex(t=>"link"===t.kind);return-1===n||e?t:t.slice(0,n)};if(n){const t=n.marks.find(t=>"link"===t.kind),e=Boolean(t&&r?.marks.some(e=>e.id===t.id));return l(n.marks,e)}return r?l(r.marks,!1):[]}(u,g);let x=(w=c.lines,Math.max(0,...w.flatMap(t=>t.chars.flatMap(t=>t.marks.map(t=>t.id))))+1);var w;const D=t=>{let e;if(void 0!==s.markup){const t=x;e=r(s.markup,o).map(e=>({bullet:e.bullet,number:e.number??null,chars:e.chars.map(e=>({...e,at:-1,marks:e.marks.map(e=>({...e,id:e.id+t}))}))}))}else{let n=u.number??null;e=(s.text??"").split("\n").map((e,r)=>(r>0&&null!=n&&(n=function(t){return String(Number(t)+1).padStart(t.length,"0")}(n)),{bullet:u.bullet,number:n,chars:[...e].map(e=>({ch:e,at:-1,marks:t??[]}))}))}const n=e.map(t=>t.chars.map(t=>t.ch).join("")).join("\n"),l={bullet:u.bullet,number:u.number??null,chars:[...v,...e[0].chars]},i=e.slice(1);if(i.length>0){const t=i[i.length-1];i[i.length-1]={...t,chars:[...t.chars,...k]}}else l.chars.push(...k);return{lines:[...c.lines.slice(0,f).map(({bullet:t,number:e,chars:n})=>({bullet:t,number:e,chars:n})),l,...i,...c.lines.slice(m+1).map(({bullet:t,number:e,chars:n})=>({bullet:t,number:e,chars:n}))],shown:n}},N=void 0!==s.markup?[null]:[(t=>{let e=t.filter(t=>!s.drop?.some(e=>t.kind===e||"highlight"===e&&"accent"===t.kind));for(const t of s.add??[]){if(e.some(e=>e.kind===t))continue;const n=l(x++,t);n&&(e=[...e,n])}if(void 0!==s.color){e=e.filter(t=>"color"!==t.kind);const t=null===s.color?null:l(x++,"color",s.color);t&&(e=[...e,t])}return e})(y),y,[]];let T="",M="";for(const t of N){const r=D(t),l=e(r.lines).text;if(T=l,M=r.shown,n(r.lines,B(l,o).lines))break}return{text:T,caret:Math.min(i,a)+M.length}}function F(t,e,n,r){const l=B(t,e),[o,,i]=W(l,n);return n!==r||!o.bullet&&null==o.number||""!==o.text?q(t,e,n,r,{text:"\n"}):O(t,e,i,!1,n)}function O(t,n,r,l,o){const i=B(t,n).lines.map(({bullet:t,number:e,chars:n},o)=>o===r?{bullet:l,number:null,chars:n}:{bullet:t,number:e,chars:n});return{text:e(i).text,caret:o}}function I(t,n,r,l){const o=B(t,n),[i,a,s]=W(o,Math.min(r,l)),[c,u,d]=W(o,Math.max(r,l)),f=o.lines.slice(s,d+1).map(({bullet:t,number:e,chars:n},r)=>{const l=0===r?V(i,a):0,o=r===d-s?V(c,u):n.length;return{bullet:t,number:e,chars:n.slice(l,o)}});return e(f).text}function z(t,e,n){if(n<0){const n=t.charCodeAt(e-1);return e-(n>=56320&&n<=57343&&e>=2?2:1)}const r=t.charCodeAt(e);return e+(r>=55296&&r<=56319?2:1)}function U(t){const{value:e,rules:n,multiline:r,inputType:l,pending:o}=t;let[i,a]=t.sel;t.target&&t.target[0]!==t.target[1]&&l.startsWith("delete")&&([i,a]=t.target);const s=[i,a];if("historyUndo"===l||"historyRedo"===l)return{kind:"history",dir:"historyUndo"===l?"undo":"redo"};if("formatBold"===l||"formatItalic"===l||"formatStrikeThrough"===l)return{kind:"format",style:"formatBold"===l?"bold":"formatItalic"===l?"italic":"strike"};if("insertParagraph"===l||"insertLineBreak"===l)return r?{kind:"edit",edit:F(e,n,i,a),range:s}:null;if(l.startsWith("insert")){if("insertTranspose"===l)return null;let c=t.data??"";if("insertFromDrop"===l||"insertFromPaste"===l){const l=C({html:t.html??void 0,text:c},{doc:t.doc,multiline:r,rules:n});return{kind:"edit",edit:q(e,n,i,a,{markup:l}),range:s}}return r||(c=c.replace(/\s*\r?\n\s*/g," ")),{kind:"type",edit:q(e,n,i,a,{text:c,add:o?.add,drop:o?.drop,color:o?.color}),range:s}}if(l.startsWith("delete")){const t=B(e,n),r=t.text;if(i===a){const o=l.includes("Backward"),c=t.lines.findIndex(t=>i>=t.vis&&i<=t.vis+t.text.length),u=t.lines[c];if(o&&u&&i===u.vis&&(u.bullet||null!=u.number))return{kind:"edit",edit:O(e,n,c,!1,i),range:s};if(o?0===i:i===r.length)return null;o?i=z(r,i,-1):a=z(r,a,1)}return{kind:"type",edit:q(e,n,i,a,{text:""}),range:[i,a]}}return null}var $=1e3;function H(t=200){let e=[],n=[],r=null,l=0;return{record(o,i,a){const s="type"===i&&"type"===r&&a-l<1e3;r=i,l=a,n=[],s||(e.push(o),e.length>t&&e.shift())},undo(t){const l=e.pop();return l?(n.push(t),r=null,l):null},redo(t){const l=n.pop();return l?(e.push(t),r=null,l):null},reset(){e=[],n=[],r=null}}}var X=t=>t.preventDefault();function Y(t,e,n){const r=n?n(t):t;return e?.find(t=>t.name===r)}function Z(t,e,n){if(t)return t.startsWith("#")?t:Y(t,e,n)?.value}function G({colors:t,current:e,nameOf:n,words:r,onPick:l}){const o=null===e||e.startsWith("#")?void 0:Y(e,t,n),i=null===e?null:e.startsWith("#")?e.toLowerCase():o?.value.toLowerCase()??null;/* @__PURE__ */
|
|
2
|
+
return w("div",{className:"es-copy-pop es-copy-colors",role:"dialog","aria-label":r.title,onMouseDown:t=>{"INPUT"!==t.target.tagName&&t.preventDefault()},children:[
|
|
3
|
+
/* @__PURE__ */D("span",{className:"es-copy-pop-label",children:r.theme}),
|
|
4
|
+
/* @__PURE__ */D("div",{className:"es-copy-theme",role:"group","aria-label":r.theme,children:t.map(t=>/* @__PURE__ */D(v,{content:`${t.label} · ${t.value.toUpperCase()}`,children:/* @__PURE__ */D(k,{color:t.value,size:"sm",className:"es-copy-theme-swatch","data-color":t.name,"aria-label":t.label,selected:o?o.name===t.name:e===t.name,onMouseDown:X,onClick:()=>l(t.name)})},t.name))}),
|
|
5
|
+
/* @__PURE__ */D("span",{className:"es-copy-pop-label",children:r.any}),
|
|
6
|
+
/* @__PURE__ */D(y,{className:"es-copy-any",value:i??"",onChange:t=>{t!==e&&l(t)},label:r.title,dragWrites:"end"}),
|
|
7
|
+
/* @__PURE__ */D("div",{className:"es-copy-pop-foot",children:/* @__PURE__ */D(x,{variant:"ghost-danger",size:"sm","data-window-action":"remove",onMouseDown:X,onClick:()=>l(null),children:r.remove})})]})}var J={sup:"sub",sub:"sup"};function Q(t){const{value:e,rules:n,start:r,end:l,style:a,pending:s}=t,c=J[a];if(r===l){const t=o(e,r,l,n),i=s&&s.at===r?s:null,u=t.has(a),d=!!i?.add.includes(a)||!i?.drop.includes(a)&&u;let f=(i?.add??[]).filter(t=>t!==a),h=(i?.drop??[]).filter(t=>t!==a);return d&&u?h.push(a):d||u||f.push(a),!d&&c&&(f=f.filter(t=>t!==c),t.has(c)&&(h=[...h.filter(t=>t!==c),c])),{kind:"pending",pending:f.length||h.length||void 0!==i?.color?{add:f,drop:h,color:i?.color,at:r}:null}}let u=e,d=r,f=l;if(c&&!o(u,d,f,n).has(a)&&o(u,d,f,n).has(c)){const t=i(u,d,f,c,n);({text:u,selectionStart:d,selectionEnd:f}=t)}return{kind:"edit",result:i(u,d,f,a,n)}}function _(t){if(null!==t.id&&a(t.value,t.start,t.end,t.rules)===t.id)return null;const e=s(t.value,t.start,t.end,t.id,t.rules);return e.text===t.value?null:e}var tt=/^(block|list-item|flex|grid|table|flow-root)$/;function et(t){const e=t.ownerDocument.defaultView;return!!e&&tt.test(e.getComputedStyle(t).display)}function nt(t,e){const n=[],r=/* @__PURE__ */new Map,l=/* @__PURE__ */new Map;let o="",i=!1;const a=()=>{i&&(o+="\n",i=!1)},s=t=>{for(const c of Array.from(t.childNodes)){if(3===c.nodeType){c.data.length>0&&a(),r.set(c,o.length),n.push({node:c,start:o.length,length:c.data.length}),o+=c.data,l.set(c,o.length);continue}if(1!==c.nodeType)continue;const t=c;if(e&&t.matches(e)){r.set(t,o.length),l.set(t,o.length);continue}if("BR"===t.tagName){a(),r.set(t,o.length),o+="\n",l.set(t,o.length);continue}const u=et(t);u&&((i||o.length>0&&!o.endsWith("\n"))&&(o+="\n"),i=!1),r.set(t,o.length);const d=o.length;s(t),u&&o.length===d&&!i&&n.push({node:t,start:d,length:0}),l.set(t,o.length),u&&(i=!0)}};r.set(t,0),s(t),l.set(t,o.length);return{text:o,at:(t,e)=>{if(3===t.nodeType)return(r.get(t)??0)+Math.min(e,t.data.length);const n=t.childNodes;return e<n.length?r.get(n[e])??l.get(t)??0:l.get(t)??o.length},dom:e=>{for(let t=0;t<n.length;t+=1){const r=n[t],l=r.start+r.length;if(e<r.start)return[r.node,0];if(e<l||e===l&&(t===n.length-1||n[t+1].start>e))return 3===r.node.nodeType?[r.node,e-r.start]:[r.node,0]}const r=n[n.length-1];return r?3===r.node.nodeType?[r.node,r.length]:[r.node,0]:[t,0]}}}function rt(t){const e=t.element();if(!e)return null;let n=t.value;const r=t.rules;if(nt(e,t.skip).text!==B(n,r).text)return null;const l=t.now??(()=>Date.now()),i=H();let s=e,b=!1,v=null,k=null,y=[t.caret[0],t.caret[1]],x=null,w=!1,D=!1;const T=()=>{D||t.onSelect?.()},M={contenteditable:e.getAttribute("contenteditable"),spellcheck:e.getAttribute("spellcheck")},S=()=>s.ownerDocument,E=()=>S().defaultView?.getSelection()??null,W=()=>{if(!k)return!0;ct();const e=nt(s,t.skip);if(e.text!==B(n,r).text)return!1;const[l,o]=k,[i,a]=e.dom(l),[c,u]=e.dom(o);return w||S().activeElement===s||s.focus({preventScroll:!0}),E()?.setBaseAndExtent(i,a,c,u),y=k,R=k,k=null,T(),!0};let R=null;const L=()=>{if(!R)return!1;const t=E(),e=t?.anchorNode??null;return!(e&&e.isConnected&&s.contains(e))||e===s&&0===t.anchorOffset&&(0!==R[0]||0!==R[1])},K=()=>{k=R,W()},V=()=>{W(),S().activeElement===s&&L()&&K();const e=E();if(!(e&&e.anchorNode&&e.focusNode&&s.contains(e.anchorNode)&&s.contains(e.focusNode)))return y;const n=nt(s,t.skip),r=n.at(e.anchorNode,e.anchorOffset),l=n.at(e.focusNode,e.focusOffset);return y=r<=l?[r,l]:[l,r],y},F=t=>{const e=S().defaultView;t<=0||!e?R=null:e.requestAnimationFrame(()=>{b||k||(ct(),S().activeElement===s?(L()&&(K(),T()),F(t-1)):R=null)})},O=(t,e)=>{k=[t,e];const n=t=>{if(b)return;if(W())return void F(3);const e=S().defaultView;t>0&&e&&e.requestAnimationFrame(()=>n(t-1))};n(30)},z=(e,r,o)=>{e.text!==n?(i.record({text:n,start:r[0],end:r[1]},o,l()),n=e.text,t.write(n),O(e.caret,e.caret),T()):O(e.caret,e.caret)},$=t=>j(B(n,r),t[0],t[1]),X=(t,e)=>{const l=N({start:t,end:e},n.length);return g(n,l.start,l.end,r)},Y=(e,o)=>{if(e.text===n)return;i.record({text:n,start:o[0],end:o[1]},"edit",l()),n=e.text,t.write(n);const[a,s]=P(B(n,r),e.selectionStart,e.selectionEnd);O(a,s),T()},Z=t=>{if(b)return;const e=V(),[l,o]=$(e),i=Q({value:n,rules:r,start:l,end:o,style:t,pending:x});if("pending"===i.kind)return x=i.pending,void T();Y(i.result,e)},G=e=>{n=e.text,t.write(n),O(e.start,e.end)},J=e=>{if(b)return;b=!0,ut.removeEventListener("selectionchange",dt),v&&tt&&t.editable&&!t.editable()&&(et(tt),tt=null,v=null,ot()),st(s);const n=E();n&&n.rangeCount>0&&s.contains(n.anchorNode)&&s.contains(n.focusNode)&&n.removeAllRanges(),t.end(e)};let tt=null;const et=t=>{const e=new Set(t.map(([t])=>t)),n=s.ownerDocument.createTreeWalker(s,4),r=[];for(let t=n.nextNode();t;t=n.nextNode())e.has(t)||r.push(t);for(const t of r)t.parentNode?.removeChild(t);for(const[e,n]of t)e.data!==n&&(e.data=n)},rt=(t,e)=>{const l=V();!b&&l[0]!==l[1]&&t.clipboardData&&(t.preventDefault(),t.clipboardData.setData("text/plain",B(n,r).text.slice(l[0],l[1])),t.clipboardData.setData(A,I(n,r,l[0],l[1])),e&&z(q(n,r,l[0],l[1],{text:""}),l,"edit"))},lt=t=>t.preventDefault(),ot=()=>{t.remount?.()},it=[["keydown",e=>{if(b||e.isComposing)return;const r=e.metaKey||e.ctrlKey;if("Escape"!==e.key){if(r&&!e.altKey&&!e.shiftKey&&("k"===e.key||"K"===e.key)&&t.onLinkKey?.())return e.preventDefault(),void e.stopPropagation();if(r&&!e.altKey&&!e.shiftKey&&("KeyA"===e.code||"a"===e.key||"A"===e.key))return e.preventDefault(),e.stopPropagation(),O(0,nt(s,t.skip).text.length),void T();if("Enter"===e.key&&(!e.shiftKey||r))return e.preventDefault(),e.stopPropagation(),void J("enter");if(r&&("z"===e.key||"Z"===e.key||"y"===e.key)){e.preventDefault(),e.stopPropagation();const t=V(),r={text:n,start:t[0],end:t[1]},l="y"===e.key||e.shiftKey?i.redo(r):i.undo(r);l&&G(l)}}else{if(e.preventDefault(),e.stopPropagation(),t.onEscape?.())return;J("escape")}}],["beforeinput",e=>{if(b)return;if("insertCompositionText"===e.inputType)return;e.preventDefault();const l=V(),o=nt(s,t.skip),a="function"==typeof e.getTargetRanges?e.getTargetRanges()[0]:void 0,c=a&&!a.collapsed?[o.at(a.startContainer,a.startOffset),o.at(a.endContainer,a.endOffset)]:null,u=U({value:n,rules:r,multiline:t.multiline,inputType:e.inputType,data:e.data??e.dataTransfer?.getData("text/plain")??"",html:e.dataTransfer?.getData("text/html"),doc:S(),sel:l,target:c,pending:x&&x.at===$(l)[0]?x:null});if(u){if("type"!==u.kind&&"edit"!==u.kind||(x=null),"history"===u.kind){const t={text:n,start:l[0],end:l[1]},e="undo"===u.dir?i.undo(t):i.redo(t);return void(e&&G(e))}"format"!==u.kind?z(u.edit,u.range,u.kind):Z(u.style)}}],["compositionstart",()=>{v=V(),tt=(()=>{const t=[],e=s.ownerDocument.createTreeWalker(s,4);for(let n=e.nextNode();n;n=e.nextNode())t.push([n,n.data]);return t})()}],["compositionend",e=>{const o=v;if(v=null,!b&&o){if(t.editable&&!t.editable())return tt&&et(tt),tt=null,void ot();if(tt=null,e.data){const a=q(n,r,o[0],o[1],{text:e.data});i.record({text:n,start:o[0],end:o[1]},"type",l()),n=a.text,t.write(n),ot(),O(a.caret,a.caret)}else ot(),O(o[0],o[0])}}],["paste",e=>{if(b)return;e.preventDefault();const l=V(),o=e.clipboardData,i=o?.getData(A)??"",a=i?t.multiline?i:i.replace(/\s*\r?\n\s*/g," "):C({html:o?.getData("text/html")??"",text:o?.getData("text/plain")??""},{doc:S(),multiline:t.multiline,rules:r});z(q(n,r,l[0],l[1],{markup:a}),l,"edit")}],["copy",t=>rt(t,!1)],["cut",t=>rt(t,!0)],["drop",lt],["dragstart",lt],["blur",e=>{if(b||null!==v||w)return;const n=e.target,r=n.ownerDocument.defaultView,l=()=>{b||(n.isConnected&&n===t.element()?w||n.ownerDocument.activeElement===n||J("blur"):O(y[0],y[1]))};r?.requestAnimationFrame?r.requestAnimationFrame(l):setTimeout(l,0)}],["focus",()=>{w=!1}]];function at(t){t.setAttribute("contenteditable","true"),t.setAttribute("spellcheck","false"),t.setAttribute("data-es-typing","");for(const[e,n]of it)t.addEventListener(e,n)}function st(t){for(const[e,n]of it)t.removeEventListener(e,n);null===M.contenteditable?t.removeAttribute("contenteditable"):t.setAttribute("contenteditable",M.contenteditable),null===M.spellcheck?t.removeAttribute("spellcheck"):t.setAttribute("spellcheck",M.spellcheck),t.removeAttribute("data-es-typing")}function ct(){const e=t.element();e&&e!==s&&(st(s),s=e,at(s))}const ut=s.ownerDocument;function dt(){b||T()}return ut.addEventListener("selectionchange",dt),at(s),s.focus({preventScroll:!0}),O(t.caret[0],t.caret[1]),{get value(){return n},update(t){if(t===n)return;const e=B(t,r).text.length,[l,o]=V();n=t,i.reset(),O(Math.min(l,e),Math.min(o,e))},stop(t="stop"){J(t)},pressed(){let t;D=!0;try{t=V()}finally{D=!1}const[e,l]=$(t),i=o(n,e,l,r),s={};for(const t of["bold","italic","underline","strike","sup","sub","link"]){const n=i.has(t),r=x&&x.at===e?x:null;s[t]=!!r?.add.includes(t)||!r?.drop.includes(t)&&n}const u=x&&x.at===e&&void 0!==x.color?x:null;return{marks:s,list:c(n,e,l,r),selected:l>e,href:m(n,e,l)?.href??null,color:u?u.color??null:p(n,e,l,r),style:l>e?a(n,e,l,r):null,clearable:X(e,l).text!==n}},press:Z,insert(t){if(b)return;w=!1;const e=V(),[r,l]=$(e),o=r+t.length;Y({text:n.slice(0,r)+t+n.slice(l),selectionStart:o,selectionEnd:o},e),ct(),s.focus({preventScroll:!0})},hold(){b||(V(),w=!0)},release(){w=!1},resume(){b||(w=!1,ct(),s.focus({preventScroll:!0}),O(y[0],y[1]))},link(t){if(b)return;w=!1;const e=V(),[l,o]=$(e),i=null===t?f(n,l,o,r):h(n,l,o,t,r),a=i.text===n;Y(i,e),ct(),s.focus({preventScroll:!0}),a&&O(e[0],e[1])},color(t){if(b)return;const e=V(),[l,o]=$(e);if(l===o){const e=x&&x.at===l?x:null;return x={add:e?.add??[],drop:e?.drop??[],color:t,at:l},void T()}Y(d(n,l,o,t,r),e)},textStyle(t){if(b)return;w=!1;const e=V(),[l,o]=$(e),i=_({value:n,start:l,end:o,id:t,rules:r});i&&Y(i,e),ct(),s.focus({preventScroll:!0}),i||O(e[0],e[1])},clear(){if(b)return;const t=V(),[e,n]=$(t);Y(X(e,n),t)},list(e){if(b||!t.multiline)return;const l=V(),[o,i]=$(l),a=c(n,o,i,r);Y(u(n,o,i,a===e?null:e,r),l)}}}var lt=(t,e,n)=>Math.min(Math.max(t,e),Math.max(e,n));function ot({anchor:t,size:e,within:n,clip:r,parent:l,gap:o=8}){const i=Math.max(n.left,r.left),a=Math.min(n.right,r.right)-e.width,s=lt(t.left,i,a),c=r.bottom-(t.bottom+o),u=t.top-o-r.top,d=e.height>c&&(e.height<=u||u>c),f=d?t.top-o-e.height:t.bottom+o,h=t.left+Math.min((t.right-t.left)/2,10),p=lt(h-5-s,10,e.width-10-10);return{top:f-l.top,left:s-l.left,above:d,point:p}}var it=t=>({left:t.left,top:t.top,right:t.right,bottom:t.bottom});function at(t,e){const n=("function"==typeof t.getClientRects?[...t.getClientRects()]:[]).filter(t=>t.height>0);if(n.length>0){const e="function"==typeof t.getBoundingClientRect?t.getBoundingClientRect():n[0];return e.height>0?it(e):it(n[0])}if(!e)return null;const r=e.getBoundingClientRect();return{left:r.left,top:r.top,right:r.left,bottom:r.bottom}}function st(t){const e=t.ownerDocument,n=e.documentElement,r={left:0,top:0,right:n.clientWidth,bottom:n.clientHeight},l=e.defaultView?.getComputedStyle.bind(e.defaultView);for(let o=t.parentElement;o&&o!==n&&o!==e.body;o=o.parentElement){const t=l?.(o);if(!t||"visible"===t.overflowX&&"visible"===t.overflowY)continue;const e=o.getBoundingClientRect();if(0===e.width&&0===e.height)continue;const n=e.left+o.clientLeft,i=e.top+o.clientTop;r.left=Math.max(r.left,n),r.top=Math.max(r.top,i),r.right=Math.min(r.right,n+(o.clientWidth||e.width)),r.bottom=Math.min(r.bottom,i+(o.clientHeight||e.height))}return r}function ct(t){const e=t.offsetParent??t.parentElement;if(!e)return{left:0,top:0};const n=e.getBoundingClientRect();return{left:n.left+e.clientLeft-e.scrollLeft,top:n.top+e.clientTop-e.scrollTop}}function ut(t,e,n){const r=t.ownerDocument,l=r.createTreeWalker(t,4),o=t=>{let e=t,n=null;for(let t=l.nextNode();t;t=l.nextNode()){if(e<=t.data.length)return[t,e];e-=t.data.length,n=t}return n?[n,n.data.length]:null},i=o(e);l.currentNode=t;const a=o(n);if(!i||!a)return null;const s=r.createRange();return s.setStart(i[0],i[1]),s.setEnd(a[0],a[1]),s}export{G as ColorWindow,A as MARKUP_CLIPBOARD_TYPE,$ as TYPING_BURST_MS,N as clearRangeOf,Z as colorRunOf,H as createHistory,q as editVisible,Q as markPress,I as markupOfRange,F as newLine,ct as offsetOrigin,C as pasteToMarkup,ot as placeWindow,U as richInput,B as richLayout,at as selectionBox,j as selectionToSource,P as selectionToVisible,O as setBullet,rt as startCanvasTyping,_ as styleChange,nt as textMap,ut as textRange,R as toSource,L as toSourceStart,K as toVisible,st as visibleArea};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{buildPaletteSections as e,pinnedSection as t,categoryLabel as n}from"./chunk-GDO4QJ4G.js";import{blockTypesIn as o}from"./chunk-IZGFJWH4.js";import{sectionTemplatesOf as r}from"./chunk-N7E6264U.js";import{sharedSectionsOf as l}from"./chunk-N3MJOHAG.js";import{SidePanelHead as i,PanelModeExit as s}from"./chunk-MTWQYLJE.js";import{blockRuns as c}from"./chunk-RUQOIQWI.js";import{useScreenBlockLook as a,useScreenBlockRules as p,useScreenPinned as d}from"./chunk-BDYS3UAD.js";import{useEaselSession as m}from"./chunk-YM4UEGBV.js";import{DEFAULT_SCREEN_WORDS as f}from"./chunk-G2VZ4DET.js";import{useEasel as y}from"./chunk-NMLAW6FI.js";import{easelMenuEntries as u}from"./chunk-FIVU2COQ.js";import{useWords as h}from"./chunk-MFIRYGHW.js";import{AddPanel as k}from"./chunk-SEC6NV6Y.js";import{DEFAULT_DRAG_WORDS as g}from"./chunk-TQ5Y6S2X.js";import{useState as b,useEffect as v,useMemo as j,useRef as w}from"react";import{SharedIcon as C,AddIcon as E}from"efficient-shell/icons/efficient";import{ContextMenu as I,toast as O,Dialog as $,Button as F}from"efficient-shell/ui";import{jsx as M,jsxs as T,Fragment as x}from"react/jsx-runtime";function D({name:e,pages:t,onDelete:n,onCancel:o}){const r=h("screen",f).shared,[l,i]=b(!1),s=w(null);/* @__PURE__ */
|
|
2
|
+
return M($,{open:!0,role:"alertdialog",size:"sm",title:r.deleteTitle({name:e}),onClose:o,initialFocus:s,footer:/* @__PURE__ */T(x,{children:[
|
|
3
|
+
/* @__PURE__ */M(F,{ref:s,variant:"secondary",onClick:o,children:r.cancel}),
|
|
4
|
+
/* @__PURE__ */M(F,{variant:"danger",loading:l,onClick:()=>{(async()=>{i(!0);try{await n()}finally{i(!1)}})()},children:r.deleteShared})]}),children:r.deleteMessage({count:t})})}var G=e=>`section:${e}`,N=e=>`block:${e}`,S=e=>`template:${e}`,W=e=>`shared:${e}`,A=e=>`preset:${e}`;function L({at:w,placeBlocks:$,placeNames:F,canTake:L,onPick:Q,itemFor:Y,session:B,siteWide:H,onClose:U,onHide:z,readOnly:J}){const V=y(e=>e.config),R=a(),{labelAtLevel:P,categoryLabel:Z,firstSection:_,Icon:X,Thumbnail:q}=R,{blockIsOffered:K,canAddTo:ee}=p(),te=h("screen",f).add,ne=h("drag",g).add,oe=m(),[re,le]=b([]);v(()=>{let e=!1;const t=e=>K(e,oe);return r(oe).list().then(n=>{if(e)return;const r=V.components;le(n.filter(e=>e.node?.type&&r[e.node.type]&&o(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[V,oe]);const ie=d().shared,se=h("screen",f).shared,[ce,ae]=b([]),[pe,de]=b(0);v(()=>{if(!ie)return;let e=!1;const t=e=>K(e,oe);return l(oe).list().then(n=>{if(e)return;const r=V.components;ae(n.filter(e=>e.node?.type&&r[e.node.type]&&o(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[V,oe,pe]);const[me,fe]=b(null),[ye,ue]=b(null),he=j(()=>e(V,R),[V]),ke=e=>P(e,"section",V.components[e]?.label??e),ge=e=>({type:e.preset?A(e.preset.key):G(e.type),label:e.name,cover:/* @__PURE__ */M(q,{type:e.type}),title:e.desc?`${e.name} — ${e.desc}`:te.tile({name:e.name}),keywords:[e.alias??"",e.desc,e.type,e.catLabel].filter(Boolean)}),be=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=re.find(e=>e.id===o);return e?{kind:"template",template:e}:null}if("shared"===n){const e=ce.find(e=>e.id===o);return e?{kind:"shared",section:e}:null}if("preset"===n){const e=he.find(e=>e.preset?.key===o)?.preset;return e?{kind:"preset",preset:e}:null}return null},ve=e=>/* @__PURE__ */M("span",{className:"es-add-glyph-cover",children:/* @__PURE__ */M(X,{type:e,size:26})}),je=j(()=>{const e=t(he,_),o=/* @__PURE__ */new Map,r=e=>{e.retired||o.has(e.type)||!K(e.type,oe)||o.set(e.type,e)};for(const t of e?[e]:he.filter(e=>!e.preset)){const e=ee(t.type)?.choices??[];e.forEach(r),e.forEach(e=>ee(e.type,1)?.choices?.forEach(r))}$?.forEach(r);const l=new Set(he.filter(e=>!e.preset).map(e=>e.type)),i=[...o.values()].filter(e=>!l.has(e.type)),s=(e,t,n)=>{const o=F?.get(t);return o&&o!==n?{...e,label:o,title:te.tile({name:o}),keywords:[n,...e.keywords??[]]}:e},a=e=>s({type:N(e.type),label:e.label,cover:ve(e.type),title:te.tile({name:e.label}),keywords:[e.group??"",e.type].filter(Boolean)},e.type,e.label),p=e=>!e.preset&&o.has(e.type)?s({...ge(e),cover:ve(e.type)},e.type,e.name):ge(e),d=[];ce.length>0&&d.push({key:"shared",title:se.group,tiles:ce.map(e=>({type:W(e.id),label:e.title,cover:/* @__PURE__ */M(q,{type:e.node.type}),mark:/* @__PURE__ */M(C,{size:12}),title:se.onPages({count:e.used_on.length}),keywords:[ke(e.node.type),e.node.type]}))}),re.length>0&&d.push({key:"templates",title:te.templates,tiles:re.map(e=>({type:S(e.id),label:e.name,cover:/* @__PURE__ */M(q,{type:e.node.type}),keywords:[ke(e.node.type),e.node.type]}))});const m=i.filter(e=>!e.group);let f=!1;for(const t of Object.keys(V.categories??{})){const o=he.filter(e=>e.cat===t);if(0===o.length)continue;const r=e&&o.some(t=>t.type===e.type)?e:null,l=(r?[r,...o.filter(e=>e.type!==r.type)]:o).map(p);r&&!f&&(l.splice(1,0,...m.map(a)),f=!0),d.push({key:`category:${t}`,title:n(V,t,Z),tiles:l})}const y=d.find(e=>e.key?.startsWith("category:"));if(!f&&y&&m.length>0&&(y.tiles=[...y.tiles,...m.map(a)],f=!0),c(i.filter(e=>e.group||!f)).forEach((e,t)=>{d.push({key:`blocks:${t}`,title:e.group??"",tiles:e.items.map(a)})}),!L)return d;const u=d.map(e=>({...e,tiles:e.tiles.map(e=>{const t=be(e.type),n=t?L(t):null;return n?{...e,disabled:!0,disabledReason:n}:e})})),h=e=>e.tiles.some(e=>!e.disabled);return[...u.filter(h),...u.filter(e=>!h(e))]},[re,ce,se,he,V,te,L,$,F,oe]);/* @__PURE__ */
|
|
5
|
+
return T(x,{children:[
|
|
6
|
+
/* @__PURE__ */M(i,{icon:/* @__PURE__ */M(E,{size:15}),title:te.title,context:te.contextAll,actions:/* @__PURE__ */M(s,{label:te.done,description:te.doneDescription,onClick:U}),onHide:z}),
|
|
7
|
+
/* @__PURE__ */T("div",{className:"sf-addside sf-scroll",children:[
|
|
8
|
+
/* @__PURE__ */M(k,{groups:je,session:B,itemFor:e=>Y(be(e)??{kind:"section",type:e}),onInsert:Q?e=>{const t=be(e);t&&Q(t)}:void 0,onTileMenu:(e,t)=>{const n=be(e);return"shared"===n?.kind&&!J&&(fe({section:n.section,...t}),!0)},at:w,hint:te.hint,searchLabel:te.search,readOnly:J,words:ne}),H??null]}),me?/* @__PURE__ */M(I,{at:{x:me.x,y:me.y},owner:me.owner,onClose:()=>fe(null),"aria-label":me.section.title,items:u([{label:se.deleteShared,danger:!0,onClick:()=>{ue(me.section),fe(null)}}])}):null,ye?/* @__PURE__ */M(D,{name:ye.title,pages:ye.used_on.length,onDelete:()=>(async e=>{try{await l(oe).remove(e.id)}catch{return void O.error(se.deleteFailed)}ue(null),ie?.removed?.(e),ae(t=>t.filter(t=>t.id!==e.id)),de(e=>e+1)})(ye),onCancel:()=>ue(null)}):null]})}export{L as AddSidePanel,N as blockKey,A as presetKey,G as sectionKey,W as sharedKey,S as templateKey};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{blockRuns as e,offeredChoices as s}from"./chunk-RUQOIQWI.js";import{useScreenBlockLook as t}from"./chunk-
|
|
1
|
+
import{blockRuns as e,offeredChoices as s}from"./chunk-RUQOIQWI.js";import{useScreenBlockLook as t}from"./chunk-BDYS3UAD.js";import{DEFAULT_SCREEN_WORDS as l}from"./chunk-G2VZ4DET.js";import{useWords as r}from"./chunk-MFIRYGHW.js";import{ItemCount as n,DropdownMenu as c}from"efficient-shell/ui";import{jsxs as a,jsx as o,Fragment as i}from"react/jsx-runtime";function m({choices:m,onPick:p}){const{Icon:u}=t(),f=r("screen",l),h=e(s(m)).flatMap(e=>[...e.group?[{type:"label",key:`group:${e.group}`,label:/* @__PURE__ */a("span",{className:"flex w-full items-center gap-2",children:[
|
|
2
2
|
/* @__PURE__ */o("span",{children:e.group}),
|
|
3
3
|
/* @__PURE__ */o(n,{count:e.items.length,label:f.blockCount({count:e.items.length}),className:"ml-auto"})]})}]:[],...e.items.map(e=>({key:e.type,label:e.label,icon:/* @__PURE__ */o("span",{className:"sf-chip",children:/* @__PURE__ */o(u,{type:e.type,size:13})}),onSelect:()=>p(e.type)}))]);/* @__PURE__ */
|
|
4
4
|
return o(c,{align:"start",triggerClassName:"sf-add-card",items:h,trigger:/* @__PURE__ */a(i,{children:[
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useScreenBlockRules as e}from"./chunk-BDYS3UAD.js";import{newNodeId as t,ROOT_ZONE as o}from"./chunk-TCAAOYQY.js";import{useEasel as n,useEaselApi as r}from"./chunk-NMLAW6FI.js";import{useMemo as s}from"react";function i(i={}){const{dispatch:p}=n(e=>e),d=r(),c=!0===i.readOnly,a=e().resolveOnInsert,l=!0===(i.resolveOnInsert??a),m=!0===i.foldIntoHistory;return s(()=>{const e=m?e=>p({...e,recordHistory:!1}):p,n=(o,n,r)=>{const s=t(n);return c||e({type:"insert",componentType:n,destinationZone:o,destinationIndex:r,id:s}),s},r=(e,t="insert")=>(l&&!c&&d.resolveNode(e,{trigger:t}),e),s=(t,o,n)=>{c||e({type:"replace",destinationZone:t,destinationIndex:o,data:n})},i=(e,t,o)=>r(n(e,t,o));return{insertComponent:i,insertSection:(e,t)=>i(o,e,t),replaceComponent:s,seedChild:(e,t,o,i)=>{const p=n(e,o,t);s(e,t,{type:o,props:{id:p,...i}}),r(p)},insertNode:(e,t,o,i)=>{const p=n(e,o.type,t);return s(e,t,{type:o.type,props:{...o.props,id:p}}),r(p,i?.copy?"copy":"insert")},removeComponent:(t,o)=>{c||e({type:"remove",index:o,zone:t})},reorderComponent:(t,o,n)=>{c||e({type:"reorder",sourceIndex:o,destinationIndex:n,destinationZone:t})},duplicateComponent:(t,o)=>{c||e({type:"duplicate",sourceIndex:o,sourceZone:t})},select:e=>p({type:"setUi",ui:{itemSelector:e}}),setDocument:t=>{c||e({type:"setData",data:t})},commitDocument:(t,o)=>{c||(m?d.batch(()=>{e({type:"setData",data:t}),void 0!==o&&("slot"===o?.kind?d.selectSlot({parentId:o.parentId,slot:o.slot}):d.select(o?o.id:null))}):d.run({data:t,select:o}))}}},[p,c,l,d,m])}export{i as useSectionOps};
|