email-builder-online 4.3.0 → 4.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{EditorContext-DlWj3SOK.js → EditorContext-CshOthVX.js} +1 -1
- package/dist/{captureThumbnail-B_uv4YoN.js → captureThumbnail-CsHIP-6e.js} +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +121 -118
- package/dist/{lazyThumbnailGenerator-CTd4SLVr.js → lazyThumbnailGenerator-BTfXeGKJ.js} +2 -2
- package/dist/{seedLocalLibrary-BiPLxvr4.js → seedLocalLibrary-CDzh8PGl.js} +1 -1
- package/dist/standalone.js +1 -1
- package/dist/standalone.mjs +2 -1
- package/package.json +4 -3
- package/dist/rolldown-runtime-Ck3dxwZt.js +0 -38
package/dist/standalone.js
CHANGED
|
@@ -1457,7 +1457,7 @@ Error generating stack: `+de.message+`
|
|
|
1457
1457
|
<style>html,body{margin:0;padding:0;background:transparent;overflow:hidden;}body{font-family:Helvetica,Arial,sans-serif;}</style>
|
|
1458
1458
|
</head>
|
|
1459
1459
|
<body></body>
|
|
1460
|
-
</html>`,tm5=qH;function rm5(e,t){const r=e.head;if(r.querySelector("link[data-eb-fonts]")===null){const n=e.createElement("link");n.setAttribute("data-eb-fonts","1"),n.rel="stylesheet",n.href=tm5,r.appendChild(n)}if(r.querySelector("style[data-eb-globals]")===null){const n=e.createElement("style");n.setAttribute("data-eb-globals","1"),n.textContent=tKe,r.appendChild(n)}e.documentElement.style.overflow="hidden",e.body.style.overflow="hidden",e.body.style.backgroundColor=t}function nm5(){const e=(0,G.useTheme)(),{t}=Xt("inspector"),r=$f5(),n=(0,ie.useRef)(null),a=(0,ie.useRef)(null),[d,p]=(0,ie.useState)(null),[h,f]=(0,ie.useState)(null),[m,v]=(0,ie.useState)("root"),[g,A]=(0,ie.useState)(!1),[y,S]=(0,ie.useState)(null),[x,O]=(0,ie.useState)(null),[w,E]=(0,ie.useState)(!1),[L,H]=(0,ie.useState)("desktop"),[V,F]=(0,ie.useState)(()=>typeof window<"u"?window.innerHeight:800),U=(0,ie.useRef)(null),I=(0,ie.useCallback)(()=>{const ze=n.current;if(ze===null)return;const pe=ze.contentDocument;pe!==null&&(rm5(pe,(Ke.getState().document.root?.data??{}).backdropColor??OKe),p(pe.body))},[]);(0,ie.useEffect)(()=>{const ze=()=>F(window.innerHeight);return window.addEventListener("resize",ze),()=>window.removeEventListener("resize",ze)},[]),(0,ie.useEffect)(()=>{if(r===null)return;const ze=`${r.category}|${r.axis}|${r.id}`;U.current=ze,S(null),E(!1),H("desktop");let pe=!1;Xf5(r).then(Z=>{U.current===ze&&(pe=!0,(0,ie.startTransition)(()=>{f(Z.doc),v(Z.rootBlockId)}),A(!1))}).catch(Z=>{U.current===ze&&(pe=!0,S(Z instanceof Error?Z.message:String(Z)),A(!1))}),Promise.resolve().then(()=>{!pe&&U.current===ze&&A(!0)})},[r]),(0,ie.useEffect)(()=>{if(d===null||r===null)return;const ze=(Ke.getState().document.root?.data??{}).backdropColor??OKe;d.style.backgroundColor=ze},[d,r]),(0,ie.useEffect)(()=>{if(d===null)return;const ze=()=>{const Z=d.firstElementChild,be=Z!==null&&Z.offsetHeight>0?Z.offsetHeight:d.scrollHeight;O(be)};ze();const pe=new ResizeObserver(ze);return pe.observe(d),()=>pe.disconnect()},[d,h]);const $=r?.category==="template",Q=$?Yf5:Qf5,K=$?Math.round(V*Jf5):Kf5,Y=L==="mobile"?Gf5:Wf5,ee=x??K,re=Q/Y,oe=w?re:Math.min(re,K/ee),le=Y*oe,X=ee*oe,se=Math.max(qf5,Math.min(X,K));(0,ie.useEffect)(()=>{a.current&&(a.current.scrollTop=0)},[w,L,r]);const Ae=(0,ie.useMemo)(()=>h===null?null:(0,C.jsx)(VZ,{document:h,rootBlockId:m,viewport:L}),[h,m,L]);return(0,C.jsx)(G.Popper,{open:r!==null,anchorEl:r?.anchor??null,placement:"right-start",keepMounted:!0,modifiers:[{name:"offset",options:{offset:[0,8]}},{name:"flip",enabled:!1},{name:"preventOverflow",options:{boundary:"viewport",padding:8,altAxis:!0}}],sx:{zIndex:e.zIndex.tooltip+1,pointerEvents:r!==null?"auto":"none",visibility:r!==null?"visible":"hidden"},children:(0,C.jsxs)(G.Paper,{elevation:6,onMouseEnter:Nf5,onMouseLeave:Ipo,sx:{width:Q+24,padding:1.5,display:"flex",flexDirection:"column",gap:1,backgroundColor:e.palette.background.paper,border:`1px solid ${e.palette.divider}`},children:[(0,C.jsxs)(G.Box,{sx:{display:"flex",alignItems:"center",gap:.5},children:[(0,C.jsx)(G.Typography,{variant:"caption",color:"text.secondary",sx:{fontWeight:600,flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:r?.name??""}),(0,C.jsx)(G.Tooltip,{title:L==="mobile"?t("componentsLibrary.preview.desktop","Desktop view"):t("componentsLibrary.preview.mobile","Mobile view"),children:(0,C.jsx)(G.IconButton,{size:"small",onClick:()=>H(ze=>ze==="mobile"?"desktop":"mobile"),sx:{flexShrink:0},children:L==="mobile"?(0,C.jsx)(Kve,{fontSize:"small"}):(0,C.jsx)(PF,{fontSize:"small"})})}),(0,C.jsx)(G.Tooltip,{title:w?t("componentsLibrary.preview.fit","Fit to view"):t("componentsLibrary.preview.zoom","Zoom in"),children:(0,C.jsx)(G.IconButton,{size:"small",onClick:()=>E(ze=>!ze),sx:{flexShrink:0},children:w?(0,C.jsx)(UBe,{fontSize:"small"}):(0,C.jsx)(WBe,{fontSize:"small"})})})]}),(0,C.jsxs)(G.Box,{ref:a,sx:{position:"relative",width:Q,height:se,mx:"auto",display:"flex",justifyContent:"center",alignItems:"flex-start",backgroundColor:e.palette.action.hover,borderRadius:1,overflowY:w?"auto":"hidden",overflowX:"hidden"},children:[(0,C.jsx)(G.Box,{sx:{position:"relative",width:le,height:X,flexShrink:0},children:(0,C.jsx)("iframe",{ref:n,srcDoc:em5,title:t("componentsLibrary.preview.iframeTitle","Live preview"),sandbox:"allow-same-origin",onLoad:I,style:{position:"absolute",top:0,left:0,width:Y,height:ee,border:0,display:"block",backgroundColor:"transparent",transform:`scale(${oe})`,transformOrigin:"top left",pointerEvents:"none"}})}),d!==null&&Ae!==null&&y===null&&(0,Uf5.createPortal)(Ae,d),g&&(0,C.jsx)(G.Box,{sx:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(255,255,255,0.6)"},children:(0,C.jsx)(G.CircularProgress,{size:24})}),y!==null&&(0,C.jsx)(G.Box,{sx:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",p:2,backgroundColor:e.palette.background.paper},children:(0,C.jsx)(G.Typography,{variant:"body2",color:"error",sx:{textAlign:"center"},children:y})})]})]})})}var am5=["updatedDesc","createdDesc","nameAsc","nameDesc","sizeDesc","sizeAsc","blocksDesc","blocksAsc"];function im5(e,t){const r=t.search.trim().toLowerCase();return e.filter(n=>{if(t.axes.length>0&&!t.axes.includes(n.axis))return!1;if(t.tags.length>0){const a=n.tags??[];if(!t.tags.every(d=>a.includes(d)))return!1}return!(r.length>0&&![n.name,n.description??"",n.axis,...n.tags??[]].join(" ").toLowerCase().includes(r))})}function om5(e,t){const r=[...e],n=(a,d)=>a.name.localeCompare(d.name);switch(t){case"nameAsc":return r.sort(n);case"nameDesc":return r.sort((a,d)=>n(d,a));case"createdDesc":return r.sort((a,d)=>a.createdAt<d.createdAt?1:a.createdAt>d.createdAt?-1:0);case"sizeAsc":return r.sort((a,d)=>a.sizeBytes-d.sizeBytes);case"sizeDesc":return r.sort((a,d)=>d.sizeBytes-a.sizeBytes);case"blocksAsc":return r.sort((a,d)=>a.blockCount-d.blockCount);case"blocksDesc":return r.sort((a,d)=>d.blockCount-a.blockCount);default:return r.sort((a,d)=>a.updatedAt<d.updatedAt?1:a.updatedAt>d.updatedAt?-1:0)}}function lm5({columns:e=2,count:t=4,thumbnailHeight:r=120}){return(0,C.jsx)(G.Box,{sx:{display:"grid",gridTemplateColumns:`repeat(${e}, minmax(0, 1fr))`,gap:.5,pt:.5},"aria-busy":"true","aria-live":"polite",children:Array.from({length:t}).map((n,a)=>(0,C.jsxs)(G.Stack,{spacing:.75,sx:{p:.5},children:[(0,C.jsx)(G.Skeleton,{variant:"rounded",animation:"wave",height:r,sx:{borderRadius:1}}),(0,C.jsx)(G.Skeleton,{variant:"text",animation:"wave",width:"70%"}),(0,C.jsx)(G.Skeleton,{variant:"text",animation:"wave",width:"45%"})]},a))})}CY1();function sm5({src:e,alt:t,height:r=120,placeholderText:n}){const a=(0,G.useTheme)(),d={width:"100%",height:r,borderRadius:4,backgroundColor:a.palette.background.default,display:"block"};return e===null?(0,C.jsxs)(G.Box,{sx:{...d,border:`1px dashed ${a.palette.divider}`,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:.5,color:"text.secondary"},"aria-label":t,children:[(0,C.jsx)(Mye,{sx:{fontSize:24,opacity:.6}}),n!==void 0&&(0,C.jsx)(G.Typography,{variant:"caption",sx:{opacity:.7},children:n})]}):(0,C.jsx)("img",{src:e,alt:t,loading:"lazy",decoding:"async",style:{...d,objectFit:"cover",objectPosition:"top center",border:`1px solid ${a.palette.divider}`},onError:p=>{const h=p.currentTarget;h.style.display="none"}})}var um5={section:"sections",layout:"layouts",template:"templates"};function cm5(e,t,r){const n=id(),a=um5[e];if(e==="template")return`${n}/dev/${a}/${encodeURIComponent(r)}/thumbnail`;if(t===null)throw new Error(`category '${e}' requires an axis but received null`);return`${n}/dev/${a}/${encodeURIComponent(t)}/${encodeURIComponent(r)}/thumbnail`}dr(),Lr(),bv();var Kz3=380,qz3=64,gz="__other__",dm5=[{key:"blocks",labelKey:"componentsLibrary.drawer.category.blocks",enabled:!0},{key:"sections",labelKey:"componentsLibrary.drawer.category.sections",enabled:!0},{key:"templates",labelKey:"componentsLibrary.drawer.category.templates",enabled:!0}];function $po({item:e,category:t,onClick:r}){const{t:n}=Xt("inspector"),a=(0,G.useTheme)(),d=t!=="template",[{isDragging:p},h]=X9(()=>({type:k4,item:()=>({kind:k4,category:t,axis:e.axis,id:e.id}),canDrag:()=>d,collect:g=>({isDragging:g.isDragging()})}),[t,e.axis,e.id,d]);(0,ie.useEffect)(()=>{p&&Bpo()},[p]);const f=t==="section"||t==="layout"||t==="template",m=t==="primitive"&&e.block!==void 0,v=f&&e.hasThumbnail?ad()==="local"?$15(e.id):cm5(t,t==="template"?null:e.axis,e.id):null;return(0,C.jsxs)(G.Box,{ref:g=>{d&&g&&h(g)},onMouseEnter:g=>Bf5({anchor:g.currentTarget,category:t,axis:e.axis,id:e.id,name:e.name,primitiveBlock:t==="primitive"?e.block:void 0}),onMouseLeave:Ipo,onClick:r?()=>r(e):void 0,sx:{p:1,borderRadius:1,border:"1px dashed",borderColor:a.palette.divider,cursor:r?"pointer":"grab",opacity:p?.5:1,display:"flex",flexDirection:"column",gap:.75,transition:"background-color 120ms ease, border-color 120ms ease","&:hover":{backgroundColor:a.palette.action.hover,borderColor:a.palette.secondary.main},"&:active":{cursor:"grabbing"}},children:[m&&(0,C.jsx)(Vpo,{id:e.id,block:e.block,alt:e.name}),f&&(0,C.jsx)(sm5,{src:v,alt:e.name,placeholderText:n("componentsLibrary.thumbnail.placeholder","No preview")}),(0,C.jsxs)(G.Box,{sx:{display:"flex",alignItems:"center",gap:.75},children:[(0,C.jsx)(GN,{sx:{fontSize:16,color:"text.secondary",flexShrink:0,display:d?"inline-flex":"none"}}),(0,C.jsx)(G.Box,{sx:{minWidth:0,flex:1},children:(0,C.jsx)(G.Typography,{variant:"body2",sx:{fontSize:"0.8rem",fontWeight:500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:e.name,children:e.name})})]})]})}var jKe=24;function pm5({items:e,columns:t,renderItem:r}){const[n,a]=(0,ie.useState)(jKe),d=(0,ie.useRef)(null);return(0,ie.useEffect)(()=>{a(jKe)},[e]),(0,ie.useEffect)(()=>{const p=d.current;if(!p)return;const h=new IntersectionObserver(f=>{f[0]?.isIntersecting&&a(m=>m<e.length?Math.min(e.length,m+jKe):m)},{rootMargin:"300px"});return h.observe(p),()=>h.disconnect()},[e.length,n]),(0,C.jsxs)(G.Box,{sx:{mt:1.5},children:[(0,C.jsx)(G.Box,{sx:{display:"grid",gridTemplateColumns:`repeat(${t}, minmax(0, 1fr))`,gap:.5},children:e.slice(0,n).map(p=>r(p))}),n<e.length&&(0,C.jsx)(G.Box,{ref:d,sx:{height:1}})]})}function Upo({items:e,category:t,loading:r,error:n,groupLabelKey:a,columns:d,virtualize:p,search:h,sort:f,onClick:m,onRename:v,onDelete:g}){const{t:A}=Xt("inspector"),[y]=(0,ie.useState)([]),[S,x]=(0,ie.useState)({}),O=(0,ie.useMemo)(()=>({search:h,axes:[],tags:y,sort:f}),[h,y,f]),w=(0,ie.useMemo)(()=>om5(im5(e,O),f),[e,O,f]),E=(0,ie.useMemo)(()=>{const U=new Map;for(const I of w){const $=U.get(I.axis)??[];$.push(I),U.set(I.axis,$)}return Array.from(U.keys()).sort((I,$)=>I===gz?1:$===gz?-1:I.localeCompare($)).map(I=>({axis:I,items:U.get(I)??[]}))},[w]),L=E.length===0||E.length===1&&E[0].axis==="",H=U=>U===gz?A("componentsLibrary.drawer.usageOther","Other"):a?A(`${a}.${U}`,U):U,V=(U,I)=>p?(0,C.jsx)(pm5,{items:U,columns:d??2,renderItem:$=>(0,C.jsx)($po,{item:$,category:t,onClick:m,onRename:v,onDelete:g},$.id)}):(0,C.jsx)(G.Box,{sx:{display:"grid",gridTemplateColumns:d?`repeat(${d}, minmax(0, 1fr))`:"1fr",gap:.5},children:U.map($=>(0,C.jsx)($po,{item:$,category:t,onClick:m,onRename:v,onDelete:g},`${I}/${$.id}`))}),F=()=>n?(0,C.jsx)(G.Alert,{severity:"error",sx:{mt:1},children:n}):r&&e.length===0?(0,C.jsx)(lm5,{columns:d??2,count:4}):!r&&e.length===0?(0,C.jsx)(Af5,{icon:(0,C.jsx)(sSe,{}),title:A("componentsLibrary.drawer.emptyTitle","Your library is empty"),description:A("componentsLibrary.drawer.empty")}):(0,C.jsx)(G.Stack,{spacing:1,sx:{pt:.5},children:w.length===0?(0,C.jsx)(G.Typography,{variant:"body2",color:"text.secondary",sx:{mt:1},children:A("componentsLibrary.drawer.noResults","No components match your search.")}):L?V(w,"flat"):(0,C.jsx)(G.Box,{children:E.map((U,I)=>(0,C.jsx)(Hf5,{title:H(U.axis),count:U.items.length,expanded:S[U.axis]??I===0,onToggle:$=>x(Q=>({...Q,[U.axis]:$})),children:V(U.items,U.axis)},U.axis))})});return(0,C.jsx)(C.Fragment,{children:F()})}async function Wpo(e,t){const r=await fetch(e);if(!r.ok){const n=await r.json().catch(()=>null);throw r.status===403?new Error(n?.hint??"Endpoint disabled in this environment."):new Error(n?.error??`HTTP ${r.status}`)}return(await r.json())[t]??[]}function hm5({refreshKey:e,search:t,sort:r,onRename:n,onChange:a}){const{t:d}=Xt("inspector"),[p,h]=(0,ie.useState)([]),[f,m]=(0,ie.useState)(!1),[v,g]=(0,ie.useState)(null),A=(0,ie.useCallback)(async()=>{m(!0),g(null);try{if(ad()==="local"){h(q15("section"));return}const y=await Wpo(`${id()}/dev/sections`,"sections");h(y.map(S=>({...S,axis:S.role})))}catch(y){g(y instanceof Error?y.message:String(y))}finally{m(!1)}},[]);return(0,ie.useEffect)(()=>{A()},[A,e]),(0,C.jsx)(Upo,{items:p,category:"section",loading:f,error:v,columns:2,groupLabelKey:"componentsLibrary.sectionRole",search:t,sort:r,onRename:y=>n({category:"section",axis:y.axis,id:y.id,name:y.name,description:y.description,tags:y.tags}),onDelete:(0,ie.useCallback)(async y=>{if(window.confirm(d("componentsLibrary.drawer.deleteConfirm",'Delete component "{{name}}"? This cannot be undone.',{name:y.name})))try{if(ad()==="local")en5("section",y.id);else{const S=await fetch(`${id()}/dev/sections/${encodeURIComponent(y.axis)}/${encodeURIComponent(y.id)}`,{method:"DELETE"});if(!S.ok){const x=await S.json().catch(()=>null);throw new Error(x?.error??`HTTP ${S.status}`)}}h(S=>S.filter(x=>!(x.axis===y.axis&&x.id===y.id))),a()}catch(S){g(S instanceof Error?S.message:String(S))}},[d,a])})}function fm5({refreshKey:e,search:t,sort:r,onRename:n,onChange:a}){const[d,p]=(0,ie.useState)([]),[h,f]=(0,ie.useState)(!1),[m,v]=(0,ie.useState)(null),[g,A]=(0,ie.useState)(null),{t:y}=Xt("inspector"),S=(0,ie.useCallback)(async()=>{f(!0),v(null);try{if(ad()==="local"){p(W15().map(O=>({...O,axis:gz})));return}const x=await Wpo(`${id()}/dev/templates`,"templates");p(x.map(O=>({...O,axis:O.usage||gz})))}catch(x){v(x instanceof Error?x.message:String(x))}finally{f(!1)}},[]);return(0,ie.useEffect)(()=>{S()},[S,e]),(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(Upo,{items:d,category:"template",loading:h,error:m,columns:2,virtualize:!0,search:t,sort:r,onClick:A,onRename:x=>n({category:"template",axis:"",id:x.id,name:x.name,description:x.description,tags:x.tags}),onDelete:(0,ie.useCallback)(async x=>{if(window.confirm(y("componentsLibrary.drawer.deleteConfirm","Delete?",{name:x.name})))try{if(ad()==="local")K15(x.id);else{const O=await fetch(`${id()}/dev/templates/${encodeURIComponent(x.id)}`,{method:"DELETE"});if(!O.ok){const w=await O.json().catch(()=>null);throw new Error(w?.error??`HTTP ${O.status}`)}}p(O=>O.filter(w=>w.id!==x.id)),a()}catch(O){v(O instanceof Error?O.message:String(O))}},[y,a])}),(0,C.jsx)(bf5,{templateId:g?.id??null,templateName:g?.name??"",onClose:()=>A(null),onApplied:()=>A(null)})]})}function mm5(){const e=B4e(),t=e?380:64,r=aO(),n=sO(),a=qyt(),d=xIo(),{t:p}=Xt("inspector"),h=(0,G.useTheme)(),f=(0,ie.useMemo)(()=>dm5.filter(Q=>!(!a&&Q.key==="templates")),[a]),[m,v]=(0,ie.useState)(0),[g,A]=(0,ie.useState)(0),[y,S]=(0,ie.useState)(null),[x,O]=(0,ie.useState)(""),[w,E]=(0,ie.useState)("updatedDesc"),[L,H]=(0,ie.useState)(null),[V,F]=(0,ie.useState)(()=>f[0]?.key??"blocks");(0,ie.useEffect)(()=>{f.some(Q=>Q.key===V)||F(f[0]?.key??"blocks")},[f,V]),(0,ie.useEffect)(()=>{d!==0&&(v(Q=>Q+1),A(Q=>Q+1),Npo())},[d]);const U=()=>{Bpo(),bF(!1)},I=()=>{v(Q=>Q+1),A(Q=>Q+1),Npo()},$=(0,ie.useCallback)(Q=>{switch(Q){case"section":v(K=>K+1);break;case"template":A(K=>K+1);break}},[]);return!r||n!=="editor"?null:(0,C.jsxs)(G.Box,{sx:{position:"absolute",top:0,left:0,bottom:0,zIndex:10,width:t,flexShrink:0,overflow:"hidden",transition:"width 220ms cubic-bezier(0.4, 0, 0.2, 1)",backgroundColor:h.palette.background.paper,borderRight:`1px solid ${h.palette.divider}`,display:"flex",flexDirection:"column",pointerEvents:"auto"},children:[(0,C.jsx)(G.Box,{sx:{width:t,height:"100%",display:"flex",flexDirection:"column"},children:e?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(G.Stack,{direction:"row",sx:{px:1.5,py:1,borderBottom:`1px solid ${h.palette.divider}`,alignItems:"center",justifyContent:"space-between"},children:[(0,C.jsx)(G.Typography,{variant:"subtitle2",children:p("componentsLibrary.drawer.title")}),(0,C.jsxs)(G.Stack,{direction:"row",spacing:.5,children:[(0,C.jsx)(G.Tooltip,{title:p("componentsLibrary.drawer.refresh"),children:(0,C.jsx)(G.IconButton,{size:"small",onClick:I,children:(0,C.jsx)(Hze,{fontSize:"small"})})}),(0,C.jsx)(G.Tooltip,{title:p("componentsLibrary.drawer.close"),children:(0,C.jsx)(G.IconButton,{size:"small",onClick:U,children:(0,C.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,C.jsx)("polyline",{points:"11 17 6 12 11 7"}),(0,C.jsx)("polyline",{points:"18 17 13 12 18 7"})]})})})]})]}),(0,C.jsx)(G.Box,{sx:{px:1.5,borderBottom:`1px solid ${h.palette.divider}`},children:(0,C.jsx)(G.Tabs,{value:V,onChange:(Q,K)=>F(K),variant:"fullWidth",slotProps:{indicator:{sx:{height:"3px",borderRadius:"4px"}}},sx:{minHeight:40},children:f.map(Q=>(0,C.jsx)(G.Tab,{value:Q.key,label:p(Q.labelKey),sx:{minHeight:40,minWidth:0,px:1,fontSize:"0.72rem",textTransform:"none"}},Q.key))})}),(0,C.jsxs)(G.Box,{sx:{flex:1,minHeight:0,overflowY:"auto",px:1.5,pb:2,pt:1},children:[V==="blocks"&&(0,C.jsx)(kf5,{}),V==="sections"&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(G.Box,{sx:{pb:1.5},children:(0,C.jsxs)(G.Stack,{direction:"row",spacing:.5,sx:{alignItems:"center"},children:[(0,C.jsx)(G.TextField,{size:"small",fullWidth:!0,value:x,onChange:Q=>O(Q.target.value),placeholder:p("componentsLibrary.search.placeholder","Search…"),sx:g5,slotProps:{input:{startAdornment:(0,C.jsx)(G.InputAdornment,{position:"start",children:(0,C.jsx)(_Ee,{fontSize:"small"})})}}}),(0,C.jsx)(G.Tooltip,{title:p("componentsLibrary.search.sortLabel","Sort"),children:(0,C.jsx)(G.IconButton,{size:"small",onClick:Q=>H(Q.currentTarget),sx:{flexShrink:0,color:L?"primary.main":"text.secondary"},children:(0,C.jsx)(zHe,{fontSize:"small"})})}),(0,C.jsx)(G.Menu,{anchorEl:L,open:!!L,onClose:()=>H(null),anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:am5.map(Q=>(0,C.jsx)(G.MenuItem,{selected:w===Q,onClick:()=>{E(Q),H(null)},sx:{fontSize:"0.8rem"},children:p(`componentsLibrary.search.sort.${Q}`,Q)},Q))})]})}),(0,C.jsx)(hm5,{search:x,sort:w,onRename:S,refreshKey:m,onChange:()=>v(Q=>Q+1)})]}),V==="templates"&&(0,C.jsx)(fm5,{search:x,sort:w,onRename:S,refreshKey:g,onChange:()=>A(Q=>Q+1)})]})]}):(0,C.jsx)(Df5,{})}),(0,C.jsx)(_f5,{target:y,onClose:()=>S(null),onRenamed:()=>{y&&$(y.category),S(null)}}),(0,C.jsx)(nm5,{})]})}dr(),zF(),Lr();function vm5(){const e=B4e(),t=aO(),r=sO(),{t:n}=Xt("inspector");return!t||r!=="editor"?null:(0,C.jsx)(G.Box,{sx:{position:"absolute",left:e?380:64,top:"50%",transform:"translateY(-50%)",zIndex:10,transition:"left 220ms cubic-bezier(0.4, 0, 0.2, 1)"},children:(0,C.jsx)(G.Tooltip,{title:n(e?"componentsLibrary.drawer.handleClose":"componentsLibrary.drawer.handleOpen"),placement:"right",children:(0,C.jsxs)(G.ButtonBase,{onClick:DIo,"aria-label":n(e?"componentsLibrary.drawer.handleClose":"componentsLibrary.drawer.handleOpen"),sx:a=>({width:28,minHeight:96,borderTopRightRadius:8,borderBottomRightRadius:8,backgroundColor:e?a.palette.secondary.main:a.palette.background.paper,color:e?a.palette.secondary.contrastText:a.palette.text.primary,border:`1px solid ${a.palette.divider}`,borderLeft:"none",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:.75,py:1,boxShadow:"2px 0 8px rgba(0,0,0,0.06)",transition:"background-color 120ms ease, color 120ms ease","&:hover":{backgroundColor:e?a.palette.secondary.dark:a.palette.mode==="dark"?a.palette.grey[800]:a.palette.grey[200]}}),children:[(0,C.jsx)(OO,{sx:{fontSize:18}}),(0,C.jsx)(G.Box,{sx:{writingMode:"vertical-rl",transform:"rotate(180deg)",fontSize:"0.7rem",fontWeight:600,letterSpacing:"0.04em",textTransform:"uppercase"},children:n("componentsLibrary.drawer.handle")})]})})})}var Gpo=(0,ie.createContext)(!1),_m5=Gpo.Provider,fd=()=>(0,ie.useContext)(Gpo);Lr();function bz(e,t){yF(e,t)}function Az(e,t){bz(e,r=>{const n=r.data&&"props"in r.data?r.data.props:void 0,a={...n!==null&&typeof n=="object"?n:{}},d=typeof t=="function"?t(a):t,p={...a,...typeof d=="object"&&d!==null?d:{}};return a===p?r:{...r,data:{...r.data,props:p}}})}oi(),Lr();var Qpo=(0,ie.createContext)(null),QX=()=>(0,ie.useContext)(Qpo),YX=(0,ie.memo)(function({id:t,isNotClient:r}){const n=Ke(h=>h.document[t]),a=Ke(h=>h.document?.root?.data?.theme),d=ll(),p=(0,ie.useMemo)(()=>n?XH(n,a,d,Sz[n.type]):void 0,[n,a,d]);return p?(0,C.jsx)(Qpo.Provider,{value:t,children:(0,C.jsx)(Bm5,{isNotClient:r,...p,blockId:t})}):(console.warn(`Block ${t} not found`),null)},(e,t)=>e.id===t.id&&e.isNotClient===t.isNotClient);dr(),Lr();function Um({childrenIds:e,onChange:t,parentId:r,position:n,isNotClient:a}){const{t:d}=Xt(),[{isOver:p},h]=GE(()=>({accept:["block",k4],drop:(m,v)=>{if(v.getItemType()==="library-component"){if(v.didDrop()){v.getDropResult();return}if(m.category==="block"&&typeof m.buttonIndex=="number"){const y=Lp[m.buttonIndex];if(!y)return;rv(r,y.block(),n);return}if(m.category==="block-preset"&&typeof m.presetIndex=="number"){const y=NX[m.presetIndex];if(!y)return;rv(r,y.block,n);return}const A=m;if(A.category==="template"){console.warn("[ComponentsLibrary] templates cannot be dropped inline; click the card in the drawer to apply.");return}(async()=>{try{oSt(r,(await BX(A.category,A.axis,A.id)).blocks,n)}catch(y){console.error("[ComponentsLibrary] failed to append saved subtree",y)}})();return}const g=m.blockId;if(v.didDrop()){v.getDropResult();return}return n===void 0?vBo({parentId:r,blockId:g}):mBo({parentId:r,blockId:g,indexArray:n})},canDrop:(m,v)=>{if(v.getItemType()==="library-component")return!0;const g=m.blockId;return!tv({targetId:r,draggedId:g})&&g!==r},collect:m=>({isOver:m.canDrop()?!!m.isOver():!1})}),[r,n]),f=e&&e.length>0?(0,C.jsx)(G.Box,{ref:m=>{h(m)},sx:{minHeight:0,border:p?"2px solid":"",borderColor:p?"secondary.main":void 0},"aria-hidden":!0}):null;return a?e.map(m=>(0,C.jsx)(ie.Fragment,{children:(0,C.jsx)(YX,{id:m,isNotClient:a})},m)):!e||e.length===0?(0,C.jsx)(G.Box,{ref:m=>{h(m)},sx:{minHeight:96,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:1,border:p?"2px solid":"1px dashed",borderColor:p?"secondary.main":"divider",backgroundImage:m=>`repeating-linear-gradient(45deg, ${m.palette.action.hover} 0, ${m.palette.action.hover} 1px, transparent 1px, transparent 12px)`,backgroundColor:p?"action.hover":"transparent",transition:"background-color 120ms ease, border-color 120ms ease"},children:(0,C.jsxs)(G.Stack,{spacing:.75,sx:{px:2,color:"text.secondary",alignItems:"center"},children:[(0,C.jsx)(YFe,{sx:{fontSize:22,opacity:.7}}),(0,C.jsx)(G.Typography,{variant:"body2",color:"text.secondary",sx:{textAlign:"center"},children:d("editor.emptyCanvasDropHint","Drag a block here from the library")})]})}):(0,C.jsxs)(C.Fragment,{children:[e.map(m=>(0,C.jsx)(ie.Fragment,{children:(0,C.jsx)(YX,{id:m})},m)),f]})}oi();var MKe=zT;iQe(),EX(),Lr();var gm5=[{childrenIds:[]},{childrenIds:[]},{childrenIds:[]}];function bm5({style:e,props:t,blockId:r,isNotClient:n}){const a=QX(),{columns:d,...p}=t??{},h=d??gm5,f=(m,{block:v,blockId:g,childrenIds:A})=>{const y=Ke.getState().document[a],S=y?.data?.props?.columns??h,x=y?.data?.props?{...y.data.props}:{...p};delete x.columns;const O=S.length===2?[...S,{childrenIds:[]}]:[...S];O[m]={childrenIds:A};const w={...x,fixedWidths:x.fixedWidths?.length===2?[...x.fixedWidths,null]:x.fixedWidths},E={type:"ColumnsContainer",data:MKe.parse({style:y?.data?.style??e,props:{...w,columns:O}})};yBo({[g]:v,[a]:E}),s2(g)};return n?(0,C.jsx)(C.Fragment,{children:(0,C.jsx)(nQe,{blockId:r,props:p,style:e,columns:[(0,C.jsx)(Um,{isNotClient:n,parentId:r,position:0,childrenIds:d?.[0]?.childrenIds,onChange:m=>f(0,m)}),(0,C.jsx)(Um,{isNotClient:n,parentId:r,position:1,childrenIds:d?.[1]?.childrenIds,onChange:m=>f(1,m)}),(0,C.jsx)(Um,{isNotClient:n,parentId:r,position:2,childrenIds:d?.[2]?.childrenIds,onChange:m=>f(2,m)})]})}):(0,C.jsx)(PX,{children:(0,C.jsx)(nQe,{blockId:r,props:p,style:e,columns:[(0,C.jsx)(Um,{parentId:r,position:0,childrenIds:d?.[0]?.childrenIds,onChange:m=>f(0,m)}),(0,C.jsx)(Um,{parentId:r,position:1,childrenIds:d?.[1]?.childrenIds,onChange:m=>f(1,m)}),(0,C.jsx)(Um,{parentId:r,position:2,childrenIds:d?.[2]?.childrenIds,onChange:m=>f(2,m)})]})})}function Am5({childrenIds:e}){return(0,C.jsx)(C.Fragment,{children:e.map(t=>(0,C.jsx)(ie.Fragment,{children:(0,C.jsx)(YX,{isNotClient:!0,id:t})},t))})}lQe(),EX(),Lr();function ym5({style:e,props:t,blockId:r,isNotClient:n}){const a=t?.childrenIds??[],d=QX();return(0,C.jsx)(Nso,{style:e,blockId:`${r}`,children:n?(0,C.jsx)(Am5,{parentId:r,childrenIds:a,onChange:({block:p,blockId:h,childrenIds:f})=>{U4e(d,h,p,f),s2(h)}}):(0,C.jsx)(PX,{children:(0,C.jsx)(Um,{parentId:r,childrenIds:a,onChange:({block:p,blockId:h,childrenIds:f})=>{U4e(d,h,p,f),s2(h)}})})})}oi();var Ypo=JH;v5(),EX(),Lr(),hA();function Sm5(e){const t=e.childrenIds??[],r=QX(),n=ll();return(0,C.jsx)("div",{onClick:()=>{s2(null)},style:{backgroundColor:e.backdropColor??"#F5F5F5",color:e.textColor??"#262626",fontFamily:Nao(e?.fontFamily||"OPEN_SANS"),fontSize:"16px",fontWeight:"400",letterSpacing:"0.15008px",lineHeight:"1.5",margin:"0",width:"100%"},children:(0,C.jsx)("table",{role:"presentation",align:"center",width:"100%",style:{margin:"0 auto",maxWidth:n==="desktop"?600:370,backgroundColor:e.canvasColor??"#FFFFFF",borderRadius:e.borderRadius??void 0,border:(()=>{const a=e.borderColor;if(a)return`1px solid ${a}`})()},cellSpacing:"0",cellPadding:"0",border:0,children:(0,C.jsx)("tbody",{children:(0,C.jsx)("tr",{style:{width:"100%"},children:(0,C.jsx)("td",{"data-value":"__content",children:(0,C.jsx)(PX,{children:(0,C.jsx)(Um,{listEndPolicy:"root",parentId:r,childrenIds:t,onChange:({block:a,blockId:d,childrenIds:p})=>{U4e(r,d,a,p),s2(d)}})})})})})})})}oi();var Kpo=A2e;dr(),Lr();var Tm5=e=>t=>({position:"absolute",...e?{top:"100%",right:0,marginTop:"8px",flexDirection:"row",width:"auto"}:{top:0,right:"-3rem",flexDirection:"column",width:"2.5rem"},borderRadius:"8px!important",zIndex:"90 !important;",boxShadow:"0px 4px 6px rgba(0, 0, 0, 0.1)",border:"1px solid",borderColor:t.palette.secondary.main,padding:"1px",display:"flex",alignItems:"center",justifyContent:"center"}),uy=null;function xm5({blockId:e}){const t=Jyt(e),{t:r}=Xt("inspector"),{t:n}=Xt(),a=Yyt(),d=SIo(),p=a&&d!=="local",[h,f]=(0,ie.useState)(!1),m=(0,ie.useMemo)(()=>{if(!t||t.type==="EmailLayout")return!1;try{const E=Ke.getState().document;return teo(e,E)==="section"}catch{return!1}},[t,e]),v=uy&&uy.blockType===t?.type,g=(0,ie.useRef)(null),[A,y]=(0,ie.useState)(!1);(0,ie.useEffect)(()=>{const E=()=>{if(!g.current)return;const H=g.current.parentElement;if(!H)return;const V=H.getBoundingClientRect(),F=H.closest(".preview-container");F&&(F.getBoundingClientRect().right-V.right<48?y(!0):y(!1))};E(),window.addEventListener("resize",E),window.addEventListener("scroll",E,!0);const L=setTimeout(E,100);return()=>{window.removeEventListener("resize",E),window.removeEventListener("scroll",E,!0),clearTimeout(L)}},[e]);const S=(0,ie.useCallback)(()=>{const E=Ke.getState().document,L=Ke.getState().notionTextInlineEditingBlockId,H=(I,$,Q=new Set)=>{if(Q.has(I))return;Q.add(I);const K=$[I];K&&(K.type==="Container"&&(K.data?.props?.childrenIds||[]).forEach(Y=>H(Y,$,Q)),K.type==="ColumnsContainer"&&(K.data?.props?.columns||[]).forEach(Y=>{(Y.childrenIds||[]).forEach(ee=>H(ee,$,Q))}))},V=new Set;H(e,E,V),V.add(e);const F=I=>I&&I.filter($=>!V.has($)),U={...E};for(const[I,$]of Object.entries(U)){if(V.has(I))continue;const Q=$;switch(Q.type){case"EmailLayout":U[I]={...Q,data:{...Q.data,childrenIds:F(Q.data.childrenIds)}};break;case"Container":U[I]={...Q,data:{...Q.data,props:{...Q.data.props,childrenIds:F(Q.data.props?.childrenIds)}}};break;case"ColumnsContainer":U[I]={...Q,data:{...Q.data,props:{...Q.data.props,columns:Q.data.props?.columns?.map(K=>({...K,childrenIds:F(K.childrenIds)}))}}};break;default:U[I]=Q}}for(const I of V)delete U[I];L&&(L===e||V.has(L))&&lO(null),Jf(U),s2(null)},[e]),x=(0,ie.useCallback)(()=>{t&&"style"in t.data&&t.data.style&&(uy={styles:JSON.parse(JSON.stringify(t.data.style)),blockType:t.type})},[t]),O=(0,ie.useCallback)(()=>{const E=Ke.getState().document;if(!uy||uy.blockType!==t?.type)return;const L={...E},H=L[e];H&&(L[e]={...H,data:{...H.data,style:JSON.parse(JSON.stringify(uy.styles))}},Jf(L),s2(e))},[e,t]),w=(0,ie.useCallback)(()=>{ABo(e)},[e]);return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(G.Paper,{ref:g,sx:Tm5(A),onClick:E=>E.stopPropagation(),elevation:10,children:[(0,C.jsx)(G.Tooltip,{title:r("actions.copyFormat"),placement:"left-start",children:(0,C.jsx)("span",{children:(0,C.jsx)(G.IconButton,{onClick:x,sx:{padding:"4px",overflow:"hidden",color:"text.primary"},disabled:!(t&&"style"in t.data&&t.data.style),children:(0,C.jsxs)("svg",{width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,C.jsx)("path",{d:"M12 22.5C6.49 22.5 2 18.01 2 12.5C2 6.99 6.49 2.5 12 2.5C17.51 2.5 22 6.54 22 11.5C22 14.81 19.31 17.5 16 17.5H14.23C13.95 17.5 13.73 17.72 13.73 18C13.73 18.12 13.78 18.23 13.86 18.33C14.27 18.8 14.5 19.39 14.5 20C14.5 21.38 13.38 22.5 12 22.5ZM12 4.5C7.59 4.5 4 8.09 4 12.5C4 16.91 7.59 20.5 12 20.5C12.28 20.5 12.5 20.28 12.5 20C12.5 19.84 12.42 19.72 12.36 19.65C11.95 19.19 11.73 18.6 11.73 18C11.73 16.62 12.85 15.5 14.23 15.5H16C18.21 15.5 20 13.71 20 11.5C20 7.64 16.41 4.5 12 4.5Z",fill:"currentColor"}),(0,C.jsx)("path",{d:"M6.5 13.5C7.32843 13.5 8 12.8284 8 12C8 11.1716 7.32843 10.5 6.5 10.5C5.67157 10.5 5 11.1716 5 12C5 12.8284 5.67157 13.5 6.5 13.5Z",fill:"currentColor"}),(0,C.jsx)("path",{d:"M9.5 9.5C10.3284 9.5 11 8.82843 11 8C11 7.17157 10.3284 6.5 9.5 6.5C8.67157 6.5 8 7.17157 8 8C8 8.82843 8.67157 9.5 9.5 9.5Z",fill:"currentColor"}),(0,C.jsx)("path",{d:"M14.5 9.5C15.3284 9.5 16 8.82843 16 8C16 7.17157 15.3284 6.5 14.5 6.5C13.6716 6.5 13 7.17157 13 8C13 8.82843 13.6716 9.5 14.5 9.5Z",fill:"currentColor"}),(0,C.jsx)("path",{d:"M17.5 13.5C18.3284 13.5 19 12.8284 19 12C19 11.1716 18.3284 10.5 17.5 10.5C16.6716 10.5 16 11.1716 16 12C16 12.8284 16.6716 13.5 17.5 13.5Z",fill:"currentColor"})]})})})}),(0,C.jsx)(G.Tooltip,{title:r(v?"actions.pasteFormatting":"actions.noFormatSupported"),placement:"left-start",children:(0,C.jsx)("span",{children:(0,C.jsx)(G.IconButton,{onClick:O,sx:{padding:"4px",overflow:"hidden",color:v?"text.primary":"text.disabled"},disabled:!v,children:(0,C.jsx)("svg",{width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,C.jsx)("path",{d:"M10.9551 22.6497C10.5139 22.6497 10.1287 22.4888 9.79934 22.167C9.47017 21.8451 9.30559 21.4582 9.30559 21.0062V16.1317H5.54784C5.09367 16.1317 4.69725 15.9624 4.35859 15.6237C4.01992 15.2851 3.85059 14.8886 3.85059 14.4345V7.10448C3.85059 6.07631 4.21 5.19264 4.92884 4.45348C5.6475 3.71431 6.52667 3.34473 7.56634 3.34473H19.2978C19.5378 3.34473 19.7408 3.42773 19.9066 3.59373C20.0726 3.75956 20.1556 3.96248 20.1556 4.20248V14.4345C20.1556 14.8886 19.9871 15.2851 19.6501 15.6237C19.3131 15.9624 18.9138 16.1317 18.4523 16.1317H14.7006V21.0062C14.7006 21.4582 14.536 21.8451 14.2068 22.167C13.8775 22.4888 13.4923 22.6497 13.0511 22.6497H10.9551ZM5.54784 10.6145H18.4523V5.04798H17.0463V8.41773C17.0463 8.63189 16.9744 8.81139 16.8306 8.95623C16.6869 9.10106 16.5063 9.17348 16.2888 9.17348C16.0715 9.17348 15.8924 9.10106 15.7516 8.95623C15.6108 8.81139 15.5403 8.63189 15.5403 8.41773V5.04798H13.7533V6.40148C13.7533 6.61814 13.6815 6.79789 13.5378 6.94073C13.394 7.08373 13.2134 7.15523 12.9961 7.15523C12.7786 7.15523 12.5994 7.08373 12.4586 6.94073C12.3178 6.79789 12.2473 6.61814 12.2473 6.40148V5.04798H7.56634C6.97717 5.04798 6.4935 5.24764 6.11534 5.64698C5.737 6.04631 5.54784 6.53214 5.54784 7.10448V10.6145ZM5.54784 14.4345H18.4523V12.0965H5.54784V14.4345Z",fill:"currentColor"})})})})}),(0,C.jsx)(G.Tooltip,{title:n("editor.cloneBlock"),placement:"left-start",children:(0,C.jsx)(G.IconButton,{onClick:w,sx:{padding:"4px",overflow:"hidden",color:"text.primary"},children:(0,C.jsx)(qe.ContentCopy,{sx:{fontSize:"1.25rem"}})})}),(0,C.jsx)(G.Tooltip,{title:r("actions.delete"),placement:"left-start",children:(0,C.jsx)(G.IconButton,{onClick:S,sx:{overflow:"hidden",color:"error.main",padding:"4px"},children:(0,C.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",children:(0,C.jsx)("path",{d:"M16 9.5V19.5H8V9.5H16ZM14.5 3.5H9.5L8.5 4.5H5V6.5H19V4.5H15.5L14.5 3.5ZM18 7.5H6V19.5C6 20.6 6.9 21.5 8 21.5H16C17.1 21.5 18 20.6 18 19.5V7.5Z",fill:"currentColor"})})})}),p&&(0,C.jsx)(G.Tooltip,{title:r("componentsLibrary.save.tooltip"),placement:"left-start",children:(0,C.jsx)("span",{children:(0,C.jsx)(G.IconButton,{onClick:()=>f(!0),disabled:!m,sx:{padding:"4px",overflow:"hidden",color:m?"text.primary":"text.disabled"},"aria-label":r("componentsLibrary.save.button"),children:(0,C.jsx)(ume,{sx:{fontSize:"1.25rem"}})})})})]}),p&&h&&m&&(0,C.jsx)(hf5,{open:h,rootBlockId:e,onClose:()=>f(!1)})]})}var Cm5=(0,ie.memo)(xm5);dr(),nl(),Lr();var qpo=150,Om5=25,yz=null,KX=null;function RKe(){yz&&(clearTimeout(yz),yz=null),KX=null}function Jpo(e){KX===e&&RKe()}function wm5(e,t,r,n){RKe(),KX=e,yz=setTimeout(()=>{yz=null,KX=null,r()&&(_F(e),n())},t)}function jm5(e){const t=e.closest(".preview-container");if(!t)return qpo;let r=0,n=e;for(;n&&t.contains(n)&&(n.hasAttribute("data-block-id")&&(r+=1),n!==t);)n=n.parentElement;return qpo+Math.max(0,r-1)*Om5}function Mm5(e){const t=oO();return(0,ie.useMemo)(()=>t?tv({draggedId:e,targetId:t}):!1,[e,t])}function Rm5(e){if(!e||typeof e.nodeType!="number")return null;const t=e,r=t.closest?.(".preview-container");if(!r)return null;const n=t.closest?.("[data-block-id]"),a=n?.getAttribute("data-block-id")??null;return!a||!n||!r.contains(n)?null:a}function zm5({children:e,canEdit:t=!0,isNotClient:r=!1}){const n=QX(),{t:a}=Xt(),d=RIo(),p=MIo(n),h=jIo(n),f=sO(),m=oO(),v=PIo();EIo();const g=Mm5(n),[A,y]=(0,ie.useState)(!1),[S,x]=(0,ie.useState)(0),O=(0,ie.useRef)(null),w=(0,ie.useRef)(null),[E,L]=(0,ie.useState)(null),H=Na(),V=zIo(),F=m===n||g,U=v===n,I=H.palette.primary.light||H.palette.primary.main,$=(0,ie.useRef)(null),Q=(0,ie.useRef)(!0);if(r)return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)("div",{style:{width:"100%"}}),(0,C.jsx)(G.Box,{sx:{position:"relative",maxWidth:"100%"},children:(0,C.jsx)("div",{children:e})}),(0,C.jsx)("div",{style:{width:"100%"}})]});let K,Y;U&&t?(K=`2px solid ${I}`,Y="10"):p&&t?(K=`2px solid ${H.palette.secondary.main}`,Y="1"):A&&t?K=`2px dotted ${H.palette.secondary.main}`:Y="auto";const ee=()=>!p||!t?null:(0,C.jsx)(Cm5,{blockId:n}),re=ve=>{const ge=ve.getClientOffset(),_e=O.current?.getBoundingClientRect(),je=w.current?.getBoundingClientRect();return!ge||!_e||!je?null:Math.abs(ge.y-_e.y)<Math.abs(ge.y-je.y)?"up":"down"},[{isOver:oe},le]=GE(()=>({accept:["block",k4],drop:(ve,ge)=>{if(ge.getItemType()==="library-component"){if(ge.didDrop()){ge.getDropResult();return}if(ve.category==="block"&&typeof ve.buttonIndex=="number"){const ye=Lp[ve.buttonIndex];if(!ye)return;re(ge)==="up"?sSt(n,ye.block()):lSt(n,ye.block());return}if(ve.category==="block-preset"&&typeof ve.presetIndex=="number"){const ye=NX[ve.presetIndex];if(!ye)return;re(ge)==="up"?sSt(n,ye.block):lSt(n,ye.block);return}const Me=ve;if(Me.category==="template"){console.warn("[ComponentsLibrary] templates cannot be dropped inline; click the card in the drawer to apply.");return}const He=re(ge)==="up"?"before":"after";(async()=>{try{const ye=await BX(Me.category,Me.axis,Me.id);He==="after"?aSt(n,ye.blocks):iSt(n,ye.blocks)}catch(ye){console.error("[ComponentsLibrary] failed to insert saved subtree",ye)}})();return}const _e=n,je=ve.blockId;if(_e===je)return;if(ge.didDrop()){ge.getDropResult();return}const Fe=re(ge);if(Fe)pO(_e,je,Fe);else{pO(_e,je,"down");return}},canDrop:(ve,ge)=>ge.getItemType()==="library-component"?!0:!tv({targetId:n,draggedId:ve.blockId}),collect:ve=>({isOver:ve.canDrop()?ve.isOver({shallow:!0}):!1}),hover:(ve,ge)=>{if(ge.getItemType()==="library-component"){if(!ge.canDrop()||!ge.isOver({shallow:!0})){L(null);return}const je=re(ge);L(je??null);return}if(ve.blockId===n){L(null);return}if(!ge.canDrop()||!ge.isOver({shallow:!0})){L(null);return}const _e=re(ge);if(!_e){L(null);return}L(_e)},end:()=>{L(null)}}));(0,ie.useEffect)(()=>{oe||L(null)},[oe]);const X=()=>(0,C.jsxs)("div",{style:{height:"3px",background:H.palette.secondary.main,position:"relative",color:H.palette.secondary.main},children:[(0,C.jsx)("svg",{style:{position:"absolute",left:"-25px",top:"50%",transform:"translateY(-50%)"},width:"20",height:"20",viewBox:"0 0 32 32",children:(0,C.jsx)("path",{fill:"currentColor",d:"M28 12H10a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h18a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2M10 4v6h18V4zm18 26H10a2 2 0 0 1-2-2v-6a2 2 0 0 1 2-2h18a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2m-18-8v6h18v-6zm-1-6l-5.586-5.586L2 11.828L6.172 16L2 20.172l1.414 1.414z"})}),(0,C.jsx)("svg",{style:{position:"absolute",right:"-25px",top:"50%",transform:"translateY(-50%) scaleX(-1)"},width:"20",height:"20",viewBox:"0 0 32 32",children:(0,C.jsx)("path",{fill:"currentColor",d:"M28 12H10a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h18a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2M10 4v6h18V4zm18 26H10a2 2 0 0 1-2-2v-6a2 2 0 0 1 2-2h18a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2m-18-8v6h18v-6zm-1-6l-5.586-5.586L2 11.828L6.172 16L2 20.172l1.414 1.414z"})})]}),[{borderDrag:se="",isDragging:Ae},ze]=X9(()=>({type:"block",item:()=>{const ve=Ke.getState().notionTextInlineEditingBlockId;return ve&&window.dispatchEvent(new CustomEvent("notion-text-force-save",{detail:{blockId:ve}})),{blockId:n}},canDrag:!F,collect:ve=>({borderDrag:ve.isDragging()?"2px dotted yellow":"",isDragging:ve.isDragging()}),end:()=>{x(Date.now())}}),[F,n])||[{borderDrag:"",isDragging:!1},ie.useRef(null)],pe=t&&f!=="preview"&&!F&&!V&&(Ae||d===n||d==null&&p);(0,ie.useEffect)(()=>(Q.current=!0,()=>{Q.current=!1,Jpo(n),$.current&&(clearTimeout($.current),$.current=null),Ke.getState().canvasHoveredBlockId===n&&_F(null)}),[n]);const Z=ve=>{const ge=Date.now()-S;if(!(Ae||S>0&&ge<200)&&(ve.stopPropagation(),f!=="preview")){if(h==="NotionText"){const _e=new CustomEvent("email-builder-highlight-editor",{detail:!0});window.dispatchEvent(_e)}s2(n)}},be=ie.useMemo(()=>ie.cloneElement(e,{onClick:ve=>{e.props.onClick&&e.props.onClick(ve),!ve.defaultPrevented&&!ve.isPropagationStopped()&&(Ae||Z(ve))},onMouseDown:ve=>{e.props.onMouseDown&&e.props.onMouseDown(ve)},onMouseUp:ve=>{e.props.onMouseUp&&e.props.onMouseUp(ve)}}),[e,Ae,n,h,f]);return(0,C.jsxs)(C.Fragment,{children:[E==="up"&&(0,C.jsx)(X,{}),(0,C.jsx)("div",{ref:O,style:{width:"100%"}}),(0,C.jsx)(G.Box,{"data-block-id":n,sx:{position:"relative",maxWidth:"100%"},ref:le,onMouseEnter:ve=>{ve.stopPropagation(),RKe(),$.current&&(clearTimeout($.current),$.current=null);const ge=jm5(ve.currentTarget);wm5(n,ge,()=>Q.current,()=>y(!0))},onMouseLeave:ve=>{Jpo(n),$.current&&clearTimeout($.current);const ge=ve.relatedTarget;$.current=setTimeout(()=>{if(y(!1),Ke.getState().canvasHoveredBlockId!==n)return;const _e=Rm5(ge);_F(_e&&_e!==n?_e:null)},150)},onClick:Z,children:(0,C.jsxs)(G.Box,{sx:{position:"relative",maxWidth:"100%",outlineOffset:"-1px",outline:K,zIndex:Y,transition:"outline 0.2s ease-in-out, z-index 0.2s ease-in-out"},children:[ee(),pe?(0,C.jsx)(G.Box,{sx:{position:"absolute",left:"50%",top:-20,transform:"translateX(-50%)",zIndex:10,display:"flex",flexDirection:"row",alignItems:"center",borderRadius:"6px 6px 0 0",overflow:"hidden",backgroundColor:U&&t?I:H.palette.secondary.main},children:(0,C.jsx)(G.Tooltip,{title:a("editor.dragBlockHandle"),placement:"top",children:(0,C.jsx)(G.IconButton,{ref:ze,type:"button","aria-label":a("editor.dragBlockHandle"),size:"small",onClick:ve=>ve.stopPropagation(),sx:{padding:"3px 6px",rotate:"90deg",borderRadius:0,color:"white",cursor:Ae?"grabbing":"grab",touchAction:"none","&:hover":{backgroundColor:"rgba(255,255,255,0.15)"}},children:(0,C.jsx)(qe.DragIndicator,{sx:{fontSize:15}})})})}):null,(0,C.jsx)(G.Fade,{in:U&&t,timeout:200,children:(0,C.jsx)(G.Chip,{label:a("editor.editing"),icon:(0,C.jsx)(qe.EditOutlined,{}),size:"small",sx:{position:"absolute",left:-1,top:-26,backgroundColor:I,color:"white",fontWeight:600,fontSize:"0.75rem",zIndex:-1,boxShadow:"0 2px 8px rgba(0,0,0,0.15)","& .MuiChip-icon":{color:"white",fontSize:"1rem"}}})}),(0,C.jsx)("div",{style:{border:se},children:be})]})}),E==="down"&&(0,C.jsx)(X,{}),(0,C.jsx)("div",{ref:w,style:{width:"100%"}})]})}var Wm=(0,ie.memo)(zm5,(e,t)=>e.children===t.children&&e.canEdit===t.canEdit&&e.isNotClient===t.isNotClient);mNe(),vNe(),Tq(),Eso(),tQe(),rQe(),oi(),Lr();var Pm5=(0,ie.memo)(kso),Em5=e=>{const t=ll(),r=D4e();return(0,C.jsx)(Pm5,{...e,selectedScreenSize:t,disableEdition:r})},km5=(0,ie.memo)(peo),Hm5=(0,ie.memo)(ym5),Lm5=(0,ie.memo)(bm5),Dm5=(0,ie.memo)(meo),Vm5=(0,ie.memo)(cc5),Fm5=(0,ie.memo)(Dso),Im5=(0,ie.memo)(feo),Zpo={SocialMedia:{schema:kZ,Component:e=>(0,C.jsx)(Wm,{isNotClient:e.isNotClient,children:(0,C.jsx)(Em5,{...e})})},Button:{schema:RT,Component:e=>(0,C.jsx)(Wm,{isNotClient:e.isNotClient,children:(0,C.jsx)(km5,{...e})})},Container:{schema:Ypo,Component:e=>(0,C.jsx)(Wm,{isNotClient:e.isNotClient,children:(0,C.jsx)(Hm5,{...e})})},ColumnsContainer:{schema:MKe,Component:e=>(0,C.jsx)(Wm,{isNotClient:e.isNotClient,children:(0,C.jsx)(Lm5,{...e})})},Image:{schema:h_,Component:e=>{const t={...e,props:{...e.props,url:e.props?.url??"https://placehold.co/600x400@2x/F8F8F8/CCC?text=Your%20image"}};return(0,C.jsx)(Wm,{isNotClient:e.isNotClient,children:(0,C.jsx)(Dm5,{...t})})}},NotionText:{schema:ZH,Component:e=>(0,C.jsx)(Wm,{isNotClient:e.isNotClient,children:(0,C.jsx)(Vm5,{blockId:e.blockId??"",...e})})},EmailLayout:{schema:Kpo,Component:e=>(0,C.jsx)(Sm5,{...e})},Spacer:{schema:kT,Component:e=>(0,C.jsx)(Wm,{isNotClient:e.isNotClient,children:(0,C.jsx)(Fm5,{...e})})},Divider:{schema:PT,Component:e=>(0,C.jsx)(Wm,{isNotClient:e.isNotClient,children:(0,C.jsx)(Im5,{...e})})}},Bm5=Xtt(Zpo),Sz=Object.fromEntries(Object.entries(Zpo).map(([e,t])=>[e,m_(t.schema)??{}])),Xpo=({tabs:e,defaultTab:t})=>{const r=(0,ie.useMemo)(()=>e.filter(p=>p.visible),[e]),[n,a]=(0,ie.useState)(null);if((0,ie.useEffect)(()=>{if(n&&r.some(h=>h.key===n))return;const p=t&&r.some(h=>h.key===t)?t:r[0]?.key??null;a(p)},[r,t,n]),r.length===0)return null;if(r.length===1)return(0,C.jsx)(G.Box,{children:r[0].render()});const d=r.find(p=>p.key===n)??r[0];return(0,C.jsxs)(G.Box,{children:[(0,C.jsx)(G.Tabs,{value:d.key,onChange:(p,h)=>a(h),variant:"scrollable",scrollButtons:!1,sx:{minHeight:34,mb:1.5,borderBottom:1,borderColor:"divider","& .MuiTabs-flexContainer":{gap:0},"& .MuiTab-root":{minHeight:34,minWidth:0,px:1.25,py:.5,fontSize:"0.72rem",fontWeight:500,textTransform:"none",color:"text.secondary","&.Mui-selected":{color:"primary.main"}}},children:r.map(p=>(0,C.jsx)(G.Tab,{value:p.key,label:p.label,disableRipple:!0},p.key))}),(0,C.jsx)(G.Box,{children:d.render()})]})};Gyt(),Lr();var Nm5={EmailLayout:{label:"Email",iconName:"DashboardOutlined"},NotionText:{label:"Text",iconName:"ArticleOutlined"},SocialMedia:{label:"Social",iconName:"Groups2"},Button:{label:"Button",iconName:"SmartButtonOutlined"},Image:{label:"Image",iconName:"ImageOutlined"},Divider:{label:"Divider",iconName:"HorizontalRuleOutlined"},Spacer:{label:"Spacer",iconName:"Crop32Outlined"},ColumnsContainer:{label:"Columns",iconName:"ViewColumnOutlined"},Container:{label:"Container",iconName:"LibraryAddOutlined"},Html:{label:"HTML",iconName:"CodeOutlined"}},$m5=e=>t=>t.document[e],Um5=e=>t=>{const r=t.document[e];if(!r)return[];switch(r.type){case"EmailLayout":return r.data?.childrenIds||[];case"Container":return r.data?.props?.childrenIds||[];case"ColumnsContainer":return r.data?.props?.columns?.flatMap(n=>n.childrenIds||[])||[];default:return[]}};function Wm5(e){if(!e)return[];switch(e.type){case"EmailLayout":return e.data?.childrenIds||[];case"Container":return e.data?.props?.childrenIds||[];case"ColumnsContainer":return e.data?.props?.columns?.flatMap(t=>t.childrenIds||[])||[];default:return[]}}function eho(e,t,r){const n=Wm5(e[t]);for(const a of n)if(a===r||eho(e,a,r))return!0;return!1}function Gm5(e,t,r,n){if(!n)return!1;const a=e[t];if(!a||a.type!=="ColumnsContainer")return!1;const d=a.data?.props?.columns?.[r]?.childrenIds||[];for(const p of d)if(p===n||eho(e,p,n))return!0;return!1}function Qm5(e){const t=e.document;if(!t||!t.root)return null;function r(a,d){const p=d.document[a];if(!p)return[];switch(p.type){case"EmailLayout":return p.data?.childrenIds||[];case"Container":return p.data?.props?.childrenIds||[];case"ColumnsContainer":return p.data?.props?.columns?.flatMap(h=>h.childrenIds||[])||[];default:return[]}}function n(a,d,p){const h=p.document[a],f=h?.type??"Unknown",m=Nm5[f]??{label:f,iconName:"WidgetsOutlined"};if(f==="ColumnsContainer"){const g=h.data?.props?.columns,A=h.data?.props?.columnsCount===2?2:3,y=[];for(let S=0;S<A;S++){const x=g?.[S]?.childrenIds??[],O=pIo(a,S);y.push({blockId:O,type:"ColumnSlot",label:"",iconName:"WidgetsOutlined",children:x.map(w=>n(w,d+2,p)),depth:d+1,columnSlot:{parentBlockId:a,columnIndex:S,columnsCount:A}})}return{blockId:a,type:f,label:m.label,iconName:m.iconName,children:y,depth:d}}const v=r(a,p).map(g=>n(g,d+1,p));return{blockId:a,type:f,label:m.label,iconName:m.iconName,children:v,depth:d}}return n("root",0,e)}function Ym5(){const e=Ke(t=>t.document);return(0,ie.useMemo)(()=>Qm5({document:e}),[e])}Lr();function tho(e){return Ke($m5(e))}function Km5(e){return Ke(Um5(e))}j4e();var zKe=hF(()=>({credits:{}}));function qm5(e,t){zKe.setState(r=>({credits:{...r.credits,[e]:t}}))}function cy(e){zKe.setState(t=>{const{[e]:r,...n}=t.credits;return{credits:n}})}function Jm5(e){return zKe(t=>e?t.credits[e]??null:null)}dr();var Zm5=350,Xm5=20,e95=10,t95=["any","landscape","portrait","squarish"],Yl={query:"",orientation:"any",photos:[],page:0,totalPages:0,selectedPhoto:null},rho=({backendUrl:e,blockId:t,source:r})=>{const{t:n}=Xt("inspector"),a=(0,ie.useMemo)(()=>id(e),[e]),[d,p]=(0,ie.useState)(t??null),[h,f]=(0,ie.useState)(null),[m,v]=(0,ie.useState)(r??"image");(0,ie.useEffect)(()=>{t!=null&&p(t)},[t]),(0,ie.useEffect)(()=>{r!=null&&v(r)},[r]);const[g,A]=(0,ie.useState)(Yl.query),[y,S]=(0,ie.useState)(Yl.orientation),[x,O]=(0,ie.useState)(Yl.photos),[w,E]=(0,ie.useState)(Yl.page),[L,H]=(0,ie.useState)(Yl.totalPages),[V,F]=(0,ie.useState)(null),[,U]=(0,ie.useState)(Yl.selectedPhoto),[I,$]=(0,ie.useState)(!1),[Q,K]=(0,ie.useState)(null),Y=(0,ie.useRef)(null);(0,ie.useEffect)(()=>{const X=se=>{const{detail:Ae}=se;p(Ae.blockId),f(Ae.currentImageUrl),v(Ae.source??"image")};return window.addEventListener("email-builder-image-panel-opened",X),()=>window.removeEventListener("email-builder-image-panel-opened",X)},[]);const ee=(0,ie.useCallback)(async(X,se,Ae,ze)=>{Y.current?.abort();const pe=new AbortController;Y.current=pe,$(!0),K(null);try{const Z=await V15(a,{query:X,page:Ae,perPage:Xm5,orientation:se==="any"?void 0:se,signal:pe.signal});F(Z.rateLimitRemaining),H(Z.totalPages),E(Ae),O(be=>{const ve=ze?[...be,...Z.results]:Z.results;return Yl.photos=ve,Yl.page=Ae,Yl.totalPages=Z.totalPages,ve})}catch(Z){if(Z?.name==="AbortError")return;K(Z instanceof _v?Z.kind:"unknown"),ze||O([])}finally{Y.current===pe&&($(!1),Y.current=null)}},[a]);(0,ie.useEffect)(()=>{Yl.query=g,Yl.orientation=y;const X=g.trim();if(X.length===0){Y.current?.abort(),O([]),E(0),H(0),K(null),Yl.photos=[],Yl.page=0,Yl.totalPages=0;return}const se=window.setTimeout(()=>{ee(X,y,1,!1)},Zm5);return()=>window.clearTimeout(se)},[g,y,ee]),(0,ie.useEffect)(()=>()=>Y.current?.abort(),[]);const re=w>0&&w<L&&!I,oe=()=>{const X=g.trim();!X||!re||ee(X,y,w+1,!0)},le=X=>{if(!d)return;const se=F15(X);m==="image"?Az(d,{url:se,alt:X.attribution}):window.dispatchEvent(new CustomEvent("email-builder-set-image",{detail:{url:se}})),U(X),Yl.selectedPhoto=X,qm5(d,{photoId:X.id,photographerName:X.user.name,photographerUrl:X.user.profileUrl,unsplashUrl:X.unsplashUrl}),XXi(a,X.links.downloadLocation)};return(0,C.jsxs)(G.Box,{children:[(0,C.jsxs)(G.Stack,{direction:"row",spacing:1,sx:{mb:1,alignItems:"center"},children:[(0,C.jsx)(G.TextField,{fullWidth:!0,size:"small",placeholder:n("inputs.unsplash.searchPlaceholder"),value:g,onChange:X=>A(X.target.value),slotProps:{input:{startAdornment:(0,C.jsx)(G.InputAdornment,{position:"start",children:(0,C.jsx)(qe.Search,{fontSize:"small",sx:{color:"text.secondary"}})})}}}),V!==null&&V<=e95&&(0,C.jsx)(G.Chip,{label:n("inputs.unsplash.quotaLow",{remaining:V}),size:"small",color:"warning",variant:"outlined"})]}),(0,C.jsx)(G.Tabs,{value:y,onChange:(X,se)=>S(se),variant:"scrollable",scrollButtons:!1,sx:{minHeight:30,mb:1.5,"& .MuiTabs-flexContainer":{gap:0},"& .MuiTabs-scroller":{pl:0},"& .MuiTab-root":{minHeight:30,minWidth:0,px:1,py:.25,fontSize:"0.7rem",textTransform:"none",color:"text.secondary","&.Mui-selected":{color:"primary.main"}},"& .MuiTab-root:first-of-type":{pl:0}},children:t95.map(X=>(0,C.jsx)(G.Tab,{value:X,label:n(`inputs.unsplash.orientation.${X}`),disableRipple:!0},X))}),Q&&(0,C.jsx)(G.Alert,{severity:Q==="not_configured"?"warning":"error",sx:{mb:1.5,fontSize:"0.75rem"},children:n(`inputs.unsplash.error.${Q}`)}),I&&x.length===0&&(0,C.jsx)(G.Box,{sx:{display:"flex",justifyContent:"center",py:3},children:(0,C.jsx)(G.CircularProgress,{size:22})}),!I&&!Q&&x.length===0&&g.trim().length===0&&(0,C.jsx)(G.Box,{sx:{textAlign:"center",py:3},children:(0,C.jsx)(G.Typography,{variant:"caption",color:"text.secondary",children:n("inputs.unsplash.emptyInitial")})}),!I&&!Q&&x.length===0&&g.trim().length>0&&(0,C.jsx)(G.Box,{sx:{textAlign:"center",py:3},children:(0,C.jsx)(G.Typography,{variant:"caption",color:"text.secondary",children:n("inputs.unsplash.emptyNoResults",{query:g.trim()})})}),x.length>0&&(0,C.jsx)(G.Box,{sx:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:1,maxHeight:380,overflowY:"auto"},children:x.map(X=>{const se=h?.includes(X.id)??!1;return(0,C.jsx)(r95,{photo:X,selected:se,onPick:()=>le(X)},X.id)})}),re&&(0,C.jsx)(G.Box,{sx:{textAlign:"center",mt:2},children:(0,C.jsx)(G.Link,{component:"button",variant:"caption",onClick:oe,sx:{cursor:"pointer"},children:n("inputs.unsplash.loadMore")})}),(0,C.jsxs)(G.Typography,{variant:"caption",sx:{display:"block",mt:1.5,color:"text.secondary",textAlign:"center",fontSize:"0.65rem"},children:[n("inputs.unsplash.poweredBy")," ",(0,C.jsx)(G.Link,{href:"https://unsplash.com/?utm_source=email-builder-online&utm_medium=referral",target:"_blank",rel:"noreferrer noopener",underline:"hover",color:"inherit",children:"Unsplash"})]})]})},r95=({photo:e,selected:t,onPick:r})=>{const{t:n}=Xt("inspector"),a=e.color??void 0;return(0,C.jsxs)(G.Box,{sx:{borderRadius:1,overflow:"hidden",border:"2px solid",borderColor:t?"primary.main":"divider",cursor:"pointer",backgroundColor:a??"action.hover",transition:"border-color 0.15s ease","&:hover":{borderColor:"primary.light"}},children:[(0,C.jsx)(G.Box,{sx:{position:"relative",aspectRatio:"1",overflow:"hidden"},children:(0,C.jsx)("img",{src:e.urls.thumb,alt:e.alt,loading:"lazy",onClick:r,style:{width:"100%",height:"100%",objectFit:"cover",display:"block"}})}),(0,C.jsx)(G.Box,{sx:{px:.75,py:.5,fontSize:"0.6rem",lineHeight:1.3,bgcolor:"#1a1a1a",color:"#ccc",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"},children:(0,C.jsx)(Qtt,{t:n,i18nKey:"inputs.unsplash.creditLine",values:{author:e.user.name},components:{authorLink:(0,C.jsx)(G.Link,{href:e.user.profileUrl,target:"_blank",rel:"noreferrer noopener",underline:"hover",onClick:d=>d.stopPropagation(),sx:{color:"#fff",fontSize:"inherit",fontWeight:500,"&:hover":{textShadow:"0 0 6px rgba(255,255,255,0.6)"}}}),unsplashLink:(0,C.jsx)(G.Link,{href:e.unsplashUrl,target:"_blank",rel:"noreferrer noopener",underline:"hover",onClick:d=>d.stopPropagation(),sx:{color:"#fff",fontSize:"inherit",fontWeight:500,"&:hover":{textShadow:"0 0 6px rgba(255,255,255,0.6)"}}})}})})]})};dr();function n95({onClick:e,disabled:t,primary:r=!1}){const{t:n}=Xt("inspector");return(0,C.jsx)(G.IconButton,{"aria-label":n("inputs.common.close"),onClick:e,disabled:t,sx:{position:"absolute",right:8,top:8,color:a=>r?"brand.blue":a.palette.grey[500],"&:hover":{opacity:.8}},children:(0,C.jsx)(qe.Close,{})})}function a95({imageUrl:e,saving:t=!1}){return(0,C.jsxs)(G.Card,{sx:{position:"relative"},children:[t&&(0,C.jsx)(G.Stack,{sx:{justifyContent:"center",alignItems:"center",position:"absolute",top:7,left:0,width:"100%",height:"314px",zIndex:20,backgroundColor:"#212121AA",mb:1},children:(0,C.jsx)(G.CircularProgress,{size:48,thickness:6,color:"inherit",sx:{color:"white"}})}),(0,C.jsx)(G.CardMedia,{component:"img",sx:{objectFit:"contain",width:"100%",height:"326px"},image:e,alt:"Generated Image"})]})}function i95({value:e,onChange:t,disabled:r}){return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(G.Typography,{sx:{fontSize:"14px",fontWeight:700},children:"Image description"}),(0,C.jsx)(G.TextField,{disabled:r,autoFocus:!0,margin:"dense",id:"prompt",placeholder:"Enter a detailed description here...",type:"text",fullWidth:!0,multiline:!0,rows:4,variant:"outlined",value:e,onChange:n=>t(n.target.value),sx:{mt:.5,"& .MuiOutlinedInput-root":{borderRadius:"6px"}}})]})}var o95=e=>({400:{code:400,title:e.title||"Invalid Request",message:e.message||"The request was invalid. Please check your input and try again.",action:e.action||"Modify your prompt and try again"},401:{code:401,title:e.title||"Authentication Required",message:e.message||"You need to be authenticated to perform this action.",action:e.action||"Please log in and try again"},403:{code:403,title:e.title||"Access Denied",message:e.message||"You don't have permission to perform this action.",action:e.action||"Contact support if you believe this is a mistake"},404:{code:404,title:e.title||"Not Found",message:e.message||"The requested resource was not found.",action:e.action||"Try again or use a different prompt"},422:{code:422,title:e.title||"Invalid Input",message:e.message||"The provided input cannot be processed.",action:e.action||"Modify your prompt and try again"},429:{code:429,title:e.title||"Too Many Requests",message:e.message||"You've made too many requests. Please wait a moment.",action:e.action||"Please wait a few minutes before trying again"},500:{code:500,title:e.title||"Server Error",message:e.message||"An unexpected error occurred on our servers.",action:e.action||"Please try again later"},502:{code:502,title:e.title||"Bad Gateway",message:e.message||"The server received an invalid response.",action:e.action||"Please try again later"},503:{code:503,title:e.title||"Service Unavailable",message:e.message||"The service is temporarily unavailable.",action:e.action||"Please try again later"}})[e.code]||{code:e.code,title:"Unexpected Error",message:"An unexpected error occurred.",action:"Please try again later"};dr();function nho({src:e,style:t}){const{t:r}=Xt("inspector"),[n,a]=(0,ie.useState)(!1),[d,p]=(0,ie.useState)(!1),[h,f]=(0,ie.useState)(""),[m,v]=(0,ie.useState)(null),[g,A]=(0,ie.useState)(!1),[y,S]=(0,ie.useState)(null),[x,O]=(0,ie.useState)(!1),[w,E]=(0,ie.useState)(0),[L,H]=(0,ie.useState)(0),V=(0,ie.useRef)(null),F=[r("inputs.aiImageGeneration.loadingStep1"),r("inputs.aiImageGeneration.loadingStep2"),r("inputs.aiImageGeneration.loadingStep3"),r("inputs.aiImageGeneration.loadingStep4")],U=(0,ie.useCallback)(()=>{E(0),H(0),V.current&&clearInterval(V.current);const re=6e4,oe=100;let le=0;V.current=setInterval(()=>{le+=oe,E(Math.min(le/re*95,95)),H(Math.min(Math.floor(le/re*F.length),F.length-1)),le>=re&&V.current&&clearInterval(V.current)},oe)},[F.length]),I=(0,ie.useCallback)(()=>{V.current&&(clearInterval(V.current),V.current=null),E(100)},[]),$=()=>{a(!0),S(null)},Q=()=>{d||(a(!1),p(!1),v(null),f(""),A(!1),S(null),O(!1),I())},K=()=>{const re=m&&!g?"store-ai-image":"request-ai-image",oe=m&&!g?m:h;S(null),re==="store-ai-image"?(O(!0),p(!1),setTimeout(()=>{p(!1),Q()},2e3)):(p(!0),U()),window.dispatchEvent(new CustomEvent(re,{detail:oe}))},Y=()=>{A(!0),v(null),S(null),O(!1)};(0,ie.useEffect)(()=>{const re=oe=>{const{detail:le}=oe;if(I(),p(!1),le.error){S(o95(le.error));return}if(!le.success||!le.url){S({code:0,title:"Generation Failed",message:"Failed to generate the image.",action:"Please try again"});return}v(le.url),A(!1)};return window.addEventListener("generated-image",re),()=>{window.removeEventListener("generated-image",re)}},[]),(0,ie.useEffect)(()=>{Q()},[e]);const ee=!m||g;return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(G.Button,{style:t,startIcon:(0,C.jsx)(qe.AutoAwesome,{className:"w-4 h-4"}),variant:"contained",onClick:$,children:r("inputs.aiImageGeneration.generate")}),(0,C.jsx)(G.Dialog,{open:n,onClose:Q,maxWidth:"sm",fullWidth:!0,slotProps:{paper:{sx:{bgcolor:"background.paper",color:"text.primary",borderRadius:"10px"}}},children:(0,C.jsxs)("form",{onSubmit:re=>{re.preventDefault(),K()},children:[(0,C.jsxs)(G.DialogTitle,{sx:{fontWeight:700,fontSize:"24px",color:y?"error.main":"inherit"},children:[r(y?"inputs.aiImageGeneration.titleError":d?"inputs.aiImageGeneration.titleLoading":m?"inputs.aiImageGeneration.titleReady":"inputs.aiImageGeneration.titleCreate"),(0,C.jsx)(n95,{onClick:Q,disabled:d,primary:!0})]}),(0,C.jsxs)(G.DialogContent,{children:[(0,C.jsx)(G.DialogContentText,{sx:{pb:1,color:y?"error.dark":"inherit"},children:r(y?"inputs.aiImageGeneration.descriptionError":d?"inputs.aiImageGeneration.descriptionLoading":ee?"inputs.aiImageGeneration.descriptionCreate":"inputs.aiImageGeneration.descriptionReady")}),m&&!g?(0,C.jsxs)(G.Stack,{sx:{position:"relative"},children:[(0,C.jsx)(a95,{imageUrl:m,saving:x}),(0,C.jsxs)(G.Alert,{variant:"outlined",severity:"warning",icon:!1,children:[r("inputs.aiImageGeneration.warningRegenerate")," ",(0,C.jsx)("b",{children:r("inputs.aiImageGeneration.warningInsertFirst")})," ",r("inputs.aiImageGeneration.warningFirst")]})]}):d&&!m?(0,C.jsxs)(G.Stack,{spacing:2,sx:{justifyContent:"center",alignItems:"center",backgroundColor:re=>re.palette.mainColor?.[50]??re.palette.action.hover,height:"326px",width:"100%",borderRadius:"8px"},children:[(0,C.jsx)(qe.AutoAwesome,{sx:{fontSize:48,color:"primary.main",animation:"pulse 1.5s ease-in-out infinite","@keyframes pulse":{"0%, 100%":{opacity:.4,transform:"scale(1)"},"50%":{opacity:1,transform:"scale(1.15)"}}}}),(0,C.jsx)(G.Typography,{variant:"body2",sx:{color:"text.secondary",fontWeight:500,transition:"opacity 0.3s"},children:F[L]}),(0,C.jsx)(G.LinearProgress,{variant:"determinate",value:w,sx:{width:"60%",borderRadius:4,height:6}})]}):(0,C.jsx)(i95,{value:h,onChange:f,disabled:d})]}),!d&&(0,C.jsxs)(G.DialogActions,{className:"p-6",children:[m&&!g&&(0,C.jsx)(G.Button,{startIcon:(0,C.jsx)(qe.Refresh,{className:"w-4 h-4"}),onClick:Y,variant:"outlined",disabled:d,children:r("inputs.aiImageGeneration.regenerate")}),!m&&!g&&(0,C.jsx)(G.Button,{onClick:Q,variant:"text",disabled:g,children:r("inputs.aiImageGeneration.cancel")}),(0,C.jsxs)(G.Button,{startIcon:m&&!g?(0,C.jsx)(qe.Attachment,{className:"w-4 h-4"}):(0,C.jsx)(qe.AutoAwesome,{className:"w-4 h-4"}),onClick:K,variant:"contained",disabled:!h||h?.length<20,children:[r(m&&!g?"inputs.aiImageGeneration.insertImage":"inputs.aiImageGeneration.generateImage"),d&&(0,C.jsx)(G.CircularProgress,{size:16,className:"ml-2"})]})]})]})})]})}var No=({children:e})=>(0,C.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:"0.3rem"},children:e});dr();var aho=({imageUrl:e,alt:t="",blockId:r,onRemove:n})=>{const{t:a}=Xt("inspector"),d=Jm5(r??null);return e?(0,C.jsxs)(G.Box,{sx:{position:"relative",mb:1.5,borderRadius:1,overflow:"hidden",border:"1px solid",borderColor:"divider"},children:[(0,C.jsx)("img",{src:e,alt:t,style:{width:"100%",display:"block",maxHeight:140,objectFit:"cover"}}),n&&(0,C.jsx)(G.IconButton,{"aria-label":a("inputs.common.close"),onClick:n,size:"small",sx:{position:"absolute",top:4,right:4,backgroundColor:"background.paper",color:"error.main",width:28,height:28,"&:hover":{backgroundColor:"error.50"}},children:(0,C.jsx)(qe.Close,{fontSize:"small"})}),d&&(0,C.jsxs)(G.Box,{sx:{display:"flex",alignItems:"center",gap:.5,px:1,py:.5,bgcolor:"#1a1a1a",color:"#ccc",fontSize:"0.65rem"},children:[(0,C.jsx)(qe.CameraAltOutlined,{sx:{fontSize:"0.8rem",flexShrink:0,color:"#ccc"}}),(0,C.jsx)(Qtt,{t:a,i18nKey:"inputs.unsplash.creditLine",values:{author:d.photographerName},components:{authorLink:(0,C.jsx)(G.Link,{href:d.photographerUrl,target:"_blank",rel:"noreferrer noopener",underline:"hover",sx:{color:"#fff",fontSize:"inherit",fontWeight:500,"&:hover":{textShadow:"0 0 6px rgba(255,255,255,0.6)"}}}),unsplashLink:(0,C.jsx)(G.Link,{href:d.unsplashUrl,target:"_blank",rel:"noreferrer noopener",underline:"hover",sx:{color:"#fff",fontSize:"inherit",fontWeight:500,"&:hover":{textShadow:"0 0 6px rgba(255,255,255,0.6)"}}})}})]})]}):null},l95=["top left","top center","top right","center left","center center","center right","bottom left","bottom center","bottom right"],fh={style:{color:"currentColor"},width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},mh={stroke:"currentColor",strokeWidth:"1.67",strokeLinecap:"round",strokeLinejoin:"round"},iho=(0,C.jsx)("svg",{...fh,children:(0,C.jsx)("path",{d:"M2.40039 5.20039V2.40039M2.40039 2.40039H5.20039M2.40039 2.40039L5.90039 5.90039M13.6004 5.20039V2.40039M13.6004 2.40039H10.8004M13.6004 2.40039L10.1004 5.90039M2.40039 10.8004V13.6004M2.40039 13.6004H5.20039M2.40039 13.6004L5.90039 10.1004M13.6004 13.6004L10.1004 10.1004M13.6004 13.6004V10.8004M13.6004 13.6004H10.8004",...mh})});function qX(e){switch(e){case"top left":return(0,C.jsx)("svg",{...fh,children:(0,C.jsx)("path",{d:"M5.26523 9.79159L5.17094 5.17183M5.17094 5.17183L9.79071 5.26611M5.17094 5.17183L10.8278 10.8287",...mh})});case"top center":return(0,C.jsx)("svg",{...fh,children:(0,C.jsx)("path",{d:"M4.7998 7.33333L7.9998 4M7.9998 4L11.1998 7.33333M7.9998 4V12",...mh})});case"top right":return(0,C.jsx)("svg",{...fh,children:(0,C.jsx)("path",{d:"M6.20841 5.2662L10.8282 5.17192M10.8282 5.17192L10.7339 9.79169M10.8282 5.17192L5.17132 10.8288",...mh})});case"center left":return(0,C.jsx)("svg",{...fh,children:(0,C.jsx)("path",{d:"M7.33333 11.2002L4 8.00019M4 8.00019L7.33333 4.8002M4 8.00019L12 8.0002",...mh})});case"center":case"center center":return iho;case"center right":return(0,C.jsx)("svg",{...fh,children:(0,C.jsx)("path",{d:"M8.66667 4.7998L12 7.9998M12 7.9998L8.66667 11.1998M12 7.9998L4 7.9998",...mh})});case"bottom left":return(0,C.jsx)("svg",{...fh,children:(0,C.jsx)("path",{d:"M9.79062 10.7348L5.17085 10.8291M5.17085 10.8291L5.26513 6.20929M5.17085 10.8291L10.8277 5.1722",...mh})});case"bottom center":return(0,C.jsx)("svg",{...fh,children:(0,C.jsx)("path",{d:"M11.1998 8.66667L7.9998 12M7.9998 12L4.7998 8.66667M7.9998 12L7.99981 4",...mh})});case"bottom right":return(0,C.jsx)("svg",{...fh,children:(0,C.jsx)("path",{d:"M10.7338 6.20938L10.8281 10.8291M10.8281 10.8291L6.20831 10.7349M10.8281 10.8291L5.17122 5.17229",...mh})});default:return iho}}function JX(e){switch(e){case"top left":return"topLeft";case"top center":return"topCenter";case"top right":return"topRight";case"center left":return"centerLeft";case"center":case"center center":return"center";case"center right":return"centerRight";case"bottom left":return"bottomLeft";case"bottom center":return"bottomCenter";case"bottom right":return"bottomRight";default:return"center"}}NC();function oho(e){return(0,C.jsx)(zs,{viewBox:"0 0 18 18",fontSize:"small",...e,children:(0,C.jsx)("path",{d:"M9.00015 6.75V8.25M9.00015 11.25H9.00765M3.804 14.25H14.1963C15.351 14.25 16.0727 13 15.4953 12L10.2992 3C9.72184 2 8.27846 2 7.70111 3L2.50496 12C1.92761 13 2.6493 14.25 3.804 14.25Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})})}dr(),nl(),Lr();var s95=({defaultValue:e,onChange:t,values:r})=>{const n=iO(),{t:a}=Xt("inspector");Na();const d=Me=>{if(!Me)return{url:"",repeat:"no-repeat",position:"center center",size:"cover"};const He=Me.trim();let ye="";if(He.startsWith("url(")){const tt=He.match(/^url\(\s*['"]?([^'")]+)['"]?\s*\)/);ye=tt?tt[1]:""}else(/^https?:\/\//i.test(He)||He.startsWith("data:"))&&(ye=He);let Oe="no-repeat";Me.includes("repeat-x")?Oe="repeat-x":Me.includes("repeat-y")?Oe="repeat-y":Me.includes("repeat")&&!Me.includes("no-repeat")&&(Oe="repeat");let De="center center";for(const tt of["top left","top center","top right","center left","center center","center right","bottom left","bottom center","bottom right"])if(Me.includes(tt)){De=tt;break}let Ce="cover";return Me.includes("contain")?Ce="contain":Me.includes("auto")&&(Ce="auto"),{url:ye,repeat:Oe,position:De,size:Ce}},p=Me=>Me.url?`url("${Me.url}") ${Me.repeat} ${Me.position} / ${Me.size}`:"",[h,f]=(0,ie.useState)(e||null),[m,v]=(0,ie.useState)(d(e)),[g,A]=(0,ie.useState)(!1),[y,S]=(0,ie.useState)(()=>!!window.__emailBuilderEnableAI),[,x]=(0,ie.useState)(null),[O,w]=(0,ie.useState)(d(e).url||""),[E,L]=(0,ie.useState)(!1),[H,V]=(0,ie.useState)(""),[F,U]=(0,ie.useState)(!1),I=(0,ie.useRef)(null),[$,Q]=(0,ie.useState)(null),K=iBo(),Y=lBo(),ee=K||Y,[re,oe]=(0,ie.useState)(()=>!!window.__emailBuilderUnsplashEnabled);(0,ie.useEffect)(()=>{const Me=()=>{oe(!!window.__emailBuilderUnsplashEnabled)};return Me(),window.addEventListener("email-builder-unsplash-updated",Me),()=>window.removeEventListener("email-builder-unsplash-updated",Me)},[]),(0,ie.useEffect)(()=>{const Me=window.__emailBuilderCustomImageProvider;Me&&(Q(Me),setTimeout(()=>{n&&window.dispatchEvent(new CustomEvent("email-builder-image-panel-opened",{detail:{blockId:n,currentImageUrl:m.url||null,alt:null,source:"background"}}))},100))},[]);const[le,X]=(0,ie.useState)(()=>sessionStorage.getItem("hideBackgroundImageWarning")==="true"),se=(Me,He)=>{const ye={...m,...Me};if(v(ye),ye.url){const Oe=p(ye);f(Oe),t(Oe,He)}else console.error("Update params error: ",ye)},Ae=(Me,He)=>{if(!Me)return!1;const ye=Me?.toLowerCase(),Oe=ye.includes(".svg")||ye.includes("svg"),De=He&&(He.includes("image/svg+xml")||He.includes("svg"));return Oe||!!De},ze=async Me=>{try{L(!0),V(""),U(!1);try{new URL(Me)}catch{return V("Invalid URL format"),!1}const He=new AbortController,ye=setTimeout(()=>He.abort(),1e4);try{const Oe=await fetch(Me,{method:"HEAD",signal:He.signal});if(clearTimeout(ye),!Oe.ok)return V(`HTTP ${Oe.status}: ${Oe.statusText}`),!1;const De=Oe.headers.get("content-type");return["image/","image/svg+xml","text/xml","application/xml"].some(Ce=>De&&De.toLowerCase().includes(Ce.toLowerCase()))?(Ae(Me,De)&&U(!0),V(""),!0):(V("URL does not point to an image"),!1)}catch(Oe){return clearTimeout(ye),Oe.name==="AbortError"?(V("Request timeout - URL took too long to respond"),!1):new Promise(De=>{const Ce=new Image,tt=setTimeout(()=>{V("Request timeout - URL took too long to respond"),De(!1)},1e4);Ce.onload=()=>{clearTimeout(tt),Ae(Me)&&U(!0),V(""),De(!0)},Ce.onerror=()=>{clearTimeout(tt),V("Cannot access image - CORS policy, network error, or invalid URL"),De(!1)},Ce.src=Me})}}catch{return V("Unexpected error occurred while validating URL"),!1}finally{L(!1)}},pe=async()=>{O.trim()&&await ze(O.trim())&&(se({url:O.trim()}),n&&cy(n))},Z=Me=>{Me.key==="Enter"&&pe()},be=Me=>{w(Me.target.value),H&&V(""),F&&U(!1)},ve=Me=>{const He=["image/png","image/jpeg","image/gif"],Oe=Array.isArray(Me)?Me:Array.from(Me),De=Oe.filter(tt=>He.includes(tt.type)&&tt.size<=5242880);if(De.length!==Oe.length&&alert(a("inputs.common.invalidFiles")),De.length===0)return;const Ce=De.map(tt=>new Promise(it=>{const Lt=new FileReader;Lt.onload=Qt=>it(Qt.target?.result),Lt.readAsDataURL(tt)}));Promise.all(Ce).then(tt=>{const it={images:tt,id:n||"",styles:r};window.dispatchEvent(new CustomEvent("email-builder-upload-image",{detail:it})),yg(!0,n||"")})},ge=Me=>{Me.preventDefault(),A(!0)},_e=()=>{A(!1)},je=Me=>{Me.preventDefault(),A(!1);const He=Me.dataTransfer.files;ve(He)},Fe=()=>{v({url:"",repeat:"no-repeat",position:"center center",size:"cover"}),f(null),t(null),w(""),U(!1)};return(0,ie.useEffect)(()=>{const Me=window.__emailBuilderEnableAI;Me!==void 0&&S(!!Me);const He=ye=>{const{detail:Oe}=ye;S(!!Oe)};return window.addEventListener("email-builder-ai-generation",He),()=>{window.removeEventListener("email-builder-ai-generation",He)}},[]),(0,ie.useEffect)(()=>{const Me=De=>{const{detail:Ce}=De;yg(!1,Ce.id||""),se({url:Ce.url},Ce.styles),n&&cy(n),eSt(!1),w(Ce.url)},He=De=>{yg(De?.detail?.uploading??!1,De?.detail?.id??"")},ye=()=>{I?.current?.click()},Oe=De=>{const Ce=De.detail;if(typeof Ce=="string"){if(!Ce.includes("url("))se({url:Ce}),w(Ce);else{const tt=d(Ce);v(tt),f(Ce),t(Ce),w(tt.url)}return}Ce?.url!=null&&typeof Ce.url=="string"&&(se({url:Ce.url},Ce.styles),w(Ce.url))};return window.addEventListener("email-builder-set-image",Oe),window.addEventListener("email-builder-upload-image-receive",Me),window.addEventListener("email-builder-upload-file",ye),window.addEventListener("email-builder-toggle-upload-file",He),()=>{window.removeEventListener("email-builder-upload-image-receive",Me),window.removeEventListener("email-builder-set-image",Oe),window.removeEventListener("email-builder-upload-file",ye),window.removeEventListener("email-builder-toggle-upload-file",He)}},[m]),(0,ie.useEffect)(()=>{e&&U(Ae(m.url))},[e,m.url]),(0,ie.useEffect)(()=>{if(e!==h){const Me=d(e);v(Me),f(e||null),w(Me.url||"")}},[e]),(0,C.jsxs)(No,{children:[(0,C.jsxs)(G.Box,{sx:{display:"flex",alignItems:"center",gap:1},children:[(0,C.jsx)(sn,{label:a("inputs.backgroundImage.label")}),!le&&(0,C.jsx)(G.Tooltip,{title:a("inputs.backgroundImage.warningTooltip"),placement:"top",children:(0,C.jsx)(G.IconButton,{size:"small",color:"warning",disableRipple:!0,sx:{p:0,cursor:"help",lineHeight:0,"&:hover":{backgroundColor:"transparent"}},children:(0,C.jsx)(oho,{"aria-hidden":!0})})})]}),(0,C.jsx)(aho,{imageUrl:m.url||null,blockId:n,onRemove:Fe}),(0,C.jsx)(Xpo,{tabs:[{key:"gallery",label:a("inputs.tabs.gallery"),visible:re,render:()=>(0,C.jsx)(rho,{blockId:n,source:"background"})},{key:"yourGallery",label:a("inputs.tabs.yourGallery"),visible:!!$,render:()=>(0,C.jsx)(G.Box,{sx:{mb:2},children:$})},{key:"upload",label:a("inputs.tabs.upload"),visible:ee,render:()=>(0,C.jsxs)(G.Stack,{spacing:1,children:[(0,C.jsx)(G.Box,{children:K&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(sn,{label:a("inputs.image.urlLabel")}),(0,C.jsxs)(G.Stack,{direction:"row",spacing:1,children:[(0,C.jsx)(G.TextField,{fullWidth:!0,placeholder:a("inputs.image.urlPlaceholder"),value:O,onChange:be,onKeyPress:Z,disabled:E,sx:g5}),(0,C.jsx)(G.Button,{variant:"contained",onClick:pe,disabled:!O.trim()||E,sx:{minWidth:"auto",px:2,position:"relative"},children:E?(0,C.jsx)(G.CircularProgress,{size:20,color:"inherit"}):a("inputs.common.add")})]}),H&&(0,C.jsx)(G.Alert,{severity:"error",sx:{mt:1,fontSize:"0.875rem",maxHeight:"70px"},children:H}),F&&(0,C.jsx)(G.Alert,{severity:"warning",sx:{mt:1,fontSize:"0.875rem"},action:(0,C.jsx)(G.IconButton,{"aria-label":a("inputs.common.close"),color:"inherit",size:"small",onClick:()=>{U(!1)},children:(0,C.jsx)(qe.Close,{fontSize:"inherit"})}),children:a("inputs.common.svgWarning")})]})}),K&&Y&&(0,C.jsxs)(G.Stack,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[(0,C.jsx)(G.Divider,{sx:{flexGrow:1}}),(0,C.jsx)(G.Typography,{variant:"caption",sx:{color:"text.secondary"},children:a("inputs.backgroundImage.or")}),(0,C.jsx)(G.Divider,{sx:{flexGrow:1}})]}),Y&&(0,C.jsxs)(G.Box,{onDragOver:ge,onDragLeave:_e,onDrop:je,sx:{width:"100%",border:"2px dashed",borderColor:g?"primary.main":"divider",borderRadius:"8px",padding:"24px 8px 36px 8px",textAlign:"center",bgcolor:g?"primary.50":"background.paper",transition:"all 0.2s ease"},children:[(0,C.jsx)(G.Box,{sx:{display:"flex",justifyContent:"center"},children:(0,C.jsx)(qe.PhotoOutlined,{sx:{fontSize:32,color:"primary"}})}),(0,C.jsxs)("label",{style:{cursor:"pointer"},children:[(0,C.jsx)("input",{ref:I,type:"file",style:{display:"none"},accept:"image/png,image/jpeg,image/gif",multiple:!0,onChange:Me=>{const He=Me.target.files;He&&He.length>0&&ve(Array.from(He))}}),(0,C.jsx)(G.Typography,{component:"span",sx:{fontWeight:"bold",color:"primary.main","&:hover":{fontWeight:"bold",color:"primary.secondary"}},children:a("inputs.common.uploadFile")}),(0,C.jsxs)(G.Typography,{component:"span",sx:{fontWeight:"bold",color:"text.secondary"},children:[" ",a("inputs.common.dragAndDrop")]})]}),(0,C.jsx)(G.Typography,{variant:"body2",sx:{color:"text.secondary",mt:1},children:a("inputs.common.fileInfo")})]})]})},{key:"generate",label:a("inputs.tabs.generate"),visible:y,render:()=>(0,C.jsx)(nho,{src:m.url,style:{width:"100%",margin:0}})}],defaultTab:"upload"}),m.url&&(0,C.jsxs)(G.Box,{sx:{mt:2},children:[(0,C.jsxs)(G.Box,{sx:{mb:2},children:[(0,C.jsx)(sn,{label:a("inputs.backgroundImage.fillType")}),(0,C.jsxs)(G.ToggleButtonGroup,{value:m.size,exclusive:!0,onChange:(Me,He)=>{He!=null&&typeof He=="string"&&se({size:He})},size:"small",fullWidth:!0,children:[(0,C.jsx)(G.ToggleButton,{value:"cover",children:(0,C.jsxs)(G.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[(0,C.jsx)(qe.Crop,{fontSize:"small"}),(0,C.jsx)("span",{children:a("inputs.backgroundImage.fillOptions.cover")})]})}),(0,C.jsx)(G.ToggleButton,{value:"contain",children:(0,C.jsxs)(G.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[(0,C.jsx)(qe.FitScreen,{fontSize:"small"}),(0,C.jsx)("span",{children:a("inputs.backgroundImage.fillOptions.contain")})]})}),(0,C.jsx)(G.ToggleButton,{value:"auto",children:(0,C.jsxs)(G.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[(0,C.jsx)(qe.AspectRatio,{fontSize:"small"}),(0,C.jsx)("span",{children:a("inputs.backgroundImage.fillOptions.auto")})]})})]})]}),(0,C.jsxs)(G.Stack,{direction:"row",spacing:2,sx:{mb:2},children:[(0,C.jsxs)("div",{style:{flex:1},children:[(0,C.jsx)(sn,{label:a("inputs.backgroundImage.repeat")}),(0,C.jsxs)(Qu,{style:{width:"100%"},value:m.repeat,size:"small",onChange:Me=>se({repeat:Me.target.value}),children:[(0,C.jsx)(G.MenuItem,{value:"no-repeat",children:a("inputs.backgroundImage.repeatOptions.none")}),(0,C.jsx)(G.MenuItem,{value:"repeat",children:a("inputs.backgroundImage.repeatOptions.repeat")}),(0,C.jsx)(G.MenuItem,{value:"repeat-x",children:a("inputs.backgroundImage.repeatOptions.repeatX")}),(0,C.jsx)(G.MenuItem,{value:"repeat-y",children:a("inputs.backgroundImage.repeatOptions.repeatY")})]})]}),(0,C.jsxs)("div",{style:{flex:1},children:[(0,C.jsx)(sn,{label:a("inputs.backgroundImage.position")}),(0,C.jsx)(Qu,{style:{width:"100%"},value:m.position,size:"small",onChange:Me=>se({position:Me.target.value}),renderValue:Me=>{const He=String(Me??"");return(0,C.jsxs)(G.Box,{sx:{display:"flex",alignItems:"center",gap:1,paddingRight:"1rem"},children:[qX(He),a(`inputs.backgroundImage.positions.${JX(He)}`)]})},children:["top left","top center","top right","center left","center center","center right","bottom left","bottom center","bottom right"].map(Me=>(0,C.jsx)(G.MenuItem,{sx:{padding:"0.5rem 1rem 0.5rem 0.5rem!important "},value:Me,children:(0,C.jsxs)(G.Box,{sx:{display:"flex",alignItems:"center",gap:1},children:[qX(Me),a(`inputs.backgroundImage.positions.${JX(Me)}`)]})},Me))})]})]})]}),!$&&F&&(0,C.jsx)(G.Alert,{severity:"warning",sx:{mt:1,fontSize:"0.875rem"},children:a("inputs.common.svgWarning")})]})};dr(),v5(),HWe();function PKe({label:e,labelAction:t,defaultValue:r,onChange:n,nullable:a,compact:d=!1,inheritedFrom:p}){const[h,f]=(0,ie.useState)(null),[m,v]=(0,ie.useState)(r),{t:g}=Xt("inspector");(0,ie.useEffect)(()=>{m!==r&&v(r)},[r]);const A=E=>{f(E.currentTarget)},y=d?{border:"1px solid",borderColor:"cadet.400",width:28,height:28,borderRadius:"6px",bgcolor:"#FFFFFF"}:{border:e?"1px solid":"",borderColor:"cadet.400",width:"100%",height:36,paddingTop:"8px",paddingBottom:"8px",paddingLeft:"12px",paddingRight:"12px",borderRadius:"6px",bgcolor:"#FFFFFF"},S=E=>{v(E),n(E)},x=()=>!a||typeof m!="string"||m.trim().length===0?null:(0,C.jsx)(G.Tooltip,{title:g("inputs.background.reset"),placement:"left",children:(0,C.jsx)(G.Box,{sx:{minWidth:24,lineHeight:1,flexShrink:0,pr:"4px",display:"grid",placeItems:"center"},onClick:()=>S(null),children:(0,C.jsx)(qe.FormatColorReset,{sx:{color:"primary.main"}})})}),O=m?(0,C.jsx)(G.ButtonBase,{onClick:A,sx:{...y,bgcolor:m}}):(0,C.jsx)(G.ButtonBase,{onClick:A,sx:{...y},children:(0,C.jsx)(qe.AddOutlined,{fontSize:"small"})}),w=(0,C.jsx)(G.Menu,{anchorEl:h,open:!!h,onClose:()=>f(null),sx:{"& .MuiPaper-root":{boxShadow:"0 4px 6px rgba(0, 0, 0, 0.4);",borderRadius:1,maxWidth:"200px",transform:"translateX(-100%) !important;"}},slotProps:{list:{sx:{height:"auto",padding:0}}},children:(0,C.jsx)(EWe,{value:m||"",nullable:a,onChange:E=>S(E)})});return d?(0,C.jsxs)(G.Box,{sx:{display:"inline-flex",opacity:p?.55:1,transition:"opacity 120ms ease-out"},children:[O,w]}):(0,C.jsxs)(No,{children:[(0,C.jsx)(sn,{label:e,action:t}),(0,C.jsxs)(G.Stack,{direction:"row",spacing:1,sx:{alignContent:"center",opacity:p?.55:1,transition:"opacity 120ms ease-out"},children:[O,x()]}),w]})}function d8(e){return(0,C.jsx)(PKe,{...e,nullable:!1})}function ZX(e){return(0,C.jsx)(PKe,{...e,nullable:!0})}nl();var u95=we(G.Box)(({theme:e})=>({display:"flex",alignItems:"center",border:`1px solid ${e.palette.divider}`,borderRadius:"8px",padding:"4px",minWidth:58,maxWidth:"fit-content",backgroundColor:e.palette.background.paper,"&:hover":{borderColor:e.palette.primary.main},"&:focus-within":{borderColor:e.palette.primary.main,boxShadow:`0 0 0 1px ${e.palette.primary.main}`}})),c95=we("input")(({theme:e})=>({border:"none",outline:"none",background:"transparent",textAlign:"center",width:"27px",minWidth:"27px",maxWidth:"27px",padding:"0!important",lineHeight:"normal",fontSize:"0.9rem",color:e.palette.text.primary,"&::-webkit-outer-spin-button, &::-webkit-inner-spin-button":{WebkitAppearance:"none",margin:0},"&[type=number]":{MozAppearance:"textfield"}})),lho=we(G.IconButton)(({theme:e})=>({padding:"0",color:e.palette.primary.main,"&:hover":{backgroundColor:gr(e.palette.primary.main,.04)},"& .MuiSvgIcon-root":{fontSize:14}}));function Di({iconLabel:e,label:t,value:r,setValue:n,units:a,min:d=0,max:p,step:h=void 0,marks:f=!0,...m}){const v=r??d,[g,A]=(0,ie.useState)(v.toString()),y=H=>{let V=H;V<d&&(V=d),p!==void 0&&V>p&&(V=p),n(V),A(V.toString())},S=H=>{const V=H.target.value;if(A(V),V!==""){const F=Number(V);isNaN(F)||F>=d&&n(F)}},x=()=>{if(g===""||isNaN(Number(g)))A(v.toString());else{const H=Number(g);y(H)}},O=H=>{H.key==="Enter"&&x()};(0,ie.useEffect)(()=>{A((r??d).toString())},[r,d]);const w=()=>{const H=v+1;y(H)},E=()=>{const H=v-1;y(H)},L=(H,V)=>{typeof V=="number"&&n(V)};return(0,C.jsxs)(No,{children:[(0,C.jsx)(sn,{label:t}),(0,C.jsxs)(G.Stack,{direction:"row",spacing:2,sx:{alignItems:"center",justifyContent:"space-between",width:"100%",gap:"1rem"},children:[(0,C.jsx)(G.Box,{sx:{minWidth:24,lineHeight:1,flexShrink:0},children:e}),(0,C.jsx)(G.Slider,{...m,value:v,min:d,max:p||1e3,step:h,color:"primary",marks:f,onChange:L}),(0,C.jsxs)(u95,{children:[(0,C.jsx)(c95,{type:"number",value:g,onChange:S,onBlur:x,onKeyDown:O,min:d,max:p,step:h}),(0,C.jsxs)(G.Box,{sx:{display:"flex",flexDirection:"column",ml:.5},children:[(0,C.jsx)(lho,{onClick:w,disabled:p!==void 0&&v>=p,children:(0,C.jsx)("svg",{width:"15",height:"10",viewBox:"0 0 24 12",children:(0,C.jsx)("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"3",d:"m6 9l6-6l6 6"})})}),(0,C.jsx)(lho,{onClick:E,disabled:v<=d,children:(0,C.jsx)("svg",{width:"15",height:"10",viewBox:"0 0 24 12",style:{transform:"rotate(180deg)"},children:(0,C.jsx)("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"3",d:"m6 9l6-6l6 6"})})})]})]}),(0,C.jsx)(G.Typography,{variant:"caption",color:"text.secondary",sx:{fontSize:"16px",ml:"4px!important"},children:a})]})]})}function dy({label:e,defaultValue:t,onChange:r,...n}){const[a,d]=(0,ie.useState)(t??0);return t!=a&&d(t),(0,C.jsxs)(No,{children:[(0,C.jsx)(sn,{label:e}),(0,C.jsx)(Di,{value:a??0,setValue:p=>{d(p),r(p)},...n})]})}dr();var EKe=({mobile:e=!1,label:t,borderColor:r,borderTop:n,borderBottom:a,borderLeft:d,borderRight:p,onChange:h,sidesLinked:f,onSidesLinkedChange:m})=>{const{t:v}=Xt("inspector"),g=()=>e?{top:"borderTopMobile",bottom:"borderBottomMobile",left:"borderLeftMobile",right:"borderRightMobile"}:{top:"borderTop",bottom:"borderBottom",left:"borderLeft",right:"borderRight"},A=$=>{const Q=Object.values($);return Q.every(K=>K===Q[0])},y=g(),S={[y.top]:n??0,[y.bottom]:a??0,[y.left]:d??0,[y.right]:p??0},[x,O]=(0,ie.useState)(r??"#000000"),[w,E]=(0,ie.useState)(S),L={[y.top]:Number(w[y.top]),[y.bottom]:Number(w[y.bottom]),[y.left]:Number(w[y.left]),[y.right]:Number(w[y.right])},H=f!==void 0?f:A(L);(0,ie.useEffect)(()=>{r!==x&&O(r??"#000000");const $={[y.top]:n??0,[y.bottom]:a??0,[y.left]:d??0,[y.right]:p??0};Object.keys($).some(Q=>w[Q]!==$[Q])&&E($)},[r,n,a,d,p,e]);const V=()=>{if(H)m(!1);else{const $=w[y.top]??0;U($),m(!0)}},F=$=>{O($),h({borderColor:$,...w})},U=$=>{const Q={[y.top]:$,[y.bottom]:$,[y.left]:$,[y.right]:$};E(Q),h({...Q,borderColor:x})},I=($,Q)=>{E(K=>({...K,[Q]:$})),h({...w,borderColor:x,[Q]:$})};return(0,C.jsxs)("div",{children:[(0,C.jsxs)(G.Stack,{direction:"row",sx:{justifyContent:"space-between",alignItems:"center",width:"100%"},children:[(0,C.jsx)(sn,{label:t}),(0,C.jsxs)(G.Stack,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[(0,C.jsx)(d8,{defaultValue:x,onChange:F,compact:!0}),(0,C.jsx)(G.Tooltip,{title:v(H?"lockValues.unlockTooltip":"lockValues.lockTooltip"),children:(0,C.jsx)(G.IconButton,{size:"small",onClick:V,sx:{color:H?"primary.main":"text.secondary","&:hover":{backgroundColor:"action.hover"}},children:H?(0,C.jsx)(qe.Lock,{fontSize:"small"}):(0,C.jsx)(qe.LockOpen,{fontSize:"small"})})})]})]}),H&&(0,C.jsx)(dy,{label:"",iconLabel:(0,C.jsx)(qe.BorderOuterOutlined,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:w[y.top],onChange:U}),!H&&(0,C.jsxs)(G.Stack,{spacing:2,children:[(0,C.jsx)(dy,{label:"",iconLabel:(0,C.jsx)(qe.BorderTopOutlined,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:w[y.top],onChange:$=>I($,y.top)}),(0,C.jsx)(dy,{label:"",iconLabel:(0,C.jsx)(qe.BorderBottomOutlined,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:w[y.bottom],onChange:$=>I($,y.bottom)}),(0,C.jsx)(dy,{label:"",iconLabel:(0,C.jsx)(qe.BorderLeftOutlined,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:w[y.left],onChange:$=>I($,y.left)}),(0,C.jsx)(dy,{label:"",iconLabel:(0,C.jsx)(qe.BorderRightOutlined,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:w[y.right],onChange:$=>I($,y.right)})]})]})};function h1({icon:e,label:t,children:r,modified:n=!1}){const a=fd(),[d,p]=(0,ie.useState)(!1),h=(0,ie.useRef)(null);return a?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(G.Tooltip,{title:t,placement:"left",children:(0,C.jsxs)(G.Box,{sx:{position:"relative",display:"inline-flex",alignSelf:"center"},children:[(0,C.jsx)(G.IconButton,{ref:h,onClick:()=>p(!d),color:d?"primary":"default",size:"small",sx:{borderRadius:1.5,width:32,height:32},children:(0,C.jsx)(e,{fontSize:"small"})}),n&&(0,C.jsx)(G.Box,{component:"span","aria-hidden":!0,sx:f=>({position:"absolute",top:2,right:2,width:5,height:5,borderRadius:"50%",bgcolor:(0,G.alpha)(f.palette.primary.main,.55),pointerEvents:"none"})})]})}),(0,C.jsx)(G.Popover,{open:d,anchorEl:h.current,onClose:()=>p(!1),anchorOrigin:{vertical:"center",horizontal:"left"},transformOrigin:{vertical:"center",horizontal:"right"},slotProps:{paper:{sx:f=>({width:360,p:2,borderRadius:2,backgroundColor:f.palette.background.paper,border:`1px solid ${f.palette.divider}`,boxShadow:"0 8px 32px rgba(0,0,0,0.12)",transform:"translateX(-18px) !important",overflow:"visible","&::after":{content:'""',position:"absolute",right:-5,top:"50%",transform:"translateY(-50%)",width:0,height:0,borderTop:"5px solid transparent",borderBottom:"5px solid transparent",borderLeft:`5px solid ${f.palette.divider}`},"&::before":{content:'""',position:"absolute",right:-4,top:"50%",transform:"translateY(-50%)",width:0,height:0,borderTop:"4px solid transparent",borderBottom:"4px solid transparent",borderLeft:`4px solid ${f.palette.background.paper}`,zIndex:1}})}},children:r})]}):n?(0,C.jsxs)(G.Box,{sx:{position:"relative"},children:[r,(0,C.jsx)(G.Box,{component:"span","aria-hidden":!0,sx:f=>({position:"absolute",top:4,left:-10,width:5,height:5,borderRadius:"50%",bgcolor:(0,G.alpha)(f.palette.primary.main,.55),pointerEvents:"none"})})]}):(0,C.jsx)(C.Fragment,{children:r})}hA();var d95=Av.map(e=>(0,C.jsx)(G.MenuItem,{value:e.key,sx:{fontFamily:e.value},children:e.label},e.key));function kKe({label:e,labelAction:t,onChange:r,defaultValue:n}){const a="INHERIT",[d,p]=(0,ie.useState)(n??a);(0,ie.useEffect)(()=>{d!==n&&p(n??a)},[n]);const h=m=>{const v=m.target.value;p(v),r(v===null?null:v)},f=Av.find(m=>m.key===d)?.value;return(0,C.jsxs)(No,{children:[(0,C.jsx)(sn,{label:e,action:t}),(0,C.jsx)(Qu,{style:{width:"100%",fontFamily:f},value:d,size:"small",onChange:h,children:d95})]})}function XX({label:e,labelAction:t,defaultValue:r=16,onChange:n,maxValue:a,minValue:d,step:p,inheritedFrom:h}){const[f,m]=(0,ie.useState)(r);(0,ie.useEffect)(()=>{f!==r&&m(r)},[r]);const v=g=>{m(g),n(g)};return(0,C.jsxs)(No,{children:[(0,C.jsx)(sn,{label:e,action:t}),(0,C.jsx)(G.Box,{sx:{opacity:h?.55:1,transition:"opacity 120ms ease-out"},children:(0,C.jsx)(Di,{iconLabel:(0,C.jsx)(qe.TextFieldsOutlined,{sx:{fontSize:16,color:"text.primary"}}),value:f,setValue:v,units:"px",step:p??2,min:d||8,max:a||48})})]})}function py({label:e,labelAction:t,children:r,defaultValue:n,onChange:a}){const[d,p]=(0,ie.useState)(n);return(0,ie.useEffect)(()=>{n!==d&&p(n)},[n]),(0,C.jsxs)(No,{children:[(0,C.jsx)(sn,{label:e,action:t}),(0,C.jsx)(G.Box,{sx:{...GBe,paddingLeft:"0px",paddingRight:"0px"},children:(0,C.jsx)(G.ToggleButtonGroup,{exclusive:!0,fullWidth:!0,value:d,size:"small",sx:{width:"100%"},onChange:(h,f)=>{if(typeof f!="string")throw new Error("RadioGroupInput can only receive string values");p(f),a(f)},children:r})})]})}dr();function sho({label:e,labelAction:t,defaultValue:r,onChange:n}){const{t:a}=Xt("inspector"),[d,p]=(0,ie.useState)(r);return(0,ie.useEffect)(()=>{d!==r&&p(r)},[r]),(0,C.jsxs)(py,{label:e,labelAction:t,defaultValue:d,onChange:h=>{p(h),n(h)},children:[(0,C.jsx)(G.ToggleButton,{value:"normal",children:(0,C.jsxs)(G.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[(0,C.jsx)(qe.TextFields,{fontSize:"small"}),(0,C.jsx)("span",{children:a("inputs.fontWeightToggle.regular")})]})}),(0,C.jsx)(G.ToggleButton,{value:"bold",children:(0,C.jsxs)(G.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[(0,C.jsx)(qe.FormatBold,{fontSize:"small"}),(0,C.jsx)("span",{children:a("inputs.fontWeightToggle.bold")})]})})]})}dr();var HKe=({label:e,defaultValue:t,onChange:r,min:n=1,max:a=100,step:d=1})=>{const{t:p}=Xt("inspector");return(0,C.jsx)(Di,{label:e??p("inputs.common.height"),iconLabel:(0,C.jsx)(qe.HeightOutlined,{sx:{color:"text.secondary"}}),units:"px",step:d,min:n,max:a,marks:!1,value:t??n,setValue:r})},p95=[{key:"1",value:"1",label:"Simple (1.0)"},{key:"1.15",value:"1.15",label:"Compact (1.15)"},{key:"1.5",value:"1.5",label:"Normal (1.5)"},{key:"2",value:"2",label:"Relaxed (2.0)"},{key:"2.5",value:"2.5",label:"Wide (2.5)"},{key:"3",value:"3",label:"Loose (3.0)"},{key:"4",value:"4",label:"Very Loose (4.0)"}].map(e=>(0,C.jsx)(G.MenuItem,{value:e.key,children:e.label},e.key));function h95({label:e,onChange:t,defaultValue:r}){const n="INHERIT",[a,d]=(0,ie.useState)(r?.toString()??n);(0,ie.useEffect)(()=>{a!==r?.toString()&&d(r?.toString()??n)},[r]);const p=h=>{const f=h.target.value;d(f),t(f===n?null:parseFloat(f))};return(0,C.jsxs)(No,{children:[(0,C.jsx)(sn,{label:e}),(0,C.jsxs)(Qu,{style:{width:"100%"},value:a,size:"small",onChange:p,children:[(0,C.jsx)(G.MenuItem,{value:n,children:"Default value"}),p95]})]})}dr();function f95(e){return(0,C.jsxs)(G.SvgIcon,{...e,viewBox:"0 0 16 16",children:[(0,C.jsx)("path",{fill:"currentColor",d:"M0 0v16h16V0zm15 3h-1v1h1v11H1V3h1V2H1V1h1v1h1V1h1v1h1V1h1v1h1V1h1v1h1V1h1v1h1V1h1v1h1V1h1v1h1z"}),(0,C.jsx)("path",{fill:"currentColor",d:"M3 2h1v1H3zM2 3h1v1H2zm2 0h1v1H4zm2 0h1v1H6zM5 2h1v1H5zm2 0h1v1H7zm2 0h1v1H9zM8 3h1v1H8zm2 0h1v1h-1zm2 0h1v1h-1zm-1-1h1v1h-1zm2 0h1v1h-1z"})]})}function m95(e){return(0,C.jsxs)(G.SvgIcon,{...e,viewBox:"0 0 16 16",children:[(0,C.jsx)("path",{fill:"currentColor",d:"M16 16V0H0v16zM1 13h1v-1H1V1h14v12h-1v1h1v1h-1v-1h-1v1h-1v-1h-1v1h-1v-1H9v1H8v-1H7v1H6v-1H5v1H4v-1H3v1H2v-1H1z"}),(0,C.jsx)("path",{fill:"currentColor",d:"M12 13h1v1h-1zm1-1h1v1h-1zm-2 0h1v1h-1zm-2 0h1v1H9zm1 1h1v1h-1zm-2 0h1v1H8zm-2 0h1v1H6zm1-1h1v1H7zm-2 0h1v1H5zm-2 0h1v1H3zm1 1h1v1H4zm-2 0h1v1H2z"})]})}function v95(e){return(0,C.jsxs)(G.SvgIcon,{...e,viewBox:"0 0 16 16",children:[(0,C.jsx)("path",{fill:"currentColor",d:"M0 16h16V0H0zM3 1v1h1V1h11v14H3v-1H2v1H1v-1h1v-1H1v-1h1v-1H1v-1h1V9H1V8h1V7H1V6h1V5H1V4h1V3H1V2h1V1z"}),(0,C.jsx)("path",{fill:"currentColor",d:"M2 12h1v1H2zm1 1h1v1H3zm0-2h1v1H3zm0-2h1v1H3zm-1 1h1v1H2zm0-2h1v1H2zm0-2h1v1H2zm1 1h1v1H3zm0-2h1v1H3zm0-2h1v1H3zM2 4h1v1H2zm0-2h1v1H2z"})]})}function _95(e){return(0,C.jsxs)(G.SvgIcon,{...e,viewBox:"0 0 16 16",children:[(0,C.jsx)("path",{fill:"currentColor",d:"M16 0H0v16h16zm-3 15v-1h-1v1H1V1h12v1h1V1h1v1h-1v1h1v1h-1v1h1v1h-1v1h1v1h-1v1h1v1h-1v1h1v1h-1v1h1v1h-1v1z"}),(0,C.jsx)("path",{fill:"currentColor",d:"M13 3h1v1h-1zm-1-1h1v1h-1zm0 2h1v1h-1zm0 2h1v1h-1zm1-1h1v1h-1zm0 2h1v1h-1zm0 2h1v1h-1zm-1-1h1v1h-1zm0 2h1v1h-1zm0 2h1v1h-1zm1-1h1v1h-1zm0 2h1v1h-1z"})]})}var eee=(e=>(0,C.jsxs)(G.SvgIcon,{...e,viewBox:"0 0 16 16",children:[(0,C.jsx)("path",{fill:"currentColor",d:"M0 0v16h16V0zm15 3h-1v1h1v1h-1v1h1v1h-1v1h1v1h-1v1h1v1h-1v1h1v1h-1v1h1v1h-1v-1h-1v1h-1v-1h-1v1h-1v-1H9v1H8v-1H7v1H6v-1H5v1H4v-1H3v1H2v-1H1v-1h1v-1H1v-1h1v-1H1V9h1V8H1V7h1V6H1V5h1V4H1V3h1V2H1V1h1v1h1V1h1v1h1V1h1v1h1V1h1v1h1V1h1v1h1V1h1v1h1V1h1v1h1z"}),(0,C.jsx)("path",{fill:"currentColor",d:"M3 2h1v1H3zm1 1h1v1H4zm2 0h1v1H6zM5 2h1v1H5zm2 0h1v1H7zm2 0h1v1H9zM8 3h1v1H8zm2 0h1v1h-1zm2 0h1v1h-1zm-1-1h1v1h-1zm2 0h1v1h-1zm-1 3h1v1h-1zm1-1h1v1h-1zm-1 3h1v1h-1zm1-1h1v1h-1zm-1 3h1v1h-1zm1-1h1v1h-1zm-1 3h1v1h-1zm1-1h1v1h-1zm-1 3h1v1h-1zm1-1h1v1h-1zM2 3h1v1H2zm1 1h1v1H3zM2 5h1v1H2zm1 1h1v1H3zM2 7h1v1H2zm1 1h1v1H3zM2 9h1v1H2zm1 1h1v1H3zm-1 1h1v1H2zm0 2h1v1H2zm1-1h1v1H3zm1-1h1v1H4zm0 2h1v1H4zm1-1h1v1H5zm1 1h1v1H6zm1-1h1v1H7zm2 0h1v1H9zm-1 1h1v1H8zm3-1h1v1h-1zm-1 1h1v1h-1z"})]}));eee.muiName="PaddingIcon";function LKe({label:e,labelAction:t,defaultValue:r,onChange:n,sidesLinked:a,onSidesLinkedChange:d,inheritedFrom:p}){const{t:f}=Xt("inspector"),[m,v]=(0,ie.useState)(()=>r||{top:0,left:0,bottom:0,right:0});(0,ie.useEffect)(()=>{r&&(r.top!==m.top||r.left!==m.left||r.bottom!==m.bottom||r.right!==m.right)&&v(r)},[r]);const g=m.top===m.bottom&&m.top===m.left&&m.top===m.right,A=a===!0&&g;function y(x,O){let w;A?w={top:O,bottom:O,left:O,right:O}:w={...m,[x]:O},v(w),n(w)}const S=()=>{const x=!A;if(!A){const O={top:m.top,bottom:m.top,left:m.top,right:m.top};v(O),n(O)}d(x)};return(0,C.jsxs)(No,{children:[(0,C.jsxs)(G.Stack,{direction:"row",sx:{justifyContent:"space-between",alignItems:"center",width:"100%"},children:[(0,C.jsx)(sn,{label:e,action:t}),(0,C.jsx)(G.Tooltip,{title:f(A?"lockValues.unlockTooltip":"lockValues.lockTooltip"),children:(0,C.jsx)(G.IconButton,{size:"small",onClick:S,sx:{marginTop:"0!important",color:A?"primary.main":"text.secondary","&:hover":{backgroundColor:"action.hover"}},children:A?(0,C.jsx)(qe.Lock,{fontSize:"small"}):(0,C.jsx)(qe.LockOpen,{fontSize:"small"})})})]}),(0,C.jsx)(G.Stack,{spacing:1,sx:{opacity:p?.55:1,transition:"opacity 120ms ease-out"},children:A?(0,C.jsx)(Di,{iconLabel:(0,C.jsx)("span",{children:f("inputs.responsiveSize.allSides")}),value:m.top,setValue:x=>y("top",x),units:"px",step:16,min:0,max:120,marks:!0}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(Di,{iconLabel:(0,C.jsx)(f95,{sx:{fontSize:16,color:"text.primary"}}),value:m.top,setValue:x=>y("top",x),units:"px",step:16,min:0,max:120,marks:!0}),(0,C.jsx)(Di,{iconLabel:(0,C.jsx)(m95,{sx:{fontSize:16,color:"text.primary"}}),value:m.bottom,setValue:x=>y("bottom",x),units:"px",step:16,min:0,max:120,marks:!0}),(0,C.jsx)(Di,{iconLabel:(0,C.jsx)(v95,{sx:{fontSize:16,color:"text.primary"}}),value:m.left,setValue:x=>y("left",x),units:"px",step:16,min:0,max:120,marks:!0}),(0,C.jsx)(Di,{iconLabel:(0,C.jsx)(_95,{sx:{fontSize:16,color:"text.primary"}}),value:m.right,setValue:x=>y("right",x),units:"px",step:16,min:0,max:120,marks:!0})]})})]})}dr();var g95=({label:e,defaultValue:t,onChange:r,maxValue:n=600,shapeSteps:a=8,cornersLinked:d,onCornersLinkedChange:p})=>{const{t:h}=Xt("inspector"),[f,m]=(0,ie.useState)(()=>typeof t=="object"&&t!==null?"rounded":t||"rectangle"),[v,g]=(0,ie.useState)(()=>typeof t=="object"&&t!==null?t:{topLeft:0,topRight:0,bottomLeft:0,bottomRight:0}),A=d===!0;(0,ie.useEffect)(()=>{typeof t=="object"&&t!==null?(g(t),m("rounded")):(t==="rectangle"||t==="pill")&&m(t)},[t]);const y=w=>{const E=w;m(E),r(E==="rounded"?v:E)},S=(w,E)=>{let L;A?L={topLeft:E,topRight:E,bottomLeft:E,bottomRight:E}:L={...v,[w]:E},g(L),r(L)},x=()=>{const w=!A;if(!A){const E={topLeft:v.topLeft,topRight:v.topLeft,bottomLeft:v.topLeft,bottomRight:v.topLeft};g(E),r(E)}p(w)},O=typeof n=="number"?n:Number(n)||600;return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(py,{label:e||h("shape.label"),defaultValue:f,onChange:y,children:[(0,C.jsx)(G.ToggleButton,{value:"rectangle",children:(0,C.jsxs)(G.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[(0,C.jsx)(qe.CropSquare,{fontSize:"small"}),(0,C.jsx)("span",{children:h("shape.square")})]})}),(0,C.jsx)(G.ToggleButton,{value:"pill",children:(0,C.jsxs)(G.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[(0,C.jsx)(qe.PanoramaFishEye,{fontSize:"small"}),(0,C.jsx)("span",{children:h("shape.pill")})]})}),(0,C.jsx)(G.ToggleButton,{value:"rounded",children:(0,C.jsxs)(G.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[(0,C.jsx)(qe.RoundedCorner,{fontSize:"small"}),(0,C.jsx)("span",{children:h("shape.custom")})]})})]}),f==="rounded"&&(0,C.jsxs)(G.Stack,{spacing:2,sx:{alignItems:"flex-start",pb:1},children:[(0,C.jsxs)(G.Stack,{direction:"row",sx:{justifyContent:"space-between",alignItems:"center",width:"100%"},children:[(0,C.jsx)(sn,{label:h("shape.borderRadius")}),(0,C.jsx)(G.Tooltip,{title:h(A?"lockValues.unlockTooltip":"lockValues.lockTooltip"),children:(0,C.jsx)(G.IconButton,{size:"small",onClick:x,sx:{marginTop:"0!important",color:A?"primary.main":"text.secondary","&:hover":{backgroundColor:"action.hover"}},children:A?(0,C.jsx)(qe.Lock,{fontSize:"small"}):(0,C.jsx)(qe.LockOpen,{fontSize:"small"})})})]}),A?(0,C.jsx)(C.Fragment,{children:(0,C.jsx)(Di,{iconLabel:(0,C.jsx)(qe.RoundedCorner,{sx:{fontSize:16}}),value:Number(v.topRight),setValue:w=>S("topLeft",w),units:"px",min:0,step:a,marks:a>1,max:O})}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(Di,{iconLabel:(0,C.jsx)(qe.RoundedCorner,{sx:{fontSize:16,transform:"rotate(0deg)"}}),value:Number(v.topLeft),setValue:w=>S("topLeft",w),units:"px",min:0,step:a,marks:a>1,max:O}),(0,C.jsx)(Di,{iconLabel:(0,C.jsx)(qe.RoundedCorner,{sx:{fontSize:16,transform:"rotate(270deg)"}}),value:Number(v.topRight),setValue:w=>S("topRight",w),units:"px",min:0,step:a,marks:a>1,max:O}),(0,C.jsx)(Di,{iconLabel:(0,C.jsx)(qe.RoundedCorner,{sx:{fontSize:16,transform:"rotate(180deg)"}}),value:Number(v.bottomLeft),setValue:w=>S("bottomLeft",w),units:"px",min:0,step:a,marks:a>1,max:O}),(0,C.jsx)(Di,{iconLabel:(0,C.jsx)(qe.RoundedCorner,{sx:{fontSize:16,transform:"rotate(90deg)"}}),value:Number(v.bottomRight),setValue:w=>S("bottomRight",w),units:"px",min:0,step:a,marks:a>1,max:O})]})]})]})};function DKe({label:e,labelAction:t,defaultValue:r,onChange:n}){const[a,d]=(0,ie.useState)(r??"left");return(0,ie.useEffect)(()=>{r!==a&&d(r??"left")},[r]),(0,C.jsxs)(No,{children:[(0,C.jsx)(sn,{label:e,action:t}),(0,C.jsxs)(py,{label:"",defaultValue:a,onChange:p=>{d(p),n(p)},children:[(0,C.jsx)(G.ToggleButton,{value:"left",children:(0,C.jsx)(qe.FormatAlignLeftOutlined,{fontSize:"small"})}),(0,C.jsx)(G.ToggleButton,{value:"center",children:(0,C.jsx)(qe.FormatAlignCenterOutlined,{fontSize:"small"})}),(0,C.jsx)(G.ToggleButton,{value:"right",children:(0,C.jsx)(qe.FormatAlignRightOutlined,{fontSize:"small"})})]})]})}dr();var uho=({label:e,defaultValue:t,onChange:r,step:n,...a})=>{const{t:d}=Xt("inspector");return(0,C.jsx)(Di,{label:e??d("inputs.common.width"),iconLabel:(0,C.jsx)(qe.HeightOutlined,{sx:{color:"text.primary",transform:"rotate(90deg)"}}),units:"%",step:n,min:1,max:100,marks:!1,value:t??1,setValue:r,...a})};dr(),oi(),Lr();var tee=(e=>(0,C.jsx)(G.SvgIcon,{...e,viewBox:"0 0 24 24",children:(0,C.jsx)("path",{fill:"currentColor",d:"M15 4h7v2h-7zm1 4h6v2h-6zm2 4h4v2h-4zM9.307 4l-6 16h2.137l1.875-5h6.363l1.875 5h2.137l-6-16zm-1.239 9L10.5 6.515L12.932 13z"})}));tee.muiName="FontFamilyIcon";var Tz=(e=>(0,C.jsx)(G.SvgIcon,{...e,viewBox:"0 0 24 24",children:(0,C.jsxs)("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",children:[(0,C.jsx)("path",{d:"M13.04 4.75h3.66c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311c.327.642.327 1.482.327 3.162v5.4c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311c-.642.327-1.482.327-3.162.327H7.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C3 17.47 3 16.63 3 14.95v-.93"}),(0,C.jsx)("path",{d:"m6.407 2.818l5.384 5.385M6.407 2.818L3.01 6.214c-.696.696-1.044 1.044-1.174 1.446c-.057.176-.086.36-.086.543m4.657-5.385L5.589 2m6.202 6.203l-3.396 3.396c-.696.696-1.044 1.044-1.445 1.174a1.76 1.76 0 0 1-1.086 0c-.401-.13-.75-.478-1.445-1.174L3.01 10.191c-.696-.696-1.044-1.044-1.174-1.445a1.8 1.8 0 0 1-.086-.543m10.042 0H1.75m10.672 4.094l1.485-2.448l1.744 2.313a1.824 1.824 0 0 1-.668 2.491c-1.546.893-3.322-.74-2.562-2.356"})]})}));Tz.muiName="BackgroundColorIcon";var ree=(e=>(0,C.jsx)(G.SvgIcon,{...e,viewBox:"0 0 24 24",children:(0,C.jsxs)("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",children:[(0,C.jsx)("path",{d:"m7.154 13.088l1.73-3.959m0 0h6.231m-6.23 0l2.652-6.065a.5.5 0 0 1 .926 0l2.652 6.065m0 0l1.731 3.96"}),(0,C.jsx)("rect",{width:"15.5",height:"4.353",x:"4.25",y:"16.897",rx:"1.5"})]})}));ree.muiName="TextColorIcon";function b95({name:e,value:t,onChange:r,shapeMaxValue:n,shapeSteps:a}){const d=ll(),p=AF(),h=vF(),{t:f}=Xt("inspector"),m=w=>{if(!h)return t[w]??null;const E=d==="desktop"?"desktop":"mobile",L=p?.theme,H=pot({type:h,data:{style:t}},"style",w,L,E);return H!==void 0?H:Sz[h]?.style?.[w]??null},v=w=>{if(t[w]!==void 0&&t[w]!==null||!h)return;const E=p?.theme?.blocks?.[h]?.style?.[w];if(E!=null)return"theme";const L=Sz[h]?.style?.[w];return L!=null?"default":void 0},g=w=>m(w),A=(w,E)=>{const L=t[w],H=t[E];return L??H},y=(w,E)=>{r(E?{...t,...E,[e]:w}:{...t,[e]:w})},S=w=>{r({...t,...w})},O=(()=>{switch(e){case"textAlignMobile":return m("textAlignMobile")??m("textAlign");case"mobilePadding":return m("mobilePadding")??m("padding");case"fontSizeMobile":return m("fontSizeMobile")??m("fontSize")??16;case"heightMobile":return m("heightMobile")??m("height");case"widthMobile":return m("widthMobile")??m("width");case"borderMobile":return{borderTop:A("borderTopMobile","borderTop"),borderBottom:A("borderBottomMobile","borderBottom"),borderLeft:A("borderLeftMobile","borderLeft"),borderRight:A("borderRightMobile","borderRight")};default:return m(e)}})();switch(e){case"backgroundColor":return(0,C.jsx)(h1,{icon:Tz,label:f("properties.backgroundColor"),children:(0,C.jsx)(ZX,{label:f("properties.backgroundColor"),defaultValue:O??p?.canvasColor,onChange:y})});case"background":return(0,C.jsx)(h1,{icon:qe.WallpaperOutlined,label:f("properties.background","Background"),children:(0,C.jsx)(s95,{defaultValue:O,onChange:(w,E)=>y(w,E),values:t})});case"borderColor":return(0,C.jsx)(h1,{icon:Tz,label:f("properties.border"),children:(0,C.jsx)(ZX,{label:f("properties.border"),defaultValue:O,onChange:y})});case"borderRadius":return(0,C.jsx)(h1,{icon:qe.RoundedCornerOutlined,label:f("properties.borderRadius"),children:(0,C.jsx)(dy,{iconLabel:(0,C.jsx)(qe.RoundedCornerOutlined,{}),units:"px",step:4,marks:!0,min:0,max:48,label:f("properties.borderRadius"),defaultValue:O,onChange:y})});case"color":return(0,C.jsx)(h1,{icon:qe.PaletteOutlined,label:f("properties.color"),children:(0,C.jsx)(ZX,{label:f("properties.color"),defaultValue:O,onChange:y})});case"fontFamily":return(0,C.jsx)(h1,{icon:tee,label:f("properties.fontFamily"),children:(0,C.jsx)(kKe,{label:f("properties.fontFamily"),defaultValue:O,onChange:y})});case"fontWeight":return(0,C.jsx)(h1,{icon:qe.FormatBoldOutlined,label:f("properties.fontWeight"),children:(0,C.jsx)(sho,{label:f("properties.fontWeight"),defaultValue:O,onChange:y})});case"textAlign":return d==="desktop"&&(0,C.jsx)(h1,{icon:qe.FormatAlignCenterOutlined,label:f("properties.alignment"),children:(0,C.jsx)(DKe,{label:f("properties.alignment"),defaultValue:O,onChange:y})});case"textAlignMobile":return d!="desktop"&&(0,C.jsx)(h1,{icon:qe.FormatAlignCenterOutlined,label:f("properties.alignment"),children:(0,C.jsx)(DKe,{label:f("properties.alignment"),defaultValue:O,onChange:y})});case"padding":return d==="desktop"&&(0,C.jsx)(h1,{icon:eee,label:f("properties.padding"),children:(0,C.jsx)(LKe,{label:f("properties.padding"),defaultValue:m("padding"),inheritedFrom:v("padding"),onChange:y,sidesLinked:t.paddingSidesLinked,onSidesLinkedChange:w=>r({...t,paddingSidesLinked:w})})});case"mobilePadding":return d!="desktop"&&(0,C.jsx)(h1,{icon:eee,label:f("properties.padding"),children:(0,C.jsx)(LKe,{label:f("properties.padding"),defaultValue:m("mobilePadding")??m("padding"),inheritedFrom:t.mobilePadding!=null?void 0:"default",onChange:y,sidesLinked:t.mobilePaddingSidesLinked,onSidesLinkedChange:w=>r({...t,mobilePaddingSidesLinked:w})})});case"fontSize":return d==="desktop"&&(0,C.jsx)(h1,{icon:qe.FormatSizeOutlined,label:f("properties.fontSize"),children:(0,C.jsx)(XX,{maxValue:80,step:8,label:f("properties.fontSize"),defaultValue:O??16,onChange:y})});case"fontSizeMobile":return d!="desktop"&&(0,C.jsx)(h1,{icon:qe.FormatSizeOutlined,label:f("properties.fontSize"),children:(0,C.jsx)(XX,{maxValue:80,step:8,label:f("properties.fontSize"),defaultValue:O,onChange:y})});case"lineHeight":return(0,C.jsx)(h1,{icon:qe.FormatLineSpacingOutlined,label:f("properties.lineHeight"),children:(0,C.jsx)(h95,{label:f("properties.lineHeight"),defaultValue:O??1.5,onChange:y})});case"shape":return(0,C.jsx)(h1,{icon:qe.RoundedCornerOutlined,label:f("properties.shape"),children:(0,C.jsx)(g95,{shapeSteps:a,maxValue:n,label:f("properties.shape"),defaultValue:O,onChange:y,cornersLinked:t.shapeCornersLinked,onCornersLinkedChange:w=>r({...t,shapeCornersLinked:w})})});case"height":return d==="desktop"&&(0,C.jsx)(h1,{icon:qe.HeightOutlined,label:f("properties.height"),children:(0,C.jsx)(HKe,{label:f("properties.height"),defaultValue:O,onChange:y})});case"heightMobile":return d!="desktop"&&(0,C.jsx)(h1,{icon:qe.HeightOutlined,label:f("properties.height"),children:(0,C.jsx)(HKe,{label:f("properties.height"),defaultValue:O,onChange:y})});case"width":return d==="desktop"&&(0,C.jsx)(h1,{icon:qe.WidthFullOutlined,label:f("properties.width"),children:(0,C.jsx)(uho,{label:f("properties.width"),defaultValue:m("width")??void 0,onChange:y})});case"widthMobile":return d!="desktop"&&(0,C.jsx)(h1,{icon:qe.WidthFullOutlined,label:f("properties.width"),children:(0,C.jsx)(uho,{label:f("properties.width"),defaultValue:m("widthMobile")??m("width")??void 0,onChange:y})});case"border":return d==="desktop"&&(0,C.jsx)(h1,{icon:qe.BorderStyleOutlined,label:f("properties.border"),children:(0,C.jsx)(EKe,{label:f("properties.border"),borderColor:t.borderColor??null,borderTop:g("borderTop"),borderBottom:g("borderBottom"),borderLeft:g("borderLeft"),borderRight:g("borderRight"),onChange:S,sidesLinked:t.borderSidesLinked,onSidesLinkedChange:w=>r({...t,borderSidesLinked:w})})});case"borderMobile":return d!="desktop"&&(0,C.jsx)(h1,{icon:qe.BorderStyleOutlined,label:f("properties.border"),children:(0,C.jsx)(EKe,{mobile:!0,label:f("properties.border"),borderColor:t.borderColor??null,borderTop:g("borderTopMobile")??g("borderTop"),borderBottom:g("borderBottomMobile")??g("borderBottom"),borderLeft:g("borderLeftMobile")??g("borderLeft"),borderRight:g("borderRightMobile")??g("borderRight"),onChange:S,sidesLinked:t.borderMobileSidesLinked,onSidesLinkedChange:w=>r({...t,borderMobileSidesLinked:w})})});default:return null}}zF();var p8={section:"style",key:"padding",kind:"padding",labelKey:"theme.fields.padding"},Gm={section:"style",key:"backgroundColor",kind:"color",labelKey:"theme.fields.backgroundColor"},A95={section:"style",key:"fontWeight",kind:"fontWeight",labelKey:"theme.fields.fontWeight"},y95={section:"style",key:"textAlign",kind:"textAlign",labelKey:"theme.fields.textAlign"},S95=["NotionText","Button","Image","Divider","Spacer","SocialMedia","Container","ColumnsContainer"],cho={NotionText:{titleKey:"theme.blocks.notionText.title",icon:she,fields:[Gm,{section:"style",key:"fontSize",kind:"fontSize",labelKey:"theme.fields.fontSize"},p8]},Button:{titleKey:"theme.blocks.button.title",icon:gHe,fields:[{section:"style",key:"buttonBackgroundColor",kind:"color",labelKey:"theme.fields.buttonBackgroundColor",icon:GW},{section:"style",key:"buttonTextColor",kind:"color",labelKey:"theme.fields.buttonTextColor",icon:ree},{section:"style",key:"fontSize",kind:"fontSize",labelKey:"theme.fields.fontSize"},A95,y95,Gm,p8]},Image:{titleKey:"theme.blocks.image.title",icon:zye,fields:[Gm,p8]},Divider:{titleKey:"theme.blocks.divider.title",icon:lye,fields:[{section:"style",key:"color",kind:"color",labelKey:"theme.fields.color",icon:GW},Gm,{section:"style",key:"width",kind:"number",labelKey:"theme.fields.width"},{section:"style",key:"height",kind:"number",labelKey:"theme.fields.height"},p8]},Spacer:{titleKey:"theme.blocks.spacer.title",icon:gve,fields:[Gm,{section:"style",key:"height",kind:"number",labelKey:"theme.fields.height"}]},SocialMedia:{titleKey:"theme.blocks.socialMedia.title",icon:hAe,fields:[Gm,p8]},Container:{titleKey:"theme.blocks.container.title",icon:OO,fields:[Gm,{section:"style",key:"border",kind:"border",labelKey:"theme.fields.border"},p8]},ColumnsContainer:{titleKey:"theme.blocks.columnsContainer.title",icon:BFe,fields:[Gm,p8]}};Lr();function Qm({title:e,children:t}){const r=fd(),n=vF(),a=(n?cho[n]:null)?.icon;return(0,C.jsxs)(G.Container,{sx:{padding:"0!important",paddingTop:"1rem!important"},children:[!r&&(0,C.jsx)(G.Typography,{sx:{fontWeight:"bold",mb:2,color:"text.primary",fontSize:"1.25rem"},children:e}),r&&a&&(0,C.jsx)(G.Tooltip,{title:e,placement:"left",children:(0,C.jsx)(G.Box,{sx:{display:"flex",justifyContent:"center",pb:1.5},children:(0,C.jsx)(a,{sx:{fontSize:22,color:"text.secondary"}})})}),(0,C.jsx)(G.Stack,{spacing:r?.5:1.5,sx:{mb:3,pt:r?0:1},children:t})]})}function xz(){return fd()?(0,C.jsx)(G.Divider,{sx:{my:.5}}):null}dr(),Lr();function dho(e){return{top:Number(e.top??0),bottom:Number(e.bottom??0),left:Number(e.left??0),right:Number(e.right??0)}}function T95({size:e,sizeMobile:t,sizePaddingSidesLinked:r,sizeMobilePaddingSidesLinked:n,onChange:a,label:d,maxValue:p=100,paddingSteps:h=8}){const{t:f}=Xt("inspector"),m=d??f("inputs.common.size"),v=ll(),[g,A]=(0,ie.useState)(()=>{const H=v==="desktop"?e:t!==void 0?t:e;return typeof H=="object"&&H!==null?dho(H):{top:8,bottom:8,left:16,right:16}}),y=v==="desktop"?r===!0:n===!0;(0,ie.useEffect)(()=>{const H=v==="desktop"?e:t!==void 0?t:e;typeof H=="object"&&H!==null&&A(dho(H))},[e,t,v]);const S=()=>{const H=v==="desktop"?e:t!==void 0?t:e;return typeof H=="object"&&H!==null?"custom":typeof H=="string"?H:"medium"},x=typeof p=="number"?p:Number(p)||100,O=H=>{if(v==="desktop"){const V={size:H==="custom"?g:H};t==null&&(V.sizeMobile=H==="custom"?g:H),a(V)}else a({sizeMobile:H==="custom"?g:H})},w=(H,V)=>{let F;y?F={top:V,bottom:V,left:V,right:V}:F={...g,[H]:V},A(F),a(v==="desktop"?{size:F}:{sizeMobile:F})},E=()=>{if(v==="desktop")if(y)a({sizePaddingSidesLinked:!1});else{const H={top:g.top,bottom:g.top,left:g.top,right:g.top};A(H),a({size:H,sizePaddingSidesLinked:!0})}else if(y)a({sizeMobilePaddingSidesLinked:!1});else{const H={top:g.top,bottom:g.top,left:g.top,right:g.top};A(H),a({sizeMobile:H,sizeMobilePaddingSidesLinked:!0})}},L=S();return(0,C.jsxs)(G.Stack,{spacing:2,children:[(0,C.jsxs)(py,{label:m,defaultValue:L,onChange:O,children:[(0,C.jsx)(G.ToggleButton,{value:"x-small",children:(0,C.jsx)(G.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:(0,C.jsx)("span",{children:f("inputs.responsiveSize.options.xSmall")})})}),(0,C.jsx)(G.ToggleButton,{value:"small",children:(0,C.jsx)(G.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:(0,C.jsx)("span",{children:f("inputs.responsiveSize.options.small")})})}),(0,C.jsx)(G.ToggleButton,{value:"medium",children:(0,C.jsx)(G.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:(0,C.jsx)("span",{children:f("inputs.responsiveSize.options.medium")})})}),(0,C.jsx)(G.ToggleButton,{value:"custom",children:(0,C.jsx)(G.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:(0,C.jsx)("span",{children:f("inputs.responsiveSize.options.custom")})})})]}),L==="custom"&&(0,C.jsxs)(G.Stack,{spacing:2,sx:{alignItems:"flex-start",pb:1},children:[(0,C.jsxs)(G.Stack,{direction:"row",sx:{justifyContent:"space-between",alignItems:"center",width:"100%"},children:[(0,C.jsx)(sn,{label:f("inputs.responsiveSize.customPadding")}),(0,C.jsx)(G.Tooltip,{title:f(y?"lockValues.unlockTooltip":"lockValues.lockTooltip"),children:(0,C.jsx)(G.IconButton,{size:"small",onClick:E,sx:{marginTop:"0!important",color:y?"primary.main":"text.secondary","&:hover":{backgroundColor:"action.hover"}},children:y?(0,C.jsx)(qe.Lock,{fontSize:"small"}):(0,C.jsx)(qe.LockOpen,{fontSize:"small"})})})]}),y?(0,C.jsx)(Di,{iconLabel:(0,C.jsx)(G.Typography,{variant:"body2",component:"span",children:f("inputs.responsiveSize.allSides")}),value:g.top,setValue:H=>w("top",H),units:"px",min:0,step:h,marks:h>1,max:x}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(Di,{iconLabel:(0,C.jsx)(qe.AlignVerticalTopOutlined,{sx:{fontSize:16}}),value:g.top,setValue:H=>w("top",H),units:"px",min:0,step:h,marks:h>1,max:x}),(0,C.jsx)(Di,{iconLabel:(0,C.jsx)(qe.AlignVerticalBottomOutlined,{sx:{fontSize:16}}),value:g.bottom,setValue:H=>w("bottom",H),units:"px",min:0,step:h,marks:h>1,max:x}),(0,C.jsx)(Di,{iconLabel:(0,C.jsx)(qe.AlignHorizontalLeftOutlined,{sx:{fontSize:16}}),value:g.left,setValue:H=>w("left",H),units:"px",min:0,step:h,marks:h>1,max:x}),(0,C.jsx)(Di,{iconLabel:(0,C.jsx)(qe.AlignHorizontalRightOutlined,{sx:{fontSize:16}}),value:g.right,setValue:H=>w("right",H),units:"px",min:0,step:h,marks:h>1,max:x})]})]})]})}dr(),Lr();function x95({fullWidth:e,fullWidthMobile:t,onChange:r,label:n="Width"}){const a=ll(),{t:d}=Xt("inspector"),p=()=>a==="desktop"?e:t!==void 0?t:e,h=f=>{const m=f==="FULL_WIDTH";if(a==="desktop"){const v={fullWidth:m};t==null&&(v.fullWidthMobile=m),r(v)}else r({fullWidthMobile:m})};return(0,C.jsxs)(py,{label:n,defaultValue:p()?"FULL_WIDTH":"AUTO",onChange:h,children:[(0,C.jsx)(G.ToggleButton,{value:"FULL_WIDTH",children:(0,C.jsxs)(G.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[(0,C.jsx)(qe.WidthFull,{fontSize:"small"}),(0,C.jsx)("span",{children:d("inputs.width.full")})]})}),(0,C.jsx)(G.ToggleButton,{value:"AUTO",children:(0,C.jsxs)(G.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[(0,C.jsx)(qe.WidthNormal,{fontSize:"small"}),(0,C.jsx)("span",{children:d("inputs.width.auto")})]})})]})}function C95(e,t){const r=(0,ie.useRef)(null),n=(0,ie.useRef)(e),a=(0,ie.useRef)([]);n.current=e;const d=(0,ie.useCallback)((...p)=>{a.current=p,r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{n.current(...p),r.current=null},t)},[t]);return d.flush=(0,ie.useCallback)(()=>{r.current&&(clearTimeout(r.current),r.current=null,n.current(...a.current))},[]),d}function nee({helperText:e,label:t,placeholder:r,rows:n,InputProps:a,defaultValue:d,onChange:p}){const[h,f]=(0,ie.useState)(d);(0,ie.useEffect)(()=>{h!==d&&f(d)},[d]);const m=C95(v=>{p(v)},150);return(0,C.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[(0,C.jsx)(sn,{label:t}),(0,C.jsx)(G.TextField,{fullWidth:!0,multiline:typeof n=="number"&&n>1,minRows:n,variant:"outlined",placeholder:r,helperText:e,slotProps:{input:a},value:h,sx:g5,onChange:v=>{const g=v.target.value;f(g),m(g)},onBlur:()=>{m.flush()}})]})}R4e(),Lr();function eu({names:e,value:t,onChange:r,disabledCSSValidation:n=!1,shapeMaxValue:a,shapeSteps:d}){const p=X6(),h=vF();return(fd()||n||p=="css"||bg.includes(h||""))&&(0,C.jsx)(C.Fragment,{children:e.map(f=>(0,C.jsx)(b95,{shapeMaxValue:a,shapeSteps:d,name:f,value:t||{},onChange:r},f))})}dr(),mNe(),Lr();function O95({data:e,setData:t}){const[,r]=(0,ie.useState)(null),n=AF(),{t:a}=Xt("inspector"),d=w=>{const E=RT.safeParse(w);E.success?(t(E.data),r(null)):r(E.error)},p=e.props?.text??Ip.text,h=e.props?.url??Ip.url,f=e.props?.fullWidth??Ip.fullWidth,m=e.props?.size??Ip.size,v=n,g=e.style?.buttonTextColor??e.props?.buttonTextColor??v?.textColor,A=e.style?.buttonBackgroundColor??e.props?.buttonBackgroundColor??Ip.buttonBackgroundColor,y=e.props?.fullWidthMobile,S=e.props?.sizeMobile,x=X6(),O=fd();return(0,C.jsxs)(Qm,{title:a("inputs.panels.button.title"),children:[(x=="block-configuration"||O)&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(eu,{disabledCSSValidation:!0,names:["fontFamily","fontSize","fontSizeMobile","fontWeight"],value:e.style,onChange:w=>d({...e,style:w})}),(0,C.jsx)(h1,{icon:qe.TitleOutlined,label:a("inputs.panels.button.textLabel"),children:(0,C.jsx)(nee,{label:a("inputs.panels.button.textLabel"),defaultValue:p,onChange:w=>d({...e,props:{...e.props,text:w}})})}),(0,C.jsx)(h1,{icon:qe.LinkOutlined,label:a("inputs.panels.button.targetLabel"),children:(0,C.jsx)(nee,{label:a("inputs.panels.button.targetLabel"),placeholder:a("inputs.panels.button.targetPlaceholder"),defaultValue:h,onChange:w=>d({...e,props:{...e.props,url:w}})})}),(0,C.jsx)(h1,{icon:qe.WidthFullOutlined,label:a("properties.width"),children:(0,C.jsx)(x95,{label:a("properties.width"),fullWidth:f,fullWidthMobile:y,onChange:w=>d({...e,props:{...e.props,...w}})})}),(0,C.jsx)(h1,{icon:qe.AspectRatioOutlined,label:a("properties.size","Size"),children:(0,C.jsx)(T95,{size:m,sizeMobile:S,sizePaddingSidesLinked:e.props?.sizePaddingSidesLinked,sizeMobilePaddingSidesLinked:e.props?.sizeMobilePaddingSidesLinked,onChange:w=>d({...e,props:{...e.props,...w}})})})]}),(0,C.jsx)(xz,{}),(0,C.jsx)(eu,{names:["shape","textAlign","textAlignMobile","backgroundColor","border","borderMobile","padding","mobilePadding"],value:e.style,shapeMaxValue:80,onChange:w=>d({...e,style:w})}),(x==="css"||O)&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h1,{icon:ree,label:a("inputs.panels.button.textColor"),children:(0,C.jsx)(d8,{label:a("inputs.panels.button.textColor"),defaultValue:g,onChange:w=>d({...e,style:{...e.style,buttonTextColor:w}})})}),(0,C.jsx)(h1,{icon:qe.PaletteOutlined,label:a("inputs.panels.button.buttonColor"),children:(0,C.jsx)(d8,{label:a("inputs.panels.button.buttonColor"),defaultValue:A,onChange:w=>d({...e,style:{...e.style,buttonBackgroundColor:w}})})})]})]})}hh();var w95=(e,t,r)=>{if(!e||!document)return;const n=q1(e),a=document.querySelector(`.${n}`);if(!a)return;const d=a.parentElement;if(!d)return;const p=Math.ceil(d.getBoundingClientRect().width);r.props?.touched||r.props?.width!==p&&t({...r,props:{...r.props,width:p}})},j95=e=>{if(!e||!document)return;const t=q1(e),r=document.querySelector(`.${t}`);if(!r)return;const n=r.parentElement;if(!n)return;const a=Math.ceil(n.getBoundingClientRect().width);return a||null};dr(),Lr();var M95={desktop:"contentAlignment",mobile:"contentAlignmentMobile"};function R95({data:e,updateData:t}){const{t:r}=Xt("inspector"),n=ll(),a=M95[n]||"contentAlignment",d=e.props?.[a]??e.props?.contentAlignment,p=h=>{t({...e,props:{...e.props,[a]:h}})};return(0,C.jsxs)(py,{label:r("inputs.alignment.label"),defaultValue:d,onChange:p,children:[(0,C.jsx)(G.ToggleButton,{value:"top",children:(0,C.jsx)(qe.VerticalAlignTopOutlined,{fontSize:"small"})}),(0,C.jsx)(G.ToggleButton,{value:"middle",children:(0,C.jsx)(qe.VerticalAlignCenterOutlined,{fontSize:"small"})}),(0,C.jsx)(G.ToggleButton,{value:"bottom",children:(0,C.jsx)(qe.VerticalAlignBottomOutlined,{fontSize:"small"})})]})}function pho({value:e,onChange:t,options:r}){return(0,C.jsx)(G.ToggleButtonGroup,{exclusive:!0,value:e,size:"small",onChange:(n,a)=>{typeof a=="string"&&t(a)},sx:{display:"flex",width:"100%"},children:r.map(n=>(0,C.jsx)(G.ToggleButton,{value:n.value,children:(0,C.jsxs)(G.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[n.icon,(0,C.jsx)("span",{children:n.label})]})},n.value))})}dr();var aee="layout-custom",VKe=[{id:"layout-50-50",distribution:[50,50,null]},{id:"layout-55-45",distribution:[55,45,null]},{id:"layout-45-55",distribution:[45,55,null]},{id:"layout-60-40",distribution:[60,40,null]},{id:"layout-40-60",distribution:[40,60,null]},{id:"layout-70-30",distribution:[70,30,null]},{id:"layout-30-70",distribution:[30,70,null]},{id:"layout-75-25",distribution:[75,25,null]},{id:"layout-25-75",distribution:[25,75,null]},{id:"layout-80-20",distribution:[80,20,null]},{id:"layout-20-80",distribution:[20,80,null]}],FKe=[{id:"layout-33-33-33",distribution:[33.34,33.33,33.33]},{id:"layout-30-40-30",distribution:[30,40,30]},{id:"layout-25-50-25",distribution:[25,50,25]},{id:"layout-20-60-20",distribution:[20,60,20]},{id:"layout-50-25-25",distribution:[50,25,25]},{id:"layout-25-25-50",distribution:[25,25,50]},{id:"layout-60-20-20",distribution:[60,20,20]},{id:"layout-20-20-60",distribution:[20,20,60]},{id:"layout-40-30-30",distribution:[40,30,30]},{id:"layout-40-20-40",distribution:[40,20,40]},{id:"layout-15-70-15",distribution:[15,70,15]}],Ym={grid:{display:"grid",gridTemplateColumns:"repeat(3, minmax(0, 1fr))",gap:"16px",width:"100%"},card:{cursor:"pointer",border:"1px solid #e5e7eb",borderRadius:"8px",backgroundColor:"primary"},cardContent:{padding:"8px"},layoutPreview:{display:"grid",gap:"4px",height:"30px",width:"100%",minHeight:"30px"}};function hho(e){const t=e?.[0];return typeof t=="number"&&!Number.isNaN(t)?Math.min(99,Math.max(1,Math.round(t))):50}function IKe(e){let t=typeof e?.[0]=="number"?Math.round(e[0]):34,r=typeof e?.[1]=="number"?Math.round(e[1]):33;return t=Math.min(98,Math.max(1,t)),r=Math.min(98,Math.max(1,r)),t+r>=99&&(r=Math.max(1,99-t)),[t,r]}var BKe=({fractions:e,highlight:t})=>{const r=(0,G.useTheme)(),n=t?r.palette.secondary.main:"#e5e7eb";return(0,C.jsx)("div",{style:{...Ym.layoutPreview,gridTemplateColumns:e.map(a=>`${a}fr`).join(" ")},children:e.map((a,d)=>(0,C.jsx)("div",{style:{minWidth:0,backgroundColor:n,borderRadius:"4px",transition:"background-color 0.2s ease"}},d))})},z95=({defaultValue:e,fixedWidths:t,onChange:r,columns:n})=>{const{t:a}=Xt("inspector"),d=(0,G.useTheme)(),[p,h]=(0,ie.useState)(null),[f,m]=(0,ie.useState)(!1),[v,g]=(0,ie.useState)(()=>hho(t??void 0)),[A,y]=(0,ie.useState)(()=>IKe(t??void 0)[0]),[S,x]=(0,ie.useState)(()=>IKe(t??void 0)[1]),O=e??(n===2?"layout-50-50":"layout-33-33-33"),w=p??(O==="layout-33-34-33"?"layout-33-33-33":O),[E,L]=(0,ie.useState)(n===2?VKe:FKe),H=(Y,ee)=>{h(null),m(!1),r({layout:Y,fixedWidths:ee})},V=()=>{if(h(aee),m(!0),n===2)g(hho(t??void 0));else{const[Y,ee]=IKe(t??void 0);y(Y),x(ee)}},F=()=>{if(n===2){const Y=v;r({layout:aee,fixedWidths:[Y,100-Y,null]})}else{const Y=A,ee=S;r({layout:aee,fixedWidths:[Y,ee,100-Y-ee]})}h(null)};(0,ie.useEffect)(()=>{L(n===2?VKe:FKe)},[n]),(0,ie.useEffect)(()=>{h(null),m(!1)},[n,e]),(0,ie.useEffect)(()=>{const Y=e;n===2?Y!=="layout-custom"&&(Y==null||!VKe.some(ee=>ee.id===Y))&&r({layout:"layout-50-50",fixedWidths:[50,50,null]}):Y==="layout-33-34-33"?r({layout:"layout-33-33-33",fixedWidths:[33.34,33.33,33.33]}):Y!=="layout-custom"&&(Y==null||!FKe.some(ee=>ee.id===Y))&&r({layout:"layout-33-33-33",fixedWidths:[33.34,33.33,33.33]})},[n,e,r]);const U=(Y,ee)=>{const re=ee;y(re),x(oe=>Math.max(1,Math.min(oe,100-re-1)))},I=(Y,ee)=>{const re=ee,oe=100-A-1;x(Math.max(1,Math.min(re,oe)))},$=100-v,Q=100-A-S,K=w===aee;return(0,C.jsxs)(No,{children:[(0,C.jsx)(sn,{label:a("inputs.layout.label")}),(0,C.jsxs)("div",{style:Ym.grid,children:[E.map(Y=>(0,C.jsx)("div",{onClick:()=>H(Y.id,Y.distribution),style:{...Ym.card,border:w===Y.id?`2px solid ${d.palette.secondary.main}`:Ym.card.border},children:(0,C.jsx)("div",{style:Ym.cardContent,children:(0,C.jsx)(BKe,{fractions:Y.distribution.filter(ee=>ee!=null),highlight:w===Y.id})})},Y.id)),(0,C.jsx)("div",{onClick:V,style:{...Ym.card,border:K?`2px solid ${d.palette.secondary.main}`:Ym.card.border},role:"button",tabIndex:0,onKeyDown:Y=>{(Y.key==="Enter"||Y.key===" ")&&(Y.preventDefault(),V())},children:(0,C.jsx)("div",{style:Ym.cardContent,children:(0,C.jsx)(G.Box,{sx:{width:"100%",height:30,minHeight:30,border:"1px dashed",borderColor:"divider",borderRadius:1,display:"flex",alignItems:"center",justifyContent:"center",bgcolor:K?"action.selected":"action.hover",color:"text.primary",transition:d.transitions.create(["background-color"],{duration:d.transitions.duration.shorter})},children:(0,C.jsx)(qe.EditOutlined,{sx:{fontSize:18,color:"text.primary"}})})})})]}),(0,C.jsx)(G.Collapse,{in:f,timeout:"auto",unmountOnExit:!0,children:(0,C.jsxs)(G.Box,{sx:{mt:2,p:2,borderRadius:1,border:1,borderColor:"divider",bgcolor:"background.paper"},children:[n===2?(0,C.jsxs)(G.Stack,{spacing:2,sx:{mt:1},children:[(0,C.jsxs)(G.Typography,{variant:"body2",color:"text.secondary",children:[v,"% | ",$,"%"]}),(0,C.jsx)(G.Slider,{value:v,min:1,max:99,step:1,valueLabelDisplay:"auto","aria-label":a("inputs.layout.custom.split2"),onChange:(Y,ee)=>g(ee)}),(0,C.jsx)(BKe,{fractions:[v,$],highlight:!0})]}):(0,C.jsxs)(G.Stack,{spacing:2,sx:{mt:1},children:[(0,C.jsxs)(G.Typography,{variant:"body2",color:"text.secondary",children:[A,"% | ",S,"% | ",Q,"%"]}),(0,C.jsxs)(G.Box,{children:[(0,C.jsx)(G.Typography,{variant:"caption",color:"text.secondary",component:"div",children:a("inputs.layout.custom.firstColumn")}),(0,C.jsx)(G.Slider,{value:A,min:1,max:98,step:1,valueLabelDisplay:"auto",onChange:U})]}),(0,C.jsxs)(G.Box,{children:[(0,C.jsx)(G.Typography,{variant:"caption",color:"text.secondary",component:"div",children:a("inputs.layout.custom.secondColumn")}),(0,C.jsx)(G.Slider,{value:S,min:1,max:100-A-1,step:1,valueLabelDisplay:"auto",onChange:I})]}),(0,C.jsx)(BKe,{fractions:[A,S,Q],highlight:!0})]}),(0,C.jsx)(G.Button,{variant:"contained",size:"small",sx:{mt:2},onClick:F,children:(0,C.jsx)(G.Typography,{variant:"button",component:"span",sx:{color:"#FFFFFF",fontWeight:"bold"},children:a("inputs.layout.custom.apply")})})]})})]})};function P95({label:e,tooltipTitle:t,hideWarning:r}){return(0,C.jsxs)(G.Box,{sx:{display:"flex",alignItems:"center",gap:.5,flexWrap:"wrap"},children:[(0,C.jsx)(sn,{label:e}),!r&&(0,C.jsx)(G.Tooltip,{title:t,placement:"top",children:(0,C.jsx)(G.IconButton,{size:"small",color:"warning",disableRipple:!0,sx:{p:0,cursor:"help",lineHeight:0,"&:hover":{backgroundColor:"transparent"}},children:(0,C.jsx)(oho,{"aria-hidden":!0})})})]})}dr(),Lr();var fho=(e=>(0,C.jsx)(G.SvgIcon,{...e,viewBox:"0 0 24 24",children:(0,C.jsxs)("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[(0,C.jsx)("path",{d:"M10.5 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v5.5m-6.7 9.1l1-.4M15 3v7.5m.2 6.4l-.9-.3m2.3 5.1l.3-.9m-.1-5.5l-.4-1m2.7.9l.3-.9m.2 7.4l-.4-1m1.5-3.9l1-.4m0 3l-.9-.3M9 3v18"}),(0,C.jsx)("circle",{cx:"18",cy:"18",r:"3"})]})}));fho.muiName="ColumnsCountIcon";function E95({data:e,setData:t}){const[,r]=(0,ie.useState)(null),[n,a]=(0,ie.useState)(e.props?.columnsCount??2),d=X6(),p=ll(),h=fd(),{t:f}=Xt("inspector"),m=S=>{const x=Ke.getState().document,O=S.filter(w=>x[w]?.type==="Image");p==="desktop"&&O.forEach(w=>{const E=x[w];if(E?.type!=="Image")return;const L=E.data;w95(w,H=>{bz(w,V=>V.type!=="Image"?V:{...V,data:H})},L)})},v=S=>{const x=MKe.safeParse(S);x.success?(x.data.props.columns.map(O=>m(O.childrenIds)),t(x.data),n&&x.data.props?.columnsCount!==n&&a(x.data.props?.columnsCount??2),r(null)):(console.error("Error on columns: ",x.error),r(x.error))},g={layout:"layout-50-50",fixedWidths:[50,50,null],columnsCount:2},A={layout:"layout-33-34-33",fixedWidths:[33,34,33],columnsCount:3},y=S=>{const x=e.props.columns.length===2?[...e.props.columns,{childrenIds:[]}]:[...e.props.columns];return S==="2"?{...g,columns:x}:{...A,columns:x}};return(0,C.jsxs)(Qm,{title:f("inputs.panels.columns.title"),children:[(d=="block-configuration"||h)&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h1,{icon:fho,label:f("inputs.panels.columns.countLabel"),children:(0,C.jsxs)(No,{children:[(0,C.jsx)(sn,{label:f("inputs.panels.columns.countLabel")}),(0,C.jsx)(G.Box,{sx:{...GBe,paddingLeft:0,paddingRight:0,height:"auto",minHeight:"36px"},children:(0,C.jsx)(pho,{value:e.props?.columnsCount===2?"2":"3",onChange:S=>{const x=y(S);v({...e,props:{...e.props,...x}})},options:[{value:"2",label:"2",icon:(0,C.jsx)(qe.SplitscreenOutlined,{fontSize:"small"})},{value:"3",label:"3",icon:(0,C.jsx)(qe.ViewWeekOutlined,{fontSize:"small"})}]})})]})}),(0,C.jsx)(h1,{icon:qe.TableChartOutlined,label:f("inputs.panels.columns.layoutLabel","Layout"),children:(0,C.jsx)(z95,{columns:e.props?.columnsCount??3,defaultValue:e.props?.layout,fixedWidths:e.props?.fixedWidths??void 0,onChange:({layout:S,fixedWidths:x})=>{const O=e.props.columns.length===2?[...e.props.columns,{childrenIds:[]}]:e.props.columns;v({...e,props:{...e.props,layout:S,fixedWidths:x,columns:O}})}})})]}),(d=="css"||h)&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(xz,{}),(0,C.jsx)(h1,{icon:qe.PhoneIphoneOutlined,label:f("inputs.panels.columns.stackColumnsOnMobile"),children:(0,C.jsxs)(No,{children:[(0,C.jsx)(P95,{label:f("inputs.panels.columns.stackColumnsOnMobile"),tooltipTitle:f("inputs.panels.columns.stackColumnsOnMobileWarning")}),(0,C.jsx)(G.Box,{sx:{width:"100%",...GBe,paddingLeft:0,paddingRight:0,height:"auto",minHeight:"36px"},children:(0,C.jsx)(pho,{value:e.props?.stackColumnsOnMobile?"stacked":"sideBySide",onChange:S=>{v({...e,props:{...e.props,stackColumnsOnMobile:S==="stacked"}})},options:[{value:"sideBySide",label:f("inputs.panels.columns.stackToggleSideBySide"),icon:(0,C.jsx)(qe.ViewColumnOutlined,{fontSize:"small"})},{value:"stacked",label:f("inputs.panels.columns.stackToggleStacked"),icon:(0,C.jsx)(qe.TableRowsOutlined,{fontSize:"small"})}]})})]})}),(0,C.jsx)(h1,{icon:qe.AlignVerticalCenterOutlined,label:f("inputs.alignment.label"),children:(0,C.jsx)(R95,{data:e,updateData:t})}),(0,C.jsx)(eu,{names:["backgroundColor","background","padding","mobilePadding"],value:e.style,onChange:S=>v({...e,style:S})})]})]})}dr();function mho({data:e,setData:t}){const[,r]=(0,ie.useState)(null),{t:n}=Xt("inspector"),a=d=>{const p=Ypo.safeParse(d);p.success?(t(p.data),r(null)):r(p.error)};return(0,C.jsx)(Qm,{title:n("inputs.panels.container.title"),children:(0,C.jsx)(eu,{names:["backgroundColor","background","border","borderMobile","shape","padding","mobilePadding"],value:e.style,shapeSteps:30,onChange:d=>a({...e,style:d})})})}dr(),vNe();function vho({data:e,setData:t}){const[,r]=(0,ie.useState)(null),{t:n}=Xt("inspector"),a=d=>{const p=PT.safeParse(d);p.success?(t(p.data),r(null)):r(p.error)};return(0,C.jsx)(Qm,{title:n("inputs.panels.divider.title"),children:(0,C.jsx)(eu,{names:["width","widthMobile","height","heightMobile","color","backgroundColor","textAlign","textAlignMobile","padding","mobilePadding"],value:e.style,onChange:d=>a({...e,style:d})})})}dr();var k95=({label:e,linkColor:t,underline:r=!1,onChange:n})=>{const[a,d]=(0,ie.useState)(t??"#FF0000"),[p,h]=(0,ie.useState)(r),{t:f}=Xt("inspector"),m=e??f("inputs.links.color"),v=p?"enabled":"disabled",g={container:{width:"100%"}};(0,ie.useEffect)(()=>{t!==a&&d(t??"#FF0000")},[t]),(0,ie.useEffect)(()=>{r!==p&&h(r)},[r]);const A=S=>{const x=S??"#FF0000";d(x),n({linkColor:x,underline:p})},y=(S,x)=>{if(!x)return;const O=x==="enabled";h(O),n({linkColor:a,underline:O})};return(0,C.jsxs)(No,{children:[(0,C.jsx)(d8,{label:m,defaultValue:a,onChange:A}),(0,C.jsx)(sn,{label:f("inputs.links.underline")}),(0,C.jsx)(G.Box,{sx:g.container,children:(0,C.jsxs)(G.ToggleButtonGroup,{value:v,exclusive:!0,fullWidth:!0,onChange:y,sx:{width:"100%"},children:[(0,C.jsx)(G.ToggleButton,{value:"enabled",children:(0,C.jsx)(G.Tooltip,{title:f("inputs.links.underlineOn"),children:(0,C.jsx)(G.Box,{component:"span",sx:{display:"inline-flex",alignItems:"center",justifyContent:"center"},children:(0,C.jsx)(qe.FormatUnderlined,{fontSize:"small"})})})}),(0,C.jsx)(G.ToggleButton,{value:"disabled",children:(0,C.jsx)(G.Tooltip,{title:f("inputs.links.underlineOff"),children:(0,C.jsx)(G.Box,{component:"span",sx:{display:"inline-flex",alignItems:"center",justifyContent:"center"},children:(0,C.jsx)(qe.FormatClear,{fontSize:"small"})})})})]})})]})};dr(),hA();function _ho({data:e,setData:t}){const[,r]=(0,ie.useState)(null),{t:n}=Xt("inspector"),a=d=>{const p=Kpo.safeParse(d);p.success?(t(p.data),r(null)):r(p.error)};return(0,C.jsxs)(G.Stack,{spacing:1,children:[(0,C.jsx)(h1,{icon:Tz,label:n("inputs.panels.emailLayout.backgroundColor"),children:(0,C.jsx)(d8,{label:n("inputs.panels.emailLayout.backgroundColor"),defaultValue:e.backdropColor??"#F5F5F5",onChange:d=>a({...e,backdropColor:d})})}),(0,C.jsx)(h1,{icon:qe.CropSquareOutlined,label:n("inputs.panels.emailLayout.canvasColor"),children:(0,C.jsx)(d8,{label:n("inputs.panels.emailLayout.canvasColor"),defaultValue:e.canvasColor??"#FFFFFF",onChange:d=>a({...e,canvasColor:d})})}),(0,C.jsx)(h1,{icon:tee,label:n("inputs.panels.emailLayout.fontFamily"),children:(0,C.jsx)(kKe,{label:n("inputs.panels.emailLayout.fontFamily"),defaultValue:e.fontFamily||cNe.FAMILY,onChange:d=>a({...e,fontFamily:d})})}),(0,C.jsx)(h1,{icon:ree,label:n("inputs.panels.emailLayout.textColor"),children:(0,C.jsx)(d8,{label:n("inputs.panels.emailLayout.textColor"),defaultValue:e.textColor??"#262626",onChange:d=>a({...e,textColor:d})})}),(0,C.jsx)(h1,{icon:qe.LinkOutlined,label:n("inputs.panels.emailLayout.linksLabel"),children:(0,C.jsx)(k95,{label:n("inputs.panels.emailLayout.linksLabel"),linkColor:e.linkGlobal?.linkColor||"#000000",underline:e.linkGlobal?.underline||!1,onChange:d=>a({...e,linkGlobal:d})})})]})}hh(),Lr();var H95=(e,t,r)=>{const n=ll();(0,ie.useEffect)(()=>{const a=()=>{if(!e||!document||n=="mobile")return;const h=q1(e),f=document.querySelector(`.${h}`);if(!f)return;const m=f.parentElement;if(!m)return;const v=Math.ceil(m.getBoundingClientRect().width);r.props?.size===void 0||r.props?.size==="original"||r.props?.touched&&r.props?.width<=v||r.props?.width!==v&&!r.props?.touched&&t({...r,props:{...r.props,width:v}})};a();const d=new ResizeObserver(a),p=document.querySelector(`.${q1(e)}`);return p?.parentElement&&d.observe(p.parentElement),()=>{d.disconnect()}},[e,t,r,n])};dr(),Tq(),Lr();var L95=({data:e,setData:t,blockId:r})=>{const{t:n}=Xt("inspector"),[a,d]=(0,ie.useState)(!1),[p,h]=(0,ie.useState)(()=>!!window.__emailBuilderEnableAI),[,f]=(0,ie.useState)(null),[m,v]=(0,ie.useState)(""),[g,A]=(0,ie.useState)(!1),[y,S]=(0,ie.useState)(""),[x,O]=(0,ie.useState)(!1),w=(0,ie.useRef)(null),[E,L]=(0,ie.useState)(null),H=tBo(),V=nBo(),F=H||V,[U,I]=(0,ie.useState)(()=>!!window.__emailBuilderUnsplashEnabled);(0,ie.useEffect)(()=>{const pe=()=>{I(!!window.__emailBuilderUnsplashEnabled)};return pe(),window.addEventListener("email-builder-unsplash-updated",pe),()=>window.removeEventListener("email-builder-unsplash-updated",pe)},[]),(0,ie.useEffect)(()=>{const pe=window.__emailBuilderCustomImageProvider;pe&&(L(pe),setTimeout(()=>{r&&window.dispatchEvent(new CustomEvent("email-builder-image-panel-opened",{detail:{blockId:r,currentImageUrl:e.props?.url||null,alt:e.props?.alt||null}}))},100))},[]);const $=pe=>{const Z=h_.safeParse(pe);Z.success?(t(Z.data),f(null)):f(Z.error)},Q=(pe,Z)=>{const be=pe.toLowerCase(),ve=be.includes(".svg")||be.includes("svg"),ge=Z&&(Z.includes("image/svg+xml")||Z.includes("svg"));return ve||!!ge},K=async pe=>{try{A(!0),S(""),O(!1);try{new URL(pe)}catch{return S(n("inputs.image.invalidUrl")),!1}const Z=new AbortController,be=setTimeout(()=>Z.abort(),1e4);try{const ve=await fetch(pe,{method:"HEAD",signal:Z.signal});if(clearTimeout(be),!ve.ok)return S(n("inputs.image.httpError",{status:ve.status,statusText:ve.statusText})),!1;const ge=ve.headers.get("content-type");return["image/","image/svg+xml","text/xml","application/xml"].some(_e=>ge&&ge.toLowerCase().includes(_e.toLowerCase()))?(Q(pe,ge)&&O(!0),S(""),!0):(S(n("inputs.image.notImage")),!1)}catch(ve){return clearTimeout(be),ve.name==="AbortError"?(S(n("inputs.image.timeout")),!1):new Promise(ge=>{const _e=new Image,je=setTimeout(()=>{S(n("inputs.image.timeout")),ge(!1)},1e4);_e.onload=()=>{clearTimeout(je),Q(pe)&&O(!0),S(""),ge(!0)},_e.onerror=()=>{clearTimeout(je),S(n("inputs.image.loadError")),ge(!1)},_e.src=pe})}}catch{return S(n("inputs.image.unexpectedError")),!1}finally{A(!1)}},Y=async()=>{m.trim()&&await K(m.trim())&&($({...e,props:{...e.props,url:m.trim()}}),r&&cy(r),v(""))},ee=pe=>{pe.key==="Enter"&&Y()},re=pe=>{v(pe.target.value),y&&S(""),x&&O(!1)},oe=pe=>{const Z=["image/png","image/jpeg","image/gif"],ve=pe.filter(_e=>Z.includes(_e.type)&&_e.size<=5242880);if(ve.length!==pe.length&&alert(n("inputs.common.invalidFiles")),ve.length===0)return;const ge=ve.map(_e=>new Promise(je=>{const Fe=new FileReader;Fe.onload=Me=>je(Me.target?.result),Fe.readAsDataURL(_e)}));Promise.all(ge).then(_e=>{const je={images:_e,id:r||""};window.dispatchEvent(new CustomEvent("email-builder-upload-image",{detail:je})),yg(!0,r||"")})},le=pe=>{pe.preventDefault(),d(!0)},X=pe=>{const Z=pe.currentTarget.getBoundingClientRect(),be=pe.clientX,ve=pe.clientY;(be<Z.left||be>=Z.right||ve<Z.top||ve>=Z.bottom)&&d(!1)},se=pe=>{pe.preventDefault(),d(!1);const Z=Array.from(pe.dataTransfer.files);Z.length>0&&oe(Z)},Ae=()=>{const pe=new CustomEvent("toggle-media-library",{detail:!0});window.dispatchEvent(pe)};(0,ie.useEffect)(()=>{const pe=window.__emailBuilderEnableAI;pe!==void 0&&h(!!pe);const Z=be=>{const{detail:ve}=be;h(!!ve)};return window.addEventListener("email-builder-ai-generation",Z),()=>{window.removeEventListener("email-builder-ai-generation",Z)}},[]),(0,ie.useEffect)(()=>{const pe=ge=>{const{detail:_e}=ge;yg(!1,_e.id||""),r&&(Az(r,{url:_e.url}),cy(r)),eSt(!1)},Z=ge=>{yg(ge?.detail?.uploading??!1,ge?.detail?.id??"")},be=()=>{w?.current?.click()},ve=ge=>{if(!r)return;const _e=ge.detail;if(typeof _e=="string"){Az(r,{url:_e}),cy(r);return}if(_e&&typeof _e=="object"&&typeof _e.url=="string"){const je={url:_e.url};typeof _e.alt=="string"&&(je.alt=_e.alt),Az(r,je)}};return window.addEventListener("email-builder-set-image",ve),window.addEventListener("email-builder-upload-image-receive",pe),window.addEventListener("email-builder-upload-file",be),window.addEventListener("email-builder-toggle-upload-file",Z),()=>{window.removeEventListener("email-builder-toggle-upload-file",Z),window.removeEventListener("email-builder-upload-image-receive",pe),window.removeEventListener("email-builder-set-image",ve),window.removeEventListener("email-builder-upload-file",be)}},[r]),(0,ie.useEffect)(()=>{e.props?.url&&O(Q(e.props.url))},[e.props?.url]);const ze=()=>(0,C.jsxs)(G.Stack,{spacing:1,children:[(0,C.jsx)(No,{children:H&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(sn,{label:n("inputs.image.urlLabel")}),(0,C.jsxs)(G.Stack,{direction:"row",spacing:1,children:[(0,C.jsx)(G.TextField,{fullWidth:!0,placeholder:n("inputs.image.urlPlaceholder"),value:m,onChange:re,onKeyPress:ee,error:!!y,disabled:g,sx:g5}),(0,C.jsx)(G.Button,{variant:"contained",onClick:Y,disabled:!m.trim()||g,sx:{minWidth:"auto",px:2},children:g?(0,C.jsx)(G.CircularProgress,{size:20,color:"inherit"}):n("inputs.common.add")})]}),y&&(0,C.jsx)(G.Alert,{severity:"error",sx:{mt:1,fontSize:"0.875rem"},children:y}),x&&(0,C.jsx)(G.Alert,{severity:"warning",sx:{mt:1,fontSize:"0.875rem"},action:(0,C.jsx)(G.IconButton,{"aria-label":n("inputs.common.close"),color:"inherit",size:"small",onClick:()=>O(!1),children:(0,C.jsx)(qe.Close,{fontSize:"inherit"})}),children:n("inputs.common.svgWarning")})]})}),H&&V&&(0,C.jsxs)(G.Stack,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[(0,C.jsx)(G.Divider,{sx:{flexGrow:1}}),(0,C.jsx)(G.Typography,{variant:"caption",sx:{color:"text.secondary"},children:n("inputs.backgroundImage.or")}),(0,C.jsx)(G.Divider,{sx:{flexGrow:1}})]}),V&&(0,C.jsxs)(G.Box,{onDragOver:le,onDragLeave:X,onDrop:se,sx:{width:"100%",border:"2px dashed",borderColor:a?"primary.main":"divider",borderRadius:"8px",padding:3,textAlign:"center",bgcolor:a?"action.hover":"background.paper",transition:"all 0.2s ease"},children:[(0,C.jsx)(G.Box,{sx:{display:"flex",justifyContent:"center",mb:1},children:(0,C.jsx)(qe.PhotoOutlined,{sx:{fontSize:28,color:"primary.main"}})}),(0,C.jsxs)("label",{style:{cursor:"pointer"},children:[(0,C.jsx)("input",{ref:w,type:"file",style:{display:"none"},accept:"image/png,image/jpeg,image/gif",multiple:!0,onChange:pe=>{const Z=pe.target.files;Z&&Z.length>0&&oe(Array.from(Z))}}),(0,C.jsx)(G.Typography,{component:"span",sx:{fontWeight:600,color:"primary.main"},children:n("inputs.common.uploadFile")}),(0,C.jsxs)(G.Typography,{component:"span",sx:{fontWeight:500,color:"text.secondary"},children:[" ",n("inputs.common.dragAndDrop")]})]}),(0,C.jsx)(G.Typography,{variant:"caption",sx:{color:"text.secondary",mt:1,display:"block"},children:n("inputs.common.fileInfo")})]}),!E&&JIo()&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(G.Stack,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[(0,C.jsx)(G.Divider,{sx:{flexGrow:1}}),(0,C.jsx)(G.Typography,{variant:"caption",sx:{color:"text.secondary"},children:n("inputs.backgroundImage.or")}),(0,C.jsx)(G.Divider,{sx:{flexGrow:1}})]}),(0,C.jsx)(G.Button,{variant:"outlined",onClick:Ae,startIcon:(0,C.jsx)(qe.ImageSearchOutlined,{}),fullWidth:!0,children:n("inputs.backgroundImage.browseGallery")})]})]});return(0,C.jsxs)(G.Stack,{spacing:1,children:[(0,C.jsx)(aho,{imageUrl:e.props?.url??null,alt:e.props?.alt??"",blockId:r,onRemove:()=>{r&&(Az(r,{url:null}),cy(r)),$({...e,props:{...e.props??{},url:null}})}}),(0,C.jsx)(Xpo,{tabs:[{key:"gallery",label:n("inputs.tabs.gallery"),visible:U,render:()=>(0,C.jsx)(rho,{blockId:r,source:"image"})},{key:"yourGallery",label:n("inputs.tabs.yourGallery"),visible:!!E,render:()=>(0,C.jsx)(G.Box,{children:E})},{key:"upload",label:n("inputs.tabs.upload"),visible:F,render:ze},{key:"generate",label:n("inputs.tabs.generate"),visible:p,render:()=>(0,C.jsx)(G.Box,{sx:{py:1},children:(0,C.jsx)(nho,{src:e.props?.url,style:{width:"100%",margin:0}})})}],defaultTab:"upload"})]})};dr();var D95=({defaultValue:e="original",scale:t=100,onChange:r})=>{const[n,a]=(0,ie.useState)(e),[d,p]=(0,ie.useState)(t),h=(0,G.useTheme)(),{t:f}=Xt("inspector"),m={container:{width:"100%"},label:{marginBottom:"8px",fontSize:"14px",fontWeight:500,color:h.palette.text.primary},sliderContainer:{marginTop:"16px",padding:"0 8px"},slider:{"& .MuiSlider-thumb":{width:12,height:12,backgroundColor:h.palette.primary.main,"&:hover":{boxShadow:`0 0 0 8px ${h.palette.primary.main}20`}},"& .MuiSlider-rail":{height:4,backgroundColor:h.palette.grey[300]},"& .MuiSlider-track":{height:4,backgroundColor:h.palette.primary.main}},scaleValue:{marginTop:"4px",textAlign:"right",fontSize:"14px",color:h.palette.text.secondary}};(0,ie.useEffect)(()=>{(e!==n||t!==d)&&(e!==n&&a(e),e==="scale"&&p(t))},[e,t]);const v=(A,y)=>{y!==null&&(a(y),r&&r({mode:y,scale:y==="scale"?d:void 0}))},g=A=>{p(A),r&&r({mode:n,scale:A})};return(0,C.jsxs)(No,{children:[(0,C.jsx)(sn,{label:f("inputs.sizeSelector.label")}),(0,C.jsxs)(G.Box,{sx:m.container,children:[(0,C.jsxs)(G.ToggleButtonGroup,{value:n,exclusive:!0,onChange:v,sx:{width:"100%"},children:[(0,C.jsx)(G.ToggleButton,{value:"original",children:(0,C.jsxs)(G.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[(0,C.jsx)(qe.FitScreen,{fontSize:"small"}),(0,C.jsx)("span",{children:f("inputs.sizeSelector.contain")})]})}),(0,C.jsx)(G.ToggleButton,{value:"fill",children:(0,C.jsxs)(G.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[(0,C.jsx)(qe.Crop,{fontSize:"small"}),(0,C.jsx)("span",{children:f("inputs.sizeSelector.cover")})]})}),(0,C.jsx)(G.ToggleButton,{value:"scale",children:(0,C.jsxs)(G.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[(0,C.jsx)(qe.Percent,{fontSize:"small"}),(0,C.jsx)("span",{children:f("inputs.sizeSelector.scale")})]})})]}),(0,C.jsx)(G.Collapse,{in:n==="scale",children:(0,C.jsx)(G.Box,{sx:m.sliderContainer,children:(0,C.jsx)(Di,{iconLabel:(0,C.jsx)(qe.WidthWideOutlined,{}),value:d,setValue:g,marks:!1,units:"%",min:1,max:100})})})]})]})};dr(),Tq(),v5(),Lr();var gho={cover:(0,C.jsx)(qe.Crop,{fontSize:"small"}),contain:(0,C.jsx)(qe.FitScreen,{fontSize:"small"}),fill:(0,C.jsx)(qe.AspectRatio,{fontSize:"small"})},bho=e=>e==="cover"||e==="contain"||e==="fill"?gho[e]:gho.cover,Aho=e=>e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1);function V95({data:e,setData:t}){const[r,n]=(0,ie.useState)(null),a=iO(),d=X6(),p=ll(),h=fd(),{t:f}=Xt("inspector");H95(a||"",t,e),ie.useEffect(()=>{a&&window.dispatchEvent(new CustomEvent("email-builder-image-panel-opened",{detail:{blockId:a,currentImageUrl:e.props?.url||null,alt:e.props?.alt||null,source:"image"}}))},[a,e.props?.url,e.props?.alt]);const m=(0,ie.useCallback)(H=>{const V=h_.safeParse(H);V.success?JSON.stringify(e)!==JSON.stringify(V.data)&&(t(V.data),n(null)):n(V.error)},[e,t]),v=(0,ie.useCallback)((H,V,F)=>{const U=j95(a)||600,I={...H.props};if(F&&(I.touchedMobile=!0),V.mode==="original"){const $=H.props?.original_width??null;return F?{...I,sizeMobile:V.mode,widthMobile:$}:{...I,size:V.mode,width:$,sizeMobile:I.touchedMobile?I.sizeMobile:V.mode,widthMobile:I.touchedMobile?I.widthMobile:$}}if(V.mode==="fill")return F?{...I,sizeMobile:V.mode,widthMobile:null}:{...I,size:V.mode,width:null,sizeMobile:I.touchedMobile?I.sizeMobile:V.mode,widthMobile:I.touchedMobile?I.widthMobile:null};if(V.mode==="scale"){const $=Math.ceil(U/100*V.scale);return F?{...I,sizeMobile:V.mode,scaleMobile:V.scale,widthMobile:$}:{...I,size:V.mode,scale:V.scale,width:$,sizeMobile:I.touchedMobile?I.sizeMobile:V.mode,scaleMobile:I.touchedMobile?I.scaleMobile:V.scale,widthMobile:I.touchedMobile?I.widthMobile:$}}return I},[a]),g=(0,ie.useCallback)((H,V)=>{const F=v(e,H,V);m({...e,props:F})},[e,m,v]),A=(0,ie.useMemo)(()=>p!=="desktop"?{size:e.props?.touchedMobile?e.props?.sizeMobile:e.props?.size??"original",scale:e.props?.touchedMobile?e.props?.scaleMobile:e.props?.scale}:{size:e.props?.size??"original",scale:e.props?.scale},[p,e.props?.touchedMobile,e.props?.sizeMobile,e.props?.size,e.props?.scaleMobile,e.props?.scale]),y=(0,ie.useCallback)(H=>{m({...e,props:{...e.props,alt:H}})},[e,m]),S=(0,ie.useCallback)(H=>{const V=H.trim().length===0?null:H.trim();m({...e,props:{...e.props,linkHref:V}})},[e,m]),x=(0,ie.useCallback)(H=>{m({...e,style:H})},[e,m]),O=(0,ie.useMemo)(()=>p!=="desktop"?e.style?.heightMobile??e.style?.height??void 0:e.style?.height??void 0,[p,e.style?.height,e.style?.heightMobile]),w=(0,ie.useCallback)(H=>{const V=p!=="desktop",F={...e.style??{}};V?F.heightMobile=H:F.height=H,m({...e,style:F})},[e,m,p]),E=(0,ie.useCallback)(H=>{const V=p!=="desktop",F={...e.style??{}};V?F.objectFitMobile=H:F.objectFit=H,m({...e,style:F})},[e,m,p]),L=(0,ie.useCallback)(H=>{const V=p!=="desktop",F={...e.style??{}};V?F.objectPositionMobile=H:F.objectPosition=H,m({...e,style:F})},[e,m,p]);return(0,C.jsxs)(Qm,{title:f("inputs.panels.image.title"),children:[(d==="block-configuration"||h)&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h1,{icon:qe.WallpaperOutlined,label:f("inputs.panels.image.title"),children:(0,C.jsx)(L95,{data:e,setData:t,blockId:a})}),(0,C.jsx)(h1,{icon:qe.DescriptionOutlined,label:f("inputs.panels.image.altLabel"),children:(0,C.jsx)(nee,{label:f("inputs.panels.image.altLabel"),placeholder:f("inputs.panels.image.altPlaceholder"),defaultValue:e.props?.alt??"",onChange:y})}),(0,C.jsx)(h1,{icon:qe.LinkOutlined,label:f("inputs.panels.image.urlLabel"),children:(0,C.jsx)(nee,{label:f("inputs.panels.image.urlLabel"),placeholder:f("inputs.panels.image.urlPlaceholder"),defaultValue:e.props?.linkHref??"",onChange:S})}),(0,C.jsx)(h1,{icon:qe.AspectRatio,label:f("inputs.panels.image.sizeLabel","Size"),children:(0,C.jsx)(D95,{defaultValue:A.size,scale:A.scale??void 0,onChange:H=>g(H,p!=="desktop")})}),(0,C.jsx)(h1,{icon:qe.HeightOutlined,label:f("inputs.panels.image.heightLabel"),children:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(HKe,{label:f("inputs.panels.image.heightLabel"),defaultValue:O??void 0,min:0,max:800,step:4,onChange:H=>w(H>0?H:null)}),O?(0,C.jsxs)(G.Stack,{direction:"row",spacing:2,sx:{mt:1},children:[(0,C.jsxs)("div",{style:{flex:1,minWidth:0},children:[(0,C.jsx)(sn,{label:f("inputs.panels.image.objectFitLabel")}),(0,C.jsx)(Qu,{style:{width:"100%"},size:"small",value:p==="desktop"?e.style?.objectFit??"cover":e.style?.objectFitMobile??e.style?.objectFit??"cover",onChange:H=>E(H.target.value),renderValue:H=>{const V=String(H??"cover");return(0,C.jsxs)(G.Box,{sx:{display:"flex",alignItems:"center",gap:1,paddingRight:"1rem"},children:[bho(V),f(`inputs.panels.image.objectFit${Aho(V)}`)]})},children:["cover","contain","fill"].map(H=>(0,C.jsx)(G.MenuItem,{value:H,sx:{padding:"0.5rem 1rem 0.5rem 0.5rem!important"},children:(0,C.jsxs)(G.Box,{sx:{display:"flex",alignItems:"center",gap:1},children:[bho(H),f(`inputs.panels.image.objectFit${Aho(H)}`)]})},H))})]}),(()=>{const H=p==="desktop"?e.style?.objectFit??"cover":e.style?.objectFitMobile??e.style?.objectFit??"cover",V=p==="desktop"?e.style?.objectPosition??"center":e.style?.objectPositionMobile??e.style?.objectPosition??"center";return H==="fill"?null:(0,C.jsxs)("div",{style:{flex:1,minWidth:0},children:[(0,C.jsx)(sn,{label:f("inputs.panels.image.objectPositionLabel")}),(0,C.jsx)(Qu,{style:{width:"100%"},size:"small",value:V,onChange:F=>L(String(F.target.value)),renderValue:F=>{const U=String(F??"center");return(0,C.jsxs)(G.Box,{sx:{display:"flex",alignItems:"center",gap:1,paddingRight:"1rem"},children:[qX(U),f(`inputs.backgroundImage.positions.${JX(U)}`)]})},children:l95.map(F=>(0,C.jsx)(G.MenuItem,{value:F,sx:{padding:"0.5rem 1rem 0.5rem 0.5rem!important"},children:(0,C.jsxs)(G.Box,{sx:{display:"flex",alignItems:"center",gap:1},children:[qX(F),f(`inputs.backgroundImage.positions.${JX(F)}`)]})},F))})]})})()]}):null]})})]}),(0,C.jsx)(xz,{}),(0,C.jsx)(eu,{names:["textAlign","textAlignMobile","backgroundColor","shape","padding","mobilePadding"],value:e.style,shapeMaxValue:300,shapeSteps:20,onChange:x})]})}dr(),Lr();function F95({data:e,setData:t}){const r=X6(),n=fd(),{t:a}=Xt("inspector"),d=e.style||{},p=h=>{const f={...d||{},...h||{}};t({...e,style:f})};return(0,C.jsxs)(Qm,{title:a("inputs.panels.notionText.title","Text"),children:[(r==="block-configuration"||n)&&(0,C.jsxs)(C.Fragment,{children:[n?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(eu,{disabledCSSValidation:!0,names:["fontFamily"],value:d,onChange:p}),(0,C.jsx)(eu,{disabledCSSValidation:!0,names:["lineHeight"],value:d,onChange:p})]}):(0,C.jsxs)("div",{style:{display:"flex",gap:"8px"},children:[(0,C.jsx)("div",{style:{flex:1},children:(0,C.jsx)(eu,{disabledCSSValidation:!0,names:["fontFamily"],value:d,onChange:p})}),(0,C.jsx)("div",{style:{flex:1},children:(0,C.jsx)(eu,{disabledCSSValidation:!0,names:["lineHeight"],value:d,onChange:p})})]}),(0,C.jsx)(eu,{disabledCSSValidation:!0,names:["fontSize","fontSizeMobile"],value:d,onChange:p})]}),(r==="css"||n)&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(xz,{}),(0,C.jsx)(eu,{names:["backgroundColor","border","borderMobile","padding","mobilePadding"],value:d,onChange:p})]})]})}dr();var I95=({element:e,index:t,moveItem:r,onSelectChange:n,onUrlChange:a,onRemove:d,onDuplicate:p,canRemove:h,theme:f})=>{const m=(0,ie.useRef)(null),[v,g]=(0,ie.useState)(null),{t:A}=Xt("inspector"),y=$=>{const Q=$.getClientOffset(),K=m.current?.getBoundingClientRect();if(!Q||!K)return null;const Y=(K.bottom-K.top)/2;return Q.y-K.top<Y?"up":"down"},[{handlerId:S,isOver:x},O]=GE(()=>({accept:"social-media-item",collect($){return{handlerId:$.getHandlerId(),isOver:$.isOver({shallow:!0})}},hover($,Q){if(!m.current)return;if($.index===t){g(null);return}if(!Q.isOver({shallow:!0})){g(null);return}const K=y(Q);g(K)},drop($,Q){if(g(null),!m.current)return;const K=$.index,Y=t;if(K===Y)return;const ee=y(Q);let re=Y;ee==="down"&&(re=Y+1),K<re&&(re=re-1),setTimeout(()=>{r(K,re)},0),$.index=re},end:()=>{g(null)}}),[e.id,t,r]),[{isDragging:w},E]=X9(()=>({type:"social-media-item",item:()=>({id:e.id,index:t}),collect:$=>({isDragging:$.isDragging()}),end:()=>{g(null)}}),[e.id,t]);(0,ie.useEffect)(()=>{x||g(null)},[x]);const L=w?.4:1;(0,ie.useEffect)(()=>{if(m.current&&E&&O){const $=m.current;E($),O($)}},[E,O]);const H=()=>{setTimeout(()=>d(t),0)},V=()=>{setTimeout(()=>p(t),0)},F=$=>{const Q=$.target.value;setTimeout(()=>n(t,Q,e),0)},U=$=>{const Q=$.target.value;setTimeout(()=>a(t,Q,e),0)},I=()=>(0,C.jsxs)("div",{style:{height:"3px",background:f.palette.secondary.main,position:"relative",color:f.palette.secondary.main,margin:"4px 0"},children:[(0,C.jsx)("svg",{style:{position:"absolute",left:"-25px",top:"50%",transform:"translateY(-50%)"},width:"20",height:"20",viewBox:"0 0 32 32",children:(0,C.jsx)("path",{fill:"currentColor",d:"M28 12H10a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h18a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2M10 4v6h18V4zm18 26H10a2 2 0 0 1-2-2v-6a2 2 0 0 1 2-2h18a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2m-18-8v6h18v-6zm-1-6l-5.586-5.586L2 11.828L6.172 16L2 20.172l1.414 1.414z"})}),(0,C.jsx)("svg",{style:{position:"absolute",right:"-25px",top:"50%",transform:"translateY(-50%) scaleX(-1)"},width:"20",height:"20",viewBox:"0 0 32 32",children:(0,C.jsx)("path",{fill:"currentColor",d:"M28 12H10a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h18a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2M10 4v6h18V4zm18 26H10a2 2 0 0 1-2-2v-6a2 2 0 0 1 2-2h18a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2m-18-8v6h18v-6zm-1-6l-5.586-5.586L2 11.828L6.172 16L2 20.172l1.414 1.414z"})})]});return(0,C.jsxs)(C.Fragment,{children:[v==="up"&&(0,C.jsx)(I,{}),(0,C.jsxs)(G.Stack,{ref:m,"data-handler-id":S,sx:{border:1,borderColor:"divider",padding:1,paddingTop:0,borderRadius:1,backgroundColor:"background.paper",marginBottom:1.5,opacity:L,cursor:w?"grabbing":"grab",boxShadow:w?f.shadows[3]:"none"},spacing:1,children:[(0,C.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",borderBottom:`1px solid ${f.palette.divider}`},children:[(0,C.jsx)("div",{style:{display:"flex",alignItems:"center"},children:(0,C.jsx)(qe.DragIndicator,{sx:{color:w?"primary.main":"text.secondary",cursor:"grab",marginLeft:-.9,"&:hover":{color:"primary.main"}}})}),(0,C.jsxs)("div",{children:[(0,C.jsx)(G.Tooltip,{title:"Duplicate",placement:"left",children:(0,C.jsx)(G.IconButton,{color:"primary",size:"small",onClick:V,children:(0,C.jsx)("svg",{width:"20",height:"20",viewBox:"0 0 24 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,C.jsx)("path",{d:"M18 2.5H9C7.9 2.5 7 3.4 7 4.5V16.5C7 17.6 7.9 18.5 9 18.5H18C19.1 18.5 20 17.6 20 16.5V4.5C20 3.4 19.1 2.5 18 2.5ZM18 16.5H9V4.5H18V16.5ZM3 15.5V13.5H5V15.5H3ZM3 10H5V12H3V10ZM10 20.5H12V22.5H10V20.5ZM3 19V17H5V19H3ZM5 22.5C3.9 22.5 3 21.6 3 20.5H5V22.5ZM8.5 22.5H6.5V20.5H8.5V22.5ZM13.5 22.5V20.5H15.5C15.5 21.6 14.6 22.5 13.5 22.5ZM5 6.5V8.5H3C3 7.4 3.9 6.5 5 6.5Z",fill:"currentColor"})})})}),h&&(0,C.jsx)(G.Tooltip,{title:"Remove",placement:"left",children:(0,C.jsx)(G.IconButton,{color:"error",size:"small",onClick:H,children:(0,C.jsx)(qe.DeleteOutlined,{sx:{fontSize:20}})})})]})]}),(0,C.jsxs)("div",{style:{width:"100%",display:"flex",flexDirection:"column",gap:"0.5rem"},children:[(0,C.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"40px auto",gap:"4px",alignItems:"center"},children:[(0,C.jsx)(sn,{label:A("inputs.social.icon")}),(0,C.jsx)(Qu,{fullWidth:!0,labelId:"demo-simple-select-label",id:"demo-simple-select",value:e.key,size:"small",onChange:F,children:pz.map($=>(0,C.jsx)(G.MenuItem,{value:$.key,children:$.label},`${e.id}_${$.key}`))})]}),(0,C.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"40px auto",gap:"4px",alignItems:"center"},children:[(0,C.jsx)(sn,{label:A("inputs.social.url")}),(0,C.jsx)(G.TextField,{size:"small",fullWidth:!0,value:e.href??"",onChange:U,variant:"outlined",placeholder:"https://your-website.com",sx:g5})]})]})]}),v==="down"&&(0,C.jsx)(I,{})]})};function B95({items:e=[],onChange:t}){const{t:r}=Xt("inspector"),n=(0,G.useTheme)(),[a,d]=(0,ie.useState)(()=>e.map(O=>({...O,id:O.id||oM()}))),[p,h]=(0,ie.useState)(e[0]?.theme||"positive"),[f,m]=(0,ie.useState)(e[0]?.size||"medium");(0,ie.useEffect)(()=>{e.length>0&&(h(e[0].theme),m(e[0].size),d(e.map(O=>({...O,id:O.id||oM()}))))},[e]);const v=(O,w)=>{d(E=>{const L=[...E],[H]=L.splice(O,1);return L.splice(w,0,H),t&&setTimeout(()=>t(L),0),L})},g=()=>{d(O=>{const w={...pz[0],theme:p,size:f,sizePx:pa(f),url:Nn(pz[0].iconName,p,f),id:oM()},E=[...O,w];return t&&setTimeout(()=>t(E),0),E})},A=O=>{d(w=>{const E=w.filter((L,H)=>H!==O);return t&&setTimeout(()=>t(E),0),E})},y=(O,w,E)=>{let L=[...a];if(w in Sf5?(h(w),L=L.map(H=>{const V=Nn(H.iconName,w,H.size);return{...H,theme:w,url:V}})):w in Tf5&&(m(w),L=L.map(H=>{const V=Nn(H.iconName,H.theme,w),F=pa(w);return{...H,size:w,sizePx:F,url:V}})),O!==null&&E){const H=pz.find(V=>V.key===w);H&&(L=L.map((V,F)=>{const U={key:H.key,label:H.label,iconName:H.iconName,href:H.href},I=Nn(U.iconName,E.theme,E.size);return F===O?{...V,...U,url:I,id:E.id}:V}))}d(L),t&&setTimeout(()=>t(L),0)},S=(O,w,E)=>{const L=a.map((H,V)=>V===O?{...E,href:w}:H);d(L),t&&setTimeout(()=>t(L),0)},x=O=>{d(w=>{const E={...JSON.parse(JSON.stringify(w[O])),id:oM()},L=[...w.slice(0,O+1),E,...w.slice(O+1)];return t&&setTimeout(()=>t(L),0),L})};return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)("div",{style:{marginBottom:"1rem",display:"grid",gridTemplateColumns:"repeat(2,1fr)",gap:"1rem"},children:[(0,C.jsxs)(No,{children:[(0,C.jsx)(sn,{label:r("inputs.social.theme")}),(0,C.jsx)(Qu,{fullWidth:!0,labelId:"theme-selector",id:"theme-selector",value:p,size:"small",onChange:O=>y(null,O.target.value,null),children:Hpo.map(O=>(0,C.jsx)(G.MenuItem,{value:O.key,children:O.label},`${O.key}`))})]}),(0,C.jsxs)(No,{children:[(0,C.jsx)(sn,{label:r("inputs.social.size")}),(0,C.jsx)(Qu,{fullWidth:!0,labelId:"size-selector",id:"size-selector",value:f,size:"small",onChange:O=>y(null,O.target.value,null),children:SKe.map(O=>(0,C.jsx)(G.MenuItem,{value:O.key,children:O.label},`${O.key}`))})]})]}),a?.map((O,w)=>(0,C.jsx)(I95,{element:O,index:w,moveItem:v,onSelectChange:y,onUrlChange:S,onRemove:A,onDuplicate:x,canRemove:a.length>1,theme:n},O.id)),(0,C.jsx)(G.Button,{onClick:g,sx:{borderRadius:1},variant:"contained",endIcon:(0,C.jsx)(qe.Add,{}),children:"Add"})]})}dr(),tQe(),Lr();var N95=({data:e,setData:t})=>{const[,r]=(0,ie.useState)(null),n=ll(),{t:a}=Xt("inspector"),d=g=>{const A=kZ.safeParse(g);A.success?(t(A.data),r(null)):r(A.error)},p=g=>{d({...e,items:g})},h=g=>{d({...e,style:g})},f=(g,A=!1)=>{if(A){d({...e,gapMobile:g});return}d({...e,gap:g})},m=X6(),v=fd();return(0,C.jsxs)(Qm,{title:a("inputs.panels.social.title"),children:[(m=="block-configuration"||v)&&(0,C.jsx)(h1,{icon:qe.ShareOutlined,label:a("inputs.panels.social.title"),children:(0,C.jsx)(G.Box,{sx:{minWidth:120,margin:1},children:(0,C.jsx)(B95,{items:e?.items??[],onChange:p})})}),(m=="css"||v)&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(xz,{}),(0,C.jsx)(h1,{icon:qe.SpaceBar,label:a("inputs.panels.social.gap"),children:(0,C.jsxs)(No,{children:[(0,C.jsx)(sn,{label:a("inputs.panels.social.gap")}),n=="desktop"?(0,C.jsx)(Di,{iconLabel:(0,C.jsx)(qe.SpaceBar,{sx:{color:"text.primary"}}),value:Number(e?.gap??4),setValue:g=>f(g,!1),marks:!0,step:4,units:"px",min:0,max:40}):(0,C.jsx)(Di,{iconLabel:(0,C.jsx)(qe.SpaceBar,{sx:{color:"text.primary"}}),value:Number(e?.gapMobile??e?.gap??4),setValue:g=>f(g,!0),marks:!0,step:4,units:"px",min:0,max:40})]})}),(0,C.jsx)(eu,{names:["textAlign","textAlignMobile","backgroundColor","padding","mobilePadding"],value:e.style,onChange:g=>h(g)})]})]})};dr(),rQe();function yho({data:e,setData:t}){const[,r]=(0,ie.useState)(null),{t:n}=Xt("inspector"),a=d=>{const p=kT.safeParse(d);p.success?(t(p.data),r(null)):r(p.error)};return(0,C.jsx)(Qm,{title:n("inputs.panels.spacer.title"),children:(0,C.jsx)(eu,{names:["height","heightMobile","backgroundColor"],value:e.style,onChange:d=>a({...e,style:d})})})}Lr();function Sho(e){return(0,C.jsx)(G.Box,{sx:{m:3,p:1,border:"1px dashed",borderColor:"divider"},children:(0,C.jsx)(G.Typography,{color:"text.secondary",children:e})})}function $95(){const e=iO(),t=Jyt(e||""),r=(0,ie.useCallback)(d=>{e&&bz(e,()=>d)},[e]);if(!e)return Sho("Click on a block to inspect.");if(!t)return Sho(`Block with id ${e} was not found. Click on a block to reset.`);const{data:n,type:a}=t;switch(a){case"Button":return(0,C.jsx)(O95,{data:n,setData:d=>r({type:a,data:d})},e);case"ColumnsContainer":return(0,C.jsx)(E95,{data:n,setData:d=>r({type:a,data:d})},e);case"Container":return(0,C.jsx)(mho,{data:n,setData:d=>r({type:a,data:d})},e);case"Divider":return(0,C.jsx)(vho,{data:n,setData:d=>r({type:a,data:d})},e);case"Image":return(0,C.jsx)(V95,{data:n,setData:d=>r({type:a,data:d})},e);case"EmailLayout":return(0,C.jsx)(_ho,{data:n,setData:d=>r({type:a,data:d})},e);case"Spacer":return(0,C.jsx)(yho,{data:n,setData:d=>r({type:a,data:d})},e);case"NotionText":return(0,C.jsx)(F95,{data:n,setData:d=>r({type:a,data:d})},e);case"SocialMedia":return(0,C.jsx)(N95,{data:n,setData:d=>r({type:a,data:d})},e);default:return(0,C.jsx)("pre",{children:JSON.stringify(t,null," ")})}}var U95=(0,ie.memo)($95),W95="email-builder-standalone",G95="4.3.0",Q95="module",Y95="./dist/index.cjs",K95="./dist/index.mjs",q95="./dist/index.d.ts",J95={".":{types:"./dist/index.d.ts",import:"./dist/index.mjs",require:"./dist/index.cjs"},"./standalone":{import:"./dist/standalone.mjs"},"./style.css":"./dist/style.css"},Z95=["*.css"],X95={node:">=24"},e65="A React email builder component with drag and drop functionality",t65="AGPL-3.0",r65={name:"Laravel42",email:"hello@laravel42.com",url:"https://github.com/laravel42/"},n65=["dist","vite.config.standalone.ts"],a65={prepack:"pnpm build:all && node prepare-publish.cjs clean",postpack:"node prepare-publish.cjs restore","dev:publish":"pnpm version patch && pnpm publish --no-git-checks",build:"vite build","build:standalone":"vite build --config vite.config.standalone.ts","build:all":"pnpm build && pnpm build:standalone"},i65={"@codexteam/icons":"^0.3.3","@eb/document-core":"workspace:*","@emoji-mart/data":"^1.2.1","@emoji-mart/react":"^1.1.1","@emotion/cache":"^11.14.0","@emotion/react":"^11.14.0","@emotion/styled":"^11.14.1","@floating-ui/react":"^0.27.20","@josecortez1/c42-core":"0.1.0","@josecortez1/c42-react":"0.1.0","@mui/icons-material":"^9.2.0","@mui/material":"^9.2.0","@r2wc/react-to-web-component":"^2.1.1","@tiptap/core":"^3.28.0","@tiptap/extension-color":"^3.28.0","@tiptap/extension-link":"^3.28.0","@tiptap/extension-placeholder":"^3.28.0","@tiptap/extension-text-align":"^3.28.0","@tiptap/extension-text-style":"^3.28.0","@tiptap/extension-underline":"^3.28.0","@tiptap/pm":"^3.28.0","@tiptap/react":"^3.28.0","@tiptap/starter-kit":"^3.28.0","@tiptap/suggestion":"^3.28.0","approve-builds":"^1.0.0",csso:"^5.0.5","driver.js":"^1.8.0","emoji-mart":"^5.6.0","fast-json-patch":"^3.1.1","highlight.js":"^11.11.1","html-to-image":"1.11.13",i18next:"^26.3.6","i18next-browser-languagedetector":"^8.2.1","lucide-react":"^1.25.0",prettier:"^3.9.5",r:"^0.0.5",react:"^19.2.7","react-colorful":"^5.8.0","react-dnd":"^16.0.1","react-dnd-html5-backend":"^16.0.1","react-dnd-preview":"^9.0.0","react-dnd-touch-backend":"^16.0.1","react-dom":"^19.2.7","react-i18next":"^17.0.10","react-sticky-el":"^2.1.1",use:"^3.1.1","vite-plugin-dts":"^5.0.3",zod:"^4.4.3",zustand:"^5.0.14"},o65={react:">=18.0.0 || ^19.0.0","react-dom":">=18.0.0 || ^19.0.0"},l65={react:{optional:!0},"react-dom":{optional:!0}},s65={"@codexteam/icons":"^0.3.3","@eb/block-button":"workspace:*","@eb/block-columns-container":"workspace:*","@eb/block-container":"workspace:*","@eb/block-divider":"workspace:*","@eb/block-image":"workspace:*","@eb/block-notion-text":"workspace:*","@eb/block-social-media":"workspace:*","@eb/block-spacer":"workspace:*","@eb/email-builder":"workspace:*","@types/react":"^18.3.18","@types/react-dom":"^18.3.5","@typescript-eslint/eslint-plugin":"^8.64.0","@typescript-eslint/parser":"^8.64.0","@vitejs/plugin-react-swc":"^4.3.1","editorjs-undo":"^2.0.28",esbuild:"^0.28.1",eslint:"^10.7.0","eslint-plugin-react-hooks":"^7.1.1","eslint-plugin-react-refresh":"^0.5.3","eslint-plugin-simple-import-sort":"^14.0.0",react:"^19.2.1","react-dom":"^19.2.1",typescript:"^6.0.3",vite:"^8.1.5"},u65=["email-builder","email-template","react","typescript","wysiwyg"],Cz={name:W95,version:G95,type:Q95,main:Y95,module:K95,types:q95,exports:J95,sideEffects:Z95,engines:X95,description:e65,license:t65,author:r65,files:n65,scripts:a65,dependencies:i65,peerDependencies:o65,peerDependenciesMeta:l65,devDependencies:s65,keywords:u65};dr();function c65({onReset:e,visible:t}){const{t:r}=Xt("inspector");return t?(0,C.jsx)(G.Tooltip,{title:r("theme.reset"),placement:"left",children:(0,C.jsx)(G.IconButton,{size:"small",onClick:e,sx:{color:"primary.main",flexShrink:0,width:32,height:32,"&:hover":{backgroundColor:"action.hover"}},children:(0,C.jsx)(qe.RestartAltOutlined,{fontSize:"small"})})}):(0,C.jsx)("span",{"aria-hidden":"true",style:{display:"inline-block",width:32,height:32,flexShrink:0}})}dr(),Lr();var d65={top:0,right:0,bottom:0,left:0},p65={color:Tz,padding:eee,fontSize:qe.FormatSizeOutlined,fontFamily:tee,fontWeight:qe.FormatBoldOutlined,textAlign:qe.FormatAlignCenterOutlined,number:qe.FormatSizeOutlined,border:qe.BorderStyleOutlined};function h65({blockType:e,field:t}){const{t:r}=Xt("inspector"),{value:n,isOverridden:a,set:d,reset:p}=Sg(e,t.section,t.key),[h,f]=(0,ie.useState)(!0),m=Sz[e]?.[t.section]?.[t.key],v=r(t.labelKey),g=(0,C.jsx)(c65,{onReset:p,visible:a}),A=t.icon??p65[t.kind];switch(t.kind){case"color":return(0,C.jsx)(h1,{icon:A,label:v,modified:a,children:(0,C.jsx)(ZX,{label:v,labelAction:g,defaultValue:n??m??null,onChange:y=>y===null?p():d(y)})});case"padding":return(0,C.jsx)(h1,{icon:A,label:v,modified:a,children:(0,C.jsx)(LKe,{label:v,labelAction:g,defaultValue:n??m??d65,inheritedFrom:a?void 0:"default",onChange:y=>d(y),sidesLinked:h,onSidesLinkedChange:f})});case"fontSize":return(0,C.jsx)(h1,{icon:A,label:v,modified:a,children:(0,C.jsx)(XX,{label:v,labelAction:g,defaultValue:n??m??16,onChange:y=>d(y)})});case"fontFamily":return(0,C.jsx)(h1,{icon:A,label:v,modified:a,children:(0,C.jsx)(kKe,{label:v,labelAction:g,defaultValue:n??m??null,onChange:y=>y===null?p():d(y)})});case"fontWeight":return(0,C.jsx)(h1,{icon:A,label:v,modified:a,children:(0,C.jsx)(sho,{label:v,labelAction:g,defaultValue:n??m??"normal",onChange:y=>d(y)})});case"textAlign":return(0,C.jsx)(h1,{icon:A,label:v,modified:a,children:(0,C.jsx)(DKe,{label:v,labelAction:g,defaultValue:n??m??null,onChange:y=>y===null?p():d(y)})});case"number":return(0,C.jsx)(h1,{icon:A,label:v,modified:a,children:(0,C.jsx)(XX,{label:v,labelAction:g,defaultValue:n??m??0,onChange:y=>d(y)})});case"border":return(0,C.jsx)(h1,{icon:A,label:v,modified:a,children:(0,C.jsx)(f65,{blockType:e,field:t})});default:return t.kind,null}}function f65({blockType:e,field:t}){const{t:r}=Xt("inspector"),n=Sg(e,t.section,"borderColor"),a=Sg(e,t.section,"borderTop"),d=Sg(e,t.section,"borderBottom"),p=Sg(e,t.section,"borderLeft"),h=Sg(e,t.section,"borderRight"),[f,m]=(0,ie.useState)(!0),v=Sz[e]?.[t.section],g=A=>{A.borderColor!==void 0&&n.set(A.borderColor),A.borderTop!==void 0&&a.set(A.borderTop),A.borderBottom!==void 0&&d.set(A.borderBottom),A.borderLeft!==void 0&&p.set(A.borderLeft),A.borderRight!==void 0&&h.set(A.borderRight)};return(0,C.jsx)(EKe,{label:r(t.labelKey),borderColor:n.value??v?.borderColor??null,borderTop:a.value??v?.borderTop??0,borderBottom:d.value??v?.borderBottom??0,borderLeft:p.value??v?.borderLeft??0,borderRight:h.value??v?.borderRight??0,onChange:g,sidesLinked:f,onSidesLinkedChange:m})}dr(),Lr();function m65({blockType:e,spec:t,defaultExpanded:r=!1}){const{t:n}=Xt("inspector"),a=FIo(e),d=fd(),p=v65(a)>0,h=t.icon;return(0,C.jsxs)(G.Accordion,{defaultExpanded:r,disableGutters:!0,square:!0,sx:{boxShadow:"none",borderTop:f=>`1px solid ${f.palette.divider}`,"&:before":{display:"none"}},children:[(0,C.jsx)(G.AccordionSummary,{expandIcon:d?void 0:(0,C.jsx)(qe.ExpandMoreOutlined,{}),sx:{px:0,minHeight:d?40:48,justifyContent:d?"center":void 0,"& .MuiAccordionSummary-content":{my:d?.5:1,justifyContent:d?"center":void 0}},children:d?(0,C.jsx)(G.Tooltip,{title:n(t.titleKey),placement:"left",children:(0,C.jsxs)(G.Box,{sx:{position:"relative",display:"flex",alignItems:"center",p:.5,borderRadius:2,color:"text.secondary"},children:[(0,C.jsx)(h,{fontSize:"small"}),p&&(0,C.jsx)(G.Box,{component:"span","aria-label":n("theme.modified","Modified"),sx:{position:"absolute",top:2,right:2,width:6,height:6,borderRadius:"50%",bgcolor:"primary.main"}})]})}):(0,C.jsx)(G.Stack,{direction:"row",spacing:1,sx:{width:"100%",alignItems:"center"},children:(0,C.jsxs)(G.Box,{sx:{position:"relative",display:"inline-flex"},children:[(0,C.jsx)(G.Typography,{sx:{fontWeight:600,color:"text.primary"},children:n(t.titleKey)}),p&&(0,C.jsx)(G.Box,{component:"span","aria-label":n("theme.modified","Modified"),sx:{position:"absolute",top:-1,right:-8,width:6,height:6,borderRadius:"50%",bgcolor:"primary.main"}})]})})}),(0,C.jsx)(G.AccordionDetails,{sx:{p:0,pb:3},children:(0,C.jsx)(G.Stack,{spacing:2,children:t.fields.map(f=>(0,C.jsx)(h65,{blockType:e,field:f},`${f.section}.${f.key}`))})})]})}function v65(e){return e?(e.style?Object.keys(e.style).length:0)+(e.props?Object.keys(e.props).length:0):0}dr(),Lr();function _65({defaultExpanded:e=!0}){const{t}=Xt("inspector"),r=tho("root"),n=fd();if(!r||r.type!=="EmailLayout")return null;const{data:a}=r;return(0,C.jsxs)(G.Accordion,{defaultExpanded:e,disableGutters:!0,square:!0,sx:{boxShadow:"none",borderTop:d=>`1px solid ${d.palette.divider}`,"&:before":{display:"none"}},children:[(0,C.jsx)(G.AccordionSummary,{expandIcon:n?void 0:(0,C.jsx)(qe.ExpandMoreOutlined,{}),sx:{px:0,minHeight:n?40:48,justifyContent:n?"center":void 0,"& .MuiAccordionSummary-content":{my:n?.5:1,justifyContent:n?"center":void 0}},children:n?(0,C.jsx)(G.Tooltip,{title:t("theme.blocks.root.title"),placement:"left",children:(0,C.jsx)(G.Box,{sx:{display:"flex",p:.5,borderRadius:2,color:"text.secondary"},children:(0,C.jsx)(qe.TuneOutlined,{fontSize:"small"})})}):(0,C.jsx)(G.Typography,{sx:{fontWeight:600,color:"text.primary"},children:t("theme.blocks.root.title")})}),(0,C.jsx)(G.AccordionDetails,{sx:{px:0,pt:0,pb:3},children:(0,C.jsx)(G.Stack,{spacing:2,children:(0,C.jsx)(_ho,{data:a,setData:d=>{E4e(),bz("root",()=>({type:"EmailLayout",data:d}))}})})})]})}Lr(),bv();async function g65(e){const t=await e.json().catch(()=>null);if(!e.ok)throw e.status===403&&t?.hint?new Error(t.hint):new Error(t?.error??`HTTP ${e.status}`);return t}async function Tho(e){return ad()==="local"?tn5(e):g65(await fetch(`${id()}/dev/save-theme`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}))}dr(),Lr();var NKe=100,$Ke=280;function b65({open:e,onClose:t,onSaved:r}){const{t:n}=Xt("inspector"),[a,d]=(0,ie.useState)(""),[p,h]=(0,ie.useState)(""),[f,m]=(0,ie.useState)(!1),[v,g]=(0,ie.useState)(null),A=a.trim(),y=A.length>0&&A.length<=NKe&&p.length<=$Ke,S=(0,ie.useCallback)(()=>{f||(d(""),h(""),g(null),t())},[f,t]),x=(0,ie.useCallback)(async()=>{if(!(!y||f)){m(!0),g(null);try{const O=$Io(),w=await Tho({name:A,description:p.trim()||void 0,bundle:O});r?.(w.id),d(""),h(""),t()}catch(O){g(O instanceof Error?O.message:String(O))}finally{m(!1)}}},[y,f,A,p,t,r]);return(0,C.jsxs)(G.Dialog,{open:e,onClose:S,maxWidth:"sm",fullWidth:!0,children:[(0,C.jsx)(G.DialogTitle,{children:n("theme.save.title","Save current theme")}),(0,C.jsx)(G.DialogContent,{children:(0,C.jsxs)(G.Stack,{spacing:2,sx:{mt:1},children:[(0,C.jsx)(G.Typography,{variant:"body2",color:"text.secondary",children:n("theme.save.description","Snapshots the current root globals and per-block-type theme overrides. Saved themes can be reapplied later from the Components Library.")}),(0,C.jsx)(G.TextField,{label:n("theme.save.nameLabel","Name"),value:a,onChange:O=>d(O.target.value),placeholder:n("theme.save.namePlaceholder","e.g. Brand default"),autoFocus:!0,fullWidth:!0,disabled:f,slotProps:{htmlInput:{maxLength:NKe}},helperText:`${A.length}/${NKe}`}),(0,C.jsx)(G.TextField,{label:n("theme.save.descriptionLabel","Description (optional)"),value:p,onChange:O=>h(O.target.value),fullWidth:!0,multiline:!0,minRows:2,disabled:f,slotProps:{htmlInput:{maxLength:$Ke}},helperText:`${p.length}/${$Ke}`}),v&&(0,C.jsx)(G.Alert,{severity:"error",children:v})]})}),(0,C.jsxs)(G.DialogActions,{children:[(0,C.jsx)(G.Button,{onClick:S,disabled:f,children:n("theme.save.cancel","Cancel")}),(0,C.jsx)(G.Button,{onClick:x,variant:"contained",disabled:!y||f,children:f?n("theme.save.submitting","Saving…"):n("theme.save.submit","Save")})]})]})}dr(),Lr();function A65(){const{t:e}=Xt("inspector"),t=fBo(),r=aO(),n=qyt(),a=OIo(),d=fd(),[p,h]=(0,ie.useState)(!1),[f,m]=(0,ie.useState)(!1);return(0,C.jsxs)(G.Container,{sx:{padding:"0!important",paddingTop:"1rem!important",display:"flex",flexDirection:"column",flex:"1 0 auto",minHeight:"100%"},children:[!d&&(0,C.jsxs)(G.Stack,{direction:"row",sx:{mb:2,flexWrap:"wrap",gap:1,alignItems:"center",justifyContent:"space-between"},children:[(0,C.jsx)(G.Typography,{sx:{fontWeight:"bold",color:"text.primary",fontSize:"1.25rem"},children:e("styles.rootTitle")}),r&&(0,C.jsxs)(G.Stack,{direction:"row",spacing:.5,sx:{width:"100%",ml:"0!important"},children:[a&&(0,C.jsx)(G.Tooltip,{title:e("theme.exportTooltip","Save current theme to the gallery"),children:(0,C.jsx)(G.Button,{size:"small",variant:"outlined",startIcon:(0,C.jsx)(qe.BookmarkAddOutlined,{fontSize:"small"}),onClick:()=>h(!0),children:e("theme.exportButton","Theme")})}),n&&(0,C.jsx)(G.Tooltip,{title:e("componentsLibrary.saveTemplate.tooltip","Save the current document as a reusable template"),children:(0,C.jsx)(G.Button,{size:"small",variant:"outlined",startIcon:(0,C.jsx)(qe.FileDownloadOutlined,{fontSize:"small"}),onClick:()=>m(!0),children:e("componentsLibrary.saveTemplate.button","Template")})})]})]}),(0,C.jsxs)(G.Box,{children:[(0,C.jsx)(_65,{defaultExpanded:!0}),S95.map(v=>(0,C.jsx)(m65,{blockType:v,spec:cho[v],defaultExpanded:!1},v))]}),t&&(0,C.jsx)(G.Box,{color:"text.secondary",sx:{display:"flex",justifyContent:"flex-end",mt:"auto",pt:3,pb:3},children:d?(0,C.jsxs)(G.Link,{href:`https://www.npmjs.com/package/${Cz.name}`,target:"_blank",rel:"noopener noreferrer",sx:{fontSize:"0.75rem"},children:["v",Cz.version]}):(0,C.jsxs)(G.Box,{sx:{textAlign:"right"},children:[(0,C.jsxs)(G.Typography,{variant:"body2",children:[e("inputs.panels.emailLayout.version"),": ",Cz.version]}),(0,C.jsx)(G.Link,{href:`https://www.npmjs.com/package/${Cz.name}`,target:"_blank",rel:"noopener noreferrer",sx:{fontSize:"0.875rem",mt:.5,display:"inline-block"},children:Cz.name})]})}),(0,C.jsx)(b65,{open:p,onClose:()=>h(!1)}),(0,C.jsx)(mf5,{open:f,onClose:()=>m(!1)})]})}Lr();function y65(){const e=iO(),t=tho(e??"root"),r=(0,ie.useCallback)(d=>{e&&bz(e,()=>d)},[e]);if(!t)return null;const{data:n,type:a}=t;switch(a){case"Container":return(0,C.jsx)(mho,{data:n,setData:d=>r({type:a,data:d})},e);case"Divider":return(0,C.jsx)(vho,{data:n,setData:d=>r({type:a,data:d})},e);case"Spacer":return(0,C.jsx)(yho,{data:n,setData:d=>r({type:a,data:d})},e);case"EmailLayout":return(0,C.jsx)(A65,{});default:return(0,C.jsx)("pre",{children:JSON.stringify(t,null," ")})}}dr(),v5(),R4e(),Lr();function S65({sticky:e,heightContent:t}){const r=X6(),n=vF(),a=iO(),d=ll(),p=gF(),h=(0,G.useTheme)(),{t:f}=Xt("inspector");(0,ie.useEffect)(()=>{const x=O=>{const w=O.target;Qyt(w.innerWidth)};return window&&Qyt(window.innerWidth),window.addEventListener("resize",x),()=>{window.removeEventListener("resize",x)}},[r]);const m=()=>{const x={position:"absolute",top:"1rem",right:"0.5rem",color:"primary.main",fontSize:"20px",cursor:"pointer",display:S?"none":void 0},O=()=>ev(d==="desktop"?"mobile":"desktop");return r==="block-configuration"||r==="css"||S&&a&&!bg.includes(n||"")?(0,C.jsxs)("div",{style:{position:"relative",display:"flex",flexDirection:"column",flex:"1 0 auto"},children:[d==="desktop"?(0,C.jsx)(qe.MonitorOutlined,{sx:x,onClick:O}):(0,C.jsx)(qe.PhoneIphoneOutlined,{sx:x,onClick:O}),(0,C.jsx)(U95,{})]}):(0,C.jsxs)("div",{style:{position:"relative",display:"flex",flexDirection:"column",flex:"1 0 auto"},children:[(0,C.jsx)(y65,{}),d==="desktop"?(0,C.jsx)(qe.MonitorOutlined,{sx:x,onClick:O}):(0,C.jsx)(qe.PhoneIphoneOutlined,{sx:x,onClick:O})]})},v=()=>(0,C.jsx)("svg",{style:{marginRight:"4px",color:"inherit"},width:"21",height:"20",viewBox:"0 0 21 20",fill:"none",children:(0,C.jsx)("path",{d:"M3.83398 5H17.1673M3.83398 10H17.1673M3.83398 15H9.66732",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),g=()=>(0,C.jsx)("svg",{style:{marginRight:"4px",color:"inherit"},width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:(0,C.jsx)("path",{d:"M5.83333 17.5C3.99238 17.5 2.5 16.0076 2.5 14.1667V4.16667C2.5 3.24619 3.24619 2.5 4.16667 2.5H7.5C8.42047 2.5 9.16667 3.24619 9.16667 4.16667V14.1667C9.16667 16.0076 7.67428 17.5 5.83333 17.5ZM5.83333 17.5H15.8333C16.7538 17.5 17.5 16.7538 17.5 15.8333V12.5C17.5 11.5795 16.7538 10.8333 15.8333 10.8333H13.8807M9.16669 6.11927L10.5474 4.73858C11.1983 4.0877 12.2535 4.0877 12.9044 4.73858L15.2614 7.0956C15.9123 7.74647 15.9123 8.80175 15.2614 9.45262L8.19036 16.5237M5.83333 14.1667H5.84167",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),A=(x,O)=>{HIo(O)},y=e?t?`calc(${t} - 4px)`:void 0:t??void 0,S=p==="compact";return(0,C.jsx)(_m5,{value:S,children:(0,C.jsxs)(G.Container,{sx:x=>({width:S?56:385,padding:"0!important",margin:"0!important",height:y,maxHeight:y,display:"flex",flexDirection:"column",overflow:"hidden",position:e?"sticky":"static",top:e?Vyt:0,backgroundColor:`${x.palette.background.paper} !important`}),children:[(0,C.jsx)(G.Box,{sx:{position:"sticky",top:0,zIndex:1,backgroundColor:`${h.palette.background.paper} !important`,display:S?"none":void 0},children:(0,C.jsxs)(G.Tabs,{sx:{backgroundColor:`${h.palette.background.paper} !important`},value:r,onChange:A,children:[a!=null&&!bg.includes(n||"")&&[(0,C.jsx)(G.Tab,{sx:{height:"50px",minHeight:"50px",fontWeight:"bold"},value:"block-configuration",label:f("header.content"),icon:(0,C.jsx)(v,{}),iconPosition:"start"},"block-configuration"),(0,C.jsx)(G.Tab,{sx:{height:"50px",minHeight:"50px",fontWeight:"bold"},value:"css",label:f("header.styles"),icon:(0,C.jsx)(g,{}),iconPosition:"start"},"css")],a!=null&&bg.includes(n)&&[(0,C.jsx)(G.Tab,{sx:{height:"50px",minHeight:"50px",fontWeight:"bold"},value:"styles",label:f("header.styles"),icon:(0,C.jsx)(g,{}),iconPosition:"start"},"styles")],a==null&&(0,C.jsx)(G.Tab,{sx:{height:"50px",minHeight:"50px",fontWeight:"bold"},value:"styles",label:f("header.styles"),icon:(0,C.jsx)(g,{}),iconPosition:"start"},"styles")]})}),(0,C.jsx)(G.Container,{sx:x=>({flex:"1 1 auto",minHeight:0,overflowY:"auto",display:"flex",flexDirection:"column",px:S?"0.5rem!important":"1rem!important",backgroundColor:`${x.palette.background.paper} !important`}),children:m()})]})})}var xho=({children:e,topOffset:t=0,zIndex:r=10,className:n="",style:a={},disabled:d=!1,threshold:p=null,...h})=>{const[f,m]=(0,ie.useState)(!1),[v,g]=(0,ie.useState)({width:0,height:0}),[A,y]=(0,ie.useState)({left:0}),[S,x]=(0,ie.useState)(0),[O,w]=(0,ie.useState)(!1),E=(0,ie.useRef)(null),L=(0,ie.useRef)(null),H=(0,ie.useRef)(null);(0,ie.useEffect)(()=>{if(d){m(!1),w(!1),x(0);return}const U=L.current,I=E.current;if(!U||!I)return;let $=null;p&&(p.startsWith("#")?$=document.getElementById(p.slice(1)):(p.startsWith("."),$=document.querySelector(p)));const Q=()=>{const oe=I.getBoundingClientRect();g({width:oe.width,height:oe.height}),y({left:oe.left})},K=()=>{if(!$||!I)return{offset:0,isPushed:!1};const oe=$.getBoundingClientRect(),le=I.getBoundingClientRect(),X=t+le.height;if(oe.top<X){const se=X-oe.top,Ae=le.height+20;return{offset:-Math.min(se,Ae),isPushed:!0}}return{offset:0,isPushed:!1}},Y=new IntersectionObserver(([oe])=>{const le=!oe.isIntersecting;if(le&&!f&&Q(),m(le),le&&p){const{offset:X,isPushed:se}=K();x(X),w(se)}else le||(x(0),w(!1))},{threshold:0,rootMargin:`-${t}px 0px 0px 0px`}),ee=new ResizeObserver(()=>{Q()}),re=()=>{if(p&&f){const{offset:oe,isPushed:le}=K();x(oe),w(le)}};return Y.observe(U),ee.observe(I),p&&window.addEventListener("scroll",re,{passive:!0}),Q(),()=>{Y.disconnect(),ee.disconnect(),p&&window.removeEventListener("scroll",re)}},[t,f,d,p]);const V=!d&&f,F=V?`${t+S}px`:"auto";return(0,C.jsxs)("div",{ref:H,className:n,...h,children:[!d&&(0,C.jsx)("div",{ref:L,style:{height:"1px",position:"absolute",top:`-${t+1}px`,left:0,right:0,pointerEvents:"none"}}),V&&(0,C.jsx)("div",{style:{height:`${v.height}px`,width:`${v.width}px`}}),(0,C.jsx)("div",{ref:E,style:{position:V?"fixed":"static",top:F,width:"auto",height:"auto",zIndex:V?r:"auto",transition:O?"none":"box-shadow 0.2s ease-in-out, top 0.3s ease-out",...O&&S<-v.height*.3&&{opacity:Math.max(0,1+(S+v.height*.3)/(v.height*.7))},...a},children:e})]})};dr(),x3e(),Lr();function T65(){const e=k4e(),t=gF(),{t:r}=Xt("inspector");if(!e)return null;const n=()=>I4e(t==="full"?"compact":"full"),a=t==="compact";return(0,C.jsx)(G.Box,{sx:{position:"absolute",left:0,top:"50%",transform:"translateX(-100%) translateY(-50%)",zIndex:10},children:(0,C.jsx)(G.Tooltip,{title:a?r("inspector.handle.expand","Expand panel"):r("inspector.handle.compact","Compact panel"),placement:"left",children:(0,C.jsx)(G.ButtonBase,{onClick:n,sx:d=>({width:24,minHeight:80,borderTopLeftRadius:8,borderBottomLeftRadius:8,backgroundColor:a?d.palette.primary.main:d.palette.background.paper,color:a?d.palette.primary.contrastText:d.palette.text.secondary,border:`1px solid ${d.palette.divider}`,borderRight:"none",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:.5,py:1,boxShadow:"-2px 0 6px rgba(0,0,0,0.04)",transition:"background-color 120ms ease, color 120ms ease","&:hover":{backgroundColor:a?d.palette.primary.dark:d.palette.mode==="dark"?d.palette.grey[800]:d.palette.grey[200]}}),children:(0,C.jsx)(EF,{sx:{fontSize:16}})})})})}var Cho=e=>Symbol.iterator in e,Oho=e=>"entries"in e,who=(e,t)=>{const r=e instanceof Map?e:new Map(e.entries()),n=t instanceof Map?t:new Map(t.entries());if(r.size!==n.size)return!1;for(const[a,d]of r)if(!n.has(a)||!Object.is(d,n.get(a)))return!1;return!0},x65=(e,t)=>{const r=e[Symbol.iterator](),n=t[Symbol.iterator]();let a=r.next(),d=n.next();for(;!a.done&&!d.done;){if(!Object.is(a.value,d.value))return!1;a=r.next(),d=n.next()}return!!a.done&&!!d.done};function C65(e,t){return Object.is(e,t)?!0:typeof e!="object"||e===null||typeof t!="object"||t===null||Object.getPrototypeOf(e)!==Object.getPrototypeOf(t)?!1:Cho(e)&&Cho(t)?Oho(e)&&Oho(t)?who(e,t):x65(e,t):who({entries:()=>Object.entries(e)},{entries:()=>Object.entries(t)})}function O65(e){const t=ie.useRef(void 0);return r=>{const n=e(r);return C65(t.current,n)?t.current:t.current=n}}hh(),Lr();function UKe({children:e}){const t=ll(),r=D4e(),n=kIo();return(0,C.jsx)(fNe,{value:t,children:(0,C.jsx)(nNe,{value:AF()??null,children:(0,C.jsx)(ieo,{value:r,children:(0,C.jsx)(leo,{value:n,children:(0,C.jsx)(ueo,{value:w65,children:e})})})})})}function w65(e,t){bBo(e,{...Ke.getState().document[e]?.data?.props??{},width:t})}function j65(e){return typeof ReadableStream<"u"&&e instanceof ReadableStream?(async function*(){const t=e.getReader(),r=new TextDecoder;try{for(;;){const{value:n,done:a}=await t.read();if(a){const d=r.decode();d&&(yield d);return}n!==void 0&&(typeof n=="string"?yield n:yield r.decode(n,{stream:!0}))}}finally{t.releaseLock()}})():e}function*jho(e){const t=e.split(`
|
|
1460
|
+
</html>`,tm5=qH;function rm5(e,t){const r=e.head;if(r.querySelector("link[data-eb-fonts]")===null){const n=e.createElement("link");n.setAttribute("data-eb-fonts","1"),n.rel="stylesheet",n.href=tm5,r.appendChild(n)}if(r.querySelector("style[data-eb-globals]")===null){const n=e.createElement("style");n.setAttribute("data-eb-globals","1"),n.textContent=tKe,r.appendChild(n)}e.documentElement.style.overflow="hidden",e.body.style.overflow="hidden",e.body.style.backgroundColor=t}function nm5(){const e=(0,G.useTheme)(),{t}=Xt("inspector"),r=$f5(),n=(0,ie.useRef)(null),a=(0,ie.useRef)(null),[d,p]=(0,ie.useState)(null),[h,f]=(0,ie.useState)(null),[m,v]=(0,ie.useState)("root"),[g,A]=(0,ie.useState)(!1),[y,S]=(0,ie.useState)(null),[x,O]=(0,ie.useState)(null),[w,E]=(0,ie.useState)(!1),[L,H]=(0,ie.useState)("desktop"),[V,F]=(0,ie.useState)(()=>typeof window<"u"?window.innerHeight:800),U=(0,ie.useRef)(null),I=(0,ie.useCallback)(()=>{const ze=n.current;if(ze===null)return;const pe=ze.contentDocument;pe!==null&&(rm5(pe,(Ke.getState().document.root?.data??{}).backdropColor??OKe),p(pe.body))},[]);(0,ie.useEffect)(()=>{const ze=()=>F(window.innerHeight);return window.addEventListener("resize",ze),()=>window.removeEventListener("resize",ze)},[]),(0,ie.useEffect)(()=>{if(r===null)return;const ze=`${r.category}|${r.axis}|${r.id}`;U.current=ze,S(null),E(!1),H("desktop");let pe=!1;Xf5(r).then(Z=>{U.current===ze&&(pe=!0,(0,ie.startTransition)(()=>{f(Z.doc),v(Z.rootBlockId)}),A(!1))}).catch(Z=>{U.current===ze&&(pe=!0,S(Z instanceof Error?Z.message:String(Z)),A(!1))}),Promise.resolve().then(()=>{!pe&&U.current===ze&&A(!0)})},[r]),(0,ie.useEffect)(()=>{if(d===null||r===null)return;const ze=(Ke.getState().document.root?.data??{}).backdropColor??OKe;d.style.backgroundColor=ze},[d,r]),(0,ie.useEffect)(()=>{if(d===null)return;const ze=()=>{const Z=d.firstElementChild,be=Z!==null&&Z.offsetHeight>0?Z.offsetHeight:d.scrollHeight;O(be)};ze();const pe=new ResizeObserver(ze);return pe.observe(d),()=>pe.disconnect()},[d,h]);const $=r?.category==="template",Q=$?Yf5:Qf5,K=$?Math.round(V*Jf5):Kf5,Y=L==="mobile"?Gf5:Wf5,ee=x??K,re=Q/Y,oe=w?re:Math.min(re,K/ee),le=Y*oe,X=ee*oe,se=Math.max(qf5,Math.min(X,K));(0,ie.useEffect)(()=>{a.current&&(a.current.scrollTop=0)},[w,L,r]);const Ae=(0,ie.useMemo)(()=>h===null?null:(0,C.jsx)(VZ,{document:h,rootBlockId:m,viewport:L}),[h,m,L]);return(0,C.jsx)(G.Popper,{open:r!==null,anchorEl:r?.anchor??null,placement:"right-start",keepMounted:!0,modifiers:[{name:"offset",options:{offset:[0,8]}},{name:"flip",enabled:!1},{name:"preventOverflow",options:{boundary:"viewport",padding:8,altAxis:!0}}],sx:{zIndex:e.zIndex.tooltip+1,pointerEvents:r!==null?"auto":"none",visibility:r!==null?"visible":"hidden"},children:(0,C.jsxs)(G.Paper,{elevation:6,onMouseEnter:Nf5,onMouseLeave:Ipo,sx:{width:Q+24,padding:1.5,display:"flex",flexDirection:"column",gap:1,backgroundColor:e.palette.background.paper,border:`1px solid ${e.palette.divider}`},children:[(0,C.jsxs)(G.Box,{sx:{display:"flex",alignItems:"center",gap:.5},children:[(0,C.jsx)(G.Typography,{variant:"caption",color:"text.secondary",sx:{fontWeight:600,flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:r?.name??""}),(0,C.jsx)(G.Tooltip,{title:L==="mobile"?t("componentsLibrary.preview.desktop","Desktop view"):t("componentsLibrary.preview.mobile","Mobile view"),children:(0,C.jsx)(G.IconButton,{size:"small",onClick:()=>H(ze=>ze==="mobile"?"desktop":"mobile"),sx:{flexShrink:0},children:L==="mobile"?(0,C.jsx)(Kve,{fontSize:"small"}):(0,C.jsx)(PF,{fontSize:"small"})})}),(0,C.jsx)(G.Tooltip,{title:w?t("componentsLibrary.preview.fit","Fit to view"):t("componentsLibrary.preview.zoom","Zoom in"),children:(0,C.jsx)(G.IconButton,{size:"small",onClick:()=>E(ze=>!ze),sx:{flexShrink:0},children:w?(0,C.jsx)(UBe,{fontSize:"small"}):(0,C.jsx)(WBe,{fontSize:"small"})})})]}),(0,C.jsxs)(G.Box,{ref:a,sx:{position:"relative",width:Q,height:se,mx:"auto",display:"flex",justifyContent:"center",alignItems:"flex-start",backgroundColor:e.palette.action.hover,borderRadius:1,overflowY:w?"auto":"hidden",overflowX:"hidden"},children:[(0,C.jsx)(G.Box,{sx:{position:"relative",width:le,height:X,flexShrink:0},children:(0,C.jsx)("iframe",{ref:n,srcDoc:em5,title:t("componentsLibrary.preview.iframeTitle","Live preview"),sandbox:"allow-same-origin",onLoad:I,style:{position:"absolute",top:0,left:0,width:Y,height:ee,border:0,display:"block",backgroundColor:"transparent",transform:`scale(${oe})`,transformOrigin:"top left",pointerEvents:"none"}})}),d!==null&&Ae!==null&&y===null&&(0,Uf5.createPortal)(Ae,d),g&&(0,C.jsx)(G.Box,{sx:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(255,255,255,0.6)"},children:(0,C.jsx)(G.CircularProgress,{size:24})}),y!==null&&(0,C.jsx)(G.Box,{sx:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",p:2,backgroundColor:e.palette.background.paper},children:(0,C.jsx)(G.Typography,{variant:"body2",color:"error",sx:{textAlign:"center"},children:y})})]})]})})}var am5=["updatedDesc","createdDesc","nameAsc","nameDesc","sizeDesc","sizeAsc","blocksDesc","blocksAsc"];function im5(e,t){const r=t.search.trim().toLowerCase();return e.filter(n=>{if(t.axes.length>0&&!t.axes.includes(n.axis))return!1;if(t.tags.length>0){const a=n.tags??[];if(!t.tags.every(d=>a.includes(d)))return!1}return!(r.length>0&&![n.name,n.description??"",n.axis,...n.tags??[]].join(" ").toLowerCase().includes(r))})}function om5(e,t){const r=[...e],n=(a,d)=>a.name.localeCompare(d.name);switch(t){case"nameAsc":return r.sort(n);case"nameDesc":return r.sort((a,d)=>n(d,a));case"createdDesc":return r.sort((a,d)=>a.createdAt<d.createdAt?1:a.createdAt>d.createdAt?-1:0);case"sizeAsc":return r.sort((a,d)=>a.sizeBytes-d.sizeBytes);case"sizeDesc":return r.sort((a,d)=>d.sizeBytes-a.sizeBytes);case"blocksAsc":return r.sort((a,d)=>a.blockCount-d.blockCount);case"blocksDesc":return r.sort((a,d)=>d.blockCount-a.blockCount);default:return r.sort((a,d)=>a.updatedAt<d.updatedAt?1:a.updatedAt>d.updatedAt?-1:0)}}function lm5({columns:e=2,count:t=4,thumbnailHeight:r=120}){return(0,C.jsx)(G.Box,{sx:{display:"grid",gridTemplateColumns:`repeat(${e}, minmax(0, 1fr))`,gap:.5,pt:.5},"aria-busy":"true","aria-live":"polite",children:Array.from({length:t}).map((n,a)=>(0,C.jsxs)(G.Stack,{spacing:.75,sx:{p:.5},children:[(0,C.jsx)(G.Skeleton,{variant:"rounded",animation:"wave",height:r,sx:{borderRadius:1}}),(0,C.jsx)(G.Skeleton,{variant:"text",animation:"wave",width:"70%"}),(0,C.jsx)(G.Skeleton,{variant:"text",animation:"wave",width:"45%"})]},a))})}CY1();function sm5({src:e,alt:t,height:r=120,placeholderText:n}){const a=(0,G.useTheme)(),d={width:"100%",height:r,borderRadius:4,backgroundColor:a.palette.background.default,display:"block"};return e===null?(0,C.jsxs)(G.Box,{sx:{...d,border:`1px dashed ${a.palette.divider}`,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:.5,color:"text.secondary"},"aria-label":t,children:[(0,C.jsx)(Mye,{sx:{fontSize:24,opacity:.6}}),n!==void 0&&(0,C.jsx)(G.Typography,{variant:"caption",sx:{opacity:.7},children:n})]}):(0,C.jsx)("img",{src:e,alt:t,loading:"lazy",decoding:"async",style:{...d,objectFit:"cover",objectPosition:"top center",border:`1px solid ${a.palette.divider}`},onError:p=>{const h=p.currentTarget;h.style.display="none"}})}var um5={section:"sections",layout:"layouts",template:"templates"};function cm5(e,t,r){const n=id(),a=um5[e];if(e==="template")return`${n}/dev/${a}/${encodeURIComponent(r)}/thumbnail`;if(t===null)throw new Error(`category '${e}' requires an axis but received null`);return`${n}/dev/${a}/${encodeURIComponent(t)}/${encodeURIComponent(r)}/thumbnail`}dr(),Lr(),bv();var Kz3=380,qz3=64,gz="__other__",dm5=[{key:"blocks",labelKey:"componentsLibrary.drawer.category.blocks",enabled:!0},{key:"sections",labelKey:"componentsLibrary.drawer.category.sections",enabled:!0},{key:"templates",labelKey:"componentsLibrary.drawer.category.templates",enabled:!0}];function $po({item:e,category:t,onClick:r}){const{t:n}=Xt("inspector"),a=(0,G.useTheme)(),d=t!=="template",[{isDragging:p},h]=X9(()=>({type:k4,item:()=>({kind:k4,category:t,axis:e.axis,id:e.id}),canDrag:()=>d,collect:g=>({isDragging:g.isDragging()})}),[t,e.axis,e.id,d]);(0,ie.useEffect)(()=>{p&&Bpo()},[p]);const f=t==="section"||t==="layout"||t==="template",m=t==="primitive"&&e.block!==void 0,v=f&&e.hasThumbnail?ad()==="local"?$15(e.id):cm5(t,t==="template"?null:e.axis,e.id):null;return(0,C.jsxs)(G.Box,{ref:g=>{d&&g&&h(g)},onMouseEnter:g=>Bf5({anchor:g.currentTarget,category:t,axis:e.axis,id:e.id,name:e.name,primitiveBlock:t==="primitive"?e.block:void 0}),onMouseLeave:Ipo,onClick:r?()=>r(e):void 0,sx:{p:1,borderRadius:1,border:"1px dashed",borderColor:a.palette.divider,cursor:r?"pointer":"grab",opacity:p?.5:1,display:"flex",flexDirection:"column",gap:.75,transition:"background-color 120ms ease, border-color 120ms ease","&:hover":{backgroundColor:a.palette.action.hover,borderColor:a.palette.secondary.main},"&:active":{cursor:"grabbing"}},children:[m&&(0,C.jsx)(Vpo,{id:e.id,block:e.block,alt:e.name}),f&&(0,C.jsx)(sm5,{src:v,alt:e.name,placeholderText:n("componentsLibrary.thumbnail.placeholder","No preview")}),(0,C.jsxs)(G.Box,{sx:{display:"flex",alignItems:"center",gap:.75},children:[(0,C.jsx)(GN,{sx:{fontSize:16,color:"text.secondary",flexShrink:0,display:d?"inline-flex":"none"}}),(0,C.jsx)(G.Box,{sx:{minWidth:0,flex:1},children:(0,C.jsx)(G.Typography,{variant:"body2",sx:{fontSize:"0.8rem",fontWeight:500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:e.name,children:e.name})})]})]})}var jKe=24;function pm5({items:e,columns:t,renderItem:r}){const[n,a]=(0,ie.useState)(jKe),d=(0,ie.useRef)(null);return(0,ie.useEffect)(()=>{a(jKe)},[e]),(0,ie.useEffect)(()=>{const p=d.current;if(!p)return;const h=new IntersectionObserver(f=>{f[0]?.isIntersecting&&a(m=>m<e.length?Math.min(e.length,m+jKe):m)},{rootMargin:"300px"});return h.observe(p),()=>h.disconnect()},[e.length,n]),(0,C.jsxs)(G.Box,{sx:{mt:1.5},children:[(0,C.jsx)(G.Box,{sx:{display:"grid",gridTemplateColumns:`repeat(${t}, minmax(0, 1fr))`,gap:.5},children:e.slice(0,n).map(p=>r(p))}),n<e.length&&(0,C.jsx)(G.Box,{ref:d,sx:{height:1}})]})}function Upo({items:e,category:t,loading:r,error:n,groupLabelKey:a,columns:d,virtualize:p,search:h,sort:f,onClick:m,onRename:v,onDelete:g}){const{t:A}=Xt("inspector"),[y]=(0,ie.useState)([]),[S,x]=(0,ie.useState)({}),O=(0,ie.useMemo)(()=>({search:h,axes:[],tags:y,sort:f}),[h,y,f]),w=(0,ie.useMemo)(()=>om5(im5(e,O),f),[e,O,f]),E=(0,ie.useMemo)(()=>{const U=new Map;for(const I of w){const $=U.get(I.axis)??[];$.push(I),U.set(I.axis,$)}return Array.from(U.keys()).sort((I,$)=>I===gz?1:$===gz?-1:I.localeCompare($)).map(I=>({axis:I,items:U.get(I)??[]}))},[w]),L=E.length===0||E.length===1&&E[0].axis==="",H=U=>U===gz?A("componentsLibrary.drawer.usageOther","Other"):a?A(`${a}.${U}`,U):U,V=(U,I)=>p?(0,C.jsx)(pm5,{items:U,columns:d??2,renderItem:$=>(0,C.jsx)($po,{item:$,category:t,onClick:m,onRename:v,onDelete:g},$.id)}):(0,C.jsx)(G.Box,{sx:{display:"grid",gridTemplateColumns:d?`repeat(${d}, minmax(0, 1fr))`:"1fr",gap:.5},children:U.map($=>(0,C.jsx)($po,{item:$,category:t,onClick:m,onRename:v,onDelete:g},`${I}/${$.id}`))}),F=()=>n?(0,C.jsx)(G.Alert,{severity:"error",sx:{mt:1},children:n}):r&&e.length===0?(0,C.jsx)(lm5,{columns:d??2,count:4}):!r&&e.length===0?(0,C.jsx)(Af5,{icon:(0,C.jsx)(sSe,{}),title:A("componentsLibrary.drawer.emptyTitle","Your library is empty"),description:A("componentsLibrary.drawer.empty")}):(0,C.jsx)(G.Stack,{spacing:1,sx:{pt:.5},children:w.length===0?(0,C.jsx)(G.Typography,{variant:"body2",color:"text.secondary",sx:{mt:1},children:A("componentsLibrary.drawer.noResults","No components match your search.")}):L?V(w,"flat"):(0,C.jsx)(G.Box,{children:E.map((U,I)=>(0,C.jsx)(Hf5,{title:H(U.axis),count:U.items.length,expanded:S[U.axis]??I===0,onToggle:$=>x(Q=>({...Q,[U.axis]:$})),children:V(U.items,U.axis)},U.axis))})});return(0,C.jsx)(C.Fragment,{children:F()})}async function Wpo(e,t){const r=await fetch(e);if(!r.ok){const n=await r.json().catch(()=>null);throw r.status===403?new Error(n?.hint??"Endpoint disabled in this environment."):new Error(n?.error??`HTTP ${r.status}`)}return(await r.json())[t]??[]}function hm5({refreshKey:e,search:t,sort:r,onRename:n,onChange:a}){const{t:d}=Xt("inspector"),[p,h]=(0,ie.useState)([]),[f,m]=(0,ie.useState)(!1),[v,g]=(0,ie.useState)(null),A=(0,ie.useCallback)(async()=>{m(!0),g(null);try{if(ad()==="local"){h(q15("section"));return}const y=await Wpo(`${id()}/dev/sections`,"sections");h(y.map(S=>({...S,axis:S.role})))}catch(y){g(y instanceof Error?y.message:String(y))}finally{m(!1)}},[]);return(0,ie.useEffect)(()=>{A()},[A,e]),(0,C.jsx)(Upo,{items:p,category:"section",loading:f,error:v,columns:2,groupLabelKey:"componentsLibrary.sectionRole",search:t,sort:r,onRename:y=>n({category:"section",axis:y.axis,id:y.id,name:y.name,description:y.description,tags:y.tags}),onDelete:(0,ie.useCallback)(async y=>{if(window.confirm(d("componentsLibrary.drawer.deleteConfirm",'Delete component "{{name}}"? This cannot be undone.',{name:y.name})))try{if(ad()==="local")en5("section",y.id);else{const S=await fetch(`${id()}/dev/sections/${encodeURIComponent(y.axis)}/${encodeURIComponent(y.id)}`,{method:"DELETE"});if(!S.ok){const x=await S.json().catch(()=>null);throw new Error(x?.error??`HTTP ${S.status}`)}}h(S=>S.filter(x=>!(x.axis===y.axis&&x.id===y.id))),a()}catch(S){g(S instanceof Error?S.message:String(S))}},[d,a])})}function fm5({refreshKey:e,search:t,sort:r,onRename:n,onChange:a}){const[d,p]=(0,ie.useState)([]),[h,f]=(0,ie.useState)(!1),[m,v]=(0,ie.useState)(null),[g,A]=(0,ie.useState)(null),{t:y}=Xt("inspector"),S=(0,ie.useCallback)(async()=>{f(!0),v(null);try{if(ad()==="local"){p(W15().map(O=>({...O,axis:gz})));return}const x=await Wpo(`${id()}/dev/templates`,"templates");p(x.map(O=>({...O,axis:O.usage||gz})))}catch(x){v(x instanceof Error?x.message:String(x))}finally{f(!1)}},[]);return(0,ie.useEffect)(()=>{S()},[S,e]),(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(Upo,{items:d,category:"template",loading:h,error:m,columns:2,virtualize:!0,search:t,sort:r,onClick:A,onRename:x=>n({category:"template",axis:"",id:x.id,name:x.name,description:x.description,tags:x.tags}),onDelete:(0,ie.useCallback)(async x=>{if(window.confirm(y("componentsLibrary.drawer.deleteConfirm","Delete?",{name:x.name})))try{if(ad()==="local")K15(x.id);else{const O=await fetch(`${id()}/dev/templates/${encodeURIComponent(x.id)}`,{method:"DELETE"});if(!O.ok){const w=await O.json().catch(()=>null);throw new Error(w?.error??`HTTP ${O.status}`)}}p(O=>O.filter(w=>w.id!==x.id)),a()}catch(O){v(O instanceof Error?O.message:String(O))}},[y,a])}),(0,C.jsx)(bf5,{templateId:g?.id??null,templateName:g?.name??"",onClose:()=>A(null),onApplied:()=>A(null)})]})}function mm5(){const e=B4e(),t=e?380:64,r=aO(),n=sO(),a=qyt(),d=xIo(),{t:p}=Xt("inspector"),h=(0,G.useTheme)(),f=(0,ie.useMemo)(()=>dm5.filter(Q=>!(!a&&Q.key==="templates")),[a]),[m,v]=(0,ie.useState)(0),[g,A]=(0,ie.useState)(0),[y,S]=(0,ie.useState)(null),[x,O]=(0,ie.useState)(""),[w,E]=(0,ie.useState)("updatedDesc"),[L,H]=(0,ie.useState)(null),[V,F]=(0,ie.useState)(()=>f[0]?.key??"blocks");(0,ie.useEffect)(()=>{f.some(Q=>Q.key===V)||F(f[0]?.key??"blocks")},[f,V]),(0,ie.useEffect)(()=>{d!==0&&(v(Q=>Q+1),A(Q=>Q+1),Npo())},[d]);const U=()=>{Bpo(),bF(!1)},I=()=>{v(Q=>Q+1),A(Q=>Q+1),Npo()},$=(0,ie.useCallback)(Q=>{switch(Q){case"section":v(K=>K+1);break;case"template":A(K=>K+1);break}},[]);return!r||n!=="editor"?null:(0,C.jsxs)(G.Box,{sx:{position:"absolute",top:0,left:0,bottom:0,zIndex:10,width:t,flexShrink:0,overflow:"hidden",transition:"width 220ms cubic-bezier(0.4, 0, 0.2, 1)",backgroundColor:h.palette.background.paper,borderRight:`1px solid ${h.palette.divider}`,display:"flex",flexDirection:"column",pointerEvents:"auto"},children:[(0,C.jsx)(G.Box,{sx:{width:t,height:"100%",display:"flex",flexDirection:"column"},children:e?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(G.Stack,{direction:"row",sx:{px:1.5,py:1,borderBottom:`1px solid ${h.palette.divider}`,alignItems:"center",justifyContent:"space-between"},children:[(0,C.jsx)(G.Typography,{variant:"subtitle2",children:p("componentsLibrary.drawer.title")}),(0,C.jsxs)(G.Stack,{direction:"row",spacing:.5,children:[(0,C.jsx)(G.Tooltip,{title:p("componentsLibrary.drawer.refresh"),children:(0,C.jsx)(G.IconButton,{size:"small",onClick:I,children:(0,C.jsx)(Hze,{fontSize:"small"})})}),(0,C.jsx)(G.Tooltip,{title:p("componentsLibrary.drawer.close"),children:(0,C.jsx)(G.IconButton,{size:"small",onClick:U,children:(0,C.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,C.jsx)("polyline",{points:"11 17 6 12 11 7"}),(0,C.jsx)("polyline",{points:"18 17 13 12 18 7"})]})})})]})]}),(0,C.jsx)(G.Box,{sx:{px:1.5,borderBottom:`1px solid ${h.palette.divider}`},children:(0,C.jsx)(G.Tabs,{value:V,onChange:(Q,K)=>F(K),variant:"fullWidth",slotProps:{indicator:{sx:{height:"3px",borderRadius:"4px"}}},sx:{minHeight:40},children:f.map(Q=>(0,C.jsx)(G.Tab,{value:Q.key,label:p(Q.labelKey),sx:{minHeight:40,minWidth:0,px:1,fontSize:"0.72rem",textTransform:"none"}},Q.key))})}),(0,C.jsxs)(G.Box,{sx:{flex:1,minHeight:0,overflowY:"auto",px:1.5,pb:2,pt:1},children:[V==="blocks"&&(0,C.jsx)(kf5,{}),V==="sections"&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(G.Box,{sx:{pb:1.5},children:(0,C.jsxs)(G.Stack,{direction:"row",spacing:.5,sx:{alignItems:"center"},children:[(0,C.jsx)(G.TextField,{size:"small",fullWidth:!0,value:x,onChange:Q=>O(Q.target.value),placeholder:p("componentsLibrary.search.placeholder","Search…"),sx:g5,slotProps:{input:{startAdornment:(0,C.jsx)(G.InputAdornment,{position:"start",children:(0,C.jsx)(_Ee,{fontSize:"small"})})}}}),(0,C.jsx)(G.Tooltip,{title:p("componentsLibrary.search.sortLabel","Sort"),children:(0,C.jsx)(G.IconButton,{size:"small",onClick:Q=>H(Q.currentTarget),sx:{flexShrink:0,color:L?"primary.main":"text.secondary"},children:(0,C.jsx)(zHe,{fontSize:"small"})})}),(0,C.jsx)(G.Menu,{anchorEl:L,open:!!L,onClose:()=>H(null),anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:am5.map(Q=>(0,C.jsx)(G.MenuItem,{selected:w===Q,onClick:()=>{E(Q),H(null)},sx:{fontSize:"0.8rem"},children:p(`componentsLibrary.search.sort.${Q}`,Q)},Q))})]})}),(0,C.jsx)(hm5,{search:x,sort:w,onRename:S,refreshKey:m,onChange:()=>v(Q=>Q+1)})]}),V==="templates"&&(0,C.jsx)(fm5,{search:x,sort:w,onRename:S,refreshKey:g,onChange:()=>A(Q=>Q+1)})]})]}):(0,C.jsx)(Df5,{})}),(0,C.jsx)(_f5,{target:y,onClose:()=>S(null),onRenamed:()=>{y&&$(y.category),S(null)}}),(0,C.jsx)(nm5,{})]})}dr(),zF(),Lr();function vm5(){const e=B4e(),t=aO(),r=sO(),{t:n}=Xt("inspector");return!t||r!=="editor"?null:(0,C.jsx)(G.Box,{sx:{position:"absolute",left:e?380:64,top:"50%",transform:"translateY(-50%)",zIndex:10,transition:"left 220ms cubic-bezier(0.4, 0, 0.2, 1)"},children:(0,C.jsx)(G.Tooltip,{title:n(e?"componentsLibrary.drawer.handleClose":"componentsLibrary.drawer.handleOpen"),placement:"right",children:(0,C.jsxs)(G.ButtonBase,{onClick:DIo,"aria-label":n(e?"componentsLibrary.drawer.handleClose":"componentsLibrary.drawer.handleOpen"),sx:a=>({width:28,minHeight:96,borderTopRightRadius:8,borderBottomRightRadius:8,backgroundColor:e?a.palette.secondary.main:a.palette.background.paper,color:e?a.palette.secondary.contrastText:a.palette.text.primary,border:`1px solid ${a.palette.divider}`,borderLeft:"none",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:.75,py:1,boxShadow:"2px 0 8px rgba(0,0,0,0.06)",transition:"background-color 120ms ease, color 120ms ease","&:hover":{backgroundColor:e?a.palette.secondary.dark:a.palette.mode==="dark"?a.palette.grey[800]:a.palette.grey[200]}}),children:[(0,C.jsx)(OO,{sx:{fontSize:18}}),(0,C.jsx)(G.Box,{sx:{writingMode:"vertical-rl",transform:"rotate(180deg)",fontSize:"0.7rem",fontWeight:600,letterSpacing:"0.04em",textTransform:"uppercase"},children:n("componentsLibrary.drawer.handle")})]})})})}var Gpo=(0,ie.createContext)(!1),_m5=Gpo.Provider,fd=()=>(0,ie.useContext)(Gpo);Lr();function bz(e,t){yF(e,t)}function Az(e,t){bz(e,r=>{const n=r.data&&"props"in r.data?r.data.props:void 0,a={...n!==null&&typeof n=="object"?n:{}},d=typeof t=="function"?t(a):t,p={...a,...typeof d=="object"&&d!==null?d:{}};return a===p?r:{...r,data:{...r.data,props:p}}})}oi(),Lr();var Qpo=(0,ie.createContext)(null),QX=()=>(0,ie.useContext)(Qpo),YX=(0,ie.memo)(function({id:t,isNotClient:r}){const n=Ke(h=>h.document[t]),a=Ke(h=>h.document?.root?.data?.theme),d=ll(),p=(0,ie.useMemo)(()=>n?XH(n,a,d,Sz[n.type]):void 0,[n,a,d]);return p?(0,C.jsx)(Qpo.Provider,{value:t,children:(0,C.jsx)(Bm5,{isNotClient:r,...p,blockId:t})}):(console.warn(`Block ${t} not found`),null)},(e,t)=>e.id===t.id&&e.isNotClient===t.isNotClient);dr(),Lr();function Um({childrenIds:e,onChange:t,parentId:r,position:n,isNotClient:a}){const{t:d}=Xt(),[{isOver:p},h]=GE(()=>({accept:["block",k4],drop:(m,v)=>{if(v.getItemType()==="library-component"){if(v.didDrop()){v.getDropResult();return}if(m.category==="block"&&typeof m.buttonIndex=="number"){const y=Lp[m.buttonIndex];if(!y)return;rv(r,y.block(),n);return}if(m.category==="block-preset"&&typeof m.presetIndex=="number"){const y=NX[m.presetIndex];if(!y)return;rv(r,y.block,n);return}const A=m;if(A.category==="template"){console.warn("[ComponentsLibrary] templates cannot be dropped inline; click the card in the drawer to apply.");return}(async()=>{try{oSt(r,(await BX(A.category,A.axis,A.id)).blocks,n)}catch(y){console.error("[ComponentsLibrary] failed to append saved subtree",y)}})();return}const g=m.blockId;if(v.didDrop()){v.getDropResult();return}return n===void 0?vBo({parentId:r,blockId:g}):mBo({parentId:r,blockId:g,indexArray:n})},canDrop:(m,v)=>{if(v.getItemType()==="library-component")return!0;const g=m.blockId;return!tv({targetId:r,draggedId:g})&&g!==r},collect:m=>({isOver:m.canDrop()?!!m.isOver():!1})}),[r,n]),f=e&&e.length>0?(0,C.jsx)(G.Box,{ref:m=>{h(m)},sx:{minHeight:0,border:p?"2px solid":"",borderColor:p?"secondary.main":void 0},"aria-hidden":!0}):null;return a?e.map(m=>(0,C.jsx)(ie.Fragment,{children:(0,C.jsx)(YX,{id:m,isNotClient:a})},m)):!e||e.length===0?(0,C.jsx)(G.Box,{ref:m=>{h(m)},sx:{minHeight:96,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:1,border:p?"2px solid":"1px dashed",borderColor:p?"secondary.main":"divider",backgroundImage:m=>`repeating-linear-gradient(45deg, ${m.palette.action.hover} 0, ${m.palette.action.hover} 1px, transparent 1px, transparent 12px)`,backgroundColor:p?"action.hover":"transparent",transition:"background-color 120ms ease, border-color 120ms ease"},children:(0,C.jsxs)(G.Stack,{spacing:.75,sx:{px:2,color:"text.secondary",alignItems:"center"},children:[(0,C.jsx)(YFe,{sx:{fontSize:22,opacity:.7}}),(0,C.jsx)(G.Typography,{variant:"body2",color:"text.secondary",sx:{textAlign:"center"},children:d("editor.emptyCanvasDropHint","Drag a block here from the library")})]})}):(0,C.jsxs)(C.Fragment,{children:[e.map(m=>(0,C.jsx)(ie.Fragment,{children:(0,C.jsx)(YX,{id:m})},m)),f]})}oi();var MKe=zT;iQe(),EX(),Lr();var gm5=[{childrenIds:[]},{childrenIds:[]},{childrenIds:[]}];function bm5({style:e,props:t,blockId:r,isNotClient:n}){const a=QX(),{columns:d,...p}=t??{},h=d??gm5,f=(m,{block:v,blockId:g,childrenIds:A})=>{const y=Ke.getState().document[a],S=y?.data?.props?.columns??h,x=y?.data?.props?{...y.data.props}:{...p};delete x.columns;const O=S.length===2?[...S,{childrenIds:[]}]:[...S];O[m]={childrenIds:A};const w={...x,fixedWidths:x.fixedWidths?.length===2?[...x.fixedWidths,null]:x.fixedWidths},E={type:"ColumnsContainer",data:MKe.parse({style:y?.data?.style??e,props:{...w,columns:O}})};yBo({[g]:v,[a]:E}),s2(g)};return n?(0,C.jsx)(C.Fragment,{children:(0,C.jsx)(nQe,{blockId:r,props:p,style:e,columns:[(0,C.jsx)(Um,{isNotClient:n,parentId:r,position:0,childrenIds:d?.[0]?.childrenIds,onChange:m=>f(0,m)}),(0,C.jsx)(Um,{isNotClient:n,parentId:r,position:1,childrenIds:d?.[1]?.childrenIds,onChange:m=>f(1,m)}),(0,C.jsx)(Um,{isNotClient:n,parentId:r,position:2,childrenIds:d?.[2]?.childrenIds,onChange:m=>f(2,m)})]})}):(0,C.jsx)(PX,{children:(0,C.jsx)(nQe,{blockId:r,props:p,style:e,columns:[(0,C.jsx)(Um,{parentId:r,position:0,childrenIds:d?.[0]?.childrenIds,onChange:m=>f(0,m)}),(0,C.jsx)(Um,{parentId:r,position:1,childrenIds:d?.[1]?.childrenIds,onChange:m=>f(1,m)}),(0,C.jsx)(Um,{parentId:r,position:2,childrenIds:d?.[2]?.childrenIds,onChange:m=>f(2,m)})]})})}function Am5({childrenIds:e}){return(0,C.jsx)(C.Fragment,{children:e.map(t=>(0,C.jsx)(ie.Fragment,{children:(0,C.jsx)(YX,{isNotClient:!0,id:t})},t))})}lQe(),EX(),Lr();function ym5({style:e,props:t,blockId:r,isNotClient:n}){const a=t?.childrenIds??[],d=QX();return(0,C.jsx)(Nso,{style:e,blockId:`${r}`,children:n?(0,C.jsx)(Am5,{parentId:r,childrenIds:a,onChange:({block:p,blockId:h,childrenIds:f})=>{U4e(d,h,p,f),s2(h)}}):(0,C.jsx)(PX,{children:(0,C.jsx)(Um,{parentId:r,childrenIds:a,onChange:({block:p,blockId:h,childrenIds:f})=>{U4e(d,h,p,f),s2(h)}})})})}oi();var Ypo=JH;v5(),EX(),Lr(),hA();function Sm5(e){const t=e.childrenIds??[],r=QX(),n=ll();return(0,C.jsx)("div",{onClick:()=>{s2(null)},style:{backgroundColor:e.backdropColor??"#F5F5F5",color:e.textColor??"#262626",fontFamily:Nao(e?.fontFamily||"OPEN_SANS"),fontSize:"16px",fontWeight:"400",letterSpacing:"0.15008px",lineHeight:"1.5",margin:"0",width:"100%"},children:(0,C.jsx)("table",{role:"presentation",align:"center",width:"100%",style:{margin:"0 auto",maxWidth:n==="desktop"?600:370,backgroundColor:e.canvasColor??"#FFFFFF",borderRadius:e.borderRadius??void 0,border:(()=>{const a=e.borderColor;if(a)return`1px solid ${a}`})()},cellSpacing:"0",cellPadding:"0",border:0,children:(0,C.jsx)("tbody",{children:(0,C.jsx)("tr",{style:{width:"100%"},children:(0,C.jsx)("td",{"data-value":"__content",children:(0,C.jsx)(PX,{children:(0,C.jsx)(Um,{listEndPolicy:"root",parentId:r,childrenIds:t,onChange:({block:a,blockId:d,childrenIds:p})=>{U4e(r,d,a,p),s2(d)}})})})})})})})}oi();var Kpo=A2e;dr(),Lr();var Tm5=e=>t=>({position:"absolute",...e?{top:"100%",right:0,marginTop:"8px",flexDirection:"row",width:"auto"}:{top:0,right:"-3rem",flexDirection:"column",width:"2.5rem"},borderRadius:"8px!important",zIndex:"90 !important;",boxShadow:"0px 4px 6px rgba(0, 0, 0, 0.1)",border:"1px solid",borderColor:t.palette.secondary.main,padding:"1px",display:"flex",alignItems:"center",justifyContent:"center"}),uy=null;function xm5({blockId:e}){const t=Jyt(e),{t:r}=Xt("inspector"),{t:n}=Xt(),a=Yyt(),d=SIo(),p=a&&d!=="local",[h,f]=(0,ie.useState)(!1),m=(0,ie.useMemo)(()=>{if(!t||t.type==="EmailLayout")return!1;try{const E=Ke.getState().document;return teo(e,E)==="section"}catch{return!1}},[t,e]),v=uy&&uy.blockType===t?.type,g=(0,ie.useRef)(null),[A,y]=(0,ie.useState)(!1);(0,ie.useEffect)(()=>{const E=()=>{if(!g.current)return;const H=g.current.parentElement;if(!H)return;const V=H.getBoundingClientRect(),F=H.closest(".preview-container");F&&(F.getBoundingClientRect().right-V.right<48?y(!0):y(!1))};E(),window.addEventListener("resize",E),window.addEventListener("scroll",E,!0);const L=setTimeout(E,100);return()=>{window.removeEventListener("resize",E),window.removeEventListener("scroll",E,!0),clearTimeout(L)}},[e]);const S=(0,ie.useCallback)(()=>{const E=Ke.getState().document,L=Ke.getState().notionTextInlineEditingBlockId,H=(I,$,Q=new Set)=>{if(Q.has(I))return;Q.add(I);const K=$[I];K&&(K.type==="Container"&&(K.data?.props?.childrenIds||[]).forEach(Y=>H(Y,$,Q)),K.type==="ColumnsContainer"&&(K.data?.props?.columns||[]).forEach(Y=>{(Y.childrenIds||[]).forEach(ee=>H(ee,$,Q))}))},V=new Set;H(e,E,V),V.add(e);const F=I=>I&&I.filter($=>!V.has($)),U={...E};for(const[I,$]of Object.entries(U)){if(V.has(I))continue;const Q=$;switch(Q.type){case"EmailLayout":U[I]={...Q,data:{...Q.data,childrenIds:F(Q.data.childrenIds)}};break;case"Container":U[I]={...Q,data:{...Q.data,props:{...Q.data.props,childrenIds:F(Q.data.props?.childrenIds)}}};break;case"ColumnsContainer":U[I]={...Q,data:{...Q.data,props:{...Q.data.props,columns:Q.data.props?.columns?.map(K=>({...K,childrenIds:F(K.childrenIds)}))}}};break;default:U[I]=Q}}for(const I of V)delete U[I];L&&(L===e||V.has(L))&&lO(null),Jf(U),s2(null)},[e]),x=(0,ie.useCallback)(()=>{t&&"style"in t.data&&t.data.style&&(uy={styles:JSON.parse(JSON.stringify(t.data.style)),blockType:t.type})},[t]),O=(0,ie.useCallback)(()=>{const E=Ke.getState().document;if(!uy||uy.blockType!==t?.type)return;const L={...E},H=L[e];H&&(L[e]={...H,data:{...H.data,style:JSON.parse(JSON.stringify(uy.styles))}},Jf(L),s2(e))},[e,t]),w=(0,ie.useCallback)(()=>{ABo(e)},[e]);return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(G.Paper,{ref:g,sx:Tm5(A),onClick:E=>E.stopPropagation(),elevation:10,children:[(0,C.jsx)(G.Tooltip,{title:r("actions.copyFormat"),placement:"left-start",children:(0,C.jsx)("span",{children:(0,C.jsx)(G.IconButton,{onClick:x,sx:{padding:"4px",overflow:"hidden",color:"text.primary"},disabled:!(t&&"style"in t.data&&t.data.style),children:(0,C.jsxs)("svg",{width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,C.jsx)("path",{d:"M12 22.5C6.49 22.5 2 18.01 2 12.5C2 6.99 6.49 2.5 12 2.5C17.51 2.5 22 6.54 22 11.5C22 14.81 19.31 17.5 16 17.5H14.23C13.95 17.5 13.73 17.72 13.73 18C13.73 18.12 13.78 18.23 13.86 18.33C14.27 18.8 14.5 19.39 14.5 20C14.5 21.38 13.38 22.5 12 22.5ZM12 4.5C7.59 4.5 4 8.09 4 12.5C4 16.91 7.59 20.5 12 20.5C12.28 20.5 12.5 20.28 12.5 20C12.5 19.84 12.42 19.72 12.36 19.65C11.95 19.19 11.73 18.6 11.73 18C11.73 16.62 12.85 15.5 14.23 15.5H16C18.21 15.5 20 13.71 20 11.5C20 7.64 16.41 4.5 12 4.5Z",fill:"currentColor"}),(0,C.jsx)("path",{d:"M6.5 13.5C7.32843 13.5 8 12.8284 8 12C8 11.1716 7.32843 10.5 6.5 10.5C5.67157 10.5 5 11.1716 5 12C5 12.8284 5.67157 13.5 6.5 13.5Z",fill:"currentColor"}),(0,C.jsx)("path",{d:"M9.5 9.5C10.3284 9.5 11 8.82843 11 8C11 7.17157 10.3284 6.5 9.5 6.5C8.67157 6.5 8 7.17157 8 8C8 8.82843 8.67157 9.5 9.5 9.5Z",fill:"currentColor"}),(0,C.jsx)("path",{d:"M14.5 9.5C15.3284 9.5 16 8.82843 16 8C16 7.17157 15.3284 6.5 14.5 6.5C13.6716 6.5 13 7.17157 13 8C13 8.82843 13.6716 9.5 14.5 9.5Z",fill:"currentColor"}),(0,C.jsx)("path",{d:"M17.5 13.5C18.3284 13.5 19 12.8284 19 12C19 11.1716 18.3284 10.5 17.5 10.5C16.6716 10.5 16 11.1716 16 12C16 12.8284 16.6716 13.5 17.5 13.5Z",fill:"currentColor"})]})})})}),(0,C.jsx)(G.Tooltip,{title:r(v?"actions.pasteFormatting":"actions.noFormatSupported"),placement:"left-start",children:(0,C.jsx)("span",{children:(0,C.jsx)(G.IconButton,{onClick:O,sx:{padding:"4px",overflow:"hidden",color:v?"text.primary":"text.disabled"},disabled:!v,children:(0,C.jsx)("svg",{width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,C.jsx)("path",{d:"M10.9551 22.6497C10.5139 22.6497 10.1287 22.4888 9.79934 22.167C9.47017 21.8451 9.30559 21.4582 9.30559 21.0062V16.1317H5.54784C5.09367 16.1317 4.69725 15.9624 4.35859 15.6237C4.01992 15.2851 3.85059 14.8886 3.85059 14.4345V7.10448C3.85059 6.07631 4.21 5.19264 4.92884 4.45348C5.6475 3.71431 6.52667 3.34473 7.56634 3.34473H19.2978C19.5378 3.34473 19.7408 3.42773 19.9066 3.59373C20.0726 3.75956 20.1556 3.96248 20.1556 4.20248V14.4345C20.1556 14.8886 19.9871 15.2851 19.6501 15.6237C19.3131 15.9624 18.9138 16.1317 18.4523 16.1317H14.7006V21.0062C14.7006 21.4582 14.536 21.8451 14.2068 22.167C13.8775 22.4888 13.4923 22.6497 13.0511 22.6497H10.9551ZM5.54784 10.6145H18.4523V5.04798H17.0463V8.41773C17.0463 8.63189 16.9744 8.81139 16.8306 8.95623C16.6869 9.10106 16.5063 9.17348 16.2888 9.17348C16.0715 9.17348 15.8924 9.10106 15.7516 8.95623C15.6108 8.81139 15.5403 8.63189 15.5403 8.41773V5.04798H13.7533V6.40148C13.7533 6.61814 13.6815 6.79789 13.5378 6.94073C13.394 7.08373 13.2134 7.15523 12.9961 7.15523C12.7786 7.15523 12.5994 7.08373 12.4586 6.94073C12.3178 6.79789 12.2473 6.61814 12.2473 6.40148V5.04798H7.56634C6.97717 5.04798 6.4935 5.24764 6.11534 5.64698C5.737 6.04631 5.54784 6.53214 5.54784 7.10448V10.6145ZM5.54784 14.4345H18.4523V12.0965H5.54784V14.4345Z",fill:"currentColor"})})})})}),(0,C.jsx)(G.Tooltip,{title:n("editor.cloneBlock"),placement:"left-start",children:(0,C.jsx)(G.IconButton,{onClick:w,sx:{padding:"4px",overflow:"hidden",color:"text.primary"},children:(0,C.jsx)(qe.ContentCopy,{sx:{fontSize:"1.25rem"}})})}),(0,C.jsx)(G.Tooltip,{title:r("actions.delete"),placement:"left-start",children:(0,C.jsx)(G.IconButton,{onClick:S,sx:{overflow:"hidden",color:"error.main",padding:"4px"},children:(0,C.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",children:(0,C.jsx)("path",{d:"M16 9.5V19.5H8V9.5H16ZM14.5 3.5H9.5L8.5 4.5H5V6.5H19V4.5H15.5L14.5 3.5ZM18 7.5H6V19.5C6 20.6 6.9 21.5 8 21.5H16C17.1 21.5 18 20.6 18 19.5V7.5Z",fill:"currentColor"})})})}),p&&(0,C.jsx)(G.Tooltip,{title:r("componentsLibrary.save.tooltip"),placement:"left-start",children:(0,C.jsx)("span",{children:(0,C.jsx)(G.IconButton,{onClick:()=>f(!0),disabled:!m,sx:{padding:"4px",overflow:"hidden",color:m?"text.primary":"text.disabled"},"aria-label":r("componentsLibrary.save.button"),children:(0,C.jsx)(ume,{sx:{fontSize:"1.25rem"}})})})})]}),p&&h&&m&&(0,C.jsx)(hf5,{open:h,rootBlockId:e,onClose:()=>f(!1)})]})}var Cm5=(0,ie.memo)(xm5);dr(),nl(),Lr();var qpo=150,Om5=25,yz=null,KX=null;function RKe(){yz&&(clearTimeout(yz),yz=null),KX=null}function Jpo(e){KX===e&&RKe()}function wm5(e,t,r,n){RKe(),KX=e,yz=setTimeout(()=>{yz=null,KX=null,r()&&(_F(e),n())},t)}function jm5(e){const t=e.closest(".preview-container");if(!t)return qpo;let r=0,n=e;for(;n&&t.contains(n)&&(n.hasAttribute("data-block-id")&&(r+=1),n!==t);)n=n.parentElement;return qpo+Math.max(0,r-1)*Om5}function Mm5(e){const t=oO();return(0,ie.useMemo)(()=>t?tv({draggedId:e,targetId:t}):!1,[e,t])}function Rm5(e){if(!e||typeof e.nodeType!="number")return null;const t=e,r=t.closest?.(".preview-container");if(!r)return null;const n=t.closest?.("[data-block-id]"),a=n?.getAttribute("data-block-id")??null;return!a||!n||!r.contains(n)?null:a}function zm5({children:e,canEdit:t=!0,isNotClient:r=!1}){const n=QX(),{t:a}=Xt(),d=RIo(),p=MIo(n),h=jIo(n),f=sO(),m=oO(),v=PIo();EIo();const g=Mm5(n),[A,y]=(0,ie.useState)(!1),[S,x]=(0,ie.useState)(0),O=(0,ie.useRef)(null),w=(0,ie.useRef)(null),[E,L]=(0,ie.useState)(null),H=Na(),V=zIo(),F=m===n||g,U=v===n,I=H.palette.primary.light||H.palette.primary.main,$=(0,ie.useRef)(null),Q=(0,ie.useRef)(!0);if(r)return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)("div",{style:{width:"100%"}}),(0,C.jsx)(G.Box,{sx:{position:"relative",maxWidth:"100%"},children:(0,C.jsx)("div",{children:e})}),(0,C.jsx)("div",{style:{width:"100%"}})]});let K,Y;U&&t?(K=`2px solid ${I}`,Y="10"):p&&t?(K=`2px solid ${H.palette.secondary.main}`,Y="1"):A&&t?K=`2px dotted ${H.palette.secondary.main}`:Y="auto";const ee=()=>!p||!t?null:(0,C.jsx)(Cm5,{blockId:n}),re=ve=>{const ge=ve.getClientOffset(),_e=O.current?.getBoundingClientRect(),je=w.current?.getBoundingClientRect();return!ge||!_e||!je?null:Math.abs(ge.y-_e.y)<Math.abs(ge.y-je.y)?"up":"down"},[{isOver:oe},le]=GE(()=>({accept:["block",k4],drop:(ve,ge)=>{if(ge.getItemType()==="library-component"){if(ge.didDrop()){ge.getDropResult();return}if(ve.category==="block"&&typeof ve.buttonIndex=="number"){const ye=Lp[ve.buttonIndex];if(!ye)return;re(ge)==="up"?sSt(n,ye.block()):lSt(n,ye.block());return}if(ve.category==="block-preset"&&typeof ve.presetIndex=="number"){const ye=NX[ve.presetIndex];if(!ye)return;re(ge)==="up"?sSt(n,ye.block):lSt(n,ye.block);return}const Me=ve;if(Me.category==="template"){console.warn("[ComponentsLibrary] templates cannot be dropped inline; click the card in the drawer to apply.");return}const He=re(ge)==="up"?"before":"after";(async()=>{try{const ye=await BX(Me.category,Me.axis,Me.id);He==="after"?aSt(n,ye.blocks):iSt(n,ye.blocks)}catch(ye){console.error("[ComponentsLibrary] failed to insert saved subtree",ye)}})();return}const _e=n,je=ve.blockId;if(_e===je)return;if(ge.didDrop()){ge.getDropResult();return}const Fe=re(ge);if(Fe)pO(_e,je,Fe);else{pO(_e,je,"down");return}},canDrop:(ve,ge)=>ge.getItemType()==="library-component"?!0:!tv({targetId:n,draggedId:ve.blockId}),collect:ve=>({isOver:ve.canDrop()?ve.isOver({shallow:!0}):!1}),hover:(ve,ge)=>{if(ge.getItemType()==="library-component"){if(!ge.canDrop()||!ge.isOver({shallow:!0})){L(null);return}const je=re(ge);L(je??null);return}if(ve.blockId===n){L(null);return}if(!ge.canDrop()||!ge.isOver({shallow:!0})){L(null);return}const _e=re(ge);if(!_e){L(null);return}L(_e)},end:()=>{L(null)}}));(0,ie.useEffect)(()=>{oe||L(null)},[oe]);const X=()=>(0,C.jsxs)("div",{style:{height:"3px",background:H.palette.secondary.main,position:"relative",color:H.palette.secondary.main},children:[(0,C.jsx)("svg",{style:{position:"absolute",left:"-25px",top:"50%",transform:"translateY(-50%)"},width:"20",height:"20",viewBox:"0 0 32 32",children:(0,C.jsx)("path",{fill:"currentColor",d:"M28 12H10a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h18a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2M10 4v6h18V4zm18 26H10a2 2 0 0 1-2-2v-6a2 2 0 0 1 2-2h18a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2m-18-8v6h18v-6zm-1-6l-5.586-5.586L2 11.828L6.172 16L2 20.172l1.414 1.414z"})}),(0,C.jsx)("svg",{style:{position:"absolute",right:"-25px",top:"50%",transform:"translateY(-50%) scaleX(-1)"},width:"20",height:"20",viewBox:"0 0 32 32",children:(0,C.jsx)("path",{fill:"currentColor",d:"M28 12H10a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h18a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2M10 4v6h18V4zm18 26H10a2 2 0 0 1-2-2v-6a2 2 0 0 1 2-2h18a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2m-18-8v6h18v-6zm-1-6l-5.586-5.586L2 11.828L6.172 16L2 20.172l1.414 1.414z"})})]}),[{borderDrag:se="",isDragging:Ae},ze]=X9(()=>({type:"block",item:()=>{const ve=Ke.getState().notionTextInlineEditingBlockId;return ve&&window.dispatchEvent(new CustomEvent("notion-text-force-save",{detail:{blockId:ve}})),{blockId:n}},canDrag:!F,collect:ve=>({borderDrag:ve.isDragging()?"2px dotted yellow":"",isDragging:ve.isDragging()}),end:()=>{x(Date.now())}}),[F,n])||[{borderDrag:"",isDragging:!1},ie.useRef(null)],pe=t&&f!=="preview"&&!F&&!V&&(Ae||d===n||d==null&&p);(0,ie.useEffect)(()=>(Q.current=!0,()=>{Q.current=!1,Jpo(n),$.current&&(clearTimeout($.current),$.current=null),Ke.getState().canvasHoveredBlockId===n&&_F(null)}),[n]);const Z=ve=>{const ge=Date.now()-S;if(!(Ae||S>0&&ge<200)&&(ve.stopPropagation(),f!=="preview")){if(h==="NotionText"){const _e=new CustomEvent("email-builder-highlight-editor",{detail:!0});window.dispatchEvent(_e)}s2(n)}},be=ie.useMemo(()=>ie.cloneElement(e,{onClick:ve=>{e.props.onClick&&e.props.onClick(ve),!ve.defaultPrevented&&!ve.isPropagationStopped()&&(Ae||Z(ve))},onMouseDown:ve=>{e.props.onMouseDown&&e.props.onMouseDown(ve)},onMouseUp:ve=>{e.props.onMouseUp&&e.props.onMouseUp(ve)}}),[e,Ae,n,h,f]);return(0,C.jsxs)(C.Fragment,{children:[E==="up"&&(0,C.jsx)(X,{}),(0,C.jsx)("div",{ref:O,style:{width:"100%"}}),(0,C.jsx)(G.Box,{"data-block-id":n,sx:{position:"relative",maxWidth:"100%"},ref:le,onMouseEnter:ve=>{ve.stopPropagation(),RKe(),$.current&&(clearTimeout($.current),$.current=null);const ge=jm5(ve.currentTarget);wm5(n,ge,()=>Q.current,()=>y(!0))},onMouseLeave:ve=>{Jpo(n),$.current&&clearTimeout($.current);const ge=ve.relatedTarget;$.current=setTimeout(()=>{if(y(!1),Ke.getState().canvasHoveredBlockId!==n)return;const _e=Rm5(ge);_F(_e&&_e!==n?_e:null)},150)},onClick:Z,children:(0,C.jsxs)(G.Box,{sx:{position:"relative",maxWidth:"100%",outlineOffset:"-1px",outline:K,zIndex:Y,transition:"outline 0.2s ease-in-out, z-index 0.2s ease-in-out"},children:[ee(),pe?(0,C.jsx)(G.Box,{sx:{position:"absolute",left:"50%",top:-20,transform:"translateX(-50%)",zIndex:10,display:"flex",flexDirection:"row",alignItems:"center",borderRadius:"6px 6px 0 0",overflow:"hidden",backgroundColor:U&&t?I:H.palette.secondary.main},children:(0,C.jsx)(G.Tooltip,{title:a("editor.dragBlockHandle"),placement:"top",children:(0,C.jsx)(G.IconButton,{ref:ze,type:"button","aria-label":a("editor.dragBlockHandle"),size:"small",onClick:ve=>ve.stopPropagation(),sx:{padding:"3px 6px",rotate:"90deg",borderRadius:0,color:"white",cursor:Ae?"grabbing":"grab",touchAction:"none","&:hover":{backgroundColor:"rgba(255,255,255,0.15)"}},children:(0,C.jsx)(qe.DragIndicator,{sx:{fontSize:15}})})})}):null,(0,C.jsx)(G.Fade,{in:U&&t,timeout:200,children:(0,C.jsx)(G.Chip,{label:a("editor.editing"),icon:(0,C.jsx)(qe.EditOutlined,{}),size:"small",sx:{position:"absolute",left:-1,top:-26,backgroundColor:I,color:"white",fontWeight:600,fontSize:"0.75rem",zIndex:-1,boxShadow:"0 2px 8px rgba(0,0,0,0.15)","& .MuiChip-icon":{color:"white",fontSize:"1rem"}}})}),(0,C.jsx)("div",{style:{border:se},children:be})]})}),E==="down"&&(0,C.jsx)(X,{}),(0,C.jsx)("div",{ref:w,style:{width:"100%"}})]})}var Wm=(0,ie.memo)(zm5,(e,t)=>e.children===t.children&&e.canEdit===t.canEdit&&e.isNotClient===t.isNotClient);mNe(),vNe(),Tq(),Eso(),tQe(),rQe(),oi(),Lr();var Pm5=(0,ie.memo)(kso),Em5=e=>{const t=ll(),r=D4e();return(0,C.jsx)(Pm5,{...e,selectedScreenSize:t,disableEdition:r})},km5=(0,ie.memo)(peo),Hm5=(0,ie.memo)(ym5),Lm5=(0,ie.memo)(bm5),Dm5=(0,ie.memo)(meo),Vm5=(0,ie.memo)(cc5),Fm5=(0,ie.memo)(Dso),Im5=(0,ie.memo)(feo),Zpo={SocialMedia:{schema:kZ,Component:e=>(0,C.jsx)(Wm,{isNotClient:e.isNotClient,children:(0,C.jsx)(Em5,{...e})})},Button:{schema:RT,Component:e=>(0,C.jsx)(Wm,{isNotClient:e.isNotClient,children:(0,C.jsx)(km5,{...e})})},Container:{schema:Ypo,Component:e=>(0,C.jsx)(Wm,{isNotClient:e.isNotClient,children:(0,C.jsx)(Hm5,{...e})})},ColumnsContainer:{schema:MKe,Component:e=>(0,C.jsx)(Wm,{isNotClient:e.isNotClient,children:(0,C.jsx)(Lm5,{...e})})},Image:{schema:h_,Component:e=>{const t={...e,props:{...e.props,url:e.props?.url??"https://placehold.co/600x400@2x/F8F8F8/CCC?text=Your%20image"}};return(0,C.jsx)(Wm,{isNotClient:e.isNotClient,children:(0,C.jsx)(Dm5,{...t})})}},NotionText:{schema:ZH,Component:e=>(0,C.jsx)(Wm,{isNotClient:e.isNotClient,children:(0,C.jsx)(Vm5,{blockId:e.blockId??"",...e})})},EmailLayout:{schema:Kpo,Component:e=>(0,C.jsx)(Sm5,{...e})},Spacer:{schema:kT,Component:e=>(0,C.jsx)(Wm,{isNotClient:e.isNotClient,children:(0,C.jsx)(Fm5,{...e})})},Divider:{schema:PT,Component:e=>(0,C.jsx)(Wm,{isNotClient:e.isNotClient,children:(0,C.jsx)(Im5,{...e})})}},Bm5=Xtt(Zpo),Sz=Object.fromEntries(Object.entries(Zpo).map(([e,t])=>[e,m_(t.schema)??{}])),Xpo=({tabs:e,defaultTab:t})=>{const r=(0,ie.useMemo)(()=>e.filter(p=>p.visible),[e]),[n,a]=(0,ie.useState)(null);if((0,ie.useEffect)(()=>{if(n&&r.some(h=>h.key===n))return;const p=t&&r.some(h=>h.key===t)?t:r[0]?.key??null;a(p)},[r,t,n]),r.length===0)return null;if(r.length===1)return(0,C.jsx)(G.Box,{children:r[0].render()});const d=r.find(p=>p.key===n)??r[0];return(0,C.jsxs)(G.Box,{children:[(0,C.jsx)(G.Tabs,{value:d.key,onChange:(p,h)=>a(h),variant:"scrollable",scrollButtons:!1,sx:{minHeight:34,mb:1.5,borderBottom:1,borderColor:"divider","& .MuiTabs-flexContainer":{gap:0},"& .MuiTab-root":{minHeight:34,minWidth:0,px:1.25,py:.5,fontSize:"0.72rem",fontWeight:500,textTransform:"none",color:"text.secondary","&.Mui-selected":{color:"primary.main"}}},children:r.map(p=>(0,C.jsx)(G.Tab,{value:p.key,label:p.label,disableRipple:!0},p.key))}),(0,C.jsx)(G.Box,{children:d.render()})]})};Gyt(),Lr();var Nm5={EmailLayout:{label:"Email",iconName:"DashboardOutlined"},NotionText:{label:"Text",iconName:"ArticleOutlined"},SocialMedia:{label:"Social",iconName:"Groups2"},Button:{label:"Button",iconName:"SmartButtonOutlined"},Image:{label:"Image",iconName:"ImageOutlined"},Divider:{label:"Divider",iconName:"HorizontalRuleOutlined"},Spacer:{label:"Spacer",iconName:"Crop32Outlined"},ColumnsContainer:{label:"Columns",iconName:"ViewColumnOutlined"},Container:{label:"Container",iconName:"LibraryAddOutlined"},Html:{label:"HTML",iconName:"CodeOutlined"}},$m5=e=>t=>t.document[e],Um5=e=>t=>{const r=t.document[e];if(!r)return[];switch(r.type){case"EmailLayout":return r.data?.childrenIds||[];case"Container":return r.data?.props?.childrenIds||[];case"ColumnsContainer":return r.data?.props?.columns?.flatMap(n=>n.childrenIds||[])||[];default:return[]}};function Wm5(e){if(!e)return[];switch(e.type){case"EmailLayout":return e.data?.childrenIds||[];case"Container":return e.data?.props?.childrenIds||[];case"ColumnsContainer":return e.data?.props?.columns?.flatMap(t=>t.childrenIds||[])||[];default:return[]}}function eho(e,t,r){const n=Wm5(e[t]);for(const a of n)if(a===r||eho(e,a,r))return!0;return!1}function Gm5(e,t,r,n){if(!n)return!1;const a=e[t];if(!a||a.type!=="ColumnsContainer")return!1;const d=a.data?.props?.columns?.[r]?.childrenIds||[];for(const p of d)if(p===n||eho(e,p,n))return!0;return!1}function Qm5(e){const t=e.document;if(!t||!t.root)return null;function r(a,d){const p=d.document[a];if(!p)return[];switch(p.type){case"EmailLayout":return p.data?.childrenIds||[];case"Container":return p.data?.props?.childrenIds||[];case"ColumnsContainer":return p.data?.props?.columns?.flatMap(h=>h.childrenIds||[])||[];default:return[]}}function n(a,d,p){const h=p.document[a],f=h?.type??"Unknown",m=Nm5[f]??{label:f,iconName:"WidgetsOutlined"};if(f==="ColumnsContainer"){const g=h.data?.props?.columns,A=h.data?.props?.columnsCount===2?2:3,y=[];for(let S=0;S<A;S++){const x=g?.[S]?.childrenIds??[],O=pIo(a,S);y.push({blockId:O,type:"ColumnSlot",label:"",iconName:"WidgetsOutlined",children:x.map(w=>n(w,d+2,p)),depth:d+1,columnSlot:{parentBlockId:a,columnIndex:S,columnsCount:A}})}return{blockId:a,type:f,label:m.label,iconName:m.iconName,children:y,depth:d}}const v=r(a,p).map(g=>n(g,d+1,p));return{blockId:a,type:f,label:m.label,iconName:m.iconName,children:v,depth:d}}return n("root",0,e)}function Ym5(){const e=Ke(t=>t.document);return(0,ie.useMemo)(()=>Qm5({document:e}),[e])}Lr();function tho(e){return Ke($m5(e))}function Km5(e){return Ke(Um5(e))}j4e();var zKe=hF(()=>({credits:{}}));function qm5(e,t){zKe.setState(r=>({credits:{...r.credits,[e]:t}}))}function cy(e){zKe.setState(t=>{const{[e]:r,...n}=t.credits;return{credits:n}})}function Jm5(e){return zKe(t=>e?t.credits[e]??null:null)}dr();var Zm5=350,Xm5=20,e95=10,t95=["any","landscape","portrait","squarish"],Yl={query:"",orientation:"any",photos:[],page:0,totalPages:0,selectedPhoto:null},rho=({backendUrl:e,blockId:t,source:r})=>{const{t:n}=Xt("inspector"),a=(0,ie.useMemo)(()=>id(e),[e]),[d,p]=(0,ie.useState)(t??null),[h,f]=(0,ie.useState)(null),[m,v]=(0,ie.useState)(r??"image");(0,ie.useEffect)(()=>{t!=null&&p(t)},[t]),(0,ie.useEffect)(()=>{r!=null&&v(r)},[r]);const[g,A]=(0,ie.useState)(Yl.query),[y,S]=(0,ie.useState)(Yl.orientation),[x,O]=(0,ie.useState)(Yl.photos),[w,E]=(0,ie.useState)(Yl.page),[L,H]=(0,ie.useState)(Yl.totalPages),[V,F]=(0,ie.useState)(null),[,U]=(0,ie.useState)(Yl.selectedPhoto),[I,$]=(0,ie.useState)(!1),[Q,K]=(0,ie.useState)(null),Y=(0,ie.useRef)(null);(0,ie.useEffect)(()=>{const X=se=>{const{detail:Ae}=se;p(Ae.blockId),f(Ae.currentImageUrl),v(Ae.source??"image")};return window.addEventListener("email-builder-image-panel-opened",X),()=>window.removeEventListener("email-builder-image-panel-opened",X)},[]);const ee=(0,ie.useCallback)(async(X,se,Ae,ze)=>{Y.current?.abort();const pe=new AbortController;Y.current=pe,$(!0),K(null);try{const Z=await V15(a,{query:X,page:Ae,perPage:Xm5,orientation:se==="any"?void 0:se,signal:pe.signal});F(Z.rateLimitRemaining),H(Z.totalPages),E(Ae),O(be=>{const ve=ze?[...be,...Z.results]:Z.results;return Yl.photos=ve,Yl.page=Ae,Yl.totalPages=Z.totalPages,ve})}catch(Z){if(Z?.name==="AbortError")return;K(Z instanceof _v?Z.kind:"unknown"),ze||O([])}finally{Y.current===pe&&($(!1),Y.current=null)}},[a]);(0,ie.useEffect)(()=>{Yl.query=g,Yl.orientation=y;const X=g.trim();if(X.length===0){Y.current?.abort(),O([]),E(0),H(0),K(null),Yl.photos=[],Yl.page=0,Yl.totalPages=0;return}const se=window.setTimeout(()=>{ee(X,y,1,!1)},Zm5);return()=>window.clearTimeout(se)},[g,y,ee]),(0,ie.useEffect)(()=>()=>Y.current?.abort(),[]);const re=w>0&&w<L&&!I,oe=()=>{const X=g.trim();!X||!re||ee(X,y,w+1,!0)},le=X=>{if(!d)return;const se=F15(X);m==="image"?Az(d,{url:se,alt:X.attribution}):window.dispatchEvent(new CustomEvent("email-builder-set-image",{detail:{url:se}})),U(X),Yl.selectedPhoto=X,qm5(d,{photoId:X.id,photographerName:X.user.name,photographerUrl:X.user.profileUrl,unsplashUrl:X.unsplashUrl}),XXi(a,X.links.downloadLocation)};return(0,C.jsxs)(G.Box,{children:[(0,C.jsxs)(G.Stack,{direction:"row",spacing:1,sx:{mb:1,alignItems:"center"},children:[(0,C.jsx)(G.TextField,{fullWidth:!0,size:"small",placeholder:n("inputs.unsplash.searchPlaceholder"),value:g,onChange:X=>A(X.target.value),slotProps:{input:{startAdornment:(0,C.jsx)(G.InputAdornment,{position:"start",children:(0,C.jsx)(qe.Search,{fontSize:"small",sx:{color:"text.secondary"}})})}}}),V!==null&&V<=e95&&(0,C.jsx)(G.Chip,{label:n("inputs.unsplash.quotaLow",{remaining:V}),size:"small",color:"warning",variant:"outlined"})]}),(0,C.jsx)(G.Tabs,{value:y,onChange:(X,se)=>S(se),variant:"scrollable",scrollButtons:!1,sx:{minHeight:30,mb:1.5,"& .MuiTabs-flexContainer":{gap:0},"& .MuiTabs-scroller":{pl:0},"& .MuiTab-root":{minHeight:30,minWidth:0,px:1,py:.25,fontSize:"0.7rem",textTransform:"none",color:"text.secondary","&.Mui-selected":{color:"primary.main"}},"& .MuiTab-root:first-of-type":{pl:0}},children:t95.map(X=>(0,C.jsx)(G.Tab,{value:X,label:n(`inputs.unsplash.orientation.${X}`),disableRipple:!0},X))}),Q&&(0,C.jsx)(G.Alert,{severity:Q==="not_configured"?"warning":"error",sx:{mb:1.5,fontSize:"0.75rem"},children:n(`inputs.unsplash.error.${Q}`)}),I&&x.length===0&&(0,C.jsx)(G.Box,{sx:{display:"flex",justifyContent:"center",py:3},children:(0,C.jsx)(G.CircularProgress,{size:22})}),!I&&!Q&&x.length===0&&g.trim().length===0&&(0,C.jsx)(G.Box,{sx:{textAlign:"center",py:3},children:(0,C.jsx)(G.Typography,{variant:"caption",color:"text.secondary",children:n("inputs.unsplash.emptyInitial")})}),!I&&!Q&&x.length===0&&g.trim().length>0&&(0,C.jsx)(G.Box,{sx:{textAlign:"center",py:3},children:(0,C.jsx)(G.Typography,{variant:"caption",color:"text.secondary",children:n("inputs.unsplash.emptyNoResults",{query:g.trim()})})}),x.length>0&&(0,C.jsx)(G.Box,{sx:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:1,maxHeight:380,overflowY:"auto"},children:x.map(X=>{const se=h?.includes(X.id)??!1;return(0,C.jsx)(r95,{photo:X,selected:se,onPick:()=>le(X)},X.id)})}),re&&(0,C.jsx)(G.Box,{sx:{textAlign:"center",mt:2},children:(0,C.jsx)(G.Link,{component:"button",variant:"caption",onClick:oe,sx:{cursor:"pointer"},children:n("inputs.unsplash.loadMore")})}),(0,C.jsxs)(G.Typography,{variant:"caption",sx:{display:"block",mt:1.5,color:"text.secondary",textAlign:"center",fontSize:"0.65rem"},children:[n("inputs.unsplash.poweredBy")," ",(0,C.jsx)(G.Link,{href:"https://unsplash.com/?utm_source=email-builder-online&utm_medium=referral",target:"_blank",rel:"noreferrer noopener",underline:"hover",color:"inherit",children:"Unsplash"})]})]})},r95=({photo:e,selected:t,onPick:r})=>{const{t:n}=Xt("inspector"),a=e.color??void 0;return(0,C.jsxs)(G.Box,{sx:{borderRadius:1,overflow:"hidden",border:"2px solid",borderColor:t?"primary.main":"divider",cursor:"pointer",backgroundColor:a??"action.hover",transition:"border-color 0.15s ease","&:hover":{borderColor:"primary.light"}},children:[(0,C.jsx)(G.Box,{sx:{position:"relative",aspectRatio:"1",overflow:"hidden"},children:(0,C.jsx)("img",{src:e.urls.thumb,alt:e.alt,loading:"lazy",onClick:r,style:{width:"100%",height:"100%",objectFit:"cover",display:"block"}})}),(0,C.jsx)(G.Box,{sx:{px:.75,py:.5,fontSize:"0.6rem",lineHeight:1.3,bgcolor:"#1a1a1a",color:"#ccc",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"},children:(0,C.jsx)(Qtt,{t:n,i18nKey:"inputs.unsplash.creditLine",values:{author:e.user.name},components:{authorLink:(0,C.jsx)(G.Link,{href:e.user.profileUrl,target:"_blank",rel:"noreferrer noopener",underline:"hover",onClick:d=>d.stopPropagation(),sx:{color:"#fff",fontSize:"inherit",fontWeight:500,"&:hover":{textShadow:"0 0 6px rgba(255,255,255,0.6)"}}}),unsplashLink:(0,C.jsx)(G.Link,{href:e.unsplashUrl,target:"_blank",rel:"noreferrer noopener",underline:"hover",onClick:d=>d.stopPropagation(),sx:{color:"#fff",fontSize:"inherit",fontWeight:500,"&:hover":{textShadow:"0 0 6px rgba(255,255,255,0.6)"}}})}})})]})};dr();function n95({onClick:e,disabled:t,primary:r=!1}){const{t:n}=Xt("inspector");return(0,C.jsx)(G.IconButton,{"aria-label":n("inputs.common.close"),onClick:e,disabled:t,sx:{position:"absolute",right:8,top:8,color:a=>r?"brand.blue":a.palette.grey[500],"&:hover":{opacity:.8}},children:(0,C.jsx)(qe.Close,{})})}function a95({imageUrl:e,saving:t=!1}){return(0,C.jsxs)(G.Card,{sx:{position:"relative"},children:[t&&(0,C.jsx)(G.Stack,{sx:{justifyContent:"center",alignItems:"center",position:"absolute",top:7,left:0,width:"100%",height:"314px",zIndex:20,backgroundColor:"#212121AA",mb:1},children:(0,C.jsx)(G.CircularProgress,{size:48,thickness:6,color:"inherit",sx:{color:"white"}})}),(0,C.jsx)(G.CardMedia,{component:"img",sx:{objectFit:"contain",width:"100%",height:"326px"},image:e,alt:"Generated Image"})]})}function i95({value:e,onChange:t,disabled:r}){return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(G.Typography,{sx:{fontSize:"14px",fontWeight:700},children:"Image description"}),(0,C.jsx)(G.TextField,{disabled:r,autoFocus:!0,margin:"dense",id:"prompt",placeholder:"Enter a detailed description here...",type:"text",fullWidth:!0,multiline:!0,rows:4,variant:"outlined",value:e,onChange:n=>t(n.target.value),sx:{mt:.5,"& .MuiOutlinedInput-root":{borderRadius:"6px"}}})]})}var o95=e=>({400:{code:400,title:e.title||"Invalid Request",message:e.message||"The request was invalid. Please check your input and try again.",action:e.action||"Modify your prompt and try again"},401:{code:401,title:e.title||"Authentication Required",message:e.message||"You need to be authenticated to perform this action.",action:e.action||"Please log in and try again"},403:{code:403,title:e.title||"Access Denied",message:e.message||"You don't have permission to perform this action.",action:e.action||"Contact support if you believe this is a mistake"},404:{code:404,title:e.title||"Not Found",message:e.message||"The requested resource was not found.",action:e.action||"Try again or use a different prompt"},422:{code:422,title:e.title||"Invalid Input",message:e.message||"The provided input cannot be processed.",action:e.action||"Modify your prompt and try again"},429:{code:429,title:e.title||"Too Many Requests",message:e.message||"You've made too many requests. Please wait a moment.",action:e.action||"Please wait a few minutes before trying again"},500:{code:500,title:e.title||"Server Error",message:e.message||"An unexpected error occurred on our servers.",action:e.action||"Please try again later"},502:{code:502,title:e.title||"Bad Gateway",message:e.message||"The server received an invalid response.",action:e.action||"Please try again later"},503:{code:503,title:e.title||"Service Unavailable",message:e.message||"The service is temporarily unavailable.",action:e.action||"Please try again later"}})[e.code]||{code:e.code,title:"Unexpected Error",message:"An unexpected error occurred.",action:"Please try again later"};dr();function nho({src:e,style:t}){const{t:r}=Xt("inspector"),[n,a]=(0,ie.useState)(!1),[d,p]=(0,ie.useState)(!1),[h,f]=(0,ie.useState)(""),[m,v]=(0,ie.useState)(null),[g,A]=(0,ie.useState)(!1),[y,S]=(0,ie.useState)(null),[x,O]=(0,ie.useState)(!1),[w,E]=(0,ie.useState)(0),[L,H]=(0,ie.useState)(0),V=(0,ie.useRef)(null),F=[r("inputs.aiImageGeneration.loadingStep1"),r("inputs.aiImageGeneration.loadingStep2"),r("inputs.aiImageGeneration.loadingStep3"),r("inputs.aiImageGeneration.loadingStep4")],U=(0,ie.useCallback)(()=>{E(0),H(0),V.current&&clearInterval(V.current);const re=6e4,oe=100;let le=0;V.current=setInterval(()=>{le+=oe,E(Math.min(le/re*95,95)),H(Math.min(Math.floor(le/re*F.length),F.length-1)),le>=re&&V.current&&clearInterval(V.current)},oe)},[F.length]),I=(0,ie.useCallback)(()=>{V.current&&(clearInterval(V.current),V.current=null),E(100)},[]),$=()=>{a(!0),S(null)},Q=()=>{d||(a(!1),p(!1),v(null),f(""),A(!1),S(null),O(!1),I())},K=()=>{const re=m&&!g?"store-ai-image":"request-ai-image",oe=m&&!g?m:h;S(null),re==="store-ai-image"?(O(!0),p(!1),setTimeout(()=>{p(!1),Q()},2e3)):(p(!0),U()),window.dispatchEvent(new CustomEvent(re,{detail:oe}))},Y=()=>{A(!0),v(null),S(null),O(!1)};(0,ie.useEffect)(()=>{const re=oe=>{const{detail:le}=oe;if(I(),p(!1),le.error){S(o95(le.error));return}if(!le.success||!le.url){S({code:0,title:"Generation Failed",message:"Failed to generate the image.",action:"Please try again"});return}v(le.url),A(!1)};return window.addEventListener("generated-image",re),()=>{window.removeEventListener("generated-image",re)}},[]),(0,ie.useEffect)(()=>{Q()},[e]);const ee=!m||g;return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(G.Button,{style:t,startIcon:(0,C.jsx)(qe.AutoAwesome,{className:"w-4 h-4"}),variant:"contained",onClick:$,children:r("inputs.aiImageGeneration.generate")}),(0,C.jsx)(G.Dialog,{open:n,onClose:Q,maxWidth:"sm",fullWidth:!0,slotProps:{paper:{sx:{bgcolor:"background.paper",color:"text.primary",borderRadius:"10px"}}},children:(0,C.jsxs)("form",{onSubmit:re=>{re.preventDefault(),K()},children:[(0,C.jsxs)(G.DialogTitle,{sx:{fontWeight:700,fontSize:"24px",color:y?"error.main":"inherit"},children:[r(y?"inputs.aiImageGeneration.titleError":d?"inputs.aiImageGeneration.titleLoading":m?"inputs.aiImageGeneration.titleReady":"inputs.aiImageGeneration.titleCreate"),(0,C.jsx)(n95,{onClick:Q,disabled:d,primary:!0})]}),(0,C.jsxs)(G.DialogContent,{children:[(0,C.jsx)(G.DialogContentText,{sx:{pb:1,color:y?"error.dark":"inherit"},children:r(y?"inputs.aiImageGeneration.descriptionError":d?"inputs.aiImageGeneration.descriptionLoading":ee?"inputs.aiImageGeneration.descriptionCreate":"inputs.aiImageGeneration.descriptionReady")}),m&&!g?(0,C.jsxs)(G.Stack,{sx:{position:"relative"},children:[(0,C.jsx)(a95,{imageUrl:m,saving:x}),(0,C.jsxs)(G.Alert,{variant:"outlined",severity:"warning",icon:!1,children:[r("inputs.aiImageGeneration.warningRegenerate")," ",(0,C.jsx)("b",{children:r("inputs.aiImageGeneration.warningInsertFirst")})," ",r("inputs.aiImageGeneration.warningFirst")]})]}):d&&!m?(0,C.jsxs)(G.Stack,{spacing:2,sx:{justifyContent:"center",alignItems:"center",backgroundColor:re=>re.palette.mainColor?.[50]??re.palette.action.hover,height:"326px",width:"100%",borderRadius:"8px"},children:[(0,C.jsx)(qe.AutoAwesome,{sx:{fontSize:48,color:"primary.main",animation:"pulse 1.5s ease-in-out infinite","@keyframes pulse":{"0%, 100%":{opacity:.4,transform:"scale(1)"},"50%":{opacity:1,transform:"scale(1.15)"}}}}),(0,C.jsx)(G.Typography,{variant:"body2",sx:{color:"text.secondary",fontWeight:500,transition:"opacity 0.3s"},children:F[L]}),(0,C.jsx)(G.LinearProgress,{variant:"determinate",value:w,sx:{width:"60%",borderRadius:4,height:6}})]}):(0,C.jsx)(i95,{value:h,onChange:f,disabled:d})]}),!d&&(0,C.jsxs)(G.DialogActions,{className:"p-6",children:[m&&!g&&(0,C.jsx)(G.Button,{startIcon:(0,C.jsx)(qe.Refresh,{className:"w-4 h-4"}),onClick:Y,variant:"outlined",disabled:d,children:r("inputs.aiImageGeneration.regenerate")}),!m&&!g&&(0,C.jsx)(G.Button,{onClick:Q,variant:"text",disabled:g,children:r("inputs.aiImageGeneration.cancel")}),(0,C.jsxs)(G.Button,{startIcon:m&&!g?(0,C.jsx)(qe.Attachment,{className:"w-4 h-4"}):(0,C.jsx)(qe.AutoAwesome,{className:"w-4 h-4"}),onClick:K,variant:"contained",disabled:!h||h?.length<20,children:[r(m&&!g?"inputs.aiImageGeneration.insertImage":"inputs.aiImageGeneration.generateImage"),d&&(0,C.jsx)(G.CircularProgress,{size:16,className:"ml-2"})]})]})]})})]})}var No=({children:e})=>(0,C.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:"0.3rem"},children:e});dr();var aho=({imageUrl:e,alt:t="",blockId:r,onRemove:n})=>{const{t:a}=Xt("inspector"),d=Jm5(r??null);return e?(0,C.jsxs)(G.Box,{sx:{position:"relative",mb:1.5,borderRadius:1,overflow:"hidden",border:"1px solid",borderColor:"divider"},children:[(0,C.jsx)("img",{src:e,alt:t,style:{width:"100%",display:"block",maxHeight:140,objectFit:"cover"}}),n&&(0,C.jsx)(G.IconButton,{"aria-label":a("inputs.common.close"),onClick:n,size:"small",sx:{position:"absolute",top:4,right:4,backgroundColor:"background.paper",color:"error.main",width:28,height:28,"&:hover":{backgroundColor:"error.50"}},children:(0,C.jsx)(qe.Close,{fontSize:"small"})}),d&&(0,C.jsxs)(G.Box,{sx:{display:"flex",alignItems:"center",gap:.5,px:1,py:.5,bgcolor:"#1a1a1a",color:"#ccc",fontSize:"0.65rem"},children:[(0,C.jsx)(qe.CameraAltOutlined,{sx:{fontSize:"0.8rem",flexShrink:0,color:"#ccc"}}),(0,C.jsx)(Qtt,{t:a,i18nKey:"inputs.unsplash.creditLine",values:{author:d.photographerName},components:{authorLink:(0,C.jsx)(G.Link,{href:d.photographerUrl,target:"_blank",rel:"noreferrer noopener",underline:"hover",sx:{color:"#fff",fontSize:"inherit",fontWeight:500,"&:hover":{textShadow:"0 0 6px rgba(255,255,255,0.6)"}}}),unsplashLink:(0,C.jsx)(G.Link,{href:d.unsplashUrl,target:"_blank",rel:"noreferrer noopener",underline:"hover",sx:{color:"#fff",fontSize:"inherit",fontWeight:500,"&:hover":{textShadow:"0 0 6px rgba(255,255,255,0.6)"}}})}})]})]}):null},l95=["top left","top center","top right","center left","center center","center right","bottom left","bottom center","bottom right"],fh={style:{color:"currentColor"},width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},mh={stroke:"currentColor",strokeWidth:"1.67",strokeLinecap:"round",strokeLinejoin:"round"},iho=(0,C.jsx)("svg",{...fh,children:(0,C.jsx)("path",{d:"M2.40039 5.20039V2.40039M2.40039 2.40039H5.20039M2.40039 2.40039L5.90039 5.90039M13.6004 5.20039V2.40039M13.6004 2.40039H10.8004M13.6004 2.40039L10.1004 5.90039M2.40039 10.8004V13.6004M2.40039 13.6004H5.20039M2.40039 13.6004L5.90039 10.1004M13.6004 13.6004L10.1004 10.1004M13.6004 13.6004V10.8004M13.6004 13.6004H10.8004",...mh})});function qX(e){switch(e){case"top left":return(0,C.jsx)("svg",{...fh,children:(0,C.jsx)("path",{d:"M5.26523 9.79159L5.17094 5.17183M5.17094 5.17183L9.79071 5.26611M5.17094 5.17183L10.8278 10.8287",...mh})});case"top center":return(0,C.jsx)("svg",{...fh,children:(0,C.jsx)("path",{d:"M4.7998 7.33333L7.9998 4M7.9998 4L11.1998 7.33333M7.9998 4V12",...mh})});case"top right":return(0,C.jsx)("svg",{...fh,children:(0,C.jsx)("path",{d:"M6.20841 5.2662L10.8282 5.17192M10.8282 5.17192L10.7339 9.79169M10.8282 5.17192L5.17132 10.8288",...mh})});case"center left":return(0,C.jsx)("svg",{...fh,children:(0,C.jsx)("path",{d:"M7.33333 11.2002L4 8.00019M4 8.00019L7.33333 4.8002M4 8.00019L12 8.0002",...mh})});case"center":case"center center":return iho;case"center right":return(0,C.jsx)("svg",{...fh,children:(0,C.jsx)("path",{d:"M8.66667 4.7998L12 7.9998M12 7.9998L8.66667 11.1998M12 7.9998L4 7.9998",...mh})});case"bottom left":return(0,C.jsx)("svg",{...fh,children:(0,C.jsx)("path",{d:"M9.79062 10.7348L5.17085 10.8291M5.17085 10.8291L5.26513 6.20929M5.17085 10.8291L10.8277 5.1722",...mh})});case"bottom center":return(0,C.jsx)("svg",{...fh,children:(0,C.jsx)("path",{d:"M11.1998 8.66667L7.9998 12M7.9998 12L4.7998 8.66667M7.9998 12L7.99981 4",...mh})});case"bottom right":return(0,C.jsx)("svg",{...fh,children:(0,C.jsx)("path",{d:"M10.7338 6.20938L10.8281 10.8291M10.8281 10.8291L6.20831 10.7349M10.8281 10.8291L5.17122 5.17229",...mh})});default:return iho}}function JX(e){switch(e){case"top left":return"topLeft";case"top center":return"topCenter";case"top right":return"topRight";case"center left":return"centerLeft";case"center":case"center center":return"center";case"center right":return"centerRight";case"bottom left":return"bottomLeft";case"bottom center":return"bottomCenter";case"bottom right":return"bottomRight";default:return"center"}}NC();function oho(e){return(0,C.jsx)(zs,{viewBox:"0 0 18 18",fontSize:"small",...e,children:(0,C.jsx)("path",{d:"M9.00015 6.75V8.25M9.00015 11.25H9.00765M3.804 14.25H14.1963C15.351 14.25 16.0727 13 15.4953 12L10.2992 3C9.72184 2 8.27846 2 7.70111 3L2.50496 12C1.92761 13 2.6493 14.25 3.804 14.25Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})})}dr(),nl(),Lr();var s95=({defaultValue:e,onChange:t,values:r})=>{const n=iO(),{t:a}=Xt("inspector");Na();const d=Me=>{if(!Me)return{url:"",repeat:"no-repeat",position:"center center",size:"cover"};const He=Me.trim();let ye="";if(He.startsWith("url(")){const tt=He.match(/^url\(\s*['"]?([^'")]+)['"]?\s*\)/);ye=tt?tt[1]:""}else(/^https?:\/\//i.test(He)||He.startsWith("data:"))&&(ye=He);let Oe="no-repeat";Me.includes("repeat-x")?Oe="repeat-x":Me.includes("repeat-y")?Oe="repeat-y":Me.includes("repeat")&&!Me.includes("no-repeat")&&(Oe="repeat");let De="center center";for(const tt of["top left","top center","top right","center left","center center","center right","bottom left","bottom center","bottom right"])if(Me.includes(tt)){De=tt;break}let Ce="cover";return Me.includes("contain")?Ce="contain":Me.includes("auto")&&(Ce="auto"),{url:ye,repeat:Oe,position:De,size:Ce}},p=Me=>Me.url?`url("${Me.url}") ${Me.repeat} ${Me.position} / ${Me.size}`:"",[h,f]=(0,ie.useState)(e||null),[m,v]=(0,ie.useState)(d(e)),[g,A]=(0,ie.useState)(!1),[y,S]=(0,ie.useState)(()=>!!window.__emailBuilderEnableAI),[,x]=(0,ie.useState)(null),[O,w]=(0,ie.useState)(d(e).url||""),[E,L]=(0,ie.useState)(!1),[H,V]=(0,ie.useState)(""),[F,U]=(0,ie.useState)(!1),I=(0,ie.useRef)(null),[$,Q]=(0,ie.useState)(null),K=iBo(),Y=lBo(),ee=K||Y,[re,oe]=(0,ie.useState)(()=>!!window.__emailBuilderUnsplashEnabled);(0,ie.useEffect)(()=>{const Me=()=>{oe(!!window.__emailBuilderUnsplashEnabled)};return Me(),window.addEventListener("email-builder-unsplash-updated",Me),()=>window.removeEventListener("email-builder-unsplash-updated",Me)},[]),(0,ie.useEffect)(()=>{const Me=window.__emailBuilderCustomImageProvider;Me&&(Q(Me),setTimeout(()=>{n&&window.dispatchEvent(new CustomEvent("email-builder-image-panel-opened",{detail:{blockId:n,currentImageUrl:m.url||null,alt:null,source:"background"}}))},100))},[]);const[le,X]=(0,ie.useState)(()=>sessionStorage.getItem("hideBackgroundImageWarning")==="true"),se=(Me,He)=>{const ye={...m,...Me};if(v(ye),ye.url){const Oe=p(ye);f(Oe),t(Oe,He)}else console.error("Update params error: ",ye)},Ae=(Me,He)=>{if(!Me)return!1;const ye=Me?.toLowerCase(),Oe=ye.includes(".svg")||ye.includes("svg"),De=He&&(He.includes("image/svg+xml")||He.includes("svg"));return Oe||!!De},ze=async Me=>{try{L(!0),V(""),U(!1);try{new URL(Me)}catch{return V("Invalid URL format"),!1}const He=new AbortController,ye=setTimeout(()=>He.abort(),1e4);try{const Oe=await fetch(Me,{method:"HEAD",signal:He.signal});if(clearTimeout(ye),!Oe.ok)return V(`HTTP ${Oe.status}: ${Oe.statusText}`),!1;const De=Oe.headers.get("content-type");return["image/","image/svg+xml","text/xml","application/xml"].some(Ce=>De&&De.toLowerCase().includes(Ce.toLowerCase()))?(Ae(Me,De)&&U(!0),V(""),!0):(V("URL does not point to an image"),!1)}catch(Oe){return clearTimeout(ye),Oe.name==="AbortError"?(V("Request timeout - URL took too long to respond"),!1):new Promise(De=>{const Ce=new Image,tt=setTimeout(()=>{V("Request timeout - URL took too long to respond"),De(!1)},1e4);Ce.onload=()=>{clearTimeout(tt),Ae(Me)&&U(!0),V(""),De(!0)},Ce.onerror=()=>{clearTimeout(tt),V("Cannot access image - CORS policy, network error, or invalid URL"),De(!1)},Ce.src=Me})}}catch{return V("Unexpected error occurred while validating URL"),!1}finally{L(!1)}},pe=async()=>{O.trim()&&await ze(O.trim())&&(se({url:O.trim()}),n&&cy(n))},Z=Me=>{Me.key==="Enter"&&pe()},be=Me=>{w(Me.target.value),H&&V(""),F&&U(!1)},ve=Me=>{const He=["image/png","image/jpeg","image/gif"],Oe=Array.isArray(Me)?Me:Array.from(Me),De=Oe.filter(tt=>He.includes(tt.type)&&tt.size<=5242880);if(De.length!==Oe.length&&alert(a("inputs.common.invalidFiles")),De.length===0)return;const Ce=De.map(tt=>new Promise(it=>{const Lt=new FileReader;Lt.onload=Qt=>it(Qt.target?.result),Lt.readAsDataURL(tt)}));Promise.all(Ce).then(tt=>{const it={images:tt,id:n||"",styles:r};window.dispatchEvent(new CustomEvent("email-builder-upload-image",{detail:it})),yg(!0,n||"")})},ge=Me=>{Me.preventDefault(),A(!0)},_e=()=>{A(!1)},je=Me=>{Me.preventDefault(),A(!1);const He=Me.dataTransfer.files;ve(He)},Fe=()=>{v({url:"",repeat:"no-repeat",position:"center center",size:"cover"}),f(null),t(null),w(""),U(!1)};return(0,ie.useEffect)(()=>{const Me=window.__emailBuilderEnableAI;Me!==void 0&&S(!!Me);const He=ye=>{const{detail:Oe}=ye;S(!!Oe)};return window.addEventListener("email-builder-ai-generation",He),()=>{window.removeEventListener("email-builder-ai-generation",He)}},[]),(0,ie.useEffect)(()=>{const Me=De=>{const{detail:Ce}=De;yg(!1,Ce.id||""),se({url:Ce.url},Ce.styles),n&&cy(n),eSt(!1),w(Ce.url)},He=De=>{yg(De?.detail?.uploading??!1,De?.detail?.id??"")},ye=()=>{I?.current?.click()},Oe=De=>{const Ce=De.detail;if(typeof Ce=="string"){if(!Ce.includes("url("))se({url:Ce}),w(Ce);else{const tt=d(Ce);v(tt),f(Ce),t(Ce),w(tt.url)}return}Ce?.url!=null&&typeof Ce.url=="string"&&(se({url:Ce.url},Ce.styles),w(Ce.url))};return window.addEventListener("email-builder-set-image",Oe),window.addEventListener("email-builder-upload-image-receive",Me),window.addEventListener("email-builder-upload-file",ye),window.addEventListener("email-builder-toggle-upload-file",He),()=>{window.removeEventListener("email-builder-upload-image-receive",Me),window.removeEventListener("email-builder-set-image",Oe),window.removeEventListener("email-builder-upload-file",ye),window.removeEventListener("email-builder-toggle-upload-file",He)}},[m]),(0,ie.useEffect)(()=>{e&&U(Ae(m.url))},[e,m.url]),(0,ie.useEffect)(()=>{if(e!==h){const Me=d(e);v(Me),f(e||null),w(Me.url||"")}},[e]),(0,C.jsxs)(No,{children:[(0,C.jsxs)(G.Box,{sx:{display:"flex",alignItems:"center",gap:1},children:[(0,C.jsx)(sn,{label:a("inputs.backgroundImage.label")}),!le&&(0,C.jsx)(G.Tooltip,{title:a("inputs.backgroundImage.warningTooltip"),placement:"top",children:(0,C.jsx)(G.IconButton,{size:"small",color:"warning",disableRipple:!0,sx:{p:0,cursor:"help",lineHeight:0,"&:hover":{backgroundColor:"transparent"}},children:(0,C.jsx)(oho,{"aria-hidden":!0})})})]}),(0,C.jsx)(aho,{imageUrl:m.url||null,blockId:n,onRemove:Fe}),(0,C.jsx)(Xpo,{tabs:[{key:"gallery",label:a("inputs.tabs.gallery"),visible:re,render:()=>(0,C.jsx)(rho,{blockId:n,source:"background"})},{key:"yourGallery",label:a("inputs.tabs.yourGallery"),visible:!!$,render:()=>(0,C.jsx)(G.Box,{sx:{mb:2},children:$})},{key:"upload",label:a("inputs.tabs.upload"),visible:ee,render:()=>(0,C.jsxs)(G.Stack,{spacing:1,children:[(0,C.jsx)(G.Box,{children:K&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(sn,{label:a("inputs.image.urlLabel")}),(0,C.jsxs)(G.Stack,{direction:"row",spacing:1,children:[(0,C.jsx)(G.TextField,{fullWidth:!0,placeholder:a("inputs.image.urlPlaceholder"),value:O,onChange:be,onKeyPress:Z,disabled:E,sx:g5}),(0,C.jsx)(G.Button,{variant:"contained",onClick:pe,disabled:!O.trim()||E,sx:{minWidth:"auto",px:2,position:"relative"},children:E?(0,C.jsx)(G.CircularProgress,{size:20,color:"inherit"}):a("inputs.common.add")})]}),H&&(0,C.jsx)(G.Alert,{severity:"error",sx:{mt:1,fontSize:"0.875rem",maxHeight:"70px"},children:H}),F&&(0,C.jsx)(G.Alert,{severity:"warning",sx:{mt:1,fontSize:"0.875rem"},action:(0,C.jsx)(G.IconButton,{"aria-label":a("inputs.common.close"),color:"inherit",size:"small",onClick:()=>{U(!1)},children:(0,C.jsx)(qe.Close,{fontSize:"inherit"})}),children:a("inputs.common.svgWarning")})]})}),K&&Y&&(0,C.jsxs)(G.Stack,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[(0,C.jsx)(G.Divider,{sx:{flexGrow:1}}),(0,C.jsx)(G.Typography,{variant:"caption",sx:{color:"text.secondary"},children:a("inputs.backgroundImage.or")}),(0,C.jsx)(G.Divider,{sx:{flexGrow:1}})]}),Y&&(0,C.jsxs)(G.Box,{onDragOver:ge,onDragLeave:_e,onDrop:je,sx:{width:"100%",border:"2px dashed",borderColor:g?"primary.main":"divider",borderRadius:"8px",padding:"24px 8px 36px 8px",textAlign:"center",bgcolor:g?"primary.50":"background.paper",transition:"all 0.2s ease"},children:[(0,C.jsx)(G.Box,{sx:{display:"flex",justifyContent:"center"},children:(0,C.jsx)(qe.PhotoOutlined,{sx:{fontSize:32,color:"primary"}})}),(0,C.jsxs)("label",{style:{cursor:"pointer"},children:[(0,C.jsx)("input",{ref:I,type:"file",style:{display:"none"},accept:"image/png,image/jpeg,image/gif",multiple:!0,onChange:Me=>{const He=Me.target.files;He&&He.length>0&&ve(Array.from(He))}}),(0,C.jsx)(G.Typography,{component:"span",sx:{fontWeight:"bold",color:"primary.main","&:hover":{fontWeight:"bold",color:"primary.secondary"}},children:a("inputs.common.uploadFile")}),(0,C.jsxs)(G.Typography,{component:"span",sx:{fontWeight:"bold",color:"text.secondary"},children:[" ",a("inputs.common.dragAndDrop")]})]}),(0,C.jsx)(G.Typography,{variant:"body2",sx:{color:"text.secondary",mt:1},children:a("inputs.common.fileInfo")})]})]})},{key:"generate",label:a("inputs.tabs.generate"),visible:y,render:()=>(0,C.jsx)(nho,{src:m.url,style:{width:"100%",margin:0}})}],defaultTab:"upload"}),m.url&&(0,C.jsxs)(G.Box,{sx:{mt:2},children:[(0,C.jsxs)(G.Box,{sx:{mb:2},children:[(0,C.jsx)(sn,{label:a("inputs.backgroundImage.fillType")}),(0,C.jsxs)(G.ToggleButtonGroup,{value:m.size,exclusive:!0,onChange:(Me,He)=>{He!=null&&typeof He=="string"&&se({size:He})},size:"small",fullWidth:!0,children:[(0,C.jsx)(G.ToggleButton,{value:"cover",children:(0,C.jsxs)(G.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[(0,C.jsx)(qe.Crop,{fontSize:"small"}),(0,C.jsx)("span",{children:a("inputs.backgroundImage.fillOptions.cover")})]})}),(0,C.jsx)(G.ToggleButton,{value:"contain",children:(0,C.jsxs)(G.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[(0,C.jsx)(qe.FitScreen,{fontSize:"small"}),(0,C.jsx)("span",{children:a("inputs.backgroundImage.fillOptions.contain")})]})}),(0,C.jsx)(G.ToggleButton,{value:"auto",children:(0,C.jsxs)(G.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[(0,C.jsx)(qe.AspectRatio,{fontSize:"small"}),(0,C.jsx)("span",{children:a("inputs.backgroundImage.fillOptions.auto")})]})})]})]}),(0,C.jsxs)(G.Stack,{direction:"row",spacing:2,sx:{mb:2},children:[(0,C.jsxs)("div",{style:{flex:1},children:[(0,C.jsx)(sn,{label:a("inputs.backgroundImage.repeat")}),(0,C.jsxs)(Qu,{style:{width:"100%"},value:m.repeat,size:"small",onChange:Me=>se({repeat:Me.target.value}),children:[(0,C.jsx)(G.MenuItem,{value:"no-repeat",children:a("inputs.backgroundImage.repeatOptions.none")}),(0,C.jsx)(G.MenuItem,{value:"repeat",children:a("inputs.backgroundImage.repeatOptions.repeat")}),(0,C.jsx)(G.MenuItem,{value:"repeat-x",children:a("inputs.backgroundImage.repeatOptions.repeatX")}),(0,C.jsx)(G.MenuItem,{value:"repeat-y",children:a("inputs.backgroundImage.repeatOptions.repeatY")})]})]}),(0,C.jsxs)("div",{style:{flex:1},children:[(0,C.jsx)(sn,{label:a("inputs.backgroundImage.position")}),(0,C.jsx)(Qu,{style:{width:"100%"},value:m.position,size:"small",onChange:Me=>se({position:Me.target.value}),renderValue:Me=>{const He=String(Me??"");return(0,C.jsxs)(G.Box,{sx:{display:"flex",alignItems:"center",gap:1,paddingRight:"1rem"},children:[qX(He),a(`inputs.backgroundImage.positions.${JX(He)}`)]})},children:["top left","top center","top right","center left","center center","center right","bottom left","bottom center","bottom right"].map(Me=>(0,C.jsx)(G.MenuItem,{sx:{padding:"0.5rem 1rem 0.5rem 0.5rem!important "},value:Me,children:(0,C.jsxs)(G.Box,{sx:{display:"flex",alignItems:"center",gap:1},children:[qX(Me),a(`inputs.backgroundImage.positions.${JX(Me)}`)]})},Me))})]})]})]}),!$&&F&&(0,C.jsx)(G.Alert,{severity:"warning",sx:{mt:1,fontSize:"0.875rem"},children:a("inputs.common.svgWarning")})]})};dr(),v5(),HWe();function PKe({label:e,labelAction:t,defaultValue:r,onChange:n,nullable:a,compact:d=!1,inheritedFrom:p}){const[h,f]=(0,ie.useState)(null),[m,v]=(0,ie.useState)(r),{t:g}=Xt("inspector");(0,ie.useEffect)(()=>{m!==r&&v(r)},[r]);const A=E=>{f(E.currentTarget)},y=d?{border:"1px solid",borderColor:"cadet.400",width:28,height:28,borderRadius:"6px",bgcolor:"#FFFFFF"}:{border:e?"1px solid":"",borderColor:"cadet.400",width:"100%",height:36,paddingTop:"8px",paddingBottom:"8px",paddingLeft:"12px",paddingRight:"12px",borderRadius:"6px",bgcolor:"#FFFFFF"},S=E=>{v(E),n(E)},x=()=>!a||typeof m!="string"||m.trim().length===0?null:(0,C.jsx)(G.Tooltip,{title:g("inputs.background.reset"),placement:"left",children:(0,C.jsx)(G.Box,{sx:{minWidth:24,lineHeight:1,flexShrink:0,pr:"4px",display:"grid",placeItems:"center"},onClick:()=>S(null),children:(0,C.jsx)(qe.FormatColorReset,{sx:{color:"primary.main"}})})}),O=m?(0,C.jsx)(G.ButtonBase,{onClick:A,sx:{...y,bgcolor:m}}):(0,C.jsx)(G.ButtonBase,{onClick:A,sx:{...y},children:(0,C.jsx)(qe.AddOutlined,{fontSize:"small"})}),w=(0,C.jsx)(G.Menu,{anchorEl:h,open:!!h,onClose:()=>f(null),sx:{"& .MuiPaper-root":{boxShadow:"0 4px 6px rgba(0, 0, 0, 0.4);",borderRadius:1,maxWidth:"200px",transform:"translateX(-100%) !important;"}},slotProps:{list:{sx:{height:"auto",padding:0}}},children:(0,C.jsx)(EWe,{value:m||"",nullable:a,onChange:E=>S(E)})});return d?(0,C.jsxs)(G.Box,{sx:{display:"inline-flex",opacity:p?.55:1,transition:"opacity 120ms ease-out"},children:[O,w]}):(0,C.jsxs)(No,{children:[(0,C.jsx)(sn,{label:e,action:t}),(0,C.jsxs)(G.Stack,{direction:"row",spacing:1,sx:{alignContent:"center",opacity:p?.55:1,transition:"opacity 120ms ease-out"},children:[O,x()]}),w]})}function d8(e){return(0,C.jsx)(PKe,{...e,nullable:!1})}function ZX(e){return(0,C.jsx)(PKe,{...e,nullable:!0})}nl();var u95=we(G.Box)(({theme:e})=>({display:"flex",alignItems:"center",border:`1px solid ${e.palette.divider}`,borderRadius:"8px",padding:"4px",minWidth:58,maxWidth:"fit-content",backgroundColor:e.palette.background.paper,"&:hover":{borderColor:e.palette.primary.main},"&:focus-within":{borderColor:e.palette.primary.main,boxShadow:`0 0 0 1px ${e.palette.primary.main}`}})),c95=we("input")(({theme:e})=>({border:"none",outline:"none",background:"transparent",textAlign:"center",width:"27px",minWidth:"27px",maxWidth:"27px",padding:"0!important",lineHeight:"normal",fontSize:"0.9rem",color:e.palette.text.primary,"&::-webkit-outer-spin-button, &::-webkit-inner-spin-button":{WebkitAppearance:"none",margin:0},"&[type=number]":{MozAppearance:"textfield"}})),lho=we(G.IconButton)(({theme:e})=>({padding:"0",color:e.palette.primary.main,"&:hover":{backgroundColor:gr(e.palette.primary.main,.04)},"& .MuiSvgIcon-root":{fontSize:14}}));function Di({iconLabel:e,label:t,value:r,setValue:n,units:a,min:d=0,max:p,step:h=void 0,marks:f=!0,...m}){const v=r??d,[g,A]=(0,ie.useState)(v.toString()),y=H=>{let V=H;V<d&&(V=d),p!==void 0&&V>p&&(V=p),n(V),A(V.toString())},S=H=>{const V=H.target.value;if(A(V),V!==""){const F=Number(V);isNaN(F)||F>=d&&n(F)}},x=()=>{if(g===""||isNaN(Number(g)))A(v.toString());else{const H=Number(g);y(H)}},O=H=>{H.key==="Enter"&&x()};(0,ie.useEffect)(()=>{A((r??d).toString())},[r,d]);const w=()=>{const H=v+1;y(H)},E=()=>{const H=v-1;y(H)},L=(H,V)=>{typeof V=="number"&&n(V)};return(0,C.jsxs)(No,{children:[(0,C.jsx)(sn,{label:t}),(0,C.jsxs)(G.Stack,{direction:"row",spacing:2,sx:{alignItems:"center",justifyContent:"space-between",width:"100%",gap:"1rem"},children:[(0,C.jsx)(G.Box,{sx:{minWidth:24,lineHeight:1,flexShrink:0},children:e}),(0,C.jsx)(G.Slider,{...m,value:v,min:d,max:p||1e3,step:h,color:"primary",marks:f,onChange:L}),(0,C.jsxs)(u95,{children:[(0,C.jsx)(c95,{type:"number",value:g,onChange:S,onBlur:x,onKeyDown:O,min:d,max:p,step:h}),(0,C.jsxs)(G.Box,{sx:{display:"flex",flexDirection:"column",ml:.5},children:[(0,C.jsx)(lho,{onClick:w,disabled:p!==void 0&&v>=p,children:(0,C.jsx)("svg",{width:"15",height:"10",viewBox:"0 0 24 12",children:(0,C.jsx)("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"3",d:"m6 9l6-6l6 6"})})}),(0,C.jsx)(lho,{onClick:E,disabled:v<=d,children:(0,C.jsx)("svg",{width:"15",height:"10",viewBox:"0 0 24 12",style:{transform:"rotate(180deg)"},children:(0,C.jsx)("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"3",d:"m6 9l6-6l6 6"})})})]})]}),(0,C.jsx)(G.Typography,{variant:"caption",color:"text.secondary",sx:{fontSize:"16px",ml:"4px!important"},children:a})]})]})}function dy({label:e,defaultValue:t,onChange:r,...n}){const[a,d]=(0,ie.useState)(t??0);return t!=a&&d(t),(0,C.jsxs)(No,{children:[(0,C.jsx)(sn,{label:e}),(0,C.jsx)(Di,{value:a??0,setValue:p=>{d(p),r(p)},...n})]})}dr();var EKe=({mobile:e=!1,label:t,borderColor:r,borderTop:n,borderBottom:a,borderLeft:d,borderRight:p,onChange:h,sidesLinked:f,onSidesLinkedChange:m})=>{const{t:v}=Xt("inspector"),g=()=>e?{top:"borderTopMobile",bottom:"borderBottomMobile",left:"borderLeftMobile",right:"borderRightMobile"}:{top:"borderTop",bottom:"borderBottom",left:"borderLeft",right:"borderRight"},A=$=>{const Q=Object.values($);return Q.every(K=>K===Q[0])},y=g(),S={[y.top]:n??0,[y.bottom]:a??0,[y.left]:d??0,[y.right]:p??0},[x,O]=(0,ie.useState)(r??"#000000"),[w,E]=(0,ie.useState)(S),L={[y.top]:Number(w[y.top]),[y.bottom]:Number(w[y.bottom]),[y.left]:Number(w[y.left]),[y.right]:Number(w[y.right])},H=f!==void 0?f:A(L);(0,ie.useEffect)(()=>{r!==x&&O(r??"#000000");const $={[y.top]:n??0,[y.bottom]:a??0,[y.left]:d??0,[y.right]:p??0};Object.keys($).some(Q=>w[Q]!==$[Q])&&E($)},[r,n,a,d,p,e]);const V=()=>{if(H)m(!1);else{const $=w[y.top]??0;U($),m(!0)}},F=$=>{O($),h({borderColor:$,...w})},U=$=>{const Q={[y.top]:$,[y.bottom]:$,[y.left]:$,[y.right]:$};E(Q),h({...Q,borderColor:x})},I=($,Q)=>{E(K=>({...K,[Q]:$})),h({...w,borderColor:x,[Q]:$})};return(0,C.jsxs)("div",{children:[(0,C.jsxs)(G.Stack,{direction:"row",sx:{justifyContent:"space-between",alignItems:"center",width:"100%"},children:[(0,C.jsx)(sn,{label:t}),(0,C.jsxs)(G.Stack,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[(0,C.jsx)(d8,{defaultValue:x,onChange:F,compact:!0}),(0,C.jsx)(G.Tooltip,{title:v(H?"lockValues.unlockTooltip":"lockValues.lockTooltip"),children:(0,C.jsx)(G.IconButton,{size:"small",onClick:V,sx:{color:H?"primary.main":"text.secondary","&:hover":{backgroundColor:"action.hover"}},children:H?(0,C.jsx)(qe.Lock,{fontSize:"small"}):(0,C.jsx)(qe.LockOpen,{fontSize:"small"})})})]})]}),H&&(0,C.jsx)(dy,{label:"",iconLabel:(0,C.jsx)(qe.BorderOuterOutlined,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:w[y.top],onChange:U}),!H&&(0,C.jsxs)(G.Stack,{spacing:2,children:[(0,C.jsx)(dy,{label:"",iconLabel:(0,C.jsx)(qe.BorderTopOutlined,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:w[y.top],onChange:$=>I($,y.top)}),(0,C.jsx)(dy,{label:"",iconLabel:(0,C.jsx)(qe.BorderBottomOutlined,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:w[y.bottom],onChange:$=>I($,y.bottom)}),(0,C.jsx)(dy,{label:"",iconLabel:(0,C.jsx)(qe.BorderLeftOutlined,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:w[y.left],onChange:$=>I($,y.left)}),(0,C.jsx)(dy,{label:"",iconLabel:(0,C.jsx)(qe.BorderRightOutlined,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:w[y.right],onChange:$=>I($,y.right)})]})]})};function h1({icon:e,label:t,children:r,modified:n=!1}){const a=fd(),[d,p]=(0,ie.useState)(!1),h=(0,ie.useRef)(null);return a?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(G.Tooltip,{title:t,placement:"left",children:(0,C.jsxs)(G.Box,{sx:{position:"relative",display:"inline-flex",alignSelf:"center"},children:[(0,C.jsx)(G.IconButton,{ref:h,onClick:()=>p(!d),color:d?"primary":"default",size:"small",sx:{borderRadius:1.5,width:32,height:32},children:(0,C.jsx)(e,{fontSize:"small"})}),n&&(0,C.jsx)(G.Box,{component:"span","aria-hidden":!0,sx:f=>({position:"absolute",top:2,right:2,width:5,height:5,borderRadius:"50%",bgcolor:(0,G.alpha)(f.palette.primary.main,.55),pointerEvents:"none"})})]})}),(0,C.jsx)(G.Popover,{open:d,anchorEl:h.current,onClose:()=>p(!1),anchorOrigin:{vertical:"center",horizontal:"left"},transformOrigin:{vertical:"center",horizontal:"right"},slotProps:{paper:{sx:f=>({width:360,p:2,borderRadius:2,backgroundColor:f.palette.background.paper,border:`1px solid ${f.palette.divider}`,boxShadow:"0 8px 32px rgba(0,0,0,0.12)",transform:"translateX(-18px) !important",overflow:"visible","&::after":{content:'""',position:"absolute",right:-5,top:"50%",transform:"translateY(-50%)",width:0,height:0,borderTop:"5px solid transparent",borderBottom:"5px solid transparent",borderLeft:`5px solid ${f.palette.divider}`},"&::before":{content:'""',position:"absolute",right:-4,top:"50%",transform:"translateY(-50%)",width:0,height:0,borderTop:"4px solid transparent",borderBottom:"4px solid transparent",borderLeft:`4px solid ${f.palette.background.paper}`,zIndex:1}})}},children:r})]}):n?(0,C.jsxs)(G.Box,{sx:{position:"relative"},children:[r,(0,C.jsx)(G.Box,{component:"span","aria-hidden":!0,sx:f=>({position:"absolute",top:4,left:-10,width:5,height:5,borderRadius:"50%",bgcolor:(0,G.alpha)(f.palette.primary.main,.55),pointerEvents:"none"})})]}):(0,C.jsx)(C.Fragment,{children:r})}hA();var d95=Av.map(e=>(0,C.jsx)(G.MenuItem,{value:e.key,sx:{fontFamily:e.value},children:e.label},e.key));function kKe({label:e,labelAction:t,onChange:r,defaultValue:n}){const a="INHERIT",[d,p]=(0,ie.useState)(n??a);(0,ie.useEffect)(()=>{d!==n&&p(n??a)},[n]);const h=m=>{const v=m.target.value;p(v),r(v===null?null:v)},f=Av.find(m=>m.key===d)?.value;return(0,C.jsxs)(No,{children:[(0,C.jsx)(sn,{label:e,action:t}),(0,C.jsx)(Qu,{style:{width:"100%",fontFamily:f},value:d,size:"small",onChange:h,children:d95})]})}function XX({label:e,labelAction:t,defaultValue:r=16,onChange:n,maxValue:a,minValue:d,step:p,inheritedFrom:h}){const[f,m]=(0,ie.useState)(r);(0,ie.useEffect)(()=>{f!==r&&m(r)},[r]);const v=g=>{m(g),n(g)};return(0,C.jsxs)(No,{children:[(0,C.jsx)(sn,{label:e,action:t}),(0,C.jsx)(G.Box,{sx:{opacity:h?.55:1,transition:"opacity 120ms ease-out"},children:(0,C.jsx)(Di,{iconLabel:(0,C.jsx)(qe.TextFieldsOutlined,{sx:{fontSize:16,color:"text.primary"}}),value:f,setValue:v,units:"px",step:p??2,min:d||8,max:a||48})})]})}function py({label:e,labelAction:t,children:r,defaultValue:n,onChange:a}){const[d,p]=(0,ie.useState)(n);return(0,ie.useEffect)(()=>{n!==d&&p(n)},[n]),(0,C.jsxs)(No,{children:[(0,C.jsx)(sn,{label:e,action:t}),(0,C.jsx)(G.Box,{sx:{...GBe,paddingLeft:"0px",paddingRight:"0px"},children:(0,C.jsx)(G.ToggleButtonGroup,{exclusive:!0,fullWidth:!0,value:d,size:"small",sx:{width:"100%"},onChange:(h,f)=>{if(typeof f!="string")throw new Error("RadioGroupInput can only receive string values");p(f),a(f)},children:r})})]})}dr();function sho({label:e,labelAction:t,defaultValue:r,onChange:n}){const{t:a}=Xt("inspector"),[d,p]=(0,ie.useState)(r);return(0,ie.useEffect)(()=>{d!==r&&p(r)},[r]),(0,C.jsxs)(py,{label:e,labelAction:t,defaultValue:d,onChange:h=>{p(h),n(h)},children:[(0,C.jsx)(G.ToggleButton,{value:"normal",children:(0,C.jsxs)(G.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[(0,C.jsx)(qe.TextFields,{fontSize:"small"}),(0,C.jsx)("span",{children:a("inputs.fontWeightToggle.regular")})]})}),(0,C.jsx)(G.ToggleButton,{value:"bold",children:(0,C.jsxs)(G.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[(0,C.jsx)(qe.FormatBold,{fontSize:"small"}),(0,C.jsx)("span",{children:a("inputs.fontWeightToggle.bold")})]})})]})}dr();var HKe=({label:e,defaultValue:t,onChange:r,min:n=1,max:a=100,step:d=1})=>{const{t:p}=Xt("inspector");return(0,C.jsx)(Di,{label:e??p("inputs.common.height"),iconLabel:(0,C.jsx)(qe.HeightOutlined,{sx:{color:"text.secondary"}}),units:"px",step:d,min:n,max:a,marks:!1,value:t??n,setValue:r})},p95=[{key:"1",value:"1",label:"Simple (1.0)"},{key:"1.15",value:"1.15",label:"Compact (1.15)"},{key:"1.5",value:"1.5",label:"Normal (1.5)"},{key:"2",value:"2",label:"Relaxed (2.0)"},{key:"2.5",value:"2.5",label:"Wide (2.5)"},{key:"3",value:"3",label:"Loose (3.0)"},{key:"4",value:"4",label:"Very Loose (4.0)"}].map(e=>(0,C.jsx)(G.MenuItem,{value:e.key,children:e.label},e.key));function h95({label:e,onChange:t,defaultValue:r}){const n="INHERIT",[a,d]=(0,ie.useState)(r?.toString()??n);(0,ie.useEffect)(()=>{a!==r?.toString()&&d(r?.toString()??n)},[r]);const p=h=>{const f=h.target.value;d(f),t(f===n?null:parseFloat(f))};return(0,C.jsxs)(No,{children:[(0,C.jsx)(sn,{label:e}),(0,C.jsxs)(Qu,{style:{width:"100%"},value:a,size:"small",onChange:p,children:[(0,C.jsx)(G.MenuItem,{value:n,children:"Default value"}),p95]})]})}dr();function f95(e){return(0,C.jsxs)(G.SvgIcon,{...e,viewBox:"0 0 16 16",children:[(0,C.jsx)("path",{fill:"currentColor",d:"M0 0v16h16V0zm15 3h-1v1h1v11H1V3h1V2H1V1h1v1h1V1h1v1h1V1h1v1h1V1h1v1h1V1h1v1h1V1h1v1h1V1h1v1h1z"}),(0,C.jsx)("path",{fill:"currentColor",d:"M3 2h1v1H3zM2 3h1v1H2zm2 0h1v1H4zm2 0h1v1H6zM5 2h1v1H5zm2 0h1v1H7zm2 0h1v1H9zM8 3h1v1H8zm2 0h1v1h-1zm2 0h1v1h-1zm-1-1h1v1h-1zm2 0h1v1h-1z"})]})}function m95(e){return(0,C.jsxs)(G.SvgIcon,{...e,viewBox:"0 0 16 16",children:[(0,C.jsx)("path",{fill:"currentColor",d:"M16 16V0H0v16zM1 13h1v-1H1V1h14v12h-1v1h1v1h-1v-1h-1v1h-1v-1h-1v1h-1v-1H9v1H8v-1H7v1H6v-1H5v1H4v-1H3v1H2v-1H1z"}),(0,C.jsx)("path",{fill:"currentColor",d:"M12 13h1v1h-1zm1-1h1v1h-1zm-2 0h1v1h-1zm-2 0h1v1H9zm1 1h1v1h-1zm-2 0h1v1H8zm-2 0h1v1H6zm1-1h1v1H7zm-2 0h1v1H5zm-2 0h1v1H3zm1 1h1v1H4zm-2 0h1v1H2z"})]})}function v95(e){return(0,C.jsxs)(G.SvgIcon,{...e,viewBox:"0 0 16 16",children:[(0,C.jsx)("path",{fill:"currentColor",d:"M0 16h16V0H0zM3 1v1h1V1h11v14H3v-1H2v1H1v-1h1v-1H1v-1h1v-1H1v-1h1V9H1V8h1V7H1V6h1V5H1V4h1V3H1V2h1V1z"}),(0,C.jsx)("path",{fill:"currentColor",d:"M2 12h1v1H2zm1 1h1v1H3zm0-2h1v1H3zm0-2h1v1H3zm-1 1h1v1H2zm0-2h1v1H2zm0-2h1v1H2zm1 1h1v1H3zm0-2h1v1H3zm0-2h1v1H3zM2 4h1v1H2zm0-2h1v1H2z"})]})}function _95(e){return(0,C.jsxs)(G.SvgIcon,{...e,viewBox:"0 0 16 16",children:[(0,C.jsx)("path",{fill:"currentColor",d:"M16 0H0v16h16zm-3 15v-1h-1v1H1V1h12v1h1V1h1v1h-1v1h1v1h-1v1h1v1h-1v1h1v1h-1v1h1v1h-1v1h1v1h-1v1h1v1h-1v1z"}),(0,C.jsx)("path",{fill:"currentColor",d:"M13 3h1v1h-1zm-1-1h1v1h-1zm0 2h1v1h-1zm0 2h1v1h-1zm1-1h1v1h-1zm0 2h1v1h-1zm0 2h1v1h-1zm-1-1h1v1h-1zm0 2h1v1h-1zm0 2h1v1h-1zm1-1h1v1h-1zm0 2h1v1h-1z"})]})}var eee=(e=>(0,C.jsxs)(G.SvgIcon,{...e,viewBox:"0 0 16 16",children:[(0,C.jsx)("path",{fill:"currentColor",d:"M0 0v16h16V0zm15 3h-1v1h1v1h-1v1h1v1h-1v1h1v1h-1v1h1v1h-1v1h1v1h-1v1h1v1h-1v-1h-1v1h-1v-1h-1v1h-1v-1H9v1H8v-1H7v1H6v-1H5v1H4v-1H3v1H2v-1H1v-1h1v-1H1v-1h1v-1H1V9h1V8H1V7h1V6H1V5h1V4H1V3h1V2H1V1h1v1h1V1h1v1h1V1h1v1h1V1h1v1h1V1h1v1h1V1h1v1h1V1h1v1h1z"}),(0,C.jsx)("path",{fill:"currentColor",d:"M3 2h1v1H3zm1 1h1v1H4zm2 0h1v1H6zM5 2h1v1H5zm2 0h1v1H7zm2 0h1v1H9zM8 3h1v1H8zm2 0h1v1h-1zm2 0h1v1h-1zm-1-1h1v1h-1zm2 0h1v1h-1zm-1 3h1v1h-1zm1-1h1v1h-1zm-1 3h1v1h-1zm1-1h1v1h-1zm-1 3h1v1h-1zm1-1h1v1h-1zm-1 3h1v1h-1zm1-1h1v1h-1zm-1 3h1v1h-1zm1-1h1v1h-1zM2 3h1v1H2zm1 1h1v1H3zM2 5h1v1H2zm1 1h1v1H3zM2 7h1v1H2zm1 1h1v1H3zM2 9h1v1H2zm1 1h1v1H3zm-1 1h1v1H2zm0 2h1v1H2zm1-1h1v1H3zm1-1h1v1H4zm0 2h1v1H4zm1-1h1v1H5zm1 1h1v1H6zm1-1h1v1H7zm2 0h1v1H9zm-1 1h1v1H8zm3-1h1v1h-1zm-1 1h1v1h-1z"})]}));eee.muiName="PaddingIcon";function LKe({label:e,labelAction:t,defaultValue:r,onChange:n,sidesLinked:a,onSidesLinkedChange:d,inheritedFrom:p}){const{t:f}=Xt("inspector"),[m,v]=(0,ie.useState)(()=>r||{top:0,left:0,bottom:0,right:0});(0,ie.useEffect)(()=>{r&&(r.top!==m.top||r.left!==m.left||r.bottom!==m.bottom||r.right!==m.right)&&v(r)},[r]);const g=m.top===m.bottom&&m.top===m.left&&m.top===m.right,A=a===!0&&g;function y(x,O){let w;A?w={top:O,bottom:O,left:O,right:O}:w={...m,[x]:O},v(w),n(w)}const S=()=>{const x=!A;if(!A){const O={top:m.top,bottom:m.top,left:m.top,right:m.top};v(O),n(O)}d(x)};return(0,C.jsxs)(No,{children:[(0,C.jsxs)(G.Stack,{direction:"row",sx:{justifyContent:"space-between",alignItems:"center",width:"100%"},children:[(0,C.jsx)(sn,{label:e,action:t}),(0,C.jsx)(G.Tooltip,{title:f(A?"lockValues.unlockTooltip":"lockValues.lockTooltip"),children:(0,C.jsx)(G.IconButton,{size:"small",onClick:S,sx:{marginTop:"0!important",color:A?"primary.main":"text.secondary","&:hover":{backgroundColor:"action.hover"}},children:A?(0,C.jsx)(qe.Lock,{fontSize:"small"}):(0,C.jsx)(qe.LockOpen,{fontSize:"small"})})})]}),(0,C.jsx)(G.Stack,{spacing:1,sx:{opacity:p?.55:1,transition:"opacity 120ms ease-out"},children:A?(0,C.jsx)(Di,{iconLabel:(0,C.jsx)("span",{children:f("inputs.responsiveSize.allSides")}),value:m.top,setValue:x=>y("top",x),units:"px",step:16,min:0,max:120,marks:!0}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(Di,{iconLabel:(0,C.jsx)(f95,{sx:{fontSize:16,color:"text.primary"}}),value:m.top,setValue:x=>y("top",x),units:"px",step:16,min:0,max:120,marks:!0}),(0,C.jsx)(Di,{iconLabel:(0,C.jsx)(m95,{sx:{fontSize:16,color:"text.primary"}}),value:m.bottom,setValue:x=>y("bottom",x),units:"px",step:16,min:0,max:120,marks:!0}),(0,C.jsx)(Di,{iconLabel:(0,C.jsx)(v95,{sx:{fontSize:16,color:"text.primary"}}),value:m.left,setValue:x=>y("left",x),units:"px",step:16,min:0,max:120,marks:!0}),(0,C.jsx)(Di,{iconLabel:(0,C.jsx)(_95,{sx:{fontSize:16,color:"text.primary"}}),value:m.right,setValue:x=>y("right",x),units:"px",step:16,min:0,max:120,marks:!0})]})})]})}dr();var g95=({label:e,defaultValue:t,onChange:r,maxValue:n=600,shapeSteps:a=8,cornersLinked:d,onCornersLinkedChange:p})=>{const{t:h}=Xt("inspector"),[f,m]=(0,ie.useState)(()=>typeof t=="object"&&t!==null?"rounded":t||"rectangle"),[v,g]=(0,ie.useState)(()=>typeof t=="object"&&t!==null?t:{topLeft:0,topRight:0,bottomLeft:0,bottomRight:0}),A=d===!0;(0,ie.useEffect)(()=>{typeof t=="object"&&t!==null?(g(t),m("rounded")):(t==="rectangle"||t==="pill")&&m(t)},[t]);const y=w=>{const E=w;m(E),r(E==="rounded"?v:E)},S=(w,E)=>{let L;A?L={topLeft:E,topRight:E,bottomLeft:E,bottomRight:E}:L={...v,[w]:E},g(L),r(L)},x=()=>{const w=!A;if(!A){const E={topLeft:v.topLeft,topRight:v.topLeft,bottomLeft:v.topLeft,bottomRight:v.topLeft};g(E),r(E)}p(w)},O=typeof n=="number"?n:Number(n)||600;return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(py,{label:e||h("shape.label"),defaultValue:f,onChange:y,children:[(0,C.jsx)(G.ToggleButton,{value:"rectangle",children:(0,C.jsxs)(G.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[(0,C.jsx)(qe.CropSquare,{fontSize:"small"}),(0,C.jsx)("span",{children:h("shape.square")})]})}),(0,C.jsx)(G.ToggleButton,{value:"pill",children:(0,C.jsxs)(G.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[(0,C.jsx)(qe.PanoramaFishEye,{fontSize:"small"}),(0,C.jsx)("span",{children:h("shape.pill")})]})}),(0,C.jsx)(G.ToggleButton,{value:"rounded",children:(0,C.jsxs)(G.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[(0,C.jsx)(qe.RoundedCorner,{fontSize:"small"}),(0,C.jsx)("span",{children:h("shape.custom")})]})})]}),f==="rounded"&&(0,C.jsxs)(G.Stack,{spacing:2,sx:{alignItems:"flex-start",pb:1},children:[(0,C.jsxs)(G.Stack,{direction:"row",sx:{justifyContent:"space-between",alignItems:"center",width:"100%"},children:[(0,C.jsx)(sn,{label:h("shape.borderRadius")}),(0,C.jsx)(G.Tooltip,{title:h(A?"lockValues.unlockTooltip":"lockValues.lockTooltip"),children:(0,C.jsx)(G.IconButton,{size:"small",onClick:x,sx:{marginTop:"0!important",color:A?"primary.main":"text.secondary","&:hover":{backgroundColor:"action.hover"}},children:A?(0,C.jsx)(qe.Lock,{fontSize:"small"}):(0,C.jsx)(qe.LockOpen,{fontSize:"small"})})})]}),A?(0,C.jsx)(C.Fragment,{children:(0,C.jsx)(Di,{iconLabel:(0,C.jsx)(qe.RoundedCorner,{sx:{fontSize:16}}),value:Number(v.topRight),setValue:w=>S("topLeft",w),units:"px",min:0,step:a,marks:a>1,max:O})}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(Di,{iconLabel:(0,C.jsx)(qe.RoundedCorner,{sx:{fontSize:16,transform:"rotate(0deg)"}}),value:Number(v.topLeft),setValue:w=>S("topLeft",w),units:"px",min:0,step:a,marks:a>1,max:O}),(0,C.jsx)(Di,{iconLabel:(0,C.jsx)(qe.RoundedCorner,{sx:{fontSize:16,transform:"rotate(270deg)"}}),value:Number(v.topRight),setValue:w=>S("topRight",w),units:"px",min:0,step:a,marks:a>1,max:O}),(0,C.jsx)(Di,{iconLabel:(0,C.jsx)(qe.RoundedCorner,{sx:{fontSize:16,transform:"rotate(180deg)"}}),value:Number(v.bottomLeft),setValue:w=>S("bottomLeft",w),units:"px",min:0,step:a,marks:a>1,max:O}),(0,C.jsx)(Di,{iconLabel:(0,C.jsx)(qe.RoundedCorner,{sx:{fontSize:16,transform:"rotate(90deg)"}}),value:Number(v.bottomRight),setValue:w=>S("bottomRight",w),units:"px",min:0,step:a,marks:a>1,max:O})]})]})]})};function DKe({label:e,labelAction:t,defaultValue:r,onChange:n}){const[a,d]=(0,ie.useState)(r??"left");return(0,ie.useEffect)(()=>{r!==a&&d(r??"left")},[r]),(0,C.jsxs)(No,{children:[(0,C.jsx)(sn,{label:e,action:t}),(0,C.jsxs)(py,{label:"",defaultValue:a,onChange:p=>{d(p),n(p)},children:[(0,C.jsx)(G.ToggleButton,{value:"left",children:(0,C.jsx)(qe.FormatAlignLeftOutlined,{fontSize:"small"})}),(0,C.jsx)(G.ToggleButton,{value:"center",children:(0,C.jsx)(qe.FormatAlignCenterOutlined,{fontSize:"small"})}),(0,C.jsx)(G.ToggleButton,{value:"right",children:(0,C.jsx)(qe.FormatAlignRightOutlined,{fontSize:"small"})})]})]})}dr();var uho=({label:e,defaultValue:t,onChange:r,step:n,...a})=>{const{t:d}=Xt("inspector");return(0,C.jsx)(Di,{label:e??d("inputs.common.width"),iconLabel:(0,C.jsx)(qe.HeightOutlined,{sx:{color:"text.primary",transform:"rotate(90deg)"}}),units:"%",step:n,min:1,max:100,marks:!1,value:t??1,setValue:r,...a})};dr(),oi(),Lr();var tee=(e=>(0,C.jsx)(G.SvgIcon,{...e,viewBox:"0 0 24 24",children:(0,C.jsx)("path",{fill:"currentColor",d:"M15 4h7v2h-7zm1 4h6v2h-6zm2 4h4v2h-4zM9.307 4l-6 16h2.137l1.875-5h6.363l1.875 5h2.137l-6-16zm-1.239 9L10.5 6.515L12.932 13z"})}));tee.muiName="FontFamilyIcon";var Tz=(e=>(0,C.jsx)(G.SvgIcon,{...e,viewBox:"0 0 24 24",children:(0,C.jsxs)("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",children:[(0,C.jsx)("path",{d:"M13.04 4.75h3.66c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311c.327.642.327 1.482.327 3.162v5.4c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311c-.642.327-1.482.327-3.162.327H7.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C3 17.47 3 16.63 3 14.95v-.93"}),(0,C.jsx)("path",{d:"m6.407 2.818l5.384 5.385M6.407 2.818L3.01 6.214c-.696.696-1.044 1.044-1.174 1.446c-.057.176-.086.36-.086.543m4.657-5.385L5.589 2m6.202 6.203l-3.396 3.396c-.696.696-1.044 1.044-1.445 1.174a1.76 1.76 0 0 1-1.086 0c-.401-.13-.75-.478-1.445-1.174L3.01 10.191c-.696-.696-1.044-1.044-1.174-1.445a1.8 1.8 0 0 1-.086-.543m10.042 0H1.75m10.672 4.094l1.485-2.448l1.744 2.313a1.824 1.824 0 0 1-.668 2.491c-1.546.893-3.322-.74-2.562-2.356"})]})}));Tz.muiName="BackgroundColorIcon";var ree=(e=>(0,C.jsx)(G.SvgIcon,{...e,viewBox:"0 0 24 24",children:(0,C.jsxs)("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",children:[(0,C.jsx)("path",{d:"m7.154 13.088l1.73-3.959m0 0h6.231m-6.23 0l2.652-6.065a.5.5 0 0 1 .926 0l2.652 6.065m0 0l1.731 3.96"}),(0,C.jsx)("rect",{width:"15.5",height:"4.353",x:"4.25",y:"16.897",rx:"1.5"})]})}));ree.muiName="TextColorIcon";function b95({name:e,value:t,onChange:r,shapeMaxValue:n,shapeSteps:a}){const d=ll(),p=AF(),h=vF(),{t:f}=Xt("inspector"),m=w=>{if(!h)return t[w]??null;const E=d==="desktop"?"desktop":"mobile",L=p?.theme,H=pot({type:h,data:{style:t}},"style",w,L,E);return H!==void 0?H:Sz[h]?.style?.[w]??null},v=w=>{if(t[w]!==void 0&&t[w]!==null||!h)return;const E=p?.theme?.blocks?.[h]?.style?.[w];if(E!=null)return"theme";const L=Sz[h]?.style?.[w];return L!=null?"default":void 0},g=w=>m(w),A=(w,E)=>{const L=t[w],H=t[E];return L??H},y=(w,E)=>{r(E?{...t,...E,[e]:w}:{...t,[e]:w})},S=w=>{r({...t,...w})},O=(()=>{switch(e){case"textAlignMobile":return m("textAlignMobile")??m("textAlign");case"mobilePadding":return m("mobilePadding")??m("padding");case"fontSizeMobile":return m("fontSizeMobile")??m("fontSize")??16;case"heightMobile":return m("heightMobile")??m("height");case"widthMobile":return m("widthMobile")??m("width");case"borderMobile":return{borderTop:A("borderTopMobile","borderTop"),borderBottom:A("borderBottomMobile","borderBottom"),borderLeft:A("borderLeftMobile","borderLeft"),borderRight:A("borderRightMobile","borderRight")};default:return m(e)}})();switch(e){case"backgroundColor":return(0,C.jsx)(h1,{icon:Tz,label:f("properties.backgroundColor"),children:(0,C.jsx)(ZX,{label:f("properties.backgroundColor"),defaultValue:O??p?.canvasColor,onChange:y})});case"background":return(0,C.jsx)(h1,{icon:qe.WallpaperOutlined,label:f("properties.background","Background"),children:(0,C.jsx)(s95,{defaultValue:O,onChange:(w,E)=>y(w,E),values:t})});case"borderColor":return(0,C.jsx)(h1,{icon:Tz,label:f("properties.border"),children:(0,C.jsx)(ZX,{label:f("properties.border"),defaultValue:O,onChange:y})});case"borderRadius":return(0,C.jsx)(h1,{icon:qe.RoundedCornerOutlined,label:f("properties.borderRadius"),children:(0,C.jsx)(dy,{iconLabel:(0,C.jsx)(qe.RoundedCornerOutlined,{}),units:"px",step:4,marks:!0,min:0,max:48,label:f("properties.borderRadius"),defaultValue:O,onChange:y})});case"color":return(0,C.jsx)(h1,{icon:qe.PaletteOutlined,label:f("properties.color"),children:(0,C.jsx)(ZX,{label:f("properties.color"),defaultValue:O,onChange:y})});case"fontFamily":return(0,C.jsx)(h1,{icon:tee,label:f("properties.fontFamily"),children:(0,C.jsx)(kKe,{label:f("properties.fontFamily"),defaultValue:O,onChange:y})});case"fontWeight":return(0,C.jsx)(h1,{icon:qe.FormatBoldOutlined,label:f("properties.fontWeight"),children:(0,C.jsx)(sho,{label:f("properties.fontWeight"),defaultValue:O,onChange:y})});case"textAlign":return d==="desktop"&&(0,C.jsx)(h1,{icon:qe.FormatAlignCenterOutlined,label:f("properties.alignment"),children:(0,C.jsx)(DKe,{label:f("properties.alignment"),defaultValue:O,onChange:y})});case"textAlignMobile":return d!="desktop"&&(0,C.jsx)(h1,{icon:qe.FormatAlignCenterOutlined,label:f("properties.alignment"),children:(0,C.jsx)(DKe,{label:f("properties.alignment"),defaultValue:O,onChange:y})});case"padding":return d==="desktop"&&(0,C.jsx)(h1,{icon:eee,label:f("properties.padding"),children:(0,C.jsx)(LKe,{label:f("properties.padding"),defaultValue:m("padding"),inheritedFrom:v("padding"),onChange:y,sidesLinked:t.paddingSidesLinked,onSidesLinkedChange:w=>r({...t,paddingSidesLinked:w})})});case"mobilePadding":return d!="desktop"&&(0,C.jsx)(h1,{icon:eee,label:f("properties.padding"),children:(0,C.jsx)(LKe,{label:f("properties.padding"),defaultValue:m("mobilePadding")??m("padding"),inheritedFrom:t.mobilePadding!=null?void 0:"default",onChange:y,sidesLinked:t.mobilePaddingSidesLinked,onSidesLinkedChange:w=>r({...t,mobilePaddingSidesLinked:w})})});case"fontSize":return d==="desktop"&&(0,C.jsx)(h1,{icon:qe.FormatSizeOutlined,label:f("properties.fontSize"),children:(0,C.jsx)(XX,{maxValue:80,step:8,label:f("properties.fontSize"),defaultValue:O??16,onChange:y})});case"fontSizeMobile":return d!="desktop"&&(0,C.jsx)(h1,{icon:qe.FormatSizeOutlined,label:f("properties.fontSize"),children:(0,C.jsx)(XX,{maxValue:80,step:8,label:f("properties.fontSize"),defaultValue:O,onChange:y})});case"lineHeight":return(0,C.jsx)(h1,{icon:qe.FormatLineSpacingOutlined,label:f("properties.lineHeight"),children:(0,C.jsx)(h95,{label:f("properties.lineHeight"),defaultValue:O??1.5,onChange:y})});case"shape":return(0,C.jsx)(h1,{icon:qe.RoundedCornerOutlined,label:f("properties.shape"),children:(0,C.jsx)(g95,{shapeSteps:a,maxValue:n,label:f("properties.shape"),defaultValue:O,onChange:y,cornersLinked:t.shapeCornersLinked,onCornersLinkedChange:w=>r({...t,shapeCornersLinked:w})})});case"height":return d==="desktop"&&(0,C.jsx)(h1,{icon:qe.HeightOutlined,label:f("properties.height"),children:(0,C.jsx)(HKe,{label:f("properties.height"),defaultValue:O,onChange:y})});case"heightMobile":return d!="desktop"&&(0,C.jsx)(h1,{icon:qe.HeightOutlined,label:f("properties.height"),children:(0,C.jsx)(HKe,{label:f("properties.height"),defaultValue:O,onChange:y})});case"width":return d==="desktop"&&(0,C.jsx)(h1,{icon:qe.WidthFullOutlined,label:f("properties.width"),children:(0,C.jsx)(uho,{label:f("properties.width"),defaultValue:m("width")??void 0,onChange:y})});case"widthMobile":return d!="desktop"&&(0,C.jsx)(h1,{icon:qe.WidthFullOutlined,label:f("properties.width"),children:(0,C.jsx)(uho,{label:f("properties.width"),defaultValue:m("widthMobile")??m("width")??void 0,onChange:y})});case"border":return d==="desktop"&&(0,C.jsx)(h1,{icon:qe.BorderStyleOutlined,label:f("properties.border"),children:(0,C.jsx)(EKe,{label:f("properties.border"),borderColor:t.borderColor??null,borderTop:g("borderTop"),borderBottom:g("borderBottom"),borderLeft:g("borderLeft"),borderRight:g("borderRight"),onChange:S,sidesLinked:t.borderSidesLinked,onSidesLinkedChange:w=>r({...t,borderSidesLinked:w})})});case"borderMobile":return d!="desktop"&&(0,C.jsx)(h1,{icon:qe.BorderStyleOutlined,label:f("properties.border"),children:(0,C.jsx)(EKe,{mobile:!0,label:f("properties.border"),borderColor:t.borderColor??null,borderTop:g("borderTopMobile")??g("borderTop"),borderBottom:g("borderBottomMobile")??g("borderBottom"),borderLeft:g("borderLeftMobile")??g("borderLeft"),borderRight:g("borderRightMobile")??g("borderRight"),onChange:S,sidesLinked:t.borderMobileSidesLinked,onSidesLinkedChange:w=>r({...t,borderMobileSidesLinked:w})})});default:return null}}zF();var p8={section:"style",key:"padding",kind:"padding",labelKey:"theme.fields.padding"},Gm={section:"style",key:"backgroundColor",kind:"color",labelKey:"theme.fields.backgroundColor"},A95={section:"style",key:"fontWeight",kind:"fontWeight",labelKey:"theme.fields.fontWeight"},y95={section:"style",key:"textAlign",kind:"textAlign",labelKey:"theme.fields.textAlign"},S95=["NotionText","Button","Image","Divider","Spacer","SocialMedia","Container","ColumnsContainer"],cho={NotionText:{titleKey:"theme.blocks.notionText.title",icon:she,fields:[Gm,{section:"style",key:"fontSize",kind:"fontSize",labelKey:"theme.fields.fontSize"},p8]},Button:{titleKey:"theme.blocks.button.title",icon:gHe,fields:[{section:"style",key:"buttonBackgroundColor",kind:"color",labelKey:"theme.fields.buttonBackgroundColor",icon:GW},{section:"style",key:"buttonTextColor",kind:"color",labelKey:"theme.fields.buttonTextColor",icon:ree},{section:"style",key:"fontSize",kind:"fontSize",labelKey:"theme.fields.fontSize"},A95,y95,Gm,p8]},Image:{titleKey:"theme.blocks.image.title",icon:zye,fields:[Gm,p8]},Divider:{titleKey:"theme.blocks.divider.title",icon:lye,fields:[{section:"style",key:"color",kind:"color",labelKey:"theme.fields.color",icon:GW},Gm,{section:"style",key:"width",kind:"number",labelKey:"theme.fields.width"},{section:"style",key:"height",kind:"number",labelKey:"theme.fields.height"},p8]},Spacer:{titleKey:"theme.blocks.spacer.title",icon:gve,fields:[Gm,{section:"style",key:"height",kind:"number",labelKey:"theme.fields.height"}]},SocialMedia:{titleKey:"theme.blocks.socialMedia.title",icon:hAe,fields:[Gm,p8]},Container:{titleKey:"theme.blocks.container.title",icon:OO,fields:[Gm,{section:"style",key:"border",kind:"border",labelKey:"theme.fields.border"},p8]},ColumnsContainer:{titleKey:"theme.blocks.columnsContainer.title",icon:BFe,fields:[Gm,p8]}};Lr();function Qm({title:e,children:t}){const r=fd(),n=vF(),a=(n?cho[n]:null)?.icon;return(0,C.jsxs)(G.Container,{sx:{padding:"0!important",paddingTop:"1rem!important"},children:[!r&&(0,C.jsx)(G.Typography,{sx:{fontWeight:"bold",mb:2,color:"text.primary",fontSize:"1.25rem"},children:e}),r&&a&&(0,C.jsx)(G.Tooltip,{title:e,placement:"left",children:(0,C.jsx)(G.Box,{sx:{display:"flex",justifyContent:"center",pb:1.5},children:(0,C.jsx)(a,{sx:{fontSize:22,color:"text.secondary"}})})}),(0,C.jsx)(G.Stack,{spacing:r?.5:1.5,sx:{mb:3,pt:r?0:1},children:t})]})}function xz(){return fd()?(0,C.jsx)(G.Divider,{sx:{my:.5}}):null}dr(),Lr();function dho(e){return{top:Number(e.top??0),bottom:Number(e.bottom??0),left:Number(e.left??0),right:Number(e.right??0)}}function T95({size:e,sizeMobile:t,sizePaddingSidesLinked:r,sizeMobilePaddingSidesLinked:n,onChange:a,label:d,maxValue:p=100,paddingSteps:h=8}){const{t:f}=Xt("inspector"),m=d??f("inputs.common.size"),v=ll(),[g,A]=(0,ie.useState)(()=>{const H=v==="desktop"?e:t!==void 0?t:e;return typeof H=="object"&&H!==null?dho(H):{top:8,bottom:8,left:16,right:16}}),y=v==="desktop"?r===!0:n===!0;(0,ie.useEffect)(()=>{const H=v==="desktop"?e:t!==void 0?t:e;typeof H=="object"&&H!==null&&A(dho(H))},[e,t,v]);const S=()=>{const H=v==="desktop"?e:t!==void 0?t:e;return typeof H=="object"&&H!==null?"custom":typeof H=="string"?H:"medium"},x=typeof p=="number"?p:Number(p)||100,O=H=>{if(v==="desktop"){const V={size:H==="custom"?g:H};t==null&&(V.sizeMobile=H==="custom"?g:H),a(V)}else a({sizeMobile:H==="custom"?g:H})},w=(H,V)=>{let F;y?F={top:V,bottom:V,left:V,right:V}:F={...g,[H]:V},A(F),a(v==="desktop"?{size:F}:{sizeMobile:F})},E=()=>{if(v==="desktop")if(y)a({sizePaddingSidesLinked:!1});else{const H={top:g.top,bottom:g.top,left:g.top,right:g.top};A(H),a({size:H,sizePaddingSidesLinked:!0})}else if(y)a({sizeMobilePaddingSidesLinked:!1});else{const H={top:g.top,bottom:g.top,left:g.top,right:g.top};A(H),a({sizeMobile:H,sizeMobilePaddingSidesLinked:!0})}},L=S();return(0,C.jsxs)(G.Stack,{spacing:2,children:[(0,C.jsxs)(py,{label:m,defaultValue:L,onChange:O,children:[(0,C.jsx)(G.ToggleButton,{value:"x-small",children:(0,C.jsx)(G.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:(0,C.jsx)("span",{children:f("inputs.responsiveSize.options.xSmall")})})}),(0,C.jsx)(G.ToggleButton,{value:"small",children:(0,C.jsx)(G.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:(0,C.jsx)("span",{children:f("inputs.responsiveSize.options.small")})})}),(0,C.jsx)(G.ToggleButton,{value:"medium",children:(0,C.jsx)(G.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:(0,C.jsx)("span",{children:f("inputs.responsiveSize.options.medium")})})}),(0,C.jsx)(G.ToggleButton,{value:"custom",children:(0,C.jsx)(G.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:(0,C.jsx)("span",{children:f("inputs.responsiveSize.options.custom")})})})]}),L==="custom"&&(0,C.jsxs)(G.Stack,{spacing:2,sx:{alignItems:"flex-start",pb:1},children:[(0,C.jsxs)(G.Stack,{direction:"row",sx:{justifyContent:"space-between",alignItems:"center",width:"100%"},children:[(0,C.jsx)(sn,{label:f("inputs.responsiveSize.customPadding")}),(0,C.jsx)(G.Tooltip,{title:f(y?"lockValues.unlockTooltip":"lockValues.lockTooltip"),children:(0,C.jsx)(G.IconButton,{size:"small",onClick:E,sx:{marginTop:"0!important",color:y?"primary.main":"text.secondary","&:hover":{backgroundColor:"action.hover"}},children:y?(0,C.jsx)(qe.Lock,{fontSize:"small"}):(0,C.jsx)(qe.LockOpen,{fontSize:"small"})})})]}),y?(0,C.jsx)(Di,{iconLabel:(0,C.jsx)(G.Typography,{variant:"body2",component:"span",children:f("inputs.responsiveSize.allSides")}),value:g.top,setValue:H=>w("top",H),units:"px",min:0,step:h,marks:h>1,max:x}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(Di,{iconLabel:(0,C.jsx)(qe.AlignVerticalTopOutlined,{sx:{fontSize:16}}),value:g.top,setValue:H=>w("top",H),units:"px",min:0,step:h,marks:h>1,max:x}),(0,C.jsx)(Di,{iconLabel:(0,C.jsx)(qe.AlignVerticalBottomOutlined,{sx:{fontSize:16}}),value:g.bottom,setValue:H=>w("bottom",H),units:"px",min:0,step:h,marks:h>1,max:x}),(0,C.jsx)(Di,{iconLabel:(0,C.jsx)(qe.AlignHorizontalLeftOutlined,{sx:{fontSize:16}}),value:g.left,setValue:H=>w("left",H),units:"px",min:0,step:h,marks:h>1,max:x}),(0,C.jsx)(Di,{iconLabel:(0,C.jsx)(qe.AlignHorizontalRightOutlined,{sx:{fontSize:16}}),value:g.right,setValue:H=>w("right",H),units:"px",min:0,step:h,marks:h>1,max:x})]})]})]})}dr(),Lr();function x95({fullWidth:e,fullWidthMobile:t,onChange:r,label:n="Width"}){const a=ll(),{t:d}=Xt("inspector"),p=()=>a==="desktop"?e:t!==void 0?t:e,h=f=>{const m=f==="FULL_WIDTH";if(a==="desktop"){const v={fullWidth:m};t==null&&(v.fullWidthMobile=m),r(v)}else r({fullWidthMobile:m})};return(0,C.jsxs)(py,{label:n,defaultValue:p()?"FULL_WIDTH":"AUTO",onChange:h,children:[(0,C.jsx)(G.ToggleButton,{value:"FULL_WIDTH",children:(0,C.jsxs)(G.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[(0,C.jsx)(qe.WidthFull,{fontSize:"small"}),(0,C.jsx)("span",{children:d("inputs.width.full")})]})}),(0,C.jsx)(G.ToggleButton,{value:"AUTO",children:(0,C.jsxs)(G.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[(0,C.jsx)(qe.WidthNormal,{fontSize:"small"}),(0,C.jsx)("span",{children:d("inputs.width.auto")})]})})]})}function C95(e,t){const r=(0,ie.useRef)(null),n=(0,ie.useRef)(e),a=(0,ie.useRef)([]);n.current=e;const d=(0,ie.useCallback)((...p)=>{a.current=p,r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{n.current(...p),r.current=null},t)},[t]);return d.flush=(0,ie.useCallback)(()=>{r.current&&(clearTimeout(r.current),r.current=null,n.current(...a.current))},[]),d}function nee({helperText:e,label:t,placeholder:r,rows:n,InputProps:a,defaultValue:d,onChange:p}){const[h,f]=(0,ie.useState)(d);(0,ie.useEffect)(()=>{h!==d&&f(d)},[d]);const m=C95(v=>{p(v)},150);return(0,C.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[(0,C.jsx)(sn,{label:t}),(0,C.jsx)(G.TextField,{fullWidth:!0,multiline:typeof n=="number"&&n>1,minRows:n,variant:"outlined",placeholder:r,helperText:e,slotProps:{input:a},value:h,sx:g5,onChange:v=>{const g=v.target.value;f(g),m(g)},onBlur:()=>{m.flush()}})]})}R4e(),Lr();function eu({names:e,value:t,onChange:r,disabledCSSValidation:n=!1,shapeMaxValue:a,shapeSteps:d}){const p=X6(),h=vF();return(fd()||n||p=="css"||bg.includes(h||""))&&(0,C.jsx)(C.Fragment,{children:e.map(f=>(0,C.jsx)(b95,{shapeMaxValue:a,shapeSteps:d,name:f,value:t||{},onChange:r},f))})}dr(),mNe(),Lr();function O95({data:e,setData:t}){const[,r]=(0,ie.useState)(null),n=AF(),{t:a}=Xt("inspector"),d=w=>{const E=RT.safeParse(w);E.success?(t(E.data),r(null)):r(E.error)},p=e.props?.text??Ip.text,h=e.props?.url??Ip.url,f=e.props?.fullWidth??Ip.fullWidth,m=e.props?.size??Ip.size,v=n,g=e.style?.buttonTextColor??e.props?.buttonTextColor??v?.textColor,A=e.style?.buttonBackgroundColor??e.props?.buttonBackgroundColor??Ip.buttonBackgroundColor,y=e.props?.fullWidthMobile,S=e.props?.sizeMobile,x=X6(),O=fd();return(0,C.jsxs)(Qm,{title:a("inputs.panels.button.title"),children:[(x=="block-configuration"||O)&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(eu,{disabledCSSValidation:!0,names:["fontFamily","fontSize","fontSizeMobile","fontWeight"],value:e.style,onChange:w=>d({...e,style:w})}),(0,C.jsx)(h1,{icon:qe.TitleOutlined,label:a("inputs.panels.button.textLabel"),children:(0,C.jsx)(nee,{label:a("inputs.panels.button.textLabel"),defaultValue:p,onChange:w=>d({...e,props:{...e.props,text:w}})})}),(0,C.jsx)(h1,{icon:qe.LinkOutlined,label:a("inputs.panels.button.targetLabel"),children:(0,C.jsx)(nee,{label:a("inputs.panels.button.targetLabel"),placeholder:a("inputs.panels.button.targetPlaceholder"),defaultValue:h,onChange:w=>d({...e,props:{...e.props,url:w}})})}),(0,C.jsx)(h1,{icon:qe.WidthFullOutlined,label:a("properties.width"),children:(0,C.jsx)(x95,{label:a("properties.width"),fullWidth:f,fullWidthMobile:y,onChange:w=>d({...e,props:{...e.props,...w}})})}),(0,C.jsx)(h1,{icon:qe.AspectRatioOutlined,label:a("properties.size","Size"),children:(0,C.jsx)(T95,{size:m,sizeMobile:S,sizePaddingSidesLinked:e.props?.sizePaddingSidesLinked,sizeMobilePaddingSidesLinked:e.props?.sizeMobilePaddingSidesLinked,onChange:w=>d({...e,props:{...e.props,...w}})})})]}),(0,C.jsx)(xz,{}),(0,C.jsx)(eu,{names:["shape","textAlign","textAlignMobile","backgroundColor","border","borderMobile","padding","mobilePadding"],value:e.style,shapeMaxValue:80,onChange:w=>d({...e,style:w})}),(x==="css"||O)&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h1,{icon:ree,label:a("inputs.panels.button.textColor"),children:(0,C.jsx)(d8,{label:a("inputs.panels.button.textColor"),defaultValue:g,onChange:w=>d({...e,style:{...e.style,buttonTextColor:w}})})}),(0,C.jsx)(h1,{icon:qe.PaletteOutlined,label:a("inputs.panels.button.buttonColor"),children:(0,C.jsx)(d8,{label:a("inputs.panels.button.buttonColor"),defaultValue:A,onChange:w=>d({...e,style:{...e.style,buttonBackgroundColor:w}})})})]})]})}hh();var w95=(e,t,r)=>{if(!e||!document)return;const n=q1(e),a=document.querySelector(`.${n}`);if(!a)return;const d=a.parentElement;if(!d)return;const p=Math.ceil(d.getBoundingClientRect().width);r.props?.touched||r.props?.width!==p&&t({...r,props:{...r.props,width:p}})},j95=e=>{if(!e||!document)return;const t=q1(e),r=document.querySelector(`.${t}`);if(!r)return;const n=r.parentElement;if(!n)return;const a=Math.ceil(n.getBoundingClientRect().width);return a||null};dr(),Lr();var M95={desktop:"contentAlignment",mobile:"contentAlignmentMobile"};function R95({data:e,updateData:t}){const{t:r}=Xt("inspector"),n=ll(),a=M95[n]||"contentAlignment",d=e.props?.[a]??e.props?.contentAlignment,p=h=>{t({...e,props:{...e.props,[a]:h}})};return(0,C.jsxs)(py,{label:r("inputs.alignment.label"),defaultValue:d,onChange:p,children:[(0,C.jsx)(G.ToggleButton,{value:"top",children:(0,C.jsx)(qe.VerticalAlignTopOutlined,{fontSize:"small"})}),(0,C.jsx)(G.ToggleButton,{value:"middle",children:(0,C.jsx)(qe.VerticalAlignCenterOutlined,{fontSize:"small"})}),(0,C.jsx)(G.ToggleButton,{value:"bottom",children:(0,C.jsx)(qe.VerticalAlignBottomOutlined,{fontSize:"small"})})]})}function pho({value:e,onChange:t,options:r}){return(0,C.jsx)(G.ToggleButtonGroup,{exclusive:!0,value:e,size:"small",onChange:(n,a)=>{typeof a=="string"&&t(a)},sx:{display:"flex",width:"100%"},children:r.map(n=>(0,C.jsx)(G.ToggleButton,{value:n.value,children:(0,C.jsxs)(G.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[n.icon,(0,C.jsx)("span",{children:n.label})]})},n.value))})}dr();var aee="layout-custom",VKe=[{id:"layout-50-50",distribution:[50,50,null]},{id:"layout-55-45",distribution:[55,45,null]},{id:"layout-45-55",distribution:[45,55,null]},{id:"layout-60-40",distribution:[60,40,null]},{id:"layout-40-60",distribution:[40,60,null]},{id:"layout-70-30",distribution:[70,30,null]},{id:"layout-30-70",distribution:[30,70,null]},{id:"layout-75-25",distribution:[75,25,null]},{id:"layout-25-75",distribution:[25,75,null]},{id:"layout-80-20",distribution:[80,20,null]},{id:"layout-20-80",distribution:[20,80,null]}],FKe=[{id:"layout-33-33-33",distribution:[33.34,33.33,33.33]},{id:"layout-30-40-30",distribution:[30,40,30]},{id:"layout-25-50-25",distribution:[25,50,25]},{id:"layout-20-60-20",distribution:[20,60,20]},{id:"layout-50-25-25",distribution:[50,25,25]},{id:"layout-25-25-50",distribution:[25,25,50]},{id:"layout-60-20-20",distribution:[60,20,20]},{id:"layout-20-20-60",distribution:[20,20,60]},{id:"layout-40-30-30",distribution:[40,30,30]},{id:"layout-40-20-40",distribution:[40,20,40]},{id:"layout-15-70-15",distribution:[15,70,15]}],Ym={grid:{display:"grid",gridTemplateColumns:"repeat(3, minmax(0, 1fr))",gap:"16px",width:"100%"},card:{cursor:"pointer",border:"1px solid #e5e7eb",borderRadius:"8px",backgroundColor:"primary"},cardContent:{padding:"8px"},layoutPreview:{display:"grid",gap:"4px",height:"30px",width:"100%",minHeight:"30px"}};function hho(e){const t=e?.[0];return typeof t=="number"&&!Number.isNaN(t)?Math.min(99,Math.max(1,Math.round(t))):50}function IKe(e){let t=typeof e?.[0]=="number"?Math.round(e[0]):34,r=typeof e?.[1]=="number"?Math.round(e[1]):33;return t=Math.min(98,Math.max(1,t)),r=Math.min(98,Math.max(1,r)),t+r>=99&&(r=Math.max(1,99-t)),[t,r]}var BKe=({fractions:e,highlight:t})=>{const r=(0,G.useTheme)(),n=t?r.palette.secondary.main:"#e5e7eb";return(0,C.jsx)("div",{style:{...Ym.layoutPreview,gridTemplateColumns:e.map(a=>`${a}fr`).join(" ")},children:e.map((a,d)=>(0,C.jsx)("div",{style:{minWidth:0,backgroundColor:n,borderRadius:"4px",transition:"background-color 0.2s ease"}},d))})},z95=({defaultValue:e,fixedWidths:t,onChange:r,columns:n})=>{const{t:a}=Xt("inspector"),d=(0,G.useTheme)(),[p,h]=(0,ie.useState)(null),[f,m]=(0,ie.useState)(!1),[v,g]=(0,ie.useState)(()=>hho(t??void 0)),[A,y]=(0,ie.useState)(()=>IKe(t??void 0)[0]),[S,x]=(0,ie.useState)(()=>IKe(t??void 0)[1]),O=e??(n===2?"layout-50-50":"layout-33-33-33"),w=p??(O==="layout-33-34-33"?"layout-33-33-33":O),[E,L]=(0,ie.useState)(n===2?VKe:FKe),H=(Y,ee)=>{h(null),m(!1),r({layout:Y,fixedWidths:ee})},V=()=>{if(h(aee),m(!0),n===2)g(hho(t??void 0));else{const[Y,ee]=IKe(t??void 0);y(Y),x(ee)}},F=()=>{if(n===2){const Y=v;r({layout:aee,fixedWidths:[Y,100-Y,null]})}else{const Y=A,ee=S;r({layout:aee,fixedWidths:[Y,ee,100-Y-ee]})}h(null)};(0,ie.useEffect)(()=>{L(n===2?VKe:FKe)},[n]),(0,ie.useEffect)(()=>{h(null),m(!1)},[n,e]),(0,ie.useEffect)(()=>{const Y=e;n===2?Y!=="layout-custom"&&(Y==null||!VKe.some(ee=>ee.id===Y))&&r({layout:"layout-50-50",fixedWidths:[50,50,null]}):Y==="layout-33-34-33"?r({layout:"layout-33-33-33",fixedWidths:[33.34,33.33,33.33]}):Y!=="layout-custom"&&(Y==null||!FKe.some(ee=>ee.id===Y))&&r({layout:"layout-33-33-33",fixedWidths:[33.34,33.33,33.33]})},[n,e,r]);const U=(Y,ee)=>{const re=ee;y(re),x(oe=>Math.max(1,Math.min(oe,100-re-1)))},I=(Y,ee)=>{const re=ee,oe=100-A-1;x(Math.max(1,Math.min(re,oe)))},$=100-v,Q=100-A-S,K=w===aee;return(0,C.jsxs)(No,{children:[(0,C.jsx)(sn,{label:a("inputs.layout.label")}),(0,C.jsxs)("div",{style:Ym.grid,children:[E.map(Y=>(0,C.jsx)("div",{onClick:()=>H(Y.id,Y.distribution),style:{...Ym.card,border:w===Y.id?`2px solid ${d.palette.secondary.main}`:Ym.card.border},children:(0,C.jsx)("div",{style:Ym.cardContent,children:(0,C.jsx)(BKe,{fractions:Y.distribution.filter(ee=>ee!=null),highlight:w===Y.id})})},Y.id)),(0,C.jsx)("div",{onClick:V,style:{...Ym.card,border:K?`2px solid ${d.palette.secondary.main}`:Ym.card.border},role:"button",tabIndex:0,onKeyDown:Y=>{(Y.key==="Enter"||Y.key===" ")&&(Y.preventDefault(),V())},children:(0,C.jsx)("div",{style:Ym.cardContent,children:(0,C.jsx)(G.Box,{sx:{width:"100%",height:30,minHeight:30,border:"1px dashed",borderColor:"divider",borderRadius:1,display:"flex",alignItems:"center",justifyContent:"center",bgcolor:K?"action.selected":"action.hover",color:"text.primary",transition:d.transitions.create(["background-color"],{duration:d.transitions.duration.shorter})},children:(0,C.jsx)(qe.EditOutlined,{sx:{fontSize:18,color:"text.primary"}})})})})]}),(0,C.jsx)(G.Collapse,{in:f,timeout:"auto",unmountOnExit:!0,children:(0,C.jsxs)(G.Box,{sx:{mt:2,p:2,borderRadius:1,border:1,borderColor:"divider",bgcolor:"background.paper"},children:[n===2?(0,C.jsxs)(G.Stack,{spacing:2,sx:{mt:1},children:[(0,C.jsxs)(G.Typography,{variant:"body2",color:"text.secondary",children:[v,"% | ",$,"%"]}),(0,C.jsx)(G.Slider,{value:v,min:1,max:99,step:1,valueLabelDisplay:"auto","aria-label":a("inputs.layout.custom.split2"),onChange:(Y,ee)=>g(ee)}),(0,C.jsx)(BKe,{fractions:[v,$],highlight:!0})]}):(0,C.jsxs)(G.Stack,{spacing:2,sx:{mt:1},children:[(0,C.jsxs)(G.Typography,{variant:"body2",color:"text.secondary",children:[A,"% | ",S,"% | ",Q,"%"]}),(0,C.jsxs)(G.Box,{children:[(0,C.jsx)(G.Typography,{variant:"caption",color:"text.secondary",component:"div",children:a("inputs.layout.custom.firstColumn")}),(0,C.jsx)(G.Slider,{value:A,min:1,max:98,step:1,valueLabelDisplay:"auto",onChange:U})]}),(0,C.jsxs)(G.Box,{children:[(0,C.jsx)(G.Typography,{variant:"caption",color:"text.secondary",component:"div",children:a("inputs.layout.custom.secondColumn")}),(0,C.jsx)(G.Slider,{value:S,min:1,max:100-A-1,step:1,valueLabelDisplay:"auto",onChange:I})]}),(0,C.jsx)(BKe,{fractions:[A,S,Q],highlight:!0})]}),(0,C.jsx)(G.Button,{variant:"contained",size:"small",sx:{mt:2},onClick:F,children:(0,C.jsx)(G.Typography,{variant:"button",component:"span",sx:{color:"#FFFFFF",fontWeight:"bold"},children:a("inputs.layout.custom.apply")})})]})})]})};function P95({label:e,tooltipTitle:t,hideWarning:r}){return(0,C.jsxs)(G.Box,{sx:{display:"flex",alignItems:"center",gap:.5,flexWrap:"wrap"},children:[(0,C.jsx)(sn,{label:e}),!r&&(0,C.jsx)(G.Tooltip,{title:t,placement:"top",children:(0,C.jsx)(G.IconButton,{size:"small",color:"warning",disableRipple:!0,sx:{p:0,cursor:"help",lineHeight:0,"&:hover":{backgroundColor:"transparent"}},children:(0,C.jsx)(oho,{"aria-hidden":!0})})})]})}dr(),Lr();var fho=(e=>(0,C.jsx)(G.SvgIcon,{...e,viewBox:"0 0 24 24",children:(0,C.jsxs)("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[(0,C.jsx)("path",{d:"M10.5 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v5.5m-6.7 9.1l1-.4M15 3v7.5m.2 6.4l-.9-.3m2.3 5.1l.3-.9m-.1-5.5l-.4-1m2.7.9l.3-.9m.2 7.4l-.4-1m1.5-3.9l1-.4m0 3l-.9-.3M9 3v18"}),(0,C.jsx)("circle",{cx:"18",cy:"18",r:"3"})]})}));fho.muiName="ColumnsCountIcon";function E95({data:e,setData:t}){const[,r]=(0,ie.useState)(null),[n,a]=(0,ie.useState)(e.props?.columnsCount??2),d=X6(),p=ll(),h=fd(),{t:f}=Xt("inspector"),m=S=>{const x=Ke.getState().document,O=S.filter(w=>x[w]?.type==="Image");p==="desktop"&&O.forEach(w=>{const E=x[w];if(E?.type!=="Image")return;const L=E.data;w95(w,H=>{bz(w,V=>V.type!=="Image"?V:{...V,data:H})},L)})},v=S=>{const x=MKe.safeParse(S);x.success?(x.data.props.columns.map(O=>m(O.childrenIds)),t(x.data),n&&x.data.props?.columnsCount!==n&&a(x.data.props?.columnsCount??2),r(null)):(console.error("Error on columns: ",x.error),r(x.error))},g={layout:"layout-50-50",fixedWidths:[50,50,null],columnsCount:2},A={layout:"layout-33-34-33",fixedWidths:[33,34,33],columnsCount:3},y=S=>{const x=e.props.columns.length===2?[...e.props.columns,{childrenIds:[]}]:[...e.props.columns];return S==="2"?{...g,columns:x}:{...A,columns:x}};return(0,C.jsxs)(Qm,{title:f("inputs.panels.columns.title"),children:[(d=="block-configuration"||h)&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h1,{icon:fho,label:f("inputs.panels.columns.countLabel"),children:(0,C.jsxs)(No,{children:[(0,C.jsx)(sn,{label:f("inputs.panels.columns.countLabel")}),(0,C.jsx)(G.Box,{sx:{...GBe,paddingLeft:0,paddingRight:0,height:"auto",minHeight:"36px"},children:(0,C.jsx)(pho,{value:e.props?.columnsCount===2?"2":"3",onChange:S=>{const x=y(S);v({...e,props:{...e.props,...x}})},options:[{value:"2",label:"2",icon:(0,C.jsx)(qe.SplitscreenOutlined,{fontSize:"small"})},{value:"3",label:"3",icon:(0,C.jsx)(qe.ViewWeekOutlined,{fontSize:"small"})}]})})]})}),(0,C.jsx)(h1,{icon:qe.TableChartOutlined,label:f("inputs.panels.columns.layoutLabel","Layout"),children:(0,C.jsx)(z95,{columns:e.props?.columnsCount??3,defaultValue:e.props?.layout,fixedWidths:e.props?.fixedWidths??void 0,onChange:({layout:S,fixedWidths:x})=>{const O=e.props.columns.length===2?[...e.props.columns,{childrenIds:[]}]:e.props.columns;v({...e,props:{...e.props,layout:S,fixedWidths:x,columns:O}})}})})]}),(d=="css"||h)&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(xz,{}),(0,C.jsx)(h1,{icon:qe.PhoneIphoneOutlined,label:f("inputs.panels.columns.stackColumnsOnMobile"),children:(0,C.jsxs)(No,{children:[(0,C.jsx)(P95,{label:f("inputs.panels.columns.stackColumnsOnMobile"),tooltipTitle:f("inputs.panels.columns.stackColumnsOnMobileWarning")}),(0,C.jsx)(G.Box,{sx:{width:"100%",...GBe,paddingLeft:0,paddingRight:0,height:"auto",minHeight:"36px"},children:(0,C.jsx)(pho,{value:e.props?.stackColumnsOnMobile?"stacked":"sideBySide",onChange:S=>{v({...e,props:{...e.props,stackColumnsOnMobile:S==="stacked"}})},options:[{value:"sideBySide",label:f("inputs.panels.columns.stackToggleSideBySide"),icon:(0,C.jsx)(qe.ViewColumnOutlined,{fontSize:"small"})},{value:"stacked",label:f("inputs.panels.columns.stackToggleStacked"),icon:(0,C.jsx)(qe.TableRowsOutlined,{fontSize:"small"})}]})})]})}),(0,C.jsx)(h1,{icon:qe.AlignVerticalCenterOutlined,label:f("inputs.alignment.label"),children:(0,C.jsx)(R95,{data:e,updateData:t})}),(0,C.jsx)(eu,{names:["backgroundColor","background","padding","mobilePadding"],value:e.style,onChange:S=>v({...e,style:S})})]})]})}dr();function mho({data:e,setData:t}){const[,r]=(0,ie.useState)(null),{t:n}=Xt("inspector"),a=d=>{const p=Ypo.safeParse(d);p.success?(t(p.data),r(null)):r(p.error)};return(0,C.jsx)(Qm,{title:n("inputs.panels.container.title"),children:(0,C.jsx)(eu,{names:["backgroundColor","background","border","borderMobile","shape","padding","mobilePadding"],value:e.style,shapeSteps:30,onChange:d=>a({...e,style:d})})})}dr(),vNe();function vho({data:e,setData:t}){const[,r]=(0,ie.useState)(null),{t:n}=Xt("inspector"),a=d=>{const p=PT.safeParse(d);p.success?(t(p.data),r(null)):r(p.error)};return(0,C.jsx)(Qm,{title:n("inputs.panels.divider.title"),children:(0,C.jsx)(eu,{names:["width","widthMobile","height","heightMobile","color","backgroundColor","textAlign","textAlignMobile","padding","mobilePadding"],value:e.style,onChange:d=>a({...e,style:d})})})}dr();var k95=({label:e,linkColor:t,underline:r=!1,onChange:n})=>{const[a,d]=(0,ie.useState)(t??"#FF0000"),[p,h]=(0,ie.useState)(r),{t:f}=Xt("inspector"),m=e??f("inputs.links.color"),v=p?"enabled":"disabled",g={container:{width:"100%"}};(0,ie.useEffect)(()=>{t!==a&&d(t??"#FF0000")},[t]),(0,ie.useEffect)(()=>{r!==p&&h(r)},[r]);const A=S=>{const x=S??"#FF0000";d(x),n({linkColor:x,underline:p})},y=(S,x)=>{if(!x)return;const O=x==="enabled";h(O),n({linkColor:a,underline:O})};return(0,C.jsxs)(No,{children:[(0,C.jsx)(d8,{label:m,defaultValue:a,onChange:A}),(0,C.jsx)(sn,{label:f("inputs.links.underline")}),(0,C.jsx)(G.Box,{sx:g.container,children:(0,C.jsxs)(G.ToggleButtonGroup,{value:v,exclusive:!0,fullWidth:!0,onChange:y,sx:{width:"100%"},children:[(0,C.jsx)(G.ToggleButton,{value:"enabled",children:(0,C.jsx)(G.Tooltip,{title:f("inputs.links.underlineOn"),children:(0,C.jsx)(G.Box,{component:"span",sx:{display:"inline-flex",alignItems:"center",justifyContent:"center"},children:(0,C.jsx)(qe.FormatUnderlined,{fontSize:"small"})})})}),(0,C.jsx)(G.ToggleButton,{value:"disabled",children:(0,C.jsx)(G.Tooltip,{title:f("inputs.links.underlineOff"),children:(0,C.jsx)(G.Box,{component:"span",sx:{display:"inline-flex",alignItems:"center",justifyContent:"center"},children:(0,C.jsx)(qe.FormatClear,{fontSize:"small"})})})})]})})]})};dr(),hA();function _ho({data:e,setData:t}){const[,r]=(0,ie.useState)(null),{t:n}=Xt("inspector"),a=d=>{const p=Kpo.safeParse(d);p.success?(t(p.data),r(null)):r(p.error)};return(0,C.jsxs)(G.Stack,{spacing:1,children:[(0,C.jsx)(h1,{icon:Tz,label:n("inputs.panels.emailLayout.backgroundColor"),children:(0,C.jsx)(d8,{label:n("inputs.panels.emailLayout.backgroundColor"),defaultValue:e.backdropColor??"#F5F5F5",onChange:d=>a({...e,backdropColor:d})})}),(0,C.jsx)(h1,{icon:qe.CropSquareOutlined,label:n("inputs.panels.emailLayout.canvasColor"),children:(0,C.jsx)(d8,{label:n("inputs.panels.emailLayout.canvasColor"),defaultValue:e.canvasColor??"#FFFFFF",onChange:d=>a({...e,canvasColor:d})})}),(0,C.jsx)(h1,{icon:tee,label:n("inputs.panels.emailLayout.fontFamily"),children:(0,C.jsx)(kKe,{label:n("inputs.panels.emailLayout.fontFamily"),defaultValue:e.fontFamily||cNe.FAMILY,onChange:d=>a({...e,fontFamily:d})})}),(0,C.jsx)(h1,{icon:ree,label:n("inputs.panels.emailLayout.textColor"),children:(0,C.jsx)(d8,{label:n("inputs.panels.emailLayout.textColor"),defaultValue:e.textColor??"#262626",onChange:d=>a({...e,textColor:d})})}),(0,C.jsx)(h1,{icon:qe.LinkOutlined,label:n("inputs.panels.emailLayout.linksLabel"),children:(0,C.jsx)(k95,{label:n("inputs.panels.emailLayout.linksLabel"),linkColor:e.linkGlobal?.linkColor||"#000000",underline:e.linkGlobal?.underline||!1,onChange:d=>a({...e,linkGlobal:d})})})]})}hh(),Lr();var H95=(e,t,r)=>{const n=ll();(0,ie.useEffect)(()=>{const a=()=>{if(!e||!document||n=="mobile")return;const h=q1(e),f=document.querySelector(`.${h}`);if(!f)return;const m=f.parentElement;if(!m)return;const v=Math.ceil(m.getBoundingClientRect().width);r.props?.size===void 0||r.props?.size==="original"||r.props?.touched&&r.props?.width<=v||r.props?.width!==v&&!r.props?.touched&&t({...r,props:{...r.props,width:v}})};a();const d=new ResizeObserver(a),p=document.querySelector(`.${q1(e)}`);return p?.parentElement&&d.observe(p.parentElement),()=>{d.disconnect()}},[e,t,r,n])};dr(),Tq(),Lr();var L95=({data:e,setData:t,blockId:r})=>{const{t:n}=Xt("inspector"),[a,d]=(0,ie.useState)(!1),[p,h]=(0,ie.useState)(()=>!!window.__emailBuilderEnableAI),[,f]=(0,ie.useState)(null),[m,v]=(0,ie.useState)(""),[g,A]=(0,ie.useState)(!1),[y,S]=(0,ie.useState)(""),[x,O]=(0,ie.useState)(!1),w=(0,ie.useRef)(null),[E,L]=(0,ie.useState)(null),H=tBo(),V=nBo(),F=H||V,[U,I]=(0,ie.useState)(()=>!!window.__emailBuilderUnsplashEnabled);(0,ie.useEffect)(()=>{const pe=()=>{I(!!window.__emailBuilderUnsplashEnabled)};return pe(),window.addEventListener("email-builder-unsplash-updated",pe),()=>window.removeEventListener("email-builder-unsplash-updated",pe)},[]),(0,ie.useEffect)(()=>{const pe=window.__emailBuilderCustomImageProvider;pe&&(L(pe),setTimeout(()=>{r&&window.dispatchEvent(new CustomEvent("email-builder-image-panel-opened",{detail:{blockId:r,currentImageUrl:e.props?.url||null,alt:e.props?.alt||null}}))},100))},[]);const $=pe=>{const Z=h_.safeParse(pe);Z.success?(t(Z.data),f(null)):f(Z.error)},Q=(pe,Z)=>{const be=pe.toLowerCase(),ve=be.includes(".svg")||be.includes("svg"),ge=Z&&(Z.includes("image/svg+xml")||Z.includes("svg"));return ve||!!ge},K=async pe=>{try{A(!0),S(""),O(!1);try{new URL(pe)}catch{return S(n("inputs.image.invalidUrl")),!1}const Z=new AbortController,be=setTimeout(()=>Z.abort(),1e4);try{const ve=await fetch(pe,{method:"HEAD",signal:Z.signal});if(clearTimeout(be),!ve.ok)return S(n("inputs.image.httpError",{status:ve.status,statusText:ve.statusText})),!1;const ge=ve.headers.get("content-type");return["image/","image/svg+xml","text/xml","application/xml"].some(_e=>ge&&ge.toLowerCase().includes(_e.toLowerCase()))?(Q(pe,ge)&&O(!0),S(""),!0):(S(n("inputs.image.notImage")),!1)}catch(ve){return clearTimeout(be),ve.name==="AbortError"?(S(n("inputs.image.timeout")),!1):new Promise(ge=>{const _e=new Image,je=setTimeout(()=>{S(n("inputs.image.timeout")),ge(!1)},1e4);_e.onload=()=>{clearTimeout(je),Q(pe)&&O(!0),S(""),ge(!0)},_e.onerror=()=>{clearTimeout(je),S(n("inputs.image.loadError")),ge(!1)},_e.src=pe})}}catch{return S(n("inputs.image.unexpectedError")),!1}finally{A(!1)}},Y=async()=>{m.trim()&&await K(m.trim())&&($({...e,props:{...e.props,url:m.trim()}}),r&&cy(r),v(""))},ee=pe=>{pe.key==="Enter"&&Y()},re=pe=>{v(pe.target.value),y&&S(""),x&&O(!1)},oe=pe=>{const Z=["image/png","image/jpeg","image/gif"],ve=pe.filter(_e=>Z.includes(_e.type)&&_e.size<=5242880);if(ve.length!==pe.length&&alert(n("inputs.common.invalidFiles")),ve.length===0)return;const ge=ve.map(_e=>new Promise(je=>{const Fe=new FileReader;Fe.onload=Me=>je(Me.target?.result),Fe.readAsDataURL(_e)}));Promise.all(ge).then(_e=>{const je={images:_e,id:r||""};window.dispatchEvent(new CustomEvent("email-builder-upload-image",{detail:je})),yg(!0,r||"")})},le=pe=>{pe.preventDefault(),d(!0)},X=pe=>{const Z=pe.currentTarget.getBoundingClientRect(),be=pe.clientX,ve=pe.clientY;(be<Z.left||be>=Z.right||ve<Z.top||ve>=Z.bottom)&&d(!1)},se=pe=>{pe.preventDefault(),d(!1);const Z=Array.from(pe.dataTransfer.files);Z.length>0&&oe(Z)},Ae=()=>{const pe=new CustomEvent("toggle-media-library",{detail:!0});window.dispatchEvent(pe)};(0,ie.useEffect)(()=>{const pe=window.__emailBuilderEnableAI;pe!==void 0&&h(!!pe);const Z=be=>{const{detail:ve}=be;h(!!ve)};return window.addEventListener("email-builder-ai-generation",Z),()=>{window.removeEventListener("email-builder-ai-generation",Z)}},[]),(0,ie.useEffect)(()=>{const pe=ge=>{const{detail:_e}=ge;yg(!1,_e.id||""),r&&(Az(r,{url:_e.url}),cy(r)),eSt(!1)},Z=ge=>{yg(ge?.detail?.uploading??!1,ge?.detail?.id??"")},be=()=>{w?.current?.click()},ve=ge=>{if(!r)return;const _e=ge.detail;if(typeof _e=="string"){Az(r,{url:_e}),cy(r);return}if(_e&&typeof _e=="object"&&typeof _e.url=="string"){const je={url:_e.url};typeof _e.alt=="string"&&(je.alt=_e.alt),Az(r,je)}};return window.addEventListener("email-builder-set-image",ve),window.addEventListener("email-builder-upload-image-receive",pe),window.addEventListener("email-builder-upload-file",be),window.addEventListener("email-builder-toggle-upload-file",Z),()=>{window.removeEventListener("email-builder-toggle-upload-file",Z),window.removeEventListener("email-builder-upload-image-receive",pe),window.removeEventListener("email-builder-set-image",ve),window.removeEventListener("email-builder-upload-file",be)}},[r]),(0,ie.useEffect)(()=>{e.props?.url&&O(Q(e.props.url))},[e.props?.url]);const ze=()=>(0,C.jsxs)(G.Stack,{spacing:1,children:[(0,C.jsx)(No,{children:H&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(sn,{label:n("inputs.image.urlLabel")}),(0,C.jsxs)(G.Stack,{direction:"row",spacing:1,children:[(0,C.jsx)(G.TextField,{fullWidth:!0,placeholder:n("inputs.image.urlPlaceholder"),value:m,onChange:re,onKeyPress:ee,error:!!y,disabled:g,sx:g5}),(0,C.jsx)(G.Button,{variant:"contained",onClick:Y,disabled:!m.trim()||g,sx:{minWidth:"auto",px:2},children:g?(0,C.jsx)(G.CircularProgress,{size:20,color:"inherit"}):n("inputs.common.add")})]}),y&&(0,C.jsx)(G.Alert,{severity:"error",sx:{mt:1,fontSize:"0.875rem"},children:y}),x&&(0,C.jsx)(G.Alert,{severity:"warning",sx:{mt:1,fontSize:"0.875rem"},action:(0,C.jsx)(G.IconButton,{"aria-label":n("inputs.common.close"),color:"inherit",size:"small",onClick:()=>O(!1),children:(0,C.jsx)(qe.Close,{fontSize:"inherit"})}),children:n("inputs.common.svgWarning")})]})}),H&&V&&(0,C.jsxs)(G.Stack,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[(0,C.jsx)(G.Divider,{sx:{flexGrow:1}}),(0,C.jsx)(G.Typography,{variant:"caption",sx:{color:"text.secondary"},children:n("inputs.backgroundImage.or")}),(0,C.jsx)(G.Divider,{sx:{flexGrow:1}})]}),V&&(0,C.jsxs)(G.Box,{onDragOver:le,onDragLeave:X,onDrop:se,sx:{width:"100%",border:"2px dashed",borderColor:a?"primary.main":"divider",borderRadius:"8px",padding:3,textAlign:"center",bgcolor:a?"action.hover":"background.paper",transition:"all 0.2s ease"},children:[(0,C.jsx)(G.Box,{sx:{display:"flex",justifyContent:"center",mb:1},children:(0,C.jsx)(qe.PhotoOutlined,{sx:{fontSize:28,color:"primary.main"}})}),(0,C.jsxs)("label",{style:{cursor:"pointer"},children:[(0,C.jsx)("input",{ref:w,type:"file",style:{display:"none"},accept:"image/png,image/jpeg,image/gif",multiple:!0,onChange:pe=>{const Z=pe.target.files;Z&&Z.length>0&&oe(Array.from(Z))}}),(0,C.jsx)(G.Typography,{component:"span",sx:{fontWeight:600,color:"primary.main"},children:n("inputs.common.uploadFile")}),(0,C.jsxs)(G.Typography,{component:"span",sx:{fontWeight:500,color:"text.secondary"},children:[" ",n("inputs.common.dragAndDrop")]})]}),(0,C.jsx)(G.Typography,{variant:"caption",sx:{color:"text.secondary",mt:1,display:"block"},children:n("inputs.common.fileInfo")})]}),!E&&JIo()&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(G.Stack,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[(0,C.jsx)(G.Divider,{sx:{flexGrow:1}}),(0,C.jsx)(G.Typography,{variant:"caption",sx:{color:"text.secondary"},children:n("inputs.backgroundImage.or")}),(0,C.jsx)(G.Divider,{sx:{flexGrow:1}})]}),(0,C.jsx)(G.Button,{variant:"outlined",onClick:Ae,startIcon:(0,C.jsx)(qe.ImageSearchOutlined,{}),fullWidth:!0,children:n("inputs.backgroundImage.browseGallery")})]})]});return(0,C.jsxs)(G.Stack,{spacing:1,children:[(0,C.jsx)(aho,{imageUrl:e.props?.url??null,alt:e.props?.alt??"",blockId:r,onRemove:()=>{r&&(Az(r,{url:null}),cy(r)),$({...e,props:{...e.props??{},url:null}})}}),(0,C.jsx)(Xpo,{tabs:[{key:"gallery",label:n("inputs.tabs.gallery"),visible:U,render:()=>(0,C.jsx)(rho,{blockId:r,source:"image"})},{key:"yourGallery",label:n("inputs.tabs.yourGallery"),visible:!!E,render:()=>(0,C.jsx)(G.Box,{children:E})},{key:"upload",label:n("inputs.tabs.upload"),visible:F,render:ze},{key:"generate",label:n("inputs.tabs.generate"),visible:p,render:()=>(0,C.jsx)(G.Box,{sx:{py:1},children:(0,C.jsx)(nho,{src:e.props?.url,style:{width:"100%",margin:0}})})}],defaultTab:"upload"})]})};dr();var D95=({defaultValue:e="original",scale:t=100,onChange:r})=>{const[n,a]=(0,ie.useState)(e),[d,p]=(0,ie.useState)(t),h=(0,G.useTheme)(),{t:f}=Xt("inspector"),m={container:{width:"100%"},label:{marginBottom:"8px",fontSize:"14px",fontWeight:500,color:h.palette.text.primary},sliderContainer:{marginTop:"16px",padding:"0 8px"},slider:{"& .MuiSlider-thumb":{width:12,height:12,backgroundColor:h.palette.primary.main,"&:hover":{boxShadow:`0 0 0 8px ${h.palette.primary.main}20`}},"& .MuiSlider-rail":{height:4,backgroundColor:h.palette.grey[300]},"& .MuiSlider-track":{height:4,backgroundColor:h.palette.primary.main}},scaleValue:{marginTop:"4px",textAlign:"right",fontSize:"14px",color:h.palette.text.secondary}};(0,ie.useEffect)(()=>{(e!==n||t!==d)&&(e!==n&&a(e),e==="scale"&&p(t))},[e,t]);const v=(A,y)=>{y!==null&&(a(y),r&&r({mode:y,scale:y==="scale"?d:void 0}))},g=A=>{p(A),r&&r({mode:n,scale:A})};return(0,C.jsxs)(No,{children:[(0,C.jsx)(sn,{label:f("inputs.sizeSelector.label")}),(0,C.jsxs)(G.Box,{sx:m.container,children:[(0,C.jsxs)(G.ToggleButtonGroup,{value:n,exclusive:!0,onChange:v,sx:{width:"100%"},children:[(0,C.jsx)(G.ToggleButton,{value:"original",children:(0,C.jsxs)(G.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[(0,C.jsx)(qe.FitScreen,{fontSize:"small"}),(0,C.jsx)("span",{children:f("inputs.sizeSelector.contain")})]})}),(0,C.jsx)(G.ToggleButton,{value:"fill",children:(0,C.jsxs)(G.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[(0,C.jsx)(qe.Crop,{fontSize:"small"}),(0,C.jsx)("span",{children:f("inputs.sizeSelector.cover")})]})}),(0,C.jsx)(G.ToggleButton,{value:"scale",children:(0,C.jsxs)(G.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[(0,C.jsx)(qe.Percent,{fontSize:"small"}),(0,C.jsx)("span",{children:f("inputs.sizeSelector.scale")})]})})]}),(0,C.jsx)(G.Collapse,{in:n==="scale",children:(0,C.jsx)(G.Box,{sx:m.sliderContainer,children:(0,C.jsx)(Di,{iconLabel:(0,C.jsx)(qe.WidthWideOutlined,{}),value:d,setValue:g,marks:!1,units:"%",min:1,max:100})})})]})]})};dr(),Tq(),v5(),Lr();var gho={cover:(0,C.jsx)(qe.Crop,{fontSize:"small"}),contain:(0,C.jsx)(qe.FitScreen,{fontSize:"small"}),fill:(0,C.jsx)(qe.AspectRatio,{fontSize:"small"})},bho=e=>e==="cover"||e==="contain"||e==="fill"?gho[e]:gho.cover,Aho=e=>e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1);function V95({data:e,setData:t}){const[r,n]=(0,ie.useState)(null),a=iO(),d=X6(),p=ll(),h=fd(),{t:f}=Xt("inspector");H95(a||"",t,e),ie.useEffect(()=>{a&&window.dispatchEvent(new CustomEvent("email-builder-image-panel-opened",{detail:{blockId:a,currentImageUrl:e.props?.url||null,alt:e.props?.alt||null,source:"image"}}))},[a,e.props?.url,e.props?.alt]);const m=(0,ie.useCallback)(H=>{const V=h_.safeParse(H);V.success?JSON.stringify(e)!==JSON.stringify(V.data)&&(t(V.data),n(null)):n(V.error)},[e,t]),v=(0,ie.useCallback)((H,V,F)=>{const U=j95(a)||600,I={...H.props};if(F&&(I.touchedMobile=!0),V.mode==="original"){const $=H.props?.original_width??null;return F?{...I,sizeMobile:V.mode,widthMobile:$}:{...I,size:V.mode,width:$,sizeMobile:I.touchedMobile?I.sizeMobile:V.mode,widthMobile:I.touchedMobile?I.widthMobile:$}}if(V.mode==="fill")return F?{...I,sizeMobile:V.mode,widthMobile:null}:{...I,size:V.mode,width:null,sizeMobile:I.touchedMobile?I.sizeMobile:V.mode,widthMobile:I.touchedMobile?I.widthMobile:null};if(V.mode==="scale"){const $=Math.ceil(U/100*V.scale);return F?{...I,sizeMobile:V.mode,scaleMobile:V.scale,widthMobile:$}:{...I,size:V.mode,scale:V.scale,width:$,sizeMobile:I.touchedMobile?I.sizeMobile:V.mode,scaleMobile:I.touchedMobile?I.scaleMobile:V.scale,widthMobile:I.touchedMobile?I.widthMobile:$}}return I},[a]),g=(0,ie.useCallback)((H,V)=>{const F=v(e,H,V);m({...e,props:F})},[e,m,v]),A=(0,ie.useMemo)(()=>p!=="desktop"?{size:e.props?.touchedMobile?e.props?.sizeMobile:e.props?.size??"original",scale:e.props?.touchedMobile?e.props?.scaleMobile:e.props?.scale}:{size:e.props?.size??"original",scale:e.props?.scale},[p,e.props?.touchedMobile,e.props?.sizeMobile,e.props?.size,e.props?.scaleMobile,e.props?.scale]),y=(0,ie.useCallback)(H=>{m({...e,props:{...e.props,alt:H}})},[e,m]),S=(0,ie.useCallback)(H=>{const V=H.trim().length===0?null:H.trim();m({...e,props:{...e.props,linkHref:V}})},[e,m]),x=(0,ie.useCallback)(H=>{m({...e,style:H})},[e,m]),O=(0,ie.useMemo)(()=>p!=="desktop"?e.style?.heightMobile??e.style?.height??void 0:e.style?.height??void 0,[p,e.style?.height,e.style?.heightMobile]),w=(0,ie.useCallback)(H=>{const V=p!=="desktop",F={...e.style??{}};V?F.heightMobile=H:F.height=H,m({...e,style:F})},[e,m,p]),E=(0,ie.useCallback)(H=>{const V=p!=="desktop",F={...e.style??{}};V?F.objectFitMobile=H:F.objectFit=H,m({...e,style:F})},[e,m,p]),L=(0,ie.useCallback)(H=>{const V=p!=="desktop",F={...e.style??{}};V?F.objectPositionMobile=H:F.objectPosition=H,m({...e,style:F})},[e,m,p]);return(0,C.jsxs)(Qm,{title:f("inputs.panels.image.title"),children:[(d==="block-configuration"||h)&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h1,{icon:qe.WallpaperOutlined,label:f("inputs.panels.image.title"),children:(0,C.jsx)(L95,{data:e,setData:t,blockId:a})}),(0,C.jsx)(h1,{icon:qe.DescriptionOutlined,label:f("inputs.panels.image.altLabel"),children:(0,C.jsx)(nee,{label:f("inputs.panels.image.altLabel"),placeholder:f("inputs.panels.image.altPlaceholder"),defaultValue:e.props?.alt??"",onChange:y})}),(0,C.jsx)(h1,{icon:qe.LinkOutlined,label:f("inputs.panels.image.urlLabel"),children:(0,C.jsx)(nee,{label:f("inputs.panels.image.urlLabel"),placeholder:f("inputs.panels.image.urlPlaceholder"),defaultValue:e.props?.linkHref??"",onChange:S})}),(0,C.jsx)(h1,{icon:qe.AspectRatio,label:f("inputs.panels.image.sizeLabel","Size"),children:(0,C.jsx)(D95,{defaultValue:A.size,scale:A.scale??void 0,onChange:H=>g(H,p!=="desktop")})}),(0,C.jsx)(h1,{icon:qe.HeightOutlined,label:f("inputs.panels.image.heightLabel"),children:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(HKe,{label:f("inputs.panels.image.heightLabel"),defaultValue:O??void 0,min:0,max:800,step:4,onChange:H=>w(H>0?H:null)}),O?(0,C.jsxs)(G.Stack,{direction:"row",spacing:2,sx:{mt:1},children:[(0,C.jsxs)("div",{style:{flex:1,minWidth:0},children:[(0,C.jsx)(sn,{label:f("inputs.panels.image.objectFitLabel")}),(0,C.jsx)(Qu,{style:{width:"100%"},size:"small",value:p==="desktop"?e.style?.objectFit??"cover":e.style?.objectFitMobile??e.style?.objectFit??"cover",onChange:H=>E(H.target.value),renderValue:H=>{const V=String(H??"cover");return(0,C.jsxs)(G.Box,{sx:{display:"flex",alignItems:"center",gap:1,paddingRight:"1rem"},children:[bho(V),f(`inputs.panels.image.objectFit${Aho(V)}`)]})},children:["cover","contain","fill"].map(H=>(0,C.jsx)(G.MenuItem,{value:H,sx:{padding:"0.5rem 1rem 0.5rem 0.5rem!important"},children:(0,C.jsxs)(G.Box,{sx:{display:"flex",alignItems:"center",gap:1},children:[bho(H),f(`inputs.panels.image.objectFit${Aho(H)}`)]})},H))})]}),(()=>{const H=p==="desktop"?e.style?.objectFit??"cover":e.style?.objectFitMobile??e.style?.objectFit??"cover",V=p==="desktop"?e.style?.objectPosition??"center":e.style?.objectPositionMobile??e.style?.objectPosition??"center";return H==="fill"?null:(0,C.jsxs)("div",{style:{flex:1,minWidth:0},children:[(0,C.jsx)(sn,{label:f("inputs.panels.image.objectPositionLabel")}),(0,C.jsx)(Qu,{style:{width:"100%"},size:"small",value:V,onChange:F=>L(String(F.target.value)),renderValue:F=>{const U=String(F??"center");return(0,C.jsxs)(G.Box,{sx:{display:"flex",alignItems:"center",gap:1,paddingRight:"1rem"},children:[qX(U),f(`inputs.backgroundImage.positions.${JX(U)}`)]})},children:l95.map(F=>(0,C.jsx)(G.MenuItem,{value:F,sx:{padding:"0.5rem 1rem 0.5rem 0.5rem!important"},children:(0,C.jsxs)(G.Box,{sx:{display:"flex",alignItems:"center",gap:1},children:[qX(F),f(`inputs.backgroundImage.positions.${JX(F)}`)]})},F))})]})})()]}):null]})})]}),(0,C.jsx)(xz,{}),(0,C.jsx)(eu,{names:["textAlign","textAlignMobile","backgroundColor","shape","padding","mobilePadding"],value:e.style,shapeMaxValue:300,shapeSteps:20,onChange:x})]})}dr(),Lr();function F95({data:e,setData:t}){const r=X6(),n=fd(),{t:a}=Xt("inspector"),d=e.style||{},p=h=>{const f={...d||{},...h||{}};t({...e,style:f})};return(0,C.jsxs)(Qm,{title:a("inputs.panels.notionText.title","Text"),children:[(r==="block-configuration"||n)&&(0,C.jsxs)(C.Fragment,{children:[n?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(eu,{disabledCSSValidation:!0,names:["fontFamily"],value:d,onChange:p}),(0,C.jsx)(eu,{disabledCSSValidation:!0,names:["lineHeight"],value:d,onChange:p})]}):(0,C.jsxs)("div",{style:{display:"flex",gap:"8px"},children:[(0,C.jsx)("div",{style:{flex:1},children:(0,C.jsx)(eu,{disabledCSSValidation:!0,names:["fontFamily"],value:d,onChange:p})}),(0,C.jsx)("div",{style:{flex:1},children:(0,C.jsx)(eu,{disabledCSSValidation:!0,names:["lineHeight"],value:d,onChange:p})})]}),(0,C.jsx)(eu,{disabledCSSValidation:!0,names:["fontSize","fontSizeMobile"],value:d,onChange:p})]}),(r==="css"||n)&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(xz,{}),(0,C.jsx)(eu,{names:["backgroundColor","border","borderMobile","padding","mobilePadding"],value:d,onChange:p})]})]})}dr();var I95=({element:e,index:t,moveItem:r,onSelectChange:n,onUrlChange:a,onRemove:d,onDuplicate:p,canRemove:h,theme:f})=>{const m=(0,ie.useRef)(null),[v,g]=(0,ie.useState)(null),{t:A}=Xt("inspector"),y=$=>{const Q=$.getClientOffset(),K=m.current?.getBoundingClientRect();if(!Q||!K)return null;const Y=(K.bottom-K.top)/2;return Q.y-K.top<Y?"up":"down"},[{handlerId:S,isOver:x},O]=GE(()=>({accept:"social-media-item",collect($){return{handlerId:$.getHandlerId(),isOver:$.isOver({shallow:!0})}},hover($,Q){if(!m.current)return;if($.index===t){g(null);return}if(!Q.isOver({shallow:!0})){g(null);return}const K=y(Q);g(K)},drop($,Q){if(g(null),!m.current)return;const K=$.index,Y=t;if(K===Y)return;const ee=y(Q);let re=Y;ee==="down"&&(re=Y+1),K<re&&(re=re-1),setTimeout(()=>{r(K,re)},0),$.index=re},end:()=>{g(null)}}),[e.id,t,r]),[{isDragging:w},E]=X9(()=>({type:"social-media-item",item:()=>({id:e.id,index:t}),collect:$=>({isDragging:$.isDragging()}),end:()=>{g(null)}}),[e.id,t]);(0,ie.useEffect)(()=>{x||g(null)},[x]);const L=w?.4:1;(0,ie.useEffect)(()=>{if(m.current&&E&&O){const $=m.current;E($),O($)}},[E,O]);const H=()=>{setTimeout(()=>d(t),0)},V=()=>{setTimeout(()=>p(t),0)},F=$=>{const Q=$.target.value;setTimeout(()=>n(t,Q,e),0)},U=$=>{const Q=$.target.value;setTimeout(()=>a(t,Q,e),0)},I=()=>(0,C.jsxs)("div",{style:{height:"3px",background:f.palette.secondary.main,position:"relative",color:f.palette.secondary.main,margin:"4px 0"},children:[(0,C.jsx)("svg",{style:{position:"absolute",left:"-25px",top:"50%",transform:"translateY(-50%)"},width:"20",height:"20",viewBox:"0 0 32 32",children:(0,C.jsx)("path",{fill:"currentColor",d:"M28 12H10a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h18a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2M10 4v6h18V4zm18 26H10a2 2 0 0 1-2-2v-6a2 2 0 0 1 2-2h18a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2m-18-8v6h18v-6zm-1-6l-5.586-5.586L2 11.828L6.172 16L2 20.172l1.414 1.414z"})}),(0,C.jsx)("svg",{style:{position:"absolute",right:"-25px",top:"50%",transform:"translateY(-50%) scaleX(-1)"},width:"20",height:"20",viewBox:"0 0 32 32",children:(0,C.jsx)("path",{fill:"currentColor",d:"M28 12H10a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h18a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2M10 4v6h18V4zm18 26H10a2 2 0 0 1-2-2v-6a2 2 0 0 1 2-2h18a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2m-18-8v6h18v-6zm-1-6l-5.586-5.586L2 11.828L6.172 16L2 20.172l1.414 1.414z"})})]});return(0,C.jsxs)(C.Fragment,{children:[v==="up"&&(0,C.jsx)(I,{}),(0,C.jsxs)(G.Stack,{ref:m,"data-handler-id":S,sx:{border:1,borderColor:"divider",padding:1,paddingTop:0,borderRadius:1,backgroundColor:"background.paper",marginBottom:1.5,opacity:L,cursor:w?"grabbing":"grab",boxShadow:w?f.shadows[3]:"none"},spacing:1,children:[(0,C.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",borderBottom:`1px solid ${f.palette.divider}`},children:[(0,C.jsx)("div",{style:{display:"flex",alignItems:"center"},children:(0,C.jsx)(qe.DragIndicator,{sx:{color:w?"primary.main":"text.secondary",cursor:"grab",marginLeft:-.9,"&:hover":{color:"primary.main"}}})}),(0,C.jsxs)("div",{children:[(0,C.jsx)(G.Tooltip,{title:"Duplicate",placement:"left",children:(0,C.jsx)(G.IconButton,{color:"primary",size:"small",onClick:V,children:(0,C.jsx)("svg",{width:"20",height:"20",viewBox:"0 0 24 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,C.jsx)("path",{d:"M18 2.5H9C7.9 2.5 7 3.4 7 4.5V16.5C7 17.6 7.9 18.5 9 18.5H18C19.1 18.5 20 17.6 20 16.5V4.5C20 3.4 19.1 2.5 18 2.5ZM18 16.5H9V4.5H18V16.5ZM3 15.5V13.5H5V15.5H3ZM3 10H5V12H3V10ZM10 20.5H12V22.5H10V20.5ZM3 19V17H5V19H3ZM5 22.5C3.9 22.5 3 21.6 3 20.5H5V22.5ZM8.5 22.5H6.5V20.5H8.5V22.5ZM13.5 22.5V20.5H15.5C15.5 21.6 14.6 22.5 13.5 22.5ZM5 6.5V8.5H3C3 7.4 3.9 6.5 5 6.5Z",fill:"currentColor"})})})}),h&&(0,C.jsx)(G.Tooltip,{title:"Remove",placement:"left",children:(0,C.jsx)(G.IconButton,{color:"error",size:"small",onClick:H,children:(0,C.jsx)(qe.DeleteOutlined,{sx:{fontSize:20}})})})]})]}),(0,C.jsxs)("div",{style:{width:"100%",display:"flex",flexDirection:"column",gap:"0.5rem"},children:[(0,C.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"40px auto",gap:"4px",alignItems:"center"},children:[(0,C.jsx)(sn,{label:A("inputs.social.icon")}),(0,C.jsx)(Qu,{fullWidth:!0,labelId:"demo-simple-select-label",id:"demo-simple-select",value:e.key,size:"small",onChange:F,children:pz.map($=>(0,C.jsx)(G.MenuItem,{value:$.key,children:$.label},`${e.id}_${$.key}`))})]}),(0,C.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"40px auto",gap:"4px",alignItems:"center"},children:[(0,C.jsx)(sn,{label:A("inputs.social.url")}),(0,C.jsx)(G.TextField,{size:"small",fullWidth:!0,value:e.href??"",onChange:U,variant:"outlined",placeholder:"https://your-website.com",sx:g5})]})]})]}),v==="down"&&(0,C.jsx)(I,{})]})};function B95({items:e=[],onChange:t}){const{t:r}=Xt("inspector"),n=(0,G.useTheme)(),[a,d]=(0,ie.useState)(()=>e.map(O=>({...O,id:O.id||oM()}))),[p,h]=(0,ie.useState)(e[0]?.theme||"positive"),[f,m]=(0,ie.useState)(e[0]?.size||"medium");(0,ie.useEffect)(()=>{e.length>0&&(h(e[0].theme),m(e[0].size),d(e.map(O=>({...O,id:O.id||oM()}))))},[e]);const v=(O,w)=>{d(E=>{const L=[...E],[H]=L.splice(O,1);return L.splice(w,0,H),t&&setTimeout(()=>t(L),0),L})},g=()=>{d(O=>{const w={...pz[0],theme:p,size:f,sizePx:pa(f),url:Nn(pz[0].iconName,p,f),id:oM()},E=[...O,w];return t&&setTimeout(()=>t(E),0),E})},A=O=>{d(w=>{const E=w.filter((L,H)=>H!==O);return t&&setTimeout(()=>t(E),0),E})},y=(O,w,E)=>{let L=[...a];if(w in Sf5?(h(w),L=L.map(H=>{const V=Nn(H.iconName,w,H.size);return{...H,theme:w,url:V}})):w in Tf5&&(m(w),L=L.map(H=>{const V=Nn(H.iconName,H.theme,w),F=pa(w);return{...H,size:w,sizePx:F,url:V}})),O!==null&&E){const H=pz.find(V=>V.key===w);H&&(L=L.map((V,F)=>{const U={key:H.key,label:H.label,iconName:H.iconName,href:H.href},I=Nn(U.iconName,E.theme,E.size);return F===O?{...V,...U,url:I,id:E.id}:V}))}d(L),t&&setTimeout(()=>t(L),0)},S=(O,w,E)=>{const L=a.map((H,V)=>V===O?{...E,href:w}:H);d(L),t&&setTimeout(()=>t(L),0)},x=O=>{d(w=>{const E={...JSON.parse(JSON.stringify(w[O])),id:oM()},L=[...w.slice(0,O+1),E,...w.slice(O+1)];return t&&setTimeout(()=>t(L),0),L})};return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)("div",{style:{marginBottom:"1rem",display:"grid",gridTemplateColumns:"repeat(2,1fr)",gap:"1rem"},children:[(0,C.jsxs)(No,{children:[(0,C.jsx)(sn,{label:r("inputs.social.theme")}),(0,C.jsx)(Qu,{fullWidth:!0,labelId:"theme-selector",id:"theme-selector",value:p,size:"small",onChange:O=>y(null,O.target.value,null),children:Hpo.map(O=>(0,C.jsx)(G.MenuItem,{value:O.key,children:O.label},`${O.key}`))})]}),(0,C.jsxs)(No,{children:[(0,C.jsx)(sn,{label:r("inputs.social.size")}),(0,C.jsx)(Qu,{fullWidth:!0,labelId:"size-selector",id:"size-selector",value:f,size:"small",onChange:O=>y(null,O.target.value,null),children:SKe.map(O=>(0,C.jsx)(G.MenuItem,{value:O.key,children:O.label},`${O.key}`))})]})]}),a?.map((O,w)=>(0,C.jsx)(I95,{element:O,index:w,moveItem:v,onSelectChange:y,onUrlChange:S,onRemove:A,onDuplicate:x,canRemove:a.length>1,theme:n},O.id)),(0,C.jsx)(G.Button,{onClick:g,sx:{borderRadius:1},variant:"contained",endIcon:(0,C.jsx)(qe.Add,{}),children:"Add"})]})}dr(),tQe(),Lr();var N95=({data:e,setData:t})=>{const[,r]=(0,ie.useState)(null),n=ll(),{t:a}=Xt("inspector"),d=g=>{const A=kZ.safeParse(g);A.success?(t(A.data),r(null)):r(A.error)},p=g=>{d({...e,items:g})},h=g=>{d({...e,style:g})},f=(g,A=!1)=>{if(A){d({...e,gapMobile:g});return}d({...e,gap:g})},m=X6(),v=fd();return(0,C.jsxs)(Qm,{title:a("inputs.panels.social.title"),children:[(m=="block-configuration"||v)&&(0,C.jsx)(h1,{icon:qe.ShareOutlined,label:a("inputs.panels.social.title"),children:(0,C.jsx)(G.Box,{sx:{minWidth:120,margin:1},children:(0,C.jsx)(B95,{items:e?.items??[],onChange:p})})}),(m=="css"||v)&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(xz,{}),(0,C.jsx)(h1,{icon:qe.SpaceBar,label:a("inputs.panels.social.gap"),children:(0,C.jsxs)(No,{children:[(0,C.jsx)(sn,{label:a("inputs.panels.social.gap")}),n=="desktop"?(0,C.jsx)(Di,{iconLabel:(0,C.jsx)(qe.SpaceBar,{sx:{color:"text.primary"}}),value:Number(e?.gap??4),setValue:g=>f(g,!1),marks:!0,step:4,units:"px",min:0,max:40}):(0,C.jsx)(Di,{iconLabel:(0,C.jsx)(qe.SpaceBar,{sx:{color:"text.primary"}}),value:Number(e?.gapMobile??e?.gap??4),setValue:g=>f(g,!0),marks:!0,step:4,units:"px",min:0,max:40})]})}),(0,C.jsx)(eu,{names:["textAlign","textAlignMobile","backgroundColor","padding","mobilePadding"],value:e.style,onChange:g=>h(g)})]})]})};dr(),rQe();function yho({data:e,setData:t}){const[,r]=(0,ie.useState)(null),{t:n}=Xt("inspector"),a=d=>{const p=kT.safeParse(d);p.success?(t(p.data),r(null)):r(p.error)};return(0,C.jsx)(Qm,{title:n("inputs.panels.spacer.title"),children:(0,C.jsx)(eu,{names:["height","heightMobile","backgroundColor"],value:e.style,onChange:d=>a({...e,style:d})})})}Lr();function Sho(e){return(0,C.jsx)(G.Box,{sx:{m:3,p:1,border:"1px dashed",borderColor:"divider"},children:(0,C.jsx)(G.Typography,{color:"text.secondary",children:e})})}function $95(){const e=iO(),t=Jyt(e||""),r=(0,ie.useCallback)(d=>{e&&bz(e,()=>d)},[e]);if(!e)return Sho("Click on a block to inspect.");if(!t)return Sho(`Block with id ${e} was not found. Click on a block to reset.`);const{data:n,type:a}=t;switch(a){case"Button":return(0,C.jsx)(O95,{data:n,setData:d=>r({type:a,data:d})},e);case"ColumnsContainer":return(0,C.jsx)(E95,{data:n,setData:d=>r({type:a,data:d})},e);case"Container":return(0,C.jsx)(mho,{data:n,setData:d=>r({type:a,data:d})},e);case"Divider":return(0,C.jsx)(vho,{data:n,setData:d=>r({type:a,data:d})},e);case"Image":return(0,C.jsx)(V95,{data:n,setData:d=>r({type:a,data:d})},e);case"EmailLayout":return(0,C.jsx)(_ho,{data:n,setData:d=>r({type:a,data:d})},e);case"Spacer":return(0,C.jsx)(yho,{data:n,setData:d=>r({type:a,data:d})},e);case"NotionText":return(0,C.jsx)(F95,{data:n,setData:d=>r({type:a,data:d})},e);case"SocialMedia":return(0,C.jsx)(N95,{data:n,setData:d=>r({type:a,data:d})},e);default:return(0,C.jsx)("pre",{children:JSON.stringify(t,null," ")})}}var U95=(0,ie.memo)($95),W95="email-builder-standalone",G95="4.3.1",Q95="module",Y95="./dist/index.cjs",K95="./dist/index.mjs",q95="./dist/index.d.ts",J95={".":{types:"./dist/index.d.ts",import:"./dist/index.mjs",require:"./dist/index.cjs"},"./standalone":{import:"./dist/standalone.mjs"},"./style.css":"./dist/style.css"},Z95=["*.css"],X95={node:">=24"},e65="A React email builder component with drag and drop functionality",t65="AGPL-3.0",r65={name:"Laravel42",email:"hello@laravel42.com",url:"https://github.com/laravel42/"},n65=["dist","vite.config.standalone.ts"],a65={prepack:"pnpm build:all && node prepare-publish.cjs clean",postpack:"node prepare-publish.cjs restore","dev:publish":"pnpm version patch && pnpm publish --no-git-checks",build:"vite build","build:standalone":"vite build --config vite.config.standalone.ts","build:all":"pnpm build && pnpm build:standalone"},i65={"@codexteam/icons":"^0.3.3","@eb/document-core":"workspace:*","@emoji-mart/data":"^1.2.1","@emoji-mart/react":"^1.1.1","@emotion/cache":"^11.14.0","@emotion/react":"^11.14.0","@emotion/styled":"^11.14.1","@floating-ui/react":"^0.27.20","@josecortez1/c42-core":"0.1.0","@josecortez1/c42-react":"0.1.0","@mui/icons-material":"^9.2.0","@mui/material":"^9.2.0","@r2wc/react-to-web-component":"^2.1.1","@tiptap/core":"^3.28.0","@tiptap/extension-color":"^3.28.0","@tiptap/extension-link":"^3.28.0","@tiptap/extension-placeholder":"^3.28.0","@tiptap/extension-text-align":"^3.28.0","@tiptap/extension-text-style":"^3.28.0","@tiptap/extension-underline":"^3.28.0","@tiptap/pm":"^3.28.0","@tiptap/react":"^3.28.0","@tiptap/starter-kit":"^3.28.0","@tiptap/suggestion":"^3.28.0","approve-builds":"^1.0.0",csso:"^5.0.5","driver.js":"^1.8.0","emoji-mart":"^5.6.0","fast-json-patch":"^3.1.1","highlight.js":"^11.11.1","html-to-image":"1.11.13",i18next:"^26.3.6","i18next-browser-languagedetector":"^8.2.1","lucide-react":"^1.25.0",prettier:"^3.9.5",r:"^0.0.5",react:"^19.2.7","react-colorful":"^5.8.0","react-dnd":"^16.0.1","react-dnd-html5-backend":"^16.0.1","react-dnd-preview":"^9.0.0","react-dnd-touch-backend":"^16.0.1","react-dom":"^19.2.7","react-i18next":"^17.0.10","react-sticky-el":"^2.1.1",use:"^3.1.1","vite-plugin-dts":"^5.0.3",zod:"^4.4.3",zustand:"^5.0.14"},o65={react:">=18.0.0 || ^19.0.0","react-dom":">=18.0.0 || ^19.0.0"},l65={react:{optional:!0},"react-dom":{optional:!0}},s65={"@codexteam/icons":"^0.3.3","@eb/block-button":"workspace:*","@eb/block-columns-container":"workspace:*","@eb/block-container":"workspace:*","@eb/block-divider":"workspace:*","@eb/block-image":"workspace:*","@eb/block-notion-text":"workspace:*","@eb/block-social-media":"workspace:*","@eb/block-spacer":"workspace:*","@eb/email-builder":"workspace:*","@types/react":"^18.3.18","@types/react-dom":"^18.3.5","@typescript-eslint/eslint-plugin":"^8.64.0","@typescript-eslint/parser":"^8.64.0","@vitejs/plugin-react-swc":"^4.3.1","editorjs-undo":"^2.0.28",esbuild:"^0.28.1",eslint:"^10.7.0","eslint-plugin-react-hooks":"^7.1.1","eslint-plugin-react-refresh":"^0.5.3","eslint-plugin-simple-import-sort":"^14.0.0",rolldown:"1.1.5",react:"^19.2.1","react-dom":"^19.2.1",typescript:"^6.0.3",vite:"^8.1.5"},u65=["email-builder","email-template","react","typescript","wysiwyg"],Cz={name:W95,version:G95,type:Q95,main:Y95,module:K95,types:q95,exports:J95,sideEffects:Z95,engines:X95,description:e65,license:t65,author:r65,files:n65,scripts:a65,dependencies:i65,peerDependencies:o65,peerDependenciesMeta:l65,devDependencies:s65,keywords:u65};dr();function c65({onReset:e,visible:t}){const{t:r}=Xt("inspector");return t?(0,C.jsx)(G.Tooltip,{title:r("theme.reset"),placement:"left",children:(0,C.jsx)(G.IconButton,{size:"small",onClick:e,sx:{color:"primary.main",flexShrink:0,width:32,height:32,"&:hover":{backgroundColor:"action.hover"}},children:(0,C.jsx)(qe.RestartAltOutlined,{fontSize:"small"})})}):(0,C.jsx)("span",{"aria-hidden":"true",style:{display:"inline-block",width:32,height:32,flexShrink:0}})}dr(),Lr();var d65={top:0,right:0,bottom:0,left:0},p65={color:Tz,padding:eee,fontSize:qe.FormatSizeOutlined,fontFamily:tee,fontWeight:qe.FormatBoldOutlined,textAlign:qe.FormatAlignCenterOutlined,number:qe.FormatSizeOutlined,border:qe.BorderStyleOutlined};function h65({blockType:e,field:t}){const{t:r}=Xt("inspector"),{value:n,isOverridden:a,set:d,reset:p}=Sg(e,t.section,t.key),[h,f]=(0,ie.useState)(!0),m=Sz[e]?.[t.section]?.[t.key],v=r(t.labelKey),g=(0,C.jsx)(c65,{onReset:p,visible:a}),A=t.icon??p65[t.kind];switch(t.kind){case"color":return(0,C.jsx)(h1,{icon:A,label:v,modified:a,children:(0,C.jsx)(ZX,{label:v,labelAction:g,defaultValue:n??m??null,onChange:y=>y===null?p():d(y)})});case"padding":return(0,C.jsx)(h1,{icon:A,label:v,modified:a,children:(0,C.jsx)(LKe,{label:v,labelAction:g,defaultValue:n??m??d65,inheritedFrom:a?void 0:"default",onChange:y=>d(y),sidesLinked:h,onSidesLinkedChange:f})});case"fontSize":return(0,C.jsx)(h1,{icon:A,label:v,modified:a,children:(0,C.jsx)(XX,{label:v,labelAction:g,defaultValue:n??m??16,onChange:y=>d(y)})});case"fontFamily":return(0,C.jsx)(h1,{icon:A,label:v,modified:a,children:(0,C.jsx)(kKe,{label:v,labelAction:g,defaultValue:n??m??null,onChange:y=>y===null?p():d(y)})});case"fontWeight":return(0,C.jsx)(h1,{icon:A,label:v,modified:a,children:(0,C.jsx)(sho,{label:v,labelAction:g,defaultValue:n??m??"normal",onChange:y=>d(y)})});case"textAlign":return(0,C.jsx)(h1,{icon:A,label:v,modified:a,children:(0,C.jsx)(DKe,{label:v,labelAction:g,defaultValue:n??m??null,onChange:y=>y===null?p():d(y)})});case"number":return(0,C.jsx)(h1,{icon:A,label:v,modified:a,children:(0,C.jsx)(XX,{label:v,labelAction:g,defaultValue:n??m??0,onChange:y=>d(y)})});case"border":return(0,C.jsx)(h1,{icon:A,label:v,modified:a,children:(0,C.jsx)(f65,{blockType:e,field:t})});default:return t.kind,null}}function f65({blockType:e,field:t}){const{t:r}=Xt("inspector"),n=Sg(e,t.section,"borderColor"),a=Sg(e,t.section,"borderTop"),d=Sg(e,t.section,"borderBottom"),p=Sg(e,t.section,"borderLeft"),h=Sg(e,t.section,"borderRight"),[f,m]=(0,ie.useState)(!0),v=Sz[e]?.[t.section],g=A=>{A.borderColor!==void 0&&n.set(A.borderColor),A.borderTop!==void 0&&a.set(A.borderTop),A.borderBottom!==void 0&&d.set(A.borderBottom),A.borderLeft!==void 0&&p.set(A.borderLeft),A.borderRight!==void 0&&h.set(A.borderRight)};return(0,C.jsx)(EKe,{label:r(t.labelKey),borderColor:n.value??v?.borderColor??null,borderTop:a.value??v?.borderTop??0,borderBottom:d.value??v?.borderBottom??0,borderLeft:p.value??v?.borderLeft??0,borderRight:h.value??v?.borderRight??0,onChange:g,sidesLinked:f,onSidesLinkedChange:m})}dr(),Lr();function m65({blockType:e,spec:t,defaultExpanded:r=!1}){const{t:n}=Xt("inspector"),a=FIo(e),d=fd(),p=v65(a)>0,h=t.icon;return(0,C.jsxs)(G.Accordion,{defaultExpanded:r,disableGutters:!0,square:!0,sx:{boxShadow:"none",borderTop:f=>`1px solid ${f.palette.divider}`,"&:before":{display:"none"}},children:[(0,C.jsx)(G.AccordionSummary,{expandIcon:d?void 0:(0,C.jsx)(qe.ExpandMoreOutlined,{}),sx:{px:0,minHeight:d?40:48,justifyContent:d?"center":void 0,"& .MuiAccordionSummary-content":{my:d?.5:1,justifyContent:d?"center":void 0}},children:d?(0,C.jsx)(G.Tooltip,{title:n(t.titleKey),placement:"left",children:(0,C.jsxs)(G.Box,{sx:{position:"relative",display:"flex",alignItems:"center",p:.5,borderRadius:2,color:"text.secondary"},children:[(0,C.jsx)(h,{fontSize:"small"}),p&&(0,C.jsx)(G.Box,{component:"span","aria-label":n("theme.modified","Modified"),sx:{position:"absolute",top:2,right:2,width:6,height:6,borderRadius:"50%",bgcolor:"primary.main"}})]})}):(0,C.jsx)(G.Stack,{direction:"row",spacing:1,sx:{width:"100%",alignItems:"center"},children:(0,C.jsxs)(G.Box,{sx:{position:"relative",display:"inline-flex"},children:[(0,C.jsx)(G.Typography,{sx:{fontWeight:600,color:"text.primary"},children:n(t.titleKey)}),p&&(0,C.jsx)(G.Box,{component:"span","aria-label":n("theme.modified","Modified"),sx:{position:"absolute",top:-1,right:-8,width:6,height:6,borderRadius:"50%",bgcolor:"primary.main"}})]})})}),(0,C.jsx)(G.AccordionDetails,{sx:{p:0,pb:3},children:(0,C.jsx)(G.Stack,{spacing:2,children:t.fields.map(f=>(0,C.jsx)(h65,{blockType:e,field:f},`${f.section}.${f.key}`))})})]})}function v65(e){return e?(e.style?Object.keys(e.style).length:0)+(e.props?Object.keys(e.props).length:0):0}dr(),Lr();function _65({defaultExpanded:e=!0}){const{t}=Xt("inspector"),r=tho("root"),n=fd();if(!r||r.type!=="EmailLayout")return null;const{data:a}=r;return(0,C.jsxs)(G.Accordion,{defaultExpanded:e,disableGutters:!0,square:!0,sx:{boxShadow:"none",borderTop:d=>`1px solid ${d.palette.divider}`,"&:before":{display:"none"}},children:[(0,C.jsx)(G.AccordionSummary,{expandIcon:n?void 0:(0,C.jsx)(qe.ExpandMoreOutlined,{}),sx:{px:0,minHeight:n?40:48,justifyContent:n?"center":void 0,"& .MuiAccordionSummary-content":{my:n?.5:1,justifyContent:n?"center":void 0}},children:n?(0,C.jsx)(G.Tooltip,{title:t("theme.blocks.root.title"),placement:"left",children:(0,C.jsx)(G.Box,{sx:{display:"flex",p:.5,borderRadius:2,color:"text.secondary"},children:(0,C.jsx)(qe.TuneOutlined,{fontSize:"small"})})}):(0,C.jsx)(G.Typography,{sx:{fontWeight:600,color:"text.primary"},children:t("theme.blocks.root.title")})}),(0,C.jsx)(G.AccordionDetails,{sx:{px:0,pt:0,pb:3},children:(0,C.jsx)(G.Stack,{spacing:2,children:(0,C.jsx)(_ho,{data:a,setData:d=>{E4e(),bz("root",()=>({type:"EmailLayout",data:d}))}})})})]})}Lr(),bv();async function g65(e){const t=await e.json().catch(()=>null);if(!e.ok)throw e.status===403&&t?.hint?new Error(t.hint):new Error(t?.error??`HTTP ${e.status}`);return t}async function Tho(e){return ad()==="local"?tn5(e):g65(await fetch(`${id()}/dev/save-theme`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}))}dr(),Lr();var NKe=100,$Ke=280;function b65({open:e,onClose:t,onSaved:r}){const{t:n}=Xt("inspector"),[a,d]=(0,ie.useState)(""),[p,h]=(0,ie.useState)(""),[f,m]=(0,ie.useState)(!1),[v,g]=(0,ie.useState)(null),A=a.trim(),y=A.length>0&&A.length<=NKe&&p.length<=$Ke,S=(0,ie.useCallback)(()=>{f||(d(""),h(""),g(null),t())},[f,t]),x=(0,ie.useCallback)(async()=>{if(!(!y||f)){m(!0),g(null);try{const O=$Io(),w=await Tho({name:A,description:p.trim()||void 0,bundle:O});r?.(w.id),d(""),h(""),t()}catch(O){g(O instanceof Error?O.message:String(O))}finally{m(!1)}}},[y,f,A,p,t,r]);return(0,C.jsxs)(G.Dialog,{open:e,onClose:S,maxWidth:"sm",fullWidth:!0,children:[(0,C.jsx)(G.DialogTitle,{children:n("theme.save.title","Save current theme")}),(0,C.jsx)(G.DialogContent,{children:(0,C.jsxs)(G.Stack,{spacing:2,sx:{mt:1},children:[(0,C.jsx)(G.Typography,{variant:"body2",color:"text.secondary",children:n("theme.save.description","Snapshots the current root globals and per-block-type theme overrides. Saved themes can be reapplied later from the Components Library.")}),(0,C.jsx)(G.TextField,{label:n("theme.save.nameLabel","Name"),value:a,onChange:O=>d(O.target.value),placeholder:n("theme.save.namePlaceholder","e.g. Brand default"),autoFocus:!0,fullWidth:!0,disabled:f,slotProps:{htmlInput:{maxLength:NKe}},helperText:`${A.length}/${NKe}`}),(0,C.jsx)(G.TextField,{label:n("theme.save.descriptionLabel","Description (optional)"),value:p,onChange:O=>h(O.target.value),fullWidth:!0,multiline:!0,minRows:2,disabled:f,slotProps:{htmlInput:{maxLength:$Ke}},helperText:`${p.length}/${$Ke}`}),v&&(0,C.jsx)(G.Alert,{severity:"error",children:v})]})}),(0,C.jsxs)(G.DialogActions,{children:[(0,C.jsx)(G.Button,{onClick:S,disabled:f,children:n("theme.save.cancel","Cancel")}),(0,C.jsx)(G.Button,{onClick:x,variant:"contained",disabled:!y||f,children:f?n("theme.save.submitting","Saving…"):n("theme.save.submit","Save")})]})]})}dr(),Lr();function A65(){const{t:e}=Xt("inspector"),t=fBo(),r=aO(),n=qyt(),a=OIo(),d=fd(),[p,h]=(0,ie.useState)(!1),[f,m]=(0,ie.useState)(!1);return(0,C.jsxs)(G.Container,{sx:{padding:"0!important",paddingTop:"1rem!important",display:"flex",flexDirection:"column",flex:"1 0 auto",minHeight:"100%"},children:[!d&&(0,C.jsxs)(G.Stack,{direction:"row",sx:{mb:2,flexWrap:"wrap",gap:1,alignItems:"center",justifyContent:"space-between"},children:[(0,C.jsx)(G.Typography,{sx:{fontWeight:"bold",color:"text.primary",fontSize:"1.25rem"},children:e("styles.rootTitle")}),r&&(0,C.jsxs)(G.Stack,{direction:"row",spacing:.5,sx:{width:"100%",ml:"0!important"},children:[a&&(0,C.jsx)(G.Tooltip,{title:e("theme.exportTooltip","Save current theme to the gallery"),children:(0,C.jsx)(G.Button,{size:"small",variant:"outlined",startIcon:(0,C.jsx)(qe.BookmarkAddOutlined,{fontSize:"small"}),onClick:()=>h(!0),children:e("theme.exportButton","Theme")})}),n&&(0,C.jsx)(G.Tooltip,{title:e("componentsLibrary.saveTemplate.tooltip","Save the current document as a reusable template"),children:(0,C.jsx)(G.Button,{size:"small",variant:"outlined",startIcon:(0,C.jsx)(qe.FileDownloadOutlined,{fontSize:"small"}),onClick:()=>m(!0),children:e("componentsLibrary.saveTemplate.button","Template")})})]})]}),(0,C.jsxs)(G.Box,{children:[(0,C.jsx)(_65,{defaultExpanded:!0}),S95.map(v=>(0,C.jsx)(m65,{blockType:v,spec:cho[v],defaultExpanded:!1},v))]}),t&&(0,C.jsx)(G.Box,{color:"text.secondary",sx:{display:"flex",justifyContent:"flex-end",mt:"auto",pt:3,pb:3},children:d?(0,C.jsxs)(G.Link,{href:`https://www.npmjs.com/package/${Cz.name}`,target:"_blank",rel:"noopener noreferrer",sx:{fontSize:"0.75rem"},children:["v",Cz.version]}):(0,C.jsxs)(G.Box,{sx:{textAlign:"right"},children:[(0,C.jsxs)(G.Typography,{variant:"body2",children:[e("inputs.panels.emailLayout.version"),": ",Cz.version]}),(0,C.jsx)(G.Link,{href:`https://www.npmjs.com/package/${Cz.name}`,target:"_blank",rel:"noopener noreferrer",sx:{fontSize:"0.875rem",mt:.5,display:"inline-block"},children:Cz.name})]})}),(0,C.jsx)(b65,{open:p,onClose:()=>h(!1)}),(0,C.jsx)(mf5,{open:f,onClose:()=>m(!1)})]})}Lr();function y65(){const e=iO(),t=tho(e??"root"),r=(0,ie.useCallback)(d=>{e&&bz(e,()=>d)},[e]);if(!t)return null;const{data:n,type:a}=t;switch(a){case"Container":return(0,C.jsx)(mho,{data:n,setData:d=>r({type:a,data:d})},e);case"Divider":return(0,C.jsx)(vho,{data:n,setData:d=>r({type:a,data:d})},e);case"Spacer":return(0,C.jsx)(yho,{data:n,setData:d=>r({type:a,data:d})},e);case"EmailLayout":return(0,C.jsx)(A65,{});default:return(0,C.jsx)("pre",{children:JSON.stringify(t,null," ")})}}dr(),v5(),R4e(),Lr();function S65({sticky:e,heightContent:t}){const r=X6(),n=vF(),a=iO(),d=ll(),p=gF(),h=(0,G.useTheme)(),{t:f}=Xt("inspector");(0,ie.useEffect)(()=>{const x=O=>{const w=O.target;Qyt(w.innerWidth)};return window&&Qyt(window.innerWidth),window.addEventListener("resize",x),()=>{window.removeEventListener("resize",x)}},[r]);const m=()=>{const x={position:"absolute",top:"1rem",right:"0.5rem",color:"primary.main",fontSize:"20px",cursor:"pointer",display:S?"none":void 0},O=()=>ev(d==="desktop"?"mobile":"desktop");return r==="block-configuration"||r==="css"||S&&a&&!bg.includes(n||"")?(0,C.jsxs)("div",{style:{position:"relative",display:"flex",flexDirection:"column",flex:"1 0 auto"},children:[d==="desktop"?(0,C.jsx)(qe.MonitorOutlined,{sx:x,onClick:O}):(0,C.jsx)(qe.PhoneIphoneOutlined,{sx:x,onClick:O}),(0,C.jsx)(U95,{})]}):(0,C.jsxs)("div",{style:{position:"relative",display:"flex",flexDirection:"column",flex:"1 0 auto"},children:[(0,C.jsx)(y65,{}),d==="desktop"?(0,C.jsx)(qe.MonitorOutlined,{sx:x,onClick:O}):(0,C.jsx)(qe.PhoneIphoneOutlined,{sx:x,onClick:O})]})},v=()=>(0,C.jsx)("svg",{style:{marginRight:"4px",color:"inherit"},width:"21",height:"20",viewBox:"0 0 21 20",fill:"none",children:(0,C.jsx)("path",{d:"M3.83398 5H17.1673M3.83398 10H17.1673M3.83398 15H9.66732",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),g=()=>(0,C.jsx)("svg",{style:{marginRight:"4px",color:"inherit"},width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:(0,C.jsx)("path",{d:"M5.83333 17.5C3.99238 17.5 2.5 16.0076 2.5 14.1667V4.16667C2.5 3.24619 3.24619 2.5 4.16667 2.5H7.5C8.42047 2.5 9.16667 3.24619 9.16667 4.16667V14.1667C9.16667 16.0076 7.67428 17.5 5.83333 17.5ZM5.83333 17.5H15.8333C16.7538 17.5 17.5 16.7538 17.5 15.8333V12.5C17.5 11.5795 16.7538 10.8333 15.8333 10.8333H13.8807M9.16669 6.11927L10.5474 4.73858C11.1983 4.0877 12.2535 4.0877 12.9044 4.73858L15.2614 7.0956C15.9123 7.74647 15.9123 8.80175 15.2614 9.45262L8.19036 16.5237M5.83333 14.1667H5.84167",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),A=(x,O)=>{HIo(O)},y=e?t?`calc(${t} - 4px)`:void 0:t??void 0,S=p==="compact";return(0,C.jsx)(_m5,{value:S,children:(0,C.jsxs)(G.Container,{sx:x=>({width:S?56:385,padding:"0!important",margin:"0!important",height:y,maxHeight:y,display:"flex",flexDirection:"column",overflow:"hidden",position:e?"sticky":"static",top:e?Vyt:0,backgroundColor:`${x.palette.background.paper} !important`}),children:[(0,C.jsx)(G.Box,{sx:{position:"sticky",top:0,zIndex:1,backgroundColor:`${h.palette.background.paper} !important`,display:S?"none":void 0},children:(0,C.jsxs)(G.Tabs,{sx:{backgroundColor:`${h.palette.background.paper} !important`},value:r,onChange:A,children:[a!=null&&!bg.includes(n||"")&&[(0,C.jsx)(G.Tab,{sx:{height:"50px",minHeight:"50px",fontWeight:"bold"},value:"block-configuration",label:f("header.content"),icon:(0,C.jsx)(v,{}),iconPosition:"start"},"block-configuration"),(0,C.jsx)(G.Tab,{sx:{height:"50px",minHeight:"50px",fontWeight:"bold"},value:"css",label:f("header.styles"),icon:(0,C.jsx)(g,{}),iconPosition:"start"},"css")],a!=null&&bg.includes(n)&&[(0,C.jsx)(G.Tab,{sx:{height:"50px",minHeight:"50px",fontWeight:"bold"},value:"styles",label:f("header.styles"),icon:(0,C.jsx)(g,{}),iconPosition:"start"},"styles")],a==null&&(0,C.jsx)(G.Tab,{sx:{height:"50px",minHeight:"50px",fontWeight:"bold"},value:"styles",label:f("header.styles"),icon:(0,C.jsx)(g,{}),iconPosition:"start"},"styles")]})}),(0,C.jsx)(G.Container,{sx:x=>({flex:"1 1 auto",minHeight:0,overflowY:"auto",display:"flex",flexDirection:"column",px:S?"0.5rem!important":"1rem!important",backgroundColor:`${x.palette.background.paper} !important`}),children:m()})]})})}var xho=({children:e,topOffset:t=0,zIndex:r=10,className:n="",style:a={},disabled:d=!1,threshold:p=null,...h})=>{const[f,m]=(0,ie.useState)(!1),[v,g]=(0,ie.useState)({width:0,height:0}),[A,y]=(0,ie.useState)({left:0}),[S,x]=(0,ie.useState)(0),[O,w]=(0,ie.useState)(!1),E=(0,ie.useRef)(null),L=(0,ie.useRef)(null),H=(0,ie.useRef)(null);(0,ie.useEffect)(()=>{if(d){m(!1),w(!1),x(0);return}const U=L.current,I=E.current;if(!U||!I)return;let $=null;p&&(p.startsWith("#")?$=document.getElementById(p.slice(1)):(p.startsWith("."),$=document.querySelector(p)));const Q=()=>{const oe=I.getBoundingClientRect();g({width:oe.width,height:oe.height}),y({left:oe.left})},K=()=>{if(!$||!I)return{offset:0,isPushed:!1};const oe=$.getBoundingClientRect(),le=I.getBoundingClientRect(),X=t+le.height;if(oe.top<X){const se=X-oe.top,Ae=le.height+20;return{offset:-Math.min(se,Ae),isPushed:!0}}return{offset:0,isPushed:!1}},Y=new IntersectionObserver(([oe])=>{const le=!oe.isIntersecting;if(le&&!f&&Q(),m(le),le&&p){const{offset:X,isPushed:se}=K();x(X),w(se)}else le||(x(0),w(!1))},{threshold:0,rootMargin:`-${t}px 0px 0px 0px`}),ee=new ResizeObserver(()=>{Q()}),re=()=>{if(p&&f){const{offset:oe,isPushed:le}=K();x(oe),w(le)}};return Y.observe(U),ee.observe(I),p&&window.addEventListener("scroll",re,{passive:!0}),Q(),()=>{Y.disconnect(),ee.disconnect(),p&&window.removeEventListener("scroll",re)}},[t,f,d,p]);const V=!d&&f,F=V?`${t+S}px`:"auto";return(0,C.jsxs)("div",{ref:H,className:n,...h,children:[!d&&(0,C.jsx)("div",{ref:L,style:{height:"1px",position:"absolute",top:`-${t+1}px`,left:0,right:0,pointerEvents:"none"}}),V&&(0,C.jsx)("div",{style:{height:`${v.height}px`,width:`${v.width}px`}}),(0,C.jsx)("div",{ref:E,style:{position:V?"fixed":"static",top:F,width:"auto",height:"auto",zIndex:V?r:"auto",transition:O?"none":"box-shadow 0.2s ease-in-out, top 0.3s ease-out",...O&&S<-v.height*.3&&{opacity:Math.max(0,1+(S+v.height*.3)/(v.height*.7))},...a},children:e})]})};dr(),x3e(),Lr();function T65(){const e=k4e(),t=gF(),{t:r}=Xt("inspector");if(!e)return null;const n=()=>I4e(t==="full"?"compact":"full"),a=t==="compact";return(0,C.jsx)(G.Box,{sx:{position:"absolute",left:0,top:"50%",transform:"translateX(-100%) translateY(-50%)",zIndex:10},children:(0,C.jsx)(G.Tooltip,{title:a?r("inspector.handle.expand","Expand panel"):r("inspector.handle.compact","Compact panel"),placement:"left",children:(0,C.jsx)(G.ButtonBase,{onClick:n,sx:d=>({width:24,minHeight:80,borderTopLeftRadius:8,borderBottomLeftRadius:8,backgroundColor:a?d.palette.primary.main:d.palette.background.paper,color:a?d.palette.primary.contrastText:d.palette.text.secondary,border:`1px solid ${d.palette.divider}`,borderRight:"none",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:.5,py:1,boxShadow:"-2px 0 6px rgba(0,0,0,0.04)",transition:"background-color 120ms ease, color 120ms ease","&:hover":{backgroundColor:a?d.palette.primary.dark:d.palette.mode==="dark"?d.palette.grey[800]:d.palette.grey[200]}}),children:(0,C.jsx)(EF,{sx:{fontSize:16}})})})})}var Cho=e=>Symbol.iterator in e,Oho=e=>"entries"in e,who=(e,t)=>{const r=e instanceof Map?e:new Map(e.entries()),n=t instanceof Map?t:new Map(t.entries());if(r.size!==n.size)return!1;for(const[a,d]of r)if(!n.has(a)||!Object.is(d,n.get(a)))return!1;return!0},x65=(e,t)=>{const r=e[Symbol.iterator](),n=t[Symbol.iterator]();let a=r.next(),d=n.next();for(;!a.done&&!d.done;){if(!Object.is(a.value,d.value))return!1;a=r.next(),d=n.next()}return!!a.done&&!!d.done};function C65(e,t){return Object.is(e,t)?!0:typeof e!="object"||e===null||typeof t!="object"||t===null||Object.getPrototypeOf(e)!==Object.getPrototypeOf(t)?!1:Cho(e)&&Cho(t)?Oho(e)&&Oho(t)?who(e,t):x65(e,t):who({entries:()=>Object.entries(e)},{entries:()=>Object.entries(t)})}function O65(e){const t=ie.useRef(void 0);return r=>{const n=e(r);return C65(t.current,n)?t.current:t.current=n}}hh(),Lr();function UKe({children:e}){const t=ll(),r=D4e(),n=kIo();return(0,C.jsx)(fNe,{value:t,children:(0,C.jsx)(nNe,{value:AF()??null,children:(0,C.jsx)(ieo,{value:r,children:(0,C.jsx)(leo,{value:n,children:(0,C.jsx)(ueo,{value:w65,children:e})})})})})}function w65(e,t){bBo(e,{...Ke.getState().document[e]?.data?.props??{},width:t})}function j65(e){return typeof ReadableStream<"u"&&e instanceof ReadableStream?(async function*(){const t=e.getReader(),r=new TextDecoder;try{for(;;){const{value:n,done:a}=await t.read();if(a){const d=r.decode();d&&(yield d);return}n!==void 0&&(typeof n=="string"?yield n:yield r.decode(n,{stream:!0}))}}finally{t.releaseLock()}})():e}function*jho(e){const t=e.split(`
|
|
1461
1461
|
`);let r=null;const n=[];for(const p of t)if(p.length!==0&&!p.startsWith(":")){if(p.startsWith("event:")){r=p.slice(6).trimStart();continue}if(p.startsWith("data:")){const h=p.slice(5);n.push(h.startsWith(" ")?h.slice(1):h);continue}}const a=n.join(`
|
|
1462
1462
|
`);if(a.length===0)return;const d=e.length;if(a==="[DONE]"){yield{kind:"done",raw:e,bytes:d};return}if(r==="error"){let p=a;try{p=JSON.parse(a)}catch{}yield{kind:"error",payload:p,raw:e,bytes:d};return}if(r==="warning"){let p=a;try{p=JSON.parse(a)}catch{}yield{kind:"warning",payload:p,raw:e,bytes:d};return}if(r==="info"){let p=a;try{p=JSON.parse(a)}catch{}yield{kind:"info",payload:p,raw:e,bytes:d};return}try{const p=JSON.parse(a);if(typeof p.id!="string"||typeof p.block!="object"||p.block===null){yield{kind:"malformed",raw:e,reason:"Missing or invalid {id, block} payload",bytes:d};return}yield{kind:"block",id:p.id,block:p.block,raw:e,bytes:d}}catch(p){yield{kind:"malformed",raw:e,reason:p instanceof Error?p.message:"Invalid JSON",bytes:d}}}async function*M65(e){const t=j65(e);let r="";for await(const a of t){r+=a,r=r.replace(/\r\n/g,`
|
|
1463
1463
|
`);let d;for(;(d=r.indexOf(`
|