efficient-easel 24.1.0 → 25.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +43 -2
- package/dist/{CanvasDragLayer-NZpaX6aq.d.ts → CanvasDragLayer-DXeQGrwJ.d.ts} +42 -3
- package/dist/canvas/index.d.ts +2 -139
- package/dist/canvas/index.js +1 -1
- package/dist/chrome/index.js +1 -1
- package/dist/{chunk-6NJHYXJM.js → chunk-3XECMGXX.js} +1 -1
- package/dist/chunk-4OMAA45Q.js +5 -0
- package/dist/{chunk-G67G63O5.js → chunk-4Y3TK65H.js} +1 -1
- package/dist/chunk-53ME3GAI.js +16 -0
- package/dist/{chunk-FRAIEWRC.js → chunk-62UGN7VM.js} +1 -1
- package/dist/{chunk-HNKB2ZYR.js → chunk-6ATIYLUL.js} +1 -1
- package/dist/{chunk-Y53EKN35.js → chunk-6EDVZBUO.js} +1 -1
- package/dist/chunk-7UFKEX72.js +1 -0
- package/dist/chunk-CEC5XLN4.js +1 -0
- package/dist/chunk-CWELHADJ.js +1 -0
- package/dist/chunk-DX3VILZ3.js +6 -0
- package/dist/chunk-ERB6FAZT.js +2 -0
- package/dist/{chunk-TGZCD6IP.js → chunk-EUFDQ4KL.js} +1 -1
- package/dist/chunk-FR7EEKFF.js +1 -0
- package/dist/{chunk-75C6WFNF.js → chunk-FYV6GZXP.js} +1 -1
- package/dist/chunk-GDO4QJ4G.js +1 -0
- package/dist/chunk-GEPSJJWW.js +1 -0
- package/dist/{chunk-GMCZXMOV.js → chunk-GR3XRILS.js} +1 -1
- package/dist/chunk-H6BER2EU.js +1 -0
- package/dist/chunk-JIP5JNRB.js +1 -0
- package/dist/{chunk-AGWKB77Q.js → chunk-K53PQAMP.js} +1 -1
- package/dist/{chunk-CLOS6SSX.js → chunk-KO47WAWR.js} +1 -1
- package/dist/chunk-KTV7ORWF.js +64 -0
- package/dist/chunk-LUG22U5L.js +1 -0
- package/dist/{chunk-DDH2DYQP.js → chunk-LUOY3A3Q.js} +1 -1
- package/dist/{chunk-OITNWE52.js → chunk-M4THI4OO.js} +1 -1
- package/dist/chunk-MBEUSPIN.js +18 -0
- package/dist/chunk-MIX7EGRG.js +2 -0
- package/dist/{chunk-2FYFAAAK.js → chunk-OXOUGEAT.js} +1 -1
- package/dist/chunk-PMRN5Z3T.js +1 -0
- package/dist/{chunk-55KKGABA.js → chunk-PVBDKBJB.js} +1 -1
- package/dist/{chunk-RPMSET77.js → chunk-QTHQPJWA.js} +1 -1
- package/dist/{chunk-ISS72IKO.js → chunk-QZJKWKGH.js} +1 -1
- package/dist/{chunk-IYHO4XQX.js → chunk-S6YOIRXQ.js} +1 -1
- package/dist/{chunk-5PXVT7JY.js → chunk-SBVIW3KJ.js} +1 -1
- package/dist/chunk-SC6E3UUS.js +13 -0
- package/dist/chunk-SSDKT4AY.js +9 -0
- package/dist/chunk-TOKMFZPB.js +1 -0
- package/dist/chunk-U3LTJSBU.js +20 -0
- package/dist/{chunk-WYTPBF3Q.js → chunk-VBEVZZTV.js} +11 -11
- package/dist/chunk-VIUES5R6.js +8 -0
- package/dist/{chunk-4ESG53BH.js → chunk-YFHKE54W.js} +1 -1
- package/dist/chunk-YYD257TD.js +1 -0
- package/dist/chunk-ZLOMH2PD.js +1 -0
- package/dist/{chunk-CE5SGCN2.js → chunk-ZYOQXBJF.js} +3 -3
- package/dist/copy/index.js +13 -13
- package/dist/copy-place-CQIemdtU.d.ts +25 -0
- package/dist/data/index.d.ts +4 -1
- package/dist/data/index.js +1 -1
- package/dist/dom-BpxMcHFP.d.ts +200 -0
- package/dist/drag/index.d.ts +2 -3
- package/dist/drag/index.js +1 -1
- package/dist/draw/index.d.ts +1 -1
- package/dist/draw/index.js +1 -1
- package/dist/easel/index.d.ts +67 -1
- package/dist/easel/index.js +1 -1
- package/dist/edit-lock/index.d.ts +0 -46
- package/dist/edit-lock/index.js +1 -1
- package/dist/fields/fields.css +6 -40
- package/dist/fields/index.d.ts +1 -6
- package/dist/fields/index.js +1 -1
- package/dist/node-ops/index.js +1 -1
- package/dist/page-copy/index.d.ts +110 -0
- package/dist/page-copy/index.js +5 -0
- package/dist/panel/index.d.ts +29 -34
- package/dist/panel/index.js +1 -1
- package/dist/panel/panel.css +0 -78
- package/dist/screen/components/AddBlockRow.js +1 -1
- package/dist/screen/components/AddSidePanel.d.ts +37 -57
- package/dist/screen/components/AddSidePanel.js +1 -1
- package/dist/screen/components/NodeContextMenu.d.ts +19 -11
- package/dist/screen/components/NodeContextMenu.js +1 -1
- package/dist/screen/components/PageEditGuardNotices.js +1 -1
- package/dist/screen/components/SaveControls.d.ts +10 -11
- package/dist/screen/components/SaveControls.js +1 -1
- package/dist/screen/components/ScreenChrome.js +1 -1
- package/dist/screen/components/ScreenDocumentContext.js +1 -1
- package/dist/screen/components/ScreenMount.d.ts +5 -6
- package/dist/screen/components/ScreenMount.js +1 -1
- package/dist/screen/components/ScreenStoreProvider.d.ts +8 -9
- package/dist/screen/components/ScreenStoreProvider.js +1 -1
- package/dist/screen/components/SectionScreenShell.js +17 -17
- package/dist/screen/components/SidePanelHead.js +1 -1
- package/dist/screen/components/panel-widths.js +1 -1
- package/dist/screen/components/usePartBridge.d.ts +10 -11
- package/dist/screen/components/usePartBridge.js +1 -1
- package/dist/screen/index.d.ts +9 -10
- package/dist/screen/index.js +1 -1
- package/dist/screen/lib/document/block-set-host.d.ts +55 -0
- package/dist/screen/lib/document/block-set-host.js +1 -0
- package/dist/screen/lib/document/block-types-in.js +1 -1
- package/dist/screen/lib/document/box-fields.d.ts +70 -3
- package/dist/screen/lib/document/box-fields.js +1 -9
- package/dist/screen/lib/document/device-fields.js +1 -1
- package/dist/screen/lib/document/palette-sections.d.ts +33 -97
- package/dist/screen/lib/document/palette-sections.js +1 -1
- package/dist/screen/lib/document/preview-dom.js +1 -1
- package/dist/screen/lib/document/section-doc.js +1 -1
- package/dist/screen/lib/document/style-clipboard.d.ts +10 -11
- package/dist/screen/lib/document/style-clipboard.js +1 -1
- package/dist/screen/lib/document/use-section-ops.js +1 -1
- package/dist/screen/lib/document-switch.js +1 -1
- package/dist/screen/lib/failure.js +1 -1
- package/dist/screen/lib/host-inbound.js +1 -1
- package/dist/screen/lib/key-scope.js +1 -1
- package/dist/screen/lib/media-picker.js +1 -1
- package/dist/screen/lib/page-lock.js +1 -1
- package/dist/screen/lib/screen-parts.d.ts +265 -13
- package/dist/screen/lib/screen-parts.js +1 -1
- package/dist/screen/screen.css +6 -0
- package/dist/screen/words.d.ts +9 -0
- package/dist/screen/words.js +1 -1
- package/dist/strings/index.d.ts +4 -1
- package/dist/strings/index.js +2 -2
- package/dist/style-clipboard/index.d.ts +0 -32
- package/dist/style-clipboard/index.js +1 -1
- package/dist/text-styles/index.d.ts +7 -6
- package/dist/text-styles/index.js +37 -36
- package/dist/text-styles/text-styles.css +5 -53
- package/dist/tree/index.d.ts +2 -2
- package/dist/{types-DBy3L69b.d.ts → types-CoUTWUwB.d.ts} +1 -1
- package/dist/words-Dl8Qja4K.d.ts +32 -0
- package/package.json +15 -3
- package/dist/chunk-3FIS2FRS.js +0 -1
- package/dist/chunk-7RSE6KKY.js +0 -1
- package/dist/chunk-AAAZ2CQR.js +0 -1
- package/dist/chunk-CMPFUJ26.js +0 -8
- package/dist/chunk-CZAAGBVL.js +0 -7
- package/dist/chunk-DSKNJXB4.js +0 -1
- package/dist/chunk-FJTCSQWK.js +0 -16
- package/dist/chunk-H4Z2V56N.js +0 -21
- package/dist/chunk-K7MMLCTT.js +0 -2
- package/dist/chunk-KRL3IUV3.js +0 -1
- package/dist/chunk-LF3FUSCQ.js +0 -1
- package/dist/chunk-LN43DP2A.js +0 -18
- package/dist/chunk-MRWVYSU5.js +0 -64
- package/dist/chunk-QORC32JO.js +0 -5
- package/dist/chunk-THWO5YVZ.js +0 -1
- package/dist/chunk-TOHOGVAE.js +0 -15
- package/dist/chunk-V7U33NF2.js +0 -1
- package/dist/chunk-VKPOH6MK.js +0 -1
- package/dist/chunk-YU3WHLGI.js +0 -1
- package/dist/repeat-D65bJS8d.d.ts +0 -49
- package/dist/session-EsjORLQ0.d.ts +0 -43
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isRecord as t,fieldsFrom as n,blockOf as o,topLevelSlotKeys as e,slotLocations as r,setIn as s,fieldsOf as i,isNode as c,defaultsFrom as p}from"./chunk-KXM6YRG2.js";var f=()=>({lastChange:{}});function a(t,n){if(t===n)return!0;if(!t||!n||"object"!=typeof t||"object"!=typeof n)return t!=t&&n!=n;if(Array.isArray(t)!==Array.isArray(n))return!1;if(Array.isArray(t)){const o=n;if(t.length!==o.length)return!1;for(let n=0;n<t.length;n++)if(!a(t[n],o[n]))return!1;return!0}const o=Object.keys(t),e=Object.keys(n);if(o.length!==e.length)return!1;for(const e of o){if(!Object.prototype.hasOwnProperty.call(n,e))return!1;if(!a(t[e],n[e]))return!1}return!0}function l(t,n){if(!t)return{};const o=t.props??{},e=n?.props??{},r={};for(const t of Object.keys(o))r[t]=!a(e[t],o[t]);return r}async function u(i,c,p={}){const{metadata:d={},trigger:h="replace",cache:y=f(),onResolveStart:g,onResolveEnd:m}=p,w=function(t,n){return t.type&&"root"!==t.type?n.components[t.type]:n.root}(i,c);let b={...i};const v=Boolean(w?.resolveData&&i.props),j=t(i.props)&&"id"in i.props?String(i.props.id):"root";if(v){const t=y.lastChange[j];if("force"!==h&&t&&a(i,t.item))return{node:t.resolved,didChange:!1};const n=l(i,t?.item??null);g?.(i);const o=await w.resolveData(i,{changed:n,lastData:t?.item??null,metadata:{...d,...w.metadata??{}},trigger:h})??{};b.props={...i.props,...o.props??{}},o.readOnly&&Object.keys(o.readOnly).length&&(b.readOnly=o.readOnly)}const $=n(i.type&&"root"!==i.type?o(c,i.type):c.root);if(w)for(const t of e($))void 0===b.props[t]&&(b={...b,props:{...b.props,[t]:[]}});for(const t of r(b.props,$)){if(!t.present)continue;const n=await Promise.all(t.content.map(async t=>(await u(t,c,{metadata:d,trigger:h,cache:y,onResolveStart:g,onResolveEnd:m})).node));b={...b,props:s(b.props,t.segments,n)}}return v&&m?.(b),y.lastChange[j]={item:i,resolved:b},{node:b,didChange:!a(i,b)}}var d="root";function h(t){if(void 0===t)return"u";if("string"==typeof t)return`s${t.length.toString(36)}.${y(t)}`;const n=g(t);return`j${n.length.toString(36)}.${y(n)}`}function y(t){let n=2166136261;for(let o=0;o<t.length;o++)n^=t.charCodeAt(o),n=Math.imul(n,16777619);return(n>>>0).toString(36)}function g(t){if(null===t||"object"!=typeof t)return JSON.stringify(t)??"null";if(Array.isArray(t))return`[${t.map(g).join(",")}]`;const n=t;return`{${Object.keys(n).filter(t=>void 0!==n[t]).sort().map(t=>`${JSON.stringify(t)}:${g(n[t])}`).join(",")}}`}var m=(t,n)=>Object.prototype.hasOwnProperty.call(t,n);function w(t,n){return t&&m(t,n)?t[n]:void 0}var b=t=>Object.keys(t).length>0,v=n=>t(n)&&"string"==typeof n.src&&void 0!==n.v,j=t=>null==t||"string"==typeof t&&""===t.trim(),$=t=>"text"===t||"textarea"===t,O=(t,n)=>"boolean"==typeof t.translatable?t.translatable:n;function k(n,o){const e=w(n,o);return t(e)?e:void 0}function A(t,n){const o=[];return x(t,n,[],[],[],void 0,o),o}function x(n,o,e,r,s,i,c){for(const p of Object.keys(o)){const f=o[p];if(!f||"slot"===f.type)continue;if(0===e.length&&"id"===p)continue;const a=[...e,p],l=[...r,p],u=w(n,p),d=O(f,i);if("object"===f.type&&f.objectFields)null==u?x({},f.objectFields,a,l,s,d,c):t(u)&&x(u,f.objectFields,a,l,s,d,c);else if("array"===f.type&&f.arrayFields){if(!Array.isArray(u))continue;const n=f.arrayFields;u.forEach((o,e)=>{t(o)&&x(o,n,[...a,e],[...l,"*"],[...s,e],d,c)})}else(d??$(f.type))&&c.push({path:a.join("."),segments:a,pattern:l.join("."),indices:s,value:u})}}function z(t,n){const o=t.split("."),e=[],r=[];let s,i=n,c=0;for(;c<o.length;){const t=w(i,o[c]);if(!t||"slot"===t.type)return null;if(0===c&&"id"===o[c])return null;e.push(o[c]),c+=1;const n=O(t,s);if("object"===t.type&&t.objectFields)i=t.objectFields,s=n;else{if("array"!==t.type||!t.arrayFields)return c!==o.length?null:n??$(t.type)?{pattern:e.join("."),indices:r}:null;{const p=o[c];if(void 0===p||!/^(0|[1-9]\d*)$/.test(p))return null;r.push(Number(p)),e.push("*"),c+=1,i=t.arrayFields,s=n}}}return null}function I(n,o){return A(t(n?.props)?n.props:{},i(o,n?.type??d)).map(({path:t,value:n})=>({path:t,value:n}))}function S(t,n,o){const e=A(t,n),r=/* @__PURE__ */new Map,s=[],i=[];if(!o)return{positions:e,hits:r,orphans:s,beaten:i};const c=/* @__PURE__ */new Map;for(const t of e)c.set(t.path,t);const p=/* @__PURE__ */new Map,f=t=>{let n=p.get(t);return void 0===n&&(n=h(t.value),p.set(t,n)),n},a=[];for(const t of Object.keys(o)){const e=o[t],p=c.get(t);if(!v(e)){(p?i:s).push(t);continue}if(p&&f(p)===e.src){r.set(t,{position:p,entry:e,from:t,stale:!1,applied:!0});continue}const l=p??z(t,n);l?l.indices.length>0?a.push({path:t,entry:e,own:p,pattern:l.pattern,indices:l.indices}):p?r.set(t,{position:p,entry:e,from:t,stale:!0,applied:!0}):s.push(t):s.push(t)}a.sort((t,n)=>function(t,n){const o=Math.min(t.length,n.length);for(let e=0;e<o;e++)if(t[e]!==n[e])return t[e]-n[e];return t.length-n.length}(t.indices,n.indices)||(t.path<n.path?-1:t.path>n.path?1:0));const l=[];for(const t of a){let n,o=-1;for(const s of e){if(s.pattern!==t.pattern||r.has(s.path))continue;if(f(s)!==t.entry.src)continue;const e=F(s.indices,t.indices);e>o&&(n=s,o=e)}n?r.set(n.path,{position:n,entry:t.entry,from:t.path,stale:!1,applied:!0}):l.push(t)}for(const t of l)t.own?r.has(t.path)?i.push(t.path):r.set(t.path,{position:t.own,entry:t.entry,from:t.path,stale:!0,applied:!1}):s.push(t.path);return{positions:e,hits:r,orphans:s,beaten:i}}function F(t,n){let o=0;for(;o<t.length&&o<n.length&&t[o]===n[o];)o+=1;return o}function M(n,o,e){const p=t=>{if(!Array.isArray(t))return t;let n=null;return t.forEach((o,r)=>{if(!c(o))return;const s=f(e(o.props.id,o.type,o.props),o.type);s!==o.props&&(n??=[...t],n[r]={...o,props:s})}),n??t},f=(t,n)=>{let e=t;for(const c of r(t,i(o,n))){if(!c.present)continue;const t=p(c.content);t!==c.content&&(e=s(e,c.segments,t))}return e};let a=n;const l=t(n.root?.props)?n.root.props:{},u=e(d,d,l),h=p(n.content);h!==n.content&&(a={...a,content:h});const y=f(u,d);y!==l&&(a={...a,root:{...a.root,props:y}});const g=n.zones;if(t(g)){let t=g;for(const n of Object.keys(g)){if(-1===n.indexOf(":"))continue;const o=p(g[n]);o!==g[n]&&(t={...t,[n]:o})}t!==g&&(a={...a,zones:t})}return a}function E(t,n){const o=/* @__PURE__ */new Map;return M(t,n,(t,n,e)=>(o.has(t)||o.set(t,{type:n,props:e}),e)),o}function N(t,n,o){return o&&b(o)?M(t,n,(t,e,r)=>{const c=k(o,t);if(!c)return r;const p=S(r,i(n,e),c);let f=r;for(const t of p.positions){const n=p.hits.get(t.path);n&&n.applied&&!a(t.value,n.entry.v)&&(f=s(f,t.segments,n.entry.v))}return f}):t}function D(t,n,o){const e={total:0,missing:[],stale:[]};return M(t,n,(t,r,s)=>{const c=S(s,i(n,r),k(o,t));for(const n of c.positions){const o=c.hits.get(n.path);!o&&j(n.value)||(e.total+=1,o?o.stale&&e.stale.push({id:t,path:n.path}):e.missing.push({id:t,path:n.path}))}return s}),e}function C(n,o){let e=n;for(let n=0;n<o.length-1;n++){const r=o[n];if("number"==typeof r){if(!Array.isArray(e)||r>=e.length)return{held:!1,value:void 0};e=e[r]}else{if(!t(e))return{held:!1,value:void 0};e=w(e,r)}}return t(e)?{held:!0,value:w(e,String(o[o.length-1]))}:{held:!1,value:void 0}}function R(n,e,r,s){const c=E(e,r),p={},f=/* @__PURE__ */new Set;if(M(n,r,(t,n,e)=>{if(f.has(t))return e;f.add(t);const l=k(s,t),u=c.get(t);if(!u||u.type!==n||!o(r,n))return l&&(p[t]=l),e;const d=S(e,i(r,n),l),y={};for(const t of d.positions){const n=d.hits.get(t.path),{held:o,value:e}=C(u.props,t.segments),r=n&&n.applied?n.entry.v:t.value;!o||void 0!==e&&a(e,r)?n&&(y[t.path]=n.entry):void 0===e||a(e,t.value)||(y[t.path]={v:e,src:h(t.value)})}if(l)for(const t of d.orphans)m(y,t)||(y[t]=l[t]);return b(y)&&(p[t]=l&&J(y,l)?l:y),e}),!s)return p;for(const n of Object.keys(s))f.has(n)||m(p,n)||!t(s[n])||(p[n]=s[n]);return J(p,s)?s:p}function J(t,n){const o=Object.keys(t);return o.length===Object.keys(n).length&&o.every(o=>m(n,o)&&t[o]===n[o])}function P(t,n,e){const r={},s=/* @__PURE__ */new Set;let c=!1;M(t,n,(t,p,f)=>{if(m(r,t))return f;const a=k(e,t);if(!o(n,p))return U(f,s),a&&(r[t]=a),f;if(!a)return f;const l=function(t,n){let o=0===t.orphans.length&&0===t.beaten.length;const e={};for(const n of t.positions){const r=t.hits.get(n.path);r&&(e[n.path]=r.entry,r.from!==n.path&&(o=!1))}return o?n:e}(S(f,i(n,p),a),a);return l!==a&&(c=!0),b(l)&&(r[t]=l),f});for(const t of s){const n=k(e,t);n&&!m(r,t)&&(r[t]=n)}return c||Object.keys(r).length!==Object.keys(e).length?r:e}function U(n,o){if(Array.isArray(n))for(const t of n)U(t,o);else if(t(n)){c(n)&&"string"==typeof n.props.id&&o.add(n.props.id);for(const t of Object.keys(n))U(n[t],o)}}function B(n,e,r,s){if(!t(s)||!b(s))return s;const c=E(e,r),p=/* @__PURE__ */new Map;if(M(n,r,(t,n,e)=>{if(p.has(t))return e;const f=k(s,t),a=c.get(t);if(!f||!a||a.type!==n||!o(r,n))return e;const l=function(t,n,o,e){const r=S(t,o,e),s=/* @__PURE__ */new Map,i=/* @__PURE__ */new Map;G(t,n,o,"","",void 0,s,i);const c={};let p=0===r.beaten.length;for(const t of r.positions){const n=r.hits.get(t.path);if(!n)continue;const o=s.get(t.path)?.[0];void 0!==o?(c[o]=n.entry,o!==n.from&&(p=!1)):p=!1}for(const t of r.positions){const n=r.hits.get(t.path);if(n)for(const o of i.get(t.path)??[])m(c,o)||(c[o]=n.entry,p=!1)}for(const t of[...r.orphans].sort())m(c,t)?p=!1:c[t]=e[t];return p?e:c}(e,a.props,i(r,n),f);return l!==f&&p.set(t,l),e}),0===p.size)return s;const f={};for(const t of Object.keys(s)){const n=p.get(t);n?b(n)&&(f[t]=n):f[t]=s[t]}return f}function G(n,o,e,r,s,i,c,p){for(const f of Object.keys(e)){const a=e[f];if(!a||"slot"===a.type)continue;if(""===r&&"id"===f)continue;const l=""===r?f:`${r}.${f}`,u=""===s?f:`${s}.${f}`,d=w(n,f),h=w(o,f),y=O(a,i);if("object"===a.type&&a.objectFields){if(null!=d&&!t(d))continue;G(t(d)?d:{},t(h)?h:{},a.objectFields,l,u,y,c,p)}else if("array"===a.type&&a.arrayFields){if(!Array.isArray(d))continue;const n=Array.isArray(h)?h:[];for(const o of K(d,n)){const e=d[o.from];if(!t(e))continue;const r="edited"===o.kind?n[o.to]:e;G(e,t(r)?r:{},a.arrayFields,`${l}.${o.from}`,`${u}.${o.to}`,y,"copy"===o.kind?p:c,p)}}else if(y??$(a.type)){const t=c.get(l);t?t.push(u):c.set(l,[u])}}}function K(t,n){const o=t.map(g),e=n.map(g),r=o.map(()=>!1),s=e.map(()=>!1),i=[],c=Math.min(o.length,e.length);for(let t=0;t<c;t++)o[t]===e[t]&&(i.push({from:t,to:t,kind:"same"}),r[t]=s[t]=!0);for(let t=0;t<e.length;t++){if(s[t])continue;const n=o.findIndex((n,o)=>!r[o]&&n===e[t]);-1!==n&&(i.push({from:n,to:t,kind:"same"}),r[n]=s[t]=!0)}for(let t=0;t<c;t++)r[t]||s[t]||(i.push({from:t,to:t,kind:"edited"}),r[t]=s[t]=!0);for(let t=0;t<e.length;t++){if(s[t])continue;const n=o.indexOf(e[t]);-1!==n&&i.push({from:n,to:t,kind:"copy"})}return i}function T(t,n,o){const e={},s=(t,n)=>{if(t.type!==n.type)return;e[t.props.id]=n.props.id;const p=r(n.props,i(o,n.type));for(const n of r(t.props,i(o,t.type))){const t=p.find(t=>t.slot===n.slot);t&&n.content.forEach((n,o)=>{const e=t.content[o];c(n)&&c(e)&&s(n,e)})}};return c(t)&&c(n)&&s(t,n),e}function X(t,n){const o={};if(!t)return o;for(const e of Object.keys(n)){const r=k(t,e),s=n[e];r&&b(r)&&"string"==typeof s&&(o[s]={...r})}return o}var Y="root",q="default-zone",H={parentId:Y,slot:q},L=({parentId:t,slot:n})=>`${t}:${n}`;function Q(t){const n=t.indexOf(":");if(-1===n)throw new W("no-slot",`"${t}" is not a zone key`);return{parentId:t.slice(0,n),slot:t.slice(n+1)}}var V=t=>t.parentId===Y&&t.slot===q,W=class extends Error{code;constructor(t,n){super(n),this.name="DataError",this.code=t}};function Z(t){try{const n=globalThis.crypto;if(n&&"function"==typeof n.randomUUID)return`${t}-${n.randomUUID()}`}catch{}return`${t}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}function _(t,n){return r(t.props,i(n,t.type)).map(({slot:t,content:n})=>({slot:t,content:n}))}function tt(t,o){return r(nt(t),n(o.root))}function nt(n){return t(n.root?.props)?n.root.props:{}}function ot(t,n,o){const e=(t,n,e,r,s)=>{if(!Array.isArray(t))return t;const i=[...e,n];let f=null;return t.forEach((e,a)=>{if(!c(e))return;const l={place:{...n,index:a},path:i,parent:r,depth:s};let u=o(e,l)??e;if(u!==e&&u.props.id!==e.props.id)throw new W("id-change",`walk: ${e.props.id} came back as ${u.props.id}`);u=p(u,i,s+1),u!==e&&(f??=[...t],f[a]=u)}),f??t},p=(t,o,c)=>{let p=t.props;for(const f of r(t.props,i(n,t.type))){if(!f.present)continue;const n=e(f.content,{parentId:t.props.id,slot:f.slot},o,t,c);n!==f.content&&(p=s(p,f.segments,n))}return p===t.props?t:{...t,props:p}};let f=t;const a=e(t.content,H,[],null,0);a!==t.content&&(f={...f,content:a});let l=nt(f);for(const t of tt(f,n)){if(!t.present)continue;const n=e(t.content,{parentId:Y,slot:t.slot},[],null,0);n!==t.content&&(l=s(l,t.segments,n))}l!==nt(f)&&(f={...f,root:{...f.root,props:l}});const u=f.zones;if(u){let t=u;for(const n of Object.keys(u)){const o=et(n);if(!o)continue;const r=e(u[n],o,[],null,0);r!==u[n]&&(t={...t,[n]:r})}t!==u&&(f={...f,zones:t})}return f}function et(t){const n=t.indexOf(":");return-1===n?null:{parentId:t.slice(0,n),slot:t.slice(n+1)}}function rt(t,n,o){let e=null;const r={};try{ot(t,n,(t,n)=>{if(t.props.id===o)throw e={node:t,place:n.place,path:n.path},r})}catch(t){if(t!==r)throw t}return e}function st(t,n,o){if(V(o))return Array.isArray(t.content)?t.content:[];const e=t.zones?.[L(o)];if(o.parentId===Y){const r=tt(t,n).find(t=>t.slot===o.slot);return r?r.content:e??null}const s=rt(t,n,o.parentId);if(s){const t=r(s.node.props,i(n,s.node.type)).find(t=>t.slot===o.slot);if(t)return t.content}return e??null}function it(t,n){const o=/* @__PURE__ */new Set;return ot(t,n,t=>{o.add(t.props.id)}),o}function ct(t,n){const o=/* @__PURE__ */new Set([t.props.id]),e=t=>{for(const{content:r}of _(t,n))for(const t of r)c(t)&&(o.add(t.props.id),e(t))};return e(t),o}function pt(t,n,o,e){if(V(o)){const n=Array.isArray(t.content)?t.content:[];return{...t,content:e(n)}}const c=L(o),p=!!t.zones&&Array.isArray(t.zones[c]);if(o.parentId===Y){const r=tt(t,n).find(t=>t.slot===o.slot);if(r){const n=s(nt(t),r.segments,e(r.content));return{...t,root:{...t.root,props:n}}}}else{const c=rt(t,n,o.parentId);if(c){const p=r(c.node.props,i(n,c.node.type)).find(t=>t.slot===o.slot);if(p)return ft(t,n,c,t=>({...t,props:s(t.props,p.segments,e(p.content))}))}else if(!p)throw new W("not-found",`no node ${o.parentId}`)}if(p)return{...t,zones:{...t.zones,[c]:e(t.zones[c])}};throw new W("no-slot",`no slot "${o.slot}" on ${o.parentId}`)}function ft(t,n,o,e){return pt(t,n,o.place,t=>{const n=[...t];return n[o.place.index]=e(t[o.place.index]),n})}function at(t,n,o){const e=rt(t,n,o);if(!e)throw new W("not-found",`no node ${o}`);return e}function lt(t,n,o){const e=st(t,n,o);if(e)return e;if(o.parentId!==Y&&!rt(t,n,o.parentId))throw new W("not-found",`no node ${o.parentId}`);throw new W("no-slot",`no slot "${o.slot}" on ${o.parentId}`)}function ut(t,n,o){if(!Number.isInteger(t)||t<0||t>n)throw new W("bad-index",`${o}: index ${t} is outside 0…${n}`)}function dt(t,i){const c=o(i,t.type);if(!c)return t;const p=n(c);let f=t.props;for(const t of e(p))null==f[t]&&(f={...f,[t]:[]});for(const t of r(f,p)){if(!t.present)continue;const n=ht(t.content,i);n!==t.content&&(f=s(f,t.segments,n))}return f===t.props?t:{...t,props:f}}function ht(n,o){let e=null;return n.forEach((r,s)=>{if(!t(r)||"string"!=typeof r.type)return;let i=r;if(t(i.props)){if("string"!=typeof i.props.id||""===i.props.id){const{id:t,...n}=i.props;i={...i,props:{id:Z(i.type),...n}}}}else i={...i,props:{id:Z(i.type)}};const c=dt(i,o);c!==r&&(e??=[...n],e[s]=c)}),e??n}function yt(t,o){const i=n(o.root);let c=t.props;for(const t of e(i))null==c[t]&&(c={...c,[t]:[]});for(const t of r(c,i)){if(!t.present)continue;const n=ht(t.content,o);n!==t.content&&(c=s(c,t.segments,n))}return c===t.props?t:{...t,props:c}}function gt(n,o){let e=t(n)?n:{};const r=e.root;if(t(r)){if(!t(r.props)){const t=Object.keys(r).filter(t=>"props"!==t);e={...e,root:t.length?{props:{...wt(r,t)}}:{props:{}}}}}else e={...e,root:{props:{}}};const s=p(o.root);if(s){const t=Object.keys(s).filter(t=>!(t in e.root.props));if(t.length){const n=bt(wt(s,t));e={...e,root:{...e.root,props:{...e.root.props,...n}}}}}const i=yt(e.root,o);i!==e.root&&(e={...e,root:i}),Array.isArray(e.content)||(e={...e,content:[]});const c=ht(e.content,o);return c!==e.content&&(e={...e,content:c}),e=t(e.zones)?function(t,n){let o=t;for(const e of Object.keys(t.zones??{})){const t=o.zones[e];if(!Array.isArray(t)||0===t.length)continue;const r=et(e);if(!r||V(r))continue;const s=mt(o,n,r);if(!s||s.content.length>0)continue;const{[e]:i,...c}=o.zones;o=pt({...o,zones:c},n,r,()=>ht(t,n))}const e=o.zones;let r=e;for(const t of Object.keys(e)){if(!Array.isArray(e[t]))continue;const o=ht(e[t],n);o!==e[t]&&(r={...r,[t]:o})}return r===e?o:{...o,zones:r}}(e,o):{...e,zones:{}},e}function mt(t,n,o){if(o.parentId===Y)return tt(t,n).find(t=>t.slot===o.slot);const e=rt(t,n,o.parentId);return e?r(e.node.props,i(n,e.node.type)).find(t=>t.slot===o.slot):void 0}function wt(t,n){const o={};for(const e of n)o[e]=t[e];return o}function bt(t){return void 0===t?t:JSON.parse(JSON.stringify(t))}function vt(t,n,o={},e={}){const r=t.components[n];if(!r)throw new W("unknown-type",`no block type "${n}" in the config`);return dt({type:n,props:{...bt(p(r)??{}),...bt(o),id:e.id??Z(n)}},t)}function jt(n,o,e,r){if(!c(r))throw new W("unknown-type","insert: not a node");const s=lt(n,o,e);ut(e.index,s.length,"insert");const i=dt(t(r.props)&&"string"==typeof r.props.id&&r.props.id?r:{...r,props:{...r.props,id:Z(r.type)}},o),p=it(n,o);for(const t of ct(i,o))if(p.has(t))throw new W("duplicate-id",`insert: ${t} is already in the document`);return pt(n,o,e,t=>[...t.slice(0,e.index),i,...t.slice(e.index)])}function $t(t,n,o){const e=at(t,n,o);let r=pt(t,n,e.place,t=>[...t.slice(0,e.place.index),...t.slice(e.place.index+1)]);if(r.zones&&Object.keys(r.zones).length){const t=ct(e.node,n),o=Object.keys(r.zones).filter(n=>!t.has(n.split(":")[0]));o.length!==Object.keys(r.zones).length&&(r={...r,zones:wt(r.zones,o)})}return r}function Ot(t,n,o,e){const r=at(t,n,o);if(ct(r.node,n).has(e.parentId))throw new W("cycle",`move: ${o} cannot go inside itself`);if(r.place.parentId===e.parentId&&r.place.slot===e.slot){const o=lt(t,n,e);return ut(e.index,o.length-1,"move"),e.index===r.place.index?t:pt(t,n,e,t=>{const n=[...t],[o]=n.splice(r.place.index,1);return n.splice(e.index,0,o),n})}ut(e.index,lt(t,n,e).length,"move");const s=pt(t,n,r.place,t=>[...t.slice(0,r.place.index),...t.slice(r.place.index+1)]);return pt(s,n,e,t=>[...t.slice(0,e.index),r.node,...t.slice(e.index)])}function kt(t,n,o,e={}){const r=at(t,n,o),s=xt(bt(r.node),n,e.strip,e.id);return pt(t,n,r.place,t=>[...t.slice(0,r.place.index+1),s,...t.slice(r.place.index+1)])}function At(t,n,o={}){return xt(bt(t),n,o.strip,o.id)}function xt(t,n,o,e){let p={...t,props:{...t.props,id:e??Z(t.type)}};if(o){const t=o(p);if(t.props.id!==p.props.id)throw new W("id-change","duplicate: strip must not change the id");p=t}let f=p.props;for(const t of r(f,i(n,p.type))){if(!t.present)continue;const e=t.content.map(t=>c(t)?xt(t,n,o):t);f=s(f,t.segments,e)}return dt({...p,props:f},n)}function zt(t,n,o,e){if("id"in e&&e.id!==o)throw new W("id-change",`setProps: ${o} cannot become ${String(e.id)}`);const r=at(t,n,o);return Ft(r.node.props,e)?ft(t,n,r,t=>dt({...t,props:{...t.props,...e,id:o}},n)):t}function It(t,n,o,e){if(!c(e))throw new W("unknown-type","replaceNode: not a node");if(e.props.id!==o)throw new W("id-change",`replaceNode: ${o} cannot become ${String(e.props.id)}`);const r=at(t,n,o),s=dt(e,n),i=it(t,n);for(const t of ct(r.node,n))i.delete(t);for(const t of ct(s,n))if(i.has(t))throw new W("duplicate-id",`replaceNode: ${t} is already in the document`);return ft(t,n,r,()=>s)}function St(t,n,o){const e=nt(t);if(!Ft(e,o))return t;const r=yt({...t.root,props:{...e,...o}},n);return{...t,root:r}}function Ft(t,n){return Object.keys(n).some(o=>!(o in t)||!Object.is(t[o],n[o]))}export{W as DataError,Y as ROOT_ID,H as ROOT_LIST,q as ROOT_SLOT,N as applyTranslation,l as changedProps,At as copyNode,X as copyTranslation,vt as createNode,f as createResolveCache,a as deepEqual,kt as duplicate,R as extractTranslation,rt as find,st as getList,jt as insert,T as mapIds,Ot as move,Z as newId,gt as normalizeData,Q as parseZoneKey,P as pruneTranslation,B as rebaseTranslation,$t as remove,It as replaceNode,u as resolveNodeData,zt as setProps,St as setRoot,_ as slotsOf,I as translatablePaths,h as translationFingerprint,D as translationStatus,ot as walk,L as zoneKey};
|
|
1
|
+
import{isRecord as t,fieldsFrom as n,blockOf as o,topLevelSlotKeys as e,slotLocations as r,setIn as s,fieldsOf as i,isNode as c,defaultsFrom as p}from"./chunk-KXM6YRG2.js";var f=()=>({lastChange:{}});function a(t,n){if(t===n)return!0;if(!t||!n||"object"!=typeof t||"object"!=typeof n)return t!=t&&n!=n;if(Array.isArray(t)!==Array.isArray(n))return!1;if(Array.isArray(t)){const o=n;if(t.length!==o.length)return!1;for(let n=0;n<t.length;n++)if(!a(t[n],o[n]))return!1;return!0}const o=Object.keys(t),e=Object.keys(n);if(o.length!==e.length)return!1;for(const e of o){if(!Object.prototype.hasOwnProperty.call(n,e))return!1;if(!a(t[e],n[e]))return!1}return!0}function l(t,n){if(!t)return{};const o=t.props??{},e=n?.props??{},r={};for(const t of Object.keys(o))r[t]=!a(e[t],o[t]);return r}async function u(i,c,p={}){const{metadata:d={},trigger:h="replace",cache:y=f(),onResolveStart:g,onResolveEnd:m}=p,w=function(t,n){return t.type&&"root"!==t.type?n.components[t.type]:n.root}(i,c);let b={...i};const v=Boolean(w?.resolveData&&i.props),j=t(i.props)&&"id"in i.props?String(i.props.id):"root";if(v){const t=y.lastChange[j];if("force"!==h&&t&&a(i,t.item))return{node:t.resolved,didChange:!1};const n=l(i,t?.item??null);g?.(i);const o=await w.resolveData(i,{changed:n,lastData:t?.item??null,metadata:{...d,...w.metadata??{}},trigger:h})??{};b.props={...i.props,...o.props??{}},o.readOnly&&Object.keys(o.readOnly).length&&(b.readOnly=o.readOnly)}const $=n(i.type&&"root"!==i.type?o(c,i.type):c.root);if(w)for(const t of e($))void 0===b.props[t]&&(b={...b,props:{...b.props,[t]:[]}});for(const t of r(b.props,$)){if(!t.present)continue;const n=await Promise.all(t.content.map(async t=>(await u(t,c,{metadata:d,trigger:h,cache:y,onResolveStart:g,onResolveEnd:m})).node));b={...b,props:s(b.props,t.segments,n)}}return v&&m?.(b),y.lastChange[j]={item:i,resolved:b},{node:b,didChange:!a(i,b)}}var d="root";function h(t){if(void 0===t)return"u";if("string"==typeof t)return`s${t.length.toString(36)}.${y(t)}`;const n=g(t);return`j${n.length.toString(36)}.${y(n)}`}function y(t){let n=2166136261;for(let o=0;o<t.length;o++)n^=t.charCodeAt(o),n=Math.imul(n,16777619);return(n>>>0).toString(36)}function g(t){if(null===t||"object"!=typeof t)return JSON.stringify(t)??"null";if(Array.isArray(t))return`[${t.map(g).join(",")}]`;const n=t;return`{${Object.keys(n).filter(t=>void 0!==n[t]).sort().map(t=>`${JSON.stringify(t)}:${g(n[t])}`).join(",")}}`}var m=(t,n)=>Object.prototype.hasOwnProperty.call(t,n);function w(t,n){return t&&m(t,n)?t[n]:void 0}var b=t=>Object.keys(t).length>0,v=n=>t(n)&&"string"==typeof n.src&&void 0!==n.v,j=t=>null==t||"string"==typeof t&&""===t.trim(),$=t=>"text"===t||"textarea"===t,O=(t,n)=>"boolean"==typeof t.translatable?t.translatable:n;function k(n,o){const e=w(n,o);return t(e)?e:void 0}function A(t,n){const o=[];return x(t,n,[],[],[],void 0,o),o}function x(n,o,e,r,s,i,c){for(const p of Object.keys(o)){const f=o[p];if(!f||"slot"===f.type)continue;if(0===e.length&&"id"===p)continue;const a=[...e,p],l=[...r,p],u=w(n,p),d=O(f,i);if("object"===f.type&&f.objectFields)null==u?x({},f.objectFields,a,l,s,d,c):t(u)&&x(u,f.objectFields,a,l,s,d,c);else if("array"===f.type&&f.arrayFields){if(!Array.isArray(u))continue;const n=f.arrayFields;u.forEach((o,e)=>{t(o)&&x(o,n,[...a,e],[...l,"*"],[...s,e],d,c)})}else(d??$(f.type))&&c.push({path:a.join("."),segments:a,pattern:l.join("."),indices:s,value:u})}}function z(t,n){const o=t.split("."),e=[],r=[];let s,i=n,c=0;for(;c<o.length;){const t=w(i,o[c]);if(!t||"slot"===t.type)return null;if(0===c&&"id"===o[c])return null;e.push(o[c]),c+=1;const n=O(t,s);if("object"===t.type&&t.objectFields)i=t.objectFields,s=n;else{if("array"!==t.type||!t.arrayFields)return c!==o.length?null:n??$(t.type)?{pattern:e.join("."),indices:r}:null;{const p=o[c];if(void 0===p||!/^(0|[1-9]\d*)$/.test(p))return null;r.push(Number(p)),e.push("*"),c+=1,i=t.arrayFields,s=n}}}return null}function I(n,o){return A(t(n?.props)?n.props:{},i(o,n?.type??d)).map(({path:t,value:n})=>({path:t,value:n}))}function S(t,n,o){const e=A(t,n),r=/* @__PURE__ */new Map,s=[],i=[];if(!o)return{positions:e,hits:r,orphans:s,beaten:i};const c=/* @__PURE__ */new Map;for(const t of e)c.set(t.path,t);const p=/* @__PURE__ */new Map,f=t=>{let n=p.get(t);return void 0===n&&(n=h(t.value),p.set(t,n)),n},a=[];for(const t of Object.keys(o)){const e=o[t],p=c.get(t);if(!v(e)){(p?i:s).push(t);continue}if(p&&f(p)===e.src){r.set(t,{position:p,entry:e,from:t,stale:!1,applied:!0});continue}const l=p??z(t,n);l?l.indices.length>0?a.push({path:t,entry:e,own:p,pattern:l.pattern,indices:l.indices}):p?r.set(t,{position:p,entry:e,from:t,stale:!0,applied:!0}):s.push(t):s.push(t)}a.sort((t,n)=>function(t,n){const o=Math.min(t.length,n.length);for(let e=0;e<o;e++)if(t[e]!==n[e])return t[e]-n[e];return t.length-n.length}(t.indices,n.indices)||(t.path<n.path?-1:t.path>n.path?1:0));const l=[];for(const t of a){let n,o=-1;for(const s of e){if(s.pattern!==t.pattern||r.has(s.path))continue;if(f(s)!==t.entry.src)continue;const e=F(s.indices,t.indices);e>o&&(n=s,o=e)}n?r.set(n.path,{position:n,entry:t.entry,from:t.path,stale:!1,applied:!0}):l.push(t)}for(const t of l)t.own?r.has(t.path)?i.push(t.path):r.set(t.path,{position:t.own,entry:t.entry,from:t.path,stale:!0,applied:!1}):s.push(t.path);return{positions:e,hits:r,orphans:s,beaten:i}}function F(t,n){let o=0;for(;o<t.length&&o<n.length&&t[o]===n[o];)o+=1;return o}function M(n,o,e){const p=t=>{if(!Array.isArray(t))return t;let n=null;return t.forEach((o,r)=>{if(!c(o))return;const s=f(e(o.props.id,o.type,o.props),o.type);s!==o.props&&(n??=[...t],n[r]={...o,props:s})}),n??t},f=(t,n)=>{let e=t;for(const c of r(t,i(o,n))){if(!c.present)continue;const t=p(c.content);t!==c.content&&(e=s(e,c.segments,t))}return e};let a=n;const l=t(n.root?.props)?n.root.props:{},u=e(d,d,l),h=p(n.content);h!==n.content&&(a={...a,content:h});const y=f(u,d);y!==l&&(a={...a,root:{...a.root,props:y}});const g=n.zones;if(t(g)){let t=g;for(const n of Object.keys(g)){if(-1===n.indexOf(":"))continue;const o=p(g[n]);o!==g[n]&&(t={...t,[n]:o})}t!==g&&(a={...a,zones:t})}return a}function E(t,n){const o=/* @__PURE__ */new Map;return M(t,n,(t,n,e)=>(o.has(t)||o.set(t,{type:n,props:e}),e)),o}function N(t,n,o){return o&&b(o)?M(t,n,(t,e,r)=>{const c=k(o,t);if(!c)return r;const p=S(r,i(n,e),c);let f=r;for(const t of p.positions){const n=p.hits.get(t.path);n&&n.applied&&!a(t.value,n.entry.v)&&(f=s(f,t.segments,n.entry.v))}return f}):t}function D(t,n,o){const e={total:0,missing:[],stale:[]};return M(t,n,(t,r,s)=>{const c=S(s,i(n,r),k(o,t));for(const n of c.positions){const o=c.hits.get(n.path);!o&&j(n.value)||(e.total+=1,o?o.stale&&e.stale.push({id:t,path:n.path}):e.missing.push({id:t,path:n.path}))}return s}),e}function C(n,o){let e=n;for(let n=0;n<o.length-1;n++){const r=o[n];if("number"==typeof r){if(!Array.isArray(e)||r>=e.length)return{held:!1,value:void 0};e=e[r]}else{if(!t(e))return{held:!1,value:void 0};e=w(e,r)}}return t(e)?{held:!0,value:w(e,String(o[o.length-1]))}:{held:!1,value:void 0}}function R(n,e,r,s){const c=E(e,r),p={},f=/* @__PURE__ */new Set;if(M(n,r,(t,n,e)=>{if(f.has(t))return e;f.add(t);const l=k(s,t),u=c.get(t);if(!u||u.type!==n||!o(r,n))return l&&(p[t]=l),e;const d=S(e,i(r,n),l),y={};for(const t of d.positions){const n=d.hits.get(t.path),{held:o,value:e}=C(u.props,t.segments),r=n&&n.applied?n.entry.v:t.value;!o||void 0!==e&&a(e,r)?n&&(y[t.path]=n.entry):void 0===e||a(e,t.value)||(y[t.path]={v:e,src:h(t.value)})}if(l)for(const t of d.orphans)m(y,t)||(y[t]=l[t]);return b(y)&&(p[t]=l&&J(y,l)?l:y),e}),!s)return p;for(const n of Object.keys(s))f.has(n)||m(p,n)||!t(s[n])||(p[n]=s[n]);return J(p,s)?s:p}function J(t,n){const o=Object.keys(t);return o.length===Object.keys(n).length&&o.every(o=>m(n,o)&&t[o]===n[o])}function P(t,n,e){const r={},s=/* @__PURE__ */new Set;let c=!1;M(t,n,(t,p,f)=>{if(m(r,t))return f;const a=k(e,t);if(!o(n,p))return U(f,s),a&&(r[t]=a),f;if(!a)return f;const l=function(t,n){let o=0===t.orphans.length&&0===t.beaten.length;const e={};for(const n of t.positions){const r=t.hits.get(n.path);r&&(e[n.path]=r.entry,r.from!==n.path&&(o=!1))}return o?n:e}(S(f,i(n,p),a),a);return l!==a&&(c=!0),b(l)&&(r[t]=l),f});for(const t of s){const n=k(e,t);n&&!m(r,t)&&(r[t]=n)}return c||Object.keys(r).length!==Object.keys(e).length?r:e}function U(n,o){if(Array.isArray(n))for(const t of n)U(t,o);else if(t(n)){c(n)&&"string"==typeof n.props.id&&o.add(n.props.id);for(const t of Object.keys(n))U(n[t],o)}}function B(n,e,r,s){if(!t(s)||!b(s))return s;const c=E(e,r),p=/* @__PURE__ */new Map;if(M(n,r,(t,n,e)=>{if(p.has(t))return e;const f=k(s,t),a=c.get(t);if(!f||!a||a.type!==n||!o(r,n))return e;const l=function(t,n,o,e){const r=S(t,o,e),s=/* @__PURE__ */new Map,i=/* @__PURE__ */new Map;G(t,n,o,"","",void 0,s,i);const c={};let p=0===r.beaten.length;for(const t of r.positions){const n=r.hits.get(t.path);if(!n)continue;const o=s.get(t.path)?.[0];void 0!==o?(c[o]=n.entry,o!==n.from&&(p=!1)):p=!1}for(const t of r.positions){const n=r.hits.get(t.path);if(n)for(const o of i.get(t.path)??[])m(c,o)||(c[o]=n.entry,p=!1)}for(const t of[...r.orphans].sort())m(c,t)?p=!1:c[t]=e[t];return p?e:c}(e,a.props,i(r,n),f);return l!==f&&p.set(t,l),e}),0===p.size)return s;const f={};for(const t of Object.keys(s)){const n=p.get(t);n?b(n)&&(f[t]=n):f[t]=s[t]}return f}function G(n,o,e,r,s,i,c,p){for(const f of Object.keys(e)){const a=e[f];if(!a||"slot"===a.type)continue;if(""===r&&"id"===f)continue;const l=""===r?f:`${r}.${f}`,u=""===s?f:`${s}.${f}`,d=w(n,f),h=w(o,f),y=O(a,i);if("object"===a.type&&a.objectFields){if(null!=d&&!t(d))continue;G(t(d)?d:{},t(h)?h:{},a.objectFields,l,u,y,c,p)}else if("array"===a.type&&a.arrayFields){if(!Array.isArray(d))continue;const n=Array.isArray(h)?h:[];for(const o of K(d,n)){const e=d[o.from];if(!t(e))continue;const r="edited"===o.kind?n[o.to]:e;G(e,t(r)?r:{},a.arrayFields,`${l}.${o.from}`,`${u}.${o.to}`,y,"copy"===o.kind?p:c,p)}}else if(y??$(a.type)){const t=c.get(l);t?t.push(u):c.set(l,[u])}}}function K(t,n){const o=t.map(g),e=n.map(g),r=o.map(()=>!1),s=e.map(()=>!1),i=[],c=Math.min(o.length,e.length);for(let t=0;t<c;t++)o[t]===e[t]&&(i.push({from:t,to:t,kind:"same"}),r[t]=s[t]=!0);for(let t=0;t<e.length;t++){if(s[t])continue;const n=o.findIndex((n,o)=>!r[o]&&n===e[t]);-1!==n&&(i.push({from:n,to:t,kind:"same"}),r[n]=s[t]=!0)}for(let t=0;t<c;t++)r[t]||s[t]||(i.push({from:t,to:t,kind:"edited"}),r[t]=s[t]=!0);for(let t=0;t<e.length;t++){if(s[t])continue;const n=o.indexOf(e[t]);-1!==n&&i.push({from:n,to:t,kind:"copy"})}return i}function T(t,n,o){const e={},s=(t,n)=>{if(t.type!==n.type)return;e[t.props.id]=n.props.id;const p=r(n.props,i(o,n.type));for(const n of r(t.props,i(o,t.type))){const t=p.find(t=>t.slot===n.slot);t&&n.content.forEach((n,o)=>{const e=t.content[o];c(n)&&c(e)&&s(n,e)})}};return c(t)&&c(n)&&s(t,n),e}function X(t,n){const o={};if(!t)return o;for(const e of Object.keys(n)){const r=k(t,e),s=n[e];r&&b(r)&&"string"==typeof s&&(o[s]={...r})}return o}var Y="root",q="default-zone",H={parentId:Y,slot:q},L=({parentId:t,slot:n})=>`${t}:${n}`;function Q(t){const n=t.indexOf(":");if(-1===n)throw new W("no-slot",`"${t}" is not a zone key`);return{parentId:t.slice(0,n),slot:t.slice(n+1)}}var V=t=>t.parentId===Y&&t.slot===q,W=class extends Error{code;constructor(t,n){super(n),this.name="DataError",this.code=t}};function Z(t){try{const n=globalThis.crypto;if(n&&"function"==typeof n.randomUUID)return`${t}-${n.randomUUID()}`}catch{}return`${t}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}function _(t,n){return r(t.props,i(n,t.type)).map(({slot:t,content:n})=>({slot:t,content:n}))}function tt(t,o){return r(nt(t),n(o.root))}function nt(n){return t(n.root?.props)?n.root.props:{}}function ot(t,n,o){const e=(t,n,e,r,s)=>{if(!Array.isArray(t))return t;const i=[...e,n];let f=null;return t.forEach((e,a)=>{if(!c(e))return;const l={place:{...n,index:a},path:i,parent:r,depth:s};let u=o(e,l)??e;if(u!==e&&u.props.id!==e.props.id)throw new W("id-change",`walk: ${e.props.id} came back as ${u.props.id}`);u=p(u,i,s+1),u!==e&&(f??=[...t],f[a]=u)}),f??t},p=(t,o,c)=>{let p=t.props;for(const f of r(t.props,i(n,t.type))){if(!f.present)continue;const n=e(f.content,{parentId:t.props.id,slot:f.slot},o,t,c);n!==f.content&&(p=s(p,f.segments,n))}return p===t.props?t:{...t,props:p}};let f=t;const a=e(t.content,H,[],null,0);a!==t.content&&(f={...f,content:a});let l=nt(f);for(const t of tt(f,n)){if(!t.present)continue;const n=e(t.content,{parentId:Y,slot:t.slot},[],null,0);n!==t.content&&(l=s(l,t.segments,n))}l!==nt(f)&&(f={...f,root:{...f.root,props:l}});const u=f.zones;if(u){let t=u;for(const n of Object.keys(u)){const o=et(n);if(!o)continue;const r=e(u[n],o,[],null,0);r!==u[n]&&(t={...t,[n]:r})}t!==u&&(f={...f,zones:t})}return f}function et(t){const n=t.indexOf(":");return-1===n?null:{parentId:t.slice(0,n),slot:t.slice(n+1)}}function rt(t,n,o){let e=null;const r={};try{ot(t,n,(t,n)=>{if(t.props.id===o)throw e={node:t,place:n.place,path:n.path},r})}catch(t){if(t!==r)throw t}return e}function st(t,n,o){if(V(o))return Array.isArray(t.content)?t.content:[];const e=t.zones?.[L(o)];if(o.parentId===Y){const r=tt(t,n).find(t=>t.slot===o.slot);return r?r.content:e??null}const s=rt(t,n,o.parentId);if(s){const t=r(s.node.props,i(n,s.node.type)).find(t=>t.slot===o.slot);if(t)return t.content}return e??null}function it(t,n){const o=/* @__PURE__ */new Set;return ot(t,n,t=>{o.add(t.props.id)}),o}function ct(t,n){const o=/* @__PURE__ */new Set([t.props.id]),e=t=>{for(const{content:r}of _(t,n))for(const t of r)c(t)&&(o.add(t.props.id),e(t))};return e(t),o}function pt(t,n,o,e){if(V(o)){const n=Array.isArray(t.content)?t.content:[];return{...t,content:e(n)}}const c=L(o),p=!!t.zones&&Array.isArray(t.zones[c]);if(o.parentId===Y){const r=tt(t,n).find(t=>t.slot===o.slot);if(r){const n=s(nt(t),r.segments,e(r.content));return{...t,root:{...t.root,props:n}}}}else{const c=rt(t,n,o.parentId);if(c){const p=r(c.node.props,i(n,c.node.type)).find(t=>t.slot===o.slot);if(p)return ft(t,n,c,t=>({...t,props:s(t.props,p.segments,e(p.content))}))}else if(!p)throw new W("not-found",`no node ${o.parentId}`)}if(p)return{...t,zones:{...t.zones,[c]:e(t.zones[c])}};throw new W("no-slot",`no slot "${o.slot}" on ${o.parentId}`)}function ft(t,n,o,e){return pt(t,n,o.place,t=>{const n=[...t];return n[o.place.index]=e(t[o.place.index]),n})}function at(t,n,o){const e=rt(t,n,o);if(!e)throw new W("not-found",`no node ${o}`);return e}function lt(t,n,o){const e=st(t,n,o);if(e)return e;if(o.parentId!==Y&&!rt(t,n,o.parentId))throw new W("not-found",`no node ${o.parentId}`);throw new W("no-slot",`no slot "${o.slot}" on ${o.parentId}`)}function ut(t,n,o){if(!Number.isInteger(t)||t<0||t>n)throw new W("bad-index",`${o}: index ${t} is outside 0…${n}`)}function dt(t,i){const c=o(i,t.type);if(!c)return t;const p=n(c);let f=t.props;for(const t of e(p))null==f[t]&&(f={...f,[t]:[]});for(const t of r(f,p)){if(!t.present)continue;const n=ht(t.content,i);n!==t.content&&(f=s(f,t.segments,n))}return f===t.props?t:{...t,props:f}}function ht(n,o){let e=null;return n.forEach((r,s)=>{if(!t(r)||"string"!=typeof r.type)return;let i=r;if(t(i.props)){if("string"!=typeof i.props.id||""===i.props.id){const{id:t,...n}=i.props;i={...i,props:{id:Z(i.type),...n}}}}else i={...i,props:{id:Z(i.type)}};const c=dt(i,o);c!==r&&(e??=[...n],e[s]=c)}),e??n}function yt(t,o){const i=n(o.root);let c=t.props;for(const t of e(i))null==c[t]&&(c={...c,[t]:[]});for(const t of r(c,i)){if(!t.present)continue;const n=ht(t.content,o);n!==t.content&&(c=s(c,t.segments,n))}return c===t.props?t:{...t,props:c}}function gt(n,o){let e=t(n)?n:{};const r=e.root;if(t(r)){if(!t(r.props)){const t=Object.keys(r).filter(t=>"props"!==t);e={...e,root:t.length?{props:{...wt(r,t)}}:{props:{}}}}}else e={...e,root:{props:{}}};const s=p(o.root);if(s){const t=Object.keys(s).filter(t=>!(t in e.root.props));if(t.length){const n=bt(wt(s,t));e={...e,root:{...e.root,props:{...e.root.props,...n}}}}}const i=yt(e.root,o);i!==e.root&&(e={...e,root:i}),Array.isArray(e.content)||(e={...e,content:[]});const c=ht(e.content,o);return c!==e.content&&(e={...e,content:c}),e=t(e.zones)?function(t,n){let o=t;for(const e of Object.keys(t.zones??{})){const t=o.zones[e];if(!Array.isArray(t)||0===t.length)continue;const r=et(e);if(!r||V(r))continue;const s=mt(o,n,r);if(!s||s.content.length>0)continue;const{[e]:i,...c}=o.zones;o=pt({...o,zones:c},n,r,()=>ht(t,n))}const e=o.zones;let r=e;for(const t of Object.keys(e)){if(!Array.isArray(e[t]))continue;const o=ht(e[t],n);o!==e[t]&&(r={...r,[t]:o})}return r===e?o:{...o,zones:r}}(e,o):{...e,zones:{}},e}function mt(t,n,o){if(o.parentId===Y)return tt(t,n).find(t=>t.slot===o.slot);const e=rt(t,n,o.parentId);return e?r(e.node.props,i(n,e.node.type)).find(t=>t.slot===o.slot):void 0}function wt(t,n){const o={};for(const e of n)o[e]=t[e];return o}function bt(t){return void 0===t?t:JSON.parse(JSON.stringify(t))}function vt(t,n,o={},e={}){const r=t.components[n];if(!r)throw new W("unknown-type",`no block type "${n}" in the config`);return dt({type:n,props:{...bt(p(r)??{}),...bt(o),id:e.id??Z(n)}},t)}function jt(n,o,e,r){if(!c(r))throw new W("unknown-type","insert: not a node");const s=lt(n,o,e);ut(e.index,s.length,"insert");const i=dt(t(r.props)&&"string"==typeof r.props.id&&r.props.id?r:{...r,props:{...r.props,id:Z(r.type)}},o),p=it(n,o);for(const t of ct(i,o))if(p.has(t))throw new W("duplicate-id",`insert: ${t} is already in the document`);return pt(n,o,e,t=>[...t.slice(0,e.index),i,...t.slice(e.index)])}function $t(t,n,o){const e=at(t,n,o);let r=pt(t,n,e.place,t=>[...t.slice(0,e.place.index),...t.slice(e.place.index+1)]);if(r.zones&&Object.keys(r.zones).length){const t=ct(e.node,n),o=Object.keys(r.zones).filter(n=>!t.has(n.split(":")[0]));o.length!==Object.keys(r.zones).length&&(r={...r,zones:wt(r.zones,o)})}return r}function Ot(t,n,o,e){const r=at(t,n,o);if(ct(r.node,n).has(e.parentId))throw new W("cycle",`move: ${o} cannot go inside itself`);if(r.place.parentId===e.parentId&&r.place.slot===e.slot){const o=lt(t,n,e);return ut(e.index,o.length-1,"move"),e.index===r.place.index?t:pt(t,n,e,t=>{const n=[...t],[o]=n.splice(r.place.index,1);return n.splice(e.index,0,o),n})}ut(e.index,lt(t,n,e).length,"move");const s=pt(t,n,r.place,t=>[...t.slice(0,r.place.index),...t.slice(r.place.index+1)]);return pt(s,n,e,t=>[...t.slice(0,e.index),r.node,...t.slice(e.index)])}function kt(t,n,o,e={}){const r=at(t,n,o),s=xt(bt(r.node),n,e.strip,e.id);return pt(t,n,r.place,t=>[...t.slice(0,r.place.index+1),s,...t.slice(r.place.index+1)])}function At(t,n,o={}){return xt(bt(t),n,o.strip,o.id)}function xt(t,n,o,e){let p={...t,props:{...t.props,id:e??Z(t.type)}};if(o){const t=o(p);if(t.props.id!==p.props.id)throw new W("id-change","duplicate: strip must not change the id");p=t}let f=p.props;for(const t of r(f,i(n,p.type))){if(!t.present)continue;const e=t.content.map(t=>c(t)?xt(t,n,o):t);f=s(f,t.segments,e)}return dt({...p,props:f},n)}function zt(t,n,o,e){if("id"in e&&e.id!==o)throw new W("id-change",`setProps: ${o} cannot become ${String(e.id)}`);const r=at(t,n,o);return Ft(r.node.props,e)?ft(t,n,r,t=>dt({...t,props:{...t.props,...e,id:o}},n)):t}function It(t,n,o,e){if(!c(e))throw new W("unknown-type","replaceNode: not a node");if(e.props.id!==o)throw new W("id-change",`replaceNode: ${o} cannot become ${String(e.props.id)}`);const r=at(t,n,o),s=dt(e,n),i=it(t,n);for(const t of ct(r.node,n))i.delete(t);for(const t of ct(s,n))if(i.has(t))throw new W("duplicate-id",`replaceNode: ${t} is already in the document`);return ft(t,n,r,()=>s)}function St(t,n,o){const e=nt(t);if(!Ft(e,o))return t;const r=yt({...t.root,props:{...e,...o}},n);return{...t,root:r}}function Ft(t,n){return Object.keys(n).some(o=>!(o in t)||!Object.is(t[o],n[o]))}export{W as DataError,Y as ROOT_ID,H as ROOT_LIST,q as ROOT_SLOT,N as applyTranslation,l as changedProps,bt as clone,At as copyNode,X as copyTranslation,vt as createNode,f as createResolveCache,a as deepEqual,kt as duplicate,R as extractTranslation,rt as find,st as getList,jt as insert,T as mapIds,Ot as move,Z as newId,gt as normalizeData,Q as parseZoneKey,P as pruneTranslation,B as rebaseTranslation,$t as remove,It as replaceNode,u as resolveNodeData,zt as setProps,St as setRoot,_ as slotsOf,I as translatablePaths,h as translationFingerprint,D as translationStatus,ot as walk,L as zoneKey};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var t=/* @__PURE__ */new Set(["button","checkbox","color","file","hidden","image","radio","range","reset","submit"]);function e(e){const n=e;if(!n||"string"!=typeof n.tagName)return!1;const o=n.tagName.toUpperCase();if("TEXTAREA"===o||"SELECT"===o)return!0;if("INPUT"===o)return!t.has(String(n.type??"text").toLowerCase());if(n.isContentEditable)return!0;const i=n.closest?.("[contenteditable]");return!(!i||"false"===i.getAttribute("contenteditable"))||null!=n.closest?.('[role="textbox"]')}var n="data-easel-block";function o(t,e=n){const o=t;return o&&"function"==typeof o.closest?o.closest(`[${e}]`)?.getAttribute(e)??null:null}function i(t){const e=t.getBoundingClientRect();if(e.width>0&&e.height>0)return{left:e.left,top:e.top,width:e.width,height:e.height};let n=1/0,o=1/0,r=-1/0,c=-1/0;for(const e of Array.from(t.children)){const t=i(e);t.width<=0||t.height<=0||(n=Math.min(n,t.left),o=Math.min(o,t.top),r=Math.max(r,t.left+t.width),c=Math.max(c,t.top+t.height))}return n===1/0?{left:e.left,top:e.top,width:e.width,height:e.height}:{left:n,top:o,width:r-n,height:c-o}}function r(t,e){return t===e||t.contains(e)||e.contains(t)}var c=4;function h(t){const e=t.offsetWidth;if(!e)return 1;const n=t.getBoundingClientRect().width;return n>0?n/e:1}function l(t,e,n){const o=t.getBoundingClientRect(),i=n?.getBoundingClientRect()??{left:0,top:0},r=h(t);return{left:o.left-i.left+e.left*r,top:o.top-i.top+e.top*r,width:e.width*r,height:e.height*r}}function f(t){const e=t.offsetWidth;if(!e)return 1;const n=t.getBoundingClientRect().width;return n>0?n/e:1}function u(t,e,n){const o=l(t,e,n),i=f(n);return{left:o.left/i,top:o.top/i,width:o.width/i,height:o.height/i}}function s(t,e,n){const o=t.getBoundingClientRect(),i=f(t);return{x:(e-o.left)/i,y:(n-o.top)/i}}function a(t,e,n,o){const{left:i,top:r}=l(t,{left:e,top:n,width:0,height:0},o);return{x:i,y:r}}function d({available:t,width:e,maxScale:n=1}){const o=Math.max(0,t);if(!e||e<=0)return{width:o,scale:1,shownWidth:o};const i=o>0?Math.min(o/e,n):1;return{width:e,scale:i,shownWidth:e*i}}var g="data-es-canvas-style",p=/* @__PURE__ */new WeakMap;function w(t,e){e?p.set(t,e):p.delete(t)}function m(t,e,n){const o=t.head??t.documentElement;let i=x(t,e);if(!i){i=t.createElement("style"),i.setAttribute(g,e);const n=p.get(t);n&&i.setAttribute("nonce",n),o.appendChild(i)}return i.textContent!==n&&(i.textContent=n),i}function b(t,e){x(t,e)?.remove()}function x(t,e){for(const n of Array.from(t.querySelectorAll(`style[${g}]`)))if(n.getAttribute(g)===e)return n;return null}export{n as BLOCK_ATTRIBUTE,c as WORDS_CLEAR,s as clientPointToLayer,i as drawnBox,f as elementScale,d as fitCanvas,a as framePointToHost,l as frameRectToHost,u as frameRectToLayer,h as frameScale,e as isTypingTarget,o as nodeIdAt,r as related,b as removeCanvasStyle,w as setCanvasNonce,m as upsertCanvasStyle};
|
|
@@ -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-53ME3GAI.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 @@
|
|
|
1
|
+
function e(e,n){const a=e.categories??{},o=e.components,s=[],c=/* @__PURE__ */new Map,r=/* @__PURE__ */new Set;for(const e of n.presets??[])r.has(e.key)||o[e.key]||(r.add(e.key),c.set(e.cat,[...c.get(e.cat)??[],e]));const i=(a,o)=>({type:a.key,cat:o,catLabel:t(e,o,n.categoryLabel),name:a.label,desc:a.desc??"",...a.alias?{alias:a.alias}:{},preset:a});for(const[r,l]of Object.entries(a)){if(!1===l?.visible)continue;const a=c.get(r)??[],f=/* @__PURE__ */new Set;for(const c of l?.components??[]){const l=o[c];if(!l)continue;const u=l.label??c,p=n.labelAtLevel(c,"section",u);s.push({type:c,cat:r,catLabel:t(e,r,n.categoryLabel),name:p,desc:n.descriptions[c]??"",...p===u?{}:{alias:u}});for(const e of a)e.after!==c||f.has(e)||(f.add(e),s.push(i(e,r)))}for(const e of a)f.has(e)||s.push(i(e,r))}return s}function t(e,t,n){return n(t)??e.categories?.[t]?.title??t}function n(e,t){return!t||`${e.name} ${e.alias??""} ${e.desc} ${e.type} ${e.catLabel}`.toLowerCase().includes(t)}function a(e,t){return e.find(e=>e.type===t)??null}function o(e,t){return e.filter(e=>e.type!==t)}export{e as buildPaletteSections,t as categoryLabel,n as matchesQuery,o as paletteWithoutPinned,a as pinnedSection};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useEaselSession as e}from"./chunk-YM4UEGBV.js";import{useHostEscape as n}from"./chunk-LX23TCTP.js";import{DEFAULT_SCREEN_WORDS as t}from"./chunk-S6YOIRXQ.js";import{styleMenuItems as o}from"./chunk-CWELHADJ.js";import{ROOT_ZONE as l}from"./chunk-TCAAOYQY.js";import{repeatCopyAt as r}from"./chunk-LUG22U5L.js";import{easelMenuEntries as i,menuLabel as c}from"./chunk-FIVU2COQ.js";import{createNodeClipboard as s,nodeMenuItems as a}from"./chunk-P5VYGWYO.js";import{DEFAULT_NODE_MENU_WORDS as u}from"./chunk-WK3AFPXY.js";import{zoneKey as d,ROOT_SLOT as p,ROOT_ID as f}from"./chunk-EUFDQ4KL.js";import{useCanvasEvent as m}from"./chunk-TOKMFZPB.js";import{isTypingTarget as y,framePointToHost as h}from"./chunk-FR7EEKFF.js";import{useState as k,useCallback as b,useRef as v,useEffect as x}from"react";import{ContextMenu as g}from"efficient-shell/ui";import{TrashIcon as w,AddIcon as C,MoveUpIcon as O,MoveDownIcon as z,UndoIcon as P,RedoIcon as A,PasteIcon as j,StylesIcon as E,LayersIcon as D,CopyIcon as K}from"efficient-shell/icons/efficient";import{jsx as L}from"react/jsx-runtime";function M(e,n){const t=[],o=/* @__PURE__ */new Set;let r={zone:n.zone,index:n.index};for(;r;){const n=e.nodeAt(r.zone,r.index);if(!n||o.has(n.props.id))break;if(o.add(n.props.id),t.push({zone:r.zone,index:r.index,node:n,parentType:null}),r.zone===l)break;const i=r.zone.lastIndexOf(":");if(i<=0)break;r=e.locate(r.zone.slice(0,i))}for(let e=0;e<t.length-1;e+=1)t[e].parentType=t[e+1].node.type;return t}var T=s(),I=/* @__PURE__ */new WeakMap;function Y(e){if(e.claimsPage)return T;const n=e.registry;if(!n)return e.cache("easel:node-clipboard",s);let t=I.get(n);return t||(t=s(),I.set(n,t)),t}function S(){return Y(e())}function X(e,n,t){if(n===l){const{floor:n,cap:o}=e.sectionBand();return{parentId:f,slot:p,index:Math.min(Math.max(t,n),o)}}const o=n.lastIndexOf(":");return{parentId:n.slice(0,o),slot:n.slice(o+1),index:t}}function F(e,n,t){const o=e.isPinned(n,t),l=!o&&!e.isLocked(n)&&!e.duplicateBlocked(n),r=e.permits?.(n)??{duplicate:!0,delete:!0};return{copy:!o&&r.duplicate,cut:l&&r.duplicate&&r.delete,delete:l&&r.delete}}function R(e,n,t){const o=e.canPasteAt;if(!o)return d(n.from)===t.zone?X(e,t.zone,t.index+1):null;for(const l of M(e,t)){const t=X(e,l.zone,l.index+1);if(o(n,t))return t}return null}function U(e){if(e.defaultPrevented||e.altKey||e.shiftKey)return null;if(y(e.target))return null;const n=e.target,t=n&&"ownerDocument"in n?n.ownerDocument??n:null,o=t?.getSelection?.();if(o&&!o.isCollapsed&&o.toString().trim())return null;if(!e.metaKey&&!e.ctrlKey)return"Delete"===e.key?"delete":null;const l=e.code||(1===e.key.length?`Key${e.key.toUpperCase()}`:"");return"KeyC"===l?"copy":"KeyX"===l?"cut":"KeyV"===l?"paste":null}function B(e,n,t,o){const l=e.nodeAt(t.zone,t.index);if(!l)return null;const r=l.props.id,i=e.labelOf(l.type,t.zone),c=F(e,l,t.zone);if("copy"===n)return c.copy?(e.nodeOps.copy(r,i),{done:"copied",name:i}):null;if(o.readOnly)return null;if("cut"===n)return c.cut?(e.nodeOps.cut(r,i),{done:"cut",name:i}):null;if("delete"===n)return c.delete?(e.nodeOps.remove(r),{done:"deleted",name:i}):null;const s=o.held;if(!s)return null;const a=e.isPinned(l,t.zone)?null:R(e,s,t);return a?(e.nodeOps.paste(a),{done:"pasted",name:s.label}):(e.onPasteRefused(s),{done:"refused",name:s.label})}function V(e,n){const{zone:t,index:r}=n,i=e.nodeAt(t,r);if(!i)return[];const c=i.props.id,s=e.labelOf(i.type,t),u=Boolean(i.props._hidden),d=e.nodeOps,p=e.isPinned(i,t),f=e.isLocked(i),m=!p&&!f&&!e.duplicateBlocked(i),y=e.permits?.(i)??{duplicate:!0,delete:!0},h=F(e,i,t),k=M(e,n),b=d.held,v=b&&!p?R(e,b,n):null,x=!e.readOnly,g=e.style?o({held:x?e.style.held():null,canCopy:e.style.canCopy(i,t),onCopy:()=>e.style?.copy(i,t),onPaste:()=>e.style?.paste(t,r,i),words:e.words?.styleClipboard}):[];return a({title:s,words:e.words?.menu,layer:{group:"pick",items:k.flatMap((n,t)=>{const o={label:e.rowNameOf(n.node,n.zone),checked:0===t,onClick:()=>e.selectAt(n.zone,n.index,n.node.props.id,n.parentType)},r=n.zone===l?null:e.slotRung?.(n.zone)??null;return r?[o,{label:r.label,checked:!1,onClick:r.select}]:[o]})},actions:{duplicate:x&&m&&y.duplicate?()=>d.duplicate(c):void 0,...W(x&&!p,e=>d.canStep(c,e),e=>d.step(c,e)),copy:h.copy?()=>d.copy(c,s):void 0,cut:x&&h.cut?()=>d.cut(c,s):void 0,paste:x&&b&&v?{label:b.label,run:()=>d.paste(v)}:void 0,rename:x&&e.renamePropOf(i,t)?()=>e.beginRename(t,r):void 0,hide:!x||f||p?void 0:{hidden:u,run:()=>d.setProps(c,{_hidden:!u})},delete:x&&m&&y.delete?()=>d.remove(c):void 0},style:g,extras:Q(x?N(e,n.copy):null,e.menuRows?.(i,t,r)),pinnedLine:p?G(e).pinned:void 0})}function N(e,n){const o=e.copyItem;if(!o||!n)return null;const l=G(e),r=t.menu,i=e=>l[e]??r[e]??"",c={ownerId:n.ownerId,slot:n.slot,index:n.index,...n.outer?{outer:n.outer}:{}},s=e=>()=>o({...c,action:e});return{make:[{label:i("itemAddAfter"),icon:/* @__PURE__ */L(C,{}),onClick:s("addAfter")},{label:i("itemMoveEarlier"),icon:/* @__PURE__ */L(O,{}),onClick:s("moveEarlier"),disabled:n.index<=0},{label:i("itemMoveLater"),icon:/* @__PURE__ */L(z,{}),onClick:s("moveLater"),disabled:n.index>=n.count-1}],remove:[{label:i("itemDelete"),icon:/* @__PURE__ */L(w,{}),danger:!0,onClick:s("delete")}]}}function Q(e,n){if(!e)return n??void 0;if(!n)return e;return Object.fromEntries(["pick","make","change","remove"].map(t=>[t,[...e[t]??[],...n[t]??[]]]).filter(([,e])=>e.length>0))}function W(e,n,t){return e?{moveUp:n(-1)?()=>t(-1):null,moveDown:n(1)?()=>t(1):null}:{}}var G=e=>e.words?.screen??t.menu;function Z(e){const n=G(e),o=!e.readOnly,r=[];o&&e.history.hasPast&&r.push({label:n.undo,icon:/* @__PURE__ */L(P,{}),shortcut:"⌘Z",onClick:e.history.back}),o&&e.history.hasFuture&&r.push({label:n.redo,icon:/* @__PURE__ */L(A,{}),shortcut:"⇧⌘Z",onClick:e.history.forward});const i=[],c=e.nodeOps.held,s=X(e,l,e.sectionBand().cap);if(o&&c&&(e.canPasteAt?e.canPasteAt(c,s):d(c.from)===l)){const n=s,t=e.words?.menu??u;i.push({label:t.pasteNamed({paste:t.paste,label:c.label}),icon:/* @__PURE__ */L(j,{}),shortcut:"⌘V",onClick:()=>e.nodeOps.paste(n)})}const a=[r,i,[...e.openPageStyles?[{label:e.pageStylesLabel??t.pageStyles,icon:/* @__PURE__ */L(E,{}),onClick:e.openPageStyles}]:[],{label:n.collapseAll,icon:/* @__PURE__ */L(D,{}),onClick:e.collapseAll}]].filter(e=>e.length>0),p={label:"—",onClick:()=>{}};return a.flatMap((e,n)=>n?[p,...e]:e)}function _(e,n){const t=n.selectionStart??0,o=n.selectionEnd??0,l=n.value.slice(t,o),r=e=>{n.focus(),n.setRangeText(e,t,o,"end"),n.dispatchEvent(new Event("input",{bubbles:!0}))},i=e.words?.menu??u,c=G(e),s=[];l&&(s.push({label:i.copy,icon:/* @__PURE__ */L(K,{}),shortcut:"⌘C",onClick:()=>navigator.clipboard?.writeText(l)}),s.push({label:i.cut,icon:/* @__PURE__ */L(K,{}),shortcut:"⌘X",onClick:()=>{navigator.clipboard?.writeText(l),r("")}})),s.push({label:i.paste,icon:/* @__PURE__ */L(j,{}),shortcut:"⌘V",onClick:()=>{navigator.clipboard?.readText().then(e=>{e&&r(e)}).catch(()=>e.onPasteRefused())}});const a=[s,n.value?[{label:c.selectAll,shortcut:"⌘A",onClick:()=>{n.focus(),n.select()}}]:[]].filter(e=>e.length>0),d={label:"—",onClick:()=>{}};return a.flatMap((e,n)=>n?[d,...e]:e)}function H(e){return e.shiftKey}function J(e,t){const[o,l]=k(null),i=b(()=>l(null),[]);n(null!==o,i);const c=v(e);c.current=e;const s=b(e=>{const n=c.current,t=n.keys;if(!t)return;const o=U(e);if(!o)return;const l=t.selected();if(!l)return;const r=B(n,o,l,{readOnly:t.readOnly,held:t.held()});r&&(e.preventDefault(),t.onDone?.(r))},[]),a=e.keys?.target??null;x(()=>{if(!a)return;const e=e=>s(e);return a.addEventListener("keydown",e),()=>a.removeEventListener("keydown",e)},[a,s]),m(t,"keydown",s);const u=b(n=>{if(H(n))return;const t=n.target;if(t?.closest?.("[data-slot-zone]"))return n.preventDefault(),void l(null);const o=function(e){const n=e?.closest?.("input, textarea");return n&&("INPUT"!==n.tagName||["text","search","url","email","tel","number",""].includes(n.type))?n:null}(t);if(o)return n.preventDefault(),void l({kind:"input",x:n.clientX,y:n.clientY,el:o,owner:t});const r=t?.closest?.("[data-node-id]")?.getAttribute("data-node-id"),i=r?e.locate(r):null;n.preventDefault(),l(i?{kind:"node",x:n.clientX,y:n.clientY,...i,owner:t}:{kind:"empty",x:n.clientX,y:n.clientY,owner:t})},[e]);m(t,"contextmenu",n=>{if(H(n)||!t)return;const o=n.target?.closest?.("[data-easel-block]")??null,i=o?.getAttribute("data-easel-block"),c=i?e.locate(i):null;n.preventDefault();const s=h(t.frame,n.clientX,n.clientY),a=t.frame,u=o?r(o):null;l(c?{kind:"node",...s,...c,copy:u,owner:a}:{kind:"empty",...s,owner:a})}),m(t,"mousedown",i),m(t,"scroll",i,{on:"window"});return{onEditorContextMenu:u,menu:o?/* @__PURE__ */L($,{host:e,target:o,onClose:i}):null,closeMenu:i}}function $({host:e,target:n,onClose:t}){const o="node"===n.kind?V(e,n):"input"===n.kind?_(e,n.el):Z(e);return 0===o.length?null:/* @__PURE__ */L(g,{at:{x:n.x,y:n.y},owner:n.owner??null,onClose:t,"aria-label":c(o),items:i(o)})}export{T as EASEL_NODE_CLIPBOARD,M as ancestorChain,Y as nodeClipboardOf,F as nodeClipboardRules,V as nodeMenuItems,U as nodeShortcut,Z as pageMenuItems,R as pastePlace,B as runNodeShortcut,_ as textMenuItems,S as useNodeClipboard,J as useNodeContextMenu};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{PAGE_CONFLICT_CODE as e,readEaselFailure as r}from"./chunk-
|
|
1
|
+
import{PAGE_CONFLICT_CODE as e,readEaselFailure as r}from"./chunk-KO47WAWR.js";import{createEditLock as o}from"./chunk-YYD257TD.js";var c=o({readFailure:r,conflictCode:e});function i(i){return i.hostFailures?i.cache("easel:edit-lock",()=>o({readFailure:e=>r(e,i),conflictCode:e})):c}export{i as editLockOf,c as pageEditLock};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{DESIGN_GROUP_KEY as t,BUCKET_KEY as o}from"./chunk-3QB2ZQXK.js";import{panelFieldsOf as n}from"./chunk-5XL2RXFU.js";import{withoutDeviceGate as e}from"./chunk-OXOUGEAT.js";import{STYLE_KIND as r,fieldKind as s,copyStyle as c,heldStyle as i,planPaste as p,pasteMessage as u}from"./chunk-CWELHADJ.js";import{ANCHOR_FIELD_KEYS as f,foldMetaOf as a,MEDIA_FIELD_MARKER as l,TEXT_FIELD_MARKER as m,LINK_FIELD_MARKER as h}from"./chunk-ANPOR6EY.js";import{deviceMetaOf as y}from"./chunk-YCSZAP7T.js";var j=/* @__PURE__ */new Set([t.Size,t.Design,t.Layout,t.Position]),w=new Set(Object.values(t)),b=new Set(Object.values(o)),S=new Set(f),k=/* @__PURE__ */new Set(["focal","imageFocal"]),g=[l,m,h];function A(t){return`site:${t??""}`}function O(t){if(!t||"object"!=typeof t)return null;const o=t,n=e(t)??t,c=o[r]??n[r];if("string"==typeof c)return c;const i=o.options??n.options;if(Array.isArray(i)){return`choice:${i.map(t=>String(t?.value)).sort().join("|")}`}return s(n)}function v(t){const o=t,n=e(t);return g.some(t=>t in o||n&&t in n)}function L(t,e){const r=n(t,e)??{},s=[];let c=!0,i=!1;for(const[t,n]of Object.entries(r))b.has(t)?(c=t===o.Design,i=!1):w.has(t)?c&&(i=j.has(t)):i&&n&&"object"==typeof n&&!t.startsWith("_")&&(a(n)||S.has(t)||k.has(t)||v(n)||"slot"!==n.type&&s.push({path:[t],kind:O(n),counted:"mobile"!==y(n)?.tier}));return s}function X(t,o,n,e,r){c({scope:n,type:e.type,label:r,rows:t(o,e),props:e.props})}function d(t,o,n,e,r,s){const c=i(n);if(!c)return null;const f=p(c,{type:e.type,rows:t(o,e),props:e.props});return{...f,message:u(f,c.sourceLabel,r,s)}}function D(t,o,n,e){X(L,t,o,n,e)}function E(t,o,n,e,r){return d(L,t,o,n,e,r)}var P={scope:t=>A(t.siteId),rows:(t,o)=>L(t,o),copy:(t,o,n,e)=>D(e,t,o,n),plan:(t,o,n,e)=>E(e,t,o,n)};function C(t,o){if(!t&&!o)return P;const n=t?.rows,e=n?(t,o)=>n(t,o):L;return{scope:t?.scope??P.scope,rows:(t,o)=>e(t,o),copy:t?.copy??((t,o,n,r)=>X(e,r,t,o,n)),plan:t?.plan??((t,n,r,s)=>d(e,s,t,n,r,o))}}export{D as copyNodeStyle,L as nodeStyleRows,E as planNodePaste,O as shopFieldKind,A as siteStyleScope,C as styleClipboardOf};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{mediaPickStoreFor as e}from"./chunk-NCXYC7WI.js";import{newId as t}from"./chunk-EUFDQ4KL.js";var o=/* @__PURE__ */new Map;function i(i,n){if(!i.connected)return Promise.resolve(null);const r=t("mp"),c=e(i);return c?c.request({requestId:r,accept:n.accept,title:n.title,file:n.file??null,...n.options?{options:n.options}:{}}):new Promise(e=>{o.set(r,e),i.send("storefront-editor:open-media-picker",{requestId:r,accept:n.accept,title:n.title,...n.file?{file:n.file}:{}})})}function n(e,t){const i=o.get(e);i&&(o.delete(e),i(t))}export{i as requestMediaPick,n as resolveMediaPick};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{changedProps as e}from"./chunk-
|
|
1
|
+
import{changedProps as e}from"./chunk-EUFDQ4KL.js";import{useState as t,useRef as r,useEffect as n}from"react";function i({id:i,node:l,block:d,parent:o=null,appState:a=null}){const u=d?.fields??{},[s,c]=t(()=>({id:i,fields:u,loading:!1})),p=r(null),f=r(null),g=r({parent:o,appState:a,id:i});return g.current={parent:o,appState:a,id:i},n(()=>{if(!l||!d)return;const t=f.current!==i;f.current=i;let r=s.fields;t&&(r=u,p.current=null,c({id:i,fields:u,loading:!1}));const n=d.resolveFields;if(!n)return void(t||c(e=>({...e,fields:u})));let o=!1;const a=p.current&&(p.current.props?.id??"root")===(l.props?.id??"root")?p.current:null,m=setTimeout(()=>{o||c(e=>e.id===i?{...e,loading:!0}:e)},50);return Promise.resolve(n(l,{changed:e(l,a),fields:u,lastFields:r,lastData:a,appState:g.current.appState,parent:g.current.parent})).then(e=>{clearTimeout(m),o||g.current.id!==i||(p.current=l,c({id:i,fields:e,loading:!1}))}),()=>{o=!0,clearTimeout(m)}},[i,l,d]),s.id===i?{fields:s.fields,loading:s.loading}:{fields:u,loading:!1}}export{i as useResolvedFields};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{readHostFailure as e,isBackendError as n,STATUS_UNREACHABLE as s}from"./chunk-KCOBHPN6.js";import{EDIT_LOCK_TAKEN as t}from"./chunk-
|
|
1
|
+
import{readHostFailure as e,isBackendError as n,STATUS_UNREACHABLE as s}from"./chunk-KCOBHPN6.js";import{EDIT_LOCK_TAKEN as t}from"./chunk-YYD257TD.js";var a="page_changed_elsewhere",d={unauthorized:401,"changed-elsewhere":409,"lock-taken":409,"not-found":404,invalid:400,unavailable:s};function o(s,o){const c=e(s,o);if(c)return{status:c.status,data:c.data};if(!n(s))return null;const u=e(s.cause,o);if(u)return{status:u.status,data:u.data};const r=d[s.kind];return"changed-elsewhere"===s.kind?{status:r,data:{code:a,saved_by:s.conflict?.savedBy??"",saved_by_you:!0===s.conflict?.savedByYou,seconds_ago:s.conflict?.secondsAgo??0}}:"lock-taken"===s.kind?{status:r,data:{code:t,holder_name:s.holder?.name??"",seconds_since_seen:s.holder?.secondsSinceSeen??0,seconds_since_held:s.holder?.secondsSinceHeld??0}}:{status:r,data:null}}function c(e,n){return 401===o(e,n)?.status}export{a as PAGE_CONFLICT_CODE,c as isExpiredSession,o as readEaselFailure};
|
|
@@ -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-H6BER2EU.js";import{scrollPreviewToSection as l,gotoPreviewSlide as s}from"./chunk-LUOY3A3Q.js";import{useEaselKeyTarget as d,useEaselUndoKeys as a,useEaselSaveKey as c,editorRootFocus as p}from"./chunk-FYV6GZXP.js";import{SlotChildActionsProvider as u}from"./chunk-KCBEE2MC.js";import{screenStorageKeys as f,DEFAULT_PANEL_W as h,clampPanelWidth as m}from"./chunk-6EDVZBUO.js";import{usePartBridge as g}from"./chunk-ZLOMH2PD.js";import{useSectionOps as y}from"./chunk-M4THI4OO.js";import{PageEditGuardNotices as v}from"./chunk-62UGN7VM.js";import{ScreenSaveIcon as b,ScreenMainButton as k}from"./chunk-PVBDKBJB.js";import{useBrowserOffline as S}from"./chunk-RKTF5XLP.js";import{useScreenDocument as w}from"./chunk-ERB6FAZT.js";import{requestMediaPick as x}from"./chunk-JIP5JNRB.js";import{AddChildRow as z}from"./chunk-5545A3PC.js";import{AddSidePanel as C}from"./chunk-VIUES5R6.js";import{keepsSharedSections as O,sharedSectionsOf as I}from"./chunk-N3MJOHAG.js";import{PanelHideButton as B,SidePanelHead as N,PanelShowStrip as P}from"./chunk-SBVIW3KJ.js";import{offeredChoices as M}from"./chunk-RUQOIQWI.js";import{useScreenSaveSwitch as $,useScreenNodeKeys as T,useScreenPinned as E,useScreenDocumentLabel as j,useScreenCanvasFrame as A,useScreenInspectorPanel as L,useScreenDevices as R,useScreenPickFollowsSelection as F,useScreenLeftView as D,SELECTION_MODE as V,isSelectionMode as W,sameInspectorMode as H,useScreenBridges as U,useScreenBlockRules as Y,useScreenBlockLook as J,useScreenStorageNamespace as X,useScreenNotify as G,useScreenCanvasHead as K,isSlotMode as Q,useScreenStyleClipboard as Z,useScreenDocumentPass as _,useScreenCanvasDrag as q,ScreenCanvasTargetProvider as ee,isPinnedFirst as ne,isPinnedLast as te,screenSlotsOf as oe,shownChildSlotsOf as re}from"./chunk-4OMAA45Q.js";import{MediaPopup as ie}from"./chunk-T2RINM7R.js";import{useMediaPanel as le,usePanelPick as se,useMediaBrowsing as de,useOpenMediaBrowse as ae,useMediaPlace as ce}from"./chunk-NCXYC7WI.js";import{useNodeClipboard as pe,useNodeContextMenu as ue}from"./chunk-GEPSJJWW.js";import{useEaselSession as fe}from"./chunk-YM4UEGBV.js";import{useEaselHost as he,useHostEscape as me}from"./chunk-LX23TCTP.js";import{LayersIcon as ge,MediaIcon as ye}from"./chunk-XFYFKITX.js";import{DEFAULT_SCREEN_WORDS as ve}from"./chunk-S6YOIRXQ.js";import{heldStyle as be,styleShortcut as ke}from"./chunk-CWELHADJ.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as Se}from"./chunk-6WY6ZXJG.js";import{rootRowName as we,slotChildRowName as xe,slotChildRenameProp as ze,sectionRenameProp as Ce}from"./chunk-5NHQ452C.js";import{ROOT_ZONE as Oe,blockNodeActions as Ie,TREE_MAX_DEPTH as Be,childSlotsOf as Ne,slotFieldsOf as Pe,newNodeId as Me,slotChildrenIn as $e,nestsInTree as Te}from"./chunk-TCAAOYQY.js";import{useEasel as Ee,useEaselApi as je,CanvasPartsContext as Ae,partHasOwnBox as Le,CanvasPassThroughContext as Re,CanvasSharedContext as Fe}from"./chunk-53ME3GAI.js";import{TreeRow as De,Subtree as Ve,LayersTree as We,TreeGroupLabel as He,TreeRowAction as Ue,TreeSeam as Ye}from"./chunk-WHS6Y55E.js";import{DEFAULT_TREE_WORDS as Je}from"./chunk-K56YDHYQ.js";import{DEFAULT_NODE_MENU_WORDS as Xe}from"./chunk-WK3AFPXY.js";import{toItemSelector as Ge,useNodeOps as Ke,clickPick as Qe}from"./chunk-QTHQPJWA.js";import{EaselTopBar as Ze,EaselIconButton as _e,TopBarCluster as qe,DeviceSwitch as en,InspectorIconButton as nn,PanelResizeHandle as tn,MAX_PANEL_W as on,MIN_PANEL_W_BY_SIDE as rn,panelWidthVars as ln}from"./chunk-VBEVZZTV.js";import{DEFAULT_NOTICE_WORDS as sn,DEFAULT_CHROME_WORDS as dn}from"./chunk-AJSDWWJW.js";import{holderOf as an,nameOrSomeone as cn}from"./chunk-YYD257TD.js";import{DEFAULT_LOCK_WORDS as pn}from"./chunk-RE4LP46F.js";import{useWords as un}from"./chunk-MFIRYGHW.js";import{insertSeams as fn,CanvasDragLayer as hn,CanvasInsert as mn}from"./chunk-MBEUSPIN.js";import{DEFAULT_DRAG_WORDS as gn}from"./chunk-TQ5Y6S2X.js";import{createDragSession as yn,useTreeDrag as vn,gapToMoveIndex as bn}from"./chunk-3XECMGXX.js";import{ROOT_ID as kn,ROOT_SLOT as Sn,zoneKey as wn,parseZoneKey as xn,find as zn,DataError as Cn}from"./chunk-EUFDQ4KL.js";import{useCanvasFrame as On,LIST_SELECTOR as In,BLOCK_SELECTOR as Bn,useCanvasTyping as Nn,useCanvasEvent as Pn}from"./chunk-TOKMFZPB.js";import{nodeIdAt as Mn,frameRectToHost as $n,BLOCK_ATTRIBUTE as Tn,drawnBox as En}from"./chunk-FR7EEKFF.js";import{queryMainCopy as jn}from"./chunk-7UFKEX72.js";import{useRef as An,useMemo as Ln,useState as Rn,useEffect as Fn,useCallback as Dn,useLayoutEffect as Vn,useContext as Wn,Fragment as Hn,useId as Un}from"react";import{ColoredBadge as Yn,Button as Jn,Tabs as Xn,toast as Gn,readMediaFileDrag as Kn,Tooltip as Qn,groupColors as Zn,Dialog as _n,FormField as qn,Input as et,MEDIA_FILE_DRAG_TYPE as nt}from"efficient-shell/ui";import{UndoIcon as tt,RedoIcon as ot,RefreshIcon as rt,AddIcon as it,TrashIcon as lt,EyeOffIcon as st,EyeIcon as dt,SharedIcon as at,DuplicateIcon as ct}from"efficient-shell/icons/efficient";import{jsx as pt,jsxs as ut,Fragment as ft}from"react/jsx-runtime";var ht="media-file";function mt({name:e,onMake:n,onCancel:t}){const o=un("screen",ve).shared,[r,i]=Rn(e),[l,s]=Rn(!1),d=Un(),a=An(null),c=async()=>{const e=r.trim();if(e&&!l){s(!0);try{await n(e)}finally{s(!1)}}};/* @__PURE__ */
|
|
2
|
+
return pt(_n,{open:!0,size:"sm",title:o.makeShared,description:o.makeSharedHint,onClose:t,initialFocus:a,footer:/* @__PURE__ */ut(ft,{children:[
|
|
3
|
+
/* @__PURE__ */pt(Jn,{variant:"secondary",onClick:t,children:o.cancel}),
|
|
4
|
+
/* @__PURE__ */pt(Jn,{variant:"primary",loading:l,disabled:!r.trim(),onClick:()=>{c()},children:o.makeShared})]}),children:/* @__PURE__ */pt("form",{onSubmit:e=>{e.preventDefault(),c()},children:/* @__PURE__ */pt(qn,{label:o.name,htmlFor:d,children:/* @__PURE__ */pt(et,{id:d,ref:a,value:r,onChange:e=>i(e.target.value)})})})})}var gt=/* @__PURE__ */new WeakSet;function yt(e,n,t){const o=zn(e,n,t);if(!o)return null;const r=o.path.find(e=>"root"!==e.parentId);return r?r.parentId:t}function vt({canvas:e,tabs:n,onSelect:t}){const o=An(null),[r,i]=Rn({}),l=n.map(e=>`${e.id}:${e.below?1:e.above?2:0}`).join("|");return Vn(()=>{const t=e?.document,r=e?.window,l=e?.frame;if(!t||!r||!l||0===n.length)return void i({});let s=0;const d=()=>{s=0;const e=o.current;if(!e)return;const d=$n(l,{left:0,top:0,width:r.innerWidth,height:r.innerHeight},e),a={};for(const o of n){const n=jn(t,`[${Tn}="${r.CSS?.escape?r.CSS.escape(o.id):o.id}"]`),i=n?En(n):null;if(!i||0===i.height){a[o.id]=null;continue}const s=$n(l,{left:i.left,top:i.top,width:i.width,height:i.height},e),c=s.top+s.height;if(c<d.top||s.top>d.top+d.height){a[o.id]=null;continue}const p=!0===o.above&&s.top-4>d.top,u=o.below?c+4:p?s.top-4:Math.max(s.top,d.top)+6;a[o.id]={left:Math.max(s.left,d.left)+(o.above?0:6),top:u,above:p}}i(a)},a=()=>{s||(s=r.requestAnimationFrame(d))};d(),r.addEventListener("scroll",a,!0),r.addEventListener("resize",a);const c=new r.MutationObserver(a);return c.observe(t.body,{childList:!0,subtree:!0,attributes:!0}),()=>{s&&r.cancelAnimationFrame(s),r.removeEventListener("scroll",a,!0),r.removeEventListener("resize",a),c.disconnect()}},[e,l]),/* @__PURE__ */pt("div",{ref:o,className:"es-band-tabs","aria-hidden":"true",children:n.map(e=>{const n=r[e.id];return n?/* @__PURE__ */pt("span",{className:"es-band-tab"+(n.above?" is-above":""),"data-band-tab":e.id,style:{left:n.left,top:n.top},onClick:n=>{n.stopPropagation(),t(e.id)},children:e.reach?
|
|
5
|
+
/* @__PURE__ */pt(Qn,{content:e.reach,children:/* @__PURE__ */ut(Yn,{colorClass:Zn("success","solid"),size:"sm",children:[
|
|
6
|
+
/* @__PURE__ */pt("span",{className:"es-band-tab-mark",children:/* @__PURE__ */pt(at,{size:12})}),e.label]})}):/* @__PURE__ */pt(Yn,{colorClass:Zn("info","solid"),size:"sm",children:e.label})},e.id):null})})}function bt({expand:e}){/* @__PURE__ */
|
|
7
|
+
return pt("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:/* @__PURE__ */ut(ft,e?{children:[
|
|
8
|
+
/* @__PURE__ */pt("path",{d:"M8 9l4-4 4 4"}),
|
|
9
|
+
/* @__PURE__ */pt("path",{d:"M8 15l4 4 4-4"})]}:{children:[
|
|
10
|
+
/* @__PURE__ */pt("path",{d:"M8 4l4 4 4-4"}),
|
|
11
|
+
/* @__PURE__ */pt("path",{d:"M8 20l4-4 4 4"}),
|
|
12
|
+
/* @__PURE__ */pt("path",{d:"M5 12h14"})]})})}var kt=`${In}, ${Bn}`;function St(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 wt="__rungs",xt=e=>"template"===e.kind?e.template.id:"shared"===e.kind?e.section.id:"preset"===e.kind?e.preset.key:e.type;var zt="screen:band",Ct={duplicate:!0,delete:!0},Ot=()=>null;function It(){const In=he(),$n=In.panels?.Toolbar,Tn=(In.panels?.useRight??Ot)(),{target:En,docId:Un,capabilities:Qn,currentSlug:Zn,siteId:_n,onPublish:qn,saveState:et,saveConflict:at,retrySave:It,toggleAutoSave:Bt,flushSave:Nt,access:Pt,saveUnreachable:Mt=!1,readOnly:$t,readOnlyReason:Tt=null}=w(),Et=$(),jt=T(),{mediaEditing:At,hasEditGuard:Lt,hasPinnedChrome:Rt}=Qn,{appState:Ft,dispatch:Dt,history:Vt,selectedItem:Wt,getSelectorForId:Ht,config:Ut}=Ee(e=>e),Yt=E(),{first:Jt,firstGroup:Xt,lastGroup:Gt,isSectionGroup:Kt,sectionGroupZone:Qt,panelOf:Zt}=Yt,_t=Zt(Jt),qt=e=>ne(Yt,e),eo=e=>te(Yt,e),no="node"===Yt.firstRow,to=Yt.band??null,oo=un("screen",ve),ro=un("tree",Je),io=un("drag",gn),lo=un("notice",sn),so=un("lock",pn),ao=un("menu",Xe),co=un("styleClipboard",Se),po=un("chrome",dn),uo=j()??`/${Zn}`,fo=A(),ho=L(),mo=y({readOnly:$t}),go=y({readOnly:$t,foldIntoHistory:!0}),yo=An(null),vo=je(),bo=Ln(()=>({...mo,select:e=>{yo.current=e,mo.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=vo.config;yo.current=Ge(e,t,n)}mo.commitDocument(e,n)}}),[mo,vo]),ko=Ft.ui,So=ko.leftSideBarVisible,wo=ko.rightSideBarVisible,{options:xo,widths:zo,initial:Co,fluid:Oo,fit:Io}=R(),[Bo,No]=Rn(Co),Po=le(),Mo=At&&null!==Po;se(),de();const $o=ae();F(Wt?.props.id);const{read:To,write:Eo,forSelection:jo}=D(),[Ao,Lo]=Rn(To);Fn(()=>{Eo(Ao)},[Ao]);const[Ro,Fo]=Rn(0),Do=An(null),Vo=An(null),Wo=On(Vo,{readySelector:kt}),Ho=Nn(Wo),Uo=d(Vo);a(Vo,Wo);const Yo=S(),Jo=an(Pt),Xo={state:et,offline:Yo||et.failed&&Mt,readOnlyReason:Tt,editing:Jo?lo.editing({name:cn(Jo.name,so),noun:oo.noun}):null,conflict:null!=at,notSaving:oo.bar.notSaving},Go=()=>{$t||(et.failed?It():Nt())};c(Vo,Wo,Go);const[Ko,Qo]=Rn(!1),Zo=An(!1),[_o,qo]=Rn(null),[er,nr]=Rn([]),[tr,or]=Rn(V);W(tr);const rr=e(tr,Wt?.props.id),[ir,lr]=Rn(null);Fn(()=>{ir&&(n(),lr(null))},[ir]);const sr=An(Ht);sr.current=Ht;const dr=Dn((e,{scroll:n})=>{Lo(n=>jo(e,n)),n&&lr(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=sr.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),t.push(e),o=n}0!==t.length&&Rr(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),ar=An(null);Fn(()=>{const e=ar.current;ar.current=null;const n=null==Wt?.props.id?null:String(Wt.props.id);or(t=>e&&e.id===n?e.mode:"part"===t.kind&&"nodeId"in t&&t.nodeId===n?t:Zt(Wt?.type)??V);const o=Wt?.props.id,r=yo.current;if(yo.current=null,!o)return;const i=Ht(o);dr(String(o),{scroll:!t(r,i??null,Oe)})},[Wt?.props.id,dr]);const cr=Dn(e=>{or(n=>H(n,e)?n:e),Dt({type:"setUi",ui:{rightSideBarVisible:!0}})},[Dt]),pr=An(()=>{});pr.current=(e,n)=>{const t=e?Ti(e.zone??Oe)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==Wt?.props.id?null:String(Wt.props.id);or(e=>H(e,n)?e:n),o!==r&&(ar.current={id:o,mode:n},bo.select(e))};const ur=Dn((e,n)=>pr.current(e,n),[]),fr={kind:tr.kind,mode:tr,open:cr,show:e=>or(e),reveal:()=>{wo||Dt({type:"setUi",ui:{rightSideBarVisible:!0}})},select:ur},hr=U(fr,{data:Ft.data,selected:Wt??null,zoneOf:e=>Ht(e)?.zone,readOnly:Boolean($t),select:e=>{or(V),bo.select({index:e})},replace:(e,n)=>bo.replaceComponent(Oe,e,n),scrollTo:e=>l(e)},{device:Bo,refreshes:Ro},{setView:Lo,reveal:()=>{So||Dt({type:"setUi",ui:{leftSideBarVisible:!0}})}}),mr=hr.resolveLeftView?hr.resolveLeftView(Ao):"sections",gr=Y(),{isLockedBlock:yr,duplicateBlocked:vr,nestDepth:br,newSectionNode:kr,canAddTo:Sr,blockIsOffered:wr}=gr,xr=e=>({id:String(e.props.id??""),data:Ft?.data}),zr=J(),{labelAtLevel:Cr,Icon:Or,useProducts:Ir}=zr,Br=zr.rowName?(e,n,t)=>zr.rowName(e,n,t):void 0,Nr=Dn(e=>{Dt({type:"setUi",ui:{rightSideBarVisible:!0}}),l(e),dr(e,{scroll:!0})},[Dt,dr]),{selectNode:Pr,openPartId:Mr}=g({mode:tr,setMode:or,onOpenPart:Nr}),[$r,Tr]=Rn(null);me(null!==$r,()=>Tr(null));const Er=f(X()),jr=Er.collapsed,Ar=Er.panelWidths,[Lr,Rr]=Rn(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(jr);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
|
|
13
|
+
return new Set}});Fn(()=>{try{window.localStorage.setItem(jr,JSON.stringify([...Lr]))}catch{}},[Lr]);const[Fr,Dr]=Rn(()=>{if("undefined"==typeof window)return{...h};try{const e=window.localStorage.getItem(Ar);if(!e)return{...h};const n=JSON.parse(e);return{left:m(Number(n.left)||h.left,"left"),right:m(Number(n.right)||h.right,"right")}}catch{return{...h}}});Fn(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(Ar,JSON.stringify(Fr))}catch{}},300);return()=>clearTimeout(e)},[Fr]);const Vr=Dn((e,n)=>Dr(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),Wr=Dn(e=>Vr("left",e),[Vr]),Hr=Dn(e=>Vr("right",e),[Vr]),Ur=e=>Lr.has(e),Yr=e=>Rr(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),Jr=An(!1),Xr=An(null);Fn(()=>{if(Jr.current&&!Ko){const e=Xr.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??Vo.current?.querySelector(`button[aria-label="${CSS.escape(oo.add.title)}"]`))?.focus(),Xr.current=null}Jr.current=Ko},[Ko]),Fn(()=>{if(!Ko||!Uo)return;const e=e=>{"Escape"===e.key&&ul()};return Uo.addEventListener("keydown",e),()=>Uo.removeEventListener("keydown",e)},[Ko,Uo]),me(Ko,()=>ul()),Fn(()=>{!So&&Ko&&(Qo(!1),qo(null),Zo.current=!1)},[So]);const Gr=G(),Kr=(e,n="success",t)=>{if(Gr)return void(t?Gr(e,"error"===n?"error":"info",t):Gr(e,"error"===n?"error":"info"));const o={sound:!1,action:t?.action,onClose:t?.onClose};"error"===n?Gn.error(e,{...o,duration:t?.duration??3200}):Gn.success(e,{...o,duration:t?.duration??1900})},Qr=An(null),[Zr,_r]=Rn(0),[qr,ei]=Rn(0),ni=K(),ti=An(null),oi=e=>Math.max(0,e.clientHeight-(ti.current?.offsetHeight??0));Fn(()=>{const e=Qr.current;if(!e)return;const n=()=>{_r(e.clientWidth),ei(oi(e))};n();const t=new ResizeObserver(n);return t.observe(e),ti.current&&t.observe(ti.current),()=>t.disconnect()},[]),Vn(()=>{Qr.current&&(_r(Qr.current.clientWidth),ei(oi(Qr.current)))},[Fr,So,wo]);const ri=Bo===Oo?Zr>0?Zr:zo[Oo]:zo[Bo],ii=Zr>0?Math.min(Zr/ri,"shrink"===Io?1:2):1,li=ri*ii,si=Zr>0&&li>Zr+1,di={width:li,height:qr||"100%",flex:"none",position:"relative"},ai={width:ri,height:qr?qr/ii:"100%",maxHeight:"none",transform:1!==ii?`scale(${ii})`:void 0,transformOrigin:"top left"},ci=()=>Dt({type:"setUi",ui:{leftSideBarVisible:!So}}),pi=()=>Dt({type:"setUi",ui:{rightSideBarVisible:!wo}}),ui=e=>{Ko&&(Qo(!1),qo(null),Zo.current=!1,So&&Ao===e)||(Lo(e),So||Dt({type:"setUi",ui:{leftSideBarVisible:!0}}))},fi=()=>{or(_t??V),wo||Dt({type:"setUi",ui:{rightSideBarVisible:!0}})},hi=Ft.data.content??[],mi=()=>{const e=hi.findIndex(qt),n=hi.findIndex(eo);return{floor:e>=0?e+1:0,cap:n>=0?n:hi.length}},gi=Ut,yi=gr.stripCopy,vi=e=>o(e,yi),bi=pe(),ki=Ke({data:Ft.data,config:gi,readOnly:Boolean($t),clipboard:bi,strip:yi?e=>yi(e):void 0,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==kn||e.slot!==Sn)return{min:0,max:n-1};const{floor:t,cap:o}=mi();return{min:t,max:o-1}},commit:(e,{select:n})=>{void 0!==n&&or(V);const t=void 0===n||"node"===n?.kind?n:null;bo.commitDocument(e,t)}}),Si=fe(),[wi,xi]=Rn(null),zi=e=>{const n=hi.find(n=>String(n.props.id)===e),t=Yt.shared;n&&t&&ki.swap(e,t.detach(n))},Ci=e=>{const n=zn(Ft.data,Ut,e);if(!n)return!1;const t=wn(n.place),o=n.node,r=t===Oe?Pi(o):Yi(o),i=t===Oe?Yt.shared?.usedOn(o):null;return!!ki.remove(e)&&(Kr(i?oo.shared.removed({count:Math.max(0,i.length-1)}):oo.deleted({name:r}),"success",{duration:8e3,action:{label:oo.bar.undo,onClick:()=>{ki.restore(n.node,n.place)}}}),!0)},Oi={...ki,remove:Ci},Ii=e=>Cr(e,"block",Ut.components[e]?.label??e),Bi=Dn(e=>Ut.components[e]?.defaultProps??{},[Ut]),Ni=e=>Cr(e,"section",Ii(e)),Pi=e=>we({type:e.type,props:e.props??{}},Ni(e.type),Br),{nodeAddresses:Mi,zoneItems:$i}=Ln(()=>{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>=Be)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of Ne(Ut,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(hi,Oe,0),{nodeAddresses:e,zoneItems:n}},[hi,Ut]),Ti=Dn(e=>$i.get(e)??[],[$i]),Ei=e=>{const n=Mi.get(e);return n?Ti(n.zone)[n.index]:void 0},ji=e=>oe(gr,Ut,e),Ai=e=>{if(!gr.slotsOf||e===Oe)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=Ei(e.slice(0,n));if(!t)return null;const o=ji(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}},Li=(()=>{if(!Q(tr))return null;const e=`${tr.nodeId}:${tr.slot}`;return Ai(e)?.slot.panel===tr.kind?e:null})(),Ri=An(null);Fn(()=>{const e=Ri.current;if(Ri.current=null,!Li||!Q(tr))return;const n=tr.nodeId;dr(n,{scroll:e!==Li}),Rr(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[tr]);const Fi=e=>{const n=Mi.get(e);n&&(n.zone===Oe?il(n.index):$l(n.zone,n.index,e,Ei(n.zone.slice(0,n.zone.lastIndexOf(":")))?.type??""))},Di=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void Fi(o);const r={kind:n.panel,nodeId:o,slot:n.slot},i=`${o}:${n.slot}`;t&&Li!==i&&(Ri.current=i),ur(null,r),wo||Dt({type:"setUi",ui:{rightSideBarVisible:!0}}),l(o)},Vi=(e,n,t)=>{const o=`${e}:${n}`;if(Rr(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;Li!==o&&(Ri.current=o);ur(null,{kind:t,nodeId:e,slot:n})},Wi=(e,n,t)=>{if($t||!gr.moveSlot)return;const o=Ei(e),r=o?ji(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:wt,index:n},s=bn(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=gr.moveSlot(e,n,s);"string"==typeof d&&Vi(e,d,i.panel)},Hi=Ir(),Ui=Ln(()=>{const e=/* @__PURE__ */new Map;for(const n of Hi??[])e.set(n.slug,n.name);return e},[Hi]),Yi=e=>xe(e,Ii,zr.plainText,e=>Ui.get(e),zr.rowName),Ji=(e,n)=>{const t=Ut.components[e.type]?.fields,o=n===Oe||rs(n)?"section":"block",r=n===Oe&&(qt(e)||eo(e)||Kt(e.type)),i="block"===o?ze(t):r?null:Ce(t);return zr.renamePropOf?zr.renamePropOf(e,o,i):i},Xi=(e,n,t,o)=>{if(!(!$t&&$r?.zone===e&&$r.index===n))return;const r=(t,o)=>{Tr(null),o&&((e,n,t)=>{const o=Ti(e)[n];if(!o)return;const r=Ji(o,e);r&&bo.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
|
|
14
|
+
return pt("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":oo.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)},Gi=i(Z(),co),Ki=Gi.scope({target:En,siteId:_n,docId:Un}),Qi=Ut,Zi=(e,n)=>n===Oe?Ni(e):Ii(e),_i=(e,n,t)=>{const o=Gi.plan(Ki,t,Zi(t.type,e),Qi);o&&(o.changed&&bo.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),Kr(o.message))},qi=ue({nodesIn:Ti,nodeAt:(e,n)=>Ti(e)[n]??null,labelOf:(e,n)=>n===Oe?Ni(e):Ii(e),renamePropOf:Ji,beginRename:(e,n)=>Tr({zone:e,index:n}),history:{hasPast:Vt.hasPast,hasFuture:Vt.hasFuture,back:()=>Vt.back(),forward:()=>Vt.forward()},openPageStyles:hr.openPageStyles,pageStylesLabel:oo.pageStyles,words:{menu:ao,styleClipboard:co,screen:oo.menu},readOnly:Boolean($t),collapseAll:()=>Rr(new Set(Ti(Oe).map(e=>String(e.props.id)))),onPasteRefused:e=>Kr(e?oo.pasteRefused({name:e.label}):oo.menu.clipboardRefused,"error"),canPasteAt:(e,n)=>ss(e,n),copyItem:hr.onCopyItem,menuRows:(e,n,t)=>{const o=hr.menuRows?.(e,n,t)??null,r=((e,n)=>{const t=Yt.shared;if(!t||n!==Oe)return null;const o=t.usedOn(e);if(o){const n={pick:[{label:oo.shared.onPages({count:o.length}),onClick:()=>{},children:o.map(e=>({label:e.title,onClick:()=>t.openPage(e)}))}]};return $t||yr(e.type,e)?n:{...n,change:[{label:oo.shared.detach,onClick:()=>zi(e.props.id)}],remove:[{label:oo.shared.removeFromPage,danger:!0,onClick:()=>{Ci(e.props.id)}}]}}return $t||qt(e)||eo(e)||Kt(e.type)?null:O(Si)?{change:[{label:oo.shared.makeShared,onClick:()=>xi({id:e.props.id,name:Pi(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=>yr(e.type,e),duplicateBlocked:e=>vr(Ft.data,e),permits:e=>{const n=Ie(Ut,e.type);return Yt.shared?.usedOn(e)?{...n,delete:!1}:n},nodeOps:Oi,isPinned:(e,n)=>n===Oe&&(qt(e)||eo(e)),sectionBand:mi,locate:e=>Mi.get(e)??null,rowNameOf:(e,n)=>n===Oe?Pi(e):Yi(e),selectAt:(e,n,t,o)=>{e===Oe?il(n):$l(e,n,t,o??"")},slotRung:e=>{const n=Ai(e);return n?.slot.panel?{label:n.slot.label,select:()=>Di(n.node,n.slot,!1)}:null},style:{held:()=>be(Ki),canCopy:e=>Gi.rows(Qi,e).some(e=>!1!==e.counted),copy:(e,n)=>Gi.copy(Ki,e,Zi(e.type,n),Qi),paste:(e,n,t)=>_i(e,n,t)},keys:jt?{target:Uo,selected:()=>{const e=Ft.ui.itemSelector;return e?{zone:e.zone??Oe,index:e.index}:null},held:()=>bi.get(),readOnly:Boolean($t),onDone:({done:e,name:n})=>{"copied"===e&&Kr(oo.copied({name:n}))}}:void 0},Wo),el=An({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});Fn(()=>{el.current={copy:(e,n)=>Gi.copy(Ki,e,Zi(e.type,n),Qi),paste:_i,at:()=>{const e=Ft.ui.itemSelector;if(!e)return null;const n=e.zone??Oe,t=Ti(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean($t)}});const nl=Dn(e=>{const n=ke(e);if(!n)return;const t=el.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))},[]);Fn(()=>{if(!Uo)return;const e=e=>nl(e);return Uo.addEventListener("keydown",e),()=>Uo.removeEventListener("keydown",e)},[nl,Uo]),Pn(Wo,"keydown",nl);const tl=hi.map(e=>e.props.id).join("|");Fn(()=>{const e=Wo?.document??null,n=Wo?.window??null;let t=0;const o=[],r=()=>{if(!e)return void nr(e=>e.length?[]:e);const n=hi.findIndex(eo),t=n>=0?n:hi.length,o=n=>{const t=hi[n]?.props?.id;return null==t?null:jn(e,`[data-easel-block="${CSS.escape(String(t))}"]`)},r=e=>e?[...e.querySelectorAll(Bn)].map(e=>e.getBoundingClientRect()).filter(e=>e.width>0||e.height>0):[],i=[];for(let e=hi.length>0&&!qt(hi[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=St(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})}nr(e=>function(e,n){if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(e[t].top!==n[t].top||e[t].index!==n[t].index||e[t].height!==n[t].height)return!1;return!0}(e,i)?e:i)},i=()=>{cancelAnimationFrame(t),t=requestAnimationFrame(r)};if(!e||!n)return void r();n.addEventListener("scroll",i,{passive:!0});const l=new ResizeObserver(i);return l.observe(e.documentElement),r(),o.push(setTimeout(r,150),setTimeout(r,450)),()=>{cancelAnimationFrame(t),o.forEach(clearTimeout),n.removeEventListener("scroll",i),l.disconnect()}},[Wo,tl,Bo,ii,So,wo,Wt?.props.id]);const ol=Wo?.document??null,rl=Wo?.window??null;Fn(()=>{const e=Do.current;if(!e||!ol||!rl)return;const n=[],t=()=>{const n=jn(ol,`[data-easel-block="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&rl.scrollTo({left:rl.scrollX,top:rl.scrollY+t,behavior:"instant"}),!0};return Do.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[ol,rl]);const il=e=>{or(V),bo.select({index:e}),hr.sectionPressed?.(hi[e]);const n=hi[e]?.props?.id;n&&l(n)},ll=e=>{const{floor:n,cap:t}=mi(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=Wt&&tr.kind!==_t?.kind?hi.findIndex(e=>e.props.id===Wt.props.id):-1;return o(r>=0?r+1:t)},sl=(e,n)=>{const{floor:t,cap:o}=mi(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(bo.reorderComponent(Oe,e,i),bo.select({index:i}),{moved:!0,dest:i})},dl=(e,n,t,o)=>{or(V),bo.select(o?{index:o.index,zone:o.zone}:{index:e}),l(n),Kr(oo.sectionAdded({name:t}))},al=(e,n)=>{const t=ll(n),o=kr(e,{nodeDefaults:Bi,newNodeId:Me,sectionLabel:Ni,blockIsOffered:wr}),r=o?bo.insertNode(Oe,t,o):bo.insertSection(e,t);return dl(t,r,Ni(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 Ne(Ut,e)){if(s.type===t&&(!o.at||n>o.at.depth)){const r=Sr(e.type,l,d.slice(d.lastIndexOf(":")+1),xr(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},cl=e=>pl(Oe,e),pl=(e,n)=>{Xr.current=document.activeElement??null,qo(null===n?null:{zone:e,index:n}),Qo(!0),So||(Zo.current=!0,Dt({type:"setUi",ui:{leftSideBarVisible:!0}}))},ul=()=>{Qo(!1),qo(null),Zo.current&&Dt({type:"setUi",ui:{leftSideBarVisible:!1}}),Zo.current=!1},fl=(e,n)=>zr.rowName?n?qt(e)?zr.rowName(e,"section",oo.header):eo(e)?zr.rowName(e,"section",oo.footer):Kt(e.type)?zr.rowName(e,"section",Ii(e.type)):Pi(e):Yi(e):n?Ni(e.type):Ii(e.type),hl=e=>n=>{e()},ml=(e,n,t)=>{if($t)return null;const o=Ti(e)[n];return o&&!Ie(Ut,o.type).delete||o&&yr(o.type,o)?null:/* @__PURE__ */pt(Ue,{kind:"delete",label:e===Oe&&o&&Yt.shared?.usedOn(o)?oo.shared.removeFromPage:oo.deleteNamed({name:t}),onClick:()=>((e,n)=>{const t=Ti(e)[n]?.props?.id;null!=t&&Ci(String(t))})(e,n),children:/* @__PURE__ */pt(lt,{size:15})})},gl=e=>zr.rowPreview?.(e)||void 0,yl=e=>zr.rowMarks?.(e)??void 0,vl=(e,n,t)=>zr.rowActions?.(e,n,t)??null,bl=(e,n,t,o)=>{if($t)return null;if(yr(t.type,t))return null;const r=Boolean(t.props._hidden);/* @__PURE__ */
|
|
15
|
+
return pt(Ue,{kind:"eye",label:r?oo.showNamed({name:o}):oo.hideNamed({name:o}),onClick:()=>Sl(e,n,t),children:/* @__PURE__ */pt(r?st:dt,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},kl=e=>nd(Oe,e),Sl=(e,n,t)=>{bo.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},wl=e=>Pe(Ut,e),xl=e=>Ne(Ut,e),zl=e=>gr.slotsOf?ji(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:$e(e,n.slot)})):[{slot:null,rung:null,kids:re(Ut,e)}],Cl=e=>gr.slotsOf?zl(e).flatMap(e=>e.kids):re(Ut,e),Ol=e=>Boolean(gr.slotsOf)&&ji(e).some(e=>e.rung),Il=(e,n,t)=>Sr(e.type,n,t??void 0,xr(e)),Bl=(e,n,t)=>{const o=Te(Ut,e.type,n)&&(t||Cl(e).length>0||Ol(e));return{collapsible:o,folded:o&&Ur(String(e.props.id))}},Nl=(e,n,t)=>zl(e).flatMap(o=>{const r=o.rung?n+1:n,i=o.kids.flatMap(({child:e})=>Bl(e,r,t(e.type)).collapsible?[String(e.props.id),...Nl(e,r+1,t)]:[]);return o.rung?[`${e.props.id}:${o.rung.slot}`,...i]:i}),Pl=e=>Cl(e).length>0||Ol(e)||Boolean(Sr(e.type)),Ml=e=>Boolean(Sr(e)),$l=(e,n,t,o)=>{if(or(V),Sr(o)?.spec?.slider){const t=e.split(":")[0];s(t,n),bo.select({index:n,zone:e}),l(t)}else bo.select({index:n,zone:e}),l(t)},Tl=(e,n,t,o,r)=>{const i=`${e}:${n}`;bo.insertComponent(i,t,o),Sr(r)?.spec?.slider?requestAnimationFrame(()=>{s(e,o),bo.select({index:o,zone:i})}):bo.select({index:o,zone:i})},El=An(/* @__PURE__ */new Set);Fn(()=>{hi.forEach(e=>{const n=Sr(e.type)?.spec;if(!n)return;const t=e.props.id;if(El.current.has(t))return;El.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(Bi)).forEach((e,t)=>go.seedChild(o,t,n.childType,e))})},[hi,go,Bi]);const jl=An(/* @__PURE__ */new Set);Fn(()=>{hi.forEach((e,n)=>{const t=e.props.id;if(jl.current.has(t))return;const o=r(e,wl(e.type));jl.current.add(t),o&&go.replaceComponent(Oe,n,{...e,props:o})})},[hi,go]),_(go,Ut);const Al=hi.findIndex(eo),Ll=Al>=0?hi[Al]:null,Rl=no?hi.findIndex(qt):-1,Fl=Rl>=0?hi[Rl]:null,Dl=Yt.groupTab,Vl=Ln(()=>Dl?e=>Kt(e.type):void 0,[Dl]),Wl=Boolean(Yt.groupBadge),Hl=Yt.sharedReach,Ul=e=>Hl?.(e)??void 0,Yl=Ln(()=>Hl?new Set(hi.filter(e=>Ul(e)).map(e=>String(e.props.id))):null,[hi,Hl]),Jl=Ln(()=>Yl?e=>Yl.has(e):void 0,[Yl]),Xl=Yt.first?Hl?.({type:Yt.first,props:{id:""}})??void 0:void 0,Gl=Yt.groupBadge?/* @__PURE__ */pt("span",{className:"es-tree-group-badge",children:/* @__PURE__ */pt(Yn,{tone:"info",size:"xs",children:Yt.groupBadge})}):void 0,Kl=hi.find(e=>e.type===Xt)??null,Ql=hi.find(e=>e.type===Gt)??null,Zl=Al>=0?Al:hi.length,_l=[];hi.forEach(e=>{eo(e)||(Pl(e)&&_l.push(String(e.props.id)),_l.push(...Nl(e,1,Ml)))}),Ll&&(_l.push(String(Ll.props.id)),_l.push(...Nl(Ll,1,Ml)));const ql=_l.length>0&&_l.every(e=>Lr.has(e)),es=e=>{const n=zr.blockRowName(e,Ii);return zr.rowName?zr.rowName(e,"block",n):n},ns=(e,n,t,o)=>{const r=Ti(e)[t];if(!r)return;const i={...xn(e),index:t},l={...xn(n),index:Math.min(Math.max(o,0),Ti(n).length)},s=bn(i,l);if(e!==n||s!==t)try{ki.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof Cn))throw e}},ts=e=>{const n=/* @__PURE__ */new Set,t=e=>{for(const{child:o,zone:r}of xl(e))n.add(r),t(o)};for(const t of wl(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},os=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=Mi.get(n);if(!e)return null;if(e.zone===Oe)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},rs=e=>{const n=e.slice(0,e.indexOf(":")),t=hi.find(e=>Kt(e.type)&&String(e.props.id)===n);return t&&Qt(n)===e?t:null},is=(e,n)=>{const t=rs(e);return!t||(!Yt.groupAccepts||Yt.groupAccepts(t.type,n,Ti(e).length))},ls=(e,n,t)=>{if(e.rung){const t=Ei(e.rung.nodeId),o=t?ji(t).filter(e=>e.rung).length:0;return n.parentId===e.rung.nodeId&&n.slot===wt&&n.index>=0&&n.index<=o}if(n.slot===wt)return!1;if(e.add)return cs(e.add,n);const o=wn(n);if(Kt(e.type))return!1;const r=rs(o),i=rs(e.zone);if(r||i)return!(!r||!i)&&(!(r!==i&&!is(o,e.type))&&(n.index>=0&&n.index<=Ti(o).length));if(e.zone===Oe||o===Oe){if(e.zone!==o)return!1;const{floor:t,cap:r}=mi();return n.index>=t&&n.index<=r}if(n.index<0||n.index>Ti(o).length)return!1;if(e.zone===o)return!0;const l=Ll&&!Yt.lastIsOpen?String(Ll.props.id):null;return(!l||os(e.zone)!==l&&os(o)!==l)&&((e,n,t,o)=>{if(e===n)return!0;const r=o??Ti(e)[t];if(!r)return!1;const i=n.split(":")[0],l=Mi.get(i),s=l?Ti(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&ts(r).has(n))return!1;const d=Sr(s.type,br(Ft?.data,s.type,i),n.slice(n.lastIndexOf(":")+1),xr(s));return!!d&&(!!(d.choices?d.choices.some(e=>e.type===r.type):d.spec?.childType===r.type)&&!d.spec?.addBlocked?.(Ti(n),r))})(e.zone,o,e.index,t)},ss=(e,n)=>{const t=wn(e.from),o=e.node;return t===wn(n)?is(t,o.type):ls({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},ds=e=>{const n=e.slice(0,e.indexOf(":")),t=Mi.get(n),o=t?Ti(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=Sr(o.type,br(Ft?.data,o.type,n),e.slice(e.lastIndexOf(":")+1),xr(o));if(!r||`${n}:${r.slot}`!==e)return null;if("footer"===r.source)return null;const i=M(r.choices??(r.spec?[{type:r.spec.childType,label:Ii(r.spec.childType)}]:[])),l=Ai(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:fl(o,t.zone===Oe)}},as=(e,n)=>{if("section"!==e.kind)return e;const t=wn(n);return t===Oe||rs(t)?e:ds(t)?.choices.some(n=>n.type===e.type)?{kind:"block",type:e.type}:e},cs=(e,n)=>{const t=as(e,n),o=wn(n);if("shared"===t.kind){if(o!==Oe||!Yt.shared?.nodeOf(t.section))return!1;const{floor:e,cap:r}=mi();return n.index>=e&&n.index<=r}if("block"!==t.kind){if(rs(o)){if("preset"===t.kind)return!1;const e="section"===t.kind?t.type:t.template.node.type;return is(o,e)&&n.index>=0&&n.index<=Ti(o).length}if(o!==Oe)return!1;const{floor:e,cap:r}=mi();return n.index>=e&&n.index<=r}if(o===Oe)return!1;const r=ds(o);return!(!r||!r.choices.some(e=>e.type===t.type))&&!r.target.spec?.addBlocked?.(Ti(o))},ps=(e,n)=>{const t=as(e,n);if("block"!==t.kind&&rs(wn(n)))return void((e,n,t)=>{const o="section"===e.kind?e.type:"template"===e.kind?e.template.node.type:null;if(o&&is(n,o)){if("section"===e.kind)bo.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;bo.insertNode(n,t,vi(e.template.node))}or(V),bo.select({index:t,zone:n})}})(t,wn(n),n.index);if("section"===t.kind)return void al(t.type,n.index);if("template"===t.kind)return void((e,n,t)=>{const o=ll(t),r=bo.insertNode(Oe,o,n);dl(o,r,e)})(t.template.name,vi(t.template.node),n.index);if("preset"===t.kind)return void((e,n,t)=>{const o=n({nodeDefaults:Bi,newNodeId:Me,sectionLabel:Ni,blockIsOffered:wr});if(!o)return;const r=ll(t),i=bo.insertNode(Oe,r,o);dl(r,i,e)})(t.preset.label,t.preset.insert,n.index);if("shared"===t.kind){const e=Yt.shared?.nodeOf(t.section);if(!e)return;const o=ll(n.index);return void(ki.restore(e,{parentId:kn,slot:Sn,index:o})&&dl(o,e.props.id,t.section.title))}const o=wn(n),r=ds(o);r&&(r.target.spec?Tl(r.parentId,r.target.slot,t.type,n.index,r.parent.type):((e,n,t)=>{bo.insertComponent(e,n,t),or(V),bo.select({index:t,zone:e})})(o,t.type,n.index))},us=(e,n)=>{e.media?function(e){const n=Qs();if(!n||!Xs)return;_s(n).then(n=>{n&&function(e,n){if(!Xs)return;const t=Xs.create(e,{nodeDefaults:Bi,newNodeId:Me,sectionLabel:Ni,blockIsOffered:wr}),o=wn(n);if(o===Oe){const e=ll(n.index),o=bo.insertNode(Oe,e,t);return void dl(e,o,Ni(t.type))}bo.insertNode(o,n.index,t),or(V),bo.select({index:n.index,zone:o})}(n,e)})}(n):e.rung?Wi(e.rung.nodeId,e.index,n.index):e.add?ps(e.add,n):e.zone===Oe?sl(e.index,n.index):ns(e.zone,wn(n),e.index,n.index)},[fs]=Rn(()=>yn()),hs=vn({keyOf:e=>e.id,readOnly:Boolean($t),session:fs,canDrop:ls,onDrop:us,onStep:(e,n)=>{e.rung?Wi(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===Oe?((e,n)=>{const t=Ni(hi[e]?.type??""),o=sl(e,n<0?e-1:e+2);if(!o.moved)return void Kr(n<0?oo.sectionFirst({name:t}):oo.sectionLast({name:t}));const{floor:r,cap:i}=mi();Kr(oo.sectionMoved({name:t,n:o.dest-r+1,total:i-r}))})(e.index,n):ns(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),ms=Dn(e=>{const{floor:n,cap:t}=mi(),o=[];for(const r of e.nodes){const e=wn(r.place),i=Ti(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(qt(i)||eo(i)||yr(i.type,i))continue;if(Kt(i.type))continue;const l=Boolean(rs(e)),s=e===Oe||l;e===Oe&&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?Ni(i.type):Yi(i),from:r.place})}const r=e.zones.flatMap(e=>{const n=wn(e.list);if(n===Oe&&0===e.children.length)return[{...e,addLabel:oo.addSection,addAlways:!0}];const t=ds(n),o=t?.target.spec?.addLabel;return e.children.length>0||Boolean(t?.choices.length)||Boolean(rs(n))?[o?{...e,addLabel:o}:e]:[]}),i=r.flatMap(e=>{const n=wn(e.list),t=n===Oe||rs(n)?null:ds(n);return t?.choices.length?fn(e,t.target.spec?.addLabel??oo.addBlockHere):[]});return{sources:o,zones:r,seams:i}},[Ft.data]),gs=null==Wt?.props.id?null:String(Wt.props.id),ys=Wn(Ae),vs=ys?.selected()&&Wo?.document&&gs?ys.selectedPart?.(Wo.document)??null:null,bs=vs&&gs&&Le(Ft.data,Ut,gs,vs)?vs:null,ks=bs?.label?{element:bs.element,label:bs.label}:null,Ss=null!==bs,ws=Dn(e=>{const n=Ut,t=e=>!e.item.rung&&null!==zn(Ft.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(gs);return i?Ss?null:i:r(Qe(Ft.data,n,o.item.id,gs,Vl))??o},[Ft.data,Ut,gs,Vl,Ss]),[xs,zs]=Rn(null),[Cs,Os]=Rn(null),Is=zr.canvasTab,Bs=Boolean(Dl||Hl||Is);Pn(Wo,"mouseover",e=>{if(!Bs)return;const n=Mn(e.target),t=n?yt(Ft.data,Ut,n):null;t!==xs&&zs(t),Is&&n!==Cs&&Os(n)}),Pn(Wo,"mouseout",e=>{Bs&&!e.relatedTarget&&(zs(null),Os(null))});const Ns=e=>qt(e)||eo(e)||Kt(e.type),Ps=e=>{const n=Kt(e.type)?Ii(e.type):qt(e)?oo.header:eo(e)?oo.footer:null;return null===n?Pi(e):zr.rowName?zr.rowName(e,"section",n):n},Ms=[];if(Bs){const e=gs?yt(Ft.data,Ut,gs):null;for(const n of/* @__PURE__ */new Set([e,xs])){const e=n?hi.find(e=>String(e.props.id)===n):void 0;if(!e)continue;const t=qt(e)||e.type===Xt,o=Ul(e);if(o){Ms.push({id:String(e.props.id),label:Ps(e),below:t,reach:o});continue}if(!Dl||!Ns(e))continue;const r=Dl(e);r&&Ms.push({id:String(e.props.id),label:r,below:t})}for(const e of Is?/* @__PURE__ */new Set([gs,Cs]):[]){const n=e?Ei(e):void 0,t=n?Is(n):null;t&&!Ms.some(n=>n.id===e)&&Ms.push({id:e,label:t,below:!1,above:!0})}}const $s=fe(),Ts=An(null);Fn(()=>{const e=Yt.changeNotice;if(!e)return;const n=JSON.stringify(hi.filter(Ns)),t=Ts.current;if(Ts.current={doc:Un,bands:n,index:Vt.index},!t||t.doc!==Un||t.bands===n)return;Vt.hasPast&&Vt.index>=t.index&&!gt.has($s)&&(gt.add($s),Kr(e,"success",{action:{label:oo.bar.undo,onClick:()=>Vt.back()},duration:8e3}))},[hi]);const Es=e=>{or(V),bo.select(e.zone===Oe?{index:e.index}:{index:e.index,zone:e.zone})},js=q(),As=()=>({data:Ft.data,device:Bo,ops:bo,inspector:fr}),Ls=js?.model,Rs=Ln(()=>Ls?e=>Ls(e,ms(e),As()):ms,[Ls,ms,Bo]),Fs=js?.measure,Ds=Fs?(e,n)=>Fs(e,n,As()):void 0,Vs=js?.canDrop,Ws=Vs?(e,n)=>Vs(e,n,ls,As()):ls,Hs=js?.drop,Us=Hs?(e,n)=>Hs(e,n,us,As()):us,Ys=js?.pick,Js=Ys?e=>Ys(e,Es,As()):Es,Xs=js?.media??null,Gs=An(null),Ks=Ln(()=>Xs?{id:ht,zone:"",index:-1,type:Xs.adds.type,add:{kind:Xs.adds.kind,type:Xs.adds.type},media:!0}:null,[Xs]);Fn(()=>{if(!Ks||$t||"undefined"==typeof document)return;const e=e=>{(e=>Array.from(e.dataTransfer?.types??[]).includes(nt))(e)&&(Gs.current=null,fs.start({key:ht,item:Ks}))},n=e=>{fs.get()?.item.media&&(Gs.current=Kn(e.dataTransfer))},t=()=>{fs.get()?.item.media&&fs.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)}},[Ks,$t,fs]);const Qs=()=>{const e=Gs.current;return Gs.current=null,e},Zs=ce(),_s=async e=>{if(!Zs)return e;const n=await Zs(e);return n?{...e,id:n.id,url:n.url}:null};const qs=(e,n)=>{if(!Xs)return;const t=zn(vo.getState().appState.data,gi,n);if(!t)return;const o=t.node;bo.replaceComponent(wn(t.place),t.place.index,{...o,props:{...Xs.replace(o,e),id:o.props.id}})},ed=e=>{const n=wn(e),t=Ai(n);t&&Di(t.node,t.slot,!1),pl(n,e.index)},nd=(e,n)=>/* @__PURE__ */pt(Ye,{...$t?{}:hs.seam({place:{...xn(e),index:n}})},`seam:${e}:${n}`),td={rowClick:hl,isCollapsed:Ur,toggleCollapse:Yr},od=e=>{const n=String(e.props.id),t=hi.findIndex(e=>String(e.props.id)===n),o=Qt(n),r=Ti(o),i=Ur(n),l=Ii(e.type),s=zr.rowName?zr.rowName(e,"section",l):l,d=e=>nd(o,e);/* @__PURE__ */
|
|
16
|
+
return ut(ft,{children:[
|
|
17
|
+
/* @__PURE__ */pt(De,{words:ro,icon:/* @__PURE__ */pt(Or,{type:e.type,size:13}),name:s,preview:gl(e),marks:yl(e),onSelect:()=>il(t),nameSlot:Xi(Oe,t,n,s),selected:rr===n,badge:Ul(e)?void 0:Gl,shared:Ul(e),actions:vl(e,Oe,t)??void 0,rowProps:{"data-node-id":n,onClick:hl(()=>il(t))},fold:{open:!i,label:"section",onToggle:()=>Yr(n)}}),!i&&/* @__PURE__ */ut(Ve,{children:[r.map((n,t)=>{const r=String(n.props.id),i=Pi(n),l=Pl(n),s=l&&Ur(r),a=()=>$l(o,t,r,e.type),{rowProps:c,...p}=hs.row({item:{id:r,zone:o,index:t,type:n.type},place:{...xn(o),index:t}},{"data-node-id":r,onClick:hl(a)});/* @__PURE__ */
|
|
18
|
+
return ut(Hn,{children:[d(t),
|
|
19
|
+
/* @__PURE__ */pt(De,{words:ro,icon:/* @__PURE__ */pt(Or,{type:n.type,size:13}),name:i,preview:gl(n),marks:yl(n),onSelect:a,nameSlot:Xi(o,t,r,i),selected:rr===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>Yr(r)}:void 0,actions:/* @__PURE__ */ut(ft,{children:[ml(o,t,i),vl(n,o,t),bl(o,t,n,i)]}),rowProps:c}),l&&!s&&/* @__PURE__ */pt(Ve,{children:ld(n,2)})]},r)}),d(r.length)]})]})},rd=(e,n,t,o,r)=>{const i=String(e.props.id),l=`${i}:${n.slot}`,s=hs.dragging,d=!Ur(l)&&s?.rung?.nodeId!==i,a={...xn(l),index:0},c=s&&!s.rung&&ls(s,a)?a:void 0,p=()=>Di(e,n,!0),{rowProps:u,...f}=hs.row({item:{id:`rung:${l}`,zone:`${i}:${wt}`,index:t,type:e.type,rung:{nodeId:i,slot:n.slot}},place:{parentId:i,slot:wt,index:t},into:c,canDrag:Boolean(gr.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:hl(p)}),h=$t?null:gr.slotActions?.(e,n.slot);/* @__PURE__ */
|
|
20
|
+
return ut(Hn,{children:[n.heading,
|
|
21
|
+
/* @__PURE__ */pt(De,{words:ro,icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:Li===l,...f,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>Yr(l)},actions:h&&h.length>0?/* @__PURE__ */pt(ft,{children:h.map((t,o)=>/* @__PURE__ */pt(Ue,{kind:"delete"===t.kind?"delete":"plain",label:t.label,disabled:t.disabled,onClick:()=>((e,n,t)=>{if($t||t.disabled)return;const o=String(e.props.id),r=e=>{"string"==typeof e&&Vi(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__ */pt(lt,{size:15}):/* @__PURE__ */pt(ct,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */pt(Ve,{children:r})]},l)},id=(e,n)=>{const t=zl(e),o=t.filter(e=>e.rung).length;let r=0;/* @__PURE__ */
|
|
22
|
+
return pt(ft,{children:t.map(t=>{const i=t.kids,l=t.rung?n+1:n,s=Il(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)=>nd(e,n),p=/* @__PURE__ */ut(ft,{children:[i.map(({child:n,zone:t,index:o})=>{const r=rr===String(n.props.id),{collapsible:i,folded:s}=Bl(n,l,Ml(n.type)),d=String(n.props.id),a=es(n),p=()=>$l(t,o,d,e.type),{rowProps:u,...f}=hs.row({item:{id:d,zone:t,index:o,type:n.type},place:{...xn(t),index:o}},{"data-node-id":d,onClick:hl(p)});/* @__PURE__ */
|
|
23
|
+
return ut(Hn,{children:[0===o&&c(t,0),
|
|
24
|
+
/* @__PURE__ */pt(De,{words:ro,icon:/* @__PURE__ */pt(Or,{type:n.type,size:13}),name:a,preview:gl(n),marks:yl(n),onSelect:p,nameSlot:Xi(t,o,d,a),selected:r,hidden:Boolean(n.props._hidden),...f,fold:i?{open:!s,label:"group",onToggle:()=>Yr(d)}:void 0,actions:/* @__PURE__ */ut(ft,{children:[ml(t,o,a),vl(n,t,o),bl(t,o,n,a)]}),rowProps:u}),i&&!s&&/* @__PURE__ */pt(Ve,{children:id(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?rd(e,t.rung,r++,o,p):/* @__PURE__ */pt(Hn,{children:p},t.slot??"")})})},ld=(e,n)=>{const t=br(Ft?.data,e.type,String(e.props.id)),o=zl(e),r=o.filter(e=>e.rung).length;let i=0;/* @__PURE__ */
|
|
25
|
+
return pt(ft,{children:o.map(o=>{const l=o.kids,s=o.rung?n+1:n,d=Il(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),f=a&&!a.fixed?`${u}:${a.slot}`:null,h=p?`${u}:${p.slot}`:null,m=(e,n)=>nd(e,n),g=null===o.slot?null:`${u}:${o.slot}`,y=Boolean(a&&!a.fixed&&(null===g||g===f)),v=/* @__PURE__ */ut(ft,{children:[l.map(({child:n,zone:t,index:o})=>{const r=rr===String(n.props.id),i=Yi(n),l=String(n.props.id),{collapsible:d,folded:a}=Bl(n,s,Ml(n.type)),c=wl(n.type),p=1===c.length?`${l}:${c[0]}`:null,u=p?{...xn(p),index:Ti(p).length}:void 0,f=hs.dragging,h=u&&f&&ls(f,u)?u:void 0,g=()=>$l(t,o,l,e.type),{rowProps:y,...v}=hs.row({item:{id:l,zone:t,index:o,type:n.type},place:{...xn(t),index:o},into:h,canDrag:!yr(n.type,n)},{"data-node-id":l,onClick:hl(g)});/* @__PURE__ */
|
|
26
|
+
return ut(Hn,{children:[0===o&&m(t,0),
|
|
27
|
+
/* @__PURE__ */pt(De,{words:ro,icon:/* @__PURE__ */pt(Or,{type:n.type,size:13}),name:i,preview:gl(n),marks:yl(n),onSelect:g,nameSlot:Xi(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...v,fold:d?{open:!a,label:"group",onToggle:()=>Yr(l)}:void 0,actions:yr(n.type,n)?vl(n,t,o)??void 0:/* @__PURE__ */ut(ft,{children:[ml(t,o,i),vl(n,t,o),bl(t,o,n,i)]}),rowProps:y}),d&&!a&&/* @__PURE__ */pt(Ve,{children:ld(n,s+1)}),m(t,o+1)]},String(n.props.id??`${t}-${o}`))}),y&&a&&
|
|
28
|
+
/* @__PURE__ */pt(z,{small:!0,label:a.addLabel,blocked:a.addBlocked?.(c)??null,onAdd:()=>Tl(e.props.id,a.slot,a.childType,c.length,e.type)}),null===g?h&&!l.some(e=>e.zone===h)?m(h,0):null:0!==l.length||(o.rung?y:g!==h)?null:m(g,0)]});return o.rung?rd(e,o.rung,i++,r,v):/* @__PURE__ */pt(Hn,{children:v},o.slot??"")})})},sd=Ko,dd=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:So&&!sd&&mr===e.id,onSelect:()=>ui(e.id)}:e,ad=[...(hr.railLead??[]).map(dd),{id:"sections",label:oo.layers,icon:/* @__PURE__ */pt(ge,{}),active:So&&!sd&&"sections"===mr,onSelect:()=>ui("sections")},...(hr.railTrail??[]).map(dd)],cd=Mo?{onPress:$o}:At?{onPress:()=>{x(In,{accept:"image/*",title:po.mediaLibrary})}}:null,pd={value:ad.find(e=>!0===e.active)?.id??"",press:e=>{const n=ad.find(n=>n.id===e);n&&!n.disabled&&!0!==n.active&&n.onSelect?.()},items:ad.map(e=>({id:e.id,icon:e.icon,label:/* @__PURE__ */pt("span",{className:"sr-only",children:e.label}),tooltip:e.label,disabled:e.disabled}))},ud=[...hr.railLead??[],...hr.railTrail??[]].find(e=>"panel"in e&&e.id===mr),fd=Boolean(to?.foldable),hd=to?.label??(Lt?oo.pageSections:oo.templateSections),md=fd&&Ur(zt),gd=/* @__PURE__ */ut(ft,{children:[hi.map((e,n)=>{if(qt(e)||eo(e)||Kt(e.type))return null;const t=rr===String(e.props.id),o=Boolean(e.props._hidden);xl(e);const r=String(e.props.id),i=hr.hasOwnRows?.(e)??!1,l=Pl(e)||i,s=l&&Ur(r),d=wl(e.type),a=1===d.length?`${r}:${d[0]}`:null,c=a?{...xn(a),index:Ti(a).length}:void 0,p=hs.dragging,u=c&&p&&ls(p,c)?c:void 0,{rowProps:f,...h}=hs.row({item:{id:r,zone:Oe,index:n,type:e.type},place:{...xn(Oe),index:n},into:u,canDrag:!yr(e.type,e)},{"data-node-id":r,onClick:hl(()=>il(n))});/* @__PURE__ */
|
|
29
|
+
return ut(Hn,{children:[n>0&&kl(n),
|
|
30
|
+
/* @__PURE__ */pt(De,{words:ro,icon:/* @__PURE__ */pt(Or,{type:e.type,size:13}),name:Pi(e),preview:gl(e),marks:yl(e),shared:Ul(e),onSelect:()=>il(n),nameSlot:Xi(Oe,n,r,Pi(e)),selected:t,hidden:o,...h,fold:l?{open:!s,label:"section",onToggle:()=>Yr(r)}:void 0,actions:/* @__PURE__ */ut(ft,{children:[ml(Oe,n,Pi(e)),vl(e,Oe,n),bl(Oe,n,e,Pi(e))]}),rowProps:f}),Pl(e)&&!s&&/* @__PURE__ */ut(Ve,{children:[ld(e,1),hr.partRows?.(e,td)]}),i&&!s&&/* @__PURE__ */pt(Ve,{children:hr.ownRows?.(e,n,td)})]},String(e.props.id??n))}),Zl>0&&kl(Zl)]}),yd=(e,n,t)=>{const o=String(e.props.id),r=Cl(e).length>0||Ol(e)||Boolean(Sr(e.type)),i=r&&Ur(o),l="header"===t?oo.header:oo.footer,s=zr.rowName?zr.rowName(e,"section",l):l;/* @__PURE__ */
|
|
31
|
+
return ut(ft,{children:[
|
|
32
|
+
/* @__PURE__ */pt(De,{words:ro,icon:/* @__PURE__ */pt(Or,{type:t,size:13}),name:s,preview:gl(e),marks:yl(e),badge:Ul(e)?void 0:Gl,shared:Ul(e),onSelect:()=>il(n),nameSlot:Xi(Oe,n,o,s),selected:rr===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>Yr(o)}:void 0,actions:vl(e,Oe,n)??void 0,rowProps:{"data-node-id":o,onClick:hl(()=>il(n))}}),r&&!i&&/* @__PURE__ */pt(Ve,{children:id(e,1)})]})};return(hr.wrap??(e=>e))(
|
|
33
|
+
/* @__PURE__ */pt(ee,{target:Wo,children:/* @__PURE__ */ut("div",{ref:Vo,className:"sf-editor es-editor",style:ln(Fr),onContextMenu:qi.onEditorContextMenu,...p(In),children:[
|
|
34
|
+
/* @__PURE__ */ut(Ze,{children:[
|
|
35
|
+
/* @__PURE__ */ut("div",{className:"es-cluster es-cluster--left",children:[cd?/* @__PURE__ */pt(Jn,{variant:"secondary",className:"es-barbtn",leftIcon:/* @__PURE__ */pt(ye,{}),onClick:cd.onPress,children:oo.railMedia}):null,
|
|
36
|
+
/* @__PURE__ */pt(_e,{label:oo.bar.undo,disabled:Boolean($t)||!Vt.hasPast,onClick:()=>Vt.back(),children:/* @__PURE__ */pt(tt,{})}),
|
|
37
|
+
/* @__PURE__ */pt(_e,{label:oo.bar.redo,disabled:Boolean($t)||!Vt.hasFuture,onClick:()=>Vt.forward(),children:/* @__PURE__ */pt(ot,{})})]}),
|
|
38
|
+
/* @__PURE__ */ut(qe,{children:[
|
|
39
|
+
/* @__PURE__ */pt(en,{devices:xo,value:Bo,onChange:No}),
|
|
40
|
+
/* @__PURE__ */pt(_e,{label:oo.bar.refresh,tip:oo.bar.refreshTip,onClick:()=>{Do.current=(()=>{const e=Wo?.document;if(!e)return null;const n=hi.findIndex(eo),t=n>=0?n:hi.length;let o=null;for(let n=0;n<t;n++){const t=hi[n]?.props?.id;if(null==t)continue;const r=jn(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=Wt?.props?.id??hi[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),Fo(e=>e+1)},children:/* @__PURE__ */pt(rt,{})}),hr.barView?.()]}),
|
|
41
|
+
/* @__PURE__ */ut(qe,{kind:"right",style:{minWidth:300},children:[
|
|
42
|
+
/* @__PURE__ */pt(b,{input:Xo,words:oo.saveStatus}),$n?/* @__PURE__ */pt($n,{}):null,hr.barLead?.(),hr.barTrail?.(),hr.mainAction||!hr.barMain?/* @__PURE__ */pt(k,{input:Xo,action:hr.mainAction??{label:oo.done,onPress:()=>{qn(Ft.data)}},readOnly:Boolean($t),saveSwitch:Et,onToggleAutoSave:Bt,onSaveNow:Go,bar:oo.bar,words:oo.saveStatus}):hr.barMain()]})]}),
|
|
43
|
+
/* @__PURE__ */pt(v,{}),
|
|
44
|
+
/* @__PURE__ */ut("div",{className:"sf-body",children:[So?/* @__PURE__ */ut(ft,{children:[
|
|
45
|
+
/* @__PURE__ */ut("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left","aria-label":oo.leftPanel,children:[
|
|
46
|
+
/* @__PURE__ */ut("div",{className:"es-paneltabs es-paneltabs--with-hide",children:[
|
|
47
|
+
/* @__PURE__ */pt(B,{side:"left",onHide:ci}),
|
|
48
|
+
/* @__PURE__ */pt("span",{className:"es-paneltabs-divider","aria-hidden":"true"}),
|
|
49
|
+
/* @__PURE__ */pt(Xn,{variant:"underline",block:!0,"aria-label":oo.bar.views,value:pd.value,onChange:pd.press,items:pd.items})]}),Ko?/* @__PURE__ */pt(C,{at:_o?{label:(e=>{const n=rs(e.zone);if(n)return oo.add.addingTo({name:zr.rowName?fl(n,!0):Ii(n.type)});if(e.zone===Oe){const n=hi[e.index];return n&&!eo(n)?oo.add.addingBefore({name:fl(n,!0)}):oo.add.addingAtEnd}const t=ds(e.zone);return t?oo.add.addingTo({name:t.parentName}):oo.add.addingHere})(_o),onClear:()=>qo(null)}:void 0,placeBlocks:_o&&_o.zone!==Oe?ds(_o.zone)?.choices:void 0,canTake:_o?e=>{if(!_o)return null;const n={...xn(_o.zone),index:_o.index};if(cs(e,n))return null;if("shared"===e.kind&&_o.zone===Oe&&!Yt.shared?.nodeOf(e.section))return oo.shared.alreadyHere;const t=rs(_o.zone);if(t)return oo.add.notInside({name:fl(t,!0)});if(_o.zone===Oe)return oo.add.onlySections;const o=ds(_o.zone);return o?oo.add.notInside({name:o.parentName}):oo.add.onlySections}:void 0,onPick:_o?e=>{if(!_o)return;const n={...xn(_o.zone),index:_o.index};cs(e,n)&&(ps(e,n),ul())}:void 0,itemFor:e=>({id:`new:${e.kind}:${xt(e)}`,zone:"",index:-1,type:"template"===e.kind?e.template.node.type:"shared"===e.kind?e.section.node.type:xt(e),add:e}),session:fs,siteWide:hr.addPanelRow?.(ul),onClose:ul,readOnly:Boolean($t)}):ud?ud.panel({onHide:ci,notify:Kr}):/* @__PURE__ */ut(ft,{children:[
|
|
50
|
+
/* @__PURE__ */pt(N,{icon:/* @__PURE__ */pt(ge,{}),title:oo.layers,context:uo,actions:/* @__PURE__ */ut(ft,{children:[!$t&&/* @__PURE__ */pt(nn,{label:oo.add.title,onClick:()=>cl(null),children:/* @__PURE__ */pt(it,{size:15})}),
|
|
51
|
+
/* @__PURE__ */pt(nn,{label:ql?oo.expandAll:oo.collapseAll,title:0===_l.length?oo.nothingToFold:void 0,disabled:0===_l.length,onClick:()=>Rr(e=>{const n=new Set(_l);return ql?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,..._l])}),children:/* @__PURE__ */pt(bt,{expand:ql})})]})}),
|
|
52
|
+
/* @__PURE__ */ut(We,{className:"sf-tree sf-scroll",words:ro,children:[Kl&&/* @__PURE__ */ut(ft,{children:[!Wl&&/* @__PURE__ */pt(He,{children:oo.header}),od(Kl)]}),Rt&&!(Wl&&Kl)&&/* @__PURE__ */ut(ft,{children:[!Wl&&/* @__PURE__ */pt(He,{children:oo.header}),!no&&/* @__PURE__ */pt(De,{words:ro,icon:/* @__PURE__ */pt(Or,{type:"header",size:13}),name:oo.header,badge:Xl?void 0:Gl,shared:Xl,onSelect:fi,selected:tr.kind===_t?.kind,rowProps:{onClick:hl(fi)}})]}),Fl&&!(Wl&&Kl)&&yd(Fl,Rl,"header"),!fd&&/* @__PURE__ */pt(He,{children:hd}),fd?/* @__PURE__ */ut(ft,{children:[
|
|
53
|
+
/* @__PURE__ */pt(De,{words:ro,icon:null,name:hd,fold:{open:!md,label:hd,onToggle:()=>Yr(zt)}}),!md&&/* @__PURE__ */pt(Ve,{children:gd})]}):gd,Rt&&!Wl&&/* @__PURE__ */pt(He,{children:oo.footer}),Ll&&!(Wl&&Ql)&&yd(Ll,Al,"footer"),Ql&&od(Ql),hr.treeFoot?.()]})]})]}),
|
|
54
|
+
/* @__PURE__ */pt(tn,{side:"left",width:Fr.left,min:rn.left,max:on,defaultWidth:h.left,label:oo.resizeLeftPanel,onResize:Wr})]}):/* @__PURE__ */pt(P,{side:"left",onShow:ci}),
|
|
55
|
+
/* @__PURE__ */ut("div",{ref:Qr,className:"sf-center sf-scroll","data-sf-canvas-head":ni?"":void 0,style:{overflowX:si?"auto":"hidden",overflowY:"hidden"},children:[ni&&/* @__PURE__ */pt("div",{ref:ti,className:"sf-canvas-head",children:/* @__PURE__ */pt(ni,{device:Bo})}),
|
|
56
|
+
/* @__PURE__ */ut("div",{className:"sf-frame-scaler",style:di,children:[
|
|
57
|
+
/* @__PURE__ */pt("div",{className:"sf-frame "+(Bo===Oo?"":`sf-frame--${Bo}`),style:ai,children:/* @__PURE__ */ut("div",{className:"sf-preview-host",children:[
|
|
58
|
+
/* @__PURE__ */pt(Re.Provider,{value:Vl,children:/* @__PURE__ */pt(Fe.Provider,{value:Jl,children:/* @__PURE__ */pt(fo,{},Ro)})}),
|
|
59
|
+
/* @__PURE__ */pt(hn,{canvas:Wo,session:fs,model:Rs,measure:Ds,canDrop:Ws,onDrop:Us,choose:ws,tag:ks,onPick:Js,dropOn:Xs?{accepts:(e,n)=>{if(!e.media||!Xs||n.item.rung)return!1;const t=zn(Ft.data,gi,n.item.id);return null!==t&&Xs.takes(t.node)},onDrop:(e,n)=>(e=>{const n=Qs();n&&Xs&&_s(n).then(n=>{n&&qs(n,e.item.id)})})(n),label:()=>oo.canvasReplaceImage}:void 0,onZoneAdd:ed,onSeamAdd:ed,zoneAddLabel:oo.canvasAddBlock,words:io.canvas,readOnly:Boolean($t),revision:Ft.data}),er.length>0&&!Ho&&/* @__PURE__ */pt("div",{className:"sf-preview-gaps",children:er.map(e=>
|
|
60
|
+
/* @__PURE__ */pt(mn,{index:e.index,label:oo.addSectionHere,onInsert:()=>cl(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))})]})}),Bs?/* @__PURE__ */pt(vt,{canvas:Wo,tabs:Ms,onSelect:Fi}):null]})]}),wo?/* @__PURE__ */ut(ft,{children:[Tn?
|
|
61
|
+
/* @__PURE__ */pt("div",{className:"es-sidepanel es-sidepanel--right","data-es-host-panel":"",children:Tn}):/* @__PURE__ */pt(ft,{children:/* @__PURE__ */pt(u,{value:{selectChild:$l,addChild:Tl,childRowName:Yi,blockRowName:es},children:/* @__PURE__ */pt(ho,{mode:tr,onOpenWebsiteSettings:hr.openSettings??(()=>{}),onOpenSiteStyles:hr.openStyles,onOpenPageStyles:hr.openPageStyles,onSelectNode:Pr,onNotify:Kr,onHidePanel:pi,nodeActions:Wt?Ie(Ut,Wt.type):Ct})})}),
|
|
62
|
+
/* @__PURE__ */pt(tn,{side:"right",width:Fr.right,min:rn.right,max:on,defaultWidth:h.right,label:oo.resizeSettingsPanel,onResize:Hr})]}):
|
|
63
|
+
/* @__PURE__ */pt(P,{side:"right",onShow:pi})]}),qi.menu,
|
|
64
|
+
/* @__PURE__ */pt(ie,{}),wi?/* @__PURE__ */pt(mt,{name:wi.name,onMake:e=>(async(e,n)=>{const t=hi.find(n=>String(n.props.id)===e),o=Yt.shared;if(!t||!o)return;let r;try{r=await I(Si).create(n,t)}catch{return void Kr(oo.shared.makeFailed,"error")}o.adopt(t,r),xi(null)})(wi.id,e),onCancel:()=>xi(null)}):null]})}))}export{It as ScreenChrome};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{parseZoneKey as t}from"./chunk-EUFDQ4KL.js";import{repeatWrapperAt as e,REPEAT_ATTRIBUTE as r,REPEAT_INDEX_ATTRIBUTE as n}from"./chunk-7UFKEX72.js";var o=`[${r}][${n}]`;function l(l){const c=e(l);if(!c)return null;let i;try{i=t(c.zone)}catch{return null}if(!i.parentId||!i.slot)return null;const{wrapper:a,zone:p,index:f}=c;let s=a.parentElement;for(let t=a.parentElement;t;t=t.parentElement)if(t.getAttribute("data-easel-block")===i.parentId){s=t;break}const d=/* @__PURE__ */new Set;for(const t of Array.from(s?.querySelectorAll(o)??[]))t.getAttribute(r)===p&&d.add(t.getAttribute(n)??"");const m={ownerId:i.parentId,slot:i.slot,index:f,count:Math.max(d.size,f+1)},y=a.parentElement?u(a.parentElement):null;return y&&(m.outer=y),{copy:m,wrapper:a}}function u(t){return l(t)?.copy??null}function c(t,e){return t&&e?t.ownerId===e.ownerId&&t.slot===e.slot&&t.index===e.index&&c(t.outer,e.outer):t===e}function i(t,e){for(const r of Array.from(t.querySelectorAll(o))){if(r.getAttribute(n)!==String(e.index))continue;const t=l(r);if(t?.wrapper===r&&c(t.copy,e))return r}return null}export{i as findCopy,u as repeatCopyAt,l as repeatCopyWithWrapper};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{HERO_SLIDER_GOTO_EVENT as t}from"./chunk-AJ2SUSET.js";import{queryMainCopy as e}from"./chunk-
|
|
1
|
+
import{HERO_SLIDER_GOTO_EVENT as t}from"./chunk-AJ2SUSET.js";import{queryMainCopy as e}from"./chunk-7UFKEX72.js";import{isPreviewClick as n}from"./chunk-MGVI67QV.js";var o=()=>document.querySelector(".sf-editor #preview-frame");function r(t){n()||requestAnimationFrame(()=>{const n=o()?.contentDocument;n&&e(n,`[data-easel-block="${CSS.escape(t)}"]`)?.scrollIntoView({behavior:"smooth",block:"start"})})}function c(e,n){const r=o()?.contentWindow;if(!r)return;const c={id:e,index:n};r.dispatchEvent(new CustomEvent(t,{detail:c}))}function i(){requestAnimationFrame(()=>{o()?.contentWindow?.scrollTo({top:0,behavior:"smooth"})})}function s(t,{passes:e=[150,400],onPinned:n}={}){let r=0,c=!1;const i=[],s=()=>{const r=o(),l=r?.contentWindow,u=r?.contentDocument;if(!l||!u)return!1;const a=t(l,u);if(null==a)return!1;if(l.scrollTo({left:l.scrollX,top:a,behavior:"instant"}),!c){c=!0,n?.();for(const t of e)i.push(setTimeout(s,t))}return!0},l=()=>{!s()&&r++<150&&i.push(setTimeout(l,32))};return l(),()=>i.forEach(clearTimeout)}function l(t){return s((n,o)=>{const r=e(o,`[data-easel-block="${CSS.escape(t)}"]`);return r?n.scrollY+r.getBoundingClientRect().top:null})}function u(t){return s((t,e)=>{if(!e.querySelector("[data-easel-block]"))return null;const n=Math.max(e.documentElement.scrollHeight,e.body?.scrollHeight??0);return n<=e.documentElement.clientHeight?null:n},{passes:[150,400,800,1300,2e3],onPinned:t})}export{c as gotoPreviewSlide,u as pinPreviewToBottom,l as pinPreviewToSection,o as previewFrame,r as scrollPreviewToSection,i as scrollPreviewToTop};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useScreenBlockRules as e}from"./chunk-
|
|
1
|
+
import{useScreenBlockRules as e}from"./chunk-4OMAA45Q.js";import{newNodeId as t,ROOT_ZONE as n}from"./chunk-TCAAOYQY.js";import{useEasel as o,useEaselApi as r}from"./chunk-53ME3GAI.js";import{useMemo as s}from"react";function i(i={}){const{dispatch:p}=o(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,o=(n,o,r)=>{const s=t(o);return c||e({type:"insert",componentType:o,destinationZone:n,destinationIndex:r,id:s}),s},r=e=>(l&&!c&&d.resolveNode(e,{trigger:"insert"}),e),s=(t,n,o)=>{c||e({type:"replace",destinationZone:t,destinationIndex:n,data:o})},i=(e,t,n)=>r(o(e,t,n));return{insertComponent:i,insertSection:(e,t)=>i(n,e,t),replaceComponent:s,seedChild:(e,t,n,i)=>{const p=o(e,n,t);s(e,t,{type:n,props:{id:p,...i}}),r(p)},insertNode:(e,t,n)=>{const i=o(e,n.type,t);return s(e,t,{type:n.type,props:{...n.props,id:i}}),r(i)},removeComponent:(t,n)=>{c||e({type:"remove",index:n,zone:t})},reorderComponent:(t,n,o)=>{c||e({type:"reorder",sourceIndex:n,destinationIndex:o,destinationZone:t})},duplicateComponent:(t,n)=>{c||e({type:"duplicate",sourceIndex:n,sourceZone:t})},select:e=>p({type:"setUi",ui:{itemSelector:e}}),setDocument:t=>{c||e({type:"setData",data:t})},commitDocument:(t,n)=>{c||(m?d.batch(()=>{e({type:"setData",data:t}),void 0!==n&&("slot"===n?.kind?d.selectSlot({parentId:n.parentId,slot:n.slot}):d.select(n?n.id:null))}):d.run({data:t,select:n}))}}},[p,c,l,d,m])}export{i as useSectionOps};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import{DEFAULT_DRAG_WORDS as e}from"./chunk-TQ5Y6S2X.js";import{dropEffectFor as t,scrollBoxOf as n,frameScrollBox as l,startAutoScroll as r,isNoOpDrop as a}from"./chunk-3XECMGXX.js";import{withTip as s}from"./chunk-P2VEMZH5.js";import{parseZoneKey as o,ROOT_ID as i}from"./chunk-EUFDQ4KL.js";import{useCanvasLayout as c,useCanvasTyping as d,useCanvasEvent as u,CANVAS_TYPABLE_EVENT as h}from"./chunk-TOKMFZPB.js";import{framePointToHost as f,elementScale as p,related as m,WORDS_CLEAR as g,frameRectToLayer as b,clientPointToLayer as y}from"./chunk-FR7EEKFF.js";import{isRepeatCopy as x}from"./chunk-7UFKEX72.js";import{useRef as v,useEffect as w,useState as k,useCallback as N,useMemo as D,useSyncExternalStore as A,useId as T,useLayoutEffect as M}from"react";import{Tooltip as z,IconButton as E,solidSurfaceStyle as C,Input as $,ItemCount as S}from"efficient-shell/ui";import{AddIcon as j,CloseIcon as L,SearchIcon as B}from"efficient-shell/icons/efficient";import{jsxs as K,jsx as O}from"react/jsx-runtime";function X({label:e,onInsert:t,style:n,axis:l="y",className:r,index:a}){const s=["es-canvas-insert","x"===l?"is-x":"",r??""].filter(Boolean).join(" ");/* @__PURE__ */
|
|
2
|
+
return K("div",{className:s,style:n,"data-index":a,children:[
|
|
3
|
+
/* @__PURE__ */O("span",{className:"es-canvas-insert-line","aria-hidden":"true"}),
|
|
4
|
+
/* @__PURE__ */O("span",{className:"es-canvas-insert-chip",children:/* @__PURE__ */O(z,{content:e,children:/* @__PURE__ */O(E,{variant:"ghost",size:"sm","aria-label":e,onClick:t,children:/* @__PURE__ */O(j,{})})})})]})}var F=(e,t,n)=>t>=e.left&&t<=e.left+e.width&&n>=e.top&&n<=e.top+e.height,I=e=>e.width*e.height;function q(e,t,n){return e.map((e,t)=>({s:e,at:t})).filter(({s:e})=>F(e.box,t,n)).sort((e,t)=>I(t.s.box)-I(e.s.box)||e.at-t.at).map(({s:e})=>e)}function Y(e,t,n){return q(e,t,n).at(-1)??null}function P(e,t,n){const l="x"===e.axis?t:n;let r=0;for(const t of e.children){l>("x"===e.axis?t.left+t.width/2:t.top+t.height/2)&&(r+=1)}return r}function Z(e,t){const n=e.children;if("x"===e.axis){const l=n[t-1],r=n[t],a=l&&r?(l.left+l.width+r.left)/2:l?l.left+l.width:r?r.left:e.box.left,s=r??l??e.box;return{left:a-1,top:s.top,width:2,height:s.height}}const l=n[t-1],r=n[t],a=l&&r?(l.top+l.height+r.top)/2:l?l.top+l.height:r?r.top:e.box.top;return{left:e.box.left,top:a-1,width:e.box.width,height:2}}function R(e,t,n,l,r=()=>!1,a=()=>!0){const s=e.filter(e=>F(e.box,t,n)).sort((e,t)=>I(e.box)-I(t.box));for(const e of s){const s=P(e,t,n),o={...e.list,index:s};if(r(o))return null;if(l(o))return{zone:e,to:o,line:Z(e,s)};if(!a(o))return null}return null}function H(e,t,n=12){const l=e.children;if(0===l.length)return[];const r=e.box,a="x"===e.axis,s=a?r.left:r.top,o=s+(a?r.width:r.height),i=e=>a?e.left:e.top,c=e=>a?e.left+e.width:e.top+e.height,d=[];for(let r=0;r<=l.length;r++){const u=l[r-1],h=l[r];let f,p;if(u&&h)f=c(u),p=Math.max(i(h)-f,0);else{const e=u?(c(u)+o)/2:(s+i(h))/2,t=Math.min(Math.max(e,s+n),o-n);f=u?Math.max(t,c(u)):Math.min(t,i(h)),p=0}const m=[u,h].filter(e=>Boolean(e)),g=Math.min(...m.map(e=>a?e.top:e.left)),b=Math.max(...m.map(e=>a?e.top+e.height:e.left+e.width)),y=a?{left:f,top:g,width:p,height:b-g}:{left:g,top:f,width:b-g,height:p};d.push({key:`${e.key}:+${r}`,place:{...e.list,index:r},box:y,axis:e.axis,label:t})}return d}function Q(e,t=e.key){const n=[];for(let l=1;l<e.children.length;l++){const r=e.children[l-1],a=e.children[l],s=r.top+r.height;n.push({key:`${t}:${l}`,place:{...e.list,index:l},box:{left:e.box.left,top:s,width:e.box.width,height:Math.max(a.top-s,0)}})}return n}var U={nodes:[],zones:[]},V="data-easel-dropzone",G="data-easel-block";function W(e){const t=e.getBoundingClientRect();return{left:t.left,top:t.top,width:t.width,height:t.height}}function J(e,t){if(e.length>=2){const[t,n]=e;return Math.abs(n.top-t.top)<Math.min(t.height,n.height)/2&&n.left>t.left?"x":"y"}const n=t.ownerDocument.defaultView?.getComputedStyle(t);return n&&n.display.includes("flex")&&n.flexDirection.startsWith("row")?"x":"y"}function _(e,t,n){return b(e.frame,W(n),t)}function ee(e,t){const{frame:n,document:l}=e,r=e=>b(n,W(e),t),a=[],s=[];for(const e of l.querySelectorAll(`[${V}]`)){if(x(e))continue;const t=e.getAttribute(V)??"";let n;try{n=o(t)}catch{continue}const l=[...e.querySelectorAll(`[${G}]`)].filter(t=>t.parentElement?.closest(`[${V}]`)===e&&!x(t)),i=l.map(r);s.push({key:t,list:n,box:r(e),axis:J(i,e),children:i}),l.forEach((e,t)=>{const l=e.getAttribute(G);l&&a.push({id:l,place:{...n,index:t},box:i[t]})})}return{nodes:a,zones:s}}var te="data-es-empty-cell",ne="data-easel-dropzone",le=140;var re=e=>({left:e.left,top:e.top,width:e.width,height:e.height}),ae=e=>({left:e.left+2,top:Math.max(e.top-11,0)});function se(s){const{canvas:o,session:b,readOnly:x,words:T=e.canvas}=s,E=v(s);w(()=>{E.current=s});const $=v(null),S=c(o),[j,L]=k(0),B=N(()=>L(e=>e+1),[]),[F,I]=k(U);w(()=>{const e=$.current;o&&e&&I((E.current.measure??ee)(o,e))},[o,S,s.revision,j]);const Y=s.model,P=D(()=>Y(F),[Y,F]),Z=A(b.subscribe,b.shown,b.shown),H=s.choose,Q=(e,t)=>{const n=q(P.sources,e,t);return 0===n.length?null:H?H(n):n[n.length-1]},[V,G]=k(null),[W,J]=k(null),[le,se]=k(null),oe=v(null),ie=()=>{oe.current&&clearTimeout(oe.current),oe.current=null},ce=()=>{ie(),oe.current=setTimeout(()=>{b.get()||G(null)},140)};w(()=>ie,[]);const de=v(null),ue=d(o),he=v(!1);he.current=ue;const[fe,pe]=k(null),me=v(null),ge=v(V);ge.current=V,w(()=>{ue?(pe(ge.current?.key??me.current?.id??null),ie(),G(null)):pe(null)},[ue]);const[be,ye]=k(null);u(o,h,e=>{const t=e.detail?.id??null,n=t?{id:t,words:e.detail?.words??null}:null;ye(n),n&&(me.current=n)});const xe=e=>{if(!(e&&e.isConnected&&o&&$.current))return null;const t=_(o,$.current,e);return{left:t.left-g,top:t.top-g,width:t.width+2*g,height:t.height+2*g}},ve=!be||ue||x||Z?null:xe(be.words)??F.nodes.find(e=>e.id===be.id)?.box??null;u(o,"mousemove",e=>{const t=$.current;if(!o||!t)return;const n=f(o.frame,e.clientX,e.clientY,t),l=p(t),r={x:n.x/l,y:n.y/l};if(de.current=r,E.current.readOnly||b.get()||he.current)return;ie();const a=Q(r.x,r.y);G(e=>e?.key===a?.key&&e?.box===a?.box?e:a)}),u(o,"mouseout",e=>{e.relatedTarget||(de.current=null,ce())}),u(o,"mouseover",e=>{e.relatedTarget||B()});const we=v(null),ke=N(()=>{we.current?.(),we.current=null,J(null),se(null)},[]);w(()=>b.subscribe(()=>{b.get()?B():ke()}),[b,ke,B]),w(()=>ke,[ke]),("undefined"==typeof document?w:M)(()=>{if(b.get())return;const e=de.current;G(t=>x||he.current?null:e?Q(e.x,e.y):t?P.sources.find(e=>e.key===t.key)??null:null)},[P,Z,b,x,H]);const Ne=e=>{const t=b.get(),n=$.current,l=E.current.dropOn;if(!t||!n||!l)return null;const r=y(n,e.clientX,e.clientY);de.current=r;const a=q(P.sources,r.x,r.y);for(let e=a.length-1;e>=0;e-=1)if(l.accepts(t.item,a[e]))return{h:t,source:a[e]};return null},De=e=>{const t=b.get(),n=$.current;if(!t||!n)return null;const l=y(n,e.clientX,e.clientY);de.current=l;const r=R(P.zones,l.x,l.y,e=>E.current.canDrop(t.item,e),e=>!!t.from&&a(t.from,e),e=>E.current.fallThrough?.(t.item,e,t.from)??!0);return r?{h:t,t:r}:null},Ae={onDragEnter:e=>{if(we.current)return;const t=n(e.currentTarget.parentElement?.parentElement??null),a=o?l(o.document):null,s=[];t&&s.push(r(t)),a&&o&&s.push(r(a,o.frame)),we.current=s.length?()=>s.forEach(e=>e()):null},onDragOver:e=>{const n=Ne(e);if(n)return e.preventDefault(),e.dataTransfer.dropEffect=t(e.dataTransfer.effectAllowed),J(null),void se(e=>e&&e.key===n.source.key&&e.box===n.source.box?e:n.source);se(null);const l=De(e);if(!l)return void J(null);e.preventDefault(),e.dataTransfer.dropEffect=t(e.dataTransfer.effectAllowed);const r={zoneKey:l.t.zone.key,line:l.t.line,axis:l.t.zone.axis};J(e=>e&&e.zoneKey===r.zoneKey&&e.line.left===r.line.left&&e.line.top===r.line.top?e:r)},onDragLeave:e=>{const t=e.relatedTarget;t&&e.currentTarget.contains(t)||(de.current=null,J(null),se(null))},onDrop:e=>{const t=Ne(e);if(t)return e.preventDefault(),b.end(),ke(),void E.current.dropOn.onDrop(t.h.item,t.source);const n=De(e);n&&(e.preventDefault(),b.end(),ke(),E.current.onDrop(n.h.item,n.t.to))}},Te={draggable:!x&&!!V,onMouseEnter:ie,onMouseLeave:()=>!b.get()&&ce(),onDragStart:e=>{if(V&&!x){b.start({key:V.key,item:V.item,from:V.from}),e.dataTransfer.effectAllowed="move";try{e.dataTransfer.setData("text/plain",V.key)}catch{}}else e.preventDefault()},onDragEnd:()=>{b.end(),ke()},onClick:()=>{V&&!x&&E.current.onPick?.(V.item)}},{seams:Me=[]}=P,ze=be?.words??(ue?me.current?.words??null:null),Ee=s.tag&&o&&$.current&&!Z?(ze&&m(s.tag.element,ze)?xe(ze):null)??_(o,$.current,s.tag.element):null,Ce=V?(be&&be.id===V.key?xe(be.words):null)??V.box:null,$e=ue&&fe&&!s.tag?P.sources.find(e=>e.key===fe)??null:null,Se=$e?xe(ze)??$e.box:null,je=P.zones.filter(e=>0===e.children.length),Le=!s.onZoneAdd||x||ue?[]:je,Be=Le.map(e=>e.key).join("\n");return w(()=>{const e=o?.document;if(!e)return;const t=new Set(Be?Be.split("\n"):[]);for(const n of e.querySelectorAll(`[${ne}]`))n.toggleAttribute(te,t.has(n.getAttribute(ne)??""));return()=>{for(const t of e.querySelectorAll(`[${te}]`))t.removeAttribute(te)}},[o,Be,F,S,j]),/* @__PURE__ */K("div",{ref:$,className:"es-canvas-layer",children:[Z||!s.onSeamAdd||x||ue?null:Me.map(e=>
|
|
5
|
+
/* @__PURE__ */O(X,{className:"es-canvas-seam",axis:e.axis,index:e.place.index,label:e.label??s.seamLabel??T.addSection,onInsert:()=>s.onSeamAdd?.(e.place),style:"x"===e.axis?{left:e.box.left+e.box.width/2-12,top:e.box.top,width:24,height:e.box.height}:{left:e.box.left,top:e.box.top+e.box.height/2-12,width:e.box.width,height:24}},e.key)),Le.length?Le.map(e=>/* @__PURE__ */O("button",{type:"button",className:["es-canvas-empty",e.addAlways?"is-always":"",W?.zoneKey===e.key?"is-over":""].filter(Boolean).join(" "),style:re(e.box),"data-node-id":e.list.parentId===i?void 0:e.list.parentId,onClick:()=>s.onZoneAdd?.({...e.list,index:0}),children:/* @__PURE__ */O("span",{className:"es-canvas-empty-add",children:T.addButton({label:e.addLabel??s.zoneAddLabel??T.addBlock})})},e.key)):null,Z?/* @__PURE__ */O("div",{className:"es-canvas-catch",...Ae}):null,le&&Z?/* @__PURE__ */O("div",{className:"es-canvas-target",style:re(le.box),children:s.dropOn?.label?/* @__PURE__ */O("span",{className:"es-canvas-target-label",style:C(),children:s.dropOn.label(Z.item,le)}):null}):null,W&&!je.some(e=>e.key===W.zoneKey)?/* @__PURE__ */O("div",{className:`es-canvas-line is-${W.axis}`,style:re(W.line)}):null,ve?/* @__PURE__ */O("span",{className:"es-canvas-hint"+(ve.width<200?" is-below":""),style:{...C(),left:ve.left+ve.width,top:ve.width<200?ve.top+ve.height:ve.top},children:T.typeHint}):null,Ee&&s.tag?/* @__PURE__ */O("span",{className:"es-canvas-tag",style:ae(Ee),children:s.tag.label}):$e&&Se?/* @__PURE__ */O("span",{className:"es-canvas-tag",style:ae(Se),children:$e.label}):null,
|
|
6
|
+
/* @__PURE__ */O("div",{className:"es-canvas-handle-spot",style:Ce?{"--es-handle-x":`${ae(Ce).left}px`,"--es-handle-y":`${ae(Ce).top}px`}:void 0,children:/* @__PURE__ */O(z,{className:"es-canvas-handle-tip",side:"top",content:!V||x||Z?null:V.title??T.handle({label:V.label}),children:/* @__PURE__ */K("div",{className:["es-canvas-handle",V&&!x?"is-shown":"",Z?"is-dragging":""].filter(Boolean).join(" "),...Te,children:[
|
|
7
|
+
/* @__PURE__ */O("span",{className:"es-canvas-grip","aria-hidden":"true",children:"⋮⋮"}),V?.label]})})})]})}var oe=e=>e.tiles.length>0&&e.tiles.every(e=>null!=e.cover);function ie({groups:t,session:n,itemFor:l,onInsert:r,onTileMenu:a,at:o,hint:i,searchLabel:c,readOnly:d,words:u=e.add}){const h=i??u.hint,f=c??u.search,[p,m]=k(""),g=T(),b=p.trim().toLowerCase(),y=function(e){const t=/* @__PURE__ */new Map;return e.map(e=>{const n=e.key??e.title,l=t.get(n)??0;return t.set(n,l+1),0===l?n:`${n}\0${l}`})}(t),x=t.map((e,t)=>({...e,key:y[t],tiles:b?e.tiles.filter(e=>((e,t)=>e.label.toLowerCase().includes(t)||(e.keywords??[]).some(e=>e.toLowerCase().includes(t)))(e,b)):e.tiles})).filter(e=>e.tiles.length>0),v=(e,t)=>r=>{if(t)r.preventDefault();else{n.start({key:`new:${e}`,item:l(e)}),r.dataTransfer.effectAllowed="copy";try{r.dataTransfer.setData("text/plain",e)}catch{}}};/* @__PURE__ */
|
|
8
|
+
return K("div",{className:"es-add",children:[o?/* @__PURE__ */K("div",{className:"es-add-at",role:"status",children:[
|
|
9
|
+
/* @__PURE__ */O("span",{children:o.label}),s(u.stop,/* @__PURE__ */O("button",{type:"button",className:"es-add-at-clear","aria-label":u.stop,onClick:o.onClear,children:/* @__PURE__ */O(L,{size:12,"aria-hidden":"true"})}))]}):null,
|
|
10
|
+
/* @__PURE__ */O("p",{className:"es-add-hint",children:h}),
|
|
11
|
+
/* @__PURE__ */O("div",{className:"es-add-find",children:/* @__PURE__ */O($,{id:g,type:"search","aria-label":f,placeholder:u.searchPlaceholder({label:f}),value:p,onChange:e=>m(e.target.value),leftIcon:/* @__PURE__ */O(B,{size:16,"aria-hidden":"true"}),endAction:p?{label:u.clearSearch,icon:/* @__PURE__ */O(L,{"aria-hidden":"true"}),onClick:()=>m("")}:void 0})}),0===x.length?/* @__PURE__ */K("div",{className:"es-add-empty",role:"status",children:[
|
|
12
|
+
/* @__PURE__ */O("div",{className:"es-add-empty-title",children:u.nothing({query:p.trim()})}),
|
|
13
|
+
/* @__PURE__ */O("div",{className:"es-add-empty-sub",children:u.tryAnother})]}):x.map(e=>/* @__PURE__ */K("section",{className:"es-add-group","aria-label":e.title,children:[
|
|
14
|
+
/* @__PURE__ */K("div",{className:"es-add-group-head",children:[
|
|
15
|
+
/* @__PURE__ */O("span",{className:"es-add-group-title",children:e.title}),
|
|
16
|
+
/* @__PURE__ */O(S,{count:e.tiles.length,label:u.count({count:e.tiles.length,sections:oe(e)}),className:"ml-auto"})]}),
|
|
17
|
+
/* @__PURE__ */O("div",{className:oe(e)?"es-add-grid is-cards":"es-add-grid",children:e.tiles.map(e=>{const t=Boolean(d||e.disabled),l=d?void 0:e.disabled?e.disabledReason:e.title??u.tile({label:e.label});return s(l,/* @__PURE__ */K("button",{type:"button",className:null!=e.cover?"es-add-tile has-cover":"es-add-tile",draggable:!t,"aria-disabled":t||void 0,"aria-label":u.tile({label:e.label}),onDragStart:v(e.type,t),onDragEnd:()=>n.end(),onClick:()=>!t&&r?.(e.type),onContextMenu:a?t=>{a(e.type,{x:t.clientX,y:t.clientY,owner:t.currentTarget})&&t.preventDefault()}:void 0,children:[null!=e.cover?/* @__PURE__ */O("span",{className:"es-add-tile-cover","aria-hidden":"true",children:e.cover}):e.icon?/* @__PURE__ */O("span",{className:"es-add-tile-glyph","aria-hidden":"true",children:e.icon}):null,
|
|
18
|
+
/* @__PURE__ */K("span",{className:"es-add-tile-label",children:[e.label,null!=e.mark?/* @__PURE__ */O("span",{className:"es-add-tile-mark","aria-hidden":"true",children:e.mark}):null]})]},e.type))})})]},e.key))]})}export{ie as AddPanel,se as CanvasDragLayer,X as CanvasInsert,U as EMPTY_MEASURE,le as HANDLE_GRACE_MS,R as canvasTarget,F as contains,P as gapInZone,Z as gapLine,H as insertSeams,ee as measureCanvas,Y as pickSource,Q as seamsBetween,q as sourcesAt};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{SettingRow as e}from"efficient-shell/ui";import{jsx as a}from"react/jsx-runtime";function l({label:l,labelId:c,icon:i,value:o,hint:t,changed:n,htmlFor:r,action:m,children:d,className:s}){/* @__PURE__ */
|
|
2
|
+
return a(e,{size:"compact",label:l,labelId:c,icon:i,readout:o,description:t,changed:n,controlId:r,action:m,value:d,className:s})}export{l as SettingsField};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{noControlField as e}from"./chunk-22I55W37.js";import{DEFAULT_SCREEN_WORDS as r}from"./chunk-
|
|
1
|
+
import{noControlField as e}from"./chunk-22I55W37.js";import{DEFAULT_SCREEN_WORDS as r}from"./chunk-S6YOIRXQ.js";import{deviceMetaOf as n,DEVICE_FIELD_MARKER as t}from"./chunk-YCSZAP7T.js";import{useWords as o}from"./chunk-MFIRYGHW.js";import{usePreviewDevice as i}from"./chunk-BSPCSC45.js";import{jsx as c}from"react/jsx-runtime";function u(e){return"mobile"===e?"mobile":"desktop"}var s={desktop:null,tablet:r.deviceNote.tablet,mobile:r.deviceNote.mobile},d="data-sf-device-hidden";function m(){/* @__PURE__ */
|
|
2
2
|
return c("span",{hidden:!0,[d]:""})}function f({tier:e,render:r,...n}){const t=i();return"each"===e?/* @__PURE__ */c(r,{...n,tier:u(t)}):u(t)===e?/* @__PURE__ */c(r,{...n}):/* @__PURE__ */c(m,{})}function l(e){return n(e)?.inner??e}function p(e,r){const n=r.render;return{...r,[t]:{tier:e,inner:r},render:r=>/* @__PURE__ */c(f,{tier:e,render:n,...r})}}function a(){const e=o("screen",r).deviceNote,n=i(),t="desktop"===n?null:e[n];return t?/* @__PURE__ */c("div",{className:"sf-device-scope",children:t}):/* @__PURE__ */c(m,{})}function h(){return e({type:"custom",render:()=>/* @__PURE__ */c(a,{})},"always")}export{d as DEVICE_HIDDEN_ATTR,s as DEVICE_NOTE,p as deviceField,h as deviceNote,u as shownTier,l as withoutDeviceGate};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{MARKUP_TOOLS as e,MARK_PLACEHOLDERS as t}from"efficient-shell/markup";var i={formatting:"Formatting",alignment:"Text alignment",marks:{...Object.fromEntries(e.map(e=>[e.style,{name:e.name??e.title,title:e.title}])),underline:{name:"Underline",title:"Underline · [words]{underline}"},sup:{name:"Superscript",title:"Superscript · [words]{sup}"},sub:{name:"Subscript",title:"Subscript · [words]{sub}"}},placeholders:t,showMarks:"Show marks",colors:{title:"Color",theme:"Theme colors",remove:"Remove",any:"Any color",square:"Saturation and brightness",hue:"Hue",hex:"Hex color"},panel:{style:"Style",editStyles:"Edit styles",updateStyle:"Update style",font:"Font",italic:"Italic",list:"List",lists:{none:"No list",bullet:"Bulleted",number:"Numbered"},capitalization:"Capitalization",cases:{none:"As typed",upper:"Uppercase",capitalize:"Capitalized",lower:"Lowercase"}},cells:{fontSize:"Font size",lineHeight:"Line spacing",letterSpacing:"Letter spacing",paragraphSpacing:"Paragraph spacing",tip:({name:e,step:t,unit:i})=>`${e} · step ${t} ${i} · Shift ×10`}};export{i as DEFAULT_COPY_WORDS};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{useNow as e,describeSave as t}from"./chunk-RKTF5XLP.js";import{SaveIcon as a}from"./chunk-
|
|
1
|
+
import{useNow as e,describeSave as t}from"./chunk-RKTF5XLP.js";import{SaveIcon as a}from"./chunk-VBEVZZTV.js";import{SplitButton as l,Kbd as i,CMD_S as n}from"efficient-shell/ui";import{CloudIcon as s,CheckIcon as o}from"efficient-shell/icons/efficient";import{jsx as r,jsxs as d}from"react/jsx-runtime";var c=e=>e.state.failed&&null!=e.state.retryAt||null!=e.state.savedAt;function u({input:l,words:i}){const n=e(c(l)),s=t({...l,now:n},i);/* @__PURE__ */
|
|
2
2
|
return r(a,{state:s.state,label:s.label})}function m({input:a,action:u,readOnly:m,saveSwitch:y,onToggleAutoSave:b,onSaveNow:p,bar:v,words:f}){const k=e(c(a)),h=t({...a,now:k},f),w=h.retry?v.retry:v.saveNow,g=/* @__PURE__ */d("span",{className:"es-savemenu-row",children:[w,
|
|
3
3
|
/* @__PURE__ */r("span",{"aria-hidden":"true",children:/* @__PURE__ */r(i,{keys:n,size:"sm"})})]}),S=[{type:"status",key:"status",label:h.line(u.status)},...(u.goingLive??[]).map((e,t)=>({type:"status",key:`going-live-${t}`,label:e})),{type:"divider",key:"divider"},...y?[{type:"checkbox",key:"auto-save",label:v.autoSave,checked:!a.state.paused,disabled:m,onSelect:b}]:[],{key:"save-now",label:g,icon:/* @__PURE__ */r(s,{}),disabled:m,onSelect:p},...u.menuItems?.length?[{type:"divider",key:"layer-divider"},...u.menuItems.map(e=>({key:`layer-${e.key}`,label:e.label,icon:e.icon,disabled:e.disabled,onSelect:e.onSelect}))]:[]],j=u.quiet??null,x=h.blocked??u.disabledReason??j?.reason??null;/* @__PURE__ */
|
|
4
4
|
return r(l,{variant:j?"secondary":"primary",leftIcon:j?/* @__PURE__ */r(o,{}):void 0,onClick:()=>u.onPress(),disabled:null!==x,disabledReason:x??void 0,tooltip:u.tooltip,loading:!0===u.busy,menuLabel:v.saveOptions,items:S,menuMinWidth:300,children:j?j.label:u.label})}export{m as ScreenMainButton,u as ScreenSaveIcon};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{find as n,remove as t,getList as e,newId as r,duplicate as o,move as l,copyNode as a,insert as c,setProps as i,slotsOf as d}from"./chunk-
|
|
1
|
+
import{find as n,remove as t,getList as e,newId as r,duplicate as o,move as l,copyNode as a,insert as c,setProps as i,slotsOf as d}from"./chunk-EUFDQ4KL.js";import{useRef as s,useSyncExternalStore as p,useCallback as u,useMemo as f}from"react";var m=n=>({kind:"node",id:n});function x(r,o,l,a="none"){const c=n(r,o,l),i=t(r,o,l);if("none"===a||!c)return{data:i,select:null};const d=e(r,o,c.place)??[],s=d[c.place.index+1]??d[c.place.index-1];return s?.props?.id?{data:i,select:m(s.props.id)}:"root"!==c.place.parentId?{data:i,select:m(c.place.parentId)}:{data:i,select:null}}function g(t,e,l,a={}){const c=n(t,e,l)?.node,i=a.id??r(c?.type??"Node");return{data:o(t,e,l,{strip:a.strip,id:i}),select:m(i)}}function I(n,t,e,r){return{data:l(n,t,e,r),select:m(e)}}var h=(n,t)=>({min:0,max:t-1});function v(t,r,o,l,a=h){const c=n(t,r,o);if(!c)return!1;const i=e(t,r,c.place)?.length??0,{min:d,max:s}=a(c.place,i),p=c.place.index+l;return c.place.index>=d&&c.place.index<=s&&p>=d&&p<=s}function b(t,e,r,o,l=h){if(!v(t,e,r,o,l))return null;const a=n(t,e,r);return I(t,e,r,{...a.place,index:a.place.index+o})}function k(n,t,e,r,o={}){const l=a(e,t,{strip:o.strip});return{data:c(n,t,r,l),select:m(l.props.id)}}function y(t,r,o,l){if(n(t,r,o.props.id))return null;const a=e(t,r,l)??[],i={...l,index:Math.max(0,Math.min(l.index,a.length))};return{data:c(t,r,i,o),select:m(o.props.id)}}function O(e,r,o,l){const a=n(e,r,o);return a?l.props.id!==o&&n(e,r,l.props.id)?null:{data:c(t(e,r,o),r,a.place,l),select:m(l.props.id)}:null}function z(n,t,e,r){return{data:i(n,t,e,r),select:void 0}}function M(t,e,r,o=()=>!1){if(!r)return null;if("slot"===r.kind)return n(t,e,r.parentId)?m(r.parentId):null;const l=n(t,e,r.id);if(!l||"root"===l.place.parentId)return null;const a=n(t,e,l.place.parentId);return a?o(a.node,l.place.slot)?{kind:"slot",parentId:a.node.props.id,slot:l.place.slot}:m(a.node.props.id):null}function B(t,e,r,o){const l=n(t,e,r);if(!l)return[];const a=l.path.filter(n=>"root"!==n.parentId).map(n=>n.parentId);return o?[...a.filter(r=>{const l=n(t,e,r);return!l||!o(l.node)}),r]:[...a,r]}function L(n,t){if(0===n.length)return null;const e=null===t?-1:n.indexOf(t);return-1===e?n[0]:n[Math.min(e+1,n.length-1)]}function R(t,e,r,o,l){const a=n(t,e,r);return a?0===d(a.node,e).length?r:L(B(t,e,r,l),o):null}function $(t,e,r,o,l,a,c){const i=n(t,e,r);if(!i)return null;if(0===d(i.node,e).length)return{node:r,part:o};const s="\0part:"+o,p=L([...B(t,e,r,c),s],l===r&&a===o?s:l);return p===s?{node:r,part:o}:{node:p??r,part:null}}function j(t,e,r){if(!r||"node"!==r.kind)return null;const o=n(t,e,r.id);return o?{zone:`${o.place.parentId}:${o.place.slot}`,index:o.place.index}:null}function w(n,t,r){if(!r)return null;const[o,l]=(r.zone??"root:default-zone").split(/:(.*)/s),a={parentId:o,slot:l},c=e(n,t,a)?.[r.index];return c?.props?.id?m(c.props.id):null}var D={get:()=>null,set:()=>{},subscribe:()=>()=>{}};function E(t){const e=s(t);e.current=t;const r=t.clipboard??D,o=p(r.subscribe,r.get,r.get),l=u(n=>{const t=e.current;if(t.readOnly)return!1;const r=n(t.data,t.config);return!!r&&((r.data!==t.data||void 0!==r.select)&&(t.commit(r.data,{select:r.select}),e.current={...t,data:r.data},!0))},[]);return f(()=>{const t=()=>e.current,r=(e,r)=>{const o=n(t().data,t().config,e);return o?{node:o.node,label:r,from:{parentId:o.place.parentId,slot:o.place.slot}}:null};return{held:o,remove:n=>l((e,r)=>x(e,r,n,t().afterRemove)),duplicate:n=>l((e,r)=>g(e,r,n,{strip:t().strip})),move:(n,t)=>l((e,r)=>I(e,r,n,t)),step:(n,e)=>l((r,o)=>b(r,o,n,e,t().stepBounds)),canStep:(n,e)=>v(t().data,t().config,n,e,t().stepBounds),setProps:(n,t)=>l((e,r)=>z(e,r,n,t)),copy:(n,e)=>{const o=r(n,e);return o&&(t().clipboard??D).set(o),!!o},cut:(n,e)=>{if(t().readOnly)return!1;const o=r(n,e);return!!o&&((t().clipboard??D).set(o),l((e,r)=>x(e,r,n,t().afterRemove)))},paste:n=>{const e=(t().clipboard??D).get();return!!e&&l((r,o)=>k(r,o,e.node,n,{strip:t().strip}))},restore:(n,t)=>l((e,r)=>y(e,r,n,t)),swap:(n,t)=>l((e,r)=>O(e,r,n,t)),parentOf:n=>M(t().data,t().config,n,t().slotIsLevel)}},[o,l])}export{v as canStep,R as clickPick,$ as clickPickPart,w as fromItemSelector,L as nextInChain,B as nodeChain,M as parentStep,g as planDuplicate,I as planMove,k as planPaste,x as planRemove,y as planRestore,z as planSetProps,b as planStep,O as planSwap,j as toItemSelector,E as useNodeOps};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{resolveMediaPick as e}from"./chunk-
|
|
1
|
+
import{resolveMediaPick as e}from"./chunk-JIP5JNRB.js";function t(t){const r=t;switch(r?.type){case"storefront-editor:media-picked":{const r=t;return r.requestId&&e(r.requestId,r.media??null),!0}case"storefront-editor:media-pick-cancelled":{const r=t;return r.requestId&&e(r.requestId,null),!0}default:return!1}}export{t as routeSharedHostMessage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e={title:"Add",contextAll:"Sections and blocks",done:"Done",doneDescription:"Close Add and go back",templates:"Your templates",tile:({name:e})=>`Add ${e}`,hint:"Drag onto the page.",search:"Search",onlySections:"Only sections go here",notInside:({name:e})=>`Cannot go inside ${e}`,addingTo:({name:e})=>`Adding to ${e}`,addingBefore:({name:e})=>`Adding before ${e}`,addingAtEnd:"Adding at the end of the page",addingHere:"Adding here"},a=e=>1===e?"1 page":`${e} pages`,
|
|
1
|
+
var e={title:"Add",contextAll:"Sections and blocks",done:"Done",doneDescription:"Close Add and go back",templates:"Your templates",tile:({name:e})=>`Add ${e}`,hint:"Drag onto the page.",search:"Search",onlySections:"Only sections go here",notInside:({name:e})=>`Cannot go inside ${e}`,addingTo:({name:e})=>`Adding to ${e}`,addingBefore:({name:e})=>`Adding before ${e}`,addingAtEnd:"Adding at the end of the page",addingHere:"Adding here"},a=e=>1===e?"1 page":`${e} pages`,t={group:"Shared sections",onPages:({count:e})=>`On ${a(e)}`,makeShared:"Make shared",makeSharedHint:"Use this section on other pages from Add. Change it once, and every page changes.",name:"Name",cancel:"Cancel",makeFailed:"Could not make it shared. Try again.",detach:"Detach from shared",removeFromPage:"Remove from this page",removed:({count:e})=>e>0?`Removed from this page · still on ${a(e)}`:"Removed from this page",deleteShared:"Delete shared section",deleteTitle:({name:e})=>`Delete “${e}”?`,deleteMessage:({count:e})=>0===e?"No page uses it. Nothing on the website changes.":1===e?"The page that uses it keeps its own copy. Nothing disappears from the website.":`The ${e} pages that use it each keep their own copy. Nothing disappears from the website.`,deleteFailed:"Could not delete it. Try again.",alreadyHere:"Already on this page"};var o={savedAgo:function({seconds:e}){const a=Math.max(0,Math.floor(e));if(a<1)return"Saved just now";if(a<60)return`Saved ${a} second${1===a?"":"s"} ago`;const t=Math.floor(a/60);if(t<60)return`Saved ${t} minute${1===t?"":"s"} ago`;const o=Math.floor(t/60);return`Saved ${o} hour${1===o?"":"s"} ago`},saved:"All changes saved",saving:"Saving",pending:"Changes not saved yet — saving in a moment",failedIn:({seconds:e})=>`Not saved — trying again in ${e} s`,failedSoon:"Not saved — trying again soon",offline:"You’re offline — we’ll save when you’re back",pausedHeld:"Auto-save is off — changes not saved",paused:"Auto-save is off",locked:({editing:e})=>`Not saving — ${e}`,blockedOffline:"You’re offline. Try again when you’re back online.",blockedFailed:"Your last changes are not saved yet. Try again when they are.",blockedConflict:"Your last save was refused. See the notice below."},n={blockCount:({count:e})=>`${e} ${1===e?"block":"blocks"}`,loading:"Loading",waitingForAuthorization:"Waiting for editor authorization",missingTemplatePage:"Couldn’t open a page in this template.",missingPage:({slug:e})=>`No page with slug "${e}".`,missingDocument:"Couldn’t open this document.",loadFailed:({cause:e})=>`Could not load the document — ${e}`,noun:"page",pageStyles:"This page",header:"Header",footer:"Footer",pageSections:"Page",templateSections:"Template",addSection:"Add section",addSectionHere:"Add section here",done:"Done",copied:({name:e})=>`Copied ${e}`,pasteRefused:({name:e})=>`${e} can’t be pasted here.`,add:e,shared:t,canvasAddBlock:"Add block",canvasReplaceImage:"Replace image",railMedia:"Media library",leftPanel:"Left panel",resizeLeftPanel:"Resize left panel",leave:{title:"Unsaved changes",body:"Your most recent edits haven’t finished saving yet. Save them before switching, or leave and discard them.",cancel:"Cancel",discard:"Discard & leave",save:"Save & leave",saving:"Saving"},bar:{undo:"Undo",redo:"Redo",refresh:"Reload the preview",refreshTip:"Reload the preview (keeps your place)",notSaving:"Not saving — see the notice below",retry:"Retry now",autoSaveOff:"Auto-save is off — click to turn it back on (saves your held edits)",autoSaveOn:"Auto-save is on — click to pause it",views:"Left panel views",saveOptions:"Save options",autoSave:"Auto-save",saveNow:"Save now"},saveStatus:o,menu:{undo:"Undo",redo:"Redo",collapseAll:"Collapse all layers",selectAll:"Select all",pinned:"Pinned — can’t be moved or deleted",clipboardRefused:"Your browser won’t let us read the clipboard — press ⌘V",itemAddAfter:"Add item after",itemMoveEarlier:"Move item earlier",itemMoveLater:"Move item later",itemDelete:"Delete item"},layers:"Layers",expandAll:"Expand all sections",collapseAll:"Collapse all sections",nothingToFold:"Nothing to fold on this page",rename:"Rename",deleteNamed:({name:e})=>`Delete ${e}`,hideNamed:({name:e})=>`Hide ${e}`,showNamed:({name:e})=>`Show ${e}`,addBlockHere:"Add block here",sectionFirst:({name:e})=>`“${e}” is already first`,sectionLast:({name:e})=>`“${e}” is already last`,sectionMoved:({name:e,n:a,total:t})=>`Moved “${e}” to position ${a} of ${t}`,sectionAdded:({name:e})=>`Added “${e}” section`,deleted:({name:e})=>`Deleted “${e}”`,resizeSettingsPanel:"Resize settings panel",sectionSettings:({name:e})=>`${e} settings`,headerSettings:"Header settings",addBlockMenu:"Add block",deviceNote:{tablet:"Tablet uses the desktop settings.",mobile:"Showing the phone settings for this section."}};export{e as DEFAULT_SCREEN_ADD_WORDS,o as DEFAULT_SCREEN_SAVE_STATUS_WORDS,t as DEFAULT_SCREEN_SHARED_WORDS,n as DEFAULT_SCREEN_WORDS};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{PanelToggleIcon as e}from"./chunk-UMDQ6CLQ.js";import{InspectorHead as n}from"./chunk-
|
|
1
|
+
import{PanelToggleIcon as e}from"./chunk-UMDQ6CLQ.js";import{InspectorHead as n}from"./chunk-VBEVZZTV.js";import{DEFAULT_CHROME_WORDS as i}from"./chunk-AJSDWWJW.js";import{useWords as o}from"./chunk-MFIRYGHW.js";import{Tooltip as s,IconButton as t,Button as c}from"efficient-shell/ui";import{jsx as r,jsxs as l,Fragment as d}from"react/jsx-runtime";function a({icon:e,title:i,context:o,actions:s,side:t="left",onHide:c}){/* @__PURE__ */
|
|
2
2
|
return r(n,{icon:e,name:i,kind:o,actions:s||c?/* @__PURE__ */l(d,{children:[s,c?/* @__PURE__ */r(m,{side:t,onHide:c,divider:Boolean(s)}):null]}):void 0})}function m({side:n,onHide:c,divider:a=!1}){const m=o("chrome",i);/* @__PURE__ */
|
|
3
3
|
return l(d,{children:[a?/* @__PURE__ */r("span",{className:"sf-head-divider","aria-hidden":"true"}):null,
|
|
4
4
|
/* @__PURE__ */r(s,{content:m.hidePanel,side:"bottom",children:/* @__PURE__ */r(t,{className:"es-insp-iconbtn","aria-label":m.hidePanelLabel({side:n}),onClick:c,children:/* @__PURE__ */r(e,{side:n})})})]})}function h({side:n,onShow:c}){const l=o("chrome",i);/* @__PURE__ */
|